2 # Emulate nroff with groff.
4 # Copyright (C) 1992-2018 Free Software Foundation, Inc.
6 # Written by James Clark.
8 # This file is of 'groff'.
10 # 'groff' is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License (GPL) as published
12 # by the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
15 # 'groff' is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
27 # Check the GROFF_TYPESETTER environment variable.
28 Tenv=$GROFF_TYPESETTER
30 # Try the 'locale charmap' command first because it is most reliable.
31 # On systems where it doesn't exist, look at the environment variables.
32 case "`exec 2>/dev/null ; locale charmap`" in
35 ISO-8859-1 | ISO-8859-15)
40 case "${LC_ALL-${LC_CTYPE-${LANG}}}" in
43 iso_8859_1 | *.ISO-8859-1 | *.ISO8859-1 | \
44 iso_8859_15 | *.ISO-8859-15 | *.ISO8859-15)
49 case "$LESSCHARSET" in
62 # 'for i; do' doesn't work with some versions of sh
74 # ignore these options
77 echo "$prog: option $1 requires an argument" >&2
79 -[iptSUC] | -[dMmrnowW]*)
84 # Solaris 2.2 through at least Solaris 9 'man' invokes
85 # 'nroff -u0 ... | col -x'. Ignore the -u0,
86 # since 'less' and 'more' can use the emboldening info.
87 # However, disable SGR, since Solaris 'col' mishandles it.
90 echo "GNU nroff (groff) version @VERSION@"
93 echo "usage: nroff [-CchipStUv] [-dCS] [-MDIR] [-mNAME] [-nNUM] [-oLIST]"
94 echo " [-rCN] [-Tname] [-WNAME] [-wNAME] [FILE...]"
102 echo "$prog: invalid option $1" >&2
110 if test "x$Topt" != x ; then
113 if test "x$Tenv" != x ; then
119 -Tascii | -Tlatin1 | -Tutf8 | -Tcp1047)
122 # ignore other devices and use locale fallback
126 # Set up the 'GROFF_BIN_PATH' variable
127 # to be exported in the current 'GROFF_RUNTIME' environment.
129 @GROFF_BIN_PATH_SETUP@
130 export GROFF_BIN_PATH
132 # Load nroff-style character definitions too.
134 PATH="$GROFF_RUNTIME$PATH" groff -mtty-char $T $opts ${1+"$@"}