1 Star 0 Fork 25

gaoch_100/procps-ng

forked from src-openEuler/procps-ng 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
feature-add-options-M-and-N-for-top.patch 2.05 KB
一键复制 编辑 原始数据 按行查看 历史
dogsheng 提交于 2019-12-25 17:13 . Package init
From 6e59f5e746c15df4d4b53f2df85b64aa1f10d0c3 Mon Sep 17 00:00:00 2001
From: xuchunmei <xuchunmei@huawei.com>
Date: Fri, 11 Jan 2019 01:29:55 -0500
Subject: [PATCH] procps-ng: add -M and -N options for top
Signed-off-by: xuchunmei <xuchunmei@huawei.com>
---
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 d890140..9bfc7f0 100644
--- a/top/top.c
+++ b/top/top.c
@@ -4139,6 +4139,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 0af77ce..79a18e1 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 | -bcEHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols]");
+ Norm_nlstab[USAGE_abbrev_txt] = _(" -hv | -bcEHiOSs1 -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");
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gaoch_100/procps-ng.git
git@gitee.com:gaoch_100/procps-ng.git
gaoch_100
procps-ng
procps-ng
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385