groff 處理手冊

  1. UNIX 使用手冊是藉由 nroff 工具,格式處理後所形成,在 Linux 系統上也有個類似的 GNU 專案 groff 可處理使用手冊的原始碼。
  2. groff 輔助說明
    [dywang@dyw219 make1]$ groff --help
    usage: groff [-abceghilpstvzCENRSUVXZ] [-Fdir] [-mname] [-Tdev] [-ffam]
           [-wname] [-Wname] [-Mdir] [-dcs] [-rcn] [-nnum] [-olist] [-Parg]
           [-Larg] [-Idir] [files...]
    
    -h	print this message
    -t	preprocess with tbl
    -p	preprocess with pic
    -e	preprocess with eqn
    -g	preprocess with grn
    -G	preprocess with grap
    -s	preprocess with soelim
    -R	preprocess with refer
    -Tdev	use device dev
    -X	use X11 previewer rather than usual postprocessor
    -mname	read macros tmac.name
    -dcs	define a string c as s
    -rcn	define a number register c as n
    -nnum	number first page n
    -olist	output only pages in list
    -ffam	use fam as the default font family
    -Fdir	search dir for device directories
    -Mdir	search dir for macro files
    -v	print version number
    -z	suppress formatted output
    -Z	don't postprocess
    -a	produce ASCII description of output
    -i	read standard input after named input files
    -wname	enable warning name
    -Wname	inhibit warning name
    -E	inhibit all errors
    -b	print backtraces with errors or warnings
    -l	spool the output
    -c	disable color output
    -C	enable compatibility mode
    -V	print commands on stdout instead of running them
    -Parg	pass arg to the postprocessor
    -Larg	pass arg to the spooler
    -N	don't allow newlines within eqn delimiters
    -S	enable safer mode (the default)
    -U	enable unsafe mode
    -Idir	search dir for soelim.  Implies -s
    
  3. groff 選項簡要說明:
    -Tascii:產生 ASCII 文字。
    -Tps:產生 PostScript。
    -man:告訴 groff 輸入一個使用手冊。
    
  4. 將使用手冊 main.1 以 ASCII 文字產生:
    [dywang@dyw219 make1]$ groff -Tascii -man main.1
    MAIN(1)                                                                MAIN(1)
    NAME
           Main - A simple demonstration application that does very little.
    SYNOPSIS
           main [-option ...]
    DESCRIPTION
           main is a complete application that does nothing useful.
           It was written for demonstration purposes.
    OPTIONS
           It doesn't have any, but let's pretend, to make this template complete:
           -option
                  If there was an option, it would not be -option.
    RESOURCES
           main uses almost no resources.
    DIAGNOSTICS
           The program shouldn't output anything, so  if  you  find  it  doing  so
           there's probably something wrong. The return value is zero.
    SEE ALSO
           The  only  other program we know with this this little functionality is
           the ubiquitous hello world application.
    COPYRIGHT
           main is Copyright (c) 2019 .....
    BUGS
           There probably are some, but we don't know what they are yet.
    AUTHORS
           ABC123
                                                                   MAIN(1)