summaryrefslogtreecommitdiffstats
path: root/usr.bin/finger
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1995-10-10 02:31:09 +0000
committerpeter <peter@FreeBSD.org>1995-10-10 02:31:09 +0000
commit040dbb88996476793d6dec5b83d990b32760c3af (patch)
treefc060d6a13cac9c5aadec085354cbf068e042499 /usr.bin/finger
parent78aea1ad2e14949ec0b48ca41b6c6745c8ec6bb5 (diff)
downloadFreeBSD-src-040dbb88996476793d6dec5b83d990b32760c3af.zip
FreeBSD-src-040dbb88996476793d6dec5b83d990b32760c3af.tar.gz
Reverse out some of the previous commit I did, which shortened the
finger output from 80 to 79 characters to stop the syscons every-second-line-is-blank problem. Also, redo the TTY column mod so that it steals one of the (usually) two blank spaces from the before the tty column rather than from the office phone number. This means the office phone field width in the short finger is back to 15 characters instead of 13.
Diffstat (limited to 'usr.bin/finger')
-rw-r--r--usr.bin/finger/sprint.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/usr.bin/finger/sprint.c b/usr.bin/finger/sprint.c
index 7d1b2ea..3f1fc91 100644
--- a/usr.bin/finger/sprint.c
+++ b/usr.bin/finger/sprint.c
@@ -59,7 +59,7 @@ sflag_print()
extern int oflag;
register PERSON *pn;
register WHERE *w;
- register int sflag, r;
+ register int sflag, r, namelen;
char p[80];
DBT data, key;
@@ -80,9 +80,9 @@ sflag_print()
* remote host
*/
#define MAXREALNAME 20
-#define MAXHOSTNAME 18 /* in reality, hosts are not longer than 16 */
- (void)printf("%-*s %-*s %s %s\n", UT_NAMESIZE, "Login", MAXREALNAME,
- "Name", "TTY Idle Login Time",
+#define MAXHOSTNAME 20 /* in reality, hosts are never longer than 16 */
+ (void)printf("%-*s %-*s%s %s\n", UT_NAMESIZE, "Login", MAXREALNAME,
+ "Name", " TTY Idle Login Time",
oflag ? " Office Office Phone" : " Where");
for (sflag = R_FIRST;; sflag = R_NEXT) {
@@ -94,9 +94,12 @@ sflag_print()
pn = *(PERSON **)data.data;
for (w = pn->whead; w != NULL; w = w->next) {
- (void)printf("%-*.*s %-*.*s ", UT_NAMESIZE, UT_NAMESIZE,
- pn->name, MAXREALNAME, MAXREALNAME,
- pn->realname ? pn->realname : "");
+ namelen = MAXREALNAME;
+ if (w->info == LOGGEDIN && !w->writable)
+ --namelen; /* leave space before `*' */
+ (void)printf("%-*.*s %-*.*s", UT_NAMESIZE, UT_NAMESIZE,
+ pn->name, MAXREALNAME, namelen,
+ pn->realname ? pn->realname : "");
if (!w->loginat) {
(void)printf(" * * No logins ");
goto office;
@@ -133,7 +136,7 @@ office: if (oflag) {
else if (pn->officephone)
(void)printf(" %-10.10s", " ");
if (pn->officephone)
- (void)printf(" %-.13s",
+ (void)printf(" %-.15s",
prphone(pn->officephone));
} else
(void)printf(" %.*s", MAXHOSTNAME, w->host);
OpenPOWER on IntegriCloud