From owner-freebsd-audit Mon Dec 31 0: 6:17 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mta0x15.coxmail.com (cm-fe1.coxmail.com [206.157.225.48]) by hub.freebsd.org (Postfix) with ESMTP id 5363F37B41A; Mon, 31 Dec 2001 00:06:13 -0800 (PST) Received: from enterprise.muriel.penguinpowered.com ([209.249.174.31]) by mta0x15.coxmail.com (InterMail vK.4.03.04.01 201-232-130-101 license c271d808eeaddc9d652e7c0b1383e8cc) with ESMTP id <20011231080553.XZCF848.mta0x15@enterprise.muriel.penguinpowered.com>; Mon, 31 Dec 2001 03:05:53 -0500 Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <89809.1009719699@axl.seasidesoftware.co.za> Date: Mon, 31 Dec 2001 03:05:51 -0500 (EST) Reply-To: Mike Heffner From: Mike Heffner To: Sheldon Hearn , freebsd-gnats-submit@freebsd.org Subject: Re: bin/32935: /bin/sh builtin echo command Cc: audit@FreeBSD.ORG Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 30-Dec-2001 Sheldon Hearn wrote: | | Hi folks, | | Could someone check out PR bin/32935, which contains a patch to fix | ash's builtin echo command so that it accepts the -e and -n options | combined? | Looks ok, except that I think in the '#define eflag 1' case it should still accept '-ne' as valid and just ignore the 'e'. How about this: Index: echo.c =================================================================== RCS file: /home/ncvs/src/bin/sh/bltin/echo.c,v retrieving revision 1.10 diff -u -r1.10 echo.c --- echo.c 26 Jun 2000 22:43:30 -0000 1.10 +++ echo.c 31 Dec 2001 08:00:09 -0000 @@ -64,16 +64,28 @@ ap = argv; if (argc) ap++; - if ((p = *ap) != NULL) { - if (equal(p, "-n")) { - nflag++; - ap++; - } else if (equal(p, "-e")) { + if ((p = *ap) != NULL && *p == '-') { + ap++; + p++; + do { + if (*p == 'n') + nflag++; + else if (*p == 'e') #ifndef eflag - eflag++; + eflag++; +#else + ; #endif - ap++; - } + else { + nflag = 0; +#ifndef eflag + eflag = 0; +#endif + ap--; + break; + } + } while (*++p != '\0'); + } while ((p = *ap++) != NULL) { while ((c = *p++) != '\0') { Mike -- Mike Heffner Fredericksburg, VA To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message