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