GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / tools / misc / xz / build-aux / manconv.sh
blobe53b0269e99e7574455dcde12dafab14175f2e24
1 #!/bin/sh
3 ###############################################################################
5 # Wrapper for GNU groff to convert man pages to a few formats
7 # Usage: manconv.sh FORMAT [PAPER_SIZE] < in.1 > out.suffix
9 # FORMAT can be ascii, utf8, ps, or pdf. PAPER_SIZE can be anything that
10 # groff accepts, e.g. a4 or letter. See groff_font(5). PAPER_SIZE defaults
11 # to a4 and is used only when FORMAT is ps (PostScript) or pdf.
13 # Multiple man pages can be given at once e.g. to create a single PDF file
14 # with continuous page numbering.
16 ###############################################################################
18 # Author: Lasse Collin
20 # This file has been put into the public domain.
21 # You can do whatever you want with this file.
23 ###############################################################################
25 FORMAT=$1
26 PAPER=${2-a4}
28 # Make PostScript and PDF output more readable:
29 # - Use 11 pt font instead of the default 10 pt.
30 # - Use larger paragraph spacing than the default 0.4v (man(7) only).
31 FONT=11
32 PD=0.8
34 SED_PD="
35 /^\\.TH /s/\$/\\
36 .PD $PD/
37 s/^\\.PD\$/.PD $PD/"
39 case $FORMAT in
40 ascii)
41 groff -t -mandoc -Tascii | col -bx
43 utf8)
44 groff -t -mandoc -Tutf8 | col -bx
46 ps)
47 sed "$SED_PD" | groff -dpaper=$PAPER -t -mandoc \
48 -rC1 -rS$FONT -Tps -P-p$PAPER
50 pdf)
51 sed "$SED_PD" | groff -dpaper=$PAPER -t -mandoc \
52 -rC1 -rS$FONT -Tps -P-p$PAPER | ps2pdf - -
55 echo 'Invalid arguments' >&2
56 exit 1
58 esac