/[man-db]/man-db/lib/pipeline.c
ViewVC logotype

Diff of /man-db/lib/pipeline.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by cjwatson, Mon Aug 4 11:04:42 2003 UTC revision 1.13 by cjwatson, Mon Aug 4 18:31:26 2003 UTC
# Line 418  FILE *pipeline_get_outfile (pipeline *p) Line 418  FILE *pipeline_get_outfile (pipeline *p)
418                  return p->outfile = fdopen (p->outfd, "r");                  return p->outfile = fdopen (p->outfd, "r");
419  }  }
420    
421    void pipeline_dump (pipeline *p, FILE *stream)
422    {
423            int i, j;
424    
425            for (i = 0; i < p->ncommands; ++i) {
426                    fputs (p->commands[i]->name, stream);
427                    for (j = 1; j < p->commands[i]->argc; ++j) {
428                            /* TODO: escape_shell()? */
429                            putc (' ', stream);
430                            fputs (p->commands[i]->argv[j], stream);
431                    }
432                    if (i < p->ncommands - 1)
433                            fputs (" | ", stream);
434            }
435            putc ('\n', stream);
436    }
437    
438    char *pipeline_tostring (pipeline *p)
439    {
440            char *out = NULL;
441            int i, j;
442    
443            for (i = 0; i < p->ncommands; ++i) {
444                    out = strappend (out, p->commands[i]->name, NULL);
445                    for (j = 1; j < p->commands[i]->argc; ++j)
446                            /* TODO: escape_shell()? */
447                            out = strappend (out, " ", p->commands[i]->argv[j],
448                                             NULL);
449                    if (i < p->ncommands - 1)
450                            out = strappend (out, " | ", NULL);
451            }
452    
453            return out;
454    }
455    
456  /* Children exit with this status if execvp fails. */  /* Children exit with this status if execvp fails. */
457  #define EXEC_FAILED_EXIT_STATUS 0xff  #define EXEC_FAILED_EXIT_STATUS 0xff
458    

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26