diff options
| author | fukachan <fukachan> | 2001-10-14 00:33:41 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-10-14 00:33:41 +0000 |
| commit | 2d5a3dc2d1d382a222429329a67948737120cd32 (patch) | |
| tree | 5ba0f59baa20513897328b046e62e2c6bf3d676a /fml/lib/FML/Process/Command.pm | |
| parent | 00f63a4085087e4828ebde340b49eb8dfe2df20e (diff) | |
| download | fml8-2d5a3dc2d1d382a222429329a67948737120cd32.tar.gz fml8-2d5a3dc2d1d382a222429329a67948737120cd32.tar.bz2 fml8-2d5a3dc2d1d382a222429329a67948737120cd32.zip | |
make argument vector from $command, $optargs -> $command_args
Diffstat (limited to 'fml/lib/FML/Process/Command.pm')
| -rw-r--r-- | fml/lib/FML/Process/Command.pm | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/fml/lib/FML/Process/Command.pm b/fml/lib/FML/Process/Command.pm index 93ae03b0..ed4c32fc 100644 --- a/fml/lib/FML/Process/Command.pm +++ b/fml/lib/FML/Process/Command.pm @@ -4,7 +4,7 @@ # Copyright (C) 2000,2001 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Command.pm,v 1.17 2001/10/13 03:12:35 fukachan Exp $ +# $FML: Command.pm,v 1.18 2001/10/13 13:09:50 fukachan Exp $ # package FML::Process::Command; @@ -222,20 +222,28 @@ sub _evaluate_command use FML::Command; my $obj = new FML::Command; if (defined $obj) { + my $found = 0; + my (@options) = (); + for (split(/\s+/, $command)) { + push(@options, $_) if $found; + $found = 1 if $_ eq $comname; + } + # arguments to pass off to each method - my $optargs = { + my $command_args = { command_mode => 'user', comname => $comname, command => $command, ml_name => $ml_name, - options => [], + options => _parse_command_options($command), argv => $argv, args => $args, }; + $curproc->reply_message("\n$prompt $command"); eval q{ - $obj->$comname($curproc, $optargs); + $obj->$comname($curproc, $command_args); }; unless ($@) { $curproc->reply_message_nl('command.ok', "ok."); @@ -253,6 +261,26 @@ sub _evaluate_command } +# Descriptions: parse command buffer to make +# argument vector after command name +# Arguments: $string_to_parse +# Side Effects: none +# Return Value: ARRAY REFERENCE +sub _parse_command_options +{ + my ($command) = @_; + my $found = 0; + my (@options) = (); + + for (split(/\s+/, $command)) { + push(@options, $_) if $found; + $found = 1 if $_ eq $comname; + } + + return \@options; +} + + =head1 AUTHOR Ken'ichi Fukamachi |
