1
0
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:
Jonas Fonseca 2006-01-09 04:49:26 +01:00 committed by Jonas Fonseca
parent 4dd9db446b
commit 4e8abf55ec

View File

@ -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;