diff options
author | jilles <jilles@FreeBSD.org> | 2011-02-04 22:47:55 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2011-02-04 22:47:55 +0000 |
commit | 95ad413d4a493285a5560182fb10217819d7c357 (patch) | |
tree | 88fab75180accb5d4fe09924cbd01e047b9e4903 /bin/sh/var.c | |
parent | 88f7b7c78b4285a838792e26cf3806ab40f879d2 (diff) | |
download | FreeBSD-src-95ad413d4a493285a5560182fb10217819d7c357.zip FreeBSD-src-95ad413d4a493285a5560182fb10217819d7c357.tar.gz |
sh: Remove special code for shell scripts without magic number.
These are called "shell procedures" in the source.
If execve() failed with [ENOEXEC], the shell would reinitialize itself
and execute the program as a script. This requires a fair amount of code
which is not frequently used (most scripts have a #! magic number).
Therefore just execute a new instance of sh (_PATH_BSHELL) to run the
script.
Diffstat (limited to 'bin/sh/var.c')
-rw-r--r-- | bin/sh/var.c | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/bin/sh/var.c b/bin/sh/var.c index 44d2028..e14027f 100644 --- a/bin/sh/var.c +++ b/bin/sh/var.c @@ -161,7 +161,7 @@ INIT { /* * This routine initializes the builtin variables. It is called when the - * shell is initialized and again when a shell procedure is spawned. + * shell is initialized. */ void @@ -542,47 +542,6 @@ environment(void) } -/* - * Called when a shell procedure is invoked to clear out nonexported - * variables. It is also necessary to reallocate variables of with - * VSTACK set since these are currently allocated on the stack. - */ - -MKINIT void shprocvar(void); - -#ifdef mkinit -SHELLPROC { - shprocvar(); -} -#endif - -void -shprocvar(void) -{ - struct var **vpp; - struct var *vp, **prev; - - for (vpp = vartab ; vpp < vartab + VTABSIZE ; vpp++) { - for (prev = vpp ; (vp = *prev) != NULL ; ) { - if ((vp->flags & VEXPORT) == 0) { - *prev = vp->next; - if ((vp->flags & VTEXTFIXED) == 0) - ckfree(vp->text); - if ((vp->flags & VSTRFIXED) == 0) - ckfree(vp); - } else { - if (vp->flags & VSTACK) { - vp->text = savestr(vp->text); - vp->flags &=~ VSTACK; - } - prev = &vp->next; - } - } - } - initvar(); -} - - static int var_compare(const void *a, const void *b) { |