From owner-freebsd-bugs@FreeBSD.ORG Fri Apr 16 22:00:42 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DEB4416A4CF for ; Fri, 16 Apr 2004 22:00:41 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id BA19943D49 for ; Fri, 16 Apr 2004 22:00:41 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i3H50fbv092868 for ; Fri, 16 Apr 2004 22:00:41 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i3H50f6W092863; Fri, 16 Apr 2004 22:00:41 -0700 (PDT) (envelope-from gnats) Resent-Date: Fri, 16 Apr 2004 22:00:41 -0700 (PDT) Resent-Message-Id: <200404170500.i3H50f6W092863@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jos Backus Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 76EB516A4CE for ; Fri, 16 Apr 2004 21:54:31 -0700 (PDT) Received: from mail1.dslextreme.com (mail1.dslextreme.com [66.51.199.25]) by mx1.FreeBSD.org (Postfix) with SMTP id 4A40543D58 for ; Fri, 16 Apr 2004 21:54:31 -0700 (PDT) (envelope-from jos@catnook.com) Received: (qmail 11469 invoked from network); 17 Apr 2004 04:54:30 -0000 Received: from unknown (HELO w250.z064001178.sjc-ca.dsl.cnc.net) (66.218.45.239) by 192.168.8.25 with SMTP; Sat, 17 Apr 2004 04:54:30 +0000 Received: (qmail 1359 invoked by uid 1000); 17 Apr 2004 04:54:52 -0000 Message-Id: <20040417045452.1358.qmail@lizzy.catnook.com> Date: 17 Apr 2004 04:54:52 -0000 From: Jos Backus To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/65649: Add `-u name' option to env(1) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Jos Backus List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Apr 2004 05:00:42 -0000 >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@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: