@@ -232,11 +232,6 @@ recode_perform_task (RECODE_TASK task)
232232 struct recode_subtask subtask_block ;
233233 RECODE_SUBTASK subtask = & subtask_block ;
234234
235- #if HAVE_PIPE
236- int pipe_pair [2 ]; /* pair of file descriptors for a pipe */
237- pid_t wait_status ; /* status returned by wait() */
238- #endif
239-
240235 struct recode_read_write_text input ;
241236 struct recode_read_write_text output ;
242237 memset (& input , 0 , sizeof (struct recode_read_write_text ));
@@ -298,71 +293,6 @@ recode_perform_task (RECODE_TASK task)
298293 {
299294 subtask -> output = output ;
300295 subtask -> output .cursor = subtask -> output .buffer ;
301-
302- #if HAVE_PIPE
303- /* Create all subprocesses, from the first to the last, and
304- interconnect them. */
305-
306- if (pipe (pipe_pair ) < 0 )
307- {
308- recode_perror (NULL , "pipe ()" );
309- recode_if_nogo (RECODE_SYSTEM_ERROR , subtask );
310- SUBTASK_RETURN (subtask );
311- }
312- xset_binary_mode (pipe_pair [0 ], O_BINARY );
313- xset_binary_mode (pipe_pair [1 ], O_BINARY );
314- if (child_process = fork (), child_process < 0 )
315- {
316- recode_perror (NULL , "fork ()" );
317- recode_if_nogo (RECODE_SYSTEM_ERROR , subtask );
318- SUBTASK_RETURN (subtask );
319- }
320- if (child_process == 0 )
321- {
322- /* The child executes its recoding step, reading from the
323- current input file and writing to the pipe; then it exits. */
324-
325- if (close (pipe_pair [0 ]) < 0 )
326- {
327- recode_perror (NULL , "close ()" );
328- recode_if_nogo (RECODE_SYSTEM_ERROR , subtask );
329- }
330- if (subtask -> output .file = fdopen (pipe_pair [1 ], "w" ),
331- subtask -> output .file == NULL )
332- {
333- recode_perror (NULL , "fdopen ()" );
334- recode_if_nogo (RECODE_SYSTEM_ERROR , subtask );
335- }
336- }
337- else
338- {
339- /* The parent saves the read end of the pipe for the next step. */
340-
341- if (input .file = fdopen (pipe_pair [0 ], "r" ),
342- input .file == NULL )
343- {
344- recode_perror (NULL , "fdopen ()" );
345- recode_if_nogo (RECODE_SYSTEM_ERROR , subtask );
346- close (pipe_pair [0 ]);
347- close (pipe_pair [1 ]);
348- SUBTASK_RETURN (subtask );
349- }
350- if (close (pipe_pair [1 ]) < 0 )
351- {
352- recode_perror (NULL , "close ()" );
353- recode_if_nogo (RECODE_SYSTEM_ERROR , subtask );
354- close (pipe_pair [0 ]);
355- fclose (input .file );
356- SUBTASK_RETURN (subtask );
357- }
358-
359- /* Close the input file when we opened it. */
360-
361- if (subtask -> input .file && subtask -> input .name &&
362- subtask -> input .name [0 ])
363- fclose (subtask -> input .file );
364- }
365- #endif
366296 }
367297 else
368298 {
@@ -395,9 +325,6 @@ recode_perform_task (RECODE_TASK task)
395325 subtask -> step = request -> sequence_array + sequence_index ;
396326 (* subtask -> step -> transform_routine ) (subtask );
397327
398- #if HAVE_PIPE
399- break ; /* child/top-level process: escape from loop */
400- #else
401328 /* Post-step clean up for memory sequence. */
402329
403330 if (subtask -> input .file )
@@ -422,7 +349,6 @@ recode_perform_task (RECODE_TASK task)
422349 output = input ;
423350 input = subtask -> output ;
424351 }
425- #endif
426352 }
427353
428354 if (sequence_index + 1 == (unsigned )request -> sequence_length )
@@ -444,57 +370,8 @@ recode_perform_task (RECODE_TASK task)
444370 recode_if_nogo (RECODE_SYSTEM_ERROR , subtask );
445371 }
446372
447- #if HAVE_PIPE
448- /* Child process exits here. */
449-
450- if (child_process == 0 )
451- exit (task -> error_so_far < task -> fail_level ? EXIT_SUCCESS
452- : EXIT_FAILURE );
453- else
454- {
455- /* Wait on all children, mainly to avoid synchronisation problems on
456- output file contents, but also to reduce the number of zombie
457- processes in case the user recodes many files at once. */
458-
459- while (wait (& wait_status ) > 0 )
460- {
461- /* Diagnose and abort on any abnormally terminating child. */
462-
463- if (!(WIFEXITED (wait_status )
464- || (WIFSIGNALED (wait_status )
465- && WTERMSIG (wait_status ) == SIGPIPE )))
466- {
467- recode_error (NULL , _ ("Child process wait status is 0x%0.2x" ),
468- wait_status );
469- recode_if_nogo (RECODE_SYSTEM_ERROR , subtask );
470- SUBTASK_RETURN (subtask );
471- }
472-
473- /* Check for a nonzero exit from the terminating child. */
474-
475- if (WIFEXITED (wait_status )
476- ? WEXITSTATUS (wait_status ) != 0
477- : WTERMSIG (wait_status ) != 0 )
478- /* FIXME: It is not very clear what happened in sub-processes. */
479- if (task -> error_so_far < task -> fail_level )
480- {
481- task -> error_so_far = task -> fail_level ;
482- task -> error_at_step = request -> sequence_array + (unsigned )request -> sequence_length - 1 ;
483- }
484- }
485-
486- if (recode_interrupted )
487- /* FIXME: It is not very clear what happened in sub-processes. */
488- if (task -> error_so_far < task -> fail_level )
489- {
490- task -> error_so_far = task -> fail_level ;
491- task -> error_at_step = request -> sequence_array + (unsigned )request -> sequence_length - 1 ;
492- }
493- }
494- #else
495373 free (input .buffer );
496374 free (output .buffer );
497- #endif
498375
499376 task -> output = subtask -> output ;
500377 SUBTASK_RETURN (subtask );
0 commit comments