Listing 1

/*     TestOpt.c
*/
#include <stdio.h>
#include "Options.h"
   void
main( int argc, char **argv){
      Options opt;
      char *s;
   PutArgs( (opt=CreateOptions()), argc, argv);
   printf( "-x switch is %s.\n",
          IsSwitch( opt, 'x' )?"ON":"OFF");
   if( (s=GetParameter(opt,'f')) != NULL )
      printf(" -f parameter:  '%s'.\n", s);
   else    printf(" -f parameter omitted.\n");
   if( IsMoreSwitches(opt) )
      printf("Unrecognized switch character.\n");
   printf( "The command line arguements are: ");
   while( (s=GetNextOption(opt)) != NULL )
      printf( "\t%s", s);
   printf(".\n");
   DestroyOptions(opt);
   }