Deleted Added
full compact
sprint.c (10553) sprint.c (11386)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 45 unchanged lines hidden (view full) ---

54
55void
56sflag_print()
57{
58 extern time_t now;
59 extern int oflag;
60 register PERSON *pn;
61 register WHERE *w;
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 45 unchanged lines hidden (view full) ---

54
55void
56sflag_print()
57{
58 extern time_t now;
59 extern int oflag;
60 register PERSON *pn;
61 register WHERE *w;
62 register int sflag, r;
62 register int sflag, r, namelen;
63 char p[80];
64 DBT data, key;
65
66 /*
67 * short format --
68 * login name
69 * real name
70 * terminal name (the XX of ttyXX)

--- 4 unchanged lines hidden (view full) ---

75 * If > 6 months, show year instead of time.
76 * if (-o)
77 * office location
78 * office phone
79 * else
80 * remote host
81 */
82#define MAXREALNAME 20
63 char p[80];
64 DBT data, key;
65
66 /*
67 * short format --
68 * login name
69 * real name
70 * terminal name (the XX of ttyXX)

--- 4 unchanged lines hidden (view full) ---

75 * If > 6 months, show year instead of time.
76 * if (-o)
77 * office location
78 * office phone
79 * else
80 * remote host
81 */
82#define MAXREALNAME 20
83#define MAXHOSTNAME 18 /* in reality, hosts are not longer than 16 */
84 (void)printf("%-*s %-*s %s %s\n", UT_NAMESIZE, "Login", MAXREALNAME,
85 "Name", "TTY Idle Login Time",
83#define MAXHOSTNAME 20 /* in reality, hosts are never longer than 16 */
84 (void)printf("%-*s %-*s%s %s\n", UT_NAMESIZE, "Login", MAXREALNAME,
85 "Name", " TTY Idle Login Time",
86 oflag ? " Office Office Phone" : " Where");
87
88 for (sflag = R_FIRST;; sflag = R_NEXT) {
89 r = (*db->seq)(db, &key, &data, sflag);
90 if (r == -1)
91 err("db seq: %s", strerror(errno));
92 if (r == 1)
93 break;
94 pn = *(PERSON **)data.data;
95
96 for (w = pn->whead; w != NULL; w = w->next) {
86 oflag ? " Office Office Phone" : " Where");
87
88 for (sflag = R_FIRST;; sflag = R_NEXT) {
89 r = (*db->seq)(db, &key, &data, sflag);
90 if (r == -1)
91 err("db seq: %s", strerror(errno));
92 if (r == 1)
93 break;
94 pn = *(PERSON **)data.data;
95
96 for (w = pn->whead; w != NULL; w = w->next) {
97 (void)printf("%-*.*s %-*.*s ", UT_NAMESIZE, UT_NAMESIZE,
98 pn->name, MAXREALNAME, MAXREALNAME,
99 pn->realname ? pn->realname : "");
97 namelen = MAXREALNAME;
98 if (w->info == LOGGEDIN && !w->writable)
99 --namelen; /* leave space before `*' */
100 (void)printf("%-*.*s %-*.*s", UT_NAMESIZE, UT_NAMESIZE,
101 pn->name, MAXREALNAME, namelen,
102 pn->realname ? pn->realname : "");
100 if (!w->loginat) {
101 (void)printf(" * * No logins ");
102 goto office;
103 }
104 (void)putchar(w->info == LOGGEDIN && !w->writable ?
105 '*' : ' ');
106 if (*w->tty)
107 (void)printf("%-3.3s ",

--- 20 unchanged lines hidden (view full) ---

128 else
129 (void)printf(" %.5s", p + 11);
130office: if (oflag) {
131 if (pn->office)
132 (void)printf(" %-10.10s", pn->office);
133 else if (pn->officephone)
134 (void)printf(" %-10.10s", " ");
135 if (pn->officephone)
103 if (!w->loginat) {
104 (void)printf(" * * No logins ");
105 goto office;
106 }
107 (void)putchar(w->info == LOGGEDIN && !w->writable ?
108 '*' : ' ');
109 if (*w->tty)
110 (void)printf("%-3.3s ",

--- 20 unchanged lines hidden (view full) ---

131 else
132 (void)printf(" %.5s", p + 11);
133office: if (oflag) {
134 if (pn->office)
135 (void)printf(" %-10.10s", pn->office);
136 else if (pn->officephone)
137 (void)printf(" %-10.10s", " ");
138 if (pn->officephone)
136 (void)printf(" %-.13s",
139 (void)printf(" %-.15s",
137 prphone(pn->officephone));
138 } else
139 (void)printf(" %.*s", MAXHOSTNAME, w->host);
140 putchar('\n');
141 }
142 }
143}
144

--- 19 unchanged lines hidden ---
140 prphone(pn->officephone));
141 } else
142 (void)printf(" %.*s", MAXHOSTNAME, w->host);
143 putchar('\n');
144 }
145 }
146}
147

--- 19 unchanged lines hidden ---