From owner-freebsd-bugs Thu Aug 26 6:10: 7 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id D94D414F7C for ; Thu, 26 Aug 1999 06:10:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id GAA01635; Thu, 26 Aug 1999 06:10:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Thu, 26 Aug 1999 06:10:03 -0700 (PDT) Message-Id: <199908261310.GAA01635@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Sheldon Hearn Subject: Re: bin/13363: Patch to env(1) for Unix 98 compatability Reply-To: Sheldon Hearn Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/13363; it has been noted by GNATS. From: Sheldon Hearn To: James Howard Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/13363: Patch to env(1) for Unix 98 compatability Date: Thu, 26 Aug 1999 15:02:38 +0200 On Wed, 25 Aug 1999 17:57:56 -0400, James Howard wrote: > - while ((ch = getopt(argc, argv, "-")) != -1) > + while ((ch = getopt(argc, argv, "i-")) != -1) > switch(ch) { > + case 'i': > case '-': You don't seem to have addressed the case disordering that Bruce commented on. :-) > +.It Fl i > +Equivalent to > +.Fl . This text begs the question "why?". I'd also suggest that the behaviour of the two options be described under -i, with - being declared the compatibility option. This should encourage people to use -i for portability. This is how the Single UNIX Spec does it. :-P Ciao, Sheldon. Index: usr.bin/printenv/printenv.1 =================================================================== RCS file: /home/ncvs/src/usr.bin/printenv/printenv.1,v retrieving revision 1.3 diff -u -d -r1.3 printenv.1 --- printenv.1 1999/07/12 20:23:52 1.3 +++ printenv.1 1999/08/26 13:02:02 @@ -45,6 +45,7 @@ .Op Ar name .Nm env .Op Fl +.Op Fl i .Op Ar name=value ... .Op Ar command .Sh DESCRIPTION @@ -72,12 +73,21 @@ .Ar name , with a value of .Ar value . -The option -.Sq Fl -causes +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl i +Execute the +.Ar command +with only those environment values specified. The environment inherited +by .Nm env -to completely ignore the environment -it inherits. +is ignored completely. +.It Fl +Identical to the +.Fl i +option, available for backward compatibility. +.El .Pp If no command is specified, .Nm env Index: usr.bin/env/env.c =================================================================== RCS file: /home/ncvs/src/usr.bin/env/env.c,v retrieving revision 1.4 diff -u -d -r1.4 env.c --- env.c 1998/12/06 22:58:22 1.4 +++ env.c 1999/08/26 12:57:34 @@ -60,9 +60,10 @@ char *cleanenv[1]; int ch; - while ((ch = getopt(argc, argv, "-")) != -1) + while ((ch = getopt(argc, argv, "-i")) != -1) switch(ch) { case '-': + case 'i': environ = cleanenv; cleanenv[0] = NULL; break; @@ -85,6 +86,6 @@ usage() { (void)fprintf(stderr, - "usage: env [-] [name=value ...] [command]\n"); + "usage: env [-] [-i] [name=value ...] [command]\n"); exit(1); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message