Date: Mon, 9 Jul 2001 08:50:02 -0700 (PDT) From: wolfgang@lyxys.ka.sub.org (Wolfgang Zenker) To: freebsd-bugs@FreeBSD.org Subject: Re: bin/28789: /usr/bin/last does not filter for uucp connects Message-ID: <200107091550.f69Fo2M84320@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <ru@FreeBSD.org>
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107091550.f69Fo2M84320>
