[code] better targeting code question

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


I saw this in the archives recently but noone ever posted any code solutions so
I began working on one of my own.  I am currently using "-" as a seperator,
only so i don't have to worry about get_char_vis or get_object_in_list_vis yet.
 I'll be going to a "." system after i get this ironed out.  The porblem is
this code I wrote doesn't work. (Isn't that always the problem?) Sooooo, I
thought I'd post it here and see if any of you doubtlessly brilliant minds
could see my probably stupid error.

Thanks in advance for any assistance.
Jason Beeland

This is my rewrite of isname() to allow compound keywords and name abbrv for
each keyword.

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;;)
      {
        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