diff options
author | rse <rse> | 2009-04-12 07:30:47 +0000 |
---|---|---|
committer | rse <rse> | 2009-04-12 07:30:47 +0000 |
commit | 09872c994864a8a1eb18417295d8f06a85dbbc56 (patch) | |
tree | ee1ece9cdd79c5d34770d4f79e326d373af213c8 /poptconfig.c | |
parent | c324653dca1ba39cc69a7d81e80aee03bd673fec (diff) | |
download | libpopt-09872c994864a8a1eb18417295d8f06a85dbbc56.tar.gz |
Fix portability:
1. glob_pattern_p is a glibc thing. As we force -D_GNU_SOURCE in the
Autoconf stuff, we cannot use this as the check whether
glob_pattern_p() exists. Use __GLIBC__ instead.
2. FNM_EXTMATCH is available within RPM because of the local fnmatch()
implementation. But FNM_EXTMATCH is not portable enough, because many
systems (including BSD) lack it. So, use it conditionally only.
Diffstat (limited to 'poptconfig.c')
-rw-r--r-- | poptconfig.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/poptconfig.c b/poptconfig.c index 6e42a27..ce88751 100644 --- a/poptconfig.c +++ b/poptconfig.c @@ -42,7 +42,7 @@ extern int glob_pattern_p (const char *__pattern, int __quote) /*@=declundef =exportheader =incondefs =protoparammatch =redecl =type @*/ #endif /* __LCLINT__ */ -#if !defined(_GNU_SOURCE) +#if !defined(__GLIBC__) /* Return nonzero if PATTERN contains any metacharacters. Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ static int @@ -72,7 +72,7 @@ glob_pattern_p (const char * pattern, int quote) } return 0; } -#endif /* !defined(_GNU_SOURCE) */ +#endif /* !defined(__GLIBC__) */ /*@unchecked@*/ static int poptGlobFlags = 0; @@ -247,7 +247,10 @@ static int configAppMatch(poptContext con, const char * s) #if defined(HAVE_GLOB_H) && defined(HAVE_FNMATCH_H) if (glob_pattern_p(s, 1)) { /*@-bitwisesigned@*/ - static int flags = FNM_EXTMATCH | FNM_PATHNAME | FNM_PERIOD; + static int flags = FNM_PATHNAME | FNM_PERIOD; +#ifdef FNM_EXTMATCH + flags |= FNM_EXTMATCH; +#endif /*@=bitwisesigned@*/ rc = fnmatch(s, con->appName, flags); } else |