Package: psptools Version: 1.2.2-6 Severity: normal This diff supercedes my #128669. There are some corrections to the original source with a few extras, for example:
1. The psplpr looks for %!PS-Adobe-3.0 instead of %!PS on the first line. The PPD allfeatures are more likely to be prepended to the beginning of the file unless the file is really DSC compliant. The parser also must have the %%BeginSetup and %%BeginProlog, for example, in a DSC document for those types of PPD features. So, prepending allfeatures should be more reliable. 2. The psplprdict can cause errors and is probably not used much. The psplprprolog should not now be included routinely. Anybody who used the /pagesetup def could see a change. 3. The -P printer form is now included. That was an outstanding item. The old -Pprinter is still there. The rest should be easy to see. My perl is still not good enough. Don [EMAIL PROTECTED] --- psptools-1.2.2.orig/src/psplpr.pl.in Wed Jul 3 04:49:28 1996 +++ psptools-1.2.2/src/psplpr.pl.in Mon Jan 14 16:24:08 2002 @@ -33,6 +33,8 @@ require 'ppd.pl'; require 'printer.pl'; +$used_prog_lpr = $prog_lpr; # default value (overridden by --output) + # # tell_user(what) # @@ -157,7 +159,7 @@ ++$dictsz if $pagesetup; } - return unless $dictsz; + return unless ($dictsz > 1); if (!$nodsc) { print "%%BeginResource: procset psplpr\n"; @@ -290,8 +292,8 @@ print "$who\n"; print "%%BoundingBox: 0 0 0 0\n%%Pages: 0\n"; print "%%EndComments\n"; - } else { - print "%!\n"; +# } else { +# print "%!\n"; } if (!$doc) { @@ -346,7 +348,7 @@ } if (!$doc) { - print "psplprdict begin psplprsetup end\n"; + print "psplprdict begin psplprsetup end\n" if countfeatures('PageSetup'); } if ($doc && $dsc) { @@ -507,22 +509,32 @@ ignoredeps('ExitServer'); ignoredeps('JCLSetup'); + local ($allout) = 0; + $_ = readpsline($conformant); if (!$_) { - %all_options = outputallfeatures($nodsc, !$dirty, $safer, - $nonstd, $special); + print "%!\n%%Creator: psplpr " . localtime() . "\n"; + print "%%EndComments\n"; + print "%\n% " . $myname . ": outputing all features... \n"; + %all_options = outputallfeatures($nodsc, 666, $safer, + $nonstd, $special) unless $allout; + $allout = 1; } else { $_ =~ s/^\004//; local($bad); - if ($dirty || ($bad = !/^%!PS/)) { + if ($dirty || ($bad = !/^%!PS-Adobe-3/)) { + print; + print "% " . $myname .": Looking for PS-Adobe-3.0 DSC conforming document...\n"; + print "% " . $myname .": with %%BeginProlog, %%BeginSetup, %%EndComments, etc. ... or\n"; + print "% " . $myname .": prepending! (not DSC compliant) at " . localtime() . "\n%\n"; local($first) = $_; - + %all_options = outputallfeatures($nodsc, 0, $safer, $nonstd, - $special); - + $special) unless $allout; + $allout = 1; if ($bad && !$dontglob) { $glob = 1; } @@ -538,13 +550,19 @@ ++$lineno; + if (/^%%Begin/) { $in_comment = 1; } elsif (/^%%End/) { $in_comment = 0; } - if (/^%%BeginProlog/) { + if (/^%%EndComments/) { + print "%%Modified: by psplpr ".localtime()."\n" if $nodsc >= 0; + print if $nodsc >= 0; + outputallfeatures ($nodsc, 0 ,$safer, $nonstd, $special) unless $allout; + $allout = 1; + } elsif (/^%%BeginProlog/) { print if $nodsc >= 0; ($_, $ps) = readfeatures($glob, $conformant, !$inc, !$chg, $del, $nodsc); @@ -598,7 +616,7 @@ } if (/^%%Page:/) { - local($addsc) = 0; + local($adddsc) = 0; if (!$prolog_output) { outputfeatures('Prolog', $nodsc, $safer, $nonstd, @@ -815,10 +833,15 @@ $opt_output = $args[1]; usage(1) if (!$opt_output); shift @args; - } elsif ($args[0] eq "-${lopt_prefix}lpr") { + } elsif ($args[0] eq "--${lopt_prefix}lpr") { $used_prog_lpr = $prog_lpr; - } elsif ($args[0] eq "-${lopt_prefix}lp") { + } elsif ($args[0] eq "--${lopt_prefix}lp") { $used_prog_lpr = $prog_lp; + } elsif ($args[0] eq "-${opt_prefix}P") { + $printer = $args[1]; + usage(1) if (($printer = $args[1]) eq ''); + $used_prog_lpr = $prog_lpr; + shift @args; } elsif ($args[0] eq "--${lopt_prefix}verbose") { $opt_verbose = 1; } elsif ($args[0] eq "-${opt_prefix}q"