diff options
author | Anantha Kesari H Y <hyanantha@php.net> | 2002-10-29 11:24:12 +0000 |
---|---|---|
committer | Anantha Kesari H Y <hyanantha@php.net> | 2002-10-29 11:24:12 +0000 |
commit | dc1d021f859605c8cd550b9f9213f40f9c323a0f (patch) | |
tree | e52082d3a7fb1fd9a5024dcf55b80b1c095da40f | |
parent | b255969faab52c602d9bab6bfedf051f4ebc4274 (diff) | |
download | php-git-dc1d021f859605c8cd550b9f9213f40f9c323a0f.tar.gz |
NetWare related files.
-rw-r--r-- | netware/ApacheCore.imp | 365 | ||||
-rwxr-xr-x | netware/build.bat | 1 | ||||
-rwxr-xr-x | netware/buildlib.bat | 2 | ||||
-rw-r--r-- | netware/common.mif | 41 | ||||
-rw-r--r-- | netware/env.c | 134 | ||||
-rw-r--r-- | netware/env.h | 23 | ||||
-rw-r--r-- | netware/geterrnoptr.c | 9 | ||||
-rw-r--r-- | netware/grp.h | 31 | ||||
-rw-r--r-- | netware/libpq-fe.h | 378 | ||||
-rw-r--r-- | netware/libpq-fs.h | 24 | ||||
-rw-r--r-- | netware/libpq.imp | 93 | ||||
-rw-r--r-- | netware/mktemp.c | 87 | ||||
-rw-r--r-- | netware/param.h | 20 | ||||
-rwxr-xr-x | netware/php-nw.bat | 3 | ||||
-rw-r--r-- | netware/php4apache.mak | 49 | ||||
-rw-r--r-- | netware/php4apache2filter.mak | 166 | ||||
-rw-r--r-- | netware/php4cli.mak | 167 | ||||
-rw-r--r-- | netware/phplib.imp | 11 | ||||
-rw-r--r-- | netware/phplib.mak | 53 | ||||
-rw-r--r-- | netware/pipe.c | 91 | ||||
-rw-r--r-- | netware/pipe.h | 6 | ||||
-rw-r--r-- | netware/postgres_ext.h | 45 | ||||
-rw-r--r-- | netware/pwd.c | 86 | ||||
-rw-r--r-- | netware/pwd.h | 5 | ||||
-rw-r--r-- | netware/start.c | 44 | ||||
-rw-r--r-- | netware/sysexits.h | 114 | ||||
-rw-r--r-- | netware/time_nw.c | 246 | ||||
-rw-r--r-- | netware/time_nw.h | 57 | ||||
-rw-r--r-- | netware/tsrm.mak | 31 | ||||
-rw-r--r-- | netware/wfile.c | 17 | ||||
-rw-r--r-- | netware/wfile.h | 16 | ||||
-rw-r--r-- | netware/zend.mak | 75 |
32 files changed, 2411 insertions, 79 deletions
diff --git a/netware/ApacheCore.imp b/netware/ApacheCore.imp new file mode 100644 index 0000000000..b4440913fd --- /dev/null +++ b/netware/ApacheCore.imp @@ -0,0 +1,365 @@ + ap_MD5Final, + ap_MD5Init, + ap_MD5Update, + ap_acquire_mutex, + ap_add_cgi_vars, + ap_add_common_vars, + ap_add_loaded_module, + ap_add_module, + ap_add_named_module, + ap_add_per_dir_conf, + ap_add_per_url_conf, + ap_add_version_component, + ap_allow_options, + ap_allow_overrides, + ap_append_arrays, + ap_array_cat, + ap_auth_name, + ap_auth_type, + ap_basic_http_header, + ap_bclose, + ap_bcreate, + ap_bfilbuf, + ap_bfileno, + ap_bflsbuf, + ap_bflush, + ap_bgetopt, + ap_bgets, + ap_bhalfduplex, + ap_block_alarms, + ap_blookc, + ap_bnonblock, + ap_bonerror, + ap_bpushfd, + ap_bputs, + ap_bread, + ap_bsetflag, + ap_bsetopt, + ap_bskiplf, + ap_bspawn_child, + ap_bwrite, + ap_bytes_in_free_blocks, + ap_bytes_in_pool, + ap_call_exec, + ap_can_exec, + ap_cfg_closefile, + ap_cfg_getc, + ap_cfg_getline, + ap_chdir_file, + ap_check_alarm, + ap_check_cmd_context, + ap_checkmask, + ap_cleanup_for_exec, + ap_clear_module_list, + ap_clear_pool, + ap_clear_table, + ap_close_piped_log, + ap_construct_server, + ap_construct_url, + ap_content_type_tolower, + ap_copy_array, + ap_copy_array_hdr, + ap_copy_table, + ap_count_dirs, + ap_cpystrn, + ap_create_environment, + ap_create_mutex, + ap_create_per_dir_config, + ap_custom_response, + ap_default_port_for_request, + ap_default_port_for_scheme, + ap_default_type, + ap_destroy_mutex, + ap_destroy_pool, + ap_destroy_sub_req, + ap_die, + ap_discard_request_body, + ap_document_root, + ap_each_byterange, + ap_error_log2stderr, + ap_escape_html, + ap_escape_path_segment, + ap_escape_quotes, + ap_escape_shell_cmd, + ap_exists_scoreboard_image, + ap_finalize_request_protocol, + ap_find_command, + ap_find_command_in_modules, + ap_find_last_token, + ap_find_linked_module, + ap_find_module_name, + ap_find_path_info, + ap_find_token, + ap_get_basic_auth_pw, + ap_get_client_block, + ap_get_gmtoff, + ap_get_limit_req_body, + ap_get_remote_host, + ap_get_remote_logname, + ap_get_server_built, + ap_get_server_name, + ap_get_server_port, + ap_get_server_version, + ap_get_time, + ap_get_token, + ap_getparents, + ap_getword, + ap_getword_conf, + ap_getword_conf_nc, + ap_getword_nc, + ap_getword_nulls, + ap_getword_nulls_nc, + ap_getword_white, + ap_getword_white_nc, + ap_gm_timestr_822, + ap_gname2id, + ap_handle_command, + ap_hard_timeout, + ap_ht_time, + ap_ind, + ap_index_of_response, + ap_init_virtual_host, + ap_internal_redirect, + ap_internal_redirect_handler, + ap_is_directory, + ap_is_fnmatch, + ap_is_initial_req, + ap_is_matchexp, + ap_is_url, + ap_kill_cleanup, + ap_kill_cleanups_for_fd, + ap_kill_cleanups_for_socket, + ap_kill_timeout, + ap_log_assert, + ap_log_error_old, + ap_log_reason, + ap_log_unixerr, + ap_make_array, + ap_make_dirstr, + ap_make_dirstr_parent, + ap_make_dirstr_prefix, + ap_make_full_path, + ap_make_sub_pool, + ap_make_table, + ap_matches_request_vhost, + ap_md5, + ap_md5_binary, + ap_md5contextTo64, + ap_md5digest, + ap_meets_conditions, + ap_no2slash, + ap_note_auth_failure, + ap_note_basic_auth_failure, + ap_note_cleanups_for_fd, + ap_note_cleanups_for_file, + ap_note_cleanups_for_socket, + ap_note_digest_auth_failure, + ap_note_subprocess, + ap_open_mutex, + ap_open_piped_log, + ap_os_escape_path, + ap_overlap_tables, + ap_overlay_tables, + ap_palloc, + ap_parseHTTPdate, + ap_parse_hostinfo_components, + ap_parse_uri, + ap_parse_uri_components, + ap_pcalloc, + ap_pcfg_open_custom, + ap_pcfg_openfile, + ap_pclosedir, + ap_pclosef, + ap_pclosesocket, + ap_pduphostent, + ap_pfclose, + ap_pfdopen, + ap_pfopen, + ap_pgethostbyname, + ap_popendir, + ap_popenf, + ap_pregcomp, + ap_pregfree, + ap_pregsub, + ap_psignature, + ap_psocket, + ap_pstrdup, + ap_pstrndup, + ap_push_array, + ap_pvsprintf, + ap_rationalize_mtime, + ap_register_cleanup, + ap_release_mutex, + ap_remove_loaded_module, + ap_remove_module, + ap_requires, + ap_reset_timeout, + ap_rflush, + ap_rind, + ap_rputc, + ap_rputs, + ap_run_cleanup, + ap_run_sub_req, + ap_rwrite, + ap_satisfies, + ap_scan_script_header_err, + ap_scan_script_header_err_buff, + ap_scan_script_header_err_core, + ap_send_fb, + ap_send_fb_length, + ap_send_fd, + ap_send_fd_length, + ap_send_http_header, + ap_send_http_trace, + ap_send_mmap, + ap_send_size, + ap_server_root_relative, + ap_set_byterange, + ap_set_content_length, + ap_set_etag, + ap_set_keepalive, + ap_set_last_modified, + ap_setup_client_block, + ap_should_client_block, + ap_soft_timeout, + ap_some_auth_required, + ap_spawn_child, + ap_srm_command_loop, + ap_str_tolower, + ap_strcasecmp_match, + ap_strcmp_match, + ap_sub_req_lookup_file, + ap_sub_req_lookup_uri, + ap_sync_scoreboard_image, + ap_table_add, + ap_table_addn, + ap_table_get, + ap_table_merge, + ap_table_mergen, + ap_table_set, + ap_table_setn, + ap_table_unset, + ap_tm2sec, + ap_uname2id, + ap_unblock_alarms, + ap_unescape_url, + ap_unparse_uri_components, + ap_update_mtime, + ap_uudecode, + ap_uuencode, + ap_vbprintf, + ap_vformatter, + ap_vsnprintf, + regcomp, + regexec, + regfree, + access_module, + alias_module, + ap_bprintf, + ap_bvputs, + ap_day_snames, + ap_extended_status, + ap_limit_section, + ap_loaded_modules, + ap_log_error, + ap_log_printf, + ap_log_rerror, + ap_month_snames, + ap_null_cleanup, + ap_psprintf, + ap_pstrcat, + ap_restart_time, + ap_rprintf, + ap_rvputs, + ap_scoreboard_image, + ap_send_header_field, + ap_server_argv0, + ap_server_root, + ap_set_file_slot, + ap_set_flag_slot, + ap_set_string_slot, + ap_set_string_slot_lower, + ap_snprintf, + ap_suexec_enabled, + ap_table_do, + apache_main, + asis_module, + auth_module, + autoindex_module, + config_log_module, + core_module, + dir_module, + env_module, + imap_module, + includes_module, + mime_module, + negotiation_module, + setenvif_module, + so_module, + top_module, + ap_fnmatch, + ap_method_number_of, + ap_exists_config_define, + ap_single_module_configure, + ap_make_etag, + ap_array_pstrcat, + ap_find_list_item, + ap_MD5Encode, + ap_validate_password, + ap_size_list_item, + ap_get_list_item, + ap_scoreboard_fname, + ap_pid_fname, + ap_excess_requests_per_child, + ap_threads_per_child, + ap_max_requests_per_child, + ap_daemons_to_start, + ap_daemons_min_free, + ap_daemons_max_free, + ap_daemons_limit, + ap_user_name, + ap_user_id, + ap_group_id, + ap_standalone, + ap_server_confname, + ap_sub_req_method_uri, + ap_regerror, + ap_regexec, + ap_field_noparam, + ap_pbase64decode, + ap_pbase64encode, + ap_base64encode, + ap_base64encode_binary, + ap_base64encode_len, + ap_base64decode, + ap_base64decode_binary, + ap_base64decode_len, + ap_SHA1Init, + ap_SHA1Update_binary, + ap_SHA1Update, + ap_SHA1Final, + ap_sha1_base64, + ap_my_generation, + ap_get_virthost_addr, + ap_listeners, + ap_listenbacklog, + clean_parent_exit, + init_tsd, + ap_set_config_vectors, + ap_strcasestr, + ap_to64, + ap_vrprintf, + regerror, + ap_add_file_conf, + ap_configtestonly, + ap_is_rdirectory, + ap_remove_spaces, + ap_scan_script_header_err_strs, + ap_start_shutdown, + ap_start_restart, + ap_stripprefix, + ap_send_error_response, + ap_os_canonical_filename, + ap_os_http_method, + os_readdir, + os_opendir diff --git a/netware/build.bat b/netware/build.bat index 5c8e310a53..593f50be21 100755 --- a/netware/build.bat +++ b/netware/build.bat @@ -6,7 +6,6 @@ if "%2" == "clean" make -f ..\netware\%1.mak clean if "%2" == "/?" goto USAGE if "%1" == "zend" call ..\netware\BisonFlexZend -if "%1" == "ZendEngine2" call ..\netware\BisonFlexZend REM Build command make -f ..\netware\%1.mak diff --git a/netware/buildlib.bat b/netware/buildlib.bat index 76e271846e..5abd71229d 100755 --- a/netware/buildlib.bat +++ b/netware/buildlib.bat @@ -5,6 +5,8 @@ cd .. if "%1" == "clean" make -f netware\phplib.mak clean if "%1" == "/?" goto USAGE +call netware\BisonExtStandard + REM Build command make -f netware\phplib.mak goto EXIT diff --git a/netware/common.mif b/netware/common.mif index d09026fd21..a8adc71fd5 100644 --- a/netware/common.mif +++ b/netware/common.mif @@ -1,8 +1,9 @@ # -# common include file for PHP build -# include this in every make file +# Common include file for PHP build. +# Include this in every make file. # + # Set following directories based on your setting # Path to CodeWarrior installation @@ -10,17 +11,22 @@ CW_PATH = P:/APPS/SCRIPT/SW/CW71-4 # NWSDK directories ifndef SDK_DIR -SDK_DIR = R:/script/common/libc +#SDK_DIR = R:/script/common/libc +SDK_DIR = P:/APPS/script/sw/libc endif # MPK related directory ifndef MPK_DIR MPK_DIR = p:/apps/script/mpk +XDCTOOL = mpkxdc +MPKTOOL = $(MPK_DIR)/$(XDCTOOL) +XDCFLAGS = -n endif -#ifndef CLIB_DIR -#CLIB_DIR = p:/apps/ndk0601/nwsdk -#endif +# Security related directory +ifndef SECURITY_DIR +SECURITY_DIR = p:/apps/script/sw/nwsec +endif # Winsock stuff WINSOCK_DIR = P:/APPS/script/sw/Winsock2 @@ -28,9 +34,17 @@ WINSOCK_DIR = P:/APPS/script/sw/Winsock2 # LDAP stuff LDAP_DIR = P:/APPS/script/sw/cldapsdk + +# Web Server defaults to Apache 1.3.x +ifndef APACHE_VER +APACHE_VER = 1.3 +endif + # Apache directory -ifndef APACHE_DIR +ifeq '$(APACHE_VER)' '1.3' APACHE_DIR = P:/APPS/script/sw/Apache1.3.xSource +else +APACHE_DIR = P:/APPS/script/sw/Apache2Source endif @@ -46,7 +60,6 @@ LINK = mwldnlm ifndef BUILD BUILD = release endif -#BUILD = debug OBJ_DIR = $(BUILD) FINAL_DIR = $(BUILD) @@ -57,8 +70,16 @@ STACK_SIZE=65536 endif ifndef COPYRIGHT -#COPYRIGHT = "Copyright (c) 1997-2002 The PHP Group. All Rights Reserved." -COPYRIGHT = "Copyright (c) 1999\, 2000 The PHP Group. All rights reserved." +COPYRIGHT = "Copyright (c) 1999 - 2002 The PHP Group. All rights reserved." +endif + + +# Compile flags +ifeq '$(APACHE_VER)' '1.3' +C_FLAGS = -align 1 +C_FLAGS += -DCLIB_STAT_PATCH +else +C_FLAGS = -align 4 endif # Link flags diff --git a/netware/env.c b/netware/env.c new file mode 100644 index 0000000000..1d4d599e28 --- /dev/null +++ b/netware/env.c @@ -0,0 +1,134 @@ +/* + Temporary implementation of 'env' stuff till they are properly available in LibC +*/ + +#include <stdlib.h> +#include <nks/netware.h> + +#include "env.h" + +/* +#define MAX_VARIABLE_LEN 255 +#define MAX_VALUE_LEN 1024 +*/ + +/*int scanenv(int *sequence, char *variable, size_t *length, char *value );*/ /* From CLib */ + +char **environ = NULL; + +/* +char *getEnvStr(char *name, char *defaultValue) +{ + char* ret = getenv(name); + + if (ret == NULL) + ret = defaultValue; + + return ret; +} + +char ***getEnvBlock() +{ + if (!environ) + setupEnvBlock (&environ); + + return (&environ); +} +*/ + +/* +void setupEnvBlock(char*** pEnv) +{ + char** env = NULL; + int sequence = 0; + char var[MAX_VARIABLE_LEN+1] = {'\0'}; + char val[MAX_VALUE_LEN+1] = {'\0'}; + char both[MAX_VARIABLE_LEN + MAX_VALUE_LEN + 5] = {'\0'}; + size_t len = MAX_VALUE_LEN; + int totalCount = 0, count = 0, i = 0; + + while(scanenv(&sequence, var, &len, val)) + { + totalCount++; + len = MAX_VALUE_LEN; + } + totalCount++;*/ /* add one for null termination +*/ +/* + env = (char **)malloc(totalCount * sizeof(char*)); + if (env) + { + sequence = 0; + len = MAX_VALUE_LEN; + + while ((count < (totalCount - 1)) && scanenv(&sequence, var, &len, val)) + { + val[len] = '\0'; + strcpy (both, var); + strcat (both, (char *)"="); + strcat (both, val); + + env[count] = (char *)malloc((sizeof(both) + 1) * sizeof(char)); + if (env[count]) + { + strcpy(env[count], both); + count++; + } + else + { + for (i = 0; i < count; i++) + { + if (env[i]) + { + free (env[i]); + env[i] = NULL; + } + } + + free (env); + env = NULL; + + return; + } + + len = MAX_VALUE_LEN; + } + + for (i = count; i <= (totalCount - 1); i++) + env[i] = NULL; + } + else + return; + + *pEnv = env; + + return; +} + +void destroyEnvBlock(char** env) +{ + int k = 0; + + if (!env) + return; + + while (env[k] != NULL) + { + free (env[k]); + env[k] = NULL; + k++; + } + + free (env); + env = NULL; + + return; +} +*/ + +/* Added to avoid 'scanenv' problem */ +void getEnvironPtr() +{ + environ = nxGetEnviron(); +} + diff --git a/netware/env.h b/netware/env.h new file mode 100644 index 0000000000..e5538b8ede --- /dev/null +++ b/netware/env.h @@ -0,0 +1,23 @@ +/* + Temporary implementation of 'env' stuff till they are properly available in LibC +*/ + + +/* + Global variable to hold the environ information. + First time it is accessed, it will be created and initialized and + next time onwards, the pointer will be returned. + Improvements: dynamically read env everytime a request comes -- is this required? +*/ + +/* + So that the original 'environ' isn't used -- this is temporary + and will go when this file goes +*/ +#undef environ + +/* +void setupEnvBlock(char*** pEnv); +void destroyEnvBlock(char** env); +*/ +void getEnvironPtr(); /* New function to get 'environ' pointer */ diff --git a/netware/geterrnoptr.c b/netware/geterrnoptr.c new file mode 100644 index 0000000000..065d33e84d --- /dev/null +++ b/netware/geterrnoptr.c @@ -0,0 +1,9 @@ +/* Moved into a separate source file -- can be eliminated later */ + +#include <errno.h> + +int *__get_errno_ptr(void) +{ + return ___errno(); +} + diff --git a/netware/grp.h b/netware/grp.h new file mode 100644 index 0000000000..e7a99327e2 --- /dev/null +++ b/netware/grp.h @@ -0,0 +1,31 @@ +/* pwd.h - Try to approximate UN*X's getuser...() functions under MS-DOS. + Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + + 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 the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Header$ + */ + +/* This 'implementation' is conjectured from the use of this functions in + the RCS and BASH distributions. Of course these functions don't do too + much useful things under MS-DOS, but using them avoids many "#ifdef + MSDOS" in ported UN*X code ... */ + +struct group { + char *gr_name; /* group name */ + char *gr_passwd; /* group password */ + int gr_gid; /* group id */ + char **gr_mem; /* group members */ +}; diff --git a/netware/libpq-fe.h b/netware/libpq-fe.h new file mode 100644 index 0000000000..879a447091 --- /dev/null +++ b/netware/libpq-fe.h @@ -0,0 +1,378 @@ +/*------------------------------------------------------------------------- + * + * libpq-fe.h + * This file contains definitions for structures and + * externs for functions used by frontend postgres applications. + * + * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * $Id$ + * + *------------------------------------------------------------------------- + */ + +#ifndef LIBPQ_FE_H +#define LIBPQ_FE_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include <stdio.h> + +/* + * postgres_ext.h defines the backend's externally visible types, + * such as Oid. + */ +#include "postgres_ext.h" + +/* SSL type is needed here only to declare PQgetssl() */ +#ifdef USE_SSL +#include <openssl/ssl.h> +#endif + +/* Application-visible enum types */ + +typedef enum +{ + /* + * Although you may decide to change this list in some way, values + * which become unused should never be removed, nor should constants + * be redefined - that would break compatibility with existing code. + */ + CONNECTION_OK, + CONNECTION_BAD, + /* Non-blocking mode only below here */ + + /* + * The existence of these should never be relied upon - they should + * only be used for user feedback or similar purposes. + */ + CONNECTION_STARTED, /* Waiting for connection to be made. */ + CONNECTION_MADE, /* Connection OK; waiting to send. */ + CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the + * postmaster. */ + CONNECTION_AUTH_OK, /* Received authentication; waiting for + * backend startup. */ + CONNECTION_SETENV /* Negotiating environment. */ +} ConnStatusType; + +typedef enum +{ + PGRES_POLLING_FAILED = 0, + PGRES_POLLING_READING, /* These two indicate that one may */ + PGRES_POLLING_WRITING, /* use select before polling again. */ + PGRES_POLLING_OK, + PGRES_POLLING_ACTIVE /* Can call poll function immediately. */ +} PostgresPollingStatusType; + +typedef enum +{ + PGRES_EMPTY_QUERY = 0, + PGRES_COMMAND_OK, /* a query command that doesn't return + * anything was executed properly by the + * backend */ + PGRES_TUPLES_OK, /* a query command that returns tuples was + * executed properly by the backend, + * PGresult contains the result tuples */ + PGRES_COPY_OUT, /* Copy Out data transfer in progress */ + PGRES_COPY_IN, /* Copy In data transfer in progress */ + PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from + * the backend */ + PGRES_NONFATAL_ERROR, + PGRES_FATAL_ERROR +} ExecStatusType; + +/* PGconn encapsulates a connection to the backend. + * The contents of this struct are not supposed to be known to applications. + */ +typedef struct pg_conn PGconn; + +/* PGresult encapsulates the result of a query (or more precisely, of a single + * SQL command --- a query string given to PQsendQuery can contain multiple + * commands and thus return multiple PGresult objects). + * The contents of this struct are not supposed to be known to applications. + */ +typedef struct pg_result PGresult; + +/* PGnotify represents the occurrence of a NOTIFY message. + * Ideally this would be an opaque typedef, but it's so simple that it's + * unlikely to change. + * NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's, + * whereas in earlier versions it was always your own backend's PID. + */ +typedef struct pgNotify +{ + char relname[NAMEDATALEN]; /* name of relation containing + * data */ + int be_pid; /* process id of backend */ +} PGnotify; + +/* PQnoticeProcessor is the function type for the notice-message callback. + */ +typedef void (*PQnoticeProcessor) (void *arg, const char *message); + +/* Print options for PQprint() */ +typedef char pqbool; + +typedef struct _PQprintOpt +{ + pqbool header; /* print output field headings and row + * count */ + pqbool align; /* fill align the fields */ + pqbool standard; /* old brain dead format */ + pqbool html3; /* output html tables */ + pqbool expanded; /* expand tables */ + pqbool pager; /* use pager for output if needed */ + char *fieldSep; /* field separator */ + char *tableOpt; /* insert to HTML <table ...> */ + char *caption; /* HTML <caption> */ + char **fieldName; /* null terminated array of repalcement + * field names */ +} PQprintOpt; + +/* ---------------- + * Structure for the conninfo parameter definitions returned by PQconndefaults + * + * All fields except "val" point at static strings which must not be altered. + * "val" is either NULL or a malloc'd current-value string. PQconninfoFree() + * will release both the val strings and the PQconninfoOption array itself. + * ---------------- + */ +typedef struct _PQconninfoOption +{ + char *keyword; /* The keyword of the option */ + char *envvar; /* Fallback environment variable name */ + char *compiled; /* Fallback compiled in default value */ + char *val; /* Option's current value, or NULL */ + char *label; /* Label for field in connect dialog */ + char *dispchar; /* Character to display for this field in + * a connect dialog. Values are: "" + * Display entered value as is "*" + * Password field - hide value "D" Debug + * option - don't show by default */ + int dispsize; /* Field size in characters for dialog */ +} PQconninfoOption; + +/* ---------------- + * PQArgBlock -- structure for PQfn() arguments + * ---------------- + */ +typedef struct +{ + int len; + int isint; + union + { + int *ptr; /* can't use void (dec compiler barfs) */ + int integer; + } u; +} PQArgBlock; + +/* ---------------- + * Exported functions of libpq + * ---------------- + */ + +/* === in fe-connect.c === */ + +/* make a new client connection to the backend */ +/* Asynchronous (non-blocking) */ +extern PGconn *PQconnectStart(const char *conninfo); +extern PostgresPollingStatusType PQconnectPoll(PGconn *conn); + +/* Synchronous (blocking) */ +extern PGconn *PQconnectdb(const char *conninfo); +extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport, + const char *pgoptions, const char *pgtty, + const char *dbName, + const char *login, const char *pwd); + +#define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \ + PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL) + +/* close the current connection and free the PGconn data structure */ +extern void PQfinish(PGconn *conn); + +/* get info about connection options known to PQconnectdb */ +extern PQconninfoOption *PQconndefaults(void); + +/* free the data structure returned by PQconndefaults() */ +extern void PQconninfoFree(PQconninfoOption *connOptions); + +/* + * close the current connection and restablish a new one with the same + * parameters + */ +/* Asynchronous (non-blocking) */ +extern int PQresetStart(PGconn *conn); +extern PostgresPollingStatusType PQresetPoll(PGconn *conn); + +/* Synchronous (blocking) */ +extern void PQreset(PGconn *conn); + +/* issue a cancel request */ +extern int PQrequestCancel(PGconn *conn); + +/* Accessor functions for PGconn objects */ +extern char *PQdb(const PGconn *conn); +extern char *PQuser(const PGconn *conn); +extern char *PQpass(const PGconn *conn); +extern char *PQhost(const PGconn *conn); +extern char *PQport(const PGconn *conn); +extern char *PQtty(const PGconn *conn); +extern char *PQoptions(const PGconn *conn); +extern ConnStatusType PQstatus(const PGconn *conn); +extern char *PQerrorMessage(const PGconn *conn); +extern int PQsocket(const PGconn *conn); +extern int PQbackendPID(const PGconn *conn); +extern int PQclientEncoding(const PGconn *conn); +extern int PQsetClientEncoding(PGconn *conn, const char *encoding); + +#ifdef USE_SSL +/* Get the SSL structure associated with a connection */ +extern SSL *PQgetssl(PGconn *conn); +#endif + + +/* Enable/disable tracing */ +extern void PQtrace(PGconn *conn, FILE *debug_port); +extern void PQuntrace(PGconn *conn); + +/* Override default notice processor */ +extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, + PQnoticeProcessor proc, + void *arg); + +/* === in fe-exec.c === */ + +/* Quoting strings before inclusion in queries. */ +extern size_t PQescapeString(char *to, const char *from, size_t length); +extern unsigned char *PQescapeBytea(unsigned char *bintext, size_t binlen, + size_t *bytealen); + +/* Simple synchronous query */ +extern PGresult *PQexec(PGconn *conn, const char *query); +extern PGnotify *PQnotifies(PGconn *conn); +extern void PQfreeNotify(PGnotify *notify); + +/* Interface for multiple-result or asynchronous queries */ +extern int PQsendQuery(PGconn *conn, const char *query); +extern PGresult *PQgetResult(PGconn *conn); + +/* Routines for managing an asychronous query */ +extern int PQisBusy(PGconn *conn); +extern int PQconsumeInput(PGconn *conn); + +/* Routines for copy in/out */ +extern int PQgetline(PGconn *conn, char *string, int length); +extern int PQputline(PGconn *conn, const char *string); +extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize); +extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes); +extern int PQendcopy(PGconn *conn); + +/* Set blocking/nonblocking connection to the backend */ +extern int PQsetnonblocking(PGconn *conn, int arg); +extern int PQisnonblocking(const PGconn *conn); + +/* Force the write buffer to be written (or at least try) */ +extern int PQflush(PGconn *conn); + +/* + * "Fast path" interface --- not really recommended for application + * use + */ +extern PGresult *PQfn(PGconn *conn, + int fnid, + int *result_buf, + int *result_len, + int result_is_int, + const PQArgBlock *args, + int nargs); + +/* Accessor functions for PGresult objects */ +extern ExecStatusType PQresultStatus(const PGresult *res); +extern char *PQresStatus(ExecStatusType status); +extern char *PQresultErrorMessage(const PGresult *res); +extern int PQntuples(const PGresult *res); +extern int PQnfields(const PGresult *res); +extern int PQbinaryTuples(const PGresult *res); +extern char *PQfname(const PGresult *res, int field_num); +extern int PQfnumber(const PGresult *res, const char *field_name); +extern Oid PQftype(const PGresult *res, int field_num); +extern int PQfsize(const PGresult *res, int field_num); +extern int PQfmod(const PGresult *res, int field_num); +extern char *PQcmdStatus(PGresult *res); +extern char *PQoidStatus(const PGresult *res); /* old and ugly */ +extern Oid PQoidValue(const PGresult *res); /* new and improved */ +extern char *PQcmdTuples(PGresult *res); +extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num); +extern int PQgetlength(const PGresult *res, int tup_num, int field_num); +extern int PQgetisnull(const PGresult *res, int tup_num, int field_num); + +/* Delete a PGresult */ +extern void PQclear(PGresult *res); + +/* + * Make an empty PGresult with given status (some apps find this + * useful). If conn is not NULL and status indicates an error, the + * conn's errorMessage is copied. + */ +extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status); + +/* === in fe-print.c === */ + +extern void +PQprint(FILE *fout, /* output stream */ + const PGresult *res, + const PQprintOpt *ps); /* option structure */ + +/* + * really old printing routines + */ +extern void +PQdisplayTuples(const PGresult *res, + FILE *fp, /* where to send the output */ + int fillAlign, /* pad the fields with spaces */ + const char *fieldSep, /* field separator */ + int printHeader, /* display headers? */ + int quiet); + +extern void +PQprintTuples(const PGresult *res, + FILE *fout, /* output stream */ + int printAttName, /* print attribute names */ + int terseOutput, /* delimiter bars */ + int width); /* width of column, if 0, use variable + * width */ + + +/* === in fe-lobj.c === */ + +/* Large-object access routines */ +extern int lo_open(PGconn *conn, Oid lobjId, int mode); +extern int lo_close(PGconn *conn, int fd); +extern int lo_read(PGconn *conn, int fd, char *buf, size_t len); +extern int lo_write(PGconn *conn, int fd, char *buf, size_t len); +extern int lo_lseek(PGconn *conn, int fd, int offset, int whence); +extern Oid lo_creat(PGconn *conn, int mode); +extern int lo_tell(PGconn *conn, int fd); +extern int lo_unlink(PGconn *conn, Oid lobjId); +extern Oid lo_import(PGconn *conn, const char *filename); +extern int lo_export(PGconn *conn, Oid lobjId, const char *filename); + +/* === in fe-misc.c === */ + +/* Determine length of multibyte encoded char at *s */ +extern int PQmblen(const unsigned char *s, int encoding); + +/* Get encoding id from environment variable PGCLIENTENCODING */ +extern int PQenv2encoding(void); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBPQ_FE_H */ diff --git a/netware/libpq-fs.h b/netware/libpq-fs.h new file mode 100644 index 0000000000..d743618895 --- /dev/null +++ b/netware/libpq-fs.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * libpq-fs.h + * definitions for using Inversion file system routines (ie, large objects) + * + * + * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * $Id$ + * + *------------------------------------------------------------------------- + */ +#ifndef LIBPQ_FS_H +#define LIBPQ_FS_H + +/* + * Read/write mode flags for inversion (large object) calls + */ + +#define INV_WRITE 0x00020000 +#define INV_READ 0x00040000 + +#endif /* LIBPQ_FS_H */ diff --git a/netware/libpq.imp b/netware/libpq.imp new file mode 100644 index 0000000000..922679f07e --- /dev/null +++ b/netware/libpq.imp @@ -0,0 +1,93 @@ + lo_open, + lo_close, + lo_read, + lo_write, + lo_lseek, + lo_creat, + lo_tell, + lo_unlink, + lo_import, + lo_export, + PQconnectdb, + PQconnectStart, + PQconndefaults, + PQsetdbLogin, + PQconnectPoll, + PQfinish, + PQreset, + PQresetStart, + PQresetPoll, + PQrequestCancel, + PQconninfoFree, + PQdb, + PQuser, + PQpass, + PQhost, + PQport, + PQtty, + PQoptions, + PQstatus, + PQerrorMessage, + PQsocket, + PQbackendPID, + PQclientEncoding, + PQsetClientEncoding, + PQtrace, + PQuntrace, + PQsetNoticeProcessor, + PQmakeEmptyPGresult, + PQclear, + PQsendQuery, + PQconsumeInput, + PQisBusy, + PQgetResult, + PQexec, + PQnotifies, + PQgetline, + PQgetlineAsync, + PQputline, + PQputnbytes, + PQendcopy, + PQfn, + PQresultStatus, + PQresStatus, + PQresultErrorMessage, + PQntuples, + PQnfields, + PQbinaryTuples, + PQfname, + PQfnumber, + PQftype, + PQfsize, + PQfmod, + PQcmdStatus, + PQoidStatus, + PQoidValue, + PQcmdTuples, + PQgetvalue, + PQgetlength, + PQgetisnull, + PQsetnonblocking, + PQisnonblocking, + PQflush, + PQmblen, + PQenv2encoding, + PQprint, + PQdisplayTuples, + PQprintTuples, + pg_valid_client_encoding, + pg_valid_server_encoding, + pg_char_to_encname_struct, + pg_char_to_encoding, + pg_encoding_to_char, + createPQExpBuffer, + initPQExpBuffer, + destroyPQExpBuffer, + termPQExpBuffer, + resetPQExpBuffer, + enlargePQExpBuffer, + printfPQExpBuffer, + appendPQExpBuffer, + appendPQExpBufferStr, + appendPQExpBufferChar, + appendBinaryPQExpBuffer diff --git a/netware/mktemp.c b/netware/mktemp.c new file mode 100644 index 0000000000..b6d8e92593 --- /dev/null +++ b/netware/mktemp.c @@ -0,0 +1,87 @@ + +#include <string.h> +#include <errno.h> +#include <unistd.h> + + +/* Based on standard ANSI C mktemp() for NetWare */ +char* mktemp(char* templateStr) +{ + char* pXs = NULL; + char numBuf[50] = {'\0'}; + int count = 0; + char* pPid = NULL; + + char termChar = '\0'; + char letter = 'a'; + char letter1 = 'a'; + + if (templateStr && (pXs = strstr(templateStr, "XXXXXX"))) + { + /* Generate temp name */ + termChar = pXs[6]; + ltoa(NXThreadGetId(), numBuf, 16); + numBuf[strlen(numBuf)-1] = '\0'; + + /* + Beware! thread IDs are 8 hex digits on NW 4.11 and only the + lower digits seem to change, whereas on NW 5 they are in the + range of < 1000 hex or 3 hex digits in length. So the following + logic ensures we use the least significant portion of the number.\ + */ + if (strlen(numBuf) > 5) + pPid = &numBuf[strlen(numBuf)-5]; + else + pPid = numBuf; + + /* + Temporary files, as the name suggests, are temporarily used and then + cleaned up after usage. In the case of complex scripts, new temp files + may be created before the old ones are deleted. So, we need to have + a provision to create many temp files. It is found that provision for + 26 files may not be enough in such cases. Hence the logic below. + + The logic below allows 26 files (like, pla00015.tmp through plz00015.tmp) + plus 6x26=676 (like, plaa0015.tmp through plzz0015.tmp) + */ + letter = 'a'; + do + { + sprintf(pXs, (char *)"%c%05.5s", letter, pPid); + pXs[6] = termChar; + + if (access(templateStr, 0) != 0) + return templateStr; /* File does not exist */ + + letter++; + } while (letter <= 'z'); + + letter1 = 'a'; + do + { + letter = 'a'; + + do + { + sprintf(pXs, (char *)"%c%c%04.5s", letter1, letter, pPid); + pXs[6] = termChar; + + if (access(templateStr, 0) != 0) + return templateStr; /* File does not exist */ + + letter++; + } while (letter <= 'z'); + + letter1++; + } while (letter1 <= 'z'); + + errno = ENOENT; + return NULL; + } + else + { + errno = EINVAL; + return NULL; + } +} + diff --git a/netware/param.h b/netware/param.h new file mode 100644 index 0000000000..aa879d035f --- /dev/null +++ b/netware/param.h @@ -0,0 +1,20 @@ + +/***************************************************************************** + * * + * sys/param.c * + * * + * Freely redistributable and modifiable. Use at your own risk. * + * * + * Copyright 1994 The Downhill Project * + * * + *****************************************************************************/ +#ifndef MAXPATHLEN +/*#define MAXPATHLEN _MAX_PATH*/ +#define MAXPATHLEN 260 /* _MAX_PATH defined in STDLIB.H for Windows; picked up the value from there */ +#define _MAX_PATH 260 /* Defined since it is used in os.c while compiling apache */ +#endif +#define MAXHOSTNAMELEN 64 +#define howmany(x,y) (((x)+((y)-1))/(y)) +#define roundup(x,y) ((((x)+((y)-1))/(y))*(y)) + +#define _MAX_VOLUME 31 /* Defined since it is used in os.c while compiling apache. The value picked up from LibC */ diff --git a/netware/php-nw.bat b/netware/php-nw.bat index 42fe820317..4811b2a39a 100755 --- a/netware/php-nw.bat +++ b/netware/php-nw.bat @@ -12,4 +12,5 @@ set path=%path%;P:\APPS\SCRIPT\SW\GNUWIN32\BIN REM Build options REM set BUILD=release -setbuild r 1 +setbuild d 1 + diff --git a/netware/php4apache.mak b/netware/php4apache.mak index 0fb977841d..7a65a638fa 100644 --- a/netware/php4apache.mak +++ b/netware/php4apache.mak @@ -4,9 +4,9 @@ PROJECT_ROOT = ../.. # Module details MODULE_NAME = mod_php -MODULE_DESC = "PHP 4.x.x for NetWare - mod_php" -VMAJ = 0 -VMIN = 90 +MODULE_DESC = "PHP 4.2.3 - Apache 1.3 Module" +VMAJ = 2 +VMIN = 0 VREV = 0 #include the common settings @@ -19,7 +19,13 @@ include $(PROJECT_ROOT)/netware/common.mif # Source files C_SRC = mod_php4.c \ php_apache.c \ - sapi_apache.c + sapi_apache.c \ + libpre.c + +# Library files +#LIBRARY = $(PROJECT_ROOT)/$(BUILD)/phplib.lib \ +# $(PROJECT_ROOT)/sapi/cgi/cgi.lib +# $(APACHE_DIR)/apache.lib # Destination directories and files OBJ_DIR = $(BUILD) @@ -35,25 +41,26 @@ endif # Compile flags -C_FLAGS = -c -maxerrors 25 -msgstyle gcc +C_FLAGS += -c -maxerrors 25 -msgstyle gcc C_FLAGS += -wchar_t on -bool on -C_FLAGS += -processor Pentium -align 1 +C_FLAGS += -processor Pentium C_FLAGS += -w nounusedarg -msext on C_FLAGS += -nostdinc -C_FLAGS += -DNETWARE -D__GNUC__ +C_FLAGS += -DNETWARE C_FLAGS += -DZTS C_FLAGS += -DNLM_PLATFORM C_FLAGS += -DN_PLAT_NLM -DNLM=1 -D__NO_MATH_OPS C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED -DAPACHE_OS_H -DNO_USE_SIGACTION -DMULTITHREAD -C_FLAGS += -DCLIB_STAT_PATCH C_FLAGS += -DNEW_LIBC #C_FLAGS += -DUSE_WINSOCK_DIRECTLY=1 +#C_FLAGS += -I. -I- -I. -I../../netware -I$(SDK_DIR)/sdk -I$(SDK_DIR)/sdk/nks # ../../netware added for special SYS/STAT.H C_FLAGS += -I. -I- -I. -I../../netware -I$(SDK_DIR)/include # ../../netware added for special SYS/STAT.H C_FLAGS += -I$(MWCIncludes) C_FLAGS += -I$(APACHE_DIR)/include -I$(APACHE_DIR)/os/netware C_FLAGS += -I- -I../../main -I../../Zend -I../../TSRM -I../../ext/standard C_FLAGS += -I../../ -I../../netware -I$(PROJECT_ROOT)/regex C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include +C_FLAGS += -I$(SECURITY_DIR)/include # Extra stuff based on debug / release builds @@ -74,13 +81,22 @@ else endif # Dependencies +#MODULE = LibC \ +# php-clib MODULE = LibC \ - phplib + phplib \ + nwsec IMPORT = @$(SDK_DIR)/imports/libc.imp \ - @$(APACHE_DIR)/os/netware/apachecore.imp \ - @$(PROJECT_ROOT)/netware/phplib.imp + @$(PROJECT_ROOT)/netware/apachecore.imp \ + @$(PROJECT_ROOT)/netware/phplib.imp \ + @$(SECURITY_DIR)/imports/nwsec.imp EXPORT = php4_module +#API = OutputToScreen +#API = EnterClib, +#API += ExitClib +# @$(MPK_DIR)/import/mpkOrg.imp \ + # Virtual paths vpath %.cpp . @@ -108,7 +124,8 @@ $(OBJ_DIR)/%.obj: %.c @$(CC) $< $(C_FLAGS) -o $@ -$(BINARY): $(DEPDS) $(OBJECTS) +#$(BINARY): $(DEPDS) $(OBJECTS) +$(BINARY): $(OBJECTS) @echo Import $(IMPORT) > $(basename $@).def ifdef API @echo Import $(API) >> $(basename $@).def @@ -125,18 +142,22 @@ endif @echo Start _lib_start >> $(basename $@).def @echo Exit _lib_stop >> $(basename $@).def + $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc + @echo xdcdata $(basename $@).xdc >> $(basename $@).def + @echo Linking $@... @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link ifdef LIBRARY @echo $(LIBRARY) >> $(basename $@).link endif - @echo $(OBJECTS) $(APACHE_DIR)/os/netware/libpre.obj >> $(basename $@).link + @echo $(OBJECTS) >> $(basename $@).link @$(LINK) @$(basename $@).link .PHONY: clean -clean: cleand cleanobj cleanbin +#clean: cleand cleanobj cleanbin +clean: cleanobj cleanbin .PHONY: cleand cleand: diff --git a/netware/php4apache2filter.mak b/netware/php4apache2filter.mak new file mode 100644 index 0000000000..645fcb43af --- /dev/null +++ b/netware/php4apache2filter.mak @@ -0,0 +1,166 @@ +# Temporarily here -- later may go into some batch file +# which will set this as an environment variable +PROJECT_ROOT = ../.. + +# Module details +MODULE_NAME = mod_php +MODULE_DESC = "PHP 4.2.3 - Apache 2.0 Module" +VMAJ = 2 +VMIN = 0 +VREV = 0 + +#include the common settings +include $(PROJECT_ROOT)/netware/common.mif + +# Extensions of all input and output files +.SUFFIXES: +.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d + +# Source files +C_SRC = apache_config.c \ + php_functions.c \ + sapi_apache2.c + +# Destination directories and files +OBJ_DIR = $(BUILD) +FINAL_DIR = $(BUILD) +MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map +OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.obj) $(C_SRC:.c=.obj)) +DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.d) $(C_SRC:.c=.d)) + +# Binary file +ifndef BINARY +BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm +endif + + +# Compile flags +C_FLAGS += -c -maxerrors 25 -msgstyle gcc +C_FLAGS += -wchar_t on -bool on +C_FLAGS += -processor Pentium +C_FLAGS += -w nounusedarg -msext on +C_FLAGS += -nostdinc +C_FLAGS += -DNETWARE -D__GNUC__ +C_FLAGS += -DZTS +C_FLAGS += -DNLM_PLATFORM +C_FLAGS += -DN_PLAT_NLM -DNLM=1 -D__NO_MATH_OPS +C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED -DAPACHE_OS_H -DNO_USE_SIGACTION -DMULTITHREAD +C_FLAGS += -DNEW_LIBC +C_FLAGS += -I. -I- -I. -I../../netware -I$(SDK_DIR)/include # ../../netware added for special SYS/STAT.H +C_FLAGS += -I$(SDK_DIR)/include/winsock # For Apache 2.0 headers +C_FLAGS += -I$(MWCIncludes) +C_FLAGS += -I$(APACHE_DIR)/include +C_FLAGS += -I- -I../../main -I../../Zend -I../../TSRM -I../../ext/standard +C_FLAGS += -I../../ -I../../netware -I$(PROJECT_ROOT)/regex +C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include + + +# Extra stuff based on debug / release builds +ifeq '$(BUILD)' 'debug' + SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym + C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -sym internal -DDEBUGGING -DDKFBPON + C_FLAGS += -r -DZEND_DEBUG + C_FLAGS += -exc cw + LD_FLAGS += -sym on -sym codeview4 -sym internal -osym $(SYM_FILE) + LD_FLAGS += -msgstyle std + export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib +else + C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -DZEND_DEBUG=0 + C_FLAGS += -opt intrinsics + C_FLAGS += -opt level=4 + LD_FLAGS += -sym off + export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib +endif + +# Dependencies +MODULE = LibC \ + phplib +IMPORT = @$(SDK_DIR)/imports/libc.imp \ + @$(APACHE_DIR)/lib/httpd.imp \ + @$(APACHE_DIR)/lib/aprlib.imp \ + @$(PROJECT_ROOT)/netware/phplib.imp +EXPORT = php4_module + + +# Virtual paths +vpath %.cpp . +vpath %.c . +vpath %.obj $(OBJ_DIR) + + +all: prebuild project + +.PHONY: all + +prebuild: + @if not exist $(OBJ_DIR) md $(OBJ_DIR) + +project: $(BINARY) $(MESSAGE) + @echo Build complete. + + +$(OBJ_DIR)/%.d: %.c + @echo Building Dependencies for $(<F) + @$(CC) -M $< $(C_FLAGS) -o $@ + +$(OBJ_DIR)/%.obj: %.c + @echo Compiling $?... + @$(CC) $< $(C_FLAGS) -o $@ + + +#$(BINARY): $(DEPDS) $(OBJECTS) +$(BINARY): $(OBJECTS) + @echo Import $(IMPORT) > $(basename $@).def +ifdef API + @echo Import $(API) >> $(basename $@).def +endif + @echo Module $(MODULE) >> $(basename $@).def +ifdef EXPORT + @echo Export $(EXPORT) >> $(basename $@).def +endif + @echo AutoUnload >> $(basename $@).def +ifeq '$(BUILD)' 'debug' + @echo Debug >> $(basename $@).def +endif + @echo Flag_On 0x00000008 >> $(basename $@).def + @echo Start _lib_start >> $(basename $@).def + @echo Exit _lib_stop >> $(basename $@).def + + $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc + @echo xdcdata $(basename $@).xdc >> $(basename $@).def + + @echo Linking $@... + @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link +ifdef LIBRARY + @echo $(LIBRARY) >> $(basename $@).link +endif + @echo $(OBJECTS) $(APACHE_DIR)/lib/libpre.obj >> $(basename $@).link + + @$(LINK) @$(basename $@).link + + +.PHONY: clean +#clean: cleand cleanobj cleanbin +clean: cleanobj cleanbin + +.PHONY: cleand +cleand: + @echo Deleting all dependency files... + -@del "$(OBJ_DIR)\*.d" + +.PHONY: cleanobj +cleanobj: + @echo Deleting all object files... + -@del "$(OBJ_DIR)\*.obj" + +.PHONY: cleanbin +cleanbin: + @echo Deleting binary files... + -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm" + @echo Deleting MAP, DEF files, etc.... + -@del "$(FINAL_DIR)\$(MODULE_NAME).map" + -@del "$(FINAL_DIR)\$(MODULE_NAME).def" + -@del "$(FINAL_DIR)\$(MODULE_NAME).link" +ifeq '$(BUILD)' 'debug' + -@del $(FINAL_DIR)\$(MODULE_NAME).sym +endif diff --git a/netware/php4cli.mak b/netware/php4cli.mak new file mode 100644 index 0000000000..0fd7d67649 --- /dev/null +++ b/netware/php4cli.mak @@ -0,0 +1,167 @@ +# Temporarily here -- later may go into some batch file +# which will set this as an environment variable +PROJECT_ROOT = ../.. + +# Module details +MODULE_NAME = php +MODULE_DESC = "PHP 4.2.3 - Command Line Interface" +VMAJ = 2 +VMIN = 0 +VREV = 0 + +#include the common settings +include $(PROJECT_ROOT)/netware/common.mif + +# Extensions of all input and output files +.SUFFIXES: +.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d + +# Source files +C_SRC = getopt.c \ + php_cli.c + +# Library files +LIBRARY = + +# Destination directories and files +OBJ_DIR = $(BUILD) +FINAL_DIR = $(BUILD) +MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map +OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.obj) $(C_SRC:.c=.obj)) +DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.d) $(C_SRC:.c=.d)) + +# Binary file +ifndef BINARY + BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm +endif + + +# Compile flags +C_FLAGS += -c -maxerrors 25 -msgstyle gcc +C_FLAGS += -wchar_t on -bool on +C_FLAGS += -processor Pentium +C_FLAGS += -w nounusedarg -msext on +C_FLAGS += -nostdinc +C_FLAGS += -DNETWARE -DTHREAD_SWITCH +C_FLAGS += -DZTS +C_FLAGS += -DNLM_PLATFORM +C_FLAGS += -DN_PLAT_NLM -DNLM=1 -D__NO_MATH_OPS +C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED -DAPACHE_OS_H -DNO_USE_SIGACTION -DMULTITHREAD +C_FLAGS += -DZEND_DEBUG +C_FLAGS += -DNEW_LIBC +#C_FLAGS += -DUSE_WINSOCK_DIRECTLY=1 +#C_FLAGS += -I. -I- -I. -I../../netware -I$(SDK_DIR)/sdk -I$(SDK_DIR)/sdk/nks # ../../netware added for special SYS/STAT.H +C_FLAGS += -I. -I- -I. -I../../netware -I$(SDK_DIR)/include # ../../netware added for special SYS/STAT.H +C_FLAGS += -I$(MWCIncludes) +C_FLAGS += -I- -I../../main -I../../Zend -I../../TSRM -I../../ext/standard +C_FLAGS += -I../../ -I../../netware -I$(PROJECT_ROOT)/regex +C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include + +# Extra stuff based on debug / release builds +ifeq '$(BUILD)' 'debug' + SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym + C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -sym internal -DDEBUGGING -DDKFBPON + C_FLAGS += -r -DZEND_DEBUG + C_FLAGS += -exc cw + LD_FLAGS += -sym on -sym codeview4 -sym internal -osym $(SYM_FILE) + export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib +else + C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -DZEND_DEBUG=0 + C_FLAGS += -opt intrinsics + C_FLAGS += -opt level=4 + LD_FLAGS += -sym off + export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib +endif + + +# Dependencies +MODULE = LibC \ + phplib +IMPORT = @$(SDK_DIR)/imports/libc.imp \ + @$(PROJECT_ROOT)/netware/phplib.imp +EXPORT = +API = + + +# Virtual paths +vpath %.cpp . +vpath %.c . +vpath %.obj $(OBJ_DIR) + + +all: prebuild project + +.PHONY: all + +prebuild: + @if not exist $(OBJ_DIR) md $(OBJ_DIR) + +project: $(BINARY) $(MESSAGE) + @echo Build complete. + + +$(OBJ_DIR)/%.d: %.c + @echo Building Dependencies for $(<F) + @$(CC) -M $< $(C_FLAGS) -o $@ + +$(OBJ_DIR)/%.obj: %.c + @echo Compiling $?... + @$(CC) $< $(C_FLAGS) -o $@ + + +#$(BINARY): $(DEPDS) $(OBJECTS) +$(BINARY): $(OBJECTS) + @echo Import $(IMPORT) > $(basename $@).def +ifdef API + @echo Import $(API) >> $(basename $@).def +endif + @echo Module $(MODULE) >> $(basename $@).def +ifdef EXPORT + @echo Export $(EXPORT) >> $(basename $@).def +endif + @echo AutoUnload >> $(basename $@).def +ifeq '$(BUILD)' 'debug' + @echo Debug >> $(basename $@).def +endif + @echo Flag_On 0x00000008 >> $(basename $@).def + @echo Start _LibCPrelude >> $(basename $@).def + @echo Exit _LibCPostlude >> $(basename $@).def + + $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc + @echo xdcdata $(basename $@).xdc >> $(basename $@).def + + @echo Linking $@... + @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link +ifdef LIBRARY + @echo $(LIBRARY) >> $(basename $@).link +endif + @echo $(OBJECTS) >> $(basename $@).link + + @$(LINK) @$(basename $@).link + + +.PHONY: clean +#clean: cleand cleanobj cleanbin +clean: cleanobj cleanbin + +.PHONY: cleand +cleand: + @echo Deleting all dependency files... + -@del "$(OBJ_DIR)\*.d" + +.PHONY: cleanobj +cleanobj: + @echo Deleting all object files... + -@del "$(OBJ_DIR)\*.obj" + +.PHONY: cleanbin +cleanbin: + @echo Deleting binary files... + -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm" + @echo Deleting MAP, DEF files, etc.... + -@del "$(FINAL_DIR)\$(MODULE_NAME).map" + -@del "$(FINAL_DIR)\$(MODULE_NAME).def" + -@del "$(FINAL_DIR)\$(MODULE_NAME).link" +ifeq '$(BUILD)' 'debug' + -@del $(FINAL_DIR)\$(MODULE_NAME).sym +endif diff --git a/netware/phplib.imp b/netware/phplib.imp index a653554310..c6f8656301 100644 --- a/netware/phplib.imp +++ b/netware/phplib.imp @@ -4,6 +4,7 @@ _efree, _emalloc, _estrdup, _estrndup, +_erealloc, _object_init, _object_init_ex, _persist_alloc, @@ -25,6 +26,7 @@ add_next_index_bool, add_next_index_long, add_next_index_string, add_next_index_stringl, +add_next_index_zval, add_property_long_ex, add_property_string_ex, compiler_globals_id, @@ -46,7 +48,9 @@ _object_and_properties_init, php_addslashes, php_checkuid, php_execute_script, +php_file_le_fopen, php_fopen_primary_script, +php_fopen_wrapper, php_handle_aborted_connection, php_handle_special_queries, php_body_write, @@ -91,7 +95,9 @@ tsrm_startup, virtual_fopen, zend_alter_ini_entry, zend_error, +zend_eval_string, zend_execute_scripts, +zend_extensions, zend_fetch_resource, zend_get_parameters_ex, zend_hash_add_or_update, @@ -106,6 +112,7 @@ zend_hash_get_current_data_ex, zend_hash_index_find, zend_hash_index_update_or_next_insert, zend_hash_init, +zend_hash_init_ex, zend_hash_internal_pointer_reset_ex zend_hash_merge_ex, zend_hash_move_forward_ex, @@ -116,10 +123,12 @@ zend_ini_boolean_displayer_cb, zend_list_insert, zend_llist_add_element, zend_llist_apply, +zend_llist_apply_with_argument, zend_llist_destroy, zend_llist_init, zend_load_extension, zend_parse_parameters, +zend_parse_parameters_ex, zend_printf, zend_register_ini_entries, zend_register_internal_class, @@ -128,8 +137,10 @@ zend_register_long_constant, zend_register_resource, zend_startup_module, zend_standard_class_def, +zend_strip, zend_unregister_ini_entries, zend_wrong_param_count, +OnUpdateBool, OnUpdateInt, OnUpdateString, OnUpdateStringUnempty diff --git a/netware/phplib.mak b/netware/phplib.mak index d7f3904939..a6e79b3fec 100644 --- a/netware/phplib.mak +++ b/netware/phplib.mak @@ -4,10 +4,10 @@ PROJECT_ROOT = . # Module details MODULE_NAME = phplib -MODULE_DESC = "PHP 4.0.8 for NetWare (Beta) - PHP Library" -VMAJ = 0 -VMIN = 60 -VREV = 1 +MODULE_DESC = "PHP 4.2.3 - Script Interpreter and Library" +VMAJ = 2 +VMIN = 0 +VREV = 0 #include the common settings include $(PROJECT_ROOT)/netware/common.mif @@ -58,11 +58,14 @@ C_SRC = ext/bcmath/bcmath.c \ ext/pcre/pcrelib/get.c \ ext/pcre/pcrelib/maketables.c \ ext/pcre/pcrelib/pcre.c \ + ext/pcre/pcrelib/pcreposix.c \ ext/pcre/pcrelib/study.c \ ext/session/mod_files.c \ + ext/session/mod_mm.c \ ext/session/mod_user.c \ ext/session/session.c \ ext/snmp/snmp.c \ + ext/standard/aggregation.c \ ext/standard/array.c \ ext/standard/assert.c \ ext/standard/base64.c \ @@ -99,7 +102,7 @@ C_SRC = ext/bcmath/bcmath.c \ ext/standard/microtime.c \ ext/standard/pack.c \ ext/standard/pageinfo.c \ - ext/standard/parsedate.c \ + ext/standard/parsedate.c \ ext/standard/php_fopen_wrapper.c \ ext/standard/quot_print.c \ ext/standard/rand.c \ @@ -114,6 +117,8 @@ C_SRC = ext/bcmath/bcmath.c \ ext/standard/url_scanner.c \ ext/standard/url_scanner_ex.c \ ext/standard/var.c \ + ext/standard/var_unserializer.c \ + ext/standard/versioning.c \ main/fopen_wrappers.c \ main/internal_functions_nw.c \ main/main.c \ @@ -124,6 +129,7 @@ C_SRC = ext/bcmath/bcmath.c \ main/php_ini.c \ main/php_logos.c \ main/php_open_temporary_file.c \ + main/php_sprintf.c \ main/php_ticks.c \ main/php_variables.c \ main/reentrancy.c \ @@ -138,9 +144,10 @@ C_SRC = ext/bcmath/bcmath.c \ netware/mktemp.c \ netware/pipe.c \ netware/pwd.c \ - netware/sendmail.c \ netware/start.c \ + netware/time_nw.c \ netware/wfile.c \ + regex/main.c \ regex/regcomp.c \ regex/regerror.c \ regex/regexec.c \ @@ -167,6 +174,8 @@ C_SRC = ext/bcmath/bcmath.c \ # ext/wddx/wddx.c \ # netware/readdir.c \ +WIN32_C_SRC = sendmail.c \ + CPP_SRC_NODIR = $(notdir $(CPP_SRC)) C_SRC_NODIR = $(notdir $(C_SRC)) @@ -174,7 +183,7 @@ SRC_DIR = $(dir $(CPP_SRC) $(C_SRC)) # Library files LIBRARY = $(PROJECT_ROOT)/Zend/$(BUILD)/Zend.lib $(PROJECT_ROOT)/TSRM/$(BUILD)/TSRM.lib -LIBRARY += $(PROJECT_ROOT)/win32build/lib/resolv.lib +#LIBRARY += $(PROJECT_ROOT)/win32build/lib/resolv.lib #LIBRARY += libmysql.lib # Destination directories and files @@ -182,6 +191,7 @@ OBJ_DIR = $(BUILD) FINAL_DIR = $(BUILD) MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map OBJECTS = $(join $(SRC_DIR), $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj))) +WIN32_OBJECTS = $(addprefix $(OBJ_DIR)/,$(WIN32_C_SRC:.c=.obj)) DEPDS = $(join $(SRC_DIR), $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d))) # Binary file @@ -197,6 +207,7 @@ C_FLAGS += -nostdinc -nosyspath C_FLAGS += -DNETWARE -D__BIT_TYPES_DEFINED__ -DZTS #C_FLAGS += -DZEND_DEBUG C_FLAGS += -DPHP4DLLTS_EXPORTS -DPHP_EXPORTS -DLIBZEND_EXPORTS -DTSRM_EXPORTS -DSAPI_EXPORTS +C_FLAGS += -DCLIB_STAT_PATCH C_FLAGS += -DHAVE_SYS_TIME_H -DHAVE_STRUCT_FLOCK -DVIRTUAL_DIR -DHAVE_TZNAME C_FLAGS += -DHAVE_DLFCN_H -DHAVE_LIBDL #C_FLAGS += -DCOMPILE_DL_LDAP @@ -209,10 +220,11 @@ C_FLAGS += -Iext/bcmath -Iext/bcmath/libbcmath/src C_FLAGS += -Iext/xml -Iext/xml/expat/xmltok -Iext/xml/expat -Iext/xml/expat/xmlparse C_FLAGS += -Iext/odbc -Iext/session -Iext/ftp -Iext/wddx -Iext/calendar -Iext/snmp #C_FLAGS += -Iext/mysql -Iext/mysql/libmysql -#C_FLAGS += -I- -Inetware -I$(SDK_DIR)/sdk -I$(MWCIncludes) # netware added for special SYS/STAT.H : Venkat(6/2/02) -C_FLAGS += -I- -Inetware -I$(SDK_DIR)/include -I$(MWCIncludes) # netware added for special SYS/STAT.H : Venkat(6/2/02) +#C_FLAGS += -I- -Inetware -I$(SDK_DIR)/sdk -I$(MWCIncludes) # netware added for special SYS/STAT.H +C_FLAGS += -I- -Inetware -I$(SDK_DIR)/include -I$(MWCIncludes) # netware added for special SYS/STAT.H +C_FLAGS += -Iwin32 -C_FLAGS += -I$(SDK_DIR)/include/winsock # Added for socket calls : Ananth (16 Aug 2002) +C_FLAGS += -I$(SDK_DIR)/include/winsock # Added for socket calls #C_FLAGS += -I$(LDAP_DIR)/inc @@ -244,7 +256,7 @@ API = NXGetEnvCount \ # Virtual paths vpath %.cpp . -vpath %.c . +vpath %.c . win32 vpath %.obj $(OBJ_DIR) @@ -297,7 +309,8 @@ project: $(BINARY) $(MESSAGE) #$(BINARY): $(DEPDS) $(OBJECTS) $(LIBRARY) -$(BINARY): $(OBJECTS) $(LIBRARY) +##$(BINARY): $(OBJECTS) $(LIBRARY) +$(BINARY): $(OBJECTS) $(WIN32_OBJECTS) $(LIBRARY) @echo Import $(IMPORT) > $(basename $@).def ifdef API @echo Import $(API) >> $(basename $@).def @@ -339,14 +352,17 @@ endif @echo $(wordlist 111, 115, $(OBJECTS)) >> $(basename $@).link @echo $(wordlist 116, 120, $(OBJECTS)) >> $(basename $@).link @echo $(wordlist 121, 125, $(OBJECTS)) >> $(basename $@).link - @echo $(wordlist 126, 127, $(OBJECTS)) >> $(basename $@).link -# @echo $(wordlist 126, 134, $(OBJECTS)) >> $(basename $@).link + @echo $(wordlist 126, 130, $(OBJECTS)) >> $(basename $@).link + @echo $(wordlist 131, 134, $(OBJECTS)) >> $(basename $@).link + + @echo $(wordlist 1, 2, $(WIN32_OBJECTS)) >> $(basename $@).link @$(LINK) @$(basename $@).link .PHONY: clean -clean: cleand cleanobj cleanbin +#clean: cleand cleanobj cleanbin +clean: cleansrc cleanobj cleanbin .PHONY: cleand cleand: @@ -374,6 +390,13 @@ cleand: -@del "ext\calendar\$(OBJ_DIR)\*.d" -@del "ext\snmp\$(OBJ_DIR)\*.d" +.PHONY: cleansrc +cleansrc: + @echo Deleting all generated source files... + -@del "parsedate.c" + -@del "parsedate.h" + -@del "parsedate.output" + .PHONY: cleanobj cleanobj: @echo Deleting all object files... diff --git a/netware/pipe.c b/netware/pipe.c new file mode 100644 index 0000000000..b34852e6fb --- /dev/null +++ b/netware/pipe.c @@ -0,0 +1,91 @@ + +/* + * FILENAME : pipe.c + * DESCRIPTION : Functions to implement pipes on NetWare. + * Author : Anantha Kesari H Y, Venkat Raghavan S + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "netware/pipe.h" +#include "netware/mktemp.h" + + +/* Following definitions unavailable in LibC, hence borrowed from CLib */ +#define P_WAIT 0 +#define P_NOWAIT 1 + +#define WHITESPACE " \t" +#define MAX_ARGS 10 + + +FILE* popen(const char* commandline, const char* mode) +{ + char *command = NULL, *argv[MAX_ARGS] = {"\0"}; + char *tempName = "phpXXXXXX.tmp"; + char *filePath = NULL; + FILE *fp = NULL; + char *ptr = NULL; + int ptrLen = 0, argc = 0, i = 0; + + /* Check for validity of input parameters */ + if (!commandline || !mode) + return NULL; + + /* Get temporary file name */ + filePath = mktemp(tempName); + if (!filePath) + return NULL; + consoleprintf("filePath = %s\n", filePath); + + /* Separate commandline string into words */ + + ptr = strtok((char*)commandline, WHITESPACE); + ptrLen = strlen(ptr); + + command = (char*)malloc(ptrLen + 1); + strcpy (command, ptr); + + ptr = strtok(NULL, WHITESPACE); + while (ptr && (argc < MAX_ARGS)) + { + ptrLen = strlen(ptr); + + argv[argc] = (char*)malloc(ptrLen + 1); + strcpy (argv[argc], ptr); + + argc++; + + ptr = strtok(NULL, WHITESPACE); + } +/*consoleprintf ("PHP | popen: command = %s\n", command);*/ + if(strchr(mode,'r') != 0) + { + /*spawnvp(P_WAIT, command, argv);*/ + + fp = fopen(filePath, "r"); /* Get the file handle of the pipe */ + } + else if(strchr(mode,'w') != 0) + fp = fopen(filePath, "w"); /* Get the file handle of the pipe */ + + /* Free resources */ + free (command); + for (i = 0; i < argc; i++) + { +/*consoleprintf ("%s\t", argv[i]);*/ + free (argv[i]); + } +/*consoleprintf ("\n");*/ + + return fp; /* Return the file handle.*/ +} + + +int pclose(FILE* stream) +{ + return (fclose(stream)); +} diff --git a/netware/pipe.h b/netware/pipe.h new file mode 100644 index 0000000000..c2e978581f --- /dev/null +++ b/netware/pipe.h @@ -0,0 +1,6 @@ + +/* pipe related function declarations */ + +FILE* popen(const char* command, const char* mode); +int pclose(FILE* stream); + diff --git a/netware/postgres_ext.h b/netware/postgres_ext.h new file mode 100644 index 0000000000..9b79a23f15 --- /dev/null +++ b/netware/postgres_ext.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * postgres_ext.h + * + * This file contains declarations of things that are visible everywhere + * in PostgreSQL *and* are visible to clients of frontend interface libraries. + * For example, the Oid type is part of the API of libpq and other libraries. + * + * Declarations which are specific to a particular interface should + * go in the header file for that interface (such as libpq-fe.h). This + * file is only for fundamental Postgres declarations. + * + * User-written C functions don't count as "external to Postgres." + * Those function much as local modifications to the backend itself, and + * use header files that are otherwise internal to Postgres to interface + * with the backend. + * + * $Id$ + * + *------------------------------------------------------------------------- + */ + +#ifndef POSTGRES_EXT_H +#define POSTGRES_EXT_H + +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +#define InvalidOid ((Oid) 0) + +#define OID_MAX UINT_MAX +/* you will need to include <limits.h> to use the above #define */ + + +/* + * NAMEDATALEN is the max length for system identifiers (e.g. table names, + * attribute names, function names, etc.) + * + * NOTE that databases with different NAMEDATALEN's cannot interoperate! + */ +#define NAMEDATALEN 32 + +#endif diff --git a/netware/pwd.c b/netware/pwd.c new file mode 100644 index 0000000000..41861a054f --- /dev/null +++ b/netware/pwd.c @@ -0,0 +1,86 @@ +/* pwd.c - Try to approximate UN*X's getuser...() functions under MS-DOS. + Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + + 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 the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Header$ + */ + +/* This 'implementation' is conjectured from the use of this functions in + the RCS and BASH distributions. Of course these functions don't do too + much useful things under MS-DOS, but using them avoids many "#ifdef + MSDOS" in ported UN*X code ... */ + +#include "php.h" /*php specific */ +/* Need to take care of all the commented stuff later for NetWare */ +/* +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <lmaccess.h> +*/ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +/*#include <lmapibuf.h>*/ +#include "pwd.h" +#include "grp.h" + +#ifndef THREAD_SAFE +static struct passwd pw; /* should we return a malloc()'d structure */ +#endif +static char *home_dir = "."; /* we feel (no|every)where at home */ +static char *login_shell = "not command.com!"; + +struct passwd *getpwnam(char *name) +{ + return (struct passwd *) 0; +} + + +char *getlogin() +{ +/* + static char name[256]; + DWORD dw = 256; + GetUserName(name, &dw); + return name; +*/ + return NULL; /* For now */ +} + +struct passwd * + getpwuid(int uid) +{ + pw.pw_name = getlogin(); + pw.pw_dir = home_dir; + pw.pw_shell = login_shell; + pw.pw_uid = 0; + + return &pw; +} + +/* Implementation for now */ +int getpid() +{ + return -1; +} + +/* + * Local Variables: + * mode:C + * ChangeLog:ChangeLog + * compile-command:make + * End: + */ diff --git a/netware/pwd.h b/netware/pwd.h index 2a6ee7373b..703710a0d1 100644 --- a/netware/pwd.h +++ b/netware/pwd.h @@ -15,6 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Header$ */ /* This 'implementation' is conjectured from the use of this functions in @@ -45,5 +46,7 @@ struct passwd { extern struct passwd *getpwuid(int); extern struct passwd *getpwnam(char *name); extern char *getlogin(void); - +#ifndef NEW_LIBC +int getpid(); +#endif #endif diff --git a/netware/start.c b/netware/start.c index 7baeb24036..c9b69b3783 100644 --- a/netware/start.c +++ b/netware/start.c @@ -1,22 +1,28 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2002 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: Novell, Inc. | - +----------------------------------------------------------------------+ - */ - - +/*============================================================================= += CodeWarrior Stationery for Creating a NetWare Executable with NKS/LibC += += Copyright (C) Unpublished Work of Novell, Inc. All Rights Reserved. += += This work is an unpublished work and contains confidential, proprietary and += trade secret information of Novell, Inc. Access to this work is restricted += to (i) Novell, Inc. employees who have a need to know how to perform tasks += within the scope of their assignments and (ii) entities other than Novell, += Inc. who have entered into appropriate license agreements. No part of this += work may be used, practiced, performed, copied, distributed, revised, modi- += fied, translated, abridged, condensed, expanded, collected, compiled, link- += ed, recast, transformed or adapted without the prior written consent of += Novell, Inc. Any use or exploitation of this work without authorization += could subject the perpetrator to criminal and civil liability. += += CodeWarrior is a trademark of Metrowerks Corporation, a Motorola Company. += NetWare is a trademark of Novell, Inc. += += When this file is used to instantiate real source code in the CodeWarrior += IDE, this copyright notice should be removed and replaced with a different += copyright indicating ownership by the developer. Novell assumes no += liability for how this sample code is used or modified by any developer. +=============================================================================== +*/ #include <library.h> #include <netware.h> #include <nks/synch.h> diff --git a/netware/sysexits.h b/netware/sysexits.h new file mode 100644 index 0000000000..37246b6e75 --- /dev/null +++ b/netware/sysexits.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 1987, 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. + * 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. + * + * @(#)sysexits.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _SYSEXITS_H +#define _SYSEXITS_H 1 + +/* + * SYSEXITS.H -- Exit status codes for system programs. + * + * This include file attempts to categorize possible error + * exit statuses for system programs, notably delivermail + * and the Berkeley network. + * + * Error numbers begin at EX__BASE to reduce the possibility of + * clashing with other exit statuses that random programs may + * already return. The meaning of the codes is approximately + * as follows: + * + * EX_USAGE -- The command was used incorrectly, e.g., with + * the wrong number of arguments, a bad flag, a bad + * syntax in a parameter, or whatever. + * EX_DATAERR -- The input data was incorrect in some way. + * This should only be used for user's data & not + * system files. + * EX_NOINPUT -- An input file (not a system file) did not + * exist or was not readable. This could also include + * errors like "No message" to a mailer (if it cared + * to catch it). + * EX_NOUSER -- The user specified did not exist. This might + * be used for mail addresses or remote logins. + * EX_NOHOST -- The host specified did not exist. This is used + * in mail addresses or network requests. + * EX_UNAVAILABLE -- A service is unavailable. This can occur + * if a support program or file does not exist. This + * can also be used as a catchall message when something + * you wanted to do doesn't work, but you don't know + * why. + * EX_SOFTWARE -- An internal software error has been detected. + * This should be limited to non-operating system related + * errors as possible. + * EX_OSERR -- An operating system error has been detected. + * This is intended to be used for such things as "cannot + * fork", "cannot create pipe", or the like. It includes + * things like getuid returning a user that does not + * exist in the passwd file. + * EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp, + * etc.) does not exist, cannot be opened, or has some + * sort of error (e.g., syntax error). + * EX_CANTCREAT -- A (user specified) output file cannot be + * created. + * EX_IOERR -- An error occurred while doing I/O on some file. + * EX_TEMPFAIL -- temporary failure, indicating something that + * is not really an error. In sendmail, this means + * that a mailer (e.g.) could not create a connection, + * and the request should be reattempted later. + * EX_PROTOCOL -- the remote system returned something that + * was "not possible" during a protocol exchange. + * EX_NOPERM -- You did not have sufficient permission to + * perform the operation. This is not intended for + * file system problems, which should use NOINPUT or + * CANTCREAT, but rather for higher level permissions. + */ + +#define EX_OK 0 /* successful termination */ + +#define EX__BASE 64 /* base value for error messages */ + +#define EX_USAGE 64 /* command line usage error */ +#define EX_DATAERR 65 /* data format error */ +#define EX_NOINPUT 66 /* cannot open input */ +#define EX_NOUSER 67 /* addressee unknown */ +#define EX_NOHOST 68 /* host name unknown */ +#define EX_UNAVAILABLE 69 /* service unavailable */ +#define EX_SOFTWARE 70 /* internal software error */ +#define EX_OSERR 71 /* system error (e.g., can't fork) */ +#define EX_OSFILE 72 /* critical OS file missing */ +#define EX_CANTCREAT 73 /* can't create (user) output file */ +#define EX_IOERR 74 /* input/output error */ +#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ +#define EX_PROTOCOL 76 /* remote error in protocol */ +#define EX_NOPERM 77 /* permission denied */ +#define EX_CONFIG 78 /* configuration error */ + +#define EX__MAX 78 /* maximum listed value */ + +#endif /* sysexits.h */ diff --git a/netware/time_nw.c b/netware/time_nw.c new file mode 100644 index 0000000000..195f18cdd9 --- /dev/null +++ b/netware/time_nw.c @@ -0,0 +1,246 @@ + +/***************************************************************************** + * * + * DH_TIME.C * + * * + * Freely redistributable and modifiable. Use at your own risk. * + * * + * Copyright 1994 The Downhill Project * + * + * Modified by Shane Caraveo for use with PHP + * + *****************************************************************************/ + +/* $Id$ */ + + /** + * + * 04-Feb-2001 + * - Added patch by "Vanhanen, Reijo" <Reijo.Vanhanen@helsoft.fi> + * Improves accuracy of msec + */ + +/* Include stuff ************************************************************ */ + +#include "time_nw.h" +#include "unistd.h" +#include "signal.h" +/*#include <winbase.h> +#include <mmsystem.h>*/ +#include <errno.h> +/* +int getfilesystemtime(struct timeval *time_Info) +{ +FILETIME ft; +__int64 ff; + + GetSystemTimeAsFileTime(&ft); *//* 100 ns blocks since 01-Jan-1641 *//* + *//* resolution seems to be 0.01 sec *//* + ff = *(__int64*)(&ft); + time_Info->tv_sec = (int)(ff/(__int64)10000000-(__int64)11644473600); + time_Info->tv_usec = (int)(ff % 10000000)/10; + return 0; +} +*/ + + +int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info) +{ +#ifdef NETWARE + return 0; +#else + static struct timeval starttime = {0, 0}; + static __int64 lasttime = 0; + static __int64 freq = 0; + __int64 timer; + LARGE_INTEGER li; + BOOL b; + double dt; + + /* Get the time, if they want it */ + if (time_Info != NULL) { + if (starttime.tv_sec == 0) { + b = QueryPerformanceFrequency(&li); + if (!b) { + starttime.tv_sec = -1; + } + else { + freq = li.QuadPart; + b = QueryPerformanceCounter(&li); + if (!b) { + starttime.tv_sec = -1; + } + else { + getfilesystemtime(&starttime); + timer = li.QuadPart; + dt = (double)timer/freq; + starttime.tv_usec -= (int)((dt-(int)dt)*1000000); + if (starttime.tv_usec < 0) { + starttime.tv_usec += 1000000; + --starttime.tv_sec; + } + starttime.tv_sec -= (int)dt; + } + } + } + if (starttime.tv_sec > 0) { + b = QueryPerformanceCounter(&li); + if (!b) { + starttime.tv_sec = -1; + } + else { + timer = li.QuadPart; + if (timer < lasttime) { + getfilesystemtime(time_Info); + dt = (double)timer/freq; + starttime = *time_Info; + starttime.tv_usec -= (int)((dt-(int)dt)*1000000); + if (starttime.tv_usec < 0) { + starttime.tv_usec += 1000000; + --starttime.tv_sec; + } + starttime.tv_sec -= (int)dt; + } + else { + lasttime = timer; + dt = (double)timer/freq; + time_Info->tv_sec = starttime.tv_sec + (int)dt; + time_Info->tv_usec = starttime.tv_usec + (int)((dt-(int)dt)*1000000); + if (time_Info->tv_usec > 1000000) { + time_Info->tv_usec -= 1000000; + ++time_Info->tv_sec; + } + } + } + } + if (starttime.tv_sec < 0) { + getfilesystemtime(time_Info); + } + + } + /* Get the timezone, if they want it */ + if (timezone_Info != NULL) { + _tzset(); + timezone_Info->tz_minuteswest = _timezone; + timezone_Info->tz_dsttime = _daylight; + } + /* And return */ + return 0; +#endif +} + + +/* this usleep isnt exactly accurate but should do ok */ +/* +void usleep(unsigned int useconds) +{ +struct timeval tnow, tthen, t0; + + gettimeofday(&tthen, NULL); + t0 = tthen; + tthen.tv_usec += useconds; + while (tthen.tv_usec > 1000000) { + tthen.tv_usec -= 1000000; + tthen.tv_sec++; + } + + if (useconds > 10000) { + useconds -= 10000; + Sleep(useconds/1000); + } + + while (1) { + gettimeofday(&tnow, NULL); + if (tnow.tv_sec > tthen.tv_sec) { + break; + } + if (tnow.tv_sec == tthen.tv_sec) { + if (tnow.tv_usec > tthen.tv_usec) { + break; + } + } + } +} +*/ + +#ifdef HAVE_SETITIMER + +/* +#ifndef THREAD_SAFE +unsigned int proftimer, virttimer, realtimer; +extern LPMSG phpmsg; +#endif + +struct timer_msg { + int signal; + unsigned int threadid; +}; + + +LPTIMECALLBACK setitimer_timeout(UINT uTimerID, UINT info, DWORD dwUser, DWORD dw1, DWORD dw2) +{ + struct timer_msg *msg = (struct timer_msg *) info; + + if (msg) { + raise((int) msg->signal); + PostThreadMessage(msg->threadid, + WM_NOTIFY, msg->signal, 0); + free(msg); + } + return 0; +} + +int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue) +{ + int timeout = value->it_value.tv_sec * 1000 + value->it_value.tv_usec; + int repeat = TIME_ONESHOT; +*/ + /*make sure the message queue is initialized *//* + PeekMessage(phpmsg, NULL, WM_USER, WM_USER, PM_NOREMOVE); + if (timeout > 0) { + struct timer_msg *msg = malloc(sizeof(struct timer_msg)); + msg->threadid = GetCurrentThreadId(); + if (!ovalue) { + repeat = TIME_PERIODIC; + } + switch (which) { + case ITIMER_REAL: + msg->signal = SIGALRM; + realtimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat); + break; + case ITIMER_VIRT: + msg->signal = SIGVTALRM; + virttimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat); + break; + case ITIMER_PROF: + msg->signal = SIGPROF; + proftimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat); + break; + default: + errno = EINVAL; + return -1; + break; + } + } else { + switch (which) { + case ITIMER_REAL: + timeKillEvent(realtimer); + break; + case ITIMER_VIRT: + timeKillEvent(virttimer); + break; + case ITIMER_PROF: + timeKillEvent(proftimer); + break; + default: + errno = EINVAL; + return -1; + break; + } + } + + + return 0; +} +*/ +#endif diff --git a/netware/time_nw.h b/netware/time_nw.h new file mode 100644 index 0000000000..c67065fdf2 --- /dev/null +++ b/netware/time_nw.h @@ -0,0 +1,57 @@ +/***************************************************************************** + * * + * sys/time.h * + * * + * Freely redistributable and modifiable. Use at your own risk. * + * * + * Copyright 1994 The Downhill Project * + * + * Modified by Shane Caraveo for PHP + * + *****************************************************************************/ +#ifndef TIME_H +#define TIME_H + +/* Include stuff ************************************************************ */ +#ifdef USE_WINSOCK +/*#include <ws2nlm.h>*/ +#include <novsock2.h> +#else +#include <sys/socket.h> +#endif +#include <time.h> + +/* +Commented out most of the stuff for now, since we dunno the utility right now +*/ + +/* Struct stuff ************************************************************* */ +/* +struct { + int tz_minuteswest; + int tz_dsttime; +} timezone; +*/ +/* +struct { + struct timeval it_interval; *//* next value *//* + struct timeval it_value; *//* current value *//* +} itimerval; +*/ +#define ITIMER_REAL 0 /*generates sigalrm */ +#define ITIMER_VIRTUAL 1 /*generates sigvtalrm */ +#define ITIMER_VIRT 1 /*generates sigvtalrm */ +#define ITIMER_PROF 2 /*generates sigprof */ + +/* Prototype stuff ********************************************************** */ +/* +extern int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info); +*/ + +/* setitimer operates at 100 millisecond resolution */ +/* +extern int setitimer(int which, const struct itimerval *value, + struct itimerval *ovalue); +*/ + +#endif diff --git a/netware/tsrm.mak b/netware/tsrm.mak index 94603934dc..337caf7206 100644 --- a/netware/tsrm.mak +++ b/netware/tsrm.mak @@ -17,9 +17,9 @@ include $(PROJECT_ROOT)/netware/common.mif # Source files CPP_SRC = C_SRC = TSRM.c \ + tsrm_nw.c \ tsrm_strtok_r.c \ tsrm_virtual_cwd.c \ - tsrm_nw.c # Destination directories and files OBJ_DIR = $(BUILD) @@ -33,14 +33,23 @@ ifndef BINARY endif # Compile flags -C_FLAGS = -c -maxerrors 25 -msgstyle gcc +#C_FLAGS = -c -maxerrors 25 -processor Pentium -align packed +#C_FLAGS += -w on -cpp_exceptions on -wchar_t off -bool on +#C_FLAGS += -msgstyle gcc -ext obj -ARM on -msext off -ansi off -nostdinc +C_FLAGS += -c -maxerrors 25 -msgstyle gcc C_FLAGS += -wchar_t on -bool on -C_FLAGS += -processor Pentium -align 1 +C_FLAGS += -processor Pentium +#C_FLAGS += -r C_FLAGS += -nostdinc +#C_FLAGS += -ext obj +#C_FLAGS += -DNLM_PLATFORM -D__GNUC__ -DTSRM_EXPORTS -D_LIB C_FLAGS += -DZTS -DNETWARE -DHAVE_DIRENT_H +C_FLAGS += -DNEW_LIBC +C_FLAGS += -DCLIB_STAT_PATCH #C_FLAGS += -DUSE_PIPE_OPEN C_FLAGS += -DUSE_MKFIFO -C_FLAGS += -DCLIB_STAT_PATCH -DUSE_MPK +##C_FLAGS += -DUSE_MPK # To use the LibC recursive mutex locking +#C_FLAGS += -I. -I- -I../netware -I$(SDK_DIR)/sdk # ../netware added for special SYS/STAT.H C_FLAGS += -I. -I- -I../netware -I$(SDK_DIR)/include # ../netware added for special SYS/STAT.H C_FLAGS += -I$(MPK_DIR)/include1 C_FLAGS += -I$(MWCIncludes) @@ -79,18 +88,28 @@ project: $(BINARY) $(MESSAGE) $(OBJ_DIR)/%.d: %.c @echo Building Dependencies for $(<F) @$(CC) -M $< $(C_FLAGS) -o $@ + +$(OBJ_DIR)/%.d: %.cpp + @echo Building Dependencies for $(<F) + @$(CC) -M $< $(C_FLAGS) -o $@ + +$(OBJ_DIR)/%.obj: %.cpp + @echo Compiling $?... + @$(CC) $< $(C_FLAGS) -o $@ $(OBJ_DIR)/%.obj: %.c @echo Compiling $?... @$(CC) $< $(C_FLAGS) -o $@ -$(BINARY): $(DEPDS) $(OBJECTS) +#$(BINARY): $(DEPDS) $(OBJECTS) +$(BINARY): $(OBJECTS) @echo Linking $@... @$(LINK) $(LD_FLAGS) $(OBJECTS) .PHONY: clean -clean: cleand cleanobj cleanbin +#clean: cleand cleanobj cleanbin +clean: cleanobj cleanbin .PHONY: cleand cleand: diff --git a/netware/wfile.c b/netware/wfile.c new file mode 100644 index 0000000000..a887ee93df --- /dev/null +++ b/netware/wfile.c @@ -0,0 +1,17 @@ + +/* Function borrowed from the Downhill Project */ +#include "wfile.h" +/*#include "direct.h"*/ /* Can't find this file */ + +int readlink(char *file_Name, char *buf_Mem, int buf_Size) +{ + /* See if the file exists */ + if (access(file_Name, X_OK) == -1) { + errno = ENOENT; + } else { + errno = EINVAL; + } + + /* Either way, it's not a link */ + return -1; +} diff --git a/netware/wfile.h b/netware/wfile.h new file mode 100644 index 0000000000..7a9614c2cf --- /dev/null +++ b/netware/wfile.h @@ -0,0 +1,16 @@ +/*#include <io.h> */ +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> + +#define access _access +#define X_OK 0 +#ifndef ENOENT +#define ENOENT 136 +#endif +#ifndef EINVAL +#define EINVAL 131 +#endif + +int readlink(char *, char *, int); +int checkroot(char *path); diff --git a/netware/zend.mak b/netware/zend.mak index 5181cc0fa4..85783ca895 100644 --- a/netware/zend.mak +++ b/netware/zend.mak @@ -14,6 +14,13 @@ include $(PROJECT_ROOT)/netware/common.mif .SUFFIXES: .SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d +# Source files +##CC_SRC = zend_ini_scanner_cc.cc \ +## zend_language_scanner_cc.cc + +##CPP_SRC = zend_ini_scanner.cpp \ +## zend_language_scanner.cpp + C_SRC = zend.c \ zend_alloc.c \ zend_API.c \ @@ -28,6 +35,10 @@ C_SRC = zend.c \ zend_highlight.c \ zend_indent.c \ zend_ini.c \ + zend_ini_parser.c \ + zend_ini_scanner.c \ + zend_language_parser.c \ + zend_language_scanner.c \ zend_list.c \ zend_llist.c \ zend_opcode.c \ @@ -38,10 +49,6 @@ C_SRC = zend.c \ zend_stack.c \ zend_static_allocator.c \ zend_variables.c \ - zend_ini_parser.c \ - zend_ini_scanner.c \ - zend_language_parser.c \ - zend_language_scanner.c # Destination directories and files @@ -57,21 +64,30 @@ endif # Compile flags -C_FLAGS = -c -maxerrors 25 -msgstyle std + +#C_FLAGS = -c -maxerrors 25 -processor Pentium -align packed +#C_FLAGS += -msgstyle gcc -ext obj -ARM on +#C_FLAGS += -cpp_exceptions on -wchar_t off -bool on -w on -ansi off -nostdinc -nosyspath +C_FLAGS += -c -maxerrors 25 -msgstyle std C_FLAGS += -wchar_t on -bool on -C_FLAGS += -processor Pentium -align 1 +C_FLAGS += -processor Pentium +#C_FLAGS += -r C_FLAGS += -nostdinc +#C_FLAGS += -nosyspath -ext obj C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED -C_FLAGS += -DNETWARE -D__GNUC__ -C_FLAGS += -DZTS -C_FLAGS += -DCLIB_STAT_PATCH +C_FLAGS += -DNETWARE -DZTS C_FLAGS += -DTHREAD_SWITCH +#C_FLAGS += -I. -I- -I../netware -I$(SDK_DIR)/sdk # ../netware added for special SYS/STAT.H C_FLAGS += -I. -I- -I../netware -I$(SDK_DIR)/include # ../netware added for special SYS/STAT.H C_FLAGS += -I$(MWCIncludes) +#C_FLAGS += -lang c++ -prefix NLM_PREFIX.H +#C_FLAGS += -ext obj -msext on -r -RTTI on + # Link flags LD_FLAGS = -type library LD_FLAGS += -o $(BINARY) +#LDFLAGS += -zerobss -nofail -msgstyle gcc -nostderr # Extra stuff based on debug / release builds @@ -116,22 +132,48 @@ project: $(BINARY) $(MESSAGE) ##zend_language_scanner.c : zend_language_scanner.l ## @flex -i -Pzend -o$@ zend_language_scanner.l + +#zend_ini_scanner.cpp : zend_ini_scanner.l +# @flex -+ -B -i -Sflex.skl -Pini_ -o$@ zend_ini_scanner.l + +#zend_language_scanner.cpp : zend_language_scanner.l +# @flex -+ -B -i -Sflex.skl -Pzend -o$@ zend_language_scanner.l + + +#$(OBJ_DIR)/%.d: %.cpp +# @echo Building Dependencies for $(<F) +# @$(CC) -M $< $(C_FLAGS) -o $@ + $(OBJ_DIR)/%.d: %.c @echo Building Dependencies for $(<F) @$(CC) -M $< $(C_FLAGS) -o $@ + +#$(OBJ_DIR)/%.d: %.cc +# @echo Building Dependencies for $(<F) +# @$(CC) -M $< $(C_FLAGS) -o $@ + +#$(OBJ_DIR)/%.obj: %.cpp +# @echo Compiling $?... +# @$(CC) $< $(C_FLAGS) -o $@ $(OBJ_DIR)/%.obj: %.c @echo Compiling $?... @$(CC) $< $(C_FLAGS) -o $@ +#$(OBJ_DIR)/%.obj: %.cc +# @echo Compiling $?... +# @$(CC) $< $(C_FLAGS) -o $@ + -$(BINARY): $(DEPDS) $(OBJECTS) +#$(BINARY): $(DEPDS) $(OBJECTS) +$(BINARY): $(OBJECTS) @echo Linking $@... @$(LINK) $(LD_FLAGS) $(OBJECTS) .PHONY: clean -clean: cleansrc cleand cleanobj cleanbin +#clean: cleansrc cleand cleanobj cleanbin +clean: cleansrc cleanobj cleanbin .PHONY: cleansrc cleansrc: @@ -145,6 +187,9 @@ cleansrc: -@del "zend_ini_parser.output" -@del "zend_language_parser.output" +# -@del "zend_ini_scanner.cpp" +# -@del "zend_language_scanner.cpp" + .PHONY: cleand cleand: @@ -160,4 +205,10 @@ cleanobj: cleanbin: @echo Deleting binary files... -@del "$(FINAL_DIR)\$(MODULE_NAME).lib" - +# @echo Deleting MAP, DEF files, etc.... +# -@del "$(FINAL_DIR)\$(MODULE_NAME).map" +# -@del "$(FINAL_DIR)\$(MODULE_NAME).def" +# -@del "$(FINAL_DIR)\$(MODULE_NAME).link" +#ifeq '$(BUILD)' 'debug' +# -@del $(FINAL_DIR)\$(MODULE_NAME).sym +#endif |