/* Return the index of the N-th non-switch argument. Return -1 if N is out of range.  */
static int argindex(int n)
/* Return the index of the N-th non-switch argument. Return -1 if N is out of range.  */
static int argindex(int n)
{
  int i;
  int dashdash = 0;
  if( argv!=0 && *argv!=0 ){
    for(i=1; argv[i]; i++){
      if( dashdash || !ISOPT(argv[i]) ){
        if( n==0 ) return i;
        n--;
      }
      if( strcmp(argv[i],"--")==0 ) dashdash = 1;
    }
  }
  return -1;
}