Open mahahahad opened 3 months ago
The exit
builtin must be implemented without options, this means that it has to purely mimic the exit
command in the terminal. The one described above the exit function call in programming, which are fundamentally different.
For proper implementation of the builtin, it is necessary that the parsing struct is obtained as the function of this command is to simply free everything in that struct and exit with the status code of the last performed command, even if it fails, is interrupted or succeeds.
The 'exit' builtin must be implemented without options but it does need to handle arguments. This would mean that the exit code
that that is provided as an argument must be used as the exit code
the process will exit with.
Built-in: exit
Exit the currently running process.
If an integer is provided as an argument, it exits with that as the return code. Otherwise it exits with the 0 return code. Supports upto LLONG_MAX as an input but exits with the 255 return code for values greater than 255. Values greater than LLONG_MAX cause it to throw an error and exit with a return code of 2.
If a non-integer is provided as an argument, it throws an error and exits with the 255 return code.