Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a version (c program) of the unix command stty, called sttyl, that supports the following specifications: [a] Display settings: if sttyl is invoked with

Write a version (c program) of the unix command stty, called sttyl, that supports the following specifications:

[a] Display settings: if sttyl is invoked with no arguments, it prints something more or less like the following. It does not have to be exact; it just has to include the intr, erase, and kill chars, and about eight other settings. speed 9600 baud; evenp hupcl cread intr = ^C; erase = ^H; kill = ^U; start = ^Q; stop = ^S; brkint -inpck icrnl -ixany onlcr tabs iexten echo -echoe echok

[b] Set erase and kill: sttyl should accept the arguments erase and kill. In each case, the argument after the word erase or kill is the character to make the erase or kill character. Try the real stty to see how this works. The character can also be expressed as a "^" and a letter.

[c] Set other attributes: sttyl should accept and correctly handle the words: icrnl, onlcr, echo, echoe, olcuc, tabs, icanon, and isig . It should handle these with or without a leading dash. A leading dash turns off that attribute, while no leading dash turns it on. Be careful about getting stuck in -icanon mode.

[d] Multiple arguments: sttyl must accept multiple settings on the command line. See the example in the section The stty command above for an example.

[e] Error handling: sttyl should print out the message unknown mode for arguments that it does not know about.

[f] Table driven: It is possible to write this program with a large number of if( strcmp(..)) else if ( strcmp(..)) blocks. Using that approach makes the code very long and tedious to update. Ten points of your score go to a table-driven solution. See the showtty.c program in the text for a starting model. 3

[g] Clean Compile: Compile your program with gcc -Wall and make sure you correct every warning and error it reports. Many small bugs can be avoided by heeding these warnings.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Consistently develop management talent.

Answered: 1 week ago

Question

Create a refreshed and common vision and values across Europe.

Answered: 1 week ago

Question

Provide the best employee relations environment.

Answered: 1 week ago