home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: InfoMgt / InfoMgt.zip / php402.zip / os2.patch < prev    next >
Text File  |  2000-08-28  |  21KB  |  688 lines

  1. Index: configure.in
  2. ===================================================================
  3. RCS file: /repository/php4/configure.in,v
  4. retrieving revision 1.169
  5. diff -u -r1.169 configure.in
  6. --- configure.in    2000/08/25 08:15:08    1.169
  7. +++ configure.in    2000/08/28 08:15:42
  8. @@ -134,7 +134,7 @@
  9.  dnl paths to the targets are relative to the build directory
  10.  SAPI_PROGRAM=php
  11.  SAPI_SHARED=libs/libphp4.$SHLIB_SUFFIX_NAME
  12. -SAPI_STATIC=libs/libphp4.a
  13. +SAPI_STATIC=libs/php4.a
  14.  
  15.  PHP_CONFIGURE_PART(Configuring SAPI modules)
  16.  
  17. @@ -227,7 +227,12 @@
  18.  
  19.  AC_CHECK_LIB(crypt, crypt, [
  20.   AC_ADD_LIBRARY(crypt)
  21. - AC_DEFINE(HAVE_LIBCRYPT,1,[ ]) ], [])
  22. + AC_DEFINE(HAVE_LIBCRYPT,1,[ ]) ], [
  23. +   AC_CHECK_LIB(ufc, crypt, [
  24. +     AC_ADD_LIBRARY(ufc)
  25. +     AC_DEFINE(HAVE_LIBCRYPT,1,[ ]) 
  26. +   ])
  27. + ])
  28.  
  29.  AC_CHECK_LIB(dl, dlopen,[AC_ADD_LIBRARY(dl)])
  30.  
  31. @@ -349,6 +354,7 @@
  32.  localtime_r \
  33.  lockf \
  34.  lrand48 \
  35. +lstat \
  36.  memcpy \
  37.  memmove \
  38.  mmap \
  39. Index: build/build.mk
  40. ===================================================================
  41. RCS file: /repository/php4/build/build.mk,v
  42. retrieving revision 1.5
  43. diff -u -r1.5 build.mk
  44. --- build/build.mk    2000/08/20 05:36:07    1.5
  45. +++ build/build.mk    2000/08/28 08:15:44
  46. @@ -20,6 +20,7 @@
  47.  # Makefile to generate build tools
  48.  #
  49.  
  50. +SHELL=sh
  51.  SUBDIRS = Zend TSRM
  52.  
  53.  STAMP = buildmk.stamp
  54. Index: build/build2.mk
  55. ===================================================================
  56. RCS file: /repository/php4/build/build2.mk,v
  57. retrieving revision 1.15
  58. diff -u -r1.15 build2.mk
  59. --- build/build2.mk    2000/08/20 05:36:07    1.15
  60. +++ build/build2.mk    2000/08/28 08:15:44
  61. @@ -17,6 +17,7 @@
  62.  # $Id: build2.mk,v 1.15 2000/08/20 05:36:07 sas Exp $ 
  63.  #
  64.  
  65. +SHELL=sh
  66.  include generated_lists
  67.  
  68.  TOUCH_FILES = mkinstalldirs install-sh missing
  69. Index: build/shtool
  70. ===================================================================
  71. RCS file: /repository/php4/build/shtool,v
  72. retrieving revision 1.2
  73. diff -u -r1.2 shtool
  74. --- build/shtool    2000/05/12 07:33:55    1.2
  75. +++ build/shtool    2000/08/28 08:15:47
  76. @@ -352,7 +352,7 @@
  77.      if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[Bb]'`" != . ]; then
  78.          case $TERM in
  79.              #   for the most important terminal types we directly know the sequences
  80. -            xterm|xterm*|vt220|vt220*)
  81. +            xterm|xterm*|vt220|vt220*|ansi*)
  82.                  term_bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
  83.                  term_norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
  84.                  ;;
  85. Index: ext/mysql/php_mysql.c
  86. ===================================================================
  87. RCS file: /repository/php4/ext/mysql/php_mysql.c,v
  88. retrieving revision 1.51
  89. diff -u -r1.51 php_mysql.c
  90. --- ext/mysql/php_mysql.c    2000/07/05 20:41:06    1.51
  91. +++ ext/mysql/php_mysql.c    2000/08/28 08:15:54
  92. @@ -218,7 +218,7 @@
  93.          
  94.          MySG(default_port) = MYSQL_PORT;
  95.          if ((serv_ptr = getservbyname("mysql", "tcp"))) {
  96. -            MySG(default_port) = (uint) ntohs((ushort) serv_ptr->s_port);
  97. +            MySG(default_port) = (uint) ntohs((unsigned short) serv_ptr->s_port);
  98.          }
  99.          if ((env = getenv("MYSQL_TCP_PORT"))) {
  100.              MySG(default_port) = (uint) atoi(env);
  101. Index: ext/mysql/libmysql/global.h
  102. ===================================================================
  103. RCS file: /repository/php4/ext/mysql/libmysql/global.h,v
  104. retrieving revision 1.5
  105. diff -u -r1.5 global.h
  106. --- ext/mysql/libmysql/global.h    2000/08/22 17:59:34    1.5
  107. +++ ext/mysql/libmysql/global.h    2000/08/28 08:15:58
  108. @@ -190,8 +190,11 @@
  109.  #define min(a, b)    ((a) < (b) ? (a) : (b))
  110.  #endif
  111.  
  112. -#if defined(__EMX__) || !defined(HAVE_UINT)
  113. +#if !defined(HAVE_UINT) && !defined(uint)
  114.  typedef unsigned int uint;
  115. +#endif
  116. +
  117. +#if !defined(HAVE_USHORT) && !defined(ushort)
  118.  typedef unsigned short ushort;
  119.  #endif
  120.  
  121. @@ -504,7 +507,7 @@
  122.  error "Neither int or long is of 4 bytes width"
  123.  #endif
  124.  
  125. -#if !defined(HAVE_ULONG) && !defined(HAVE_LINUXTHREADS) && !defined(__USE_MISC)
  126. +#if !defined(HAVE_ULONG) && !defined(HAVE_LINUXTHREADS) && !defined(__USE_MISC) && !defined(ulong)
  127.  typedef unsigned long    ulong;    /* Short for unsigned long */
  128.  #endif
  129.  #ifndef longlong_defined
  130. Index: ext/mysql/libmysql/violite.c
  131. ===================================================================
  132. RCS file: /repository/php4/ext/mysql/libmysql/violite.c,v
  133. retrieving revision 1.3
  134. diff -u -r1.3 violite.c
  135. --- ext/mysql/libmysql/violite.c    2000/08/22 17:59:35    1.3
  136. +++ ext/mysql/libmysql/violite.c    2000/08/28 08:15:59
  137. @@ -21,7 +21,7 @@
  138.  
  139.  #if defined(__EMX__)
  140.  #include <sys/ioctl.h>
  141. -#define ioctlsocket(A,B,C) ioctl((A),(B),(void *)(C),sizeof(*(C)))
  142. +#define ioctlsocket(A,B,C,D) ioctl((A),(B),(void *)(C),(D))
  143.  #undef HAVE_FCNTL
  144.  #endif                /* defined(__EMX__) */
  145.  
  146. @@ -93,7 +93,7 @@
  147.      {
  148.        /* set to blocking mode by default */
  149.        ulong arg=0;
  150. -      r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg));
  151. +      ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg));
  152.      }
  153.  #endif
  154.    }
  155. Index: ext/standard/basic_functions.c
  156. ===================================================================
  157. RCS file: /repository/php4/ext/standard/basic_functions.c,v
  158. retrieving revision 1.243
  159. diff -u -r1.243 basic_functions.c
  160. --- ext/standard/basic_functions.c    2000/08/27 22:46:40    1.243
  161. +++ ext/standard/basic_functions.c    2000/08/28 08:16:06
  162. @@ -220,7 +220,7 @@
  163.      PHP_FE(gethostbyaddr,                            NULL)
  164.      PHP_FE(gethostbyname,                            NULL)
  165.      PHP_FE(gethostbynamel,                            NULL)
  166. -#if !defined(PHP_WIN32)||HAVE_BINDLIB
  167. +#if (!defined(PHP_WIN32) && !defined(PHP_OS2))||HAVE_BINDLIB
  168.      PHP_FE(checkdnsrr,                                NULL)
  169.      PHP_FE(getmxrr,                                    second_and_third_args_force_ref)
  170.  #else
  171. @@ -400,7 +400,7 @@
  172.      PHP_FALIAS(socket_set_timeout, warn_not_available,      NULL)                             
  173.  #endif
  174.      PHP_FE(socket_get_status,    NULL)
  175. -#if !PHP_WIN32 || defined(ZTS)
  176. +#if (!PHP_WIN32 && !PHP_OS2) || defined(ZTS)
  177.      PHP_FE(realpath,            NULL)
  178.  #else
  179.      PHP_FALIAS(realpath,        warn_not_available,        NULL)
  180. @@ -465,10 +465,12 @@
  181.      PHP_FE(ezmlm_hash,                NULL)
  182.  
  183.      /* functions from syslog.c */
  184. +#ifdef HAVE_SYSLOG_H
  185.      PHP_FE(openlog,                    NULL)
  186.      PHP_FE(syslog,                    NULL)
  187.      PHP_FE(closelog,                NULL)
  188.      PHP_FE(define_syslog_variables,    NULL)
  189. +#endif
  190.  
  191.      /* functions from lcg.c */
  192.      PHP_FE(lcg_value, NULL)
  193. @@ -687,7 +689,9 @@
  194.  #endif
  195.  
  196.      PHP_MINIT(dir)(INIT_FUNC_ARGS_PASSTHRU);
  197. +#ifdef HAVE_SYSLOG_H
  198.      PHP_MINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU);
  199. +#endif
  200.      PHP_MINIT(array)(INIT_FUNC_ARGS_PASSTHRU);
  201.      PHP_MINIT(assert)(INIT_FUNC_ARGS_PASSTHRU);
  202.  
  203. @@ -738,7 +742,9 @@
  204.  
  205.      PHP_RINIT(head)(INIT_FUNC_ARGS_PASSTHRU);
  206.      PHP_RINIT(filestat)(INIT_FUNC_ARGS_PASSTHRU);
  207. +#ifdef HAVE_SYSLOG_H
  208.      PHP_RINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU);
  209. +#endif
  210.      PHP_RINIT(assert)(INIT_FUNC_ARGS_PASSTHRU);
  211.      PHP_RINIT(dir)(INIT_FUNC_ARGS_PASSTHRU);
  212.  
  213. @@ -768,7 +774,9 @@
  214.  
  215.      PHP_RSHUTDOWN(fsock)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
  216.      PHP_RSHUTDOWN(filestat)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
  217. +#ifdef HAVE_SYSLOG_H
  218.      PHP_RSHUTDOWN(syslog)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
  219. +#endif
  220.      PHP_RSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
  221.  
  222.  #ifdef TRANS_SID
  223. @@ -791,7 +799,9 @@
  224.  {
  225.      php_info_print_table_start();
  226.      PHP_MINFO(regex)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU);
  227. +#ifdef HAVE_LIBDL
  228.      PHP_MINFO(dl)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU);
  229. +#endif
  230.      PHP_MINFO(mail)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU);
  231.      php_info_print_table_end();
  232.      PHP_MINFO(assert)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU);
  233. Index: ext/standard/dns.c
  234. ===================================================================
  235. RCS file: /repository/php4/ext/standard/dns.c,v
  236. retrieving revision 1.22
  237. diff -u -r1.22 dns.c
  238. --- ext/standard/dns.c    2000/06/05 19:47:44    1.22
  239. +++ ext/standard/dns.c    2000/08/28 08:16:06
  240. @@ -159,7 +159,7 @@
  241.      return estrdup(inet_ntoa(in));
  242.  }
  243.  
  244. -#if !defined(PHP_WIN32)||HAVE_BINDLIB
  245. +#if (!defined(PHP_WIN32) && !defined(PHP_OS2))||HAVE_BINDLIB
  246.  
  247.  /* {{{ proto int checkdnsrr(string host [, string type])
  248.     Check DNS records corresponding to a given Internet host name or IP address */
  249. Index: ext/standard/file.c
  250. ===================================================================
  251. RCS file: /repository/php4/ext/standard/file.c,v
  252. retrieving revision 1.108
  253. diff -u -r1.108 file.c
  254. --- ext/standard/file.c    2000/08/21 19:24:44    1.108
  255. +++ ext/standard/file.c    2000/08/28 08:16:12
  256. @@ -30,6 +30,9 @@
  257.  #include "ext/standard/php_filestat.h"
  258.  
  259.  #include <stdio.h>
  260. +#ifdef PHP_OS2
  261. +#include <io.h>
  262. +#endif
  263.  #include <stdlib.h>
  264.  #include <errno.h>
  265.  #include <sys/types.h>
  266. @@ -1991,7 +1994,7 @@
  267.  
  268.  /* }}} */
  269.  
  270. -#if !PHP_WIN32 || defined(ZTS)
  271. +#if (!PHP_WIN32 && !PHP_OS2) || defined(ZTS)
  272.  /* {{{ proto string realpath(string path)
  273.     Return the resolved path */
  274.  PHP_FUNCTION(realpath)
  275. Index: ext/standard/filestat.c
  276. ===================================================================
  277. RCS file: /repository/php4/ext/standard/filestat.c,v
  278. retrieving revision 1.44
  279. diff -u -r1.44 filestat.c
  280. --- ext/standard/filestat.c    2000/08/06 16:22:07    1.44
  281. +++ ext/standard/filestat.c    2000/08/28 08:16:15
  282. @@ -34,7 +34,7 @@
  283.  # include <unistd.h>
  284.  #endif
  285.  
  286. -#ifdef OS2
  287. +#ifdef PHP_OS2
  288.  #  define INCL_DOS
  289.  #  include <os2.h>
  290.  #endif
  291. @@ -198,7 +198,7 @@
  292.          RETURN_FALSE;
  293.      }
  294.  
  295. -#elif defined(OS2)
  296. +#elif defined(PHP_OS2)
  297.      {
  298.          FSALLOCATE fsinfo;
  299.            char drive = (*path)->value.str.val[0] & 95;
  300. @@ -228,7 +228,7 @@
  301.     Change file owner */
  302.  PHP_FUNCTION(chgrp)
  303.  {
  304. -#ifndef WINDOWS
  305. +#if !defined(WINDOWS) && !defined(PHP_OS2)
  306.      pval **filename, **group;
  307.      gid_t gid;
  308.      struct group *gr=NULL;
  309. @@ -276,7 +276,7 @@
  310.     Change file group */
  311.  PHP_FUNCTION(chown)
  312.  {
  313. -#ifndef WINDOWS
  314. +#if !defined(WINDOWS) && !defined(PHP_OS2)
  315.      pval **filename, **user;
  316.      int ret;
  317.      uid_t uid;
  318. @@ -547,8 +547,10 @@
  319.          switch(BG(sb).st_mode&S_IFMT) {
  320.          case S_IFIFO: RETURN_STRING("fifo",1);
  321.          case S_IFCHR: RETURN_STRING("char",1);
  322. -        case S_IFDIR: RETURN_STRING("dir",1);
  323. -        case S_IFBLK: RETURN_STRING("block",1);
  324. +                case S_IFDIR: RETURN_STRING("dir",1);
  325. +#ifdef S_IFBLK
  326. +                case S_IFBLK: RETURN_STRING("block",1);
  327. +#endif
  328.          case S_IFREG: RETURN_STRING("file",1);
  329.          }
  330.          php_error(E_WARNING,"Unknown file type (%d)",BG(sb).st_mode&S_IFMT);
  331. Index: ext/standard/mail.c
  332. ===================================================================
  333. RCS file: /repository/php4/ext/standard/mail.c,v
  334. retrieving revision 1.28
  335. diff -u -r1.28 mail.c
  336. --- ext/standard/mail.c    2000/08/03 19:26:19    1.28
  337. +++ ext/standard/mail.c    2000/08/28 08:16:16
  338. @@ -25,7 +25,14 @@
  339.  #include "ext/standard/info.h"
  340.  #if !defined(PHP_WIN32)
  341.  #include "build-defs.h"
  342. +
  343. +#ifdef PHP_OS2
  344. +#define EX_OK 0
  345. +#define EX_TEMPFAIL 75 /* Not sure if this is right for OS/2's sendmail */
  346. +#else
  347.  #include <sysexits.h>
  348. +#endif
  349. +
  350.  #endif
  351.  #include "php_mail.h"
  352.  #include "php_ini.h"
  353. Index: ext/standard/microtime.c
  354. ===================================================================
  355. RCS file: /repository/php4/ext/standard/microtime.c,v
  356. retrieving revision 1.27
  357. diff -u -r1.27 microtime.c
  358. --- ext/standard/microtime.c    2000/06/05 19:47:44    1.27
  359. +++ ext/standard/microtime.c    2000/08/28 08:16:18
  360. @@ -39,6 +39,11 @@
  361.  #include <stdio.h>
  362.  #include <errno.h>
  363.  
  364. +#if PHP_OS2
  365. +#define INCL_DOSPROFILE
  366. +#include <os2.h>
  367. +#endif
  368. +
  369.  #include "microtime.h"
  370.  
  371.  #define NUL  '\0'
  372. @@ -50,10 +55,32 @@
  373.  {
  374.  #ifdef HAVE_GETTIMEOFDAY
  375.      struct timeval tp;
  376. -    long sec = 0L;
  377. -    double msec = 0.0;
  378.      char ret[100];
  379.      
  380. +#if PHP_OS2
  381. +    static ULONG hrtimerHz = 0;
  382. +    /* Number of hrtimerHz between 1 Jan 1970 & base of DosTmrQueryTime() */
  383. +    static unsigned long long hradjust; 
  384. +    QWORD qwNow;
  385. +    unsigned long long llNow;
  386. +
  387. +    if (hrtimerHz == 0) {
  388. +        DosTmrQueryFreq(&hrtimerHz);
  389. +        gettimeofday(&tp, NULL);
  390. +        DosTmrQueryTime(&qwNow);
  391. +        llNow = ((unsigned long long)qwNow.ulHi << 32) | qwNow.ulLo;
  392. +        hradjust = (unsigned long long)tp.tv_sec * hrtimerHz + (tp.tv_usec * hrtimerHz / MICRO_IN_SEC) - llNow;
  393. +    }
  394. +
  395. +    DosTmrQueryTime(&qwNow);
  396. +    llNow = ((unsigned long long)qwNow.ulHi << 32) | qwNow.ulLo;
  397. +    llNow += hradjust;
  398. +    snprintf(ret, 100, "%.8f %ld", (double)(llNow % hrtimerHz)/hrtimerHz, llNow / hrtimerHz);
  399. +    RETVAL_STRING(ret,1);
  400. +#else
  401. +    long sec = 0L;
  402. +    double msec = 0.0;
  403. +
  404.      if (gettimeofday((struct timeval *) &tp, (NUL)) == 0) {
  405.          msec = (double) (tp.tv_usec / MICRO_IN_SEC);
  406.          sec = tp.tv_sec;
  407. @@ -61,6 +88,7 @@
  408.      if (msec >= 1.0) msec -= (long) msec;
  409.      snprintf(ret, 100, "%.8f %ld", msec, sec);
  410.      RETVAL_STRING(ret,1);
  411. +#endif
  412.  #endif
  413.  }
  414.  /* }}} */
  415. Index: ext/standard/php_math.h
  416. ===================================================================
  417. RCS file: /repository/php4/ext/standard/php_math.h,v
  418. retrieving revision 1.5
  419. diff -u -r1.5 php_math.h
  420. --- ext/standard/php_math.h    2000/08/19 22:01:37    1.5
  421. +++ ext/standard/php_math.h    2000/08/28 08:16:19
  422. @@ -56,6 +56,9 @@
  423.  PHP_FUNCTION(rad2deg);
  424.  
  425.  #include <math.h>
  426. +#ifdef HAVE_FLOAT_H
  427. +#include <float.h>
  428. +#endif
  429.  
  430.  #ifndef M_E
  431.  #define M_E            2.7182818284590452354   /* e */
  432. Index: ext/standard/syslog.c
  433. ===================================================================
  434. RCS file: /repository/php4/ext/standard/syslog.c,v
  435. retrieving revision 1.22
  436. diff -u -r1.22 syslog.c
  437. --- ext/standard/syslog.c    2000/06/05 19:47:44    1.22
  438. +++ ext/standard/syslog.c    2000/08/28 08:16:20
  439. @@ -34,6 +34,7 @@
  440.  #include "basic_functions.h"
  441.  #include "php_ext_syslog.h"
  442.  
  443. +#ifdef HAVE_SYSLOG_H
  444.  static void start_syslog(BLS_D);
  445.  
  446.  PHP_MINIT_FUNCTION(syslog)
  447. @@ -256,6 +257,7 @@
  448.      RETURN_TRUE;
  449.  }
  450.  /* }}} */
  451. +#endif /* HAVE_SYSLOG_H */
  452.  
  453.  /*
  454.   * Local variables:
  455. Index: main/SAPI.c
  456. ===================================================================
  457. RCS file: /repository/php4/main/SAPI.c,v
  458. retrieving revision 1.85
  459. diff -u -r1.85 SAPI.c
  460. --- main/SAPI.c    2000/08/27 09:48:03    1.85
  461. +++ main/SAPI.c    2000/08/28 08:16:24
  462. @@ -18,10 +18,10 @@
  463.     +----------------------------------------------------------------------+
  464.  */
  465.  
  466. +#include "php.h"
  467.  #include <ctype.h>
  468.  #include <sys/stat.h>
  469.  
  470. -#include "php.h"
  471.  #include "SAPI.h"
  472.  #ifdef ZTS
  473.  #include "TSRM.h"
  474. Index: main/configuration-parser.y
  475. ===================================================================
  476. RCS file: /repository/php4/main/configuration-parser.y,v
  477. retrieving revision 1.53
  478. diff -u -r1.53 configuration-parser.y
  479. --- main/configuration-parser.y    2000/07/25 18:50:50    1.53
  480. +++ main/configuration-parser.y    2000/08/28 08:16:25
  481. @@ -186,7 +186,13 @@
  482.              }
  483.          }
  484.  #else
  485. +#if PHP_OS2
  486.          if (!php_ini_path) {
  487. +            php_ini_path = getenv("ETC");
  488. +        }
  489. +#endif
  490. +
  491. +        if (!php_ini_path) {
  492.              default_location = CONFIGURATION_FILE_PATH;
  493.          } else {
  494.              default_location = php_ini_path;
  495. @@ -197,7 +203,7 @@
  496.          php_ini_search_path = (char *) malloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
  497.  
  498.          if (!php_ini_path) {
  499. -#ifdef PHP_WIN32
  500. +#if defined(PHP_WIN32) || defined(PHP_OS2)
  501.              sprintf(php_ini_search_path,".;%s;%s",env_location,default_location);
  502.  #else
  503.              sprintf(php_ini_search_path,".:%s:%s",env_location,default_location);
  504. Index: main/fopen-wrappers.c
  505. ===================================================================
  506. RCS file: /repository/php4/main/fopen-wrappers.c,v
  507. retrieving revision 1.82
  508. diff -u -r1.82 fopen-wrappers.c
  509. --- main/fopen-wrappers.c    2000/08/21 09:50:52    1.82
  510. +++ main/fopen-wrappers.c    2000/08/28 08:16:28
  511. @@ -217,7 +217,7 @@
  512.          ptr = pathbuf;
  513.  
  514.          while (ptr && *ptr) {
  515. -#ifdef PHP_WIN32
  516. +#if defined(PHP_WIN32) || defined(PHP_OS2)
  517.              end = strchr(ptr, ';');
  518.  #else
  519.              end = strchr(ptr, ':');
  520. @@ -408,7 +408,7 @@
  521.          return php_fopen_and_set_opened_path(filename, mode, opened_path);
  522.      }
  523.      /* Absolute path open - prepend document_root in safe mode */
  524. -#ifdef PHP_WIN32
  525. +#if defined(PHP_WIN32) || defined(PHP_OS2)
  526.      if (IS_SLASH(*filename) || (filename[1] == ':')) {
  527.  #else
  528.      if (IS_SLASH(*filename)) {
  529. @@ -438,7 +438,7 @@
  530.      ptr = pathbuf;
  531.  
  532.      while (ptr && *ptr) {
  533. -#ifdef PHP_WIN32
  534. +#if defined(PHP_WIN32) || defined(PHP_OS2)
  535.          end = strchr(ptr, ';');
  536.  #else
  537.          end = strchr(ptr, ':');
  538. Index: main/php.h
  539. ===================================================================
  540. RCS file: /repository/php4/main/php.h,v
  541. retrieving revision 1.122
  542. diff -u -r1.122 php.h
  543. --- main/php.h    2000/08/27 18:27:37    1.122
  544. +++ main/php.h    2000/08/28 08:16:30
  545. @@ -64,6 +64,16 @@
  546.  #define PHP_DIR_SEPARATOR '/'
  547.  #endif
  548.  
  549. +#ifdef __EMX__
  550. +#define PHP_OS2 1
  551. +#define TCPIPV4 1
  552. +#define MAXSOCKETS 2048
  553. +#if !HAVE_AP_CONFIG_H
  554. +#define strcasecmp(s1, s2) stricmp(s1, s2)
  555. +#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
  556. +#endif
  557. +#endif
  558. +
  559.  #include "php_regex.h"
  560.  
  561.  /* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
  562. @@ -305,7 +315,7 @@
  563.  #define V_GETWD(buf)
  564.  #define V_REALPATH(path,real_path) virtual_realpath(path,real_path)
  565.  #define V_STAT(path, buff) virtual_stat(path, buff)
  566. -#ifdef PHP_WIN32
  567. +#if defined(PHP_WIN32) || defined(PHP_OS2)
  568.  #define V_LSTAT(path, buff) virtual_stat(path, buff)
  569.  #else
  570.  #define V_LSTAT(path, buff) virtual_lstat(path, buff)
  571. Index: main/php_syslog.h
  572. ===================================================================
  573. RCS file: /repository/php4/main/php_syslog.h,v
  574. retrieving revision 1.4
  575. diff -u -r1.4 php_syslog.h
  576. --- main/php_syslog.h    2000/06/09 17:21:40    1.4
  577. +++ main/php_syslog.h    2000/08/28 08:16:30
  578. @@ -4,7 +4,9 @@
  579.  #ifdef PHP_WIN32
  580.  #include "win32/syslog.h"
  581.  #else
  582. +#ifdef HAVE_SYSLOG_H
  583.  #include <syslog.h>
  584. +#endif
  585.  #endif
  586.  
  587.  /* 
  588. Index: main/php_virtual_cwd.c
  589. ===================================================================
  590. RCS file: /repository/php4/main/php_virtual_cwd.c,v
  591. retrieving revision 1.73
  592. diff -u -r1.73 php_virtual_cwd.c
  593. --- main/php_virtual_cwd.c    2000/08/27 19:36:35    1.73
  594. +++ main/php_virtual_cwd.c    2000/08/28 08:16:32
  595. @@ -35,6 +35,7 @@
  596.  
  597.  #include "php_virtual_cwd.h"
  598.  #include "php_reentrancy.h" /* for php_strtok_r */
  599. +#include "php_config.h"
  600.  
  601.  #define VIRTUAL_CWD_DEBUG 0
  602.  
  603. @@ -65,7 +66,7 @@
  604.  #define S_ISREG(mode) ((mode) & _S_IFREG)
  605.  #endif
  606.  
  607. -#ifdef ZEND_WIN32
  608. +#if defined(ZEND_WIN32) || defined(PHP_OS2)
  609.  #define php_strtok_r(a,b,c) strtok((a),(b))
  610.  #define DEFAULT_SLASH '\\'
  611.  #define TOKENIZER_STRING "/\\"
  612. @@ -201,7 +202,7 @@
  613.          return retval;
  614.      }
  615.  
  616. -#ifdef ZEND_WIN32
  617. +#if defined(ZEND_WIN32)||defined(PHP_OS2)
  618.      /* If we have something like C: */
  619.      if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') {
  620.          char *retval;
  621. @@ -260,7 +261,7 @@
  622.      if (path_length == 0) 
  623.          return (0);
  624.  
  625. -#ifndef ZEND_WIN32
  626. +#if !defined(ZEND_WIN32) && HAVE_REALPATH
  627.      if (IS_ABSOLUTE_PATH(path, path_length)) {
  628.          if (realpath(path, resolved_path)) {
  629.              path = resolved_path;
  630. @@ -297,7 +298,7 @@
  631.      if (IS_ABSOLUTE_PATH(path_copy, path_length)) {
  632.          copy_amount = COPY_WHEN_ABSOLUTE;
  633.          is_absolute = 1;
  634. -#ifdef ZEND_WIN32
  635. +#if defined(ZEND_WIN32) || defined(PHP_OS2)
  636.      } else if(IS_SLASH(path_copy[0])) {
  637.          copy_amount = 2;
  638.  #endif
  639. @@ -500,7 +501,7 @@
  640.      return ret;
  641.  }
  642.  
  643. -#ifndef PHP_WIN32
  644. +#if !defined(PHP_WIN32) && !defined(PHP_OS2) 
  645.  CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group)
  646.  {
  647.      cwd_state new_state;
  648. @@ -573,7 +574,7 @@
  649.      return retval;
  650.  }
  651.  
  652. -#ifndef ZEND_WIN32
  653. +#ifdef HAVE_LSTAT
  654.  
  655.  CWD_API int virtual_lstat(const char *path, struct stat *buf)
  656.  {
  657. Index: sapi/cgi/cgi_main.c
  658. ===================================================================
  659. RCS file: /repository/php4/sapi/cgi/cgi_main.c,v
  660. retrieving revision 1.68
  661. diff -u -r1.68 cgi_main.c
  662. --- sapi/cgi/cgi_main.c    2000/08/27 19:46:03    1.68
  663. +++ sapi/cgi/cgi_main.c    2000/08/28 08:16:34
  664. @@ -59,8 +59,10 @@
  665.  #include "win32/syslog.h"
  666.  #include "win32/php_registry.h"
  667.  #else
  668. +#ifdef HAVE_SYSLOG_H
  669.  #include <syslog.h>
  670.  #endif
  671. +#endif
  672.  
  673.  #if HAVE_SIGNAL_H
  674.  #include <signal.h>
  675. @@ -419,6 +421,12 @@
  676.      setmode(_fileno(stdin), O_BINARY);        /* make the stdio mode be binary */
  677.      setmode(_fileno(stdout), O_BINARY);        /* make the stdio mode be binary */
  678.      setmode(_fileno(stderr), O_BINARY);        /* make the stdio mode be binary */
  679. +#endif
  680. +
  681. +#ifdef PHP_OS2
  682. +    _fsetmode(stdin,  "b");
  683. +    _fsetmode(stdout, "b");
  684. +    _fsetmode(stderr, "b");
  685.  #endif
  686.  
  687.  
  688.