diff options
author | Anantha Kesari H Y <hyanantha@php.net> | 2003-01-03 11:46:20 +0000 |
---|---|---|
committer | Anantha Kesari H Y <hyanantha@php.net> | 2003-01-03 11:46:20 +0000 |
commit | ad7aa57e2748400edc505c13c84e891397955f69 (patch) | |
tree | cec3af2f2449b5132aa329922f0fd3782cc5a157 | |
parent | 452389df71314d55bf207947cb51a3e90abb9283 (diff) | |
download | php-git-ad7aa57e2748400edc505c13c84e891397955f69.tar.gz |
A few New files added and some old files modified for NetWare.
-rw-r--r-- | netware/ZendEngine2.mak | 8 | ||||
-rw-r--r-- | netware/grp.h | 31 | ||||
-rw-r--r-- | netware/libpq.imp | 93 | ||||
-rw-r--r-- | netware/mktemp.c | 87 | ||||
-rw-r--r-- | netware/param.h | 20 | ||||
-rwxr-xr-x | netware/php-nw.bat | 5 | ||||
-rw-r--r-- | netware/php4apache.mak | 30 | ||||
-rw-r--r-- | netware/php4apache2filter.mak | 166 | ||||
-rw-r--r-- | netware/php4cli.mak | 163 | ||||
-rw-r--r-- | netware/phplib.imp | 38 | ||||
-rw-r--r-- | netware/phplib.mak | 118 | ||||
-rw-r--r-- | netware/phptest.ncf | 1 | ||||
-rw-r--r-- | netware/pipe.c | 329 | ||||
-rw-r--r-- | netware/pipe.h | 11 | ||||
-rw-r--r-- | netware/postgres_ext.h | 45 | ||||
-rw-r--r-- | netware/pwd.c | 86 | ||||
-rw-r--r-- | netware/pwd.h | 15 | ||||
-rw-r--r-- | netware/start.c | 73 | ||||
-rw-r--r-- | netware/sysexits.h | 114 | ||||
-rw-r--r-- | netware/time_nw.c | 246 | ||||
-rw-r--r-- | netware/time_nw.h | 57 | ||||
-rw-r--r-- | netware/tsrm.mak | 21 | ||||
-rw-r--r-- | netware/wfile.c | 17 | ||||
-rw-r--r-- | netware/wfile.h | 16 | ||||
-rw-r--r-- | netware/zend.mak | 45 |
25 files changed, 1668 insertions, 167 deletions
diff --git a/netware/ZendEngine2.mak b/netware/ZendEngine2.mak index caa52c8693..effd309835 100644 --- a/netware/ZendEngine2.mak +++ b/netware/ZendEngine2.mak @@ -3,7 +3,7 @@ PROJECT_ROOT = .. # Module details -MODULE_NAME = Zend +MODULE_NAME = ZEND #include the common settings include $(PROJECT_ROOT)/netware/common.mif @@ -63,10 +63,10 @@ C_FLAGS = -c -maxerrors 25 -msgstyle std C_FLAGS += -wchar_t on -bool on C_FLAGS += -processor Pentium C_FLAGS += -nostdinc -C_FLAGS += -relax_pointers # To remove the type-casting errors +C_FLAGS += -relax_pointers # To remove type-casting errors C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED -C_FLAGS += -DNETWARE -C_FLAGS += -DZTS +C_FLAGS += -DNETWARE -DZTS +C_FLAGS += -DNEW_LIBC C_FLAGS += -DCLIB_STAT_PATCH C_FLAGS += -DTHREAD_SWITCH diff --git a/netware/grp.h b/netware/grp.h new file mode 100644 index 0000000000..e7a99327e2 --- /dev/null +++ b/netware/grp.h @@ -0,0 +1,31 @@ +/* pwd.h - Try to approximate UN*X's getuser...() functions under MS-DOS. + Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Header$ + */ + +/* This 'implementation' is conjectured from the use of this functions in + the RCS and BASH distributions. Of course these functions don't do too + much useful things under MS-DOS, but using them avoids many "#ifdef + MSDOS" in ported UN*X code ... */ + +struct group { + char *gr_name; /* group name */ + char *gr_passwd; /* group password */ + int gr_gid; /* group id */ + char **gr_mem; /* group members */ +}; diff --git a/netware/libpq.imp b/netware/libpq.imp new file mode 100644 index 0000000000..922679f07e --- /dev/null +++ b/netware/libpq.imp @@ -0,0 +1,93 @@ + lo_open, + lo_close, + lo_read, + lo_write, + lo_lseek, + lo_creat, + lo_tell, + lo_unlink, + lo_import, + lo_export, + PQconnectdb, + PQconnectStart, + PQconndefaults, + PQsetdbLogin, + PQconnectPoll, + PQfinish, + PQreset, + PQresetStart, + PQresetPoll, + PQrequestCancel, + PQconninfoFree, + PQdb, + PQuser, + PQpass, + PQhost, + PQport, + PQtty, + PQoptions, + PQstatus, + PQerrorMessage, + PQsocket, + PQbackendPID, + PQclientEncoding, + PQsetClientEncoding, + PQtrace, + PQuntrace, + PQsetNoticeProcessor, + PQmakeEmptyPGresult, + PQclear, + PQsendQuery, + PQconsumeInput, + PQisBusy, + PQgetResult, + PQexec, + PQnotifies, + PQgetline, + PQgetlineAsync, + PQputline, + PQputnbytes, + PQendcopy, + PQfn, + PQresultStatus, + PQresStatus, + PQresultErrorMessage, + PQntuples, + PQnfields, + PQbinaryTuples, + PQfname, + PQfnumber, + PQftype, + PQfsize, + PQfmod, + PQcmdStatus, + PQoidStatus, + PQoidValue, + PQcmdTuples, + PQgetvalue, + PQgetlength, + PQgetisnull, + PQsetnonblocking, + PQisnonblocking, + PQflush, + PQmblen, + PQenv2encoding, + PQprint, + PQdisplayTuples, + PQprintTuples, + pg_valid_client_encoding, + pg_valid_server_encoding, + pg_char_to_encname_struct, + pg_char_to_encoding, + pg_encoding_to_char, + createPQExpBuffer, + initPQExpBuffer, + destroyPQExpBuffer, + termPQExpBuffer, + resetPQExpBuffer, + enlargePQExpBuffer, + printfPQExpBuffer, + appendPQExpBuffer, + appendPQExpBufferStr, + appendPQExpBufferChar, + appendBinaryPQExpBuffer diff --git a/netware/mktemp.c b/netware/mktemp.c new file mode 100644 index 0000000000..b6d8e92593 --- /dev/null +++ b/netware/mktemp.c @@ -0,0 +1,87 @@ + +#include <string.h> +#include <errno.h> +#include <unistd.h> + + +/* Based on standard ANSI C mktemp() for NetWare */ +char* mktemp(char* templateStr) +{ + char* pXs = NULL; + char numBuf[50] = {'\0'}; + int count = 0; + char* pPid = NULL; + + char termChar = '\0'; + char letter = 'a'; + char letter1 = 'a'; + + if (templateStr && (pXs = strstr(templateStr, "XXXXXX"))) + { + /* Generate temp name */ + termChar = pXs[6]; + ltoa(NXThreadGetId(), numBuf, 16); + numBuf[strlen(numBuf)-1] = '\0'; + + /* + Beware! thread IDs are 8 hex digits on NW 4.11 and only the + lower digits seem to change, whereas on NW 5 they are in the + range of < 1000 hex or 3 hex digits in length. So the following + logic ensures we use the least significant portion of the number.\ + */ + if (strlen(numBuf) > 5) + pPid = &numBuf[strlen(numBuf)-5]; + else + pPid = numBuf; + + /* + Temporary files, as the name suggests, are temporarily used and then + cleaned up after usage. In the case of complex scripts, new temp files + may be created before the old ones are deleted. So, we need to have + a provision to create many temp files. It is found that provision for + 26 files may not be enough in such cases. Hence the logic below. + + The logic below allows 26 files (like, pla00015.tmp through plz00015.tmp) + plus 6x26=676 (like, plaa0015.tmp through plzz0015.tmp) + */ + letter = 'a'; + do + { + sprintf(pXs, (char *)"%c%05.5s", letter, pPid); + pXs[6] = termChar; + + if (access(templateStr, 0) != 0) + return templateStr; /* File does not exist */ + + letter++; + } while (letter <= 'z'); + + letter1 = 'a'; + do + { + letter = 'a'; + + do + { + sprintf(pXs, (char *)"%c%c%04.5s", letter1, letter, pPid); + pXs[6] = termChar; + + if (access(templateStr, 0) != 0) + return templateStr; /* File does not exist */ + + letter++; + } while (letter <= 'z'); + + letter1++; + } while (letter1 <= 'z'); + + errno = ENOENT; + return NULL; + } + else + { + errno = EINVAL; + return NULL; + } +} + diff --git a/netware/param.h b/netware/param.h new file mode 100644 index 0000000000..aa879d035f --- /dev/null +++ b/netware/param.h @@ -0,0 +1,20 @@ + +/***************************************************************************** + * * + * sys/param.c * + * * + * Freely redistributable and modifiable. Use at your own risk. * + * * + * Copyright 1994 The Downhill Project * + * * + *****************************************************************************/ +#ifndef MAXPATHLEN +/*#define MAXPATHLEN _MAX_PATH*/ +#define MAXPATHLEN 260 /* _MAX_PATH defined in STDLIB.H for Windows; picked up the value from there */ +#define _MAX_PATH 260 /* Defined since it is used in os.c while compiling apache */ +#endif +#define MAXHOSTNAMELEN 64 +#define howmany(x,y) (((x)+((y)-1))/(y)) +#define roundup(x,y) ((((x)+((y)-1))/(y))*(y)) + +#define _MAX_VOLUME 31 /* Defined since it is used in os.c while compiling apache. The value picked up from LibC */ diff --git a/netware/php-nw.bat b/netware/php-nw.bat index 42fe820317..3d2b59d8a8 100755 --- a/netware/php-nw.bat +++ b/netware/php-nw.bat @@ -3,13 +3,8 @@ REM CodeWarrior stuff set path=%path%;P:\APPS\SCRIPT\SW\CW71-4\BIN -REM Cygwin stuff -REM set path=%path%;R:\SCRIPT\PHP\CYGWIN\BIN -REM set CYGWIN=R:\SCRIPT\PHP\CYGWIN - REM Tools for building Zend set path=%path%;P:\APPS\SCRIPT\SW\GNUWIN32\BIN REM Build options -REM set BUILD=release setbuild r 1 diff --git a/netware/php4apache.mak b/netware/php4apache.mak index 0fb977841d..5573941b43 100644 --- a/netware/php4apache.mak +++ b/netware/php4apache.mak @@ -4,9 +4,9 @@ PROJECT_ROOT = ../.. # Module details MODULE_NAME = mod_php -MODULE_DESC = "PHP 4.x.x for NetWare - mod_php" -VMAJ = 0 -VMIN = 90 +MODULE_DESC = "PHP 4.3 - Apache 1.3 Module" +VMAJ = 3 +VMIN = 0 VREV = 0 #include the common settings @@ -19,7 +19,8 @@ include $(PROJECT_ROOT)/netware/common.mif # Source files C_SRC = mod_php4.c \ php_apache.c \ - sapi_apache.c + sapi_apache.c \ + libpre.c # Destination directories and files OBJ_DIR = $(BUILD) @@ -37,18 +38,18 @@ endif # Compile flags C_FLAGS = -c -maxerrors 25 -msgstyle gcc C_FLAGS += -wchar_t on -bool on -C_FLAGS += -processor Pentium -align 1 +C_FLAGS += -processor Pentium C_FLAGS += -w nounusedarg -msext on C_FLAGS += -nostdinc -C_FLAGS += -DNETWARE -D__GNUC__ +C_FLAGS += -relax_pointers # To remove type-casting errors +C_FLAGS += -DNETWARE C_FLAGS += -DZTS C_FLAGS += -DNLM_PLATFORM C_FLAGS += -DN_PLAT_NLM -DNLM=1 -D__NO_MATH_OPS C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED -DAPACHE_OS_H -DNO_USE_SIGACTION -DMULTITHREAD C_FLAGS += -DCLIB_STAT_PATCH C_FLAGS += -DNEW_LIBC -#C_FLAGS += -DUSE_WINSOCK_DIRECTLY=1 -C_FLAGS += -I. -I- -I. -I../../netware -I$(SDK_DIR)/include # ../../netware added for special SYS/STAT.H +C_FLAGS += -I. -I- -I. -I../../netware -I$(SDK_DIR)/include # ../../netware added for special SYS/STAT.H C_FLAGS += -I$(MWCIncludes) C_FLAGS += -I$(APACHE_DIR)/include -I$(APACHE_DIR)/os/netware C_FLAGS += -I- -I../../main -I../../Zend -I../../TSRM -I../../ext/standard @@ -60,7 +61,7 @@ C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include ifeq '$(BUILD)' 'debug' SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -sym internal -DDEBUGGING -DDKFBPON - C_FLAGS += -r -DZEND_DEBUG + C_FLAGS += -r -DZEND_DEBUG=1 C_FLAGS += -exc cw LD_FLAGS += -sym on -sym codeview4 -sym internal -osym $(SYM_FILE) LD_FLAGS += -msgstyle std @@ -77,7 +78,7 @@ endif MODULE = LibC \ phplib IMPORT = @$(SDK_DIR)/imports/libc.imp \ - @$(APACHE_DIR)/os/netware/apachecore.imp \ + @$(PROJECT_ROOT)/netware/apachecore.imp \ @$(PROJECT_ROOT)/netware/phplib.imp EXPORT = php4_module @@ -108,7 +109,7 @@ $(OBJ_DIR)/%.obj: %.c @$(CC) $< $(C_FLAGS) -o $@ -$(BINARY): $(DEPDS) $(OBJECTS) +$(BINARY): $(OBJECTS) @echo Import $(IMPORT) > $(basename $@).def ifdef API @echo Import $(API) >> $(basename $@).def @@ -125,18 +126,21 @@ endif @echo Start _lib_start >> $(basename $@).def @echo Exit _lib_stop >> $(basename $@).def + $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc + @echo xdcdata $(basename $@).xdc >> $(basename $@).def + @echo Linking $@... @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link ifdef LIBRARY @echo $(LIBRARY) >> $(basename $@).link endif - @echo $(OBJECTS) $(APACHE_DIR)/os/netware/libpre.obj >> $(basename $@).link + @echo $(OBJECTS) >> $(basename $@).link @$(LINK) @$(basename $@).link .PHONY: clean -clean: cleand cleanobj cleanbin +clean: cleanobj cleanbin .PHONY: cleand cleand: diff --git a/netware/php4apache2filter.mak b/netware/php4apache2filter.mak new file mode 100644 index 0000000000..99e8e24534 --- /dev/null +++ b/netware/php4apache2filter.mak @@ -0,0 +1,166 @@ +# Temporarily here -- later may go into some batch file +# which will set this as an environment variable +PROJECT_ROOT = ../.. + +# Module details +MODULE_NAME = mod_php +MODULE_DESC = "PHP 4.3 - Apache 2.0 Module" +VMAJ = 3 +VMIN = 0 +VREV = 0 + +#include the common settings +include $(PROJECT_ROOT)/netware/common.mif + +# Extensions of all input and output files +.SUFFIXES: +.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d + +# Source files +C_SRC = apache_config.c \ + php_functions.c \ + sapi_apache2.c + +# Destination directories and files +OBJ_DIR = $(BUILD) +FINAL_DIR = $(BUILD) +MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map +OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.obj) $(C_SRC:.c=.obj)) +DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.d) $(C_SRC:.c=.d)) + +# Binary file +ifndef BINARY +BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm +endif + + +# Compile flags +C_FLAGS += -c -maxerrors 25 -msgstyle gcc +C_FLAGS += -wchar_t on -bool on +C_FLAGS += -processor Pentium +C_FLAGS += -w nounusedarg -msext on +C_FLAGS += -nostdinc +C_FLAGS += -relax_pointers # To remove type-casting errors +C_FLAGS += -DNETWARE +C_FLAGS += -DZTS +C_FLAGS += -DNLM_PLATFORM +C_FLAGS += -DN_PLAT_NLM -DNLM=1 -D__NO_MATH_OPS +C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED -DAPACHE_OS_H -DNO_USE_SIGACTION -DMULTITHREAD +C_FLAGS += -DCLIB_STAT_PATCH +C_FLAGS += -DNEW_LIBC +C_FLAGS += -I. -I- -I. -I../../netware -I$(SDK_DIR)/include # ../../netware added for special SYS/STAT.H +C_FLAGS += -I$(SDK_DIR)/include/winsock # For Apache 2.0 headers +C_FLAGS += -I$(MWCIncludes) +C_FLAGS += -I$(APACHE_DIR)/include +C_FLAGS += -I- -I../../main -I../../Zend -I../../TSRM -I../../ext/standard +C_FLAGS += -I../../ -I../../netware -I$(PROJECT_ROOT)/regex +C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include + + +# Extra stuff based on debug / release builds +ifeq '$(BUILD)' 'debug' + SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym + C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -sym internal -DDEBUGGING -DDKFBPON + C_FLAGS += -r -DZEND_DEBUG=1 + C_FLAGS += -exc cw + LD_FLAGS += -sym on -sym codeview4 -sym internal -osym $(SYM_FILE) + LD_FLAGS += -msgstyle std + export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib +else + C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -DZEND_DEBUG=0 + C_FLAGS += -opt intrinsics + C_FLAGS += -opt level=4 + LD_FLAGS += -sym off + export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib +endif + +# Dependencies +MODULE = LibC \ + phplib +IMPORT = @$(SDK_DIR)/imports/libc.imp \ + @$(APACHE_DIR)/lib/httpd.imp \ + @$(APACHE_DIR)/lib/aprlib.imp \ + @$(PROJECT_ROOT)/netware/phplib.imp +EXPORT = php4_module + + +# Virtual paths +vpath %.cpp . +vpath %.c . +vpath %.obj $(OBJ_DIR) + + +all: prebuild project + +.PHONY: all + +prebuild: + @if not exist $(OBJ_DIR) md $(OBJ_DIR) + +project: $(BINARY) $(MESSAGE) + @echo Build complete. + + +$(OBJ_DIR)/%.d: %.c + @echo Building Dependencies for $(<F) + @$(CC) -M $< $(C_FLAGS) -o $@ + +$(OBJ_DIR)/%.obj: %.c + @echo Compiling $?... + @$(CC) $< $(C_FLAGS) -o $@ + + +$(BINARY): $(OBJECTS) + @echo Import $(IMPORT) > $(basename $@).def +ifdef API + @echo Import $(API) >> $(basename $@).def +endif + @echo Module $(MODULE) >> $(basename $@).def +ifdef EXPORT + @echo Export $(EXPORT) >> $(basename $@).def +endif + @echo AutoUnload >> $(basename $@).def +ifeq '$(BUILD)' 'debug' + @echo Debug >> $(basename $@).def +endif + @echo Flag_On 0x00000008 >> $(basename $@).def + @echo Start _lib_start >> $(basename $@).def + @echo Exit _lib_stop >> $(basename $@).def + + $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc + @echo xdcdata $(basename $@).xdc >> $(basename $@).def + + @echo Linking $@... + @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link +ifdef LIBRARY + @echo $(LIBRARY) >> $(basename $@).link +endif + @echo $(OBJECTS) $(APACHE_DIR)/lib/libpre.obj >> $(basename $@).link + + @$(LINK) @$(basename $@).link + + +.PHONY: clean +clean: cleanobj cleanbin + +.PHONY: cleand +cleand: + @echo Deleting all dependency files... + -@del "$(OBJ_DIR)\*.d" + +.PHONY: cleanobj +cleanobj: + @echo Deleting all object files... + -@del "$(OBJ_DIR)\*.obj" + +.PHONY: cleanbin +cleanbin: + @echo Deleting binary files... + -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm" + @echo Deleting MAP, DEF files, etc.... + -@del "$(FINAL_DIR)\$(MODULE_NAME).map" + -@del "$(FINAL_DIR)\$(MODULE_NAME).def" + -@del "$(FINAL_DIR)\$(MODULE_NAME).link" +ifeq '$(BUILD)' 'debug' + -@del $(FINAL_DIR)\$(MODULE_NAME).sym +endif diff --git a/netware/php4cli.mak b/netware/php4cli.mak new file mode 100644 index 0000000000..941ed586a8 --- /dev/null +++ b/netware/php4cli.mak @@ -0,0 +1,163 @@ +# Temporarily here -- later may go into some batch file +# which will set this as an environment variable +PROJECT_ROOT = ../.. + +# Module details +MODULE_NAME = php +MODULE_DESC = "PHP 4.2.3 - Command Line Interface" +VMAJ = 2 +VMIN = 0 +VREV = 0 + +#include the common settings +include $(PROJECT_ROOT)/netware/common.mif + +# Extensions of all input and output files +.SUFFIXES: +.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d + +# Source files +C_SRC = getopt.c \ + php_cli.c + +# Library files +LIBRARY = + +# Destination directories and files +OBJ_DIR = $(BUILD) +FINAL_DIR = $(BUILD) +MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map +OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.obj) $(C_SRC:.c=.obj)) +DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.d) $(C_SRC:.c=.d)) + +# Binary file +ifndef BINARY + BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm +endif + + +# Compile flags +C_FLAGS += -c -maxerrors 25 -msgstyle gcc +C_FLAGS += -wchar_t on -bool on +C_FLAGS += -processor Pentium +C_FLAGS += -w nounusedarg -msext on +C_FLAGS += -nostdinc +C_FLAGS += -relax_pointers # To remove type-casting errors +C_FLAGS += -DNETWARE -DTHREAD_SWITCH +C_FLAGS += -DZTS +C_FLAGS += -DNLM_PLATFORM +C_FLAGS += -DN_PLAT_NLM -DNLM=1 -D__NO_MATH_OPS +C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED -DAPACHE_OS_H -DNO_USE_SIGACTION -DMULTITHREAD +C_FLAGS += -DNEW_LIBC +C_FLAGS += -I. -I- -I. -I../../netware -I$(SDK_DIR)/include # ../../netware added for special SYS/STAT.H +C_FLAGS += -I$(MWCIncludes) +C_FLAGS += -I- -I../../main -I../../Zend -I../../TSRM -I../../ext/standard +C_FLAGS += -I../../ -I../../netware -I$(PROJECT_ROOT)/regex +C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include + +# Extra stuff based on debug / release builds +ifeq '$(BUILD)' 'debug' + SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym + C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -sym internal -DDEBUGGING -DDKFBPON + C_FLAGS += -r -DZEND_DEBUG=1 + C_FLAGS += -exc cw + LD_FLAGS += -sym on -sym codeview4 -sym internal -osym $(SYM_FILE) + export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib +else + C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -DZEND_DEBUG=0 + C_FLAGS += -opt intrinsics + C_FLAGS += -opt level=4 + LD_FLAGS += -sym off + export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib +endif + + +# Dependencies +MODULE = LibC \ + phplib +IMPORT = @$(SDK_DIR)/imports/libc.imp \ + @$(PROJECT_ROOT)/netware/phplib.imp +EXPORT = +API = + + +# Virtual paths +vpath %.cpp . +vpath %.c . +vpath %.obj $(OBJ_DIR) + + +all: prebuild project + +.PHONY: all + +prebuild: + @if not exist $(OBJ_DIR) md $(OBJ_DIR) + +project: $(BINARY) $(MESSAGE) + @echo Build complete. + + +$(OBJ_DIR)/%.d: %.c + @echo Building Dependencies for $(<F) + @$(CC) -M $< $(C_FLAGS) -o $@ + +$(OBJ_DIR)/%.obj: %.c + @echo Compiling $?... + @$(CC) $< $(C_FLAGS) -o $@ + + +$(BINARY): $(OBJECTS) + @echo Import $(IMPORT) > $(basename $@).def +ifdef API + @echo Import $(API) >> $(basename $@).def +endif + @echo Module $(MODULE) >> $(basename $@).def +ifdef EXPORT + @echo Export $(EXPORT) >> $(basename $@).def +endif + @echo AutoUnload >> $(basename $@).def +ifeq '$(BUILD)' 'debug' + @echo Debug >> $(basename $@).def +endif + @echo Flag_On 0x00000008 >> $(basename $@).def + @echo Start _LibCPrelude >> $(basename $@).def + @echo Exit _LibCPostlude >> $(basename $@).def + + $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc + @echo xdcdata $(basename $@).xdc >> $(basename $@).def + + @echo Linking $@... + @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link +ifdef LIBRARY + @echo $(LIBRARY) >> $(basename $@).link +endif + @echo $(OBJECTS) >> $(basename $@).link + + @$(LINK) @$(basename $@).link + + +.PHONY: clean +clean: cleanobj cleanbin + +.PHONY: cleand +cleand: + @echo Deleting all dependency files... + -@del "$(OBJ_DIR)\*.d" + +.PHONY: cleanobj +cleanobj: + @echo Deleting all object files... + -@del "$(OBJ_DIR)\*.obj" + +.PHONY: cleanbin +cleanbin: + @echo Deleting binary files... + -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm" + @echo Deleting MAP, DEF files, etc.... + -@del "$(FINAL_DIR)\$(MODULE_NAME).map" + -@del "$(FINAL_DIR)\$(MODULE_NAME).def" + -@del "$(FINAL_DIR)\$(MODULE_NAME).link" +ifeq '$(BUILD)' 'debug' + -@del $(FINAL_DIR)\$(MODULE_NAME).sym +endif diff --git a/netware/phplib.imp b/netware/phplib.imp index a653554310..fdee6f1efe 100644 --- a/netware/phplib.imp +++ b/netware/phplib.imp @@ -1,9 +1,12 @@ _array_init, _convert_to_string, +_ecalloc, _efree, _emalloc, +_erealloc, _estrdup, _estrndup, +_object_and_properties_init, _object_init, _object_init_ex, _persist_alloc, @@ -13,6 +16,7 @@ _zend_list_delete, _zend_list_find, _zval_copy_ctor, _zval_dtor, +_zval_ptr_dtor, add_assoc_long_ex, add_index_null, add_index_long, @@ -25,10 +29,14 @@ add_next_index_bool, add_next_index_long, add_next_index_string, add_next_index_stringl, +add_next_index_zval, add_property_long_ex, add_property_string_ex, +call_user_function, compiler_globals_id, convert_to_boolean, +convert_to_array, +convert_to_double, convert_to_long, core_globals_id, display_ini_entries, @@ -41,16 +49,21 @@ get_active_function_name, highlight_file, le_index_ptr, module_registry, +multi_convert_to_long_ex, open_file_for_scanning, -_object_and_properties_init, php_addslashes, +php_check_open_basedir, php_checkuid, php_execute_script, +php_file_le_fopen, php_fopen_primary_script, +php_fopen_wrapper, +php_fread_all, php_handle_aborted_connection, php_handle_special_queries, php_body_write, php_end_ob_buffers, +php_error_docref0, php_get_current_user, php_get_highlight_struct, php_handle_auth_data, @@ -68,30 +81,46 @@ php_module_shutdown, php_module_shutdown_for_exec, php_module_shutdown_wrapper, php_module_startup, +php_ob_set_internal_handler, php_output_activate, php_output_set_status, php_output_startup, php_print_info, php_printf, +php_regfree, php_register_variable, php_request_shutdown, php_request_shutdown_for_exec, php_request_startup, +php_sig_gif, +php_sig_jpg, +php_sig_png, +php_start_ob_buffer, +php_strip_tags, +php_strip_url_passwd, +php_stripslashes, php_strlcpy, php_strtolower, +php_strtoupper, +php_write, +sapi_add_header_ex, sapi_free_header, sapi_get_default_content_type, sapi_globals_id, sapi_shutdown, sapi_startup, +second_arg_force_ref, ts_allocate_id, ts_resource_ex, tsrm_shutdown, tsrm_startup, +virtual_filepath, virtual_fopen, zend_alter_ini_entry, zend_error, +zend_eval_string, zend_execute_scripts, +zend_extensions, zend_fetch_resource, zend_get_parameters_ex, zend_hash_add_or_update, @@ -106,6 +135,7 @@ zend_hash_get_current_data_ex, zend_hash_index_find, zend_hash_index_update_or_next_insert, zend_hash_init, +zend_hash_init_ex, zend_hash_internal_pointer_reset_ex zend_hash_merge_ex, zend_hash_move_forward_ex, @@ -113,13 +143,16 @@ zend_hash_num_elements, zend_highlight, zend_ini_deactivate, zend_ini_boolean_displayer_cb, +zend_ini_string, zend_list_insert, zend_llist_add_element, zend_llist_apply, +zend_llist_apply_with_argument, zend_llist_destroy, zend_llist_init, zend_load_extension, zend_parse_parameters, +zend_parse_parameters_ex, zend_printf, zend_register_ini_entries, zend_register_internal_class, @@ -128,8 +161,11 @@ zend_register_long_constant, zend_register_resource, zend_startup_module, zend_standard_class_def, +zend_strip, zend_unregister_ini_entries, zend_wrong_param_count, +zval_add_ref, +OnUpdateBool, OnUpdateInt, OnUpdateString, OnUpdateStringUnempty diff --git a/netware/phplib.mak b/netware/phplib.mak index d7f3904939..7d70e0e666 100644 --- a/netware/phplib.mak +++ b/netware/phplib.mak @@ -3,11 +3,11 @@ PROJECT_ROOT = . # Module details -MODULE_NAME = phplib -MODULE_DESC = "PHP 4.0.8 for NetWare (Beta) - PHP Library" -VMAJ = 0 -VMIN = 60 -VREV = 1 +MODULE_NAME = PHPLIB +MODULE_DESC = "PHP 4.3 - Script Interpreter and Library" +VMAJ = 3 +VMIN = 0 +VREV = 0 #include the common settings include $(PROJECT_ROOT)/netware/common.mif @@ -58,11 +58,14 @@ C_SRC = ext/bcmath/bcmath.c \ ext/pcre/pcrelib/get.c \ ext/pcre/pcrelib/maketables.c \ ext/pcre/pcrelib/pcre.c \ + ext/pcre/pcrelib/pcreposix.c \ ext/pcre/pcrelib/study.c \ ext/session/mod_files.c \ + ext/session/mod_mm.c \ ext/session/mod_user.c \ ext/session/session.c \ ext/snmp/snmp.c \ + ext/standard/aggregation.c \ ext/standard/array.c \ ext/standard/assert.c \ ext/standard/base64.c \ @@ -70,6 +73,7 @@ C_SRC = ext/bcmath/bcmath.c \ ext/standard/browscap.c \ ext/standard/crc32.c \ ext/standard/credits.c \ + ext/standard/css.c \ ext/standard/cyr_convert.c \ ext/standard/datetime.c \ ext/standard/dir.c \ @@ -81,6 +85,7 @@ C_SRC = ext/bcmath/bcmath.c \ ext/standard/flock_compat.c \ ext/standard/formatted_print.c \ ext/standard/fsock.c \ + ext/standard/ftok.c \ ext/standard/ftp_fopen_wrapper.c \ ext/standard/head.c \ ext/standard/html.c \ @@ -105,6 +110,7 @@ C_SRC = ext/bcmath/bcmath.c \ ext/standard/rand.c \ ext/standard/reg.c \ ext/standard/scanf.c \ + ext/standard/sha1.c \ ext/standard/soundex.c \ ext/standard/string.c \ ext/standard/strnatcmp.c \ @@ -114,9 +120,12 @@ C_SRC = ext/bcmath/bcmath.c \ ext/standard/url_scanner.c \ ext/standard/url_scanner_ex.c \ ext/standard/var.c \ + ext/standard/var_unserializer.c \ + ext/standard/versioning.c \ main/fopen_wrappers.c \ main/internal_functions_nw.c \ main/main.c \ + main/memory_streams.c \ main/mergesort.c \ main/network.c \ main/output.c \ @@ -124,6 +133,7 @@ C_SRC = ext/bcmath/bcmath.c \ main/php_ini.c \ main/php_logos.c \ main/php_open_temporary_file.c \ + main/php_sprintf.c \ main/php_ticks.c \ main/php_variables.c \ main/reentrancy.c \ @@ -131,42 +141,35 @@ C_SRC = ext/bcmath/bcmath.c \ main/safe_mode.c \ main/SAPI.c \ main/snprintf.c \ + main/spprintf.c \ + main/streams.c \ main/strlcat.c \ main/strlcpy.c \ - netware/env.c \ + main/user_streams.c \ netware/geterrnoptr.c \ netware/mktemp.c \ netware/pipe.c \ netware/pwd.c \ - netware/sendmail.c \ netware/start.c \ + netware/time_nw.c \ netware/wfile.c \ regex/regcomp.c \ regex/regerror.c \ regex/regexec.c \ regex/regfree.c \ # ext/standard/crypt.c \ -# ext/xml/xml.c \ # ext/com/COM.c \ # ext/com/conversion.c \ -# ext/ldap/ldap.c \ # ext/odbc/php_odbc.c \ # ext/snmp/winsnmp.c \ # netware/winutil.c \ -# ext/mysql/php_mysql.c \ -# ext/standard/syslog.c \ # netware/registry.c \ -# netware/time_nw.c \ -# netware/wsyslog.c -# ext/xml/expat/xmlparse/hashtable.c \ -# ext/xml/expat/xmlparse/xmlparse.c \ -# ext/xml/expat/xmltok/xmlrole.c \ -# ext/xml/expat/xmltok/xmltok.c \ -# ext/xml/expat/xmltok/xmltok_impl.c \ -# ext/xml/expat/xmltok/xmltok_ns.c \ +# main/alloca.c \ # ext/wddx/wddx.c \ # netware/readdir.c \ +WIN32_C_SRC = sendmail.c \ + CPP_SRC_NODIR = $(notdir $(CPP_SRC)) C_SRC_NODIR = $(notdir $(C_SRC)) @@ -174,14 +177,13 @@ SRC_DIR = $(dir $(CPP_SRC) $(C_SRC)) # Library files LIBRARY = $(PROJECT_ROOT)/Zend/$(BUILD)/Zend.lib $(PROJECT_ROOT)/TSRM/$(BUILD)/TSRM.lib -LIBRARY += $(PROJECT_ROOT)/win32build/lib/resolv.lib -#LIBRARY += libmysql.lib # Destination directories and files OBJ_DIR = $(BUILD) FINAL_DIR = $(BUILD) MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map OBJECTS = $(join $(SRC_DIR), $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj))) +WIN32_OBJECTS = $(addprefix $(OBJ_DIR)/,$(WIN32_C_SRC:.c=.obj)) DEPDS = $(join $(SRC_DIR), $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d))) # Binary file @@ -192,36 +194,35 @@ endif # Compile flags C_FLAGS += -c -maxerrors 25 -msgstyle gcc C_FLAGS += -wchar_t on -bool on +C_FLAGS += -relax_pointers # To remove type-casting errors C_FLAGS += -processor Pentium C_FLAGS += -nostdinc -nosyspath C_FLAGS += -DNETWARE -D__BIT_TYPES_DEFINED__ -DZTS -#C_FLAGS += -DZEND_DEBUG C_FLAGS += -DPHP4DLLTS_EXPORTS -DPHP_EXPORTS -DLIBZEND_EXPORTS -DTSRM_EXPORTS -DSAPI_EXPORTS C_FLAGS += -DHAVE_SYS_TIME_H -DHAVE_STRUCT_FLOCK -DVIRTUAL_DIR -DHAVE_TZNAME C_FLAGS += -DHAVE_DLFCN_H -DHAVE_LIBDL -#C_FLAGS += -DCOMPILE_DL_LDAP +C_FLAGS += -DCLIB_STAT_PATCH # stat patch C_FLAGS += -DNEW_LIBC -DHAVE_ARPA_INET_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_INET_ATON=1 -#C_FLAGS += -DUSE_WINSOCK -DUSE_WINSOCK_DIRECTLY=1 -C_FLAGS += -I. -Imain -Inetware -Iregex -I./bindlib_w32 -IZend -ITSRM + +C_FLAGS += -DLINK_SIZE=2 # Added for the new definition in ext\pcre\pcrelib\internal.h +# Below added for the file ext\pcre\pcrelib\pcreposix.c and +# the default value is what is defined in the changelog file +C_FLAGS += -DPOSIX_MALLOC_THRESHOLD=5 + +C_FLAGS += -I. -Imain -Inetware -Iregex -IZend -ITSRM C_FLAGS += -Iext/standard -Iext/mcal -Iext/pcre -Iext/pcre/pcrelib C_FLAGS += -Iext/bcmath -Iext/bcmath/libbcmath/src -#C_FLAGS += -Iext/ldap -C_FLAGS += -Iext/xml -Iext/xml/expat/xmltok -Iext/xml/expat -Iext/xml/expat/xmlparse C_FLAGS += -Iext/odbc -Iext/session -Iext/ftp -Iext/wddx -Iext/calendar -Iext/snmp -#C_FLAGS += -Iext/mysql -Iext/mysql/libmysql -#C_FLAGS += -I- -Inetware -I$(SDK_DIR)/sdk -I$(MWCIncludes) # netware added for special SYS/STAT.H : Venkat(6/2/02) C_FLAGS += -I- -Inetware -I$(SDK_DIR)/include -I$(MWCIncludes) # netware added for special SYS/STAT.H : Venkat(6/2/02) - -C_FLAGS += -I$(SDK_DIR)/include/winsock # Added for socket calls : Ananth (16 Aug 2002) - -#C_FLAGS += -I$(LDAP_DIR)/inc +C_FLAGS += -Iwin32 +C_FLAGS += -I$(SDK_DIR)/include/winsock # Added for socket calls # Extra stuff based on debug / release builds ifeq '$(BUILD)' 'debug' SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym C_FLAGS += -inline smart -sym on -sym codeview4 -sym internal -opt off -opt intrinsics - C_FLAGS += -D_DEBUG -DZEND_DEBUG=1 #-r + C_FLAGS += -D_DEBUG -DZEND_DEBUG=1 LD_FLAGS += -sym codeview4 -sym internal -osym $(SYM_FILE) export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib else @@ -244,7 +245,7 @@ API = NXGetEnvCount \ # Virtual paths vpath %.cpp . -vpath %.c . +vpath %.c . win32 vpath %.obj $(OBJ_DIR) @@ -255,23 +256,16 @@ all: prebuild project prebuild: @if not exist main\$(OBJ_DIR) md main\$(OBJ_DIR) @if not exist regex\$(OBJ_DIR) md regex\$(OBJ_DIR) - @if not exist bindlib_w32\$(OBJ_DIR) md bindlib_w32\$(OBJ_DIR) @if not exist netware\$(OBJ_DIR) md netware\$(OBJ_DIR) @if not exist ext\standard\$(OBJ_DIR) md ext\standard\$(OBJ_DIR) @if not exist ext\bcmath\$(OBJ_DIR) md ext\bcmath\$(OBJ_DIR) @if not exist ext\bcmath\libbcmath\src\$(OBJ_DIR) md ext\bcmath\libbcmath\src\$(OBJ_DIR) @if not exist ext\mcal\$(OBJ_DIR) md ext\mcal\$(OBJ_DIR) - @if not exist ext\mysql\$(OBJ_DIR) md ext\mysql\$(OBJ_DIR) - @if not exist ext\mysql\libmysql\$(OBJ_DIR) md ext\mysql\libmysql\$(OBJ_DIR) @if not exist ext\pcre\$(OBJ_DIR) md ext\pcre\$(OBJ_DIR) @if not exist ext\pcre\pcrelib\$(OBJ_DIR) md ext\pcre\pcrelib\$(OBJ_DIR) @if not exist ext\odbc\$(OBJ_DIR) md ext\odbc\$(OBJ_DIR) - @if not exist ext\xml\$(OBJ_DIR) md ext\xml\$(OBJ_DIR) - @if not exist ext\xml\expat\xmlparse\$(OBJ_DIR) md ext\xml\expat\xmlparse\$(OBJ_DIR) - @if not exist ext\xml\expat\xmltok\$(OBJ_DIR) md ext\xml\expat\xmltok\$(OBJ_DIR) @if not exist ext\session\$(OBJ_DIR) md ext\session\$(OBJ_DIR) @if not exist ext\ftp\$(OBJ_DIR) md ext\ftp\$(OBJ_DIR) -# @if not exist ext\ldap\$(OBJ_DIR) md ext\ldap\$(OBJ_DIR) @if not exist ext\wddx\$(OBJ_DIR) md ext\wddx\$(OBJ_DIR) @if not exist ext\calendar\$(OBJ_DIR) md ext\calendar\$(OBJ_DIR) @if not exist ext\snmp\$(OBJ_DIR) md ext\snmp\$(OBJ_DIR) @@ -293,11 +287,9 @@ project: $(BINARY) $(MESSAGE) @echo $(wordlist 61, 80, $(C_FLAGS)) >> $(basename $(OBJ_DIR)\$(notdir $@)).cfg @$(CC) $< @$(basename $(OBJ_DIR)\$(notdir $@)).cfg -o $@ @del $(basename $(OBJ_DIR)\$(notdir $@)).cfg -# @$(CC) $< $(C_FLAGS) -o $@ -#$(BINARY): $(DEPDS) $(OBJECTS) $(LIBRARY) -$(BINARY): $(OBJECTS) $(LIBRARY) +$(BINARY): $(OBJECTS) $(WIN32_OBJECTS) $(LIBRARY) @echo Import $(IMPORT) > $(basename $@).def ifdef API @echo Import $(API) >> $(basename $@).def @@ -311,8 +303,10 @@ ifeq '$(BUILD)' 'debug' @echo Debug >> $(basename $@).def endif @echo Flag_On 0x00000008 >> $(basename $@).def - @echo Start _NonAppStart >> $(basename $@).def - @echo Exit _NonAppStop >> $(basename $@).def +# @echo Start _NonAppStart >> $(basename $@).def +# @echo Exit _NonAppStop >> $(basename $@).def + @echo Start _LibCPrelude >> $(basename $@).def + @echo Exit _LibCPostlude >> $(basename $@).def $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc @echo xdcdata $(basename $@).xdc >> $(basename $@).def @@ -339,61 +333,57 @@ endif @echo $(wordlist 111, 115, $(OBJECTS)) >> $(basename $@).link @echo $(wordlist 116, 120, $(OBJECTS)) >> $(basename $@).link @echo $(wordlist 121, 125, $(OBJECTS)) >> $(basename $@).link - @echo $(wordlist 126, 127, $(OBJECTS)) >> $(basename $@).link -# @echo $(wordlist 126, 134, $(OBJECTS)) >> $(basename $@).link + @echo $(wordlist 126, 130, $(OBJECTS)) >> $(basename $@).link + @echo $(wordlist 131, 135, $(OBJECTS)) >> $(basename $@).link + @echo $(wordlist 136, 140, $(OBJECTS)) >> $(basename $@).link + + @echo $(wordlist 1, 2, $(WIN32_OBJECTS)) >> $(basename $@).link @$(LINK) @$(basename $@).link .PHONY: clean -clean: cleand cleanobj cleanbin +clean: cleansrc cleanobj cleanbin .PHONY: cleand cleand: @echo Deleting all dependency files... -@del "main\$(OBJ_DIR)\*.d" -@del "regex\$(OBJ_DIR)\*.d" - -@del "..\bindlib_w32\$(OBJ_DIR)\*.d" -@del "netware\$(OBJ_DIR)\*.d" -@del "ext\standard\$(OBJ_DIR)\*.d" -@del "ext\bcmath\$(OBJ_DIR)\*.d" -@del "ext\bcmath\libbcmath\src\$(OBJ_DIR)\*.d" -# -@del "ext\ldap\$(OBJ_DIR)\*.d" -@del "ext\mcal\$(OBJ_DIR)\*.d" - -@del "ext\mysql\$(OBJ_DIR)\*.d" - -@del "ext\mysql\libmysql\$(OBJ_DIR)\*.d" -@del "ext\pcre\$(OBJ_DIR)\*.d" -@del "ext\pcre\pcrelib\$(OBJ_DIR)\*.d" -@del "ext\odbc\$(OBJ_DIR)\*.d" - -@del "ext\xml\$(OBJ_DIR)\*.d" - -@del "ext\xml\expat\xmlparse\$(OBJ_DIR)\*.d" - -@del "ext\xml\expat\xmltok\$(OBJ_DIR)\*.d" -@del "ext\session\$(OBJ_DIR)\*.d" -@del "ext\ftp\$(OBJ_DIR)\*.d" -@del "ext\wddx\$(OBJ_DIR)\*.d" -@del "ext\calendar\$(OBJ_DIR)\*.d" -@del "ext\snmp\$(OBJ_DIR)\*.d" +.PHONY: cleansrc +cleansrc: + @echo Deleting all generated source files... + -@del "ext\standard\parsedate.c" + -@del "ext\standard\parsedate.h" + -@del "ext\standard\parsedate.output" + .PHONY: cleanobj cleanobj: @echo Deleting all object files... -@del "main\$(OBJ_DIR)\*.obj" -@del "regex\$(OBJ_DIR)\*.obj" - -@del "..\bindlib_w32\$(OBJ_DIR)\*.obj" -@del "netware\$(OBJ_DIR)\*.obj" -@del "ext\standard\$(OBJ_DIR)\*.obj" -@del "ext\bcmath\$(OBJ_DIR)\*.obj" -@del "ext\bcmath\libbcmath\src\$(OBJ_DIR)\*.obj" -# -@del "ext\ldap\$(OBJ_DIR)\*.obj" -@del "ext\mcal\$(OBJ_DIR)\*.obj" - -@del "ext\mysql\$(OBJ_DIR)\*.obj" - -@del "ext\mysql\libmysql\$(OBJ_DIR)\*.obj" -@del "ext\pcre\$(OBJ_DIR)\*.obj" -@del "ext\pcre\pcrelib\$(OBJ_DIR)\*.obj" -@del "ext\odbc\$(OBJ_DIR)\*.obj" - -@del "ext\xml\$(OBJ_DIR)\*.obj" - -@del "ext\xml\expat\xmlparse\$(OBJ_DIR)\*.obj" - -@del "ext\xml\expat\xmltok\$(OBJ_DIR)\*.obj" -@del "ext\session\$(OBJ_DIR)\*.obj" -@del "ext\ftp\$(OBJ_DIR)\*.obj" -@del "ext\wddx\$(OBJ_DIR)\*.obj" diff --git a/netware/phptest.ncf b/netware/phptest.ncf new file mode 100644 index 0000000000..9cb599e194 --- /dev/null +++ b/netware/phptest.ncf @@ -0,0 +1 @@ +php -q run-tests.php > results.txt
\ No newline at end of file diff --git a/netware/pipe.c b/netware/pipe.c new file mode 100644 index 0000000000..c302fdf3e0 --- /dev/null +++ b/netware/pipe.c @@ -0,0 +1,329 @@ +/* + * FILENAME : pipe.c + * DESCRIPTION : Functions to implement pipes on NetWare. + * Author : Anantha Kesari H Y, Venkat Raghavan S, Srivathsa M + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "netware/pipe.h" +#include "netware/mktemp.h" + + +/* Following definitions unavailable in LibC, hence borrowed from CLib */ +#define P_WAIT 0 +#define P_NOWAIT 1 + +#define WHITESPACE " \t" +#define MAX_ARGS 10 + + +FILE* popen(const char* commandline, const char* mode) +{ + int err, count; + char pszPipestr[32] = {'\0'}; + char *command = NULL, *argv[MAX_ARGS] = {'\0'}; + int fd = -1; + fd_set myfds; + wiring_t wiring; + pid_t pid=0; + FILE *fp=NULL; + char *ptr = NULL; + int ptrLen = 0, argc = 0, i = 0; + + + /* Get a temporary name */ + (void) tmpnam(strecpy(pszPipestr, "PHP/php$pipe/")); + + wiring.infd=FD_UNUSED; + wiring.outfd=FD_UNUSED; + wiring.errfd=FD_UNUSED; + + /* Open a pipe */ + if ( *mode=='r') { + fd = pipe_open (pszPipestr, O_RDONLY); + if (fd == -1) + return NULL; + + wiring.outfd=fd; + } else if (*mode=='w') { + fd = pipe_open (pszPipestr, O_WRONLY); + if (fd == -1) + return NULL; + + wiring.infd=fd; + } else { + consoleprintf ("Unsupported pipe open mode \n"); + return NULL; + } + + /* Get the file pointer */ + fp = fdopen(fd, mode); + if (fp == NULL) { + consoleprintf ("Failure in fdopen \n"); + close (fd); + return NULL; + } + + /* Separate commandline string into words */ + ptr = strtok((char*)commandline, WHITESPACE); + ptrLen = strlen(ptr); + + /* Get the command */ + command = (char*)malloc(ptrLen + 1); + if(command == NULL) { + consoleprintf ("Failure in memory allocation \n"); + close (fd); + fclose (fp); + return NULL; + } + strcpy (command, ptr); + + /* Command as the first argument into prcessve */ + argv[argc] = (char*)malloc(ptrLen + 1); + if(argv[argc] == NULL) { + consoleprintf ("Failure in memory allocation \n"); + close (fd); + fclose (fp); + if(command) { + free(command); + command = NULL; + } + return NULL; + } + strcpy (argv[argc], ptr); + argc++; + + /* Get more arguments if any to be passed to prcessve */ + ptr = strtok(NULL, WHITESPACE); + while (ptr && (argc < MAX_ARGS)) + { + ptrLen = strlen(ptr); + + argv[argc] = (char*)malloc(ptrLen + 1); + if(argv[argc] == NULL) { + consoleprintf ("Failure in memory allocation \n"); + close (fd); + fclose (fp); + if(command) { + free(command); + command = NULL; + } + return NULL; + } + strcpy (argv[argc], ptr); + argc++; + + ptr = strtok(NULL, WHITESPACE); + } + argv[argc] = NULL; + + FD_ZERO(&myfds); + FD_SET(fd, &myfds); + + pid = processve(command, PROC_CURRENT_SPACE, NULL, &wiring, + &myfds, NULL, (const char **)argv ); + if (pid == -1) { + consoleprintf ("Failure in processve call \n"); + close (fd); + fclose(fp); + if(command) { + free(command); + command = NULL; + } + for(i=0; i<argc; i++) { + if(argv[i]) { + free(argv[i]); + argv[i] = NULL; + } + } + return NULL; + } + + close (fd); + if(command) { + free(command); + command = NULL; + } + for(i=0; i<argc; i++) { + if(argv[i]) { + free(argv[i]); + argv[i] = NULL; + } + } + + return fp; +} + + +int pclose(FILE* stream) +{ + fclose(stream); + return 0; +} + + + +#if 0 + +FILE* popen2(const char* commandline, const char* mode) +{ + int err, count, var, replaced; + char **env, pszPipestr[32]; + NXVmId_t newVM; + NXExecEnvSpec_t envSpec; + char *command = NULL, *argv[MAX_ARGS] = {"\0"}; + NXHandle_t fd; + + fd = (NXHandle_t) -1; + + count = NXGetEnvCount() + 1; // (add one for NULL) + env = (char **) NXMemAlloc(sizeof(char *) * count, 0); + + if (!env) + return 0; + + err = NXCopyEnv(env, count); // ensure NULL added at end + if ( *mode='r'){ + (void) tmpnam(strecpy(pszPipestr, "PHPPIPE/stdin/")); + err = NXFifoOpen(0, pszPipestr, NX_O_RDONLY, 0, &fd); + if (err) + return 0; + + envSpec.esStdin.ssType = NX_OBJ_CONSOLE; + envSpec.esStdout.ssType = NX_OBJ_FIFO; + envSpec.esStdout.ssPath = pszPipestr; + } + else if (*mode='w') then{ + (void) tmpnam(strecpy(pszPipestr, "PHPPIPE/stdout/")); + err = NXFifoOpen(0, instr, NX_O_WRONLY, 0, &fd); + if (err) + return 0; + envSpec.esStdin.ssType = NX_OBJ_FIFO; + envSpec.esStdout.ssType = NX_OBJ_CONSOLE; + envSpec.esStdin.ssPath = pszPipestr; + } + else + consoleprintf ("Unsupported pipe open mode \n"); + + + /* Separate commandline string into words */ + + ptr = strtok((char*)commandline, WHITESPACE); + ptrLen = strlen(ptr); + + command = (char*)malloc(ptrLen + 1); + strcpy (command, ptr); + + ptr = strtok(NULL, WHITESPACE); + while (ptr && (argc < MAX_ARGS)) + { + ptrLen = strlen(ptr); + + argv[argc] = (char*)malloc(ptrLen + 1); + strcpy (argv[argc], ptr); + + argc++; + + ptr = strtok(NULL, WHITESPACE); + } +/* consoleprintf ("PHP | popen: command = %s\n", command); */ + + // + + envSpec.esArgc = argc; + envSpec.esArgv = argv; + envSpec.esEnv = env; + + envSpec.esStderr.ssType = NX_OBJ_CONSOLE; + + envSpec.esStdin.ssHandle = + envSpec.esStdout.ssHandle = + envSpec.esStderr.ssHandle = -1; + + envSpec.esStdin.ssPathCtx = + envSpec.esStdout.ssPathCtx = + envSpec.esStderr.ssPathCtx = NULL; + + envSpec.esStderr.ssPath = NULL; + + err = NXVmSpawn(NULL, command, &envSpec, NX_VM_CREATE_DETACHED, &newVM); + return fd; + +} + +int pclose2(FILE* stream) +{ + NXClose(*(NXHandle_t *)stream); + return 0; +} + +FILE* popen1(const char* commandline, const char* mode) +{ + char *command = NULL, *argv[MAX_ARGS] = {"\0"}; + char *tempName = "phpXXXXXX.tmp"; + char *filePath = NULL; + FILE *fp = NULL; + char *ptr = NULL; + int ptrLen = 0, argc = 0, i = 0; + + /* Check for validity of input parameters */ + if (!commandline || !mode) + return NULL; + + /* Get temporary file name */ + filePath = mktemp(tempName); + if (!filePath) + return NULL; + + /* Separate commandline string into words */ + + ptr = strtok((char*)commandline, WHITESPACE); + ptrLen = strlen(ptr); + + command = (char*)malloc(ptrLen + 1); + strcpy (command, ptr); + + ptr = strtok(NULL, WHITESPACE); + while (ptr && (argc < MAX_ARGS)) + { + ptrLen = strlen(ptr); + + argv[argc] = (char*)malloc(ptrLen + 1); + strcpy (argv[argc], ptr); + + argc++; + + ptr = strtok(NULL, WHITESPACE); + } +/*consoleprintf ("PHP | popen: command = %s\n", command);*/ + if(strchr(mode,'r') != 0) + { + /*spawnvp(P_WAIT, command, argv);*/ + + fp = fopen(filePath, "r"); /* Get the file handle of the pipe */ + } + else if(strchr(mode,'w') != 0) + fp = fopen(filePath, "w"); /* Get the file handle of the pipe */ + + /* Free resources */ + free (command); + for (i = 0; i < argc; i++) + { +/*consoleprintf ("%s\t", argv[i]);*/ + free (argv[i]); + } +/*consoleprintf ("\n");*/ + + return fp; /* Return the file handle.*/ +} + +int pclose1(FILE* stream) +{ + return (fclose(stream)); +} + +# endif diff --git a/netware/pipe.h b/netware/pipe.h new file mode 100644 index 0000000000..a54c8bf915 --- /dev/null +++ b/netware/pipe.h @@ -0,0 +1,11 @@ + +/* pipe related function declarations */ + +/*#include <unistd.h>*/ +#include <proc.h> +#include <fcntl.h> +#include <sys/select.h> + + +FILE* popen(const char* command, const char* mode); +int pclose(FILE* stream); diff --git a/netware/postgres_ext.h b/netware/postgres_ext.h new file mode 100644 index 0000000000..9b79a23f15 --- /dev/null +++ b/netware/postgres_ext.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * postgres_ext.h + * + * This file contains declarations of things that are visible everywhere + * in PostgreSQL *and* are visible to clients of frontend interface libraries. + * For example, the Oid type is part of the API of libpq and other libraries. + * + * Declarations which are specific to a particular interface should + * go in the header file for that interface (such as libpq-fe.h). This + * file is only for fundamental Postgres declarations. + * + * User-written C functions don't count as "external to Postgres." + * Those function much as local modifications to the backend itself, and + * use header files that are otherwise internal to Postgres to interface + * with the backend. + * + * $Id$ + * + *------------------------------------------------------------------------- + */ + +#ifndef POSTGRES_EXT_H +#define POSTGRES_EXT_H + +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +#define InvalidOid ((Oid) 0) + +#define OID_MAX UINT_MAX +/* you will need to include <limits.h> to use the above #define */ + + +/* + * NAMEDATALEN is the max length for system identifiers (e.g. table names, + * attribute names, function names, etc.) + * + * NOTE that databases with different NAMEDATALEN's cannot interoperate! + */ +#define NAMEDATALEN 32 + +#endif diff --git a/netware/pwd.c b/netware/pwd.c new file mode 100644 index 0000000000..41861a054f --- /dev/null +++ b/netware/pwd.c @@ -0,0 +1,86 @@ +/* pwd.c - Try to approximate UN*X's getuser...() functions under MS-DOS. + Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Header$ + */ + +/* This 'implementation' is conjectured from the use of this functions in + the RCS and BASH distributions. Of course these functions don't do too + much useful things under MS-DOS, but using them avoids many "#ifdef + MSDOS" in ported UN*X code ... */ + +#include "php.h" /*php specific */ +/* Need to take care of all the commented stuff later for NetWare */ +/* +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <lmaccess.h> +*/ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +/*#include <lmapibuf.h>*/ +#include "pwd.h" +#include "grp.h" + +#ifndef THREAD_SAFE +static struct passwd pw; /* should we return a malloc()'d structure */ +#endif +static char *home_dir = "."; /* we feel (no|every)where at home */ +static char *login_shell = "not command.com!"; + +struct passwd *getpwnam(char *name) +{ + return (struct passwd *) 0; +} + + +char *getlogin() +{ +/* + static char name[256]; + DWORD dw = 256; + GetUserName(name, &dw); + return name; +*/ + return NULL; /* For now */ +} + +struct passwd * + getpwuid(int uid) +{ + pw.pw_name = getlogin(); + pw.pw_dir = home_dir; + pw.pw_shell = login_shell; + pw.pw_uid = 0; + + return &pw; +} + +/* Implementation for now */ +int getpid() +{ + return -1; +} + +/* + * Local Variables: + * mode:C + * ChangeLog:ChangeLog + * compile-command:make + * End: + */ diff --git a/netware/pwd.h b/netware/pwd.h index 2a6ee7373b..646d5f33ac 100644 --- a/netware/pwd.h +++ b/netware/pwd.h @@ -20,15 +20,16 @@ /* This 'implementation' is conjectured from the use of this functions in the RCS and BASH distributions. Of course these functions don't do too much useful things under MS-DOS, but using them avoids many "#ifdef - MSDOS" in ported UN*X code ... */ + MSDOS" in ported UN*X code ... + */ + #ifndef PWD_H #define PWD_H -/* - Not available in LibC / SDK header or CodeWarrior header files; so taking from Winsock - definitions, which should be OK -*/ +/* Not available in LibC / SDK header or CodeWarrior header files. + * So taking from Winsock definitions, which should be OK + */ typedef unsigned int DWORD; struct passwd { @@ -46,4 +47,8 @@ extern struct passwd *getpwuid(int); extern struct passwd *getpwnam(char *name); extern char *getlogin(void); +#ifndef NEW_LIBC +int getpid(); +#endif + #endif diff --git a/netware/start.c b/netware/start.c index dcb1643a52..903aef6ed2 100644 --- a/netware/start.c +++ b/netware/start.c @@ -21,14 +21,14 @@ #include <netware.h> #include <nks/synch.h> -void *gLibHandle = (void *) NULL; +void *gLibHandle = (void *) NULL; rtag_t gAllocTag = (rtag_t) NULL; NXMutex_t *gLibLock = (NXMutex_t *) NULL; -int gLibId=0; +int gLibId = 0; + int DisposeLibraryData( void *data) { - return 0; } @@ -61,26 +61,22 @@ int _NonAppStart #pragma unused(messageCount) #pragma unused(messages) -/* -** Here we process our command line, post errors (to the error screen), -** perform initializations and anything else we need to do before being able -** to accept calls into us. If we succeed, we return non-zero and the NetWare -** Loader will leave us up, otherwise we fail to load and get dumped. -*/ -// gAllocTag = AllocateResourceTag(NLMHandle, -// "<library-name> memory allocations", AllocSignature); - -// if (!gAllocTag) -// { -// OutputToScreen(errorScreen, "Unable to allocate resource tag for " -// "library memory allocations.\n"); -// return -1; -// } - +/* Here we process our command line, post errors (to the error screen), + * perform initializations and anything else we need to do before being able + * to accept calls into us. If we succeed, we return non-zero and the NetWare + * Loader will leave us up, otherwise we fail to load and get dumped. + */ +/** + gAllocTag = AllocateResourceTag(NLMHandle, + "<library-name> memory allocations", AllocSignature); + if (!gAllocTag) { + OutputToScreen(errorScreen, "Unable to allocate resource tag for " + "library memory allocations.\n"); + return -1; + } +**/ gLibId = register_library(DisposeLibraryData); - - if (gLibId < -1) - { + if (gLibId == -1) { OutputToScreen(errorScreen, "Unable to register library with kernel.\n"); return -1; } @@ -88,9 +84,7 @@ int _NonAppStart gLibHandle = NLMHandle; gLibLock = NXMutexAlloc(0, 0, &liblock); - - if (!gLibLock) - { + if (!gLibLock) { OutputToScreen(errorScreen, "Unable to allocate library data lock.\n"); return -1; } @@ -101,26 +95,25 @@ int _NonAppStart void _NonAppStop( void ) { -/* -** Here we clean up any resources we allocated. Resource tags is a big part -** of what we created, but NetWare doesn't ask us to free those. -*/ +/* Here we clean up any resources we allocated. Resource tags is a big part + * of what we created, but NetWare doesn't ask us to free those. + */ (void) unregister_library(gLibId); NXMutexFree(gLibLock); } + int _NonAppCheckUnload( void ) { -/* -** This function cannot be the first in the file for if the file is linked -** first, then the check-unload function's offset will be nlmname.nlm+0 -** which is how to tell that there isn't one. When the check function is -** first in the linked objects, it is ambiguous. For this reason, we will -** put it inside this file after the stop function. -** -** Here we check to see if it's alright to ourselves to be unloaded. If not, -** we return a non-zero value. Right now, there isn't any reason not to allow -** it. -*/ +/* This function cannot be the first in the file for if the file is linked + * first, then the check-unload function's offset will be nlmname.nlm+0 + * which is how to tell that there isn't one. When the check function is + * first in the linked objects, it is ambiguous. For this reason, we will + * put it inside this file after the stop function. + * + * Here we check to see if it's alright to ourselves to be unloaded. If not, + * we return a non-zero value. Right now, there isn't any reason not to allow + * it. + */ return 0; } diff --git a/netware/sysexits.h b/netware/sysexits.h new file mode 100644 index 0000000000..37246b6e75 --- /dev/null +++ b/netware/sysexits.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sysexits.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _SYSEXITS_H +#define _SYSEXITS_H 1 + +/* + * SYSEXITS.H -- Exit status codes for system programs. + * + * This include file attempts to categorize possible error + * exit statuses for system programs, notably delivermail + * and the Berkeley network. + * + * Error numbers begin at EX__BASE to reduce the possibility of + * clashing with other exit statuses that random programs may + * already return. The meaning of the codes is approximately + * as follows: + * + * EX_USAGE -- The command was used incorrectly, e.g., with + * the wrong number of arguments, a bad flag, a bad + * syntax in a parameter, or whatever. + * EX_DATAERR -- The input data was incorrect in some way. + * This should only be used for user's data & not + * system files. + * EX_NOINPUT -- An input file (not a system file) did not + * exist or was not readable. This could also include + * errors like "No message" to a mailer (if it cared + * to catch it). + * EX_NOUSER -- The user specified did not exist. This might + * be used for mail addresses or remote logins. + * EX_NOHOST -- The host specified did not exist. This is used + * in mail addresses or network requests. + * EX_UNAVAILABLE -- A service is unavailable. This can occur + * if a support program or file does not exist. This + * can also be used as a catchall message when something + * you wanted to do doesn't work, but you don't know + * why. + * EX_SOFTWARE -- An internal software error has been detected. + * This should be limited to non-operating system related + * errors as possible. + * EX_OSERR -- An operating system error has been detected. + * This is intended to be used for such things as "cannot + * fork", "cannot create pipe", or the like. It includes + * things like getuid returning a user that does not + * exist in the passwd file. + * EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp, + * etc.) does not exist, cannot be opened, or has some + * sort of error (e.g., syntax error). + * EX_CANTCREAT -- A (user specified) output file cannot be + * created. + * EX_IOERR -- An error occurred while doing I/O on some file. + * EX_TEMPFAIL -- temporary failure, indicating something that + * is not really an error. In sendmail, this means + * that a mailer (e.g.) could not create a connection, + * and the request should be reattempted later. + * EX_PROTOCOL -- the remote system returned something that + * was "not possible" during a protocol exchange. + * EX_NOPERM -- You did not have sufficient permission to + * perform the operation. This is not intended for + * file system problems, which should use NOINPUT or + * CANTCREAT, but rather for higher level permissions. + */ + +#define EX_OK 0 /* successful termination */ + +#define EX__BASE 64 /* base value for error messages */ + +#define EX_USAGE 64 /* command line usage error */ +#define EX_DATAERR 65 /* data format error */ +#define EX_NOINPUT 66 /* cannot open input */ +#define EX_NOUSER 67 /* addressee unknown */ +#define EX_NOHOST 68 /* host name unknown */ +#define EX_UNAVAILABLE 69 /* service unavailable */ +#define EX_SOFTWARE 70 /* internal software error */ +#define EX_OSERR 71 /* system error (e.g., can't fork) */ +#define EX_OSFILE 72 /* critical OS file missing */ +#define EX_CANTCREAT 73 /* can't create (user) output file */ +#define EX_IOERR 74 /* input/output error */ +#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ +#define EX_PROTOCOL 76 /* remote error in protocol */ +#define EX_NOPERM 77 /* permission denied */ +#define EX_CONFIG 78 /* configuration error */ + +#define EX__MAX 78 /* maximum listed value */ + +#endif /* sysexits.h */ diff --git a/netware/time_nw.c b/netware/time_nw.c new file mode 100644 index 0000000000..195f18cdd9 --- /dev/null +++ b/netware/time_nw.c @@ -0,0 +1,246 @@ + +/***************************************************************************** + * * + * DH_TIME.C * + * * + * Freely redistributable and modifiable. Use at your own risk. * + * * + * Copyright 1994 The Downhill Project * + * + * Modified by Shane Caraveo for use with PHP + * + *****************************************************************************/ + +/* $Id$ */ + + /** + * + * 04-Feb-2001 + * - Added patch by "Vanhanen, Reijo" <Reijo.Vanhanen@helsoft.fi> + * Improves accuracy of msec + */ + +/* Include stuff ************************************************************ */ + +#include "time_nw.h" +#include "unistd.h" +#include "signal.h" +/*#include <winbase.h> +#include <mmsystem.h>*/ +#include <errno.h> +/* +int getfilesystemtime(struct timeval *time_Info) +{ +FILETIME ft; +__int64 ff; + + GetSystemTimeAsFileTime(&ft); *//* 100 ns blocks since 01-Jan-1641 *//* + *//* resolution seems to be 0.01 sec *//* + ff = *(__int64*)(&ft); + time_Info->tv_sec = (int)(ff/(__int64)10000000-(__int64)11644473600); + time_Info->tv_usec = (int)(ff % 10000000)/10; + return 0; +} +*/ + + +int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info) +{ +#ifdef NETWARE + return 0; +#else + static struct timeval starttime = {0, 0}; + static __int64 lasttime = 0; + static __int64 freq = 0; + __int64 timer; + LARGE_INTEGER li; + BOOL b; + double dt; + + /* Get the time, if they want it */ + if (time_Info != NULL) { + if (starttime.tv_sec == 0) { + b = QueryPerformanceFrequency(&li); + if (!b) { + starttime.tv_sec = -1; + } + else { + freq = li.QuadPart; + b = QueryPerformanceCounter(&li); + if (!b) { + starttime.tv_sec = -1; + } + else { + getfilesystemtime(&starttime); + timer = li.QuadPart; + dt = (double)timer/freq; + starttime.tv_usec -= (int)((dt-(int)dt)*1000000); + if (starttime.tv_usec < 0) { + starttime.tv_usec += 1000000; + --starttime.tv_sec; + } + starttime.tv_sec -= (int)dt; + } + } + } + if (starttime.tv_sec > 0) { + b = QueryPerformanceCounter(&li); + if (!b) { + starttime.tv_sec = -1; + } + else { + timer = li.QuadPart; + if (timer < lasttime) { + getfilesystemtime(time_Info); + dt = (double)timer/freq; + starttime = *time_Info; + starttime.tv_usec -= (int)((dt-(int)dt)*1000000); + if (starttime.tv_usec < 0) { + starttime.tv_usec += 1000000; + --starttime.tv_sec; + } + starttime.tv_sec -= (int)dt; + } + else { + lasttime = timer; + dt = (double)timer/freq; + time_Info->tv_sec = starttime.tv_sec + (int)dt; + time_Info->tv_usec = starttime.tv_usec + (int)((dt-(int)dt)*1000000); + if (time_Info->tv_usec > 1000000) { + time_Info->tv_usec -= 1000000; + ++time_Info->tv_sec; + } + } + } + } + if (starttime.tv_sec < 0) { + getfilesystemtime(time_Info); + } + + } + /* Get the timezone, if they want it */ + if (timezone_Info != NULL) { + _tzset(); + timezone_Info->tz_minuteswest = _timezone; + timezone_Info->tz_dsttime = _daylight; + } + /* And return */ + return 0; +#endif +} + + +/* this usleep isnt exactly accurate but should do ok */ +/* +void usleep(unsigned int useconds) +{ +struct timeval tnow, tthen, t0; + + gettimeofday(&tthen, NULL); + t0 = tthen; + tthen.tv_usec += useconds; + while (tthen.tv_usec > 1000000) { + tthen.tv_usec -= 1000000; + tthen.tv_sec++; + } + + if (useconds > 10000) { + useconds -= 10000; + Sleep(useconds/1000); + } + + while (1) { + gettimeofday(&tnow, NULL); + if (tnow.tv_sec > tthen.tv_sec) { + break; + } + if (tnow.tv_sec == tthen.tv_sec) { + if (tnow.tv_usec > tthen.tv_usec) { + break; + } + } + } +} +*/ + +#ifdef HAVE_SETITIMER + +/* +#ifndef THREAD_SAFE +unsigned int proftimer, virttimer, realtimer; +extern LPMSG phpmsg; +#endif + +struct timer_msg { + int signal; + unsigned int threadid; +}; + + +LPTIMECALLBACK setitimer_timeout(UINT uTimerID, UINT info, DWORD dwUser, DWORD dw1, DWORD dw2) +{ + struct timer_msg *msg = (struct timer_msg *) info; + + if (msg) { + raise((int) msg->signal); + PostThreadMessage(msg->threadid, + WM_NOTIFY, msg->signal, 0); + free(msg); + } + return 0; +} + +int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue) +{ + int timeout = value->it_value.tv_sec * 1000 + value->it_value.tv_usec; + int repeat = TIME_ONESHOT; +*/ + /*make sure the message queue is initialized *//* + PeekMessage(phpmsg, NULL, WM_USER, WM_USER, PM_NOREMOVE); + if (timeout > 0) { + struct timer_msg *msg = malloc(sizeof(struct timer_msg)); + msg->threadid = GetCurrentThreadId(); + if (!ovalue) { + repeat = TIME_PERIODIC; + } + switch (which) { + case ITIMER_REAL: + msg->signal = SIGALRM; + realtimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat); + break; + case ITIMER_VIRT: + msg->signal = SIGVTALRM; + virttimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat); + break; + case ITIMER_PROF: + msg->signal = SIGPROF; + proftimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat); + break; + default: + errno = EINVAL; + return -1; + break; + } + } else { + switch (which) { + case ITIMER_REAL: + timeKillEvent(realtimer); + break; + case ITIMER_VIRT: + timeKillEvent(virttimer); + break; + case ITIMER_PROF: + timeKillEvent(proftimer); + break; + default: + errno = EINVAL; + return -1; + break; + } + } + + + return 0; +} +*/ +#endif diff --git a/netware/time_nw.h b/netware/time_nw.h new file mode 100644 index 0000000000..c67065fdf2 --- /dev/null +++ b/netware/time_nw.h @@ -0,0 +1,57 @@ +/***************************************************************************** + * * + * sys/time.h * + * * + * Freely redistributable and modifiable. Use at your own risk. * + * * + * Copyright 1994 The Downhill Project * + * + * Modified by Shane Caraveo for PHP + * + *****************************************************************************/ +#ifndef TIME_H +#define TIME_H + +/* Include stuff ************************************************************ */ +#ifdef USE_WINSOCK +/*#include <ws2nlm.h>*/ +#include <novsock2.h> +#else +#include <sys/socket.h> +#endif +#include <time.h> + +/* +Commented out most of the stuff for now, since we dunno the utility right now +*/ + +/* Struct stuff ************************************************************* */ +/* +struct { + int tz_minuteswest; + int tz_dsttime; +} timezone; +*/ +/* +struct { + struct timeval it_interval; *//* next value *//* + struct timeval it_value; *//* current value *//* +} itimerval; +*/ +#define ITIMER_REAL 0 /*generates sigalrm */ +#define ITIMER_VIRTUAL 1 /*generates sigvtalrm */ +#define ITIMER_VIRT 1 /*generates sigvtalrm */ +#define ITIMER_PROF 2 /*generates sigprof */ + +/* Prototype stuff ********************************************************** */ +/* +extern int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info); +*/ + +/* setitimer operates at 100 millisecond resolution */ +/* +extern int setitimer(int which, const struct itimerval *value, + struct itimerval *ovalue); +*/ + +#endif diff --git a/netware/tsrm.mak b/netware/tsrm.mak index 94603934dc..d0088ecb4a 100644 --- a/netware/tsrm.mak +++ b/netware/tsrm.mak @@ -5,8 +5,6 @@ PROJECT_ROOT = .. # Module details MODULE_NAME = TSRM -#MODULE_ROOT = $(PROJECT_ROOT)\\$(MODULE_NAME) - #include the common settings include $(PROJECT_ROOT)/netware/common.mif @@ -17,9 +15,9 @@ include $(PROJECT_ROOT)/netware/common.mif # Source files CPP_SRC = C_SRC = TSRM.c \ + tsrm_nw.c \ tsrm_strtok_r.c \ - tsrm_virtual_cwd.c \ - tsrm_nw.c + tsrm_virtual_cwd.c # Destination directories and files OBJ_DIR = $(BUILD) @@ -35,16 +33,19 @@ endif # Compile flags C_FLAGS = -c -maxerrors 25 -msgstyle gcc C_FLAGS += -wchar_t on -bool on -C_FLAGS += -processor Pentium -align 1 +C_FLAGS += -processor Pentium C_FLAGS += -nostdinc -C_FLAGS += -DZTS -DNETWARE -DHAVE_DIRENT_H -#C_FLAGS += -DUSE_PIPE_OPEN +C_FLAGS += -relax_pointers # To remove type-casting errors +C_FLAGS += -DZTS -DNETWARE -DHAVE_DIRENT_H=1 +C_FLAGS += -DNEW_LIBC C_FLAGS += -DUSE_MKFIFO -C_FLAGS += -DCLIB_STAT_PATCH -DUSE_MPK +C_FLAGS += -DCLIB_STAT_PATCH +#C_FLAGS += -DUSE_MPK # To use the LibC recursive mutex locking C_FLAGS += -I. -I- -I../netware -I$(SDK_DIR)/include # ../netware added for special SYS/STAT.H C_FLAGS += -I$(MPK_DIR)/include1 C_FLAGS += -I$(MWCIncludes) + # Link flags LD_FLAGS = -type library LD_FLAGS += -o $(BINARY) @@ -84,13 +85,13 @@ $(OBJ_DIR)/%.obj: %.c @echo Compiling $?... @$(CC) $< $(C_FLAGS) -o $@ -$(BINARY): $(DEPDS) $(OBJECTS) +$(BINARY): $(OBJECTS) @echo Linking $@... @$(LINK) $(LD_FLAGS) $(OBJECTS) .PHONY: clean -clean: cleand cleanobj cleanbin +clean: cleanobj cleanbin .PHONY: cleand cleand: diff --git a/netware/wfile.c b/netware/wfile.c new file mode 100644 index 0000000000..a887ee93df --- /dev/null +++ b/netware/wfile.c @@ -0,0 +1,17 @@ + +/* Function borrowed from the Downhill Project */ +#include "wfile.h" +/*#include "direct.h"*/ /* Can't find this file */ + +int readlink(char *file_Name, char *buf_Mem, int buf_Size) +{ + /* See if the file exists */ + if (access(file_Name, X_OK) == -1) { + errno = ENOENT; + } else { + errno = EINVAL; + } + + /* Either way, it's not a link */ + return -1; +} diff --git a/netware/wfile.h b/netware/wfile.h new file mode 100644 index 0000000000..7a9614c2cf --- /dev/null +++ b/netware/wfile.h @@ -0,0 +1,16 @@ +/*#include <io.h> */ +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> + +#define access _access +#define X_OK 0 +#ifndef ENOENT +#define ENOENT 136 +#endif +#ifndef EINVAL +#define EINVAL 131 +#endif + +int readlink(char *, char *, int); +int checkroot(char *path); diff --git a/netware/zend.mak b/netware/zend.mak index 5181cc0fa4..77b1074808 100644 --- a/netware/zend.mak +++ b/netware/zend.mak @@ -5,8 +5,6 @@ PROJECT_ROOT = .. # Module details MODULE_NAME = ZEND -#MODULE_ROOT = $(PROJECT_ROOT)\\$(MODULE_NAME) - #include the common settings include $(PROJECT_ROOT)/netware/common.mif @@ -28,8 +26,13 @@ C_SRC = zend.c \ zend_highlight.c \ zend_indent.c \ zend_ini.c \ + zend_ini_parser.c \ + zend_ini_scanner.c \ + zend_language_parser.c \ + zend_language_scanner.c \ zend_list.c \ zend_llist.c \ + zend_multibyte.c \ zend_opcode.c \ zend_operators.c \ zend_ptr_stack.c \ @@ -37,11 +40,7 @@ C_SRC = zend.c \ zend_sprintf.c \ zend_stack.c \ zend_static_allocator.c \ - zend_variables.c \ - zend_ini_parser.c \ - zend_ini_scanner.c \ - zend_language_parser.c \ - zend_language_scanner.c + zend_variables.c # Destination directories and files @@ -59,16 +58,23 @@ endif # Compile flags C_FLAGS = -c -maxerrors 25 -msgstyle std C_FLAGS += -wchar_t on -bool on -C_FLAGS += -processor Pentium -align 1 +C_FLAGS += -processor Pentium C_FLAGS += -nostdinc +C_FLAGS += -relax_pointers # To remove type-casting errors C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED -C_FLAGS += -DNETWARE -D__GNUC__ -C_FLAGS += -DZTS +C_FLAGS += -DNETWARE -DZTS +C_FLAGS += -DNEW_LIBC C_FLAGS += -DCLIB_STAT_PATCH C_FLAGS += -DTHREAD_SWITCH + +# These are required to use dlclose so that the PHP extensions are automatically unloaded +# when apache is unloaded +C_FLAGS += -DHAVE_DLFCN_H -DHAVE_LIBDL + C_FLAGS += -I. -I- -I../netware -I$(SDK_DIR)/include # ../netware added for special SYS/STAT.H C_FLAGS += -I$(MWCIncludes) + # Link flags LD_FLAGS = -type library LD_FLAGS += -o $(BINARY) @@ -76,12 +82,13 @@ LD_FLAGS += -o $(BINARY) # Extra stuff based on debug / release builds ifeq '$(BUILD)' 'debug' - C_FLAGS += -DZEND_DEBUG + C_FLAGS += -DZEND_DEBUG=1 C_FLAGS += -inline smart -sym on -sym codeview4 -sym internal -opt off -opt intrinsics LD_FLAGS += -sym codeview4 -sym internal export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib else C_FLAGS += -opt speed -inline on -inline auto -sym off + C_FLAGS += -DZEND_DEBUG=0 LD_FLAGS += -sym off export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib endif @@ -104,18 +111,6 @@ project: $(BINARY) $(MESSAGE) @echo Build complete. -##zend_ini_parser.c zend_ini_parser.h : zend_ini_parser.y -## @bison --output=$@ -v -d -p ini_ zend_ini_parser.y - -##zend_ini_scanner.c : zend_ini_scanner.l -## @flex -i -Pini_ -o$@ zend_ini_scanner.l - -##zend_language_parser.c zend_language_parser.h : zend_language_parser.y -## @bison --output=$@ -v -d -p zend zend_language_parser.y - -##zend_language_scanner.c : zend_language_scanner.l -## @flex -i -Pzend -o$@ zend_language_scanner.l - $(OBJ_DIR)/%.d: %.c @echo Building Dependencies for $(<F) @$(CC) -M $< $(C_FLAGS) -o $@ @@ -125,13 +120,13 @@ $(OBJ_DIR)/%.obj: %.c @$(CC) $< $(C_FLAGS) -o $@ -$(BINARY): $(DEPDS) $(OBJECTS) +$(BINARY): $(OBJECTS) @echo Linking $@... @$(LINK) $(LD_FLAGS) $(OBJECTS) .PHONY: clean -clean: cleansrc cleand cleanobj cleanbin +clean: cleansrc cleanobj cleanbin .PHONY: cleansrc cleansrc: |