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";
28 $ENV{LC_ALL} = "C"; # we parse enscript's output
31 $program =~ s/.*\///g;
34 warn "Usage: $program [-oFILE] [ENSCRIPT_OPTION]... [FILE]...\n";
38 $args = "--extended-return-values";
40 while ($arg = shift(@ARGV)) {
41 if ($arg eq "--help") {
44 } elsif ($arg eq "--version") {
45 warn "sliceprint 1.0\n";
47 } elsif ($arg =~ /^-p(.+)$/
49 || $arg =~ /^--output=(.+)$/) {
51 } elsif ($arg eq "-p" || $arg eq "-o") {
52 $output_file = shift(@ARGV);
53 } elsif ($arg =~ /^-/) {
60 # Check if output file is "-".
61 if (defined($output_file) && $output_file eq "-") {
62 die "$program: output file can't be stdout\n";
68 if (defined($output_file)) {
69 $cmd = "$enscript " . $args . " --slice=$slice -p"
70 . $output_file . "." . $slice . " " . $files;
72 $cmd = "$enscript " . $args . " --slice=$slice" . $files;
74 print "printing slice $slice...\n";
75 $result = `$cmd 2>&1`;
77 if ($result !~ ".*line.* were wrapped.*") {