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