libproc buffer extension, better w guess

This commit is contained in:
csmall
2002-05-15 12:54:32 +00:00
parent 264c563f54
commit 4a21f35257
3 changed files with 12 additions and 2 deletions

5
w.c
View File

@ -146,7 +146,10 @@ static proc_t *getproc(utmp_t *u, char *tty, int *jcpu, int *found_utpid) {
line = tty_to_dev(tty);
*jcpu = *found_utpid = 0;
for(p = procs; *p; p++) {
if((**p).pid == u->ut_pid) *found_utpid = 1;
if((**p).pid == u->ut_pid) {
*found_utpid = 1;
best = *p;
}
if((**p).tty != line) continue;
(*jcpu) += (**p).utime + (**p).stime;
secondbest = *p;