#include <scan2/modall.h>
#include <stdarg.h>
#include <string.h>

/*
 * Scan through an array of words and see if the given argument
 * matches any of them.  Returns the index + 1 or 0 if it doesn't
 * match any of them.  A NULL terminates the array.
 */
int SB_MatchArg (char *arg, ...)
{
   int i;
   char *ptr;
   va_list va;

   va_start(va, arg);
   for (i = 0, ptr = va_arg(va, char *); ptr; i++, ptr = va_arg(va, char *)) {
      if (strnicmp(ptr, arg, strlen(ptr)) == 0) return (i + 1);
   }
   return(0);
}

