diff --git a/utf8-to-roff b/utf8-to-roff
index de937782d0ce78845105f92f471477a0af69c561..9bb178f10da13dd6535c00a0ee3f692cd9b5e3c9 100755 (executable)
--- a/utf8-to-roff
+++ b/utf8-to-roff
-#! /usr/bin/perl -w -CI
+if (true || '\'); then exec perl -CI "$0" "$@"; fi # ') {}
+# The above uses the fact that backslash isn't special in single quotes in
+# shell script, whereas in perl it escapes the following single quote.
+#
+# The problem it tries to solve is that we want perl to be run with -CI flag
+# (to have stdin interpreted as utf-8), so we would use `#! /usr/bin/perl -CI',
+# except that if we do that then perl 5.10 complains about it being too late
+# to apply -CI if the script is run with `perl -CI ./utf8-to-roff', as we want
+# to do from the Makefile. The reason we don't do `./utf8-to-roff' from the makefile
+# is that then we require the #! line to have the right location of perl instead of
+# just consulting the path. (Similarly, we could use `#! /usr/bin/env perl -CI',
+# though that still requires that /usr/bin/env exist.) The reason we don't just
+# remove the `-CI' from the #! line is that then the script couldn't be run correctly
+# with ./utf8-to-roff.
+
+
# Converts a man page from utf8 (not understood by groff 1.18) to groff escapes.
# I couldn't find any existing tool to convert from utf8 to groff, though I
# seem to recall seeing some code to do so somewhere.
#
# Hereby released into public domain by Peter Moulder.
+use warnings;
use strict;
# Table generated automatically using:
# zcat /usr/share/man/man7/groff_char.7.gz |groff -man -Tutf8| col -pb | grep '\\\['|
# perl -CI -nae 'my ($ch, $seq) = @F; if (ord($ch) >= 128) { printf(" 0x\%x, q{\%s},\n", ord($ch), $seq); }'
-# with č (0x10d) manually translated as ˇc (\[ah]c). (Anyone have a better translation, e.g. using
+# with č (0x10d) manually translated as cˇ (c\[ah]). (Anyone have a better translation, e.g. using
# overprint? \[vc] doesn't work, btw.)
+# Similarly, ć (0x107) has been manually translated as c´ (c\[aa]), and ń (0x144) as n´ (n\[aa]).
my %map = (
0xd0, q{\[-D]},
0xf0, q{\[Sd]},
0xe3, q{\[~a]},
0xf1, q{\[~n]},
0xf5, q{\[~o]},
- 0x107, q{\[ah]c}, # Added manually; see above.
- 0x10d, q{\[ah]c}, # Added manually; see above.
+ 0x107, q{c\[aa]}, # Added manually; see above.
+ 0x10d, q{c\[ah]}, # Added manually; see above.
0x160, q{\[vS]},
0x161, q{\[vs]},
0x17d, q{\[vZ]},
0xe7, q{\[,c]},
0x141, q{\[/L]},
0x142, q{\[/l]},
+ 0x144, q{n\[aa]}, # Added manually; see above.
0xd8, q{\[/O]},
0xf8, q{\[/o]},
0xc5, q{\[oA]},