Mercurial > octave-nkf
comparison src/oct-procbuf.cc @ 10411:479cc8a0a846
use gnulib namespace
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 15 Mar 2010 15:57:23 -0400 |
parents | 57a59eae83cc |
children | fd0a3ac60b0e |
comparison
equal
deleted
inserted
replaced
10410:b3ec24dc305a | 10411:479cc8a0a846 |
---|---|
103 | 103 |
104 proc_pid = ::fork (); | 104 proc_pid = ::fork (); |
105 | 105 |
106 if (proc_pid == 0) | 106 if (proc_pid == 0) |
107 { | 107 { |
108 ::close (parent_end); | 108 gnulib::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 gnulib::dup2 (child_end, child_std_end); |
113 ::close (child_end); | 113 gnulib::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 gnulib::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 } |
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 } |
133 | 133 |
134 ::close (child_end); | 134 gnulib::close (child_end); |
135 | 135 |
136 if (proc_pid < 0) | 136 if (proc_pid < 0) |
137 { | 137 { |
138 ::close (parent_end); | 138 gnulib::close (parent_end); |
139 return 0; | 139 return 0; |
140 } | 140 } |
141 | 141 |
142 f = ::fdopen (parent_end, (mode & std::ios::in) ? "r" : "w"); | 142 f = ::fdopen (parent_end, (mode & std::ios::in) ? "r" : "w"); |
143 | 143 |
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 && gnulib::fclose (f) == 0) |
197 { | 197 { |
198 using namespace std; | 198 using namespace std; |
199 | 199 |
200 do | 200 do |
201 { | 201 { |