File: process.h

package info (click to toggle)
yodl 4.04.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,720 kB
  • sloc: ansic: 7,803; perl: 683; cpp: 570; sh: 411; xml: 190; makefile: 164
file content (33 lines) | stat: -rw-r--r-- 955 bytes parent folder | download | duplicates (4)
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
#ifndef INCLUDED_PROCESS_H_
#define INCLUDED_PROCESS_H_

#include "../string/string.h"

typedef struct
{
    int d_pid;
    char const *d_fname;
    char *d_cmd;
    char *d_short_cmd;
    char *d_input;
    String *d_output;
}
Process;
                                /* cmd and input are freed by _destroy()    */
                                /* input may be NULL (or point to an empty  */
                                /* String if there's nothing to pipe        */
                                /* input is not used with _system()         */
void    process_construct(Process *pp, char const *fname,
                          char *cmd, char *input);
void    process_destruct(Process *pp);


void    process_fork(Process *pp);                  /* calls execvp()       */
void    process_system(Process *pp);                /* calls /bin/sh -c cmd */

static inline String const *process_output(Process *pp)
{
    return pp->d_output;
}

#endif