From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26770 invoked by alias); 11 Feb 2011 17:26:40 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28744 Received: (qmail 26215 invoked from network); 11 Feb 2011 17:26:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110211092602.ZM485@torch.brasslantern.com> Date: Fri, 11 Feb 2011 09:26:02 -0800 In-reply-to: Comments: In reply to Greg Klanderman "Re: loading user startup files for zsh scripts" (Feb 11, 11:28am) References: <19792.22365.139876.599478@gargle.gargle.HOWL> <110207213357.ZM22407@torch.brasslantern.com> <20110208172056.6a985c90@pwslap01u.europe.root.pri> <110208205856.ZM24066@torch.brasslantern.com> <110209085358.ZM29014@torch.brasslantern.com> <110210095253.ZM30860@torch.brasslantern.com> <110210192945.ZM31349@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: loading user startup files for zsh scripts MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Feb 11, 11:28am, Greg Klanderman wrote: } } >>>>> On February 10, 2011 Bart Schaefer wrote: } > I'm also finding it a little weird that $0 apparently might be a } > metafied string, since setupshin() believes that unmeta(runscript) } > is necessary before calling e.g. access(). } } Did you note this line near the top of zsh_main(): } } | for (t = argv; *t; *t = metafy(*t, -1, META_ALLOC), t++); } } i.e. all the argv arguments are metified early on. Indeed. Still, I must be missing where the un-metafication happens in parameter substitution. } > I'm inclined to suggest ZSH_SCRIPT to be initialized from runscript. } } How is the patch below? Looks basically as I was expecting, though it brings up another question: Why have zsh_name et al. hanging around permanently as globals when the strings get ztrdup()'d to set the parameters? There are some cases where the global gets used more than once, but zsh_name (and after this patch zsh_script, among others) are only used in createparamtable(), which is called exactly once. I suppose it's easier than trying to pass them back and forth through all the functions that perform shell initialization via zsh_main(). } I can add doc if you like it.. one open } question is whether you want $ZSH_SCRIPT to be unset or empty when not } running a script; currently it would be empty, which might be useful } for detecting whether zsh is providing that parameter. I think empty is OK, but let's hear from PWS. } > Returning to your original problem ... I don't suppose all these user's } > hosts are running linux? You can examine /proc/$$/cmdline to find out } > if a script name appears. } } Oooh that's tricky, yes all are a variety of linux distros, mostly } debian/ubuntu and FC/RHEL/Centos. Still would have to parse it and } deal with the nul byte separators, yuck. Nul byte separators are no problem, zsh's IFS has nul in it by default. print -l -- $(