]> git.pld-linux.org Git - packages/ash.git/blame - ash-jobs.patch
- dropped pre-cvs changelog
[packages/ash.git] / ash-jobs.patch
CommitLineData
cf7098dd
MM
1diff -ur netbsd-sh/jobs.c netbsd-sh-/jobs.c
2--- netbsd-sh/jobs.c Tue May 23 12:03:19 2000
3+++ netbsd-sh-/jobs.c Mon Apr 23 23:31:47 2001
4@@ -92,6 +92,7 @@
5 int initialpgrp; /* pgrp of shell on invocation */
6 short curjob; /* current job */
7 #endif
8+STATIC int intreceived;
9
10 STATIC void restartjob __P((struct job *));
11 STATIC void freejob __P((struct job *));
12@@ -101,8 +102,10 @@
13 STATIC int waitproc __P((int, int *));
14 STATIC void cmdtxt __P((union node *));
15 STATIC void cmdputs __P((const char *));
16+STATIC void waitonint(int);
17
18
19+#if JOBS
20 /*
21 * Turn job control on and off.
22 *
23@@ -171,6 +174,7 @@
24 }
25 jobctl = on;
26 }
27+#endif
28
29
30 #ifdef mkinit
31@@ -594,9 +598,6 @@
32 TRACE(("Child shell %d\n", getpid()));
33 wasroot = rootshell;
34 rootshell = 0;
35- for (i = njobs, p = jobtab ; --i >= 0 ; p++)
36- if (p->used)
37- freejob(p);
38 closescript();
39 INTON;
40 clear_traps();
41@@ -642,6 +643,9 @@
42 }
43 }
44 #endif
45+ for (i = njobs, p = jobtab ; --i >= 0 ; p++)
46+ if (p->used)
47+ freejob(p);
48 if (wasroot && iflag) {
49 setsignal(SIGINT);
50 setsignal(SIGQUIT);
51@@ -701,13 +705,33 @@
52 #endif
53 int status;
54 int st;
55+ struct sigaction act, oact;
56
57 INTOFF;
58+ intreceived = 0;
59+#if JOBS
60+ if (!jobctl) {
61+#else
62+ if (!iflag) {
63+#endif
64+ sigaction(SIGINT, 0, &act);
65+ act.sa_handler = waitonint;
66+ sigaction(SIGINT, &act, &oact);
67+ }
68 TRACE(("waitforjob(%%%d) called\n", jp - jobtab + 1));
69 while (jp->state == 0) {
70 dowait(1, jp);
71 }
72 #if JOBS
73+ if (!jobctl) {
74+#else
75+ if (!iflag) {
76+#endif
77+ extern char *trap[];
78+ sigaction(SIGINT, &oact, 0);
79+ if (intreceived && trap[SIGINT]) kill(getpid(), SIGINT);
80+ }
81+#if JOBS
82 if (jp->jobctl) {
83 #ifdef OLD_TTY_DRIVER
84 if (ioctl(2, TIOCSPGRP, (char *)&mypgrp) < 0)
85@@ -896,10 +920,10 @@
86 #ifdef BSD
87 int flags;
88
89-#if JOBS
90- flags = WUNTRACED;
91-#else
92 flags = 0;
93+#if JOBS
94+ if (jobctl)
95+ flags |= WUNTRACED;
96 #endif
97 if (block == 0)
98 flags |= WNOHANG;
99@@ -1139,4 +1163,9 @@
100 }
101 }
102 cmdnextc = q;
103+}
104+
105+STATIC void waitonint(int sig) {
106+ intreceived = 1;
107+ return;
108 }
This page took 0.078039 seconds and 4 git commands to generate.