Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Jun 2001 11:49:36 +0300
From:      Peter Pentchev <roam@orbitel.bg>
To:        Garance A Drosihn <drosih@rpi.edu>
Cc:        Dima Dorfman <dima@unixfreak.org>, Peter Seebach <seebs@plethora.net>, hackers@FreeBSD.ORG
Subject:   Re: Fixing documented bug in env(1)
Message-ID:  <20010602114936.C24747@ringworld.oblivion.bg>
In-Reply-To: <p05100e09b73e2fbdba9e@[128.113.24.47]>; from drosih@rpi.edu on Sat, Jun 02, 2001 at 02:03:38AM -0400
References:  <20010602041242.849893E33@bazooka.unixfreak.org> <p05100e09b73e2fbdba9e@[128.113.24.47]>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jun 02, 2001 at 02:03:38AM -0400, Garance A Drosihn wrote:
> At 9:12 PM -0700 6/1/01, Dima Dorfman wrote:
> >Honestly, I don't care about this all that much.  I'll
> >let you and David debate this to your liking.  If no
> >consensus develops in the next few days, I'll just
> >commit what I have now.
> 
> For whatever it's worth, it seems more reasonable to me
> to use '--' instead of '=='.  Since '--' has NO equals
> sign in it, it clearly can't be the setting of an
> environment variable.
> 
> It also strikes me that this might be another topic to
> send thru freebsd-standards@bostonradio.org, as Posix
> might have something to say about what's appropriate.

..or at the very least to -arch.

FWIW, I, too, think that '--' would be a POLA-friendly choice.
However, if '==' were chosen, the patch to env.c would have to be
slightly modified, as attached.

G'luck,
Peter

-- 
This would easier understand fewer had omitted.

Index: env/env.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/env/env.c,v
retrieving revision 1.5
diff -u -r1.5 env.c
--- env/env.c	1999/08/27 08:59:31	1.5
+++ env/env.c	2001/06/02 08:47:31
@@ -71,8 +71,13 @@
 		default:
 			usage();
 		}
-	for (argv += optind; *argv && (p = strchr(*argv, '=')); ++argv)
+	for (argv += optind; *argv && (p = strchr(*argv, '=')); ++argv) {
+		if (!strcmp(*argv, "==")) {
+			argv++;
+			break;
+		}
 		(void)setenv(*argv, ++p, 1);
+	}
 	if (*argv) {
 		execvp(*argv, argv);
 		err(1, "%s", *argv);
@@ -86,6 +91,6 @@
 usage()
 {
 	(void)fprintf(stderr,
-	    "usage: env [-] [-i] [name=value ...] [command]\n");
+	    "usage: env [-] [-i] [name=value ...] [==] [command]\n");
 	exit(1);
 }

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010602114936.C24747>