forked from z64tools/ext_lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathext_proc.h
49 lines (42 loc) · 1.14 KB
/
ext_proc.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
45
46
47
48
49
#include <ext_lib.h>
typedef enum {
PROC_MUTE_STDOUT = 1 << 0,
PROC_MUTE_STDERR = 1 << 1,
PROC_OPEN_STDIN = 1 << 3,
PROC_MUTE = PROC_MUTE_STDOUT | PROC_MUTE_STDERR,
PROC_THROW_ERROR = 1 << 30,
PROC_SYSTEM_EXE = 1 << 31,
} e_ProcState;
typedef struct {
const char** arg;
const char** env;
u32 numArg;
char* msg;
char* path;
void* proc;
e_ProcState state;
int localStatus;
int signal;
thread_t thd;
} Proc;
typedef enum {
READ_STDOUT,
READ_STDERR,
} e_ProcRead;
Proc* Proc_New(char* fmt, ...);
void Proc_AddArg(Proc* this, char* fmt, ...);
void Proc_SetState(Proc* this, e_ProcState state);
int Proc_SetPath(Proc* this, const char* path);
void Proc_SetEnv(Proc* this, const char* env);
void Proc_Info(Proc* this);
int Proc_Exec(Proc* this);
char* Proc_ReadLine(Proc* this, e_ProcRead target);
char* Proc_Read(Proc* this, e_ProcRead);
int Proc_Write(Proc* this, const char* fmt, ...);
int Proc_Kill(Proc* this);
int Proc_Join(Proc* this);
void Proc_AddEach(Proc* this, ...);
#ifndef __clang__
#define Proc_AddEach(instance, ...) \
Proc_AddEach(instance, NARGS(__VA_ARGS__), __VA_ARGS__)
#endif