From owner-svn-src-all@FreeBSD.ORG Sun Jul 24 19:19:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 950F0106564A; Sun, 24 Jul 2011 19:19:50 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 847FC8FC16; Sun, 24 Jul 2011 19:19:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6OJJocK021243; Sun, 24 Jul 2011 19:19:50 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6OJJomX021241; Sun, 24 Jul 2011 19:19:50 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201107241919.p6OJJomX021241@svn.freebsd.org> From: Ed Schouten Date: Sun, 24 Jul 2011 19:19:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224296 - stable/8/usr.bin/lock X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jul 2011 19:19:50 -0000 Author: ed Date: Sun Jul 24 19:19:50 2011 New Revision: 224296 URL: http://svn.freebsd.org/changeset/base/224296 Log: MFC r216696 and r216737: Slightly improve output of lock(1). - Remove the /dev/ portion of the TTY name. - In case we use lock -p, print the username that was used to obtain the password hash. Modified: stable/8/usr.bin/lock/lock.c Directory Properties: stable/8/usr.bin/lock/ (props changed) Modified: stable/8/usr.bin/lock/lock.c ============================================================================== --- stable/8/usr.bin/lock/lock.c Sun Jul 24 19:13:54 2011 (r224295) +++ stable/8/usr.bin/lock/lock.c Sun Jul 24 19:19:50 2011 (r224296) @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -102,6 +103,7 @@ main(int argc, char **argv) openlog("lock", LOG_ODELAY, LOG_AUTH); sectimeout = TIMEOUT; + pw = NULL; mypw = NULL; usemine = 0; no_timeout = 0; @@ -137,6 +139,8 @@ main(int argc, char **argv) gethostname(hostname, sizeof(hostname)); if (!(ttynam = ttyname(0))) errx(1, "not a terminal?"); + if (strncmp(ttynam, _PATH_DEV, strlen(_PATH_DEV)) == 0) + ttynam += strlen(_PATH_DEV); if (gettimeofday(&timval, (struct timezone *)NULL)) err(1, "gettimeofday"); nexttime = timval.tv_sec + (sectimeout * 60); @@ -196,7 +200,11 @@ main(int argc, char **argv) } /* header info */ - (void)printf("lock: %s on %s.", ttynam, hostname); + if (pw != NULL) + (void)printf("lock: %s using %s on %s.", pw->pw_name, + ttynam, hostname); + else + (void)printf("lock: %s on %s.", ttynam, hostname); if (no_timeout) (void)printf(" no timeout."); else