This repository has been archived by the owner on Feb 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
csh.diff
executable file
·392 lines (356 loc) · 10.6 KB
/
csh.diff
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
diff -cd csh/Makefile bak3/Makefile
*** csh/Makefile Tue Jan 5 16:02:46 1993
--- bak3/Makefile Thu Jan 7 13:29:28 1993
***************
*** 3,40 ****
# C Shell with process control; VM/UNIX VAX Makefile
# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
#
! # To profile, put -DPROF in DEFS and -pg in CFLAGS, and recompile.
! PROG= csh
! CFLAGS+=-fcombine-regs -fstrength-reduce -DFILEC -DNLS -DSHORT_STRINGS -I.
! SRCS= alloc.c char.c const.c csh.c dir.c dol.c err.c exec.c exp.c file.c \
! func.c glob.c hist.c init.c lex.c misc.c parse.c print.c printf.c \
! proc.c sem.c set.c str.c time.c
! MAN1= csh.0
! MLINKS= csh.1 limit.1 csh.1 alias.1 csh.1 bg.1 csh.1 dirs.1 csh.1 fg.1 \
! csh.1 foreach.1 csh.1 history.1 csh.1 jobs.1 csh.1 popd.1 \
! csh.1 pushd.1 csh.1 rehash.1 csh.1 repeat.1 csh.1 suspend.1 \
! csh.1 stop.1 csh.1 source.1
! CLEANFILES+=err.h const.h
! const.h: err.h
! err.h: err.c
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '#ifndef _h_sh_err' >> $@
@echo '#define _h_sh_err' >> $@
! egrep 'ERR_' ${.CURDIR}/$*.c | egrep '^#define' >> $@
@echo '#endif /* _h_sh_err */' >> $@
! const.h: const.c
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
! ${CC} -E ${CFLAGS} ${.CURDIR}/$*.c | egrep 'Char STR' | \
sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \
sort >> $@
! .depend alloc.o: const.h err.h
!
! .include <bsd.prog.mk>
--- 3,41 ----
# C Shell with process control; VM/UNIX VAX Makefile
# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
#
! # Linux changes by Ken Clark 1/6/93
! CFLAGS = -O3 -s -fstrength-reduce -DFILEC -DNLS \
! -DSHORT_STRINGS -D__USE_BSD -D__USE_BSD_SIGNAL -I.
! # I wanted -fwritable-strings but GCC complained. Why? Seems it is not
! # needed anyway.
! OBJS = alloc.o char.o const.o csh.o dir.o dol.o err.o exec.o exp.o file.o \
! func.o glob.o hist.o init.o lex.o misc.o parse.o print.o printf.o \
! proc.o sem.o set.o str.o time.o
! CC = gcc
! csh: $(OBJS)
! $(CC) -s -o csh $(OBJS)
!
! err.h:
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '#ifndef _h_sh_err' >> $@
@echo '#define _h_sh_err' >> $@
! egrep 'ERR_' $*.c | egrep '^#define' >> $@
@echo '#endif /* _h_sh_err */' >> $@
! # I have included a const.h and err.h. It seems my sed is broken
! # with the new shared libs. Don't know why.
!
! const.h:
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
! ${CC} -E ${CFLAGS} $*.c | egrep 'Char STR' | \
sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \
sort >> $@
! clean:
! rm -f csh *.o core
diff -cd csh/char.h bak3/char.h
*** csh/char.h Tue Jan 5 16:02:49 1993
--- bak3/char.h Wed Jan 6 14:01:13 1993
***************
*** 42,47 ****
--- 42,50 ----
#endif
+ #undef _LOW /* why the heck did they use underscore? Are those
+ variable name supposed to be reserved? */
+
#define _Q 0x0001 /* '" */
#define _Q1 0x0002 /* ` */
#define _SP 0x0004 /* space and tab */
diff -cd csh/csh.c bak3/csh.c
*** csh/csh.c Tue Jan 5 16:02:53 1993
--- bak3/csh.c Thu Jan 7 11:56:28 1993
***************
*** 110,117 ****
register char *tcp;
register int f;
register char **tempv;
! struct sigvec osv;
!
settimes(); /* Immed. estab. timing base */
--- 110,117 ----
register char *tcp;
register int f;
register char **tempv;
! /* struct sigvec osv;*/
! struct sigaction oact; /* I guess this is like sigvec? */
settimes(); /* Immed. estab. timing base */
***************
*** 128,133 ****
--- 128,134 ----
environ = short2blk(STR_environ); /* So that we can free it */
STR_WORD_CHARS = SAVE(WORD_CHARS);
+
HIST = '!';
HISTSUB = '^';
word_chars = STR_WORD_CHARS;
***************
*** 229,239 ****
* only if we are the login shell.
*/
/* parents interruptibility */
! (void) sigvec(SIGINT, NULL, &osv);
parintr = (void (*) ()) osv.sv_handler;
(void) sigvec(SIGTERM, NULL, &osv);
parterm = (void (*) ()) osv.sv_handler;
!
if (loginsh) {
(void) signal(SIGHUP, phup); /* exit processing on HUP */
(void) signal(SIGXCPU, phup); /* ...and on XCPU */
--- 230,246 ----
* only if we are the login shell.
*/
/* parents interruptibility */
! /* (void) sigvec(SIGINT, NULL, &osv);
parintr = (void (*) ()) osv.sv_handler;
(void) sigvec(SIGTERM, NULL, &osv);
parterm = (void (*) ()) osv.sv_handler;
! */
!
! sigaction(SIGINT, NULL, &oact); /* is this is correct? */
! parintr = oact.sa_handler;
! sigaction(SIGTERM, NULL, &oact);
! parterm = oact.sa_handler;
!
if (loginsh) {
(void) signal(SIGHUP, phup); /* exit processing on HUP */
(void) signal(SIGXCPU, phup); /* ...and on XCPU */
diff -cd csh/csh.h bak3/csh.h
*** csh/csh.h Tue Jan 5 16:02:54 1993
--- bak3/csh.h Wed Jan 6 11:37:37 1993
***************
*** 210,215 ****
--- 210,217 ----
Char *gointr; /* Label for an onintr transfer */
#include <signal.h>
+ typedef void* sig_t;
+
sig_t parintr; /* Parents interrupt catch */
sig_t parterm; /* Parents terminate catch */
diff -cd csh/dol.c bak3/dol.c
*** csh/dol.c Tue Jan 5 16:02:56 1993
--- bak3/dol.c Wed Jan 6 13:28:41 1993
***************
*** 36,41 ****
--- 36,42 ----
#endif /* not lint */
#include <sys/types.h>
+ #include <sys/file.h> /* added for L_SET. Where should it be? */
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
diff -cd csh/func.c bak3/func.c
*** csh/func.c Tue Jan 5 16:03:04 1993
--- bak3/func.c Wed Jan 6 19:37:52 1993
***************
*** 35,40 ****
--- 35,42 ----
static char sccsid[] = "@(#)func.c 5.20 (Berkeley) 6/27/91";
#endif /* not lint */
+ #define notdef /* what is up with this anyway? See resource.h */
+
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
***************
*** 52,57 ****
--- 54,60 ----
#include "extern.h"
#include "pathnames.h"
+
extern char **environ;
static int zlast = -1;
***************
*** 1108,1114 ****
Char **v;
{
register float f;
! double atof();
Char *cp = *v++;
f = atof(short2str(cp));
--- 1111,1117 ----
Char **v;
{
register float f;
! /* double atof();*/
Char *cp = *v++;
f = atof(short2str(cp));
diff -cd csh/glob.c bak3/glob.c
*** csh/glob.c Tue Jan 5 16:03:06 1993
--- bak3/glob.c Wed Jan 6 13:55:33 1993
***************
*** 354,361 ****
libglob(vl)
Char **vl;
{
! int gflgs = GLOB_QUOTE | GLOB_NOCHECK;
! glob_t globv;
char *ptr;
globv.gl_offs = 0;
--- 354,361 ----
libglob(vl)
Char **vl;
{
! int gflgs = /*GLOB_QUOTE |*/ GLOB_NOCHECK;
! glob_t globv; /* ^-- why is there not GLOB_QUOTE in the gnu glob? */
char *ptr;
globv.gl_offs = 0;
***************
*** 375,381 ****
default:
break;
}
! if (!nonomatch && (globv.gl_matchc == 0) &&
(globv.gl_flags & GLOB_MAGCHAR)) {
globfree(&globv);
return (NULL);
--- 375,381 ----
default:
break;
}
! if (!nonomatch && (globv.gl_pathc == 0) && /* changed .gl_matchc */
(globv.gl_flags & GLOB_MAGCHAR)) {
globfree(&globv);
return (NULL);
diff -cd csh/lex.c bak3/lex.c
*** csh/lex.c Tue Jan 5 16:03:09 1993
--- bak3/lex.c Wed Jan 6 13:57:13 1993
***************
*** 35,40 ****
--- 35,41 ----
static char sccsid[] = "@(#)lex.c 5.16 (Berkeley) 6/8/91";
#endif /* not lint */
+ #include <sys/file.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <termios.h>
diff -cd csh/proc.c bak3/proc.c
*** csh/proc.c Tue Jan 5 16:03:16 1993
--- bak3/proc.c Wed Jan 6 14:27:29 1993
***************
*** 84,96 ****
register struct process *fp;
register int pid;
extern int insource;
! union wait w;
int jobflags;
struct rusage ru;
loop:
errno = 0; /* reset, just in case */
! pid = wait3(&w.w_status,
(setintr && (intty || insource) ? WNOHANG | WUNTRACED : WNOHANG), &ru);
if (pid <= 0) {
--- 84,97 ----
register struct process *fp;
register int pid;
extern int insource;
! /* union wait w; I gather SysV doesn't do it this way */
! int wait_stat; /* This it to replace functionality of w */
int jobflags;
struct rusage ru;
loop:
errno = 0; /* reset, just in case */
! pid = wait3(&wait_stat,
(setintr && (intty || insource) ? WNOHANG | WUNTRACED : WNOHANG), &ru);
if (pid <= 0) {
***************
*** 109,117 ****
if (pid == atoi(short2str(value(STRchild))))
unsetv(STRchild);
pp->p_flags &= ~(PRUNNING | PSTOPPED | PREPORTED);
! if (WIFSTOPPED(w)) {
pp->p_flags |= PSTOPPED;
! pp->p_reason = w.w_stopsig;
}
else {
if (pp->p_flags & (PTIME | PPTIME) || adrof(STRtime))
--- 110,118 ----
if (pid == atoi(short2str(value(STRchild))))
unsetv(STRchild);
pp->p_flags &= ~(PRUNNING | PSTOPPED | PREPORTED);
! if (WIFSTOPPED(wait_stat)) {
pp->p_flags |= PSTOPPED;
! pp->p_reason = WSTOPSIG(wait_stat); /*w.w_stopsig;*/
}
else {
if (pp->p_flags & (PTIME | PPTIME) || adrof(STRtime))
***************
*** 118,134 ****
(void) gettimeofday(&pp->p_etime, NULL);
pp->p_rusage = ru;
! if (WIFSIGNALED(w)) {
! if (w.w_termsig == SIGINT)
pp->p_flags |= PINTERRUPTED;
else
pp->p_flags |= PSIGNALED;
! if (w.w_coredump)
pp->p_flags |= PDUMPED;
! pp->p_reason = w.w_termsig;
}
else {
! pp->p_reason = w.w_retcode;
if (pp->p_reason != 0)
pp->p_flags |= PAEXITED;
else
--- 119,135 ----
(void) gettimeofday(&pp->p_etime, NULL);
pp->p_rusage = ru;
! if (WIFSIGNALED(wait_stat)) {
! if (WTERMSIG(wait_stat) == SIGINT)
pp->p_flags |= PINTERRUPTED;
else
pp->p_flags |= PSIGNALED;
! if (WCOREDUMP(wait_stat))
pp->p_flags |= PDUMPED;
! pp->p_reason = WTERMSIG(wait_stat);
}
else {
! pp->p_reason = WEXITSTATUS(wait_stat);
if (pp->p_reason != 0)
pp->p_flags |= PAEXITED;
else
diff -cd csh/sem.c bak3/sem.c
*** csh/sem.c Tue Jan 5 16:03:18 1993
--- bak3/sem.c Wed Jan 6 14:28:57 1993
***************
*** 483,489 ****
}
else if ((flags & F_NOINTERRUPT) && tpgrp == -1) {
(void) close(0);
! (void) open(_PATH_DEVNULL, O_RDONLY);
}
else {
(void) close(0);
--- 483,489 ----
}
else if ((flags & F_NOINTERRUPT) && tpgrp == -1) {
(void) close(0);
! (void) open("/dev/null", O_RDONLY); /*hard coded. no paths.h yet*/
}
else {
(void) close(0);