Skip to content
Snippets Groups Projects
Commit 25cb1fd2 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

wildcardmatch(): use fnmatch() if available

parent 076aa76f
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
2015-03-11 Uwe Schulzweida
* wildcardmatch(): use fnmatch() if available
* eofspatial: removed scaling with grid cell area weights (bug fix)
* eoftime: removed scaling with grid cell area weights (bug fix)
......
......@@ -17407,6 +17407,18 @@ fi
 
done
 
for ac_header in fnmatch.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "fnmatch.h" "ac_cv_header_fnmatch_h" "$ac_includes_default"
if test "x$ac_cv_header_fnmatch_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_FNMATCH_H 1
_ACEOF
fi
done
for ac_header in wordexp.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "wordexp.h" "ac_cv_header_wordexp_h" "$ac_includes_default"
......
......@@ -64,6 +64,7 @@ AC_CHECK_HEADERS(sys/resource.h)
AC_CHECK_HEADERS(sys/times.h)
AC_CHECK_HEADERS(malloc.h)
AC_CHECK_HEADERS(glob.h)
AC_CHECK_HEADERS(fnmatch.h)
AC_CHECK_HEADERS(wordexp.h)
# ----------------------------------------------------------------------
# Checks for the availability of functions
......
......@@ -25,6 +25,9 @@
/* Define to 1 if you have the <fftw3.h> header file. */
#undef HAVE_FFTW3_H
/* Define to 1 if you have the <fnmatch.h> header file. */
#undef HAVE_FNMATCH_H
/* Define to 1 if you have the `gethostname' function. */
#undef HAVE_GETHOSTNAME
......
......@@ -19,10 +19,19 @@
#define _XOPEN_SOURCE 600 /* ftello */
#endif
#if defined(HAVE_CONFIG_H)
# include "config.h"
#endif
#if defined(_OPENMP)
# include <omp.h>
#endif
#if defined(HAVE_FNMATCH_H)
#include <fnmatch.h>
#endif
#include <stdio.h>
#include <string.h>
#include <ctype.h> /* tolower */
......@@ -103,6 +112,12 @@ char *cdoExpName = NULL;
int timer_read, timer_write;
#if defined(HAVE_FNMATCH_H)
int wildcardmatch(const char *pattern, const char *string)
{
return !fnmatch(pattern, string, 0);
}
#else
// The wildcardmatch function checks if two given strings match.
// The first string may contain wildcard characters
// * --> Matches with 0 or more instances of any character or set of characters.
......@@ -127,7 +142,7 @@ int wildcardmatch(const char *w, const char *s)
return 0;
}
#endif
int cdo_omp_get_thread_num(void)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment