sprint.c (9987) | sprint.c (9993) |
---|---|
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 --- 46 unchanged lines hidden (view full) --- 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; | 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 --- 46 unchanged lines hidden (view full) --- 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; |
63 register char *p; | 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) 71 * if terminal writeable (add an '*' to the terminal name --- 38 unchanged lines hidden (view full) --- 110 ? w->tty : w->tty + 3); 111 else 112 (void)printf(" "); 113 if (w->info == LOGGEDIN) { 114 stimeprint(w); 115 (void)printf(" "); 116 } else 117 (void)printf(" * "); | 64 DBT data, key; 65 66 /* 67 * short format -- 68 * login name 69 * real name 70 * terminal name (the XX of ttyXX) 71 * if terminal writeable (add an '*' to the terminal name --- 38 unchanged lines hidden (view full) --- 110 ? w->tty : w->tty + 3); 111 else 112 (void)printf(" "); 113 if (w->info == LOGGEDIN) { 114 stimeprint(w); 115 (void)printf(" "); 116 } else 117 (void)printf(" * "); |
118 p = ctime(&w->loginat); | 118 strftime(p, sizeof(p), "%c", localtime(&w->loginat)); |
119#define SECSPERDAY 86400 120#define DAYSPERWEEK 7 121#define DAYSPERNYEAR 365 122 if (now - w->loginat < SECSPERDAY * (DAYSPERWEEK - 1)) 123 (void)printf("%.3s ", p); 124 else 125 (void)printf("%.6s", p + 4); 126 if (now - w->loginat >= SECSPERDAY * DAYSPERNYEAR / 2) --- 37 unchanged lines hidden --- | 119#define SECSPERDAY 86400 120#define DAYSPERWEEK 7 121#define DAYSPERNYEAR 365 122 if (now - w->loginat < SECSPERDAY * (DAYSPERWEEK - 1)) 123 (void)printf("%.3s ", p); 124 else 125 (void)printf("%.6s", p + 4); 126 if (now - w->loginat >= SECSPERDAY * DAYSPERNYEAR / 2) --- 37 unchanged lines hidden --- |