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

    r12290 r12545  
    9898
    9999    my $hashParsingResult = {};
    100     my $blnParseFailed = "false";
    101100    # parse the options
    102101    my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options");
     102
     103    # If parse returns -1 then something has gone wrong
     104    if ($intArgLeftinAfterParsing == -1)
     105    {
     106    &PrintUsage::print_txt_usage($options, "{explode.params}");
     107    die "\n";
     108    }
    103109
    104110    foreach my $strVariable (keys %$hashParsingResult)
     
    119125    }
    120126
    121     # There should one arg left after parsing
    122     if($intArgLeftinAfterParsing > 1)
     127    # There should one arg left after parsing (the filename)
     128    # Or the user may have specified -h, in which case we output the usage
     129    if($intArgLeftinAfterParsing != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/))
    123130    {
    124131    &PrintUsage::print_txt_usage($options, "{explode.params}");
Note: See TracChangeset for help on using the changeset viewer.