1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

*

this procedure will return an array of string pointers, one for each file argument, that is terminated by a zero entry,this allows us to handle an arbitrary number of file name arguments

Now that we have a basic idea of the data structures, how do we organize the code?

process_arguments is the interface to our module that the rest of the program sees, it also contains the high level structure of the algorithm

to process the arguments, we need to work our way through the argv array, there are three things that we can expect to see in this array, flags, argument values, and arguments without flags (what we have called file name arguments)

an argument value will always have a flag before it, so we don't need to recognize them, we can easily find them after we have recognized a flag

so we will have a while loop that steps along the argv array

at each entry this loop will determine whether we have a flag, or a file name

a flag always starts with a + or -, and a file name doesn't so its easy to recognize a flag

*

*

*

*

*

*

*

March 1, 1999

Page 6

C201/TAM