]> granicus.if.org Git - php/commitdiff
- MFB
authorPierre Joye <pajoye@php.net>
Tue, 20 Jan 2009 01:41:19 +0000 (01:41 +0000)
committerPierre Joye <pajoye@php.net>
Tue, 20 Jan 2009 01:41:19 +0000 (01:41 +0000)
 - [DOC] add support for fnmatch() on Windows
 - enable tests (pass)

ext/standard/file.c
ext/standard/tests/file/fnmatch_basic.phpt
ext/standard/tests/file/fnmatch_error.phpt
ext/standard/tests/file/fnmatch_variation.phpt

index 1c744a396e59b8280acede99e36ac655cea8f5e1..553c44e0ef8b2cd68c4a7ca085f11baf091977d5 100644 (file)
@@ -48,6 +48,7 @@
 #define O_RDONLY _O_RDONLY
 #include "win32/param.h"
 #include "win32/winutil.h"
+#include "win32/fnmatch.h"
 #elif defined(NETWARE)
 #include <sys/param.h>
 #include <sys/select.h>
@@ -115,7 +116,7 @@ int file_globals_id;
 php_file_globals file_globals;
 #endif
 
-#ifdef HAVE_FNMATCH
+#if defined(HAVE_FNMATCH) && !defined(PHP_WIN32)
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
index 9f8f4dbb4d67433a85602a8e08dddbe813d2a301..189605169d17e4e48b61f6db3bea96422968a1b5 100644 (file)
@@ -2,9 +2,6 @@
 Test fnmatch() function: Basic functionality
 --SKIPIF--
 <?php
-if (substr(PHP_OS, 0, 3) == 'WIN')
-    die("skip do not run on Windows");
-
 if (!function_exists('fnmatch'))
     die("skip fnmatch() function is not available");
 ?>
index 77a2a386e599d90f44dbed9014030623ec5b3a29..1b175b0852b76b07c47966a23acd71823f045324 100644 (file)
@@ -2,9 +2,6 @@
 Test fnmatch() function: Error conditions
 --SKIPIF--
 <?php
-if (substr(PHP_OS, 0, 3) == 'WIN')
-    die("skip do not run on Windows");
-
 if (!function_exists('fnmatch'))
     die("skip fnmatch() function is not available");
 ?>
index 34cc0b8e4cf665043ce9dbc3afb335e6fb93c3fa..e65bdd05553868eae86e5d7ab8ec2aba96ac60ad 100644 (file)
@@ -2,9 +2,6 @@
 Test fnmatch() function: Variations
 --SKIPIF--
 <?php
-if (substr(PHP_OS, 0, 3) == 'WIN')
-    die("skip do not run on Windows");
-
 if (!function_exists('fnmatch'))
     die("skip fnmatch() function is not available");
 ?>
@@ -18,6 +15,11 @@ if (!function_exists('fnmatch'))
 echo "*** Testing fnmatch() with file and various patterns ***\n";
 $file_name = dirname(__FILE__)."/match.tmp";
 
+/* avoid using \, it breaks the pattern */
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+    $file_name = str_replace('\\','/', $file_name);
+}
+
 fopen($file_name, "w");
 
 $pattern_arr = array(