From owner-freebsd-bugs Mon Jul 28 21:20:17 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id VAA06533 for bugs-outgoing; Mon, 28 Jul 1997 21:20:17 -0700 (PDT) Received: (from gnats@localhost) by hub.freebsd.org (8.8.5/8.8.5) id VAA06488; Mon, 28 Jul 1997 21:20:03 -0700 (PDT) Resent-Date: Mon, 28 Jul 1997 21:20:03 -0700 (PDT) Resent-Message-Id: <199707290420.VAA06488@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, ee96199@tom.fe.up.pt Received: from garfield.telepac.pt (sj1-p3.telepac.pt [194.65.177.67]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id VAA05754 for ; Mon, 28 Jul 1997 21:10:53 -0700 (PDT) Received: (from jmg@localhost) by garfield.telepac.pt (8.8.6/8.8.5) id QAA00784; Mon, 28 Jul 1997 16:52:50 +0100 (WEST) Message-Id: <199707281552.QAA00784@garfield.telepac.pt> Date: Mon, 28 Jul 1997 16:52:50 +0100 (WEST) From: jmg@bug.fe.up.pt Reply-To: ee96199@tom.fe.up.pt To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/4187: w command Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >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: