-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheaders.h
More file actions
91 lines (81 loc) · 2.03 KB
/
headers.h
File metadata and controls
91 lines (81 loc) · 2.03 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// Header Files
#include<stdio.h>
#include <sys/wait.h> //waitpid
#include <unistd.h> //chdir, fork, exec, pid_t
#include <stdlib.h> //malloc, realloc, free, exit, execvp
#include <string.h> //strcmp, strtok
#include <sys/utsname.h> //uname
#include <dirent.h> // scandir
#include<fcntl.h>
#include<sys/types.h> // stat
#include<sys/stat.h> // stat
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include <signal.h>
#define LSH_TOK_BUFSIZE 64
#define ANSI_COLOR_RED "\x1b[31m"
#define ANSI_COLOR_GREEN "\x1b[32m"
#define ANSI_COLOR_YELLOW "\x1b[33m"
#define ANSI_COLOR_BLUE "\x1b[34m"
#define ANSI_COLOR_MAGENTA "\x1b[35m"
#define ANSI_COLOR_CYAN "\x1b[36m"
#define ANSI_COLOR_BCYAN "\x1b[96m"
#define ANSI_COLOR_RESET "\x1b[0m"
// [1;36m Bold Cyan
//Global Variables
char addr[256];
char directory[1000];
struct utsname unameData;
char home_addr[256];
int a,b;
typedef struct
{
int pid;
char pname[100];
char status[100];
}processes;
int shellPID;
int curPID;
char curPROCESS[100];
int process_count;
processes process_list[1000];
int bg;
int ctr_arg;
int is_pipe;
int no_of_pipes;
char input_file[100];
char output_file[100];
char append_file[100];
int inp_redir;
int op_redir;
int app_redir;
int fd1, fd2, fd3;
int ctrlZ;
//Function Declarations
void remindme(char **args);
void execute_ls(char **args);
void execute_pwd();
void execute_lsl();
void execute_lsa();
void execute_lsla();
void execute_simple_ls();
int execute_cd(char **args);
void execute_ls(char **args);
int execute_help(char **args);
int execute_exit(char **args);
int execute_command(char **args, int in, int out);
int launch_command(char **args, int in, int out);
int execute_help(char **args);
void execute_echo(char **args);
void pinfo(int number);
void execute_clock(char **args);
void execute_setenv(char **args);
void execute_unsetenv(char **args);
void execute_jobs(char **args);
int execute_pipes(char *args2);
char **split_command(char *line, char *DELIM);
char *read_command(void);
void shell_loop();
void redirection(char **args);
void execute_fg(char **args);