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 # This program 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 2, or (at your option)
18 # This program 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 this program; see the file COPYING. If not, write to
25 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
26 # Boston, MA 02110-1301, USA.
29 $enscript = "enscript";
32 $program =~ s/.*\///g;
35 warn "Usage: $program [ENSCRIPT_OPTION]... [FILE]...\n";
39 $args = "--extended-return-values";
41 while ($arg = shift(@ARGV)) {
42 if ($arg eq "--help") {
45 } elsif ($arg eq "--version") {
46 warn "sliceprint 1.0\n";
48 } elsif ($arg =~ /^-p(.+)$/
50 || $arg =~ /^--output=(.+)$/) {
52 } elsif ($arg eq "-p" || $arg eq "-o") {
53 $output_file = shift(@ARGV);
54 } elsif ($arg =~ /^-/) {
61 # Check if output file is "-".
62 if (defined($output_file) && $output_file eq "-") {
63 die "$program: output file can't be stdout\n";
69 if (defined($output_file)) {
70 $cmd = "$enscript" . $args . " --slice=$slice -p"
71 . $output_file . "." . $slice . " " . $files;
73 $cmd = "$enscript" . $args . " --slice=$slice" . $files;
75 print "printing slice $slice...\n";
76 $result = `$cmd 2>&1`;
77 if ($result !~ ".*lines were.*") {