From owner-freebsd-bugs Mon Jul 9 7:20: 7 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id B1A4437B401 for ; Mon, 9 Jul 2001 07:20:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.3/8.11.3) id f69EK4l70765; Mon, 9 Jul 2001 07:20:04 -0700 (PDT) (envelope-from gnats) Date: Mon, 9 Jul 2001 07:20:04 -0700 (PDT) Message-Id: <200107091420.f69EK4l70765@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Ruslan Ermilov Subject: Re: bin/28789: /usr/bin/last does not filter for uucp connects Reply-To: Ruslan Ermilov Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/28789; it has been noted by GNATS. From: Ruslan Ermilov To: wolfgang@lyxys.ka.sub.org Cc: bug-followup@FreeBSD.org Subject: Re: bin/28789: /usr/bin/last does not filter for uucp connects Date: Mon, 9 Jul 2001 17:18:04 +0300 On Sat, Jul 07, 2001 at 12:08:15PM +0200, wolfgang@lyxys.ka.sub.org wrote: > > Suggested fix is to introduce a new option "-T ttytype" to > /usr/bin/last. This option would allow to filter for entries > with tty name fields starting with the specified string. > > Suggested implementation is attached as diff to last.c and last.1, > I hope it is not garbled by send-pr. > An alternate solution would be to add the concept of wildcard tty match, e.g., ``last -t ftp*'' (modulo the shell expansion). Index: last.c =================================================================== RCS file: /home/ncvs/src/usr.bin/last/last.c,v retrieving revision 1.10.6.2 diff -u -r1.10.6.2 last.c --- last.c 2001/03/04 08:39:25 1.10.6.2 +++ last.c 2001/07/09 14:11:59 @@ -333,6 +333,7 @@ struct utmp *bp; { ARG *step; + char *c; if (!arglist) return (YES); @@ -344,7 +345,9 @@ return (YES); break; case TTY_TYPE: - if (!strncmp(step->name, bp->ut_line, UT_LINESIZE)) + if (!strncmp(step->name, bp->ut_line, + (c = strchr(step->name, '*')) != NULL ? + c - step->name : UT_LINESIZE)) return (YES); break; case USER_TYPE: Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message