nroff.sh (121880) | nroff.sh (151503) |
---|---|
1#!/bin/sh | 1#! /bin/sh |
2# Emulate nroff with groff. | 2# Emulate nroff with groff. |
3# $FreeBSD: head/contrib/groff/src/roff/nroff/nroff.sh 121880 2003-11-02 07:27:40Z ru $ | 3# $FreeBSD: head/contrib/groff/src/roff/nroff/nroff.sh 151503 2005-10-20 10:53:15Z ru $ |
4 5prog="$0" 6# Default device. 7# First try the "locale charmap" command, because it's most reliable. 8# On systems where it doesn't exist, look at the environment variables. | 4 5prog="$0" 6# Default device. 7# First try the "locale charmap" command, because it's most reliable. 8# On systems where it doesn't exist, look at the environment variables. |
9case "`locale charmap 2>/dev/null`" in | 9case "`exec 2>/dev/null ; locale charmap`" in 10 UTF-8) 11 T=-Tutf8 ;; |
10 ISO*8859-1 | ISO*8859-15) 11 T=-Tlatin1 ;; 12 KOI8-R) 13 T=-Tkoi8-r ;; | 12 ISO*8859-1 | ISO*8859-15) 13 T=-Tlatin1 ;; 14 KOI8-R) 15 T=-Tkoi8-r ;; |
14 UTF-8) 15 T=-Tutf8 ;; | |
16 IBM-1047) 17 T=-Tcp1047 ;; 18 *) 19 case "${LC_ALL-${LC_CTYPE-${LANG}}}" in | 16 IBM-1047) 17 T=-Tcp1047 ;; 18 *) 19 case "${LC_ALL-${LC_CTYPE-${LANG}}}" in |
20 iso_8859_1 | *.ISO*8859-1 | *.ISO*8859-15) | 20 *.UTF-8) 21 T=-Tutf8 ;; 22 iso_8859_1 | *.ISO-8859-1 | *.ISO8859-1 | \ 23 iso_8859_15 | *.ISO-8859-15 | *.ISO8859-15) |
21 T=-Tlatin1 ;; 22 *.KOI8-R) 23 T=-Tkoi8-r ;; | 24 T=-Tlatin1 ;; 25 *.KOI8-R) 26 T=-Tkoi8-r ;; |
24 *.UTF-8) 25 T=-Tutf8 ;; | |
26 *.IBM-1047) 27 T=-Tcp1047 ;; 28 *) 29 case "$LESSCHARSET" in | 27 *.IBM-1047) 28 T=-Tcp1047 ;; 29 *) 30 case "$LESSCHARSET" in |
31 utf-8) 32 T=-Tutf8 ;; |
|
30 latin1) 31 T=-Tlatin1 ;; 32 koi8-r) 33 T=-Tkoi8-r ;; | 33 latin1) 34 T=-Tlatin1 ;; 35 koi8-r) 36 T=-Tkoi8-r ;; |
34 utf-8) 35 T=-Tutf8 ;; | |
36 cp1047) 37 T=-Tcp1047 ;; 38 *) 39 T=-Tascii ;; 40 esac ;; 41 esac ;; 42esac 43opts= --- 5 unchanged lines hidden (view full) --- 49 case $1 in 50 -c) 51 opts="$opts -P-c" ;; 52 -h) 53 opts="$opts -P-h" ;; 54 -[eq] | -s*) 55 # ignore these options 56 ;; | 37 cp1047) 38 T=-Tcp1047 ;; 39 *) 40 T=-Tascii ;; 41 esac ;; 42 esac ;; 43esac 44opts= --- 5 unchanged lines hidden (view full) --- 50 case $1 in 51 -c) 52 opts="$opts -P-c" ;; 53 -h) 54 opts="$opts -P-h" ;; 55 -[eq] | -s*) 56 # ignore these options 57 ;; |
57 -[dmrnoT]) | 58 -[dMmrnoT]) |
58 echo "$prog: option $1 requires an argument" >&2 59 exit 1 ;; | 59 echo "$prog: option $1 requires an argument" >&2 60 exit 1 ;; |
60 -[iptSUC] | -[dmrno]*) | 61 -[iptSUC] | -[dMmrno]*) |
61 opts="$opts $1" ;; 62 -Tascii | -Tlatin1 | -Tkoi8-r | -Tutf8 | -Tcp1047) 63 T=$1 ;; 64 -T*) 65 # ignore other devices 66 ;; 67 -u*) | 62 opts="$opts $1" ;; 63 -Tascii | -Tlatin1 | -Tkoi8-r | -Tutf8 | -Tcp1047) 64 T=$1 ;; 65 -T*) 66 # ignore other devices 67 ;; 68 -u*) |
68 # Solaris 2.2 `man' uses -u0; ignore it, | 69 # Solaris 2.2 through at least Solaris 9 `man' invokes 70 # `nroff -u0 ... | col -x'. Ignore the -u0, |
69 # since `less' and `more' can use the emboldening info. | 71 # since `less' and `more' can use the emboldening info. |
70 ;; | 72 # However, disable SGR, since Solaris `col' mishandles it. 73 opts="$opts -P-c" ;; |
71 -v | --version) 72 echo "GNU nroff (groff) version @VERSION@" 73 exit 0 ;; 74 --help) | 74 -v | --version) 75 echo "GNU nroff (groff) version @VERSION@" 76 exit 0 ;; 77 --help) |
75 echo "usage: nroff [-CchipStUv] [-dCS] [-mNAME] [-nNUM] [-oLIST] [-rCN] [-Tname] [FILE...]" | 78 echo "usage: nroff [-CchipStUv] [-dCS] [-MDIR] [-mNAME] [-nNUM] [-oLIST]" 79 echo " [-rCN] [-Tname] [FILE...]" |
76 exit 0 ;; 77 --) 78 shift 79 break ;; 80 -) 81 break ;; 82 -*) 83 echo "$prog: invalid option $1" >&2 84 exit 1 ;; 85 *) 86 break ;; 87 esac 88 shift 89done 90 | 80 exit 0 ;; 81 --) 82 shift 83 break ;; 84 -) 85 break ;; 86 -*) 87 echo "$prog: invalid option $1" >&2 88 exit 1 ;; 89 *) 90 break ;; 91 esac 92 shift 93done 94 |
95# Set up the `GROFF_BIN_PATH' variable 96# to be exported in the current `GROFF_RUNTIME' environment. 97 98@GROFF_BIN_PATH_SETUP@ 99export GROFF_BIN_PATH 100 |
|
91# This shell script is intended for use with man, so warnings are 92# probably not wanted. Also load nroff-style character definitions. 93 | 101# This shell script is intended for use with man, so warnings are 102# probably not wanted. Also load nroff-style character definitions. 103 |
94: ${GROFF_BIN_PATH=@BINDIR@} 95export GROFF_BIN_PATH 96PATH=$GROFF_BIN_PATH@SEP@$PATH groff -mtty-char $T $opts ${1+"$@"} | 104PATH="$GROFF_RUNTIME$PATH" groff -mtty-char $T $opts ${1+"$@"} |
97 98# eof | 105 106# eof |