hyanantha               Thu Oct 24 07:54:04 2002 EDT

  Modified files:              (Branch: PHP_4_2_0)
    /php4/sapi/apache   php_apache.c 
  Log:
  NetWare related changes/modifications.
  
  
Index: php4/sapi/apache/php_apache.c
diff -u php4/sapi/apache/php_apache.c:1.56 php4/sapi/apache/php_apache.c:1.56.2.1
--- php4/sapi/apache/php_apache.c:1.56  Thu Feb 28 03:27:19 2002
+++ php4/sapi/apache/php_apache.c       Thu Oct 24 07:54:03 2002
@@ -17,7 +17,7 @@
    |          David Sklar <[EMAIL PROTECTED]>                             |
    +----------------------------------------------------------------------+
  */
-/* $Id: php_apache.c,v 1.56 2002/02/28 08:27:19 sebastian Exp $ */
+/* $Id: php_apache.c,v 1.56.2.1 2002/10/24 11:54:03 hyanantha Exp $ */
 
 #define NO_REGEX_EXTRA_H
 
@@ -26,6 +26,14 @@
 #include <stddef.h>
 #endif
 
+#ifdef NETWARE
+#ifdef NEW_LIBC /* Works fine for both Winsock and Berkeley sockets */
+#include <netinet/in.h>
+#else
+#include <sys/socket.h>
+#endif
+#endif /* NETWARE */
+
 #include "php.h"
 #include "ext/standard/head.h"
 #include "php_globals.h"
@@ -51,7 +59,7 @@
 php_apache_info_struct php_apache_info;
 #endif
 
-#ifdef PHP_WIN32
+#if defined(PHP_WIN32) || defined(NETWARE)
 #include "zend.h"
 #include "ap_compat.h"
 #else
@@ -101,7 +109,7 @@
 static PHP_MINIT_FUNCTION(apache)
 {
 #ifdef ZTS
-       ts_allocate_id(&php_apache_info_id, sizeof(php_apache_info_struct), 
php_apache_globals_ctor, NULL);
+       ts_allocate_id(&php_apache_info_id, sizeof(php_apache_info_struct), (void 
+(*)(void *, void ***))php_apache_globals_ctor, NULL); /* Type-casting done due to 
+NetWare */
 #else
        php_apache_globals_ctor(&php_apache_info TSRMLS_CC);
 #endif
@@ -133,6 +141,9 @@
    Terminate apache process after this request */
 PHP_FUNCTION(apache_child_terminate)
 {
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       EnterClib();
+#endif
 #ifndef MULTITHREAD
        if (AP(terminate_child)) {
                ap_child_terminate( ((request_rec *)SG(server_context)) );
@@ -142,6 +153,9 @@
 #else
                php_error(E_WARNING, "apache_child_terminate() is not supported in 
this build");
 #endif
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       ExitClib();
+#endif
 }
 /* }}} */
 
@@ -153,6 +167,9 @@
        char *note_val;
        int arg_count = ARG_COUNT(ht);
 
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       EnterClib();
+#endif
        if (arg_count<1 || arg_count>2 ||
                zend_get_parameters_ex(arg_count, &arg_name, &arg_val) ==FAILURE ) {
                WRONG_PARAM_COUNT;
@@ -166,6 +183,9 @@
                table_set(((request_rec *)SG(server_context))->notes, 
(*arg_name)->value.str.val, (*arg_val)->value.str.val);
        }
 
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       ExitClib();
+#endif
        if (note_val) {
                RETURN_STRING(note_val, 1);
        } else {
@@ -180,7 +200,7 @@
 {
        module *modp = NULL;
        char output_buf[128];
-#if !defined(WIN32) && !defined(WINNT)
+#if !defined(WIN32) && !defined(WINNT) /* This seems to be working for NetWare */
        char name[64];
        char modulenames[1024];
        char *p;
@@ -192,6 +212,9 @@
        extern gid_t group_id;
        extern int max_requests_per_child;
 
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       EnterClib();
+#endif
        serv = ((request_rec *) SG(server_context))->server;
 
 
@@ -201,6 +224,10 @@
        php_info_print_table_row(1, "Apache for Windows 95/NT");
        php_info_print_table_end();
        php_info_print_table_start();
+#elif defined(NETWARE)
+       php_info_print_table_row(1, "Apache for NetWare");
+       php_info_print_table_end();
+       php_info_print_table_start();
 #else
        php_info_print_table_row(2, "APACHE_INCLUDE", PHP_APACHE_INCLUDE);
        php_info_print_table_row(2, "APACHE_TARGET", PHP_APACHE_TARGET);
@@ -216,7 +243,7 @@
        php_info_print_table_row(2, "Apache API Version", output_buf);
        sprintf(output_buf, "%s:%u", serv->server_hostname, serv->port);
        php_info_print_table_row(2, "Hostname:Port", output_buf);
-#if !defined(WIN32) && !defined(WINNT)
+#if !defined(WIN32) && !defined(WINNT) /* This seems to be working for NetWare */
        sprintf(output_buf, "%s(%d)/%d", user_name, (int)user_id, (int)group_id);
        php_info_print_table_row(2, "User/Group", output_buf);
        sprintf(output_buf, "Per Child: %d - Keep Alive: %s - Max Per Connection: %d", 
max_requests_per_child, serv->keep_alive ? "on":"off", serv->keep_alive_max);
@@ -224,7 +251,7 @@
 #endif
        sprintf(output_buf, "Connection: %d - Keep-Alive: %d", serv->timeout, 
serv->keep_alive_timeout);
        php_info_print_table_row(2, "Timeouts", output_buf);
-#if !defined(WIN32) && !defined(WINNT)
+#if !defined(WIN32) && !defined(WINNT) /* This seems to be working for NetWare */
        php_info_print_table_row(2, "Server Root", server_root);
 
        strcpy(modulenames, "");
@@ -238,6 +265,7 @@
                        strcat(modulenames, ", ");
                }
        }
+       /* But here for NetWare, it seems to be showing all modules instead of just 
+the loaded ones */
        php_info_print_table_row(2, "Loaded Modules", modulenames);
 #endif
 
@@ -292,6 +320,9 @@
                }
                php_info_print_table_end();
        }
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       ExitClib();
+#endif
 }
 /* }}} */
 
