diff options
| author | fukachan <fukachan> | 2003-01-26 03:11:27 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-01-26 03:11:27 +0000 |
| commit | 934a7ab9287bcfed10cb1e70b575f799b9d09fc4 (patch) | |
| tree | 99bb13315465936b74f9e3bd00076aa450fbc53a /fml/lib/FML/Command | |
| parent | 37a07be4bdb667f6672c777012eb7f79994b2b3a (diff) | |
| download | fml8-934a7ab9287bcfed10cb1e70b575f799b9d09fc4.tar.gz fml8-934a7ab9287bcfed10cb1e70b575f799b9d09fc4.tar.bz2 fml8-934a7ab9287bcfed10cb1e70b575f799b9d09fc4.zip | |
use FML::Restriction::Base::regexp_match() to check command line options.
FNF: remove $_
Diffstat (limited to 'fml/lib/FML/Command')
| -rw-r--r-- | fml/lib/FML/Command/DirUtils.pm | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fml/lib/FML/Command/DirUtils.pm b/fml/lib/FML/Command/DirUtils.pm index 7db4dd1d..b083c5ec 100644 --- a/fml/lib/FML/Command/DirUtils.pm +++ b/fml/lib/FML/Command/DirUtils.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: DirUtils.pm,v 1.11 2003/01/03 07:05:04 fukachan Exp $ +# $FML: DirUtils.pm,v 1.12 2003/01/25 09:14:05 fukachan Exp $ # package FML::Command::DirUtils; @@ -62,12 +62,12 @@ sub dir my $argv = $du_args->{ argv }; my $opt_ls = ''; - # XXX-TODO: define and use safe "option" regexp in FML::Restriction? - # XXX-TODO: safe "option" regexp [-A-Za-z0-9] ? # option: permit "ls [-A-Za-z]" syntax if (defined($du_args->{ opt_ls })) { - my $opt = $du_args->{ opt_ls }; - if ($opt =~ /^-[A-Za-z]+$/) { + use FML::Restriction::Base; + my $safe = new FML::Restriction::Base; + my $opt = $du_args->{ opt_ls }; + if ($safe->regexp_match('command_line_options', $opt)) { $opt_ls = $opt; } else { @@ -97,7 +97,8 @@ sub dir use FileHandle; my $fh = new FileHandle "$eval|"; if (defined $fh) { - while (<$fh>) { $curproc->reply_message($_);} + my $buf = undef; + while ($buf = <$fh>) { $curproc->reply_message($buf);} $fh->close(); } else { |
