home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / elm / elm2.4 / src / find_alias.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-03  |  1.4 KB  |  53 lines

  1.  
  2. static char rcsid[] = "@(#)$Id: find_alias.c,v 5.1 1992/10/03 22:58:40 syd Exp $";
  3.  
  4. /*******************************************************************************
  5.  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  6.  *
  7.  *            Copyright (c) 1988-1992 USENET Community Trust
  8.  *            Copyright (c) 1986,1987 Dave Taylor
  9.  *******************************************************************************
  10.  * Bug reports, patches, comments, suggestions should be sent to:
  11.  *
  12.  *    Syd Weinstein, Elm Coordinator
  13.  *    elm@DSI.COM            dsinc!elm
  14.  *
  15.  *******************************************************************************
  16.  * $Log: find_alias.c,v $
  17.  * Revision 5.1  1992/10/03  22:58:40  syd
  18.  * Initial checkin as of 2.4 Release at PL0
  19.  *
  20.  *
  21.  ******************************************************************************/
  22.  
  23. /** 
  24.     Search the list of aliases for a specific address.  Search
  25.     is limited to either SYSTEM or USER alias types....
  26. **/
  27.  
  28. #include "headers.h"
  29.  
  30. extern int num_duplicates;
  31.  
  32. int
  33. find_alias(word, alias_type)
  34. char *word;
  35. int alias_type;
  36. {
  37.     /** find word and return loc, or -1 **/
  38.     register int loc = -1;
  39.  
  40.     /** cannot be an alias if its longer than NLEN chars **/
  41.     if (strlen(word) > NLEN)
  42.         return(-1);
  43.  
  44.     while (++loc < (message_count+num_duplicates)) {
  45.         if ( aliases[loc]->type & alias_type ) {
  46.             if (istrcmp(word, aliases[loc]->alias) == 0)
  47.                 return(loc);
  48.         }
  49.     }
  50.  
  51.     return(-1);                /* Not found */
  52. }
  53.