diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mail/aux.c | 16 | ||||
-rw-r--r-- | usr.bin/mail/extern.h | 5 | ||||
-rw-r--r-- | usr.bin/mail/list.c | 62 |
3 files changed, 20 insertions, 63 deletions
diff --git a/usr.bin/mail/aux.c b/usr.bin/mail/aux.c index 6152515e2e1..92b5b54ee7b 100644 --- a/usr.bin/mail/aux.c +++ b/usr.bin/mail/aux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aux.c,v 1.22 2004/09/15 22:21:40 deraadt Exp $ */ +/* $OpenBSD: aux.c,v 1.23 2008/07/15 19:23:26 martynas Exp $ */ /* $NetBSD: aux.c,v 1.5 1997/05/13 06:15:52 mikel Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static const char sccsid[] = "@(#)aux.c 8.1 (Berkeley) 6/6/93"; #else -static const char rcsid[] = "$OpenBSD: aux.c,v 1.22 2004/09/15 22:21:40 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: aux.c,v 1.23 2008/07/15 19:23:26 martynas Exp $"; #endif #endif /* not lint */ @@ -600,18 +600,6 @@ charcount(char *str, int c) } /* - * Convert c to upper case - */ -int -chraise(int c) -{ - - if (islower(c)) - return(toupper(c)); - return(c); -} - -/* * Copy s1 to s2, return pointer to null in s2. */ char * diff --git a/usr.bin/mail/extern.h b/usr.bin/mail/extern.h index 95d086e7997..67381e9eea4 100644 --- a/usr.bin/mail/extern.h +++ b/usr.bin/mail/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.25 2006/05/02 05:28:07 hugh Exp $ */ +/* $OpenBSD: extern.h,v 1.26 2008/07/15 19:23:26 martynas Exp $ */ /* $NetBSD: extern.h,v 1.7 1997/07/09 05:22:00 mikel Exp $ */ /*- @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)extern.h 8.2 (Berkeley) 4/20/95 - * $OpenBSD: extern.h,v 1.25 2006/05/02 05:28:07 hugh Exp $ + * $OpenBSD: extern.h,v 1.26 2008/07/15 19:23:26 martynas Exp $ */ struct name; @@ -198,7 +198,6 @@ int putline(FILE *, char *, int); int pversion(void *); int quit(void); int quitcmd(void *); -int chraise(int); int readline(FILE *, char *, int, int *); void register_file(FILE *, int, pid_t); void regret(int); diff --git a/usr.bin/mail/list.c b/usr.bin/mail/list.c index 3c53d7fcf6d..d04bcef54d2 100644 --- a/usr.bin/mail/list.c +++ b/usr.bin/mail/list.c @@ -1,4 +1,4 @@ -/* $OpenBSD: list.c,v 1.16 2005/07/11 14:08:23 millert Exp $ */ +/* $OpenBSD: list.c,v 1.17 2008/07/15 19:23:26 martynas Exp $ */ /* $NetBSD: list.c,v 1.7 1997/07/09 05:23:36 mikel Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static const char sccsid[] = "@(#)list.c 8.4 (Berkeley) 5/1/95"; #else -static const char rcsid[] = "$OpenBSD: list.c,v 1.16 2005/07/11 14:08:23 millert Exp $"; +static const char rcsid[] = "$OpenBSD: list.c,v 1.17 2008/07/15 19:23:26 martynas Exp $"; #endif #endif /* not lint */ @@ -650,21 +650,12 @@ first(int f, int m) int matchsender(char *str, int mesg) { - char *cp, *cp2, *backup; + char *cp; if (!*str) /* null string matches nothing instead of everything */ return(0); - backup = cp2 = nameof(&message[mesg - 1], 0); - cp = str; - while (*cp2) { - if (*cp == 0) - return(1); - if (chraise(*cp++) != chraise(*cp2++)) { - cp2 = ++backup; - cp = str; - } - } - return(*cp == 0); + cp = nameof(&message[mesg - 1], 0); + return (strcasestr(cp, str) != NULL); } /* @@ -677,7 +668,7 @@ int matchto(char *str, int mesg) { struct message *mp; - char *cp, *cp2, *backup, **to; + char *cp, **to; str++; @@ -687,21 +678,9 @@ matchto(char *str, int mesg) mp = &message[mesg-1]; for (to = to_fields; *to; to++) { - cp = str; - cp2 = hfield(*to, mp); - if (cp2 != NULL) { - backup = cp2; - while (*cp2) { - if (*cp == 0) - return(1); - if (chraise(*cp++) != chraise(*cp2++)) { - cp2 = ++backup; - cp = str; - } - } - if (*cp == 0) - return(1); - } + cp = hfield(*to, mp); + if (cp != NULL && strcasestr(cp, str) != NULL) + return(1); } return(0); } @@ -719,7 +698,7 @@ int matchsubj(char *str, int mesg) { struct message *mp; - char *cp, *cp2, *backup; + char *cp, *cp2; str++; if (*str == '\0') @@ -733,29 +712,20 @@ matchsubj(char *str, int mesg) */ if (value("searchheaders") && (cp = strchr(str, ':'))) { /* Check for special case "/To:" */ - if (chraise(str[0]) == 'T' && chraise(str[1]) == 'O' && - str[2] == ':') + if (strncasecmp(str, "to:", 3) == 0) return(matchto(cp, mesg)); *cp++ = '\0'; cp2 = hfield(*str ? str : "subject", mp); cp[-1] = ':'; str = cp; + cp = cp2; } else { - cp = str; - cp2 = hfield("subject", mp); + cp = hfield("subject", mp); } - if (cp2 == NULL) + if (cp == NULL) return(0); - backup = cp2; - while (*cp2) { - if (*cp == 0) - return(1); - if (chraise(*cp++) != chraise(*cp2++)) { - cp2 = ++backup; - cp = str; - } - } - return(*cp == 0); + + return (strcasestr(cp, str) != NULL); } /* |