CODE: Abbreviations

From: Mike Levine UK(UTC 00:00) (usfmcunw@ibmmail.com)
Date: 01/10/97


/********************************                                               
 abbr_3_0.txt                                                                   
 Mike Levine usfmcunw@ibmmail.com                                               
 January 10, 1997 (UK)                                                          
 --------------------------------                                               

 PURPOSE: Allows the use of abbreviations for all PC, NPC names.                
 Original code from Jurgen Zigge Sigvardsson (di4sig@cse.hks.se).               

 This update is more compact and works first time on Circle 3.0                 
 patch 11.                                                                      

 Instead of typing 'kill mobwithaverylongandcomplicatedname' you                
 can type 'kill mob' instead. It is VERY appreciated by players.                

 This will check for an abbreviation on every word in the namelist.             

 As an alternative - a call to the function 'strsep' could be used              
 in place of 'strtok' as it is more dynamic and has no bugs. Yet                
 for portability reasons use strtok.                                            

 Replace isname() in handler.c around line 57 with the following.               
 ********************************/                                              

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

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

  for(curtok = strtok(newlist, " \t"); curtok; (curtok = strtok(NULL," \t")))   
     if(curtok && is_abbrev(str, curtok))                                       
     {                                                                          
        free(newlist);                                                          
        return 1;                                                               
     }                                                                          
  free(newlist);                                                                
  return 0;                                                                     

Regards,                                                                        
Mike Levine - Information Technology - Europe & South America                   
DIALNET: 734-2682  FAX: 734-2681  EMAIL: usfmcunw@ibmmail.com                   

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST