solidc
Robust collection of general-purpose cross-platform C libraries and data structures designed for rapid and safe development in C
Loading...
Searching...
No Matches
pipeline.h
Go to the documentation of this file.
1
6#ifndef PIPELINE_H
7#define PIPELINE_H
8
9#ifdef _WIN32
10#include <fcntl.h>
11#include <io.h>
12#include <sys/stat.h>
13#include <windows.h>
14#define O_WRONLY _O_WRONLY
15#define O_CREAT _O_CREAT
16#define O_TRUNC _O_TRUNC
17#define STDIN_FILENO 0
18#define STDOUT_FILENO 1
19#else
20#include <fcntl.h>
21#include <sys/wait.h>
22#include <unistd.h>
23#endif
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
32typedef struct CommandNode {
33 char** args; // NULL-terminated array of command arguments
34 struct CommandNode* next; // Next command in the pipeline
36
44
52void execute_pipeline(CommandNode* head, int output_fd);
53
59void free_pipeline(CommandNode* head);
60
67void build_pipeline(CommandNode** commands);
68
69#ifdef __cplusplus
70}
71#endif
72
73#endif // PIPELINE_H
void build_pipeline(CommandNode **commands)
Build the pipeline using a NULL-terminated array of CommandNode pointers.
Definition pipeline.c:250
void free_pipeline(CommandNode *head)
Free the linked list of commands.
Definition pipeline.c:235
CommandNode * create_command_node(char **args)
Create a new CommandNode.
Definition pipeline.c:19
void execute_pipeline(CommandNode *head, int output_fd)
Execute a pipeline of commands.
Definition pipeline.c:165
Structure representing a command in a pipeline.
Definition pipeline.h:32