version 1.44, 2006/12/27 07:24:52 |
version 1.45, 2007/01/03 18:57:49 |
|
|
#define CMD_pid 17 |
#define CMD_pid 17 |
#define CMD_command 18 |
#define CMD_command 18 |
#define CMD_threads 19 |
#define CMD_threads 19 |
|
#define CMD_grep 20 |
|
|
static void |
static void |
usage(void) |
usage(void) |
|
|
extern char *__progname; |
extern char *__progname; |
|
|
fprintf(stderr, |
fprintf(stderr, |
"usage: %s [-bCIinqSTu] [-d count] [-o field] [-p pid] [-s time] [-U username] [number]\n", |
"usage: %s [-bCIinqSTu] [-d count] [-g command] [-o field] [-p pid] [-s time]\n\t[-U username] [number]\n", |
__progname); |
__progname); |
} |
} |
|
|
|
|
char *endp; |
char *endp; |
int i; |
int i; |
|
|
while ((i = getopt(ac, av, "STICbinqus:d:p:U:o:")) != -1) { |
while ((i = getopt(ac, av, "STICbinqus:d:p:U:o:g:")) != -1) { |
switch (i) { |
switch (i) { |
case 'C': |
case 'C': |
show_args = Yes; |
show_args = Yes; |
|
|
order_name = optarg; |
order_name = optarg; |
break; |
break; |
|
|
|
case 'g': /* grep command name */ |
|
ps.command = strdup(optarg); |
|
break; |
|
|
default: |
default: |
usage(); |
usage(); |
exit(1); |
exit(1); |
|
|
int change, i; |
int change, i; |
struct pollfd pfd[1]; |
struct pollfd pfd[1]; |
uid_t uid; |
uid_t uid; |
static char command_chars[] = "\f qh?en#sdkriIuSopCT"; |
static char command_chars[] = "\f qh?en#sdkriIuSopCTg"; |
|
|
/* |
/* |
* assume valid command unless told |
* assume valid command unless told |
|
|
new_message(MT_standout | MT_delayed, |
new_message(MT_standout | MT_delayed, |
" %sisplaying threads.", |
" %sisplaying threads.", |
ps.threads ? "D" : "Not d"); |
ps.threads ? "D" : "Not d"); |
|
break; |
|
|
|
case CMD_grep: |
|
new_message(MT_standout, |
|
"Grep command name: "); |
|
if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) { |
|
free(ps.command); |
|
if (tempbuf2[0] == '+' && |
|
tempbuf2[1] == '\0') |
|
ps.command = NULL; |
|
else |
|
ps.command = strdup(tempbuf2); |
|
if (putchar('\r') == EOF) |
|
exit(1); |
|
} else |
|
clear_message(); |
break; |
break; |
|
|
default: |
default: |