CS 3733 Operating Systems, Fall 1996 Assignment 1
Due Thursday, September 12 at 9:30 am
Read the Exercise of Section 1.6 which starts on Page 25 of PUP.
You will be doing something similar to this, but follow the instructions below.
All output from your programs should go to standard output.
All pages handed in should be stapled together in one group.
Use the burst page from one of your printouts as a cover sheet.
Make sure your full name is on the cover sheet and that you
write your explanations from the last part on this sheet or the
one following it.
- In a directory called assign1a get copies of
Program 1.1 and Program 1.2.
Create a makefile to compile and lint these. Most of this is done for you
and available in /usr/local/courses/cs3733/pup/ch01.
Modify argtest.c so
that the first thing it does is print a line in the form
This program was written by (yourname).
Test the program with the following:
argtest
argtest abc
argtest abc de
argtest "abc de"
argtest " abc de"
argtest ""
Hand in copies of the source, lint output and test output.
- Copy everything from assign1a to a directory called
assign1b.
Modify makeargv to use strtok_r instead of strtok.
Rerun all of the tests above.
Hand in copies of the source, lint output and test output.
- Do one of the following:
- In a directory called assign1c,
modify argtest so that it frees all storage
allocated by makeargv before argtest exits.
While this is not necessary in a program that exits,
it might be necessary if the
program were to process additional arguments lists.
Explain in words what you did and
and in output similar to that above.
Hand in copies of the source, lint output and test output.
- Explain why argtest cannot free all of the memory created
by makeargv without modifying makeargv.
What modifications would be necessary?