aboutsummaryrefslogtreecommitdiff
path: root/include/system.h
blob: cdbefd83df6d8d78b0ffe33dc1c84cb2a0ed7cfd (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
31
32
//
// Created by jhunk on 10/4/23.
//

#ifndef OMC_SYSTEM_H
#define OMC_SYSTEM_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <limits.h>
#include <sys/wait.h>
#include <sys/stat.h>

struct Process {
    // Write stdout stream to file
    char f_stdout[PATH_MAX];
    // Write stderr stream to file
    char f_stderr[PATH_MAX];
    // Combine stderr and stdout (into stdout stream)
    int redirect_stderr;
    // Exit code from program
    int returncode;
};

int shell(struct Process *proc, char *args);
int shell_safe(struct Process *proc, char *args);
char *shell_output(const char *command, int *status);

#endif //OMC_SYSTEM_H