From 6e59f5e746c15df4d4b53f2df85b64aa1f10d0c3 Mon Sep 17 00:00:00 2001 From: xuchunmei Date: Fri, 11 Jan 2019 01:29:55 -0500 Subject: [PATCH] procps-ng: add -M and -N options for top Signed-off-by: xuchunmei --- top/top.c | 17 +++++++++++++++++ top/top_nls.c | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/top/top.c b/top/top.c index b53e532..20cf7a1 100644 --- a/top/top.c +++ b/top/top.c @@ -4337,6 +4337,23 @@ static void parse_args (char **args) { args += ai; if (pn) cp = pn + ci; } continue; + case 'M': + { + Curwin->rc.sortindx = EU_MEM; + break; + } + case 'N': + { + if (cp[1]) + cp++; + else if (*args) + cp = *args++; + else + error_exit("-N requires argument"); + if (sscanf(cp, "%d", &Curwin->rc.maxtasks) != 1 || Curwin->rc.maxtasks < 0) + error_exit(fmtmk("bad iterations arg '%s'", cp)); + break; + } default : error_exit(fmtmk(N_fmt(UNKNOWN_opts_fmt) , *cp, Myname, N_txt(USAGE_abbrev_txt))); diff --git a/top/top_nls.c b/top/top_nls.c index ab3029e..97c3468 100644 --- a/top/top_nls.c +++ b/top/top_nls.c @@ -350,7 +350,7 @@ static void build_norm_nlstab (void) { Norm_nlstab[OFF_one_word_txt] = _("Off"); /* Translation Hint: Only the following words should be translated . secs (seconds), max (maximum), user, field, cols (columns)*/ - Norm_nlstab[USAGE_abbrev_txt] = _(" -hv | -bcEeHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols]"); + Norm_nlstab[USAGE_abbrev_txt] = _(" -hv | -bcEeHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols] -M -N num"); Norm_nlstab[FAIL_statget_txt] = _("failed /proc/stat read"); Norm_nlstab[FOREST_modes_fmt] = _("Forest mode %s"); Norm_nlstab[FAIL_tty_get_txt] = _("failed tty get"); -- 2.27.0