Date: Mon, 31 Dec 2001 03:05:51 -0500 (EST) From: Mike Heffner <mheffner@novacoxmail.com> To: Sheldon Hearn <sheldonh@starjuice.net>, freebsd-gnats-submit@freebsd.org Cc: audit@FreeBSD.ORG Subject: Re: bin/32935: /bin/sh builtin echo command Message-ID: <XFMail.20011231030551.mheffner@novacoxmail.com> In-Reply-To: <89809.1009719699@axl.seasidesoftware.co.za>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <mheffner@[acm.]vt.edu> Fredericksburg, VA <mikeh@FreeBSD.org> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20011231030551.mheffner>