- type
make
./shell
to run
-
header.h - consists of all headers.
-
shell.c - the main/master file.
- semicolon_tokenize - divides input with
;
as delimiter - actual_path - returns actual path from root
- relative_paths - returns relative paths
- prompt - prints prompt
- semicolon_tokenize - divides input with
-
cd.c
-
echo.c
-
exit_stat - Used for printing status of background process when finished
- EXIT_STAT
-
input.c - execution file
- filter_token - Every command tokenized with
" \n\t\r"
delimiters - execute - it sends commands to the specific
x.c
file to execute
- filter_token - Every command tokenized with
-
ls.c -
ls [flags]
- lists contents in the current directory.
-l
,-a
,-la
and-al
flags are supported.
-
pinfo.c -
pinfo <pid>
- prints process information of process
- If
<pid>
is empty, it returns info on current process.
-
pwd.c -
pwd
- prints current working directory from the root
-
rest.c - Background & Other Foreground processes are implemented
- foreground - executes other commands
- background - executes commands with & at the end in background
-
history.c -
history <num>
history
prints previous 10 commands (if available) or less commands- Can store upto 20 commands. E.g:
history 20
- load_hist: loads at start of int main
- history_add: Adds input to the hist[] char array
- hist_exit: writes hist[] char array into history.txt file
-
nightswatch.c -
nightswatch -n <seconds> interrupt
interrupt
argument prints the number of times CPU has been interrupted by keyboard- Executes every
<seconds>
seconds specified by user - Press
q+enter
to end command.
-
jobs.c
- prints all the background jobs with their status and pid.
-
kjob
kjob <job number> <signal number>
- background job with given job number
-
environment.c
- setenv() & unsetenv() are implemented
-
overkill.c -
overkill
- kills all the background processes
quit
- Exits the shell.
- Many char arrays store 1024 or 2048 characters in it. Its assumed that it will not overflow.
- No. of background processes should be less than 1000.
- Running background processes and then exiting thorough
Ctrl+C
will give error (Ctrl+C handling is not implemented). - Process exit status (E.g: process exited normally) is printed after next prompt.
- All functions returns:
=0
value if successful>0
value if error occurs
CtrlD
exits the shell.cd -
prints relative last working directory.