From 66f6b10e007d4c7a9bef24629212359ad04ed4f9 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 4 Apr 1998 19:31:12 +0000 Subject: De-caseblind UID comparisons where appropriate. svn path=/trunk/; revision=1733 --- uid.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'uid.c') diff --git a/uid.c b/uid.c index 93fabcbd..30ce1827 100644 --- a/uid.c +++ b/uid.c @@ -60,7 +60,7 @@ * be picked up by the next run. If there are no un-expunged * messages, the file is deleted. * - * Note: all comparisons are caseblind! + * Note: some comparisons (those used for DNS address lists) are caseblind! */ /* UIDs associated with un-queried hosts */ @@ -170,15 +170,17 @@ void free_str_pair_list(struct idlist **idl) } #endif -int str_in_list(struct idlist **idl, const char *str) -/* is a given ID in the given list? (comparison is caseblind) */ +int str_in_list(struct idlist **idl, const char *str, const flag caseblind) +/* is a given ID in the given list? (comparison may be caseblind) */ { if (*idl == (struct idlist *)NULL || str == (char *) NULL) return(0); - else if (strcasecmp(str, (*idl)->id) == 0) + else if (!caseblind && strcmp(str, (*idl)->id) == 0) + return(1); + else if (caseblind && strcasecmp(str, (*idl)->id) == 0) return(1); else - return(str_in_list(&(*idl)->next, str)); + return(str_in_list(&(*idl)->next, str, caseblind)); } int str_nr_in_list( struct idlist **idl, const char *str ) @@ -189,7 +191,7 @@ int str_nr_in_list( struct idlist **idl, const char *str ) if ( !str ) return -1; for( walk = *idl, nr = 0; walk; nr ++, walk = walk->next ) - if( strcasecmp( str, walk->id) == 0 ) + if( strcmp( str, walk->id) == 0 ) return nr; return -1; } @@ -202,7 +204,7 @@ int str_nr_last_in_list( struct idlist **idl, const char *str) if ( !str ) return -1; for( walk = *idl, nr = 0; walk; nr ++, walk = walk->next ) - if( strcasecmp( str, walk->id) == 0 ) + if( strcmp( str, walk->id) == 0 ) ret = nr; return ret; } @@ -215,7 +217,7 @@ void str_set_mark( struct idlist **idl, const char *str, const flag val) if (!str) return; for(walk = *idl, nr = 0; walk; nr ++, walk = walk->next) - if (strcasecmp(str, walk->id) == 0) + if (strcmp(str, walk->id) == 0) walk->val.status.mark = val; } -- cgit v1.2.3