Hi all, I'm new to Parrot and Perl6. I hope this is an ok way to submit a patch.
--- - Allow assemble.pl to read from STDIN - Use the '-' symbol to indicate STDIN - Made invocation failures/usages behave more correctly - Minor refactorings in this code section .... Index: assemble.pl =================================================================== RCS file: /cvs/public/parrot/assemble.pl,v retrieving revision 1.82 diff -u -r1.82 assemble.pl --- assemble.pl 18 Jul 2002 02:13:27 -0000 1.82 +++ assemble.pl 1 Aug 2002 09:25:00 -0000 @@ -1047,35 +1047,33 @@ sub process_args { my ($args,$files) = @_; - for (my $count = 0; $count < @ARGV; $count++) { - my $arg = $ARGV[$count]; - + while (my $arg = shift @ARGV) { if($arg =~ /^-(c|-checksyntax)$/) { $args->{-c} = 1; } elsif($arg =~ /^-E$/) { $args->{-E} = 1; } - elsif($arg =~ /^-(o|-output)$/) { $args->{-o} = $ARGV[++$count]; } - elsif($arg =~ /^-(h|-help)$/) { Usage(); } - else { - push @$files,$arg; - } - } - unless(@$files) { - print STDERR "No files to process.\n"; - Usage(); + elsif($arg =~ /^-(o|-output)$/) { $args->{-o} = shift @ARGV; } + elsif($arg =~ /^-(h|-help)$/) { Usage(); exit 0; } + elsif($arg =~ /^-./) { Fail("Invalid option '$arg'\n"); } + else { push @$files,$arg; } } - for(@$files) { - next if -e $_; - print STDERR "File '$_' does not exist.\n"; + Fail("No files to process.\n") unless(@$files); + Fail("File '$_' does not exist.\n") for grep { not (-e or /^-$/) } @$files; +} + +sub Fail { + print STDERR @_; Usage(); - } + exit 1; } sub Usage { print <<" _EOF_"; + usage: $0 [options] file [file...] -E Preprocess input files and terminate processing -h,--help Print this message -o,--output Write file -c,-checksyntax Check syntax only, do not generate bytecode + _EOF_ }