Patrick Dughi wrote:
>
> > Hello there
> >
> > I want to implement a abbreviation system on my mud, can anyone publish
> > a source-code here? I''ve already tried to do this by myself, but I've
> > can't.
>
> ftp://ftp.circlemud.org/pub/CircleMUD/contrib/snippets/utils/abbrevs.txt
>
>                                 PjD
Hi Elminster, Hi Patrick.
<PERSONAL-OPINION>
Ugh!! This code is nasty and unecessary...
</PERSONAL-OPINION>
Changing only 2 lines in the current bpl17 isname() function is enough
to support abbreviations.
 int isname(const char *str, const char *namelist)
 {
   const char *curname, *curstr;
   curname = namelist;
   for (;;) {
     for (curstr = str;; curstr++, curname++) {
-      if (!*curstr)
+      if (!*curstr && !isalpha(*curname))
        return (1);
       if (!*curname)
        return (0);
-      if (*curname == ' ')
+      if (!*curstr || *curname == ' ')
        break;
       if (LOWER(*curstr) != LOWER(*curname))
        break;
     }
     /* skip to next name */
     for (; isalpha(*curname); curname++);
     if (!*curname)
       return (0);
     curname++;                 /* first char of new name */
   }
 }
Hugs.
--
----=[ Juliano Ravasi Ferraz ]=----=[ jferraz@linkway.com.br ]=----
     Rayon Eletrônica e Informática Ltda. - Linkway Descalvado
Chaste makes waste.
     +------------------------------------------------------------+
     | 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