-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyshell.h
78 lines (71 loc) · 1.68 KB
/
myshell.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
CIS3207 Lab2 Shell
Author: John Glatts
Header file for the shell program
Contains all neccessary data structures and function prototypes
Please see myshell.c for implementation
*/
#ifndef MYSHELL__H
#define MYSHELL__H
#include "myshell_man.h"
#include <stdbool.h>
/* MyShell defines */
#define CMD_LIMIT 15
#define GREEN "\033[0;32m"
#define RESET "\033[0m"
/*
MultiParallel Data Structure to hold info
about the commands to run in parrallel
Only gets used if the "&" character is used more than once and is valid
*/
typedef struct MultiParallel {
char* cmd[CMD_LIMIT];
int args;
}MultiParallel;
/*
Enum of Built-In Shell commands
These are the current valid built in commands
*/
typedef enum Built_In {
CD,
CLR,
DIR_CMD,
ENVIORN,
ECHO,
PATH,
HELP,
PAUSE,
EXIT
} Built_In;
/*
Shell Functions
Please see myshell.c for details
*/
bool init_shell(int, char**);
bool run_shell(int, char**, char**);
bool check_for_built_in(char*);
void check_file_io();
void call_built_in(char*, char**, char** envp);
void reset_redirect();
bool run_parser();
void run_user_cmd(char**);
void run_built_in(char**);
void run_external();
void run_external_with_pipe();
void run_parrallel_cmds(char**);
void run_built_in_with_pipe(char**);
void run_ext_cmd_background();
void run_built_in_background(char**);
bool parse_cmd_line();
void parse_parrallel_cmds(int*, int);
void print_prompt();
void myshell_cd(char**);
void myshell_clear_screen();
void myshell_dir();
void myshell_echo(char**);
void myshell_pause();
void myshell_help();
void myshell_path(char*);
void myshell_env(char**);
void myshell_exit();
#endif // MYSHELL__H