Skip to content
Snippets Groups Projects
Commit bdc36070 authored by Danny Auble's avatar Danny Auble
Browse files

Added sacct ability to use --format NAME%LENGTH similar to sacctmgr.

parent 15001c00
No related branches found
No related tags found
No related merge requests found
......@@ -1034,18 +1034,32 @@ void parse_command_line(int argc, char **argv)
start = params.opt_field_list;
while ((end = strstr(start, ","))) {
char *tmp_char = NULL;
int command_len = 0;
int newlen = 0;
*end = 0;
while (isspace(*start))
start++; /* discard whitespace */
if(!(int)*start)
continue;
if((tmp_char = strstr(start, "\%"))) {
newlen = atoi(tmp_char+1);
tmp_char[0] = '\0';
}
command_len = strlen(start);
for (i = 0; fields[i].name; i++) {
if (!strcasecmp(fields[i].name, start))
if (!strncasecmp(fields[i].name, start, command_len))
goto foundfield;
}
error("Invalid field requested: \"%s\"", start);
exit(1);
foundfield:
if(newlen)
fields[i].len = newlen;
list_append(print_fields_list, &fields[i]);
start = end + 1;
}
......
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