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

Modify popt use to conform with spec (and not fail under RedHat 9).

parent 5af828d7
No related branches found
No related tags found
No related merge requests found
......@@ -76,7 +76,7 @@
#endif
struct poptOption options[] = {
{"interactive", 'i', POPT_ARG_NONE, &opt.interactive, OPT_INTERACTIVE,
{"interactive", 'i', POPT_ARG_NONE, NULL, OPT_INTERACTIVE,
"confirm each job cancelation", },
{"name", 'n', POPT_ARG_STRING, NULL, OPT_NAME,
"name of job", "name"},
......@@ -88,7 +88,7 @@ struct poptOption options[] = {
"name of job's state", "PENDING | RUNNING"},
{"user", 'u', POPT_ARG_STRING, NULL, OPT_USER,
"name of job's owner", "name"},
{"verbose", 'v', 0, 0, OPT_VERBOSE,
{"verbose", 'v', POPT_ARG_NONE, NULL, OPT_VERBOSE,
"verbose operation (multiple -v's increase verbosity)", },
{"version", 'V', POPT_ARG_NONE, NULL, OPT_VERSION,
"report the current version", },
......@@ -338,6 +338,10 @@ static void opt_args(int ac, char **av)
arg = poptGetOptArg(optctx);
switch (rc) {
case OPT_INTERACTIVE:
opt.interactive = true;
break;
case OPT_NAME:
opt.job_name = xstrdup(arg);
break;
......
......@@ -79,7 +79,7 @@ int parse_command_line(int argc, char *argv[])
/* Declare the Options */
static const struct poptOption options[] = {
{"exact", 'e', POPT_ARG_NONE, &params.exact_match, OPT_EXACT,
{"exact", 'e', POPT_ARG_NONE, NULL, OPT_EXACT,
"group nodes only on exact match of configuration",
NULL},
{"iterate", 'i', POPT_ARG_INT, &params.iterate,
......@@ -94,19 +94,19 @@ int parse_command_line(int argc, char *argv[])
"PARTITION"},
{"nodes", 'n', POPT_ARG_STRING, &params.nodes, OPT_NODES,
"report on specific node(s)", "NODES"},
{"Node", 'N', POPT_ARG_NONE, &params.node_flag, OPT_NODE,
{"Node", 'N', POPT_ARG_NONE, NULL, OPT_NODE,
"Node-centric format", NULL},
{"long", 'l', POPT_ARG_NONE, &params.long_output,
OPT_LONG, "long output - displays more information",
{"long", 'l', POPT_ARG_NONE, NULL, OPT_LONG,
"long output - displays more information",
NULL},
{"sort", 'S', POPT_ARG_STRING, &params.sort, OPT_SORT,
"comma seperated list of fields to sort on", "fields"},
{"summarize", 's', POPT_ARG_NONE, &params.summarize,
OPT_SHORT,"report state summary only", NULL},
{"verbose", 'v', POPT_ARG_NONE, &params.verbose,
OPT_VERBOSE, "verbosity level", "level"},
{"noheader", 'h', POPT_ARG_NONE, &params.no_header,
OPT_NO_HEAD, "no headers on output", NULL},
{"summarize", 's', POPT_ARG_NONE, NULL, OPT_SHORT,
"report state summary only", NULL},
{"verbose", 'v', POPT_ARG_NONE, NULL, OPT_VERBOSE,
"verbosity level", "level"},
{"noheader", 'h', POPT_ARG_NONE, NULL, OPT_NO_HEAD,
"no headers on output", NULL},
{"format", 'o', POPT_ARG_STRING, &params.format, OPT_FORMAT,
"format specification", "format"},
{"version", 'V', POPT_ARG_NONE, 0, OPT_VERSION,
......@@ -124,9 +124,27 @@ int parse_command_line(int argc, char *argv[])
while ((curr_opt = poptGetNextOpt(context)) > 0) {
switch ( curr_opt )
{
case OPT_EXACT:
params.exact_match = true;
break;
case OPT_NODE_STATE:
params.state_list = _build_state_list( params.states );
break;
case OPT_NODE:
params.node_flag = true;
break;
case OPT_LONG:
params.long_output = true;
break;
case OPT_SHORT:
params.summarize = true;
break;
case OPT_VERBOSE:
params.verbose++;
break;
case OPT_NO_HEAD:
params.no_header = true;
break;
case OPT_VERSION:
_print_version();
exit(0);
......
......@@ -102,7 +102,6 @@ struct sinfo_parameters {
bool exact_match;
bool filtering;
bool long_output;
bool line_wrap;
bool no_header;
bool node_field_flag;
bool node_flag;
......
......@@ -86,17 +86,16 @@ parse_command_line( int argc, char* argv[] )
{"iterate", 'i', POPT_ARG_INT, &params.iterate, OPT_ITERATE,
"specify an interation period", "seconds"},
{"noheader", 'h', POPT_ARG_NONE, &params.no_header,
OPT_NO_HEAD, "no headers on output", NULL},
{"jobs", 'j', POPT_ARG_NONE, &params.job_flag, OPT_JOBS_NONE,
{"noheader", 'h', POPT_ARG_NONE, NULL, OPT_NO_HEAD,
"no headers on output", NULL},
{"jobs", 'j', POPT_ARG_NONE, NULL, OPT_JOBS_NONE,
"comma separated list of jobs to view, default is all",
"job_id"},
{"steps", 's', POPT_ARG_NONE, &params.step_flag,
OPT_STEPS_NONE,
{"steps", 's', POPT_ARG_NONE, NULL, OPT_STEPS_NONE,
"comma separated list of job steps to view, "
"default is all",
"job_step"},
{"long", 'l', POPT_ARG_NONE, &params.long_list, OPT_LONG,
{"long", 'l', POPT_ARG_NONE, NULL, OPT_LONG,
"long report", NULL},
{"sort", 'S', POPT_ARG_STRING, &params.sort, OPT_SORT,
"comma seperated list of fields to sort on", "fields"},
......@@ -113,9 +112,9 @@ parse_command_line( int argc, char* argv[] )
"format specification", "format"},
{"user", 'u', POPT_ARG_STRING, &params.users, OPT_USERS,
"comma separated list of users to view", "user_name"},
{"verbose", 'v', POPT_ARG_NONE, &params.verbose, OPT_VERBOSE,
{"verbose", 'v', POPT_ARG_NONE, NULL, OPT_VERBOSE,
"verbosity level", NULL},
{"version", 'V', POPT_ARG_NONE, 0, OPT_VERSION,
{"version", 'V', POPT_ARG_NONE, NULL, OPT_VERSION,
"output version information and exit", NULL},
POPT_AUTOHELP
{NULL, '\0', 0, NULL, 0, NULL, NULL} /* end the list */
......@@ -137,16 +136,24 @@ parse_command_line( int argc, char* argv[] )
switch ( curr_opt )
{
case OPT_NO_HEAD:
params.no_header = true;
break;
case OPT_JOBS_NONE:
if ( (opt_arg = poptGetArg(context)) != NULL )
params.jobs = (char*)opt_arg;
params.job_list = _build_job_list(params.jobs);
params.job_flag = true;
break;
case OPT_STEPS_NONE:
if ( (opt_arg = poptGetArg( context )) != NULL )
params.steps = (char*)opt_arg;
params.step_list = _build_step_list( params.steps );
params.step_flag = true;
break;
case OPT_LONG:
params.long_list = true;
break;
case OPT_STATES:
params.state_list = _build_state_list( params.states );
break;
......@@ -158,7 +165,7 @@ parse_command_line( int argc, char* argv[] )
params.user_list = _build_user_list( params.users );
break;
case OPT_VERBOSE:
params.verbose = true;
params.verbose++;
break;
case OPT_VERSION:
_print_version();
......
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