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