version 1.5, 2003/08/12 10:55:42
|
version 1.6, 2003/08/12 11:02:59
|
Line 50
|
Line 50
|
# not the IP address of the host. |
# not the IP address of the host. |
# |
# |
# $Log$ |
# $Log$ |
|
# Revision 1.6 2003/08/12 11:02:59 foxr |
|
# Implement command switch dispatching. |
|
# |
# Revision 1.5 2003/08/12 10:55:42 foxr |
# Revision 1.5 2003/08/12 10:55:42 foxr |
# Complete command line parsing (tested) |
# Complete command line parsing (tested) |
# |
# |
Line 132 sub ParseArgs {
|
Line 135 sub ParseArgs {
|
# --push takes in addition a table, and a host: |
# --push takes in addition a table, and a host: |
# |
# |
if($paramcount != 2) { |
if($paramcount != 2) { |
print "Bad count $paramcount\n"; |
|
return (); # Invalid parameter count. |
return (); # Invalid parameter count. |
} |
} |
if($command ne '') { |
if($command ne '') { |
Line 149 sub ParseArgs {
|
Line 151 sub ParseArgs {
|
# --reinit takes in addition just a host name |
# --reinit takes in addition just a host name |
|
|
if($paramcount != 1) { |
if($paramcount != 1) { |
print "Bad count $paramcount\n"; |
|
return (); |
return (); |
} |
} |
if($command ne '') { |
if($command ne '') { |
Line 171 sub ParseArgs {
|
Line 172 sub ParseArgs {
|
return @result; |
return @result; |
} |
} |
|
|
# |
#--------------------------- Entry point: -------------------------- |
# If command parsing failed, then print usage: |
|
|
# Parse the parameters |
|
# If command parsing failed, then print usage: |
|
|
@status = ParseArgs; |
@params = ParseArgs; |
$nparam = @status; |
$nparam = @params; |
|
|
if($nparam == 0) { |
if($nparam == 0) { |
Usage; |
Usage; |
exit -1; |
exit -1; |
} |
} |
|
|
print "---- params ---\n"; |
|
for($i = 0; $i < $nparam; $i++) { |
sub PushFile { |
print "Param[$i] = $status[$i]\n"; |
print "Pushing a file\n"; |
|
} |
|
|
|
sub ReinitProcess { |
|
print "Reinitializing a process\n"; |
} |
} |
|
|
|
# Based on the operation requested invoke the appropriate function: |
|
|
|
$operation = shift @params; |
|
|
|
if($operation eq "push") { # push tablename filename host |
|
$tablename = shift @params; |
|
$tablefile = shift @params; |
|
$host = shift @params; |
|
PushFile($tablename, $tablefile, $host); |
|
|
|
} |
|
if($operation eq "reinit") { # reinit processname host. |
|
$process = shift @params; |
|
$host = shift @params; |
|
ReinitProcess($process, $host); |
|
} |
exit 0; |
exit 0; |
|
|
=head1 NAME |
=head1 NAME |