You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2011/05/28 19:45:54 UTC

svn commit: r1128717 - /apr/apr/branches/0.9.x/strings/apr_fnmatch.c

Author: wrowe
Date: Sat May 28 17:45:54 2011
New Revision: 1128717

URL: http://svn.apache.org/viewvc?rev=1128717&view=rev
Log:
Replace from trunk/ at r1124997, including deprecated apr_is_fnmatch, 
and excluding apr_match_glob addition

Added:
    apr/apr/branches/0.9.x/strings/apr_fnmatch.c
      - copied, changed from r1128716, apr/apr/trunk/strings/apr_fnmatch.c

Copied: apr/apr/branches/0.9.x/strings/apr_fnmatch.c (from r1128716, apr/apr/trunk/strings/apr_fnmatch.c)
URL: http://svn.apache.org/viewvc/apr/apr/branches/0.9.x/strings/apr_fnmatch.c?p2=apr/apr/branches/0.9.x/strings/apr_fnmatch.c&p1=apr/apr/trunk/strings/apr_fnmatch.c&r1=1128716&r2=1128717&rev=1128717&view=diff
==============================================================================
--- apr/apr/trunk/strings/apr_fnmatch.c (original)
+++ apr/apr/branches/0.9.x/strings/apr_fnmatch.c Sat May 28 17:45:54 2011
@@ -434,49 +434,8 @@ APR_DECLARE(int) apr_fnmatch_test(const 
 }
 
 
-/* Find all files matching the specified pattern */
-APR_DECLARE(apr_status_t) apr_match_glob(const char *pattern, 
-                                         apr_array_header_t **result,
-                                         apr_pool_t *p)
+/* Deprecated */
+APR_DECLARE(int) apr_is_fnmatch(const char *pattern)
 {
-    apr_dir_t *dir;
-    apr_finfo_t finfo;
-    apr_status_t rv;
-    char *path;
-
-    /* XXX So, this is kind of bogus.  Basically, I need to strip any leading
-     * directories off the pattern, but there is no portable way to do that.
-     * So, for now we just find the last occurance of '/' and if that doesn't
-     * return anything, then we look for '\'.  This means that we could
-     * screw up on unix if the pattern is something like "foo\.*"  That '\'
-     * isn't a directory delimiter, it is a part of the filename.  To fix this,
-     * we really need apr_filepath_basename, which will be coming as soon as
-     * I get to it.  rbb
-     */
-    char *idx = strrchr(pattern, '/');
-    
-    if (idx == NULL) {
-        idx = strrchr(pattern, '\\');
-    }
-    if (idx == NULL) {
-        path = ".";
-    }
-    else {
-        path = apr_pstrndup(p, pattern, idx - pattern);
-        pattern = idx + 1;
-    }
-
-    *result = apr_array_make(p, 0, sizeof(char *));
-    rv = apr_dir_open(&dir, path, p);
-    if (rv != APR_SUCCESS) {
-        return rv;
-    }
-
-    while (apr_dir_read(&finfo, APR_FINFO_NAME, dir) == APR_SUCCESS) {
-        if (apr_fnmatch(pattern, finfo.name, 0) == APR_SUCCESS) {
-            *(const char **)apr_array_push(*result) = apr_pstrdup(p, finfo.name);
-        }
-    }
-    apr_dir_close(dir);
-    return APR_SUCCESS;
+    return apr_fnmatch_test(pattern);
 }