GROFFER(1)
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]
options related to groff
[-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_extensionname(section_extension)name.section_extensionsection_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, inGROFFER_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--modefor 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 includexdvi(1)anddvilx(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-modesoption. 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 thexdvi(1)program.groffβ After the file determination, switchgrofferto process the input likegroff(1)would do. This disables thegrofferviewing 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 withkonqueror(1)andmozilla(1). The text HTML viewer islynx(1). By default, the existence of a sequence of standard web browsers is tested, starting withkonqueror(1)andmozilla(1). The text HTML viewer islynx(1). (yes she said it twice, that's canon π)pdfβ Transform roff input files into a PDF file by using thegroff (1)device-Tpdf. This is the default PDF generator. The generated PDF file is displayed with suitable viewer programs, such asokular(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 usinggs(1), orps2pdf(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 islatin1by 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 thegxditview(1)program that ships together withgroff. But the legacy X Window System applicationxditview(1)can also be chosen with the option--viewer. The default resolution is75dpi, but100dpiis also possible. The default groff device for the resolution of75dpiisX75-12, and for100dpiit isX100. The corresponding groff intermediate output for the actual device gets generated, and then the result is displayed. And for a resolution of100dpi, the default width of the geometry of the display program is chosen to850dpi. π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 plaingroff, without using the special viewing features of groffer. If no device was specified by option-T, the groff defaultpsis 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 includeokular(1),evince(1),gv(1),ghostview(1), andgs(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 isless(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 aregxditview(1), which is the default, andxditview(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. πΈ
π Options related to groff π
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 thetextmodes. That could be important when the text pager has problems with control sequences inttymode.--mfile β add file as a groff macro file. This is useful in case it cannot be recognized automatically. π--Popt_or_arg β send the argument opt_or_arg as an option or option argument to the actual groff postprocessor.--Tdevname |--devicedevname β this option determines groff's output device. The most important devices are the text output devices for referring to the different character sets, such asascii,utf8,latin1,utf8, and others. Each of these arguments switchesgrofferinto a text mode using this device β to modettyif the actual mode is not a text mode. The following devname arguments are mapped to the correspondinggroffer --mode=devname option:dvi,html,xhtml, andps. AllX*arguments are mapped to modex. Each other devname argument switches to modegroffusing this device. π--Xβ is equivalent togroff -X. It displays the groff intermediate output withgxditview. As the quality is relatively bad this option is deprecated; use--Xinstead because thexmode uses anX*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; seegroff_out(5). This is equivalent to option--ditroffofman, 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 theapropos(1)command or facility ofman(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 that7 groffsearches for the two arguments7andgroff, with a large result; for the filespecgroff.7nothing will be found. The language locale is handled only when the called programs do support this; the GNUaproposandman -kdo not. The display differs from theaproposprogram 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
--sectionsis handled as well, - wildcard characters are allowed and handled without a further option.
- Construct a groff frame similar to a man page to the output of
--apropos-dataβ show only the apropos descriptions for data documents, these are theman(7)sections4,5, and7. Direct section declarations are ignored, wildcards are accepted. π--apropos-develβ show only the apropos descriptions for development documents, these are theman(7)sections2,3, and9. Direct section declarations are ignored, wildcards are accepted. π§--apropos-progsβ show only the apropos descriptions for documents on programs, these are theman(7)sections1,6, and8. 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'swhatisoutput 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-fileis 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 togroff -mtty_char; seegroff_tmac(5).--ditroffβ produce groff intermediate output. This is equivalent togroffer -Z. π₯--extensionsuffix β 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.gzthe man page extension isncurses.--localelanguage β 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 bygroffer. π--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 inttymode; default isless. This can be set with--viewer.--sectionssec1: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. π―--systemssys1,sys2,... β searching for man pages that belong to specific operating systems? Slay, just hand over a comma-separated list of systems. π--whereβ literally just--locationwearing 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. Forgrofferthat got glow-up'd to the standard: a double minus for long options. So like,grofferuses the option--fontfor 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. π
--backgroundcolor β sets the background color of the viewer window. π¨--bdpixels β this is equivalent to--bordercolor.--bgcolor β this is equivalent to--background.--bwpixels β this is equivalent to--borderwidth.--bordercolorpixels β specifies the color of the border surrounding the viewer window. πΌοΈ--borderwidthpixels β specifies the width in pixels of the border surrounding the viewer window. (Yes, in pixels. Yes, it matters.)--displayX-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β inX(7). π₯οΈ--foregroundcolor β sets the foreground color of the viewer window.--fgcolor β this is equivalent to--foreground.--fnfont_name β this is equivalent to--font.--fontfont_name β sets the font used by the viewer window. The argument is an X Window System font name. π€--ftfont_name β this is equivalent to--font.--geometrysize_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β inX(7). π--resolutionvalue β sets the X Window System resolution in dpi (dots per inch) in some viewer programs. Heads up: the only supported dpi values are75and100. And actually, the default resolution forgrofferis set to75dpi. The resolution also sets the default device in modex. π--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, thegrogoutput 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 bygroffer.--debug-grogβ prints the output of allgrogcommands.--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 ofgroffer. ποΈ--debug-paramsβ prints the parameters, as obtained from the configuration files, fromGROFFER_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 ofgrofferspecific information is printed to standard output:- the output file name in the temporary directory,
- the display mode of the actual
grofferrun, - 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
groffprogram, 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
grofferwaits 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 argumentman:-. - 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
manprogram. 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 (
pdfmode) - in a web browser (
html, (xhtml, orwwwmode) - in a PostScript viewer (
psmode) - X Window System roff viewers such as
gxditview(1)orxditview(1)(inxmode) - in a DVI viewer program (
dvimode)
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
textfor plain output without a pager - mode
ttyfor 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 β allgroffshort options are supported bygroffer. 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
MANPATHcan 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
$PATHis 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
SYSTEMhas 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 builtineval, so if your arguments have whitespace or special shell characters in them, you need to quote them, fr fr. Also!! do not forget toexportthis 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 formlanguage[_territory[.codeset[@modifier]]], wherelanguageis an ISO 639 language code,territoryis an ISO 3166 country code, andcodesetis a character set or encoding identifier likeISO-8859-1orUTF-8; peepsetlocale(3)for the full lore. The locale valuesCandPOSIXstand 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 thecat(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$HOMEdenotes 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
DarkBluein all viewers that support this, such asgxditview. - Use a resolution of
100dpiin all viewers that support this, such asgxditview. By this, the default device in x mode is set toX100. - Force
gxditview(1)as the x-mode viewer using the geometry option for setting the width to900pxand the height to1200px. This geometry is suitable for a resolution of100dpi. - 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
groffershort option combination-Qmfoois 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=argis 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 ingroff; all of them can be used withgroffer. π«Άgrog(1)β This program tries to guess the necessary groff command-line options from the input and thegrofferoptions. π₯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. (ditroffoutput). This can be run by the groff orgrofferoption-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 bygroffer. πgxditview(1),xditview(1x)β Viewers forgroffer'sxmode. πΈkpdf(1),kghostview(1),evince(1),ggv(1),gv(1),ghostview(1),gs(1)β Viewers forgroffer'spsmode. πkpdf(1),acroread(1),evince(1),xpdf(1),gpdf(1),kghostview(1),ggv(1)β Viewers forgroffer'spdfmode. πkdvi(1),xdvi(1),dvilx(1)β Viewers forgroffer'sdvimode. πkonqueror(1),epiphany(1),firefox(1),mozilla(1),netscape(1),lynx(1)β Web-browsers forgroffer'shtml,xhtml, orwwwmode. πless(1),more(1)β Standard pager program for thettymode. πgzip(1),bzip2(1),xz(1)β The decompression programs supported bygroffer. π
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
- ubuntu jammy: groff 1.22.4-8build1
- Copyright (C) 2001-2018 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms