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