Newer
Older
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
/*
** shell.h for 42sh in /home/seblu/devel/c/42sh
**
** Made by Seblu
** Login <seblu@epita.fr>
**
** Started on Sun Jul 16 20:03:53 2006 Seblu
** Last update Sun Jul 16 20:12:27 2006 Seblu
*/
#ifndef SHELL_H_
# define SHELL_H_
# include <errno.h>
# include <stdlib.h>
# define SCAN_ERROR 1
# define PARSE_ERROR 2
# define MEM_ERROR 42
# define FORK_ERROR 128
# define RED_ERROR 1
# define secmalloc(name, size) if (!(name = malloc(size))) exit(MEM_ERROR)
# define secrealloc(ret, name, size) if (!(ret = realloc(name, size))) exit(MEM_ERROR)
# define secstrdup(ret, str) if (!(ret = strdup(str))) exit(MEM_ERROR)
struct s_shell
{
struct s_ast *ast;
struct s_var *vars;
struct s_func *funcs;
struct s_opt *opt;
struct s_history *history;
int last_status;
};
struct s_shell *sh_init(void);
void sh_destroy(struct s_shell *sh);
char *strmerges(int n, const char *s1, ...);
#endif /* !SHELL_H_ */