bin/51488: Compat patch: more(1) allowed filename to start with
'+'
Peter Pentchev
roam at ringlet.net
Tue Apr 29 01:40:15 PDT 2003
The following reply was made to PR bin/51488; it has been noted by GNATS.
From: Peter Pentchev <roam at ringlet.net>
To: Dmitry Sivachenko <mitya at cavia.pp.ru>
Cc: bug-followup at FreeBSD.org
Subject: Re: bin/51488: Compat patch: more(1) allowed filename to start with '+'
Date: Tue, 29 Apr 2003 11:29:32 +0300
On Mon, Apr 28, 2003 at 02:44:04PM +0400, Dmitry Sivachenko wrote:
>
> >Number: 51488
> >Category: bin
> >Synopsis: Compat patch: more(1) allowed filename to start with '+'
> >Originator: Dmitry Sivachenko
> >Release: FreeBSD 4.8-STABLE i386
> >Description:
> more(1), before it became an alias to less(1), allowed filename to start with
> '+'. Thus, `more +abc` was legal request to view file '+abc'.
> less(1) treats leading '+' symbol specially. The following patch
> restores old behaviour (only when invoked as 'more').
> >Fix:
> --- main.c.orig Mon Apr 28 14:36:38 2003
> +++ main.c Mon Apr 28 14:38:21 2003
> @@ -125,7 +125,8 @@
> if (s != NULL)
> scan_option(save(s));
>
> -#define isoptstring(s) (((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0')
> +#define isoptstring(s) more_mode ? (((s)[0] == '-') && (s)[1] != '\0') : \
> + (((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0')
> while (argc > 0 && (isoptstring(*argv) || isoptpending()))
> {
> s = *argv++;
Just a minor style/correctness comment: IMHO, the ?: conditional should
be enclosed in another set of parentheses.
Other than that, this looks great!
G'luck,
Peter
--
Peter Pentchev roam at ringlet.net roam at sbnd.net roam at FreeBSD.org
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553
The rest of this sentence is written in Thailand, on
More information about the freebsd-bugs
mailing list