home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume5 / xldimage / part01 / options.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-13  |  634 b   |  31 lines

  1. /* options.c:
  2.  *
  3.  * finds which option in an array an argument matches
  4.  *
  5.  * jim frost 10.03.89
  6.  *
  7.  * Copyright 1989 Jim Frost.  See included file "copyright.h" for complete
  8.  * copyright information.
  9.  */
  10.  
  11. #include "copyright.h"
  12. #include "options.h"
  13.  
  14. int optionNumber(arg, options)
  15.      char *arg;
  16.      char *options[];
  17. { int a, b;
  18.  
  19.   if ((*arg) != '-')
  20.     return(OPT_NOTOPT);
  21.   for (a= 0; options[a]; a++) {
  22.     if (!strncmp(arg + 1, options[a], strlen(arg) - 1)) {
  23.       for (b= a + 1; options[b]; b++)
  24.     if (!strncmp(arg + 1, options[b], strlen(arg) - 1))
  25.       return(OPT_SHORTOPT);
  26.       return(a);
  27.     }
  28.   }
  29.   return(OPT_BADOPT);
  30. }
  31.