who: use an unsigned integer for the preferences
This commit is contained in:
parent
d83a38be60
commit
9dc518dae2
14
src/who.c
14
src/who.c
|
@ -30,9 +30,9 @@
|
||||||
|
|
||||||
|
|
||||||
/* types */
|
/* types */
|
||||||
typedef int Prefs;
|
typedef unsigned int Prefs;
|
||||||
#define PREFS_m 0x1
|
#define WHO_PREFS_m 0x1
|
||||||
#define PREFS_T 0x2
|
#define WHO_PREFS_T 0x2
|
||||||
|
|
||||||
|
|
||||||
/* who */
|
/* who */
|
||||||
|
@ -48,7 +48,7 @@ static int _who(Prefs * prefs)
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
||||||
memset(&tm, 0, sizeof(tm));
|
memset(&tm, 0, sizeof(tm));
|
||||||
if(*prefs & PREFS_m && (tty = _who_tty()) == NULL)
|
if(*prefs & WHO_PREFS_m && (tty = _who_tty()) == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
#ifdef USER_PROCESS
|
#ifdef USER_PROCESS
|
||||||
for(; (u = getutxent()) != NULL;)
|
for(; (u = getutxent()) != NULL;)
|
||||||
|
@ -58,7 +58,7 @@ static int _who(Prefs * prefs)
|
||||||
if(tty != NULL && strcmp(tty, u->ut_line) != 0)
|
if(tty != NULL && strcmp(tty, u->ut_line) != 0)
|
||||||
continue;
|
continue;
|
||||||
printf("%-8s", u->ut_user);
|
printf("%-8s", u->ut_user);
|
||||||
if(*prefs & PREFS_T)
|
if(*prefs & WHO_PREFS_T)
|
||||||
printf(" %c", '?');
|
printf(" %c", '?');
|
||||||
printf(" %-8s", u->ut_line);
|
printf(" %-8s", u->ut_line);
|
||||||
t = u->ut_tv.tv_sec;
|
t = u->ut_tv.tv_sec;
|
||||||
|
@ -115,10 +115,10 @@ int main(int argc, char * argv[])
|
||||||
switch(o)
|
switch(o)
|
||||||
{
|
{
|
||||||
case 'm':
|
case 'm':
|
||||||
prefs |= PREFS_m;
|
prefs |= WHO_PREFS_m;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
prefs |= PREFS_T;
|
prefs |= WHO_PREFS_T;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return _usage();
|
return _usage();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user