2 # Emulate nroff with groff.
4 # Copyright (C) 1992, 1993, 1994, 1999, 2000, 2001, 2002, 2003,
5 # 2004, 2005, 2007, 2009
6 # Free Software Foundation, Inc.
8 # Written by James Clark, maintained by Werner Lemberg.
10 # This file is of `groff'.
12 # `groff' is free software; you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License (GPL) as published
14 # by the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # `groff' is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 # General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program. If not, see <http://www.gnu.org/licenses/>.
29 # Check the GROFF_TYPESETTER environment variable.
30 Tenv=$GROFF_TYPESETTER
32 # Try the `locale charmap' command first because it is most reliable.
33 # On systems where it doesn't exist, look at the environment variables.
34 case "`exec 2>/dev/null ; locale charmap`" in
37 ISO-8859-1 | ISO-8859-15)
42 case "${LC_ALL-${LC_CTYPE-${LANG}}}" in
45 iso_8859_1 | *.ISO-8859-1 | *.ISO8859-1 | \
46 iso_8859_15 | *.ISO-8859-15 | *.ISO8859-15)
51 case "$LESSCHARSET" in
64 # `for i; do' doesn't work with some versions of sh
76 # ignore these options
79 echo "$prog: option $1 requires an argument" >&2
81 -[iptSUC] | -[dMmrnowW]*)
86 # Solaris 2.2 through at least Solaris 9 `man' invokes
87 # `nroff -u0 ... | col -x'. Ignore the -u0,
88 # since `less' and `more' can use the emboldening info.
89 # However, disable SGR, since Solaris `col' mishandles it.
92 echo "GNU nroff (groff) version @VERSION@"
95 echo "usage: nroff [-CchipStUv] [-dCS] [-MDIR] [-mNAME] [-nNUM] [-oLIST]"
96 echo " [-rCN] [-Tname] [-WNAME] [-wNAME] [FILE...]"
104 echo "$prog: invalid option $1" >&2
112 if test "x$Topt" != x ; then
115 if test "x$Tenv" != x ; then
121 -Tascii | -Tlatin1 | -Tutf8 | -Tcp1047)
124 # ignore other devices and use locale fallback
128 # Set up the `GROFF_BIN_PATH' variable
129 # to be exported in the current `GROFF_RUNTIME' environment.
131 @GROFF_BIN_PATH_SETUP@
132 export GROFF_BIN_PATH
134 # Load nroff-style character definitions too.
136 PATH="$GROFF_RUNTIME$PATH" groff -mtty-char $T $opts ${1+"$@"}