static char rcsid[] = "@(#)$Id: find_alias.c,v 1.5 2006/04/09 07:37:29 hurtta Exp $";
/******************************************************************************
* The Elm (ME+) Mail System - $Revision: 1.5 $ $State: Exp $
*
* Modified by: Kari Hurtta <hurtta+elm@posti.FMI.FI>
* (was hurtta+elm@ozone.FMI.FI)
******************************************************************************
* The Elm Mail System
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
*****************************************************************************/
/**
Search the list of aliases for a specific address. Search
is limited to either SYSTEM or USER alias types....
**/
#include "def_aliases.h"
/* ????
*
* Why aliases is stored to hash, if we search all
* aliases linearly ????
*
* / Kari Hurtta
*/
int find_alias(word, alias_type, aview)
char *word;
int alias_type;
struct AliasView *aview;
{
/** find word and return loc, or -1 **/
int loc = -1;
int tc = get_total_alias_count(aview);
/** cannot be an alias if its longer than NLEN chars **/
if (strlen(word) > NLEN)
return(-1);
while (++loc < tc) {
struct alias_rec *a = give_alias(aview,loc);
if ( a &&
(a->type & alias_type) ) {
if (istrcmp(word, a->alias) == 0)
return(loc);
}
}
return(-1); /* Not found */
}
/*
* Local Variables:
* mode:c
* c-basic-offset:4
* buffer-file-coding-system: iso-8859-1
* End:
*/
syntax highlighted by Code2HTML, v. 0.9.1