From f1e6410401c6d067b3a66d4b246e37e61ca8f344 Mon Sep 17 00:00:00 2001 From: Anantha Kesari H Y Date: Tue, 26 Jul 2005 09:32:58 +0000 Subject: [PATCH] ext/standard/basic_functions.c Removed Redundant inclusion headers for NetWare. NetWare LibC SDK has netdb.h. ext/standard/file.c NetWare LibC sys/types.h does not include sys/select.h implicitly as it is the case with Linux LibC. So including explicitly. NetWare LibC SDK has pwd.h NetWare specific stat structure issues. ext/standard/filestat.c NetWare LibC SDK has pwd.h removing redundant CLIB_STAT_PATCH and NEW_LIBC checks ext/standard/fsock.c Removed the redundant NEW_LIBC checks ext/standard/mail.c netware/pipe.h not needed to be included anymore for NetWare Removed the netware/sysexits.h and defined the 2 relevant macros inside the NetWare section ext/standard/pack.c NetWare LibC SDK has pwd.h ext/standard/pageinfo.c NetWare LibC SDK has pwd.h. Removing redunant NEW_LIBC checks. ext/standard/rand.c NetWare LibC SDK has pwd.h. ext/standard/ftp_fopen_wrapper.c Removing redundant inclusion of headers. NetWare LibC SDK has sys/param.h ext/standard/http_fopen_wrapper.c Removing redundant inclusion of headers. NetWare LibC SDK has sys/param.h --Kamesh --- ext/standard/basic_functions.c | 11 ----------- ext/standard/file.c | 15 +++++++++------ ext/standard/filestat.c | 22 ++++++++-------------- ext/standard/fsock.c | 5 ----- ext/standard/ftp_fopen_wrapper.c | 9 --------- ext/standard/http_fopen_wrapper.c | 9 --------- ext/standard/mail.c | 4 ++-- ext/standard/pack.c | 2 -- ext/standard/pageinfo.c | 7 +------ ext/standard/rand.c | 4 ---- 10 files changed, 20 insertions(+), 68 deletions(-) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index c995c1a8fa..c0568a4f59 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -42,18 +42,7 @@ #include #include -#ifndef NETWARE #include -#else -/*#include "netware/env.h"*/ /* Temporary */ -#ifdef NEW_LIBC /* Same headers hold good for Winsock and Berkeley sockets */ -#include -/*#include */ -#include -#else -#include -#endif -#endif #if HAVE_ARPA_INET_H # include diff --git a/ext/standard/file.c b/ext/standard/file.c index 4e1e17c3c5..24a029d31f 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -49,12 +49,11 @@ #define O_RDONLY _O_RDONLY #include "win32/param.h" #include "win32/winutil.h" -#elif defined(NETWARE) && !defined(NEW_LIBC) -/*#include */ -#include -#include "netware/param.h" #else #include +#if HAVE_SYS_SELECT_H +#include +#endif #if defined(NETWARE) && defined(USE_WINSOCK) #include #else @@ -73,8 +72,6 @@ #if HAVE_PWD_H #ifdef PHP_WIN32 #include "win32/pwd.h" -#elif defined(NETWARE) -#include "netware/pwd.h" #else #include #endif @@ -2061,9 +2058,15 @@ PHP_NAMED_FUNCTION(php_if_fstat) MAKE_LONG_ZVAL_INCREF(stat_rdev, -1); #endif MAKE_LONG_ZVAL_INCREF(stat_size, stat_ssb.sb.st_size); +#ifdef NETWARE + MAKE_LONG_ZVAL_INCREF(stat_atime, stat_ssb.sb.st_atime.tv_sec); + MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_ssb.sb.st_mtime.tv_sec); + MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_ssb.sb.st_ctime.tv_sec); +#else MAKE_LONG_ZVAL_INCREF(stat_atime, stat_ssb.sb.st_atime); MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_ssb.sb.st_mtime); MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_ssb.sb.st_ctime); +#endif #ifdef HAVE_ST_BLKSIZE MAKE_LONG_ZVAL_INCREF(stat_blksize, stat_ssb.sb.st_blksize); #else diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 8a6041c660..6a11053de7 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -58,8 +58,6 @@ #if HAVE_PWD_H # ifdef PHP_WIN32 # include "win32/pwd.h" -# elif defined(NETWARE) -# include "netware/pwd.h" # else # include # endif @@ -330,8 +328,12 @@ PHP_FUNCTION(disk_free_space) } #elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS) if (statfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE; +#ifdef NETWARE + bytesfree = (((double)buf.f_bsize) * ((double)buf.f_bfree)); +#else bytesfree = (((double)buf.f_bsize) * ((double)buf.f_bavail)); #endif +#endif #endif /* WINDOWS */ RETURN_DOUBLE(bytesfree); @@ -479,11 +481,7 @@ PHP_FUNCTION(touch) { pval **filename, **filetime, **fileatime; int ret; -#if defined(NETWARE) && defined(CLIB_STAT_PATCH) - struct stat_libc sb; -#else struct stat sb; -#endif FILE *file; struct utimbuf newtimebuf; struct utimbuf *newtime = NULL; @@ -560,11 +558,7 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ { zval *stat_dev, *stat_ino, *stat_mode, *stat_nlink, *stat_uid, *stat_gid, *stat_rdev, *stat_size, *stat_atime, *stat_mtime, *stat_ctime, *stat_blksize, *stat_blocks; -#if defined(NETWARE) && defined(CLIB_STAT_PATCH) - struct stat_libc *stat_sb; -#else struct stat *stat_sb; -#endif int rmask=S_IROTH, wmask=S_IWOTH, xmask=S_IXOTH; /* access rights defaults to other */ char *stat_sb_names[13]={"dev", "ino", "mode", "nlink", "uid", "gid", "rdev", "size", "atime", "mtime", "ctime", "blksize", "blocks"}; @@ -683,19 +677,19 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ case FS_GROUP: RETURN_LONG((long)BG(sb).st_gid); case FS_ATIME: -#if defined(NETWARE) && defined(NEW_LIBC) +#ifdef NETWARE RETURN_LONG((long)(BG(sb).st_atime).tv_nsec); #else RETURN_LONG((long)BG(sb).st_atime); #endif case FS_MTIME: -#if defined(NETWARE) && defined(NEW_LIBC) +#ifdef NETWARE RETURN_LONG((long)(BG(sb).st_mtime).tv_nsec); #else RETURN_LONG((long)BG(sb).st_mtime); #endif case FS_CTIME: -#if defined(NETWARE) && defined(NEW_LIBC) +#ifdef NETWARE RETURN_LONG((long)(BG(sb).st_ctime).tv_nsec); #else RETURN_LONG((long)BG(sb).st_ctime); @@ -774,7 +768,7 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ MAKE_LONG_ZVAL_INCREF(stat_rdev, -1); #endif MAKE_LONG_ZVAL_INCREF(stat_size, stat_sb->st_size); -#if defined(NETWARE) && defined(NEW_LIBC) +#ifdef NETWARE MAKE_LONG_ZVAL_INCREF(stat_atime, (stat_sb->st_atime).tv_nsec); MAKE_LONG_ZVAL_INCREF(stat_mtime, (stat_sb->st_mtime).tv_nsec); MAKE_LONG_ZVAL_INCREF(stat_ctime, (stat_sb->st_ctime).tv_nsec); diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 72d8d453be..7bb8cd36e2 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -48,17 +48,12 @@ #ifdef PHP_WIN32 #include #elif defined(NETWARE) -#ifdef NEW_LIBC #ifdef USE_WINSOCK #include #else #include #include -/*#include */ #include -/*#else -#include */ -#endif #endif #else #include diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index d2267d3e9f..c859434254 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -35,14 +35,6 @@ #include #define O_RDONLY _O_RDONLY #include "win32/param.h" -#elif defined(NETWARE) -/*#include */ -/*#include */ -#ifdef NEW_LIBC -#include -#else -#include "netware/param.h" -#endif #else #include #endif @@ -57,7 +49,6 @@ #ifdef PHP_WIN32 #include #elif defined(NETWARE) && defined(USE_WINSOCK) -/*#include */ #include #else #include diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index c67688d300..67d45cf554 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -39,14 +39,6 @@ #include #define O_RDONLY _O_RDONLY #include "win32/param.h" -#elif defined(NETWARE) -/*#include */ -/*#include */ -#ifdef NEW_LIBC -#include -#else -#include "netware/param.h" -#endif #else #include #endif @@ -61,7 +53,6 @@ #ifdef PHP_WIN32 #include #elif defined(NETWARE) && defined(USE_WINSOCK) -/*#include */ #include #else #include diff --git a/ext/standard/mail.c b/ext/standard/mail.c index cab90301a5..03a787223c 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -42,8 +42,8 @@ #endif #ifdef NETWARE -#include "netware/pipe.h" /* For popen(), pclose() */ -#include "netware/sysexits.h" /* For exit status codes like EX_OK */ +#define EX_OK 0 /* successful termination */ +#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ #endif #define SKIP_LONG_HEADER_SEP(str, pos) \ diff --git a/ext/standard/pack.c b/ext/standard/pack.c index a34bb643c4..3aeb2d2bee 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -47,8 +47,6 @@ #if HAVE_PWD_H #ifdef PHP_WIN32 #include "win32/pwd.h" -#elif defined(NETWARE) -#include "netware/pwd.h" #else #include #endif diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c index 43e7b338fb..7c83323741 100644 --- a/ext/standard/pageinfo.c +++ b/ext/standard/pageinfo.c @@ -27,11 +27,6 @@ #if HAVE_PWD_H #ifdef PHP_WIN32 #include "win32/pwd.h" -#elif defined(NETWARE) -#ifdef ZTS -extern int basic_globals_id; -#endif -#include "netware/pwd.h" #else #include #endif @@ -77,7 +72,7 @@ PHPAPI void php_statpage(TSRMLS_D) BG(page_uid) = pstat->st_uid; BG(page_gid) = pstat->st_gid; BG(page_inode) = pstat->st_ino; -#if defined(NETWARE) && defined(NEW_LIBC) +#ifdef NETWARE BG(page_mtime) = (pstat->st_mtime).tv_nsec; #else BG(page_mtime) = pstat->st_mtime; diff --git a/ext/standard/rand.c b/ext/standard/rand.c index 686d64d263..6e73833a20 100644 --- a/ext/standard/rand.c +++ b/ext/standard/rand.c @@ -31,10 +31,6 @@ # include #endif -#if defined(NETWARE) && !defined(NEW_LIBC) /* For getpid() used below */ -#include "netware/pwd.h" -#endif - #include "php.h" #include "php_math.h" #include "php_rand.h" -- 2.50.1