Ignore:
Timestamp:
2006-08-24T16:17:35+12:00 (18 years ago)
Author:
kjdon
Message:

changed parse2::parse so that it returns -1 on error, 0 on success, or if allow_extra_options is specified, then on success returns the number of args left over. allowed the use of -h to print the usage for all scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/export.pl

    r12361 r12545  
    235235
    236236    my $hashParsingResult = {};
    237     my $blnParseFailed = "false";
    238237    # general options available to all plugins
    239238    my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options");
    240     # can have more than one collection name, so don't check num args left   
     239   
     240    # If parse returns -1 then something has gone wrong
     241    if ($intArgLeftinAfterParsing == -1)
     242    {
     243    &PrintUsage::print_txt_usage($options, "{export.params}");
     244    die "\n";
     245    }
     246
    241247    foreach my $strVariable (keys %$hashParsingResult)
    242248    {
     
    280286    }
    281287
    282     if (scalar(@ARGV) == 0) {
     288    # can have more than one collection name, 
     289    # if the first extra option is -h, then output the help
     290    if (scalar(@ARGV) == 0 || (@ARGV && $ARGV[0] =~ /^\-+h/)) {
    283291    &PrintUsage::print_txt_usage($options, "{export.params}");
    284292    die "\n";
Note: See TracChangeset for help on using the changeset viewer.