aboutsummaryrefslogtreecommitdiff
path: root/procps/ps.c
diff options
context:
space:
mode:
Diffstat (limited to 'procps/ps.c')
-rw-r--r--procps/ps.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/procps/ps.c b/procps/ps.c
index 801a6fdf3..4c6e07e8b 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -451,17 +451,19 @@ static void parse_o(char* opt)
451 opt = comma + 1; 451 opt = comma + 1;
452 continue; 452 continue;
453 } 453 }
454 break; 454 // opt points to last spec in comma separated list.
455 } 455 // This one can have =HEADER part.
456 // opt points to last spec in comma separated list. 456 new = new_out_t();
457 // This one can have =HEADER part. 457 if (equal)
458 new = new_out_t(); 458 *equal = '\0';
459 if (equal) 459 *new = *find_out_spec(opt);
460 *equal = '\0'; 460 if (!equal)
461 *new = *find_out_spec(opt); 461 break;
462 if (equal) { 462 *equal++ = '=';
463 *equal = '='; 463 new->header = equal;
464 new->header = equal + 1; 464 comma = strchr(equal, ',');
465 if (comma)
466 *comma = '\0';
465 // POSIX: the field widths shall be ... at least as wide as 467 // POSIX: the field widths shall be ... at least as wide as
466 // the header text (default or overridden value). 468 // the header text (default or overridden value).
467 // If the header text is null, such as -o user=, 469 // If the header text is null, such as -o user=,
@@ -469,10 +471,12 @@ static void parse_o(char* opt)
469 // default header text 471 // default header text
470 if (new->header[0]) { 472 if (new->header[0]) {
471 new->width = strlen(new->header); 473 new->width = strlen(new->header);
472 print_header = 1;
473 } 474 }
474 } else 475 if (!comma)
475 print_header = 1; 476 break;
477 //*comma = ','; /* no, new->header should stay NUL-terminated */
478 opt = comma + 1;
479 }
476} 480}
477 481
478static void alloc_line_buffer(void) 482static void alloc_line_buffer(void)