summaryrefslogtreecommitdiffstats
path: root/usr.bin/finger/sprint.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-12-28 20:54:34 +0000
committered <ed@FreeBSD.org>2009-12-28 20:54:34 +0000
commit5bf232465b8e0def3c04c6e47745b969162463fe (patch)
tree572b8cc48e0e4fce2e62ea0eb3f0cf8dc6028a53 /usr.bin/finger/sprint.c
parentf60568ce2e9a52bcb63e2ad46f8bc34bf16b6273 (diff)
downloadFreeBSD-src-5bf232465b8e0def3c04c6e47745b969162463fe.zip
FreeBSD-src-5bf232465b8e0def3c04c6e47745b969162463fe.tar.gz
Migrate finger(1) away from <utmp.h>.
Unfortunately it also uses lastlog, which means we must resort to local extensions of the utmpx-interface. Because the user name and TTY name are now nul-terminated, there is no need to copy around strings as often.
Diffstat (limited to 'usr.bin/finger/sprint.c')
-rw-r--r--usr.bin/finger/sprint.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/finger/sprint.c b/usr.bin/finger/sprint.c
index e4f768b..c08ca3a 100644
--- a/usr.bin/finger/sprint.c
+++ b/usr.bin/finger/sprint.c
@@ -43,6 +43,7 @@ static char sccsid[] = "@(#)sprint.c 8.3 (Berkeley) 4/28/95";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <db.h>
@@ -52,7 +53,8 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#include <string.h>
#include <time.h>
-#include <utmp.h>
+#define _ULOG_POSIX_NAMES
+#include <ulog.h>
#include "finger.h"
static void stimeprint(WHERE *);
@@ -88,7 +90,7 @@ sflag_print(void)
*/
#define MAXREALNAME 16
#define MAXHOSTNAME 17 /* in reality, hosts are never longer than 16 */
- (void)printf("%-*s %-*s%s %s\n", UT_NAMESIZE, "Login", MAXREALNAME,
+ (void)printf("%-*s %-*s%s %s\n", MAXLOGNAME, "Login", MAXREALNAME,
"Name", " TTY Idle Login Time ", (gflag) ? "" :
oflag ? "Office Phone" : "Where");
@@ -105,7 +107,7 @@ sflag_print(void)
namelen = MAXREALNAME;
if (w->info == LOGGEDIN && !w->writable)
--namelen; /* leave space before `*' */
- (void)printf("%-*.*s %-*.*s", UT_NAMESIZE, UT_NAMESIZE,
+ (void)printf("%-*.*s %-*.*s", MAXLOGNAME, MAXLOGNAME,
pn->name, MAXREALNAME, namelen,
pn->realname ? pn->realname : "");
if (!w->loginat) {
OpenPOWER on IntegriCloud