Mercurial > hg > octave-jordi
comparison src/oct-procbuf.cc @ 10315:57a59eae83cc
untabify src C++ source files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 11 Feb 2010 12:41:46 -0500 |
parents | 0522a65bcd56 |
children | 479cc8a0a846 |
comparison
equal
deleted
inserted
replaced
10314:07ebe522dac2 | 10315:57a59eae83cc |
---|---|
106 if (proc_pid == 0) | 106 if (proc_pid == 0) |
107 { | 107 { |
108 ::close (parent_end); | 108 ::close (parent_end); |
109 | 109 |
110 if (child_end != child_std_end) | 110 if (child_end != child_std_end) |
111 { | 111 { |
112 ::dup2 (child_end, child_std_end); | 112 ::dup2 (child_end, child_std_end); |
113 ::close (child_end); | 113 ::close (child_end); |
114 } | 114 } |
115 | 115 |
116 while (octave_procbuf_list) | 116 while (octave_procbuf_list) |
117 { | 117 { |
118 FILE *fp = octave_procbuf_list->f; | 118 FILE *fp = octave_procbuf_list->f; |
119 | 119 |
120 if (fp) | 120 if (fp) |
121 { | 121 { |
122 ::fclose (fp); | 122 ::fclose (fp); |
123 fp = 0; | 123 fp = 0; |
124 } | 124 } |
125 | 125 |
126 octave_procbuf_list = octave_procbuf_list->next; | 126 octave_procbuf_list = octave_procbuf_list->next; |
127 } | 127 } |
128 | 128 |
129 execl ("/bin/sh", "sh", "-c", command, static_cast<void *> (0)); | 129 execl ("/bin/sh", "sh", "-c", command, static_cast<void *> (0)); |
130 | 130 |
131 exit (127); | 131 exit (127); |
132 } | 132 } |
180 pid_t wait_pid; | 180 pid_t wait_pid; |
181 | 181 |
182 int status = -1; | 182 int status = -1; |
183 | 183 |
184 for (octave_procbuf **ptr = &octave_procbuf_list; | 184 for (octave_procbuf **ptr = &octave_procbuf_list; |
185 *ptr != 0; | 185 *ptr != 0; |
186 ptr = &(*ptr)->next) | 186 ptr = &(*ptr)->next) |
187 { | 187 { |
188 if (*ptr == this) | 188 if (*ptr == this) |
189 { | 189 { |
190 *ptr = (*ptr)->next; | 190 *ptr = (*ptr)->next; |
191 status = 0; | 191 status = 0; |
192 break; | 192 break; |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 if (status == 0 && ::fclose (f) == 0) | 196 if (status == 0 && ::fclose (f) == 0) |
197 { | 197 { |
198 using namespace std; | 198 using namespace std; |
199 | 199 |
200 do | 200 do |
201 { | 201 { |
202 wait_pid = octave_syscalls::waitpid (proc_pid, &wstatus, 0); | 202 wait_pid = octave_syscalls::waitpid (proc_pid, &wstatus, 0); |
203 } | 203 } |
204 while (wait_pid == -1 && errno == EINTR); | 204 while (wait_pid == -1 && errno == EINTR); |
205 } | 205 } |
206 | 206 |
207 f = 0; | 207 f = 0; |
208 } | 208 } |
209 | 209 |
210 open_p = false; | 210 open_p = false; |