Re: [CODE] Command abbreviations

From: Torgny Bjers (
Date: 09/01/00

----- Original Message -----
From: "Brandon Brown" <>
Sent: Friday, September 01, 2000 5:11 PM
Subject: Re: [CIRCLE] [CODE] Command abbreviations

> > I want to know if there is a way to
> > disallow do_help from using abbreviation when searching for help
> > When I type help <keyword> it grabs the first keyword in the list that
> > matches, not the exact keyword.  Could one perhaps restrict it to only
> > search for whole words?
> Try looking at 'find_help' in act.informative.c.

This is my 'find_help' :

struct help_index_element *find_help(char *keyword)
  extern int top_of_helpt;
  int i;

  for (i = 0; i < top_of_helpt; i++)
    if (isname(keyword, help_table[i].keywords))
      return (help_table + i);

  return NULL;

What causes the abbreviations to be trapped is the isname, right?  Or so I
would assume by looking at the code.  Well, here is my isname:

int isname(const char *str, const char *namelist)
  char *newlist;
  char *curtok;

  newlist = strdup(namelist); /* make a copy since strtok 'modifies' strings

  for(curtok = strtok(newlist, WHITESPACE); curtok; curtok = strtok(NULL,

     if(curtok && is_abbrev(str, curtok))
        return 1;
  return 0;


What should I do to make find_help look for whole words instead of

Kind Regards,

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

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