-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathengine.h
44 lines (40 loc) · 1.34 KB
/
engine.h
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
34
35
36
37
38
39
40
41
42
43
44
#ifndef ENGINE_H_
#define ENGINE_H_
/*
* stdout_cmd_fmt
* version of the cmd used when writing to stdout. It is
* a sprintf style string with %s format specifiers, one for
* each step in the tmpfile_prerequisities list and in the
* same order. Once the cmd has been processed by sprintf
* it can be given to a system() for execution.
*
* tmpfile_cmd_file
* version of the cmd used when the output of the command is
* to be written to a temp file. It is a sprintf sytle string
* with %s format specifiers for each of the tmpfile_prerequisites,
* plus an extra %s specifier at the end for output temp file.
*
* stdin_prerequisite
* the step which should be connected via a pipeline to this
* step. This is done by concatenating the command for the
* prerequisite, "|", and the command for this step together
* and calling system() on the result.
*
* tmpfile_prerequisites
* steps which create the tempfiles needed for executing
* stdout_cmd_fmt or tmpfile_cmd_fmt.
*
*/
typedef struct step {
char *stdout_cmd_fmt;
char *tmpfile_cmd_fmt;
char *tmpfile;
struct step *stdin_prerequisite;
struct step *tmpfile_prerequisites;
struct step *next;
} step;
int
format_step(char *buf, char *fmt, step *step);
int
execute_stdout_step(step *stp);
#endif