-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructs.h
More file actions
67 lines (61 loc) · 1.47 KB
/
Copy pathstructs.h
File metadata and controls
67 lines (61 loc) · 1.47 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
60
61
62
63
64
65
66
67
#ifndef STUCTS_H_
#define STUCTS_H_
/**
* struct cmd_info - struct for command information
* @prompt: User input
* @shell_av: Shell arguments
* @av: user input split into tokens
* @path: Command path
* @ac: number of tokens
* @cmd_type: 0 if command is normal, 1 if command is OR, 2 if command is AND
* @is_path: 1 if command is a path, 0 if not
* @run_count: Number of times command has been run
* @exit_state: Exit state
* @exit_status: Exit status
*
*/
typedef struct cmd_info
{
char *shell_name;
char *prompt;
char **shell_av;
char **av;
char *path;
int fdd;
int status;
int ac;
int cmd_type;
int is_path;
int run_count;
int exit_state;
int exit_status;
} UCommand;
#define CMD_NORM 0
#define CMD_OR 1
#define CMD_AND 2
#define CMD_CHAIN 3
#define CMD_BUILTIN 4
/**
* struct builtin_s - struct for builtin utilities
* @name: utility name
* @func: function to call to execute the utility
*
*/
typedef struct builtin_s
{
char *name; /* utility name */
int (*func)(UCommand *cmd); /* function to call to execute the utility */
} Built_in;
/* shell builtin utilities */
int dump(UCommand *cmd);
int exit_shell(UCommand *cmd);
int _env(UCommand *cmd);
int clear_screen(UCommand *cmd);
int _cd(UCommand *cmd);
int set_env(UCommand *cmd);
int unset_env(UCommand *cmd);
#define COMMAND_INFO_INIT \
{ \
NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 1, 0, 0, 0 \
}
#endif /* STUCTS_H_ */