----- Original Message -----
From: "Brandon Brown" <BBrown@uasoft.com>
To: <CIRCLE@POST.QUEENSU.CA>
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
entries?
> > 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' :
-----snip----------------
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;
}
-----snip----------------
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:
-----------snip----------------------------
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,
WHITESPACE))
if(curtok && is_abbrev(str, curtok))
{
free(newlist);
return 1;
}
free(newlist);
return 0;
}
--------------------snip-------------
What should I do to make find_help look for whole words instead of
abbreviations?
Kind Regards,
/Torgny
+------------------------------------------------------------+
| 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/11/01 PDT