Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Can't trace script not in PATH



On Mon, 15 Mar 2010 12:59:23 +0000
Peter Stephenson <pws@xxxxxxx> wrote:
>      if (*argv) {
>  	if (unset(SHINSTDIN)) {
>  	    if (!cmd)
> -		SHIN = movefd(open(unmeta(*argv), O_RDONLY | O_NOCTTY));
> -	    if (SHIN == -1) {
> -		zerr("can't open input file: %s", *argv);
> -		exit(127);
> -	    }
> +		*runscript = *argv;
>  	    opts[INTERACTIVE] &= 1;
> -	    argzero = *argv;
> -	    scriptfilename = argzero;
>  	    argv++;
>  	}

one more issue here... we should set argzero ($0) at this point if cmd is
set since we won't execute the code for *runscript non-NULL.  This affects

zsh -c 'echo $0' foo

where time-honoured (well, time-somethinged anyway) behaviour is that $0
returns "foo".  I'll add a test for this, too.

I don't think it's right to set scriptfilename in this case (i.e. -c,
obviously we set it if there's a real script), however.  It's used for
debugging and it's just confusing to have the debug output look like it's
running a script it isn't.

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



Messages sorted by: Reverse Date, Date, Thread, Author