]> granicus.if.org Git - php/commitdiff
Fix the possible conflicts with other libs (like libc-client)
authorfoobar <sniper@php.net>
Wed, 19 Feb 2003 09:25:16 +0000 (09:25 +0000)
committerfoobar <sniper@php.net>
Wed, 19 Feb 2003 09:25:16 +0000 (09:25 +0000)
main/php_ini.c
main/php_scandir.c
main/php_scandir.h

index 6e599ebcaf85a112bd49f29f54bf409212309a32..1288774c93d60e857f634e81fd48cb4b310d7fd1 100644 (file)
 #include "zend_highlight.h"
 #include "SAPI.h"
 #include "php_main.h"
+#include "php_scandir.h"
 
-#if !HAVE_SCANDIR || !HAVE_ALPHASORT
- #include "php_scandir.h"
-#else
- #include <dirent.h>
+#if HAVE_SCANDIR && HAVE_ALPHASORT && HAVE_DIRENT_H
+#include <dirent.h>
 #endif
 
 #ifndef S_ISREG
@@ -432,7 +431,7 @@ int php_init_config()
                struct dirent **namelist;
                int ndir, i;
 
-               if ((ndir = scandir(PHP_CONFIG_FILE_SCAN_DIR, &namelist, 0, alphasort)) > 0) {
+               if ((ndir = php_scandir(PHP_CONFIG_FILE_SCAN_DIR, &namelist, 0, php_alphasort)) > 0) {
                        for (i = 0; i < ndir; i++) {
                                /* check for a .ini extension */
                                if (!(p = strrchr(namelist[i]->d_name, '.')) || (p && strcmp(p, ".ini"))) {
index 148c8828a3357f1edb06a716519b60ed33b244e1..15d4febf4a069e1410bb192dfae88219e5cd9d36 100644 (file)
@@ -17,6 +17,8 @@
    +----------------------------------------------------------------------+
  */
 
+/* $Id$ */
+
 #ifdef PHP_WIN32
 #include "config.w32.h"
 #else
 #include "php_scandir.h"
 
 #ifndef HAVE_SCANDIR
+
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 
 #ifdef HAVE_DIRENT_H
 #include <dirent.h>
 
 #include <stdlib.h>
 #include <search.h>
-#endif
+
+#endif /* HAVE_SCANDIR */
 
 #ifndef HAVE_ALPHASORT
+
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 
-int alphasort(const struct dirent **a, const struct dirent **b)
+int php_alphasort(const struct dirent **a, const struct dirent **b)
 {
        return strcoll((*a)->d_name,(*b)->d_name);
 }
-#endif
+#endif /* HAVE_ALPHASORT */
 
 #ifndef HAVE_SCANDIR
-int scandir(const char *dirname, struct dirent **namelist[], int (*selector) (const struct dirent *entry), int (*compare) (const struct dirent **a, const struct dirent **b))
+int php_scandir(const char *dirname, struct dirent **namelist[], int (*selector) (const struct dirent *entry), int (*compare) (const struct dirent **a, const struct dirent **b))
 {
        DIR *dirp = NULL;
        struct dirent **vector = NULL;
@@ -117,3 +126,12 @@ fail:
        return -1;      
 }
 #endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: sw=4 ts=4 fdm=marker
+ * vim<600: sw=4 ts=4
+ */
index fc3b191dfbb6b593b9ea524eb721c75a5852f4d3..4a8b57ed3f31492850738f5f0ef2688d2530645e 100644 (file)
@@ -1,3 +1,27 @@
+/* 
+   +----------------------------------------------------------------------+
+   | PHP Version 4                                                        |
+   +----------------------------------------------------------------------+
+   | Copyright (c) 1997-2003 The PHP Group                                |
+   +----------------------------------------------------------------------+
+   | This source file is subject to version 2.02 of the PHP license,      |
+   | that is bundled with this package in the file LICENSE, and is        |
+   | available at through the world-wide-web at                           |
+   | http://www.php.net/license/2_02.txt.                                 |
+   | If you did not receive a copy of the PHP license and are unable to   |
+   | obtain it through the world-wide-web, please send a note to          |
+   | license@php.net so we can mail you a copy immediately.               |
+   +----------------------------------------------------------------------+
+   | Authors: Shane Caraveo <shane@caraveo.com>                           |
+   |          Ilia Alshanetsky  <ilia@prohost.org>                        |
+   +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#ifndef PHP_SCANDIR_H
+#define PHP_SCANDIR_H
+
 #include <sys/types.h>
 
 #ifdef PHP_WIN32
 #include "php_config.h"
 #endif
 
+#ifdef HAVE_SCANDIR
 #ifdef HAVE_DIRENT_H
-# include <dirent.h>
+#include <dirent.h>
 #endif
-
-#ifndef HAVE_ALPHASORT 
-int alphasort(const struct dirent **a, const struct dirent **b);
+#define php_scandir            scandir
+#else
+int php_scandir(const char *dirname, struct dirent **namelist[], int (*selector) (const struct dirent *entry), int (*compare) (const struct dirent **a, const struct dirent **b));
 #endif
 
-#ifndef HAVE_SCANDIR
-int scandir(const char *dirname, struct dirent **namelist[], int (*selector) (const struct dirent *entry), int (*compare) (const struct dirent **a, const struct dirent **b));
+#ifdef HAVE_ALPHASORT
+#define php_alphasort  alphasort
+#else
+int php_alphasort(const struct dirent **a, const struct dirent **b);
 #endif
+
+#endif /* PHP_SCANDIR_H */