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/exportcol.pl

    r11944 r12545  
    9797
    9898    my $hashParsingResult = {};
    99     my $blnParseFailed = "false";
     99
    100100    # parse options
    101101    my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options");
    102     # don't care how many args are left - can have multiple collection names
     102
     103    # If parse returns -1 then something has gone wrong
     104    if ($intArgLeftinAfterParsing == -1)
     105    {
     106    &PrintUsage::print_txt_usage($options, "{exportcol.params}");
     107    die "\n";
     108    }
     109   
    103110    foreach my $strVariable (keys %$hashParsingResult)
    104111    {
     
    122129    }
    123130   
     131    # can have more than one collection name, 
     132    # if the first extra option is -h, then output the help
     133    if (scalar(@ARGV) == 0 || (@ARGV && $ARGV[0] =~ /^\-+h/)) {
     134    &PrintUsage::print_txt_usage($options, "{exportcol.params}");
     135    die "\n";
     136    }
     137
    124138    my @coll_list = @ARGV;
    125    
    126     if (not @coll_list) { # empty list
    127     &PrintUsage::print_txt_usage($options, "{exportcol.params}");
    128     exit(1);
    129     }
    130139
    131140    my $close_out = 0;
Note: See TracChangeset for help on using the changeset viewer.