-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.h
More file actions
59 lines (52 loc) · 1.12 KB
/
Copy pathmain.h
File metadata and controls
59 lines (52 loc) · 1.12 KB
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
52
53
54
55
56
57
58
59
#ifndef _MAIN_H_
#define _MAIN_H_
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <time.h>
#include <stdbool.h>
/* env */
extern char **environ;
extern __sighandler_t signal(int __sig, __sighandler_t __handler);
/* utils */
void handle_signal(int);
void prompt_user(void);
char **tokenize(char *);
int check_command(char **, char *);
int handle_builtin(char **, char *);
char *check_path(char **, char *);
char *find_path(void);
char *append_path(char *, char *);
void execute(char *, char **);
void handle_exit(char **, char *);
void handle_env(void);
void free_buffer(char **);
/* structs */
/**
* builtin - stores builtins.
* @env: env builtin.
* @exit: exit builtin.
*
* Description: a struct that stores builtins for comparison purposes.
*/
struct builtin
{
char *env;
char *exit;
} builtin;
/**
* flags - stores flags.
* @interactive: indicates whether shell is interactive.
*
* Description: a struct that stores flags for shell.
*/
struct flags
{
bool interactive;
} flags;
#endif /* _MAIN_H_ */