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