Re: top: add / as alias for g (grep)

2020-07-23 Thread Todd C . Miller
On Thu, 23 Jul 2020 22:04:24 +0200, Klemens Nanni wrote:

> I've somehow hit the slash way to often for searching a particular
> command, would anyone object if I added it as a command character?

No objection from me.

 - todd



Re: top: add / as alias for g (grep)

2020-07-23 Thread Jason McIntyre
On Thu, Jul 23, 2020 at 10:04:24PM +0200, Klemens Nanni wrote:
> I've somehow hit the slash way to often for searching a particular
> command, would anyone object if I added it as a command character?
> 
> While here, what's up with the weird markup in top.1 for `n|# count'?
> I've simplified that before adopting it, `mandoc -Tlint ./top.1' is
> happy with it.
> 

we used to use \*(Ba instead of "|". i think it made mark up simpler in
some cases. and i think ingo wants us to reduce it (and he'll probably
chip in) so i guess that particular change is fine.

jmc



top: add / as alias for g (grep)

2020-07-23 Thread Klemens Nanni
I've somehow hit the slash way to often for searching a particular
command, would anyone object if I added it as a command character?

While here, what's up with the weird markup in top.1 for `n|# count'?
I've simplified that before adopting it, `mandoc -Tlint ./top.1' is
happy with it.

Feedback? OK?


Index: display.c
===
RCS file: /cvs/src/usr.bin/top/display.c,v
retrieving revision 1.62
diff -u -p -r1.62 display.c
--- display.c   27 Jun 2020 01:09:57 -  1.62
+++ display.c   23 Jul 2020 20:00:05 -
@@ -810,7 +810,7 @@ show_help(void)
"C- toggle the display of command line arguments\n"
"d count  - show `count' displays, then exit\n"
"e- list errors generated by last \"kill\" or 
\"renice\" command\n"
-   "g string - filter on command name (g+ selects all commands)\n"
+   "g|/ string   - filter on command name (g+ or /+ selects all 
commands)\n"
"h | ?- help; show this text\n"
"H- toggle the display of threads\n"
"I | i- toggle the display of idle processes\n"
Index: top.1
===
RCS file: /cvs/src/usr.bin/top/top.1,v
retrieving revision 1.74
diff -u -p -r1.74 top.1
--- top.1   23 Jun 2020 21:39:19 -  1.74
+++ top.1   23 Jul 2020 20:00:54 -
@@ -308,12 +308,14 @@ Display a list of system errors (if any)
 or
 .Li renice
 command.
-.It g Ar string
+.It g|/ Ar string
 Display only processes that contain
 .Ar string
 in their command name.
 If displaying of arguments is enabled, the arguments are searched too.
 .Sq g+
+or
+.Sq /+
 shows all processes.
 .It H
 Toggle the display of process threads.
@@ -330,7 +332,7 @@ by default) to process
 .Ar pid .
 This acts similarly to the command
 .Xr kill 1 .
-.It n\*(Ba# Ar count
+.It n|# Ar count
 Show
 .Ar count
 processes.
Index: top.c
===
RCS file: /cvs/src/usr.bin/top/top.c,v
retrieving revision 1.103
diff -u -p -r1.103 top.c
--- top.c   25 Jun 2020 20:38:41 -  1.103
+++ top.c   23 Jul 2020 19:50:49 -
@@ -131,6 +131,7 @@ struct statics  statics;
 #define CMD_up 25
 #define CMD_pagedown   26
 #define CMD_pageup 27
+#define CMD_grep2  28
 
 static void
 usage(void)
@@ -631,7 +632,7 @@ rundisplay(void)
char ch, *iptr;
int change, i;
struct pollfd pfd[1];
-   static char command_chars[] = "\f qh?en#sdkriIuSopCHg+P109)(";
+   static char command_chars[] = "\f qh?en#sdkriIuSopCHg+P109)(/";
 
/*
 * assume valid command unless told
@@ -937,6 +938,7 @@ rundisplay(void)
break;
 
case CMD_grep:
+   case CMD_grep2:
new_message(MT_standout,
"Grep command name: ");
if (readline(tempbuf, sizeof(tempbuf)) > 0) {