-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (32 loc) · 1.13 KB
/
Copy pathmain.cpp
File metadata and controls
34 lines (32 loc) · 1.13 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
/*
******************* Assignment #2: XSH ********************
******************* CS480, Summer 2024 ********************
Aeron Flores (826123084) and Jasmine Rasmussen (129935517)
***** Edoras #s: Aeron - CSSC4404; Jasmine - CSSC4427 *****
************************ main.cpp *************************
*/
#include "xsh_shell.h"
int main(){
// Runs shell until user indicates they would like to exit
std::string userInput;
while(true){
// Output for user to indicate they are in the shell
// input is being expected
// userInput waits to collect input from user
std::cout << "cssc4427% ";
std::getline(std::cin, userInput);
// if userInput is exit, exits shell
if (userInput == "exit") {
break;
}
// if user input contains pipes, creates 2+ processes
// each process connected to last via pipe
else if (userInput.find("|") != std::string::npos){
startProcess(userInput);
}
// else, user would like to execute a file and shell will search for it
else {
executeFile(userInput);
}
}
}