You will write an interactive C program (location: task-4/solution-4.c) which will continuously wait for a user to type in command strings on the standard input (stdin). For each command string, your program should print out the tokens in the given string on the standard output (i.e., stdout): one token in each line.
Input: A command string can contain any printable ASCII characters except the newline character (i.e., '\n). The newline character is used as the terminator of a command string.
Output: For each command string, your program should print the command followed by its arguments (in the same order as they appear on the input) in separate lines on the standard output. Your program should terminate without printing anything on the standard output whenever it observes the exit command after parsing.
Assumptions: You can safely assume that each input line will have a maximum of 1024 characters including the newline character at the end of the line.
Hint: Once a command string has been entered by the user - determined by observing a newline character your program should use space and tab characters as delimiters to tokenize the command string. Once a command string has been tokenized, the first token is considered to be the "command" whereas the rest of the following tokens are considered to be arguments to the command.
You may want to utilize getline()/fgets() and strtok() library functions for this task.
Error checking: Your program should do appropriate error checking. In case of an error, your program must print the following error message: "An error has occurred\n" and then exit with the error code 1, e.g., using exit(1).