Kevin Li and Peter Lee
Period 10
- Forks and executes commands
- Has a nice greeting when you open the shell!
- Handles cd and exit
- Displays working directory, like bash
- Can execute multiple commands on one line separated with semicolon (";")
- Says something sad but cute when you quit shell!
- When you do something bad in the shell, it will print out bash-like errors using errno
- 'magic' can hide or show your working directory
- Implements redirect stdout
- Handle multiple commands on one line when semicolons or commands are surrounded with spaces, like " ; " instead of just ";"
- Redirection and pipes
- Very occasionally the parser fails and cannot read the commands correctly. We tested it, and every time it happens, it can't read a certain character and reads it as a space.
- Commands cannot be executed if there are any spaces regardless of usage of semicolons
- The redirection breaks if multiple ">"s are entered.
char ** parse_args(char * line, char delimiter)- Description:
- Parses the given string using the given delimiter
- Arguments:
- char * line -> A pointer to the original string
- char delimiter -> The character that is going to be used to parse the string
- Return Value:
- A char ** which consists of the parsed strings
void exec_one(char ** args)- Description:
- Forks off a child process and the child process calls execvp to execute the given command
- Arguments:
- char ** args -> Command line arguments that should be executed
- Return Value:
- N/A
void redir_out(char ** args)- Description:
- Implements redirecting stdout by writing to a file
- Arguments:
- char ** args -> A pointer to the original string
- Return Value:
- N/A