Skip to content

Commit e966a04

Browse files
author
Anantha Kesari H Y
committed
NetWare related changes/modifications.
1 parent 4bc5295 commit e966a04

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+691
-80
lines changed

ext/standard/base64.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ PHP_FUNCTION(base64_encode)
160160
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
161161
return;
162162
}
163-
result = php_base64_encode(str, str_len, &ret_length);
163+
result = php_base64_encode((const unsigned char*)str, str_len, &ret_length); /* type-casting done due to NetWare */
164164
if (result != NULL) {
165-
RETVAL_STRINGL(result, ret_length, 0);
165+
RETVAL_STRINGL((char*)result, ret_length, 0); /* type-casting done due to NetWare */
166166
} else {
167167
RETURN_FALSE;
168168
}
@@ -181,9 +181,9 @@ PHP_FUNCTION(base64_decode)
181181
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
182182
return;
183183
}
184-
result = php_base64_decode(str, str_len, &ret_length);
184+
result = php_base64_decode((const unsigned char*)str, str_len, &ret_length); /* type-casting done due to NetWare */
185185
if (result != NULL) {
186-
RETVAL_STRINGL(result, ret_length, 0);
186+
RETVAL_STRINGL((char*)result, ret_length, 0); /* type-casting done due to NetWare */
187187
} else {
188188
RETURN_FALSE;
189189
}

ext/standard/basic_functions.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@
3838
#include <stdio.h>
3939
#include <netdb.h>
4040

41+
/* Additional headers for NetWare */
42+
#ifdef NETWARE
43+
/*#include "netware/env.h"*/ /* Temporary */
44+
#ifdef NEW_LIBC /* Same headers hold good for Winsock and Berkeley sockets */
45+
#include <netinet/in.h>
46+
/*#include <arpa/inet.h>*/
47+
#include <netdb.h>
48+
#else
49+
#include <sys/socket.h>
50+
#endif
51+
#else
52+
#include <netdb.h>
53+
#endif
54+
4155
#if HAVE_ARPA_INET_H
4256
# include <arpa/inet.h>
4357
#endif
@@ -415,7 +429,7 @@ function_entry basic_functions[] = {
415429
PHP_FE(gethostbyname, NULL)
416430
PHP_FE(gethostbynamel, NULL)
417431

418-
#if HAVE_RES_SEARCH && !(defined(__BEOS__) || defined(PHP_WIN32))
432+
#if HAVE_RES_SEARCH && !(defined(__BEOS__) || defined(PHP_WIN32) || defined(NETWARE))
419433
PHP_FE(checkdnsrr, NULL)
420434
PHP_FE(getmxrr,second_and_third_args_force_ref)
421435
#else
@@ -447,7 +461,7 @@ function_entry basic_functions[] = {
447461
PHP_FE(cosh, NULL)
448462
PHP_FE(tanh, NULL)
449463

450-
#ifndef PHP_WIN32
464+
#if !defined(PHP_WIN32) && !defined(NETWARE)
451465
PHP_FE(asinh, NULL)
452466
PHP_FE(acosh, NULL)
453467
PHP_FE(atanh, NULL)
@@ -634,7 +648,7 @@ function_entry basic_functions[] = {
634648

635649
PHP_FE(socket_get_status, NULL)
636650

637-
#if (!defined(PHP_WIN32) && !defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS)
651+
#if (!defined(PHP_WIN32) && !defined(__BEOS__) && HAVE_REALPATH && !defined(NETWARE)) || defined(ZTS)
638652
PHP_FE(realpath, NULL)
639653
#else
640654
PHP_FALIAS(realpath, warn_not_available, NULL)
@@ -1001,7 +1015,9 @@ PHP_MINIT_FUNCTION(basic)
10011015
PHP_MINIT(lcg) (INIT_FUNC_ARGS_PASSTHRU);
10021016

10031017
PHP_MINIT(dir) (INIT_FUNC_ARGS_PASSTHRU);
1018+
#ifdef HAVE_SYSLOG_H
10041019
PHP_MINIT(syslog) (INIT_FUNC_ARGS_PASSTHRU);
1020+
#endif
10051021
PHP_MINIT(array) (INIT_FUNC_ARGS_PASSTHRU);
10061022
PHP_MINIT(assert) (INIT_FUNC_ARGS_PASSTHRU);
10071023
PHP_MINIT(url_scanner_ex) (INIT_FUNC_ARGS_PASSTHRU);
@@ -1082,7 +1098,9 @@ PHP_RINIT_FUNCTION(basic)
10821098
PHP_RINIT(lcg) (INIT_FUNC_ARGS_PASSTHRU);
10831099

10841100
PHP_RINIT(filestat) (INIT_FUNC_ARGS_PASSTHRU);
1101+
#ifdef HAVE_SYSLOG_H
10851102
PHP_RINIT(syslog) (INIT_FUNC_ARGS_PASSTHRU);
1103+
#endif
10861104
PHP_RINIT(dir) (INIT_FUNC_ARGS_PASSTHRU);
10871105

10881106
/* Reset magic_quotes_runtime */
@@ -1113,7 +1131,9 @@ PHP_RSHUTDOWN_FUNCTION(basic)
11131131

11141132
PHP_RSHUTDOWN(fsock) (SHUTDOWN_FUNC_ARGS_PASSTHRU);
11151133
PHP_RSHUTDOWN(filestat) (SHUTDOWN_FUNC_ARGS_PASSTHRU);
1134+
#ifdef HAVE_SYSLOG_H
11161135
PHP_RSHUTDOWN(syslog) (SHUTDOWN_FUNC_ARGS_PASSTHRU);
1136+
#endif
11171137
PHP_RSHUTDOWN(assert) (SHUTDOWN_FUNC_ARGS_PASSTHRU);
11181138

11191139
if (BG(user_tick_functions)) {

ext/standard/datetime.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ char *day_short_names[] =
5555
};
5656

5757
#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !defined(HAVE_DECLARED_TIMEZONE)
58+
#if defined(NETWARE) && (NEW_LIBC)
59+
#define timezone _timezone /* Do not know why this is called '_timezone' in new version of LibC */
60+
#endif
5861
extern time_t timezone;
5962
extern int daylight;
6063
#endif

ext/standard/dl.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "ext/standard/info.h"
2727
#include "SAPI.h"
2828

29-
#ifndef PHP_WIN32
29+
#if !defined(PHP_WIN32) && !defined(NETWARE)
3030
#include "build-defs.h"
3131
#endif
3232

@@ -43,6 +43,13 @@
4343
#include "win32/param.h"
4444
#include "win32/winutil.h"
4545
#define GET_DL_ERROR() php_win_err()
46+
#elif defined(NETWARE)
47+
#ifdef NEW_LIBC
48+
#include <sys/param.h>
49+
#else
50+
#include "netware/param.h"
51+
#endif
52+
#define GET_DL_ERROR() dlerror()
4653
#else
4754
#include <sys/param.h>
4855
#define GET_DL_ERROR() dlerror()
@@ -141,7 +148,23 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC)
141148

142149
efree(libpath);
143150

144-
151+
152+
#ifdef NETWARE
153+
/* NetWare doesn't support two NLMs exporting same symbol */
154+
{
155+
char symbol_name[64] = "\0";
156+
int module_name_length = Z_STRLEN_P(file) - 4; /* '.nlm' is 4 characters; knock it off */
157+
158+
/* Take the module name (e.g.: 'php_ldap') and append '@get_module' to it */
159+
strncpy(symbol_name, Z_STRVAL_P(file), module_name_length);
160+
symbol_name[module_name_length] = '\0';
161+
strcat(symbol_name, "@");
162+
strcat(symbol_name, "get_module");
163+
164+
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, symbol_name);
165+
}
166+
/* NetWare doesn't prepend _ to symbol names. So, that portion of code is also not necessary */
167+
#else
145168
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module");
146169

147170
/*
@@ -152,6 +175,7 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC)
152175

153176
if (!get_module)
154177
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "_get_module");
178+
#endif
155179

156180
if (!get_module) {
157181
DL_UNLOAD(handle);

ext/standard/dns.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#endif
4343
#endif
4444
#include <winsock.h>
45-
#else
45+
#else /* This holds good for NetWare too, both for Winsock and Berkeley sockets */
4646
#include <netinet/in.h>
4747
#if HAVE_ARPA_INET_H
4848
#include <arpa/inet.h>
@@ -60,6 +60,11 @@
6060
#endif
6161
#endif
6262

63+
/* Borrowed from SYS/SOCKET.H */
64+
#if defined(NETWARE) && defined(USE_WINSOCK)
65+
#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
66+
#endif
67+
6368
#include "dns.h"
6469
/* }}} */
6570

@@ -201,7 +206,7 @@ static char *php_gethostbyname(char *name)
201206
}
202207
/* }}} */
203208

