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