w.c is 4-unit indent, mixed spaces and 8-unit hard tabs
This commit is contained in:
parent
1572abd03e
commit
c471462b3d
40
w.c
40
w.c
@ -127,33 +127,33 @@ static proc_t *getproc(const utmp_t *restrict const u, const char *restrict cons
|
|||||||
unsigned uid = ~0U;
|
unsigned uid = ~0U;
|
||||||
|
|
||||||
if(!ignoreuser){
|
if(!ignoreuser){
|
||||||
char buf[UT_NAMESIZE+1];
|
char buf[UT_NAMESIZE+1];
|
||||||
struct passwd *passwd_data; /* pointer to static data */
|
struct passwd *passwd_data; /* pointer to static data */
|
||||||
strncpy(buf,u->ut_user,UT_NAMESIZE);
|
strncpy(buf,u->ut_user,UT_NAMESIZE);
|
||||||
buf[UT_NAMESIZE] = '\0';
|
buf[UT_NAMESIZE] = '\0';
|
||||||
passwd_data = getpwnam(buf);
|
passwd_data = getpwnam(buf);
|
||||||
if(!passwd_data) return NULL;
|
if(!passwd_data) return NULL;
|
||||||
uid = passwd_data->pw_uid;
|
uid = passwd_data->pw_uid;
|
||||||
/* OK to have passwd_data go out of scope here */
|
/* OK to have passwd_data go out of scope here */
|
||||||
}
|
}
|
||||||
line = tty_to_dev(tty);
|
line = tty_to_dev(tty);
|
||||||
*jcpu = 0;
|
*jcpu = 0;
|
||||||
*found_utpid = 0;
|
*found_utpid = 0;
|
||||||
for(p = procs; *p; p++) {
|
for(p = procs; *p; p++) {
|
||||||
if((**p).pid == u->ut_pid) {
|
if((**p).pid == u->ut_pid) {
|
||||||
*found_utpid = 1;
|
*found_utpid = 1;
|
||||||
best = *p;
|
best = *p;
|
||||||
}
|
}
|
||||||
if((**p).tty != line) continue;
|
if((**p).tty != line) continue;
|
||||||
(*jcpu) += (**p).utime + (**p).stime;
|
(*jcpu) += (**p).utime + (**p).stime;
|
||||||
secondbest = *p;
|
secondbest = *p;
|
||||||
/* same time-logic here as for "best" below */
|
/* same time-logic here as for "best" below */
|
||||||
if(! (secondbest && (**p).start_time <= secondbest->start_time) ){
|
if(! (secondbest && (**p).start_time <= secondbest->start_time) ){
|
||||||
secondbest = *p;
|
secondbest = *p;
|
||||||
}
|
}
|
||||||
if(!ignoreuser && uid != (**p).euid && uid != (**p).ruid) continue;
|
if(!ignoreuser && uid != (**p).euid && uid != (**p).ruid) continue;
|
||||||
if((**p).pid != (**p).tpgid) continue;
|
if((**p).pid != (**p).tpgid) continue;
|
||||||
if(best && (**p).start_time <= best->start_time) continue;
|
if(best && (**p).start_time <= best->start_time) continue;
|
||||||
best = *p;
|
best = *p;
|
||||||
}
|
}
|
||||||
return best ? best : secondbest;
|
return best ? best : secondbest;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user