nroff.sh revision 18248
1#!/bin/sh
2# Emulate nroff with groff.
3
4prog="$0"
5# Default device.
6if test `expr "$LC_CTYPE" : ".*\.ISO_8859-1"` -gt 0 || \
7   test `expr "$LANG" : ".*\.ISO_8859-1"` -gt 0
8then
9	T=-Tlatin1
10else
11if test "X$LC_CTYPE" = "Xru_SU.KOI8-R" || test "X$LANG" = "Xru_SU.KOI8-R"
12then
13	T=-Tkoi8-r
14else
15	T=-Tascii
16fi
17fi
18opts=
19
20for i
21do
22	case $1 in
23	-h)
24		opts="$opts -P-h"
25		;;
26	-[eq]|-s*)
27		# ignore these options
28		;;
29	-[mrnoT])
30		echo "$prog: option $1 requires an argument" >&2
31		exit 1
32		;;
33	-i|-[mrno]*)
34		opts="$opts $1";
35		;;
36
37	-Tascii|-Tlatin1|-Tkoi8-r)
38		T=$1
39		;;
40	-T*)
41		# ignore other devices
42		;;
43	-u*)
44		# Solaris 2.2 `man' uses -u0; ignore it,
45		# since `less' and `more' can use the emboldening info.
46		;;
47	--)
48		shift
49		break
50		;;
51	-)
52		break
53		;;
54	-*)
55		echo "$prog: invalid option $1" >&2
56		exit 1
57		;;
58	*)
59		break
60		;;
61	esac
62	shift
63done
64
65# This shell script is intended for use with man, so warnings are
66# probably not wanted.  Also load nroff-style character definitions.
67exec groff -Wall -mtty-char $T $opts ${1+"$@"}
68