-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.h
135 lines (105 loc) · 2.86 KB
/
header.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#include <sys/utsname.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
#include <string.h>
#include <sys/sysinfo.h>
#include <dirent.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/wait.h>
#define max(a,b) (a>b ? a : b)
#define GREEN "\033[1;32m"
#define BLUE "\033[1;34m"
#define NORMAL "\033[0m"
#define RED "\033[1;31m"
#define CYAN "\033[1;36m"
#define MAGENTA "\033[1;35m"
#define red "\033[0;31m"
char *user_name, *system_name, *INTDIR, *PRDIR, *OPRDIR, *PREVDIR;
char *process[100005];
char curr_fore_proc[100005];
long long int process_id[100005] ;
int process_status[100005];
long long int curr_proc;
int curr_fore;
int status;
char ** history;
int n_h;
pid_t SHELL_PID;
/*Functions in basic.c */
void get_val();
void prompt();
char* inc_tilda(char * address);
/* Functions in execute_inst.c */
void execute_inst(char** instruction, int len);
void remove_spaces(char* ins);
/* Functions in input.c */
void get_input();
void process_input(char* input);
void execute_input(char* instructions);
/* Functions in cd.c */
char* trim_dir(char* cwd);
void change_dir(char* loc);
char* get_dir ();
/* Functions in pwd.c */
void print_cur_dir();
/* Functions in echo.c */
void echo_ex(char** inst, int len);
/* Functions in ls.c */
void list_con(char** loc, int len);
char check_flags_ls(char* inst);
void print_ls(char** loc, int hidden,int lf, int len, int files);
void flag_01 (char* loc, int hide);
void flag_23 (char* loc, int hide);
/* Functions in foreground.c */
void foreground(char **instruction, int len);
/* Functions in background.c */
void background(char **instruction, int len);
/* Functions in pinfo.c */
void pinfo(char *inst);
/* Functions in history.c */
void history_dis(char* ins);
void read_history();
void write_history();
/* Functions in nightwatch.c */
void watch_interrupt(char* t);
void watch_process(char* t);
void read_line (int n);
int input_available(int n);
void read_op();
void print_out(char* buffer);
/* Functions in piping.c */
void processPipe(char* input);
/* Functions in redirection.c */
void output_redirection(char* input);
void input_redirection(char* input);
/* Functions in jobs.c */
void jobs();
/* Functions in kjob.c */
void kjob(char* pid, char* sig_id);
/* Functions in fg.c */
void fg(char* pid);
/* Functions in quit.c */
void quit();
/* Functions in overkill.c */
void overkill();
/* Function in signal_handler.c */
void sigchld_handler(int signum);
void sigint_handler(int signum);
void sigtstp_handler(int signum);
/* Function in bg.c */
void bg(char* pid);
/* Functions in chaining.c */
void chaining(char *str);
// Later : Make seperate headers
// Make all errors to stderr so that can be displayed for piping and redirection too
// Replace pointer assignment