-
Notifications
You must be signed in to change notification settings - Fork 0
/
declarations.h
111 lines (100 loc) · 1.91 KB
/
declarations.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
#ifndef declarations
#define declarations
#define S 100
//libraries
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <signal.h>
#include <dirent.h>
#include <sys/dir.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include <locale.h>
#include<sys/utsname.h>
//structs
typedef struct Bgproc
{
int pid;
int jobid;
char command[1000];
char status[1000];//running,stopped etc
int flag;//for reminder
int state;//for jobs
}bgproc;
//variables
int homeflag;//for cd~
char homedir[1000];//stores ~
char cmd[1000],tcs[1000],pipecmd[1000];//stores commands
char*tempcmd;//tokenise tcs
struct dirent **namelist;//used in ls
char**buf;//for execvp
char*cmdstorage[1000];//stores commands after tokenising with ;
char*pipecmdstorage[1000];
int cmdc;//pointer for above
int bg;//if the cmd is in bg or not
int maxbg;//no of bg processes
bgproc a[100];//stores bg process info
int remindflag;//for reminder
char remindmsg[2000];//for storing reminder msg
pid_t pid;
int builtinredirecterror;
//redirection
int in1;
int out1;
int out2;
int in1i;
int out1i;
int out2i;
char redirectfile[S];
char redirectfile2[S];
int doubleredirect;
//pipe
int pipecheck;
int pipedes;
int intermediatepipe;
int pipein;
int pipeout;
int fd[2];
//built in commands
char c1[S];
char c2[S];
char c3[S];
char c4[S];
char c5[S];
char c6[S];
char c7[S];
char c8[S];
char c9[S];
char c10[S];
char c11[S];
char c12[S];
char c13[S];
char c14[S];
char c15[S];
//functions
void prompt();
void builtin_cmd();
void print_perms();
void ls_la(int);
void process_cmd();
void execute();
void bg_proc_initialize(int,char*);
void bgprocexecute();
int reminder();
void clk();
void pipefunc();
void redirectioncheck();
int builtin_check();
void processbuilt_cmd();
void sigintHandler();
void sigstpHandler();
void sigqHandler();
#endif