Re: [code] better targeting code question

From: Veritus (jbeeland@bellsouth.net)
Date: 07/16/00


hahaha, ignore me, I'm a moron.
I forgot the pointer advances in the innermost loop.
I wrote it out in my brainstorming but forgot to put it there.
sooooo, here's the correted snippit:


int isname(const char *str, const char *namelist)
{
  const char *curname, *curstr, *curword;
  int found;

  for(curword = str;;)
  {
    for(curname = namelist;;)
    {
      for(found = 0, curstr = curword;;curstr++, curname++)
      {
        if((!*curstr) || (*curstr == '-'))
        {
          found = 1;
          break;
        }
        if(LOWER(*curstr) != LOWER(*curname))
        {
          found = 0;
          break;
        }
      }
      if(found == 1) break;
      for(; isalpha(*curname); curname++);
      if(!*curname) return (0);
      curname++;
    }
    for(; *curword && *curword != '-'; curword++);
    if(!*curword) return (1);
    curword++;
    if(!*curword) return (1);
  }
}


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT