bin/65649: Add `-u name' option to env(1)
Jos Backus
jos at catnook.com
Fri Apr 16 22:00:42 PDT 2004
>Number: 65649
>Category: bin
>Synopsis: Add `-u name' option to env(1)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Fri Apr 16 22:00:41 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator: Jos Backus
>Release: FreeBSD 5.2-CURRENT i386
>Organization:
CatNook
>Environment:
System: FreeBSD lizzy.catnook.com 5.2-CURRENT FreeBSD 5.2-CURRENT #49: Fri Apr 16 20:26:49 PDT 2004 root at lizzy.catnook.com:/usr/obj/usr/src/sys/LIZZY i386
>Description:
This patch adds the `-u name' option to env(1). For a rationale of why
this is useful (besides compatibility with GNU coreutils), see this
post:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=b083i6%2486c%241%40news5.svr.pol.co.uk
>How-To-Repeat:
>Fix:
--- env.c.orig Fri Apr 16 21:16:44 2004
+++ env.c Fri Apr 16 21:21:25 2004
@@ -64,13 +64,16 @@
char *cleanenv[1];
int ch;
- while ((ch = getopt(argc, argv, "-i")) != -1)
+ while ((ch = getopt(argc, argv, "-iu:")) != -1)
switch(ch) {
case '-':
case 'i':
environ = cleanenv;
cleanenv[0] = NULL;
break;
+ case 'u':
+ unsetenv(optarg);
+ break;
case '?':
default:
usage();
@@ -90,6 +93,6 @@
usage(void)
{
(void)fprintf(stderr,
- "usage: env [-i] [name=value ...] [utility [argument ...]]\n");
+ "usage: env [-i] [[-u name] ...] [name=value ...] [utility [argument ...]]\n");
exit(1);
}
--- env.1.orig Fri Apr 16 21:16:39 2004
+++ env.1 Fri Apr 16 21:41:17 2004
@@ -44,6 +44,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl i
+.Op Fl u Ar name
.Op Ar name Ns = Ns Ar value ...
.Op Ar utility Op Ar argument ...
.Sh DESCRIPTION
@@ -71,6 +72,14 @@
by
.Nm
is ignored completely.
+.It Fl u Ar name
+Execute the
+.Ar utility
+with
+.Ar name
+removed from the environment,
+if it was present in the environment inherited by
+.Nm .
.El
.Pp
If no utility is specified,
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list