home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / misc / imagefx_sdk / sas / scanlib / matcharg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-15  |  514 b   |  23 lines

  1. #include <scan/modall.h>
  2. #include <stdarg.h>
  3. #include <string.h>
  4.  
  5. /*
  6.  * Scan through an array of words and see if the given argument
  7.  * matches any of them.  Returns the index + 1 or 0 if it doesn't
  8.  * match any of them.  A NULL terminates the array.
  9.  */
  10. int MatchArg (char *arg, ...)
  11. {
  12.    int i;
  13.    char *ptr;
  14.    va_list va;
  15.  
  16.    va_start(va, arg);
  17.    for (i = 0, ptr = va_arg(va, char *); ptr; i++, ptr = va_arg(va, char *)) {
  18.       if (strnicmp(ptr, arg, strlen(ptr)) == 0) return (i + 1);
  19.    }
  20.    return(0);
  21. }
  22.  
  23.