summaryrefslogtreecommitdiffstats
path: root/contrib/groff/nroff/nroff.sh
blob: 05b953b54886fe3ab440db6a1aab80d8a0214479 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
# Emulate nroff with groff.

prog="$0"
# Default device.
if test `expr "$LC_CTYPE" : ".*\.ISO_8859-1"` -gt 0 || \
   test `expr "$LANG" : ".*\.ISO_8859-1"` -gt 0
then
	T=-Tlatin1
else
if test "X$LC_CTYPE" = "Xru_SU.KOI8-R" || test "X$LANG" = "Xru_SU.KOI8-R"
then
	T=-Tkoi8-r
else
	T=-Tascii
fi
fi
opts=

for i
do
	case $1 in
	-h)
		opts="$opts -P-h"
		;;
	-[eq]|-s*)
		# ignore these options
		;;
	-[mrnoT])
		echo "$prog: option $1 requires an argument" >&2
		exit 1
		;;
	-i|-[mrno]*)
		opts="$opts $1";
		;;

	-Tascii|-Tlatin1|-Tkoi8-r)
		T=$1
		;;
	-T*)
		# ignore other devices
		;;
	-u*)
		# Solaris 2.2 `man' uses -u0; ignore it,
		# since `less' and `more' can use the emboldening info.
		;;
	--)
		shift
		break
		;;
	-)
		break
		;;
	-*)
		echo "$prog: invalid option $1" >&2
		exit 1
		;;
	*)
		break
		;;
	esac
	shift
done

# This shell script is intended for use with man, so warnings are
# probably not wanted.  Also load nroff-style character definitions.
exec groff -Wall -mtty-char $T $opts ${1+"$@"}
OpenPOWER on IntegriCloud