A simple command-line program that processes user input. More...
Functions | |
| std::string | getHeader () |
| Returns the prompt header string for the user input. | |
| void | handle_sigint (int) |
| Signal handler for SIGINT (Ctrl + C) interrupt. | |
| int | main (int argc, char *argv[]) |
| Main function that processes user input. | |
A simple command-line program that processes user input.
This program provides a command-line interface where the user can input commands. It uses a CommandParser object to process each line of input. The program is designed to handle SIGINT (Ctrl + C) gracefully and provides an interactive prompt for the user to enter commands.
When the user presses Ctrl + C (SIGINT), the program will display a message reminding the user to exit using the "exit" command or Ctrl + D. The program clears the screen on startup and repeatedly prompts for user input until the program is terminated.
| std::string getHeader | ( | ) |
Returns the prompt header string for the user input.
This function provides a string that is displayed as a prompt to the user when accepting input.
| void handle_sigint | ( | int | ) |
Signal handler for SIGINT (Ctrl + C) interrupt.
This function is triggered when the user presses Ctrl + C. It displays a message prompting the user to use the exit command or Ctrl + D to exit the program.
| signum | The signal number (not used in this case). |
| int main | ( | int | argc, |
| char * | argv[] ) |
Main function that processes user input.
This function initializes signal handling, clears the terminal screen, and enters a loop where it continually prompts the user for input. The input is passed to a CommandParser instance, which processes the command.
| argc | The number of command-line arguments (not used in this case). |
| argv | The command-line arguments (not used in this case). |