summaryrefslogtreecommitdiff
path: root/source/ap/ash/patches/ash-misc.patch
blob: 9845a23258284b67604306553d35a764520ae763 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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;