version 1.9, 2000/03/22 17:07:37 |
version 1.10, 2001/01/31 17:42:26 |
|
|
int show_labels; /* show column labels */ |
int show_labels; /* show column labels */ |
int show_quick; /* quick, names only */ |
int show_quick; /* quick, names only */ |
|
|
|
#define NAME_WIDTH 8 |
|
#define HOST_WIDTH 32 |
|
|
int |
int |
main(argc, argv) |
main(argc, argv) |
int argc; |
int argc; |
|
|
|
|
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1) { |
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1) { |
if (*usr.ut_name && *usr.ut_line) { |
if (*usr.ut_name && *usr.ut_line) { |
(void)printf("%-*.*s ", UT_NAMESIZE, |
(void)printf("%-*.*s ", NAME_WIDTH, |
UT_NAMESIZE, usr.ut_name); |
UT_NAMESIZE, usr.ut_name); |
if ((++count % 8) == 0) |
if ((++count % 8) == 0) |
(void) printf("\n"); |
(void) printf("\n"); |
|
|
|
|
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1) { |
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1) { |
if (*usr.ut_name && *usr.ut_line) { |
if (*usr.ut_name && *usr.ut_line) { |
(void)printf("%-*.*s ", UT_NAMESIZE, |
(void)printf("%-*.*s ", NAME_WIDTH, |
UT_NAMESIZE, usr.ut_name); |
UT_NAMESIZE, usr.ut_name); |
if ((++count % 8) == 0) |
if ((++count % 8) == 0) |
(void) printf("\n"); |
(void) printf("\n"); |
|
|
|
|
} |
} |
|
|
(void)printf("%-*.*s ", UT_NAMESIZE, UT_NAMESIZE, up->ut_name); |
(void)printf("%-*.*s ", NAME_WIDTH, UT_NAMESIZE, up->ut_name); |
|
|
if (show_term) { |
if (show_term) { |
(void)printf("%c ", state); |
(void)printf("%c ", state); |
|
|
} |
} |
|
|
if (*up->ut_host) |
if (*up->ut_host) |
printf("\t(%.*s)", UT_HOSTSIZE, up->ut_host); |
printf(" (%.*s)", HOST_WIDTH, up->ut_host); |
(void)putchar('\n'); |
(void)putchar('\n'); |
} |
} |
|
|
void |
void |
output_labels() |
output_labels() |
{ |
{ |
(void)printf("%-*.*s ", UT_NAMESIZE, UT_NAMESIZE, "USER"); |
(void)printf("%-*.*s ", NAME_WIDTH, UT_NAMESIZE, "USER"); |
|
|
if (show_term) |
if (show_term) |
(void)printf("S "); |
(void)printf("S "); |
|
|
if (show_idle) |
if (show_idle) |
(void)printf("IDLE "); |
(void)printf("IDLE "); |
|
|
(void)printf("\t%.*s", UT_HOSTSIZE, "FROM"); |
(void)printf(" %.*s", HOST_WIDTH, "FROM"); |
|
|
(void)putchar('\n'); |
(void)putchar('\n'); |
} |
} |