sniper          Wed Feb 19 04:25:16 2003 EDT

  Modified files:              
    /php4/main  php_ini.c php_scandir.c php_scandir.h 
  Log:
  Fix the possible conflicts with other libs (like libc-client)
  
Index: php4/main/php_ini.c
diff -u php4/main/php_ini.c:1.114 php4/main/php_ini.c:1.115
--- php4/main/php_ini.c:1.114   Tue Feb 18 04:37:54 2003
+++ php4/main/php_ini.c Wed Feb 19 04:25:16 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_ini.c,v 1.114 2003/02/18 09:37:54 wez Exp $ */
+/* $Id: php_ini.c,v 1.115 2003/02/19 09:25:16 sniper Exp $ */
 
 /* Check CWD for php.ini */
 #define INI_CHECK_CWD
@@ -30,11 +30,10 @@
 #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 @@
                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: php4/main/php_scandir.c
diff -u php4/main/php_scandir.c:1.5 php4/main/php_scandir.c:1.6
--- php4/main/php_scandir.c:1.5 Sun Feb  2 15:26:46 2003
+++ php4/main/php_scandir.c     Wed Feb 19 04:25:16 2003
@@ -17,6 +17,8 @@
    +----------------------------------------------------------------------+
  */
 
+/* $Id: php_scandir.c,v 1.6 2003/02/19 09:25:16 sniper Exp $ */
+
 #ifdef PHP_WIN32
 #include "config.w32.h"
 #else
@@ -26,7 +28,10 @@
 #include "php_scandir.h"
 
 #ifndef HAVE_SCANDIR
+
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 
 #ifdef HAVE_DIRENT_H
 #include <dirent.h>
@@ -38,19 +43,23 @@
 
 #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 @@
        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: php4/main/php_scandir.h
diff -u php4/main/php_scandir.h:1.3 php4/main/php_scandir.h:1.4
--- php4/main/php_scandir.h:1.3 Sun Feb  2 18:09:24 2003
+++ php4/main/php_scandir.h     Wed Feb 19 04:25:16 2003
@@ -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          |
+   | [EMAIL PROTECTED] so we can mail you a copy immediately.               |
+   +----------------------------------------------------------------------+
+   | Authors: Shane Caraveo <[EMAIL PROTECTED]>                           |
+   |          Ilia Alshanetsky  <[EMAIL PROTECTED]>                        |
+   +----------------------------------------------------------------------+
+*/
+
+/* $Id: php_scandir.h,v 1.4 2003/02/19 09:25:16 sniper Exp $ */
+
+#ifndef PHP_SCANDIR_H
+#define PHP_SCANDIR_H
+
 #include <sys/types.h>
 
 #ifdef PHP_WIN32
@@ -7,14 +31,19 @@
 #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 */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to