-
Notifications
You must be signed in to change notification settings - Fork 0
/
huelle.h
51 lines (43 loc) · 795 Bytes
/
huelle.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
50
51
/* SPDX-License-Identifier: GPL-3.0-or-later
* Author: bluewww */
#ifndef __HUELLE_H__
#define __HUELLE_H__
#define HUL_OK 0
#define HUL_FAIL 1
#define HUL_FATAL 2
enum hul_redir_type {
NTO,
NTO2,
NCLOBBER,
NFROM,
NFROMTO,
NAPPEND,
NTOFD,
NFROMFD,
NHERE,
NEXHERE,
NNOT
};
struct hul_redir {
enum hul_redir_type type;
int fd_n;
char *file;
struct hul_redir *next;
};
struct hul_simple_cmd {
size_t pos;
size_t size;
char **args;
struct hul_redir *prefix;
struct hul_redir *suffix;
};
struct hul_pipe {
struct hul_simple_cmd *left;
struct hul_pipe *right;
};
void *xmalloc(size_t size);
void *xrealloc(void *ptr, size_t size);
int hul_run(char **args);
int hul_eval_pipe(struct hul_pipe *pipes);
void hul_free_pipe(struct hul_pipe *pipes);
#endif /* __HUELLE_H__ */