Listing 2

/*     Options.h
*/
enum boolean { FALSE, TRUE};
typedef int    boolean;
typedef void * Options; /*hides definition of the object*/

Options CreateOptions( void );

void   PutArgs( Options options, const int argc, char **argv);
  /*  Establishes the options list as the argc strings
      pointed to by argv.
  */

boolean IsSwitch(      Options, const char switch_character);
  /*  Returns TRUE if -switch_character is an option.
     It also marks this arguement as used.
  */
char *  GetParameter( Options, const char switch_character);
  /*  Returns a pointer to the string following
     the first occurance of -switch character
     in the arguement list, called the switch parameter.
     It also marks this arguement as used.
  */

boolean IsMoreSwitches( Options options );
  /*  Returns TRUE if there are switches
     which have not been marked as used by IsSwitch()
  */

char *  GetNextOption( Options );
  /*  Returns pointers to the options
     in first-in, first-out or left-to-right order,
     and NULL when there are no more options.
     
     Options are the strings in the arguement list
         which are neither switches nor switch parameters.
     GetParameter() marks the switch parameters.
  */

void  DestroyOptions(Options);