Question: Write a C program mywrite whose behavior resembles that of the system command write. mywrite accepts the following parameters: $ mywrite username ttyname ; username

Write a C program mywrite whose behavior resembles that of the system command write.

mywrite accepts the following parameters: $ mywrite username ttyname; username is a name of the user logged into a terminal ttyname.

mywrite operates by copying lines from stdin of your terminal to stdout of the username's terminal.

Every line typed by the sender must be displayed at the receiver's terminal immediately after the sender presses the Enter key or closes the connection.

The first line to be displayed on the username's terminal will look like this: Message from yourname@yourhost on yourtty

When the user who started mywrite presses Ctrl-D (EOF), mywrite closes the connection and displays the final message on the username's terminal: EOF

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!