--- a2ps-j.orig 2013-10-22 21:19:43.000000000 +0900 +++ a2ps-j 2013-10-22 21:20:30.000000000 +0900 @@ -51,14 +51,23 @@ @mon{@mon} = ($[ .. $#mon); @day{@day} = ($[ .. $#day); +my $LIBPAPER = 1; +if ($LIBPAPER) { + $default_paper = `%%LOCALBASE%%/bin/paperconf -n`; + chomp($default_paper); +} +@param_letter = ( 8.50, 11.06, 0.65, 1.2, 6.85, 9.5, 0.29, 0.22, 0.12, 'letter'); @param_us = ( 8.50, 11.06, 0.65, 1.2, 6.85, 9.5, 0.29, 0.22, 0.12, 'letter'); @param_a4 = ( 8.27, 11.64, 1.20, 1.2, 6.60, 9.8, 0.29, 0.22, 0.05, 'a4'); @param_b4 = (10.15, 14.31, 1.40, 1.2, 8.50, 9.5, 0.29, 0.22, 0.08, 'b4'); sub paper { local(*param) = 'param_' . $_[0]; - die "Unknown paper type: $_[0]\n" unless defined @param; + if (@param) { ($width, $height, $lmargin, $smargin, $fontsize_l, $fontsize_p, $portrait_header, $landscape_header, $paper_adjust, $paper_tray) = @param; + } else { + die "Unknown paper type: $_[0]\n"; + } } &paper($default_paper); @@ -192,7 +201,8 @@ if ($debug == 2) { require('dumpvar.pl'); - local($#) = '%.6g'; +## Perl 5.10.1 says $# is no longer supported +## local($#) = '%.6g'; &dumpvar('main', 'width', 'height', 'lmargin', 'smargin', 'font_size', 'sheet_height', 'sheet_width', 'char_width', 'skip_column', @@ -208,8 +218,14 @@ $file = shift; if ($file && !-r $file) { warn "$file: $!\n"; next; } if ($jisconvert) { - require 'flush.pl'; - &flush(STDOUT); + # flush.pl obsolete (originally in Perl 4) + # replaced with equivalent code of &flush(STDOUT) + local($old_stdout) = select(STDOUT); + $| = 1; + print ""; + $| = 0; + select($old_stdout); + # end of equivalent code open(F, "-|") || &jis($file); } else { $file = '-' if $file eq ''; @@ -476,10 +492,13 @@ } sub print_header { - require('ctime.pl'); return if $header_is_printed++; - chop(local($date) = &ctime(time)); + # ctime.pl obsolete (originally in Perl 4) + # ctime.pl behaves differently when TZ is not set, + # but the behavior will not affect the PostScript file details + local($date) = scalar localtime; + local($orientation) = $portrait ? "Portrait" : "Landscape"; print <<"---"; @@ -525,7 +544,8 @@ printf("/lines %d def\n", $linesperpage); printf("/columns %d def\n", $columnsperline); $sublabel = $default_sublabel unless defined $sublabel; - print "/date (", &date($sublabel, time), ") def\n"; + # function name changed to a2ps_date to avoid confusion + print "/date (", &a2ps_date($sublabel, time), ") def\n"; if ($ascii_mag) { printf("/doasciimag true def /asciimagsize %f def\n", $ascii_mag); } else { @@ -548,7 +568,8 @@ print "%%EndProlog\n\n"; } -sub date { +# function name changed to a2ps_date to avoid confusion +sub a2ps_date { local($_, $time) = @_; local($sec, $min, $hour, $mday, $mon, $year, $wday) = localtime($time); $year += 1900;