Prototyped.
[unix-history] / usr / src / usr.bin / vgrind / vgrind.1
CommitLineData
14e25837 1.\" Copyright (c) 1980 ,1990 The Regents of the University of California.
616af90a 2.\" All rights reserved.
9005ce62 3.\"
75fa9140
EA
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
616af90a 19.\"
75fa9140
EA
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
9005ce62 31.\"
75fa9140
EA
32.\" @(#)vgrind.1 6.5 (Berkeley) 8/6/92
33.\"
34.Dd August 6, 1992
14e25837
CL
35.Dt VGRIND 1
36.Os BSD 4
37.Sh NAME
38.Nm vgrind
39.Nd grind nice listings of programs
40.Sh SYNOPSIS
41.Nm vgrind
42.Op Fl
43.Op Fl W
44.Op Fl d Ar file
45.Op Fl f
46.Op Fl h Ar header
47.Op Fl l Ar language
48.Op Fl n
49.Op Fl sn
50.Op Fl t
51.Op Fl x
52.Ar name Ar ...
53.Sh DESCRIPTION
54.Nm Vgrind
4a9bc47c 55formats the program sources which are arguments
9005ce62 56in a nice style using
14e25837 57.Xr troff 1
4a9bc47c 58Comments are placed in italics, keywords in bold face,
9005ce62
KM
59and the name of the current function is listed down the margin of each
60page as it is encountered.
14e25837
CL
61.Pp
62.Nm Vgrind
63runs in two basic modes, filter mode (see the
64.Fl f
65option) or regular mode. In filter mode
66.Nm vgrind
4a9bc47c 67acts as a filter in a manner similar to
14e25837 68.Xr tbl 1 .
4a9bc47c
KM
69The standard input is passed directly to the standard output except
70for lines bracketed by the
14e25837 71.Em troff-like
4a9bc47c 72macros:
14e25837
CL
73.Bl -tag -width Ds
74.It \&.vS
75starts processing
76.It \&.vE
77ends processing
78.El
79.Pp
4a9bc47c
KM
80These lines are formatted as described above. The output from this
81filter can be passed to
14e25837 82.Xr troff
4a9bc47c 83for output. There need be no particular ordering with
14e25837 84.Xr eqn 1
4a9bc47c 85or
14e25837
CL
86.Xr tbl 1 .
87.Pp
4a9bc47c 88In regular mode
14e25837 89.Nm vgrind
4a9bc47c 90accepts input files, processes them, and passes them to
14e25837 91.Xr troff 1
4a9bc47c 92for output.
14e25837 93.Pp
4a9bc47c 94In both modes
14e25837 95.Nm vgrind
4a9bc47c 96passes any lines beginning with a decimal point without conversion.
14e25837 97.Pp
4a9bc47c 98The options are:
14e25837
CL
99.Bl -tag -width Ar
100.It Fl
4a9bc47c 101forces input to be taken from standard input (default if
14e25837 102.Fl f
4a9bc47c 103is specified )
14e25837
CL
104.It Fl W
105forces output to the (wide) Versatec printer rather than the (narrow)
106Varian
107.It Fl d Ar file
108specifies an alternate language definitions
109file (default is
110.Pa /usr/share/misc/vgrindefs )
111.It Fl f
112forces filter mode
113.It Fl h Ar header
114specifies a particular header to put on every output page (default is
115the file name)
116.It Fl l
117specifies the language to use. Currently known are
118.Tn PASCAL
119.Pq Fl l Ns Ar p ,
120.Tn MODEL
121.Pq Fl l Ns Ar m ,
122C
123.Pf ( Fl l Ns Ar c
124or the default),
125.Tn CSH
126.Pq Fl l Ns Ar csh ,
127.Tn SHELL
128.Pq Fl l Ns Ar sh ,
129.Tn RATFOR
130.Pq Fl l Ns Ar r ,
131.Tn MODULA2
132.Pq Fl l Ns Ar mod2 ,
133.Tn YACC
134.Pq Fl l Ns Ar yacc ,
135.Tn LISP
136.Pq Fl l Ns Ar isp ,
137and
138.Tn ICON
139.Pq Fl l Ns Ar I .
140.It Fl n
141forces no keyword bolding
142.It Fl s
143specifies a point size to use on output (exactly the same as the argument
144of a .ps)
145.It Fl t
4a9bc47c 146similar to the same option in
14e25837 147.Xr troff
4a9bc47c 148causing formatted text to go to the standard output
14e25837 149.It Fl x
4a9bc47c
KM
150outputs the index file in a ``pretty'' format.
151The index file itself is produced whenever
14e25837 152.Nm vgrind
4a9bc47c 153is run with a file called
14e25837 154.Pa index
4a9bc47c
KM
155in the current directory.
156The index of function
157definitions can then be run off by giving
14e25837 158.Nm vgrind
9005ce62 159the
14e25837 160.Fl x
9005ce62 161option and the file
14e25837 162.Pa index
9005ce62 163as argument.
14e25837
CL
164.El
165.Sh FILES
166.Bl -tag -width /usr/share/misc/vgrindefsxx -compact
167.It Pa index
168file where source for index is created
169.It Pa /usr/share/tmac/tmac.vgrind
170macro package
171.It Pa /usr/libexec/vfontedpr
172preprocessor
173.It Pa /usr/share/misc/vgrindefs
174language descriptions
175.El
176.Sh SEE ALSO
75fa9140 177.Xr getcap 3 ,
14e25837
CL
178.Xr vgrindefs 5
179.Sh BUGS
9005ce62 180Vfontedpr assumes that a certain programming style is followed:
14e25837 181.Pp
9005ce62 182For
14e25837 183.Tn C
4a9bc47c
KM
184\- function names can be preceded on a line only by spaces, tabs, or an
185asterisk. The parenthesized arguments must also be on the same line.
14e25837 186.Pp
9005ce62 187For
14e25837 188.Tn PASCAL
4a9bc47c 189\- function names need to appear on the same line as the keywords
14e25837 190.Em function
4a9bc47c 191or
14e25837
CL
192.Em procedure .
193.Pp
9005ce62 194For
14e25837 195.Tn MODEL
4a9bc47c 196\- function names need to appear on the same line as the keywords
14e25837
CL
197.Em is beginproc .
198.Pp
9005ce62
KM
199If these conventions are not followed, the indexing and marginal function
200name comment mechanisms will fail.
14e25837 201.Pp
9005ce62
KM
202More generally, arbitrary formatting styles for programs mostly look bad.
203The use of spaces to align source code fails miserably; if you plan to
14e25837 204.Nm vgrind
9005ce62
KM
205your program you should use tabs. This is somewhat inevitable since the
206font used by
14e25837 207.Nm vgrind
9005ce62 208is variable width.
14e25837
CL
209.Pp
210The mechanism of
211.Xr ctags 1
212in recognizing functions should be used here.
213.Pp
214Filter mode does not work in documents using the
215.Fl me
216or
217.Fl ms
218macros.
6d2470eb 219(So what use is it anyway?)
14e25837
CL
220.Sh HISTORY
221The
222.Nm
223command appeared in
224.Bx 3.0 .