move to eina's new fnmatch

This commit is contained in:
Carsten Haitzler 2021-05-03 20:59:27 +01:00
parent 835221e29a
commit 3faf1a4627
11 changed files with 12 additions and 24 deletions

View File

@ -192,12 +192,6 @@ if cc.has_function('mlock') == true
config_h.set('HAVE_MLOCK' , '1') config_h.set('HAVE_MLOCK' , '1')
endif endif
if cc.has_header('fnmatch.h') == false
error('fnmatch.h not found')
endif
dep_fnmatch = cc.find_library('fnmatch', required: false)
code = '''#define _GNU_SOURCE 1 code = '''#define _GNU_SOURCE 1
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>

View File

@ -78,7 +78,6 @@ void *alloca (size_t);
# include <dlfcn.h> # include <dlfcn.h>
# include <math.h> # include <math.h>
# include <fcntl.h> # include <fcntl.h>
# include <fnmatch.h>
# include <limits.h> # include <limits.h>
# include <ctype.h> # include <ctype.h>
# include <time.h> # include <time.h>

View File

@ -2718,7 +2718,7 @@ ACT_FN_GO(shelf_show, )
EINA_LIST_FOREACH(e_shelf_list(), l, es) EINA_LIST_FOREACH(e_shelf_list(), l, es)
{ {
if ((!params) || (params && (fnmatch(params, es->name, 0) == 0))) if ((!params) || (params && (eina_fnmatch(params, es->name, 0))))
{ {
e_shelf_toggle(es, 1); e_shelf_toggle(es, 1);
e_shelf_toggle(es, 0); e_shelf_toggle(es, 0);
@ -2727,7 +2727,7 @@ ACT_FN_GO(shelf_show, )
} }
/***************************************************************************/ /***************************************************************************/
#define ACT_SHELF_SHOW(params, es) \ #define ACT_SHELF_SHOW(params, es) \
if ((!params) || (params && (fnmatch(params, es->name, 0) == 0))) \ if ((!params) || (params && (eina_fnmatch(params, es->name, 0)))) \
{ \ { \
e_shelf_toggle(es, 1); \ e_shelf_toggle(es, 1); \
e_shelf_toggle(es, 0); \ e_shelf_toggle(es, 0); \

View File

@ -20,7 +20,6 @@
#include <sys/param.h> #include <sys/param.h>
#include <utime.h> #include <utime.h>
#include <math.h> #include <math.h>
#include <fnmatch.h>
#include <limits.h> #include <limits.h>
#include <ctype.h> #include <ctype.h>
#include <time.h> #include <time.h>

View File

@ -32,7 +32,6 @@ void *alloca (size_t);
#include <sys/param.h> #include <sys/param.h>
#include <utime.h> #include <utime.h>
#include <math.h> #include <math.h>
#include <fnmatch.h>
#include <limits.h> #include <limits.h>
#include <ctype.h> #include <ctype.h>
#include <time.h> #include <time.h>

View File

@ -20,7 +20,6 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
#include <fnmatch.h>
#include <ctype.h> #include <ctype.h>
#ifdef HAVE_ALLOCA_H #ifdef HAVE_ALLOCA_H
#include <alloca.h> #include <alloca.h>
@ -598,7 +597,7 @@ auth_etc_enlightenment_sysactions(char *a,
deny = 0; deny = 0;
if (!strcmp(id, "user:")) if (!strcmp(id, "user:"))
{ {
if (!fnmatch(ugname, u, 0)) if (eina_fnmatch(ugname, u, 0))
{ {
if (!strcmp(perm, "allow:")) allow = 1; if (!strcmp(perm, "allow:")) allow = 1;
else if (!strcmp(perm, "deny:")) else if (!strcmp(perm, "deny:"))
@ -615,7 +614,7 @@ auth_etc_enlightenment_sysactions(char *a,
for (gp = g; *gp; gp++) for (gp = g; *gp; gp++)
{ {
if (!fnmatch(ugname, *gp, 0)) if (eina_fnmatch(ugname, *gp, 0))
{ {
matched = EINA_TRUE; matched = EINA_TRUE;
if (!strcmp(perm, "allow:")) allow = 1; if (!strcmp(perm, "allow:")) allow = 1;
@ -646,7 +645,7 @@ auth_etc_enlightenment_sysactions(char *a,
{ {
p = get_word(p, act); p = get_word(p, act);
if (act[0] == 0) break; if (act[0] == 0) break;
if (!fnmatch(act, a, 0)) if (eina_fnmatch(act, a, 0))
{ {
if (allow) ok = 1; if (allow) ok = 1;
else if (deny) else if (deny)

View File

@ -62,7 +62,7 @@ e_util_glob_match(const char *str, const char *pattern)
} }
if (str == pattern) return 1; if (str == pattern) return 1;
if (!strcmp(pattern, "*")) return 1; if (!strcmp(pattern, "*")) return 1;
if (!fnmatch(pattern, str, 0)) return 1; if (eina_fnmatch(pattern, str, 0)) return 1;
return 0; return 0;
} }
@ -87,7 +87,7 @@ e_util_glob_case_match(const char *str, const char *pattern)
for (tp = tglob, p = pattern; *p != 0; p++, tp++) for (tp = tglob, p = pattern; *p != 0; p++, tp++)
*tp = tolower(*p); *tp = tolower(*p);
*tp = 0; *tp = 0;
if (!fnmatch(tglob, tstr, 0)) return 1; if (eina_fnmatch(tglob, tstr, 0)) return 1;
return 0; return 0;
} }

View File

@ -16,7 +16,6 @@ deps_e = [
dep_m, dep_m,
dep_dl, dep_dl,
dep_execinfo, dep_execinfo,
dep_fnmatch,
dep_eina, dep_eina,
dep_eet, dep_eet,
dep_eeze, dep_eeze,

View File

@ -52,7 +52,6 @@ void *alloca (size_t);
# include <dlfcn.h> # include <dlfcn.h>
# include <math.h> # include <math.h>
# include <fcntl.h> # include <fcntl.h>
# include <fnmatch.h>
# include <limits.h> # include <limits.h>
# include <ctype.h> # include <ctype.h>
# include <time.h> # include <time.h>

View File

@ -15,12 +15,12 @@ _conf_allow_deny(const char *cmd, const char *glob, const char *sys)
if (!strcmp(cmd, "allow:")) if (!strcmp(cmd, "allow:"))
{ {
if (!strcmp(glob, "*")) return 1; // allow if (!strcmp(glob, "*")) return 1; // allow
if (!fnmatch(glob, sys, 0)) return 1; // allow this sys if (eina_fnmatch(glob, sys, 0)) return 1; // allow this sys
} }
else if (!strcmp(cmd, "deny:")) else if (!strcmp(cmd, "deny:"))
{ {
if (!strcmp(glob, "*")) return -1; // deny if (!strcmp(glob, "*")) return -1; // deny
if (!fnmatch(glob, sys, 0)) return -1; // deny this sys if (eina_fnmatch(glob, sys, 0)) return -1; // deny this sys
} }
return 0; // unknown return 0; // unknown
} }
@ -58,7 +58,7 @@ _etc_enlightenment_system_conf_check(const char *sys)
in_usergroup = EINA_FALSE; in_usergroup = EINA_FALSE;
if (pw) if (pw)
{ {
if (!fnmatch(usergroup, pw->pw_name, 0)) if (eina_fnmatch(usergroup, pw->pw_name, 0))
{ {
in_usergroup = EINA_TRUE; in_usergroup = EINA_TRUE;
} }
@ -87,7 +87,7 @@ _etc_enlightenment_system_conf_check(const char *sys)
gp = getgrgid(gl[i]); gp = getgrgid(gl[i]);
if (gp) if (gp)
{ {
if (!fnmatch(usergroup, gp->gr_name, 0)) if (eina_fnmatch(usergroup, gp->gr_name, 0))
{ {
in_usergroup = EINA_TRUE; in_usergroup = EINA_TRUE;
break; break;

View File

@ -42,7 +42,7 @@ _glob_case_match(const char *str, const char *pattern)
for (tp = tglob, p = pattern; *p != 0; p++, tp++) for (tp = tglob, p = pattern; *p != 0; p++, tp++)
*tp = tolower(*p); *tp = tolower(*p);
*tp = 0; *tp = 0;
if (!fnmatch(tglob, tstr, 0)) return 1; if (eina_fnmatch(tglob, tstr, 0)) return 1;
return 0; return 0;
} }