X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/blobdiff_plain/ffadcb36bef7c620b33232f88a77bb0de117ac60..66e2df0e031d076e65863d4c2ffe132850aa2ff3:/ignore-case.diff diff --git a/ignore-case.diff b/ignore-case.diff index 2933b27..f4287fb 100644 --- a/ignore-case.diff +++ b/ignore-case.diff @@ -1,8 +1,8 @@ This adds the --ignore-case option, which makes rsync compare filenames in a case-insensitive manner. ---- orig/lib/wildmatch.c 2005-12-30 07:31:41 -+++ lib/wildmatch.c 2005-12-30 07:38:42 +--- orig/lib/wildmatch.c 2006-01-03 17:26:02 ++++ lib/wildmatch.c 2006-01-03 17:29:11 @@ -53,6 +53,8 @@ #define ISUPPER(c) (ISASCII(c) && isupper(c)) #define ISXDIGIT(c) (ISASCII(c) && isxdigit(c)) @@ -12,27 +12,28 @@ in a case-insensitive manner. #ifdef WILD_TEST_ITERATIONS int wildmatch_iteration_count; #endif -@@ -71,6 +73,8 @@ static int dowild(const uchar *p, const +@@ -72,6 +74,8 @@ static int dowild(const uchar *p, const for ( ; (p_ch = *p) != '\0'; text++, p++) { int matched, special; uchar t_ch, prev_ch; + if (ignore_case && ISUPPER(p_ch)) + p_ch = tolower(p_ch); - if ((t_ch = *text) == '\0' && p_ch != '*') - return ABORT_ALL; - if (force_lower_case && ISUPPER(t_ch)) -@@ -211,10 +215,13 @@ static int dowild(const uchar *p, const - /* Match the "pattern" against the "text" string. */ + while ((t_ch = *text) == '\0') { + if (*a == NULL) { + if (p_ch != '*') +@@ -288,10 +292,14 @@ static const uchar *trailing_N_elements( int wildmatch(const char *pattern, const char *text) { + static const uchar *nomore[1]; /* A NULL pointer. */ + int ret; #ifdef WILD_TEST_ITERATIONS wildmatch_iteration_count = 0; #endif -- return dowild((const uchar*)pattern, (const uchar*)text) == TRUE; +- return dowild((const uchar*)pattern, (const uchar*)text, nomore) == TRUE; + force_lower_case = ignore_case; -+ ret = dowild((const uchar*)pattern, (const uchar*)text) == TRUE; ++ ret = dowild((const uchar*)pattern, (const uchar*)text, nomore) == TRUE; + force_lower_case = 0; ++ return ret; } /* Match the "pattern" against the forced-to-lower-case "text" string. */ @@ -118,7 +119,7 @@ in a case-insensitive manner. return (int)*s1 - (int)*s2; } ---- orig/wildtest.c 2004-02-07 18:40:52 +--- orig/wildtest.c 2006-01-03 17:26:02 +++ wildtest.c 2004-08-13 17:19:34 @@ -16,6 +16,7 @@ int fnmatch_errors = 0; #endif