You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-utils-1/install/patches/sys-apps/man-1.6f-koi8r.patch

102 lines
3.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

diff --git a/configure b/configure
index f6e9e78..4138ba9 100755
--- a/configure
+++ b/configure
@@ -474,9 +474,9 @@ else
then
if test $Fnroff = "missing"
then
- nroff="nroff -Tascii -c -mandoc"
+ nroff="/usr/bin/man2nroff -Tascii -c -mandoc"
else
- nroff="$Fnroff -mandoc"
+ nroff="/usr/bin/man2nroff -mandoc -Tlatin1"
fi
troff="troff -mandoc"
echo "Warning: could not find groff"
@@ -485,7 +485,7 @@ else
then
nroff="$Fgroff -Tlatin1 -mandoc"
else
- nroff="$Fnroff -mandoc"
+ nroff="/usr/bin/man2nroff -mandoc -Tlatin1"
fi
troff="$Fgroff -Tps -mandoc"
jnroff="$Fgroff -Tnippon -mandocj"
@@ -1248,6 +1248,7 @@ man=$bindir/man
apropos=$bindir/apropos
whatis=$bindir/whatis
man2dvi=$bindir/man2dvi
+man2nroff=$bindir/man2nroff
makewhatis=$sbindir/makewhatis
man_config_dir=$confdir
man_config_file=$confdir/$conffilename
@@ -1351,6 +1352,7 @@ s,@man@,$man,
s,@apropos@,$apropos,
s,@whatis@,$whatis,
s,@man2dvi@,$man2dvi,
+s,@man2nroff@,$man2nroff,
s,@makewhatis@,$makewhatis,
s,@man_config_dir@,$man_config_dir,
s,@man_config_file@,$man_config_file,
diff --git a/src/Makefile.in b/src/Makefile.in
index 9e95cab..0db1ad4 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -105,6 +105,7 @@ install: all apropos whatis makewhatis
$(INSTALL) -c -m 755 apropos $(DESTDIR)$(PREFIX)@apropos@
$(INSTALL) -c -m 755 whatis $(DESTDIR)$(PREFIX)@whatis@
$(INSTALL) -c -m 755 man2dvi $(DESTDIR)$(PREFIX)@man2dvi@
+ $(INSTALL) -c -m 755 man2nroff $(DESTDIR)$(PREFIX)@man2nroff@
mkdir -p $(DESTDIR)$(PREFIX)@sbindir@
$(INSTALL) -c -m 754 makewhatis $(DESTDIR)$(PREFIX)@makewhatis@
mkdir -p $(DESTDIR)$(PREFIX)@man_config_dir@
diff --git a/src/man2nroff b/src/man2nroff
new file mode 100755
index 0000000..11b871a
--- /dev/null
+++ b/src/man2nroff
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+#-*- coding: utf-8 -*-
+#------------------------------------------------------------------------------
+# manrc
+# Copyright ©2009 Mir Calculate Ltd.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#------------------------------------------------------------------------------
+
+import sys
+import subprocess
+import os
+
+buf = sys.stdin.read()
+
+# проверяем локаль и есть ли символы выше ascii
+if os.environ.get("LANG") == "ru_RU.UTF-8" and \
+ len([ i for i in buf if ord(i)>127 ]) > 0:
+ # конвертируем текст вначале через enconv, а в конце через iconv
+ convert_string = '/usr/bin/enconv -L ru -x KOI8-R |' \
+ '/usr/bin/nroff %s | iconv -f koi8-r' % " ".join(sys.argv[1:])
+else:
+ convert_string = '/usr/bin/nroff -mandoc -Tlatin1 -c'
+
+pipe = subprocess.Popen(convert_string,
+ stdin=subprocess.PIPE,
+ stdout=sys.stdout,
+ stderr=subprocess.PIPE,
+ close_fds=True,shell=True)
+pipe.stdin.write(buf)
+pipe.stdin.close()