diff -urN netbsd-sh/error.c ash-0.3.7.orig/error.c --- netbsd-sh/error.c Fri Jan 12 17:50:35 2001 +++ ash-0.3.7.orig/error.c Mon Apr 23 22:16:46 2001 @@ -233,6 +233,7 @@ { ENOTDIR, E_CREAT,"directory nonexistent" }, { ENOTDIR, E_EXEC, "not found" }, { EISDIR, ALL, "is a directory" }, + { EEXIST, E_CREAT,"file exists" }, #ifdef notdef { EMFILE, ALL, "too many open files" }, #endif diff -urN netbsd-sh/error.h ash-0.3.7.orig/error.h --- netbsd-sh/error.h Fri Jul 9 13:02:05 1999 +++ ash-0.3.7.orig/error.h Mon Apr 23 22:16:46 2001 @@ -102,7 +102,7 @@ * so we use _setjmp instead. */ -#if defined(BSD) && !defined(__SVR4) +#if defined(BSD) && !defined(__SVR4) && !defined(__GLIBC__) #define setjmp(jmploc) _setjmp(jmploc) #define longjmp(jmploc, val) _longjmp(jmploc, val) #endif diff -urN netbsd-sh/bltin/bltin.h ash-0.3.7.orig/bltin/bltin.h --- netbsd-sh/bltin/bltin.h Sat Jul 5 13:12:37 1997 +++ ash-0.3.7.orig/bltin/bltin.h Mon Apr 23 22:16:46 2001 @@ -46,8 +46,10 @@ #include "../shell.h" #include "../mystring.h" +#include "../memalloc.h" #ifdef SHELL #include "../output.h" +#ifndef _GNU_SOURCE #define stdout out1 #define stderr out2 #define printf out1fmt @@ -56,12 +58,13 @@ #define fprintf outfmt #define fputs outstr #define fflush flushout -#define INITARGS(argv) #define warnx(a, b, c) { \ char buf[64]; \ (void)snprintf(buf, sizeof(buf), a, b, c); \ error("%s", buf); \ } +#endif +#define INITARGS(argv) #else #undef NULL diff -urN netbsd-sh/main.c ash-0.3.7.orig/main.c --- netbsd-sh/main.c Fri Jan 12 17:50:36 2001 +++ ash-0.3.7.orig/main.c Mon Apr 23 22:16:46 2001 @@ -115,6 +119,9 @@ #if PROFILE monitor(4, etext, profile_buf, sizeof profile_buf, 50); #endif +#if defined(linux) || defined(__GNU__) + signal(SIGCHLD, SIG_DFL); +#endif state = 0; if (setjmp(jmploc.loc)) { /* diff -urN netbsd-sh/var.c ash-0.3.7.orig/var.c --- netbsd-sh/var.c Fri Jan 12 17:50:40 2001 +++ ash-0.3.7.orig/var.c Mon Apr 23 22:19:54 2001 @@ -114,7 +114,7 @@ NULL }, { &vmpath, VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH=", NULL }, - { &vpath, VSTRFIXED|VTEXTFIXED, "PATH=" _PATH_DEFPATH, + { &vpath, VSTRFIXED|VTEXTFIXED, "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", changepath }, /* * vps1 depends on uid @@ -138,13 +138,16 @@ /* * Initialize the varable symbol tables and import the environment + * Setting PWD added by herbert */ #ifdef mkinit +INCLUDE "cd.h" INCLUDE "var.h" INIT { char **envp; extern char **environ; + extern char *curdir; initvar(); for (envp = environ ; *envp ; envp++) { @@ -152,6 +155,9 @@ setvareq(*envp, VEXPORT|VTEXTFIXED); } } + + getpwd(); + setvar("PWD", curdir, VEXPORT|VTEXTFIXED); } #endif @@ -283,6 +289,7 @@ struct var *vp, **vpp; vpp = hashvar(s); + flags |= (VEXPORT & (((unsigned) (1 - aflag)) - 1)); for (vp = *vpp ; vp ; vp = vp->next) { if (varequal(s, vp->text)) { if (vp->flags & VREADONLY) { @@ -305,7 +312,8 @@ * We could roll this to a function, to handle it as * a regular variable function callback, but why bother? */ - if (vp == &vmpath || (vp == &vmail && ! mpathset())) + if (iflag && + (vp == &vmpath || (vp == &vmail && ! mpathset()))) chkmail(1); INTON; return;