GROFFER(1)

πŸ“¦
version 1.22.4 Β· 2 versions
, in ubuntu jammy

okay bestie, welcome to GROFFER(1) from the General Commands Manual 🫢 this one's a big girl, so buckle up β€” but she's so worth it, fr fr.

🌸 NAME 🌸

groffer β€” display groff files and man pages on X and tty ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

groffer [mode-option ...] [groff-option ...] [man-option ...] [X-option
        ...] [--] [filespec ...]

groffer -h
groffer --help

groffer -v
groffer --version

πŸ’– DESCRIPTION πŸ’–

groffer is literally the easiest way to use groff(1) πŸ’… It can display arbitrary documents written in the groff language, see groff(7), or other roff languages, see roff(7), that are compatible to the original troff language. And the way it finds and runs all the necessary groff preprocessors for you, such as chem? no notes, queen behavior.

The groffer program also includes many of the features for finding and displaying the Unix manual pages (man pages), such that it can be used as a replacement for a man(1) program πŸ‘‘ Moreover, compressed files that can be handled by gzip(1) or bzip2(1) are decompressed on-the-fly πŸŽ€

The normal usage is quite simple β€” just supply a file name or name of a man page without further options. But the option handling has many possibilities for creating special behaviors. This can be done either in configuration files, with the shell environment variable GROFFER_OPT, or on the command line.

The output can be generated and viewed in several different ways available for groff. This includes the X Window System-based groff program gxditview(1), each PostScript, PDF, or DVI display program, a web browser by generating HTML or XHTML in www mode, or several text modes in text terminals 🌈

Most of the options that must be named when running groff directly are determined automatically for groffer, due to the internal usage of the grog(1) program ✨ But all parts can also be controlled manually by arguments.

Several file names can be specified on the command-line arguments. They are transformed into a single document in the normal way of groff.

Option handling is done in GNU style. Options and file names can be mixed freely. The option -- closes the option handling, all following arguments are treated as file names. Long options can be abbreviated in several ways πŸ‘€


πŸ’… OPTION OVERVIEW πŸ’…

breaking options

[-h | --help] [-v | --version]

groffer mode options

[--auto] [--default] [--default-modes mode1,mode2,...] [--dvi]
[--groff] [--html] [--latin1] [--mode display_mode] [--pdf]
[--pdf2] [--ps] [--source] [--text] [--to-stdout] [--tty]
[--utf8] [--viewer prog] [--www] [--xhtml] [--x | --X]
[-T | --device device] [-Z | --intermediate-output | --ditroff]

All further groff short options are accepted 🫢

options for man pages

[--apropos] [--apropos-data] [--apropos-devel] [--apropos-progs]
[--man] [--no-man] [--no-special] [--whatis]

long options taken over from GNU man

[--all] [--ascii] [--ditroff] [--extension suffix]
[--locale language] [--local-file] [--location | --where]
[--manpath dir1:dir2:...] [--no-location] [--pager program]
[--sections sec1:sec2:...] [--systems sys1,sys2,...]
[--troff-device device]

Further long options of GNU man are accepted as well ✨

options mapped to X Window System Toolkit Intrinsics options

[--bd | --bordercolor pixels] [--bg | --background color]
[--bw | --borderwidth pixels] [--display X-display]
[--fg | --foreground color] [--fn | --ft | --font font_name]
[--geometry size_pos] [--resolution value] [--rv]
[--title string] [--xrm X-resource]

options for development

[--debug] [--debug-filenames] [--debug-grog] [--debug-keep]
[--debug-params] [--debug-tmpdir] [--do-nothing] [--print text]
[-V]

filespec arguments

The filespec parameters are all arguments that are neither an option nor an option argument. They usually mean a file name or a man page searching scheme.

In the following, the term section_extension is used. It means a word that consists of a man section that is optionally followed by an extension. The name of a man section is a single character from [1–9on], the extension is some word. The extension is mostly lacking πŸ™ˆ

No filespec parameters means standard input.

  • - β€” stands for standard input (can occur several times).
  • filename β€” the path name of an existing file.
  • man:name(section_extension)
  • man:name.section_extension
  • name(section_extension)
  • name.section_extension
  • section_extension name β€” search the man page name in the section with optional extension section_extension.
  • man:name β€” man page in the lowest man section that has name.
  • name β€” if name is not an existing file search for the man page name in the lowest man section.

πŸ‘‘ OPTION DETAILS πŸ‘‘

The groffer program can usually be run with very few options. But for special purposes, it supports many options. These can be classified in 5 option classes.

All short options of groffer are compatible with the short options of groff(1). All long options of groffer are compatible with the long options of man(1) πŸ’–

Arguments for long option names can be abbreviated in several ways. First, the argument is checked whether it can be prolonged as is. Furthermore, each minus sign - is considered as a starting point for a new abbreviation. This leads to a set of multiple abbreviations for a single argument. For example, --de-n-f can be used as an abbreviation for --debug-not-func, but --de-n works as well πŸ‘€ If the abbreviation of the argument leads to several resulting options an error is raised.

bestie listen β€” these abbreviations are only allowed in the environment variable GROFFER_OPT, but not in the configuration files. In configuration, all long options must be exact. no shortcuts, periodt πŸ’…

πŸŽ€ groffer breaking Options πŸŽ€

As soon as one of these options is found on the command line it is executed, printed to standard output, and the running groffer is terminated thereafter. All other arguments are ignored πŸ’€

  • -h, --help β€” Print help information with a short explanation of options to standard output.
  • -v, --version β€” Print version information to standard output.

🌈 groffer Mode Options 🌈

The display mode and the viewer programs are determined by these options. If none of these mode and viewer options is specified groffer tries to find a suitable display mode automatically. The default modes are mode pdf, mode ps, mode html, mode xhtml, mode x, and mode dvi in the X Window System with different viewers and mode tty with device utf8 under less on a terminal; other modes are tested if the programs for the main default mode do not exist.

In the X Window System, many programs create their own window when called. groffer can run these viewers as an independent program in the background πŸ¦‹ As this does not work in text mode on a terminal (tty) there must be a way to know which viewers are X Window System-based graphical programs. The groffer script has a small amount of information on some viewer names. If a viewer argument of the command-line chooses an element that is recognized as an X Window System-based program in this list, it is treated as a viewer that can run in the background. Unrecognized viewers are not run in the background πŸ™ˆ