@@ -310,6 +341,9 @@
        pval **filename;
        request_rec *rr = NULL;
 
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       EnterClib();
+#endif
        if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
                WRONG_PARAM_COUNT;
        }
@@ -318,12 +352,18 @@
        if (!(rr = sub_req_lookup_uri ((*filename)->value.str.val, ((request_rec *) 
SG(server_context))))) {
                php_error(E_WARNING, "Unable to include '%s' - URI lookup failed", 
(*filename)->value.str.val);
                if (rr) destroy_sub_req (rr);
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+               ExitClib();
+#endif
                RETURN_FALSE;
        }
 
        if (rr->status != 200) {
                php_error(E_WARNING, "Unable to include '%s' - error finding URI", 
(*filename)->value.str.val);
                if (rr) destroy_sub_req (rr);
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+               ExitClib();
+#endif
                RETURN_FALSE;
        }
 
@@ -333,9 +373,15 @@
        if (run_sub_req(rr)) {
                php_error(E_WARNING, "Unable to include '%s' - request execution 
failed", (*filename)->value.str.val);
                if (rr) destroy_sub_req (rr);
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+               ExitClib();
+#endif
                RETURN_FALSE;
        } else {
                if (rr) destroy_sub_req (rr);
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+               ExitClib();
+#endif
                RETURN_TRUE;
        }
 }
@@ -348,8 +394,14 @@
     array_header *env_arr;
     table_entry *tenv;
     int i;
-       
+
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       EnterClib();
+#endif
     if (array_init(return_value) == FAILURE) {
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+               ExitClib();
+#endif
                RETURN_FALSE;
     }
     env_arr = table_elts(((request_rec *) SG(server_context))->headers_in);
@@ -361,9 +413,15 @@
                        continue;
                }
                if (add_assoc_string(return_value, tenv[i].key, (tenv[i].val==NULL) ? 
"" : tenv[i].val, 1)==FAILURE) {
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+                       ExitClib();
+#endif
                        RETURN_FALSE;
                }
     }
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       ExitClib();
+#endif
 }
 /* }}} */
 
@@ -384,7 +442,13 @@
                else break;
        }
 
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       EnterClib();
+#endif
        ap_table_setn(r->subprocess_env, ap_pstrndup(r->pool, var, var_len), 
ap_pstrndup(r->pool, val, val_len));
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       ExitClib();
+#endif
        RETURN_TRUE;
 }
 /* }}} */
@@ -396,6 +460,9 @@
        pval **filename;
        request_rec *rr=NULL;
 
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       EnterClib();
+#endif
        if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
                WRONG_PARAM_COUNT;
        }
@@ -458,6 +525,9 @@
        }
 
        destroy_sub_req(rr);
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       ExitClib();
+#endif
 }
 /* }}} */
 
@@ -471,6 +541,9 @@
        request_rec *rr=NULL;
        TSRMLS_FETCH();
 
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       EnterClib();
+#endif
        if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
                WRONG_PARAM_COUNT;
        }
@@ -482,6 +555,9 @@
        }
        RETVAL_LONG(ap_run_sub_req(rr));
        ap_destroy_sub_req(rr);
+#if defined(NETWARE) && defined(NETWARE_CLIB_BROKER)
+       ExitClib();
+#endif
 }
 #endif
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to