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