From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15798 invoked from network); 22 Dec 2002 17:58:09 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 22 Dec 2002 17:58:09 -0000 Received: (qmail 5691 invoked by alias); 22 Dec 2002 17:57:58 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18026 Received: (qmail 5667 invoked from network); 22 Dec 2002 17:57:57 -0000 From: "Bart Schaefer" Message-Id: <1021222175728.ZM12826@candle.brasslantern.com> Date: Sun, 22 Dec 2002 17:57:28 +0000 In-Reply-To: <3e054ca0.99775.26970@imap.qut.edu.au> Comments: In reply to "Mark Hessling" "How to change environment from a module" (Dec 22, 3:24pm) References: <3e054ca0.99775.26970@imap.qut.edu.au> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: Re: How to change environment from a module MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Dec 22, 3:24pm, Mark Hessling wrote: } } So, from within the module I have, I need to be able to do the following: } 1) Get the current value of an environment variable } 2) Set the value of an enviornment variable } 3) Get the value of the current working directory } 4) Set the value of the current working directory } } I thought I might be able to use bin_cd() and bin_typeset() In general you shouldn't call bin_ functions directly. They should almost always be called only via the command execution code. } 2) How does one get the values of an environment variable and current } working directory from within a module ? Most likely you want these functions: createparam(variablename, PM_EXPORTED); getsparam(variablename); setsparam(variablename, valuestring); struct dirsave ds; dir = zgetdir(&ds); restoredir(&ds); It's very likely that your module should call zgetdir(&ds) before running the Rexx program and call restoredir(&ds) after it. That is, the Rexx program should not permanently change the shell's current directory. Within the Rexx program, the usual chdir() system call can be used (but the values of the PWD and OLDPWD variables cannot be relied upon). In this sense the Rexx program would behave as if it is an external command. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net