For each mode, you are free to choose whatever viewer you want. That need not be some graphical viewer suitable for this mode. There is a chance to view the output source; for example, the combination of the options --mode=ps and --viewer=less shows the content of the PostScript output, the source code, with the pager less πŸ‘‘

  • --auto β€” Equivalent to --mode=auto.
  • --default β€” Reset all configuration from previously processed command-line options to the default values. This is useful to wipe out all former options of the configuration, in GROFFER_OPT, and restart option processing using only the rest of the command line.
  • --default-modes mode1,mode2,... β€” Set the sequence of modes for auto mode to the comma separated list given in the argument. See --mode for details on modes. Display in the default manner; actually, this means to try the modes x, ps, and tty in this sequence.
  • --dvi β€” Equivalent to --mode=dvi. Known DVI viewers for the X Window System include xdvi(1) and dvilx(1).
  • --groff β€” Equivalent to --mode=groff.
  • --html β€” Equivalent to --mode=html.
  • --mode value β€” Set the display mode. The following mode values are recognized:
    • auto β€” Select the automatic determination of the display mode. The sequence of modes that are tried can be set with the --default-modes option. Useful for restoring the default mode when a different mode was specified before.
    • dvi β€” Display formatted input in a DVI viewer program. By default, the formatted input is displayed with the xdvi(1) program.
    • groff β€” After the file determination, switch groffer to process the input like groff(1) would do. This disables the groffer viewing features.
    • html β€” Translate the input into HTML format and display the result in a web browser program. By default, the existence of a sequence of standard web browsers is tested, starting with konqueror(1) and mozilla(1). The text HTML viewer is lynx(1). By default, the existence of a sequence of standard web browsers is tested, starting with konqueror(1) and mozilla(1). The text HTML viewer is lynx(1). (yes she said it twice, that's canon πŸ’€)
    • pdf β€” Transform roff input files into a PDF file by using the groff (1) device -Tpdf. This is the default PDF generator. The generated PDF file is displayed with suitable viewer programs, such as okular(1).
    • pdf2 β€” This is the traditional pdf mode. Sometimes this mode produces more correct output than the default PDF mode. By default, the input is formatted by groff using the PostScript device, then it is transformed into the PDF file format using gs(1), or ps2pdf(1). If that's not possible, the PostScript mode (ps) is used instead. Finally it is displayed using different viewer programs.
    • ps β€” Display formatted input in a PostScript viewer program. By default, the formatted input is displayed in one of many viewer programs.
  • text β€” formats in a groff text mode and drops the result straight to standard output, no pager, no viewer, no drama. The text device is latin1 by default, but you can pick a different one with option -T. πŸ’–
  • tty β€” formats in a groff text mode and writes the result to standard output using a text pager program β€” even when you're sitting in the X Window System, bestie. It does not care. ✨
  • www β€” literally equivalent to --mode=html. Same vibe, different spelling. πŸ¦‹
  • x β€” displays the formatted input in a native roff viewer. By default that's the gxditview(1) program that ships together with groff. But the legacy X Window System application xditview(1) can also be chosen with the option --viewer. The default resolution is 75dpi, but 100dpi is also possible. The default groff device for the resolution of 75dpi is X75-12, and for 100dpi it is X100. The corresponding groff intermediate output for the actual device gets generated, and then the result is displayed. And for a resolution of 100dpi, the default width of the geometry of the display program is chosen to 850dpi. πŸ‘‘
  • X β€” equivalent to --mode=x. Same thing, capital energy. πŸ’…
  • xhtml β€” translates the input into XHTML format, which is the XML version of HTML. Then it displays the result in a web browser program β€” mostly the known HTML viewers. 🌈

Okay so the following modes do not use the groffer viewing features. They're only interesting for advanced applications. You've been warned, and honestly, respect. πŸ’œ

  • groff β€” generates device output with plain groff, without using the special viewing features of groffer. If no device was specified by option -T, the groff default ps is assumed. πŸ“„
  • source β€” outputs the roff source code of the input files, no further processing whatsoever. Raw. Unfiltered. Iconic. πŸŽ€

  • --pdf β€” equivalent to --mode=pdf.
  • --pdf2 β€” equivalent to --mode=pdf2.
  • --ps β€” equivalent to --mode=ps. Common PostScript viewers include okular(1), evince(1), gv(1), ghostview(1), and gs(1). In each case, arguments can be provided additionally. πŸ–¨οΈ
  • --source β€” equivalent to --mode=source.
  • --text β€” equivalent to --mode=text.
  • --to-stdout β€” the file for the chosen mode gets generated and its content is printed to standard output. It will not be displayed in graphical mode. 😌
  • --tty β€” equivalent to --mode=tty. The standard pager is less(1). This option is equivalent to the man option --pager=prog. The option argument can be a file name or a program to be searched in $PATH; arguments can be provided additionally. 🫢
  • --viewer prog β€” choose a viewer program for the actual device or mode. This can be a file name or a program to be searched in $PATH; arguments can be provided additionally.
  • --www β€” equivalent to --mode=html.
  • --X | --x β€” equivalent to --mode=x. Suitable viewer programs are gxditview(1), which is the default, and xditview(1). ✨
  • -- β€” signals the end of option processing; all remaining arguments are interpreted as filespec parameters. Everything after this is just files, no cap. πŸ’€

Besides these, groffer accepts all short options that are valid for the groff(1) program. All non-groffer options are sent unmodified via grog to groff. So postprocessors, macro packages, compatibility with classical troff, and much more can be manually specified. The range of possibilities is genuinely huge. 🌸


All short options of groffer are compatible with the short options of groff(1). The following groff options have either an additional special meaning within groffer or make sense for normal usage.

Because of the special outputting behavior of the groff option -Z, groffer was designed to be switched into groff mode; the groffer viewing features are disabled there. The other groff options do not switch the mode, but they allow you to customize the formatting process. πŸŽ€

  • --a β€” this generates an ASCII approximation of output in the text modes. That could be important when the text pager has problems with control sequences in tty mode.
  • --m file β€” add file as a groff macro file. This is useful in case it cannot be recognized automatically. πŸ”
  • --P opt_or_arg β€” send the argument opt_or_arg as an option or option argument to the actual groff postprocessor.
  • --T devname | --device devname β€” this option determines groff's output device. The most important devices are the text output devices for referring to the different character sets, such as ascii, utf8, latin1, utf8, and others. Each of these arguments switches groffer into a text mode using this device β€” to mode tty if the actual mode is not a text mode. The following devname arguments are mapped to the corresponding groffer --mode=devname option: dvi, html, xhtml, and ps. All X* arguments are mapped to mode x. Each other devname argument switches to mode groff using this device. πŸ‘‘
  • --X β€” is equivalent to groff -X. It displays the groff intermediate output with gxditview. As the quality is relatively bad this option is deprecated; use --X instead because the x mode uses an X* device for a better display.
ngl, that last line is exactly what the page says and it is sending me 😭 β€” deprecated option, bad quality, read it and move on bestie.
  • -Z | --intermediate-output | --ditroff β€” switch into groff mode and format the input with the groff intermediate output without postprocessing; see groff_out(5). This is equivalent to option --ditroff of man, which can be used as well. πŸ”₯

All other groff options are supported by groffer, but they are just transparently transferred to groff without any intervention. The options that are not explicitly handled by groffer are transparently passed to groff. Therefore these transparent options are not documented here, but in groff(1). Due to the automatism in groffer, none of these groff options should be needed, except for advanced usage. πŸ’…


πŸ“– Options for man pages πŸ“–

  • --apropos β€” start the apropos(1) command or facility of man(1) for searching the filespec arguments within all man page descriptions. Each filespec argument is taken for search as it is; section specific parts are not handled, such that 7 groff searches for the two arguments 7 and groff, with a large result; for the filespec groff.7 nothing will be found. The language locale is handled only when the called programs do support this; the GNU apropos and man -k do not. The display differs from the apropos program by the following concepts:
    • Construct a groff frame similar to a man page to the output of apropos,
    • each filespec argument is searched on its own.
    • The restriction by --sections is handled as well,
    • wildcard characters are allowed and handled without a further option.
  • --apropos-data β€” show only the apropos descriptions for data documents, these are the man(7) sections 4, 5, and 7. Direct section declarations are ignored, wildcards are accepted. πŸ“
  • --apropos-devel β€” show only the apropos descriptions for development documents, these are the man(7) sections 2, 3, and 9. Direct section declarations are ignored, wildcards are accepted. 🧚
  • --apropos-progs β€” show only the apropos descriptions for documents on programs, these are the man(7) sections 1, 6, and 8. Direct section declarations are ignored, wildcards are accepted. ⭐
  • --whatis β€” for each filespec argument search all man pages and display their description β€” or say that it is not a man page. This is written from anew, so it differs from man's whatis output by the following concepts:
    • each retrieved file name is added,
    • local files are handled as well,
    • the language and system locale is supported,
    • the display is framed by a groff output format similar to a man page,
    • wildcard characters are allowed without a further option.

The following options were added to groffer for choosing whether the file name arguments are interpreted as names for local files or as a search pattern for man pages. The default is looking up for local files. 🌸

  • --man β€” check the non-option command-line arguments (filespecs) first on being man pages, then whether they represent an existing file. By default, a filespec is first tested whether it is an existing file.
  • --no-man | --local-file β€” do not check for man pages. --local-file is the corresponding man option. πŸ™ˆ
  • --no-special β€” disable former calls of --all, --apropos*, and --whatis.

πŸ’– Long options taken over from GNU man πŸ’–

The long options of groffer were synchronized with the long options of GNU man. All long options of GNU man are recognized, but not all of these options are important to groffer, so most of them are just ignored. These ignored man options are --catman, --troff, and --update.

In the following, the man options that have a special meaning for groffer are documented.

If your system has GNU man installed, the full set of long and short options of the GNU man program can be passed via the environment variable MANOPT; see man(1). 🫢

  • --all β€” in searching man pages, retrieve all suitable documents instead of only one.
  • -7 | --ascii β€” in text modes, display ASCII translation of special characters for critical environment. This is equivalent to groff -mtty_char; see groff_tmac(5).
  • --ditroff β€” produce groff intermediate output. This is equivalent to groffer -Z. πŸ”₯
  • --extension suffix β€” restrict man page search to file names that have suffix appended to their section element. For example, in the file name /usr/share/man/man3/terminfo.3ncurses.gz the man page extension is ncurses.
  • --locale language β€” set the language for man pages. This has the same effect, but overwrites $LANG. 🌈
  • --location β€” print the location of the retrieved files to standard error.
  • --no-location β€” do not display the location of retrieved files; this resets a former call to --location. This was added by groffer. πŸ’…
  • --manpath 'dir1:dir2:...' β€” use the specified search path for retrieving man pages instead of the program defaults. If the argument is set to the empty string "" the search for man page is disabled. 🚫
  • --pager β€” set the pager program in tty mode; default is less. This can be set with --viewer.
  • --sections sec1:sec2:... β€” bestie, this one pins your man-page hunt to only the sections you name. The argument is a colon-separated list, so it's giving very "one section, then another, then another" energy. 🎯
  • --systems sys1,sys2,... β€” searching for man pages that belong to specific operating systems? Slay, just hand over a comma-separated list of systems. 🌍
  • --where β€” literally just --location wearing a different fit. Same thing, no cap. πŸ’…

πŸ¦‹ X Window System Toolkit Intrinsics Options πŸ¦‹

okay so these long options? They were adapted from the corresponding X Window System Toolkit Intrinsics options, and honestly they're iconic in a vintage way. If the viewer program is an X Window System program, groffer will pass them straight through to it. But if it's not? They just get ignored, no drama, no error, nothing. πŸ™ˆ

ngl, these options rock the OLD style of a single minus for long options. For groffer that got glow-up'd to the standard: a double minus for long options. So like, groffer uses the option --font for the X Window System Toolkit Intrinsics option -font. Periodt. ✨

Wanna know more about these options and their arguments? See X(7) and the manual X Toolkit Intrinsics – C Language Interface. πŸ“–

  • --background color β€” sets the background color of the viewer window. 🎨
  • --bd pixels β€” this is equivalent to --bordercolor.
  • --bg color β€” this is equivalent to --background.
  • --bw pixels β€” this is equivalent to --borderwidth.
  • --bordercolor pixels β€” specifies the color of the border surrounding the viewer window. πŸ–ΌοΈ
  • --borderwidth pixels β€” specifies the width in pixels of the border surrounding the viewer window. (Yes, in pixels. Yes, it matters.)
  • --display X-display β€” sets the X Window System display on which the viewer program shall be started. For the syntax of the argument, see the section β€œDisplay Names” in X(7). πŸ–₯️
  • --foreground color β€” sets the foreground color of the viewer window.
  • --fg color β€” this is equivalent to --foreground.
  • --fn font_name β€” this is equivalent to --font.
  • --font font_name β€” sets the font used by the viewer window. The argument is an X Window System font name. πŸ”€
  • --ft font_name β€” this is equivalent to --font.
  • --geometry size_pos β€” sets the geometry of the display window, meaning its size AND its starting position. For the syntax of the argument, see the section β€œGeometry Specifications” in X(7). πŸ“
  • --resolution value β€” sets the X Window System resolution in dpi (dots per inch) in some viewer programs. Heads up: the only supported dpi values are 75 and 100. And actually, the default resolution for groffer is set to 75dpi. The resolution also sets the default device in mode x. πŸ‘‘
  • --rv β€” reverses foreground and background color of the viewer window. It's giving invert, it's giving chaos, we love it. πŸ”„
  • --title 'some text' β€” sets the title for the viewer window. Name your window, main character energy. πŸŽ€
  • --xrm 'resource' β€” sets the X Window System server resource to the given value.

πŸ”₯ Options for Development πŸ”₯

these are the dev-only zone, bestie. Useful, chaotic, and occasionally they print things you did NOT ask for.
  • --debug β€” enables ALL the debugging options --debug-type. Concretely: the temporary files are kept and not deleted, the grog output is printed, the name of the temporary directory is printed, the displayed file names are printed, and the parameters are printed. Everything. All at once. πŸ’€
  • --debug-filenames β€” prints the names of the files and man pages that are displayed by groffer.
  • --debug-grog β€” prints the output of all grog commands.
  • --debug-keep β€” enables two debugging informations. It prints the name of the temporary directory and keeps the temporary files β€” does not delete them during the run of groffer. πŸ—‚οΈ
  • --debug-params β€” prints the parameters, as obtained from the configuration files, from GROFFER_OPT, and the command-line arguments.
  • --debug-tmpdir β€” prints the name of the temporary directory.
  • --do-nothing β€” this is like --version, but without the output; no viewer is started. This makes only sense in development. Literally does nothing, and that's the whole point. 😌
  • *--print=text* β€” just prints the argument to standard error. This is good for parameter check. πŸ“
  • -V β€” this is an advanced option for debugging only. Instead of displaying the formatted input, a lot of groffer specific information is printed to standard output:
    • the output file name in the temporary directory,
    • the display mode of the actual groffer run,
    • the display program for viewing the output with its arguments,
    • the active parameters from the config files, the arguments in GROFFER_OPT, and the arguments of the command line,
    • the pipeline that would be run by the groff program, but without executing it. πŸ› οΈ

Other useful debugging options are the groff option -Z and --mode=groff. iykyk. πŸ’œ


🌈 Filespec Arguments 🌈

okay so a filespec parameter is an argument that is not an option and not an option argument. In groffer, filespec parameters are either a file name or a template for searching man pages. These input sources get collected and composed into a single output file, exactly the way groff does it. ✨

The strange POSIX behavior β€” you know the one, where every argument behind the first non-option argument gets treated as a filespec argument? Yeah, that one is ignored here. Instead, the GNU behavior is used throughout: options are recognized even when they're mixed in with filespec arguments. But, as usual, the double minus argument -- ends the option handling and interprets all following arguments as filespec arguments. So if you really want that POSIX behavior, you can easily adopt it. 🫢

The options --apropos* have a special handling of filespec arguments. Each argument is taken as a search scheme of its own. Also a regexp (regular expression) can be used in the filespec. For example:

groffer --apropos '^gro.f$'

searches groff in the man page name, while:

groffer --apropos groff

searches groff somewhere in the name or description of the man pages. See the difference? That's the whole vibe. πŸ”

All other parts of groffer, such as the normal display or the output with --whatis, have a different scheme for filespecs. No regular expressions are used for the arguments there. The filespec arguments are handled by the following scheme. πŸ‘‡

It is necessary to know that on each system the man pages are sorted according to their content into several sections. The classical man sections have a single-character name, either a digit from 1 to 9 or one of the characters n or o. πŸ“š

This can optionally be followed by a string, the so-called extension. The extension allows the storage of several man pages with the same name in the same section. But the extension is only rarely used; usually it is omitted. Then the extensions are searched automatically by alphabet.

In the following, we use the name section_extension for a word that consists of a single character section name or a section character that is followed by an extension. Each filespec parameter can have one of the following forms in decreasing sequence. ⭐

  • No filespec parameters means that groffer waits for standard input. The minus option - always stands for standard input; it can occur several times. If you want to look up a man page called -, use the argument man:-.
  • Next a filespec is tested whether it is the path name of an existing file. Otherwise it is assumed to be a searching pattern for a man page. πŸ•΅οΈ
  • man:name(section_extension), man:name.section_extension, name(section_extension), or name.section_extension search the man page name in man section and possibly extension of section_extension.
  • Now man:name searches for a man page in the lowest man section that has a document called name.
  • section_extension name is a pattern of 2 arguments that originates from a strange argument parsing of the man program. Again, this searches the man page name with section_extension, a combination of a section character optionally followed by an extension. πŸŒ€
  • We are left with the argument name which is not an existing file. So this searches for the man page called name in the lowest man section that has a document for this name.

Several file name arguments can be supplied. They are mixed by groff into a single document. Note that the set of option arguments must fit to all of these file arguments. So they should have at least the same style of the groff language. πŸ’–

✨ OUTPUT MODES ✨

okay so here's the tea bestie πŸ«– β€” by default, groffer scoops up all your input into one single file, formats it with groff for a certain device, and then picks a cute little viewer program to show it off. that whole device-plus-viewer combo situation? it's called a mode, and it's basically the main character of how groffer decides to present stuff πŸ’…

the mode and viewer of a running groffer program get selected automatically, but you absolutely can choose it yourself with options if you're feeling opinionated. modes are picked through the arguments of --mode=anymode. and here's the fun part β€” each of those arguments can also be its own standalone option, like just anymode on its own. iconic. most of these modes come with a viewer program, which you can hand-pick with the option --viewer.

so there's a bunch of different modes on offer: graphical modes for the X Window System, text modes, and some direct groff modes for debugging and development πŸ› οΈ

by default, groffer first tries whether x mode is possible, then ps mode, and finally tty mode. this little mode-testing sequence for auto mode? you can switch it up by giving a comma separated list of modes with the option --default-modes ✨

also important: the searching for man pages and the decompression of the input are active in every mode. no skipping that step, ever.

πŸ¦‹ Graphical Display Modes πŸ¦‹

these ones work mostly in the X Window System environment (or similar implementations within other windowing environments, iykyk).

the environment variable DISPLAY and the option --display are what you use for specifying the X Window System display to be used. and if that environment variable is empty? groffer just assumes the X Window System isn't running and switches over to a text mode. no drama. you can change this automatic behavior with the option --default-modes though πŸ’–

the known viewers for the graphical display modes and their standard X Window System viewer programs are:

  • in a PDF viewer (pdf mode)
  • in a web browser (html, (xhtml, or www mode)
  • in a PostScript viewer (ps mode)
  • X Window System roff viewers such as gxditview(1) or xditview(1) (in x mode)
  • in a DVI viewer program (dvi mode)

now, the pdf mode has a major advantage β€” it is the only graphical display mode that allows searching for text within the viewer, and honestly that can be a really important feature πŸ”. unfortunately, it takes some time to transform the input into the PDF format, so it was not chosen as the major mode. tragic but valid.

these graphical viewers can be customized by options of the X Window System Toolkit Intrinsics. but heads up β€” the groffer options use a leading double minus instead of the single minus used by the X Window System Toolkit Intrinsics. so like -- not -. don't get it twisted πŸ™ˆ


🌸 Text modes 🌸

there are two modes for text output:

  • mode text for plain output without a pager
  • mode tty for a text output on a text terminal using some pager program

if the variable DISPLAY is not set or empty, groffer assumes that it should use tty mode.

in the actual implementation, the groff output device latin1 is chosen for text modes. you can change that by specifying option -T or --device πŸ’œ

the pager to be used can be specified by one of the options --pager and --viewer, or by the environment variable PAGER. and if all of that is not used? the less(1) program with the option -r for correctly displaying control sequences is used as the default pager. slay. πŸ‘‘


πŸŽ€ Special Modes for Debugging and Development πŸŽ€

these modes use the groffer file determination and decompression. that gets combined into a single input file that is fed directly into groff with different strategy β€” no groffer viewing facilities involved at all. these modes are regarded as advanced, and they're useful for debugging and development purposes.

the source mode with option --source just displays the decompressed input. simple as that.

option --to-stdout does not display in a graphical mode. it just generates the file for the chosen mode and then prints its content to standard output.

the groff mode passes the input to groff using only some suitable options provided to groffer. this lets you save the generated output into a file or pipe it into another program β€” very handy, very demure 🫢

in groff mode, the option -Z disables post-processing, thus producing the groff intermediate output. in this mode, the input is formatted, but not postprocessed; see groff_out(5) for details.

oh and also β€” all groff short options are supported by groffer. every single one. periodt. πŸ’…

πŸ’… MAN PAGE SEARCHING πŸ’…

okay so here's the tea, bestie: by default groffer is gonna look at each file parameter and be like "is this a real local file tho?" β€” if it's not an existing file name, she just assumes it's the name of a man page. adorable. πŸ’–

And you can boss her around with these options if you wanna control whether the arguments get treated as file names or as man page arguments:

  • --man β€” forces all file parameters to be interpreted as filespecs for searching man pages. no local-file nonsense here. ✨
  • --no-man, --local-file β€” disables the man searching entirely, so literally only local files get displayed. that's it. that's the vibe. πŸŽ€
if neither a local file nor a man page got retrieved for some file parameter, she issues a warning on standard error, but keeps processing anyway. she's not gonna crash out over it. 🫢

πŸ” Search Algorithm

so let's say a man page needs to be searched, right? groffer has a whole search facility for man pages β€” all long options, all environment variables, and most of the functionality of the GNU man(1) program got implemented. the algorithm figures out which file gets displayed for a given man page, and the process can be tweaked by options and environment variables. iconic behavior tbh. πŸ‘‘

The one (1) man action that is omitted in groffer is the preformatted man pages, aka cat pages. and honestly? with how fast actual computers are now, preformatted man pages just aren't necessary anymore. also groffer is a roff program β€” she wants to read roff source files and format them herself. main character energy. πŸ’…

The algorithm for retrieving a file for a man page first needs a set of directories. that set starts with the so-called man path, which gets modified later by adding names of operating system and language. this arising set is then used for adding the section directories, which are the ones that contain the actual man page files. 🌸

The man path is a list of directories separated by colon. it's generated by these methods:

  • The environment variable MANPATH can be set.
  • It can be read from the arguments of the environment variable MANOPT.
  • The man path can be manually specified by using the option --manpath. an empty argument disables the man page searching. (yes, that's a thing!)
  • When no man path was set, the manpath(1) program is tried to determine one.
  • If that doesn't work, a reasonable default path from $PATH is determined.

so now we have a starting set of directories. the first way to change it is by adding names of operating systems β€” this assumes man pages for several operating systems are installed, which is not always true. those OS names can be provided by 3 methods:

  • The environment variable SYSTEM has the lowest precedence.
  • This can be overridden by an option in MANOPT.
  • This again is overridden by the command-line option --systems.

you can give several names of operating systems by appending their names, separated by a comma. πŸ“

The man path gets changed by appending each system name as a subdirectory at the end of each directory of the set. No directory of the man path set is kept. but if no system name is specified, the man path is left unchanged. periodt.

After this, the actual set of directories can be changed by language information. this assumes man pages exist in different languages. the wanted language can be chosen by several methods:

  • Environment variable LANG.
  • This is overridden by LC_MESSAGES.
  • This is overridden by LC_ALL.
  • This can be overridden by providing an option in MANOPT.
  • All these environment variables are overridden by the command-line option --locale.

The default language can be specified by specifying one of the pseudo-language parameters C or POSIX. this is like deleting a formerly given language information. the man pages in the default language are usually in English. πŸ‡¬πŸ‡§βœ¨

Of course, the language name is determined by man. in GNU man, it's specified in the POSIX 1003.1 based format:

<language>[_<territory>[.<character-set>[,<version>]]],

but the two-letter code in <language> is sufficient for most purposes. if for a complicated language formulation no man pages are found, groffer searches the country part consisting of these first two characters as well. she's thorough like that. πŸ’…

The actual directory set is copied thrice. the language name is appended as subdirectory to each directory in the first copy of the actual directory set (this is only done when a language information is given). then the 2-letter abbreviation of the language name is appended as subdirectories to the second copy of the directory set (this is only done when the given language name has more than 2 letters). the third copy of the directory set is kept unchanged (if no language information is given, this is the kept directory set). these maximally 3 copies are appended to get the new directory set. math girlie ate. 🧚

so now we have a complete set of directories to work with. in each of these directories, the man files are separated into sections. the name of a section is represented by a single character β€” a digit between 1 and 9, or the character o or n, in this order.

For each available section, a subdirectory man<section> exists, containing all man files for this section, where <section> is a single character as described before. each man file in a section directory has the form:

man<section>/<name>.<section>[<extension>][.<compression>]

where <extension> and <compression> are optional. <name> is the name of the man page, which is also the filespec argument on the command line. πŸŽ€

The extension is an addition to the section. this postfix acts like a subsection. an extension occurs only in the file name, not in the name of the section subdirectory. it can be specified on the command line.

On the other hand, the compression is just an information on how the file is compressed. this is not important for the user, so it cannot be specified on the command line.

There are 4 methods to specify a section on the command line:

  • Environment variable MANSECT
  • Command line option --sections
  • Appendix to the name argument in the form <name>.<section>
  • Preargument before the name argument in the form <section> <name>

It's also possible to specify several sections by appending the single characters separated by colons. you can imagine this means restricting the man page search to only some sections. multiple sections are only possible for MANSECT and --sections. iykyk. πŸ’…

If no section is specified, all sections are searched one after the other in the given order, starting with section 1, until a suitable file is found.

There are 4 methods to specify an extension on the command line. but you don't need to provide the whole extension name β€” some abbreviation is good enough in most cases. ✨

  • Environment variable EXTENSION
  • Command line option --extension
  • Appendix to the <name>.<section> argument in the form <name>.<section><extension>
  • Preargument before the name argument in the form <section><extension> <name>

For further details on man page searching, see man(1). 🫢


πŸ“‚ Examples of man files

/usr/share/man/man1/groff.1

This is an uncompressed file for the man page groff in section 1. it can be called by:

sh# groffer groff

No section is specified here, so all sections should be searched β€” but since section 1 is searched first, this file will be found first. slay. 🌟

The file name is composed of the following components. /usr/share/man/ must be part of the man path; the subdirectory man1/ and the part .1 stand for the section; groff is the name of the man page.

/usr/local/share/man/man7/groff.7.gz

The file name is composed of the following components. /usr/local/share/man must be part of the man path; the subdirectory man7/ and the part .7 stand for the section; groff is the name of the man page; the final part .gz stands for a compression with gzip(1). since the section is not the first one, it must be specified as well. you can do that with one of the following commands:

sh# groffer groff.7
sh# groffer 7 groff
sh# groffer --sections=7 groff

/usr/local/man/man1/ctags.1emacs21.bz2

Here /usr/local/man must be in man path; the subdirectory man1/ and the file name part .1 stand for section 1; the name of the man page is ctags; the section has an extension emacs21; and the file is compressed as .bz2 with bzip2(1). the file can be viewed with one of the following commands:

sh# groffer ctags.1e
sh# groffer 1e ctags
sh# groffer --extension=e --sections=1 ctags

where e works as an abbreviation for the extension emacs21. ✨

/usr/man/linux/de/man7/man.7.Z

The directory /usr/man is now part of the man path; then there's a subdirectory for an operating system name linux/; next comes a subdirectory de/ for the German language; the section names man7 and .7 are known so far; man is the name of the man page; and .Z signifies the compression that can be handled by gzip(1). 🧚

we wanna show now how to provide several values for some options. that's possible for sections and operating system names. so we use 5 and 7 as sections, and linux and aix as system names. the command is then:

sh# groffer --locale=de --sections=5:7 --systems=linux,aix man
sh# LANG=de MANSECT=5:7 SYSTEM=linux,aix groffer man

both of those? chef's kiss. πŸ‘‘


πŸ¦‹ DECOMPRESSION πŸ¦‹

The program has a decompression facility. if standard input, or a file that was retrieved from the command line parameters, is compressed with a format supported by either gzip(1) or bzip2(1), it gets decompressed on-the-fly. this includes the GNU .gz, .bz2, and the traditional .Z compression. πŸŽ€

The program displays the concatenation of all decompressed input in the sequence that was specified on the command line. no cap, she just lines them all up for you. πŸ’–

🌸 ENVIRONMENT 🌸

okay bestie, this is the part where groffer is like "i'm not doing this alone" πŸ’… β€” it honors so many system variables, and most of them it's literally borrowing from other programs. Basically every single environment variable that groff(1) and GNU man(1) know about, plus a handful of standard system ones, are all respected here. She's generous like that. 🫢


πŸ’– Native groffer Variables πŸ’–

just the one, and it's hers:

  • GROFFER_OPT β€” this is where you stash options for a whole run of groffer. ✨ Important tho: whatever you put in here gets overridden by options you actually type on the command line β€” command line always wins, periodt. And here's the tea: the content of this variable gets run through the shell builtin eval, so if your arguments have whitespace or special shell characters in them, you need to quote them, fr fr. Also!! do not forget to export this variable, otherwise it literally does not exist during the run of groffer. like it's just a ghost πŸ‘»

🌈 System Variables 🌈

these ones have a special meaning for groffer, bestie, listen up:

  • DISPLAY β€” if this is set, it means the X Window System is running. groffer tests this variable to decide whether it gives you graphical or text output. πŸ‘‘ You should not be changing this carelessly, okay? but you can use it to start the graphical groffer on a remote X Window System terminal. For example, depending on your system, you can start groffer on the second monitor with:
sh# DISPLAY=:0.1 groffer what.ever &
  • LC_ALL, LC_MESSAGES, LANG β€” if one of these is set (checked in exactly that order, above), its content is interpreted as the locale, i.e. the language to use, especially when it's out here retrieving man pages for you. 🌍 A locale name is typically of the form language[_territory[.codeset[@modifier]]], where language is an ISO 639 language code, territory is an ISO 3166 country code, and codeset is a character set or encoding identifier like ISO-8859-1 or UTF-8; peep setlocale(3) for the full lore. The locale values C and POSIX stand for the default, meaning the man page directories without a language prefix. Which is the exact same behavior you get when all 3 variables are unset. same vibe either way πŸ’œ
  • PAGER β€” set your pager for the tty output right here. For example, to disable the use of a pager completely, just set this variable to the cat(1) program:
sh# PAGER=cat groffer anything
  • PATH β€” every program inside the groffer script is called without a fixed path. So this environment variable is literally what determines the set of programs used within the run of groffer. no pressure or anything πŸŽ€

🧚 Groff Variables 🧚

groffer internally calls groff, so all the environment variables documented in groff(1) are internally used inside groffer too. But this next one has a direct meaning for groffer specifically:

  • GROFF_TMPDIR β€” if the value of this variable is an existing, writable directory, groffer uses it for storing its temporary files, just like groff does. 🌸 See the groff(1) man page for more deets on where temporary files live.

πŸ¦‹ Man Variables πŸ¦‹

okay so parts of the functionality of the man program were implemented inside groffer. Support for all environment variables documented in man(1) got added to groffer, but the meaning is slightly modified, because groffer takes a different approach β€” the user interface stays the same tho, so don't worry. πŸ’…

the man environment variables can be overwritten by options provided with MANOPT, which in turn gets overwritten by the command line. it's giving hierarchy, iykyk.

  • EXTENSION β€” restrict the search for man pages to files having this extension. This is overridden by option --extension; go look there for details.
  • MANOPT β€” this variable holds options as a preset for man(1). Since not all of them are relevant for groffer, only the essential parts of its value get extracted. The options specified in this variable overwrite the values of the other environment variables that are specific to man. And all options specified in this variable are overridden by the options given on the command line. 😌
  • MANPATH β€” if set, this variable contains the directories where the man page trees are stored. This is overridden by option --manpath.
  • MANSECT β€” if this is a colon separated list of section names, the search for man pages is restricted to those manual sections, in that order. This is overridden by option --sections.
  • SYSTEM β€” if this is set to a comma separated list of names, these get interpreted as man page trees for different operating systems. 🌐 This variable can be overwritten by option --systems; see there for details.
also bestie, the environment variable MANROFFSEQ is ignored by groffer, because the necessary preprocessors are determined automatically. she doesn't need the help πŸ’…

βš™οΈ CONFIGURATION FILES βš™οΈ

groffer can be preconfigured by two configuration files. two!! iconic.

  • /etc/groff/groffer.conf β€” system-wide configuration file for groffer.
  • $HOME/.groff/groffer.conf β€” user-specific configuration file for groffer, where $HOME denotes the user's home directory. This file is called after the system-wide configuration file to enable overriding by the user. main character energy πŸŽ€

Both files are handled for the configuration, but the config file in /etc comes first; it gets overwritten by the config file in the home directory; both config files get overwritten by the environment variable GROFFER_OPT; and literally everything gets overwritten by the command line arguments. the pecking order is real. πŸ‘‘


The configuration files contain options that should be called as default for every groffer run. These options are written in lines, such that each line contains either a long option, a short option, or a short option cluster β€” each with or without an argument. So every line with configuration info starts with a minus character -; a line with a long option starts with two minus characters --; a line with a short option or short option cluster starts with a single minus -. 🌸

The option names in the configuration files may not be abbreviated β€” they must be exact. no shortcuts, bestie.

The argument for a long option can be separated from the option name either by an equal sign = or by whitespace, i.e. one or several space or tab characters. An argument for a short option or short option cluster can be directly appended to the option name, or separated by whitespace. The end of an argument is the end of the line. And it is not allowed to use a shell environment variable in an option name or argument. nope, not happening. πŸ™ˆ

It's not necessary to use quotes in an option or argument β€” except for empty arguments. An empty argument can be provided by appending a pair of quotes to the separating equal sign or whitespace; with a short option, the separator can be omitted as well. For a long option with a separating equal sign =, the pair of quotes can be omitted, thus ending the line with the separating equal sign. All other quote characters are cancelled internally. πŸ¦‹

In the configuration files, arbitrary whitespace is allowed at the beginning of each line β€” it's just ignored. Each whitespace within a line is replaced by a single space character " " internally.

All lines of the configuration lines that do not start with a minus character are ignored, such that comments starting with # are possible. So there are no shell commands in the configuration files. 🧚

As an example, consider the following configuration file that can be used either in /etc/groff/groffer.conf or ~/.groff/groffer.conf:

# groffer configuration file
#
# groffer options that are used in each call of groffer
--foreground=DarkBlue
--resolution=100
--viewer=gxditview -geometry 900x1200

The lines starting with # are just ignored, so they act as comment lines. This configuration sets four groffer options (the lines starting with -). This has the following effects:

  • Use a text color of DarkBlue in all viewers that support this, such as gxditview.
  • Use a resolution of 100dpi in all viewers that support this, such as gxditview. By this, the default device in x mode is set to X100.
  • Force gxditview(1) as the x-mode viewer using the geometry option for setting the width to 900px and the height to 1200px. This geometry is suitable for a resolution of 100dpi.
  • Use xpdf(1) as the pdf-mode viewer with the argument -Z 150.

✨ EXAMPLES ✨

Using groffer is so easy bestie, like genuinely. Most of the time you just hand it a file name or a man page and you're done. But these examples? They show off the fancy side, and honestly, iconic.

sh# groffer /usr/local/share/doc/groff/meintro.ms.gz

This decompresses, formats and displays the compressed file meintro.ms.gz in the directory /usr/local/share/doc/groff. When you're in the X Window System it uses the standard viewer gxditview as the graphical viewer, and otherwise it falls back to the less(1) pager program. πŸ’…

sh# groffer groff

If the file ./groff exists, that's the input, periodt. Otherwise it interprets the argument as a search for the man page named groff in the smallest possible man section β€” which in this case is section 1.

sh# groffer man:groff

Same thing, but it searches for the man page of groff even when the file ./groff exists. No cap. πŸŽ€

sh# groffer groff.7
sh# groffer 7 groff

Both of these search the man page of groff in man section 7. Heads up though β€” this section search only works for a digit or a single character from a small set. πŸ¦‹

sh# groffer fb.modes

If the file ./fb.modes does not exist, this gets interpreted as a search for the man page of fb.modes. And here's the tea: since the extension modes is not a single character in classical section style, the argument is not split into a search for fb. πŸ“

sh# groffer groff ’troff(1)’ man:roff

The arguments that aren't existing files get looked up as the following man pages: groff (automatic search, should be found in man section 1), troff (in section 1), and roff (in the section with the lowest number, which is 7 in this case). The quotes around ’troff(1)’ are necessary because the parentheses are special shell characters β€” you could also escape them with a backslash character \( and \) instead. The formatted files get concatenated and displayed in one piece. 🫢

sh# LANG=de groffer --man --viewer=galeon ls

This retrieves the German man page (language de) for the ls program, decompresses it, formats it to html or xhtml format (that's www mode) and views the result in the web browser galeon. The option --man guarantees that the man page is retrieved, even when a local file ls exists in the actual directory. 🌸

sh# groffer --source 'man:roff(7)'

Get the man page called roff in man section 7, decompress it, and print its unformatted content β€” its source code. πŸ‘‘

sh# groffer --de-p --in --ap

This is a set of abbreviated arguments, and it gets determined as

sh# groffer --debug-params --intermediate-output --apropos
sh# cat file.gz | groffer -Z -mfoo

The file file.gz is sent to standard input, this gets decompressed, and then this is transported to the groff intermediate output mode without post-processing (that's the groff option -Z), using macro package foo (groff option -m). ✨

sh# echo '\f(CBWOW!' |
> groffer --x --bg red --fg yellow --geometry 200x100 -

Displays the word WOW! in a small window in constant-width bold font, using color yellow on red background. WOW indeed. 😭


πŸ’œ COMPATIBILITY πŸ’œ

The groffer program is written in Perl, and the Perl version during writing was v5.8.8. Ngl, vintage.

groffer provides its own parser for command-line arguments that is compatible to both POSIX getopts(1) and GNU getopt(1). It can handle option arguments and file names containing white space and a large set of special characters. The following standard types of options are supported.

  • The option consisting of a single minus - refers to standard input. πŸ™ˆ
  • A single minus followed by characters refers to a single character option or a combination thereof; for example, the groffer short option combination -Qmfoo is equivalent to -Q -m foo. πŸ¦‹
  • Long options are options with names longer than one character; they are always preceded by a double minus. An option argument can either go to the next command-line argument or be appended with an equal sign to the argument; for example, --long=arg is equivalent to --long arg. πŸ’…
  • An argument of -- ends option parsing; all further command-line arguments are interpreted as filespec parameters, i.e. file names or constructs for searching man pages). πŸŽ€
  • All command-line arguments that are neither options nor option arguments are interpreted as filespec parameters and stored until option parsing has finished. For example, the command line
sh# groffer file1 -a -o arg file2

is equivalent to

sh# groffer -a -o arg -- file1 file2

The free mixing of options and filespec parameters follows the GNU principle. That does not fulfill the strange option behavior of POSIX that ends option processing as soon as the first non-option argument has been reached. The end of option processing can be forced by the option β€œ--” anyway. πŸ’–


🌈 AUTHORS 🌈

groffer was written by Bernd Warken. πŸ‘‘


⭐ SEE ALSO ⭐

  • groff(1), troff(1) β€” Details on the options and environment variables available in groff; all of them can be used with groffer. 🫢
  • grog(1) β€” This program tries to guess the necessary groff command-line options from the input and the groffer options. πŸ”₯
  • groff(7) β€” Documentation of the groff language. πŸ“–
  • groff_char(7) β€” Documentation on the groff characters, special characters, and glyphs.. ✨
  • groff_tmac(5) β€” Documentation on the groff macro files. πŸŽ€
  • groff_out(5) β€” Documentation on the groff intermediate output before the run of a postprocessor. (ditroff output). This can be run by the groff or groffer option -Z. πŸ¦‹
  • man(1) β€” The standard program to display man pages. The information there is only useful if it is the man page for GNU man. Then it documents the options and environment variables that are supported by groffer. πŸ’œ
  • gxditview(1), xditview(1x) β€” Viewers for groffer's x mode. 🌸
  • kpdf(1), kghostview(1), evince(1), ggv(1), gv(1), ghostview(1), gs(1) β€” Viewers for groffer's ps mode. πŸ“
  • kpdf(1), acroread(1), evince(1), xpdf(1), gpdf(1), kghostview(1), ggv(1) β€” Viewers for groffer's pdf mode. πŸ’…
  • kdvi(1), xdvi(1), dvilx(1) β€” Viewers for groffer's dvi mode. πŸ‘‘
  • konqueror(1), epiphany(1), firefox(1), mozilla(1), netscape(1), lynx(1) β€” Web-browsers for groffer's html, xhtml, or www mode. 🌈
  • less(1), more(1) β€” Standard pager program for the tty mode. πŸ“„
  • gzip(1), bzip2(1), xz(1) β€” The decompression programs supported by groffer. 🎁

and that's the whole page bestie, we made it πŸ’– this one came from groff 1.22.4 and it's dated 23 March 2022 β€” go forth and groffer responsibly, mwah 🫢✨

πŸ“¦ where this page comes from