-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshell.h
More file actions
118 lines (85 loc) · 1.5 KB
/
Copy pathshell.h
File metadata and controls
118 lines (85 loc) · 1.5 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef SHELL_H
#define SHELL_H
#include <stdlib.h>
#include <stdio.h>
/*Built in function defines*/
#define SET 1
#define PRINT 2
#define UNSET 3
#define CHANGE 4
#define AL 5
#define UNAL 6
#define BY 7
#define CLR 8
/*shell error declerations*/
#define CLOSE -1 //close terminal
#define SYSERR 0 //error occured
#define OK 1 //command is ok
#define WARNING 2
/*function position*/
#define ONLY_ONE 0
#define FIRST 1
#define LAST 2
#define MIDDLE 3
/*File descriptors*/
#define READ 0
#define WRITE 1
extern FILE* yyin;
char errorMsg[100];
char warMsg[100];
char temp[100];
char cwd[100];
char*string;
int str_length;
int checkalias;
int checkcommand;
int ret;
/*command variables*/
#define MAXCMDS 50
#define MAXARGS 50
int arg_counter;
int cmd_counter;
int bi;
typedef struct command{
char cmdname[50];
int bi_type;
char arguments[MAXARGS][100];
int num_args;
int infd;
int outfd;
int backgnd;
} Cmd;
Cmd* cmd_table;
char global_cmd_path[MAXCMDS][100];
/*io variables*/
int inFile_red;
int outFile_red;
int errFile_red;
int append;
int iFile;
int oFile;
int eFile;
char inFile[100];
char outFile[100];
char errFile[100];
int amp;
/*environment variables*/
#define MAXENV 100
typedef struct env{
char variable[100];
char path[100];
int used;
} Env;
Env* home_env;
Env* path_env;
Env* env_table;
/*alias variables*/
#define MAXALI 100
typedef struct alias{
char name[100];
char value[100];
int used;
} Alias;
Alias* alias_table;
int ilist[MAXALI];
#endif