Question: In the C programming language, build a command called terminfo to do the following The intent of the command is to print information about a
In the C programming language, build a command called terminfo to do the following The intent of the command is to print information about a terminal. The command is run like this:
$ terminfo - [option] *Note: Only one argument is fed into the command.
The options are as follows : [size][res][cann][quit][kill][min][time]
You must STRICTLY follow the following requirements.
Using all desired systems calls and the winsize and termios structures you are wring this command to extract and print attributes of a terminal.
#When you run the size option, you must print the size of the current terminal (the terminal you are running the command):
$ ./terminfo -size
current window size = [38 rows , 122 columns]
#When you run the res option, you must print the resolution (in pixels) of the current terminal (the terminal you are running the command):
$ ./terminfo -res
current window resolution = [854 x-pixels , 456 y-pixels]
#When you run the cann option, you must print the canonical code of the current terminal (the terminal you are running the command):
$ ./terminfo -cann
Canonical Input mode (Line Editing Mode ) = 3359
#When you run the quit option, you must print the quit code (VQUIT) of the current terminal (the terminal you are running the command) in a readable way (i.e. the VQUIT code is a hidden character represented by a ASCII code. Use the ASCII table to print the meaning of the code):
$ ./terminfo -quit
Quit Code (VQUIT) = ctrl-L
#When you run the kill option, you must print the kill code (VKILL) of the current terminal (the terminal you are running the command) in a readable way (i.e. the VKILL code is a hidden character represented by a ASCII code. Use the ASCII table to print the meaning of the code):
$ ./terminfo -kill
Kill Code (VKILL) = ctrl-U
#When you run the min option, you must print the minimum response characters (VMIN) of the current terminal (the terminal you are running the command) :
$ ./terminfo -min
Minimum Response Characters = 1
#When you run the time option, you must print the response time (VTIME) of the current terminal (the terminal you are running the command) :
$ ./terminfo -time
Response Time Value = 0
# If the user entered no option or wrong option you must print a meaningful message. Here are examples: a. User enters no options: $ ./terminfo Need Arguments:
usage terminfo -[option]
options: [size][res][cann][quit][kill][min][time]
#User enters a wrong option
$ ./terminfo canon
error: unknown option
$ ./terminfo -canon
error: unknown option
#Remember this is a System Program. You MUST use System Calls where appropriate.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
