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
|
Taken from: [FDclone-users:00145]
diff -u ../old/FD-2.03a/system.c ./system.c
--- ../old/FD-2.03a/system.c Tue Apr 15 00:00:00 2003
+++ ./system.c Tue Apr 22 00:00:00 2003
@@ -3926,7 +3926,11 @@
char *tmp;
int type;
- if (rp -> next && (errp = doredirect(rp -> next))) return(errp);
+ rp -> type &= ~MD_REST;
+ if (rp -> next) {
+ if ((errp = doredirect(rp -> next))) return(errp);
+ if (((rp -> next) -> type) & MD_REST) rp -> type |= MD_REST;
+ }
type = rp -> type;
if (!(rp -> filename)) tmp = NULL;
@@ -3940,6 +3944,25 @@
tmp = NULL;
type &= ~MD_FILEDESC;
}
+#ifdef FD
+ else {
+ char **argv;
+ int n, argc;
+
+ argv = (char **)malloc2(2 * sizeof(char *));
+ argv[0] = tmp;
+ argv[1] = NULL;
+ argc = 1;
+ n = replaceargs(&argc, &argv, NULL, 0);
+ tmp = argv[0];
+ free(argv);
+ if (n < 0) {
+ free(tmp);
+ return(rp);
+ }
+ if (n) rp -> type |= MD_REST;
+ }
+#endif /* FD */
if (!tmp);
else if (type & MD_HEREDOC) {
@@ -7230,7 +7253,6 @@
}
else for (i = 0; i < argc; i++) stripquote(argv[i], 1);
#ifdef FD
- replaceargs(NULL, NULL, NULL, 0);
if (replaceargs(&argc, &argv, NULL, -1) < 0) {
freevar(argv);
return(-1);
@@ -9558,9 +9580,6 @@
fflush(stderr);
}
-#ifdef FD
- replaceargs(NULL, NULL, NULL, 0);
-#endif
for (;;) {
#ifdef FD
char **dupargv;
@@ -9806,6 +9825,10 @@
return(-1);
#endif
+#ifdef FD
+ replaceargs(NULL, NULL, NULL, 0);
+#endif
+
if (!(trp -> comm) || pipein > 0L) {
#if !MSDOS && !defined (NOJOB)
if (pipein > 0L) stackjob(pipein, 0, trp);
@@ -9822,7 +9845,7 @@
#endif
ret_status = (ret >= 0) ? ret : RET_FAIL;
}
- else {
+ else for (;;) {
if (!(errp = doredirect((trp -> comm) -> redp)))
#if MSDOS || defined (USEFAKEPIPE)
ret = exec_process(trp);
@@ -9854,6 +9877,11 @@
}
closeredirect((trp -> comm) -> redp);
ret_status = (ret >= 0) ? ret : RET_FAIL;
+#ifdef FD
+ if (!errp && ((trp -> comm) -> redp) -> type & MD_REST)
+ continue;
+#endif
+ break;
}
trp = tmptr;
|