From owner-freebsd-bugs Mon Jul 9 8:50: 8 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 A3EE237B410 for ; Mon, 9 Jul 2001 08:50:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.3/8.11.3) id f69Fo2M84320; Mon, 9 Jul 2001 08:50:02 -0700 (PDT) (envelope-from gnats) Date: Mon, 9 Jul 2001 08:50:02 -0700 (PDT) Message-Id: <200107091550.f69Fo2M84320@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: wolfgang@lyxys.ka.sub.org (Wolfgang Zenker) Subject: Re: bin/28789: /usr/bin/last does not filter for uucp connects Reply-To: wolfgang@lyxys.ka.sub.org (Wolfgang Zenker) 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: wolfgang@lyxys.ka.sub.org (Wolfgang Zenker) To: Ruslan Ermilov Cc: wolfgang@lyxys.ka.sub.org, bug-followup@FreeBSD.org Subject: Re: bin/28789: /usr/bin/last does not filter for uucp connects Date: Mon, 9 Jul 2001 17:43:49 +0200 (CEST) Hello, Ruslan Ermilov wrote: > 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: this would of course work, but i don't think it would be a good idea, because a) the "wildcard" would only work right at the end of the terminal string, b) the user would have to quote the tty-string or shell metacharacter expansion might lead to unexpected results, c) the -t option is already supposed to have wildcard characteristics, as e.g. "-t p0" is supposed to match "ttyp0", so it might be a bit hard to see why one of the "wildcard options" requires a "*" and the other doesn't. BTW, the wildcard characteristic for "-t" doesn't work right either, it fails for e.g. "-t a0" to match "cuaa0". I will file a separate PR for this problem. Wolfgang To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message