Listing 4

#include "makedef.h"

long   parse_options(int argc, char *argv[], char *makefile, char *target)
{
int    i = 0;

while (++i < argc) {
   if (argv[i][0] != '-')
      fatal_error("all options must begin with '-'.");
   switch (toupper(argv[i][1])) {
      case 'F':
             if (argc > i+1)
                strcpy(makefile, argv[i+1]);
             else
              fatal_error("'-f' argument not found.");
             break;

      case 'T':
             if (argc > i+1)
                strcpy(target, argv [i+1]);
             else
              fatal_error("'-t' argument not found.");
             break;

      default:
             fatal error("invalid option found.");
   }
i++;
}
}
/* End of File */