Displaying 1 result from an estimated 1 matches for "strcmp_pattern".
2005 May 23
3
module-init-tools ported to klibc
...*optstring,
+ const struct option *longopts, int *longindex)
+{
+ /* TODO: the rest of getopt_long */
+ return getopt(argc, argv, optstring);
+}
+
+#endif
+
+#ifndef HAVE_FNMATCH
+
+/* shamelessly copied from udev */
+/* compare string with pattern (supports * ? [0-9] [!A-Z]) */
+static int strcmp_pattern(const char *p, const char *s)
+{
+ if (s[0] == '\0') {
+ while (p[0] == '*')
+ p++;
+ return (p[0] != '\0');
+ }
+ switch (p[0]) {
+ case '[':
+ {
+ int not = 0;
+ p++;
+ if (p[0] == '!') {
+ not = 1;
+ p++;
+ }
+ while ((p[0] != '\0&...