Add feature.

This commit is contained in:
Marcela Mašláňová 2007-07-03 09:53:23 +00:00
parent 73243046a4
commit 19207b66bf
2 changed files with 40 additions and 14 deletions

View File

@ -3,7 +3,7 @@
Summary: A document formatting system
Name: groff
Version: 1.18.1.4
Release: 4%{?dist}
Release: 5%{?dist}
License: GPL
Group: Applications/Publishing
URL: http://groff.ffii.org
@ -233,6 +233,9 @@ exit 0
%endif
%changelog
* Mon Jul 2 2007 Marcela Maslanova <mmaslano@redhat.com> - 1.18.1.4-5
- Resolves: rhbz#245934
* Tue Feb 27 2007 Marcela Maslanova <mmaslano@redhat.com> - 1.18.1.4-4
- merge review
- rhbz#225859 review

45
nroff
View File

@ -4,7 +4,7 @@
prog="$0"
charset_in=iso-8859-1
charset_out=`locale charmap 2>/dev/null`
opts=
opts="-mtty-char -Tutf8"
for i
do
@ -44,15 +44,21 @@ do
shift
done
TMPFILE=$(mktemp /tmp/man.XXXXXX)
if TMPFILE=$(mktemp /tmp/man.XXXXXX 2>/dev/null); then
trap "rm -f $TMPFILE" 0 1 2 3 15
cat ${1+"$@"} >| ${TMPFILE}
if iconv -f utf-8 -t utf-8 -o /dev/null ${TMPFILE} 2>/dev/null
then
charset_in=utf-8
cat ${1+"$@"} >| $TMPFILE
else
buf=$(cat ${1+"$@"})
TMPFILE=buf
fi
if [ $TMPFILE = buf ]; then
echo -n "$buf" | iconv -f utf-8 -t utf-8 &>/dev/null && charset_in=utf-8
else
iconv -f utf-8 -t utf-8 $TMPFILE &>/dev/null && charset_in=utf-8
fi
if [ $charset_in != utf-8 ]; then
echo XXX
echo XXX $"WARNING: old character encoding and/or character set"
echo XXX
@ -64,10 +70,27 @@ 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.
/usr/bin/iconv -f ${charset_in} -t utf-8 ${TMPFILE} | \
/usr/bin/groff -mtty-char -Tutf8 $opts 2>/dev/null | \
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
else
exec < $TMPFILE
rm -f $TMPFILE
exec /usr/bin/groff $opts 2>/dev/null
fi
else
if [ $TMPFILE = buf ]; then
echo -n "$buf" | \
/usr/bin/iconv -f $charset_in -t utf-8 | \
/usr/bin/groff $opts 2>/dev/null | \
/usr/bin/iconv -f utf-8 -t ${charset_out}//translit
else
/usr/bin/iconv -f $charset_in -t utf-8 $TMPFILE | \
/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
# eof