(file) Return to sliceprint CVS log (file) (dir) Up to [RizwankCVS] / testProject / bin

 1 rizwank 1.1 #!/usr/local/bin/perl
 2             # -*- perl -*-
 3             #
 4             # Print documents with long lines.
 5             # Copyright (c) 1996-1999 Markku Rossi
 6             #
 7             # Author: Markku Rossi <mtr@iki.fi>
 8             #
 9             
10             #
11             # This file is part of GNU enscript.
12             #
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)
16             # any later version.
17             #
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.
22 rizwank 1.1 #
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, 59 Temple Place - Suite 330,
26             # Boston, MA 02111-1307, USA.
27             #
28             
29             $enscript = "enscript";
30             
31             $program = $0;
32             $program =~ s/.*\///g;
33             
34             sub usage {
35                 warn "Usage: $program [ENSCRIPT_OPTION]... [FILE]...\n";
36             }
37             
38             # Handle arguments.
39             $args = "--extended-return-values";
40             $files = "";
41             while ($arg = shift(@ARGV)) {
42                 if ($arg eq "--help") {
43 rizwank 1.1 	&usage;
44             	exit 0;
45                 } elsif ($arg eq "--version") {
46             	warn "sliceprint 1.0\n";
47             	exit 0;
48                 } elsif ($arg =~ /^-p(.+)$/
49             	|| $arg =~ /^-o(.+)$/
50             	|| $arg =~ /^--output=(.+)$/) {
51             	$output_file = $1;
52                 } elsif ($arg eq "-p" || $arg eq "-o") {
53             	$output_file = shift(@ARGV);
54                 } elsif ($arg =~ /^-/) {
55             	$args .= " $arg";
56                 } else {
57             	$files .= " $arg";
58                 }
59             }
60             
61             # Check if output file is "-".
62             if (defined($output_file) && $output_file eq "-") {
63                 die "$program: output file can't be stdout\n";
64 rizwank 1.1 }
65             
66             $slice = 0;
67             while (1) {
68                 $slice++;
69                 if (defined($output_file)) {
70             	$cmd = "$enscript" . $args . " --slice=$slice -p"
71             	    . $output_file . "." . $slice . " " . $files;
72                 } else {
73             	$cmd = "$enscript" . $args . " --slice=$slice" . $files;
74                 }
75                 print "printing slice $slice...\n";
76                 $result = `$cmd 2>&1`;
77                 if ($result !~ ".*lines were.*") {
78             	last;
79                 }
80             }

Rizwan Kassim
Powered by
ViewCVS 0.9.2