mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Cleanup; use Getopt::Std; Loop multiple files from cmdline with <>
This commit is contained in:
parent
4dd9db446b
commit
4e8abf55ec
@ -2,16 +2,24 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
use Getopt::Std;
|
||||
|
||||
print "Usage: $0 [FILE]\n\tParses [FILE], outputing the result to stdout.\n"
|
||||
and exit if not @ARGV;
|
||||
my $HELP = "Usage: $0 [FILE]
|
||||
Parses [FILE], outputing the result to stdout.";
|
||||
|
||||
sub usage {
|
||||
print "@_\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
our($opt_h, $opt_v);
|
||||
getopts("hv") or usage($HELP);
|
||||
$opt_v and usage("Copyleft (c) 2006, Russ Rowan (See `COPYING')");
|
||||
usage($HELP) if $opt_h or @ARGV < 1;
|
||||
|
||||
my ($input) = @ARGV;
|
||||
my ($found, $start, $first, $gotone, $idpath);
|
||||
print "Copyleft© 2006, Russ Rowan (See `COPYING')\n" and exit if $input eq '-v';
|
||||
open FILEIN, "<$input" or print "File `$input' was not found.\n" and exit;
|
||||
$idpath = '';
|
||||
while (<FILEIN>)
|
||||
while (<>)
|
||||
{
|
||||
if ($found)
|
||||
{
|
||||
@ -43,4 +51,3 @@ while (<FILEIN>)
|
||||
next if not $found; $found = undef if $found eq 'sorta';
|
||||
print STDOUT $_ and $start = 1;
|
||||
}
|
||||
close FILEIN;
|
||||
|
Loading…
Reference in New Issue
Block a user