Implementation
Bellow are listed the internal commands available in NuShell along with an explanation of their use.
- CatchINT(): Callback used when a SIGINT gets sent to the shell. This happens when the user presses Ctrl-c. The foreground process will be sent a SIGTERM signal;
- CatchTSTP(): Callback used when a SIGTSTP gets sent to the shell. This happens when the user presses Ctrl-z. The foreground process will be sent a SIGTSTP signal;
- ExecuteCommand(): Calls the appropriate function to execute the internal command;
- ExecuteIntCommand(): Executes an external program. Returns 0 on failure;
- GetInputLine(): Reads an input line from stdin;
- Initialization(): Performs general initialization;
- IsForegroundJob(): Checks if the job to be executed is a foreground job
- IsInternalCmd(): Checks if the job to be executed is an internal command
- ParseInput(): Parses a string to get a job list;
- PrintPrompt(): Prints the command prompt
- ProcessNewJobs(): Creates a new process using the job parameters;
- SplitString(): Splits a string according to a list of separators;
- UpdateChildren(): Checks if any child exited and updates the background job list;
- WaitForJob(): Waits for a job to complete and checks the exit status.