-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.h
More file actions
43 lines (34 loc) · 924 Bytes
/
shell.h
File metadata and controls
43 lines (34 loc) · 924 Bytes
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
/*
* Author: David Chau
* File: shell.h
* Description: Header file to support implementation
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include "enums.h"
class shell
{
public:
//Default constructor
shell();
//Runs the shell program
void runShell();
protected:
//Parses input into the first argument and additional arguments
//Sees if there are any pipes, indirection, or redirection
//Returns number of arguments if needed
int parse(char *inputString, char *cmdArgv[], char **supplementPtr);
//Goes to the end of the word and delimits it with a null character
void nullDelimateArgs(char *srcPtr);
//Function which executes OS calls
void execute(char **cmdArgv, char **supplementPtr);
private:
modes mode;
char CWD[MAX_PATH];
char *userInput;
size_t len;
};