From owner-freebsd-bugs Mon Dec 31 0:10: 6 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 B2B8737B428 for ; Mon, 31 Dec 2001 00:10:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id fBV8A2w35884; Mon, 31 Dec 2001 00:10:02 -0800 (PST) (envelope-from gnats) Date: Mon, 31 Dec 2001 00:10:02 -0800 (PST) Message-Id: <200112310810.fBV8A2w35884@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Mike Heffner Subject: Re: bin/32935: /bin/sh builtin echo command Reply-To: Mike Heffner 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/32935; it has been noted by GNATS. From: Mike Heffner To: Sheldon Hearn , freebsd-gnats-submit@freebsd.org Cc: audit@FreeBSD.ORG Subject: Re: bin/32935: /bin/sh builtin echo command Date: Mon, 31 Dec 2001 03:05:51 -0500 (EST) 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-bugs" in the body of the message