Final realease of nroff. Reviewed-by: mlichvar and skasal

This commit is contained in:
Marcela Mašláňová 2008-01-25 07:46:15 +00:00
parent ce8b802af9
commit 36fd98f7e3

19
nroff
View File

@ -4,8 +4,7 @@
prog="$0" prog="$0"
charset_in=iso-8859-1 charset_in=iso-8859-1
charset_out=`locale charmap 2>/dev/null` charset_out=`locale charmap 2>/dev/null`
# we prefer utf8 opts="-mtty-char"
opts="-mtty-char -Tutf8"
for i for i
do do
@ -19,12 +18,10 @@ do
exit 1 ;; exit 1 ;;
-[iptSUC] | -[mrno]*) -[iptSUC] | -[mrno]*)
opts="$opts $1" ;; opts="$opts $1" ;;
# someone wants specified -T, let's change opts from utf8
-Tascii | -Tlatin1 | -Tutf8 | -Tcp1047 | -Tascii8 | -Tnippon | -Tkorean) -Tascii | -Tlatin1 | -Tutf8 | -Tcp1047 | -Tascii8 | -Tnippon | -Tkorean)
T=$1 ; T=$1 ;;
opts="-mtty-char $T";;
-[eq] | -s* | -u* | -T*) -[eq] | -s* | -u* | -T*)
# ignore other devices # ignore these options
;; ;;
-v | --version) -v | --version)
echo $"GNU nroff (groff) with Red Hat i18n/l10n support" echo $"GNU nroff (groff) with Red Hat i18n/l10n support"
@ -49,6 +46,11 @@ do
shift shift
done done
# Don't convert encodings when -T is specified
[ -n "$T" ] && exec /usr/bin/groff $opts $T ${1+"$@"} 2>/dev/null
opts="$opts -Tutf8"
if TMPFILE=$(mktemp /tmp/man.XXXXXX 2>/dev/null); then if TMPFILE=$(mktemp /tmp/man.XXXXXX 2>/dev/null); then
trap "rm -f $TMPFILE" 0 1 2 3 15 trap "rm -f $TMPFILE" 0 1 2 3 15
cat ${1+"$@"} >| $TMPFILE cat ${1+"$@"} >| $TMPFILE
@ -57,10 +59,6 @@ else
TMPFILE=buf TMPFILE=buf
fi fi
# if -T was set -> just run groff and quit nroff
if [ -n "$T" ]; then
/usr/bin/groff -mtty-char $opts ${TMPFILE} 2>/dev/null
else
if [ $TMPFILE = buf ]; then if [ $TMPFILE = buf ]; then
echo -n "$buf" | iconv -f utf-8 -t utf-8 &>/dev/null && charset_in=utf-8 echo -n "$buf" | iconv -f utf-8 -t utf-8 &>/dev/null && charset_in=utf-8
else else
@ -100,5 +98,4 @@ else
rm -f $TMPFILE rm -f $TMPFILE
fi fi
fi fi
fi
# eof # eof