Question: Write a Makefile that builds the program tee from a C file tee.c . Your Makefile should use the compiler flags discussed in class, and

Write a Makefile that builds the program tee from a C file tee.c. Your Makefile should
use the compiler flags discussed in class, and have the all and clean targets as shown
previously. You should also include the flag -Wextra as discussed in the lab. Note that
running ./tee (our program) is different from tee (the one you used previously).
Fixing tee [50 points]
An implementation of the program tee.c is available at
/student/cmpt214/2024/summer/starter/le4/tee.c. This program resembles the pro-
gram tee that you have used in Lab exercise 2, except that this program has a particular
liking to the letters c,m,p, and t. The program likes to capitalize those letters when-
ever it finds them. Do not change this. Moreover, there is a number of logical and syntactic
errors in this program (using the appropriate compiler options in your Makefile will reveal
some of the syntactic errors). Your task is to find and fix all errors. There are 4 errors in
total. Some errors will be easy to fix (gcc will point you to the errors), and some will require
you to read the comments in the code, consult the man pages regarding the C functions you
are not familiar with, and use gdb.
Do not get overwhelmed by the code. The errors are all related to things you have already
used and have been discussed in class. The man pages might talk about things you dont
understand yet. Ignore those parts. Just make sure that the logic of the program is consistent
with what it is trying to do (according to the comments and your knowledge of the real tee).
Once all errors are fixed, make sure to properly test the program. The following tests must
pass:
1. echo all of stdin back onto stdout after EOF (ctrl + D) is encountered on stdin,
2. echo all of stdin to zero or more files given as command-line arguments,
3. work correctly for inputs greater than 128 characters (do not change the values of
MIN ALLOC SIZE and MIN READ SIZE), and
4. capitalize the letters c,m,p, and t.
2

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!