4 # Print documents with long lines.
5 # Copyright (c) 1996-1999 Markku Rossi
7 # Author: Markku Rossi <mtr@iki.fi>
11 # This file is part of GNU Enscript.
13 # Enscript is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation, either version 3 of the License, or
16 # (at your option) any later version.
18 # Enscript is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with Enscript. If not, see <http://www.gnu.org/licenses/>.
27 $enscript = "enscript";
30 $program =~ s/.*\///g;
33 warn "Usage: $program [ENSCRIPT_OPTION]... [FILE]...\n";
37 $args = "--extended-return-values";
39 while ($arg = shift(@ARGV)) {
40 if ($arg eq "--help") {
43 } elsif ($arg eq "--version") {
44 warn "sliceprint 1.0\n";
46 } elsif ($arg =~ /^-p(.+)$/
48 || $arg =~ /^--output=(.+)$/) {
50 } elsif ($arg eq "-p" || $arg eq "-o") {
51 $output_file = shift(@ARGV);
52 } elsif ($arg =~ /^-/) {
59 # Check if output file is "-".
60 if (defined($output_file) && $output_file eq "-") {
61 die "$program: output file can't be stdout\n";
67 if (defined($output_file)) {
68 $cmd = "$enscript" . $args . " --slice=$slice -p"
69 . $output_file . "." . $slice . " " . $files;
71 $cmd = "$enscript" . $args . " --slice=$slice" . $files;
73 print "printing slice $slice...\n";
74 $result = `$cmd 2>&1`;
75 if ($result !~ ".*lines were.*") {