Date: Mon, 28 Jul 1997 16:52:50 +0100 (WEST) From: jmg@bug.fe.up.pt To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/4187: w command Message-ID: <199707281552.QAA00784@garfield.telepac.pt> Resent-Message-ID: <199707290420.VAA06488@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 4187
>Category: bin
>Synopsis: The w command should have a larger tty field
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Mon Jul 28 21:20:01 PDT 1997
>Last-Modified:
>Originator: Jorge M. Goncalves
>Organization:
>Release: FreeBSD 2.2-STABLE i386
>Environment:
All FreeBSD releases.
>Description:
Like most Unices FreeBSD should have a larger tty field at least
as large as UT_LINESIZE (/usr/include/utmp.h). If the tty name is logged
with this size why isn't the w command reporting it?
>How-To-Repeat:
Use a serial console and open a getty on /dev/console and the run
the w command. It reports con and could report console like
USER TTY FROM LOGIN@ IDLE WHAT
jmg console - 4:50PM - -
>Fix:
Here is a simple patch to /usr/src/usr.bin/w/w.c that uses UT_LINESIZE:
*** w.c.#orig# Sat Mar 15 10:52:33 1997
--- w.c Fri Jul 25 08:06:18 1997
***************
*** 235,241 ****
if (wcmd == 0)
exit (0);
! #define HEADER "USER TTY FROM LOGIN@ IDLE WHAT\n"
#define WUSED (sizeof (HEADER) - sizeof ("WHAT\n"))
(void)printf(HEADER);
}
--- 235,241 ----
if (wcmd == 0)
exit (0);
! #define HEADER "USER TTY FROM LOGIN@ IDLE WHAT\n"
#define WUSED (sizeof (HEADER) - sizeof ("WHAT\n"))
(void)printf(HEADER);
}
***************
*** 338,345 ****
ep->utmp.ut_host + UT_HOSTSIZE - x, x);
p = buf;
}
! (void)printf("%-*.*s %-3.3s %-*.*s ",
UT_NAMESIZE, UT_NAMESIZE, ep->utmp.ut_name,
strncmp(ep->utmp.ut_line, "tty", 3) &&
strncmp(ep->utmp.ut_line, "cua", 3) ?
ep->utmp.ut_line : ep->utmp.ut_line + 3,
--- 338,346 ----
ep->utmp.ut_host + UT_HOSTSIZE - x, x);
p = buf;
}
! (void)printf("%-*.*s %-*.*s %-*.*s ",
UT_NAMESIZE, UT_NAMESIZE, ep->utmp.ut_name,
+ UT_LINESIZE, UT_LINESIZE,
strncmp(ep->utmp.ut_line, "tty", 3) &&
strncmp(ep->utmp.ut_line, "cua", 3) ?
ep->utmp.ut_line : ep->utmp.ut_line + 3,
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707281552.QAA00784>
