Write a program that:
has to have at least one input argument passed on the command line, e.g. ./program_name first_argument
displays the first argument and also prints a selection menu to standard output, e.g.
Welcome! The input parameter is "/dev/ttyACM0"
== program menu ==
Item 1: Control LED
Item 2: Read button state
Item 3: Read joystick
Item 4: Control display
Item c: Enter a custom command
Item e: Exit
Selection:
then the program waits for user input. The program will react just on the allowed options and if wrong selection is made then it prints “Wrong option” to stderr
selections 1 to 4 will cause redraw of the menu
selection 'c' will allow the user to enter a string which will be printed to the standard output - see the example:
Welcome! The input paramenter is "/dev/ttyACM0"
== program menu ==
Item 1: Control LED
Item 2: Read button state
Item 3: Read joystick
Item 4: Control display
Item c: Enter a custom command
Item e: Exit
Selection:
User input (keyboard) 'c' - '' denotes character
Enter commnad:
User input (keyboard) “*IDN?” - “” denotes string array
The command is "*IDN?"
== program menu ==
Item 1: Control LED
Item 2: Read button state
Item 3: Read joystick
Item 4: Control display
Item c: Enter a custom command
Item e: Exit
Selection:
These parameters of the program will be evaluated:
1 point - student is able to compile the program on the command line and it is possible to run the program on the computer
1 point - the program generates the menu in a loop - all options are working
1 point - the program exits with e option properly without any memory lead - check by valgrind
1 point - the program takes an input parameter passed over the command line and prints it for one time before all menus
1 point - the program is capable to read a custom command and print the command on the standard output