Changeset 12545
- Timestamp:
- 2006-08-24T16:17:35+12:00 (18 years ago)
- Location:
- trunk/gsdl/bin/script
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/buildcol.pl
r12500 r12545 227 227 228 228 my $hashParsingResult = {}; 229 my $blnParseFailed = "false";230 229 # general options available to all plugins 231 230 my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options"); 232 231 233 # If there are more than one argument left after parsing, it mean user input too many arguments. 234 # Error occoured will return 0 235 if ($intArgLeftinAfterParsing != 1) 232 # If parse returns -1 then something has gone wrong 233 if ($intArgLeftinAfterParsing == -1) 236 234 { 237 $blnParseFailed = "true";238 }239 if($blnParseFailed eq "true")240 {241 print "";242 235 &PrintUsage::print_txt_usage($options, "{buildcol.params}"); 243 236 die "\n"; 244 237 } 238 245 239 foreach my $strVariable (keys %$hashParsingResult) 246 240 { … … 264 258 } 265 259 260 # now check that we had exactly one leftover arg, which should be 261 # the collection name. We don't want to do this earlier, cos 262 # -xml arg doesn't need a collection name 263 # Or if the user specified -h, then we output the usage also 264 if ($intArgLeftinAfterParsing != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/)) 265 { 266 &PrintUsage::print_txt_usage($options, "{buildcol.params}"); 267 die "\n"; 268 } 269 266 270 $textindex = ""; 267 271 my $close_out = 0; -
trunk/gsdl/bin/script/classinfo.pl
r11683 r12545 85 85 86 86 my $hashParsingResult = {}; 87 my $blnParseFailed = "false"; 88 # general options available to all plugins 87 # general options available to all classifiers 89 88 my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options"); 90 # If there are more than one argument left after parsing, it mean user input too many arguments. 91 # Error occoured will return 0 92 if($intArgLeftinAfterParsing > 1) 89 # parse returns -1 if an error occurred 90 if($intArgLeftinAfterParsing == -1) 93 91 { 94 92 &PrintUsage::print_txt_usage($options, "{classinfo.params}"); … … 104 102 if ($language) { 105 103 &gsprintf::load_language_specific_resource_bundle($language); 104 } 105 106 # If there is not exactly 1 argument left (classifier name), then the arguments were wrong 107 # Or if the user specified -h, then we output the usage also 108 if( $intArgLeftinAfterParsing != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/) ) 109 { 110 PrintUsage::print_txt_usage($options, "{classinfo.params}"); 111 die "\n"; 106 112 } 107 113 -
trunk/gsdl/bin/script/downloadinfo.pl
r11786 r12545 86 86 my $unparsed_args = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options"); 87 87 88 # parse returns -1 on error 89 if ($unparsed_args == -1) { 90 PrintUsage::print_txt_usage($options, "{pluginfo.params}"); 91 die "\n"; 92 } 93 88 94 foreach my $strVariable (keys %$hashParsingResult) 89 95 { … … 118 124 } 119 125 120 # If there are more than one argument left after parsing, it mean user input too many arguments. 121 # Error occoured will return 0 122 if( $unparsed_args > 1 or (@ARGV && $ARGV[0] =~ /^\-+h/) ) 126 # If there is not exactly one argument left (download name), then the arguments were wrong 127 # Or if the user specified -h, then we output the usage also 128 129 if( $unparsed_args != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/) ) 123 130 { 124 PrintUsage::print_txt_usage($options, "{ pluginfo.params}");131 PrintUsage::print_txt_usage($options, "{downloadinfo.params}"); 125 132 die "\n"; 126 133 } -
trunk/gsdl/bin/script/explode_metadata_database.pl
r12290 r12545 98 98 99 99 my $hashParsingResult = {}; 100 my $blnParseFailed = "false";101 100 # parse the options 102 101 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 } 103 109 104 110 foreach my $strVariable (keys %$hashParsingResult) … … 119 125 } 120 126 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/)) 123 130 { 124 131 &PrintUsage::print_txt_usage($options, "{explode.params}"); -
trunk/gsdl/bin/script/export.pl
r12361 r12545 235 235 236 236 my $hashParsingResult = {}; 237 my $blnParseFailed = "false";238 237 # general options available to all plugins 239 238 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 241 247 foreach my $strVariable (keys %$hashParsingResult) 242 248 { … … 280 286 } 281 287 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/)) { 283 291 &PrintUsage::print_txt_usage($options, "{export.params}"); 284 292 die "\n"; -
trunk/gsdl/bin/script/exportcol.pl
r11944 r12545 97 97 98 98 my $hashParsingResult = {}; 99 my $blnParseFailed = "false"; 99 100 100 # parse options 101 101 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 103 110 foreach my $strVariable (keys %$hashParsingResult) 104 111 { … … 122 129 } 123 130 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 124 138 my @coll_list = @ARGV; 125 126 if (not @coll_list) { # empty list127 &PrintUsage::print_txt_usage($options, "{exportcol.params}");128 exit(1);129 }130 139 131 140 my $close_out = 0; -
trunk/gsdl/bin/script/import.pl
r12500 r12545 251 251 252 252 my $hashParsingResult = {}; 253 my $blnParseFailed = "false";254 253 # general options available to all plugins 255 254 my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options"); 256 # If there is more than one argument left after parsing, it mean user input too many arguments.257 if($intArgLeftinAfterParsing >1)255 # Parse returns -1 if something has gone wrong 256 if($intArgLeftinAfterParsing == -1) 258 257 { 259 258 &PrintUsage::print_txt_usage($options, "{import.params}"); … … 280 279 if ($gli) { # the gli wants strings to be in UTF-8 281 280 &gsprintf::output_strings_in_UTF8; 281 } 282 283 # now check that we had exactly one leftover arg, which should be 284 # the collection name. We don't want to do this earlier, cos 285 # -xml arg doesn't need a collection name 286 # Or if the user specified -h, then we output the usage also 287 if ($intArgLeftinAfterParsing != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/)) 288 { 289 &PrintUsage::print_txt_usage($options, "{buildcol.params}"); 290 die "\n"; 282 291 } 283 292 -
trunk/gsdl/bin/script/mkcol.pl
r11330 r12545 206 206 my $hashParsingResult = {}; 207 207 my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options"); 208 # If there is more than one argument left after parsing, it mean user input too many arguments. 209 if($intArgLeftinAfterParsing > 1) 208 209 # If parse returns -1 then something has gone wrong 210 if ($intArgLeftinAfterParsing == -1) 210 211 { 211 212 &PrintUsage::print_txt_usage($options, "{mkcol.params}"); … … 217 218 eval "\$$strVariable = \$hashParsingResult->{\"\$strVariable\"}"; 218 219 } 219 220 220 221 221 # If $language has been specified, load the appropriate resource bundle … … 234 234 &gsprintf::output_strings_in_UTF8; 235 235 } 236 236 237 # now check that we had exactly one leftover arg, which should be 238 # the collection name. We don't want to do this earlier, cos 239 # -xml arg doesn't need a collection name 240 # Or if the user specified -h, then we output the usage also 241 if ($intArgLeftinAfterParsing != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/)) 242 { 243 &PrintUsage::print_txt_usage($options, "{mkcol.params}"); 244 die "\n"; 245 } 246 237 247 if ($optionfile =~ /\w/) { 238 248 open (OPTIONS, $optionfile) || … … 245 255 close OPTIONS; 246 256 my $optionsParsingResult = {}; 247 my $optionsParseFailed = "false"; 248 if (!parse2::parse($options,$arguments,$optionsParsingResult)) { 257 if (parse2::parse($options,$arguments,$optionsParsingResult) == -1) { 249 258 &PrintUsage::print_txt_usage($options, "{mkcol.params}"); 250 259 die "\n"; -
trunk/gsdl/bin/script/pluginfo.pl
r11683 r12545 85 85 86 86 my $hashParsingResult = {}; 87 my $blnParseFailed = "false";88 87 # general options available to all plugins 89 88 my $unparsed_args = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options"); 90 89 # parse returns -1 if an error occurred 90 if ($unparsed_args == -1) { 91 92 PrintUsage::print_txt_usage($options, "{pluginfo.params}"); 93 die "\n"; 94 } 95 91 96 foreach my $strVariable (keys %$hashParsingResult) 92 97 { … … 121 126 } 122 127 123 # If there are more than one argument left after parsing, it mean user input too many arguments.124 # Error occoured will return 0125 if( $unparsed_args > 1 or(@ARGV && $ARGV[0] =~ /^\-+h/) )128 # If there is not exactly 1 argument left (plugin name), then the arguments were wrong 129 # Or if the user specified -h, then we output the usage also 130 if( $unparsed_args != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/) ) 126 131 { 127 PrintUsage::print_txt_usage($options, "{pluginfo.params}"); 128 129 } 130 132 PrintUsage::print_txt_usage($options, "{pluginfo.params}"); 133 die "\n"; 134 } 135 131 136 my $plugin = shift (@ARGV); 132 137 if (defined $plugin) { -
trunk/gsdl/bin/script/plugoutinfo.pl
r12334 r12545 85 85 86 86 my $hashParsingResult = {}; 87 my $blnParseFailed = "false"; 88 # general options available to all plugins 87 # general options available to all plugouts 89 88 my $unparsed_args = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options"); 90 89 90 # parse returns -1 if an error occurred 91 if ($unparsed_args == -1) { 92 93 PrintUsage::print_txt_usage($options, "{plugoutinfo.params}"); 94 die "\n"; 95 } 96 91 97 foreach my $strVariable (keys %$hashParsingResult) 92 98 { … … 100 106 } 101 107 102 103 108 # if language wasn't specified, see if it is set in the environment 104 109 # (LC_ALL or LANG) … … 123 128 } 124 129 125 # If there are more than one argument left after parsing, it mean user input too many arguments.126 # Error occoured will return 0127 if( $unparsed_args > 1 or(@ARGV && $ARGV[0] =~ /^\-+h/) )130 # If there is not exactly 1 argument left (plugout name), then the arguments were wrong 131 # Or if the user specified -h, then we output the usage also 132 if( $unparsed_args != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/) ) 128 133 { 129 PrintUsage::print_txt_usage($options, "{plugoutinfo.params}"); 130 134 PrintUsage::print_txt_usage($options, "{plugoutinfo.params}"); 135 die "\n"; 131 136 } 132 137
Note:
See TracChangeset
for help on using the changeset viewer.