sprint.c (11386) | sprint.c (20157) |
---|---|
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 --- 66 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 | 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 --- 66 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 20 /* in reality, hosts are never longer than 16 */ | 83#define MAXHOSTNAME 17 /* 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", | 84 (void)printf("%-*s %-*s%s %s\n", UT_NAMESIZE, "Login", MAXREALNAME, 85 "Name", " TTY Idle Login Time", |
86 oflag ? " Office Office Phone" : " Where"); | 86 oflag ? " 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; --- 32 unchanged lines hidden (view full) --- 127 else 128 (void)printf("%.6s", p + 4); 129 if (now - w->loginat >= SECSPERDAY * DAYSPERNYEAR / 2) 130 (void)printf(" %.4s", p + 20); 131 else 132 (void)printf(" %.5s", p + 11); 133office: if (oflag) { 134 if (pn->office) | 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; --- 32 unchanged lines hidden (view full) --- 127 else 128 (void)printf("%.6s", p + 4); 129 if (now - w->loginat >= SECSPERDAY * DAYSPERNYEAR / 2) 130 (void)printf(" %.4s", p + 20); 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) 139 (void)printf(" %-.15s", 140 prphone(pn->officephone)); | 135 (void)printf(" %-7.7s", pn->office); 136 else if (pn->officephone) 137 (void)printf(" %-7.7s", " "); 138 if (pn->officephone) 139 (void)printf(" %-.9s", 140 prphone(pn->officephone)); |
141 } else 142 (void)printf(" %.*s", MAXHOSTNAME, w->host); 143 putchar('\n'); 144 } 145 } 146} 147 148static void --- 18 unchanged lines hidden --- | 141 } else 142 (void)printf(" %.*s", MAXHOSTNAME, w->host); 143 putchar('\n'); 144 } 145 } 146} 147 148static void --- 18 unchanged lines hidden --- |