#include "ext/standard/info.h"
#include "SAPI.h"
-#ifndef PHP_WIN32
+/*#ifndef PHP_WIN32*/
+#if !defined(PHP_WIN32) && !defined(NETWARE)
#include "build-defs.h"
#endif
#include <stdlib.h>
#include <stdio.h>
-#if HAVE_STRING_H
+/*#if HAVE_STRING_H*/
+#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#include "win32/param.h"
#include "win32/winutil.h"
#define GET_DL_ERROR() php_win_err()
+#elif defined(NETWARE)
+#ifdef NEW_LIBC
+#include <sys/param.h>
+#else
+#include "netware/param.h"
+#endif
+#define GET_DL_ERROR() dlerror()
#else
#include <sys/param.h>
#define GET_DL_ERROR() DL_ERROR()
efree(libpath);
-
+#ifndef NETWARE
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module");
/*
if (!get_module)
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "_get_module");
+#else
+ /* NetWare doesn't support two NLMs exporting same symbol */
+ {
+ char symbol_name[64] = "\0";
+ int module_name_length = Z_STRLEN_P(file) - 4; /* '.nlm' is 4 characters; knock it off */
+
+ /* Take the module name (e.g.: 'php_ldap') and append '@get_module' to it */
+ strncpy(symbol_name, Z_STRVAL_P(file), module_name_length);
+ symbol_name[module_name_length] = '\0';
+ strcat(symbol_name, "@");
+ strcat(symbol_name, "get_module");
+
+ get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, symbol_name);
+ }
+ /* NetWare doesn't prepend '_' to symbol names; so the corresponding portion of code is also
+ not required for NetWare */
+#endif
if (!get_module) {
DL_UNLOAD(handle);
#endif
#endif
#include <winsock.h>
-#else
+#else /* This holds good for NetWare too, both for Winsock and Berkeley sockets */
#include <netinet/in.h>
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#endif
+/* Borrowed from SYS/SOCKET.H */
+#if defined(NETWARE) && defined(USE_WINSOCK)
+#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
+#endif
+
#include "dns.h"
/* }}} */
}
/* }}} */
-#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32))
+#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32) || defined(NETWARE))
/* {{{ proto int checkdnsrr(string host [, string type])
Check DNS records corresponding to a given Internet host name or IP address */
#define O_RDONLY _O_RDONLY
#include "win32/param.h"
#include "win32/winutil.h"
+#elif defined(NETWARE) && !defined(NEW_LIBC)
+/*#include <ws2nlm.h>*/
+#include <sys/socket.h>
+#include "netware/param.h"
#else
#include <sys/param.h>
+#if defined(NETWARE) && defined(USE_WINSOCK)
+#include <novsock2.h>
+#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
+#endif
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#if HAVE_PWD_H
#ifdef PHP_WIN32
#include "win32/pwd.h"
+#elif defined(NETWARE)
+#include "netware/pwd.h"
#else
#include <pwd.h>
#endif
/* }}} */
-#if (!defined(PHP_WIN32) && !defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS)
+#if (!defined(PHP_WIN32) && !defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
/* {{{ proto string realpath(string path)
Return the resolved path */
PHP_FUNCTION(realpath)
#if HAVE_PWD_H
# ifdef PHP_WIN32
# include "win32/pwd.h"
+# elif defined(NETWARE)
+# include "netware/pwd.h"
# else
# include <pwd.h>
# endif
Change file group */
PHP_FUNCTION(chgrp)
{
-#ifndef WINDOWS
+/*#ifndef WINDOWS*/
+#if !defined(WINDOWS) && !defined(NETWARE) /* I guess 'chgrp' won't be available on NetWare */
pval **filename, **group;
gid_t gid;
struct group *gr=NULL;
Change file owner */
PHP_FUNCTION(chown)
{
-#ifndef WINDOWS
+/*#ifndef WINDOWS*/
+#if !defined(WINDOWS) && !defined(NETWARE) /* I guess 'chown' won't be available on NetWare */
pval **filename, **user;
int ret;
uid_t uid;
{
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;
{
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"};
#endif
+#ifndef NETWARE
if (type >= FS_IS_W && type <= FS_IS_X) {
if(BG(sb).st_uid==getuid()) {
rmask=S_IRUSR;
}
}
}
+#endif
switch (type) {
case FS_PERMS:
case FS_GROUP:
RETURN_LONG((long)BG(sb).st_gid);
case FS_ATIME:
- RETURN_LONG((long)BG(sb).st_atime);
+#if defined(NETWARE) && defined(NEW_LIBC)
+ RETURN_LONG((long)(BG(sb).st_atime).tv_nsec);
+#else
+ RETURN_LONG((long)BG(sb).st_atime);
+#endif
case FS_MTIME:
- RETURN_LONG((long)BG(sb).st_mtime);
+#if defined(NETWARE) && defined(NEW_LIBC)
+ RETURN_LONG((long)(BG(sb).st_mtime).tv_nsec);
+#else
+ RETURN_LONG((long)BG(sb).st_mtime);
+#endif
case FS_CTIME:
- RETURN_LONG((long)BG(sb).st_ctime);
+#if defined(NETWARE) && defined(NEW_LIBC)
+ RETURN_LONG((long)(BG(sb).st_ctime).tv_nsec);
+#else
+ RETURN_LONG((long)BG(sb).st_ctime);
+#endif
case FS_TYPE:
#if HAVE_SYMLINK
if (S_ISLNK(BG(lsb).st_mode)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown file type (%d)", BG(sb).st_mode&S_IFMT);
RETURN_STRING("unknown", 1);
case FS_IS_W:
+#ifdef NETWARE
+ RETURN_LONG(0);
+#else
if (getuid()==0) {
RETURN_TRUE; /* root */
}
RETURN_BOOL((BG(sb).st_mode & wmask) != 0);
case FS_IS_R:
+#ifdef NETWARE
+ RETURN_LONG(0);
+#else
if (getuid()==0) {
RETURN_TRUE; /* root */
}
RETURN_BOOL((BG(sb).st_mode&rmask)!=0);
case FS_IS_X:
+#ifdef NETWARE
+ RETURN_LONG(0);
+#else
if (getuid()==0) {
xmask = S_IXROOT; /* root */
}
MAKE_LONG_ZVAL_INCREF(stat_rdev, -1);
#endif
MAKE_LONG_ZVAL_INCREF(stat_size, stat_sb->st_size);
+#if defined(NETWARE) && defined(NEW_LIBC)
+ 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);
+#else
MAKE_LONG_ZVAL_INCREF(stat_atime, stat_sb->st_atime);
MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_sb->st_mtime);
MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_sb->st_ctime);
+#endif
#ifdef HAVE_ST_BLKSIZE
MAKE_LONG_ZVAL_INCREF(stat_blksize, stat_sb->st_blksize);
#else
#include <io.h>
#endif
+#ifdef NETWARE
+#ifdef NEW_LIBC
+#include <netinet/in.h>
+#else
+#include <sys/socket.h>
+#endif
+#endif
+
#ifndef HAVE_FLOCK
int flock(int fd, int operation)
#if HAVE_STRUCT_FLOCK
#endif
#ifdef PHP_WIN32
#include <winsock.h>
+#elif defined(NETWARE)
+#ifdef NEW_LIBC
+#ifdef USE_WINSOCK
+#include <novsock2.h>
+#else
+#include <netinet/in.h>
+#include <netdb.h>
+/*#include <sys/socket.h>*/
+#include <sys/select.h>
+/*#else
+#include <sys/socket.h>*/
+#endif
+#endif
#else
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#endif
#endif
-#if defined(PHP_WIN32) || defined(__riscos__)
+#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
#undef AF_UNIX
#endif
#if defined(AF_UNIX)
#ifdef PHP_WIN32
#define EWOULDBLOCK WSAEWOULDBLOCK
+#elif defined(NETWARE)
+#ifdef USE_WINSOCK
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#endif
#else
#include "build-defs.h"
#endif
#ifndef FSOCK_H
#define FSOCK_H
+#ifdef NETWARE
+#ifdef NEW_LIBC
+#include "sys/timeval.h"
+#else
+#include "netware/time_nw.h" /* For 'timeval' */
+#endif
+#endif
+
#include "file.h"
#include "php_network.h"
#include <winsock.h>
#define O_RDONLY _O_RDONLY
#include "win32/param.h"
+#elif defined(NETWARE)
+/*#include <ws2nlm.h>*/
+/*#include <sys/socket.h>*/
+#ifdef NEW_LIBC
+#include <sys/param.h>
+#else
+#include "netware/param.h"
+#endif
#else
#include <sys/param.h>
#endif
#ifdef PHP_WIN32
#include <winsock.h>
+#elif defined(NETWARE) && defined(USE_WINSOCK)
+/*#include <ws2nlm.h>*/
+#include <novsock2.h>
#else
#include <netinet/in.h>
#include <netdb.h>
#endif
#endif
-#if defined(PHP_WIN32) || defined(__riscos__)
+#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
#undef AF_UNIX
#endif
/* $Id$ */
#include <stdio.h>
+
+#if defined(NETWARE) && !defined(NEW_LIBC)
+#include <sys/socket.h>
+#endif
+
#include "php.h"
#include "ext/standard/php_standard.h"
#include "SAPI.h"
#include <winsock.h>
#define O_RDONLY _O_RDONLY
#include "win32/param.h"
+#elif defined(NETWARE)
+/*#include <ws2nlm.h>*/
+/*#include <sys/socket.h>*/
+#ifdef NEW_LIBC
+#include <sys/param.h>
+#else
+#include "netware/param.h"
+#endif
#else
#include <sys/param.h>
#endif
#ifdef PHP_WIN32
#include <winsock.h>
+#elif defined(NETWARE) && defined(USE_WINSOCK)
+/*#include <ws2nlm.h>*/
+#include <novsock2.h>
#else
#include <netinet/in.h>
#include <netdb.h>
#endif
#endif
-#if defined(PHP_WIN32) || defined(__riscos__)
+#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
#undef AF_UNIX
#endif
void * ptr TSRMLS_DC);
typedef struct _php_stream_statbuf {
+#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
+ struct stat_libc sb; /* regular info */
+#else
struct stat sb; /* regular info */
+#endif
/* extended info to go here some day: content-type etc. etc. */
} php_stream_statbuf;