return rtrn;
}
+
+#define UNMATCHABLE(c) ((c) == '(' || (c) == ')' || (c) == '/')
+
+Bool
+XkbcNameMatchesPattern(char *name, char *ptrn)
+{
+ while (ptrn[0] != '\0') {
+ if (name[0] == '\0') {
+ if (ptrn[0] == '*') {
+ ptrn++;
+ continue;
+ }
+ return False;
+ }
+
+ if (ptrn[0] == '?') {
+ if (UNMATCHABLE(name[0]))
+ return False;
+ }
+ else if (ptrn[0] == '*') {
+ if (!UNMATCHABLE(name[0]) &&
+ XkbcNameMatchesPattern(name + 1, ptrn))
+ return True;
+ return XkbcNameMatchesPattern(name, ptrn + 1);
+ }
+ else if (ptrn[0] != name[0])
+ return False;
+
+ name++;
+ ptrn++;
+ }
+
+ /* if we get here, the pattern is exhausted (-:just like me:-) */
+ return (name[0] == '\0');
+}
# define FileName(file) file->d_name
#endif
+#include "xkbmisc.h"
#include "xkbpath.h"
#include "parseutils.h"
#include "misc.h"
filename = FileName(file);
if (!filename || filename[0] == '.')
continue;
- if (ptrn && (!XkbNameMatchesPattern(filename, ptrn)))
+ if (ptrn && (!XkbcNameMatchesPattern(filename, ptrn)))
continue;
tmp =
(char *) uAlloc((head ? strlen(head) : 0) + strlen(filename) + 2);
int i;
if (ptrn != NULL)
- return XkbNameMatchesPattern(mapToConsider, ptrn);
+ return XkbcNameMatchesPattern(mapToConsider, ptrn);
if (nMapOnly < 1)
return True;
for (i = 0; i < nMapOnly; i++)
{
- if (XkbNameMatchesPattern(mapToConsider, mapOnly[i]))
+ if (XkbcNameMatchesPattern(mapToConsider, mapOnly[i]))
return True;
}
return False;
#define XkbcKSIsLower(k) (_XkbcKSCheckCase(k) & _XkbKSLower)
#define XkbcKSIsUpper(k) (_XkbcKSCheckCase(k) & _XkbKSUpper)
+extern Bool
+XkbcNameMatchesPattern(char *name, char *ptrn);
+
/***====================================================================***/
extern char *