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