Nroff is now fixed for working with or without -T option.
This commit is contained in:
parent
88c2d0a7f6
commit
ce8b802af9
8
nroff
8
nroff
@ -4,6 +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 -Tutf8"
|
opts="-mtty-char -Tutf8"
|
||||||
|
|
||||||
for i
|
for i
|
||||||
@ -18,6 +19,7 @@ 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";;
|
opts="-mtty-char $T";;
|
||||||
@ -55,6 +57,10 @@ 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
|
||||||
@ -94,5 +100,5 @@ else
|
|||||||
rm -f $TMPFILE
|
rm -f $TMPFILE
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
# eof
|
# eof
|
||||||
|
97
nroff.patch
97
nroff.patch
@ -1,97 +0,0 @@
|
|||||||
diff -up ./nroff.old ./nroff
|
|
||||||
--- ./nroff.old 2007-08-16 16:11:35.000000000 +0200
|
|
||||||
+++ ./nroff 2008-01-23 14:22:19.000000000 +0100
|
|
||||||
@@ -6,51 +6,6 @@ charset_in=iso-8859-1
|
|
||||||
charset_out=`locale charmap 2>/dev/null`
|
|
||||||
opts="-mtty-char -Tutf8"
|
|
||||||
|
|
||||||
-# Default device.
|
|
||||||
-# First try the "locale charmap" command, because it's most reliable.
|
|
||||||
-# On systems where it doesn't exist, look at the environment variables.
|
|
||||||
-case "`locale charmap 2>/dev/null`" in
|
|
||||||
- UTF-8)
|
|
||||||
- T=-Tutf8 ;;
|
|
||||||
- ISO-8859-1)
|
|
||||||
- T=-Tlatin1 ;;
|
|
||||||
- IBM-1047)
|
|
||||||
- T=-Tcp1047 ;;
|
|
||||||
- EUC-JP)
|
|
||||||
- T=-Tnippon ;;
|
|
||||||
- EUC-KR)
|
|
||||||
- T=-Tkorean ;;
|
|
||||||
- *)
|
|
||||||
- case "${LC_ALL-${LC_CTYPE-${LANG}}}" in
|
|
||||||
- *.UTF-8)
|
|
||||||
- T=-Tutf8 ;;
|
|
||||||
- iso_8859_1 | *.ISO-8859-1)
|
|
||||||
- T=-Tlatin1 ;;
|
|
||||||
- *.IBM-1047)
|
|
||||||
- T=-Tcp1047 ;;
|
|
||||||
- ja_JP.ujis | ja_JP.eucJP)
|
|
||||||
- T=-Tnippon ;;
|
|
||||||
- ko_KR.eucKR)
|
|
||||||
- T=-Tkorean ;;
|
|
||||||
- *)
|
|
||||||
- case "$LESSCHARSET" in
|
|
||||||
- utf-8)
|
|
||||||
- T=-Tutf8 ;;
|
|
||||||
- latin1)
|
|
||||||
- T=-Tlatin1 ;;
|
|
||||||
- cp1047)
|
|
||||||
- T=-Tcp1047 ;;
|
|
||||||
- japanese)
|
|
||||||
- T=-Tnippon ;;
|
|
||||||
- ko)
|
|
||||||
- T=-Tkorean ;;
|
|
||||||
- *)
|
|
||||||
- T=-Tascii8 ;;
|
|
||||||
- esac ;;
|
|
||||||
- esac ;;
|
|
||||||
-esac
|
|
||||||
-
|
|
||||||
-
|
|
||||||
for i
|
|
||||||
do
|
|
||||||
case $1 in
|
|
||||||
@@ -58,19 +13,16 @@ do
|
|
||||||
opts="$opts -P-c" ;;
|
|
||||||
-h)
|
|
||||||
opts="$opts -P-h" ;;
|
|
||||||
- -[eq] | -s*)
|
|
||||||
- # ignore these options
|
|
||||||
- ;;
|
|
||||||
-[mrnoT])
|
|
||||||
echo $"option $1 requires an argument" >&2
|
|
||||||
exit 1 ;;
|
|
||||||
-[iptSUC] | -[mrno]*)
|
|
||||||
opts="$opts $1" ;;
|
|
||||||
- -Tascii | -Tlatin1 | -Tutf8 | -Tcp1047 | -Tascii8 | -Tnippon | -Tkorean)
|
|
||||||
- opts=
|
|
||||||
- T=$1 ;;
|
|
||||||
- -T*)
|
|
||||||
- # ignore other devices
|
|
||||||
+ -Tascii | -Tlatin1 | -Tutf8 | -Tcp1047 | -Tascii8 | -Tnippon | -Tkorean)
|
|
||||||
+ T=$1 ;
|
|
||||||
+ opts="-mtty-char $T";;
|
|
||||||
+ -[eq] | -s* | -u* | -T*)
|
|
||||||
+ # ignore other devices
|
|
||||||
;;
|
|
||||||
-v | --version)
|
|
||||||
echo $"GNU nroff (groff) with Red Hat i18n/l10n support"
|
|
||||||
@@ -120,7 +72,6 @@ export LC_ALL=en_US.UTF-8
|
|
||||||
|
|
||||||
# This shell script is intended for use with man, so warnings are
|
|
||||||
# probably not wanted. Also load nroff-style character definitions.
|
|
||||||
-
|
|
||||||
if [ $charset_in = utf-8 -a $charset_out = UTF-8 ]; then
|
|
||||||
if [ $TMPFILE = buf ]; then
|
|
||||||
echo -n "$buf" | /usr/bin/groff $opts 2>/dev/null
|
|
||||||
@@ -140,7 +91,7 @@ else
|
|
||||||
/usr/bin/groff $opts 2>/dev/null | \
|
|
||||||
/usr/bin/iconv -f utf-8 -t ${charset_out}//translit
|
|
||||||
|
|
||||||
- rm -f $TMPFILE
|
|
||||||
+ rm -f $TMPFILE
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user