summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcela Mašláňová <mmaslano@fedoraproject.org>2007-07-03 09:53:23 +0000
committerMarcela Mašláňová <mmaslano@fedoraproject.org>2007-07-03 09:53:23 +0000
commit19207b66bfc5d43b71602823bc3401b803d70339 (patch)
tree5ea3a9cca63aeab4b70826dde08ef832da592379
parent73243046a4f00d91f3767d87a1d14ee7953e1aef (diff)
downloadgroff-19207b66bfc5d43b71602823bc3401b803d70339.tar.gz
groff-19207b66bfc5d43b71602823bc3401b803d70339.tar.xz
groff-19207b66bfc5d43b71602823bc3401b803d70339.zip
-rw-r--r--groff.spec5
-rw-r--r--nroff47
2 files changed, 39 insertions, 13 deletions
diff --git a/groff.spec b/groff.spec
index 099b71d..132cbed 100644
--- a/groff.spec
+++ b/groff.spec
@@ -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
diff --git a/nroff b/nroff
index 2c7f3d0..fb9d176 100644
--- a/nroff
+++ b/nroff
@@ -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)
-trap "rm -f $TMPFILE" 0 1 2 3 15
-
-cat ${1+"$@"} >| ${TMPFILE}
+if TMPFILE=$(mktemp /tmp/man.XXXXXX 2>/dev/null); then
+ trap "rm -f $TMPFILE" 0 1 2 3 15
+ cat ${1+"$@"} >| $TMPFILE
+else
+ buf=$(cat ${1+"$@"})
+ TMPFILE=buf
+fi
-if iconv -f utf-8 -t utf-8 -o /dev/null ${TMPFILE} 2>/dev/null
-then
- charset_in=utf-8
+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