zsh-workers
 help / color / mirror / code / Atom feed
From: P.Stephenson@swansea.ac.uk
To: zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Re: Environment Passed to Functions
Date: Thu, 15 Jun 95 09:46:41 +0100	[thread overview]
Message-ID: <28749.9506150846@pyro.swan.ac.uk> (raw)
In-Reply-To: "shelton@grind.ICD.Teradyne.COM"'s message of "Wed, 14 Jun 95 16:17:51 EDT." <9506142017.AA13377@grind.icd.teradyne.com>

shelton@grind.ICD.Teradyne.COM wrote:
> If an environment variable is set on the command line for a function, then 
> that enviroment variable is only in effect for the first command in the 
> function.

Actually, the problem is slightly different: for shell functions and
builtins the parameter isn't put into the environment at all.  This
must be a bug.

It looks to me like the simplest thing is to export the variable for a
function, not for a builtin (the only two possibilities at that point
in the code).

*** Src/exec.c~	Mon Jun  5 10:34:30 1995
--- Src/exec.c	Thu Jun 15 09:43:27 1995
***************
*** 1416,1422 ****
  	    }
  	    
  	    if (cmd->vars) {
! 		addvars(cmd->vars, 0);
  		if (errflag) {
  		    lastval = 1;
  		    return;
--- 1416,1425 ----
  	    }
  	    
  	    if (cmd->vars) {
! 		/* Export this if the command is a shell function,
! 		 * but not if it's a builtin.
! 		 */
! 		addvars(cmd->vars, cn1->flags & SHFUNC);
  		if (errflag) {
  		    lastval = 1;
  		    return;

-- 
Peter Stephenson <P.Stephenson@swansea.ac.uk>  Tel: +44 1792 205678 extn. 4461
WWW:  http://python.swan.ac.uk/~pypeters/      Fax: +44 1792 295324
Department of Physics, University of Wales, Swansea,
Singleton Park, Swansea, SA2 8PP, U.K.


      reply	other threads:[~1995-06-15  8:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-06-14 20:17 Vinnie Shelton
1995-06-15  8:46 ` P.Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28749.9506150846@pyro.swan.ac.uk \
    --to=p.stephenson@swansea.ac.uk \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).