204-
#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32))
209+
#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32) || defined(NETWARE))
205210

206211
/* {{{ proto int checkdnsrr(string host [, string type])
207212
Check DNS records corresponding to a given Internet host name or IP address */

ext/standard/file.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,19 @@
4747
#define O_RDONLY _O_RDONLY
4848
#include "win32/param.h"
4949
#include "win32/winutil.h"
50+
#elif defined(NETWARE) && !defined(NEW_LIBC)
51+
/*#include <ws2nlm.h>*/
52+
#include <sys/socket.h>
53+
#include "netware/param.h"
5054
#else
5155
#include <sys/param.h>
56+
#if defined(NETWARE) && defined(USE_WINSOCK)
57+
#include <novsock2.h>
58+
#else
5259
#include <sys/socket.h>
5360
#include <netinet/in.h>
5461
#include <netdb.h>
62+
#endif
5563
#if HAVE_ARPA_INET_H
5664
#include <arpa/inet.h>
5765
#endif
@@ -63,6 +71,8 @@
6371
#if HAVE_PWD_H
6472
#ifdef PHP_WIN32
6573
#include "win32/pwd.h"
74+
#elif defined(NETWARE)
75+
#include "netware/pwd.h"
6676
#else
6777
#include <pwd.h>
6878
#endif
@@ -802,7 +812,7 @@ PHPAPI int php_set_sock_blocking(int socketd, int block)
802812
int flags;
803813
int myflag = 0;
804814

805-
#ifdef PHP_WIN32
815+
#if defined(PHP_WIN32) || (defined(NETWARE) && defined(USE_WINSOCK))
806816
/* with ioctlsocket, a non-zero sets nonblocking, a zero sets blocking */
807817
flags = !block;
808818
if (ioctlsocket(socketd, FIONBIO, &flags)==SOCKET_ERROR){
@@ -2187,7 +2197,7 @@ PHP_FUNCTION(fgetcsv)
21872197
/* }}} */
21882198

21892199

2190-
#if (!defined(PHP_WIN32) && !defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS)
2200+
#if (!defined(PHP_WIN32) && !defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
21912201
/* {{{ proto string realpath(string path)
21922202
Return the resolved path */
21932203
PHP_FUNCTION(realpath)

0 commit comments

Comments
 (0)