[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] patch::match



Fileselector now matches *-patterns from the end

-----------------------------------------------------------
Longest possible match for '*' is used.
This enables the pattern '*.pat' to match for example abc.xy.pat.
-----------------------------------------------------------

--- src.km/matchpat.c	4 Jan 2010 22:31:11 -0000	1.5.10.1
+++ src.km/matchpat.c	3 Feb 2010 23:05:18 -0000
@@ -95,9 +95,8 @@
 			case '*':
 			{
 				pat++;
-				//while (*t && (toupper(*t) != toupper(*pat)))
-				while (*t && *t != *pat)
-					t++;
+				/* match from end */
+				t = strrchr( t, *pat );
 				break;
 			}
 			/* !X means any character but X */
@@ -189,8 +188,8 @@
 			case '*':
 			{
 				pat++;
-				while (*t && (toupper(*t) != toupper(*pat)))
-					t++;
+				/* match from end */
+				t = t + strlen(t);
+				for( t--; t >= s && toupper(*t) != toupper(*pat); t-- );
 				break;
 			}
 			/* !X means any character but X */