VGRIND(1)

πŸ“¦ version 191015, in alpine 3.24

✨ VGRIND(1) ✨

Hey bestie! This is VGRIND(1), from BSD System Compatibility β€” and it's literally all about grinding out the cutest listings of your programs πŸ’…


🌸 NAME 🌸

vgrind β€” grind nice listings of programs ✨


πŸŽ€ SYNOPSIS πŸŽ€

vgrind [-2ftnxw] [-sn] [-h header] [-d file] [-l language] [-P printer]
       [-T device] [-o list] name ...

πŸ’– DESCRIPTION πŸ’–

Okay so vgrind formats the program sources you pass as arguments into a super nice style using troff(1). Comments go in italics, keywords go in bold face, and the name of the current function gets listed down the margin of every page as it's encountered. Iconic behavior, honestly 🫢

vgrind runs in two basic modes: filter mode or regular mode.

In filter mode, vgrind acts as a filter kinda like tbl(1). Standard input gets passed directly to standard output except for lines bracketed by these troff-like macros:

  • .vS β€” starts processing
  • .vE β€” ends processing

Those bracketed lines get formatted as described above. The output from this filter can be passed to troff for output. And there's no need for any particular ordering with eqn(1) or tbl(1) β€” no cap.

In regular mode, vgrind accepts input files, processes them, and passes them to troff(1) for output.

In both modes, vgrind passes any lines beginning with a decimal point without conversion πŸ‘€


⭐ The Options

  • -2 β€” produce two-column output, slay πŸ’…
  • -f β€” forces filter mode
  • -t β€” similar to the same option in troff, causing formatted text to go to the standard output
  • -n β€” forces no keyword bolding
  • -x β€” outputs the index file in a β€œpretty” format. The index file itself is produced whenever vgrind is run with a file called index in the current directory. The index of function definitions can then be run off by giving vgrind the -x option and the file index as argument. So cute πŸŽ€
  • -s β€” specifies a point size to use on output (exactly the same as the argument of a .ps)
  • -h β€” specifies a particular header to put on every output page (default is the file name)
  • -d β€” specifies an alternate language definitions file (default is /usr/lib/vgrindefs)
  • -l β€” specifies the language to use. Currently known are PASCAL (-lp), MODEL (-lm), C (-lc or the default), C++ (-lc++), CSH (-lcsh), SHELL (-lsh), RATFOR (-lr), MODULA2 (-lmod2), YACC (-lyacc), ISP (-lisp), and ICON (-lI). So many languages, we love a multilingual icon 🌈
  • -P β€” specifies that output is directed to the named printer
  • -T β€” is passed to troff and specifies the device to use
  • -o β€” is passed to troff and specifies selected pages to print
  • -w β€” sets the size of tabulators to four instead of the default eight

πŸ“ FILES πŸ“

  • index β€” file where source for index is created
  • /usr/share/heirloom-doctools/tmac/vgrind β€” macro package
  • /usr/lib/heirloom-doctools/vfontedpr β€” preprocessor
  • /usr/lib/heirloom-doctools/vgrindefs β€” language descriptions

πŸ‘€ SEE ALSO πŸ‘€

troff(1) β€” go check it out bestie, they're like this 🀝


⚠️ NOTES ⚠️

Okay so vfontedpr assumes a certain programming style is followed, and if you don't follow it, things get messy 😭

For C and 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.
For PASCAL β€” function names need to appear on the same line as the keywords function or procedure.
For MODEL β€” function names need to appear on the same line as the keywords is beginproc.

If these conventions are not followed, the indexing and marginal function name comment mechanisms will fail. So like, don't do that πŸ’€

More generally, arbitrary formatting styles for programs mostly look bad. The use of spaces to align source code fails miserably; if you plan to vgrind your program you should use tabs. This is somewhat inevitable since the font used by vgrind is variable width. It's giving "aesthetic but make it functional" ✨

The mechanism of ctags in recognizing functions should be used here.

Filter mode does not work in documents using the -me or -ms macros. (So what use is it anyway?) πŸ™ˆ

Written by Dave Presotto & William Joy. Respect the OGs πŸ‘‘


This page is from the 4th Berkeley Distribution, dated 11/6/05, and it's VGRIND(1) β€” periodt πŸ’–πŸ

πŸ“¦ where this page comes from