Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!spool2.mu.edu!uunet!mcsun!ukc!stl!andrew From: andrew@stl.stc.co.uk (Andrew Macpherson) Newsgroups: comp.mail.elm Subject: Priority etc. Message-ID: <3987@stl.stc.co.uk> Date: 29 Jan 91 16:29:19 GMT Sender: news@stl.stc.co.uk Reply-To: "Andrew Macpherson" Organization: STC Technology Limited, London Road, Harlow, Essex, UK Lines: 155 The comparisons of various header fields in elm are made with the macro first_word(a,b) which expands to (strncmp(a,b,strlen(b))==0) In various places different common capitalisations are tested to set (e.g.) the Urgency flag. I suggest this definition be changed to strincmp allowing many expressions to be simplified, and a better chance of Non-Urgent messages being handled correctly :-). A side effect is that istrcmp/strnicmp should be moved to opt_utils.c, and the second copy of istrcmp deleted from newalias. Proposed patch: *** hdrs/defs.oh Tue Jan 29 16:22:59 1991 --- hdrs/defs.h Tue Jan 29 15:22:06 1991 *************** *** 192,198 **** s[xyz--] = '\0'; \ } ! #define first_word(s,w) (strncmp(s,w, strlen(w)) == 0) #define ClearLine(n) MoveCursor(n,0); CleartoEOLN() #define whitespace(c) (c == ' ' || c == '\t') #define ok_rc_char(c) (isalnum(c) || c == '-' || c == '_') --- 192,198 ---- s[xyz--] = '\0'; \ } ! #define first_word(s,w) (strincmp(s,w, strlen(w)) == 0) #define ClearLine(n) MoveCursor(n,0); CleartoEOLN() #define whitespace(c) (c == ' ' || c == '\t') #define ok_rc_char(c) (isalnum(c) || c == '-' || c == '_') *** src/aliaslib.oc Mon Dec 10 16:42:22 1990 --- src/aliaslib.c Tue Jan 29 15:56:59 1991 *************** *** 301,341 **** } int - istrcmp(s1,s2) - register char *s1, *s2; - { - /* case insensitive comparison */ - register int d; - for (;;) { - d = ( isupper(*s1) ? tolower(*s1) : *s1 ) - - ( isupper(*s2) ? tolower(*s2) : *s2 ) ; - if ( d != 0 || *s1 == '\0' || *s2 == '\0' ) - return d; - ++s1; - ++s2; - } - /*NOTREACHED*/ - } - - int - strincmp(s1,s2,n) - register char *s1, *s2; - register int n; - { - /* case insensitive comparison */ - register int d; - while (--n >= 0) { - d = ( isupper(*s1) ? tolower(*s1) : *s1 ) - - ( isupper(*s2) ? tolower(*s2) : *s2 ) ; - if ( d != 0 || *s1 == '\0' || *s2 == '\0' ) - return d; - ++s1; - ++s2; - } - return(0); - } - - int hash_it(string, table_size) register char *string; int table_size; --- 301,306 ---- *** src/opt_utils.oc Mon Dec 10 16:37:58 1990 --- src/opt_utils.c Tue Jan 29 16:07:32 1991 *************** *** 449,451 **** --- 449,487 ---- return(0); } #endif + + int + istrcmp(s1,s2) + register char *s1, *s2; + { + /* case insensitive comparison */ + register int d; + for (;;) { + d = ( isupper(*s1) ? tolower(*s1) : *s1 ) + - ( isupper(*s2) ? tolower(*s2) : *s2 ) ; + if ( d != 0 || *s1 == '\0' || *s2 == '\0' ) + return d; + ++s1; + ++s2; + } + /*NOTREACHED*/ + } + + int + strincmp(s1,s2,n) + register char *s1, *s2; + register int n; + { + /* case insensitive comparison */ + register int d; + while (--n >= 0) { + d = ( isupper(*s1) ? tolower(*s1) : *s1 ) + - ( isupper(*s2) ? tolower(*s2) : *s2 ) ; + if ( d != 0 || *s1 == '\0' || *s2 == '\0' ) + return d; + ++s1; + ++s2; + } + return(0); + } + *** utils/newalias.oc Sat Jan 26 10:12:29 1991 --- utils/newalias.c Tue Jan 29 16:14:43 1991 *************** *** 441,463 **** } int - istrcmp(s1,s2) - register char *s1, *s2; - { - /* case insensitive comparison */ - register int d; - for (;;) { - d = ( isupper(*s1) ? tolower(*s1) : *s1 ) - - ( isupper(*s2) ? tolower(*s2) : *s2 ) ; - if ( d != 0 || *s1 == '\0' || *s2 == '\0' ) - return d; - ++s1; - ++s2; - } - /*NOTREACHED*/ - } - - int hash_it(string, table_size) register char *string; int table_size; --- 441,446 ---- -- Andrew.Macpherson@stl.stc.co.uk -- PSI%234237100122::Andrew.Macpherson "There is nothing quite so worthwhile as simply messing about in boats"