From e3bad0687d2e6f303bfdb41f32dce887a1e69d5b Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Mon, 22 May 2017 00:00:00 -0500 Subject: [PATCH] top: correct functioning of the '-p' command line args With the introduction of a new '1' command line toggle I have gone and broken a provision of the '-p' command line switch (pids monitoring). Multiple pids could not be specified through the use of comma delimited lists. Thus, this commit simply corrects that newly added bug which was born in the 'adjustment' commit shown below. Reference(s): . adjustment to '-1' implementation commit 3e5c950a5e22320c9eece08584ac6b3292f09315 Signed-off-by: Jim Warner --- top/top.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/top/top.c b/top/top.c index 3e4d894e..84b3c0c5 100644 --- a/top/top.c +++ b/top/top.c @@ -3161,7 +3161,6 @@ static void parse_args (char **args) { . bunched args are actually handled properly and none are ignored . we tolerate NO whitespace and NO switches -- maybe too tolerant? */ static const char numbs_str[] = "+,-.0123456789"; - static const char wrong_str[] = "+,-."; float tmp_delay = FLT_MAX; int i; @@ -3178,7 +3177,7 @@ static void parse_args (char **args) { case '-': if (cp[1]) ++cp; else if (*args) cp = *args++; - if (strspn(cp, wrong_str)) + if (strspn(cp, "+,-.")) error_exit(fmtmk(N_fmt(WRONG_switch_fmt) , cp, Myname, N_txt(USAGE_abbrev_txt))); continue; @@ -3260,7 +3259,7 @@ static void parse_args (char **args) { if (Monpidsidx >= MONPIDMAX) error_exit(fmtmk(N_fmt(LIMIT_exceed_fmt), MONPIDMAX)); if (1 != sscanf(cp, "%d", &pid) - || strpbrk(cp, wrong_str)) + || strpbrk(cp, "+-.")) error_exit(fmtmk(N_fmt(BAD_mon_pids_fmt), cp)); if (!pid) pid = getpid(); for (i = 0; i < Monpidsidx; i++) -- 2.40.0