summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/SAPI.c572
-rw-r--r--main/SAPI.h217
-rw-r--r--main/alloca.c490
-rw-r--r--main/config.w32.h327
-rw-r--r--main/configuration-parser.y582
-rw-r--r--main/configuration-scanner.l182
-rw-r--r--main/fopen_wrappers.c1169
-rw-r--r--main/fopen_wrappers.h92
-rw-r--r--main/internal_functions.c.in64
-rw-r--r--main/internal_functions_registry.h38
-rw-r--r--main/internal_functions_win32.c102
-rw-r--r--main/logos.h1059
-rw-r--r--main/main.c1218
-rw-r--r--main/mergesort.c344
-rw-r--r--main/output.c430
-rw-r--r--main/php.h375
-rw-r--r--main/php3_compat.h97
-rw-r--r--main/php_compat.h71
-rw-r--r--main/php_content_types.c55
-rw-r--r--main/php_content_types.h10
-rw-r--r--main/php_globals.h127
-rw-r--r--main/php_ini.c516
-rw-r--r--main/php_ini.h158
-rw-r--r--main/php_main.h56
-rw-r--r--main/php_output.h44
-rw-r--r--main/php_realpath.c275
-rw-r--r--main/php_realpath.h30
-rw-r--r--main/php_reentrancy.h124
-rw-r--r--main/php_regex.h42
-rw-r--r--main/php_sprintf.c42
-rw-r--r--main/php_syslog.h32
-rw-r--r--main/php_ticks.c77
-rw-r--r--main/php_ticks.h41
-rw-r--r--main/php_variables.c335
-rw-r--r--main/php_variables.h49
-rw-r--r--main/php_version.h3
-rw-r--r--main/php_virtual_cwd.c598
-rw-r--r--main/php_virtual_cwd.h85
-rw-r--r--main/reentrancy.c406
-rw-r--r--main/rfc1867.c372
-rw-r--r--main/rfc1867.h13
-rw-r--r--main/safe_mode.c138
-rw-r--r--main/safe_mode.h7
-rw-r--r--main/snprintf.c932
-rw-r--r--main/snprintf.h44
-rw-r--r--main/strlcat.c77
-rw-r--r--main/strlcpy.c74
-rw-r--r--main/win95nt.h73
48 files changed, 0 insertions, 12264 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
deleted file mode 100644
index 87714e9033..0000000000
--- a/main/SAPI.c
+++ /dev/null
@@ -1,572 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Original design: Shane Caraveo <shane@caraveo.com> |
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include <ctype.h>
-#include <sys/stat.h>
-
-#include "php.h"
-#include "SAPI.h"
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#include "rfc1867.h"
-
-#ifdef PHP_WIN32
-#define STRCASECMP stricmp
-#else
-#define STRCASECMP strcasecmp
-#endif
-
-
-SAPI_POST_READER_FUNC(sapi_read_standard_form_data);
-
-static sapi_post_entry supported_post_entries[] = {
-#if HAVE_FDFLIB
- { "application/vnd.fdf", sizeof("application/vnd.fdf")-1, sapi_read_standard_form_data },
-#endif
- { NULL, 0, NULL }
-};
-
-
-static HashTable known_post_content_types;
-
-SAPI_API void (*sapi_error)(int error_type, const char *message, ...);
-
-
-#ifdef ZTS
-SAPI_API int sapi_globals_id;
-#else
-sapi_globals_struct sapi_globals;
-#endif
-
-static void sapi_globals_ctor(sapi_globals_struct *sapi_globals)
-{
- memset(sapi_globals,0,sizeof(*sapi_globals));
-}
-
-/* True globals (no need for thread safety) */
-sapi_module_struct sapi_module;
-SAPI_API void (*sapi_error)(int error_type, const char *message, ...);
-
-
-SAPI_API void sapi_startup(sapi_module_struct *sf)
-{
- sapi_module = *sf;
- zend_hash_init(&known_post_content_types, 5, NULL, NULL, 1);
-
- sapi_register_post_entries(supported_post_entries);
-
-#ifdef ZTS
- sapi_globals_id = ts_allocate_id(sizeof(sapi_globals_struct), (ts_allocate_ctor) sapi_globals_ctor, NULL);
-#else
- sapi_globals_ctor(&sapi_globals);
-#endif
-
-#ifdef VIRTUAL_DIR
- virtual_cwd_startup(); /* Could use shutdown to free the main cwd but it would just slow it down for CGI */
-#endif
-
- reentrancy_startup();
-
- php_global_startup_internal_extensions();
-}
-
-SAPI_API void sapi_shutdown(void)
-{
- reentrancy_shutdown();
-#ifdef VIRTUAL_DIR
- virtual_cwd_shutdown();
-#endif
- php_global_shutdown_internal_extensions();
- zend_hash_destroy(&known_post_content_types);
-}
-
-
-SAPI_API void sapi_free_header(sapi_header_struct *sapi_header)
-{
- efree(sapi_header->header);
-}
-
-
-SAPI_API void sapi_handle_post(void *arg SLS_DC)
-{
- if (SG(request_info).post_entry) {
- SG(request_info).post_entry->post_handler(SG(request_info).content_type_dup, arg SLS_CC);
- efree(SG(request_info).post_data);
- SG(request_info).post_data = NULL;
- efree(SG(request_info).content_type_dup);
- SG(request_info).content_type_dup = NULL;
- }
-}
-
-static void sapi_read_post_data(SLS_D)
-{
- sapi_post_entry *post_entry;
- uint content_type_length = strlen(SG(request_info).content_type);
- char *content_type = estrndup(SG(request_info).content_type, content_type_length);
- char *p;
- char oldchar=0;
- void (*post_reader_func)(SLS_D);
-
-
- /* dedicated implementation for increased performance:
- * - Make the content type lowercase
- * - Trim descriptive data, stay with the content-type only
- */
- for (p=content_type; p<content_type+content_type_length; p++) {
- switch (*p) {
- case ';':
- case ',':
- case ' ':
- content_type_length = p-content_type;
- oldchar = *p;
- *p = 0;
- break;
- default:
- *p = tolower(*p);
- break;
- }
- }
-
- if (zend_hash_find(&known_post_content_types, content_type, content_type_length+1, (void **) &post_entry)==SUCCESS) {
- SG(request_info).post_entry = post_entry;
- post_reader_func = post_entry->post_reader;
- } else {
- if (!sapi_module.default_post_reader) {
- sapi_module.sapi_error(E_COMPILE_ERROR, "Unsupported content type: '%s'", content_type);
- return;
- }
- SG(request_info).post_entry = NULL;
- post_reader_func = sapi_module.default_post_reader;
- }
- if (oldchar) {
- *(p-1) = oldchar;
- }
- post_reader_func(SLS_C);
- SG(request_info).content_type_dup = content_type;
-}
-
-
-SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
-{
- int read_bytes;
- int allocated_bytes=SAPI_POST_BLOCK_SIZE+1;
-
- SG(request_info).post_data = emalloc(allocated_bytes);
-
- for (;;) {
- read_bytes = sapi_module.read_post(SG(request_info).post_data+SG(read_post_bytes), SAPI_POST_BLOCK_SIZE SLS_CC);
- if (read_bytes<=0) {
- break;
- }
- SG(read_post_bytes) += read_bytes;
- if (read_bytes < SAPI_POST_BLOCK_SIZE) {
- break;
- }
- if (SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE >= allocated_bytes) {
- allocated_bytes = SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE+1;
- SG(request_info).post_data = erealloc(SG(request_info).post_data, allocated_bytes);
- }
- }
- SG(request_info).post_data[SG(read_post_bytes)] = 0; /* terminating NULL */
- SG(request_info).post_data_length = SG(read_post_bytes);
-}
-
-
-SAPI_API char *sapi_get_default_content_type(SLS_D)
-{
- char *mimetype, *charset, *content_type;
-
- mimetype = SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE;
- charset = SG(default_charset) ? SG(default_charset) : SAPI_DEFAULT_CHARSET;
-
- if (strncasecmp(mimetype, "text/", 5) == 0 && *charset) {
- int len = strlen(mimetype) + sizeof("; charset=") + strlen(charset);
- content_type = emalloc(len);
- snprintf(content_type, len, "%s; charset=%s", mimetype, charset);
- } else {
- content_type = estrdup(mimetype);
- }
- return content_type;
-}
-
-
-SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header SLS_DC)
-{
- char *default_content_type = sapi_get_default_content_type(SLS_C);
- int default_content_type_len = strlen(default_content_type);
-
- default_header->header_len = (sizeof("Content-type: ")-1) + default_content_type_len;
- default_header->header = emalloc(default_header->header_len+1);
- memcpy(default_header->header, "Content-type: ", sizeof("Content-type: "));
- memcpy(default_header->header+sizeof("Content-type: ")-1, default_content_type, default_content_type_len);
- default_header->header[default_header->header_len] = 0;
- efree(default_content_type);
-}
-
-/*
- * Add charset on content-type header if the MIME type starts with
- * "text/", the default_charset directive is not empty and
- * there is not already a charset option in there.
- *
- * If "mimetype" is non-NULL, it should point to a pointer allocated
- * with emalloc(). If a charset is added, the string will be
- * re-allocated and the new length is returned. If mimetype is
- * unchanged, 0 is returned.
- *
- */
-SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len SLS_DC)
-{
- char *charset, *newtype;
- int newlen;
- charset = SG(default_charset) ? SG(default_charset) : SAPI_DEFAULT_CHARSET;
-
- if (*charset && strncmp(*mimetype, "text/", 5) == 0 && strstr(*mimetype, "charset=") == NULL) {
- newlen = len + (sizeof(";charset=")-1) + strlen(charset);
- newtype = emalloc(newlen + 1);
- strlcpy(newtype, *mimetype, len);
- strlcat(newtype, ";charset=", len);
- if (*mimetype != NULL) {
- efree(*mimetype);
- }
- *mimetype = newtype;
- return newlen;
- }
- return 0;
-}
-
-
-/*
- * Called from php_request_startup() for every request.
- */
-SAPI_API void sapi_activate(SLS_D)
-{
- zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), (void (*)(void *)) sapi_free_header, 0);
- SG(sapi_headers).send_default_content_type = 1;
-
- SG(sapi_headers).http_response_code = 200;
- SG(sapi_headers).http_status_line = NULL;
- SG(headers_sent) = 0;
- SG(read_post_bytes) = 0;
- SG(request_info).post_data = NULL;
- SG(request_info).current_user = NULL;
- SG(request_info).current_user_length = 0;
-
- if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) {
- SG(request_info).headers_only = 1;
- } else {
- SG(request_info).headers_only = 0;
- }
-
- if (SG(server_context)) {
- if (SG(request_info).request_method
- && !strcmp(SG(request_info).request_method, "POST")) {
- if (!SG(request_info).content_type) {
- sapi_module.sapi_error(E_COMPILE_ERROR, "No content-type in POST request");
- }
- sapi_read_post_data(SLS_C);
- } else {
- SG(request_info).content_type_dup = NULL;
- }
- SG(request_info).cookie_data = sapi_module.read_cookies(SLS_C);
- if (sapi_module.activate) {
- sapi_module.activate(SLS_C);
- }
- }
-}
-
-
-SAPI_API void sapi_deactivate(SLS_D)
-{
- zend_llist_destroy(&SG(sapi_headers).headers);
- if (SG(request_info).post_data) {
- efree(SG(request_info).post_data);
- }
- if (SG(request_info).auth_user) {
- efree(SG(request_info).auth_user);
- }
- if (SG(request_info).auth_password) {
- efree(SG(request_info).auth_password);
- }
- if (SG(request_info).content_type_dup) {
- efree(SG(request_info).content_type_dup);
- }
- if (SG(request_info).current_user) {
- efree(SG(request_info).current_user);
- }
- if (sapi_module.deactivate) {
- sapi_module.deactivate(SLS_C);
- }
-}
-
-
-SAPI_API void sapi_initialize_empty_request(SLS_D)
-{
- SG(server_context) = NULL;
- SG(request_info).request_method = NULL;
- SG(request_info).auth_user = SG(request_info).auth_password = NULL;
- SG(request_info).content_type_dup = NULL;
-}
-
-
-static int sapi_extract_response_code(const char *header_line)
-{
- int code = 200;
- const char *ptr;
-
- for (ptr = header_line; *ptr; ptr++) {
- if (*ptr == ' ' && *(ptr + 1) != ' ') {
- code = atoi(ptr + 1);
- break;
- }
- }
-
- return code;
-}
-
-/* This function expects a *duplicated* string, that was previously emalloc()'d.
- * Pointers sent to this functions will be automatically freed by the framework.
- */
-SAPI_API int sapi_add_header(char *header_line, uint header_line_len, zend_bool duplicate)
-{
- int retval, free_header = 0;
- sapi_header_struct sapi_header;
- char *colon_offset;
- SLS_FETCH();
-
- if (SG(headers_sent)) {
- char *output_start_filename = php_get_output_start_filename();
- int output_start_lineno = php_get_output_start_lineno();
-
- if (output_start_filename) {
- sapi_module.sapi_error(E_WARNING, "Cannot add header information - headers already sent by (output started at %s:%d)",
- output_start_filename, output_start_lineno);
- } else {
- sapi_module.sapi_error(E_WARNING, "Cannot add header information - headers already sent");
- }
- if (!duplicate) {
- efree(header_line);
- }
- return FAILURE;
- }
-
- if (duplicate) {
- header_line = estrndup(header_line, header_line_len);
- }
-
- /* cut of trailing spaces, linefeeds and carriage-returns */
- while(isspace(header_line[header_line_len-1]))
- header_line[--header_line_len]='\0';
-
-
- sapi_header.header = header_line;
- sapi_header.header_len = header_line_len;
-
- /* Check the header for a few cases that we have special support for in SAPI */
- if (header_line_len>=5
- && !memcmp(header_line, "HTTP/", 5)) {
- /* filter out the response code */
- SG(sapi_headers).http_response_code = sapi_extract_response_code(header_line);
- SG(sapi_headers).http_status_line = header_line;
- return SUCCESS;
- } else {
- colon_offset = strchr(header_line, ':');
- if (colon_offset) {
- *colon_offset = 0;
- if (!STRCASECMP(header_line, "Content-Type")) {
- char *ptr = colon_offset, *mimetype = NULL, *newheader;
- size_t len = header_line_len - (ptr - header_line), newlen;
- while (*ptr == ' ' && *ptr != '\0') {
- ptr++;
- }
- mimetype = estrdup(ptr);
- newlen = sapi_apply_default_charset(&mimetype, len SLS_CC);
- if (newlen != 0) {
- newlen += sizeof("Content-type: ");
- newheader = emalloc(newlen);
- strlcpy(newheader, "Content-type: ", newlen);
- strlcpy(newheader, mimetype, newlen);
- sapi_header.header = newheader;
- sapi_header.header_len = newlen - 1;
- colon_offset = strchr(newheader, ':');
- *colon_offset = '\0';
- free_header = 1;
- }
- efree(mimetype);
- SG(sapi_headers).send_default_content_type = 0;
- } else if (!STRCASECMP(header_line, "Location")) {
- SG(sapi_headers).http_response_code = 302; /* redirect */
- } else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */
- SG(sapi_headers).http_response_code = 401; /* authentication-required */
- }
- *colon_offset = ':';
- }
- }
-
- if (sapi_module.header_handler) {
- retval = sapi_module.header_handler(&sapi_header, &SG(sapi_headers) SLS_CC);
- } else {
- retval = SAPI_HEADER_ADD;
- }
- if (retval & SAPI_HEADER_DELETE_ALL) {
- zend_llist_clean(&SG(sapi_headers).headers);
- }
- if (retval & SAPI_HEADER_ADD) {
- zend_llist_add_element(&SG(sapi_headers).headers, (void *) &sapi_header);
- }
- if (free_header) {
- efree(sapi_header.header);
- }
- return SUCCESS;
-}
-
-
-SAPI_API int sapi_send_headers()
-{
- int retval;
- int ret = FAILURE;
- SLS_FETCH();
-
- if (SG(headers_sent)) {
- return SUCCESS;
- }
-
- if (sapi_module.send_headers) {
- retval = sapi_module.send_headers(&SG(sapi_headers) SLS_CC);
- } else {
- retval = SAPI_HEADER_DO_SEND;
- }
-
- switch (retval) {
- case SAPI_HEADER_SENT_SUCCESSFULLY:
- SG(headers_sent) = 1;
- ret = SUCCESS;
- break;
- case SAPI_HEADER_DO_SEND:
- if (SG(sapi_headers).http_status_line) {
- sapi_header_struct http_status_line;
-
- http_status_line.header = SG(sapi_headers).http_status_line;
- http_status_line.header_len = strlen(SG(sapi_headers).http_status_line);
- sapi_module.send_header(&http_status_line, SG(server_context));
- }
- zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) sapi_module.send_header, SG(server_context));
- if(SG(sapi_headers).send_default_content_type) {
- sapi_header_struct default_header;
-
- sapi_get_default_content_type_header(&default_header SLS_CC);
- sapi_module.send_header(&default_header, SG(server_context));
- sapi_free_header(&default_header);
- }
- sapi_module.send_header(NULL, SG(server_context));
- SG(headers_sent) = 1;
- ret = SUCCESS;
- break;
- case SAPI_HEADER_SEND_FAILED:
- ret = FAILURE;
- break;
- }
-
- if (SG(sapi_headers).http_status_line) {
- efree(SG(sapi_headers).http_status_line);
- }
-
- return ret;
-}
-
-
-SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries)
-{
- sapi_post_entry *p=post_entries;
-
- while (p->content_type) {
- if (sapi_register_post_entry(p)==FAILURE) {
- return FAILURE;
- }
- p++;
- }
- return SUCCESS;
-}
-
-
-SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry)
-{
- return zend_hash_add(&known_post_content_types, post_entry->content_type, post_entry->content_type_len+1, (void *) post_entry, sizeof(sapi_post_entry), NULL);
-}
-
-
-SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry)
-{
- zend_hash_del(&known_post_content_types, post_entry->content_type, post_entry->content_type_len+1);
-}
-
-
-SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(SLS_D))
-{
- sapi_module.default_post_reader = default_post_reader;
- return SUCCESS;
-}
-
-
-SAPI_API int sapi_flush()
-{
- if (sapi_module.flush) {
- SLS_FETCH();
-
- sapi_module.flush(SG(server_context));
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-SAPI_API struct stat *sapi_get_stat()
-{
- SLS_FETCH();
-
- if (sapi_module.get_stat) {
- return sapi_module.get_stat(SLS_C);
- } else {
- if (!SG(request_info).path_translated || (V_STAT(SG(request_info).path_translated, &SG(global_stat))==-1)) {
- return NULL;
- }
- return &SG(global_stat);
- }
-}
-
-
-SAPI_API char *sapi_getenv(char *name, int name_len)
-{
- if (sapi_module.getenv) {
- SLS_FETCH();
-
- return sapi_module.getenv(name, name_len SLS_CC);
- } else {
- return NULL;
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/SAPI.h b/main/SAPI.h
deleted file mode 100644
index e7bf31fc2d..0000000000
--- a/main/SAPI.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _NEW_SAPI_H
-#define _NEW_SAPI_H
-
-#include "zend.h"
-#include "zend_llist.h"
-#include "zend_operators.h"
-#include <sys/stat.h>
-
-#define SAPI_POST_BLOCK_SIZE 4000
-
-#ifdef PHP_WIN32
-# ifdef SAPI_EXPORTS
-# define SAPI_API __declspec(dllexport)
-# else
-# define SAPI_API __declspec(dllimport)
-# endif
-#else
-#define SAPI_API
-#endif
-
-
-typedef struct {
- char *header;
- uint header_len;
-} sapi_header_struct;
-
-
-typedef struct {
- zend_llist headers;
- int http_response_code;
- unsigned char send_default_content_type;
- char *http_status_line;
-} sapi_headers_struct;
-
-
-typedef struct _sapi_post_entry sapi_post_entry;
-typedef struct _sapi_module_struct sapi_module_struct;
-
-
-extern sapi_module_struct sapi_module; /* true global */
-
-
-typedef struct {
- char *request_method;
- char *query_string;
- char *post_data;
- char *cookie_data;
- uint content_length;
- uint post_data_length;
-
- char *path_translated;
- char *request_uri;
-
- char *content_type;
-
- unsigned char headers_only;
-
- sapi_post_entry *post_entry;
-
- char *content_type_dup;
-
- /* for HTTP authentication */
- char *auth_user;
- char *auth_password;
-
- /* this is necessary for the CGI SAPI module */
- char *argv0;
-
- /* this is necessary for Safe Mode */
- char *current_user;
- int current_user_length;
-} sapi_request_info;
-
-
-typedef struct {
- void *server_context;
- sapi_request_info request_info;
- sapi_headers_struct sapi_headers;
- int read_post_bytes;
- unsigned char headers_sent;
- struct stat global_stat;
- char *default_mimetype;
- char *default_charset;
-} sapi_globals_struct;
-
-
-#ifdef ZTS
-# define SLS_D sapi_globals_struct *sapi_globals
-# define SLS_DC , SLS_D
-# define SLS_C sapi_globals
-# define SLS_CC , SLS_C
-# define SG(v) (sapi_globals->v)
-# define SLS_FETCH() sapi_globals_struct *sapi_globals = ts_resource(sapi_globals_id)
-SAPI_API extern int sapi_globals_id;
-#else
-# define SLS_D void
-# define SLS_DC
-# define SLS_C
-# define SLS_CC
-# define SG(v) (sapi_globals.v)
-# define SLS_FETCH()
-extern SAPI_API sapi_globals_struct sapi_globals;
-#endif
-
-
-SAPI_API void sapi_startup(sapi_module_struct *sf);
-SAPI_API void sapi_shutdown(void);
-SAPI_API void sapi_activate(SLS_D);
-SAPI_API void sapi_deactivate(SLS_D);
-SAPI_API void sapi_initialize_empty_request(SLS_D);
-
-SAPI_API int sapi_add_header(char *header_line, uint header_line_len, zend_bool duplicate);
-SAPI_API int sapi_send_headers(void);
-SAPI_API void sapi_free_header(sapi_header_struct *sapi_header);
-SAPI_API void sapi_handle_post(void *arg SLS_DC);
-
-SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entry);
-SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry);
-SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry);
-SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(SLS_D));
-
-SAPI_API int sapi_flush(void);
-SAPI_API struct stat *sapi_get_stat(void);
-SAPI_API char *sapi_getenv(char *name, int name_len);
-
-SAPI_API char *sapi_get_default_content_type(SLS_D);
-SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header SLS_DC);
-SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len SLS_DC);
-
-struct _sapi_module_struct {
- char *name;
-
- int (*startup)(struct _sapi_module_struct *sapi_module);
- int (*shutdown)(struct _sapi_module_struct *sapi_module);
-
- int (*activate)(SLS_D);
- int (*deactivate)(SLS_D);
-
- int (*ub_write)(const char *str, unsigned int str_length);
- void (*flush)(void *server_context);
- struct stat *(*get_stat)(SLS_D);
- char *(*getenv)(char *name, int name_len SLS_DC);
-
- void (*sapi_error)(int type, const char *error_msg, ...);
-
- int (*header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC);
- int (*send_headers)(sapi_headers_struct *sapi_headers SLS_DC);
- void (*send_header)(sapi_header_struct *sapi_header, void *server_context);
-
- int (*read_post)(char *buffer, uint count_bytes SLS_DC);
- char *(*read_cookies)(SLS_D);
-
- void (*register_server_variables)(zval *track_vars_array ELS_DC SLS_DC PLS_DC);
- void (*log_message)(char *message);
-
- void (*block_interruptions)(void);
- void (*unblock_interruptions)(void);
-
- void (*default_post_reader)(SLS_D);
-};
-
-
-struct _sapi_post_entry {
- char *content_type;
- uint content_type_len;
- void (*post_reader)(SLS_D);
- void (*post_handler)(char *content_type_dup, void *arg SLS_DC);
-};
-
-/* header_handler() constants */
-#define SAPI_HEADER_ADD (1<<0)
-#define SAPI_HEADER_DELETE_ALL (1<<1)
-#define SAPI_HEADER_SEND_NOW (1<<2)
-
-
-#define SAPI_HEADER_SENT_SUCCESSFULLY 1
-#define SAPI_HEADER_DO_SEND 2
-#define SAPI_HEADER_SEND_FAILED 3
-
-#define SAPI_DEFAULT_MIMETYPE "text/html"
-#define SAPI_DEFAULT_CHARSET ""
-#define SAPI_PHP_VERSION_HEADER "X-Powered-By: PHP/" PHP_VERSION
-
-#define SAPI_POST_READER_FUNC(post_reader) void post_reader(SLS_D)
-#define SAPI_POST_HANDLER_FUNC(post_handler) void post_handler(char *content_type_dup, void *arg SLS_DC)
-
-SAPI_POST_READER_FUNC(sapi_read_standard_form_data);
-
-#define STANDARD_SAPI_MODULE_PROPERTIES NULL
-
-#endif /* _NEW_SAPI_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/alloca.c b/main/alloca.c
deleted file mode 100644
index 7c6cd4f192..0000000000
--- a/main/alloca.c
+++ /dev/null
@@ -1,490 +0,0 @@
-/* alloca.c -- allocate automatically reclaimed memory
- (Mostly) portable public-domain implementation -- D A Gwyn
-
- This implementation of the PWB library alloca function,
- which is used to allocate space off the run-time stack so
- that it is automatically reclaimed upon procedure exit,
- was inspired by discussions with J. Q. Johnson of Cornell.
- J.Otto Tennant <jot@cray.com> contributed the Cray support.
-
- There are some preprocessor constants that can
- be defined when compiling for your specific system, for
- improved efficiency; however, the defaults should be okay.
-
- The general concept of this implementation is to keep
- track of all alloca-allocated blocks, and reclaim any
- that are found to be deeper in the stack than the current
- invocation. This heuristic does not reclaim storage as
- soon as it becomes invalid, but it will do so eventually.
-
- As a special case, alloca(0) reclaims storage without
- allocating any. It is a good idea to use alloca(0) in
- your main control loop, etc. to force garbage collection. */
-
-#include "php_config.h"
-
-#if !HAVE_ALLOCA
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef emacs
-#include "blockinput.h"
-#endif
-
-/* If compiling with GCC 2, this file's not needed. */
-#if !defined (__GNUC__) || __GNUC__ < 2
-
-/* If someone has defined alloca as a macro,
- there must be some other way alloca is supposed to work. */
-#ifndef alloca
-
-#ifdef emacs
-#ifdef static
-/* actually, only want this if static is defined as ""
- -- this is for usg, in which emacs must undefine static
- in order to make unexec workable
- */
-#ifndef STACK_DIRECTION
-you
-lose
--- must know STACK_DIRECTION at compile-time
-#endif /* STACK_DIRECTION undefined */
-#endif /* static */
-#endif /* emacs */
-
-/* If your stack is a linked list of frames, you have to
- provide an "address metric" ADDRESS_FUNCTION macro. */
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-long i00afunc ();
-#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
-#else
-#define ADDRESS_FUNCTION(arg) &(arg)
-#endif
-
-#if __STDC__
-typedef void *pointer;
-#else
-typedef char *pointer;
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* Define STACK_DIRECTION if you know the direction of stack
- growth for your system; otherwise it will be automatically
- deduced at run-time.
-
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-
-#ifndef STACK_DIRECTION
-#define STACK_DIRECTION 0 /* Direction unknown. */
-#endif
-
-#if STACK_DIRECTION != 0
-
-#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
-
-#else /* STACK_DIRECTION == 0; need run-time code. */
-
-static int stack_dir; /* 1 or -1 once known. */
-#define STACK_DIR stack_dir
-
-static void
-find_stack_direction ()
-{
- static char *addr = NULL; /* Address of first `dummy', once known. */
- auto char dummy; /* To get stack address. */
-
- if (addr == NULL)
- { /* Initial entry. */
- addr = ADDRESS_FUNCTION (dummy);
-
- find_stack_direction (); /* Recurse once. */
- }
- else
- {
- /* Second entry. */
- if (ADDRESS_FUNCTION (dummy) > addr)
- stack_dir = 1; /* Stack grew upward. */
- else
- stack_dir = -1; /* Stack grew downward. */
- }
-}
-
-#endif /* STACK_DIRECTION == 0 */
-
-/* An "alloca header" is used to:
- (a) chain together all alloca'ed blocks;
- (b) keep track of stack depth.
-
- It is very important that sizeof(header) agree with malloc
- alignment chunk size. The following default should work okay. */
-
-#ifndef ALIGN_SIZE
-#define ALIGN_SIZE sizeof(double)
-#endif
-
-typedef union hdr
-{
- char align[ALIGN_SIZE]; /* To force sizeof(header). */
- struct
- {
- union hdr *next; /* For chaining headers. */
- char *deep; /* For stack depth measure. */
- } h;
-} header;
-
-static header *last_alloca_header = NULL; /* -> last alloca header. */
-
-/* Return a pointer to at least SIZE bytes of storage,
- which will be automatically reclaimed upon exit from
- the procedure that called alloca. Originally, this space
- was supposed to be taken from the current stack frame of the
- caller, but that method cannot be made to work for some
- implementations of C, for example under Gould's UTX/32. */
-
-pointer
-alloca (size)
- size_t size;
-{
- auto char probe; /* Probes stack depth: */
- register char *depth = ADDRESS_FUNCTION (probe);
-
-#if STACK_DIRECTION == 0
- if (STACK_DIR == 0) /* Unknown growth direction. */
- find_stack_direction ();
-#endif
-
- /* Reclaim garbage, defined as all alloca'd storage that
- was allocated from deeper in the stack than currently. */
-
- {
- register header *hp; /* Traverses linked list. */
-
-#ifdef emacs
- BLOCK_INPUT;
-#endif
-
- for (hp = last_alloca_header; hp != NULL;)
- if ((STACK_DIR > 0 && hp->h.deep > depth)
- || (STACK_DIR < 0 && hp->h.deep < depth))
- {
- register header *np = hp->h.next;
-
- free ((pointer) hp); /* Collect garbage. */
-
- hp = np; /* -> next header. */
- }
- else
- break; /* Rest are not deeper. */
-
- last_alloca_header = hp; /* -> last valid storage. */
-
-#ifdef emacs
- UNBLOCK_INPUT;
-#endif
- }
-
- if (size == 0)
- return NULL; /* No allocation required. */
-
- /* Allocate combined header + user data storage. */
-
- {
- register pointer new = malloc (sizeof (header) + size);
- /* Address of header. */
-
- if (new == 0)
- abort();
-
- ((header *) new)->h.next = last_alloca_header;
- ((header *) new)->h.deep = depth;
-
- last_alloca_header = (header *) new;
-
- /* User storage begins just after header. */
-
- return (pointer) ((char *) new + sizeof (header));
- }
-}
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-
-#ifdef DEBUG_I00AFUNC
-#include <stdio.h>
-#endif
-
-#ifndef CRAY_STACK
-#define CRAY_STACK
-#ifndef CRAY2
-/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
-struct stack_control_header
- {
- long shgrow:32; /* Number of times stack has grown. */
- long shaseg:32; /* Size of increments to stack. */
- long shhwm:32; /* High water mark of stack. */
- long shsize:32; /* Current size of stack (all segments). */
- };
-
-/* The stack segment linkage control information occurs at
- the high-address end of a stack segment. (The stack
- grows from low addresses to high addresses.) The initial
- part of the stack segment linkage control information is
- 0200 (octal) words. This provides for register storage
- for the routine which overflows the stack. */
-
-struct stack_segment_linkage
- {
- long ss[0200]; /* 0200 overflow words. */
- long sssize:32; /* Number of words in this segment. */
- long ssbase:32; /* Offset to stack base. */
- long:32;
- long sspseg:32; /* Offset to linkage control of previous
- segment of stack. */
- long:32;
- long sstcpt:32; /* Pointer to task common address block. */
- long sscsnm; /* Private control structure number for
- microtasking. */
- long ssusr1; /* Reserved for user. */
- long ssusr2; /* Reserved for user. */
- long sstpid; /* Process ID for pid based multi-tasking. */
- long ssgvup; /* Pointer to multitasking thread giveup. */
- long sscray[7]; /* Reserved for Cray Research. */
- long ssa0;
- long ssa1;
- long ssa2;
- long ssa3;
- long ssa4;
- long ssa5;
- long ssa6;
- long ssa7;
- long sss0;
- long sss1;
- long sss2;
- long sss3;
- long sss4;
- long sss5;
- long sss6;
- long sss7;
- };
-
-#else /* CRAY2 */
-/* The following structure defines the vector of words
- returned by the STKSTAT library routine. */
-struct stk_stat
- {
- long now; /* Current total stack size. */
- long maxc; /* Amount of contiguous space which would
- be required to satisfy the maximum
- stack demand to date. */
- long high_water; /* Stack high-water mark. */
- long overflows; /* Number of stack overflow ($STKOFEN) calls. */
- long hits; /* Number of internal buffer hits. */
- long extends; /* Number of block extensions. */
- long stko_mallocs; /* Block allocations by $STKOFEN. */
- long underflows; /* Number of stack underflow calls ($STKRETN). */
- long stko_free; /* Number of deallocations by $STKRETN. */
- long stkm_free; /* Number of deallocations by $STKMRET. */
- long segments; /* Current number of stack segments. */
- long maxs; /* Maximum number of stack segments so far. */
- long pad_size; /* Stack pad size. */
- long current_address; /* Current stack segment address. */
- long current_size; /* Current stack segment size. This
- number is actually corrupted by STKSTAT to
- include the fifteen word trailer area. */
- long initial_address; /* Address of initial segment. */
- long initial_size; /* Size of initial segment. */
- };
-
-/* The following structure describes the data structure which trails
- any stack segment. I think that the description in 'asdef' is
- out of date. I only describe the parts that I am sure about. */
-
-struct stk_trailer
- {
- long this_address; /* Address of this block. */
- long this_size; /* Size of this block (does not include
- this trailer). */
- long unknown2;
- long unknown3;
- long link; /* Address of trailer block of previous
- segment. */
- long unknown5;
- long unknown6;
- long unknown7;
- long unknown8;
- long unknown9;
- long unknown10;
- long unknown11;
- long unknown12;
- long unknown13;
- long unknown14;
- };
-
-#endif /* CRAY2 */
-#endif /* not CRAY_STACK */
-
-#ifdef CRAY2
-/* Determine a "stack measure" for an arbitrary ADDRESS.
- I doubt that "lint" will like this much. */
-
-static long
-i00afunc (long *address)
-{
- struct stk_stat status;
- struct stk_trailer *trailer;
- long *block, size;
- long result = 0;
-
- /* We want to iterate through all of the segments. The first
- step is to get the stack status structure. We could do this
- more quickly and more directly, perhaps, by referencing the
- $LM00 common block, but I know that this works. */
-
- STKSTAT (&status);
-
- /* Set up the iteration. */
-
- trailer = (struct stk_trailer *) (status.current_address
- + status.current_size
- - 15);
-
- /* There must be at least one stack segment. Therefore it is
- a fatal error if "trailer" is null. */
-
- if (trailer == 0)
- abort ();
-
- /* Discard segments that do not contain our argument address. */
-
- while (trailer != 0)
- {
- block = (long *) trailer->this_address;
- size = trailer->this_size;
- if (block == 0 || size == 0)
- abort ();
- trailer = (struct stk_trailer *) trailer->link;
- if ((block <= address) && (address < (block + size)))
- break;
- }
-
- /* Set the result to the offset in this segment and add the sizes
- of all predecessor segments. */
-
- result = address - block;
-
- if (trailer == 0)
- {
- return result;
- }
-
- do
- {
- if (trailer->this_size <= 0)
- abort ();
- result += trailer->this_size;
- trailer = (struct stk_trailer *) trailer->link;
- }
- while (trailer != 0);
-
- /* We are done. Note that if you present a bogus address (one
- not in any segment), you will get a different number back, formed
- from subtracting the address of the first block. This is probably
- not what you want. */
-
- return (result);
-}
-
-#else /* not CRAY2 */
-/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
- Determine the number of the cell within the stack,
- given the address of the cell. The purpose of this
- routine is to linearize, in some sense, stack addresses
- for alloca. */
-
-static long
-i00afunc (long address)
-{
- long stkl = 0;
-
- long size, pseg, this_segment, stack;
- long result = 0;
-
- struct stack_segment_linkage *ssptr;
-
- /* Register B67 contains the address of the end of the
- current stack segment. If you (as a subprogram) store
- your registers on the stack and find that you are past
- the contents of B67, you have overflowed the segment.
-
- B67 also points to the stack segment linkage control
- area, which is what we are really interested in. */
-
- stkl = CRAY_STACKSEG_END ();
- ssptr = (struct stack_segment_linkage *) stkl;
-
- /* If one subtracts 'size' from the end of the segment,
- one has the address of the first word of the segment.
-
- If this is not the first segment, 'pseg' will be
- nonzero. */
-
- pseg = ssptr->sspseg;
- size = ssptr->sssize;
-
- this_segment = stkl - size;
-
- /* It is possible that calling this routine itself caused
- a stack overflow. Discard stack segments which do not
- contain the target address. */
-
- while (!(this_segment <= address && address <= stkl))
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
-#endif
- if (pseg == 0)
- break;
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- this_segment = stkl - size;
- }
-
- result = address - this_segment;
-
- /* If you subtract pseg from the current end of the stack,
- you get the address of the previous stack segment's end.
- This seems a little convoluted to me, but I'll bet you save
- a cycle somewhere. */
-
- while (pseg != 0)
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o\n", pseg, size);
-#endif
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- result += size;
- }
- return (result);
-}
-
-#endif /* not CRAY2 */
-#endif /* CRAY */
-
-#endif /* no alloca */
-#endif /* not GCC version 2 */
-#endif /* HAVE_ALLOCA */
diff --git a/main/config.w32.h b/main/config.w32.h
deleted file mode 100644
index d7361ce8b2..0000000000
--- a/main/config.w32.h
+++ /dev/null
@@ -1,327 +0,0 @@
-/* config.w32.h. Configure file for win32 platforms */
-/* tested only with MS Visual C++ V5 */
-
-
-/* Define if PHP to setup it's own SIGCHLD handler (not needed on Win32) */
-#define PHP_SIGCHILD 0
-
-/* if you have resolv.lib and lib44bsd95.lib you can compile the extra
- dns functions located in dns.c. Set this to 1. add resolv.lib and
- lib33bsd95.lib to the project settings, and add the path to the
- bind include directory to the preprocessor settings. These libs
- are availabe in the ntbind distribution */
-#define HAVE_BINDLIB 1
-
-/* set to enable bcmath */
-#define WITH_BCMATH 1
-
-/* set to enable mysql */
-#define HAVE_MYSQL 1
-
-/* set to enable bundled PCRE library */
-#define HAVE_BUNDLED_PCRE 1
-
-/* set to enable bundled expat library */
-#define HAVE_LIBEXPAT 1
-#define HAVE_WDDX 1
-
-/* should be added to runtime config*/
-#define PHP_URL_FOPEN 1
-
-#define STDIN_FILENO 0
-#define STDOUT_FILENO 1
-#define STDERR_FILENO 2
-
-/* ----------------------------------------------------------------
- The following are defaults for run-time configuration
- ---------------------------------------------------------------*/
-
-#define PHP_SAFE_MODE 0
-#define MAGIC_QUOTES 0
-/* This is the default configuration file to read */
-#define CONFIGURATION_FILE_PATH "php.ini"
-#define USE_CONFIG_FILE 1
-
-/* Undefine if you want stricter XML/SGML compliance by default */
-/* this disables "<?expression?>" and "<?=expression?>" */
-#define DEFAULT_SHORT_OPEN_TAG 1
-
-#define PHP_TRACK_VARS 1
-
-/* ----------------------------------------------------------------
- The following defines are for those modules which require
- external libraries to compile. These will be removed from
- here in a future beta, as these modules will be moved out to dll's
- ---------------------------------------------------------------*/
-#if !defined(COMPILE_DL)
-#define HAVE_SNMP 0
-# define HAVE_ERRMSG_H 0 /*needed for mysql 3.21.17 and up*/
-#define DBASE 0
-#define NDBM 0
-#define GDBM 0
-#define BSD2 0
-#define HAVE_CRYPT 0
-#define HAVE_ORACLE 0
-#undef HAVE_ADABAS
-#undef HAVE_SOLID
-#define HAVE_MSQL 0
-#define HAVE_PGSQL 0
-#define HAVE_SYBASE 0
-#define HAVE_LIBGD 0
-#define HAVE_FILEPRO 0
-#define HAVE_ZLIB 0
-#endif
-/* ----------------------------------------------------------------
- The following may or may not be (or need to be) ported to the
- windows environment.
- ---------------------------------------------------------------*/
-
-/* Define if you have the link function. */
-#undef HAVE_LINK
-
-/* Define if you have the lockf function. */
-/* #undef HAVE_LOCKF */
-
-/* Define if you have the lrand48 function. */
-/* #undef HAVE_LRAND48 */
-
-/* Define if you have the srand48 function. */
-/* #undef HAVE_SRAND48 */
-
-/* Define if you have the symlink function. */
-#undef HAVE_SYMLINK
-
-/* Define if you have the usleep function. */
-#undef HAVE_USLEEP
-
-
-#define HAVE_GETCWD 1
-#define HAVE_POSIX_READDIR_R 1
-
-#define NEED_ISBLANK 1
-/* ----------------------------------------------------------------
- The following may be changed and played with right now, but
- will move to the "don't touch" list below eventualy.
- ---------------------------------------------------------------*/
-
-
-/* ----------------------------------------------------------------
- The following should never need to be played with
- Functions defined to 0 or remarked out are either already
- handled by the standard VC libraries, or are no longer needed, or
- simply will/can not be ported.
-
- DONT TOUCH!!!!! Unless you realy know what your messing with!
- ---------------------------------------------------------------*/
-
-#define DISCARD_PATH 1
-#undef HAVE_SETITIMER
-#undef HAVE_IODBC
-#define HAVE_UODBC 1
-#define HAVE_LIBDL 1
-#define HAVE_SENDMAIL 1
-#define HAVE_GETTIMEOFDAY 1
-#define HAVE_PUTENV 1
-#define HAVE_LIMITS_H 1
-
-#define HAVE_TZSET 1
-/* Define if you have the flock function. */
-#undef HAVE_FLOCK
-
-/* Define if using alloca.c. */
-/* #undef C_ALLOCA */
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
- This function is required for alloca.c support on those systems. */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-/* #undef gid_t */
-
-/* Define if you have alloca, as a function or macro. */
-#define HAVE_ALLOCA 1
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
-/* #undef HAVE_ALLOCA_H */
-
-/* Define if you have <sys/time.h> */
-#undef HAVE_SYS_TIME_H
-
-/* Define if you have <signal.h> */
-#define HAVE_SIGNAL_H 1
-
-/* Define if you don't have vprintf but do have _doprnt. */
-/* #undef HAVE_DOPRNT */
-
-/* Define if your struct stat has st_blksize. */
-#undef HAVE_ST_BLKSIZE
-
-/* Define if your struct stat has st_blocks. */
-#undef HAVE_ST_BLOCKS
-
-/* Define if your struct stat has st_rdev. */
-#define HAVE_ST_RDEV 1
-
-/* Define if utime(file, NULL) sets file's timestamp to the present. */
-#define HAVE_UTIME_NULL 1
-
-/* Define if you have the vprintf function. */
-#define HAVE_VPRINTF 1
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-/* #undef size_t */
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-/* #undef STACK_DIRECTION */
-
-/* Define if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define if your <sys/time.h> declares struct tm. */
-/* #undef TM_IN_SYS_TIME */
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-/* #undef uid_t */
-
-/* Define both of these if you want the bundled REGEX library */
-#define REGEX 1
-#define HSREGEX 1
-
-#define HAVE_PCRE 1
-
-/* Define if you have the gcvt function. */
-#define HAVE_GCVT 1
-
-/* Define if you have the getlogin function. */
-#define HAVE_GETLOGIN 1
-
-/* Define if you have the gettimeofday function. */
-#define HAVE_GETTIMEOFDAY 1
-
-/* Define if you have the memcpy function. */
-#define HAVE_MEMCPY 1
-
-/* Define if you have the strlcat function. */
-/* #undef HAVE_STRLCAT */
-
-/* Define if you have the strlcpy function. */
-/* #undef HAVE_STRLCPY */
-
-/* Define if you have the memmove function. */
-#define HAVE_MEMMOVE 1
-
-/* Define if you have the putenv function. */
-#define HAVE_PUTENV 1
-
-/* Define if you have the regcomp function. */
-#define HAVE_REGCOMP 1
-
-/* Define if you have the setlocale function. */
-#define HAVE_SETLOCALE 1
-
-#define HAVE_LOCALE_H 1
-
-/* Define if you have the setvbuf function. */
-#ifndef HAVE_BINDLIB
-#define HAVE_SETVBUF 1
-#endif
-
-/* Define if you have the snprintf function. */
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-/* Define if you have the strcasecmp function. */
-#define HAVE_STRCASECMP 1
-
-/* Define if you have the strdup function. */
-#define HAVE_STRDUP 1
-
-/* Define if you have the strerror function. */
-#define HAVE_STRERROR 1
-
-/* Define if you have the strstr function. */
-#define HAVE_STRSTR 1
-
-/* Define if you have the tempnam function. */
-#define HAVE_TEMPNAM 1
-
-/* Define if you have the utime function. */
-#define HAVE_UTIME 1
-
-/* Define if you have the <crypt.h> header file. */
-/* #undef HAVE_CRYPT_H */
-
-/* Define if you have the <dirent.h> header file. */
-#undef HAVE_DIRENT_H
-
-/* Define if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define if you have the <grp.h> header file. */
-#define HAVE_GRP_H 0
-
-/* Define if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define if you have the <ndir.h> header file. */
-/* #undef HAVE_NDIR_H */
-
-/* Define if you have the <pwd.h> header file. */
-#define HAVE_PWD_H 1
-
-/* Define if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define if you have the <sys/dir.h> header file. */
-/* #undef HAVE_SYS_DIR_H */
-
-/* Define if you have the <sys/file.h> header file. */
-#undef HAVE_SYS_FILE_H
-
-/* Define if you have the <sys/ndir.h> header file. */
-/* #undef HAVE_SYS_NDIR_H */
-
-/* Define if you have the <sys/socket.h> header file. */
-#undef HAVE_SYS_SOCKET_H
-
-/* Define if you have the <sys/wait.h> header file. */
-#undef HAVE_SYS_WAIT_H
-
-/* Define if you have the <syslog.h> header file. */
-#define HAVE_SYSLOG_H 1
-
-/* Define if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define if you have the crypt library (-lcrypt). */
-/* #undef HAVE_LIBCRYPT 0 */
-
-/* Define if you have the dl library (-ldl). */
-#define HAVE_LIBDL 1
-
-/* Define if you have the m library (-lm). */
-#define HAVE_LIBM 1
-
-/* Define if you have the nsl library (-lnsl). */
-/* #undef HAVE_LIBNSL */
-
-/* Define if you have the socket library (-lsocket). */
-/* #undef HAVE_LIBSOCKET */
-
-/* Define if you have the cuserid function. */
-#define HAVE_CUSERID 0
-
-/* Define if you have the rint function. */
-#undef HAVE_RINT
-
-#define HAVE_STRFTIME 1
-
-/* Default directory for loading extensions. */
-#define PHP_EXTENSION_DIR NULL
-
-#define SIZEOF_INT 4
diff --git a/main/configuration-parser.y b/main/configuration-parser.y
deleted file mode 100644
index 0e8b57bced..0000000000
--- a/main/configuration-parser.y
+++ /dev/null
@@ -1,582 +0,0 @@
-%{
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-
-/* $Id$ */
-
-#define DEBUG_CFG_PARSER 0
-#include "php.h"
-#include "php_globals.h"
-#include "php_ini.h"
-#include "ext/standard/dl.h"
-#include "ext/standard/file.h"
-#include "ext/standard/php_browscap.h"
-#include "zend_extensions.h"
-
-
-#if WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <winbase.h>
-#include "win32/wfile.h"
-#endif
-
-#define YYSTYPE zval
-
-#define PARSING_MODE_CFG 0
-#define PARSING_MODE_BROWSCAP 1
-#define PARSING_MODE_STANDALONE 2
-
-static HashTable configuration_hash;
-extern HashTable browser_hash;
-PHPAPI extern char *php_ini_path;
-static HashTable *active_hash_table;
-static zval *current_section;
-static char *currently_parsed_filename;
-
-static int parsing_mode;
-
-zval yylval;
-
-extern int cfglex(zval *cfglval);
-extern FILE *cfgin;
-extern int cfglineno;
-extern void init_cfg_scanner(void);
-
-zval *cfg_get_entry(char *name, uint name_length)
-{
- zval *tmp;
-
- if (zend_hash_find(&configuration_hash, name, name_length, (void **) &tmp)==SUCCESS) {
- return tmp;
- } else {
- return NULL;
- }
-}
-
-
-PHPAPI int cfg_get_long(char *varname,long *result)
-{
- zval *tmp,var;
-
- if (zend_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) {
- *result=(long)NULL;
- return FAILURE;
- }
- var = *tmp;
- zval_copy_ctor(&var);
- convert_to_long(&var);
- *result = var.value.lval;
- return SUCCESS;
-}
-
-
-PHPAPI int cfg_get_double(char *varname,double *result)
-{
- zval *tmp,var;
-
- if (zend_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) {
- *result=(double)0;
- return FAILURE;
- }
- var = *tmp;
- zval_copy_ctor(&var);
- convert_to_double(&var);
- *result = var.value.dval;
- return SUCCESS;
-}
-
-
-PHPAPI int cfg_get_string(char *varname, char **result)
-{
- zval *tmp;
-
- if (zend_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) {
- *result=NULL;
- return FAILURE;
- }
- *result = tmp->value.str.val;
- return SUCCESS;
-}
-
-
-static void yyerror(char *str)
-{
- char *error_buf;
- int error_buf_len;
-
- error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */
- error_buf = (char *) emalloc(error_buf_len);
-
- sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, cfglineno);
-#ifdef PHP_WIN32
- MessageBox(NULL, error_buf, "PHP Error", MB_OK);
-#else
- fprintf(stderr, "PHP: %s", error_buf);
-#endif
- efree(error_buf);
-}
-
-
-static void pvalue_config_destructor(zval *pvalue)
-{
- if (pvalue->type == IS_STRING && pvalue->value.str.val != empty_string) {
- free(pvalue->value.str.val);
- }
-}
-
-
-static void pvalue_browscap_destructor(zval *pvalue)
-{
- if (pvalue->type == IS_OBJECT || pvalue->type == IS_ARRAY) {
- zend_hash_destroy(pvalue->value.obj.properties);
- free(pvalue->value.obj.properties);
- }
-}
-
-
-int php_init_config(void)
-{
- PLS_FETCH();
-
- if (zend_hash_init(&configuration_hash, 0, NULL, (dtor_func_t) pvalue_config_destructor, 1)==FAILURE) {
- return FAILURE;
- }
-
-#if USE_CONFIG_FILE
- {
- char *env_location,*default_location,*php_ini_search_path;
- int safe_mode_state = PG(safe_mode);
- char *open_basedir = PG(open_basedir);
- char *opened_path;
- int free_default_location=0;
-
- env_location = getenv("PHPRC");
- if (!env_location) {
- env_location="";
- }
-#ifdef PHP_WIN32
- {
- if (php_ini_path) {
- default_location = php_ini_path;
- } else {
- default_location = (char *) malloc(512);
-
- if (!GetWindowsDirectory(default_location,255)) {
- default_location[0]=0;
- }
- free_default_location=1;
- }
- }
-#else
- if (!php_ini_path) {
- default_location = CONFIGURATION_FILE_PATH;
- } else {
- default_location = php_ini_path;
- }
-#endif
-
-/* build a path */
- php_ini_search_path = (char *) malloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
-
- if (!php_ini_path) {
-#ifdef PHP_WIN32
- sprintf(php_ini_search_path,".;%s;%s",env_location,default_location);
-#else
- sprintf(php_ini_search_path,".:%s:%s",env_location,default_location);
-#endif
- } else {
- /* if path was set via -c flag, only look there */
- strcpy(php_ini_search_path,default_location);
- }
- PG(safe_mode) = 0;
- PG(open_basedir) = NULL;
- cfgin = php_fopen_with_path("php.ini","r",php_ini_search_path,&opened_path);
- free(php_ini_search_path);
- if (free_default_location) {
- free(default_location);
- }
- PG(safe_mode) = safe_mode_state;
- PG(open_basedir) = open_basedir;
-
- if (!cfgin) {
- return SUCCESS; /* having no configuration file is ok */
- }
-
- if (opened_path) {
- zval tmp;
-
- tmp.value.str.val = opened_path;
- tmp.value.str.len = strlen(opened_path);
- tmp.type = IS_STRING;
- zend_hash_update(&configuration_hash,"cfg_file_path",sizeof("cfg_file_path"),(void *) &tmp,sizeof(zval),NULL);
-#if DEBUG_CFG_PARSER
- php_printf("INI file opened at '%s'\n",opened_path);
-#endif
- }
-
- init_cfg_scanner();
- active_hash_table = &configuration_hash;
- parsing_mode = PARSING_MODE_CFG;
- currently_parsed_filename = "php.ini";
- yyparse();
- fclose(cfgin);
- }
-
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_MINIT_FUNCTION(browscap)
-{
- char *browscap = INI_STR("browscap");
-
- if (browscap) {
- if (zend_hash_init(&browser_hash, 0, NULL, (dtor_func_t) pvalue_browscap_destructor, 1)==FAILURE) {
- return FAILURE;
- }
-
- cfgin = V_FOPEN(browscap, "r");
- if (!cfgin) {
- php_error(E_WARNING,"Cannot open '%s' for reading", browscap);
- return FAILURE;
- }
- init_cfg_scanner();
- active_hash_table = &browser_hash;
- parsing_mode = PARSING_MODE_BROWSCAP;
- currently_parsed_filename = browscap;
- yyparse();
- fclose(cfgin);
- }
-
- return SUCCESS;
-}
-
-
-/* {{{ proto void parse_ini_file(string filename)
- Parse configuration file */
-PHP_FUNCTION(parse_ini_file)
-{
-#ifdef ZTS
- php_error(E_WARNING, "parse_ini_file() is not supported in multithreaded PHP");
- RETURN_FALSE;
-#else
- zval **filename;
-
- if (ARG_COUNT(ht)!=1 || zend_get_parameters_ex(1, &filename)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
- cfgin = V_FOPEN((*filename)->value.str.val, "r");
- if (!cfgin) {
- php_error(E_WARNING,"Cannot open '%s' for reading", (*filename)->value.str.val);
- return;
- }
- array_init(return_value);
- init_cfg_scanner();
- active_hash_table = return_value->value.ht;
- parsing_mode = PARSING_MODE_STANDALONE;
- currently_parsed_filename = (*filename)->value.str.val;
- yyparse();
- fclose(cfgin);
-#endif
-}
-/* }}} */
-
-int php_shutdown_config(void)
-{
- zend_hash_destroy(&configuration_hash);
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(browscap)
-{
- if (INI_STR("browscap")) {
- zend_hash_destroy(&browser_hash);
- }
- return SUCCESS;
-}
-
-
-static void convert_browscap_pattern(zval *pattern)
-{
- register int i,j;
- char *t;
-
- for (i=0; i<pattern->value.str.len; i++) {
- if (pattern->value.str.val[i]=='*' || pattern->value.str.val[i]=='?') {
- break;
- }
- }
-
- if (i==pattern->value.str.len) { /* no wildcards */
- pattern->value.str.val = zend_strndup(pattern->value.str.val, pattern->value.str.len);
- }
-
- t = (char *) malloc(pattern->value.str.len*2);
-
- for (i=0,j=0; i<pattern->value.str.len; i++,j++) {
- switch (pattern->value.str.val[i]) {
- case '?':
- t[j] = '.';
- break;
- case '*':
- t[j++] = '.';
- t[j] = '*';
- break;
- case '.':
- t[j++] = '\\';
- t[j] = '.';
- break;
- default:
- t[j] = pattern->value.str.val[i];
- break;
- }
- }
- t[j]=0;
- pattern->value.str.val = t;
- pattern->value.str.len = j;
-}
-
-
-void do_cfg_op(char type, zval *result, zval *op1, zval *op2)
-{
- int i_result;
- int i_op1, i_op2;
- char str_result[MAX_LENGTH_OF_LONG];
-
- i_op1 = atoi(op1->value.str.val);
- free(op1->value.str.val);
- if (op2) {
- i_op2 = atoi(op2->value.str.val);
- free(op2->value.str.val);
- } else {
- i_op2 = 0;
- }
-
- switch (type) {
- case '|':
- i_result = i_op1 | i_op2;
- break;
- case '&':
- i_result = i_op1 & i_op2;
- break;
- case '~':
- i_result = ~i_op1;
- break;
- default:
- i_result = 0;
- break;
- }
-
- result->value.str.len = zend_sprintf(str_result, "%d", i_result);
- result->value.str.val = (char *) malloc(result->value.str.len+1);
- memcpy(result->value.str.val, str_result, result->value.str.len);
- result->value.str.val[result->value.str.len] = 0;
- result->type = IS_STRING;
-}
-
-
-void do_cfg_get_constant(zval *result, zval *name)
-{
- zval z_constant;
-
- if (zend_get_constant(name->value.str.val, name->value.str.len, &z_constant)) {
- /* z_constant is emalloc()'d */
- convert_to_string(&z_constant);
- result->value.str.val = zend_strndup(z_constant.value.str.val, z_constant.value.str.len);
- result->value.str.len = z_constant.value.str.len;
- result->type = z_constant.type;
- zval_dtor(&z_constant);
- free(name->value.str.val);
- } else {
- *result = *name;
- }
-}
-
-
-%}
-
-%pure_parser
-%token TC_STRING
-%token TC_ENCAPSULATED_STRING
-%token SECTION
-%token CFG_TRUE
-%token CFG_FALSE
-%token EXTENSION
-%token T_ZEND_EXTENSION
-%token T_ZEND_EXTENSION_TS
-%token T_ZEND_EXTENSION_DEBUG
-%token T_ZEND_EXTENSION_DEBUG_TS
-%left '|' '&'
-%right '~'
-
-%%
-
-statement_list:
- statement_list statement
- | /* empty */
-;
-
-statement:
- TC_STRING '=' string_or_value {
-#if DEBUG_CFG_PARSER
- printf("'%s' = '%s'\n",$1.value.str.val,$3.value.str.val);
-#endif
- $3.type = IS_STRING;
- switch (parsing_mode) {
- case PARSING_MODE_CFG:
- zend_hash_update(active_hash_table, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(zval), NULL);
- if (active_hash_table == &configuration_hash) {
- php_alter_ini_entry($1.value.str.val, $1.value.str.len+1, $3.value.str.val, $3.value.str.len+1, PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP);
- }
- break;
- case PARSING_MODE_BROWSCAP:
- if (current_section) {
- zval *new_property;
-
- new_property = (zval *) malloc(sizeof(zval));
- INIT_PZVAL(new_property);
- new_property->value.str.val = $3.value.str.val;
- new_property->value.str.len = $3.value.str.len;
- new_property->type = IS_STRING;
- zend_str_tolower(new_property->value.str.val, new_property->value.str.len);
- zend_hash_update(current_section->value.obj.properties, $1.value.str.val, $1.value.str.len+1, &new_property, sizeof(zval *), NULL);
- }
- break;
- case PARSING_MODE_STANDALONE: {
- zval *entry;
-
- MAKE_STD_ZVAL(entry);
- entry->value.str.val = estrndup($3.value.str.val, $3.value.str.len);
- entry->value.str.len = $3.value.str.len;
- entry->type = IS_STRING;
- zend_hash_update(active_hash_table, $1.value.str.val, $1.value.str.len+1, &entry, sizeof(zval *), NULL);
- pvalue_config_destructor(&$3);
- }
- break;
- }
- free($1.value.str.val);
- }
- | TC_STRING { free($1.value.str.val); }
- | EXTENSION '=' cfg_string {
- if (parsing_mode==PARSING_MODE_CFG) {
- zval dummy;
-
-#if DEBUG_CFG_PARSER
- printf("Loading '%s'\n",$3.value.str.val);
-#endif
- php_dl(&$3,MODULE_PERSISTENT,&dummy);
- }
- }
- | T_ZEND_EXTENSION '=' cfg_string {
- if (parsing_mode==PARSING_MODE_CFG) {
-#if !defined(ZTS) && !ZEND_DEBUG
- zend_load_extension($3.value.str.val);
-#endif
- free($3.value.str.val);
- }
- }
- | T_ZEND_EXTENSION_TS '=' cfg_string {
- if (parsing_mode==PARSING_MODE_CFG) {
-#if defined(ZTS) && !ZEND_DEBUG
- zend_load_extension($3.value.str.val);
-#endif
- free($3.value.str.val);
- }
- }
- | T_ZEND_EXTENSION_DEBUG '=' cfg_string {
- if (parsing_mode==PARSING_MODE_CFG) {
-#if !defined(ZTS) && ZEND_DEBUG
- zend_load_extension($3.value.str.val);
-#endif
- free($3.value.str.val);
- }
- }
- | T_ZEND_EXTENSION_DEBUG_TS '=' cfg_string {
- if (parsing_mode==PARSING_MODE_CFG) {
-#if defined(ZTS) && ZEND_DEBUG
- zend_load_extension($3.value.str.val);
-#endif
- free($3.value.str.val);
- }
- }
- | SECTION {
- if (parsing_mode==PARSING_MODE_BROWSCAP) {
- zval *processed;
-
- /*printf("'%s' (%d)\n",$1.value.str.val,$1.value.str.len+1);*/
- current_section = (zval *) malloc(sizeof(zval));
- INIT_PZVAL(current_section);
- processed = (zval *) malloc(sizeof(zval));
- INIT_PZVAL(processed);
-
- current_section->value.obj.ce = &zend_standard_class_def;
- current_section->value.obj.properties = (HashTable *) malloc(sizeof(HashTable));
- current_section->type = IS_OBJECT;
- zend_hash_init(current_section->value.obj.properties, 0, NULL, (dtor_func_t) pvalue_config_destructor, 1);
- zend_hash_update(active_hash_table, $1.value.str.val, $1.value.str.len+1, (void *) &current_section, sizeof(zval *), NULL);
-
- processed->value.str.val = $1.value.str.val;
- processed->value.str.len = $1.value.str.len;
- processed->type = IS_STRING;
- convert_browscap_pattern(processed);
- zend_hash_update(current_section->value.obj.properties, "browser_name_pattern", sizeof("browser_name_pattern"), (void *) &processed, sizeof(zval *), NULL);
- }
- free($1.value.str.val);
- }
- | '\n'
-;
-
-
-cfg_string:
- TC_STRING { $$ = $1; }
- | TC_ENCAPSULATED_STRING { $$ = $1; }
-;
-
-string_or_value:
- expr { $$ = $1; }
- | TC_ENCAPSULATED_STRING { $$ = $1; }
- | CFG_TRUE { $$ = $1; }
- | CFG_FALSE { $$ = $1; }
- | '\n' { $$.value.str.val = strdup(""); $$.value.str.len=0; $$.type = IS_STRING; }
- | '\0' { $$.value.str.val = strdup(""); $$.value.str.len=0; $$.type = IS_STRING; }
-;
-
-expr:
- constant_string { $$ = $1; }
- | expr '|' expr { do_cfg_op('|', &$$, &$1, &$3); }
- | expr '&' expr { do_cfg_op('&', &$$, &$1, &$3); }
- | '~' expr { do_cfg_op('~', &$$, &$2, NULL); }
- | '(' expr ')' { $$ = $2; }
-;
-
-constant_string:
- TC_STRING { do_cfg_get_constant(&$$, &$1); }
-;
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/configuration-scanner.l b/main/configuration-scanner.l
deleted file mode 100644
index a13d074d9b..0000000000
--- a/main/configuration-scanner.l
+++ /dev/null
@@ -1,182 +0,0 @@
-%{
-
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "php.h"
-#include "configuration-parser.h"
-
-#undef YYSTYPE
-#define YYSTYPE pval
-
-#define YY_DECL cfglex(pval *cfglval)
-
-
-void init_cfg_scanner()
-{
- cfglineno=1;
-}
-
-
-%}
-
-%option noyywrap
-%option yylineno
-
-%%
-
-<INITIAL>"extension" {
-#if 0
- printf("found extension\n");
-#endif
- return EXTENSION;
-}
-
-
-<INITIAL>"zend_extension" {
- return T_ZEND_EXTENSION;
-}
-
-
-<INITIAL>"zend_extension_ts" {
- return T_ZEND_EXTENSION_TS;
-}
-
-
-<INITIAL>"zend_extension_debug" {
- return T_ZEND_EXTENSION_DEBUG;
-}
-
-
-<INITIAL>"zend_extension_debug_ts" {
- return T_ZEND_EXTENSION_DEBUG_TS;
-}
-
-
-<INITIAL>[ ]*("true"|"on"|"yes")[ ]* {
- cfglval->value.str.val = zend_strndup("1",1);
- cfglval->value.str.len = 1;
- cfglval->type = IS_STRING;
- return CFG_TRUE;
-}
-
-
-<INITIAL>[ ]*("false"|"off"|"no"|"none")[ ]* {
- cfglval->value.str.val = zend_strndup("",0);
- cfglval->value.str.len = 0;
- cfglval->type = IS_STRING;
- return CFG_FALSE;
-}
-
-<INITIAL>[[][^[]+[\]]([\n]?|"\r\n"?) {
- /* SECTION */
-
- /* eat trailng ] */
- while (yyleng>0 && (yytext[yyleng-1]=='\n' || yytext[yyleng-1]=='\r' || yytext[yyleng-1]==']')) {
- yyleng--;
- yytext[yyleng]=0;
- }
-
- /* eat leading [ */
- yytext++;
- yyleng--;
-
- cfglval->value.str.val = zend_strndup(yytext,yyleng);
- cfglval->value.str.len = yyleng;
- cfglval->type = IS_STRING;
- return SECTION;
-}
-
-
-<INITIAL>["][^\n\r"]*["] {
- /* ENCAPSULATED TC_STRING */
-
- /* eat trailing " */
- yytext[yyleng-1]=0;
-
- /* eat leading " */
- yytext++;
-
- cfglval->value.str.val = zend_strndup(yytext,yyleng);
- cfglval->value.str.len = yyleng;
- cfglval->type = IS_STRING;
- return TC_ENCAPSULATED_STRING;
-}
-
-<INITIAL>[&|~()] {
- return yytext[0];
-}
-
-
-<INITIAL>[^=\n\r\t;|&~()"]+ {
- /* STRING */
- register int i;
-
- /* eat trailing whitespace */
- for (i=yyleng-1; i>=0; i--) {
- if (yytext[i]==' ' || yytext[i]=='\t') {
- yytext[i]=0;
- yyleng--;
- } else {
- break;
- }
- }
- /* eat leading whitespace */
- while (yytext[0]) {
- if (yytext[0]==' ' || yytext[0]=='\t') {
- yytext++;
- yyleng--;
- } else {
- break;
- }
- }
- if (yyleng!=0) {
- cfglval->value.str.val = zend_strndup(yytext,yyleng);
- cfglval->value.str.len = yyleng;
- cfglval->type = IS_STRING;
- return TC_STRING;
- } else {
- /* whitespace */
- }
-}
-
-
-
-<INITIAL>[=\n] {
- return yytext[0];
-}
-
-<INITIAL>"\r\n" {
- return '\n';
-}
-
-<INITIAL>[;][^\r\n]*[\r\n]? {
- /* comment */
- return '\n';
-}
-
-<INITIAL>[ \t] {
- /* eat whitespace */
-}
-
-<INITIAL>. {
-#if DEBUG
- php_error(E_NOTICE,"Unexpected character on line %d: '%s' (ASCII %d)\n",yylineno,yytext,yytext[0]);
-#endif
-}
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
deleted file mode 100644
index 1fad046d10..0000000000
--- a/main/fopen_wrappers.c
+++ /dev/null
@@ -1,1169 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "SAPI.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#ifdef PHP_WIN32
-#include <windows.h>
-#include <winsock.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#else
-#include <sys/param.h>
-#endif
-
-#include "safe_mode.h"
-#include "php_realpath.h"
-#include "ext/standard/head.h"
-#include "ext/standard/php_standard.h"
-#include "zend_compile.h"
-
-#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-
-#include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG(mode) (((mode)&S_IFMT) & S_IFREG)
-#endif
-
-#ifdef PHP_WIN32
-#include <winsock.h>
-#else
-#include <netinet/in.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-#endif
-
-#ifdef PHP_WIN32
-#undef AF_UNIX
-#endif
-
-#if defined(AF_UNIX)
-#include <sys/un.h>
-#endif
-
-
-typedef FILE * (*php_fopen_url_wrapper_t) (const char *, char *, int, int *, int *, char **) ;
-
-static FILE *php_fopen_url_wrapper(const char *, char *, int, int *, int *, char **);
-static FILE *php_fopen_url_wrap_http(const char *, char *, int, int *, int *, char **);
-static FILE *php_fopen_url_wrap_ftp(const char *, char *, int, int *, int *, char **);
-static FILE *php_fopen_url_wrap_php(const char *, char *, int, int *, int *, char **);
-
-int php_get_ftp_result(int socketd);
-
-
-
-HashTable fopen_url_wrappers_hash;
-
-PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)) {
-#if PHP_URL_FOPEN
- return zend_hash_add(&fopen_url_wrappers_hash, protocol, strlen(protocol)+1, &wrapper, sizeof(wrapper), NULL);
-#else
- return FAILURE;
-#endif
-}
-
-PHPAPI int php_unregister_url_wrapper(char *protocol) {
-#if PHP_URL_FOPEN
- return zend_hash_del(&fopen_url_wrappers_hash, protocol, strlen(protocol)+1);
-#else
- return SUCCESS;
-#endif
-}
-
-int php_init_fopen_wrappers(void)
-{
- int status = SUCCESS;
-#if PHP_URL_FOPEN
- if (zend_hash_init(&fopen_url_wrappers_hash, 0, NULL, NULL, 1)==FAILURE) {
- return FAILURE;
- }
-
- if(FAILURE==php_register_url_wrapper("http",php_fopen_url_wrap_http)) {
- status = FAILURE;
- } else
- if(FAILURE==php_register_url_wrapper("ftp",php_fopen_url_wrap_ftp)) {
- status = FAILURE;
- } else
- if(FAILURE==php_register_url_wrapper("php",php_fopen_url_wrap_php)) {
- status = FAILURE;
- }
-
- if(FAILURE==status) {
- zend_hash_destroy(&fopen_url_wrappers_hash);
- }
-#endif
- return status;
-}
-
-int php_shutdown_fopen_wrappers(void)
-{
-#if PHP_URL_FOPEN
- zend_hash_destroy(&fopen_url_wrappers_hash);
-#endif
-
- return SUCCESS;
-}
-
-
-/*
- When open_basedir is not NULL, check if the given filename is located in
- open_basedir. Returns -1 if error or not in the open_basedir, else 0
-
- When open_basedir is NULL, always return 0
-*/
-PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC)
-{
- char resolved_name[MAXPATHLEN];
- char resolved_basedir[MAXPATHLEN];
- char local_open_basedir[MAXPATHLEN];
- int local_open_basedir_pos;
- SLS_FETCH();
-
- /* Special case basedir==".": Use script-directory */
- if ((strcmp(PG(open_basedir), ".") == 0) &&
- SG(request_info).path_translated &&
- *SG(request_info).path_translated
- ) {
- strlcpy(local_open_basedir, SG(request_info).path_translated, sizeof(local_open_basedir));
- local_open_basedir_pos = strlen(local_open_basedir) - 1;
-
- /* Strip filename */
- while ((
-#ifdef PHP_WIN32
- (local_open_basedir[local_open_basedir_pos] != '\\') ||
-#endif
- (local_open_basedir[local_open_basedir_pos] != '/')
- ) &&
- (local_open_basedir_pos >= 0)
- ) {
- local_open_basedir[local_open_basedir_pos--] = 0;
- }
- } else {
- /* Else use the unmodified path */
- strlcpy(local_open_basedir, basedir, sizeof(local_open_basedir));
- }
-
- /* Resolve the real path into resolved_name */
- if ((php_realpath(path, resolved_name) != NULL) && (php_realpath(local_open_basedir, resolved_basedir) != NULL)) {
- /* Check the path */
-#ifdef PHP_WIN32
- if (strncasecmp(resolved_basedir, resolved_name, strlen(resolved_basedir)) == 0) {
-#else
- if (strncmp(resolved_basedir, resolved_name, strlen(resolved_basedir)) == 0) {
-#endif
- /* File is in the right directory */
- return 0;
- } else {
- return -1;
- }
- } else {
- /* Unable to resolve the real path, return -1 */
- return -1;
- }
-}
-
-PHPAPI int php_check_open_basedir(char *path)
-{
- PLS_FETCH();
-
- /* Only check when open_basedir is available */
- if (PG(open_basedir) && *PG(open_basedir)) {
- char *pathbuf;
- char *ptr;
- char *end;
-
- pathbuf = estrdup(PG(open_basedir));
-
- ptr = pathbuf;
-
- while (ptr && *ptr) {
-#ifdef PHP_WIN32
- end = strchr(ptr, ';');
-#else
- end = strchr(ptr, ':');
-#endif
- if (end != NULL) {
- *end = '\0';
- end++;
- }
-
- if (php_check_specific_open_basedir(ptr, path PLS_CC) == 0) {
- efree(pathbuf);
- return 0;
- }
-
- ptr = end;
- }
- php_error(E_WARNING, "open_basedir restriction in effect. File is in wrong directory.");
- efree(pathbuf);
- return -1;
- }
-
- /* Nothing to check... */
- return 0;
-}
-
-PHPAPI FILE *php_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
-{
- int cm=2; /* checkuid mode: 2 = if file does not exist, check directory */
- PLS_FETCH();
-
- if (opened_path) {
- *opened_path = NULL;
- }
-
- /* FIXME Lets not get in the habit of doing stuff like this. This should
- be runtime enabled, NOT compile time. */
-#if PHP_URL_FOPEN
- if (!(options & IGNORE_URL)) {
- return php_fopen_url_wrapper(path, mode, options, issock, socketd, opened_path);
- }
-#endif
-
- if (options & USE_PATH && PG(include_path) != NULL) {
- return php_fopen_with_path(path, mode, PG(include_path), opened_path);
- } else {
- FILE *fp;
-
- if (!strcmp(mode,"r") || !strcmp(mode,"r+")) {
- cm=0;
- }
- if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!php_checkuid(path, cm))) {
- return NULL;
- }
- if (php_check_open_basedir(path)) {
- return NULL;
- }
- fp = V_FOPEN(path, mode);
- if (fp && opened_path) {
- *opened_path = expand_filepath(path);
- }
- return fp;
- }
-}
-
-
-PHPAPI FILE *php_fopen_primary_script(void)
-{
- FILE *fp;
- struct stat st;
- char *temp, *path_info, *fn;
- int l;
- PLS_FETCH();
- SLS_FETCH();
-
- fn = SG(request_info).path_translated;
- path_info = SG(request_info).request_uri;
-#if HAVE_PWD_H
- if (PG(user_dir) && *PG(user_dir)
- && path_info && '/' == path_info[0] && '~' == path_info[1]) {
-
- char user[32];
- struct passwd *pw;
- char *s = strchr(path_info + 2, '/');
-
- fn = NULL; /* discard the original filename, it must not be used */
- if (s) { /* if there is no path name after the file, do not bother
- to try open the directory */
- l = s - (path_info + 2);
- if (l > sizeof(user) - 1)
- l = sizeof(user) - 1;
- memcpy(user, path_info + 2, l);
- user[l] = '\0';
-
- pw = getpwnam(user);
- if (pw && pw->pw_dir) {
- fn = emalloc(strlen(PG(user_dir)) + strlen(path_info) + strlen(pw->pw_dir) + 4);
- if (fn) {
- strcpy(fn, pw->pw_dir); /* safe */
- strcat(fn, "/"); /* safe */
- strcat(fn, PG(user_dir)); /* safe */
- strcat(fn, "/"); /* safe */
- strcat(fn, s + 1); /* safe (shorter than path_info) */
- STR_FREE(SG(request_info).path_translated);
- SG(request_info).path_translated = fn;
- }
- }
- }
- } else
-#endif
-#ifdef PHP_WIN32
- if (PG(doc_root) && path_info && ('/' == *PG(doc_root) ||
- '\\' == *PG(doc_root) || strstr(PG(doc_root),":\\") ||
- strstr(PG(doc_root),":/"))) {
-#else
- if (PG(doc_root) && '/' == *PG(doc_root) && path_info) {
-#endif
- l = strlen(PG(doc_root));
- fn = emalloc(l + strlen(path_info) + 2);
- if (fn) {
- memcpy(fn, PG(doc_root), l);
- if ('/' != fn[l - 1] || '\\' != fn[l - 1]) /* l is never 0 */
- fn[l++] = '/';
- if ('/' == path_info[0])
- l--;
- strcpy(fn + l, path_info);
- STR_FREE(SG(request_info).path_translated);
- SG(request_info).path_translated = fn;
- }
- } /* if doc_root && path_info */
- if (!fn) {
- /* we have to free SG(request_info).path_translated here because
- php_destroy_request_info assumes that it will get
- freed when the include_names hash is emptied, but
- we're not adding it in this case */
- STR_FREE(SG(request_info).path_translated);
- SG(request_info).path_translated = NULL;
- return NULL;
- }
- fp = V_FOPEN(fn, "r");
-
- /* refuse to open anything that is not a regular file */
- if (fp && (0 > fstat(fileno(fp), &st) || !S_ISREG(st.st_mode))) {
- fclose(fp);
- fp = NULL;
- }
- if (!fp) {
- php_error(E_CORE_ERROR, "Unable to open %s", fn);
- STR_FREE(SG(request_info).path_translated); /* for same reason as above */
- return NULL;
- }
-
- temp = estrdup(fn);
- php_dirname(temp, strlen(temp));
- if (*temp) {
- V_CHDIR(temp);
- }
- efree(temp);
- SG(request_info).path_translated = fn;
-
- return fp;
-}
-
-
-/*
- * Tries to open a file with a PATH-style list of directories.
- * If the filename starts with "." or "/", the path is ignored.
- */
-PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path)
-{
- char *pathbuf, *ptr, *end;
- char trypath[MAXPATHLEN + 1];
- struct stat sb;
- FILE *fp;
- int cm=2;
- PLS_FETCH();
-
- if (opened_path) {
- *opened_path = NULL;
- }
-
- if(!strcmp(mode,"r") || !strcmp(mode,"r+")) cm=0;
- /* Relative path open */
- if (*filename == '.') {
- if (PG(safe_mode) && (!php_checkuid(filename, cm))) {
- return NULL;
- }
- if (php_check_open_basedir(filename)) return NULL;
- fp = V_FOPEN(filename, mode);
- if (fp && opened_path) {
- *opened_path = expand_filepath(filename);
- }
- return fp;
- }
- /* Absolute path open - prepend document_root in safe mode */
-#ifdef PHP_WIN32
- if ((*filename == '\\') || (*filename == '/') || (filename[1] == ':')) {
-#else
- if (*filename == '/') {
-#endif
- if (PG(safe_mode)) {
- if(PG(doc_root)) {
- snprintf(trypath, MAXPATHLEN, "%s%s", PG(doc_root), filename);
- } else {
- strlcpy(trypath,filename,sizeof(trypath));
- }
- if (!php_checkuid(trypath, cm)) {
- return NULL;
- }
- if (php_check_open_basedir(trypath)) return NULL;
- fp = V_FOPEN(trypath, mode);
- if (fp && opened_path) {
- *opened_path = expand_filepath(trypath);
- }
- return fp;
- } else {
- if (php_check_open_basedir(filename)) {
- return NULL;
- }
- fp = V_FOPEN(filename, mode);
- if (fp && opened_path) {
- *opened_path = expand_filepath(filename);
- }
- return fp;
- }
- }
- if (!path || (path && !*path)) {
- if (PG(safe_mode) && (!php_checkuid(filename, cm))) {
- return NULL;
- }
- if (php_check_open_basedir(filename)) {
- return NULL;
- }
- fp = V_FOPEN(filename, mode);
- if (fp && opened_path) {
- *opened_path = strdup(filename);
- }
- return fp;
- }
- pathbuf = estrdup(path);
-
- ptr = pathbuf;
-
- while (ptr && *ptr) {
-#ifdef PHP_WIN32
- end = strchr(ptr, ';');
-#else
- end = strchr(ptr, ':');
-#endif
- if (end != NULL) {
- *end = '\0';
- end++;
- }
- snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename);
- if (PG(safe_mode)) {
- if (V_STAT(trypath, &sb) == 0 && (!php_checkuid(trypath, cm))) {
- efree(pathbuf);
- return NULL;
- }
- }
- if ((fp = V_FOPEN(trypath, mode)) != NULL) {
- if (php_check_open_basedir(trypath)) {
- fclose(fp);
- efree(pathbuf);
- return NULL;
- }
- if (opened_path) {
- *opened_path = expand_filepath(trypath);
- }
- efree(pathbuf);
- return fp;
- }
- ptr = end;
- }
- efree(pathbuf);
- return NULL;
-}
-
-/*
- * If the specified path starts with "http://" (insensitive to case),
- * a socket is opened to the specified web server and a file pointer is
- * position at the start of the body of the response (past any headers).
- * This makes a HTTP/1.0 request, and knows how to pass on the username
- * and password for basic authentication.
- *
- * If the specified path starts with "ftp://" (insensitive to case),
- * a pair of sockets are used to request the specified file and a file
- * pointer to the requested file is returned. Passive mode ftp is used,
- * so if the server doesn't support this, it will fail!
- *
- * Otherwise, fopen is called as usual and the file pointer is returned.
- */
-
-
-static FILE *php_fopen_url_wrap_http(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
-{
- FILE *fp=NULL;
- url *resource=NULL;
- struct sockaddr_in server;
- char tmp_line[512];
- char location[512];
- char hdr_line[8192];
- int body = 0;
- char *scratch;
- unsigned char *tmp;
- int len;
- int reqok = 0;
-
- resource = url_parse((char *) path);
- if (resource == NULL) {
- php_error(E_WARNING, "Invalid URL specified, %s", path);
- *issock = BAD_URL;
- return NULL;
- }
- /* use port 80 if one wasn't specified */
- if (resource->port == 0)
- resource->port = 80;
-
- *socketd = socket(AF_INET, SOCK_STREAM, 0);
- if (*socketd == SOCK_ERR) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
- server.sin_family = AF_INET;
-
- if (lookup_hostname(resource->host, &server.sin_addr)) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
- server.sin_port = htons(resource->port);
-
- if (connect(*socketd, (struct sockaddr *) &server, sizeof(server)) == SOCK_CONN_ERR) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
-#if 0
- if ((fp = fdopen(*socketd, "r+")) == NULL) {
- free_url(resource);
- return NULL;
- }
-#ifdef HAVE_SETVBUF
- if ((setvbuf(fp, NULL, _IONBF, 0)) != 0) {
- free_url(resource);
- return NULL;
- }
-#endif
-#endif /*win32 */
-
- strcpy(hdr_line, "GET ");
-
- /* tell remote http which file to get */
- if (resource->path != NULL) {
- strlcat(hdr_line, resource->path, sizeof(hdr_line));
- } else {
- strlcat(hdr_line, "/", sizeof(hdr_line));
- }
- /* append the query string, if any */
- if (resource->query != NULL) {
- strlcat(hdr_line, "?", sizeof(hdr_line));
- strlcat(hdr_line, resource->query, sizeof(hdr_line));
- }
- strlcat(hdr_line, " HTTP/1.0\r\n", sizeof(hdr_line));
- SOCK_WRITE(hdr_line, *socketd);
-
- /* send authorization header if we have user/pass */
- if (resource->user != NULL && resource->pass != NULL) {
- scratch = (char *) emalloc(strlen(resource->user) + strlen(resource->pass) + 2);
- if (!scratch) {
- free_url(resource);
- return NULL;
- }
- strcpy(scratch, resource->user);
- strcat(scratch, ":");
- strcat(scratch, resource->pass);
- tmp = php_base64_encode((unsigned char *)scratch, strlen(scratch), NULL);
-
- if (snprintf(hdr_line, sizeof(hdr_line),
- "Authorization: Basic %s\r\n", tmp) > 0) {
- SOCK_WRITE(hdr_line, *socketd);
- }
-
- efree(scratch);
- efree(tmp);
- }
- /* if the user has configured who they are, send a From: line */
- if (cfg_get_string("from", &scratch) == SUCCESS) {
- if (snprintf(hdr_line, sizeof(hdr_line),
- "From: %s\r\n", scratch) > 0) {
- SOCK_WRITE(hdr_line, *socketd);
- }
-
- }
- /* send a Host: header so name-based virtual hosts work */
- if (resource->port != 80) {
- len = snprintf(hdr_line, sizeof(hdr_line),
- "Host: %s:%i\r\n", resource->host, resource->port);
- } else {
- len = snprintf(hdr_line, sizeof(hdr_line),
- "Host: %s\r\n", resource->host);
- }
- if (len > 0) {
- SOCK_WRITE(hdr_line, *socketd);
- }
-
- /* identify ourselves and end the headers */
- SOCK_WRITE("User-Agent: PHP/" PHP_VERSION "\r\n\r\n", *socketd);
-
- body = 0;
- location[0] = '\0';
- if (!SOCK_FEOF(*socketd)) {
- /* get response header */
- if (SOCK_FGETS(tmp_line, sizeof(tmp_line)-1, *socketd) != NULL) {
- if (strncmp(tmp_line + 8, " 200 ", 5) == 0) {
- reqok = 1;
- }
- }
- }
- /* Read past HTTP headers */
- while (!body && !SOCK_FEOF(*socketd)) {
- if (SOCK_FGETS(tmp_line, sizeof(tmp_line)-1, *socketd) != NULL) {
- char *p = tmp_line;
-
- tmp_line[sizeof(tmp_line)-1] = '\0';
-
- while (*p) {
- if (*p == '\n' || *p == '\r') {
- *p = '\0';
- }
- p++;
- }
-
- if (!strncasecmp(tmp_line, "Location: ", 10)) {
- strlcpy(location, tmp_line + 10, sizeof(location));
- }
-
- if (tmp_line[0] == '\0') {
- body = 1;
- }
- }
- }
- if (!reqok) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- if (location[0] != '\0') {
- return php_fopen_url_wrapper(location, mode, options, issock, socketd, opened_path);
- } else {
- return NULL;
- }
- }
- free_url(resource);
- *issock = 1;
- return (fp);
-}
-
- static FILE *php_fopen_url_wrap_ftp(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
-{
- FILE *fp=NULL;
- url *resource=NULL;
- struct sockaddr_in server;
- char tmp_line[512];
- unsigned short portno;
- char *scratch;
- int result;
- int i;
- char *tpath, *ttpath;
-
- resource = url_parse((char *) path);
- if (resource == NULL) {
- php_error(E_WARNING, "Invalid URL specified, %s", path);
- *issock = BAD_URL;
- return NULL;
- } else if (resource->path == NULL) {
- php_error(E_WARNING, "No file-path specified");
- free_url(resource);
- *issock = BAD_URL;
- return NULL;
- }
- /* use port 21 if one wasn't specified */
- if (resource->port == 0)
- resource->port = 21;
-
- *socketd = socket(AF_INET, SOCK_STREAM, 0);
- if (*socketd == SOCK_ERR) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
- server.sin_family = AF_INET;
-
- if (lookup_hostname(resource->host, &server.sin_addr)) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
- server.sin_port = htons(resource->port);
-
- if (connect(*socketd, (struct sockaddr *) &server, sizeof(server)) == SOCK_CONN_ERR) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
-#if 0
- if ((fpc = fdopen(*socketd, "r+")) == NULL) {
- free_url(resource);
- return NULL;
- }
-#ifdef HAVE_SETVBUF
- if ((setvbuf(fpc, NULL, _IONBF, 0)) != 0) {
- free_url(resource);
- fclose(fpc);
- return NULL;
- }
-#endif
-#endif
-
- /* Start talking to ftp server */
- result = php_get_ftp_result(*socketd);
- if (result > 299 || result < 200) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- /* send the user name */
- SOCK_WRITE("USER ", *socketd);
- if (resource->user != NULL) {
- php_raw_url_decode(resource->user, strlen(resource->user));
- SOCK_WRITE(resource->user, *socketd);
- } else {
- SOCK_WRITE("anonymous", *socketd);
- }
- SOCK_WRITE("\r\n", *socketd);
-
- /* get the response */
- result = php_get_ftp_result(*socketd);
-
- /* if a password is required, send it */
- if (result >= 300 && result <= 399) {
- SOCK_WRITE("PASS ", *socketd);
- if (resource->pass != NULL) {
- php_raw_url_decode(resource->pass, strlen(resource->pass));
- SOCK_WRITE(resource->pass, *socketd);
- } else {
- /* if the user has configured who they are,
- send that as the password */
- if (cfg_get_string("from", &scratch) == SUCCESS) {
- SOCK_WRITE(scratch, *socketd);
- } else {
- SOCK_WRITE("anonymous", *socketd);
- }
- }
- SOCK_WRITE("\r\n", *socketd);
-
- /* read the response */
- result = php_get_ftp_result(*socketd);
- if (result > 299 || result < 200) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- } else if (result > 299 || result < 200) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
-
- /* set the connection to be binary */
- SOCK_WRITE("TYPE I\r\n", *socketd);
- result = php_get_ftp_result(*socketd);
- if (result > 299 || result < 200) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
-
- /* find out the size of the file (verifying it exists) */
- SOCK_WRITE("SIZE ", *socketd);
- SOCK_WRITE(resource->path, *socketd);
- SOCK_WRITE("\r\n", *socketd);
-
- /* read the response */
- result = php_get_ftp_result(*socketd);
- if (mode[0] == 'r') {
- /* when reading file, it must exist */
- if (result > 299 || result < 200) {
- php_error(E_WARNING, "File not found");
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- errno = ENOENT;
- return NULL;
- }
- } else {
- /* when writing file, it must NOT exist */
- if (result <= 299 && result >= 200) {
- php_error(E_WARNING, "File already exists");
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- errno = EEXIST;
- return NULL;
- }
- }
-
- /* set up the passive connection */
- SOCK_WRITE("PASV\r\n", *socketd);
- while (SOCK_FGETS(tmp_line, sizeof(tmp_line)-1, *socketd) &&
- !(isdigit((int) tmp_line[0]) && isdigit((int) tmp_line[1]) &&
- isdigit((int) tmp_line[2]) && tmp_line[3] == ' '));
-
- /* make sure we got a 227 response */
- if (strncmp(tmp_line, "227", 3)) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- /* parse pasv command (129,80,95,25,13,221) */
- tpath = tmp_line;
-
- /* skip over the "227 Some message " part */
- for (tpath += 4; *tpath && !isdigit((int) *tpath); tpath++);
- if (!*tpath) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- /* skip over the host ip, we just assume it's the same */
- for (i = 0; i < 4; i++) {
- for (; isdigit((int) *tpath); tpath++);
- if (*tpath == ',') {
- tpath++;
- } else {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- }
-
- /* pull out the MSB of the port */
- portno = (unsigned short) strtol(tpath, &ttpath, 10) * 256;
- if (ttpath == NULL) {
- /* didn't get correct response from PASV */
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- tpath = ttpath;
- if (*tpath == ',') {
- tpath++;
- } else {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
-
- /* pull out the LSB of the port */
- portno += (unsigned short) strtol(tpath, &ttpath, 10);
-
- if (ttpath == NULL) {
- /* didn't get correct response from PASV */
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
-
- if (mode[0] == 'r') {
- /* retrieve file */
- SOCK_WRITE("RETR ", *socketd);
- } else {
- /* store file */
- SOCK_WRITE("STOR ", *socketd);
- }
- if (resource->path != NULL) {
- SOCK_WRITE(resource->path, *socketd);
- } else {
- SOCK_WRITE("/", *socketd);
- }
-
- /* close control connection */
- SOCK_WRITE("\r\nQUIT\r\n", *socketd);
- SOCK_FCLOSE(*socketd);
-
- /* open the data channel */
- *socketd = socket(AF_INET, SOCK_STREAM, 0);
- if (*socketd == SOCK_ERR) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
- server.sin_family = AF_INET;
-
- if (lookup_hostname(resource->host, &server.sin_addr)) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- server.sin_port = htons(portno);
-
- if (connect(*socketd, (struct sockaddr *) &server, sizeof(server)) == SOCK_CONN_ERR) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
-#if 0
- if (mode[0] == 'r') {
- if ((fp = fdopen(*socketd, "r+")) == NULL) {
- free_url(resource);
- return NULL;
- }
- } else {
- if ((fp = fdopen(*socketd, "w+")) == NULL) {
- free_url(resource);
- return NULL;
- }
- }
-#ifdef HAVE_SETVBUF
- if ((setvbuf(fp, NULL, _IONBF, 0)) != 0) {
- free_url(resource);
- fclose(fp);
- return NULL;
- }
-#endif
-#endif
- free_url(resource);
- *issock = 1;
- return (fp);
-}
-
-static FILE *php_fopen_url_wrap_php(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
-{
- const char *res = path + 6;
-
- *issock = 0;
-
- if (!strcasecmp(res, "stdin")) {
- return fdopen(STDIN_FILENO, mode);
- } else if (!strcasecmp(res, "stdout")) {
- return fdopen(STDOUT_FILENO, mode);
- } else if (!strcasecmp(res, "stderr")) {
- return fdopen(STDERR_FILENO, mode);
- }
-
- return NULL;
-}
-
-static FILE *php_fopen_url_wrapper(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
-{
- FILE *fp = NULL;
- const char *p;
- const char *protocol=NULL;
- int n=0;
-
- for(p=path;isalnum((int)*p);p++)
- n++;
- if((*p==':')&&(n>1)) {
- protocol=path;
- }
-
- if(protocol) {
- php_fopen_url_wrapper_t *wrapper=NULL;
- char *protocopy = emalloc(n+1);
-
- if(protocopy) {
- strncpy(protocopy,protocol,n);
- protocopy[n]='\0';
- if(FAILURE==zend_hash_find(&fopen_url_wrappers_hash, protocopy, n+1,(void **)&wrapper)) {
- wrapper=NULL;
- }
- efree(protocopy);
- }
- if(wrapper)
- return (*wrapper)(path, mode, options, issock, socketd, opened_path);
- }
-
- if( !protocol || !strncasecmp(protocol, "file",n)){
- PLS_FETCH();
-
- *issock = 0;
-
- if(protocol) {
- if(path[n+1]=='/') {
- if(path[n+2]=='/') {
- php_error(E_WARNING, "remote host file access not supported, %s", path);
- return NULL;
- }
- }
- path+= n+1;
- }
-
- if (options & USE_PATH) {
- fp = php_fopen_with_path((char *) path, mode, PG(include_path), opened_path);
- } else {
- int cm=2;
- if(!strcmp(mode,"r") || !strcmp(mode,"r+")) cm=0;
- if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!php_checkuid(path, cm))) {
- fp = NULL;
- } else {
- if (php_check_open_basedir((char *) path)) {
- fp = NULL;
- } else {
- fp = V_FOPEN(path, mode);
- }
- }
- }
-
-
- return (fp);
- }
-
- php_error(E_WARNING, "Invalid URL specified, %s", path);
- return NULL;
-}
-
-int php_get_ftp_result(int socketd)
-{
- char tmp_line[513];
-
- while (SOCK_FGETS(tmp_line, sizeof(tmp_line)-1, socketd) &&
- !(isdigit((int) tmp_line[0]) && isdigit((int) tmp_line[1]) &&
- isdigit((int) tmp_line[2]) && tmp_line[3] == ' '));
-
- return strtol(tmp_line, NULL, 10);
-}
-
-PHPAPI int php_is_url(char *path)
-{
- return (!strncasecmp(path, "http://", 7) || !strncasecmp(path, "ftp://", 6));
-}
-
-
-PHPAPI char *php_strip_url_passwd(char *url)
-{
- register char *p = url, *url_start;
-
- while (*p) {
- if (*p==':' && *(p+1)=='/' && *(p+2)=='/') {
- /* found protocol */
- url_start = p = p+3;
-
- while (*p) {
- if (*p=='@') {
- int i;
-
- for (i=0; i<3 && url_start<p; i++, url_start++) {
- *url_start = '.';
- }
- for (; *p; p++) {
- *url_start++ = *p;
- }
- *url_start=0;
- break;
- }
- p++;
- }
- return url;
- }
- p++;
- }
- return url;
-}
-
-
-#if 1
-
-PHPAPI char *expand_filepath(char *filepath)
-{
- cwd_state new_state;
- char cwd[MAXPATHLEN+1];
- char *result;
-
- result = V_GETCWD(cwd, MAXPATHLEN);
- if (!result) {
- cwd[0] = '\0';
- }
-
- new_state.cwd = strdup(cwd);
- new_state.cwd_length = strlen(cwd);
-
- virtual_file_ex(&new_state, filepath, NULL);
- return new_state.cwd;
-}
-
-#else
-
-PHPAPI char *expand_filepath(char *filepath)
-{
- char *retval = NULL;
-
- if (filepath[0] == '.') {
- char *cwd = malloc(MAXPATHLEN + 1);
-
- if (V_GETCWD(cwd, MAXPATHLEN)) {
- char *cwd_end = cwd + strlen(cwd);
-
- if (filepath[1] == '.') { /* parent directory - .. */
- /* erase the last directory name from the path */
-#ifdef PHP_WIN32
- while (*cwd_end != '/' || *cwd_end != '\\') {
-#else
- while (*cwd_end != '/') {
-#endif
- *cwd_end-- = 0;
- }
- filepath++; /* make filepath appear as a current directory path */
- }
-#ifdef PHP_WIN32
- if (cwd_end > cwd && (*cwd_end == '/' || *cwd_end == '\\')) { /* remove trailing slashes */
-#else
- if (cwd_end > cwd && *cwd_end == '/') { /* remove trailing slashes */
-#endif
- *cwd_end-- = 0;
- }
- retval = (char *) malloc(strlen(cwd) + strlen(filepath) - 1 + 1);
- strcpy(retval, cwd);
- strcat(retval, filepath + 1);
- free(cwd);
- }
- }
- if (!retval) {
- retval = strdup(filepath);
- }
- return retval;
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h
deleted file mode 100644
index 152c965d31..0000000000
--- a/main/fopen_wrappers.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef _FOPEN_WRAPPERS_H
-#define _FOPEN_WRAPPERS_H
-
-#include "php_globals.h"
-
-#define IGNORE_PATH 0
-#define USE_PATH 1
-#define IGNORE_URL 2
-/* There's no USE_URL. */
-#ifdef PHP_WIN32
-# define IGNORE_URL_WIN 2
-#else
-# define IGNORE_URL_WIN 0
-#endif
-#define ENFORCE_SAFE_MODE 4
-
-#ifdef PHP_WIN32
-# define SOCK_ERR INVALID_SOCKET
-# define SOCK_CONN_ERR SOCKET_ERROR
-# define SOCK_RECV_ERR SOCKET_ERROR
-#else
-# define SOCK_ERR -1
-# define SOCK_CONN_ERR -1
-# define SOCK_RECV_ERR -1
-#endif
-#define SOCK_WRITE(d,s) send(s,d,strlen(d),0)
-#define SOCK_WRITEL(d,l,s) send(s,d,l,0)
-#define SOCK_FGETC(s) php_sock_fgetc((s))
-#define SOCK_FGETS(b,l,s) php_sock_fgets((b),(l),(s))
-#define SOCK_FEOF(sock) php_sock_feof((sock))
-#define SOCK_FREAD(ptr,size,sock) php_sock_fread((ptr),(size),(sock))
-#define SOCK_FCLOSE(s) php_sock_close(s)
-
-#define FP_FGETS(buf,len,sock,fp,issock) \
- ((issock)?SOCK_FGETS(buf,len,sock):fgets(buf,len,fp))
-#define FP_FREAD(buf,len,sock,fp,issock) \
- ((issock)?SOCK_FREAD(buf,len,sock):fread(buf,1,len,fp))
-#define FP_FEOF(sock,fp,issock) \
- ((issock)?SOCK_FEOF(sock):feof(fp))
-#define FP_FGETC(sock,fp,issock) \
- ((issock)?SOCK_FGETC(sock):fgetc(fp))
-
-/* values for issock */
-#define IS_NOT_SOCKET 0
-#define IS_SOCKET 1
-#define BAD_URL 2
-
-PHPAPI FILE *php_fopen_wrapper(char *filename, char *mode, int options, int *issock, int *socketd, char **opened_path);
-
-PHPAPI FILE *php_fopen_primary_script(void);
-
-PHPAPI int php_check_open_basedir(char *path);
-PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC);
-
-PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path);
-
-PHPAPI int php_is_url(char *path);
-PHPAPI char *php_strip_url_passwd(char *path);
-
-PHPAPI char *expand_filepath(char *filepath);
-
-int php_init_fopen_wrappers(void);
-int php_shutdown_fopen_wrappers(void);
-PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path));
-PHPAPI int php_unregister_url_wrapper(char *protocol);
-
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/internal_functions.c.in b/main/internal_functions.c.in
deleted file mode 100644
index 5ac434ea18..0000000000
--- a/main/internal_functions.c.in
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- C -*-
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_main.h"
-#include "modules.h"
-#include "internal_functions_registry.h"
-#include "zend_compile.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-@EXT_INCLUDE_CODE@
-
-/* SNMP has to be moved to ext */
-/* #include "dl/snmp/php3_snmp.h" */
-
-zend_module_entry *php_builtin_extensions[] = {
-@EXT_MODULE_PTRS@
-};
-
-#define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *))
-
-
-int php_startup_internal_extensions(void)
-{
- return php_startup_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-int php_global_startup_internal_extensions(void)
-{
- return php_global_startup_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-int php_global_shutdown_internal_extensions(void)
-{
- return php_global_shutdown_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/internal_functions_registry.h b/main/internal_functions_registry.h
deleted file mode 100644
index a06eaa349f..0000000000
--- a/main/internal_functions_registry.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _INTERNAL_FUNCTIONS_REGISTRY_H
-#define _INTERNAL_FUNCTIONS_REGISTRY_H
-
-extern int php_init_mime(INIT_FUNC_ARGS);
-
-/* environment functions */
-extern int php_init_environment(void);
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/internal_functions_win32.c b/main/internal_functions_win32.c
deleted file mode 100644
index a1144e0aac..0000000000
--- a/main/internal_functions_win32.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-
-#include "php.h"
-#include "php_main.h"
-#include "modules.h"
-#include "internal_functions_registry.h"
-#include "zend_compile.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "ext/bcmath/php_bcmath.h"
-#include "ext/db/php_db.h"
-#include "ext/gd/php_gd.h"
-#include "ext/standard/dl.h"
-#include "ext/standard/file.h"
-#include "ext/standard/fsock.h"
-#include "ext/standard/head.h"
-#include "ext/standard/pack.h"
-#include "ext/standard/php_browscap.h"
-#include "ext/standard/php_crypt.h"
-#include "ext/standard/php_dir.h"
-#include "ext/standard/php_filestat.h"
-#include "ext/standard/php_mail.h"
-#include "ext/standard/php_ext_syslog.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/php_lcg.h"
-#include "ext/standard/php_output.h"
-#include "ext/standard/php_array.h"
-#include "ext/standard/php_assert.h"
-#include "ext/com/php_COM.h"
-#include "ext/standard/reg.h"
-#include "ext/pcre/php_pcre.h"
-#include "ext/odbc/php_odbc.h"
-#include "ext/session/php_session.h"
-#include "ext/xml/php_xml.h"
-#include "ext/wddx/php_wddx.h"
-#include "ext/mysql/php_mysql.h"
-
-/* SNMP has to be moved to ext */
-/* #include "dl/snmp/php_snmp.h" */
-
-zend_module_entry *php_builtin_extensions[] = {
-#if WITH_BCMATH
- phpext_bcmath_ptr,
-#endif
- phpext_standard_ptr,
- COM_module_ptr,
- phpext_pcre_ptr,
- phpext_odbc_ptr,
- phpext_session_ptr,
- phpext_xml_ptr,
- phpext_wddx_ptr,
- phpext_mysql_ptr
-};
-
-#define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *))
-
-
-int php_startup_internal_extensions(void)
-{
- return php_startup_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-int php_global_startup_internal_extensions(void)
-{
- return php_global_startup_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-int php_global_shutdown_internal_extensions(void)
-{
- return php_global_shutdown_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/logos.h b/main/logos.h
deleted file mode 100644
index 428cf6dc90..0000000000
--- a/main/logos.h
+++ /dev/null
@@ -1,1059 +0,0 @@
-#define CONTEXT_TYPE_IMAGE_GIF "Content-Type: image/gif"
-
-unsigned char zend_logo[] = {
- 71, 73, 70, 56, 57, 97, 100, 0, 58, 0,
- 247, 255, 0, 255, 255, 255, 8, 8, 8, 24,
- 24, 24, 57, 57, 57, 74, 74, 74, 90, 90,
- 90, 99, 99, 99, 123, 123, 123, 132, 132, 132,
- 140, 140, 140, 148, 148, 148, 189, 189, 189, 214,
- 214, 214, 231, 231, 231, 239, 239, 239, 90, 99,
- 99, 222, 231, 239, 57, 66, 74, 165, 173, 181,
- 0, 8, 16, 214, 222, 231, 57, 66, 82, 16,
- 33, 66, 0, 8, 24, 24, 41, 82, 222, 231,
- 255, 57, 66, 90, 198, 206, 231, 181, 189, 214,
- 99, 107, 132, 0, 8, 33, 189, 198, 231, 123,
- 132, 165, 148, 165, 231, 123, 140, 206, 123, 148,
- 239, 49, 66, 132, 24, 33, 66, 49, 74, 165,
- 214, 222, 255, 206, 214, 247, 181, 189, 222, 148,
- 156, 189, 123, 132, 173, 156, 173, 247, 132, 148,
- 214, 99, 115, 181, 49, 57, 90, 41, 49, 82,
- 90, 107, 181, 82, 99, 173, 24, 33, 74, 57,
- 82, 189, 49, 74, 173, 16, 24, 57, 8, 16,
- 49, 198, 206, 247, 181, 189, 231, 165, 173, 214,
- 99, 107, 148, 74, 82, 123, 140, 156, 239, 66,
- 74, 115, 115, 132, 222, 41, 49, 90, 57, 74,
- 165, 49, 66, 148, 49, 66, 156, 41, 57, 140,
- 57, 82, 206, 33, 49, 123, 57, 82, 214, 16,
- 24, 66, 198, 206, 255, 181, 189, 239, 189, 198,
- 255, 156, 165, 214, 140, 148, 198, 132, 140, 189,
- 115, 123, 173, 90, 99, 148, 132, 148, 247, 123,
- 140, 239, 107, 123, 214, 115, 132, 231, 57, 66,
- 115, 107, 123, 222, 115, 132, 239, 57, 66, 123,
- 99, 115, 214, 90, 107, 214, 74, 90, 181, 74,
- 90, 189, 66, 82, 173, 57, 74, 173, 49, 66,
- 165, 66, 90, 231, 49, 66, 173, 24, 33, 90,
- 41, 57, 156, 33, 49, 140, 8, 16, 66, 181,
- 189, 247, 165, 173, 231, 148, 156, 214, 132, 140,
- 198, 115, 123, 181, 82, 90, 148, 49, 57, 115,
- 99, 115, 231, 90, 107, 231, 82, 99, 214, 82,
- 99, 222, 74, 90, 206, 82, 99, 231, 66, 82,
- 189, 33, 41, 99, 57, 74, 189, 57, 74, 198,
- 57, 74, 206, 49, 66, 181, 41, 57, 165, 24,
- 33, 99, 16, 24, 82, 8, 16, 74, 173, 181,
- 247, 173, 181, 255, 165, 173, 247, 140, 148, 214,
- 156, 165, 239, 165, 173, 255, 156, 165, 247, 132,
- 140, 214, 140, 148, 231, 99, 107, 173, 107, 115,
- 189, 115, 123, 206, 123, 132, 222, 99, 107, 189,
- 82, 90, 165, 90, 99, 181, 74, 82, 156, 82,
- 90, 173, 90, 99, 189, 66, 74, 140, 57, 66,
- 140, 57, 66, 148, 41, 49, 115, 74, 90, 222,
- 74, 90, 231, 41, 49, 132, 66, 82, 222, 33,
- 41, 115, 33, 41, 123, 24, 33, 107, 24, 33,
- 123, 16, 24, 90, 148, 156, 247, 140, 148, 239,
- 132, 140, 231, 140, 148, 247, 132, 140, 239, 123,
- 132, 231, 107, 115, 206, 123, 132, 239, 123, 132,
- 247, 99, 107, 206, 99, 107, 214, 82, 90, 181,
- 90, 99, 206, 49, 57, 148, 41, 49, 148, 33,
- 41, 140, 239, 239, 247, 247, 247, 255, 198, 198,
- 206, 214, 214, 222, 173, 173, 181, 189, 189, 198,
- 148, 148, 156, 156, 156, 165, 231, 231, 247, 239,
- 239, 255, 173, 173, 189, 90, 90, 99, 231, 231,
- 255, 222, 222, 247, 140, 140, 156, 66, 66, 74,
- 132, 132, 148, 198, 198, 222, 123, 123, 140, 173,
- 173, 198, 107, 107, 123, 222, 222, 255, 57, 57,
- 66, 49, 49, 57, 156, 156, 181, 198, 198, 231,
- 140, 140, 165, 181, 181, 214, 90, 90, 107, 214,
- 214, 255, 165, 165, 198, 82, 82, 99, 123, 123,
- 148, 74, 74, 90, 115, 115, 140, 33, 33, 41,
- 99, 99, 123, 156, 156, 198, 90, 90, 115, 132,
- 132, 173, 173, 173, 231, 165, 165, 222, 24, 24,
- 33, 82, 82, 115, 156, 156, 222, 115, 115, 165,
- 57, 57, 82, 107, 107, 156, 123, 123, 181, 33,
- 33, 49, 156, 156, 231, 82, 82, 123, 49, 49,
- 74, 107, 107, 165, 74, 74, 115, 148, 148, 231,
- 57, 57, 90, 41, 41, 66, 82, 82, 132, 66,
- 66, 107, 132, 132, 214, 140, 140, 231, 99, 99,
- 165, 123, 123, 206, 66, 66, 115, 82, 82, 148,
- 123, 123, 222, 66, 66, 123, 8, 8, 16, 41,
- 41, 82, 49, 49, 99, 24, 24, 49, 41, 41,
- 90, 24, 24, 66, 8, 8, 24, 16, 16, 57,
- 8, 8, 41, 8, 8, 49, 8, 8, 57, 0,
- 0, 8, 0, 0, 16, 0, 0, 24, 0, 0,
- 0, 44, 0, 0, 0, 0, 100, 0, 58, 0,
- 0, 8, 255, 0, 255, 9, 28, 72, 176, 160,
- 193, 131, 8, 19, 42, 92, 200, 176, 161, 195,
- 135, 188, 146, 37, 131, 246, 176, 226, 193, 94,
- 188, 10, 6, 203, 104, 177, 99, 67, 99, 31,
- 140, 25, 75, 230, 177, 227, 200, 130, 39, 75,
- 170, 60, 104, 12, 87, 128, 103, 198, 40, 174,
- 108, 248, 1, 87, 193, 154, 51, 115, 10, 52,
- 198, 236, 31, 175, 15, 196, 124, 246, 58, 150,
- 17, 227, 203, 0, 2, 122, 9, 240, 121, 140,
- 232, 191, 94, 201, 130, 57, 229, 213, 148, 227,
- 63, 103, 199, 96, 218, 36, 104, 172, 89, 47,
- 140, 2, 159, 57, 19, 232, 236, 153, 206, 143,
- 199, 130, 33, 43, 118, 213, 216, 50, 96, 31,
- 4, 24, 139, 230, 204, 152, 179, 100, 198, 4,
- 240, 50, 166, 2, 88, 76, 144, 200, 144, 17,
- 53, 86, 12, 46, 69, 188, 133, 113, 114, 229,
- 11, 55, 104, 49, 14, 1, 226, 113, 56, 118,
- 150, 33, 72, 99, 207, 2, 252, 3, 70, 249,
- 222, 200, 98, 199, 122, 141, 236, 165, 226, 159,
- 138, 98, 206, 150, 113, 240, 92, 44, 192, 215,
- 211, 169, 145, 45, 93, 214, 235, 95, 128, 148,
- 3, 63, 4, 179, 13, 172, 54, 177, 145, 184,
- 140, 5, 173, 172, 176, 37, 87, 146, 255, 70,
- 23, 251, 0, 90, 119, 114, 99, 28, 158, 45,
- 197, 45, 50, 250, 210, 228, 200, 21, 15, 52,
- 254, 175, 169, 192, 99, 129, 41, 19, 255, 231,
- 103, 142, 31, 203, 158, 3, 139, 45, 227, 5,
- 19, 26, 94, 96, 204, 66, 82, 124, 187, 173,
- 236, 94, 244, 255, 150, 173, 103, 159, 177, 24,
- 178, 8, 120, 225, 183, 211, 49, 196, 224, 149,
- 76, 63, 252, 252, 6, 212, 66, 252, 152, 87,
- 145, 57, 30, 176, 132, 156, 64, 208, 112, 0,
- 82, 52, 255, 64, 163, 155, 0, 31, 44, 67,
- 33, 50, 74, 228, 128, 12, 52, 184, 85, 8,
- 24, 69, 208, 32, 35, 18, 78, 14, 254, 19,
- 82, 72, 102, 245, 211, 207, 63, 130, 49, 56,
- 163, 69, 48, 208, 115, 16, 52, 154, 17, 20,
- 0, 49, 215, 253, 131, 75, 60, 255, 108, 227,
- 141, 64, 252, 208, 163, 193, 112, 60, 22, 68,
- 204, 112, 3, 17, 3, 141, 0, 68, 182, 56,
- 37, 49, 247, 8, 116, 207, 5, 117, 89, 117,
- 80, 63, 19, 180, 248, 144, 61, 230, 204, 196,
- 15, 130, 252, 120, 83, 130, 152, 30, 177, 57,
- 80, 63, 30, 168, 224, 97, 66, 112, 186, 217,
- 208, 61, 224, 220, 168, 210, 4, 253, 204, 80,
- 142, 78, 13, 30, 196, 143, 7, 214, 96, 67,
- 103, 62, 122, 90, 196, 79, 59, 24, 204, 212,
- 79, 60, 232, 228, 3, 168, 157, 255, 240, 147,
- 143, 62, 148, 122, 224, 1, 165, 13, 149, 160,
- 205, 13, 156, 50, 228, 79, 62, 80, 72, 170,
- 83, 162, 5, 121, 80, 70, 62, 108, 242, 51,
- 65, 62, 155, 170, 255, 212, 15, 15, 226, 220,
- 224, 15, 159, 97, 226, 10, 230, 174, 97, 54,
- 24, 232, 160, 85, 156, 147, 37, 160, 168, 34,
- 233, 1, 31, 248, 120, 208, 107, 131, 23, 232,
- 147, 44, 167, 215, 228, 115, 77, 177, 72, 222,
- 144, 134, 19, 24, 224, 3, 171, 7, 247, 116,
- 219, 45, 183, 223, 198, 19, 79, 0, 174, 246,
- 67, 135, 33, 166, 2, 122, 129, 160, 249, 240,
- 177, 71, 62, 247, 140, 27, 192, 61, 250, 240,
- 161, 15, 181, 3, 221, 67, 79, 56, 229, 192,
- 96, 14, 168, 3, 241, 19, 128, 7, 108, 4,
- 98, 141, 59, 24, 216, 99, 195, 194, 12, 51,
- 76, 15, 61, 210, 114, 235, 129, 61, 46, 208,
- 17, 79, 168, 22, 249, 211, 42, 63, 55, 136,
- 161, 7, 18, 55, 72, 124, 195, 30, 72, 196,
- 202, 96, 60, 54, 148, 179, 195, 57, 155, 186,
- 26, 207, 61, 54, 72, 130, 130, 25, 138, 68,
- 194, 198, 36, 56, 231, 140, 51, 29, 98, 204,
- 96, 129, 13, 244, 76, 130, 134, 17, 218, 226,
- 235, 209, 5, 254, 20, 196, 207, 61, 248, 232,
- 145, 137, 30, 51, 148, 64, 143, 13, 30, 235,
- 67, 228, 67, 150, 142, 115, 142, 61, 19, 220,
- 35, 173, 13, 108, 120, 146, 203, 18, 158, 88,
- 49, 69, 22, 103, 79, 113, 202, 217, 169, 116,
- 65, 2, 29, 116, 44, 242, 13, 36, 249, 228,
- 179, 79, 62, 73, 43, 250, 101, 132, 72, 242,
- 255, 19, 143, 7, 72, 104, 194, 10, 17, 152,
- 96, 48, 131, 38, 152, 204, 224, 193, 197, 21,
- 45, 61, 79, 19, 240, 212, 51, 3, 6, 24,
- 24, 241, 67, 18, 174, 228, 146, 196, 18, 156,
- 115, 190, 249, 18, 130, 128, 194, 69, 23, 228,
- 152, 33, 9, 61, 209, 210, 83, 198, 13, 23,
- 152, 23, 232, 5, 30, 92, 19, 175, 140, 247,
- 132, 121, 177, 157, 253, 232, 179, 110, 131, 127,
- 95, 51, 3, 38, 171, 124, 177, 138, 17, 70,
- 168, 66, 7, 62, 215, 244, 26, 112, 131, 50,
- 226, 126, 13, 36, 213, 144, 19, 131, 36, 108,
- 64, 50, 133, 31, 185, 0, 0, 128, 43, 220,
- 111, 207, 125, 230, 126, 72, 177, 4, 14, 93,
- 248, 140, 4, 29, 152, 32, 206, 70, 21, 243,
- 200, 83, 78, 57, 219, 208, 115, 65, 60, 176,
- 75, 235, 79, 188, 189, 146, 75, 16, 63, 251,
- 232, 115, 143, 223, 250, 154, 129, 24, 44, 49,
- 4, 46, 60, 162, 17, 142, 24, 67, 61, 44,
- 128, 4, 120, 45, 235, 76, 19, 208, 212, 176,
- 12, 210, 143, 124, 96, 33, 16, 56, 240, 132,
- 41, 136, 113, 13, 1, 64, 163, 131, 83, 10,
- 161, 7, 71, 8, 141, 10, 173, 65, 18, 139,
- 64, 68, 54, 190, 145, 142, 67, 24, 129, 14,
- 51, 136, 161, 13, 22, 39, 174, 111, 105, 10,
- 92, 241, 242, 155, 175, 252, 182, 15, 36, 220,
- 205, 3, 55, 176, 128, 24, 255, 38, 65, 132,
- 24, 112, 224, 131, 196, 88, 132, 17, 48, 161,
- 135, 61, 36, 235, 30, 254, 64, 218, 61, 36,
- 72, 169, 165, 221, 192, 29, 223, 80, 70, 18,
- 130, 212, 144, 3, 228, 226, 15, 102, 248, 195,
- 33, 26, 177, 10, 34, 104, 98, 6, 72, 128,
- 88, 180, 174, 113, 13, 77, 229, 227, 6, 55,
- 88, 216, 195, 110, 208, 70, 111, 141, 235, 101,
- 251, 224, 4, 39, 98, 136, 129, 122, 16, 81,
- 8, 136, 128, 133, 102, 4, 16, 131, 49, 172,
- 34, 19, 154, 216, 195, 221, 46, 85, 55, 88,
- 5, 74, 80, 241, 200, 135, 5, 136, 48, 133,
- 36, 200, 164, 33, 3, 112, 133, 45, 146, 48,
- 10, 35, 120, 12, 19, 155, 96, 162, 24, 12,
- 103, 1, 123, 32, 97, 97, 37, 40, 193, 228,
- 48, 48, 202, 61, 76, 78, 106, 106, 236, 86,
- 62, 108, 160, 7, 77, 100, 2, 19, 153, 176,
- 4, 17, 134, 16, 132, 64, 106, 230, 26, 169,
- 192, 195, 42, 44, 161, 9, 78, 32, 161, 12,
- 251, 184, 193, 182, 254, 87, 197, 8, 218, 0,
- 3, 68, 24, 197, 53, 4, 114, 0, 90, 40,
- 64, 1, 214, 196, 102, 2, 122, 244, 143, 5,
- 0, 224, 15, 93, 152, 68, 61, 244, 64, 7,
- 75, 144, 161, 140, 150, 120, 33, 220, 198, 57,
- 78, 244, 101, 194, 8, 233, 92, 34, 220, 48,
- 144, 74, 160, 77, 13, 3, 182, 36, 3, 17,
- 86, 49, 255, 134, 47, 212, 160, 14, 63, 16,
- 228, 63, 4, 144, 5, 47, 172, 130, 137, 122,
- 68, 22, 188, 186, 165, 49, 133, 136, 139, 30,
- 208, 252, 196, 117, 24, 160, 73, 87, 120, 15,
- 0, 10, 24, 72, 1, 0, 224, 135, 57, 168,
- 179, 156, 252, 12, 131, 72, 195, 96, 130, 49,
- 8, 65, 8, 68, 72, 233, 42, 134, 240, 133,
- 48, 124, 1, 15, 97, 168, 193, 23, 136, 96,
- 137, 121, 174, 18, 19, 68, 24, 67, 30, 90,
- 234, 133, 158, 210, 32, 160, 154, 129, 70, 22,
- 194, 64, 4, 158, 113, 130, 100, 250, 192, 155,
- 140, 16, 148, 16, 129, 121, 109, 18, 159, 176,
- 69, 1, 8, 64, 0, 6, 36, 193, 15, 75,
- 224, 158, 50, 100, 209, 35, 1, 52, 64, 25,
- 169, 136, 196, 11, 49, 161, 203, 49, 132, 1,
- 15, 115, 136, 195, 35, 82, 193, 5, 60, 224,
- 161, 167, 117, 240, 66, 29, 236, 96, 135, 59,
- 164, 53, 21, 143, 216, 66, 35, 134, 64, 4,
- 156, 97, 2, 158, 121, 16, 41, 30, 234, 192,
- 133, 84, 164, 226, 13, 63, 104, 192, 32, 181,
- 16, 6, 98, 138, 225, 168, 253, 83, 214, 163,
- 152, 218, 212, 123, 148, 128, 17, 202, 88, 2,
- 10, 114, 193, 89, 63, 68, 97, 9, 0, 56,
- 65, 18, 134, 49, 16, 90, 184, 226, 10, 38,
- 176, 4, 206, 140, 144, 83, 19, 112, 225, 16,
- 211, 136, 192, 147, 152, 241, 4, 45, 255, 20,
- 225, 8, 69, 200, 130, 26, 180, 112, 132, 31,
- 104, 195, 25, 79, 170, 64, 52, 92, 224, 5,
- 33, 68, 66, 8, 47, 29, 108, 29, 70, 225,
- 4, 102, 12, 131, 24, 195, 152, 70, 44, 130,
- 154, 133, 47, 212, 84, 12, 123, 80, 100, 200,
- 226, 209, 60, 78, 249, 45, 31, 116, 168, 6,
- 14, 78, 225, 136, 69, 40, 34, 11, 109, 16,
- 196, 38, 205, 48, 139, 129, 16, 0, 0, 102,
- 224, 66, 95, 233, 48, 9, 18, 32, 247, 17,
- 29, 224, 162, 64, 152, 33, 2, 74, 180, 161,
- 25, 241, 56, 70, 19, 6, 96, 16, 1, 116,
- 96, 11, 255, 164, 171, 29, 226, 192, 4, 3,
- 112, 83, 32, 93, 29, 170, 37, 244, 128, 93,
- 146, 193, 138, 187, 143, 106, 230, 196, 214, 144,
- 132, 63, 160, 226, 164, 65, 208, 130, 25, 132,
- 225, 7, 65, 80, 96, 154, 3, 109, 64, 46,
- 74, 225, 5, 44, 76, 130, 172, 95, 152, 67,
- 58, 182, 114, 16, 98, 84, 163, 52, 182, 185,
- 218, 65, 162, 17, 135, 34, 220, 246, 13, 41,
- 240, 146, 65, 160, 97, 138, 26, 212, 116, 15,
- 144, 213, 135, 7, 118, 69, 89, 131, 44, 45,
- 31, 51, 88, 135, 25, 112, 80, 8, 68, 168,
- 227, 15, 73, 232, 195, 21, 212, 107, 128, 129,
- 40, 0, 0, 75, 40, 69, 28, 186, 16, 132,
- 71, 152, 226, 19, 228, 216, 141, 64, 226, 97,
- 128, 4, 32, 32, 255, 40, 1, 136, 5, 10,
- 40, 64, 128, 130, 16, 32, 1, 9, 192, 15,
- 63, 156, 112, 132, 75, 196, 161, 15, 248, 129,
- 70, 48, 20, 16, 140, 32, 9, 64, 11, 214,
- 213, 68, 133, 241, 161, 100, 127, 112, 247, 145,
- 78, 134, 147, 13, 230, 97, 8, 52, 152, 193,
- 12, 125, 72, 135, 35, 226, 224, 7, 87, 112,
- 85, 32, 196, 216, 222, 85, 253, 208, 135, 68,
- 252, 128, 173, 77, 232, 17, 47, 24, 144, 1,
- 205, 66, 160, 154, 56, 176, 130, 39, 40, 64,
- 96, 219, 208, 98, 108, 56, 104, 197, 116, 5,
- 130, 11, 55, 92, 34, 20, 18, 24, 136, 1,
- 40, 176, 1, 28, 216, 162, 1, 5, 160, 144,
- 41, 172, 107, 84, 69, 42, 25, 195, 77, 118,
- 114, 0, 250, 225, 53, 123, 204, 67, 156, 154,
- 216, 130, 25, 92, 161, 139, 225, 4, 224, 21,
- 218, 115, 69, 6, 250, 112, 138, 26, 212, 128,
- 6, 90, 232, 242, 63, 136, 225, 128, 64, 248,
- 186, 18, 159, 64, 1, 14, 220, 0, 6, 48,
- 4, 130, 22, 2, 33, 192, 18, 172, 64, 137,
- 74, 80, 1, 5, 25, 29, 168, 40, 42, 145,
- 3, 153, 48, 99, 3, 87, 168, 4, 37, 172,
- 128, 3, 197, 14, 84, 194, 154, 192, 64, 118,
- 35, 203, 221, 71, 51, 200, 101, 23, 160, 135,
- 17, 216, 161, 12, 205, 97, 72, 32, 193, 8,
- 119, 18, 72, 81, 4, 185, 114, 193, 20, 104,
- 255, 144, 137, 2, 62, 144, 182, 44, 200, 65,
- 14, 112, 0, 195, 37, 46, 209, 134, 93, 228,
- 91, 20, 245, 190, 4, 37, 164, 0, 129, 171,
- 165, 193, 10, 183, 128, 48, 7, 124, 61, 243,
- 75, 80, 129, 2, 65, 77, 69, 99, 233, 128,
- 100, 39, 42, 121, 169, 209, 174, 108, 61, 92,
- 96, 134, 19, 152, 161, 19, 77, 24, 136, 0,
- 28, 224, 10, 18, 183, 129, 176, 113, 240, 47,
- 1, 184, 25, 128, 178, 151, 29, 26, 33, 184,
- 132, 204, 213, 238, 6, 155, 255, 131, 0, 35,
- 152, 121, 191, 229, 128, 130, 90, 175, 96, 4,
- 1, 231, 69, 40, 212, 206, 247, 43, 8, 84,
- 0, 203, 46, 234, 99, 157, 173, 172, 71, 99,
- 140, 31, 54, 192, 130, 33, 206, 144, 229, 40,
- 148, 34, 10, 164, 21, 72, 44, 92, 177, 132,
- 78, 148, 66, 10, 140, 95, 66, 20, 164, 32,
- 100, 130, 8, 160, 26, 107, 151, 121, 27, 18,
- 144, 111, 82, 168, 93, 230, 149, 88, 66, 157,
- 255, 177, 130, 30, 32, 64, 32, 5, 104, 131,
- 204, 103, 47, 10, 129, 10, 245, 11, 47, 60,
- 234, 30, 86, 181, 56, 4, 69, 189, 32, 253,
- 192, 64, 19, 86, 152, 142, 31, 156, 162, 13,
- 109, 216, 129, 123, 1, 96, 11, 206, 157, 64,
- 24, 202, 16, 134, 43, 146, 16, 138, 206, 107,
- 253, 12, 106, 127, 185, 27, 174, 224, 118, 2,
- 72, 129, 18, 148, 224, 187, 255, 18, 86, 223,
- 122, 210, 251, 196, 215, 179, 55, 250, 223, 171,
- 251, 194, 236, 42, 116, 201, 221, 69, 72, 60,
- 110, 0, 133, 38, 184, 163, 10, 144, 112, 196,
- 90, 219, 160, 142, 235, 4, 128, 1, 218, 195,
- 124, 87, 245, 7, 125, 80, 11, 40, 16, 10,
- 178, 16, 11, 215, 129, 0, 177, 208, 128, 177,
- 176, 0, 125, 32, 7, 200, 87, 9, 96, 208,
- 118, 55, 151, 126, 151, 96, 6, 228, 23, 10,
- 177, 32, 16, 2, 240, 3, 51, 71, 123, 72,
- 55, 80, 169, 48, 4, 158, 52, 3, 72, 197,
- 45, 59, 36, 40, 212, 118, 14, 58, 208, 14,
- 51, 80, 5, 141, 176, 127, 165, 128, 31, 8,
- 176, 61, 2, 120, 2, 182, 80, 104, 2, 32,
- 1, 161, 48, 2, 102, 160, 110, 5, 96, 117,
- 75, 96, 6, 75, 48, 8, 161, 112, 5, 107,
- 87, 115, 249, 38, 5, 124, 167, 118, 26, 40,
- 16, 43, 112, 116, 87, 19, 13, 49, 199, 119,
- 84, 0, 1, 65, 245, 8, 145, 64, 7, 24,
- 128, 4, 72, 160, 100, 247, 64, 89, 110, 194,
- 60, 215, 112, 14, 213, 176, 14, 238, 112, 8,
- 234, 224, 9, 81, 48, 8, 108, 145, 111, 1,
- 200, 124, 39, 160, 61, 201, 246, 15, 180, 48,
- 8, 143, 183, 0, 3, 17, 12, 74, 112, 5,
- 110, 208, 6, 82, 64, 13, 221, 32, 7, 106,
- 55, 122, 55, 87, 116, 50, 55, 126, 2, 65,
- 13, 116, 255, 103, 126, 252, 176, 3, 68, 39,
- 7, 103, 96, 126, 132, 100, 4, 245, 128, 4,
- 140, 54, 134, 190, 98, 35, 55, 240, 4, 214,
- 128, 3, 40, 160, 12, 186, 32, 12, 181, 112,
- 73, 4, 16, 12, 6, 160, 138, 170, 184, 138,
- 50, 113, 107, 202, 208, 113, 119, 248, 15, 222,
- 16, 12, 218, 192, 13, 117, 22, 15, 210, 0,
- 7, 151, 96, 129, 111, 39, 10, 69, 167, 118,
- 125, 176, 122, 212, 112, 9, 61, 208, 10, 80,
- 18, 1, 59, 0, 2, 191, 16, 121, 235, 22,
- 3, 147, 48, 3, 16, 83, 59, 24, 179, 63,
- 150, 50, 3, 88, 224, 8, 136, 64, 8, 133,
- 208, 1, 21, 65, 11, 39, 240, 7, 161, 240,
- 9, 27, 0, 37, 67, 150, 13, 148, 160, 5,
- 110, 199, 11, 137, 64, 87, 113, 112, 4, 71,
- 16, 133, 255, 0, 2, 151, 0, 7, 31, 240,
- 10, 250, 69, 16, 241, 80, 12, 93, 128, 9,
- 22, 32, 59, 58, 134, 53, 93, 51, 75, 208,
- 164, 6, 22, 65, 11, 61, 64, 3, 65, 16,
- 4, 34, 192, 0, 2, 18, 37, 177, 240, 1,
- 71, 160, 5, 181, 241, 15, 3, 128, 8, 38,
- 240, 79, 62, 86, 13, 28, 1, 2, 240, 152,
- 5, 186, 240, 10, 181, 86, 16, 188, 32, 11,
- 136, 144, 7, 116, 80, 2, 139, 83, 141, 144,
- 228, 1, 244, 64, 2, 128, 48, 11, 5, 96,
- 0, 52, 89, 147, 54, 121, 147, 6, 255, 240,
- 10, 202, 176, 5, 186, 20, 4, 236, 0, 1,
- 177, 96, 0, 3, 80, 66, 5, 64, 11, 13,
- 144, 3, 169, 96, 7, 169, 112, 11, 52, 169,
- 0, 79, 112, 92, 95, 48, 87, 57, 160, 0,
- 52, 169, 2, 115, 32, 87, 89, 176, 1, 174,
- 64, 11, 5, 80, 66, 196, 96, 0, 177, 224,
- 11, 46, 96, 72, 116, 64, 15, 226, 194, 146,
- 210, 70, 15, 144, 208, 7, 228, 160, 3, 27,
- 176, 89, 22, 53, 135, 114, 201, 124, 40, 96,
- 12, 56, 96, 6, 142, 64, 7, 36, 176, 10,
- 143, 144, 13, 40, 160, 11, 181, 80, 11, 20,
- 128, 12, 135, 16, 4, 66, 96, 2, 142, 160,
- 3, 190, 224, 11, 28, 176, 6, 116, 0, 79,
- 253, 36, 2, 34, 97, 12, 78, 32, 4, 67,
- 160, 10, 95, 208, 5, 45, 240, 1, 186, 208,
- 10, 181, 0, 1, 41, 224, 4, 144, 128, 9,
- 100, 165, 7, 55, 240, 63, 109, 130, 50, 139,
- 96, 6, 139, 128, 1, 147, 224, 8, 160, 160,
- 12, 182, 240, 61, 180, 201, 61, 182, 144, 1,
- 127, 224, 8, 70, 32, 4, 132, 240, 7, 144,
- 128, 62, 171, 144, 7, 93, 32, 3, 50, 208,
- 8, 238, 96, 4, 171, 69, 60, 150, 224, 98,
- 243, 64, 7, 64, 0, 55, 172, 69, 4, 40,
- 133, 5, 99, 5, 79, 252, 20, 4, 142, 32,
- 3, 139, 224, 14, 108, 0, 55, 64, 32, 6,
- 233, 211, 64, 97, 255, 98, 17, 55, 48, 15,
- 238, 128, 6, 235, 80, 15, 11, 83, 15, 143,
- 96, 6, 185, 96, 11, 39, 16, 139, 242, 41,
- 159, 89, 150, 8, 150, 16, 53, 24, 192, 8,
- 103, 208, 8, 191, 179, 10, 100, 80, 83, 60,
- 83, 15, 125, 36, 6, 236, 100, 56, 62, 19,
- 67, 98, 0, 55, 152, 96, 83, 148, 163, 160,
- 240, 4, 160, 134, 83, 2, 63, 3, 134, 217,
- 85, 50, 104, 249, 15, 254, 160, 50, 220, 32,
- 14, 24, 112, 49, 94, 35, 6, 138, 176, 4,
- 154, 131, 105, 127, 80, 162, 38, 90, 162, 234,
- 208, 8, 245, 0, 49, 249, 80, 2, 144, 32,
- 2, 104, 132, 75, 122, 64, 74, 11, 99, 1,
- 22, 16, 67, 104, 36, 71, 83, 131, 4, 172,
- 68, 97, 72, 160, 48, 54, 96, 74, 24, 64,
- 78, 154, 64, 97, 51, 0, 52, 209, 178, 45,
- 30, 160, 15, 145, 197, 146, 23, 80, 14, 47,
- 176, 80, 174, 243, 55, 245, 128, 8, 162, 24,
- 8, 228, 64, 8, 234, 176, 165, 92, 170, 14,
- 233, 192, 8, 147, 176, 15, 220, 34, 46, 30,
- 0, 15, 80, 128, 15, 72, 160, 7, 31, 3,
- 71, 215, 160, 76, 55, 128, 15, 101, 112, 74,
- 110, 250, 166, 72, 224, 46, 21, 10, 71, 116,
- 138, 100, 106, 42, 6, 167,
- 4, 43, 221, 34, 47, 211, 6, 68, 254, 131,
- 49, 247, 16, 14, 124, 179, 63, 3, 83, 15,
- 104, 128, 2, 214, 255, 192, 14, 134, 96, 8,
- 235, 16, 169, 146, 186, 14, 80, 128, 14, 42,
- 121, 150, 126, 131, 15, 162, 89, 167, 198, 164,
- 76, 117, 3, 71, 61, 84, 6, 248, 0, 71,
- 111, 116, 3, 117, 154, 93, 36, 163, 45, 111,
- 234, 46, 122, 164, 71, 32, 67, 67, 191, 34,
- 16, 21, 148, 44, 191, 151, 47, 244, 80, 69,
- 247, 0, 5, 74, 144, 6, 231, 208, 14, 47,
- 80, 15, 47, 48, 15, 47, 16, 172, 243, 32,
- 172, 51, 112, 154, 14, 226, 58, 248, 0, 5,
- 108, 80, 161, 154, 114, 1, 223, 114, 41, 73,
- 245, 172, 83, 84, 55, 76, 250, 67, 83, 228,
- 1, 118, 83, 167, 238, 210, 64, 204, 116, 16,
- 23, 208, 72, 173, 243, 37, 183, 218, 84, 51,
- 224, 4, 91, 211, 72, 55, 36, 65, 235, 106,
- 113, 4, 209, 15, 123, 224, 14, 98, 128, 55,
- 227, 178, 67, 13, 18, 38, 228, 66, 46, 190,
- 18, 15, 19, 96, 120, 2, 243, 40, 110, 196,
- 45, 70, 83, 41, 174, 114, 63, 13, 165, 143,
- 215, 16, 42, 30, 176, 3, 232, 176, 146, 249,
- 154, 175, 13, 82, 118, 2, 3, 105, 111, 178,
- 15, 108, 208, 14, 172, 210, 56, 149, 34, 40,
- 145, 193, 93, 88, 179, 52, 209, 54, 176, 2,
- 33, 15, 207, 224, 1, 250, 170, 52, 27, 203,
- 32, 118, 99, 3, 225, 144, 46, 57, 225, 58,
- 23, 138, 36, 227, 137, 53, 227, 240, 2, 140,
- 61, 163, 18, 131, 146, 15, 220, 229, 13, 19,
- 100, 38, 20, 139, 53, 34, 171, 52, 224, 80,
- 14, 181, 90, 17, 21, 212, 58, 253, 48, 45,
- 47, 187, 130, 29, 241, 179, 10, 193, 15, 225,
- 16, 14, 183, 131, 36, 109, 2, 173, 14, 114,
- 179, 12, 225, 58, 78, 102, 175, 109, 226, 32,
- 1, 1, 0, 59 };
-
-unsigned char php_logo[] = {
- 71, 73, 70, 56, 57, 97, 130, 0, 67, 0,
- 213, 255, 0, 0, 0, 0, 48, 47, 49, 2,
- 2, 3, 7, 7, 10, 152, 152, 203, 153, 153,
- 204, 150, 150, 200, 147, 147, 195, 3, 3, 4,
- 91, 91, 105, 164, 164, 178, 69, 69, 73, 196,
- 196, 206, 141, 142, 189, 136, 137, 180, 152, 153,
- 187, 101, 103, 134, 126, 129, 172, 176, 178, 205,
- 25, 26, 36, 49, 52, 73, 33, 35, 49, 69,
- 73, 100, 82, 88, 127, 111, 119, 168, 201, 204,
- 221, 81, 95, 159, 85, 99, 163, 97, 105, 147,
- 13, 14, 19, 162, 169, 205, 183, 189, 220, 88,
- 103, 165, 92, 106, 169, 90, 104, 165, 91, 105,
- 166, 95, 110, 172, 102, 115, 174, 93, 105, 158,
- 139, 150, 197, 148, 158, 202, 219, 221, 229, 192,
- 192, 192, 2, 2, 1, 3, 3, 2, 7, 7,
- 6, 15, 15, 14, 133, 133, 131, 152, 152, 151,
- 114, 113, 110, 5, 4, 3, 20, 19, 18, 31,
- 30, 29, 39, 38, 37, 10, 9, 9, 25, 24,
- 24, 61, 60, 60, 183, 183, 183, 81, 81, 81,
- 12, 12, 12, 5, 5, 5, 1, 1, 1, 255,
- 255, 255, 0, 0, 0, 33, 249, 4, 1, 0,
- 0, 42, 0, 44, 0, 0, 0, 0, 130, 0,
- 67, 0, 64, 6, 255, 64, 149, 112, 72, 44,
- 26, 143, 200, 100, 146, 192, 108, 58, 159, 80,
- 130, 114, 74, 173, 90, 175, 70, 130, 225, 112,
- 48, 72, 24, 169, 112, 42, 227, 105, 96, 66,
- 155, 52, 72, 36, 26, 185, 223, 240, 184, 124,
- 78, 15, 185, 69, 38, 14, 100, 15, 73, 236,
- 49, 14, 13, 92, 6, 88, 133, 72, 91, 13,
- 15, 138, 24, 32, 32, 116, 143, 144, 112, 26,
- 30, 48, 0, 150, 150, 59, 25, 140, 145, 156,
- 157, 111, 33, 33, 23, 11, 1, 1, 11, 128,
- 13, 132, 134, 66, 4, 7, 17, 24, 24, 158,
- 35, 27, 31, 9, 151, 150, 51, 9, 49, 186,
- 49, 58, 56, 46, 182, 151, 60, 57, 40, 25,
- 51, 192, 52, 58, 201, 201, 56, 52, 192, 150,
- 45, 12, 17, 62, 49, 192, 59, 185, 187, 9,
- 190, 206, 0, 44, 48, 37, 142, 115, 33, 32,
- 19, 0, 19, 16, 17, 168, 84, 91, 28, 28,
- 38, 177, 27, 39, 57, 43, 192, 48, 30, 27,
- 114, 26, 31, 212, 244, 149, 182, 52, 41, 223,
- 36, 125, 120, 1, 204, 6, 131, 15, 12, 16,
- 0, 123, 241, 65, 3, 190, 15, 253, 108, 197,
- 136, 0, 238, 17, 137, 11, 2, 120, 248, 137,
- 112, 128, 74, 43, 118, 109, 34, 129, 200, 176,
- 96, 155, 73, 75, 60, 22, 228, 72, 129, 65,
- 67, 132, 12, 60, 22, 54, 132, 3, 2, 67,
- 134, 22, 192, 98, 100, 240, 81, 235, 228, 54,
- 255, 22, 56, 20, 124, 32, 113, 175, 19, 9,
- 13, 3, 0, 4, 216, 216, 17, 139, 1, 3,
- 13, 34, 236, 105, 247, 102, 3, 10, 5, 206,
- 114, 156, 40, 26, 171, 235, 195, 28, 206, 94,
- 4, 244, 10, 39, 196, 197, 14, 0, 6, 80,
- 240, 3, 168, 169, 42, 117, 7, 26, 56, 136,
- 160, 135, 15, 132, 118, 33, 201, 234, 245, 100,
- 54, 132, 137, 11, 22, 2, 212, 160, 65, 163,
- 194, 218, 11, 16, 48, 68, 112, 208, 229, 173,
- 227, 199, 66, 158, 110, 225, 210, 64, 174, 131,
- 203, 17, 50, 107, 222, 204, 153, 243, 229, 203,
- 149, 185, 116, 73, 5, 185, 180, 233, 44, 90,
- 38, 115, 41, 224, 65, 130, 107, 6, 176, 25,
- 184, 158, 173, 64, 129, 34, 69, 152, 51, 191,
- 194, 192, 174, 119, 111, 197, 139, 67, 143, 38,
- 125, 186, 184, 138, 201, 15, 90, 203, 110, 80,
- 34, 77, 222, 189, 179, 98, 184, 152, 62, 29,
- 71, 10, 18, 21, 247, 134, 243, 203, 33, 129,
- 178, 4, 167, 26, 27, 223, 162, 121, 44, 29,
- 16, 36, 82, 4, 160, 206, 190, 189, 139, 25,
- 53, 116, 188, 200, 144, 161, 185, 172, 6, 57,
- 88, 0, 107, 177, 195, 253, 141, 0, 242, 101,
- 48, 84, 35, 210, 248, 226, 158, 123, 240, 201,
- 39, 155, 56, 116, 92, 116, 131, 12, 230, 160,
- 67, 156, 58, 116, 113, 208, 149, 6, 18, 68,
- 100, 137, 65, 155, 208, 68, 255, 66, 6, 53,
- 0, 115, 131, 15, 37, 217, 178, 64, 6, 35,
- 228, 37, 194, 72, 58, 0, 19, 64, 6, 41,
- 96, 101, 11, 11, 57, 56, 144, 93, 138, 34,
- 100, 128, 3, 48, 51, 120, 16, 194, 115, 113,
- 160, 129, 86, 0, 231, 52, 48, 5, 43, 188,
- 185, 211, 9, 8, 37, 164, 240, 139, 68, 62,
- 124, 32, 229, 7, 244, 229, 208, 98, 88, 62,
- 200, 120, 201, 10, 57, 52, 192, 149, 44, 241,
- 244, 64, 15, 140, 205, 216, 162, 67, 148, 83,
- 86, 217, 83, 78, 246, 24, 69, 1, 0, 55,
- 248, 193, 152, 21, 80, 233, 97, 33, 29, 249,
- 16, 100, 203, 12, 0, 109, 208, 200, 159, 107,
- 0, 249, 6, 160, 128, 158, 71, 104, 35, 41,
- 104, 8, 128, 11, 10, 136, 115, 40, 27, 100,
- 97, 71, 206, 14, 22, 92, 192, 193, 156, 144,
- 33, 66, 215, 84, 28, 60, 170, 157, 118, 43,
- 122, 218, 149, 89, 26, 88, 128, 86, 57, 149,
- 38, 22, 200, 132, 198, 169, 131, 136, 92, 174,
- 212, 101, 215, 172, 119, 245, 102, 194, 173, 184,
- 178, 161, 43, 174, 183, 246, 182, 199, 5, 9,
- 4, 171, 140, 14, 11, 20, 187, 128, 5, 9,
- 32, 118, 151, 98, 129, 140, 214, 234, 179, 88,
- 164, 38, 153, 106, 148, 85, 102, 237, 181, 215,
- 138, 54, 200, 180, 79, 65, 235, 173, 21, 169,
- 13, 242, 5, 140, 98, 132, 193, 128, 7, 7,
- 204, 133, 255, 65, 9, 118, 172, 168, 198, 161,
- 128, 66, 250, 6, 30, 184, 178, 67, 235, 93,
- 193, 9, 210, 237, 183, 111, 105, 193, 133, 114,
- 244, 73, 96, 134, 8, 126, 222, 216, 137, 8,
- 37, 36, 172, 48, 187, 130, 238, 101, 71, 30,
- 125, 4, 203, 86, 179, 172, 126, 139, 156, 2,
- 30, 120, 224, 0, 81, 13, 239, 85, 83, 6,
- 59, 200, 228, 208, 167, 157, 252, 120, 65, 47,
- 56, 232, 192, 1, 58, 226, 157, 182, 197, 103,
- 17, 164, 72, 71, 27, 11, 215, 108, 51, 118,
- 26, 100, 215, 134, 142, 192, 232, 80, 223, 205,
- 32, 228, 12, 135, 8, 33, 216, 108, 116, 194,
- 216, 249, 89, 71, 8, 22, 212, 112, 67, 5,
- 69, 186, 85, 8, 43, 14, 40, 214, 33, 36,
- 86, 129, 229, 211, 73, 58, 176, 148, 207, 62,
- 91, 111, 163, 128, 4, 249, 48, 32, 64, 216,
- 219, 44, 48, 96, 131, 22, 136, 73, 193, 202,
- 82, 31, 121, 64, 146, 177, 124, 108, 67, 78,
- 13, 105, 160, 247, 61, 37, 100, 160, 40, 0,
- 56, 100, 185, 95, 52, 5, 175, 145, 222, 154,
- 150, 208, 248, 129, 147, 120, 235, 189, 247, 8,
- 125, 43, 48, 143, 45, 1, 180, 249, 72, 8,
- 21, 148, 83, 100, 197, 68, 176, 146, 135, 146,
- 7, 135, 144, 65, 0, 61, 103, 176, 70, 28,
- 118, 3, 179, 0, 3, 56, 217, 82, 207, 200,
- 110, 128, 16, 1, 235, 57, 165, 64, 255, 34,
- 48, 56, 100, 240, 35, 234, 77, 26, 67, 185,
- 229, 22, 89, 0, 64, 7, 150, 58, 192, 121,
- 100, 7, 176, 3, 58, 39, 95, 31, 115, 157,
- 35, 108, 4, 29, 66, 10, 122, 154, 233, 67,
- 153, 151, 36, 144, 193, 151, 34, 124, 24, 162,
- 137, 59, 85, 111, 137, 11, 245, 129, 179, 98,
- 206, 126, 59, 179, 0, 240, 22, 93, 208, 131,
- 70, 231, 196, 109, 132, 1, 14, 40, 223, 201,
- 6, 30, 104, 137, 118, 207, 41, 68, 64, 11,
- 238, 186, 123, 78, 116, 142, 81, 165, 253, 165,
- 141, 1, 230, 129, 196, 69, 4, 208, 3, 10,
- 92, 0, 16, 199, 35, 66, 43, 238, 98, 2,
- 59, 156, 199, 1, 12, 144, 65, 237, 232, 195,
- 193, 48, 208, 231, 3, 13, 64, 67, 27, 54,
- 16, 129, 49, 112, 144, 131, 36, 16, 96, 9,
- 79, 200, 193, 197, 181, 46, 123, 44, 36, 151,
- 128, 36, 64, 145, 47, 113, 130, 4, 109, 3,
- 192, 90, 226, 87, 8, 242, 76, 69, 14, 76,
- 74, 193, 13, 128, 161, 61, 27, 146, 44, 18,
- 27, 112, 128, 15, 190, 119, 137, 5, 160, 192,
- 136, 122, 33, 74, 230, 16, 176, 67, 9, 61,
- 230, 41, 233, 170, 75, 59, 172, 82, 46, 49,
- 124, 64, 94, 71, 228, 196, 138, 22, 215, 197,
- 20, 176, 175, 43, 36, 184, 8, 57, 80, 133,
- 152, 197, 200, 207, 101, 113, 217, 20, 31, 168,
- 98, 193, 48, 218, 255, 17, 18, 125, 1, 204,
- 4, 118, 192, 131, 14, 44, 5, 49, 225, 225,
- 151, 18, 16, 161, 46, 89, 217, 165, 29, 38,
- 104, 67, 29, 239, 248, 9, 80, 60, 140, 3,
- 23, 16, 197, 2, 112, 128, 3, 82, 224, 96,
- 1, 201, 194, 23, 197, 4, 233, 178, 201, 88,
- 70, 55, 134, 188, 23, 31, 36, 70, 202, 82,
- 154, 50, 147, 83, 121, 69, 102, 2, 161, 175,
- 8, 114, 242, 149, 157, 139, 130, 44, 103, 217,
- 4, 88, 218, 242, 52, 210, 226, 150, 46, 119,
- 185, 175, 91, 250, 242, 72, 210, 210, 22, 23,
- 110, 67, 204, 98, 230, 70, 55, 187, 1, 14,
- 43, 5, 177, 173, 94, 254, 18, 90, 225, 90,
- 141, 4, 168, 68, 46, 19, 198, 70, 2, 30,
- 120, 192, 39, 145, 153, 204, 110, 246, 202, 55,
- 190, 90, 214, 98, 154, 229, 172, 103, 190, 5,
- 139, 7, 40, 128, 4, 170, 233, 65, 116, 69,
- 128, 93, 32, 72, 67, 193, 116, 117, 199, 111,
- 222, 139, 89, 173, 52, 231, 18, 38, 163, 78,
- 250, 132, 225, 3, 173, 64, 131, 159, 58, 38,
- 135, 80, 17, 138, 160, 94, 129, 88, 196, 130,
- 117, 142, 77, 234, 19, 57, 95, 128, 205, 3,
- 98, 54, 80, 232, 156, 192, 132, 29, 68, 145,
- 193, 62, 245, 176, 136, 233, 32, 88, 225, 113,
- 229, 120, 134, 233, 26, 141, 17, 101, 163, 100,
- 33, 218, 232, 74, 135, 82, 59, 254, 168, 59,
- 255, 198, 186, 128, 27, 69, 234, 24, 68, 60,
- 160, 54, 14, 104, 14, 66, 245, 2, 15, 121,
- 0, 67, 1, 79, 100, 36, 30, 255, 66, 73,
- 28, 36, 96, 166, 35, 189, 204, 3, 54, 134,
- 82, 131, 194, 75, 84, 113, 104, 158, 45, 106,
- 144, 2, 71, 29, 116, 14, 79, 125, 42, 24,
- 229, 32, 142, 166, 213, 224, 109, 86, 204, 84,
- 186, 46, 195, 8, 130, 110, 64, 2, 24, 141,
- 225, 9, 61, 248, 1, 12, 40, 109, 4, 76,
- 202, 192, 147, 178, 151, 86, 127, 126, 208, 173,
- 208, 75, 79, 93, 213, 218, 66, 15, 52, 7,
- 165, 23, 161, 129, 11, 34, 36, 136, 115, 166,
- 43, 51, 9, 196, 234, 236, 98, 98, 64, 56,
- 189, 32, 5, 14, 72, 3, 37, 26, 107, 9,
- 26, 192, 32, 5, 35, 208, 0, 10, 82, 112,
- 183, 198, 206, 32, 6, 31, 72, 236, 27, 46,
- 114, 55, 168, 133, 245, 10, 80, 217, 205, 78,
- 221, 128, 161, 191, 25, 48, 6, 41, 24, 201,
- 142, 40, 107, 137, 0, 96, 54, 70, 180, 189,
- 132, 14, 206, 8, 7, 18, 188, 105, 0, 224,
- 193, 84, 21, 234, 132, 129, 20, 30, 204, 123,
- 61, 67, 83, 154, 252, 22, 178, 218, 229, 64,
- 33, 174, 75, 1, 53, 253, 169, 128, 230, 94,
- 162, 7, 57, 240, 128, 15, 102, 123, 9, 235,
- 76, 73, 74, 244, 129, 129, 239, 204, 180, 149,
- 224, 1, 160, 7, 22, 184, 255, 212, 27, 231,
- 215, 0, 251, 121, 162, 167, 98, 114, 93, 80,
- 231, 181, 129, 38, 205, 181, 178, 62, 16, 31,
- 0, 254, 129, 29, 93, 137, 64, 170, 151, 32,
- 31, 66, 160, 123, 137, 23, 144, 109, 104, 27,
- 72, 15, 246, 44, 113, 3, 9, 32, 20, 135,
- 0, 224, 65, 122, 133, 139, 4, 36, 81, 229,
- 29, 250, 0, 6, 85, 141, 235, 161, 12, 12,
- 113, 170, 66, 108, 28, 77, 154, 180, 96, 0,
- 248, 44, 191, 34, 2, 200, 141, 84, 74, 58,
- 91, 52, 184, 165, 110, 240, 109, 57, 30, 152,
- 142, 36, 172, 227, 194, 75, 178, 137, 117, 45,
- 1, 90, 216, 85, 5, 5, 57, 136, 239, 37,
- 98, 160, 191, 8, 71, 35, 59, 86, 41, 50,
- 0, 96, 0, 163, 241, 90, 162, 136, 114, 216,
- 64, 3, 24, 160, 31, 19, 149, 87, 129, 23,
- 72, 139, 156, 214, 139, 60, 247, 118, 98, 18,
- 138, 226, 193, 145, 227, 176, 1, 12, 164, 160,
- 196, 46, 72, 193, 149, 186, 27, 64, 56, 204,
- 2, 113, 0, 168, 65, 1, 109, 209, 3, 5,
- 92, 185, 42, 77, 106, 241, 37, 108, 160, 128,
- 18, 236, 116, 129, 240, 227, 136, 18, 88, 161,
- 188, 69, 62, 98, 103, 220, 181, 196, 137, 228,
- 185, 129, 162, 109, 22, 6, 147, 219, 51, 140,
- 24, 91, 224, 3, 15, 202, 38, 157, 29, 242,
- 78, 214, 92, 91, 211, 105, 32, 13, 69, 187,
- 168, 2, 255, 50, 253, 140, 62, 195, 56, 198,
- 194, 179, 6, 15, 149, 240, 145, 59, 113, 66,
- 202, 25, 212, 240, 71, 133, 181, 30, 147, 116,
- 109, 32, 60, 82, 177, 36, 50, 4, 12, 97,
- 80, 233, 133, 150, 136, 143, 196, 122, 225, 100,
- 19, 125, 96, 119, 157, 32, 71, 5, 18, 112,
- 41, 87, 222, 216, 213, 144, 200, 83, 110, 89,
- 0, 91, 27, 129, 136, 136, 219, 27, 154, 232,
- 244, 172, 104, 24, 185, 22, 109, 9, 64, 224,
- 169, 71, 251, 166, 14, 88, 96, 115, 234, 104,
- 47, 59, 68, 210, 59, 96, 32, 0, 65, 52,
- 0, 208, 11, 86, 130, 130, 120, 246, 212, 61,
- 90, 249, 210, 189, 219, 195, 228, 20, 48, 209,
- 18, 50, 128, 55, 128, 98, 144, 131, 12, 108,
- 101, 220, 228, 6, 0, 165, 30, 104, 60, 58,
- 205, 237, 46, 102, 189, 10, 48, 4, 160, 21,
- 163, 137, 227, 211, 207, 233, 158, 205, 144, 237,
- 33, 155, 129, 224, 3, 90, 187, 238, 11, 114,
- 90, 51, 18, 160, 33, 103, 171, 237, 173, 6,
- 208, 50, 1, 182, 212, 216, 225, 245, 187, 203,
- 121, 50, 192, 105, 192, 181, 89, 168, 231, 41,
- 1, 79, 52, 44, 1, 40, 70, 81, 4, 153,
- 75, 73, 27, 95, 238, 148, 9, 66, 156, 38,
- 139, 21, 25, 206, 31, 161, 89, 206, 18, 209,
- 70, 71, 60, 10, 57, 120, 176, 195, 182, 92,
- 145, 60, 90, 100, 45, 68, 102, 192, 219, 117,
- 174, 83, 85, 180, 75, 79, 17, 8, 98, 212,
- 117, 174, 211, 64, 1, 28, 254, 57, 5, 206,
- 214, 129, 5, 0, 146, 194, 98, 173, 218, 28,
- 17, 102, 51, 153, 133, 125, 14, 52, 171, 187,
- 94, 72, 181, 246, 180, 44, 5, 95, 133, 125,
- 214, 83, 228, 130, 129, 57, 114, 128, 104, 119,
- 79, 188, 27, 72, 101, 129, 9, 136, 169, 3,
- 59, 92, 25, 99, 104, 90, 154, 151, 201, 113,
- 42, 137, 28, 129, 161, 21, 239, 149, 190, 108,
- 224, 2, 20, 168, 1, 215, 255, 147, 42, 197,
- 232, 235, 153, 132, 188, 252, 28, 111, 197, 249,
- 203, 57, 242, 191, 128, 169, 164, 96, 2, 64,
- 129, 84, 113, 128, 89, 45, 211, 231, 16, 176,
- 8, 171, 194, 139, 82, 121, 172, 255, 132, 230,
- 55, 207, 85, 71, 26, 63, 69, 16, 3, 86,
- 50, 138, 85, 212, 99, 101, 242, 246, 193, 201,
- 189, 238, 7, 249, 170, 185, 196, 74, 148, 216,
- 191, 215, 41, 73, 57, 44, 29, 32, 11, 149,
- 208, 143, 190, 244, 167, 175, 10, 201, 84, 235,
- 152, 175, 176, 87, 246, 215, 207, 14, 85, 174,
- 146, 149, 229, 36, 63, 44, 167, 37, 204, 250,
- 219, 255, 254, 206, 52, 103, 16, 0, 0, 59,
- 10, 124, 165, 92, 136, 65, 105, 236, 247, 73,
- 168, 224, 1, 35, 240, 0, 23, 226, 0, 154,
- 225, 54, 178, 247, 74, 94, 17, 75, 229, 34,
- 22, 137, 33, 128, 174, 3, 88, 10, 143, 65,
- 21, 34, 48, 1, 51, 160, 3, 207, 151, 127,
- 104, 37, 126, 248, 196, 4, 196, 18, 46, 202,
- 52, 75, 2, 50, 129, 21, 88, 7, 209, 100,
- 114, 95, 97, 12, 172, 96, 92, 36, 176, 128,
- 104, 213, 128, 10, 117, 76, 254, 71, 8, 175,
- 80, 130, 203, 164, 46, 186, 176, 130, 20, 24,
- 7, 62, 24, 77, 199, 52, 47, 247, 177, 54,
- 19, 128, 90, 60, 240, 43, 229, 132, 86, 180,
- 161, 121, 58, 85, 11, 46, 115, 8, 175, 49,
- 25, 155, 17, 8, 58, 184, 76, 9, 80, 46,
- 3, 0, 85, 80, 165, 78, 235, 52, 13, 247,
- 178, 47, 241, 164, 26, 177, 65, 27, 221, 241,
- 132, 183, 193, 86, 189, 49, 78, 228, 84, 78,
- 110, 248, 134, 112, 24, 135, 242, 68, 134, 28,
- 37, 42, 103, 136, 134, 33, 104, 48, 39, 35,
- 27, 109, 160, 48, 220, 242, 135, 21, 224, 25,
- 220, 2, 49, 7, 53, 49, 32, 21, 4, 0,
- 59, 0 };
-
-unsigned char php_egg_logo[] = {
- 71, 73, 70, 56, 57, 97, 130, 0, 67, 0,
- 213, 255, 0, 0, 0, 0, 152, 138, 142, 104,
- 95, 105, 89, 86, 93, 160, 151, 174, 102, 101,
- 136, 164, 163, 205, 174, 173, 213, 102, 102, 153,
- 99, 99, 149, 102, 102, 152, 96, 96, 143, 90,
- 90, 134, 82, 82, 115, 87, 87, 121, 80, 80,
- 108, 74, 74, 100, 110, 110, 147, 95, 95, 127,
- 149, 149, 198, 118, 118, 157, 67, 67, 89, 144,
- 144, 191, 128, 128, 169, 137, 137, 180, 155, 155,
- 197, 186, 186, 227, 209, 209, 247, 242, 242, 254,
- 64, 67, 65, 192, 192, 192, 32, 45, 25, 50,
- 54, 36, 65, 63, 42, 75, 71, 53, 87, 79,
- 61, 93, 85, 69, 231, 180, 110, 106, 92, 74,
- 207, 155, 100, 121, 101, 80, 181, 131, 89, 141,
- 110, 88, 158, 125, 103, 148, 118, 97, 169, 135,
- 112, 131, 112, 99, 180, 141, 117, 135, 101, 81,
- 191, 148, 124, 168, 126, 107, 201, 153, 130, 164,
- 116, 97, 191, 139, 119, 213, 155, 135, 220, 164,
- 146, 203, 142, 124, 180, 127, 112, 175, 118, 103,
- 191, 127, 114, 162, 102, 91, 255, 255, 255, 0,
- 0, 0, 0, 0, 0, 33, 249, 4, 1, 0,
- 0, 30, 0, 44, 0, 0, 0, 0, 130, 0,
- 67, 0, 64, 6, 255, 64, 143, 112, 72, 44,
- 26, 143, 72, 226, 100, 105, 105, 98, 158, 151,
- 40, 133, 18, 137, 20, 36, 18, 135, 118, 203,
- 213, 74, 10, 133, 200, 52, 122, 121, 98, 154,
- 150, 229, 50, 201, 110, 187, 223, 202, 137, 5,
- 115, 137, 72, 30, 16, 72, 101, 15, 105, 48,
- 24, 11, 9, 130, 10, 132, 10, 8, 135, 136,
- 137, 137, 11, 3, 34, 31, 31, 32, 32, 33,
- 147, 34, 149, 34, 35, 152, 153, 34, 33, 32,
- 143, 143, 29, 2, 133, 130, 9, 11, 127, 14,
- 13, 13, 91, 88, 18, 17, 101, 105, 19, 112,
- 112, 114, 24, 17, 120, 123, 21, 14, 129, 132,
- 138, 188, 189, 190, 137, 21, 31, 33, 38, 48,
- 44, 52, 58, 57, 59, 53, 56, 203, 56, 206,
- 206, 51, 207, 204, 53, 47, 57, 50, 44, 40,
- 36, 35, 150, 33, 144, 191, 188, 132, 164, 12,
- 14, 95, 96, 20, 103, 176, 111, 22, 20, 182,
- 16, 12, 9, 134, 223, 242, 243, 138, 32, 36,
- 48, 42, 52, 50, 57, 203, 205, 206, 54, 0,
- 111, 8, 20, 8, 112, 198, 140, 24, 212, 86,
- 184, 64, 97, 162, 33, 166, 77, 32, 36, 208,
- 251, 165, 32, 193, 31, 49, 231, 44, 176, 185,
- 3, 33, 87, 188, 137, 32, 229, 129, 24, 129,
- 66, 5, 10, 23, 35, 62, 184, 112, 1, 163,
- 134, 141, 26, 57, 98, 210, 88, 209, 2, 69,
- 139, 24, 49, 94, 188, 136, 97, 16, 71, 181,
- 255, 28, 42, 26, 170, 184, 105, 99, 199, 142,
- 25, 20, 66, 130, 43, 101, 134, 13, 173, 44,
- 126, 224, 41, 157, 170, 72, 129, 128, 124, 59,
- 152, 225, 115, 121, 3, 161, 209, 29, 52, 118,
- 228, 192, 97, 131, 160, 13, 28, 8, 173, 173,
- 208, 183, 130, 133, 10, 131, 48, 73, 124, 156,
- 90, 145, 65, 134, 13, 26, 50, 104, 116, 51,
- 139, 2, 152, 43, 14, 222, 237, 162, 58, 113,
- 0, 10, 26, 47, 100, 208, 40, 113, 2, 6,
- 15, 30, 58, 190, 234, 72, 81, 162, 68, 179,
- 131, 60, 11, 190, 88, 209, 150, 133, 11, 21,
- 109, 77, 74, 149, 23, 110, 65, 1, 13, 61,
- 56, 108, 48, 160, 38, 22, 27, 38, 116, 168,
- 84, 169, 82, 224, 15, 160, 65, 133, 168, 38,
- 0, 113, 162, 132, 138, 98, 156, 101, 200, 104,
- 177, 83, 231, 138, 202, 59, 115, 182, 88, 190,
- 188, 184, 206, 196, 161, 85, 184, 8, 76, 193,
- 192, 134, 235, 120, 89, 171, 73, 231, 186, 123,
- 119, 53, 104, 230, 152, 33, 67, 222, 204, 153,
- 240, 232, 211, 167, 201, 192, 190, 189, 28, 245,
- 175, 214, 120, 159, 79, 63, 142, 147, 11, 84,
- 36, 52, 120, 192, 63, 143, 255, 10, 121, 240,
- 151, 138, 109, 128, 44, 96, 224, 129, 6, 98,
- 49, 0, 39, 158, 52, 8, 130, 8, 29, 116,
- 16, 32, 127, 15, 160, 194, 197, 23, 98, 184,
- 242, 74, 125, 243, 49, 81, 255, 7, 30, 122,
- 0, 232, 71, 32, 240, 204, 69, 88, 3, 143,
- 132, 80, 201, 8, 13, 161, 224, 34, 10, 197,
- 12, 199, 28, 113, 45, 200, 208, 22, 75, 38,
- 144, 176, 201, 35, 32, 48, 224, 75, 56, 226,
- 156, 66, 14, 22, 5, 100, 36, 223, 119, 22,
- 92, 32, 65, 136, 238, 148, 72, 24, 72, 144,
- 16, 115, 76, 50, 254, 144, 21, 208, 64, 4,
- 57, 83, 67, 13, 53, 98, 211, 16, 9, 58,
- 66, 84, 1, 85, 225, 140, 19, 134, 24, 232,
- 180, 81, 75, 30, 130, 61, 73, 88, 7, 35,
- 196, 200, 79, 79, 86, 222, 96, 195, 12, 48,
- 45, 199, 19, 78, 124, 62, 39, 214, 10, 12,
- 145, 208, 16, 11, 47, 192, 36, 209, 147, 117,
- 21, 16, 5, 6, 108, 68, 224, 64, 133, 186,
- 184, 73, 213, 0, 38, 168, 96, 140, 112, 44,
- 192, 0, 3, 13, 49, 25, 245, 204, 87, 210,
- 60, 3, 83, 14, 250, 216, 168, 194, 80, 91,
- 194, 36, 131, 143, 132, 85, 180, 64, 4, 7,
- 24, 176, 87, 18, 115, 216, 129, 69, 46, 163,
- 73, 74, 207, 0, 155, 110, 169, 2, 15, 52,
- 4, 107, 77, 88, 151, 213, 176, 67, 98, 53,
- 24, 148, 19, 78, 47, 180, 48, 147, 91, 248,
- 172, 96, 146, 4, 38, 210, 227, 106, 4, 28,
- 168, 166, 157, 119, 179, 212, 49, 91, 109, 183,
- 57, 169, 43, 34, 9, 176, 136, 2, 101, 39,
- 28, 19, 255, 217, 87, 89, 225, 208, 219, 9,
- 60, 25, 116, 208, 102, 156, 177, 192, 89, 169,
- 44, 228, 235, 194, 0, 85, 85, 36, 206, 5,
- 27, 100, 139, 87, 6, 173, 113, 40, 203, 44,
- 177, 77, 161, 48, 126, 84, 148, 98, 219, 129,
- 163, 140, 82, 8, 3, 33, 208, 80, 192, 2,
- 29, 8, 90, 146, 165, 246, 114, 214, 86, 10,
- 49, 48, 215, 236, 114, 156, 181, 16, 0, 1,
- 7, 104, 160, 178, 202, 7, 196, 74, 240, 118,
- 6, 199, 252, 26, 19, 226, 73, 97, 199, 41,
- 251, 81, 216, 159, 127, 60, 247, 220, 179, 206,
- 2, 162, 146, 138, 42, 97, 80, 80, 198, 121,
- 27, 202, 172, 180, 125, 177, 221, 1, 98, 30,
- 124, 84, 248, 7, 196, 18, 23, 98, 117, 60,
- 14, 52, 210, 73, 131, 144, 68, 178, 53, 215,
- 33, 12, 144, 139, 195, 167, 4, 61, 52, 145,
- 70, 163, 195, 221, 210, 73, 120, 72, 1, 71,
- 76, 142, 72, 98, 110, 83, 49, 176, 181, 36,
- 151, 128, 169, 55, 9, 47, 46, 100, 210, 73,
- 129, 142, 192, 32, 36, 13, 244, 235, 106, 41,
- 66, 14, 249, 133, 145, 107, 27, 220, 151, 3,
- 80, 3, 24, 238, 96, 227, 34, 208, 193, 37,
- 38, 108, 236, 150, 189, 50, 164, 26, 106, 170,
- 212, 144, 154, 105, 54, 219, 116, 2, 66, 2,
- 164, 249, 139, 248, 144, 230, 164, 233, 93, 173,
- 182, 72, 30, 105, 229, 188, 116, 240, 255, 193,
- 61, 249, 32, 163, 140, 52, 0, 5, 212, 251,
- 157, 206, 88, 115, 77, 160, 218, 64, 244, 1,
- 234, 33, 185, 106, 38, 24, 173, 164, 241, 134,
- 28, 236, 132, 120, 91, 181, 180, 39, 18, 2,
- 223, 185, 39, 195, 251, 239, 3, 149, 85, 208,
- 188, 210, 50, 244, 229, 67, 145, 56, 208, 170,
- 2, 165, 176, 82, 133, 235, 72, 40, 169, 71,
- 147, 212, 87, 175, 136, 8, 184, 239, 211, 238,
- 51, 189, 99, 105, 103, 239, 7, 81, 163, 211,
- 240, 95, 2, 211, 138, 88, 213, 42, 113, 40,
- 140, 81, 73, 224, 200, 3, 102, 39, 191, 111,
- 192, 233, 36, 167, 178, 212, 62, 114, 16, 131,
- 59, 229, 196, 70, 52, 97, 14, 159, 228, 181,
- 37, 82, 193, 32, 71, 38, 88, 1, 79, 118,
- 96, 131, 28, 196, 111, 34, 232, 99, 0, 25,
- 54, 178, 31, 143, 52, 112, 30, 25, 43, 201,
- 10, 132, 35, 28, 172, 24, 5, 25, 157, 170,
- 1, 78, 60, 231, 140, 180, 12, 43, 83, 42,
- 24, 11, 64, 248, 81, 0, 55, 165, 144, 96,
- 8, 108, 31, 84, 0, 113, 194, 23, 34, 160,
- 0, 149, 50, 198, 49, 104, 128, 2, 30, 220,
- 80, 7, 88, 140, 140, 149, 126, 39, 170, 97,
- 233, 131, 6, 167, 202, 193, 157, 10, 101, 130,
- 5, 32, 202, 34, 6, 208, 128, 172, 216, 80,
- 171, 91, 49, 177, 137, 242, 187, 138, 22, 107,
- 240, 27, 77, 57, 255, 6, 139, 193, 90, 198,
- 12, 98, 130, 3, 121, 45, 171, 6, 138, 153,
- 73, 91, 74, 226, 150, 50, 158, 175, 20, 7,
- 184, 206, 182, 218, 48, 1, 58, 252, 37, 11,
- 186, 128, 163, 174, 20, 80, 18, 107, 192, 96,
- 130, 84, 202, 1, 30, 129, 85, 131, 96, 33,
- 68, 89, 51, 176, 224, 102, 242, 117, 170, 98,
- 100, 234, 80, 32, 81, 30, 106, 56, 144, 151,
- 35, 201, 98, 14, 84, 248, 75, 96, 34, 249,
- 194, 4, 240, 141, 5, 50, 64, 215, 20, 143,
- 113, 63, 116, 133, 242, 32, 161, 180, 65, 78,
- 58, 67, 74, 123, 185, 101, 95, 39, 44, 13,
- 3, 48, 144, 45, 109, 21, 140, 67, 176, 241,
- 214, 183, 166, 134, 27, 73, 210, 3, 2, 36,
- 160, 76, 10, 166, 148, 21, 207, 225, 169, 55,
- 241, 154, 151, 141, 102, 68, 35, 12, 110, 46,
- 20, 170, 99, 64, 4, 238, 162, 154, 236, 60,
- 147, 109, 69, 136, 166, 194, 230, 25, 1, 2,
- 25, 168, 154, 148, 243, 69, 185, 122, 3, 66,
- 205, 229, 43, 131, 43, 64, 215, 140, 116, 194,
- 172, 231, 44, 7, 131, 1, 176, 14, 118, 84,
- 102, 128, 151, 185, 18, 158, 223, 161, 25, 20,
- 200, 67, 81, 50, 200, 6, 12, 14, 35, 144,
- 109, 40, 37, 168, 204, 245, 109, 37, 1, 8,
- 41, 1, 50, 96, 0, 3, 180, 236, 164, 45,
- 43, 41, 193, 208, 0, 51, 136, 186, 244, 165,
- 255, 48, 141, 105, 76, 193, 227, 132, 132, 89,
- 1, 42, 66, 3, 154, 78, 129, 38, 180, 46,
- 148, 35, 67, 71, 99, 233, 67, 101, 170, 52,
- 137, 74, 225, 10, 57, 219, 153, 207, 252, 99,
- 182, 46, 104, 225, 1, 123, 136, 80, 132, 0,
- 52, 161, 166, 122, 161, 104, 65, 77, 26, 81,
- 35, 58, 7, 252, 56, 138, 66, 60, 139, 218,
- 128, 10, 116, 207, 136, 225, 179, 0, 2, 24,
- 193, 215, 184, 198, 181, 145, 144, 96, 28, 168,
- 160, 80, 79, 175, 218, 138, 39, 104, 117, 171,
- 70, 136, 166, 29, 158, 118, 139, 62, 204, 146,
- 68, 37, 178, 26, 69, 6, 176, 86, 72, 76,
- 226, 176, 136, 141, 4, 216, 6, 48, 10, 3,
- 253, 33, 174, 22, 82, 92, 93, 239, 42, 211,
- 110, 237, 53, 114, 21, 120, 192, 44, 171, 102,
- 205, 68, 56, 160, 3, 221, 16, 134, 37, 50,
- 49, 2, 48, 53, 228, 180, 95, 50, 222, 39,
- 6, 96, 8, 171, 9, 194, 97, 115, 93, 69,
- 218, 156, 247, 210, 190, 20, 0, 68, 124, 24,
- 81, 53, 221, 20, 12, 72, 172, 168, 163, 167,
- 61, 201, 103, 242, 101, 204, 124, 193, 128, 33,
- 165, 227, 17, 242, 18, 33, 138, 32, 165, 98,
- 21, 172, 112, 69, 227, 160, 217, 213, 219, 134,
- 40, 179, 147, 235, 236, 60, 42, 32, 9, 76,
- 128, 9, 70, 46, 146, 32, 5, 251, 129, 144,
- 231, 88, 35, 95, 200, 221, 255, 209, 7, 32,
- 240, 13, 81, 172, 110, 21, 97, 144, 46, 117,
- 105, 17, 187, 10, 232, 54, 159, 186, 74, 0,
- 4, 236, 1, 163, 236, 117, 106, 26, 161, 210,
- 210, 150, 170, 113, 141, 15, 134, 137, 65, 99,
- 154, 135, 50, 189, 80, 14, 35, 113, 11, 118,
- 76, 154, 158, 118, 67, 18, 12, 146, 228, 131,
- 155, 85, 250, 199, 239, 162, 49, 224, 243, 146,
- 110, 27, 198, 91, 174, 130, 149, 71, 142, 191,
- 56, 88, 22, 24, 136, 222, 30, 30, 32, 152,
- 9, 79, 37, 18, 196, 200, 199, 127, 183, 167,
- 191, 253, 161, 69, 85, 94, 2, 19, 136, 59,
- 81, 56, 165, 148, 201, 1, 204, 107, 222, 116,
- 143, 208, 200, 53, 73, 78, 92, 78, 60, 68,
- 8, 44, 204, 203, 251, 245, 49, 127, 4, 49,
- 203, 141, 55, 99, 146, 211, 22, 143, 19, 32,
- 112, 241, 33, 126, 60, 155, 11, 208, 150, 86,
- 24, 184, 237, 30, 26, 192, 192, 36, 31, 130,
- 126, 248, 152, 210, 150, 160, 241, 100, 40, 19,
- 196, 143, 128, 244, 210, 248, 74, 7, 130, 4,
- 147, 73, 28, 103, 42, 195, 144, 135, 64, 95,
- 61, 120, 68, 203, 79, 186, 94, 154, 169, 20,
- 42, 55, 119, 15, 120, 3, 166, 50, 241, 180,
- 193, 137, 30, 31, 82, 157, 99, 152, 213, 17,
- 40, 208, 0, 63, 47, 0, 208, 110, 138, 161,
- 140, 147, 21, 141, 58, 213, 88, 89, 49, 64,
- 75, 78, 255, 116, 98, 141, 160, 128, 176, 33,
- 194, 33, 129, 164, 82, 120, 64, 54, 88, 23,
- 126, 102, 238, 197, 3, 57, 182, 143, 29, 254,
- 18, 79, 214, 184, 73, 48, 49, 179, 195, 208,
- 201, 32, 27, 66, 209, 73, 13, 110, 224, 2,
- 76, 35, 64, 121, 43, 76, 32, 30, 200, 108,
- 236, 64, 147, 164, 99, 10, 129, 17, 13, 200,
- 130, 39, 197, 12, 37, 0, 32, 0, 128, 9,
- 88, 160, 107, 101, 17, 216, 192, 42, 144, 65,
- 40, 219, 101, 62, 68, 49, 229, 9, 27, 193,
- 131, 11, 99, 205, 139, 145, 128, 215, 5, 217,
- 246, 12, 12, 148, 177, 3, 100, 212, 64, 7,
- 156, 154, 129, 64, 228, 229, 71, 177, 228, 0,
- 27, 48, 106, 129, 75, 138, 130, 131, 164, 152,
- 155, 1, 78, 112, 245, 126, 152, 205, 110, 94,
- 64, 128, 24, 156, 139, 201, 10, 54, 197, 174,
- 100, 196, 68, 147, 235, 122, 198, 14, 133, 55,
- 19, 75, 137, 241, 37, 200, 64, 37, 153, 12,
- 212, 80, 73, 27, 129, 2, 101, 107, 83, 195,
- 17, 81, 129, 74, 5, 139, 6, 60, 168, 35,
- 14, 249, 97, 165, 0, 63, 3, 79, 247, 214,
- 7, 190, 79, 149, 239, 23, 224, 128, 7, 4,
- 164, 139, 69, 46, 16, 43, 147, 23, 225, 2,
- 5, 208, 2, 153, 115, 213, 112, 5, 72, 41,
- 50, 157, 68, 129, 24, 113, 64, 42, 117, 105,
- 145, 44, 221, 187, 177, 90, 216, 226, 255, 150,
- 23, 8, 51, 6, 52, 96, 0, 166, 175, 149,
- 29, 163, 19, 33, 73, 183, 90, 122, 179, 167,
- 34, 199, 110, 106, 74, 56, 157, 18, 11, 22,
- 153, 33, 196, 59, 113, 152, 26, 129, 180, 81,
- 166, 146, 5, 148, 7, 156, 241, 85, 215, 57,
- 192, 80, 149, 128, 118, 55, 50, 61, 214, 3,
- 80, 1, 212, 73, 85, 199, 95, 173, 139, 93,
- 48, 225, 244, 168, 113, 82, 35, 143, 1, 177,
- 45, 134, 188, 179, 10, 85, 211, 202, 61, 15,
- 65, 14, 72, 191, 2, 36, 15, 239, 196, 2,
- 160, 128, 5, 150, 156, 210, 88, 96, 146, 149,
- 80, 222, 96, 143, 57, 168, 6, 168, 149, 213,
- 130, 122, 213, 49, 124, 102, 244, 49, 41, 10,
- 16, 176, 13, 8, 126, 240, 121, 133, 229, 35,
- 113, 133, 95, 249, 217, 242, 146, 53, 208, 84,
- 13, 82, 160, 169, 199, 56, 31, 6, 232, 210,
- 161, 228, 119, 61, 74, 82, 194, 160, 45, 48,
- 8, 5, 10, 93, 37, 129, 85, 174, 6, 248,
- 109, 19, 190, 44, 37, 236, 68, 195, 132, 251,
- 5, 232, 114, 62, 100, 216, 245, 174, 95, 102,
- 198, 130, 181, 39, 46, 207, 221, 130, 130, 220,
- 183, 87, 28, 17, 216, 64, 106, 190, 15, 126,
- 70, 194, 114, 54, 55, 67, 126, 242, 131, 77,
- 37, 129, 46, 89, 132, 69, 158, 130, 3, 59,
- 208, 27, 252, 102, 119, 205, 226, 49, 245, 50,
- 67, 250, 34, 0, 255, 34, 134, 8, 64, 194,
- 0, 5, 112, 0, 251, 167, 70, 239, 68, 31,
- 239, 225, 85, 211, 148, 93, 180, 147, 0, 34,
- 96, 2, 218, 4, 25, 66, 20, 42, 239, 146,
- 25, 6, 241, 128, 52, 17, 28, 251, 160, 119,
- 150, 130, 2, 200, 3, 36, 165, 0, 43, 2,
- 227, 123, 45, 181, 52, 221, 34, 27, 33, 120,
- 79, 116, 243, 36, 11, 16, 2, 148, 65, 3,
- 184, 132, 73, 133, 210, 130, 232, 210, 39, 228,
- 68, 28, 207, 33, 28, 157, 17, 20, 18, 128,
- 127, 119, 177, 80, 218, 209, 127, 50, 35, 79,
- 243, 148, 31, 83, 3, 88, 65, 72, 15, 67,
- 216, 27, 217, 192, 49, 29, 51, 35, 43, 240,
- 46, 207, 209, 44, 207, 81, 80, 58, 17, 127,
- 38, 225, 2, 24, 160, 1, 216, 145, 29, 14,
- 229, 121, 48, 245, 30, 9, 179, 133, 13, 243,
- 48, 101, 21, 88, 87, 131, 8, 11, 48, 2,
- 39, 208, 2, 112, 146, 57, 196, 213, 22, 51,
- 52, 28, 103, 88, 2, 109, 232, 132, 6, 85,
- 121, 38, 147, 70, 120, 177, 50, 177, 178, 29,
- 118, 136, 87, 66, 32, 81, 121, 88, 81, 117,
- 112, 49, 26, 69, 86, 7, 130, 11, 6, 210,
- 0, 37, 232, 81, 248, 64, 134, 167, 2, 129,
- 156, 33, 82, 41, 67, 137, 41, 213, 80, 239,
- 209, 129, 152, 24, 11, 52, 53, 30, 156, 88,
- 30, 102, 0, 31, 186, 56, 1, 236, 81, 82,
- 30, 190, 248, 139, 42, 181, 82, 66, 133, 133,
- 179, 232, 129, 52, 85, 83, 230, 145, 140, 202,
- 184, 140, 230, 161, 139, 195, 120, 137, 108, 19,
- 4, 0, 59, 0 };
-
-
diff --git a/main/main.c b/main/main.c
deleted file mode 100644
index 31ecf101b4..0000000000
--- a/main/main.c
+++ /dev/null
@@ -1,1218 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-/* $Id$ */
-
-
-#include <stdio.h>
-#include "php.h"
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#include "win32/signal.h"
-#include <process.h>
-#else
-#include "build-defs.h"
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-#include "zend.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "php_main.h"
-#include "fopen-wrappers.h"
-#include "ext/standard/php_standard.h"
-#include "php_variables.h"
-#ifdef PHP_WIN32
-#include <io.h>
-#include <fcntl.h>
-#include "win32/php_registry.h"
-#endif
-#include "php_syslog.h"
-
-#if PHP_SIGCHILD
-#include <sys/types.h>
-#include <sys/wait.h>
-#endif
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-
-#include "php_content_types.h"
-#include "php_ticks.h"
-
-#include "SAPI.h"
-
-#ifndef ZTS
-php_core_globals core_globals;
-#else
-PHPAPI int core_globals_id;
-#endif
-
-#define NO_GLOBAL_LOCK
-
-/* temporary workaround for thread-safety issues in Zend */
-#if defined(ZTS) && !defined(NO_GLOBAL_LOCK)
-static MUTEX_T global_lock;
-#define global_lock() tsrm_mutex_lock(global_lock)
-#define global_unlock() tsrm_mutex_unlock(global_lock);
-#define global_lock_init() global_lock = tsrm_mutex_alloc()
-#define global_lock_destroy() tsrm_mutex_free(global_lock)
-#else
-#define global_lock()
-#define global_unlock()
-#define global_lock_init()
-#define global_lock_destroy()
-#endif
-
-
-static void php_build_argv(char *s, zval *track_vars_array ELS_DC PLS_DC);
-static void php_timeout(int dummy);
-static void php_set_timeout(long seconds);
-
-void *gLock; /*mutex variable */
-
-
-/* True globals (no need for thread safety) */
-HashTable configuration_hash;
-PHPAPI char *php_ini_path = NULL;
-
-
-#define SAFE_FILENAME(f) ((f)?(f):"-")
-
-static PHP_INI_MH(OnSetPrecision)
-{
- ELS_FETCH();
-
- EG(precision) = atoi(new_value);
- return SUCCESS;
-}
-
-
-#if MEMORY_LIMIT
-static PHP_INI_MH(OnChangeMemoryLimit)
-{
- int new_limit;
-
- if (new_value) {
- new_limit = atoi(new_value);
- } else {
- new_limit = 1<<30; /* effectively, no limit */
- }
- return zend_set_memory_limit(new_limit);
-}
-#endif
-
-
-static PHP_INI_MH(OnUpdateErrorReporting)
-{
- ELS_FETCH();
-
- if (!new_value) {
- EG(error_reporting) = E_ALL & ~E_NOTICE;
- } else {
- EG(error_reporting) = atoi(new_value);
- }
- return SUCCESS;
-}
-
-
-static PHP_INI_MH(OnDisableFunctions)
-{
- char *func;
- char *new_value_dup = zend_strndup(new_value, new_value_length); /* This is an intentional leak,
- * it's not a big deal as it's process-wide
- */
-
- func = strtok(new_value_dup, ", ");
- while (func) {
- zend_disable_function(func, strlen(func));
- func = strtok(NULL, ", ");
- }
- return SUCCESS;
-}
-
-
-/* Need to convert to strings and make use of:
- * DEFAULT_SHORT_OPEN_TAG
- * PHP_SAFE_MODE
- *
- * Need to be read from the environment (?):
- * PHP_AUTO_PREPEND_FILE
- * PHP_AUTO_APPEND_FILE
- * PHP_DOCUMENT_ROOT
- * PHP_USER_DIR
- * PHP_INCLUDE_PATH
- */
-
-#ifndef SAFE_MODE_EXEC_DIR
-# define SAFE_MODE_EXEC_DIR "/"
-#endif
-
-#ifdef PHP_PROG_SENDMAIL
-# define DEFAULT_SENDMAIL_PATH PHP_PROG_SENDMAIL " -t"
-#else
-# define DEFAULT_SENDMAIL_PATH NULL
-#endif
-PHP_INI_BEGIN()
- PHP_INI_ENTRY_EX("define_syslog_variables", "0", PHP_INI_ALL, NULL, php_ini_boolean_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.bg", HL_BG_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.comment", HL_COMMENT_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.default", HL_DEFAULT_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.html", HL_HTML_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
-
- STD_PHP_INI_BOOLEAN("allow_call_time_pass_reference","1",PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, allow_call_time_pass_reference, zend_compiler_globals, compiler_globals)
- STD_PHP_INI_BOOLEAN("asp_tags", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, asp_tags, zend_compiler_globals, compiler_globals)
- STD_PHP_INI_BOOLEAN("display_errors", "1", PHP_INI_ALL, OnUpdateBool, display_errors, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateBool, enable_dl, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("error_append_string", NULL, PHP_INI_ALL, OnUpdateString, error_append_string, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("error_prepend_string", NULL, PHP_INI_ALL, OnUpdateString, error_prepend_string, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("expose_php", "1", PHP_INI_SYSTEM, OnUpdateBool, expose_php, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("ignore_user_abort", "0", PHP_INI_ALL, OnUpdateBool, ignore_user_abort, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("implicit_flush", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateBool, implicit_flush, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("log_errors", "0", PHP_INI_ALL, OnUpdateBool, log_errors, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("magic_quotes_gpc", "1", PHP_INI_ALL, OnUpdateBool, magic_quotes_gpc, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("magic_quotes_runtime", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_runtime, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("magic_quotes_sybase", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_sybase, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("output_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateBool, output_buffering, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_ALL, OnUpdateBool, register_argc_argv, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("register_globals", "1", PHP_INI_ALL, OnUpdateBool, register_globals, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("safe_mode", "0", PHP_INI_SYSTEM, OnUpdateBool, safe_mode, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("short_open_tag", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, short_tags, zend_compiler_globals, compiler_globals)
- STD_PHP_INI_BOOLEAN("sql.safe_mode", "0", PHP_INI_SYSTEM, OnUpdateBool, sql_safe_mode, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals)
-#if PHP_TRACK_VARS /* "cc -32" on IRIX 6.4 does not like (PHP_TRACK_VARS?"1":"0") - thies 991004 */
- STD_PHP_INI_BOOLEAN("track_vars", "1", PHP_INI_ALL, OnUpdateBool, track_vars, php_core_globals, core_globals)
-#else
- STD_PHP_INI_BOOLEAN("track_vars", "0", PHP_INI_ALL, OnUpdateBool, track_vars, php_core_globals, core_globals)
-#endif
- STD_PHP_INI_BOOLEAN("y2k_compliance", "0", PHP_INI_ALL, OnUpdateBool, y2k_compliance, php_core_globals, core_globals)
-
- STD_PHP_INI_ENTRY("arg_separator", "&", PHP_INI_ALL, OnUpdateStringUnempty, arg_separator, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_ALL, OnUpdateString, auto_append_file, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_ALL, OnUpdateString, auto_prepend_file, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("default_charset", SAPI_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct,sapi_globals)
- STD_PHP_INI_ENTRY("default_mimetype",SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct,sapi_globals)
- STD_PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateString, error_log, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("extension_dir", PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("gpc_order", "GPC", PHP_INI_ALL, OnUpdateStringUnempty, gpc_order, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("include_path", NULL, PHP_INI_ALL, OnUpdateStringUnempty, include_path, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("max_execution_time", "30", PHP_INI_ALL, OnUpdateInt, max_execution_time, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("open_basedir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, open_basedir, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("safe_mode_exec_dir", "1", PHP_INI_SYSTEM, OnUpdateString, safe_mode_exec_dir, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("upload_max_filesize", "2097152", PHP_INI_ALL, OnUpdateInt, upload_max_filesize, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("upload_tmp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, upload_tmp_dir, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("user_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, user_dir, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("variables_order", NULL, PHP_INI_ALL, OnUpdateStringUnempty, variables_order, php_core_globals, core_globals)
-
- PHP_INI_ENTRY("SMTP", "localhost",PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("browscap", NULL, PHP_INI_SYSTEM, NULL)
- PHP_INI_ENTRY("error_reporting", NULL, PHP_INI_ALL, OnUpdateErrorReporting)
-#if MEMORY_LIMIT
- PHP_INI_ENTRY("memory_limit", "8388608", PHP_INI_ALL, OnChangeMemoryLimit)
-#endif
- PHP_INI_ENTRY("precision", "14", PHP_INI_ALL, OnSetPrecision)
- PHP_INI_ENTRY("sendmail_from", NULL, PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("sendmail_path", DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL)
-
- PHP_INI_ENTRY("disable_functions", "", PHP_INI_SYSTEM, OnDisableFunctions)
-PHP_INI_END()
-
-
-
-/* True global (no need for thread safety */
-static int module_initialized = 0;
-
-void php_log_err(char *log_message)
-{
- FILE *log_file;
- char error_time_str[128];
- struct tm tmbuf;
- time_t error_time;
- PLS_FETCH();
-
- /* Try to use the specified logging location. */
- if (PG(error_log) != NULL) {
-#ifdef HAVE_SYSLOG_H
- if (!strcmp(PG(error_log), "syslog")) {
- php_syslog(LOG_NOTICE, log_message);
- return;
- }
-#endif
- log_file = V_FOPEN(PG(error_log), "a");
- if (log_file != NULL) {
- time(&error_time);
- strftime(error_time_str, 128, "%d-%b-%Y %H:%M:%S", php_localtime_r(&error_time, &tmbuf));
- fprintf(log_file, "[%s] ", error_time_str);
- fprintf(log_file, log_message);
- fprintf(log_file, "\n");
- fclose(log_file);
- return;
- }
- }
-
- /* Otherwise fall back to the default logging location, if we have one */
-
- if (sapi_module.log_message) {
- sapi_module.log_message(log_message);
- }
-}
-
-
-/* is 4K big enough? */
-#define PRINTF_BUFFER_SIZE 1024*4
-
-/* wrapper for modules to use PHPWRITE */
-PHPAPI int php_write(void *buf, int size)
-{
- return PHPWRITE(buf, size);
-}
-
-PHPAPI int php_printf(const char *format, ...)
-{
- va_list args;
- int ret;
- char buffer[PRINTF_BUFFER_SIZE];
- int size;
-
- va_start(args, format);
- size = vsnprintf(buffer, sizeof(buffer), format, args);
- ret = PHPWRITE(buffer, size);
- va_end(args);
-
- return ret;
-}
-
-
-/* extended error handling function */
-static void php_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list orig_args)
-{
- char buffer[1024];
- int size = 0;
- va_list args;
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
-
- if (EG(error_reporting) & type || (type & E_CORE)) {
- char *error_type_str;
-
- switch (type) {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- error_type_str = "Fatal error";
- break;
- case E_WARNING:
- case E_CORE_WARNING:
- case E_COMPILE_WARNING:
- case E_USER_WARNING:
- error_type_str = "Warning";
- break;
- case E_PARSE:
- error_type_str = "Parse error";
- break;
- case E_NOTICE:
- error_type_str = "Warning";
- break;
- case E_USER_NOTICE:
- error_type_str = "Notice";
- break;
- default:
- error_type_str = "Unknown error";
- break;
- }
-
- /* get include file name */
- if (PG(log_errors) || PG(display_errors) || (!module_initialized)) {
- args = orig_args;
- size = vsnprintf(buffer, sizeof(buffer) - 1, format, args);
- va_end(args);
- buffer[sizeof(buffer) - 1] = 0;
-
- if (PG(log_errors) || (!module_initialized)) {
- char log_buffer[1024];
-
- snprintf(log_buffer, 1024, "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno);
- php_log_err(log_buffer);
- }
- if (PG(display_errors)) {
- char *prepend_string = INI_STR("error_prepend_string");
- char *append_string = INI_STR("error_append_string");
-
-#ifdef PHP_WIN32
- if (type==E_CORE_ERROR || type==E_CORE_WARNING)
- MessageBox(NULL, buffer, error_type_str, MB_OK);
- else
-#endif
- {
- if (prepend_string) {
- PUTS(prepend_string);
- }
- php_printf("<br>\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br>\n", error_type_str, buffer, error_filename, error_lineno);
- if (append_string) {
- PUTS(append_string);
- }
- }
- }
-#if ZEND_DEBUG
- {
- zend_bool trigger_break;
-
- switch (type) {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- trigger_break=1;
- break;
- default:
- trigger_break=0;
- break;
- }
- zend_output_debug_string(trigger_break, "%s(%d) : %s - %s", error_filename, error_lineno, error_type_str, buffer);
- }
-#endif
- }
- }
-
- switch (type) {
- case E_ERROR:
- case E_CORE_ERROR:
- /*case E_PARSE: the parser would return 1 (failure), we can bail out nicely */
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- if (module_initialized) {
- zend_bailout();
- return;
- }
- break;
- }
-
- if (PG(track_errors)) {
- pval *tmp;
-
- args = orig_args;
- size = vsnprintf(buffer, sizeof(buffer) - 1, format, args);
- va_end(args);
-
- buffer[sizeof(buffer) - 1] = 0;
-
- ALLOC_ZVAL(tmp);
- INIT_PZVAL(tmp);
- tmp->value.str.val = (char *) estrndup(buffer, size);
- tmp->value.str.len = size;
- tmp->type = IS_STRING;
-
- zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(pval *), NULL);
- }
-}
-
-
-static long php_timeout_seconds;
-
-#ifdef HAVE_SETITIMER
-static void php_timeout(int dummy)
-{
- PLS_FETCH();
-
- PG(connection_status) |= PHP_CONNECTION_TIMEOUT;
- php_error(E_ERROR, "Maximum execution time of %d second%s exceeded",
- php_timeout_seconds, php_timeout_seconds == 1 ? "" : "s");
-}
-#endif
-
-/* This one doesn't exists on QNX */
-#ifndef SIGPROF
-#define SIGPROF 27
-#endif
-
-static void php_set_timeout(long seconds)
-{
-#ifdef PHP_WIN32
-#else
-# ifdef HAVE_SETITIMER
- struct itimerval t_r; /* timeout requested */
-
- t_r.it_value.tv_sec = seconds;
- t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0;
-
- php_timeout_seconds = seconds;
- setitimer(ITIMER_PROF, &t_r, NULL);
- signal(SIGPROF, php_timeout);
-# endif
-#endif
-}
-
-
-static void php_unset_timeout(void)
-{
-#ifdef PHP_WIN32
-#else
-# ifdef HAVE_SETITIMER
- struct itimerval no_timeout;
-
- no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0;
-
- setitimer(ITIMER_PROF, &no_timeout, NULL);
-# endif
-#endif
-}
-
-/* {{{ proto void set_time_limit(int seconds)
- Sets the maximum time a script can run */
-PHP_FUNCTION(set_time_limit)
-{
- pval *new_timeout;
- PLS_FETCH();
-
- if (PG(safe_mode)) {
- php_error(E_WARNING, "Cannot set time limit in safe mode");
- RETURN_FALSE;
- }
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &new_timeout) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(new_timeout);
- /* FIXME ** This is BAD...in a threaded situation, any user
- can set the timeout for php on a server wide basis.
- INI variables should not be reset via a user script
-
- Fix what? At least on Unix, timers like these are
- per-thread timers. Well, with a little work they will
- be. If we use a bound thread and proper masking it
- should work fine. Is this FIXME a WIN32 problem? Is
- there no way to do per-thread timers on WIN32?
- */
- php_unset_timeout();
- php_set_timeout(new_timeout->value.lval);
-}
-/* }}} */
-
-static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path)
-{
- int issock=0, socketd=0;
- int old_chunk_size;
- FILE *retval;
-
- old_chunk_size = php_sock_set_def_chunk_size(1);
- retval=php_fopen_wrapper((char *) filename, "r", USE_PATH|IGNORE_URL_WIN, &issock, &socketd, opened_path);
- php_sock_set_def_chunk_size(old_chunk_size);
-
- if (issock) {
- retval = fdopen(socketd, "r");
- }
- return retval;
-}
-
-
-static int php_get_ini_entry_for_zend(char *name, uint name_length, zval *contents)
-{
- zval *retval = cfg_get_entry(name, name_length);
-
- if (retval) {
- *contents = *retval;
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-
-static void php_message_handler_for_zend(long message, void *data)
-{
- switch (message) {
- case ZMSG_ENABLE_TRACK_VARS: {
- PLS_FETCH();
-
- PG(track_vars) = 1;
- }
- break;
- case ZMSG_FAILED_INCLUDE_FOPEN: {
- PLS_FETCH();
-
- php_error(E_WARNING, "Failed opening '%s' for inclusion (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path)));
- }
- break;
- case ZMSG_FAILED_REQUIRE_FOPEN: {
- PLS_FETCH();
-
- php_error(E_COMPILE_ERROR, "Failed opening required '%s' (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path)));
- }
- break;
- case ZMSG_FAILED_HIGHLIGHT_FOPEN:
- php_error(E_WARNING, "Failed opening '%s' for highlighting", php_strip_url_passwd((char *) data));
- break;
- case ZMSG_MEMORY_LEAK_DETECTED:
- case ZMSG_MEMORY_LEAK_REPEATED: {
- ELS_FETCH();
-
- if (EG(error_reporting)&E_WARNING) {
-#if ZEND_DEBUG
- char memory_leak_buf[512];
- SLS_FETCH();
-
- if (message==ZMSG_MEMORY_LEAK_DETECTED) {
- zend_mem_header *t = (zend_mem_header *) data;
- void *ptr = (void *)((char *)t+sizeof(zend_mem_header)+PLATFORM_PADDING);
-
- snprintf(memory_leak_buf, 512, "%s(%d) : Freeing 0x%.8lX (%d bytes), script=%s\n", t->filename, t->lineno, (unsigned long)ptr, t->size, SAFE_FILENAME(SG(request_info).path_translated));
- if (t->orig_filename) {
- char relay_buf[512];
-
- snprintf(relay_buf, 512, "%s(%d) : Actual location (location was relayed)\n", t->orig_filename, t->orig_lineno);
- strcat(memory_leak_buf, relay_buf);
- }
- } else {
- unsigned long leak_count = (unsigned long) data;
-
- snprintf(memory_leak_buf, 512, "Last leak repeated %ld time%s\n", leak_count, (leak_count>1?"s":""));
- }
-# if defined(PHP_WIN32)
- OutputDebugString(memory_leak_buf);
-# else
- fprintf(stderr, memory_leak_buf);
-# endif
-#endif
- }
- }
- break;
- case ZMSG_LOG_SCRIPT_NAME: {
- struct tm *ta, tmbuf;
- time_t curtime;
- char *datetime_str, asctimebuf[52];
- SLS_FETCH();
-
- time(&curtime);
- ta = php_localtime_r(&curtime, &tmbuf);
- datetime_str = php_asctime_r(ta, asctimebuf);
- datetime_str[strlen(datetime_str)-1]=0; /* get rid of the trailing newline */
- fprintf(stderr, "[%s] Script: '%s'\n", datetime_str, SAFE_FILENAME(SG(request_info).path_translated));
- }
- break;
- }
-}
-
-
-#if PHP_SIGCHILD
-static void sigchld_handler(int apar)
-{
- while (waitpid(-1, NULL, WNOHANG) > 0)
- ;
- signal(SIGCHLD,sigchld_handler);
-}
-#endif
-
-
-int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC)
-{
-#if PHP_SIGCHILD
- signal(SIGCHLD,sigchld_handler);
-#endif
-
- global_lock();
-
- php_output_startup();
-
- /* initialize global variables */
- PG(modules_activated) = 0;
- PG(header_is_being_sent) = 0;
- PG(connection_status) = PHP_CONNECTION_NORMAL;
-
- zend_activate(CLS_C ELS_CC);
- sapi_activate(SLS_C);
-
-#ifdef VIRTUAL_DIR
- virtual_cwd_activate(SG(request_info).path_translated);
-#endif
-
- php_set_timeout(PG(max_execution_time));
-
- if (PG(expose_php)) {
- sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1);
- }
-
- if (PG(output_buffering)) {
- php_start_ob_buffering();
- } else if (PG(implicit_flush)) {
- php_start_implicit_flush();
- }
-
- return SUCCESS;
-}
-
-
-void php_request_shutdown_for_exec(void *dummy)
-{
- /* used to close fd's in the 3..255 range here, but it's problematic
- */
- shutdown_memory_manager(1, 1);
-}
-
-
-void php_request_shutdown(void *dummy)
-{
- CLS_FETCH();
- ELS_FETCH();
- SLS_FETCH();
- PLS_FETCH();
-
- if (setjmp(EG(bailout))!=0) {
- return;
- }
-
- sapi_send_headers();
- php_end_ob_buffering(SG(request_info).headers_only?0:1);
-
- php_call_shutdown_functions();
-
- php_ini_rshutdown();
-
- if (PG(modules_activated)) {
- zend_deactivate_modules();
- }
- zend_deactivate(CLS_C ELS_CC);
- sapi_deactivate(SLS_C);
-
- shutdown_memory_manager(CG(unclean_shutdown), 0);
- php_unset_timeout();
-
- global_unlock();
-}
-
-
-static int php_config_ini_startup(void)
-{
- if (php_init_config() == FAILURE) {
- php_printf("PHP: Unable to parse configuration file.\n");
- return FAILURE;
- }
- return SUCCESS;
-}
-
-static void php_config_ini_shutdown(void)
-{
- php_shutdown_config();
-}
-
-
-static int php_body_write_wrapper(const char *str, uint str_length)
-{
- return php_body_write(str, str_length);
-}
-
-#ifdef ZTS
-static void php_new_thread_end_handler(THREAD_T thread_id)
-{
- php_ini_refresh_caches(PHP_INI_STAGE_STARTUP);
-}
-#endif
-
-
-#ifdef ZTS
-static void core_globals_ctor(php_core_globals *core_globals)
-{
- memset(core_globals,0,sizeof(*core_globals));
-}
-
-#endif
-
-
-int php_startup_extensions(zend_module_entry **ptr, int count)
-{
- zend_module_entry **end = ptr+count;
-
- while (ptr < end) {
- if (*ptr) {
- if (zend_startup_module(*ptr)==FAILURE) {
- return FAILURE;
- }
- }
- ptr++;
- }
- return SUCCESS;
-}
-
-int php_global_startup_extensions(zend_module_entry **ptr, int count)
-{
- zend_module_entry **end = ptr+count;
-
- while (ptr < end) {
- if (*ptr) {
- if ((*ptr)->global_startup_func &&
- (*ptr)->global_startup_func()==FAILURE) {
- return FAILURE;
- }
- }
- ptr++;
- }
- return SUCCESS;
-}
-
-int php_global_shutdown_extensions(zend_module_entry **ptr, int count)
-{
- zend_module_entry **end = ptr+count;
-
- while (ptr < end) {
- if (*ptr) {
- if ((*ptr)->global_shutdown_func &&
- (*ptr)->global_shutdown_func()==FAILURE) {
- return FAILURE;
- }
- }
- ptr++;
- }
- return SUCCESS;
-}
-
-
-int php_module_startup(sapi_module_struct *sf)
-{
- zend_utility_functions zuf;
- zend_utility_values zuv;
- int module_number=0; /* for REGISTER_INI_ENTRIES() */
- char *php_os;
-#ifdef ZTS
- zend_executor_globals *executor_globals;
- php_core_globals *core_globals;
- sapi_globals_struct *sapi_globals = ts_resource(sapi_globals_id);
-#endif
-#ifdef PHP_WIN32
- WORD wVersionRequested = MAKEWORD(2, 0);
- WSADATA wsaData;
-#endif
-#ifdef PHP_WIN32
- {
- DWORD dwVersion = GetVersion();
-
- /* Get build numbers for Windows NT or Win95 */
- if (dwVersion < 0x80000000){
- php_os="WINNT";
- } else {
- php_os="WIN32";
- }
- }
-#else
- php_os=PHP_OS;
-#endif
-
- global_lock_init();
- sapi_initialize_empty_request(SLS_C);
- sapi_activate(SLS_C);
-
- if (module_initialized) {
- return SUCCESS;
- }
-
- sapi_module = *sf;
-
- php_output_startup();
-
- zuf.error_function = php_error_cb;
- zuf.printf_function = php_printf;
- zuf.write_function = php_body_write_wrapper;
- zuf.fopen_function = php_fopen_wrapper_for_zend;
- zuf.message_handler = php_message_handler_for_zend;
- zuf.block_interruptions = sapi_module.block_interruptions;
- zuf.unblock_interruptions = sapi_module.unblock_interruptions;
- zuf.get_ini_entry = php_get_ini_entry_for_zend;
- zuf.ticks_function = php_run_ticks;
- zend_startup(&zuf, NULL, 1);
-
-#ifdef ZTS
- tsrm_set_new_thread_end_handler(php_new_thread_end_handler);
- executor_globals = ts_resource(executor_globals_id);
- core_globals_id = ts_allocate_id(sizeof(php_core_globals), (ts_allocate_ctor) core_globals_ctor, NULL);
- core_globals = ts_resource(core_globals_id);
-#endif
- EG(error_reporting) = E_ALL & ~E_NOTICE;
-
- PG(header_is_being_sent) = 0;
- SG(request_info).headers_only = 0;
- SG(request_info).argv0 = NULL;
- PG(connection_status) = PHP_CONNECTION_NORMAL;
-
-#if HAVE_SETLOCALE
- setlocale(LC_CTYPE, "");
-#endif
-
-#ifdef PHP_WIN32
- /* start up winsock services */
- if (WSAStartup(wVersionRequested, &wsaData) != 0) {
- php_printf("\nwinsock.dll unusable. %d\n", WSAGetLastError());
- return FAILURE;
- }
-#endif
-
- SET_MUTEX(gLock);
- le_index_ptr = zend_register_list_destructors(NULL, NULL, 0);
- FREE_MUTEX(gLock);
-
- php_ini_mstartup();
-
- if (php_init_fopen_wrappers() == FAILURE) {
- php_printf("PHP: Unable to initialize fopen url wrappers.\n");
- return FAILURE;
- }
-
- if (php_config_ini_startup() == FAILURE) {
- return FAILURE;
- }
-
- REGISTER_INI_ENTRIES();
-
- zuv.import_use_extension = ".php";
- zend_set_utility_values(&zuv);
- php_startup_sapi_content_types();
-
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_VERSION", PHP_VERSION, sizeof(PHP_VERSION)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS", php_os, strlen(php_os), CONST_PERSISTENT | CONST_CS);
-
- if (php_startup_ticks(PLS_C) == FAILURE) {
- php_printf("Unable to start PHP ticks\n");
- return FAILURE;
- }
-
- if (php_startup_internal_extensions() == FAILURE) {
- php_printf("Unable to start builtin modules\n");
- return FAILURE;
- }
- module_initialized = 1;
- sapi_deactivate(SLS_C);
- return SUCCESS;
-}
-
-
-
-void php_module_shutdown_for_exec()
-{
- /* used to close fd's in the range 3.255 here, but it's problematic */
-}
-
-
-int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals)
-{
- php_module_shutdown();
- return SUCCESS;
-}
-
-
-void php_module_shutdown()
-{
- int module_number=0; /* for UNREGISTER_INI_ENTRIES() */
- PLS_FETCH();
-
- if (!module_initialized) {
- return;
- }
-
- php_shutdown_fopen_wrappers();
-
- /* close down the ini config */
- php_config_ini_shutdown();
-
-#ifdef PHP_WIN32
- /*close winsock */
- WSACleanup();
-#endif
-
- php_shutdown_ticks(PLS_C);
- sapi_flush();
-
- global_lock_destroy();
- zend_shutdown();
- UNREGISTER_INI_ENTRIES();
- php_ini_mshutdown();
- shutdown_memory_manager(0, 1);
- module_initialized = 0;
-}
-
-
-static inline void php_register_server_variables(ELS_D SLS_DC PLS_DC)
-{
- zval *array_ptr=NULL;
-
- if (PG(track_vars)) {
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- PG(http_globals).server = array_ptr;
- }
-
- /* Server variables */
- if (sapi_module.register_server_variables) {
- sapi_module.register_server_variables(array_ptr ELS_CC SLS_CC PLS_CC);
- }
-
- /* argv/argc support */
- if (PG(register_argc_argv)) {
- php_build_argv(SG(request_info).query_string, array_ptr ELS_CC PLS_CC);
- }
-
- /* PHP Authentication support */
- if (SG(request_info).auth_user) {
- php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, array_ptr ELS_CC PLS_CC);
- }
- if (SG(request_info).auth_password) {
- php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, array_ptr ELS_CC PLS_CC);
- }
-}
-
-
-static int php_hash_environment(ELS_D SLS_DC PLS_DC)
-{
- char *p;
- unsigned char _gpc_flags[3] = {0,0,0};
- zend_bool have_variables_order;
-
- PG(http_globals).post = PG(http_globals).get = PG(http_globals).cookie = PG(http_globals).server = PG(http_globals).environment = PG(http_globals).post_files = NULL;
-
- if (PG(variables_order)) {
- p = PG(variables_order);
- have_variables_order=1;
- } else {
- p = PG(gpc_order);
- have_variables_order=0;
- php_import_environment_variables(ELS_C PLS_CC);
- }
-
- while(p && *p) {
- switch(*p++) {
- case 'p':
- case 'P':
- if (!_gpc_flags[0] && !SG(headers_sent) && SG(request_info).request_method && !strcasecmp(SG(request_info).request_method, "POST")) {
- php_treat_data(PARSE_POST, NULL ELS_CC PLS_CC SLS_CC); /* POST Data */
- _gpc_flags[0]=1;
- }
- break;
- case 'c':
- case 'C':
- if (!_gpc_flags[1]) {
- php_treat_data(PARSE_COOKIE, NULL ELS_CC PLS_CC SLS_CC); /* Cookie Data */
- _gpc_flags[1]=1;
- }
- break;
- case 'g':
- case 'G':
- if (!_gpc_flags[2]) {
- php_treat_data(PARSE_GET, NULL ELS_CC PLS_CC SLS_CC); /* GET Data */
- _gpc_flags[2]=1;
- }
- break;
- case 'e':
- case 'E':
- if (have_variables_order) {
- php_import_environment_variables(ELS_C PLS_CC);
- } else {
- php_error(E_CORE_WARNING, "Unsupported 'e' element (environment) used in gpc_order - use variables_order instead");
- }
- break;
- case 's':
- case 'S':
- php_register_server_variables(ELS_C SLS_CC PLS_CC);
- break;
- }
- }
-
- if (!have_variables_order) {
- php_register_server_variables(ELS_C SLS_CC PLS_CC);
- }
-
- if (PG(http_globals).post) {
- zend_hash_update(&EG(symbol_table), "HTTP_POST_VARS", sizeof("HTTP_POST_VARS"), &PG(http_globals).post, sizeof(zval *), NULL);
- }
- if (PG(http_globals).get) {
- zend_hash_update(&EG(symbol_table), "HTTP_GET_VARS", sizeof("HTTP_GET_VARS"), &PG(http_globals).get, sizeof(zval *), NULL);
- }
- if (PG(http_globals).cookie) {
- zend_hash_update(&EG(symbol_table), "HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS"), &PG(http_globals).cookie, sizeof(zval *), NULL);
- }
- if (PG(http_globals).server) {
- zend_hash_update(&EG(symbol_table), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), &PG(http_globals).server, sizeof(zval *), NULL);
- }
- if (PG(http_globals).environment) {
- zend_hash_update(&EG(symbol_table), "HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS"), &PG(http_globals).environment, sizeof(zval *), NULL);
- }
- if (PG(http_globals).post_files) {
- zend_hash_update(&EG(symbol_table), "HTTP_POST_FILES", sizeof("HTTP_POST_FILES"), &PG(http_globals).post_files, sizeof(zval *),NULL);
- }
-
- return SUCCESS;
-}
-
-
-static void php_build_argv(char *s, zval *track_vars_array ELS_DC PLS_DC)
-{
- pval *arr, *argc, *tmp;
- int count = 0;
- char *ss, *space;
-
- ALLOC_ZVAL(arr);
- array_init(arr);
- INIT_PZVAL(arr);
-
- /* Prepare argv */
- if (s && *s) {
- ss = s;
- while (ss) {
- space = strchr(ss, '+');
- if (space) {
- *space = '\0';
- }
- /* auto-type */
- ALLOC_ZVAL(tmp);
- tmp->type = IS_STRING;
- tmp->value.str.len = strlen(ss);
- tmp->value.str.val = estrndup(ss, tmp->value.str.len);
- INIT_PZVAL(tmp);
- count++;
- if (zend_hash_next_index_insert(arr->value.ht, &tmp, sizeof(pval *), NULL)==FAILURE) {
- if (tmp->type == IS_STRING) {
- efree(tmp->value.str.val);
- }
- }
- if (space) {
- *space = '+';
- ss = space + 1;
- } else {
- ss = space;
- }
- }
- }
-
- /* prepare argc */
- ALLOC_ZVAL(argc);
- argc->value.lval = count;
- argc->type = IS_LONG;
- INIT_PZVAL(argc);
-
- if (PG(register_globals)) {
- zend_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, sizeof(zval *), NULL);
- zend_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &argc, sizeof(zval *), NULL);
- }
-
- if (PG(track_vars)) {
- if (PG(register_globals)) {
- arr->refcount++;
- argc->refcount++;
- }
- zend_hash_update(track_vars_array->value.ht, "argv", sizeof("argv"), &arr, sizeof(pval *), NULL);
- zend_hash_update(track_vars_array->value.ht, "argc", sizeof("argc"), &argc, sizeof(pval *), NULL);
- }
-
-}
-
-
-#include "logos.h"
-
-PHPAPI void php_execute_script(zend_file_handle *primary_file CLS_DC ELS_DC PLS_DC)
-{
- zend_file_handle *prepend_file_p, *append_file_p;
- zend_file_handle prepend_file, append_file;
- SLS_FETCH();
-
- php_hash_environment(ELS_C SLS_CC PLS_CC);
-
- zend_activate_modules();
- PG(modules_activated)=1;
-
- if (SG(request_info).query_string && SG(request_info).query_string[0]=='='
- && PG(expose_php)) {
- if (!strcmp(SG(request_info).query_string+1, PHP_LOGO_GUID)) {
- sapi_add_header(CONTEXT_TYPE_IMAGE_GIF, sizeof(CONTEXT_TYPE_IMAGE_GIF)-1, 1);
- PHPWRITE(php_logo, sizeof(php_logo));
- return;
- } else if (!strcmp(SG(request_info).query_string+1, PHP_EGG_LOGO_GUID)) {
- sapi_add_header(CONTEXT_TYPE_IMAGE_GIF, sizeof(CONTEXT_TYPE_IMAGE_GIF)-1, 1);
- PHPWRITE(php_egg_logo, sizeof(php_egg_logo));
- return;
- } else if (!strcmp(SG(request_info).query_string+1, ZEND_LOGO_GUID)) {
- sapi_add_header(CONTEXT_TYPE_IMAGE_GIF, sizeof(CONTEXT_TYPE_IMAGE_GIF)-1, 1);
- PHPWRITE(zend_logo, sizeof(zend_logo));
- return;
- } else if (!strcmp(SG(request_info).query_string+1, "PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000")) {
- php_print_credits(PHP_CREDITS_ALL);
- return;
- }
- }
-
-
- if (setjmp(EG(bailout))!=0) {
- return;
- }
-
-#ifdef PHP_WIN32
- UpdateIniFromRegistry(primary_file->filename);
-#endif
-
- if (PG(auto_prepend_file) && PG(auto_prepend_file)[0]) {
- prepend_file.filename = PG(auto_prepend_file);
- prepend_file.free_filename = 0;
- prepend_file.type = ZEND_HANDLE_FILENAME;
- prepend_file_p = &prepend_file;
- } else {
- prepend_file_p = NULL;
- }
- if (PG(auto_append_file) && PG(auto_append_file)[0]) {
- append_file.filename = PG(auto_append_file);
- append_file.free_filename = 0;
- append_file.type = ZEND_HANDLE_FILENAME;
- append_file_p = &append_file;
- } else {
- append_file_p = NULL;
- }
- EG(main_op_array) = zend_compile_files(ZEND_REQUIRE CLS_CC, 3, prepend_file_p, primary_file, append_file_p);
- if (EG(main_op_array)) {
- EG(active_op_array) = EG(main_op_array);
- zend_execute(EG(main_op_array) ELS_CC);
- }
-}
-
-#ifdef PHP_WIN32
-/* just so that this symbol gets exported... */
-PHPAPI void dummy_indent()
-{
- zend_indent();
-}
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/mergesort.c b/main/mergesort.c
deleted file mode 100644
index b173bc1269..0000000000
--- a/main/mergesort.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Peter McIlroy.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94";
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * Hybrid exponential search/linear search merge sort with hybrid
- * natural/pairwise first pass. Requires about .3% more comparisons
- * for random data than LSMS with pairwise first pass alone.
- * It works for objects as small as two bytes.
- */
-
-#define NATURAL
-#define THRESHOLD 16 /* Best choice for natural merge cut-off. */
-
-/* #define NATURAL to get hybrid natural merge.
- * (The default is pairwise merging.)
- */
-
-#include <sys/types.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "php.h"
-
-#ifdef PHP_WIN32
-#include <winsock.h> /* Includes definition for u_char */
-#endif
-
-static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp)(const void *, const void *));
-static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const void *, const void *));
-
-#define ISIZE sizeof(int)
-#define PSIZE sizeof(u_char *)
-#define ICOPY_LIST(src, dst, last) \
- do \
- *(int*)dst = *(int*)src, src += ISIZE, dst += ISIZE; \
- while(src < last)
-#define ICOPY_ELT(src, dst, i) \
- do \
- *(int*) dst = *(int*) src, src += ISIZE, dst += ISIZE; \
- while (i -= ISIZE)
-
-#define CCOPY_LIST(src, dst, last) \
- do \
- *dst++ = *src++; \
- while (src < last)
-#define CCOPY_ELT(src, dst, i) \
- do \
- *dst++ = *src++; \
- while (i -= 1)
-
-/*
- * Find the next possible pointer head. (Trickery for forcing an array
- * to do double duty as a linked list when objects do not align with word
- * boundaries.
- */
-/* Assumption: PSIZE is a power of 2. */
-#define EVAL(p) (u_char **) \
- ((u_char *)0 + \
- (((u_char *)p + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1)))
-
-/*
- * Arguments are as for qsort.
- */
-int mergesort(void *base, size_t nmemb, size_t size, int (*cmp)(const void *, const void *))
-{
- register unsigned int i;
- register int sense;
- int big, iflag;
- register u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2;
- u_char *list2, *list1, *p2, *p, *last, **p1;
-
- if (size < PSIZE / 2) { /* Pointers must fit into 2 * size. */
- errno = EINVAL;
- return (-1);
- }
-
- if (nmemb == 0)
- return (0);
-
- /*
- * XXX
- * Stupid subtraction for the Cray.
- */
- iflag = 0;
- if (!(size % ISIZE) && !(((char *)base - (char *)0) % ISIZE))
- iflag = 1;
-
- if ((list2 = malloc(nmemb * size + PSIZE)) == NULL)
- return (-1);
-
- list1 = base;
- setup(list1, list2, nmemb, size, cmp);
- last = list2 + nmemb * size;
- i = big = 0;
- while (*EVAL(list2) != last) {
- l2 = list1;
- p1 = EVAL(list1);
- for (tp2 = p2 = list2; p2 != last; p1 = EVAL(l2)) {
- p2 = *EVAL(p2);
- f1 = l2;
- f2 = l1 = list1 + (p2 - list2);
- if (p2 != last)
- p2 = *EVAL(p2);
- l2 = list1 + (p2 - list2);
- while (f1 < l1 && f2 < l2) {
- if ((*cmp)(f1, f2) <= 0) {
- q = f2;
- b = f1, t = l1;
- sense = -1;
- } else {
- q = f1;
- b = f2, t = l2;
- sense = 0;
- }
- if (!big) { /* here i = 0 */
- while ((b += size) < t && cmp(q, b) >sense)
- if (++i == 6) {
- big = 1;
- goto EXPONENTIAL;
- }
- } else {
-EXPONENTIAL: for (i = size; ; i <<= 1)
- if ((p = (b + i)) >= t) {
- if ((p = t - size) > b &&
- (*cmp)(q, p) <= sense)
- t = p;
- else
- b = p;
- break;
- } else if ((*cmp)(q, p) <= sense) {
- t = p;
- if (i == size)
- big = 0;
- goto FASTCASE;
- } else
- b = p;
- while (t > b+size) {
- i = (((t - b) / size) >> 1) * size;
- if ((*cmp)(q, p = b + i) <= sense)
- t = p;
- else
- b = p;
- }
- goto COPY;
-FASTCASE: while (i > size)
- if ((*cmp)(q,
- p = b + (i >>= 1)) <= sense)
- t = p;
- else
- b = p;
-COPY: b = t;
- }
- i = size;
- if (q == f1) {
- if (iflag) {
- ICOPY_LIST(f2, tp2, b);
- ICOPY_ELT(f1, tp2, i);
- } else {
- CCOPY_LIST(f2, tp2, b);
- CCOPY_ELT(f1, tp2, i);
- }
- } else {
- if (iflag) {
- ICOPY_LIST(f1, tp2, b);
- ICOPY_ELT(f2, tp2, i);
- } else {
- CCOPY_LIST(f1, tp2, b);
- CCOPY_ELT(f2, tp2, i);
- }
- }
- }
- if (f2 < l2) {
- if (iflag)
- ICOPY_LIST(f2, tp2, l2);
- else
- CCOPY_LIST(f2, tp2, l2);
- } else if (f1 < l1) {
- if (iflag)
- ICOPY_LIST(f1, tp2, l1);
- else
- CCOPY_LIST(f1, tp2, l1);
- }
- *p1 = l2;
- }
- tp2 = list1; /* swap list1, list2 */
- list1 = list2;
- list2 = tp2;
- last = list2 + nmemb*size;
- }
- if (base == list2) {
- memmove(list2, list1, nmemb*size);
- list2 = list1;
- }
- free(list2);
- return (0);
-}
-
-#define swap(a, b) { \
- s = b; \
- i = size; \
- do { \
- tmp = *a; *a++ = *s; *s++ = tmp; \
- } while (--i); \
- a -= size; \
- }
-#define reverse(bot, top) { \
- s = top; \
- do { \
- i = size; \
- do { \
- tmp = *bot; *bot++ = *s; *s++ = tmp; \
- } while (--i); \
- s -= size2; \
- } while(bot < s); \
-}
-
-/*
- * Optional hybrid natural/pairwise first pass. Eats up list1 in runs of
- * increasing order, list2 in a corresponding linked list. Checks for runs
- * when THRESHOLD/2 pairs compare with same sense. (Only used when NATURAL
- * is defined. Otherwise simple pairwise merging is used.)
- */
-static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp)(const void *, const void *))
-{
- int i, length, size2, tmp, sense;
- u_char *f1, *f2, *s, *l2, *last, *p2;
-
- size2 = size*2;
- if (n <= 5) {
- insertionsort(list1, n, size, cmp);
- *EVAL(list2) = (u_char*) list2 + n*size;
- return;
- }
- /*
- * Avoid running pointers out of bounds; limit n to evens
- * for simplicity.
- */
- i = 4 + (n & 1);
- insertionsort(list1 + (n - i) * size, i, size, cmp);
- last = list1 + size * (n - i);
- *EVAL(list2 + (last - list1)) = list2 + n * size;
-
-#ifdef NATURAL
- p2 = list2;
- f1 = list1;
- sense = (cmp(f1, f1 + size) > 0);
- for (; f1 < last; sense = !sense) {
- length = 2;
- /* Find pairs with same sense. */
- for (f2 = f1 + size2; f2 < last; f2 += size2) {
- if ((cmp(f2, f2+ size) > 0) != sense)
- break;
- length += 2;
- }
- if (length < THRESHOLD) { /* Pairwise merge */
- do {
- p2 = *EVAL(p2) = f1 + size2 - list1 + list2;
- if (sense > 0)
- swap (f1, f1 + size);
- } while ((f1 += size2) < f2);
- } else { /* Natural merge */
- l2 = f2;
- for (f2 = f1 + size2; f2 < l2; f2 += size2) {
- if ((cmp(f2-size, f2) > 0) != sense) {
- p2 = *EVAL(p2) = f2 - list1 + list2;
- if (sense > 0)
- reverse(f1, f2-size);
- f1 = f2;
- }
- }
- if (sense > 0)
- reverse (f1, f2-size);
- f1 = f2;
- if (f2 < last || cmp(f2 - size, f2) > 0)
- p2 = *EVAL(p2) = f2 - list1 + list2;
- else
- p2 = *EVAL(p2) = list2 + n*size;
- }
- }
-#else /* pairwise merge only. */
- for (f1 = list1, p2 = list2; f1 < last; f1 += size2) {
- p2 = *EVAL(p2) = p2 + size2;
- if (cmp (f1, f1 + size) > 0)
- swap(f1, f1 + size);
- }
-#endif /* NATURAL */
-}
-
-/*
- * This is to avoid out-of-bounds addresses in sorting the
- * last 4 elements.
- */
-static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const void *, const void *))
-{
- u_char *ai, *s, *t, *u, tmp;
- int i;
-
- for (ai = a+size; --n >= 1; ai += size)
- for (t = ai; t > a; t -= size) {
- u = t - size;
- if (cmp(u, t) <= 0)
- break;
- swap(u, t);
- }
-}
diff --git a/main/output.c b/main/output.c
deleted file mode 100644
index 03d81165ff..0000000000
--- a/main/output.c
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Thies C. Arntzen <thies@digicol.de> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "php.h"
-#include "ext/standard/head.h"
-#include "ext/session/php_session.h"
-#include "SAPI.h"
-
-/* output functions */
-static int php_ub_body_write(const char *str, uint str_length);
-static int php_ub_body_write_no_header(const char *str, uint str_length);
-static int php_b_body_write(const char *str, uint str_length);
-
-static void php_ob_init(uint initial_size, uint block_size);
-static void php_ob_destroy(void);
-static void php_ob_append(const char *text, uint text_length);
-#if 0
-static void php_ob_prepend(const char *text, uint text_length);
-#endif
-static inline void php_ob_send(void);
-
-
-typedef struct {
- int (*php_body_write)(const char *str, uint str_length); /* string output */
- int (*php_header_write)(const char *str, uint str_length); /* unbuffer string output */
- char *ob_buffer;
- uint ob_size;
- uint ob_block_size;
- uint ob_text_length;
- unsigned char implicit_flush;
- char *output_start_filename;
- int output_start_lineno;
-} php_output_globals;
-
-#ifdef ZTS
-#define OLS_D php_output_globals *output_globals
-#define OLS_C output_globals
-#define OG(v) (output_globals->v)
-#define OLS_FETCH() php_output_globals *output_globals = ts_resource(output_globals_id)
-int output_globals_id;
-#else
-#define OLS_D void
-#define OLS_C
-#define OG(v) (output_globals.v)
-#define OLS_FETCH()
-php_output_globals output_globals;
-#endif
-
-static void php_output_init_globals(OLS_D)
-{
- OG(php_body_write) = NULL;
- OG(php_header_write) = NULL;
- OG(ob_buffer) = NULL;
- OG(ob_size) = 0;
- OG(ob_block_size) = 0;
- OG(ob_text_length) = 0;
- OG(implicit_flush) = 0;
- OG(output_start_filename) = NULL;
- OG(output_start_lineno) = 0;
-}
-
-
-PHP_GINIT_FUNCTION(output)
-{
-#ifdef ZTS
- output_globals_id = ts_allocate_id(sizeof(php_output_globals), (ts_allocate_ctor) php_output_init_globals, NULL);
-#else
- php_output_init_globals(OLS_C);
-#endif
-
- return SUCCESS;
-}
-
-/* Start output layer */
-PHPAPI void php_output_startup()
-{
- OLS_FETCH();
-
- OG(ob_buffer) = NULL;
- OG(php_body_write) = php_ub_body_write;
- OG(php_header_write) = sapi_module.ub_write;
-}
-
-PHPAPI int php_body_write(const char *str, uint str_length)
-{
- OLS_FETCH();
- return OG(php_body_write)(str, str_length);
-}
-
-PHPAPI int php_header_write(const char *str, uint str_length)
-{
- OLS_FETCH();
- return OG(php_header_write)(str, str_length);
-}
-
-/* Start output buffering */
-PHPAPI void php_start_ob_buffering()
-{
- OLS_FETCH();
-
- php_ob_init(4096, 1024);
- OG(php_body_write) = php_b_body_write;
-}
-
-
-/* End output buffering */
-PHPAPI void php_end_ob_buffering(int send_buffer)
-{
- SLS_FETCH();
- OLS_FETCH();
-
- if (!OG(ob_buffer)) {
- return;
- }
- if (SG(headers_sent) && !SG(request_info).headers_only) {
- OG(php_body_write) = php_ub_body_write_no_header;
- } else {
- OG(php_body_write) = php_ub_body_write;
- }
- if (send_buffer) {
- php_ob_send();
- }
- php_ob_destroy();
-}
-
-
-PHPAPI void php_start_implicit_flush()
-{
- OLS_FETCH();
-
- php_end_ob_buffering(1); /* Switch out of output buffering if we're in it */
- OG(implicit_flush)=1;
-}
-
-
-PHPAPI void php_end_implicit_flush()
-{
- OLS_FETCH();
-
- OG(implicit_flush)=0;
-}
-
-
-/*
- * Output buffering - implementation
- */
-
-static inline void php_ob_allocate(void)
-{
- OLS_FETCH();
-
- if (OG(ob_size)<OG(ob_text_length)) {
- while (OG(ob_size) <= OG(ob_text_length))
- OG(ob_size)+=OG(ob_block_size);
-
- OG(ob_buffer) = (char *) erealloc(OG(ob_buffer), OG(ob_size)+1);
- }
-}
-
-
-static void php_ob_init(uint initial_size, uint block_size)
-{
- OLS_FETCH();
-
- if (OG(ob_buffer)) {
- return;
- }
- OG(ob_block_size) = block_size;
- OG(ob_size) = initial_size;
- OG(ob_buffer) = (char *) emalloc(initial_size+1);
- OG(ob_text_length) = 0;
-}
-
-
-static void php_ob_destroy()
-{
- OLS_FETCH();
-
- if (OG(ob_buffer)) {
- efree(OG(ob_buffer));
- OG(ob_buffer) = NULL;
- }
-}
-
-
-static void php_ob_append(const char *text, uint text_length)
-{
- char *target;
- int original_ob_text_length;
- OLS_FETCH();
-
- original_ob_text_length=OG(ob_text_length);
-
- OG(ob_text_length) += text_length;
- php_ob_allocate();
- target = OG(ob_buffer)+original_ob_text_length;
- memcpy(target, text, text_length);
- target[text_length]=0;
-}
-
-#if 0
-static void php_ob_prepend(const char *text, uint text_length)
-{
- char *p, *start;
- OLS_FETCH();
-
- OG(ob_text_length) += text_length;
- php_ob_allocate();
-
- /* php_ob_allocate() may change OG(ob_buffer), so we can't initialize p&start earlier */
- p = OG(ob_buffer)+OG(ob_text_length);
- start = OG(ob_buffer);
-
- while (--p>=start) {
- p[text_length] = *p;
- }
- memcpy(OG(ob_buffer), text, text_length);
- OG(ob_buffer)[OG(ob_text_length)]=0;
-}
-#endif
-
-static inline void php_ob_send()
-{
- OLS_FETCH();
-
- /* header_write is a simple, unbuffered output function */
- OG(php_body_write)(OG(ob_buffer), OG(ob_text_length));
-}
-
-
-/* Return the current output buffer */
-int php_ob_get_buffer(pval *p)
-{
- OLS_FETCH();
-
- if (!OG(ob_buffer)) {
- return FAILURE;
- }
- p->type = IS_STRING;
- p->value.str.val = estrndup(OG(ob_buffer), OG(ob_text_length));
- p->value.str.len = OG(ob_text_length);
- return SUCCESS;
-}
-
-
-/*
- * Wrapper functions - implementation
- */
-
-
-/* buffered output function */
-static int php_b_body_write(const char *str, uint str_length)
-{
- php_ob_append(str, str_length);
- return str_length;
-}
-
-
-static int php_ub_body_write_no_header(const char *str, uint str_length)
-{
- char *newstr = NULL;
- uint new_length=0;
- int result;
- OLS_FETCH();
-
- session_adapt_uris(str, str_length, &newstr, &new_length);
-
- if (newstr) {
- str = newstr;
- str_length = new_length;
- }
-
- result = OG(php_header_write)(str, str_length);
-
- if (newstr) {
- free(newstr);
- }
-
- if (OG(implicit_flush)) {
- sapi_flush();
- }
-
- return result;
-}
-
-
-static int php_ub_body_write(const char *str, uint str_length)
-{
- int result = 0;
- SLS_FETCH();
- OLS_FETCH();
-
- if (SG(request_info).headers_only) {
- zend_bailout();
- }
- if (php_header()) {
- if (zend_is_compiling()) {
- CLS_FETCH();
-
- OG(output_start_filename) = zend_get_compiled_filename(CLS_C);
- OG(output_start_lineno) = zend_get_compiled_lineno(CLS_C);
- } else if (zend_is_executing()) {
- ELS_FETCH();
-
- OG(output_start_filename) = zend_get_executed_filename(ELS_C);
- OG(output_start_lineno) = zend_get_executed_lineno(ELS_C);
- }
-
- OG(php_body_write) = php_ub_body_write_no_header;
- result = php_ub_body_write_no_header(str, str_length);
- }
-
- return result;
-}
-
-
-/*
- * HEAD support
- */
-
-
-/* {{{ proto void ob_start(void)
- Turn on Output Buffering */
-PHP_FUNCTION(ob_start)
-{
- php_start_ob_buffering();
-}
-/* }}} */
-
-
-/* {{{ proto void ob_end_flush(void)
- Flush (send) the output buffer, and turn off output buffering */
-PHP_FUNCTION(ob_end_flush)
-{
- php_end_ob_buffering(1);
-}
-/* }}} */
-
-
-/* {{{ proto void ob_end_clean(void)
- Clean (erase) the output buffer, and turn off output buffering */
-PHP_FUNCTION(ob_end_clean)
-{
- php_end_ob_buffering(0);
-}
-/* }}} */
-
-
-/* {{{ proto string ob_get_contents(void)
- Return the contents of the output buffer */
-PHP_FUNCTION(ob_get_contents)
-{
- if (php_ob_get_buffer(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto void ob_implicit_flush([int flag])
- Turn implicit flush on/off and is equivalent to calling flush() after every output call */
-PHP_FUNCTION(ob_implicit_flush)
-{
- zval **zv_flag;
- int flag;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- flag = 1;
- break;
- case 1:
- if (zend_get_parameters_ex(1, &zv_flag)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(zv_flag);
- flag = (*zv_flag)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- if (flag) {
- php_start_implicit_flush();
- } else {
- php_end_implicit_flush();
- }
-}
-/* }}} */
-
-
-PHPAPI char *php_get_output_start_filename()
-{
- OLS_FETCH();
-
- return OG(output_start_filename);
-}
-
-
-PHPAPI int php_get_output_start_lineno()
-{
- OLS_FETCH();
-
- return OG(output_start_lineno);
-}
-
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php.h b/main/php.h
deleted file mode 100644
index 5af3f98e83..0000000000
--- a/main/php.h
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _PHP_H
-#define _PHP_H
-
-#ifdef HAVE_DMALLOC
-#include <dmalloc.h>
-#endif
-
-#define PHP_API_VERSION 19990421
-
-#define YYDEBUG 0
-
-#include "php_version.h"
-#include "zend.h"
-#include "php_compat.h"
-
-/* automake defines PACKAGE and VERSION for Zend too */
-#undef PACKAGE
-#undef VERSION
-
-#include "zend_API.h"
-
-#if PHP_BROKEN_SPRINTF
-#undef sprintf
-#define sprintf php_sprintf
-#endif
-
-extern unsigned char first_arg_force_ref[];
-extern unsigned char first_arg_allow_ref[];
-extern unsigned char second_arg_force_ref[];
-extern unsigned char second_arg_allow_ref[];
-
-
-/* somebody stealing BOOL from windows. pick something else!
-#ifndef BOOL
-#define BOOL MYBOOL
-#endif
-*/
-
-
-#ifdef PHP_WIN32
-#include "win95nt.h"
-# ifdef PHP_EXPORTS
-# define PHPAPI __declspec(dllexport)
-# else
-# define PHPAPI __declspec(dllimport)
-# endif
-#else
-#define PHPAPI
-#define THREAD_LS
-#endif
-
-#include "php_regex.h"
-
-/* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
-#undef PHP_DEBUG
-#define PHP_DEBUG ZEND_DEBUG
-
-
-#if PHP_DEBUG || !(defined(__GNUC__)||defined(PHP_WIN32))
-#ifdef inline
-#undef inline
-#endif
-#define inline
-#endif
-
-#define APACHE 0
-#define CGI_BINARY 0
-
-#if HAVE_UNIX_H
-#include <unix.h>
-#endif
-
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#ifndef HAVE_STRLCPY
-PHPAPI size_t strlcpy(char *dst, const char *src, size_t siz);
-#endif
-
-#ifndef HAVE_STRLCAT
-PHPAPI size_t strlcat(char *dst, const char *src, size_t siz);
-#endif
-
-#ifndef HAVE_STRTOK_R
-char *strtok_r(char *s, const char *delim, char **last);
-#endif
-
-#ifndef HAVE_SOCKLEN_T
-typedef unsigned int socklen_t;
-#endif
-
-#define CREATE_MUTEX(a,b)
-#define SET_MUTEX(a)
-#define FREE_MUTEX(a)
-
-/*
- * Then the ODBC support can use both iodbc and Solid,
- * uncomment this.
- * #define HAVE_ODBC (HAVE_IODBC|HAVE_SOLID)
- */
-
-#include <stdlib.h>
-#include <ctype.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_STDARG_H
-#include <stdarg.h>
-#else
-# if HAVE_SYS_VARARGS_H
-# include <sys/varargs.h>
-# endif
-#endif
-
-
-#include "zend_hash.h"
-#include "php3_compat.h"
-#include "zend_alloc.h"
-#include "zend_stack.h"
-
-typedef zval pval;
-
-#define pval_copy_constructor zval_copy_ctor
-#define pval_destructor zval_dtor
-
-#if STDC_HEADERS
-# include <string.h>
-#else
-# ifndef HAVE_MEMCPY
-# define memcpy(d, s, n) bcopy((s), (d), (n))
-# define memmove(d, s, n) bcopy ((s), (d), (n))
-# endif
-#endif
-
-#include "safe_mode.h"
-
-#ifndef HAVE_STRERROR
-extern char *strerror(int);
-#endif
-
-#include "fopen-wrappers.h"
-
-#if (REGEX == 1 || REGEX == 0) && !defined(NO_REGEX_EXTRA_H)
-#include "regex/regex_extra.h"
-#endif
-
-#if HAVE_PWD_H
-# ifdef PHP_WIN32
-#include "win32/pwd.h"
-#include "win32/param.h"
-# else
-#include <pwd.h>
-#include <sys/param.h>
-# endif
-#endif
-
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#ifndef LONG_MAX
-#define LONG_MAX 2147483647L
-#endif
-
-#ifndef LONG_MIN
-#define LONG_MIN (- LONG_MAX - 1)
-#endif
-
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) || defined(BROKEN_SPRINTF)
-#include "snprintf.h"
-#endif
-
-#define EXEC_INPUT_BUF 4096
-
-
-#define DONT_FREE 0
-#define DO_FREE 1
-
-#define PHP_MIME_TYPE "application/x-httpd-php"
-
-/* macros */
-#undef COPY_STRING
-#define COPY_STRING(yy) (yy).value.str.val = (char *) estrndup((yy).value.str.val,(yy).value.str.len)
-#define STR_PRINT(str) ((str)?(str):"")
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 256 /* Should be safe for any weird systems that do not define it */
-#endif
-
-#define PHP_FN(name) php_if_##name
-#define PHP_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
-#define PHP_FUNCTION(name) PHP_NAMED_FUNCTION(PHP_FN(name))
-
-#define PHP_NAMED_FE(php_name, name, arg_types) { #php_name, name, arg_types },
-#define PHP_FE(name, arg_types) PHP_NAMED_FE(name, PHP_FN(name), arg_types)
-#define PHP_FALIAS(name, alias, arg_types) PHP_NAMED_FE(name, PHP_FN(alias), arg_types)
-
-#define PHP_MINIT(module) php_minit_##module
-#define PHP_MSHUTDOWN(module) php_mshutdown_##module
-#define PHP_RINIT(module) php_rinit_##module
-#define PHP_RSHUTDOWN(module) php_rshutdown_##module
-#define PHP_MINFO(module) php_info_##module
-#define PHP_GINIT(module) php_ginit_##module
-#define PHP_GSHUTDOWN(module) php_gshutdown_##module
-
-#define PHP_MINIT_FUNCTION(module) int PHP_MINIT(module)(INIT_FUNC_ARGS)
-#define PHP_MSHUTDOWN_FUNCTION(module) int PHP_MSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
-#define PHP_RINIT_FUNCTION(module) int PHP_RINIT(module)(INIT_FUNC_ARGS)
-#define PHP_RSHUTDOWN_FUNCTION(module) int PHP_RSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
-#define PHP_MINFO_FUNCTION(module) void PHP_MINFO(module)(ZEND_MODULE_INFO_FUNC_ARGS)
-#define PHP_GINIT_FUNCTION(module) int PHP_GINIT(module)(GINIT_FUNC_ARGS)
-#define PHP_GSHUTDOWN_FUNCTION(module) int PHP_GSHUTDOWN(module)(void)
-
-
-/* global variables */
-extern pval *data;
-#if !defined(PHP_WIN32)
-extern char **environ;
-#define php_sleep sleep
-#endif
-
-extern void phperror(char *error);
-extern PHPAPI int php_write(void *buf, int size);
-extern PHPAPI int php_printf(const char *format, ...);
-extern void php_log_err(char *log_message);
-extern int Debug(char *format, ...);
-extern int cfgparse(void);
-
-#define php_error zend_error
-
-
-#define zenderror phperror
-#define zendlex phplex
-
-#define phpparse zendparse
-#define phprestart zendrestart
-#define phpin zendin
-
-/* functions */
-int php_startup_internal_extensions(void);
-int php_global_startup_internal_extensions(void);
-int php_global_shutdown_internal_extensions(void);
-
-int mergesort(void *base, size_t nmemb, register size_t size, int (*cmp) (const void *, const void *));
-
-/*from basic functions*/
-extern PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers);
-
-PHPAPI void php_register_pre_request_shutdown(void (*func)(void *), void *userdata);
-
-PHPAPI int cfg_get_long(char *varname, long *result);
-PHPAPI int cfg_get_double(char *varname, double *result);
-PHPAPI int cfg_get_string(char *varname, char **result);
-
-
-/* Output support */
-#include "ext/standard/php_output.h"
-#define PHPWRITE(str, str_len) php_body_write((str), (str_len))
-#define PUTS(str) php_body_write((str), strlen((str)))
-#define PUTC(c) (php_body_write(&(c), 1), (c))
-#define PHPWRITE_H(str, str_len) php_header_write((str), (str_len))
-#define PUTS_H(str) php_header_write((str), strlen((str)))
-#define PUTC_H(c) (php_header_write(&(c), 1), (c))
-
-#define VIRTUAL_DIR
-#include "php_virtual_cwd.h"
-
-/* Virtual current directory support */
-#ifdef VIRTUAL_DIR
-#define V_GETCWD(buff, size) virtual_getcwd(buff,size)
-#define V_FOPEN(path, mode) virtual_fopen(path, mode)
-/* The V_OPEN macro will need to be used as V_OPEN((path, flags, ...)) */
-#define V_OPEN(open_args) virtual_open open_args
-#define V_CREAT(path, mode) virtual_creat(path, mode)
-#define V_CHDIR(path) virtual_chdir(path)
-#define V_CHDIR_FILE(path) virtual_chdir_file(path)
-#define V_GETWD(buf)
-#define V_STAT(path, buff) virtual_stat(path, buff)
-#ifdef PHP_WIN32
-#define V_LSTAT(path, buff) virtual_stat(path, buff)
-#else
-#define V_LSTAT(path, buff) virtual_lstat(path, buff)
-#endif
-#define V_UNLINK(path) virtual_unlink(path)
-#define V_MKDIR(pathname, mode) virtual_mkdir(pathname, mode)
-#define V_RMDIR(pathname) virtual_rmdir(pathname)
-#define V_OPENDIR(pathname) virtual_opendir(pathname)
-#else
-#define V_GETCWD(buff, size) getcwd(buff,size)
-#define V_FOPEN(path, mode) fopen(path, mode)
-#define V_OPEN(open_args) open open_args
-#define V_CREAT(path, mode) creat(path, mode)
-#define V_CHDIR(path) chdir(path)
-#define V_CHDIR_FILE(path) chdir_file(path)
-#define V_GETWD(buf) getwd(buf)
-#define V_STAT(path, buff) stat(path, buff)
-#define V_LSTAT(path, buff) lstat(path, buff)
-#define V_UNLINK(path) unlink(path)
-#define V_MKDIR(pathname, mode) mkdir(pathname, mode)
-#define V_RMDIR(pathname) rmdir(pathname)
-#define V_OPENDIR(pathname) opendir(pathname)
-#endif
-
-#include "zend_constants.h"
-
-/* connection status states */
-#define PHP_CONNECTION_NORMAL 0
-#define PHP_CONNECTION_ABORTED 1
-#define PHP_CONNECTION_TIMEOUT 2
-
-#include "php_reentrancy.h"
-
-/* Finding offsets of elements within structures.
- * Taken from the Apache code, which in turn, was taken from X code...
- */
-
-#if defined(CRAY) || (defined(__arm) && !defined(LINUX))
-#ifdef __STDC__
-#define XtOffset(p_type,field) _Offsetof(p_type,field)
-#else
-#ifdef CRAY2
-#define XtOffset(p_type,field) \
- (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
-
-#else /* !CRAY2 */
-
-#define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
-
-#endif /* !CRAY2 */
-#endif /* __STDC__ */
-#else /* ! (CRAY || __arm) */
-
-#define XtOffset(p_type,field) \
- ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
-
-#endif /* !CRAY */
-
-#ifdef offsetof
-#define XtOffsetOf(s_type,field) offsetof(s_type,field)
-#else
-#define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
-#endif
-
-PHP_FUNCTION(warn_not_available);
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php3_compat.h b/main/php3_compat.h
deleted file mode 100644
index 213cb5374b..0000000000
--- a/main/php3_compat.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef _PHP_COMPAT_H
-#define _PHP_COMPAT_H
-
-#define _php3_hash_init zend_hash_init
-#define _php3_hash_destroy zend_hash_destroy
-
-#define _php3_hash_clean zend_hash_clean
-
-#define _php3_hash_add_or_update zend_hash_add_or_update
-#define _php3_hash_add zend_hash_add
-#define _php3_hash_update zend_hash_update
-
-#define _php3_hash_quick_add_or_update zend_hash_quick_add_or_update
-#define _php3_hash_quick_add zend_hash_quick_add
-#define _php3_hash_quick_update zend_hash_quick_update
-
-#define _php3_hash_index_update_or_next_insert zend_hash_index_update_or_next_insert
-#define _php3_hash_index_update zend_hash_index_update
-#define _php3_hash_next_index_insert zend_hash_next_index_insert
-
-#define _php3_hash_pointer_update zend_hash_pointer_update
-
-#define _php3_hash_pointer_index_update_or_next_insert zend_hash_pointer_index_update_or_next_insert
-#define _php3_hash_pointer_index_update zend_hash_pointer_index_update
-#define _php3_hash_next_index_pointer_update zend_hash_next_index_pointer_update
-#define _php3_hash_next_index_pointer_insert zend_hash_next_index_pointer_insert
-
-#define _php3_hash_del_key_or_index zend_hash_del_key_or_index
-#define _php3_hash_del zend_hash_del
-#define _php3_hash_index_del zend_hash_index_del
-
-#define _php3_hash_find zend_hash_find
-#define _php3_hash_quick_find zend_hash_quick_find
-#define _php3_hash_index_find zend_hash_index_find
-
-#define _php3_hash_exists zend_hash_exists
-#define _php3_hash_index_exists zend_hash_index_exists
-#define _php3_hash_is_pointer zend_hash_is_pointer
-#define _php3_hash_index_is_pointer zend_hash_index_is_pointer
-#define _php3_hash_next_free_element zend_hash_next_free_element
-
-#define _php3_hash_move_forward zend_hash_move_forward
-#define _php3_hash_move_backwards zend_hash_move_backwards
-#define _php3_hash_get_current_key zend_hash_get_current_key
-#define _php3_hash_get_current_data zend_hash_get_current_data
-#define _php3_hash_internal_pointer_reset zend_hash_internal_pointer_reset
-#define _php3_hash_internal_pointer_end zend_hash_internal_pointer_end
-
-#define _php3_hash_copy zend_hash_copy
-#define _php3_hash_merge zend_hash_merge
-#define _php3_hash_sort zend_hash_sort
-#define _php3_hash_minmax zend_hash_minmax
-
-#define _php3_hash_num_elements zend_hash_num_elements
-
-#define _php3_hash_apply zend_hash_apply
-#define _php3_hash_apply_with_argument zend_hash_apply_with_argument
-
-
-#define php3_error php_error
-
-#define php3_printf php_printf
-#define _php3_sprintf php_sprintf
-
-
-
-#define php3_module_entry zend_module_entry
-
-#define php3_strndup zend_strndup
-#define php3_str_tolower zend_str_tolower
-#define php3_binary_strcmp zend_binary_strcmp
-
-
-#define php3_list_insert zend_list_insert
-#define php3_list_find zend_list_find
-#define php3_list_delete zend_list_delete
-
-#define php3_plist_insert zend_plist_insert
-#define php3_plist_find zend_plist_find
-#define php3_plist_delete zend_plist_delete
-
-#define zend_print_pval zend_print_zval
-#define zend_print_pval_r zend_print_zval_r
-
-
-#define function_entry zend_function_entry
-
-#define _php3_addslashes php_addslashes
-#define _php3_stripslashes php_stripslashes
-#define php3_dl php_dl
-
-#define getParameters zend_get_parameters
-#define getParametersArray zend_get_parameters_array
-
-#define list_entry zend_rsrc_list_entry
-
-#endif /* _PHP_COMPAT_H */
diff --git a/main/php_compat.h b/main/php_compat.h
deleted file mode 100644
index c0726da009..0000000000
--- a/main/php_compat.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef PHP_COMPAT_H
-#define PHP_COMPAT_H
-
-#ifdef PHP_WIN32
-#include "config.w32.h"
-#else
-#include "php_config.h"
-#endif
-
-#if defined(HAVE_BUNDLED_PCRE) || !defined(PHP_VERSION)
-#define pcre_compile php_pcre_compile
-#define pcre_copy_substring php_pcre_copy_substring
-#define pcre_exec php_pcre_exec
-#define pcre_get_substring php_pcre_substring
-#define pcre_get_substring_list php_pcre_get_substring_list
-#define pcre_info php_pcre_info
-#define pcre_maketables php_pcre_maketables
-#define pcre_study php_pcre_study
-#define pcre_version php_pcre_version
-#endif
-
-#define lookup php_lookup
-#define hashTableInit php_hashTableInit
-#define hashTableDestroy php_hashTableDestroy
-#define hashTableIterInit php_hashTableIterInit
-#define hashTableIterNext php_hashTableIterNext
-#define XML_DefaultCurrent php_XML_DefaultCurrent
-#define XML_ErrorString php_XML_ErrorString
-#define XML_ExternalEntityParserCreate php_XML_ExternalEntityParserCreate
-#define XML_GetBase php_XML_GetBase
-#define XML_GetBuffer php_XML_GetBuffer
-#define XML_GetCurrentByteCount php_XML_GetCurrentByteCount
-#define XML_GetCurrentByteIndex php_XML_GetCurrentByteIndex
-#define XML_GetCurrentColumnNumber php_XML_GetCurrentColumnNumber
-#define XML_GetCurrentLineNumber php_XML_GetCurrentLineNumber
-#define XML_GetErrorCode php_XML_GetErrorCode
-#define XML_GetSpecifiedAttributeCount php_XML_GetSpecifiedAttributeCount
-#define XML_Parse php_XML_Parse
-#define XML_ParseBuffer php_XML_ParseBuffer
-#define XML_ParserCreate php_XML_ParserCreate
-#define XML_ParserCreateNS php_XML_ParserCreateNS
-#define XML_ParserFree php_XML_ParserFree
-#define XML_SetBase php_XML_SetBase
-#define XML_SetCdataSectionHandler php_XML_SetCdataSectionHandler
-#define XML_SetCharacterDataHandler php_XML_SetCharacterDataHandler
-#define XML_SetCommentHandler php_XML_SetCommentHandler
-#define XML_SetDefaultHandler php_XML_SetDefaultHandler
-#define XML_SetDefaultHandlerExpand php_XML_SetDefaultHandlerExpand
-#define XML_SetElementHandler php_XML_SetElementHandler
-#define XML_SetEncoding php_XML_SetEncoding
-#define XML_SetExternalEntityRefHandler php_XML_SetExternalEntityRefHandler
-#define XML_SetExternalEntityRefHandlerArg php_XML_SetExternalEntityRefHandlerArg
-#define XML_SetNamespaceDeclHandler php_XML_SetNamespaceDeclHandler
-#define XML_SetNotStandaloneHandler php_XML_SetNotStandaloneHandler
-#define XML_SetNotationDeclHandler php_XML_SetNotationDeclHandler
-#define XML_SetProcessingInstructionHandler php_XML_SetProcessingInstructionHandler
-#define XML_SetUnknownEncodingHandler php_XML_SetUnknownEncodingHandler
-#define XML_SetUnparsedEntityDeclHandler php_XML_SetUnparsedEntityDeclHandler
-#define XML_SetUserData php_XML_SetUserData
-#define XML_UseParserAsHandlerArg php_XML_UseParserAsHandlerArg
-#define XmlGetUtf16InternalEncoding php_XmlGetUtf16InternalEncoding
-#define XmlGetUtf8InternalEncoding php_XmlGetUtf8InternalEncoding
-#define XmlInitEncoding php_XmlInitEncoding
-#define XmlInitUnknownEncoding php_XmlInitUnknownEncoding
-#define XmlParseXmlDecl php_XmlParseXmlDecl
-#define XmlSizeOfUnknownEncoding php_XmlSizeOfUnknownEncoding
-#define XmlUtf16Encode php_XmlUtf16Encode
-#define XmlUtf8Encode php_XmlUtf8Encode
-#define XmlPrologStateInit php_XmlPrologStateInit
-
-#endif
diff --git a/main/php_content_types.c b/main/php_content_types.c
deleted file mode 100644
index e6c85b7685..0000000000
--- a/main/php_content_types.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_01.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | |
- +----------------------------------------------------------------------+
- */
-#include "php.h"
-#include "SAPI.h"
-#include "rfc1867.h"
-
-#include "php_content_types.h"
-
-static sapi_post_entry php_post_entries[] = {
- { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_std_post_handler },
- { MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, sapi_read_standard_form_data, rfc1867_post_handler },
- { NULL, 0, NULL }
-};
-
-
-SAPI_POST_READER_FUNC(php_default_post_reader)
-{
- char *data;
- ELS_FETCH();
-
- sapi_read_standard_form_data(SLS_C);
- data = estrndup(SG(request_info).post_data,SG(request_info).post_data_length);
- SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, SG(request_info).post_data_length);
-}
-
-
-int php_startup_sapi_content_types(void)
-{
- sapi_register_post_entries(php_post_entries);
- sapi_register_default_post_reader(php_default_post_reader);
- return SUCCESS;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_content_types.h b/main/php_content_types.h
deleted file mode 100644
index af512ed3ab..0000000000
--- a/main/php_content_types.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _PHP_CONTENT_TYPES_H
-#define _PHP_CONTENT_TYPES_H
-
-#define DEFAULT_POST_CONTENT_TYPE "application/x-www-form-urlencoded"
-
-SAPI_POST_READER_FUNC(php_default_post_reader);
-SAPI_POST_HANDLER_FUNC(php_std_post_handler);
-int php_startup_sapi_content_types(void);
-
-#endif /* _PHP_CONTENT_TYPES_H */
diff --git a/main/php_globals.h b/main/php_globals.h
deleted file mode 100644
index 7c5a0fb919..0000000000
--- a/main/php_globals.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _PHP_GLOBALS_H
-#define _PHP_GLOBALS_H
-
-#include "zend_globals.h"
-
-typedef struct _php_core_globals php_core_globals;
-
-#ifdef ZTS
-# define PLS_D php_core_globals *core_globals
-# define PLS_DC , PLS_D
-# define PLS_C core_globals
-# define PLS_CC , PLS_C
-# define PG(v) (core_globals->v)
-# define PLS_FETCH() php_core_globals *core_globals = ts_resource(core_globals_id)
-extern PHPAPI int core_globals_id;
-#else
-# define PLS_D
-# define PLS_DC
-# define PLS_C
-# define PLS_CC
-# define PG(v) (core_globals.v)
-# define PLS_FETCH()
-extern ZEND_API struct _php_core_globals core_globals;
-#endif
-
-typedef struct _php_http_globals {
- zval *post;
- zval *get;
- zval *cookie;
- zval *server;
- zval *environment;
- zval *post_files;
-} php_http_globals;
-
-struct _php_tick_function_entry;
-
-struct _php_core_globals {
- zend_bool magic_quotes_gpc;
- zend_bool magic_quotes_runtime;
- zend_bool magic_quotes_sybase;
-
- zend_bool allow_call_time_pass_reference;
- zend_bool zend_set_utility_values;
- zend_bool output_buffering;
- zend_bool implicit_flush;
-
- zend_bool safe_mode;
- zend_bool sql_safe_mode;
- zend_bool enable_dl;
- char *safe_mode_exec_dir;
-
- long memory_limit;
-
- zend_bool track_errors;
- zend_bool display_errors;
- zend_bool log_errors;
- char *error_log;
-
- char *doc_root;
- char *user_dir;
- char *include_path;
- char *open_basedir;
- char *extension_dir;
-
- char *upload_tmp_dir;
- long upload_max_filesize;
-
- char *error_append_string;
- char *error_prepend_string;
-
- char *auto_prepend_file;
- char *auto_append_file;
-
- char *arg_separator;
- char *gpc_order;
- char *variables_order;
-
- short connection_status;
- short ignore_user_abort;
-
- long max_execution_time;
-
- unsigned char header_is_being_sent;
-
- zend_llist tick_functions;
-
- php_http_globals http_globals;
-
- zend_bool expose_php;
-
- zend_bool track_vars;
- zend_bool register_globals;
- zend_bool register_argc_argv;
-
- zend_bool y2k_compliance;
-
- zend_bool modules_activated;
-};
-
-
-#endif /* _PHP_GLOBALS_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_ini.c b/main/php_ini.c
deleted file mode 100644
index 44e7347bb3..0000000000
--- a/main/php_ini.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-#include <stdlib.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "zend_alloc.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-
-static HashTable known_directives;
-
-
-/*
- * hash_apply functions
- */
-static int php_remove_ini_entries(php_ini_entry *ini_entry, int *module_number)
-{
- if (ini_entry->module_number == *module_number) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-static int php_restore_ini_entry_cb(php_ini_entry *ini_entry, int stage)
-{
- if (ini_entry->modified) {
- if (ini_entry->on_modify) {
- ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage);
- }
- efree(ini_entry->value);
- ini_entry->value = ini_entry->orig_value;
- ini_entry->value_length = ini_entry->orig_value_length;
- ini_entry->modified = 0;
- ini_entry->orig_value = NULL;
- ini_entry->orig_value_length = 0;
- }
- return 0;
-}
-
-/*
- * Startup / shutdown
- */
-int php_ini_mstartup()
-{
- if (zend_hash_init(&known_directives, 100, NULL, NULL, 1)==FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-int php_ini_mshutdown()
-{
- zend_hash_destroy(&known_directives);
- return SUCCESS;
-}
-
-
-int php_ini_rshutdown()
-{
- zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_restore_ini_entry_cb, (void *) PHP_INI_STAGE_DEACTIVATE);
- return SUCCESS;
-}
-
-
-static int ini_key_compare(const void *a, const void *b)
-{
- Bucket *f;
- Bucket *s;
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- if (f->nKeyLength==0 && s->nKeyLength==0) { /* both numeric */
- return ZEND_NORMALIZE_BOOL(f->nKeyLength - s->nKeyLength);
- } else if (f->nKeyLength==0) { /* f is numeric, s is not */
- return -1;
- } else if (s->nKeyLength==0) { /* s is numeric, f is not */
- return 1;
- } else { /* both strings */
- return zend_binary_strcasecmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength);
- }
-}
-
-
-void php_ini_sort_entries()
-{
- zend_hash_sort(&known_directives, qsort, ini_key_compare, 0);
-}
-
-/*
- * Registration / unregistration
- */
-
-PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number)
-{
- php_ini_entry *p = ini_entry;
- php_ini_entry *hashed_ini_entry;
- pval *default_value;
-
- while (p->name) {
- p->module_number = module_number;
- if (zend_hash_add(&known_directives, p->name, p->name_length, p, sizeof(php_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
- php_unregister_ini_entries(module_number);
- return FAILURE;
- }
- if (hashed_ini_entry->on_modify) {
- hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, PHP_INI_STAGE_STARTUP);
- }
- if ((default_value=cfg_get_entry(p->name, p->name_length))) {
- if (!hashed_ini_entry->on_modify
- || hashed_ini_entry->on_modify(hashed_ini_entry, default_value->value.str.val, default_value->value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, PHP_INI_STAGE_STARTUP)==SUCCESS) {
- hashed_ini_entry->value = default_value->value.str.val;
- hashed_ini_entry->value_length = default_value->value.str.len;
- }
- } else {
- if (hashed_ini_entry->on_modify) {
- hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, PHP_INI_STAGE_STARTUP);
- }
- }
- hashed_ini_entry->modified = 0;
- p++;
- }
- return SUCCESS;
-}
-
-
-PHPAPI void php_unregister_ini_entries(int module_number)
-{
- zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_remove_ini_entries, (void *) &module_number);
-}
-
-
-static int php_ini_refresh_cache(php_ini_entry *p, int stage)
-{
- if (p->on_modify) {
- p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage);
- }
- return 0;
-}
-
-
-PHPAPI void php_ini_refresh_caches(int stage)
-{
- zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_ini_refresh_cache, (void *) stage);
-}
-
-
-PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage)
-{
- php_ini_entry *ini_entry;
- char *duplicate;
-
- if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) {
- return FAILURE;
- }
-
- if (!(ini_entry->modifyable & modify_type)) {
- return FAILURE;
- }
-
- duplicate = estrndup(new_value, new_value_length);
-
- if (!ini_entry->on_modify
- || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage)==SUCCESS) {
- if (!ini_entry->modified) {
- ini_entry->orig_value = ini_entry->value;
- ini_entry->orig_value_length = ini_entry->value_length;
- } else { /* we already changed the value, free the changed value */
- efree(ini_entry->value);
- }
- ini_entry->value = duplicate;
- ini_entry->value_length = new_value_length;
- ini_entry->modified = 1;
- } else {
- efree(duplicate);
- }
-
- return SUCCESS;
-}
-
-
-PHPAPI int php_restore_ini_entry(char *name, uint name_length, int stage)
-{
- php_ini_entry *ini_entry;
-
- if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) {
- return FAILURE;
- }
-
- php_restore_ini_entry_cb(ini_entry, stage);
- return SUCCESS;
-}
-
-
-PHPAPI int php_ini_register_displayer(char *name, uint name_length, void (*displayer)(php_ini_entry *ini_entry, int type))
-{
- php_ini_entry *ini_entry;
-
- if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) {
- return FAILURE;
- }
-
- ini_entry->displayer = displayer;
- return SUCCESS;
-}
-
-
-
-/*
- * Data retrieval
- */
-
-PHPAPI long php_ini_long(char *name, uint name_length, int orig)
-{
- php_ini_entry *ini_entry;
-
- if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
- if (orig && ini_entry->modified) {
- return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0);
- } else if (ini_entry->value) {
- return strtol(ini_entry->value, NULL, 0);
- }
- }
-
- return 0;
-}
-
-
-PHPAPI double php_ini_double(char *name, uint name_length, int orig)
-{
- php_ini_entry *ini_entry;
-
- if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
- if (orig && ini_entry->modified) {
- return (double) (ini_entry->orig_value ? strtod(ini_entry->orig_value, NULL) : 0.0);
- } else if (ini_entry->value) {
- return (double) strtod(ini_entry->value, NULL);
- }
- }
-
- return 0.0;
-}
-
-
-PHPAPI char *php_ini_string(char *name, uint name_length, int orig)
-{
- php_ini_entry *ini_entry;
-
- if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
- if (orig && ini_entry->modified) {
- return ini_entry->orig_value;
- } else {
- return ini_entry->value;
- }
- }
-
- return "";
-}
-
-
-php_ini_entry *get_ini_entry(char *name, uint name_length)
-{
- php_ini_entry *ini_entry;
-
- if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
- return ini_entry;
- } else {
- return NULL;
- }
-}
-
-
-static void php_ini_displayer_cb(php_ini_entry *ini_entry, int type)
-{
- if (ini_entry->displayer) {
- ini_entry->displayer(ini_entry, type);
- } else {
- char *display_string;
- uint display_string_length;
-
- if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- if (ini_entry->orig_value) {
- display_string = ini_entry->orig_value;
- display_string_length = ini_entry->orig_value_length;
- } else {
- display_string = "<i>no value</i>";
- display_string_length = sizeof("<i>no value</i>")-1;
- }
- } else if (ini_entry->value && ini_entry->value[0]) {
- display_string = ini_entry->value;
- display_string_length = ini_entry->value_length;
- } else {
- display_string = "<i>no value</i>";
- display_string_length = sizeof("<i>no value</i>")-1;
- }
- PHPWRITE(display_string, display_string_length);
- }
-}
-
-
-PHP_INI_DISP(php_ini_boolean_displayer_cb)
-{
- int value;
-
- if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = (ini_entry->orig_value ? atoi(ini_entry->orig_value) : 0);
- } else if (ini_entry->value) {
- value = atoi(ini_entry->value);
- } else {
- value = 0;
- }
- if (value) {
- PUTS("On");
- } else {
- PUTS("Off");
- }
-}
-
-
-PHP_INI_DISP(php_ini_color_displayer_cb)
-{
- char *value;
-
- if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
- if (value) {
- php_printf("<font color=\"%s\">%s</font>", value, value);
- } else {
- PUTS("<i>no value</i>;");
- }
-}
-
-
-PHP_INI_DISP(display_link_numbers)
-{
- char *value;
-
- if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (value) {
- if (atoi(value)==-1) {
- PUTS("Unlimited");
- } else {
- php_printf("%s", value);
- }
- }
-}
-
-
-static int php_ini_displayer(php_ini_entry *ini_entry, int module_number)
-{
- if (ini_entry->module_number != module_number) {
- return 0;
- }
-
- PUTS("<TR VALIGN=\"baseline\" BGCOLOR=\"" PHP_CONTENTS_COLOR "\">");
- PUTS("<TD BGCOLOR=\"" PHP_ENTRY_NAME_COLOR "\"><B>");
- PHPWRITE(ini_entry->name, ini_entry->name_length-1);
- PUTS("</B><BR></TD><TD ALIGN=\"center\">");
- php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ACTIVE);
- PUTS("</TD><TD ALIGN=\"center\">");
- php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ORIG);
- PUTS("</TD></TR>\n");
- return 0;
-}
-
-
-PHPAPI void display_ini_entries(zend_module_entry *module)
-{
- int module_number;
-
- if (module) {
- module_number = module->module_number;
- } else {
- module_number = 0;
- }
- php_info_print_table_start();
- php_info_print_table_header(3, "Directive", "Local Value", "Master Value");
- zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_ini_displayer, (void *) (long) module_number);
- php_info_print_table_end();
-}
-
-
-/* Standard message handlers */
-
-PHPAPI PHP_INI_MH(OnUpdateBool)
-{
- zend_bool *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (zend_bool *) (base+(size_t) mh_arg1);
-
- *p = (zend_bool) atoi(new_value);
- return SUCCESS;
-}
-
-
-PHPAPI PHP_INI_MH(OnUpdateInt)
-{
- long *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (long *) (base+(size_t) mh_arg1);
-
- *p = atoi(new_value);
- return SUCCESS;
-}
-
-
-PHPAPI PHP_INI_MH(OnUpdateReal)
-{
- double *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (double *) (base+(size_t) mh_arg1);
-
- *p = strtod(new_value, NULL);
- return SUCCESS;
-}
-
-
-PHPAPI PHP_INI_MH(OnUpdateString)
-{
- char **p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (char **) (base+(size_t) mh_arg1);
-
- *p = new_value;
- return SUCCESS;
-}
-
-
-PHPAPI PHP_INI_MH(OnUpdateStringUnempty)
-{
- char **p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- if (new_value && !new_value[0]) {
- return FAILURE;
- }
-
- p = (char **) (base+(size_t) mh_arg1);
-
- *p = new_value;
- return SUCCESS;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_ini.h b/main/php_ini.h
deleted file mode 100644
index 47965baaa5..0000000000
--- a/main/php_ini.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _PHP_INI_H
-#define _PHP_INI_H
-
-#define PHP_INI_USER (1<<0)
-#define PHP_INI_PERDIR (1<<1)
-#define PHP_INI_SYSTEM (1<<2)
-
-#define PHP_INI_ALL (PHP_INI_USER|PHP_INI_PERDIR|PHP_INI_SYSTEM)
-
-typedef struct _php_ini_entry php_ini_entry;
-
-#define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage)
-#define PHP_INI_DISP(name) void name(php_ini_entry *ini_entry, int type)
-
-struct _php_ini_entry {
- int module_number;
- int modifyable;
- char *name;
- uint name_length;
- PHP_INI_MH((*on_modify));
- void *mh_arg1;
- void *mh_arg2;
- void *mh_arg3;
-
- char *value;
- uint value_length;
-
- char *orig_value;
- uint orig_value_length;
- int modified;
-
- void (*displayer)(php_ini_entry *ini_entry, int type);
-};
-
-
-int php_ini_mstartup(void);
-int php_ini_mshutdown(void);
-int php_ini_rshutdown(void);
-
-void php_ini_sort_entries();
-
-PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number);
-PHPAPI void php_unregister_ini_entries(int module_number);
-PHPAPI void php_ini_refresh_caches(int stage);
-PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage);
-PHPAPI int php_restore_ini_entry(char *name, uint name_length, int stage);
-PHPAPI void display_ini_entries(zend_module_entry *module);
-
-PHPAPI long php_ini_long(char *name, uint name_length, int orig);
-PHPAPI double php_ini_double(char *name, uint name_length, int orig);
-PHPAPI char *php_ini_string(char *name, uint name_length, int orig);
-php_ini_entry *get_ini_entry(char *name, uint name_length);
-
-PHPAPI int php_ini_register_displayer(char *name, uint name_length, void (*displayer)(php_ini_entry *ini_entry, int type));
-PHPAPI PHP_INI_DISP(php_ini_boolean_displayer_cb);
-PHPAPI PHP_INI_DISP(php_ini_color_displayer_cb);
-PHPAPI PHP_INI_DISP(display_link_numbers);
-
-#define PHP_INI_BEGIN() static php_ini_entry ini_entries[] = {
-#define PHP_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } };
-
-#define PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, displayer) \
- { 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, displayer },
-
-#define PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, arg3) \
- PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, NULL)
-
-#define PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, displayer) \
- PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL, displayer)
-
-#define PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, arg1, arg2) \
- PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL)
-
-#define PHP_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, displayer) \
- PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, NULL, NULL, displayer)
-
-#define PHP_INI_ENTRY1(name, default_value, modifyable, on_modify, arg1) \
- PHP_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, NULL)
-
-#define PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, displayer) \
- PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, NULL, NULL, NULL, displayer)
-
-#define PHP_INI_ENTRY(name, default_value, modifyable, on_modify) \
- PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, NULL)
-
-#ifdef ZTS
-#define STD_PHP_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
- PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id)
-#define STD_PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \
- PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, displayer)
-#define STD_PHP_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
- PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, NULL, php_ini_boolean_displayer_cb)
-#else
-#define STD_PHP_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
- PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr)
-#define STD_PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \
- PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, displayer)
-#define STD_PHP_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
- PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, php_ini_boolean_displayer_cb)
-#endif
-
-#define INI_INT(name) php_ini_long((name), sizeof(name), 0)
-#define INI_FLT(name) php_ini_double((name), sizeof(name), 0)
-#define INI_STR(name) php_ini_string((name), sizeof(name), 0)
-#define INI_BOOL(name) ((zend_bool) INI_INT(name))
-
-#define INI_ORIG_INT(name) php_ini_long((name), sizeof(name), 1)
-#define INI_ORIG_FLT(name) php_ini_double((name), sizeof(name), 1)
-#define INI_ORIG_STR(name) php_ini_string((name), sizeof(name), 1)
-#define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name))
-
-
-#define REGISTER_INI_ENTRIES() php_register_ini_entries(ini_entries, module_number)
-#define UNREGISTER_INI_ENTRIES() php_unregister_ini_entries(module_number)
-#define DISPLAY_INI_ENTRIES() display_ini_entries(zend_module)
-
-#define REGISTER_INI_DISPLAYER(name, displayer) php_ini_register_displayer((name), sizeof(name), displayer)
-#define REGISTER_INI_BOOLEAN(name) REGISTER_INI_DISPLAYER(name, php_ini_boolean_displayer_cb)
-
-pval *cfg_get_entry(char *name, uint name_length);
-
-
-/* Standard message handlers */
-PHPAPI PHP_INI_MH(OnUpdateBool);
-PHPAPI PHP_INI_MH(OnUpdateInt);
-PHPAPI PHP_INI_MH(OnUpdateReal);
-PHPAPI PHP_INI_MH(OnUpdateString);
-PHPAPI PHP_INI_MH(OnUpdateStringUnempty);
-
-
-#define PHP_INI_DISPLAY_ORIG 1
-#define PHP_INI_DISPLAY_ACTIVE 2
-
-#define PHP_INI_STAGE_STARTUP (1<<0)
-#define PHP_INI_STAGE_SHUTDOWN (1<<1)
-#define PHP_INI_STAGE_ACTIVATE (1<<2)
-#define PHP_INI_STAGE_DEACTIVATE (1<<3)
-#define PHP_INI_STAGE_RUNTIME (1<<4)
-
-#endif /* _PHP_INI_H */
diff --git a/main/php_main.h b/main/php_main.h
deleted file mode 100644
index 977f6ada80..0000000000
--- a/main/php_main.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-
-#ifndef _MAIN_H
-#define _MAIN_H
-
-#include "zend_globals.h"
-#include "php_globals.h"
-#include "SAPI.h"
-
-PHPAPI int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC);
-PHPAPI void php_request_shutdown(void *dummy);
-PHPAPI void php_request_shutdown_for_exec(void *dummy);
-PHPAPI int php_module_startup(sapi_module_struct *sf);
-PHPAPI void php_module_shutdown(void);
-PHPAPI void php_module_shutdown_for_exec(void);
-PHPAPI int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals);
-
-PHPAPI int php_startup_extensions(zend_module_entry **ptr, int count);
-PHPAPI int php_global_startup_extensions(zend_module_entry **ptr, int count);
-PHPAPI int php_global_shutdown_extensions(zend_module_entry **ptr, int count);
-
-PHPAPI void php_execute_script(zend_file_handle *primary_file CLS_DC ELS_DC PLS_DC);
-
-extern void php_call_shutdown_functions(void);
-
-
-/* configuration module */
-extern int php_init_config(void);
-extern int php_shutdown_config(void);
-
-/* environment module */
-extern int php_init_environ(void);
-extern int php_shutdown_environ(void);
-
-#endif
diff --git a/main/php_output.h b/main/php_output.h
deleted file mode 100644
index 957116ca41..0000000000
--- a/main/php_output.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _OUTPUT_BUFFER
-#define _OUTPUT_BUFFER
-
-#include "php.h"
-
-PHPAPI void php_output_startup(void);
-PHPAPI int php_body_write(const char *str, uint str_length);
-PHPAPI int php_header_write(const char *str, uint str_length);
-PHPAPI void php_start_ob_buffering(void);
-PHPAPI void php_end_ob_buffering(int send_buffer);
-PHPAPI int php_ob_get_buffer(pval *p);
-PHPAPI void php_start_implicit_flush(void);
-PHPAPI void php_end_implicit_flush(void);
-PHPAPI char *php_get_output_start_filename(void);
-PHPAPI int php_get_output_start_lineno(void);
-
-PHP_FUNCTION(ob_start);
-PHP_FUNCTION(ob_end_flush);
-PHP_FUNCTION(ob_end_clean);
-PHP_FUNCTION(ob_get_contents);
-PHP_FUNCTION(ob_implicit_flush);
-
-PHP_GINIT_FUNCTION(output);
-
-#endif /* _OUTPUT_BUFFER */
diff --git a/main/php_realpath.c b/main/php_realpath.c
deleted file mode 100644
index 26a9359e08..0000000000
--- a/main/php_realpath.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sander Steffann (sander@steffann.nl) |
- +----------------------------------------------------------------------+
- */
-
-#include "php.h"
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-
-#ifndef MAXSYMLINKS
-#define MAXSYMLINKS 32
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
-#endif
-
-char *php_realpath(char *path, char resolved_path[]);
-
-char *php_realpath(char *path, char resolved_path []) {
- char path_construction[MAXPATHLEN]; /* We build the result in here */
- char *writepos; /* Position to write next char */
-
- char path_copy[MAXPATHLEN]; /* A work-copy of the path */
- char *workpos; /* working position in *path */
-
-#if !defined(PHP_WIN32)
- char buf[MAXPATHLEN]; /* Buffer for readlink */
- int linklength; /* The result from readlink */
-#endif
- int linkcount = 0; /* Count symlinks to avoid loops */
-
- struct stat filestat; /* result from stat */
-
-#ifdef PHP_WIN32
- char *temppos; /* position while counting '.' */
- int dotcount; /* number of '.' */
- int t; /* counter */
-#endif
-
- /* Set the work-position to the beginning of the given path */
- strcpy(path_copy, path);
- workpos = path_copy;
-
-#ifdef PHP_WIN32
- /* Find out where we start - Windows version */
- if ((*workpos == '\\') || (*workpos == '/')) {
- /* We start at the root of the current drive */
- /* Get the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- /* We only need the first three chars (for example "C:\") */
- path_construction[3] = 0;
- workpos++;
- } else if (workpos[1] == ':') {
- /* A drive-letter is specified, copy it */
- strncpy(path_construction, path, 2);
- strcat(path_construction, "\\");
- workpos++;
- workpos++;
- } else {
- /* Use the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- strcat(path_construction, "\\");
- }
-#else
- /* Find out where we start - Unix version */
- if (*workpos == '/') {
- /* We start at the root */
- strcpy(path_construction, "/");
- workpos++;
- } else {
- /* Use the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- strcat(path_construction, "/");
- }
-#endif
-
- /* Set the next-char-position */
- writepos = &path_construction[strlen(path_construction)];
-
- /* Go to the end, then stop */
- while(*workpos != 0) {
- /* Strip (back)slashes */
-#ifdef PHP_WIN32
- while(*workpos == '\\') workpos++;
-#else
- while(*workpos == '/') workpos++;
-#endif
-
-#ifdef PHP_WIN32
- /* reset dotcount */
- dotcount = 0;
-
- /* Look for .. */
- if ((workpos[0] == '.') && (workpos[1] != 0)) {
- /* Windows accepts \...\ as \..\..\, \....\ as \..\..\..\, etc */
- /* At least Win98 does */
-
- temppos = workpos;
- while(*temppos++ == '.') {
- dotcount++;
- if ((*temppos != '\\') && (*temppos != 0) && (*temppos != '.')) {
- /* This is not a /../ component, but a filename that starts with '.' */
- dotcount = 0;
- }
- }
-
- /* Go back dotcount-1 times */
- for (t=0 ; t<(dotcount-1) ; t++) {
- workpos++; /* move to next '.' */
-
- /* Can we still go back? */
- if ((writepos-3) <= path_construction) return NULL;
-
- /* Go back */
- writepos--; /* move to '\' */
- while(*--writepos != '\\') ; /* skip until previous '\\' */
- }
- }
-
- /* No special case */
- if (dotcount == 0) {
- /* Append */
- while((*workpos != '\\') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
-
- /* Just one '.', go to next element */
- if (dotcount == 1) {
- while((*workpos != '\\') && (*workpos != 0)) {
- *workpos++;
- }
-
- /* Avoid double \ in the result */
- writepos--;
- }
-
- /* If it was a directory, append a slash */
- if (*workpos == '\\') {
- *writepos++ = *workpos++;
- }
- *writepos = 0;
-#else /* defined(PHP_WIN32) */
- /* Look for .. */
- if ((workpos[0] == '.') && (workpos[1] != 0)) {
- if ((workpos[1] == '.') && ((workpos[2] == '/') || (workpos[2] == 0))) {
- /* One directory back */
- /* Set pointers to right position */
- workpos++; /* move to second '.' */
- workpos++; /* move to '/' */
-
- /* Only apply .. if not in root */
- if ((writepos-1) > path_construction) {
- writepos--; /* move to '/' */
- while(*--writepos != '/') ; /* skip until previous '/' */
- }
- } else {
- if (workpos[1] == '/') {
- /* Found a /./ skip it */
- workpos++; /* move to '/' */
-
- /* Avoid double / in the result */
- writepos--;
- } else {
- /* No special case, the name just started with a . */
- /* Append */
- while((*workpos != '/') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
- }
- } else {
- /* No special case */
- /* Append */
- while((*workpos != '/') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
-
-#if HAVE_SYMLINK
- /* We are going to use path_construction, so close it */
- *writepos = 0;
-
- /* Check the current location to see if it is a symlink */
- if((linklength = readlink(path_construction, buf, MAXPATHLEN)) != -1) {
- /* Check linkcount */
- if (linkcount > MAXSYMLINKS) return NULL;
-
- /* Count this symlink */
- linkcount++;
-
- /* Set end of buf */
- buf[linklength] = 0;
-
- /* Check for overflow */
- if ((strlen(workpos) + strlen(buf) + 1) >= MAXPATHLEN) return NULL;
-
- /* Remove the symlink-component wrom path_construction */
- writepos--; /* move to '/' */
- while(*--writepos != '/') ; /* skip until previous '/' */
- *++writepos = 0; /* end of string after '/' */
-
- /* If the symlink starts with a '/', empty path_construction */
- if (*buf == '/') {
- *path_construction = 0;
- writepos = path_construction;
- }
-
- /* Insert symlink into path_copy */
- strcat(buf, workpos);
- strcpy(path_copy, buf);
- workpos = path_copy;
- }
-#endif /* HAVE_SYMLINK */
-
- /* If it was a directory, append a slash */
- if (*workpos == '/') {
- *writepos++ = *workpos++;
- }
- *writepos = 0;
-#endif /* defined(PHP_WIN32) */
- }
-
- /* Check if the resolved path is a directory */
- if (V_STAT(path_construction, &filestat) != 0) return NULL;
- if (S_ISDIR(filestat.st_mode)) {
- /* It's a directory, append a / if needed */
- if (*(writepos-1) != '/') {
- /* Check for overflow */
- if ((strlen(workpos) + 2) >= MAXPATHLEN) return NULL;
-
- *writepos++ = '/';
- *writepos = 0;
- }
- }
-
- strcpy(resolved_path, path_construction);
- return resolved_path;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_realpath.h b/main/php_realpath.h
deleted file mode 100644
index 53b72d7f60..0000000000
--- a/main/php_realpath.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sander Steffann (sander@steffann.nl) |
- +----------------------------------------------------------------------+
- */
-
-#ifndef _PHP_REALPATH_H_
-#define _PHP_REALPATH_H_
-
-extern char *php_realpath(const char *path, char resolved_path []);
-
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_reentrancy.h b/main/php_reentrancy.h
deleted file mode 100644
index 6b637879e2..0000000000
--- a/main/php_reentrancy.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-
-#ifndef PHP_REENTRANCY_H
-#define PHP_REENTRANCY_H
-
-#include "php.h"
-
-#include <sys/types.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-#include <time.h>
-
-/* currently, PHP does not check for these functions, but assumes
- that they are available on all systems. */
-
-#define HAVE_LOCALTIME 1
-#define HAVE_GMTIME 1
-#define HAVE_ASCTIME 1
-#define HAVE_CTIME 1
-
-
-#ifdef PHP_HPUX_TIME_R
-#undef HAVE_LOCALTIME_R
-#undef HAVE_ASCTIME_R
-#undef HAVE_CTIME_R
-#undef HAVE_GMTIME_R
-#endif
-
-#if defined(HAVE_POSIX_READDIR_R)
-#define php_readdir_r readdir_r
-#else
-PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry,
- struct dirent **result);
-#endif
-
-#if !defined(HAVE_LOCALTIME_R) && defined(HAVE_LOCALTIME)
-#define PHP_NEED_REENTRANCY 1
-PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm);
-#else
-#define php_localtime_r localtime_r
-#ifdef MISSING_LOCALTIME_R_DECL
-struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
-#endif
-#endif
-
-
-#if !defined(HAVE_CTIME_R) && defined(HAVE_CTIME)
-#define PHP_NEED_REENTRANCY 1
-PHPAPI char *php_ctime_r(const time_t *clock, char *buf);
-#else
-#define php_ctime_r ctime_r
-#ifdef MISSING_CTIME_R_DECL
-char *ctime_r(const time_t *clock, char *buf);
-#endif
-#endif
-
-
-#if !defined(HAVE_ASCTIME_R) && defined(HAVE_ASCTIME)
-#define PHP_NEED_REENTRANCY 1
-PHPAPI char *php_asctime_r(const struct tm *tm, char *buf);
-#else
-#define php_asctime_r asctime_r
-#ifdef MISSING_ASCTIME_R_DECL
-char *asctime_r(const struct tm *tm, char *buf);
-#endif
-#endif
-
-
-#if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME)
-#define PHP_NEED_REENTRANCY 1
-PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm);
-#else
-#define php_gmtime_r gmtime_r
-#ifdef MISSING_GMTIME_R_DECL
-struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm);
-#endif
-#endif
-
-#if !defined(HAVE_STRTOK_R)
-PHPAPI char *php_strtok_r(char *s, const char *delim, char **last);
-#else
-#define php_strtok_r strtok_r
-#ifdef MISSING_STRTOK_R_DECL
-char *strtok_r(char *s, const char *delim, char **last);
-#endif
-#endif
-
-#if !defined(HAVE_RAND_R)
-PHPAPI int php_rand_r(unsigned int *seed);
-#else
-#define php_rand_r rand_r
-#endif
-
-#if !defined(ZTS)
-#undef PHP_NEED_REENTRANCY
-#endif
-
-#if defined(PHP_NEED_REENTRANCY)
-void reentrancy_startup(void);
-void reentrancy_shutdown(void);
-#else
-#define reentrancy_startup()
-#define reentrancy_shutdown()
-#endif
-
-#endif
diff --git a/main/php_regex.h b/main/php_regex.h
deleted file mode 100644
index f4dc865163..0000000000
--- a/main/php_regex.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _PHP_REGEX_H
-#define _PHP_REGEX_H
-
-/*
- * REGEX means:
- * 0.. system regex
- * 1.. bundled regex
- */
-
-#if REGEX
-/* get aliases */
-#include "regex/regex_extra.h"
-#include "regex/regex.h"
-
-/* get rid of aliases */
-#define PHP_NO_ALIASES
-#include "regex/regex_extra.h"
-#undef PHP_NO_ALIASES
-
-#ifndef _REGEX_H
-#define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */
-#endif
-#ifndef _REGEX_H_
-#define _REGEX_H_ 1
-#endif
-#ifndef _RX_H
-#define _RX_H 1 /* Try defining these for Linux to */
-#endif
-#ifndef __REGEXP_LIBRARY_H__
-#define __REGEXP_LIBRARY_H__ 1 /* avoid Apache including regex.h */
-#endif
-#ifndef _H_REGEX
-#define _H_REGEX 1 /* This one is for AIX */
-#endif
-#elif REGEX == 0
-#include <regex.h>
-#ifndef _REGEX_H_
-#define _REGEX_H_ 1
-#endif
-#endif
-
-#endif /* _PHP_REGEX_H */
diff --git a/main/php_sprintf.c b/main/php_sprintf.c
deleted file mode 100644
index 4509f33da2..0000000000
--- a/main/php_sprintf.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jaakko Hyvätti <jaakko.hyvatti@iki.fi> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include "php_config.h"
-
-#if BROKEN_SPRINTF
-
-int
-php_sprintf (char*s, const char* format, ...)
-{
- va_list args;
- char *ret;
-
- va_start (args, format);
- s[0] = '\0';
- ret = vsprintf (s, format, args);
- va_end (args);
- if (!ret)
- return -1;
- return strlen (s);
-}
-
-#endif /* BROKEN_SPRINTF */
diff --git a/main/php_syslog.h b/main/php_syslog.h
deleted file mode 100644
index c9abb8f0c6..0000000000
--- a/main/php_syslog.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef PHP_SYSLOG_H
-#define PHP_SYSLOG_H
-
-#ifdef PHP_WIN32
-#include "win32/syslog.h"
-#else
-#include <syslog.h>
-#endif
-
-/*
- * SCO OpenServer 5 defines syslog to var_syslog/std_syslog which
- * causes trouble with our use of syslog. We define php_syslog
- * to be the system function syslog.
- */
-
-#ifdef syslog
-
-#if defined(var_syslog) && var_syslog == syslog
-#define php_syslog var_syslog
-#elif defined(std_syslog) && std_syslog == syslog
-#define php_syslog std_syslog
-#endif
-
-#endif
-
-#ifndef php_syslog
-#define php_syslog syslog
-#undef syslog
-#endif
-
-
-#endif
diff --git a/main/php_ticks.c b/main/php_ticks.c
deleted file mode 100644
index 7f53ef3741..0000000000
--- a/main/php_ticks.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Bakken <ssb@fast.no> |
- | |
- +----------------------------------------------------------------------+
- */
-
-#include "php.h"
-#include "php_ticks.h"
-
-int php_startup_ticks(PLS_D)
-{
- zend_llist_init(&PG(tick_functions), sizeof(PG(tick_functions)), NULL, 1);
- return SUCCESS;
-}
-
-void php_shutdown_ticks(PLS_D)
-{
- zend_llist_destroy(&PG(tick_functions));
-}
-
-static int php_compare_tick_functions(void *elem1, void *elem2)
-{
- return ((void (*)(int))elem1 == (void (*)(int))elem2);
-}
-
-PHPAPI int php_add_tick_function(void (*func)(int))
-{
- PLS_FETCH();
-
- zend_llist_add_element(&PG(tick_functions), func);
-
- return SUCCESS;
-}
-
-PHPAPI int php_remove_tick_function(void (*func)(int))
-{
- PLS_FETCH();
-
- zend_llist_del_element(&PG(tick_functions), func,
- (int(*)(void*,void*))php_compare_tick_functions);
- return SUCCESS;
-}
-
-void php_tick_iterator(void *data, void *arg)
-{
- void (*func)(int);
- func = (void(*)(int))data;
- func(*((int *)arg));
-}
-
-void php_run_ticks(int count)
-{
- PLS_FETCH();
-
- zend_llist_apply_with_argument(&PG(tick_functions), (void(*)(void*,void*))php_tick_iterator, &count);
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_ticks.h b/main/php_ticks.h
deleted file mode 100644
index 3b06448c1c..0000000000
--- a/main/php_ticks.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Bakken <ssb@fast.no> |
- | |
- +----------------------------------------------------------------------+
- */
-
-#ifndef _PHP_TICKS_H
-#define _PHP_TICKS_H
-
-struct _php_tick_function_entry {
- void (*func)(int count);
- struct _php_tick_function_entry *next;
-};
-
-int php_startup_ticks(PLS_D);
-void php_shutdown_ticks(PLS_D);
-void php_run_ticks(int count);
-PHPAPI int php_add_tick_function(void (*func)(int count));
-PHPAPI int php_remove_tick_function(void (*func)(int count));
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_variables.c b/main/php_variables.c
deleted file mode 100644
index 180a2c0d1d..0000000000
--- a/main/php_variables.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id: */
-
-#include <stdio.h>
-#include "php.h"
-#include "ext/standard/php_standard.h"
-#include "php_variables.h"
-#include "php_globals.h"
-#include "SAPI.h"
-
-#include "zend_globals.h"
-
-
-PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array ELS_DC PLS_DC)
-{
- zval new_entry;
-
- /* Prepare value */
- new_entry.value.str.len = strlen(strval);
- if (PG(magic_quotes_gpc)) {
- new_entry.value.str.val = php_addslashes(strval, new_entry.value.str.len, &new_entry.value.str.len, 0);
- } else {
- new_entry.value.str.val = estrndup(strval, new_entry.value.str.len);
- }
- new_entry.type = IS_STRING;
-
- php_register_variable_ex(var, &new_entry, track_vars_array ELS_CC PLS_CC);
-}
-
-
-PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array ELS_DC PLS_DC)
-{
- char *p = NULL;
- char *ip; /* index pointer */
- char *index;
- int var_len, index_len;
- zval *gpc_element, **gpc_element_p, **top_gpc_p=NULL;
- zend_bool is_array;
- zend_bool free_index;
- HashTable *symtable1=NULL;
- HashTable *symtable2=NULL;
-
- if (PG(register_globals)) {
- symtable1 = EG(active_symbol_table);
- }
- if (track_vars_array) {
- if (symtable1) {
- symtable2 = track_vars_array->value.ht;
- } else {
- symtable1 = track_vars_array->value.ht;
- }
- }
- if (!symtable1) {
- /* we don't need track_vars, and we're not setting GPC globals either. */
- zval_dtor(val);
- return;
- }
-
- /*
- * Prepare variable name
- */
- ip = strchr(var, '[');
- if (ip) {
- is_array = 1;
- *ip = 0;
- } else {
- is_array = 0;
- }
- /* ignore leading spaces in the variable name */
- while (*var && *var==' ') {
- var++;
- }
- var_len = strlen(var);
- if (var_len==0) { /* empty variable name, or variable name with a space in it */
- zval_dtor(val);
- return;
- }
- /* ensure that we don't have spaces or dots in the variable name (not binary safe) */
- for (p=var; *p; p++) {
- switch(*p) {
- case ' ':
- case '.':
- *p='_';
- break;
- }
- }
-
- index = var;
- index_len = var_len;
- free_index = 0;
-
- while (1) {
- if (is_array) {
- char *escaped_index;
-
- if (!index) {
- MAKE_STD_ZVAL(gpc_element);
- array_init(gpc_element);
- zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- } else {
- if (PG(magic_quotes_gpc) && (index!=var)) {
- /* no need to addslashes() the index if it's the main variable name */
- escaped_index = php_addslashes(index, index_len, &index_len, 0);
- } else {
- escaped_index = index;
- }
- if (zend_hash_find(symtable1, escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE
- || (*gpc_element_p)->type != IS_ARRAY) {
- MAKE_STD_ZVAL(gpc_element);
- array_init(gpc_element);
- zend_hash_update(symtable1, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- }
- if (index!=escaped_index) {
- efree(escaped_index);
- }
- }
- if (!top_gpc_p) {
- top_gpc_p = gpc_element_p;
- }
- symtable1 = (*gpc_element_p)->value.ht;
- /* ip pointed to the '[' character, now obtain the key */
- index = ++ip;
- index_len = 0;
- if (*ip=='\n' || *ip=='\r' || *ip=='\t' || *ip==' ') {
- ip++;
- }
- if (*ip==']') {
- index = NULL;
- } else {
- ip = strchr(ip, ']');
- if (!ip) {
- php_error(E_WARNING, "Missing ] in %s variable", var);
- return;
- }
- *ip = 0;
- index_len = strlen(index);
- }
- ip++;
- if (*ip=='[') {
- is_array = 1;
- *ip = 0;
- } else {
- is_array = 0;
- }
- } else {
- MAKE_STD_ZVAL(gpc_element);
- gpc_element->value = val->value;
- gpc_element->type = val->type;
- if (!index) {
- zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- } else {
- zend_hash_update(symtable1, index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- }
- if (!top_gpc_p) {
- top_gpc_p = gpc_element_p;
- }
- break;
- }
- }
-
- if (top_gpc_p) {
- if (symtable2) {
- zend_hash_update(symtable2, var, var_len+1, top_gpc_p, sizeof(zval *), NULL);
- (*top_gpc_p)->refcount++;
- }
- }
-}
-
-
-SAPI_POST_HANDLER_FUNC(php_std_post_handler)
-{
- char *var, *val;
- char *strtok_buf = NULL;
- zval *array_ptr = (zval *) arg;
- ELS_FETCH();
- PLS_FETCH();
-
- var = php_strtok_r(SG(request_info).post_data, "&", &strtok_buf);
-
- while (var) {
- val = strchr(var, '=');
- if (val) { /* have a value */
- *val++ = '\0';
- /* FIXME: XXX: not binary safe, discards returned length */
- php_url_decode(var, strlen(var));
- php_url_decode(val, strlen(val));
- php_register_variable(var, val, array_ptr ELS_CC PLS_CC);
- }
- var = php_strtok_r(NULL, "&", &strtok_buf);
- }
-}
-
-
-void php_treat_data(int arg, char *str ELS_DC PLS_DC SLS_DC)
-{
- char *res = NULL, *var, *val;
- pval *array_ptr;
- int free_buffer=0;
- char *strtok_buf = NULL;
-
- switch (arg) {
- case PARSE_POST:
- case PARSE_GET:
- case PARSE_COOKIE:
- if (PG(track_vars)) {
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- switch (arg) {
- case PARSE_POST:
- PG(http_globals).post = array_ptr;
- break;
- case PARSE_GET:
- PG(http_globals).get = array_ptr;
- break;
- case PARSE_COOKIE:
- PG(http_globals).cookie = array_ptr;
- break;
- }
- } else {
- array_ptr=NULL;
- }
- break;
- default:
- array_ptr=NULL;
- break;
- }
-
- if (arg==PARSE_POST) {
- sapi_handle_post(array_ptr SLS_CC);
- return;
- }
-
- if (arg == PARSE_GET) { /* GET data */
- var = SG(request_info).query_string;
- if (var && *var) {
- res = (char *) estrdup(var);
- free_buffer = 1;
- } else {
- free_buffer = 0;
- }
- } else if (arg == PARSE_COOKIE) { /* Cookie data */
- var = SG(request_info).cookie_data;
- if (var && *var) {
- res = (char *) estrdup(var);
- free_buffer = 1;
- } else {
- free_buffer = 0;
- }
- } else if (arg == PARSE_STRING) { /* String data */
- res = str;
- free_buffer = 1;
- }
-
- if (!res) {
- return;
- }
-
- if (arg == PARSE_COOKIE) {
- var = php_strtok_r(res, ";", &strtok_buf);
- } else if (arg == PARSE_POST) {
- var = php_strtok_r(res, "&", &strtok_buf);
- } else {
- var = php_strtok_r(res, PG(arg_separator), &strtok_buf);
- }
-
- while (var) {
- val = strchr(var, '=');
- if (val) { /* have a value */
- *val++ = '\0';
- /* FIXME: XXX: not binary safe, discards returned length */
- php_url_decode(var, strlen(var));
- php_url_decode(val, strlen(val));
- php_register_variable(var, val, array_ptr ELS_CC PLS_CC);
- }
- if (arg == PARSE_COOKIE) {
- var = php_strtok_r(NULL, ";", &strtok_buf);
- } else {
- var = php_strtok_r(NULL, PG(arg_separator), &strtok_buf);
- }
- }
- if (free_buffer) {
- efree(res);
- }
-}
-
-
-
-void php_import_environment_variables(ELS_D PLS_DC)
-{
- char **env, *p, *t;
- zval *array_ptr=NULL;
-
- if (PG(track_vars)) {
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- PG(http_globals).environment = array_ptr;
- }
-
- for (env = environ; env != NULL && *env != NULL; env++) {
- p = strchr(*env, '=');
- if (!p) { /* malformed entry? */
- continue;
- }
- t = estrndup(*env, p - *env);
- php_register_variable(t, p+1, array_ptr ELS_CC PLS_CC);
- efree(t);
- }
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_variables.h b/main/php_variables.h
deleted file mode 100644
index 7c36d6fd28..0000000000
--- a/main/php_variables.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP HTML Embedded Scripting Language Version 3.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
- +----------------------------------------------------------------------+
- | This program is free software; you can redistribute it and/or modify |
- | it under the terms of one of the following licenses: |
- | |
- | A) the GNU General Public License as published by the Free Software |
- | Foundation; either version 2 of the License, or (at your option) |
- | any later version. |
- | |
- | B) the PHP License as published by the PHP Development Team and |
- | included in the distribution in the file: LICENSE |
- | |
- | 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 both licenses referred to here. |
- | If you did not, or have any questions about PHP licensing, please |
- | contact core@php.net. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef _PHP_VARIABLES_H
-#define _PHP_VARIABLES_H
-
-#include "php.h"
-#include "SAPI.h"
-
-#define PARSE_POST 0
-#define PARSE_GET 1
-#define PARSE_COOKIE 2
-#define PARSE_STRING 3
-
-void php_treat_data(int arg, char *str ELS_DC PLS_DC SLS_DC);
-void php_import_environment_variables(ELS_D PLS_DC);
-PHPAPI void php_register_variable(char *var, char *val, pval *track_vars_array ELS_DC PLS_DC);
-PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array ELS_DC PLS_DC);
-
-
-#endif /* _PHP_VARIABLES_H */
diff --git a/main/php_version.h b/main/php_version.h
deleted file mode 100644
index 846c5b3764..0000000000
--- a/main/php_version.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* automatically generated by configure */
-/* edit configure.in to change version number */
-#define PHP_VERSION "4.0.1-dev"
diff --git a/main/php_virtual_cwd.c b/main/php_virtual_cwd.c
deleted file mode 100644
index 03ba8f4b21..0000000000
--- a/main/php_virtual_cwd.c
+++ /dev/null
@@ -1,598 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | |
- +----------------------------------------------------------------------+
- */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdio.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <fcntl.h>
-
-#ifdef ZEND_WIN32
-#include "win95nt.h"
-#endif
-
-#include "php_virtual_cwd.h"
-#include "php_reentrancy.h" /* for php_strtok_r */
-
-#define VIRTUAL_CWD_DEBUG 0
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(cwd);
-
-cwd_state main_cwd_state; /* True global */
-
-#ifndef ZEND_WIN32
-#include <unistd.h>
-#else
-#include <direct.h>
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(mode) ((mode) & _S_IFDIR)
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG(mode) ((mode) & _S_IFREG)
-#endif
-
-#ifdef ZEND_WIN32
-#define php_strtok_r(a,b,c) strtok((a),(b))
-#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
-#define DEFAULT_SLASH '\\'
-#define TOKENIZER_STRING "/\\"
-
-#define IS_ABSOLUTE_PATH(path, len) \
- (len >= 2 && isalpha(path[0]) && path[1] == ':')
-
-#define COPY_WHEN_ABSOLUTE 2
-
-static int php_check_dots(const char *element, int n)
-{
- while (n-- > 0) if (element[n] != '.') break;
-
- return (n != -1);
-}
-
-#define IS_DIRECTORY_UP(element, len) \
- (len >= 2 && !php_check_dots(element, len))
-
-#define IS_DIRECTORY_CURRENT(element, len) \
- (len == 1 && ptr[0] == '.')
-
-
-#else
-#define IS_SLASH(c) ((c) == '/')
-#define DEFAULT_SLASH '/'
-#define TOKENIZER_STRING "/"
-#endif
-
-
-/* default macros */
-
-#ifndef IS_ABSOLUTE_PATH
-#define IS_ABSOLUTE_PATH(path, len) \
- (IS_SLASH(path[0]))
-#endif
-
-#ifndef IS_DIRECTORY_UP
-#define IS_DIRECTORY_UP(element, len) \
- (len == 2 && memcmp(element, "..", 2) == 0)
-#endif
-
-#ifndef IS_DIRECTORY_CURRENT
-#define IS_DIRECTORY_CURRENT(element, len) \
- (len == 1 && ptr[0] == '.')
-#endif
-
-#ifndef COPY_WHEN_ABSOLUTE
-#define COPY_WHEN_ABSOLUTE 0
-#endif
-
-/* define this to check semantics */
-#define IS_DIR_OK(s) (1)
-
-#ifndef IS_DIR_OK
-#define IS_DIR_OK(state) (php_is_dir_ok(state) == 0)
-#endif
-
-
-#define CWD_STATE_COPY(d, s) \
- (d)->cwd_length = (s)->cwd_length; \
- (d)->cwd = (char *) malloc((s)->cwd_length+1); \
- memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1);
-
-#define CWD_STATE_FREE(s) \
- free((s)->cwd);
-
-static int php_is_dir_ok(const cwd_state *state)
-{
- struct stat buf;
-
- if (stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode))
- return (0);
-
- return (1);
-}
-
-static int php_is_file_ok(const cwd_state *state)
-{
- struct stat buf;
-
- if (stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode))
- return (0);
-
- return (1);
-}
-
-static void cwd_globals_ctor(zend_cwd_globals *cwd_globals)
-{
- CWD_STATE_COPY(&cwd_globals->cwd, &main_cwd_state);
-}
-
-static void cwd_globals_dtor(zend_cwd_globals *cwd_globals)
-{
- CWD_STATE_FREE(&cwd_globals->cwd);
-}
-
-CWD_API void virtual_cwd_startup(void)
-{
- char cwd[1024]; /* Should probably use system define here */
- char *result;
-
- result = getcwd(cwd, sizeof(cwd));
- if (!result) {
- cwd[0] = '\0';
- }
- main_cwd_state.cwd = strdup(cwd);
- main_cwd_state.cwd_length = strlen(cwd);
-
- ZEND_INIT_MODULE_GLOBALS(cwd, cwd_globals_ctor, cwd_globals_dtor);
-}
-
-CWD_API void virtual_cwd_activate(char *filename)
-{
-#if VIRTUAL_CWD_DEBUG
- fprintf(stderr, "Changing dir to %s\n", filename);
-#endif
- if (filename) {
- virtual_chdir_file(filename);
- }
-}
-
-CWD_API void virtual_cwd_shutdown(void)
-{
-#ifndef ZTS
- cwd_globals_dtor(&cwd_globals);
-#endif
- free(main_cwd_state.cwd); /* Don't use CWD_STATE_FREE because the non global states will probably use emalloc()/efree() */
-}
-
-CWD_API char *virtual_getcwd_ex(int *length)
-{
- cwd_state *state;
- CWDLS_FETCH();
-
- state = &CWDG(cwd);
-
- if (state->cwd_length == 0) {
- char *retval;
-
- *length = 1;
- retval = (char *) malloc(2);
- retval[0] = DEFAULT_SLASH;
- retval[1] = '\0';
- return retval;
- }
-
-#ifdef ZEND_WIN32
- /* If we have something like C: */
- if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') {
- char *retval;
-
- *length = state->cwd_length+1;
- retval = (char *) malloc(*length+1);
- memcpy(retval, state->cwd, *length);
- retval[*length-1] = DEFAULT_SLASH;
- retval[*length] = '\0';
- return retval;
- }
-#endif
- *length = state->cwd_length;
- return strdup(state->cwd);
-}
-
-
-/* Same semantics as UNIX getcwd() */
-CWD_API char *virtual_getcwd(char *buf, size_t size)
-{
- size_t length;
- char *cwd;
-
- cwd = virtual_getcwd_ex(&length);
-
- if (buf == NULL) {
- return cwd;
- }
- if (length > size-1) {
- free(cwd);
- errno = ERANGE; /* Is this OK? */
- return NULL;
- }
- memcpy(buf, cwd, length+1);
- free(cwd);
- return buf;
-}
-
-/* Resolve path relatively to state and put the real path into state */
-/* returns 0 for ok, 1 for error */
-CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path)
-{
- int path_length = strlen(path);
- char *ptr, *path_copy;
- char *tok = NULL;
- int ptr_length;
- cwd_state *old_state;
- int ret = 0;
- int copy_amount = -1;
- char *free_path;
- zend_bool is_absolute = 0;
-
- if (path_length == 0)
- return (0);
-
- free_path = path_copy = estrndup(path, path_length);
-
- old_state = (cwd_state *) malloc(sizeof(cwd_state));
- CWD_STATE_COPY(old_state, state);
-#if VIRTUAL_CWD_DEBUG
- fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path);
-#endif
- if (IS_ABSOLUTE_PATH(path_copy, path_length)) {
- copy_amount = COPY_WHEN_ABSOLUTE;
- is_absolute = 1;
-#ifdef ZEND_WIN32
- } else if(IS_SLASH(path_copy[0])) {
- copy_amount = 2;
-#endif
- }
-
- if (copy_amount != -1) {
- state->cwd = (char *) realloc(state->cwd, copy_amount + 1);
- if (copy_amount) {
- if (is_absolute) {
- memcpy(state->cwd, path_copy, copy_amount);
- } else {
- memcpy(state->cwd, old_state->cwd, copy_amount);
- }
- }
- state->cwd[copy_amount] = '\0';
- state->cwd_length = copy_amount;
- path_copy += copy_amount;
- }
-
-
- ptr = php_strtok_r(path_copy, TOKENIZER_STRING, &tok);
- while (ptr) {
- ptr_length = strlen(ptr);
-
- if (IS_DIRECTORY_UP(ptr, ptr_length)) {
- char save;
-
- save = DEFAULT_SLASH;
-
-#define PREVIOUS state->cwd[state->cwd_length - 1]
-
- while (IS_ABSOLUTE_PATH(state->cwd, state->cwd_length) &&
- !IS_SLASH(PREVIOUS)) {
- save = PREVIOUS;
- PREVIOUS = '\0';
- state->cwd_length--;
- }
-
- if (!IS_ABSOLUTE_PATH(state->cwd, state->cwd_length)) {
- state->cwd[state->cwd_length++] = save;
- state->cwd[state->cwd_length] = '\0';
- } else {
- PREVIOUS = '\0';
- state->cwd_length--;
- }
- } else if (!IS_DIRECTORY_CURRENT(ptr, ptr_length)) {
- state->cwd = (char *) realloc(state->cwd, state->cwd_length+ptr_length+1+1);
- state->cwd[state->cwd_length] = DEFAULT_SLASH;
- memcpy(&state->cwd[state->cwd_length+1], ptr, ptr_length+1);
- state->cwd_length += (ptr_length+1);
- }
- ptr = php_strtok_r(NULL, TOKENIZER_STRING, &tok);
- }
-
- if (verify_path && verify_path(state)) {
- CWD_STATE_FREE(state);
-
- *state = *old_state;
-
- ret = 1;
- } else {
- CWD_STATE_FREE(old_state);
- }
-
- free(old_state);
-
- efree(free_path);
-#if VIRTUAL_CWD_DEBUG
- fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd);
-#endif
- return (ret);
-}
-
-CWD_API int virtual_chdir(char *path)
-{
- CWDLS_FETCH();
-
- return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok)?-1:0;
-}
-
-CWD_API int virtual_chdir_file(char *path)
-{
- int length = strlen(path);
- char *temp;
- int retval;
-
- if (length == 0) {
- return 1; /* Can't cd to empty string */
- }
- while(--length >= 0 && !IS_SLASH(path[length])) {
- }
-
- if (length == -1) {
- return virtual_chdir(path);
- }
-
- if (length == COPY_WHEN_ABSOLUTE && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */
- length++;
- }
- temp = (char *) malloc(length+1);
- memcpy(temp, path, length);
- temp[length] = 0;
-#if VIRTUAL_CWD_DEBUG
- fprintf (stderr, "Changing directory to %s\n", temp);
-#endif
- retval = virtual_chdir(temp);
- free(temp);
- return retval;
-}
-
-
-CWD_API int virtual_filepath(char *path, char **filepath)
-{
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- retval = virtual_file_ex(&new_state, path, php_is_file_ok);
-
- *filepath = new_state.cwd;
-
- return retval;
-}
-
-CWD_API FILE *virtual_fopen(const char *path, const char *mode)
-{
- cwd_state new_state;
- FILE *f;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL);
-
- f = fopen(new_state.cwd, mode);
-
- CWD_STATE_FREE(&new_state);
- return f;
-}
-
-CWD_API int virtual_open(const char *path, int flags, ...)
-{
- cwd_state new_state;
- int f;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL);
-
- if (flags & O_CREAT) {
- mode_t mode;
- va_list arg;
-
- va_start(arg, flags);
- mode = va_arg(arg, mode_t);
- va_end(arg);
-
- f = open(new_state.cwd, flags, mode);
- } else {
- f = open(new_state.cwd, flags);
- }
- CWD_STATE_FREE(&new_state);
- return f;
-}
-
-CWD_API int virtual_creat(const char *path, mode_t mode)
-{
- cwd_state new_state;
- int f;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL);
-
- f = creat(new_state.cwd, mode);
-
- CWD_STATE_FREE(&new_state);
- return f;
-}
-
-
-CWD_API int virtual_stat(const char *path, struct stat *buf)
-{
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL);
-
- retval = stat(new_state.cwd, buf);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-#ifndef ZEND_WIN32
-
-CWD_API int virtual_lstat(const char *path, struct stat *buf)
-{
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL);
-
- retval = lstat(new_state.cwd, buf);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-#endif
-
-CWD_API int virtual_unlink(const char *path)
-{
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL);
-
- retval = unlink(new_state.cwd);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-CWD_API int virtual_mkdir(const char *pathname, mode_t mode)
-{
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, pathname, NULL);
-
- retval = mkdir(new_state.cwd, mode);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-CWD_API int virtual_rmdir(const char *pathname)
-{
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, pathname, NULL);
-
- retval = rmdir(new_state.cwd);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-CWD_API DIR *virtual_opendir(const char *pathname)
-{
- cwd_state new_state;
- DIR *retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, pathname, NULL);
-
- retval = opendir(new_state.cwd);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-#if 0
-
-main(void)
-{
- cwd_state state;
- int length;
-
-#ifndef ZEND_WIN32
- state.cwd = malloc(PATH_MAX + 1);
- state.cwd_length = PATH_MAX;
-
- while (getcwd(state.cwd, state.cwd_length) == NULL && errno == ERANGE) {
- state.cwd_length <<= 1;
- state.cwd = realloc(state.cwd, state.cwd_length + 1);
- }
-#else
- state.cwd = strdup("d:\\foo\\bar");
-#endif
- state.cwd_length = strlen(state.cwd);
-
-#define T(a) \
- printf("[%s] $ cd %s\n", virtual_getcwd_ex(&state, &length), a); \
- virtual_chdir(&state, strdup(a)); \
- printf("new path is %s\n", virtual_getcwd_ex(&state, &length));
-
- T("..")
- T("...")
- T("foo")
- T("../bar")
- T(".../slash/../dot")
- T("//baz")
- T("andi/././././././///bar")
- T("../andi/../bar")
- T("...foo")
- T("D:/flash/zone")
- T("../foo/bar/../baz")
-
- return 0;
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_virtual_cwd.h b/main/php_virtual_cwd.h
deleted file mode 100644
index 9d6150a07c..0000000000
--- a/main/php_virtual_cwd.h
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef VIRTUAL_CWD_H
-#define VIRTUAL_CWD_H
-
-#include "zend.h"
-#include "zend_API.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifndef ZEND_WIN32
-#include <unistd.h>
-#endif
-
-#ifdef ZEND_WIN32
-#include "win32/readdir.h"
-#else
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-#endif
-
-#ifdef PHP_EXPORTS
-#define CWD_EXPORTS
-#endif
-
-#ifdef ZEND_WIN32
-# ifdef CWD_EXPORTS
-# define CWD_API __declspec(dllexport)
-# else
-# define CWD_API __declspec(dllimport)
-# endif
-#else
-#define CWD_API
-#endif
-
-typedef struct _cwd_state {
- char *cwd;
- int cwd_length;
-} cwd_state;
-
-typedef int (*verify_path_func)(const cwd_state *);
-
-CWD_API void virtual_cwd_startup(void);
-CWD_API void virtual_cwd_shutdown(void);
-CWD_API void virtual_cwd_activate(char *filename);
-CWD_API char *virtual_getcwd_ex(int *length);
-CWD_API char *virtual_getcwd(char *buf, size_t size);
-CWD_API int virtual_chdir(char *path);
-CWD_API int virtual_chdir_file(char *path);
-CWD_API int virtual_filepath(char *path, char **filepath);
-CWD_API FILE *virtual_fopen(const char *path, const char *mode);
-CWD_API int virtual_open(const char *path, int flags, ...);
-CWD_API int virtual_creat(const char *path, mode_t mode);
-CWD_API int virtual_stat(const char *path, struct stat *buf);
-#ifndef ZEND_WIN32
-CWD_API int virtual_lstat(const char *path, struct stat *buf);
-#endif
-CWD_API int virtual_unlink(const char *path);
-CWD_API int virtual_mkdir(const char *pathname, mode_t mode);
-CWD_API int virtual_rmdir(const char *pathname);
-CWD_API DIR *virtual_opendir(const char *pathname);
-
-CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path);
-
-ZEND_BEGIN_MODULE_GLOBALS(cwd)
- cwd_state cwd;
-ZEND_END_MODULE_GLOBALS(cwd)
-
-#ifdef ZTS
-# define CWDLS_D zend_cwd_globals *cwd_globals
-# define CWDLS_DC , CWDLS_D
-# define CWDLS_C cwd_globals
-# define CWDLS_CC , CWDLS_C
-# define CWDG(v) (cwd_globals->v)
-# define CWDLS_FETCH() zend_cwd_globals *cwd_globals = ts_resource(cwd_globals_id)
-#else
-# define CWDLS_D void
-# define CWDLS_DC
-# define CWDLS_C
-# define CWDLS_CC
-# define CWDG(v) (cwd_globals.v)
-# define CWDLS_FETCH()
-#endif
-
-#endif /* VIRTUAL_CWD_H */
diff --git a/main/reentrancy.c b/main/reentrancy.c
deleted file mode 100644
index 79e4f13da3..0000000000
--- a/main/reentrancy.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-
-#include <sys/types.h>
-#include <string.h>
-#include <errno.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#ifdef PHP_WIN32
-#include "win32/readdir.h"
-#endif
-
-#include "php_reentrancy.h"
-#include "ext/standard/php_rand.h" /* for RAND_MAX */
-
-enum {
- LOCALTIME_R,
- CTIME_R,
- ASCTIME_R,
- GMTIME_R,
- READDIR_R,
- NUMBER_OF_LOCKS
-};
-
-#if defined(PHP_NEED_REENTRANCY)
-
-#include <TSRM.h>
-
-static MUTEX_T reentrant_locks[NUMBER_OF_LOCKS];
-
-#define local_lock(x) tsrm_mutex_lock(reentrant_locks[x])
-#define local_unlock(x) tsrm_mutex_unlock(reentrant_locks[x])
-
-#else
-
-#define local_lock(x)
-#define local_unlock(x)
-
-#endif
-
-#if defined(PHP_HPUX_TIME_R)
-
-#define HAVE_LOCALTIME_R 1
-#define HAVE_CTIME_R 1
-#define HAVE_ASCTIME_R 1
-#define HAVE_GMTIME_R 1
-
-PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm)
-{
- if (localtime_r(timep, p_tm) == 0)
- return (p_tm);
- return (NULL);
-}
-
-PHPAPI char *php_ctime_r(const time_t *clock, char *buf)
-{
- if (ctime_r(clock, buf, 26) != -1)
- return (buf);
- return (NULL);
-}
-
-PHPAPI char *php_asctime_r(const struct tm *tm, char *buf)
-{
- if (asctime_r(tm, buf, 26) != -1)
- return (buf);
- return (NULL);
-}
-
-PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
-{
- if (gmtime_r(timep, p_tm) == 0)
- return (p_tm);
- return (NULL);
-}
-
-#endif
-
-#if !defined(HAVE_POSIX_READDIR_R)
-
-PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry,
- struct dirent **result)
-{
-#if defined(HAVE_OLD_READDIR_R)
- int ret;
-
- errno = 0;
-
- ret = readdir_r(dirp, entry);
-
- if (ret == 0)
- *result = entry;
- else if (errno == 0) {
- *result = NULL;
- ret = 0;
- }
-
- return ret;
-#else
- struct dirent *ptr;
- int ret = 0;
-
- local_lock(READDIR_R);
-
- errno = 0;
-
- ptr = readdir(dirp);
-
- if (!ptr && errno != 0)
- ret = errno;
-
- if (ptr)
- memcpy(entry, ptr, sizeof(*ptr));
-
- *result = ptr;
-
- local_unlock(READDIR_R);
-
- return ret;
-#endif
-}
-
-#endif
-
-#if !defined(HAVE_LOCALTIME_R) && defined(HAVE_LOCALTIME)
-
-PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm)
-{
- struct tm *tmp;
-
- local_lock(LOCALTIME_R);
-
- tmp = localtime(timep);
- if (tmp) {
- memcpy(p_tm, tmp, sizeof(struct tm));
- tmp = p_tm;
- }
-
- local_unlock(LOCALTIME_R);
-
- return tmp;
-}
-
-#endif
-
-#if !defined(HAVE_CTIME_R) && defined(HAVE_CTIME)
-
-PHPAPI char *php_ctime_r(const time_t *clock, char *buf)
-{
- char *tmp;
-
- local_lock(CTIME_R);
-
- tmp = ctime(clock);
- strcpy(buf, tmp);
-
- local_unlock(CTIME_R);
-
- return buf;
-}
-
-#endif
-
-#if !defined(HAVE_ASCTIME_R) && defined(HAVE_ASCTIME)
-
-PHPAPI char *php_asctime_r(const struct tm *tm, char *buf)
-{
- char *tmp;
-
- local_lock(ASCTIME_R);
-
- tmp = asctime(tm);
- strcpy(buf, tmp);
-
- local_unlock(ASCTIME_R);
-
- return buf;
-}
-
-#endif
-
-#if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME)
-
-PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
-{
- struct tm *tmp;
-
- local_lock(GMTIME_R);
-
- tmp = gmtime(timep);
- memcpy(p_tm, tmp, sizeof(struct tm));
-
- local_unlock(GMTIME_R);
-
- return p_tm;
-}
-
-#endif
-
-#if defined(PHP_NEED_REENTRANCY)
-
-void reentrancy_startup(void)
-{
- int i;
-
- for (i = 0; i < NUMBER_OF_LOCKS; i++) {
- reentrant_locks[i] = tsrm_mutex_alloc();
- }
-}
-
-void reentrancy_shutdown(void)
-{
- int i;
-
- for (i = 0; i < NUMBER_OF_LOCKS; i++) {
- tsrm_mutex_free(reentrant_locks[i]);
- }
-}
-
-#endif
-
-#ifndef HAVE_RAND_R
-
-/*-
- * Copyright (c) 1990, 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 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.
- *
- * Posix rand_r function added May 1999 by Wes Peters <wes@softweyr.com>.
- */
-
-#include <sys/types.h>
-#include <stdlib.h>
-
-static int
-do_rand(unsigned long *ctx)
-{
- return ((*ctx = *ctx * 1103515245 + 12345) % ((u_long)RAND_MAX + 1));
-}
-
-
-PHPAPI int
-php_rand_r(unsigned int *ctx)
-{
- u_long val = (u_long) *ctx;
- *ctx = do_rand(&val);
- return (int) *ctx;
-}
-
-#endif
-
-
-#ifndef HAVE_STRTOK_R
-
-/*
- * Copyright (c) 1998 Softweyr LLC. All rights reserved.
- *
- * strtok_r, from Berkeley strtok
- * Oct 13, 1998 by Wes Peters <wes@softweyr.com>
- *
- * Copyright (c) 1988, 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
- * notices, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notices, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- *
- * This product includes software developed by Softweyr LLC, the
- * University of California, Berkeley, and its contributors.
- *
- * 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 SOFTWEYR LLC, 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 SOFTWEYR LLC, 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.
- */
-
-#include <stddef.h>
-
-PHPAPI char *
-php_strtok_r(char *s, const char *delim, char **last)
-{
- char *spanp;
- int c, sc;
- char *tok;
-
- if (s == NULL && (s = *last) == NULL)
- {
- return NULL;
- }
-
- /*
- * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
- */
-cont:
- c = *s++;
- for (spanp = (char *)delim; (sc = *spanp++) != 0; )
- {
- if (c == sc)
- {
- goto cont;
- }
- }
-
- if (c == 0) /* no non-delimiter characters */
- {
- *last = NULL;
- return NULL;
- }
- tok = s - 1;
-
- /*
- * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
- * Note that delim must have one NUL; we stop if we see that, too.
- */
- for (;;)
- {
- c = *s++;
- spanp = (char *)delim;
- do
- {
- if ((sc = *spanp++) == c)
- {
- if (c == 0)
- {
- s = NULL;
- }
- else
- {
- char *w = s - 1;
- *w = '\0';
- }
- *last = s;
- return tok;
- }
- }
- while (sc != 0);
- }
- /* NOTREACHED */
-}
-
-#endif
diff --git a/main/rfc1867.c b/main/rfc1867.c
deleted file mode 100644
index b6a7aeac17..0000000000
--- a/main/rfc1867.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-#include "php.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/file.h" /* for php_file_le_uploads() */
-#include "zend_globals.h"
-#include "php_globals.h"
-#include "php_variables.h"
-#include "rfc1867.h"
-
-
-#define NEW_BOUNDARY_CHECK 1
-#define SAFE_RETURN { if (namebuf) efree(namebuf); if (filenamebuf) efree(filenamebuf); if (lbuf) efree(lbuf); if (abuf) efree(abuf); if(arr_index) efree(arr_index); return; }
-
-/* The longest property name we use in an uploaded file array */
-#define MAX_SIZE_OF_INDEX sizeof("[tmp_name]")
-
-
-static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files ELS_DC PLS_DC)
-{
- int register_globals = PG(register_globals);
-
- PG(register_globals) = 0;
- php_register_variable(strvar, val, http_post_files ELS_CC PLS_CC);
- PG(register_globals) = register_globals;
-}
-
-
-static void register_http_post_files_variable_ex(char *var, zval *val, zval *http_post_files ELS_DC PLS_DC)
-{
- int register_globals = PG(register_globals);
-
- PG(register_globals) = 0;
- php_register_variable_ex(var, val, http_post_files ELS_CC PLS_CC);
- PG(register_globals) = register_globals;
-}
-
-
-/*
- * Split raw mime stream up into appropriate components
- */
-static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr)
-{
- char *ptr, *loc, *loc2, *s, *name, *filename, *u, *fn;
- int len, state = 0, Done = 0, rem, urem;
- int eolsize;
- long bytes, max_file_size = 0;
- char *namebuf=NULL, *filenamebuf=NULL, *lbuf=NULL,
- *abuf=NULL, *start_arr=NULL, *end_arr=NULL, *arr_index=NULL;
- FILE *fp;
- int itype, is_arr_upload=0, arr_len=0;
- zval *http_post_files=NULL;
- ELS_FETCH();
- PLS_FETCH();
-
- if (PG(track_vars)) {
- ALLOC_ZVAL(http_post_files);
- array_init(http_post_files);
- INIT_PZVAL(http_post_files);
- PG(http_globals).post_files = http_post_files;
- }
-
-
- ptr = buf;
- rem = cnt;
- len = strlen(boundary);
- while ((ptr - buf < cnt) && !Done) {
- switch (state) {
- case 0: /* Looking for mime boundary */
- loc = memchr(ptr, *boundary, cnt);
- if (loc) {
- if (!strncmp(loc, boundary, len)) {
-
- state = 1;
-
- eolsize = 2;
- if(*(loc+len)==0x0a) {
- eolsize = 1;
- }
-
- rem -= (loc - ptr) + len + eolsize;
- ptr = loc + len + eolsize;
- } else {
- rem -= (loc - ptr) + 1;
- ptr = loc + 1;
- }
- } else {
- Done = 1;
- }
- break;
- case 1: /* Check content-disposition */
- if (strncasecmp(ptr, "Content-Disposition: form-data;", 31)) {
- if (rem < 31) {
- SAFE_RETURN;
- }
- php_error(E_WARNING, "File Upload Mime headers garbled [%c%c%c%c%c]", *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), *(ptr + 4));
- SAFE_RETURN;
- }
- loc = memchr(ptr, '\n', rem);
- name = strstr(ptr, " name=\"");
- if (name && name < loc) {
- name += 7;
- s = memchr(name, '\"', loc - name);
- if (!s) {
- php_error(E_WARNING, "File Upload Mime headers garbled [%c%c%c%c%c]", *name, *(name + 1), *(name + 2), *(name + 3), *(name + 4));
- SAFE_RETURN;
- }
- if (namebuf) {
- efree(namebuf);
- }
- namebuf = estrndup(name, s-name);
- if (lbuf) {
- efree(lbuf);
- }
- lbuf = emalloc(s-name + MAX_SIZE_OF_INDEX);
- state = 2;
- loc2 = memchr(loc + 1, '\n', rem);
- rem -= (loc2 - ptr) + 1;
- ptr = loc2 + 1;
- /* is_arr_upload is true when name of file upload field
- * ends in [.*]
- * start_arr is set to point to 1st [
- * end_arr points to last ]
- */
- is_arr_upload = (start_arr = strrchr(namebuf,'[')) &&
- (end_arr = strrchr(namebuf,']')) &&
- (end_arr = namebuf+strlen(namebuf)-1);
- if(is_arr_upload) {
- arr_len = strlen(start_arr);
- if(arr_index) efree(arr_index);
- arr_index = estrndup(start_arr+1,arr_len-1);
- }
- } else {
- php_error(E_WARNING, "File upload error - no name component in content disposition");
- SAFE_RETURN;
- }
- filename = strstr(s, " filename=\"");
- if (filename && filename < loc) {
- filename += 11;
- s = memchr(filename, '\"', loc - filename);
- if (!s) {
- php_error(E_WARNING, "File Upload Mime headers garbled [%c%c%c%c%c]", *filename, *(filename + 1), *(filename + 2), *(filename + 3), *(filename + 4));
- SAFE_RETURN;
- }
- if (filenamebuf) {
- efree(filenamebuf);
- }
- filenamebuf = estrndup(filename, s-filename);
-
- /* Add $foo_name */
- if (is_arr_upload) {
- if (abuf) {
- efree(abuf);
- }
- abuf = estrndup(namebuf, strlen(namebuf)-arr_len);
- sprintf(lbuf, "%s_name[%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s_name", namebuf);
- }
- s = strrchr(filenamebuf, '\\');
- if (s && s > filenamebuf) {
- php_register_variable(lbuf, s+1, NULL ELS_CC PLS_CC);
- } else {
- php_register_variable(lbuf, filenamebuf, NULL ELS_CC PLS_CC);
- }
-
- /* Add $foo[name] */
- if (is_arr_upload) {
- sprintf(lbuf, "%s[name][%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s[name]", namebuf);
- }
- if (s && s > filenamebuf) {
- register_http_post_files_variable(lbuf, s+1, http_post_files ELS_CC PLS_CC);
- } else {
- register_http_post_files_variable(lbuf, filenamebuf, http_post_files ELS_CC PLS_CC);
- }
-
- state = 3;
- if ((loc2 - loc) > 2) {
- if (!strncasecmp(loc + 1, "Content-Type:", 13)) {
- *(loc2 - 1) = '\0';
-
- /* Add $foo_type */
- if (is_arr_upload) {
- sprintf(lbuf, "%s_type[%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s_type", namebuf);
- }
- php_register_variable(lbuf, loc+15, NULL ELS_CC PLS_CC);
-
- /* Add $foo[type] */
- if (is_arr_upload) {
- sprintf(lbuf, "%s[type][%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s[type]", namebuf);
- }
- register_http_post_files_variable(lbuf, loc+15, http_post_files ELS_CC PLS_CC);
-
- *(loc2 - 1) = '\n';
- }
- rem -= 2;
- ptr += 2;
- }
- }
- break;
-
- case 2: /* handle form-data fields */
- loc = memchr(ptr, *boundary, rem);
- u = ptr;
- while (loc) {
- if (!strncmp(loc, boundary, len))
- break;
- u = loc + 1;
- urem = rem - (loc - ptr) - 1;
- loc = memchr(u, *boundary, urem);
- }
- if (!loc) {
- php_error(E_WARNING, "File Upload Field Data garbled");
- SAFE_RETURN;
- }
- *(loc - 4) = '\0';
-
- php_register_variable(namebuf, ptr, array_ptr ELS_CC PLS_CC);
-
- /* And a little kludge to pick out special MAX_FILE_SIZE */
- itype = php_check_ident_type(namebuf);
- if (itype) {
- u = strchr(namebuf, '[');
- if (u)
- *u = '\0';
- }
- if (!strcmp(namebuf, "MAX_FILE_SIZE")) {
- max_file_size = atol(ptr);
- }
- if (itype) {
- if (u)
- *u = '[';
- }
- rem -= (loc - ptr);
- ptr = loc;
- state = 0;
- break;
-
- case 3: /* Handle file */
- loc = memchr(ptr, *boundary, rem);
- u = ptr;
- while (loc) {
- if (!strncmp(loc, boundary, len)
-#if NEW_BOUNDARY_CHECK
- && (loc-2>buf && *(loc-2)=='-' && *(loc-1)=='-') /* ensure boundary is prefixed with -- */
- && (loc-2==buf || *(loc-3)=='\n') /* ensure beginning of line */
-#endif
- ) {
- break;
- }
- u = loc + 1;
- urem = rem - (loc - ptr) - 1;
- loc = memchr(u, *boundary, urem);
- }
- if (!loc) {
- php_error(E_WARNING, "File Upload Error - No Mime boundary found after start of file header");
- SAFE_RETURN;
- }
- bytes = 0;
- fn = tempnam(PG(upload_tmp_dir), "php");
- if ((loc - ptr - 4) > PG(upload_max_filesize)) {
- php_error(E_WARNING, "Max file size of %ld bytes exceeded - file [%s] not saved", PG(upload_max_filesize),namebuf);
- fn = "none";
- } else if (max_file_size && ((loc - ptr - 4) > max_file_size)) {
- php_error(E_WARNING, "Max file size exceeded - file [%s] not saved", namebuf);
- fn = "none";
- } else if ((loc - ptr - 4) <= 0) {
- fn = "none";
- } else {
- fp = V_FOPEN(fn, "wb");
- if (!fp) {
- php_error(E_WARNING, "File Upload Error - Unable to open temporary file [%s]", fn);
- SAFE_RETURN;
- }
- bytes = fwrite(ptr, 1, loc - ptr - 4, fp);
- fclose(fp);
- zend_list_insert(fn,php_file_le_uploads()); /* Tell PHP about the file so the destructor can unlink it later */
- if (bytes < (loc - ptr - 4)) {
- php_error(E_WARNING, "Only %d bytes were written, expected to write %ld", bytes, loc - ptr - 4);
- }
- }
- php_register_variable(namebuf, fn, NULL ELS_CC PLS_CC);
-
- /* Add $foo[tmp_name] */
- if(is_arr_upload) {
- sprintf(lbuf, "%s[tmp_name][%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s[tmp_name]", namebuf);
- }
- register_http_post_files_variable(lbuf, fn, http_post_files ELS_CC PLS_CC);
- {
- zval file_size;
-
- file_size.value.lval = bytes;
- file_size.type = IS_LONG;
-
- /* Add $foo_size */
- if(is_arr_upload) {
- sprintf(lbuf, "%s_size[%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s_size", namebuf);
- }
- php_register_variable_ex(lbuf, &file_size, NULL ELS_CC PLS_CC);
-
- /* Add $foo[size] */
- if(is_arr_upload) {
- sprintf(lbuf, "%s[size][%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s[size]", namebuf);
- }
- register_http_post_files_variable_ex(lbuf, &file_size, http_post_files ELS_CC PLS_CC);
- }
- state = 0;
- rem -= (loc - ptr);
- ptr = loc;
- break;
- }
- }
- SAFE_RETURN;
-}
-
-
-SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
-{
- char *boundary;
- uint boundary_len;
- zval *array_ptr = (zval *) arg;
-
- boundary = strstr(content_type_dup, "boundary");
- if (!boundary || !(boundary=strchr(boundary, '='))) {
- sapi_module.sapi_error(E_COMPILE_ERROR, "Missing boundary in multipart/form-data POST data");
- return;
- }
- boundary++;
- boundary_len = strlen(boundary);
-
- if (SG(request_info).post_data) {
- php_mime_split(SG(request_info).post_data, SG(request_info).post_data_length, boundary, array_ptr);
- }
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/rfc1867.h b/main/rfc1867.h
deleted file mode 100644
index b50cf46549..0000000000
--- a/main/rfc1867.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _RFC1867_H
-#define _RFC1867_H
-
-#include "SAPI.h"
-
-#define MULTIPART_CONTENT_TYPE "multipart/form-data"
-
-SAPI_POST_READER_FUNC(rfc1867_post_reader);
-SAPI_POST_HANDLER_FUNC(rfc1867_post_handler);
-
-#define FILE_UPLOAD_INPUT_BUFFER_SIZE 8192
-
-#endif /* _RFC1867_H */
diff --git a/main/safe_mode.c b/main/safe_mode.c
deleted file mode 100644
index e7bb879362..0000000000
--- a/main/safe_mode.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-#include "ext/standard/pageinfo.h"
-#include "safe_mode.h"
-#include "SAPI.h"
-
-/*
- * php_checkuid
- *
- * This function has four modes:
- *
- * 0 - return invalid (0) if file does not exist
- * 1 - return valid (1) if file does not exist
- * 2 - if file does not exist, check directory
- * 3 - only check directory (needed for mkdir)
- */
-PHPAPI int php_checkuid(const char *fn, int mode) {
- struct stat sb;
- int ret;
- long uid=0L, duid=0L;
- char *s;
-
- if (!fn) return(0); /* path must be provided */
-
- /*
- * If given filepath is a URL, allow - safe mode stuff
- * related to URL's is checked in individual functions
- */
- if (!strncasecmp(fn,"http://",7) || !strncasecmp(fn,"ftp://",6)) {
- return(1);
- }
-
- if (mode<3) {
- ret = V_STAT(fn,&sb);
- if (ret<0 && mode < 2) {
- php_error(E_WARNING,"Unable to access %s",fn);
- return(mode);
- }
- if (ret>-1) {
- uid=sb.st_uid;
- if (uid==php_getuid()) return(1);
- }
- }
- s = strrchr(fn,'/');
-
- /* This loop gets rid of trailing slashes which could otherwise be
- * used to confuse the function.
- */
- while(s && *(s+1)=='\0' && s>fn) {
- *s='\0';
- s = strrchr(fn,'/');
- }
-
- if (s) {
- *s='\0';
- ret = V_STAT(fn,&sb);
- *s='/';
- if (ret<0) {
- php_error(E_WARNING, "Unable to access %s",fn);
- return(0);
- }
- duid = sb.st_uid;
- } else {
- s = emalloc(MAXPATHLEN+1);
- if (!V_GETCWD(s,MAXPATHLEN)) {
- php_error(E_WARNING, "Unable to access current working directory");
- return(0);
- }
- ret = V_STAT(s,&sb);
- efree(s);
- if (ret<0) {
- php_error(E_WARNING, "Unable to access %s",s);
- return(0);
- }
- duid = sb.st_uid;
- }
- if (duid == (uid=php_getuid())) return(1);
- else {
- php_error(E_WARNING, "SAFE MODE Restriction in effect. The script whose uid is %ld is not allowed to access %s owned by uid %ld",uid,fn,duid);
- return(0);
- }
-}
-
-
-PHPAPI char *php_get_current_user()
-{
- struct passwd *pwd;
- struct stat *pstat;
- SLS_FETCH();
-
- if (SG(request_info).current_user) {
- return SG(request_info).current_user;
- }
-
- /* FIXME: I need to have this somehow handled if
- USE_SAPI is defined, because cgi will also be
- interfaced in USE_SAPI */
-
- pstat = sapi_get_stat();
-
- if (!pstat) {
- return empty_string;
- }
-
- if ((pwd=getpwuid(pstat->st_uid))==NULL) {
- return empty_string;
- }
- SG(request_info).current_user_length = strlen(pwd->pw_name);
- SG(request_info).current_user = estrndup(pwd->pw_name, SG(request_info).current_user_length);
-
- return SG(request_info).current_user;
-}
diff --git a/main/safe_mode.h b/main/safe_mode.h
deleted file mode 100644
index 8fba1db8c5..0000000000
--- a/main/safe_mode.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _SAFE_MODE_H_
-#define _SAFE_MODE_H_
-
-extern PHPAPI int php_checkuid(const char *filename, int mode);
-extern PHPAPI char *php_get_current_user(void);
-
-#endif
diff --git a/main/snprintf.c b/main/snprintf.c
deleted file mode 100644
index b3afec1146..0000000000
--- a/main/snprintf.c
+++ /dev/null
@@ -1,932 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1995-1998 The Apache Group. 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission.
- *
- * 5. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
- * EXPRESSED 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 APACHE GROUP OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Group and was originally based
- * on public domain software written at the National Center for
- * Supercomputing Applications, University of Illinois, Urbana-Champaign.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- * This code is based on, and used with the permission of, the
- * SIO stdio-replacement strx_* functions by Panos Tsirigotis
- * <panos@alumni.cs.colorado.edu> for xinetd.
- */
-
-#include "php.h"
-
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
-
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-
-
-#ifdef HAVE_GCVT
-
-#define ap_php_ecvt ecvt
-#define ap_php_fcvt fcvt
-#define ap_php_gcvt gcvt
-
-#else
-
-/*
- * cvt.c - IEEE floating point formatting routines for FreeBSD
- * from GNU libc-4.6.27
- */
-
-/*
- * ap_php_ecvt converts to decimal
- * the number of digits is specified by ndigit
- * decpt is set to the position of the decimal point
- * sign is set to 0 for positive, 1 for negative
- */
-
-#define NDIG 80
-
-static char *
- ap_php_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag)
-{
- register int r2;
- double fi, fj;
- register char *p, *p1;
- static char buf[NDIG];
-
- if (ndigits >= NDIG - 1)
- ndigits = NDIG - 2;
- r2 = 0;
- *sign = 0;
- p = &buf[0];
- if (arg < 0) {
- *sign = 1;
- arg = -arg;
- }
- arg = modf(arg, &fi);
- p1 = &buf[NDIG];
- /*
- * Do integer part
- */
- if (fi != 0) {
- p1 = &buf[NDIG];
- while (fi != 0) {
- fj = modf(fi / 10, &fi);
- *--p1 = (int) ((fj + .03) * 10) + '0';
- r2++;
- }
- while (p1 < &buf[NDIG])
- *p++ = *p1++;
- } else if (arg > 0) {
- while ((fj = arg * 10) < 1) {
- arg = fj;
- r2--;
- }
- }
- p1 = &buf[ndigits];
- if (eflag == 0)
- p1 += r2;
- *decpt = r2;
- if (p1 < &buf[0]) {
- buf[0] = '\0';
- return (buf);
- }
- while (p <= p1 && p < &buf[NDIG]) {
- arg *= 10;
- arg = modf(arg, &fj);
- *p++ = (int) fj + '0';
- }
- if (p1 >= &buf[NDIG]) {
- buf[NDIG - 1] = '\0';
- return (buf);
- }
- p = p1;
- *p1 += 5;
- while (*p1 > '9') {
- *p1 = '0';
- if (p1 > buf)
- ++ * --p1;
- else {
- *p1 = '1';
- (*decpt)++;
- if (eflag == 0) {
- if (p > buf)
- *p = '0';
- p++;
- }
- }
- }
- *p = '\0';
- return (buf);
-}
-
-static char *
- ap_php_ecvt(double arg, int ndigits, int *decpt, int *sign)
-{
- return (ap_php_cvt(arg, ndigits, decpt, sign, 1));
-}
-
-static char *
- ap_php_fcvt(double arg, int ndigits, int *decpt, int *sign)
-{
- return (ap_php_cvt(arg, ndigits, decpt, sign, 0));
-}
-
-/*
- * ap_php_gcvt - Floating output conversion to
- * minimal length string
- */
-
-static char *
- ap_php_gcvt(double number, int ndigit, char *buf)
-{
- int sign, decpt;
- register char *p1, *p2;
- register i;
-
- p1 = ap_php_ecvt(number, ndigit, &decpt, &sign);
- p2 = buf;
- if (sign)
- *p2++ = '-';
- for (i = ndigit - 1; i > 0 && p1[i] == '0'; i--)
- ndigit--;
- if ((decpt >= 0 && decpt - ndigit > 4)
- || (decpt < 0 && decpt < -3)) { /* use E-style */
- decpt--;
- *p2++ = *p1++;
- *p2++ = '.';
- for (i = 1; i < ndigit; i++)
- *p2++ = *p1++;
- *p2++ = 'e';
- if (decpt < 0) {
- decpt = -decpt;
- *p2++ = '-';
- } else
- *p2++ = '+';
- if (decpt / 100 > 0)
- *p2++ = decpt / 100 + '0';
- if (decpt / 10 > 0)
- *p2++ = (decpt % 100) / 10 + '0';
- *p2++ = decpt % 10 + '0';
- } else {
- if (decpt <= 0) {
- if (*p1 != '0')
- *p2++ = '.';
- while (decpt < 0) {
- decpt++;
- *p2++ = '0';
- }
- }
- for (i = 1; i <= ndigit; i++) {
- *p2++ = *p1++;
- if (i == decpt)
- *p2++ = '.';
- }
- if (ndigit < decpt) {
- while (ndigit++ < decpt)
- *p2++ = '0';
- *p2++ = '.';
- }
- }
- if (p2[-1] == '.')
- p2--;
- *p2 = '\0';
- return (buf);
-}
-
-#endif /* HAVE_CVT */
-
-typedef enum {
- NO = 0, YES = 1
-} boolean_e;
-
-#define FALSE 0
-#define TRUE 1
-#define NUL '\0'
-#define INT_NULL ((int *)0)
-#define WIDE_INT long
-
-typedef WIDE_INT wide_int;
-typedef unsigned WIDE_INT u_wide_int;
-typedef int bool_int;
-
-#define S_NULL "(null)"
-#define S_NULL_LEN 6
-
-#define FLOAT_DIGITS 6
-#define EXPONENT_LENGTH 10
-
-/*
- * NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions
- *
- * XXX: this is a magic number; do not decrease it
- */
-#define NUM_BUF_SIZE 512
-
-
-/*
- * Descriptor for buffer area
- */
-struct buf_area {
- char *buf_end;
- char *nextb; /* pointer to next byte to read/write */
-};
-
-typedef struct buf_area buffy;
-
-/*
- * The INS_CHAR macro inserts a character in the buffer and writes
- * the buffer back to disk if necessary
- * It uses the char pointers sp and bep:
- * sp points to the next available character in the buffer
- * bep points to the end-of-buffer+1
- * While using this macro, note that the nextb pointer is NOT updated.
- *
- * NOTE: Evaluation of the c argument should not have any side-effects
- */
-#define INS_CHAR( c, sp, bep, cc ) \
- { \
- if ( sp < bep ) \
- { \
- *sp++ = c ; \
- cc++ ; \
- } \
- }
-
-#define NUM( c ) ( c - '0' )
-
-#define STR_TO_DEC( str, num ) \
- num = NUM( *str++ ) ; \
- while ( isdigit((int)*str ) ) \
- { \
- num *= 10 ; \
- num += NUM( *str++ ) ; \
- }
-
-/*
- * This macro does zero padding so that the precision
- * requirement is satisfied. The padding is done by
- * adding '0's to the left of the string that is going
- * to be printed.
- */
-#define FIX_PRECISION( adjust, precision, s, s_len ) \
- if ( adjust ) \
- while ( s_len < precision ) \
- { \
- *--s = '0' ; \
- s_len++ ; \
- }
-
-/*
- * Macro that does padding. The padding is done by printing
- * the character ch.
- */
-#define PAD( width, len, ch ) do \
- { \
- INS_CHAR( ch, sp, bep, cc ) ; \
- width-- ; \
- } \
- while ( width > len )
-
-/*
- * Prefix the character ch to the string str
- * Increase length
- * Set the has_prefix flag
- */
-#define PREFIX( str, length, ch ) *--str = ch ; length++ ; has_prefix = YES
-
-
-/*
- * Convert num to its decimal format.
- * Return value:
- * - a pointer to a string containing the number (no sign)
- * - len contains the length of the string
- * - is_negative is set to TRUE or FALSE depending on the sign
- * of the number (always set to FALSE if is_unsigned is TRUE)
- *
- * The caller provides a buffer for the string: that is the buf_end argument
- * which is a pointer to the END of the buffer + 1 (i.e. if the buffer
- * is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
- */
-static char *
- conv_10(register wide_int num, register bool_int is_unsigned,
- register bool_int * is_negative, char *buf_end, register int *len)
-{
- register char *p = buf_end;
- register u_wide_int magnitude;
-
- if (is_unsigned) {
- magnitude = (u_wide_int) num;
- *is_negative = FALSE;
- } else {
- *is_negative = (num < 0);
-
- /*
- * On a 2's complement machine, negating the most negative integer
- * results in a number that cannot be represented as a signed integer.
- * Here is what we do to obtain the number's magnitude:
- * a. add 1 to the number
- * b. negate it (becomes positive)
- * c. convert it to unsigned
- * d. add 1
- */
- if (*is_negative) {
- wide_int t = num + 1;
-
- magnitude = ((u_wide_int) - t) + 1;
- } else
- magnitude = (u_wide_int) num;
- }
-
- /*
- * We use a do-while loop so that we write at least 1 digit
- */
- do {
- register u_wide_int new_magnitude = magnitude / 10;
-
- *--p = magnitude - new_magnitude * 10 + '0';
- magnitude = new_magnitude;
- }
- while (magnitude);
-
- *len = buf_end - p;
- return (p);
-}
-
-
-
-/*
- * Convert a floating point number to a string formats 'f', 'e' or 'E'.
- * The result is placed in buf, and len denotes the length of the string
- * The sign is returned in the is_negative argument (and is not placed
- * in buf).
- */
-static char *
- conv_fp(register char format, register double num,
- boolean_e add_dp, int precision, bool_int * is_negative, char *buf, int *len)
-{
- register char *s = buf;
- register char *p;
- int decimal_point;
-
- if (format == 'f')
- p = ap_php_fcvt(num, precision, &decimal_point, is_negative);
- else /* either e or E format */
- p = ap_php_ecvt(num, precision + 1, &decimal_point, is_negative);
-
- /*
- * Check for Infinity and NaN
- */
- if (isalpha((int)*p)) {
- *len = strlen(strcpy(buf, p));
- *is_negative = FALSE;
- return (buf);
- }
- if (format == 'f') {
- if (decimal_point <= 0) {
- *s++ = '0';
- if (precision > 0) {
- *s++ = '.';
- while (decimal_point++ < 0)
- *s++ = '0';
- } else if (add_dp) {
- *s++ = '.';
- }
- } else {
- while (decimal_point-- > 0) {
- *s++ = *p++;
- }
- if (precision > 0 || add_dp) {
- *s++ = '.';
- }
- }
- } else {
- *s++ = *p++;
- if (precision > 0 || add_dp)
- *s++ = '.';
- }
-
- /*
- * copy the rest of p, the NUL is NOT copied
- */
- while (*p)
- *s++ = *p++;
-
- if (format != 'f') {
- char temp[EXPONENT_LENGTH]; /* for exponent conversion */
- int t_len;
- bool_int exponent_is_negative;
-
- *s++ = format; /* either e or E */
- decimal_point--;
- if (decimal_point != 0) {
- p = conv_10((wide_int) decimal_point, FALSE, &exponent_is_negative,
- &temp[EXPONENT_LENGTH], &t_len);
- *s++ = exponent_is_negative ? '-' : '+';
-
- /*
- * Make sure the exponent has at least 2 digits
- */
- if (t_len == 1)
- *s++ = '0';
- while (t_len--)
- *s++ = *p++;
- } else {
- *s++ = '+';
- *s++ = '0';
- *s++ = '0';
- }
- }
- *len = s - buf;
- return (buf);
-}
-
-
-/*
- * Convert num to a base X number where X is a power of 2. nbits determines X.
- * For example, if nbits is 3, we do base 8 conversion
- * Return value:
- * a pointer to a string containing the number
- *
- * The caller provides a buffer for the string: that is the buf_end argument
- * which is a pointer to the END of the buffer + 1 (i.e. if the buffer
- * is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
- */
-static char *
- conv_p2(register u_wide_int num, register int nbits,
- char format, char *buf_end, register int *len)
-{
- register int mask = (1 << nbits) - 1;
- register char *p = buf_end;
- static char low_digits[] = "0123456789abcdef";
- static char upper_digits[] = "0123456789ABCDEF";
- register char *digits = (format == 'X') ? upper_digits : low_digits;
-
- do {
- *--p = digits[num & mask];
- num >>= nbits;
- }
- while (num);
-
- *len = buf_end - p;
- return (p);
-}
-
-
-/*
- * Do format conversion placing the output in buffer
- */
-static int format_converter(register buffy * odp, const char *fmt,
- va_list ap)
-{
- register char *sp;
- register char *bep;
- register int cc = 0;
- register int i;
-
- register char *s = NULL;
- char *q;
- int s_len;
-
- register int min_width = 0;
- int precision = 0;
- enum {
- LEFT, RIGHT
- } adjust;
- char pad_char;
- char prefix_char;
-
- double fp_num;
- wide_int i_num = (wide_int) 0;
- u_wide_int ui_num;
-
- char num_buf[NUM_BUF_SIZE];
- char char_buf[2]; /* for printing %% and %<unknown> */
-
- /*
- * Flag variables
- */
- boolean_e is_long;
- boolean_e alternate_form;
- boolean_e print_sign;
- boolean_e print_blank;
- boolean_e adjust_precision;
- boolean_e adjust_width;
- bool_int is_negative;
-
- sp = odp->nextb;
- bep = odp->buf_end;
-
- while (*fmt) {
- if (*fmt != '%') {
- INS_CHAR(*fmt, sp, bep, cc);
- } else {
- /*
- * Default variable settings
- */
- adjust = RIGHT;
- alternate_form = print_sign = print_blank = NO;
- pad_char = ' ';
- prefix_char = NUL;
-
- fmt++;
-
- /*
- * Try to avoid checking for flags, width or precision
- */
- if (isascii((int)*fmt) && !islower((int)*fmt)) {
- /*
- * Recognize flags: -, #, BLANK, +
- */
- for (;; fmt++) {
- if (*fmt == '-')
- adjust = LEFT;
- else if (*fmt == '+')
- print_sign = YES;
- else if (*fmt == '#')
- alternate_form = YES;
- else if (*fmt == ' ')
- print_blank = YES;
- else if (*fmt == '0')
- pad_char = '0';
- else
- break;
- }
-
- /*
- * Check if a width was specified
- */
- if (isdigit((int)*fmt)) {
- STR_TO_DEC(fmt, min_width);
- adjust_width = YES;
- } else if (*fmt == '*') {
- min_width = va_arg(ap, int);
- fmt++;
- adjust_width = YES;
- if (min_width < 0) {
- adjust = LEFT;
- min_width = -min_width;
- }
- } else
- adjust_width = NO;
-
- /*
- * Check if a precision was specified
- *
- * XXX: an unreasonable amount of precision may be specified
- * resulting in overflow of num_buf. Currently we
- * ignore this possibility.
- */
- if (*fmt == '.') {
- adjust_precision = YES;
- fmt++;
- if (isdigit((int)*fmt)) {
- STR_TO_DEC(fmt, precision);
- } else if (*fmt == '*') {
- precision = va_arg(ap, int);
- fmt++;
- if (precision < 0)
- precision = 0;
- } else
- precision = 0;
- } else
- adjust_precision = NO;
- } else
- adjust_precision = adjust_width = NO;
-
- /*
- * Modifier check
- */
- if (*fmt == 'l') {
- is_long = YES;
- fmt++;
- } else
- is_long = NO;
-
- /*
- * Argument extraction and printing.
- * First we determine the argument type.
- * Then, we convert the argument to a string.
- * On exit from the switch, s points to the string that
- * must be printed, s_len has the length of the string
- * The precision requirements, if any, are reflected in s_len.
- *
- * NOTE: pad_char may be set to '0' because of the 0 flag.
- * It is reset to ' ' by non-numeric formats
- */
- switch (*fmt) {
- case 'u':
- if (is_long)
- i_num = va_arg(ap, u_wide_int);
- else
- i_num = (wide_int) va_arg(ap, unsigned int);
- /*
- * The rest also applies to other integer formats, so fall
- * into that case.
- */
- case 'd':
- case 'i':
- /*
- * Get the arg if we haven't already.
- */
- if ((*fmt) != 'u') {
- if (is_long)
- i_num = va_arg(ap, wide_int);
- else
- i_num = (wide_int) va_arg(ap, int);
- };
- s = conv_10(i_num, (*fmt) == 'u', &is_negative,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
-
- if (*fmt != 'u') {
- if (is_negative)
- prefix_char = '-';
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
- }
- break;
-
-
- case 'o':
- if (is_long)
- ui_num = va_arg(ap, u_wide_int);
- else
- ui_num = (u_wide_int) va_arg(ap, unsigned int);
- s = conv_p2(ui_num, 3, *fmt,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
- if (alternate_form && *s != '0') {
- *--s = '0';
- s_len++;
- }
- break;
-
-
- case 'x':
- case 'X':
- if (is_long)
- ui_num = (u_wide_int) va_arg(ap, u_wide_int);
- else
- ui_num = (u_wide_int) va_arg(ap, unsigned int);
- s = conv_p2(ui_num, 4, *fmt,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
- if (alternate_form && i_num != 0) {
- *--s = *fmt; /* 'x' or 'X' */
- *--s = '0';
- s_len += 2;
- }
- break;
-
-
- case 's':
- s = va_arg(ap, char *);
- if (s != NULL) {
- s_len = strlen(s);
- if (adjust_precision && precision < s_len)
- s_len = precision;
- } else {
- s = S_NULL;
- s_len = S_NULL_LEN;
- }
- pad_char = ' ';
- break;
-
-
- case 'f':
- case 'e':
- case 'E':
- fp_num = va_arg(ap, double);
-
- s = conv_fp(*fmt, fp_num, alternate_form,
- (adjust_precision == NO) ? FLOAT_DIGITS : precision,
- &is_negative, &num_buf[1], &s_len);
- if (is_negative)
- prefix_char = '-';
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
- break;
-
-
- case 'g':
- case 'G':
- if (adjust_precision == NO)
- precision = FLOAT_DIGITS;
- else if (precision == 0)
- precision = 1;
- /*
- * * We use &num_buf[ 1 ], so that we have room for the sign
- */
- s = ap_php_gcvt(va_arg(ap, double), precision, &num_buf[1]);
- if (*s == '-')
- prefix_char = *s++;
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
-
- s_len = strlen(s);
-
- if (alternate_form && (q = strchr(s, '.')) == NULL)
- s[s_len++] = '.';
- if (*fmt == 'G' && (q = strchr(s, 'e')) != NULL)
- *q = 'E';
- break;
-
-
- case 'c':
- char_buf[0] = (char) (va_arg(ap, int));
- s = &char_buf[0];
- s_len = 1;
- pad_char = ' ';
- break;
-
-
- case '%':
- char_buf[0] = '%';
- s = &char_buf[0];
- s_len = 1;
- pad_char = ' ';
- break;
-
-
- case 'n':
- *(va_arg(ap, int *)) = cc;
- break;
-
- /*
- * Always extract the argument as a "char *" pointer. We
- * should be using "void *" but there are still machines
- * that don't understand it.
- * If the pointer size is equal to the size of an unsigned
- * integer we convert the pointer to a hex number, otherwise
- * we print "%p" to indicate that we don't handle "%p".
- */
- case 'p':
- ui_num = (u_wide_int) va_arg(ap, char *);
-
- if (sizeof(char *) <= sizeof(u_wide_int))
- s = conv_p2(ui_num, 4, 'x',
- &num_buf[NUM_BUF_SIZE], &s_len);
- else {
- s = "%p";
- s_len = 2;
- }
- pad_char = ' ';
- break;
-
-
- case NUL:
- /*
- * The last character of the format string was %.
- * We ignore it.
- */
- continue;
-
-
- /*
- * The default case is for unrecognized %'s.
- * We print %<char> to help the user identify what
- * option is not understood.
- * This is also useful in case the user wants to pass
- * the output of format_converter to another function
- * that understands some other %<char> (like syslog).
- * Note that we can't point s inside fmt because the
- * unknown <char> could be preceded by width etc.
- */
- default:
- char_buf[0] = '%';
- char_buf[1] = *fmt;
- s = char_buf;
- s_len = 2;
- pad_char = ' ';
- break;
- }
-
- if (prefix_char != NUL) {
- *--s = prefix_char;
- s_len++;
- }
- if (adjust_width && adjust == RIGHT && min_width > s_len) {
- if (pad_char == '0' && prefix_char != NUL) {
- INS_CHAR(*s, sp, bep, cc)
- s++;
- s_len--;
- min_width--;
- }
- PAD(min_width, s_len, pad_char);
- }
- /*
- * Print the string s.
- */
- for (i = s_len; i != 0; i--) {
- INS_CHAR(*s, sp, bep, cc);
- s++;
- }
-
- if (adjust_width && adjust == LEFT && min_width > s_len)
- PAD(min_width, s_len, pad_char);
- }
- fmt++;
- }
- odp->nextb = sp;
- return (cc);
-}
-
-
-/*
- * This is the general purpose conversion function.
- */
-static void strx_printv(int *ccp, char *buf, size_t len, const char *format,
- va_list ap)
-{
- buffy od;
- int cc;
-
- /*
- * First initialize the descriptor
- * Notice that if no length is given, we initialize buf_end to the
- * highest possible address.
- */
- od.buf_end = len ? &buf[len] : (char *) ~0;
- od.nextb = buf;
-
- /*
- * Do the conversion
- */
- cc = format_converter(&od, format, ap);
- if (len == 0 || od.nextb <= od.buf_end)
- *(od.nextb) = '\0';
- if (ccp)
- *ccp = cc;
-}
-
-
-int ap_php_snprintf(char *buf, size_t len, const char *format,...)
-{
- int cc;
- va_list ap;
-
- va_start(ap, format);
- strx_printv(&cc, buf, (len - 1), format, ap);
- va_end(ap);
- return (cc);
-}
-
-
-int ap_php_vsnprintf(char *buf, size_t len, const char *format, va_list ap)
-{
- int cc;
-
- strx_printv(&cc, buf, (len - 1), format, ap);
- return (cc);
-}
-
-#endif /* HAVE_SNPRINTF */
diff --git a/main/snprintf.h b/main/snprintf.h
deleted file mode 100644
index 88900b980b..0000000000
--- a/main/snprintf.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef _PHP_SNPRINTF_H
-#define _PHP_SNPRINTF_H
-
-#ifndef HAVE_SNPRINTF
-extern int ap_php_snprintf(char *, size_t, const char *, ...);
-#define snprintf ap_php_snprintf
-#endif
-
-#ifndef HAVE_VSNPRINTF
-extern int ap_php_vsnprintf(char *, size_t, const char *, va_list ap);
-#define vsnprintf ap_php_vsnprintf
-#endif
-
-#if BROKEN_SPRINTF
-int php_sprintf (char* s, const char* format, ...);
-#define sprintf php_sprintf
-#endif
-
-#endif /* _PHP_SNPRINTF_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/strlcat.c b/main/strlcat.c
deleted file mode 100644
index fb390dfe91..0000000000
--- a/main/strlcat.c
+++ /dev/null
@@ -1,77 +0,0 @@
-#include "php.h"
-
-#ifndef HAVE_STRLCAT
-
-/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * 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.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Appends src to string dst of size siz (unlike strncat, siz is the
- * full size of dst, not space left). At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- */
-PHPAPI size_t strlcat(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
-{
- register char *d = dst;
- register const char *s = src;
- register size_t n = siz;
- size_t dlen;
-
- /* Find the end of dst and adjust bytes left but don't go past end */
- while (*d != '\0' && n-- != 0)
- d++;
- dlen = d - dst;
- n = siz - dlen;
-
- if (n == 0)
- return(dlen + strlen(s));
- while (*s != '\0') {
- if (n != 1) {
- *d++ = *s;
- n--;
- }
- s++;
- }
- *d = '\0';
-
- return(dlen + (s - src)); /* count does not include NUL */
-}
-
-#endif /* !HAVE_STRLCAT */
diff --git a/main/strlcpy.c b/main/strlcpy.c
deleted file mode 100644
index 382d8ba56e..0000000000
--- a/main/strlcpy.c
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "php.h"
-
-#ifndef HAVE_STRLCPY
-
-/* $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $ */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * 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.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Copy src to string dst of size siz. At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- */
-PHPAPI size_t strlcpy(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
-{
- register char *d = dst;
- register const char *s = src;
- register size_t n = siz;
-
- /* Copy as many bytes as will fit */
- if (n != 0 && --n != 0) {
- do {
- if ((*d++ = *s++) == 0)
- break;
- } while (--n != 0);
- }
-
- /* Not enough room in dst, add NUL and traverse rest of src */
- if (n == 0) {
- if (siz != 0)
- *d = '\0'; /* NUL-terminate dst */
- while (*s++)
- ;
- }
-
- return(s - src - 1); /* count does not include NUL */
-}
-
-#endif /* !HAVE_STRLCPY */
diff --git a/main/win95nt.h b/main/win95nt.h
deleted file mode 100644
index 9010c06e75..0000000000
--- a/main/win95nt.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Defines and types for Windows 95/NT */
-#define HAVE_DECLARED_TIMEZONE
-#define WIN32_LEAN_AND_MEAN
-#include <io.h>
-#include <malloc.h>
-#include <direct.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <sys/types.h>
-typedef int uid_t;
-typedef int gid_t;
-typedef int mode_t;
-typedef char * caddr_t;
-#define lstat(x, y) stat(x, y)
-#define _IFIFO 0010000 /* fifo */
-#define _IFBLK 0060000 /* block special */
-#define _IFLNK 0120000 /* symbolic link */
-#define S_IFIFO _IFIFO
-#define S_IFBLK _IFBLK
-#define S_IFLNK _IFLNK
-#define pclose(a) _pclose(a)
-#define popen(a, b) _popen(a, b)
-#define chdir(path) SetCurrentDirectory(path)
-#define mkdir(a,b) _mkdir(a)
-#define rmdir(a) _rmdir(a)
-#define getpid _getpid
-#define php_sleep(t) Sleep(t*1000)
-#define getcwd(a, b) _getcwd(a, b)
-#define snprintf _snprintf
-#define off_t _off_t
-#define vsnprintf _vsnprintf
-typedef unsigned int uint;
-typedef unsigned long ulong;
-#if !NSAPI
-#define strcasecmp(s1, s2) stricmp(s1, s2)
-#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
-typedef long pid_t;
-#endif
-
-/* missing in vc5 math.h */
-#define M_PI 3.14159265358979323846
-#define M_TWOPI (M_PI * 2.0)
-#define M_PI_2 1.57079632679489661923
-#define M_PI_4 0.78539816339744830962
-
-#if !PHP_DEBUG
-#ifdef inline
-#undef inline
-#endif
-#define inline __inline
-#endif
-
-/* General Windows stuff */
-#define WINDOWS 1
-
-/* Prevent use of VC5 OpenFile function */
-#define NOOPENFILE
-
-/* sendmail is built-in */
-#ifdef PHP_PROG_SENDMAIL
-#undef PHP_PROG_SENDMAIL
-#define PHP_PROG_SENDMAIL "Built in mailer"
-#endif
-
-#define CONVERT_TO_WIN_FS(Filename) \
-{ \
- char *stemp; \
- if (Filename) \
- for (stemp = Filename; *stemp; stemp++) \
- if ( *stemp == '/') \
- *stemp = '\\'; \
-}