summaryrefslogtreecommitdiffstats
path: root/02_exercise/process.h
blob: 6e9208cf922a0fcb695a8ca9ac488694b2d52abf (plain) (blame)
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
#ifndef SHELL_PROCESS_H
#define SHELL_PROCESS_H

#include <stddef.h>
#include <stdbool.h>

typedef struct {
    char **argv;
    size_t argc;
    int in_fd;
    int out_fd;
    int  pid;
    bool blocking;
} process;

/*
 * Parses the given line and creates an array of processes at *processes
 *  Expects tail -F file | grep panic & to mean that both processes should
 *  run in the background
 */
int parse_line(char const *line, process **processes);

/*
 * returns the return code of the executed program
 */
int exec_command(process p);

void free_processes(process **processes);

#endif // SHELL_PROCESS_H