-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmajor2.h
More file actions
91 lines (75 loc) · 2.58 KB
/
major2.h
File metadata and controls
91 lines (75 loc) · 2.58 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
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
char *alias_name[50];
char *real_name[50];
// Function: Shell
// Params: NULL
// Usage: Runs the shell in interactive mode
int shell();
// Function: batchProcessor
// Params: char* file
// Usage: takes in a batch file that contains shell commands to be executed
int batchProcesser(char* file);
// Function: shellRun
// Params: char*
// Runner function of the shell
void shellRun(char*);
// Function: commandToInt(char*)
// Params: char*
// Usage: Helper function to determine built-in commands
int commandToInt(char*);
// Function: SIGHandler
// Params: int sig
// Usage: Handle signal SIG sent to the shell (I.E. cntrl-c), the parameter is the signal number
void SIGHandler(int sig);
// Function: CD
// Params: char*
// Usage: Takes in the path that we want to change the current directory
void changeDirectory(char*);
// Function: setUpChangeDir
// Params: char** path
// Usage: Takes the path and formats it to be used with the CD function
char* setUpChangeDir(char** path);
// Function: myHistory
// Params: char**
// Usage: myHistory : Prints out users history
// myHistory -c : Clears out users history
// myHistory -e [Number of Command] : runs a command saved into history, does have a usage if no number is provided
void myHistory(char**);
// Function: saveCommand
// Params: char**
// Usage: Saves the user inputted command, only saving previous 20 commands
void saveCommand(char**);
// Function: printPrompt
// params: char* user, char* curDir
// Usage: Prints out the prompt showing a user name and the current working directory
void printPrompt(char* user, char* curDir);
// exit
void exitAtEndOfLine();
// alias command
void aliasNew(char**);
// Function: pipeCheck
// Params: char*
// Usage: Returns how many pipes are involved within the command statement, returns -1 if there is I/O Direction as well as a pipe
int pipeCheck(char *);
// Function: pipeRun
// Params: char*, int
// Usage: Runs commands by piping the outputs to the next command
void pipeRun(char*, int);
//PATH functions
int myShellInteract();
int myShellScript(char*);
int execShell(char**);
int myShellLaunch(char**);
int myShell_path(char**);
int numBuiltin();
char** splitLine(char*);
char* readLine();