Re: [CODE] Command abbreviations

From: Dana Luther (dtluther@mindspring.com)
Date: 09/01/00


-----Original Message-----
From: Torgny Bjers <tb@sbbs.se>

-----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))          <----- this is the line
>     {
>        free(newlist);
>        return 1;
>     }
>  free(newlist);
>  return 0;
>}


Yes, it's your isname. Notice the line which reads is_abbrev(str, curtok).
Now you get to choose - You can change your isname so that you can't use the
abbreviations (which would affect everthing and is not the best idea in my
opinion), or you can use an alternate isname for your help related functions
(namely the find_help and the function in the hedit which calls isname() to
decide which help entry to edit).
In the hedit patch was a copy of the original isname. What I did was copy
that in as orig_isname and use that instead of isname() in the hedit and
find_help. This enables you to have your abbreviated name search
capabilities for everything else, and use exact name comparison for your
help files.

Maybe not the best solution, but it certainly does work. ;)

Dana


     +------------------------------------------------------------+
     | 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