2 # Emulate nroff with groff.
4 # Copyright (C) 1992, 1993, 1994, 1999, 2000, 2001, 2002, 2003,
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 2, or (at your
15 # 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 `groff'; see the files COPYING and LICENSE in the top
24 # directory of the `groff' source. If not, write to the Free Software
25 # Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301,
32 # Check the GROFF_TYPESETTER environment variable.
33 Tenv
=$GROFF_TYPESETTER
35 # Try the `locale charmap' command first because it is most reliable.
36 # On systems where it doesn't exist, look at the environment variables.
37 case "`exec 2>/dev/null ; locale charmap`" in
40 ISO-8859-1 | ISO-8859-15
)
45 case "${LC_ALL-${LC_CTYPE-${LANG}}}" in
48 iso_8859_1 |
*.ISO-8859-1 |
*.ISO8859-1 | \
49 iso_8859_15 |
*.ISO-8859-15 |
*.ISO8859-15
)
54 case "$LESSCHARSET" in
67 # `for i; do' doesn't work with some versions of sh
79 # ignore these options
82 echo "$prog: option $1 requires an argument" >&2
84 -[iptSUC
] |
-[dMmrno
]*)
89 # Solaris 2.2 through at least Solaris 9 `man' invokes
90 # `nroff -u0 ... | col -x'. Ignore the -u0,
91 # since `less' and `more' can use the emboldening info.
92 # However, disable SGR, since Solaris `col' mishandles it.
95 echo "GNU nroff (groff) version @VERSION@"
98 echo "usage: nroff [-CchipStUv] [-dCS] [-MDIR] [-mNAME] [-nNUM] [-oLIST]"
99 echo " [-rCN] [-Tname] [FILE...]"
107 echo "$prog: invalid option $1" >&2
115 if test "x$Topt" != x
; then
118 if test "x$Tenv" != x
; then
124 -Tascii |
-Tlatin1 |
-Tutf8 |
-Tcp1047)
127 # ignore other devices and use locale fallback
131 # Set up the `GROFF_BIN_PATH' variable
132 # to be exported in the current `GROFF_RUNTIME' environment.
134 @GROFF_BIN_PATH_SETUP@
135 export GROFF_BIN_PATH
137 # This shell script is intended for use with man, so warnings are
138 # probably not wanted. Also load nroff-style character definitions.
140 PATH
="$GROFF_RUNTIME$PATH" groff -mtty-char $T $opts ${1+"$@"}