[comp.bugs.4bsd] 4.3BSD "who" improvements

gwyn@brl-smoke.ARPA (Doug Gwyn ) (03/16/87)

65a66,67
+ 	if (argc == 3)		/* DAG -- efficiency tweak (moved out of loop) */
+ 		gethostname(hostname, sizeof (hostname));
68d69
- 			gethostname(hostname, sizeof (hostname));
78a80,90
+ 	if (argc == 3) {	/* DAG -- added to handle empty utmp slots */
+ 		/* not in utmp - use best guess from passwd file */
+ 		pw = getpwuid(getuid());
+ 		strncpy(utmp.ut_name, pw ? pw->pw_name : "?", NMAX);
+ 		strncpy(utmp.ut_line, tp, LMAX);
+ 		strncpy(utmp.ut_host, "null", HMAX);
+ 		time(&utmp.ut_time);
+ 		printf("%s!", hostname);
+ 		putline();
+ 	}
+ 	exit(0);		/* DAG -- bug fix (was missing) */

gwyn@brl-smoke.ARPA (Doug Gwyn ) (03/16/87)

Oops -- in my previous posting please change the words
"efficiency tweak" to "now needed twice" in the comment.