version 1.77, 2012/04/20 16:36:11 |
version 1.78, 2012/06/05 18:52:53 |
|
|
|
|
fprintf(stderr, |
fprintf(stderr, |
"usage: %s [-1bCHIinqSu] [-d count] [-g string] [-o field] " |
"usage: %s [-1bCHIinqSu] [-d count] [-g string] [-o field] " |
"[-p pid] [-s time]\n\t[-U user] [number]\n", |
"[-p pid] [-s time]\n\t[-U [-]user] [number]\n", |
__progname); |
__progname); |
} |
} |
|
|
|
|
break; |
break; |
|
|
case 'U': /* display only username's processes */ |
case 'U': /* display only username's processes */ |
if ((ps.uid = userid(optarg)) == (uid_t)-1) |
if (optarg[0] == '-') { |
|
if ((ps.huid = userid(optarg+1)) == (uid_t)-1) |
|
new_message(MT_delayed, "%s: unknown user", |
|
optarg); |
|
} else if ((ps.uid = userid(optarg)) == (uid_t)-1) |
new_message(MT_delayed, "%s: unknown user", |
new_message(MT_delayed, "%s: unknown user", |
optarg); |
optarg); |
break; |
break; |
|
|
ps.idle = Yes; |
ps.idle = Yes; |
ps.system = No; |
ps.system = No; |
ps.uid = (uid_t)-1; |
ps.uid = (uid_t)-1; |
|
ps.huid = (uid_t)-1; |
ps.pid = (pid_t)-1; |
ps.pid = (pid_t)-1; |
ps.command = NULL; |
ps.command = NULL; |
|
|
|
|
char ch, *iptr; |
char ch, *iptr; |
int change, i; |
int change, i; |
struct pollfd pfd[1]; |
struct pollfd pfd[1]; |
uid_t uid; |
uid_t uid, huid; |
static char command_chars[] = "\f qh?en#sdkriIuSopCHg+P1"; |
static char command_chars[] = "\f qh?en#sdkriIuSopCHg+P1"; |
|
|
/* |
/* |
|
|
new_message(MT_standout, |
new_message(MT_standout, |
"Username to show: "); |
"Username to show: "); |
if (readline(tempbuf, sizeof(tempbuf)) > 0) { |
if (readline(tempbuf, sizeof(tempbuf)) > 0) { |
if (tempbuf[0] == '+' && |
if ((tempbuf[0] == '+' || tempbuf[0] == '-') && |
tempbuf[1] == '\0') { |
tempbuf[1] == '\0') { |
ps.uid = (uid_t)-1; |
ps.uid = (uid_t)-1; |
|
ps.huid = (uid_t)-1; |
|
} else if (tempbuf[0] == '-') { |
|
if ((huid = userid(tempbuf+1)) == (uid_t)-1) { |
|
new_message(MT_standout, |
|
" %s: unknown user", tempbuf+1); |
|
no_command = Yes; |
|
} else { |
|
ps.huid = huid; |
|
ps.uid = (uid_t)-1; |
|
} |
} else if ((uid = userid(tempbuf)) == (uid_t)-1) { |
} else if ((uid = userid(tempbuf)) == (uid_t)-1) { |
new_message(MT_standout, |
new_message(MT_standout, |
" %s: unknown user", tempbuf); |
" %s: unknown user", tempbuf); |
no_command = Yes; |
no_command = Yes; |
} else |
} else { |
ps.uid = uid; |
ps.uid = uid; |
|
ps.huid = (uid_t)-1; |
|
} |
putr(); |
putr(); |
} else |
} else |
clear_message(); |
clear_message(); |
|
|
|
|
case CMD_add: |
case CMD_add: |
ps.uid = (uid_t)-1; /* uid */ |
ps.uid = (uid_t)-1; /* uid */ |
|
ps.huid = (uid_t)-1; |
ps.pid = (pid_t)-1; /* pid */ |
ps.pid = (pid_t)-1; /* pid */ |
ps.system = old_system; |
ps.system = old_system; |
ps.command = NULL; /* grep */ |
ps.command = NULL; /* grep */ |