Skip to content
Snippets Groups Projects
Commit 20a82856 authored by Moe Jette's avatar Moe Jette
Browse files

move spank option parsing to first pass of command line option

processing
parent ad025d45
No related branches found
No related tags found
No related merge requests found
......@@ -551,6 +551,12 @@ char *process_options_first_pass(int argc, char **argv)
{
int opt_char, option_index = 0;
char *str = NULL;
struct option *optz = spank_option_table_create (long_options);
if (!optz) {
error ("Unable to create option table");
exit (1);
}
/* initialize option defaults */
_opt_default();
......@@ -559,7 +565,7 @@ char *process_options_first_pass(int argc, char **argv)
optind = 0;
while((opt_char = getopt_long(argc, argv, opt_string,
long_options, &option_index)) != -1) {
optz, &option_index)) != -1) {
switch (opt_char) {
case '?':
fprintf(stderr, "Try \"sbatch --help\" for more "
......@@ -1276,8 +1282,6 @@ static void _set_options(int argc, char **argv)
default:
if (spank_process_option (opt_char, optarg) < 0)
exit (1);
fatal("Unrecognized command line parameter %c",
opt_char);
}
}
......
......@@ -71,6 +71,9 @@ int main(int argc, char *argv[])
int retries = 0;
log_init(xbasename(argv[0]), logopt, 0, NULL);
if (spank_init(NULL) < 0)
fatal("Plug-in initialization failed");
script_name = process_options_first_pass(argc, argv);
/* reinit log with new verbosity (if changed by command line) */
if (opt.verbose || opt.quiet) {
......@@ -88,8 +91,6 @@ int main(int argc, char *argv[])
if (script_body == NULL)
exit(1);
if (spank_init(NULL) < 0)
fatal("Plug-in initialization failed");
if (process_options_second_pass((argc - opt.script_argc), argv,
script_body, script_size) < 0) {
fatal("sbatch parameter parsing");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment