
The program code is as follows:
# define TRUE 1
while (TRUE) Start Parenthesis. It has a comment repeat forever.
type_prompt ( ) semicolon. It has a comment display prompt on the screen.
read_command (command, parameters) semicolon. It has a comment read input from terminal.
if (fork ( ) not equal to 0) Start Parenthesis. It has a comment fork off child process.
Comment is parent code.
wait pid (baseline equals 1, & status, 0) semicolon. It has a comment wait for child to exit.
End Parenthesis else Start Parenthesis
Comment is child node.
execve (command, parameters, 0) semicolon. It has a comment execute command.
End Parenthesis
End Parenthesis
Back