On Mon, Nov 07, 2005 at 07:52:07AM +0100, Nicolas Rachinsky wrote: > So I don't think it should be commited with this name. Okay, the previous function was completely brain-dead. I have no idea what the hell I was thinking; please pretend it didn't happen. Could you test with the attached patch instead? Thanks, -- Paul
diff -r 38ac88174436 PATCHES
--- a/PATCHES Tue Nov 1 08:43:14 2005
+++ b/PATCHES Mon Nov 7 15:08:25 2005
@@ -1,0 +1,1 @@
+patch-1.5.11.pw.alias_case.2
diff -r 38ac88174436 alias.c
--- a/alias.c Tue Nov 1 08:43:14 2005
+++ b/alias.c Mon Nov 7 15:08:25 2005
@@ -429,7 +429,7 @@
while (a)
{
- if (a->name && strstr (a->name, s) == a->name)
+ if (a->name && mutt_strcasestr (a->name, s) == a->name)
{
if (!bestname[0]) /* init */
strfcpy (bestname, a->name,
diff -r 38ac88174436 lib.c
--- a/lib.c Tue Nov 1 08:43:14 2005
+++ b/lib.c Mon Nov 7 15:08:25 2005
@@ -704,6 +704,39 @@
return strcasecmp(NONULL(a), NONULL(b));
}
+char *mutt_strcasestr(const char *haystack, const char *needle)
+{
+ char cmp, src;
+ size_t needle_len;
+
+ if ((NULL == needle) || (NULL == haystack))
+ return (char *)haystack;
+
+ cmp = tolower(*needle++);
+ needle_len = strlen(needle);
+ do
+ {
+ /* Find the first matching character (if any) */
+ do
+ {
+ if ((src = *haystack++) == 0)
+ return NULL;
+ } while (tolower(src) != cmp);
+
+ /* At this point, we must have found a matching character. Compare
+ * the strings to see if we need to keep going.
+ */
+ } while (mutt_strncasecmp(haystack, needle, needle_len) != 0);
+
+ /* Move the pointer back one (since we incremented it during the
+ * character search).
+ */
+ haystack--;
+
+ /* Return the adjusted pointer */
+ return (char *)haystack;
+}
+
int mutt_strncmp(const char *a, const char *b, size_t l)
{
return strncmp(NONULL(a), NONULL(b), l);
diff -r 38ac88174436 lib.h
--- a/lib.h Tue Nov 1 08:43:14 2005
+++ b/lib.h Mon Nov 7 15:08:25 2005
@@ -128,6 +128,7 @@
int mutt_copy_bytes (FILE *, FILE *, size_t);
int mutt_rx_sanitize_string (char *, size_t, const char *);
int mutt_strcasecmp (const char *, const char *);
+char *mutt_strcasestr(const char *haystack, const char *needle);
int mutt_strcmp (const char *, const char *);
int mutt_strncasecmp (const char *, const char *, size_t);
int mutt_strncmp (const char *, const char *, size_t);
Attachment:
signature.asc
Description: Digital signature