diff --git a/CODING_STANDARDS b/CODING_STANDARDS deleted file mode 100644 index 477cad33c96ef..0000000000000 --- a/CODING_STANDARDS +++ /dev/null @@ -1,149 +0,0 @@ -PHP Coding Standards -==================== - - -This file lists several standards that any programmer, adding or changing -code in PHP, should follow. Since this file was added at a very late -stage of the development of PHP v3.0, the code base does not (yet) fully -follow it, but it's going in that general direction. -This is an initial version - it'll most probably grow as time passes. - - -Code Implementation -------------------- - -[1] Functions that are given pointers to resources should not free them - -For instance, function int mail(char *to, char *from) should NOT free -to and/or from. -Exceptions: - - - The function's designated behavior is freeing that resource. E.g. efree() - - The function is given a boolean argument, that controls whether or not - the function may free its arguments (if true - the function must free its - arguments, if false - it must not) - - Low-level parser routines, that are tightly integrated with the token - cache and the bison code for minimum memory copying overhead. - -[2] Functions that are tightly integrated with other functions within the - same module, and rely on each other non-trivial behavior, should be - documented as such and declared 'static'. They should be avoided if - possible. - -[3] Use definitions and macros whenever possible, so that constants have - meaningful names and can be easily manipulated. The only exceptions - to this rule are 0 and 1, when used as false and true (respectively). - Any other use of a numeric constant to specify different behavior - or actions should be done through a #define. - -[4] When writing functions that deal with strings, be sure to remember - that PHP holds the length property of each string, and that it - shouldn't be calculated with strlen(). Write your functions in a such - a way so that they'll take advantage of the length property, both - for efficiency and in order for them to be binary-safe. - Functions that change strings and obtain their new lengths while - doing so, should return that new length, so it doesn't have to be - recalculated with strlen() (e.g. _php3_addslashes()) - -[5] Use php3_error() to report any errors/warnings during code execution. - Use descriptive error messages, and try to avoid using identical - error strings for different stages of an error. For example, - if in order to obtain a URL you have to parse the URL, connect, - and retreive the text, assuming something can go wrong at each - of these stages, don't report an error "Unable to get URL" - on all of them, but instead, write something like "Unable - to parse URL", "Unable to connect to URL server" and "Unable - to fetch URL text", respectively. - -[6] NEVER USE strncat(). If you're absolutely sure you know what you're doing, - check its man page again, and only then, consider using it, and even then, - try avoiding it. - - -Naming Conventions ------------------- - -[1] Function names for user functions implementation should be prefixed with - "php3_", and followed by a word or an underscore-delimited list of words, - in lowercase letters, that describes the function. - -[2] Function names used by user functions implementations should be prefixed - with "_php3_", and followed by a word or an underscore-delimited list of - words, in lowercase letters, that describes the function. If applicable, - they should be declared 'static'. - -[3] Variable names must be meaningful. One letter variable names must be - avoided, except for places where the variable has no real meaning or - a trivial meaning (e.g. for (i=0; i<100; i++) ...). - -[4] Variable names should be in lowercase; Use underscores to seperate - between words. - - - -Syntax and indentation ----------------------- - -[1] Never use C++ style comments (i.e. // comment). Always use C-style - comments instead. PHP is written in C, and is aimed at compiling - under any ANSI-C compliant compiler. Even though many compilers - accept C++-style comments in C code, you have to ensure that your - code would compile with other compilers as well. - The only exception to this rule is code that is Win32-specific, - because the Win32 port is MS-Visual C++ specific, and this compiler - is known to accept C++-style comments in C code. - -[2] Use K&R-style. Of course, we can't and don't want to - force anybody to use a style she's not used to, but - at the very least, when you write code that goes into the core - of PHP or one of its standard modules, please maintain the K&R - style. This applies to just about everything, starting with - indentation and comment styles and up to function decleration - syntax. - -[3] Be generous with whitespace and braces. Always prefer - if (foo) { - bar; - } - to - if(foo)bar; - - Keep one empty line between the variable decleration section and - the statements in a block, as well as between logical statement - groups in a block. Maintain at least one empty line between - two functions, preferably two. - -Documentation and Folding Hooks -------------------------------- - -In order to make sure that the online documentation stays in line with -the code, each user-level function should have its user-level function -prototype before it along with a brief one-line description of what the -function does. It would look like this: - -/* {{{ proto int abs(int number) - Return the absolute value of the number */ -void php3_abs(INTERNAL_FUNCTION_PARAMETERS) { - ... -} -/* }}} */ - -The {{{ symbols are the default folding symbols for the folding mode in -Emacs. vim will soon have support for folding as well. Folding is very -useful when dealing with large files because you can scroll through the -file quickly and just unfold the function you wish to work on. The }}} -at the end of each function marks the end of the fold, and should be on -a separate line. - -The "proto" keyword there is just a helper for the doc/genfuncsummary script -which generates a full function summary. Having this keyword in front of the -function prototypes allows us to put folds elsewhere in the code without -messing up the function summary. - -Optional arguments are written like this: - -/* {{{ proto object imap_header(int stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]]) - -And yes, please keep everything on a single line, even if that line is massive. - - diff --git a/CREDITS b/CREDITS deleted file mode 100644 index dbb3f0bceaf87..0000000000000 --- a/CREDITS +++ /dev/null @@ -1,3 +0,0 @@ -For the list of people who've put work into PHP 4.0, please see -http://www.php.net/version4/credits.php - diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index 9777b3b30a60c..0000000000000 --- a/ChangeLog +++ /dev/null @@ -1,9536 +0,0 @@ -1999-11-20 Sascha Schumann - - * ext/dba/config.h.stub - ext/dba/config.m4 - ext/dba/dba.c - ext/dba/dba_db3.c - ext/dba/php3_db3.h - ext/dba/Makefile.am: add Berkeley DB3 support - -1999-11-20 Andrei Zmievski - - * ext/standard/string.c: - (PHP substr_replace) Changed the order of the arguments. - -1999-11-20 Sascha Schumann - - * sapi/cgi/php.sym - sapi/apache/php.sym - acinclude.m4 - configure.in - php.sym: - --enable-versioning can now be used with CGI/AOLserver as well. Note that - we do not use versioning per se anymore, but export only the required - symbols. - -1999-11-20 Andi Gutmans - - * ext/pgsql/pgsql.dsp - ext/mysql/mysql.dsp: - Changed path to MySQL library in Win32 project - -1999-11-20 Thies C. Arntzen - - * ext/standard/string.c: (PHP strtr) new 2-Arg version. - - * NEWS: *** empty log message *** - -1999-11-20 Andi Gutmans - - * ext/pgsql/pgsql.dsp - ext/pgsql/pqsql.dsp: - - Fixed a typo in the name of the project file. It links now - -1999-11-20 changelog - - * NEWS: NEWS update - -1999-11-20 Andi Gutmans - - * ext/pgsql/pgsql.c - ext/pgsql/pqsql.dsp: - - More PGSQL thread-safe updates. It still doesn't work though. Crashes for - some reason at .dll load time - - * ext/pgsql/pgsql.c - ext/pgsql/php3_pgsql.h - ext/pgsql/pqsql.dsp: - Should pretty much work now - - * ext/pgsql/pgsql.c - ext/pgsql/pqsql.dsp: - Add project file - - * ext/pgsql/pgsql.c - ext/pgsql/php3_pgsql.h: - - Start PostgreSQL support for Win32. Just added preliminary ZTS support. - Still need to make minit ZTS. - -1999-11-19 Andrei Zmievski - - * ext/pcre/php_pcre.c: - (PHP preg_replace) Fixed a bug that cause backreferences to lose - their value after the first occurrence. - - * ext/pcre/php_pcre.c: - Fixed a bug that would replace only the first occurrence and result in - a parse error for the rest when using /e modifier. - -1999-11-19 Thies C. Arntzen - - * ext/ftp/ftp.c: is needed on linux - -1999-11-19 Andi Gutmans - - * internal_functions_win32.c: - - Make it consistent with the rest of the stuff there. - - * ext/standard/array.c - internal_functions_win32.c - php4dllts.dsp: - Add array.c to the Win32 project - -1999-11-19 Thies C. Arntzen - - * ext/xml/xml.c: (PHP xml_parse_into_struct) buffer was sometimes short by 1. - -1999-11-19 Zeev Suraski - - * ext/sybase_ct/php_sybase_ct.c - ext/sybase/sybase.c: Optimize a bit - - * ext/sybase_ct/php_sybase_ct.c: Fix a bug in sybase_fetch_hash() - -1999-11-18 Andrew Skalski - - * ext/ftp/ftp.c - ext/ftp/ftp.h: - Removed stdio wrapper from sockets; added timeouts to socket ops. - -1999-11-18 Sascha Schumann - - * sapi/apache/apMakefile.libdir - sapi/apache/apMakefile.tmpl - sapi/apache/config.m4 - apMakefile.libdir - apMakefile.tmpl: - Moving apMakefile.{libdir,tmpl} to sapi/apache directory. - -1999-11-18 Sam Ruby - - * ext/standard/info.c: arg! alphabetize correctly! - - * ext/standard/info.c: add Java module to credit info - -1999-11-17 Sascha Schumann - - * php_globals.h: - Add post request startup handlers. These are called at the end of the - request startup function, and can use the initialized structures like - the symbol table. - - * ext/session/session.c (php_rinit_session): - use post request startups to reenable session.auto_start - - * main.c - php.h: - Add post request startup handlers. These are called at the end of the - request startup function, and can use the initialized structures like - the symbol table. - - * configure.in: - Remove --enable-thread-safety. There is no reason people should be able - to set this manually; most likely, they will burn themselves by using it. - -1999-11-17 Stig Bakken - - * NEWS - php_version.h: Bump version to 4.0b4-dev. - -1999-11-17 Thies C. Arntzen - - * configure.in: b3 is already tagged in CVS - -1999-11-17 changelog - - * NEWS: NEWS update - -1999-11-16 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/php3_string.h - ext/standard/string.c: (PHP substr_replace) New function. - - * ext/standard/array.c: Just some rearranging. - -1999-11-16 Andi Gutmans - - * ext/standard/array.c: - Change used_return_value to return_value_used - - * ext/standard/array.c: - - Initial support for Thies' idea of passing functions a flag telling them - they don't need to return a value. Adjusted reset() to work with this. - It is a bit problematic because if internal functions don't look at the - flag and still return a value orginally this leaked. So I free the value - in any case, which kind of makes the speed gain a bit smaller - -1999-11-16 Stig Bakken - - * NEWS: final news update before 4.0b3 - - * php_version.h - configure.in: 4.0b3 coming up - -1999-11-16 Stig Bakken - - * php_version.h - configure.in: 4.0b3 coming up - -1999-11-15 Andrei Zmievski - - * NEWS: cleaning up - -1999-11-15 changelog - - * NEWS: NEWS update - -1999-11-15 Sascha Schumann - - * ext/mcrypt/mcrypt.c (php_minit_mcrypt): Also allow never versions of mcrypt - - * ext/mhash/mhash.c: - (php_minit_mhash): Don't use REGISTER_LONG_CONSTANT macro, because we - don't have a fixed size array of chars (this used to work nevertheless). - -1999-11-14 Sascha Schumann - - * ext/mhash/mhash.c (PHP mhash): don't segfault, if mhash_end() returns NULL - - * ext/db/config.m4 - ext/db/db.c: Check for db1/ndbm.h and use it in db. Fixes #2647 - -1999-11-14 Andi Gutmans - - * sapi/isapi/php4isapi.dsp - regex/engine.c - regex/regcomp.c: - Fixing warnings in regex - -1999-11-14 Thies C. Arntzen - - * NEWS - ext/standard/array.c: - (PHP k[r]sort) now use compare_function from libzend to be consistent with the language-core. - -1999-11-14 Andi Gutmans - - * sapi/isapi/php4isapi.c - php4isapi/php4isapi.c - php4isapi/php4isapi.def - php4isapi/php4isapi.dsp - php4ts.dsw: - - Remove ISAPI project from main dir as it's been copied to sapi/isapi - -1999-11-14 Thies C. Arntzen - - * NEWS: clearify - - * ext/standard/string.c: (PHP ucfirst,ucwords) no longer modify arg1 - - * ext/standard/string.c: (PHP strtr) no longer modifies arg1. - -1999-11-14 Danny Heijl - - * ext/informix/ifx_custom_build.dsp - ext/informix/ifx_custom_build.dsw - ext/informix/php_informix.h - ext/informix/ifx.dsp - ext/informix/ifx.dsw - ext/informix/ifx.ec: - (ext/informix) Added WIN32 build files for informix driver - and make it compile with ZTS - -1999-11-14 Stig Bakken - - * ext/standard/file.c - ext/standard/file.h - configure.in - php.h: Removed the mkstemp stuff and added tmpfile() function instead. - -1999-11-13 Andrei Zmievski - - * internal_functions.c.in: These are inserted automatically now. - - * ext/standard/basic_functions.c: It's in array.c now. - - * ext/standard/Makefile.am - ext/standard/array.c - ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/php_array.h - internal_functions.c.in: Split array functions into separate module. - -1999-11-13 Sascha Schumann - - * regex/regex_extra.h - php_regex.h: - Suck in prototypes correctly with applied aliases - (otherwise php_reg* would not be prototyped) - -1999-11-13 Andi Gutmans - - * regex/regex_extra.h - php4dllts.dsp: - Make Win32 compile again - -1999-11-13 Sascha Schumann - - * sapi/apache/config.m4: Allow --with-apxs and --with-regex=apache - - * sapi/apache/config.m4 - sapi/apache/libphp4.module.in - regex/regex_extra.h - regex/utils.h - ext/standard/config.m4 - ext/standard/reg.c - Makefile.am - acinclude.m4 - configure.in - php.h - php_regex.h: - Improve regex library selection. It lets user specify whether they want - system, apache, or php's regex library by using the --with-regex option. - "php" is the default; if you use --with-apache in combination with - Apache 1.3.x, the default is "apache". - - * .cvsignore: Remove libtool targets - - * ext/standard/config.m4 - Makefile.am - acinclude.m4 - configure.in: - - remove extra CPPFLAGS from top-level Makefile - - HSREGEX defaults to what the user wants, but can be changed now internally - - * configure.in: Export CPPFLAGS to propagate additional flags - - * configure.in: Fix typo (escape sign was one off) - - * configure.in - php_version.h: preparing 4.0b3-RC5 - - * sapi/cgi/Makefile.am - sapi/isapi/Makefile.am - ext/zlib/Makefile.am - ext/wddx/Makefile.am - ext/yp/Makefile.am - ext/sysvsem/Makefile.am - ext/sysvshm/Makefile.am - ext/sybase/Makefile.am - ext/sybase_ct/Makefile.am - ext/session/Makefile.am - ext/standard/Makefile.am - ext/pdf/Makefile.am - ext/oracle/Makefile.am - ext/pcre/Makefile.am - ext/oci8/Makefile.am - ext/odbc/Makefile.am - ext/msql/Makefile.am - ext/mhash/Makefile.am - ext/mcal/Makefile.am - ext/mcrypt/Makefile.am - ext/interbase/Makefile.am - ext/ldap/Makefile.am - ext/imap/Makefile.am - ext/informix/Makefile.am - ext/hyperwave/Makefile.am - ext/icap/Makefile.am - ext/gettext/Makefile.am - ext/gd/Makefile.am - ext/filepro/Makefile.am - ext/ftp/Makefile.am - ext/dbase/Makefile.am - ext/fdf/Makefile.am - ext/db/Makefile.am - ext/dba/Makefile.am - ext/bcmath/Makefile.am - ext/dav/Makefile.am - ext/apache/Makefile.am - ext/aspell/Makefile.am - configure.in: - Remove the extra INCLUDES line from most automake Mafiles. This is not - necessary, because we can change the value of INCLUDES globally in one - place (configure.in). - - Also add two defines in thread-safe mode - (_REENTRANT and POSIX_PTHREAD_SEMANTICS) - - * acinclude.m4: (AC_EXPAND_PATH) Expand relative paths completely - -1999-11-13 changelog - - * NEWS: NEWS update - -1999-11-12 Sascha Schumann - - * sapi/apache/config.m4 - acinclude.m4 - configure.in - ext/standard/config.m4: Enable selective regex library compilation. - - * regex/cclass.h - regex/cname.h - regex/engine.c - regex/regcomp.c - regex/regcomp.ih - regex/regerror.c - regex/regex.h - regex/regex2.h - regex/regexec.c - regex/utils.h: upgrade regex library to alpha3.8 - -1999-11-12 Thies C. Arntzen - - * ext/oci8/oci8.c: added missing function-alias - - * ext/oci8/oci8.c: oops, didn't mean to activate this! - - * ext/oci8/oci8.c: fixed mested-tables again (broke it when resourcified the driver) - -1999-11-12 changelog - - * NEWS: NEWS update - -1999-11-11 Rasmus Lerdorf - - * MAINTAINERS: -1999-11-11 Thies C. Arntzen - - * fopen-wrappers.c: (PHP fopen) commands send to a FTP-server need to end in "\r\n" (RFC 854) - -1999-11-10 Rasmus Lerdorf - - * ext/gd/config.m4: - * ext/gd/gd.c: This arg is optional - -1999-11-10 Stig Bakken - - * makedist: "import" libtool file preservation code from build.mk - - * build.mk: Shut up warning from automake. - -1999-11-10 Rasmus Lerdorf - - * ext/oci8/oci8.c: -1999-11-10 Andrei Zmievski - - * NEWS: Remove duplicates. - -1999-11-10 changelog - - * NEWS: NEWS update - -1999-11-09 Frank M. Kromann - - * php.ini-dist: Adding default mssql ini-setings - -1999-11-09 Stig Bakken - - * config.w32.h: -1999-11-09 Thies C. Arntzen - - * ext/oracle/config.m4 - ext/oci8/config.m4: IRIX ld likes this order better - -1999-11-09 Sascha Schumann - - * build.mk: Move only, if the file exists. - - * build.mk: - automake overwrites libtool's files, if - - - --add-missing was used - - *_LTLIBRARIES targets are used - - Thus, we preserve our customized files while automake runs - - * config.guess - config.sub: Add libtool helper files - -1999-11-09 Sam Ruby - - * php4dll.dsp: add mergesort into build - -1999-11-09 Stig Bakken - - * configure.in - php_version.h: 4.0b3-RC4 - - * makedist: - Preserve the CVS versions of ltconfig/ltmain.sh during makedist. - -1999-11-09 Rasmus Lerdorf - - * ext/snmp/config.m4: Better lib detection for ucd-snmp - -1999-11-09 Sam Ruby - - * php4dll.dsp: location of output.c moved. - -1999-11-09 Rasmus Lerdorf - - * ext/snmp/config.m4: Find ucd-snmp include files more intelligently - -1999-11-09 Stig Bakken - - * ext/odbc/config.h.stub - ext/odbc/config.m4 - ext/odbc/php3_velocis.h - ext/odbc/php_odbc.c - ext/odbc/php_odbc.h - ext/odbc/velocis.c: - Clean up ODBC HAVE_XXX symbols, compile fixes for OpenLink and Solid. - -1999-11-09 Sascha Schumann - - * ext/session/session.c - php.ini-dist: - set default path for cookie to the root directory ("/") - - complete session documentation in php.ini-dist - -1999-11-09 Sam Ruby - - * MAINTAINERS: add java - -1999-11-09 Sascha Schumann - - * ext/standard/url_scanner.c - ext/standard/url_scanner.re: - Include proper header files (replacement functions were not used). - -1999-11-09 Stig Bakken - - * ext/odbc/config.m4: Fix OpenLink ODBC support - - * configure.in - php_version.h: Bump version to 4.0b3-RC3. - - * makedist: Makedist can now be run from outside the CVS tree. - - * ext/standard/basic_functions.c: -1999-11-09 changelog - - * NEWS: NEWS update - -1999-11-08 Jakub Skopal - - * ext/sybase_ct/php_sybase_ct.c: - "sybase" is definitelly six characters long :-) - -1999-11-08 Stig Bakken - - * configure.in - makedist: Cleaned up makedist a bit more. - - * .cvsignore: ignore distribution files - -1999-11-08 Sascha Schumann - - * build.mk - buildconf - ltconfig - ltmain.sh: - Add libtool files to CVS. Advantages: - - - PHP-specific changes are easier to maintain - - it removes one dependency for users (i.e. GNU vs. FreeBSD ports) - - I have not removed the libtool check in buildconf, since libzend/TSRM still - depend on a local version of libtool. - - * ext/snmp/snmp.c: - Remove prototype. The prototype was not necessary for UCD SNMP 3.5.3, and - broke the build for UCD SNMP 4.0.1. - -1999-11-08 Stig Bakken - - * configure.in - php.h: (PHP tempnam) now uses mkstemp() if available - -1999-11-08 changelog - - * ChangeLog: ChangeLog update - -1999-11-07 changelog - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-11-06 Sascha Schumann - - * build.mk: - limit find to PHP's automake Makefiles - - check whether patches were applied correctly - - * ext/session/session.c: - Disable auto_start until we find a way to access the necessary data fields. - -1999-11-06 Zeev Suraski - - * configure.in - php_version.h: Version update - - * ext/standard/basic_functions.c - ext/session/session.c - ext/com/COM.c - NEWS - mergesort.c - php_ini.h: - Win32 fixes - - COM module improvements from Boris Wedl - -1999-11-06 Thies C. Arntzen - - * ext/standard/var.c: - (PHP var_dump, serialize) now use php.ini's precision size when displying/serializing doubles - -1999-11-06 changelog - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-11-05 Rasmus Lerdorf - - * ext/mysql/php_mysql.c: - We need to use mysql_field_count() instead of mysql_num_fields() if - we are using MySQL 3.22.24 or newer when we want to check a mysql struct - instead of a result struct. The reference is here: - http://www.mysql.com/Manual_chapter/manual_Clients.html#mysql_num_fields - -1999-11-05 Sam Ruby - - * main.c: configuration failures trap server - -1999-11-05 Rasmus Lerdorf - - * LICENSE: -1999-11-05 Thies C. Arntzen - - * ext/sybase/sybase.c: - (php3_sybase_get_column_content) initialize buffer before call to dbconvert() - -1999-11-05 changelog - - * ChangeLog: ChangeLog update - -1999-11-04 Andrei Zmievski - - * ext/standard/basic_functions.c: - (PHP multisort) More work, not yet done though. - -1999-11-04 Rasmus Lerdorf - - * ext/dba/config.m4: Try to avoid IBM/Berkeley DB2 confusion - -1999-11-04 Stig Bakken - - * makedist - configure.in - php_version.h - buildconf: -1999-11-04 changelog - - * ChangeLog: ChangeLog update - -1999-11-03 Andrei Zmievski - - * TODO: *** empty log message *** - -1999-11-03 Frank M. Kromann - - * MAINTAINERS - NEWS: Added MS SQL server module - -1999-11-03 Andi Gutmans - - * NEWS: -1999-11-03 Evan Klinger - - * ext/standard/basic_functions.c: Fix compile warning - -1999-11-03 changelog - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-11-02 Sascha Schumann - - * ext/standard/url_scanner.c - ext/standard/url_scanner.re: Add
tag - - * configure.in: - Additional check for concurrent use of --with-{apache,apxs} - -1999-11-02 Andrei Zmievski - - * ext/standard/basic_functions.c: Remove extraneous comment. - -1999-11-02 Evan Klinger - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: - (PHP getprotoby{name,number}) New Functions - -1999-11-02 changelog - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-11-01 Andrei Zmievski - - * NEWS: *** empty log message *** - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: Added array_pad() function. - -1999-11-01 Charles Hagenbuch - - * ext/imap/imap.c: - Trying to clean up the last of the body->id/body->description confusion. - -1999-11-01 Andrei Zmievski - - * php.ini-dist: Added new session configuration directives. - -1999-11-01 Sascha Schumann - - * ext/snmp/config.m4: Fix for #2631 - -1999-11-01 changelog - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-11-01 Evan Klinger - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: - (PHP getservby{name,port}) New functions. - -1999-10-31 Sascha Schumann - - * ext/session/session.c: Add missing initialization entry - - * ext/mcrypt/mcrypt.c: Support current mcrypt. Tested with libmcrypt-2.2.4 - - * ext/session/php_session.h - ext/session/session.c: - Change session.lifetime to session.cookie_lifetime. And: - -1999-10-31 Sam Ruby - - * configuration-parser.y: -1999-10-31 changelog - - * ChangeLog: ChangeLog update - -1999-10-30 Rasmus Lerdorf - - * php_regex.h: typing in the dark - - * php_regex.h: - Damn, can't see underscores correctly on this silly terminal I am on - - * sapi/apache/mod_php4.c - sapi/apache/sapi_apache.c - ext/standard/browscap.c - ext/standard/reg.c - ext/standard/url.c - php_regex.h - php.h: - Clean up regex header file mess. php.h now explicitly includes php_regex.h - and php_regex.h figures out which regex header files to include and - defines symbols that prevents other stuff from including the wrong versions - of regex header files. - -1999-10-30 changelog - - * ChangeLog: ChangeLog update - -1999-10-29 Rasmus Lerdorf - - * ext/imap/imap.c: Fix typo found by hholzgra@media-engineering.de - - * ext/standard/dl.c - regex/regex.h - php_regex.h: Kill the regex header file warnings - - * NEWS: Looked like this was done by RedHat the way I wrote it. - -1999-10-29 changelog - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-10-28 Rasmus Lerdorf - - * ext/odbc/config.h.stub - ext/odbc/config.m4 - ext/odbc/php_odbc.c - ext/odbc/php_odbc.h: - (IBM DB2 Support) Fix stuff to allow IBM DB2 to work with PHP 4. - Tested against DB2 6.1 UDB on Linux (RH-6.0) - -1999-10-28 Sascha Schumann - - * Makefile.am: - Remove set-if-not-set colon, since CPPFLAGS is never set by automake. - -1999-10-28 Andrei Zmievski - - * ext/pcre/php_pcre.c: Fix bug #2623. - - * NEWS: New function. - -1999-10-28 changelog - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-10-28 rubys - - * php4dllts.dsp: - look for output.c in its new location in the windows build - -1999-10-27 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/php3_string.h - ext/standard/string.c: (PHP str_repeat) New function. - -1999-10-27 Thies C. Arntzen - - * ext/standard/basic_functions.h - ext/standard/output.c - ext/standard/php_output.h - Makefile.am - ext/standard/Makefile.am - ext/standard/basic_functions.c - internal_functions.c.in - internal_functions_win32.c - output.c - output.h - php.h: moved output.c into ext/standart and made it thread-safe. - moved output-buffering related functions from basic_functions to output.c - Win32 project need to be updated to reflect new position. - - * ext/oci8/oci8.c: -1999-10-27 Andrei Zmievski - - * ext/standard/basic_functions.c: Forgot to remove function entry. - -1999-10-27 changelog - - * ChangeLog: ChangeLog update - -1999-10-26 Thies C. Arntzen - - * ext/standard/file.c: eliminated warinigs - -1999-10-26 Andrei Zmievski - - * TODO: No tabs please. - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: (PHP array_map) Away with it. - - * TODO: Some todo things. - -1999-10-26 changelog - - * ChangeLog: ChangeLog update - -1999-10-25 changelog - - * ChangeLog: ChangeLog update - -1999-10-24 Thies C. Arntzen - - * ext/standard/fsock.c: kill warning - - * ext/standard/basic_functions.c: - folding fix (xemacs 21 loads the file again;-) - -1999-10-24 Sascha Schumann - - * ext/pcre/config.h.stub - ext/pcre/config.m4: - Define USE_BCOPY, if memmove is not found (i.e. SunOS 4). Fix for #2480 - -1999-10-24 rubys - - * php4dllts.dsp - php4dll.dsp: - Allow CYGWIN directory to be specified as via environment variable - -1999-10-24 Sascha Schumann - - * ext/session/session.c: - (PHP session_register, session_unregister) always return true - -1999-10-24 changelog - - * ChangeLog: ChangeLog update - -1999-10-23 changelog - - * ChangeLog: ChangeLog update - -1999-10-22 Sascha Schumann - - * ext/session/php_session.h - ext/session/session.c - NEWS - php.ini-dist: Add session.use_cookies option - -1999-10-22 Thies C. Arntzen - - * ext/standard/var.c: - unserialize no longer complaints about unserializing empty-strings (started that just a few days ago) - -1999-10-22 changelog - - * ChangeLog: ChangeLog update - -1999-10-21 Sascha Schumann - - * ext/standard/url_scanner.c - ext/standard/url_scanner.re: Add - - * ext/hyperwave/hg_comm.c - ext/hyperwave/hg_comm.h - ext/hyperwave/hw.c - ext/hyperwave/php3_hyperwave.h: - Added hw_mapid(), read comment in hg_comm.c - -1999-10-21 Sascha Schumann - - * ext/session/mod_files.c (_ps_files_open): evaluate key (session id) before path creation - -1999-10-21 changelog - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-10-20 Andi Gutmans - - * ext/com/COM.c - internal_functions_win32.c - php4dllts.dsp: - Make COM compile again - - * ext/com/php3_COM.h - ext/com/php_COM.h - ext/standard/dir.c - config.w32.h - php4ts.dsp: - Make CVS compile on Win32. - - Rename php3_COM.h -> php_COM.h - -1999-10-20 Thies C. Arntzen - - * ext/standard/config.h.stub - ext/standard/config.m4 - ext/standard/dir.c - ext/standard/php3_dir.h: (PHP getcwd()) added, needs to porting to Win32 - -1999-10-20 Sascha Schumann - - * ext/standard/info.c (_display_module_info): Add anchor for module names - -1999-10-20 Thies C. Arntzen - - * ext/xml/xml.c: - (PHP xml_parse_into_struct) sometimes the value was truncated - - * ext/standard/var.c: (PHP var_dump, serialize) fixed mem_leak. - -1999-10-20 Andrei Zmievski - - * .cvsignore: Ignore shared modules directory. - - * .cvsignore: Ignore generated libs. - -1999-10-20 Thies C. Arntzen - - * ext/xml/xml.c (PHP xml_parse_into_struct): fixed mem-leak when encountering invalid XML. - -1999-10-20 changelog - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-10-19 Andrei Zmievski - - * main.c: Revert my patches to error functions. - -1999-10-19 Thies C. Arntzen - - * NEWS: added === operator support (type *and* value match) . samples: - (1 == "1") is true - (1 === "1") is false (integer != string) - (0 == false) is true - (0 === false) is false (integer != boolean) - -1999-10-19 Andrei Zmievski - - * ext/standard/basic_functions.c (PHP extract): - Fixed bug that would mess up global and referenced - variables in certain cases. - - * ext/ldap/ldap.c (PHP ldap_get_entries): Fix string function name. - -1999-10-19 Uwe Steinmann - - * ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c: - - some tiny changes to possible improve link extraction/insertion of HTML-docs - -1999-10-19 Thies C. Arntzen - - * ext/standard/url.c: (parse_url) fix for #2569: parse_url('-') crashes - -1999-10-19 changelog - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-10-18 Egon Schmid - - * ext/standard/formatted_print.c: More forgotten prototypes. - -1999-10-18 Stefan Roehrich - - * MAINTAINERS: - Added zlib module to list of maintained extensions. (Stefan). - -1999-10-18 Thies C. Arntzen - - * ext/standard/var.c: - * ext/standard/var.c: (PHP unserialize) - fixed mem-leak. - -1999-10-18 changelog - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-10-17 Sascha Schumann - - * ext/gd/Makefile.am - ext/gd/config.h.stub - ext/gd/config.m4 - ext/gd/gd.c - ext/gd/php3_gd.h: Add PNG support. Tested with gd 1.7.3. - -1999-10-17 Egon Schmid - - * ext/standard/dl.c: Looks better, but isn't wrong - - * ext/standard/math.c: One typo corrected. - -1999-10-17 Andrei Zmievski - - * ext/zlib/zlib.c: Fix bug #2548. - -1999-10-16 Andrei Zmievski - - * ext/xml/xml.c - ext/standard/file.c - ext/standard/php3_string.h - ext/standard/string.c - fopen-wrappers.c: _php3/_php3i -> php rename - -1999-10-16 Andi Gutmans - - * sapi/cgi/cgi_main.c: - It's OK if we link dynamically. - - * sapi/cgi/cgi_main.c - ext/standard/basic_functions.c - ext/standard/basic_functions.h - php4ts.dsp - mergesort.c - php4dllts.dsp: - - Get windows version to compile again. No biggy if array_map is not #if 0'd - out even if it doesn't work. - -1999-10-15 Andrei Zmievski - - * ext/standard/basic_functions.h: *** empty log message *** - - * ext/standard/basic_functions.c: (PHP array_map) Temporarily #if 0 this. - - * php.h: Update mergesort() proto. - - * ext/pcre/php_pcre.c: Make string copying a little more efficient. - - * main.c: Small tweak in the error format. - - * main.c (php3_log_err): Don't output error message to stderr when - running as CGI binary. - - * ext/pcre/php_pcre.c - ext/standard/php3_string.h - ext/standard/string.c: - Renamed a couple of functions to have proper php_ prefix. - - * main.c (php_error): finally get rid of those annoying html tags - when running as CGI binary - - * ext/standard/basic_functions.c: - Massive change of zend_error() to php_error(). - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: - * Makefile.am: Add mergesort.c to compilation list. - - * mergesort.c - php.h: Added mergesort.c from FreeBSD. - -1999-10-15 Thies C. Arntzen - - * ext/standard/basic_functions.h - ext/standard/basic_functions.c: (is_resource, is_bool) new functions - -1999-10-15 Andrei Zmievski - - * ext/pcre/php_pcre.c: - (_php_replace_in_subject) - (PHP preg_replace): - Fixed a bug that happened when regex was an array and replacement was a - single non-string value. Also changed conversions to use - convert_to_string_ex(). - - (PHP preg_grep): use convert_to_string_ex() for proper conversion - -1999-10-15 Thies C. Arntzen - - * ext/standard/file.h - ext/standard/fsock.c - ext/standard/file.c - ext/pdf/pdf.c - ext/ftp/php_ftp.c - rfc1867.c - fopen-wrappers.h - php.h: - files are now resources, file.c is thread-safe, the le_ vars are no longer shared, - but they are accessible thru "php_file_le_socket(), php_file_le_uploads()..." - i also updated the ftp, pdf and file-upload stuff to match the new requirements. - -1999-10-15 Andrei Zmievski - - * ext/standard/string.c (PHP implode): Properly separate zval for another case. - -1999-10-15 Zeev Suraski - - * ext/standard/string.c: - That should do the trick - fix implode() not to modify its arguments - - * ext/odbc/php_odbc.c - config.w32.h: Make ODBC work under Win32 - -1999-10-15 Andi Gutmans - - * tests/testarray - tests/testfuncref - ext/standard/math.c - php4dllts.dsp: - - Converted math.c to use new convert_to_number_ex() macro. - -1999-10-13 Sascha Schumann - - * MAINTAINERS: Add dba and mcrypt extensions to list. - -1999-10-13 Thies C. Arntzen - - * configuration-parser.y - ext/standard/dl.c - ext/standard/dl.h - ext/standard/file.c - php3_compat.h: - new api fo dl() - renamed php3_dl to php_dl (added compat header) - - * ext/standard/html.c (PHP: htmlspecialchars, htmlentities): - new zend-api for html-function (not worth mentioning in NEWS) - - * ext/standard/math.c: -1999-10-13 Andrei Zmievski - - * MAINTAINERS: Add mhash module. - -1999-10-13 Thies C. Arntzen - - * ext/standard/exec.c: - (shell_exec) use pclose for FILE* that has been opened via popen! - -1999-10-13 changelog - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-10-12 Thies C. Arntzen - - * ext/standard/file.c - ext/standard/file.h - ext/standard/fsock.c - fopen-wrappers.h - rfc1867.c: - starting to clean-up/new API'ize and resourcify the file-stuff - nothing happened yet - just renaming things around. - -1999-10-12 Danny Heijl - - * ext/informix/ifx.ec: - (Informix driver) Thies introduced ZEND_FETCH_RESOURCE2 (Danny). - -1999-10-12 Thies C. Arntzen - - * MAINTAINERS: made nice - - * MAINTAINERS: add myself - - * ext/wddx/wddx.c: (wddx_add_vars) adjusted to new resource-API - - * ext/sybase_ct/php_sybase_ct.c: (php sybase_close) fixed obvious bug. - - * ext/sybase_ct/php_sybase_ct.c - ext/oracle/oracle.c - ext/odbc/php_odbc.c - ext/oci8/oci8.c - ext/mysql/php_mysql.c - ext/msql/php_msql.c: - new improved resource-API (i hope everything still compiles) - -1999-10-12 Andrei Zmievski - - * MAINTAINERS: Just some formatting. - -1999-10-12 Danny Heijl - - * MAINTAINERS: - Added Informix driver to list of maintained extensions. (Danny). - -1999-10-12 changelog - - * NEWS - ChangeLog: *** empty log message *** - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-10-11 Andrei Zmievski - - * ext/standard/basic_functions.c: - Modified sorting functions to use updated zend_hash() prototype. - - * README.CVS-RULES: Added notice about LXR and Bonsai. - - * MAINTAINERS: First revision. - -1999-10-11 Danny Heijl - - * ext/informix/config.m4: *** empty log message *** - - * ext/informix/ifx.ec: - (ext/informix) Changed ifx.ec to use the new high-performance - ZEND API now that it compiles with libtool. (Danny) - - * ext/informix/config.m4: - (configure) Allow IFX_LIBDIR environment variable to specify the - Informix library path to allow linking with the static - libraries (libtool related). (Danny). - -1999-10-11 changelog - - * ChangeLog: ChangeLog update - -1999-10-10 Sascha Schumann - - * build.mk: automake scans aclocal.m4 as well - -1999-10-10 Thies C. Arntzen - - * build.mk: (build.mk) fix suggested by sascha. - - * build.mk: - (build.mk) make cvsclean now also deletes the libzend & TSRM symlinks. - -1999-10-10 Sascha Schumann - - * ext/informix/stub.c: Add stub.c for helper library. - -1999-10-10 Thies C. Arntzen - - * build.mk: - (build.mk) added target cvsclean: removed all files listed in all .cvsignore files found in the current tree. - -1999-10-10 Sascha Schumann - - * ext/informix/Makefile.am - ext/informix/config.m4: - Workaround for Informix set of libraries. One library depends on - another "library" (an object file). We build a standard library - out of this object here, so that we can link it in at the right place - later. - - * ext/gd/gd.c - ext/pgsql/pgsql.c - ext/snmp/snmp.c: - Remove -DPIC preprocessor macros. This is defined by libtool - automatically, if a shared library is built. This would lead - to multiple definitions of get_module(). If you want to build - modules, add -DCOMPILE_DL to your CFLAGS. - - * ext/informix/Makefile.am - ext/informix/config.m4: Link in IFX_LIBS properly. - -1999-10-10 changelog - - * ChangeLog: ChangeLog update - -1999-10-10 Sascha Schumann - - * build.mk: - Clean up and add 'clean' target which removes standard targets recursively - - * build.mk: build.mk can be used to generate build tools. It is usually - faster than buildconf, since it rebuilds only components, if - it is necessary. To use it, run - - $ make -f build.mk - -1999-10-09 Sascha Schumann - - * Makefile.am: Remove redundant library declaration. All libtool libraries - are referenced through DEPENDENCIES now. - - * Makefile.am: Only link with bundled regex, if the user wants it. - - * regex/regcomp.c: POSIX_MISTAKE is enabled by default. - -1999-10-09 Thies C. Arntzen - - * sapi/apache/config.m4: - fix suggested by sascha for xml-build in apxs mode - -1999-10-09 changelog - - * ChangeLog: ChangeLog update - - * NEWS: NEWS update - -1999-10-08 Andreas Karajannis - - * ext/odbc/php_odbc.c: - Forgot to remove workaround for SQLANY_BUG which is no longer needed - - * ext/odbc/php_odbc.c - ext/odbc/php_odbc.h: - Moved Environment handle to connection struct for thread safety - -1999-10-08 Andrei Zmievski - - * README.CVS-RULES: Mention php-cvs-daily list. - -1999-10-08 Sascha Schumann - - * main.c: Use correct data type for mutex. - - * main.c: - Implement temporary workaround for thread-safety issues. This - serializes all request accesses. To disable, define NO_GLOBAL_LOCK - -1999-10-08 Andrei Zmievski - - * README.CVS-RULES: More emphasis on ChangeLog and NEWS daily updates. - -1999-10-08 Andrei Zmievski - - * README.CVS-RULES: - More information on how to use the special prefixes and the frequency - of NEWS and ChangeLog updates. - -1999-10-08 Jouni Ahto - - * ext/gd/gdt1.c - ext/gd/gdt1.h: - Added the files for t1lib support. No porting from PHP3 done yet. - -1999-10-08 changelog - - * ChangeLog: ChangeLog update - -1999-10-08 Jouni Ahto - - * ext/standard/datetime.c: - (PHP gmmktime) Should now give right values. Note that there was never need for - the acrobacy adjusting the time for GMT. mktime() fills - tm_gmtoff with just the right offset to add. - - * ext/standard/php3_string.h - ext/standard/string.c - ext/standard/basic_functions.c: - (PHP setlocale) Locale settings are now correctly restored to the values - set in environment at request shutdown. - -1999-10-07 Andrei Zmievski - - * NEWS: NEWS update - - * ChangeLog - MAINTAINERS - README.CVS-RULES - TODO: - New files. - - Please read README.CVS-RULES! - -1999-10-07 Sascha Schumann - - * sapi/cgi/config.m4 - sapi/isapi/config.m4 - sapi/apache/config.m4 - configure.in: Remove SAPI_TARGET and use PHP_SAPI completely. - - The target filename is now available as SAPI_PROGRAM, SAPI_SHARED, and - SAPI_STATIC. - -1999-10-07 Andrei Zmievski - - * ChangeLog.3 - ChangeLog.TODO - TODO-LeftOver: Some ChangeLog surgery. - -1999-10-07 Sascha Schumann - - * ext/ext_skel: Add help to get people started. - -1999-10-07 Andreas Karajannis - - * ext/odbc/php_odbc.c - ext/odbc/php_odbc.h: - Made henv a real global var. Seems to work basically when multithreaded - -1999-10-07 Sascha Schumann - - * sapi/nsapi/.cvsignore - sapi/nsapi/Makefile.am - sapi/nsapi/aolserver.c - sapi/nsapi/config.m4: nsapi => aolserver - - "NSAPI" suggests Netscape too often. - -1999-10-07 Andrei Zmievski - - * ChangeLog - NEWS: - Renaming ChangeLog to NEWS. All future entries intended for public should - go into NEWS. - -1999-10-07 Sascha Schumann - - * configure.in: - PHP_SHOW_LD_LIBRARY_PATH leaked out of my test environment. - -1999-10-07 Uwe Steinmann - - * ext/pdf/pdf.c - ext/pdf/php3_pdf.h: - - new functions pdf_get_font, pdf_get_fontsize, pdf_get_fontname - -1999-10-07 Andrei Zmievski - - * tests/testfunc: Test commit again. - - * tests/testfunc: Testing commit. - - * sapi/nsapi/.cvsignore - sapi/cgi/.cvsignore - sapi/isapi/.cvsignore - sapi/apache/.cvsignore - regex/.cvsignore - .cvsignore: Ignore generated files. - - * ext/db/db.c: Put PLS_FETCH() in the correct place. - - * ext/pcre/pcrelib/.cvsignore - ext/yp/.cvsignore - ext/zlib/.cvsignore - ext/sysvshm/.cvsignore - ext/wddx/.cvsignore - ext/sysvsem/.cvsignore - ext/sybase/.cvsignore - ext/sybase_ct/.cvsignore - ext/standard/.cvsignore - ext/session/.cvsignore - ext/snmp/.cvsignore - ext/pdf/.cvsignore - ext/pgsql/.cvsignore - ext/pcre/.cvsignore - ext/oracle/.cvsignore - ext/oci8/.cvsignore - ext/odbc/.cvsignore - ext/msql/.cvsignore - ext/mysql/.cvsignore - ext/mcrypt/.cvsignore - ext/mhash/.cvsignore - ext/mcal/.cvsignore - ext/interbase/.cvsignore - ext/ldap/.cvsignore - ext/imap/.cvsignore - ext/informix/.cvsignore - ext/icap/.cvsignore - ext/gettext/.cvsignore - ext/hyperwave/.cvsignore - ext/ftp/.cvsignore - ext/gd/.cvsignore - ext/fdf/.cvsignore - ext/filepro/.cvsignore - ext/dbase/.cvsignore - ext/db/.cvsignore - ext/dba/.cvsignore - ext/com/.cvsignore - ext/dav/.cvsignore - ext/bcmath/.cvsignore - ext/apache/.cvsignore - ext/aspell/.cvsignore - ext/ext_skel: Ignore generated files. - - * request_info.c: Fix for #2457. - -1999-10-07 Thies C. Arntzen - - * ext/db/db.c: fix ZTS compile - - * ext/xml/xml.c - ChangeLog: fixed hopefully last XML problem. that one was hard! - -1999-10-07 Sascha Schumann - - * sapi/nsapi/aolserver.c (php_ns_request_handler): call ts_free_thread() to clean up - -1999-10-07 Thies C. Arntzen - - * ext/db/db.c: compiles again - and gets compiled - -1999-10-07 Sascha Schumann - - * configure.in: - Pass -avoid-version when building a shared library to avoid problems - with "installing" symbolic links. We need to do this conditional, since - some libtool versions imply --disable-static with this option. - -1999-10-07 Thies C. Arntzen - - * ChangeLog - php_content_types.c: - SET_VAR_STR* expect a emalloc'ed copy of the string! - -1999-10-06 Sascha Schumann - - * patch-aa - buildconf: - Enable hardcoding runpaths for more platforms and allow Solaris' patch to run - buildconf. - - * buildconf: Ignore already applied patches. - - If somebody could make this work on Solaris, I'd appreciate it. - - * buildconf - patch-aa - patch-ab - patch-ltmain.sh: - Allow *.a and *.o as libtool objects, and hardcode runpaths into - shared libraries. - - (Both taken from FreeBSD's libtool port.) - -1999-10-06 Andrei Zmievski - - * ext/standard/rand.c - ext/standard/php_rand.h: - Move random functions related defines into its own header file. - -1999-10-06 Thies C. Arntzen - - * ChangeLog: *** empty log message *** - -1999-10-06 Sascha Schumann - - * ext/informix/Makefile.am: - Fix "make clean". automake does not define an extra target for clean. - - * patch-ltmain.sh: - unidiff isn't widely recognized, change to context format. - - * ext/pgsql/pgsql.c - ChangeLog: Fixed pg_fetch_array() with three arguments. - - Submitted by: brian@soda.berkeley.edu - -1999-10-06 Thies C. Arntzen - - * ext/standard/basic_functions.c - ChangeLog: - replaced most getParamters against getParamtersEx calls - - removed ParamterPassedByReference where appropiate - -1999-10-06 Sascha Schumann - - * buildconf: * --copy always, since we need to change ltmain.sh - * make patch on some obscure UNIX happy - -1999-10-06 Uwe Steinmann - - * ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c: - fixed some memory leaks - - * ChangeLog: - as always forgot the Changelog entry - - * SAPI.c - ext/standard/post.c: - - support for mimetype application/vnd.fdf needed by fdf module - (only active if fdf support is compiled in) - - * ext/fdf/config.m4 - ext/fdf/fdf.c: - fix to work with new version of FdfTk - -1999-10-05 Sascha Schumann - - * Makefile.am: - FreeBSD's libtool port seems to contain a bug which is triggered by - -avoid-version. Removing it, since we don't absolutely need this option. - - * buildconf - patch-ltmain.sh: Apply patch automatically at buildconf time - - * ext/standard/dir.c: Fix typo (xml_globals => dir_globals) - -1999-10-05 Thies C. Arntzen - - * ext/oci8/oci8.c - ext/oci8/php3_oci8.h - ChangeLog: - use reference counting for emulating child<->parent (cursor<->connection) relationships. - - * ext/standard/dir.c - ext/standard/php3_dir.h - ChangeLog: dir modules is now resourcified & thread-safe! - -1999-10-05 Sascha Schumann - - * genfiles - makedist: Generate files for distribution (also adds parsedate.c) - - * sapi/apache/config.m4: Fix typo. - - * sapi/apache/config.m4: - Get rid of *_SHLIB variables. Our config scripts don't need Perl, - unfortunately the "apxs" utility does. Someone slap the creator of apxs. - -1999-10-05 Andrei Zmievski - - * ext/wddx/wddx.c: Remove _A. - -1999-10-05 Sascha Schumann - - * Makefile.am: Fix automake dependencies - -1999-10-05 Thies C. Arntzen - - * ChangeLog: *** empty log message *** - - * ext/oracle/oracle.c: fixed ora_close again - - * ext/standard/basic_functions.c: fix some warnings - -1999-10-05 Sascha Schumann - - * SAPI.c: Fix logic. - - * ext/msql/Makefile.am: Use libtool - - * buildconf: automake does not find all subdirectories automatically. - - * regex/.cvsignore - regex/regex.h - .cvsignore - Makefile.am: * Get rid of libphp_util.la - * Don't build CGI from convenience library - * Add additional checks to regex.h (Apache build broke) - - * buildconf: 100% speedup in buildconf. - We have a top-level Makefile.am, so find becomes superflicious - - * configure.in: Build program static. - -1999-10-05 Marko Karppinen - - * regex/regex.h: Fix a typo? (compile bustage on Solaris 2.6) - -1999-10-04 Andrei Zmievski - - * ext/standard/basic_functions.h - ext/standard/basic_functions.c - ChangeLog: Taken from PHP3 source. - - * tests/testobj: *** empty log message *** - - * tests/testobj - tests/testfunc - tests/testarray: test - -1999-10-04 Sascha Schumann - - * configure.in: -module is already set in Makefile.am - -1999-10-04 Andrew Skalski - - * ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: Added delete and rename functions. - -1999-10-04 Sascha Schumann - - * sapi/README - ChangeLog - SAPI.c - configure.in: * Fix header("HTTP/..") behaviour - * Fix leak WRT http_status_line - * Update sapi/README - * Remove %PHP_OUTPUT_FILES sort - - * Makefile.am: Move %(EXTRA_LIBS). - - * php.sym: The .sym format isn't that complex. - - * sapi/aolserver/Makefile.am - sapi/aolserver/Makefile.inc - sapi/aolserver/config.m4 - sapi/nsapi/Makefile.am - sapi/nsapi/Makefile.inc - sapi/nsapi/config.m4 - sapi/apache/Makefile.inc - sapi/apache/apache.c - sapi/apache/config.m4 - sapi/apache/libphp4.module.in - sapi/apache/mod_php4.c - sapi/apache/sapi_apache.c - sapi/cgi/Makefile.am - sapi/cgi/Makefile.inc - sapi/isapi/Makefile.inc - sapi/Makefile.am - sapi/README - sapi/apache/Makefile.am - ext/zlib/Makefile.am - regex/Makefile.am - regex/Makefile.in - ext/xml/Makefile.am - ext/xml/config.m4 - ext/xml/xml.c - ext/yp/Makefile.am - ext/sysvshm/Makefile.am - ext/wddx/Makefile.am - ext/sybase_ct/Makefile.am - ext/sysvsem/Makefile.am - ext/standard/Makefile.am - ext/standard/info.c - ext/sybase/Makefile.am - ext/session/Makefile.am - ext/snmp/Makefile.am - ext/pdf/Makefile.am - ext/pgsql/Makefile.am - ext/pgsql/config.m4 - ext/pcre/config.m4 - ext/pcre/pcrelib/Makefile.am - ext/oracle/Makefile.am - ext/pcre/Makefile.am - ext/mysql/php_mysql.h - ext/oci8/Makefile.am - ext/odbc/Makefile.am - ext/mhash/Makefile.am - ext/mysql/Makefile.am - ext/mysql/config.m4 - ext/mysql/php_mysql.c - ext/mcal/Makefile.am - ext/mcrypt/Makefile.am - ext/interbase/Makefile.am - ext/ldap/Makefile.am - ext/imap/Makefile.am - ext/informix/Makefile.am - ext/hyperwave/Makefile.am - ext/icap/Makefile.am - ext/gd/Makefile.am - ext/gd/config.m4 - ext/gettext/Makefile.am - ext/filepro/Makefile.am - ext/ftp/Makefile.am - ext/dbase/Makefile.am - ext/fdf/Makefile.am - ext/db/Makefile.am - ext/dba/Makefile.am - ext/bcmath/Makefile.am - ext/dav/Makefile.am - ext/apache/Makefile.am - ext/apache/config.m4 - ext/aspell/Makefile.am - ext/Makefile.am - ext/ext_skel - Makefile.in - acinclude.m4 - buildconf - configure.in - install-sh - php.map - php.sym - stub.c - Makefile.am - .cvsignore: - * archive-based convenience libraries completely replaced - with libtool components - - * SAPI targets can enable thread-safe mode and define - shared/static/program build target - - * all configure scripts use the same config.cache - - * phplibdir is $(top_builddir)/modules to avoid - permission problems - - * sapi/*/Makefile.inc are gone - - * runpath handling cleaned up - - * top-level Makefile.in obsoleted through Makefile.am - - * --enable-versioning uses libtool's cleaner and more - portable -export-symbols feature - - * sapi/aolserver/aolserver.c - sapi/nsapi/aolserver.c: Polish this. - -1999-10-04 Thies C. Arntzen - - * ChangeLog: upgraded the former basic_functions.c code to use new API. - - * ext/standard/reg.c - ChangeLog: - ereg now returns a continious array 0..9 again - empty values are returned as false. - i think this is *more* compatible with PHP3 - unless anybody really dislikes it i'd prefer it like this. - - * main.c: i swear, i compiled (at least) before i committed! - -1999-10-04 Sascha Schumann - - * sapi/apache/Makefile.inc: - Object files are usually not found in the srcdir. - -1999-10-04 Thies C. Arntzen - - * main.c: - "cc -32" on IRIX 6.4 does not like (PHP_TRACK_VARS?"1":"0") - at least not if PHP_TRACK_VARS is 0. - -1999-10-04 Sascha Schumann - - * acinclude.m4: - Fix typo. This caused strange errors when using --with-apxs. - -1999-10-03 Andi Gutmans - - * ChangeLog: - Update changelog - -1999-10-03 Sascha Schumann - - * configure.in: *_config are executable, thus we don't need %(SHELL) - - * configure.in: Fix Apache-module build - -1999-10-02 Andrei Zmievski - - * tests/testobj - tests/testarray2 - tests/testarray - tests/testfe - tests/testfunc: test commit - - * tests/testfunc: commit test - - * tests/testfunc: test - - * tests/testfunc: test commit - - * tests/testfunc: test commit 1 - - * tests/testfunc: test commit - -1999-10-02 Sascha Schumann - - * sapi/apache/Makefile.inc: - Use the already compiled `mod_php4.o'. This avoids the trouble - apxs has with VPATH builds (assumes source dir = build dir). - -1999-10-01 Andi Gutmans - - * ChangeLog - php4dllts.dsp: - I forgot this - -1999-10-01 Andrei Zmievski - - * ChangeLog - ext/standard/basic_functions.c - ext/standard/basic_functions.h: Added array_reverse() function. - - * ext/standard/info.c - ext/wddx/php_wddx.h - ext/wddx/php_wddx_api.h - ext/wddx/wddx.c - ext/session/session.c - ext/pcre/php_pcre.c - ext/pcre/php_pcre.h: rename. - -1999-10-01 Thies C. Arntzen - - * ext/xml/xml.c - ChangeLog: one zval fix - cleanups - -1999-09-30 Andrei Zmievski - - * ChangeLog: test commit - - * ChangeLog - ext/pcre/php_pcre.c: - preg_replace() now makes copies of array entries if arrays are passed in, - so that convert_to_string() preserves the originals. Is this the correct way to do it? - -1999-09-30 Sascha Schumann - - * ext/gd/config.m4: Fix typo--GD_* is for shared build mode. - -1999-09-30 Andrei Zmievski - - * ext/standard/string.c: Fix nl2br crash. - -1999-09-30 Sascha Schumann - - * ChangeLog: Test commit II. - -1999-09-30 Andrei Zmievski - - * setup: No need for this anymore. - -1999-09-30 Sascha Schumann - - * ChangeLog: Test commit. - - * configure.in - sapi/apache/config.m4: - Automatically add the SAPI target's Makefile to the list. This - frees us from doing this in each config.m4. - -1999-09-30 Thies C. Arntzen - - * ChangeLog - ext/oci8/oci8.c - ext/oci8/php3_oci8.h: - major rework here - the refcount stuff gets better and better! - -1999-09-29 Sascha Schumann - - * configure.in - ext/pcre/config.m4 - sapi/apache/config.m4: * create Makefiles for ext, pcrelib, sapi/* - * copy files for Apache from $(srcdir) - - * buildconf - configure.in: * VPATH work - * add "--local" switch to buildconf which only recrates the local - autoconf scripts. - -1999-09-29 Charles Hagenbuch - - * ext/imap/imap.c: cjh: closing bug #2407. - -1999-09-29 Thies C. Arntzen - - * ext/xml/xml.c: fix the order.. (thanx, andi) - -1999-09-29 Sascha Schumann - - * sapi/apache/Makefile.inc: Fix a VPATH issue. - -1999-09-29 Stig Bakken - - * ChangeLog: *** empty log message *** - - * scripts/preconfig - sapi/apache/Makefile.am - sapi/apache/Makefile.inc - sapi/apache/apache.c - sapi/apache/config.m4 - sapi/apache/libphp4.module.in - sapi/apache/mod_php4.c - Makefile.in - acconfig.h.in - acinclude.m4 - buildconf - configure.in - configure.in.in - libphp4.module.in - sapi/apache/.cvsignore - .cvsignore: - Decent configure speedup. Makefiles are now generated only for the - extensions you are including. Got rid of configure.in.in. - Moved the last Apache-specific files into sapi/apache and made both - static and DSO build work again (it still doesn't run properly). - - * ext/gd/config.m4: - The $shared variable should normally never be used outside of a call to - AC_ARG_(ENABLE|WITH). If it is necessary anyway, make sure it is set to - "no" before starting. - -1999-09-29 Andrei Zmievski - - * ext/standard/url.c: Fix for my fix. - -1999-09-29 Thies C. Arntzen - - * ChangeLog - ext/oci8/oci8.c - ext/oci8/php3_oci8.h: fixed crash in connection shutdown! - - * ext/oci8/oci8.c: just some renaming. - -1999-09-28 Andi Gutmans - - * tests/testfunc2 - ext/standard/string.c: - Get rid of warning - -1999-09-28 Stig Bakken - - * sapi/isapi/config.m4: disable --with-zeus for now. - - * sapi/isapi/config.m4 - sapi/isapi/php4isapi.c - INSTALL - acconfig.h.in: - Started working on the Zeus support. Zeus's ISAPI obviously differs from - Windows's, does someone have docs for the Windows API? - -1999-09-28 Thies C. Arntzen - - * ext/oci8/oci8.c: initialize OCI in threaded mode if ZTS is defined. - - * ext/oracle/oracle.c: init in thread-safe mode if ZTS isdefined - - * ext/oracle/oracle.c: fixed startup-deadlock. - - * ext/xml/config.m4: found a typo! - -1999-09-27 Andi Gutmans - - * php4ts.dsp: - Update project. - -1999-09-27 Sascha Schumann - - * ext/standard/string.c: Make an extra copy of input parameter. - - * Makefile.in - sapi/aolserver/Makefile.inc - sapi/nsapi/Makefile.inc: * include from $(srcdir) - * use proper target for nsapi - - * configure.in.in: - Create directories, if they do not exist (for VPATH builds). - -1999-09-27 Stig Bakken - - * sapi/README: added README file with very brief docs - - * sapi/aolserver/.cvsignore - sapi/aolserver/Makefile.am - sapi/aolserver/Makefile.inc - sapi/aolserver/aolserver.c - sapi/aolserver/config.m4 - sapi/cgi/.cvsignore - sapi/cgi/Makefile.am - sapi/cgi/Makefile.inc - sapi/cgi/cgi_main.c - sapi/cgi/config.h.in - sapi/cgi/config.m4 - sapi/isapi/.cvsignore - sapi/isapi/Makefile.am - sapi/isapi/Makefile.inc - sapi/isapi/config.m4 - sapi/isapi/php4isapi.c - sapi/isapi/php4isapi.def - sapi/isapi/php4isapi.dsp - sapi/nsapi/.cvsignore - sapi/nsapi/Makefile.am - sapi/nsapi/Makefile.inc - sapi/nsapi/aolserver.c - sapi/nsapi/config.m4 - scripts/config-stubs - scripts/preconfig - Makefile.in - aolserver.c - cgi_main.c - configure.in.in - ext/apache/apache.c - header - main.c - mod_php4.c - mod_php4.exp - mod_php4.h - sapi/.cvsignore - sapi/Makefile.am - sapi/apache/.cvsignore - sapi/apache/Makefile.am - sapi/apache/Makefile.inc - sapi/apache/config.h.stub - sapi/apache/config.m4 - sapi/apache/mod_php4.c - sapi/apache/mod_php4.exp - sapi/apache/mod_php4.h - ChangeLog: Generalized server-API build process on UNIX. Each SAPI - implementation now has its own directory under sapi/, just like - extensions have theirs under ext/. To make the final targets appear - in the main dir, the top-level Makefile includes sapi/NN/Makefile.inc - from the selected sapi backend. This is a plan Makefile stub without - any autoconf substitutions. Each SAPI backend also has its own - config.m4 like extensions (read at the end of diversion 2) and - config.h.stub files. - - Each SAPI backend has to contain: - - config.m4: just like for extensions, this file contains - autoconf/automake directives that end up in the configure script. The - only difference is that the sapi config.m4 files are read in diversion - (output block) 2 instead of 3. The sapi config.m4 files should set - two variables: PHP_SAPI (which sapi backend to choose) and SAPI_TARGET - (the name of the resulting library or program, previously BINNAME). - If they are not specified, they will default to "cgi" and "php", - respectively. - - Makefile.inc: has to exist, has to define "INSTALL_IT" to the command - used to install the final target (or ":" for no operation). It also - has to define a plain Makefile rule (without autoconf substitutions) - to build $(SAPI_TARGET) - - Makefile.am: just what you think. Make sure your target is called - "libphpsapi_NNN.a", where NNN is the value of PHP_SAPI. - - Some testing and fixing probably remains. To make everything hang - together, I've done some ugly tricks that I can imagine causing some - problems. I've built and run the CGI version and built the Apache - DSO. - -1999-09-27 Andrei Zmievski - - * ext/standard/url.c: - Fix for bug #2199. Redirect was returning http:// which resulted in a crash. - - * ext/ext_skel: I will follow portability guidelines. - I will follow portability guidelines. - I will follow portability guidelines. - I will follow... - -1999-09-27 Andrew Skalski - - * ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: Added functions ftp_{pasv,size,mdtm,fget,fput} - PASV mode is now supported; file size and last-modified time can now - be fetched from servers that support them; files now may be stored to and - retrieved from open files, in addition to disk files. - -1999-09-27 Andrei Zmievski - - * ext/ext_skel: Make it portable. - -1999-09-27 Stig Bakken - - * acinclude.m4: added AC_SYS_LFS from fileutils - -1999-09-26 Sascha Schumann - - * configure.in.in - Makefile.in: - Now thread safe version builds out of the box. libzend/TSRM - contain extra config scripts which pass the necessary libs back - to our Makefile. - - * configure.in.in - Makefile.in: Use new tsrm_config script to determine libraries. - -1999-09-26 Stig Bakken - - * configure.in.in: - Have to keep using AM_PROG_LIBTOOL to keep all automake versions happy. - -1999-09-26 Sascha Schumann - - * acinclude.m4: - Avoid specifying standard paths. This might result in compiler problems - (see #1937, #2367) - - * ext/gd/config.m4: - Expand relative paths properly, otherwise build process will fail. - - * acinclude.m4: Do nothing, if PHP_RPATHS is empty. - - * ChangeLog - acinclude.m4 - configure.in.in: Disable rpaths optionally. - -1999-09-25 Sascha Schumann - - * ChangeLog - aolserver.c: * Use per-thread structure for request data - * Update ChangeLog - - * ext/session/session.c: Do not try to free NULLs. - - * aolserver.c: * use faster Ns_ConnWrite() - * access cookies correctly - * set HTTP_* variables for script - - * aolserver.c: * cleanup - * make cookies work - -1999-09-25 Thies C. Arntzen - - * ChangeLog - ext/xml/xml.c: - fixed callback code -> now $parser is passed as a resource! - -1999-09-25 Sascha Schumann - - * aolserver.c: * use consistent php_ns prefix - * improve configuration code - * shutdown SAPI/TSRM correctly - - * ext/standard/info.c: Add entry for AOLserver. - - * aolserver.c: * remove debugging message - * use SAPI's http response code - * improve POST read (still blocks in Ns_ConnRead, even if there is enough - data to read) - * improve config data handling - - * ext/standard/dns.c - ext/standard/mail.c - ext/standard/rand.c - ext/standard/soundex.c - ext/standard/syslog.c: New Zend API - - * ext/standard/string.c: Use new Zend API - -1999-09-25 Andreas Karajannis - - * ChangeLog: *** empty log message *** - - * ext/odbc/php_odbc.c: odbc now uses the new Zend function api - -1999-09-25 Stefan Roehrich - - * ChangeLog - ext/zlib/zlib.c: Use new Zend API. - -1999-09-25 Sascha Schumann - - * aolserver.c: - support POST and HEAD requests - - clean up module_main() - - allow arbitrary mappings - - * Makefile.in - acconfig.h.in - aolserver.c - configure.in.in: - Initial AOLserver support. Note that the current way of creating - the shared library works only with GNU utilities. Some features - have to be added yet (i.e. POST and cookie support). - -1999-09-24 Andrei Zmievski - - * ext/pcre/php_pcre.c - ext/standard/basic_functions.c - ChangeLog: - Updated array functions to use high-performance API - - Updated preg_split() to allow returning only non-empty pieces - - * ChangeLog: *** empty log message *** - - * ext/pcre/php_pcre.c - ChangeLog: Update to new high-performance function API. - -1999-09-24 Sascha Schumann - - * ext/standard/base64.c - ext/standard/crypt.c - ext/standard/link.c - ext/standard/md5.c - ext/standard/microtime.c - ext/standard/uniqid.c - ext/standard/url.c: Use new Zend API. - - * ext/gettext/gettext.c - ChangeLog - ext/sysvsem/sysvsem.c - ext/sysvshm/php3_sysvshm.h - ext/sysvshm/sysvshm.c: Use new Zend API and some minor cleanup. - -1999-09-24 Andrei Zmievski - - * ChangeLog: *** empty log message *** - - * ext/standard/var.c: Extended var_dump to handle IS_RESOURCE somewhat. - - * ext/wddx/wddx.c - ChangeLog: Update WDDX for new high-performance function API. - -1999-09-24 Thies C. Arntzen - - * ChangeLog: we want to know who to "blame";-) - - * ChangeLog - ext/standard/info.c - ext/xml/xml.c: updated XML (only partly tested) - -1999-09-24 Stig Bakken - - * ext/xml/Makefile.am - ext/xml/config.m4: more high-tech shared building - - * ext/standard/string.c: kill another warning - - * ext/standard/parsedate.y: kill warning - - * configure.in.in: - set "phplibdir" in configure so it doesn't have to be set in Makefile.am - -1999-09-24 Thies C. Arntzen - - * ChangeLog - ext/oracle/oracle.c: use getParameterEx - -1999-09-24 Stig Bakken - - * strlcat.c - strlcpy.c: - * configure.in.in: - AM_PROG_LIBTOOL is obsolete in libtool 1.3.3, which we now require. - Using AC_PROG_LIBTOOL instead. - - * buildconf: - Detect automake/libtool that are installed with different prefixes. - -1999-09-24 Thies C. Arntzen - - * ext/xml/xml.c: fixed warning - -1999-09-24 Zeev Suraski - - * ext/wddx/wddx.c - ext/xml/xml.c - ext/zlib/zlib.c: Compile fixes for WDDX, XML and Zlib (untested) - - * ext/sybase_ct/php_sybase_ct.c: - This should make the Sybase CT module compile again (untested) - - * ext/msql/php_msql.c: - This should make the mSQL module compile again (untested) - - * ext/mysql/php_mysql.c - ChangeLog: - Ok guys, the prototype for zend_fetch_resource*() has changed - it now - accepts a zval ** instead of a zval *, to be suitable for use with the - getParametersEx() API. - You don't have to switch to the getParametersEx() API, but you will have to - go over your code and add &'s where it's applicable (of course, if you have - the mental strength to go over your code and convert it to use the Ex API, - it's best). - - The MySQL module now uses the getParametersEx() API completely. - -1999-09-23 Sascha Schumann - - * Makefile.in: Link with libtsrm.a, if thread-safety is chosen. - - * configure.in.in: Exit, if subsequent configure scripts fail. - -1999-09-23 Andrew Skalski - - * ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: fixed php3 code problem - -1999-09-23 Andrei Zmievski - - * ext/pcre/config.m4: Small clarification. - -1999-09-23 Sascha Schumann - - * ext/standard/url_scanner.c: - This version is finally the standard one. The last one was created - using the 'nested ifs mode' which seems to be the source of the problem. - -1999-09-23 Nick Gorham - - * ext/odbc/config.h.stub - ext/odbc/config.m4 - ext/odbc/php_odbc.c - ext/odbc/php_odbc.h - ext/odbc/setup.stub - ChangeLog: - Added support for Easysoft ODBC-ODBC Bridge - Fixed bug in odbc_setoption - -1999-09-23 Andrew Skalski - - * ext/mcal/php3_mcal.c - ChangeLog: fixed typo in mcal_list_alarms() - -1999-09-23 Sascha Schumann - - * ext/standard/Makefile.am - ext/standard/url_scanner.c: - re2c's bit vectors appear to be not binary clean. Revert to - standard mode for the moment. - -1999-09-23 Thies C. Arntzen - - * ext/oracle/oracle.c: tiny optimisation - - * ChangeLog - ext/oracle/oracle.c: - Ora_Fetch_Into now resets the returned array in all cases - - * ext/oracle/oracle.c - ext/oracle/php3_oracle.h - ChangeLog: fixed NULL column - cleanups - -1999-09-22 Nick Gorham - - * ChangeLog: - Added odbc metadata update log - - * ext/odbc/php_odbc.h - ext/odbc/php_odbc.c: - Added support for metadata functions, odbc_tables, odbc_columns, - odbc_columnprivileges, odbc_foreignkeys, odbc_gettypeinfo, - odbc_primarykeys, odbc_procedurecolumns, odbc_procedures, - odbc_procedurecolumns, odbc_procedures, odbc_specialcolumns, - odbc_statistics, odbc_tableprivileges - -1999-09-22 Andrew Skalski - - * ChangeLog: mcal fix - - * ext/mcal/php3_mcal.c: added null-checking in make_event_object - - * ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: Added optional port argument to ftp_connect() - -1999-09-22 Thies C. Arntzen - - * ext/oracle/oracle.c: i always forget something;-) - - * ext/oracle/oracle.c - ext/oracle/oracle_hack.c - ChangeLog: fixed Ora_PLogon (rewrote ora_do_logon using php_mysql.c) - oracle_hack.c should no longer be needed! - - * ChangeLog - ext/oracle/oracle.c: resourcified Oracle - -1999-09-22 Stefan Roehrich - - * ChangeLog: Added new allowable_tags for gzgetss() in ChangeLog, too. - - * ext/zlib/zlib.c: - Fixed gzgetss() with new _php3_strip_tags, corrected prototype. - -1999-09-22 Uwe Steinmann - - * ext/fdf/config.m4: - fixed misleading explaination of fdftk option - -1999-09-22 Andi Gutmans - - * ext/standard/lcg.c: - Get rid of warning on win32, non-threadsafe mode. - -1999-09-21 Andrew Skalski - - * ext/ftp/php_ftp.c: removed NULL reference - - * ext/ftp/ftp.c: - added missing "addr.sin_family = AF_INET" to socket routines - -1999-09-21 Andrei Zmievski - - * ChangeLog: *** empty log message *** - - * ext/wddx/wddx.c: - WDDX can now serialize and deserialize objects. It uses a variable named - 'php_classname' to store the class name as part of the structure. This way - WDDX modules in other languages don't get broken by extensions to DTD - we would have had to make otherwise. - -1999-09-21 Rasmus Lerdorf - - * ext/standard/config.m4: - Slightly redundant to check for crypt() here again, but the TRY_RUN stuff - needs it defined in the same m4 file or it won't work, and it will just - get pulled out of the cache anyway, so it isn't a big deal. - - * ext/standard/string.c - ext/zlib/zlib.c - ext/standard/file.c: fgetss/gzgetss fixes - -1999-09-21 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/string.c: A couple of fixes. - -1999-09-21 Sascha Schumann - - * ext/standard/config.m4: - AC_CRYPT_CAP depends on symbol checks performed later. - - * configure.in.in: - * Do not check explicitly for symbols in the C library (fixes #2339) - - * sort function checks - -1999-09-21 Thies C. Arntzen - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - ChangeLog: added krsort() function - -1999-09-21 Sascha Schumann - - * ext/standard/Makefile.am: Continue, if re2c is not available. - - Using the ".new" suffix, we prevent the shell from zeroing the file. - - * ext/standard/microtime.c: Fix typo. - - catched by: ssb - - * configure.in.in: - Use install-sh (autoconf) script to install php. This automatically - creates the bindir path, so that the effect described in #2304 disappears. - - * ext/standard/microtime.c: - On at least Win32, gettimeofday() returns values in tv_usec which exceed - 1,000,000. - - For portability reasons we set the integer part of our result to 0. - This is equivalent to using tv_usec % 1000000. - -1999-09-21 Zeev Suraski - - * ChangeLog: *** empty log message *** - -1999-09-21 Rasmus Lerdorf - - * ext/zlib/zlib.c: woops - - * ext/zlib/zlib.c: Fix zlib compile problem - -1999-09-20 Andi Gutmans - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: - - Move some more language specific functions over to Zend. - get_class() and friends. - -1999-09-20 Sascha Schumann - - * ext/standard/url_scanner.c: - Timestamp commit. I do consider removing the rule from Makefile.am - -1999-09-20 Egon Schmid - - * ext/standard/file.c - ext/standard/string.c: Here was also something missing. - -1999-09-20 Andrew Skalski - - * ChangeLog: added FTP module - -1999-09-20 Andi Gutmans - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/php3_string.h - ext/standard/string.c - tests/testarray - php.h: - - Internal functions which are basic language functions should be in Zend - and not in PHP. I.e. strlen(), each(), error_reporting(), count(), - get_class_name(). - -1999-09-20 Rasmus Lerdorf - - * ext/standard/string.c - ChangeLog - ext/standard/file.c - ext/standard/php3_string.h: - Added optional allowable_tags arguments to strip_tags() and fgetss() to - allow you to specify a string of tags that are not to be stripped - - Could have used flex for this, and Andrew sent me a flex file to do this, - but I could do the same thing with only minor additions to the existing - state machine and the resulting code is much smaller and tighter. - -1999-09-20 Andrew Skalski - - * ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: php3 compatibility added - -1999-09-20 Andrei Zmievski - - * ChangeLog: *** empty log message *** - - * ext/standard/php3_var.h - ext/standard/var.c - ext/sysvshm/sysvshm.c - ext/session/session.c: - Upgraded var_dump() to take multiple arguments - - php3api_ is changed to php_ - -1999-09-20 Andrew Skalski - - * ext/ftp/Makefile.am - ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/ftplib.c - ext/ftp/ftplib.h - ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: Replaced ftplib because of incompatible license. - -1999-09-20 Stig Bakken - - * ext/standard/uniqid.c: logic fix - -1999-09-20 Thies C. Arntzen - - * ChangeLog - ext/xml/php3_xml.h - ext/xml/xml.c: resource API & ZTS stuff - -1999-09-20 Zeev Suraski - - * ChangeLog: *** empty log message *** - - * ChangeLog - mod_php4.c: - Fixed a memory leak in the Apache per-directory directives handler - -1999-09-20 Thies C. Arntzen - - * ChangeLog - ext/standard/basic_functions.c - ext/standard/basic_functions.h: added array_count_values function. - - * ext/standard/var.c: new API for var_dump - -1999-09-19 Zeev Suraski - - * ChangeLog: *** empty log message *** - -1999-09-18 Andi Gutmans - - * ext/mcal/php3_mcal.c: - Fix bug #2278 - - * serverapi/isapi_sapi.c - win32/readdir.c - php4dll.dsp - php4dllts.dsp: - Make Win32 compile again - -1999-09-18 Stefan Roehrich - - * ext/zlib/zlib.c: Fixed prototype. - -1999-09-18 Sascha Schumann - - * ext/standard/url_scanner.re - ext/standard/url_scanner.c: Aline escape signs in macro definitions. - - * configure.in.in: - Pipe header names through sort and put only one on each line. This - makes them better accessible. - - Add stdlib.h to check headers. - - * alloca.c: - There is no reason to define malloc() to xmalloc() in this context. - -1999-09-17 Andrei Zmievski - - * ext/ftp/.cvsignore: Make CVS quiet. - -1999-09-17 Thies C. Arntzen - - * ext/standard/url_scanner.c - ext/standard/url_scanner.re: - SUN c89 doesn't like } direct after a label;-( - -1999-09-17 Gergely Madarász - - * ChangeLog: note the shared modules in the changelog - -1999-09-17 Sascha Schumann - - * ext/dba/dba_db2.c - ext/dba/dba_dbm.c - ext/dba/dba_gdbm.c - ext/dba/dba_ndbm.c - ext/dba/php3_dba.h - ext/dba/dba.c: Convert to Ex API. Does anyone have a better name for it? - - * ext/mcrypt/mcrypt.c - ext/mhash/mhash.c: Use Ex API here as well. - - * ext/session/session.c: Convert module to use Ex API. - -1999-09-17 Thies C. Arntzen - - * ext/oci8/oci8.c - ChangeLog: fix #2316 - fetching empty LOBs via OCI8 - -1999-09-17 Sascha Schumann - - * ext/session/mod_user.c: don't call empty function names - - * ext/session/Makefile.am - ext/session/mod_user.c - ext/session/mod_user.h - ext/session/modules.c - ext/session/php_session.h - ext/session/session.c - ChangeLog: add user-level callbacks - -1999-09-17 Zeev Suraski - - * php4dllts.dsp: *** empty log message *** - -1999-09-17 Sascha Schumann - - * configure.in.in - ext/xml/config.m4: supply path to xml include dir for APXS and APACI - - * ext/wddx/php_wddx.h: This format is also used by the XML module - allows us to compile with Apache's expat-lite dir - - * main.c: `0' flag ignored with precision specifier and `X' format - - * ext/xml/config.m4: If available, use Apache's embedded expat - - * Makefile.in: fix Unix build - -1999-09-16 Zeev Suraski - - * ChangeLog.TODO - SAPI.c - SAPI.h - cgi_main.c - config.w32.h - ext/standard/string.c - main.c - mod_php4.c - php4dll.dsp - php4dllts.dsp - php4isapi/php4isapi.c - php_content_types.c - rfc1867.c - ChangeLog: - Added support for unknown POST content types (Zeev) - - Introduce the convert_to_*_ex() API in strlen() - - * Makefile.in - php_content_types.h: *** empty log message *** - - * ext/standard/info.c - Makefile.in - php_content_types.c: Generalize SAPI a bit - -1999-09-16 Andrei Zmievski - - * ext/session/session.c: Fixed memory leak. - -1999-09-16 Andrew Skalski - - * ext/ftp/ftp.c: Added documentation hooks to ftp.c - - * ext/ftp/ftp.c - ext/ftp/ftp.h: added ftp_pwd() ftp_cdup() ftp_mkdir() and ftp_rmdir() - - * ext/ftp/ftp.c - ext/ftp/ftp.h: added ftp_systype() and ftp_listraw() functions - - * ext/ftp/Makefile.am - ext/ftp/config.h.stub - ext/ftp/config.m4 - ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/ftplib.c - ext/ftp/ftplib.h: Added rudimentary FTP support. - -1999-09-16 Sascha Schumann - - * ext/odbc/config.m4 - ext/pcre/config.m4 - ext/session/session.c - ext/imap/config.m4 - ext/gd/config.m4 - configure.in.in: improve short help messages - - * configure.in.in: this was twice here - -1999-09-16 Rasmus Lerdorf - - * buildconf: libtool check fix - -1999-09-16 Sascha Schumann - - * INSTALL: . - - * ext/wddx/php_wddx_api.h - ext/wddx/wddx.c: - Make some things accessible from outside for session module - - * ChangeLog: . - - * ext/session/php_session.h - ext/session/session.c: wddx decode works as well - - * ext/session/php_session.h - ext/session/session.c: wddx serialization works now - - * ext/session/session.c: Since Thies fixed var.c, objects work now, too. - - * configure.in.in: - use AM_PROG_CC_STDC which covers AIX, Ultrix, OSF/1, HP-UX, and SVR4 - - * acinclude.m4 - configure.in.in: silence libtool - -1999-09-16 Thies C. Arntzen - - * ext/standard/var.c - ChangeLog: php4 now deserialized php3 objects correctly! - php3 will ignore objects serialized by php4 (that's the price we have to pay!) - small fix in deserializing objects with static initializers (thanx boris) - -1999-09-15 Thies C. Arntzen - - * ext/standard/var.c - ChangeLog: when unserializing classes: - if the class is not known the standard class (no methods) will be used. - if the class is known - the created object will functional again! - -1999-09-15 Andrei Zmievski - - * ext/standard/var.c: Fixed printf format. - - * ext/wddx/wddx.c: HASH_OF is now in php.h. - -1999-09-15 Thies C. Arntzen - - * ext/standard/var.c - ChangeLog: use new API in var.c - - * ext/standard/var.c: i love id-strings - - * ext/standard/var.c - ChangeLog: - made serialize/unserialize work with classes! (also made the code "shorter") - CHANGES: - - the serialized string now also contains the class name (was not available in PHP3)! - - when unserializing php will create a fully working object of that class again - therby the class has to be defined when unserializing - else you get a warning! - -1999-09-15 Stig Bakken - - * Makefile.in: add LIBOBJS, used by AC_REPLACE_FUNCS - -1999-09-15 Thies C. Arntzen - - * ext/standard/basic_functions.c - php.h: - HASH_OF is usable enough (i hate duplicating macros all over the place) - -1999-09-15 Stig Bakken - - * configure.in.in - php.h - Makefile.in: Clean up the strlcat/strlcpy checks. - -1999-09-15 Andi Gutmans - - * regex/regerror.c: - Leave this for now. - - * ext/zlib/zlib.c - regex/regerror.c - ext/hyperwave/hw.c - ext/standard/file.c - php4dll.dsp: - Thread-unsafe win32 compiles again - - Some strlcpy changes including one bug fix. - - * ext/standard/microtime.h - ext/standard/basic_functions.c: - gettimeofday wasn't registered. - -1999-09-14 Andi Gutmans - - * ext/apache/apache.c: - Another small one. I'll leave the rest for now... - - * fopen-wrappers.c: - First go at using strlcat(). - - * config.w32.h - php4dllts.dsp: - Support strlcpy/strlcat in windows. - -1999-09-14 Andrei Zmievski - - * ChangeLog - ext/pcre/config.h.stub - ext/pcre/config.m4 - ext/pcre/pcrelib/ChangeLog - ext/pcre/pcrelib/README - ext/pcre/pcrelib/chartables.c - ext/pcre/pcrelib/dftables.c - ext/pcre/pcrelib/dll.mk - ext/pcre/pcrelib/internal.h - ext/pcre/pcrelib/maketables.c - ext/pcre/pcrelib/pcre.3 - ext/pcre/pcrelib/pcre.3.html - ext/pcre/pcrelib/pcre.3.txt - ext/pcre/pcrelib/pcre.c - ext/pcre/pcrelib/pcre.def - ext/pcre/pcrelib/pcre.h - ext/pcre/pcrelib/pcreposix.3 - ext/pcre/pcrelib/pcreposix.3.html - ext/pcre/pcrelib/pcreposix.3.txt - ext/pcre/pcrelib/pcreposix.c - ext/pcre/pcrelib/pcretest.c - ext/pcre/pcrelib/pgrep.1 - ext/pcre/pcrelib/pgrep.1.html - ext/pcre/pcrelib/pgrep.1.txt - ext/pcre/pcrelib/pgrep.c - ext/pcre/pcrelib/testinput1 - ext/pcre/pcrelib/testinput2 - ext/pcre/pcrelib/testinput3 - ext/pcre/pcrelib/testoutput1 - ext/pcre/pcrelib/testoutput2 - ext/pcre/pcrelib/testoutput3 - ext/pcre/pcrelib/testoutput4 - ext/pcre/php_pcre.c - ext/pcre/php_pcre.h: - Updated bundled PCRE library to version 2.08 - - Made it possible to specify external location of the PCRE library - - Reworked PCRE extension to use updated PCRE library API - - Hopefully now everything behaves just like Perl.. - -1999-09-14 Andi Gutmans - - * Makefile.in - configure.in.in - php.h - strlcat.c - strlcpy.c: Add strlcpy/strlcat to the build process - -1999-09-14 Uwe Steinmann - - * ext/pdf/pdf.c: - - fixed memory leaks in pdf_open_memory_image() and pdf_add_bookmark() - -1999-09-14 Thies C. Arntzen - - * ChangeLog: forgot - - * ext/standard/basic_functions.c: is_array & friens speedups - -1999-09-14 Rasmus Lerdorf - - * ext/standard/basic_functions.c: Fix a warning - -1999-09-14 Thies C. Arntzen - - * ChangeLog - ext/standard/basic_functions.c: - count() now uses the new getParamertersEx API. - - * SAPI.c: i'm sure this was left-over debugging code! - - * ext/oci8/oci8.c - ChangeLog: you can now position when doing lob-writes. - -1999-09-13 Andi Gutmans - - * output.c - SAPI.h: - X-* is probably more standard. - -1999-09-13 Stig Bakken - - * ext/mhash/config.m4 - ext/mysql/config.m4 - ext/oci8/config.m4 - ext/yp/config.m4 - acinclude.m4 - configure.in.in - ext/bcmath/config.m4 - ext/gettext/config.m4 - ext/icap/config.m4 - ext/mcal/config.m4: - Added PHP_WITH_SHARED for checking "shared,*" prefix when configuring - extensions. - -1999-09-13 Thies C. Arntzen - - * ChangeLog - ext/standard/Makefile.am - ext/standard/metaphone.c - ext/standard/php_metaphone.h - internal_functions.c.in: added Metaphone support - - * ext/oci8/php3_oci8.h - ChangeLog - ext/oci8/oci8.c: - got rid of the define-callback stuff there's a bug in oracle-oci8! - -1999-09-13 Andrei Zmievski - - * ext/oci8/config.m4: Per Stig's suggestion. - -1999-09-13 Thies C. Arntzen - - * ext/oci8/oci8.c: ported $lob->savefile($filename) method from PHP3 - - * ext/oci8/oci8.c: cleanups - - * ChangeLog - ext/oci8/oci8.c - ext/standard/var.c: ported oci8 to use new class API - var_dump no longer tries to traverse avr->value.ht for objects but uses var->value.obj.properties instead - -1999-09-13 Zeev Suraski - - * ext/standard/info.c: - Modified phpinfo() to show the contents of arrays in HTTP_*_VARS[] - - * ext/standard/info.c - ext/standard/post.c - mod_php4.c: - Fix a buglet, and avoid crashing in phpinfo() (fixes an elusive legacy bug too) - -1999-09-12 Zeev Suraski - - * ChangeLog - ext/standard/post.c - ext/standard/post.h - rfc1867.c: - - Rewrote the GET/POST/Cookie data reader to support multi-dimensional - arrays! (Zeev) - - This still needs a lot of more testing, but it seems to work more or less. - - * SAPI.h - php4isapi/php4isapi.c: Add PHP-Version header in IIS - - * ext/standard/file.c - mod_php4.c - php_globals.h - main.c: That's important enough to be cached - -1999-09-12 Sascha Schumann - - * ext/standard/Makefile.am - ext/standard/url_scanner.c - ext/standard/url_scanner.re: - use static buffer for URLs instead of allocating/freeing memory - for each one - - * ext/session/session.c: calculate length of cookie string correctly - - * acinclude.m4: add missing result msg - - * output.c: - move session URL stuff to the last place before SAPI takes over - - * ChangeLog: These shouldn't be here - -1999-09-12 Andi Gutmans - - * ext/session/session.c: - Oops - - * ext/session/session.c: - Make it compile on Win32 - -1999-09-12 Zeev Suraski - - * cgi_main.c - ext/standard/basic_functions.c - main.c - output.c - output.h - php.h: Time to do that - rename the output layer prefix - - * ChangeLog - mod_php4.c - output.c: *** empty log message *** - -1999-09-12 Sascha Schumann - - * INSTALL: expand version number - - * ChangeLog: update - -1999-09-12 Andrei Zmievski - - * output.c: Reverting to previous state. - -1999-09-12 Sascha Schumann - - * ext/session/php_session.h: update macro - -1999-09-12 Andrei Zmievski - - * ext/session/session.c: Use global symbol table instead.. - - * output.c: Use TRANS_SID macro for selective compilation.. - - * ChangeLog - ext/wddx/wddx.c: - - Fixed mem leak when undefined variable was passed in for serialization - - Made it properly serialize object properties - -1999-09-12 Sascha Schumann - - * ext/standard/Makefile.am: add rule for url_scanner.c - -1999-09-11 Sascha Schumann - - * ext/standard/url_scanner.c - ext/standard/url_scanner.h - ext/standard/url_scanner.re: - add standard disclaimer - - regenerate scanner with re2c -s - - * ext/session/config.h.stub - ext/session/config.m4 - ext/session/php_session.h - ext/session/session.c - ext/standard/Makefile.am - ext/standard/url_scanner.c - ext/standard/url_scanner.h - ext/standard/url_scanner.re - output.c: add transparent session id propagation - this uses a custom scanner which detects relative URIs and changes - them appropiately. - must be explicitly enabled with --enable-trans-sid - (normal case is not affected, since session_adapt_uris defaults to - void statement. Compiler should eliminate dead code in output.c then.) - -1999-09-11 Andrei Zmievski - - * ChangeLog - ext/session/php_session.h - ext/session/session.c: - Added session_unset() function - - Fixed double session globals shutdown crash - - Added warning when session_destroy() is called without session_start() - - * ChangeLog - main.c: Use OnUpdateBool for Boolean entries. - -1999-09-11 Sascha Schumann - - * ext/standard/file.c: avoid mmap overhead for small files - - * configure.in.in - ext/standard/file.c: - optimize fpassthru/readfile to use mmap instead of fread - which especially increases speed on large files. - - * ChangeLog - ext/session/mod_files.c - ext/session/php_session.h - ext/session/session.c: - support for external entropy sources - - extern_referer_chk => extern_referer_check - - kill a warning in mod_files.c - -1999-09-11 Zeev Suraski - - * ext/standard/info.c - main.c - php.ini-dist: Rename allow_builtin_links to expose_php - - * main.c: More cleanup - - * ext/standard/post.c: Except for this small bug fix - it works - - * ChangeLog - ext/standard/post.c - main.c - php.ini-dist - php_globals.h: - Seriously optimize and clean php_parse_gpc_data() - - Added gpc_globals directive to turn global definitions of GPC variables on/off - (untested) - - * cgi_main.c - ext/standard/post.c - ext/standard/post.h - ext/standard/string.c - main.c - rfc1867.c: Cleanups & optimizations - - * ext/standard/post.c - ext/standard/post.h - rfc1867.c: Cleanups - -1999-09-10 Sascha Schumann - - * configure.in.in: Move Linux check => more general --version-script check - - * INSTALL: add info about php3/php4 apache modules - - * INSTALL: tweak the INSTALL document a little bit - - * configure.in.in: pass flag correctly to linker - - * Makefile.in - configure.in.in - php.map: - better use of scoping - - support Solaris 2.x - -1999-09-10 Andrei Zmievski - - * ext/oci8/config.m4: Workaround for m4 weirdness. - -1999-09-10 Mark Musone - - * ext/mcal/php3_mcal.c: - lets not go down that road..were onyl going to use the internal event structure. No passing objects - - * ext/mcal/php3_mcal.c: wrong preprocessor command - - * ext/mcal/php3_mcal.c - ext/mcal/php3_mcal.h: - ported the php3 stuff to php4. This module should work intechangably between the two versions also - -1999-09-10 Zeev Suraski - - * ext/gd/Makefile.am: *** empty log message *** - -1999-09-10 Uwe Steinmann - - * ext/pdf/pdf.c: - wrong use of php_print corrected - -1999-09-10 Zeev Suraski - - * ext/pgsql/pgsql.c: - Lost functionality in earlier fix... That should really work. - - * ext/pgsql/pgsql.c: That should do the trick (untested) - -1999-09-10 Mark Musone - - * ext/pgsql/pgsql.c: my bad, sorry - - * ext/pgsql/pgsql.c: fixed memory leak - -1999-09-09 Andi Gutmans - - * php4dllts.dsp: - - Add mcal to TS project. It seems that mcal needs to be patched a bit in - order to work TSRM. Right now it has globals. - -1999-09-09 Uwe Steinmann - - * ext/pdf/pdf.c: forgot to change prototype - - * ext/pdf/pdf.c: pdf_setfont got optional parameter to embed fonts - -1999-09-08 Andrei Zmievski - - * ext/standard/dl.c: - Remove extraneous debug dlerror() call which results in the subsequent - dlerror() returning NULL. - -1999-09-08 Gergely Madarász - - * configure.in.in - Makefile.in: - remove -Wl,--version-script from RPATHS, put it into a separate - variable - -1999-09-08 Danny Heijl - - * ext/informix/ifx.ec: Be consistent. - -1999-09-08 Uwe Steinmann - - * ext/hyperwave/hw.c: - - add posibility to specify how objrec to objarr conversion - is performed (not ready yet) - -1999-09-08 Sascha Schumann - - * ChangeLog - configure.in.in - php.map: add versioning support - -1999-09-08 Jakub Skopal - - * mod_php4.c: Correct compiler warning. - -1999-09-07 Andi Gutmans - - * php4dll.dsp: - Update non-threadsafe project file - - * ext/standard/string.c - config.w32.h: - Fix warnings and win32 compile - -1999-09-07 Andrei Zmievski - - * ext/standard/basic_functions.c: Here you go, Egon. - -1999-09-07 Stefan Roehrich - - * ext/zlib/zlib.c: Fixed behavior with empty doc_root. - gzgetss() now uses _php3_strip_tags. - -1999-09-07 Stig Bakken - - * ext/standard/fsock.c: - Add thread-safety notice here. The solution is using gethostbyname_r, - but it seems that it takes different parameters on Solaris and - Linux. ;-P We should probably make a wrapper function, and make a - configure test that checks if there is a reentrant version available, - and if not protect gethostbyname and similar calls with a mutex until - the results have been copied. Ugly. - -1999-09-07 Andrei Zmievski - - * ext/standard/basic_functions.c - ChangeLog: - Added second parameter to array_keys() which allows returning keys - only for a specific value in an array. - - * ext/standard/math.c: Kill compiler warning. - - * ext/mcal/.cvsignore: Shut up, CVS. - - * ext/standard/string.c: Kill warnings. - -1999-09-07 Uwe Steinmann - - * ext/standard/uniqid.c: - - uniqid() used the additional parameter even if it was not provided - this caused an segm fault. fixed it. - -1999-09-06 Zeev Suraski - - * ext/standard/dl.c - main.c: A couple of BoundsChecker fixes - -1999-09-06 Andi Gutmans - - * config.w32.h: - Should fix Win32 compile - -1999-09-06 Egon Schmid - - * ext/standard/basic_functions.c: File should here be string. - -1999-09-06 Danny Heijl - - * ChangeLog: Forgot to update ChangeLog - -1999-09-06 Stefan Roehrich - - * ext/zlib/php3_zlib.h - ext/zlib/zlib.c: Removed remaining PHP_31 defines. - First try with ZTS support, can someone with a working ZTS enabled setup test this, please? - -1999-09-06 Gergely Madarász - - * ext/gd/Makefile.am - ext/gd/config.m4 - ext/gd/gd.c: Enabled shared build of gd module - -1999-09-06 Danny Heijl - - * ext/informix/ifx.ec: - "Resourcified" the Informix driver. - -1999-09-06 Stig Bakken - - * LICENSE: untabified - -1999-09-06 Jakub Skopal - - * ext/standard/crypt.c: - Workaround for crypt() getting too few characters for salt. - -1999-09-06 Stefan Roehrich - - * ext/zlib/zlib.c: Fixed prototype. - -1999-09-06 Zeev Suraski - - * ext/mysql/php_mysql.c: Fix the 4.0 tree (forgot to commit) - -1999-09-06 Jakub Skopal - - * cgi_main.c: Corrected the argument-list for getopt. -c expects argument. - -1999-09-05 Jakub Skopal - - * ext/standard/basic_functions.c - ext/standard/php3_string.h - ext/standard/string.c: Added addcslashes(), stripcslashes(). - Reverted addslashes() to the very original behaviour. - -1999-09-05 Sascha Schumann - - * main.c: fix warning - -1999-09-05 Andi Gutmans - - * main.c - php_ini.c - php_ini.h: - Should fix short_tags and co. problem. - - * internal_functions_win32.c - php4dllts.dsp: - Make Win32 compile once again. - - * ext/standard/basic_functions.c - ext/standard/dir.c - win32/readdir.h - SAPI.c - ext/session/mod_files.c - php4dll.dsp: - Make dir functions compile in Win32 - - Fix too early memory manager initialization (For you Thies) - -1999-09-05 Stefan Roehrich - - * ext/ldap/config.m4: Find debian umich-ldap libraries/include files. - -1999-09-05 Andreas Karajannis - - * ChangeLog - build-defs.h.in: Changes for updated odbc module - - * ext/odbc/odbc.c - ext/odbc/php3_odbc.h: Renaming odbc files - - * ext/odbc/Makefile.am - ext/odbc/config.h.stub - ext/odbc/php_odbc.c - ext/odbc/php_odbc.h - ext/odbc/velocis.c: New resource handling for odbc module - -1999-09-05 Sascha Schumann - - * php_globals.h: work around gcc bug, otherwise compiler would die with - - toplev.c:2261: Internal compiler error in function float_signal - - in basic_functions.c - -1999-09-05 Andi Gutmans - - * main.c: - - php_error(E_ERROR,...) won't ever return so change the connection_status - before it is called. - -1999-09-05 Jakub Skopal - - * ext/standard/string.c: C++ comment fix... sorry. - - * ext/standard/php3_string.h - ext/standard/string.c: Appended second argument of addslashes(), - Changed php_addslashes() to add \000 instead of just \0 - -1999-09-04 Rasmus Lerdorf - - * php.h: Forgot one - - * ext/standard/exec.c: Kill a warning - -1999-09-04 Zeev Suraski - - * php.h: This was actually intentional... put it back in and improve - -1999-09-04 Rasmus Lerdorf - - * php.h - php_globals.h: Cleanups - - What the heck was that dangling (c) for in the PUTC macros? Were they - supposed to serve some sort of purpose, because I sure don't see one for - them. - -1999-09-04 Stefan Roehrich - - * ext/zlib/zlib.c: First try with new resource handling in zlib module. - -1999-09-04 Rasmus Lerdorf - - * serverapi/isapi_sapi.c - serverapi/nsapi_sapi.c: - Add connection handling stuff to ISAPI and NSAPI code. This will - likely need some reworking, but this way it won't get overlooked. - - * ChangeLog - configure.in.in: - Oops, set_time_limit() would never have worked becase HAVE_SETITIMER - never got defined anywhere. - - * ChangeLog - mod_php4.c: Oops - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - main.c: - Catch a timeout and add user-level interface for connection handling - - * mod_php4.c - serverapi/cgi_sapi.c - main.c: - Might as well bail as soon as we know we should since this is now - possible. We still need to set our connection status bit field so a - shutdown function can figure out if a script was terminated due to an - abort, timeout or finished normally. - - * main.c - mod_php4.c - php.h - php_globals.h - serverapi/cgi_sapi.c - serverapi/isapi_sapi.c - serverapi/nsapi_sapi.c - serverapi/sapi.h: - First part of the connection_status work. No user-callable functions - yet. That is coming next. Have also only done Apache and CGI so far. - Will have to crack open my ISAPI book to do that one. - - Also changed the SAPI output functions to return an int. We'll check - the connection status inside each one, but we might need the return - code at some other level and I don't see a good reason for just tossing - these return codes. - -1999-09-04 Andrei Zmievski - - * ext/wddx/wddx.c: Oops, don't need those commented out blocks. - - * output.c: Kill compiler warnings. - - * ext/wddx/wddx.c: Conform to new resource handling guidelines. - -1999-09-04 Zeev Suraski - - * ext/zlib/zlib.c - ext/standard/file.c - ext/standard/php3_string.h - ext/standard/post.c - ext/standard/string.c - ext/sybase/sybase.c - ext/sybase_ct/php_sybase_ct.c - ext/msql/php_msql.c - ext/mysql/php_mysql.c - ext/pgsql/pgsql.c - ext/standard/exec.c - dl/mssql/mssql.c - ext/db/db.c - ext/interbase/interbase.c - php3_compat.h: *** empty log message *** - - * ext/sybase_ct/php_sybase_ct.c - ext/sybase_ct/php_sybase_ct.h - ChangeLog: Add resource support to the Sybase CT module - -1999-09-04 Sascha Schumann - - * ext/session/session.c: First try at WDDX serializer - (not active currently) - -1999-09-04 Zeev Suraski - - * ext/msql/php_msql.c - ext/msql/php_msql.h: - - - - - - - - - - A few fixes - -1999-09-04 Sascha Schumann - - * ext/session/mod_files.c: cleanup - - * ext/session/php_session.h: remove superflicious enumaration - - * ext/session/mod_mm.c: - bail out, if ps_mm_instance wasn't initialized correctly - (should take place in global startup) - - * ext/session/mod_files.c: implement single directory garbage collector - -1999-09-04 Zeev Suraski - - * ext/msql/Makefile.am - ext/msql/msql.c - ext/msql/php3_msql.h - ext/msql/php_msql.c - ext/msql/php_msql.h - ChangeLog: Update the mSQL module with the latest tech - -1999-09-03 Zeev Suraski - - * ext/mysql/mysql.dsp: *** empty log message *** - -1999-09-03 Andrei Zmievski - - * ext/pcre/php_pcre.c - ext/pcre/php_pcre.h: Static is good... - -1999-09-03 Zeev Suraski - - * ChangeLog - ext/mysql/mysql.c - ext/mysql/php3_mysql.h - ext/mysql/php_mysql.c - ext/mysql/php_mysql.h: Final MySQL tweaks - -1999-09-03 Danny Heijl - - * ext/informix/ifx.ec: - - backed out IS_RESOURCE stuff in favour of old php3-style IS_LONG - for now. This makes the Informix driver work again. - -1999-09-03 Zeev Suraski - - * ext/mysql/Makefile.am - ext/mysql/mysql.dsp - php_modules.dsw: More cleanups - - * ChangeLog - ext/mysql/mysql.c: Use the new API for resources in MySQL - -1999-09-03 Stefan Roehrich - - * ext/oci8/config.m4 - ext/oracle/config.m4: Added detection of Oracle 8.1 (aka 8i) from PHP3. - -1999-09-03 Andrei Zmievski - - * ext/pcre/php_pcre.c - ext/pcre/php_pcre.h: Practice what you preach, I guess. - -1999-09-03 Sascha Schumann - - * internal_functions_win32.c: - Add global startup/shutdown functions in Win32 version as well - - * php.h: Add prototypes for new functions in internal_functions.c.in - - * SAPI.c - acinclude.m4 - ext/session/config.m4 - ext/session/mod_mm.c - ext/session/mod_mm.h - ext/session/session.c - genif.sh - internal_functions.c.in - main.c - php.h - ChangeLog: - add global startup/shutdown handlers - - improve genif.sh to also consider all header files for inclusion - (checks for phpext_) - - use vsnprintf in main.c to avoid buffer overflows - - improve sessions's mm module to cope better with OOM situations - within the shared memory segment - - fix typo wrt session.auto_start - - * ext/mcal/Makefile.in: - Makefile.in and other generated do not belong under CVS control - -1999-09-03 Gergely Madarász - - * ext/mysql/Makefile.am - ext/mysql/config.m4 - ext/mysql/mysql.c: Enabled shared build of mysql module - - * ext/xml/config.m4: Small cleanup - - * ext/snmp/Makefile.am - ext/snmp/config.m4 - ext/snmp/snmp.c: Enabled shared build of snmp module - - * ext/pgsql/Makefile.am - ext/pgsql/config.m4 - ext/pgsql/pgsql.c: Enabled shared build of pgsql module - -1999-09-03 Andrei Zmievski - - * ext/wddx/wddx.c: Fixed resource handling to conform to PHP4 guidelines. - -1999-09-03 Uwe Steinmann - - * ext/hyperwave/hw.c: - complete rewrite of object to array conversion - -1999-09-03 Zeev Suraski - - * php_version.h - configure.in.in: Version update - - * php4isapi/php4isapi.c - output.c - ChangeLog - main.c: - - Fixed several problems with output buffering and HEAD requests (Zeev) - - Fixed HTTP Status code issue with ISAPI module (Zeev) - - * ChangeLog: *** empty log message *** - -1999-09-02 Stig Bakken - - * ext/xml/Makefile.am - ext/xml/config.m4: clean up library naming - -1999-09-02 Thies C. Arntzen - - * ext/standard/image.c - ext/standard/image.h - ext/standard/php3_standard.h - ext/standard/php_image.h - ChangeLog: newest GetImageSize renamed header-file - -1999-09-02 Andi Gutmans - - * ChangeLog: - - Small fix but it's important for people to know when B3 is released. - -1999-09-01 Mark Musone - - * ext/mcal/Makefile.am - ext/mcal/Makefile.in - ext/mcal/config.h.stub - ext/mcal/config.m4 - ext/mcal/php3_mcal.c - ext/mcal/php3_mcal.h: Added mcal module - -1999-09-01 Andi Gutmans - - * internal_functions_win32.c - main.c - php4dllts.dsp: - Add sessions module to standard win32 build. - -1999-09-01 Andrei Zmievski - - * ext/session/session.c: Fix lcg.h location. - -1999-09-01 Uwe Steinmann - - * ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c: - - Group-attribute may now appear multiple times in objrec record. - -1999-08-31 Stig Bakken - - * ext/session/session.c - ext/standard/uniqid.c - buildconf - internal_functions_win32.c: ext/lcg -> ext/standard in various places - - * ext/standard/uniqid.c: oops - -1999-08-31 Thies C. Arntzen - - * Makefile.in: we need DEFS when compiling this dir - -1999-08-31 Stig Bakken - - * main.c: fix for bug #2165 - - * ext/standard/basic_functions.c: fix for bug #2191 - - * ext/standard/uniqid.c: compat fix, bug #2201 - -1999-08-31 Thies C. Arntzen - - * ext/apache/apache.c: "fix" for #2202 - -1999-08-30 Andreas Karajannis - - * ext/odbc/config.h.stub - ext/odbc/config.m4 - ext/odbc/php3_odbc.h - ext/odbc/setup.stub: Add support for unixODBC - -1999-08-29 Stig Bakken - - * internal_functions.c.in - ext/standard/Makefile.am - ext/standard/lcg.c - ext/standard/php_lcg.h: moved lcg stuff to ext/standard - -1999-08-29 Sascha Schumann - - * cgi_main.c: - PATH_TRANSLATED was not used at all, even if one comment implied - it should be used. After adding this, the CGI version works for me - w/ Apache + suexec - -1999-08-29 Egon Schmid - - * ext/pgsql/pgsql.c: This one was nonesense. - - * ext/pgsql/pgsql.c: Missing return type. - - * ext/standard/basic_functions.c: Oops, file should be string here. - -1999-08-28 Rasmus Lerdorf - - * mod_php4.c: - This check actually doesn't make a whole lot of sense. We need - something here, but if a mod_auth_* module declines, the type is - still set. So, we need a check to see if there have been a - non-declined auth hook previously for this request. I will ponder - a good approach to this. - -1999-08-28 Zeev Suraski - - * ChangeLog - cgi_main.c: Add -d switch - -1999-08-28 Philippe Verdy - - * ext/standard/datetime.c: semicolon syntax error - - * ext/standard/datetime.c: Bug in gmmktime(): - it produced wrong results in New Foundland, - Central Australia, India, Iran, and Java, with - half-hour timezones. - -1999-08-28 Sascha Schumann - - * main.c: - when "track_vars" is disabled and a script which contains is - accessed for the first time, track vars were not created properly. - - * ext/standard/file.c: merge in fix from php3 - -1999-08-28 Zeev Suraski - - * main.c: New relay code - -1999-08-28 Sascha Schumann - - * ChangeLog: - If we stick to this style, parsing becomes easier (for humans and computers). - -1999-08-27 Sascha Schumann - - * ext/session/config.h.stub - ext/session/config.m4 - ext/session/mod_files.c - ext/session/mod_mm.c - ext/session/mod_mm.h - ext/session/modules.c - ext/session/php_session.h - ext/session/session.c - ext/session/Makefile.am: - fix potential buffer problem in send_cookie - - fix gc probability algorithm - - don't access mod_data directly - - initial version of mm support for session data storage - - This works pretty good, but we need to create the initial mm pool - from the parent process/thread. Still looking for a clean way to do that. - -1999-08-27 Zeev Suraski - - * ext/standard/browscap.c: Better debug macros - -1999-08-27 Andreas Karajannis - - * ext/odbc/odbc.c: Typo fix - -1999-08-27 Zeev Suraski - - * main.c: *** empty log message *** - - * ext/imap/imap.c: Tiny fixes - - * main.c: Log date&time on script logs - -1999-08-27 Mark Musone - - * ext/imap/imap.c: - lets not make global functions unless we need to..actually this should be taken out someday - - * ext/icap/php3_icap.c: cleand up storing new events - -1999-08-26 Rasmus Lerdorf - - * ext/pcre/php_pcre.c: Missing return types in prototypes - -1999-08-26 Andrei Zmievski - - * ext/sybase_ct/.cvsignore: shut up CVS - - * ChangeLog: *** empty log message *** - - * ext/wddx/wddx.c: Fix for #2161 - -1999-08-26 Andi Gutmans - - * ChangeLog: - Make Win32 compile again. - -1999-08-25 Sascha Schumann - - * ChangeLog: . - - * ext/sysvsem/sysvsem.c: - AIX wants the value, not the pointer to the value. - - Fixes #2149 - -1999-08-25 Andi Gutmans - - * ext/standard/fsock.h - ext/standard/fsock.c - fopen-wrappers.c - main.c - ChangeLog: Make fopen() work with URL's in Win32 - - * ChangeLog: - Fix for include_path for Win32 (Zend library) - -1999-08-24 Zeev Suraski - - * ext/com/COM.c - output.c - php.ini-dist - php4dll.dsp - php_globals.h - ChangeLog - main.c: Add output_buffering directive - -1999-08-24 Mark Musone - - * ext/icap/php3_icap.c - ext/icap/php3_icap.h: argh..Finally - -1999-08-23 Sascha Schumann - - * ext/Makefile.am: suppress error exit status on non Rhapsody systems - - * buildconf: don't print out error message - - * dlist.c: malloc.h is deprecated, use stdlib.h instead - -1999-08-23 Andi Gutmans - - * php4isapi/php4isapi.c: - Commit fix proposed in bug report. - -1999-08-23 Mark Musone - - * ext/icap/php3_icap.c - ext/icap/php3_icap.h: - changed to use the new, soon to be public libicap 0.99 - -1999-08-23 Sascha Schumann - - * ext/session/session.c: return true to match documentation - -1999-08-22 Andi Gutmans - - * internal_functions_win32.c - php4dllts.dsp: - Add lcg to windows project. - -1999-08-22 Sascha Schumann - - * ChangeLog: . - - * acinclude.m4 - configure.in.in - libphp4.module.in: remove all references to RAW_RPATHs - Apache builds now correctly when shared core is used - - * ext/session/mod_files.c - ext/session/mod_files.sh: - cleanup code - - add script which creates the directory tree for better scaling - of mod_files - - I have to decide yet whether we implement the garbage collection in the - module or if we simply let the user do - - find path -ctime +1 | xargs rm - - * ext/session/mod_files.c: Use O_EXCL where possible. - -1999-08-21 Sascha Schumann - - * ChangeLog - ext/session/php_session.h - ext/session/session.c: - add session.extern_referer_chk - - use combined lcg in session id creation - - * ChangeLog: . - - * ext/standard/uniqid.c: - get rid of that usleep() and add some entropy using the combined lcg - -1999-08-20 Andrei Zmievski - - * ChangeLog: *** empty log message *** - - * ext/ldap/ldap.c: Fix bug #2025 - -1999-08-19 Egon Schmid - - * ext/pcre/php_pcre.c: Here was also something missing - -1999-08-19 Mark Musone - - * ext/icap/php3_icap.c: *smack*...must..initialize...return...value.. - -1999-08-19 Uwe Steinmann - - * ext/pdf/config.m4: On the way to make configure more robust - -1999-08-19 Andi Gutmans - - * ext/standard/dir.c - ext/pcre/php_pcre.c - main.c: - - Fixed memory leaks. tsrm resource id deallocation still needs to be implemented. - -1999-08-19 Uwe Steinmann - - * ext/hyperwave/hw.c: - fixed several memory leaks - - fixed broken hw_cp and hw_mv functions - -1999-08-19 Andrei Zmievski - - * ChangeLog: *** empty log message *** - -1999-08-19 Uwe Steinmann - - * ext/pdf/pdf.c: missing return type - -1999-08-19 Rasmus Lerdorf - - * ext/gd/gdcache.c: TTF support tested and working now - - * ext/gd/php3_gd.h: This should fix TTF support - untested - -1999-08-19 Andi Gutmans - - * ext/oci8/oci8.c: - Fixed typo in oci8 error message - -1999-08-18 Andrei Zmievski - - * ext/standard/exec.c: Fixed bug #2105 - -1999-08-18 Charles Hagenbuch - - * ext/imap/imap.c: cjh: fixing the imap_add_body crash in php4. - -1999-08-18 Thies C. Arntzen - - * ext/oracle/php3_oracle.h - ext/oracle/oracle.c - ext/oci8/oci8.c: ZTS - -1999-08-18 Andrei Zmievski - - * ext/wddx/wddx.c: Ported fixed for bug #2103 from PHP3. - -1999-08-18 Thies C. Arntzen - - * ext/xml/xml.c: ZTS fix - - * ext/oracle/oracle.c: some ZTS stuff - - * ChangeLog - ext/oci8/oci8.c: ocifetchinto fix - -1999-08-17 Zeev Suraski - - * ext/mysql/mysql.c - ChangeLog: Fix #2090 - - * ChangeLog: *** empty log message *** - - * ext/standard/basic_functions.c: Fix #2096 - -1999-08-17 Sascha Schumann - - * ext/standard/crypt.c: merge in change: - - Date: Monday June 28, 1999 @ 4:40 - Author: bjh - - Update of /repository/php3/functions - In directory php:/tmp/cvs-serv5697 - - Modified Files: - crypt.c - Log Message: - Stop core dump using crypt() with standard DES. When PHP3_MAX_SALT_LEN = 2 - adding the null terminator to the salt exceeds allocated space causing - stack corruption. - - * ChangeLog: update - - * ext/gd/php3_gd.h: - HAVE_FREETYPE_H isn't defined anywhere. HAVE_LIBTTF should be sufficient - - * ChangeLog - ext/mhash/mhash.c: fix persistency of mhash_* constants - -1999-08-17 Mark Musone - - * ext/icap/php3_icap.c: dont have these library functiosn yet - - * ext/icap/php3_icap.h: argh..heh..par for the course.. - - * ext/icap/php3_icap.h: argh..bad day.. - - * ext/icap/php3_icap.h: please work... - - * ext/icap/Makefile.am: hrmmm - - * ext/icap/php3_icap.c: last few compile fixes - - * ext/icap/php3_icap.c: - maybe it'll compile now..more php3->php4 conversions - - * ext/icap/php3_icap.c: more changes - -1999-08-17 Thies C. Arntzen - - * ext/oracle/php3_oracle.h - ChangeLog - ext/oracle/oracle.c: ZTS stuff - -1999-08-17 Mark Musone - - * ext/icap/config.m4: thanks Andrei! - -1999-08-17 Sascha Schumann - - * ext/dba/dba_db2.c - ChangeLog: fix flushing cached information to disk - -1999-08-17 Thies C. Arntzen - - * ext/oci8/php3_oci8.h - ChangeLog - ext/oci8/oci8.c: cleanups & ZTS stuff (ZTS untested!) - - * configure.in.in - ext/standard/filestat.c - ChangeLog: imported diskfreespace from 3.0 - -1999-08-17 Uwe Steinmann - - * ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c: fixed potential segm faults - -1999-08-16 Andrei Zmievski - - * ext/standard/basic_functions.c - ChangeLog: Removed internal pointer reset from array_walk. - -1999-08-15 Philippe Verdy - - * ext/pcre/pcrelib/pcreposix.c: - make pcre test program compile again with Zeev's - additions in the pcre_exec() function parameters - -1999-08-15 Thies C. Arntzen - - * ext/standard/filestat.c - ext/standard/link.c: added a few PLS_FETCH() - -1999-08-14 Zeev Suraski - - * apMakefile.tmpl - php.h: Close bug #1742 - -1999-08-14 Andrei Zmievski - - * ChangeLog: *** empty log message *** - - * ext/standard/basic_functions.c: Forgot to have internal pointer reset. - -1999-08-14 Danny Heijl - - * ext/informix/ifx.ec: more of the new ini stuff - -1999-08-14 Zeev Suraski - - * ext/standard/basic_functions.c: Rename TestClass to OverloadedTestClass - - * ext/mysql/mysql.c - php_ini.h: Fix thread unsafe version - -1999-08-14 Andi Gutmans - - * main.c: - Make the non-threadsafe version compile again - -1999-08-13 Zeev Suraski - - * ext/mysql/mysql.c - ext/mysql/mysql.dsp - ext/standard/dl.c - ChangeLog - main.c - php.ini-dist - php4ts.dsw - php_ini.c - php_ini.h - php_modules.dsw: - Add PHP Modules workspace - - Get the MySQL module to compile&work under thread-safe Win32 - - Fix various thread safety issues with dynamic modules - -1999-08-13 Andrei Zmievski - - * ext/standard/filestat.c: Fixed bug #2023. - -1999-08-13 Sascha Schumann - - * buildconf: rerun checks if buildconf is newer than the time stamp file - -1999-08-13 Zeev Suraski - - * ext/sybase/config.h.stub - ext/sybase/config.m4 - ext/sybase/php3_sybase-ct.h - ext/sybase/sybase-ct.c - ext/sybase_ct/Makefile.am - ext/sybase_ct/config.h.stub - ext/sybase_ct/config.m4 - ext/sybase_ct/php_sybase_ct.c - ext/sybase_ct/php_sybase_ct.h - ext/sybase_ct/setup.stub - ChangeLog - ext/sybase/Makefile.am: - Separate Sybase-CT from Sybase, and fix build process for Sybase-CT - -1999-08-12 Uwe Steinmann - - * ext/pdf/pdf.c: - fixed unresolved symbol pdf_open_memory_image when pdflib 2.01 is used - -1999-08-12 Philippe Verdy - - * main.c: no return warning removed. fixed TSRM constructor prototype - - * ext/standard/string.c: signed/unsigned warning removed - - * ext/standard/.cvsignore: Bison generated files - -1999-08-12 Uwe Steinmann - - * ext/pdf/config.m4: config for pdf module should now be similar to php3 - -1999-08-11 Mark Musone - - * ext/icap/php3_icap.c: whoops, forgot to actually return the alarms :^) - -1999-08-10 Uwe Steinmann - - * ext/pdf/config.h.stub - ext/pdf/config.m4: slight changes to config of pdf module - -1999-08-10 Stig Bakken - - * ext/icap/.cvsignore - ext/icap/Makefile.in: Makefile.in should not be added to CVS - -1999-08-10 Thies C. Arntzen - - * ext/oci8/oci8.c: starting to clean up - - * Makefile.in - regex/Makefile.in: - you can now override the CFLAGS while doing make - eg: - make CFLAGS="-g" - -1999-08-09 Mark Musone - - * ext/icap/Makefile.in - ext/icap/config.m4 - ext/icap/php3_icap.c: more ports - - * ext/icap/php3_icap.c: ports to php4 - - * ext/icap/Makefile.am - ext/icap/Makefile.in - ext/icap/config.h.stub - ext/icap/config.m4: more moudle stuff - - * ext/icap/php3_icap.c - ext/icap/php3_icap.h: added icap files from php3 sources - -1999-08-09 Egon Schmid - - * ext/standard/string.c: More typos. - - * ext/zlib/zlib.c: I missed that also. - - * ext/pgsql/pgsql.c: Another typo. - -1999-08-09 Zeev Suraski - - * ChangeLog: that too - -1999-08-09 Andi Gutmans - - * ChangeLog - configure.in.in - internal_functions_win32.c - php_version.h: Go beta 2 (final) - - * SAPI.c: Fix HTTP/ header handling - -1999-08-09 Andreas Karajannis - - * MODULES_STATUS - ext/odbc/odbc.c: Fixed odbc_fetch_into, added prototype return values. - Pconnects are not working - -1999-08-09 Thies C. Arntzen - - * ChangeLog - MODULES_STATUS - ext/sysvshm/sysvshm.c: fixed sysv_shm* - -1999-08-09 Uwe Steinmann - - * ChangeLog - ext/pdf/pdf.c: add changelog entries which I forget a couple of days ago - -1999-08-08 Philippe Verdy - - * win32/signal.h: solve infinite recursion error when including - -1999-08-08 Andreas Karajannis - - * ext/odbc/config.m4 - ext/odbc/odbc.c - ext/odbc/php3_odbc.h: First shot at odbc for PHP4 - Problems with LONGs to be investigated - -1999-08-08 Thies C. Arntzen - - * ext/xml/xml.c: fix for #1995 (this module needs some more work.) - -1999-08-07 Danny Heijl - - * ext/informix/ifx.ec: More zend-izing. - -1999-08-07 Zeev Suraski - - * ChangeLog - ext/standard/info.c - main.c - php.ini-dist: - Built-in phpinfo() links are now turned off by default. They can be - turned on using the allow_builtin_links INI directive - - * ChangeLog - ext/standard/info.c - php4.dsp - php4dll.dsp: - - Changed phpinfo() to list modules that have no info function - -1999-08-07 Andrei Zmievski - - * ChangeLog: *** empty log message *** - - * ext/standard/basic_functions.c: - Modified array_walk() function so that the userland callback is passed - a key and possible user data in addition to the value. It's still backward - compatible with one argument version. - -1999-08-07 Zeev Suraski - - * ChangeLog - ext/ldap/ldap.c: Fix for bug #1980 - - * ChangeLog - ext/apache/apache.c: Fix for bug #1754 - -1999-08-07 Philippe Verdy - - * configuration-scanner.l: unreferenced variable warning - -1999-08-07 Stefan Roehrich - - * ext/standard/info.c: Corrected spelling. - -1999-08-07 Zeev Suraski - - * ext/standard/basic_functions.c - scripts/apache/conffix.awk - scripts/apache/htaccessfix.awk: Fix&improve conversion scripts - -1999-08-06 Zeev Suraski - - * LICENSE: bump up the version number - - * ext/standard/basic_functions.c: - count/sizeof had their arguments setup wrong (messup between Beta 1 and 2) - - * ChangeLog - ext/standard/basic_functions.c: - - Improved register_shutdown_function() - you may now supply arguments that - will be passed to the shutdown function - - Improved call_user_func() and call_user_method() - they now support passing - arguments by reference - - Fixed usort() and uksort() - - * ChangeLog: *** empty log message *** - -1999-08-06 Uwe Steinmann - - * ext/pdf/pdf.c - ext/pdf/php3_pdf.h - ext/hyperwave/hg_comm.h - ext/hyperwave/hw.c - ext/hyperwave/php3_hyperwave.h: Made Hypwerwave module threat safe - -1999-08-06 Thies C. Arntzen - - * ext/standard/basic_functions.c: fix for #1947 - -1999-08-06 Uwe Steinmann - - * ext/fdf/fdf.c - ext/fdf/php3_fdf.h: Fdf module should now be up to date - - * ext/hyperwave/hg_comm.c: - Order of freeing memory cause segm fault since efree seems to wipe - out the memory. - -1999-08-05 Uwe Steinmann - - * ext/hyperwave/hw.h - ext/hyperwave/php3_hyperwave.h: renamed file - - * ext/hyperwave/hw.c: - zend_hash_update() seems to be a bit different form php3_hash_update - - * ext/hyperwave/hg_comm.c - ext/hyperwave/hg_comm.h - ext/hyperwave/hw.c - ext/hyperwave/hw_error.h - ext/pdf/config.m4 - ext/pdf/pdf.c - ext/pdf/php3_pdf.h - ext/gd/gd.c: Huge patch to update the hyperwave and pdflib module. - Only pdflib >2.0 is supported. - None is tested yet. Hyperwave seems to be broken now. - -1999-08-05 Andrei Zmievski - - * ext/msql/msql.c: Fixed. - -1999-08-05 Thies C. Arntzen - - * main.c: - hope i haven't missed anything - but we're no longer in the 3.x tree - -1999-08-04 Zeev Suraski - - * ChangeLog: *** empty log message *** - - * makedist: Fix makedist to work with the libtool enabled distribution - - * ChangeLog - php4isapi/php4isapi.c: * Fix bug #1963 - * Support large ISAPI server variables - -1999-08-04 Steven Lawrance - - * ChangeLog: Added a note about the SNMP changes - - * ext/snmp/php3_snmp.h - ext/snmp/snmp.c: - Fixed a little boo-boo I made during the PHP3->PHP4 conversion. - - * ext/snmp/php3_snmp.h - ext/snmp/snmp.c: - Updated the files so that they have all the functionality of - PHP 3.0.12. These include snmpwalkoid, snmp_get_quick_print, snmp_set_quick_print, and snmpset. - -1999-08-03 Mike Gerdts - - * acinclude.m4: - Fix bug #1949: -rdynamic not handled properly with Sun's C compiler - -1999-08-03 Rasmus Lerdorf - - * ext/standard/formatted_print.c: [s]printf fix for bug #1952 - (note, [s]printf doesn't work in PHP4 yet) - -1999-08-03 Mike Gerdts - - * rfc1867.h: - Last character of file not a newline, causing problems with Sun's C compiler - - * php_regex.h: - file did not end with a newline, causing problems for Sun's C compiler - -1999-08-02 Zeev Suraski - - * buildconf: This should sort the buildconf bug... - -1999-08-02 Stefan Roehrich - - * ext/zlib/zlib.c - ext/zlib/php3_zlib.h - ChangeLog - MODULES_STATUS: - Fix for Redhat libc 2.1 and dynamic loading in zlib module. - Adapted zlib module to new PHP_Mxxx macros. - -1999-08-02 Zeev Suraski - - * ext/standard/fsock.c - configure.in.in: AIX needs this include... - - * configure.in.in - php_version.h: Go Beta 2 - - * php4isapi/php4isapi.c - serverapi/cgi_sapi.c - serverapi/isapi_sapi.c - ext/xml/php3_xml.h - ext/xml/xml.c - ext/zlib/zlib.c - ext/sysvshm/sysvshm.c - ext/standard/reg.c - ext/standard/string.c - ext/standard/uniqid.c - ext/standard/url.c - ext/standard/var.c - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ext/sysvsem/sysvsem.c - ext/snmp/snmp.c - ext/standard/basic_functions.c - ext/standard/browscap.c - ext/standard/cyr_convert.c - ext/standard/datetime.c - ext/standard/dir.c - ext/standard/dl.c - ext/standard/dns.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/filestat.c - ext/standard/formatted_print.c - ext/standard/fsock.c - ext/standard/head.c - ext/standard/image.c - ext/standard/info.c - ext/standard/iptc.c - ext/standard/link.c - ext/standard/mail.c - ext/standard/math.c - ext/standard/pack.c - ext/standard/pageinfo.c - ext/standard/post.c - ext/standard/rand.c - ext/pcre/php_pcre.c - ext/pdf/pdf.c - ext/pgsql/pgsql.c - ext/session/session.c - ext/oci8/oci8.c - ext/oci8/php3_oci8.h - ext/odbc/odbc.c - ext/odbc/velocis.c - ext/oracle/oracle.c - ext/mysql/mysql.c - ext/mhash/mhash.c - ext/msql/msql.c - ext/mcrypt/mcrypt.c - ext/ldap/ldap.c - ext/imap/imap.c - ext/interbase/interbase.c - ext/filepro/filepro.c - ext/gd/gd.c - ext/gettext/gettext.c - ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c - ext/dba/dba.c - ext/dbase/dbase.c - ext/fdf/fdf.c - ext/aspell/aspell.c - ext/bcmath/bcmath.c - ext/com/COM.c - ext/db/db.c - dl/log/log_sql.c - dl/mssql/mssql.c - dl/snmp/snmp.c - dl/snmp/winsnmp.c - ext/apache/apache.c - dl/crypt/crypt.c - dl/log/log_db.c - cgi_main.c - configuration-parser.y - configuration-scanner.l - fopen-wrappers.c - main.c - mod_php4.c - php.h - php3_compat.h - php3_sprintf.c - php_ini.c - rfc1867.c - safe_mode.c - snprintf.h: - Removed '3' from key functions in PHP (maintained compatibility through - php3_compat.h) - -1999-08-02 Andrei Zmievski - - * ext/oracle/php3_oracle.h: Fix function declarations. - - * ext/odbc/php3_odbc.h - ext/odbc/php3_velocis.h - ext/odbc/velocis.c - ext/oracle/oracle.c - ext/oracle/php3_oracle.h - ext/oci8/oci8.c - ext/odbc/odbc.c - ext/mhash/mhash.c - ext/msql/msql.c - ext/msql/php3_msql.h - ext/mysql/mysql.c - ext/mysql/php3_mysql.h - ext/interbase/interbase.c - ext/interbase/php3_interbase.h - ext/ldap/ldap.c - ext/ldap/php3_ldap.h - ext/mcrypt/mcrypt.c - ext/imap/imap.c - ext/imap/imap.h: More symbol work. - - * ext/standard/datetime.c: Updated proto - -1999-08-01 Egon Schmid - - * ext/pcre/php_pcre.c: - Another forgotten prototype. Andrei, why is preg_grep in PHP3 missing? - -1999-08-01 Andi Gutmans - - * ext/standard/basic_functions.c - tests/testobj: Support resource type in gettype() - -1999-08-01 Zeev Suraski - - * ChangeLog - ext/sybase/sybase-ct.c - ext/sybase/sybase.c: Fix bug #1872 - - * ChangeLog - ext/imap/imap.c: Final IMAP fixes - -1999-07-31 Zeev Suraski - - * ext/imap/imap.c: More IMAP fixes - - * snprintf.c: Fix another compile warning - - * ext/sybase/sybase.c: That should fix bug #1903 - - * ChangeLog: Fix problem with include/require of URLs (bug #1832) - - * main.c: Fix problem with include/require of URLs - - * ext/standard/math.c: Fix bug #1914 - - * ext/imap/imap.c: Declaration fix - -1999-07-30 Zeev Suraski - - * ext/imap/imap.c: - Ok, that should be a good start. Can somebody verify that this actually compiles, - and perhaps check if it runs? - - * ext/imap/imap.c: - Early steps towards making the IMAP module PHP 4.0 compatible - (and readable - indent people, INDENT) - - * ChangeLog - ext/standard/string.c: This should fix the implode() problem - -1999-07-30 Andrei Zmievski - - * main.c: Fix for bug #1907. - -1999-07-29 Andi Gutmans - - * ext/standard/basic_functions.c - tests/testobj: -Tiny fix - - * ext/standard/basic_functions.c: - - Added function documentation prototypes. Thanks to Egon Schmid for - straightening me out :) - -1999-07-28 Andi Gutmans - - * ext/standard/basic_functions.h - ext/standard/soundex.c - tests/testobj - ChangeLog - ext/standard/basic_functions.c: - - Added get_class($obj), get_parent_class($obj) and method_exists($obj,"name") - -1999-07-28 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/link.c - php.h: Fix link functions problem. - -1999-07-28 Danny Heijl - - * ext/standard/soundex.c: Make it compile again - -1999-07-28 Philippe Verdy - - * ext/standard/soundex.c: Commited changes in php3 function/soundex 1.32 - -1999-07-27 Zeev Suraski - - * LICENSE: License update - - * ChangeLog: *** empty log message *** - -1999-07-27 Andrei Zmievski - - * ext/hyperwave/hw.h - ext/gettext/gettext.c - ext/gettext/php3_gettext.h - ext/hyperwave/hw.c - ext/fdf/fdf.c - ext/fdf/php3_fdf.h - ext/filepro/filepro.c - ext/filepro/php_filepro.h - ext/gd/gd.c - ext/gd/php3_gd.h: Symbol work. - -1999-07-27 Andi Gutmans - - * ChangeLog: - Update Changelog - - * ext/standard/basic_functions.c - ext/standard/datetime.c: - strttotime is compiled in on win32 again. - -1999-07-27 Andrei Zmievski - - * ext/dbase/dbase.c: Oops. - - * ext/dba/dba.c - ext/dbase/dbase.c - ext/dbase/php_dbase.h: More symbol work. - - * ext/standard/basic_functions.c - ChangeLog: check for nKeyLength not arKey - - * ChangeLog: *** empty log message *** - - * ext/standard/basic_functions.c: Fix for bug #1887. - - * ext/standard/basic_functions.c: Fix for bug #1891 - -1999-07-27 Stig Bakken - - * buildconf: forgot to mention the password - - * buildconf: spoonfeed - -1999-07-27 Danny Heijl - - * ext/informix/php_informix.h - ext/informix/ifx.ec: - >... If you can, please update your module to use these macros. - I could, so I did. - -1999-07-26 Zeev Suraski - - * ChangeLog: Fix bug #1867 - - * ChangeLog: Fix bug #1851 - -1999-07-26 Andrei Zmievski - - * ext/db/db.c - ext/db/php3_db.h - ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/browscap.c - ext/standard/crypt.c - ext/standard/dir.c - ext/standard/dl.c - ext/standard/dl.h - ext/standard/file.c - ext/standard/file.h - ext/standard/filestat.c - ext/standard/fsock.c - ext/standard/fsock.h - ext/standard/head.c - ext/standard/head.h - ext/standard/mail.c - ext/standard/pack.c - ext/standard/pack.h - ext/standard/php3_browscap.h - ext/standard/php3_crypt.h - ext/standard/php3_dir.h - ext/standard/php3_filestat.h - ext/standard/php3_mail.h - ext/standard/php3_syslog.h - ext/standard/reg.c - ext/standard/syslog.c - ext/aspell/aspell.c - ext/aspell/php3_aspell.h - ext/bcmath/bcmath.c - ext/bcmath/php3_bcmath.h - ext/com/COM.c - ext/com/php3_COM.h - ext/apache/apache.c - configuration-parser.y - php.h: More symbol work. - - I've defined a few macros to help with module/request init/startup function definitions. - Basically: - - PHP_MINIT_FUNCTION(module) - PHP_MSHUTDOWN_FUNCTION(module) - PHP_RINIT_FUNCTION(module) - PHP_RSHUTDOWN_FUNCTION(module) - PHP_MINFO_FUNCTION(module) - - These will expand to proper function prototypes. - - Now to specify these in the module entry, use: - - PHP_MINIT(module) - PHP_MSHUTDOWN(module) - PHP_RINIT(module) - PHP_RSHUTDOWN(module) - PHP_MINFO(module) - - I've updated all modules in ext/standard and everything from ext/apache to ext/db. - If you can, please update your module to use these macros. - -1999-07-26 Andi Gutmans - - * ext/standard/basic_functions.c - ext/standard/datetime.c - tests/testobj - ext/com/COM.c: - Fix the new operator incompatibility. - - I commented PHP_FUNCTION(strtotime) in datetime.c because it stopped - win32 from compiling. This needs to be fixed!!! - - Check out libzend to compile the tree now. - -1999-07-25 Stig Bakken - - * ext/gd/config.m4: "gd", not "-lgd" - - * ext/gd/config.m4: use AC_ADD_ macros - - * acconfig.h.in - configure.in.in: final php3.ini -> php.ini renaming? - -1999-07-24 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/browscap.c - ext/standard/crypt.c - ext/standard/dir.c - ext/standard/dl.c - ext/standard/file.c - ext/standard/filestat.c - ext/standard/fsock.c - ext/standard/head.c - ext/standard/head.h - ext/standard/link.c - ext/standard/mail.c - ext/standard/microtime.h - ext/standard/pack.c - ext/standard/php3_filestat.h - ext/standard/php3_string.h - ext/standard/reg.c - ext/standard/reg.h - ext/standard/soundex.c - ext/standard/string.c - ext/standard/syslog.c - main.c: - A bunch of grunt work updating function entries and declarations. - -1999-07-24 Sascha Schumann - - * ext/xml/config.m4: overlooked them - -1999-07-24 Andrei Zmievski - - * Makefile.in: Remove buildconf.stamp on make distclean - -1999-07-24 Zeev Suraski - - * main.c - ChangeLog: Congrats Andrei - -1999-07-24 Stig Bakken - - * acinclude.m4: more Solaris fun - - * php4.spec.in - scripts/mkextlib.in - .cvsignore - acinclude.m4 - configure.in.in: added workaround for Solaris PIC weirdness. - added RPM spec file for a future "official" RPM, work-in-progress - - * php4.gif: - temporary icon for RPMs until Colin gets back and can make us a spiffy new one - -1999-07-24 Zeev Suraski - - * ext/standard/fsock.c - ext/standard/parsedate.y - main.c - php4dll.dsp - php4dllts.dsp: * Make Win32 build work again - * Make error_reporting value prior to the standard initialization be - set so that errors show up - -1999-07-24 Stig Bakken - - * buildconf: Solaris 7 fix - -1999-07-24 Zeev Suraski - - * ChangeLog - mod_php4.c: *** empty log message *** - - * ext/standard/fsock.c - php4dllts.dsp - ChangeLog: * Fix a warning - * Update ChangeLog - -1999-07-24 Danny Heijl - - * ext/informix/ifx.ec: Get rid of most compiler warnings. - -1999-07-24 Rasmus Lerdorf - - * ChangeLog: Changelog - - * ext/standard/datetime.c: Fix broken build - - * ext/standard/rand.c: Bring rand.c up to date - -1999-07-24 Sascha Schumann - - * ext/xml/Makefile.am - ext/xml/config.m4: fix for missing include path in CFLAGS - - * buildconf: Bourne Shell does not have -nt. - -1999-07-23 Andrei Zmievski - - * ChangeLog - ext/standard/basic_functions.c: Added function entry for similar_text(). - - * ext/standard/basic_functions.c - ext/standard/php3_string.h: Added function entry for strip_tags. - - * .cvsignore: Ignore generated file. - - * ChangeLog: *** empty log message *** - - * ext/standard/.cvsignore: Ignore parsedate.c - - * ext/wddx/wddx.c: - Fixed a bug in WDDX that occured when a number was passed in instead - of a variable name. - -1999-07-23 Stig Bakken - - * config.guess - config.sub: generated and not required by windows - - * php_version.h: required for the Windows build, re-adding - -1999-07-23 Andrei Zmievski - - * ChangeLog: *** empty log message *** - - * ext/standard/datetime.c - ext/standard/datetime.h - ext/standard/parsedate.y - ext/standard/Makefile.am - ext/standard/basic_functions.c: Ported strtotime() function. - -1999-07-23 Sascha Schumann - - * .cvsignore - buildconf: Improve speed on subsequent runs of buildconf - -1999-07-23 Andrei Zmievski - - * buildconf: Fix for compatibility. - -1999-07-23 Zeev Suraski - - * ext/gd/gd.c: Fix bug #1807 (requires libzend update) - -1999-07-23 Sascha Schumann - - * ext/gd/config.h.stub - ext/gd/config.m4 - ext/gd/gdttf.c - ChangeLog: gdttf update - -1999-07-23 Stig Bakken - - * buildconf - ltconfig - ltmain.sh: - run libtoolize during buildconf since we depend on libtool anyway - - * php_version.h: generated file - - * configure.in.in: in case ltconfig isn't checked out executable - - * ChangeLog: good boy - - * ext/xml/config.m4: updated the docstring for --with-xml - -1999-07-23 Zeev Suraski - - * ext/gd/config.m4 - ext/gd/gd.c - ext/gd/gdcache.c - ext/gd/gdttf.c - ext/gd/php3_gd.h - ChangeLog: Added check for freetype.h - -1999-07-23 Stig Bakken - - * buildconf: small fix to libtool check - - * buildconf: require libtool to be installed as well - -1999-07-23 Andi Gutmans - - * config.w32.h: - Make Win32 compile again. - -1999-07-23 Andrei Zmievski - - * php_version.h - ChangeLog: Changeloggin' - -1999-07-23 Danny Heijl - - * ChangeLog: ChangeLog - - * ext/informix/ifx.ec - MODULES_STATUS: - New ini-stuff incorporated. Porting to PHP4 and ZTS hopefully complete. - -1999-07-23 Sascha Schumann - - * ChangeLog: ChangeLog - -1999-07-22 Zeev Suraski - - * ext/msql/msql.c - ext/mysql/mysql.c - ext/pgsql/pgsql.c - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ChangeLog - buildconf: - Please add in any changes/bug fixes you've made - we need to keep a details ChangeLog... - - * ChangeLog - ChangeLog.3: Time to remove the PHP 3.0 ChangeLog - -1999-07-22 Sascha Schumann - - * configure.in.in: add the HPUX ANSI detection from php3 - -1999-07-22 Stig Bakken - - * buildconf: - add checks for autoconf, automake and whether libzend/TSRM is around - -1999-07-22 Sascha Schumann - - * ext/session/session.c: - Implement additional heuristic for session id search. Now looks into - REQUEST_URI as well. - -1999-07-22 Stig Bakken - - * Makefile.in: temporary hack-fix - -1999-07-22 Andrei Zmievski - - * ext/standard/datetime.c - ext/standard/basic_functions.c - php_version.h: -Ported all remaining date() options - -Made array_walk() work somewhat, but it's not - possible to change array values from inside the - walk function yet - - * ext/pcre/php_pcre.c: *** empty log message *** - -1999-07-22 Danny Heijl - - * MODULES_STATUS - ext/informix/ifx.ec: Blobs now working too. - - * MODULES_STATUS - ext/informix/ifx.ec: - Blobs don't work, hash problems. - -1999-07-21 Stig Bakken - - * ext/Makefile.am - ext/xml/.cvsignore - ext/xml/Makefile.am - ext/xml/config.m4 - ext/xml/xml.c - Makefile.in - acinclude.m4 - config.guess - config.sub - configure.in.in - ltconfig - ltmain.sh - php_version.h: - First cut at standard way of making dynamically loadable extensions on UNIX. - Examples on how to test: - - ./configure --with-xml static - ./configure --with-xml=/opt static - ./configure --with-xml=shared shared - ./configure --with-xml=shared,/opt shared - - The difference between these two is that when the extension is shared, it - is not merged into libphpext.a. The shared extension is currently always - built. I can't find a way to do just one or the other with automake/libtool, - if someone has a clever idea, please come forward. :-) - - "make install" installs the .so (as well as a lot of other cruft) in - $prefix/lib/php. - -1999-07-21 Zeev Suraski - - * mod_php4.c: Fixed the Apache cookie problem (untested) - -1999-07-21 Andrei Zmievski - - * ext/fdf/fdf.c: Fix for bug #1806 - - * ext/session/session.c - objects: *** empty log message *** - -1999-07-21 Danny Heijl - - * MODULES_STATUS - ext/informix/ifx.ec: - Informix extension now works but php_ini stuff still needs rewriting. - -1999-07-21 Sascha Schumann - - * ext/standard/fsock.c: sync with 1.133 - - * MODULES_STATUS: - since we all seem to use different tabwidths, reformat this with :set tw=4 - - * MODULES_STATUS: update - - * ext/dba/dba.c: merge in change from php3 - - * ext/dba/php3_cdb.h - ext/dba/php3_db2.h - ext/dba/php3_dba.h - ext/dba/php3_dbm.h - ext/dba/php3_gdbm.h - ext/dba/php3_ndbm.h - ext/dba/setup.stub - MODULES_STATUS - ext/dba/.cvsignore - ext/dba/Makefile.am - ext/dba/config.h.stub - ext/dba/config.m4 - ext/dba/dba.c - ext/dba/dba_cdb.c - ext/dba/dba_db2.c - ext/dba/dba_dbm.c - ext/dba/dba_gdbm.c - ext/dba/dba_ndbm.c: initial import of DBA - - * ext/msql/config.m4: the ; is superflicious - -1999-07-21 Andrei Zmievski - - * main.c: *** empty log message *** - -1999-07-21 Stig Bakken - - * ext/xml/config.m4: that's better - - * ext/imap/config.m4 - ext/pgsql/config.m4 - ext/snmp/config.m4 - ext/xml/config.m4 - ext/xml/php3_xml.h - ext/xml/xml.c: Debian fixes - - * configure.in.in: change version number to 4.0b2-dev - - * ext/standard/base64.c: - fix to reiterate that one should _always_ use braces around if/else/for/while - -1999-07-21 Andrei Zmievski - - * MODULES_STATUS: It really does work. - -1999-07-21 Danny Heijl - - * MODULES_STATUS - ext/informix/ifx.ec - ext/informix/php_informix.h: - Started php4/ZTS port of Informix driver. - -1999-07-21 Sascha Schumann - - * ext/standard/string.c: use the same version as in php3 - - * ext/standard/base64.c: - use reverse lookup array, submitted by bfranklin@dct.com, #1755 - - * ext/sybase/sybase-ct.c: fix for #1748 - - * configure.in.in: disable broken sprintf test - - * configure.in.in: defaults to empty string - -1999-07-20 Andrei Zmievski - - * ext/pcre/php_pcre.c - ext/pcre/php_pcre.h: Added locale support. - -1999-07-20 Mike Gerdts - - * ext/standard/exec.c: - exec() can now properly handle lines longer than (EXEC_INPUT_BUF-2) bytes. - - Lines being returned via the array that that contain only "\n" now are - trimmed down to "" to be consistent with exec's whitespace trimming - behavior for all other lines. - -1999-07-20 Andrei Zmievski - - * ext/standard/datetime.c - ChangeLog.TODO: Added 'n' option to date(). - - * ext/standard/basic_functions.c - ext/standard/head.c - ext/standard/head.h: Added headers_sent() function - - * ext/standard/datetime.c: Fix for bug #1750. - -1999-07-20 Sascha Schumann - - * acinclude.m4 - configure.in.in - libphp4.module.in: get rid of --with-shared-apache - it's currently broken and redundant (use APXS instead) - -1999-07-20 jim - - * BUGS - CHANGES-3.0 - COPYING - EXTENSION_STATUS - TODO - WISHLIST - WISHLIST-3.1 - cvsusers - press-release-3.0.txt: Remove a bunch of old junk. - -1999-07-19 Egon Schmid - - * ext/pgsql/pgsql.c: The last forgotten prototypes I know. - -1999-07-19 Andrei Zmievski - - * ext/standard/info.c - MODULES_STATUS: Updated status - - * ext/wddx/.cvsignore: Don't forget .cvsignore - - * ext/wddx/config.h.stub - ext/wddx/config.m4 - ext/wddx/php_wddx.h - ext/wddx/setup.stub - ext/wddx/wddx.c - ext/wddx/Makefile.am: Ported WDDX module. - -1999-07-19 Egon Schmid - - * ext/mysql/mysql.c: It's in PHP 3 and 4. - - * ext/msql/msql.c: Test, will document this soon. - -1999-07-19 Andrei Zmievski - - * ext/bcmath/.cvsignore: Updating cvsignore - - * dlist.c - dlist.h - ext/hyperwave/DList.h - ext/hyperwave/dlist.c - ext/hyperwave/hg_comm.c - Makefile.in: Moving dlist stuff into core. - -1999-07-19 Zeev Suraski - - * INSTALL - ext/standard/info.c - LICENSE - makedist: *** empty log message *** - -1999-07-19 Andi Gutmans - - * config.w32.h - internal_functions_win32.c: Fix Win32 compilation - -1999-07-19 Andrei Zmievski - - * ext/standard/file.c: Kill compiler warnings. - -1999-07-19 Danny Heijl - - * ext/informix/ifx.ec: - license change - -1999-07-19 Sascha Schumann - - * ext/standard/info.c: update - -1999-07-19 Andrei Zmievski - - * ext/standard/info.c: More credits. - -1999-07-18 Sascha Schumann - - * fopen-wrappers.c: - allow access to std{in,out,err} by using the php domain - - * ext/session/session.c: more to do - - * ext/session/session.c - php.ini-dist: - add session config to php.ini and adapt the naming scheme for it - -1999-07-17 Andrei Zmievski - - * ext/standard/info.c: Update credits a bit. - "Overall Work" line should probably be extended. - - * ext/apache/apache.c - ext/pcre/php_pcre.c: -Kill compile warnings in apache.c - -Make preg_grep() work with copies of array entries - - * ext/standard/basic_functions.c: Proto change - -1999-07-17 Zeev Suraski - - * ext/standard/info.c: *** empty log message *** - - * cgi_main.c - ext/standard/basic_functions.c - ext/standard/info.c - ext/standard/info.h - main.c: I was sure I committed these already. Weird - - * php4dll.dsp - php4dllts.dsp: One more necessary .dsp update - - * ext/standard/info.c: *** empty log message *** - - * CREDITS - configure.in.in: * Turn on debug by default - * Remove CREDITS file, point to web page instead - - * php4isapi/php4isapi.dsp - MODULES_STATUS - php4.dsp - php4dll.dsp - php4dllts.dsp - php4ts.dsp: Update DSPs - -1999-07-17 Sascha Schumann - - * ext/pgsql/pgsql.c: void some warnings - - * makedist: use optional copy - - * buildconf: make copy optional - -1999-07-17 Zeev Suraski - - * buildconf - makedist: Oki doki - - * buildconf - makedist: Some work on makedist - - * README-BCMATH - configure.in.in: Handle BCMath - Add a license pointer - - * ext/bcmath/number.c - ext/bcmath/number.h: We'll have to live without these files somehow. - - * ext/bcmath/number.c - ext/bcmath/number.h: Dummies - - * ext/bcmath/config.m4 - ext/bcmath/number.c - ext/bcmath/number.h: We need to disable bcmath by default - - * acconfig.h.in - configure.in.in: Remove MEMORY_LIMIT from PHP, it's a Zend issue... - -1999-07-16 Zeev Suraski - - * ext/sybase/sybase.c - ext/sybase/sybase-ct.c: Get the Sybase modules uptodate - - * ext/ldap/ldap.c: *** empty log message *** - -1999-07-16 Andrei Zmievski - - * ext/standard/basic_functions.c: - A little change in how array_splice/array_slice handle length parameter. - - Makes it compatible with Perl. - - * ext/standard/basic_functions.c: - Updated the functionality of array_splice. - -1999-07-16 Sascha Schumann - - * configure.in.in: - the regex check relies on a previously set APXS variable, - so it needs to be after the apxs check - - * configure.in.in: merge fix - - * ext/pgsql/php3_pgsql.h: unnecessary, breaks the build - - * ext/msql/msql.c: This is so ugly, I hate myself for committing it - -1999-07-16 Zeev Suraski - - * ext/ldap/ldap.c: Get the LDAP module uptodate - -1999-07-16 Sascha Schumann - - * acinclude.m4: avoid nameclash - - * ext/msql/config.m4: fix detection - -1999-07-16 Zeev Suraski - - * ext/pgsql/pgsql.c: *** empty log message *** - - * ext/mysql/mysql.c - ext/pgsql/pgsql.c: Get postgresql module uptodate - - * ext/msql/msql.c: Oops #2 - - * ext/msql/msql.c: Oops - - * ext/standard/string.c - ext/msql/msql.c: * Get the mSQL module up to date - - * ext/msql/msql.c: Minor fix - - * ext/session/session.c: Fix TS version - - * ext/xml/xml.c - ext/yp/yp.c - ext/zlib/zlib.c - ext/standard/pack.c - ext/standard/pageinfo.c - ext/standard/post.c - ext/standard/quot_print.c - ext/standard/rand.c - ext/standard/reg.c - ext/standard/soundex.c - ext/standard/string.c - ext/standard/syslog.c - ext/standard/type.c - ext/standard/uniqid.c - ext/standard/url.c - ext/standard/var.c - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ext/sysvsem/sysvsem.c - ext/sysvshm/sysvshm.c - ext/standard/filestat.c - ext/standard/flock_compat.c - ext/standard/formatted_print.c - ext/standard/fsock.c - ext/standard/head.c - ext/standard/html.c - ext/standard/image.c - ext/standard/info.c - ext/standard/iptc.c - ext/standard/link.c - ext/standard/mail.c - ext/standard/md5.c - ext/standard/microtime.c - ext/session/mod_files.c - ext/session/session.c - ext/snmp/snmp.c - ext/standard/base64.c - ext/standard/basic_functions.c - ext/standard/browscap.c - ext/standard/crypt.c - ext/standard/cyr_convert.c - ext/standard/datetime.c - ext/standard/dir.c - ext/standard/dl.c - ext/standard/dns.c - ext/standard/exec.c - ext/standard/file.c - ext/pcre/php_pcre.c - ext/pdf/pdf.c - ext/pgsql/pgsql.c - ext/odbc/odbc.c - ext/odbc/velocis.c - ext/oracle/oracle.c - ext/mysql/mysql.c - ext/oci8/oci8.c - ext/msql/msql.c - ext/interbase/interbase.c - ext/ldap/ldap.c - ext/mcrypt/mcrypt.c - ext/mhash/mhash.c - ext/hyperwave/hw.c - ext/imap/imap.c - ext/hyperwave/hg_comm.c - ext/gd/gd.c - ext/gettext/gettext.c - ext/db/db.c - ext/dbase/dbase.c - ext/fdf/fdf.c - ext/filepro/filepro.c - ext/dav/dav.c - ext/bcmath/bcmath.c - ext/bcmath/number.c - ext/com/COM.c - ext/apache/apache.c - ext/aspell/aspell.c - mod_php4.h - output.c - output.h - php.h - php3_realpath.c - php3_realpath.h - php3_sprintf.c - php_globals.h - php_ini.c - php_ini.h - request_info.c - request_info.h - rfc1867.c - safe_mode.c - snprintf.h - SAPI.h - cgi_main.c - configuration-parser.y - configuration-scanner.l - fhttpd.c - fopen-wrappers.c - fopen-wrappers.h - internal_functions_registry.h - internal_functions_win32.c - main.c - main.h - mod_php4.c - SAPI.c: License update - -1999-07-15 Sascha Schumann - - * ext/session/session.c: define sid to "", if we are in cookie mode - - * ext/session/php_session.h - ext/session/session.c: we don't need php_sid - - * ext/session/mod_files.c: that should be included 1st - - * ext/session/session.c: define SID appropiately - -1999-07-15 Andi Gutmans - - * mod_php4.c: *** empty log message *** - -1999-07-15 Sascha Schumann - - * ext/session/php_session.h: that should be included 1st - -1999-07-15 Andi Gutmans - - * mod_php4.c: *** empty log message *** - - * CHANGES - CHANGES-3.0 - README.WIN32: More 3->4 changes - - * INSTALL - mod_php4.c - php4dllts.dsp: * PHP 3.0 -> 4.0 changes - * Add php_admin Apache directives - - * scripts/apache/apconf-conv.sh - scripts/apache/aphtaccess-conv.sh - scripts/apache/conffix.awk - scripts/apache/htaccessfix.awk: Sooner than you think, Sascha :) - - * php.ini-dist - php3.ini-dist: *** empty log message *** - -1999-07-15 Andrei Zmievski - - * ext/aspell/.cvsignore: Added .cvsignore - -1999-07-15 Rasmus Lerdorf - - * ext/imap/config.m4: A useless check - -1999-07-14 Zeev Suraski - - * ext/standard/info.c - serverapi/cgi_sapi.c: php3.ini -> php.ini - - * ext/standard/info.c - logos.h - main.c - php_version.h - configure.in.in: * Update logos - * Move from PreAlpha 1 to Beta 1. - -1999-07-14 Rasmus Lerdorf - - * ext/apache/apache.c: How did this ever work without this #define ? - - * ext/mysql/config.m4: Remove some useless stuff - - * ext/imap/config.m4: Fix imap build problem - - * LICENSE: Small grammar fix - -1999-07-14 Andi Gutmans - - * LICENSE - php4dllts.dsp: *** empty log message *** - - * ext/apache/apache.c - ext/standard/basic_functions.c - ext/standard/info.c - ext/standard/info.h - LICENSE - cgi_main.c - php_ini.c: - Add a bitwise flag to phpinfo() - - Import a draft of the new PHP license - -1999-07-14 Rasmus Lerdorf - - * ext/imap/config.m4: - Fix logic here - the error message was bogus when it couldn't find the - imap lib - - * configure.in.in: Woops, this was in the wrong place - -1999-07-14 Zeev Suraski - - * mod_php4.c: change php4_value and php4_flag to php_value and php_flag - -1999-07-13 Thies C. Arntzen - - * MODULES_STATUS: *** empty log message *** - -1999-07-12 Sascha Schumann - - * build-defs.h.in: add some which are always substituted - -1999-07-12 Rasmus Lerdorf - - * MODULES_STATUS: - Tested imap, and had a look at ldap. ldap should be working, but my - ldap server is currently in a box. - - * regex/regex.h - ext/aspell/aspell.c - ext/aspell/config.h.stub - ext/aspell/config.m4 - ext/aspell/php3_aspell.h - MODULES_STATUS: Finish porting aspell - tested and works ok now - -1999-07-12 Sascha Schumann - - * MODULES_STATUS: update - -1999-07-12 Andrei Zmievski - - * ext/pcre/config.m4 - MODULES_STATUS: *** empty log message *** - -1999-07-12 Andi Gutmans - - * MODULES_STATUS: *** empty log message *** - -1999-07-12 Sascha Schumann - - * ChangeLog.TODO: test commit (new format inspired by FreeBSD cvs-all) - -1999-07-12 Thies C. Arntzen - - * mod_php4.c: destructors should return 1, shouldn't they? - - * ext/oracle/oracle.c: par with 3.0 - - * ext/oci8/oci8.c: fixed mem-problem - - * ext/oci8/oci8.c: small php4 fixes - -1999-07-11 Sascha Schumann - - * acinclude.m4: typo - - * acinclude.m4 - configure.in.in - libphp4.module.in: merge in some autoconf stuff - -1999-07-09 Zeev Suraski - - * ext/standard/var.c - ext/xml/xml.c - php4isapi/php4isapi.c - ext/com/COM.c - ext/oci8/oci8.c - ext/oracle/oracle.c - ext/pcre/php_pcre.c - ext/standard/basic_functions.c - ext/standard/iptc.c - ext/standard/post.c - main.c - rfc1867.c: Don't touch refcount and EA directly - - * ext/xml/xml.c - php4isapi/php4isapi.c - ext/oracle/oracle.c - ext/pcre/php_pcre.c - ext/standard/basic_functions.c - ext/standard/fsock.c - ext/standard/iptc.c - ext/standard/post.c - ext/standard/var.c - ext/com/COM.c - ext/oci8/oci8.c - main.c - rfc1867.c: Step 2: - Rename is_ref to EA - - * ext/pcre/php_pcre.c - ext/standard/basic_functions.c - ext/standard/reg.c - configuration-parser.y: Step 1 in nuking the garbage collector: - - Change the hash destructor to return int - -1999-07-09 Rasmus Lerdorf - - * ext/aspell/Makefile.am - ext/aspell/aspell.c - ext/aspell/config.h.stub - ext/aspell/config.m4 - ext/aspell/php3_aspell.h: Add Aspell module - -1999-07-08 Andrei Zmievski - - * foo - foo2 - foo3 - foo4 - recurse - tests/foo - tests/foo2 - tests/foo3 - tests/foo4 - tests/recurse: More cleanup. - - * ext/pcre/php_pcre.c - test.php4 - test.pl - test_class_inheritance - testarray - testarray.pl - testarray2 - testarray2.pl - testclassfunc - testcom - testfe - testfunc - testfunc.pl - testfunc2 - testfunc2.pl - testfuncref - testinclude - testobj - tests/test.php4 - tests/test.pl - tests/test_class_inheritance - tests/testarray - tests/testarray.pl - tests/testarray2 - tests/testarray2.pl - tests/testclassfunc - tests/testcom - tests/testfe - tests/testfunc - tests/testfunc.pl - tests/testfunc2 - tests/testfunc2.pl - tests/testfuncref - tests/testinclude - tests/testobj: Reduce clutter a bit. - -1999-07-08 Zeev Suraski - - * php.h: *** empty log message *** - - * main.c: Avoid sending NULL argument to printf - -1999-07-08 Thies C. Arntzen - - * ext/oci8/oci8.c - ext/oci8/php3_oci8.h: on par with latest php3 - -1999-07-07 Andrei Zmievski - - * ext/session/session.c: - Fix a memory leak by not allowing session_start() to be called more than once. - -1999-07-06 Sascha Schumann - - * build-defs.h.in: add sendmail - -1999-07-06 Zeev Suraski - - * config.w32.h - ext/pcre/php_pcre.c - internal_functions_win32.c - php4dll.dsp - php4dllts.dsp: Support PCRE under Win32 - - * ext/pcre/pcre.c - ext/pcre/php_pcre.c - ext/pcre/Makefile.am: avoid two copies of pcre.c in the repository - -1999-07-05 Andrei Zmievski - - * ext/pcre/pcre.c - ext/pcre/php_pcre.h: Correct option caching - -1999-07-05 Thies C. Arntzen - - * ext/oci8/oci8.c: ups - - * ext/oci8/oci8.c: fixed mem-leak - - * ext/standard/basic_functions.c - ext/standard/iptc.c - ext/standard/php3_iptc.h: ported IPTC fro php3 - - * ext/oracle/oracle.c: added RESOURCE-returning - - * ext/oci8/oci8.c: up to php3 version - returns resources now! - -1999-07-04 Thies C. Arntzen - - * ext/xml/xml.c: updated to latest php3 - -1999-07-03 Zeev Suraski - - * ext/session/mod_files.c: *** empty log message *** - - * main.c: Support x-httpd-php-source - -1999-07-03 Sascha Schumann - - * Makefile.in: *** empty log message *** - - * Makefile.in: remove cvsignore files as well - - * Makefile.in: 'make dist' builds an easy distributable tarball - - * ext/session/mod_files.c: add missing include - - * ext/Makefile.am: ignore this - - * mod_php4.c: would be logical to enable display source mode - - * scripts/armerge: ar t is a little bit noisy on Rhapsody - - * build-defs.h.in: almost no config.m4 substitutes these anymore. - - * php.h: work around the Apache problem that it pollutes the namespace - - * ext/Makefile.am: there must be a better way - - * configure.in.in: let's start OS X hacking - -1999-07-02 Sascha Schumann - - * ChangeLog: .. - - * ChangeLog: ... - - * ChangeLog: . - - * ChangeLog: test commit - -1999-07-02 Thies C. Arntzen - - * ext/xml/xml.c: added some refcount stuff - - * ext/xml/php3_xml.h - ext/xml/xml.c: losses memory like hell, but seems to work! - - 3 things (this is a bad hack as of now!): - - xml.c uses _php3_strtoupper - is #include "../standard/php3_string.h" the right way to get the prototype? - - - i've copied php3i_long_pval/php3i_string_pval from the php3 tree into - xml.c (this is defnetly WRONG, but where do i find those?) - - - as php3tls_pval_destructor is not available in zend, i've - #define php3tls_pval_destructor(a) pval_destructor(a) which is maybe not what we want! - -1999-07-02 Sascha Schumann - - * ext/standard/crypt.c: fix from php3 - - * configure.in.in: suppress No such file or directory - -1999-07-01 Sascha Schumann - - * ext/sybase/config.m4: - someone please try whether the autoconf stuff works - for sybase and sybase-ct - I've neither one. - - * ext/sybase/sybase.c: maybe fix, following Joey's description - - * ext/zlib/config.m4: --with-zlib should work now - -1999-07-01 Thies C. Arntzen - - * ext/standard/var.c: changed boolean behaviour: - - var_dump( - -1999-07-01 Sascha Schumann - - * ext/standard/php3_var.h - ext/standard/var.c: some additional consts - - * regex/Makefile.in: vpath thingie - - * ext/session/php_session.h - ext/session/session.c: - implement a simple API in the case someone wants to define his/her own serialization stuff - -1999-06-29 Zeev Suraski - - * ext/session/session.c: - No need for a PSLS_FETCH() if PSLS_D/PSLS_DC are supplied as function arguments - -1999-06-29 Andrei Zmievski - - * ext/session/session.c: *** empty log message *** - - * ext/session/php_session.h - ext/session/session.c: Added session expiration. - -1999-06-29 Thies C. Arntzen - - * ext/oracle/oracle.c - ext/oracle/php3_oracle.h: synced with 3.0.11 - ora_bind works! - -1999-06-28 Zeev Suraski - - * request_info.c: No need for that either... - -1999-06-28 Rasmus Lerdorf - - * request_info.c: Don't break the tree - -1999-06-28 Andrei Zmievski - - * ext/session/php_session.h - ext/session/session.c: Added session_is_registered(varname) function. - - * ext/mysql/mysql.c: - Ported MYSQL_NUM, MYSQL_ASSOC, and MYSQL_BOTH additions from php3. - - * ext/standard/basic_functions.c: oops - - * ext/standard/basic_functions.c: *** empty log message *** - -1999-06-28 Sascha Schumann - - * acinclude.m4: work around that solaris bug - - * Makefile.in: ugly and working - - * Makefile.in: BSD derived tests want -h for symlink test - -1999-06-27 Sascha Schumann - - * ext/mcrypt/mcrypt.c: port - - * ext/snmp/config.h.stub - ext/snmp/config.m4 - ext/snmp/snmp.c - ext/standard/base64.c - ext/standard/datetime.c - ext/standard/file.c: more porting - - * Makefile.in - configure.in.in - mod_php4.exp: port Rasmus' APXS changes for AIX - - * ext/dbase/dbase.c: port over from php3 - - * Makefile.in - configure.in.in: lex optimizations - - * ext/dbase/dbase.c: add dbase_replace_record - - * Makefile.in - acinclude.m4 - configure.in.in: port over autoconf fixes from php3 - -1999-06-26 Zeev Suraski - - * cgi_main.c - ext/standard/pageinfo.c - request_info.c: Win32/general patches - - * cgi_main.c - ext/standard/pageinfo.c - fopen-wrappers.c - request_info.c - request_info.h - safe_mode.c: * Get rid of another request_info element (filename) - * CGI through Apache should work now - - * ext/standard/fsock.h: *** empty log message *** - - * main.c: Protect against NULL arguments in filename - -1999-06-26 Sascha Schumann - - * acconfig.h.in - configure.in.in - php.h: add dmalloc - -1999-06-25 Sascha Schumann - - * Makefile.in: - APXS link thingie - - functions/ game obsolete. Should make compiling faster on slow machines (hi Kristian :-) - -1999-06-23 Andrei Zmievski - - * regex/engine.ih - regex/regcomp.ih - regex/regerror.ih: *** empty log message *** - -1999-06-22 Thies C. Arntzen - - * ext/standard/basic_functions.c: gettype now reports "boolean" correct - -1999-06-22 Andrei Zmievski - - * ext/standard/php3_string.h: Making function accessible. - - * ext/standard/string.c: Making the function accessible. - -1999-06-22 Zeev Suraski - - * main.c: Fix compile-time definition of track_vars default - -1999-06-22 Andrei Zmievski - - * ext/pcre/pcre.c - ext/pcre/pcrelib/internal.h: Made preg_split() consistent with split(). - Added a new /e modifier for preg_replace - Kill a warning in pcrelib. - -1999-06-22 Thies C. Arntzen - - * ext/standard/url.c: - urlencode and decode return an empty-string if the input-string is empty (matches php3 behaviour "more" closly) - Please read my previous mail and comment! - -1999-06-22 Stig Bakken - - * fopen-wrappers.c: cosmetics - -1999-06-22 Danny Heijl - - * ext/informix/ifx.ec: - Bad html in ifx_htmltbl_result(). - -1999-06-22 Stig Bakken - - * fopen-wrappers.c: fix some potential buffer overflows - -1999-06-21 Andrei Zmievski - - * ext/standard/reg.c: Backing out changes. - -1999-06-21 Thies C. Arntzen - - * ext/standard/string.c: fixed implode "again" - - -1999-06-20 Sascha Schumann - - * acinclude.m4: whoops, kill debugging message - - * ext/snmp/config.m4 - ext/mysql/config.m4 - ext/pgsql/config.m4 - ext/msql/config.m4 - ext/mcrypt/config.m4 - ext/mhash/config.m4 - ext/ldap/config.m4 - acinclude.m4 - configure.in.in - Makefile.in: Introduce AC_ADD_* macros - - The use of AC_EXPAND_PATH makes it possible to continue - to use relative paths when configuring PHP. - (e.g. --with-apache=../apache-1.3.x works again) - - * Makefile.in: avoid error message - - * acinclude.m4: use standard autoconf variables - -1999-06-19 Zeev Suraski - - * main.c: *** empty log message *** - - * main.c - php_ini.c - php_ini.h: Implement new get_ini_entry() for Zend - - * win32/sendmail.c - cgi_main.c - config.w32.h - configuration-parser.y: Use php.ini instead of php3.ini - - * ext/standard/fsock.c: *** empty log message *** - - * ext/standard/fsock.c - fopen-wrappers.h - php_globals.h - fopen-wrappers.c: Win32/ZTS compiles again - -1999-06-18 Andrei Zmievski - - * ext/standard/fsock.h: for struct sockaddr - -1999-06-18 Stig Bakken - - * fopen-wrappers.c: update php3 sync info - - * fopen-wrappers.c: - optimize php3_fopen_url_wrapper() a bit (fewer recv() and send() calls) - - * ext/standard/fsock.h - ext/standard/fsock.c: Apply Sascha's fsock fixes to php4. - - * fopen-wrappers.c: make CGI version work again - -1999-06-17 Sascha Schumann - - * configure.in.in: typo - -1999-06-17 Andrei Zmievski - - * configure.in.in: Need to check if it exists first. - -1999-06-17 Zeev Suraski - - * config.w32.h: Win32 patches (does not compile still) - -1999-06-16 Stig Bakken - - * fopen-wrappers.c: MIME headers may be 512 characters long. - - * win32/time.c - ext/standard/file.h - ext/standard/filestat.c - ext/standard/flock_compat.c - ext/standard/flock_compat.h - ext/standard/fsock.c - ext/standard/fsock.h - ext/standard/microtime.c - ext/standard/php3_string.h - ext/standard/string.c - acconfig.h.in - config.w32.h - configure.in.in - ext/standard/basic_functions.c - ext/standard/dir.c - ext/standard/file.c - fopen-wrappers.c - fopen-wrappers.h - main.c: * fixed some #if/#ifdef issues - * hand-patched in php3 changes from 3.0.6 to HEAD in these files: - fopen-wrappers.[ch] ext/standard/file.[ch] ext/standard/fsock.[ch] - ext/standard/php3_string.h ext/standard/string.c - * added some new file/socket macros for more readable code: - FP_FGETS(buf,len,sock,fp,issock) - FP_FREAD(buf,len,sock,fp,issock) - FP_FEOF(sock,fp,issock) - FP_FGETC(sock,fp,issock) - -1999-06-15 Stig Bakken - - * ext/standard/file.c: reversing another patch that slipped - - * ext/standard/fsock.c - ext/standard/fsock.h - ext/standard/php3_string.h - ext/standard/string.c - ext/standard/file.c - ext/standard/file.h - fopen-wrappers.h - fopen-wrappers.c: * reverse fsock/string import patches - -1999-06-15 Zeev Suraski - - * php_globals.h: - Change four spaces back to tabs (Why the hell did you change the tabs to four spaces?!) - -1999-06-15 Stig Bakken - - * ext/standard/file.c - ext/standard/file.h - ext/standard/fsock.c - ext/standard/fsock.h - ext/standard/php3_string.h - ext/standard/string.c - ext/standard/var.c - cgi_main.c - fopen-wrappers.c - fopen-wrappers.h - php_globals.h: * now using php4.ini instead of php3.ini - * re-imported fopen-wrappers, fsock and string code from php3 - NB! I have not tested all of the imported functions yet. - - * ext/session/.cvsignore - .cvsignore: fix some .cvsignore files - -1999-06-15 Rasmus Lerdorf - - * ext/standard/datetime.c: gmmktime() fix - -1999-06-14 Andrei Zmievski - - * buildconf: Need to test for directory. - -1999-06-14 Stig Bakken - - * buildconf: make symlinks if they are not present already - -1999-06-12 Zeev Suraski - - * ext/standard/mime.h - ext/standard/php3_standard.h - SAPI.c - SAPI.h - ext/standard/Makefile.am - ext/standard/mime.c - php4dllts.dsp - rfc1867.c: - First attempt at moving the old RFC1867 support to the right place - -1999-06-11 Sascha Schumann - - * ext/standard/var.c: it's obj.properties, not ht - -1999-06-11 Andrei Zmievski - - * ext/standard/var.c: Fix up var.c a bit. - -1999-06-11 Rasmus Lerdorf - - * ext/standard/crypt.c: Same Fix here - -1999-06-11 Stig Bakken - - * configure.in.in: append DEBUG_CFLAGS to CFLAGS - -1999-06-11 Zeev Suraski - - * main.c: Print out include_path in include/require failures - - * ext/session/mod_files.c - ext/session/php_session.h - ext/session/session.c - ext/standard/basic_functions.c - ext/standard/file.c - main.c: * Fix a buglet in the session module - * Make some renames in the session module - avoid having a function called 'delete' - so that we don't piss any C++ compilers. Also rename the {startup,shutdown}_globals - to {startup,shutdown}_session_globals, so that they're a bit less general names, - and made them static. - * Remove uselss variables - -1999-06-10 Sascha Schumann - - * ext/standard/var.c: make serialize work - unserialize does not work yet - -1999-06-10 Andrei Zmievski - - * ext/standard/var.c: Fixing serialize a bit. - - * ext/standard/basic_functions.c - ext/pcre/pcre.c - ext/pcre/php_pcre.h: Added preg_grep() function. - -1999-06-10 Frank M. Kromann - - * win32/sendmail.c: - Sync. with php3. Only add Date: and From: if not supplied by user - -1999-06-09 Andrei Zmievski - - * ext/standard/basic_functions.c: Make array_shift/array_pop work better. - - * ext/pcre/pcre.c: A fix for a fix. - - * ext/pcre/pcre.c - ext/standard/basic_functions.c: Fixed a bug in preg_split. - Fixed a bug in array_shift/array_pop. - -1999-06-09 Thies C. Arntzen - - * ext/standard/string.c - ext/oci8/oci8.c: oci8 to 3.0.9 - implode works! - -1999-06-09 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: *** empty log message *** - - * ext/standard/reg.c - ext/pcre/pcre.c: Fixed a bug in preg_replace. - -1999-06-09 Thies C. Arntzen - - * ext/oci8/oci8.c - ext/oci8/php3_oci8.h: up to 3.0.9 - -1999-06-09 Danny Heijl - - * ext/informix/ifx.ec - ext/informix/php_informix.h: - - resync informix driver with php 3.09 version - -1999-06-07 Sascha Schumann - - * ext/session/session.c - ext/session/mod_files.c: - better scaling for large servers using many session ids - -1999-06-07 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: Don't set is_ref in _phpi_splice() - More checking in array_merge() - Added keys() and values() array functions. - -1999-06-07 Sascha Schumann - - * ext/session/mod_files.c - ext/session/mod_files.h - ext/session/php_session.h - ext/session/session.c: - some cleanups - - add gc logic - - add session_destroy() - -1999-06-07 Zeev Suraski - - * ext/standard/reg.c: Fix an ereg_replace() crash bug - -1999-06-06 Zeev Suraski - - * ext/session/mod_files.c - ext/session/session.c - php4dllts.dsp: - Fix PSLS issues - - Add a standard info function for the session module (use them!) - - Replace PATH_MAX with MAXPATHLEN (that's our platform indepedent constant) - -1999-06-06 Sascha Schumann - - * ext/session/session.c: one C too much - - * ext/session/session.c: - avoid unnecessary PSLS_FETCH() in internal functions - -1999-06-06 Andi Gutmans - - * ext/session/session.c: -Init tsrm on minit - - * ext/session/session.c: - Use PS() everywhere. - - * ext/session/session.c: - - Make sessions compile on win32 but it still doesn't link. - - * ext/session/session.c - php4dllts.dsp: - - Add some *_FETCH()'s. Still some work to be done so that it'll compile on win32. - -1999-06-06 Sascha Schumann - - * ext/session/php_session.h - ext/session/session.c: - s/encoded/encode/ - - new TODO entry - -1999-06-06 Andi Gutmans - - * ext/standard/basic_functions.c: - - Remove the is_ref =1 from the push() function. - -1999-06-06 Sascha Schumann - - * ext/session/session.c: add some protos - - * ext/session/session.c: add some thoughts - -1999-06-05 Sascha Schumann - - * ext/session/session.c: - auto startup when calling register - - auto startup using a configuration option - - * ext/session/session.c: moving start code into its own function - -1999-06-05 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: Added array_merge() function. - -1999-06-05 Sascha Schumann - - * ext/session/session.c: SAPI does not want line endings - -1999-06-05 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/reg.c: - Added push(), pop(), shift(), unshift(), splice(), and slice() array functions. - The first 5 work like their Perl counterparts. slice() returns a chunk of the array - specified by offset and length arguments. - - Backport to PHP3 and docs will be coming soon. - -1999-06-05 Sascha Schumann - - * ext/session/Makefile.am - ext/session/config.h.stub - ext/session/config.m4 - ext/session/mod_files.c - ext/session/mod_files.h - ext/session/modules.c - ext/session/php_session.h - ext/session/session.c - ext/session/setup.stub: first import of session module - -1999-06-05 Zeev Suraski - - * main.c: Move shutdown order into Zend - - * mod_php4.c: I got the order wrong earlier :I - - * ext/standard/reg.c: - Not sure that's the right fix, but at least it fixes the symptom - -1999-06-05 Sascha Schumann - - * ext/oci8/.cvsignore - ext/yp/.cvsignore - ext/pcre/pcrelib/.cvsignore: add some .cvsignores - -1999-06-04 Andrei Zmievski - - * ext/pcre/php_pcre.h - ext/pcre/pcre.c: Added preg_quote() function. - - * ext/pcre/pcre.c: *** empty log message *** - -1999-06-04 Zeev Suraski - - * ext/mysql/php3_mysql.h: Fix UNIX MySQL build - - * php3sapi.dsw - php3extra.dsw: Remove old workspaces - - * ext/mysql/Readme_w32.txt - ext/mysql/mysql.c - ext/mysql/mysql.dsp - ext/mysql/php3_mysql.h - config.w32.h - php.h - php4ext.dsw - php_globals.h - php_ini.c - php_ini.h: * Add a new workspace for dynamic PHP extensions. - * Add a few functions to PHP's API. - * Get the MySQL extension up-to-date and thread safe. - * Add a project for building the MySQL extension under Win32. - -1999-06-01 Andrei Zmievski - - * ext/standard/Makefile.am: function dir doesn't exist anymore - - * ext/pcre/config.m4: *** empty log message *** - -1999-06-01 Sascha Schumann - - * scripts/armerge: avoid touching libraries which have not changed - -1999-06-01 Andi Gutmans - - * ext/standard/exec.c: - Fix for exec to use API - -1999-05-31 Zeev Suraski - - * main.c - php4dll.dsp: thread-safety fix - -1999-05-31 Andi Gutmans - - * ext/standard/browscap.c: *** empty log message *** - -1999-05-31 Zeev Suraski - - * main.c: *** empty log message *** - -1999-05-30 Andrei Zmievski - - * ext/pcre/pcre.c: - preg_match_all() now returns the number of global matches. - -1999-05-30 Sascha Schumann - - * main.c - php_ini.c: kill some warnings - - * ext/standard/browscap.c: zend_hash_merge was changed - -1999-05-29 Andrei Zmievski - - * ext/pcre/pcre.c: Updated preg_split(). - - * ext/pcre/pcre.c: Fix preg_match_all to do proper matching with \b. - - * ext/pcre/pcrelib/internal.h - ext/pcre/pcrelib/pcre.c - ext/pcre/pcrelib/pcre.h - ext/pcre/pcre.c: - Fixed PCRE so that global matching with patterns with \b works. - -1999-05-29 Zeev Suraski - - * Makefile.in - libphp4.module.in - mod_php4.c: - * Changed the way INI entries work in Apache to allow .conf entries to work right too. - * vpath fixes for standard Apache build - - * ext/standard/browscap.c - testobj: Fix - -1999-05-29 Sascha Schumann - - * regex/Makefile.in: more VPATH work - - * SAPI.c: kill warning - - * Makefile.in - configure.in.in: - fix APXS VPATH build - - libzend/TSRM build in their own directories - - ext/Makefile was generated twice - - ****NOTE****** - - If you use any kind of VPATH, you need to do a "make distclean" in your - libzend/TSRM directory, before running configure again. - -1999-05-29 Zeev Suraski - - * mod_php4.c: - avoid crashing with php4 directives in .conf files (they still don't work) - - * scripts/preconfig - Makefile.in: fixes - -1999-05-29 Sascha Schumann - - * serverapi/cgi_sapi.c - cgi_main.c - getopt.c - getopt.h - main.c - php_getopt.h: getopt.h conflicted with system include file - - * ext/pgsql/pgsql.c: . - -1999-05-28 Zeev Suraski - - * mod_php4.c: no need for those - - * SAPI.c - configure.in.in - ext/pcre/config.m4 - mod_php4.c - rfc1867.c: * Get Apache module to compile again with the regex stuff. - * Get Apache to propertly work with POST, and some SAPI fixes - -1999-05-28 Sascha Schumann - - * ext/standard/var.c: that seems to fix it - - * ext/standard/var.c: - Either I'm playing the EG(symbol_table) game wrong or var.c leaks memory - when unserializing arrays/objects. Still testing - -1999-05-28 Andrei Zmievski - - * ext/pcre/pcrelib/pcre.c - ext/pcre/pcrelib/pcre.h - ext/pcre/config.h.stub - ext/pcre/config.m4 - ext/pcre/pcre.c - ext/pcre/php_pcre.h: - -Modified PCRE library slightly to do what needs to be done - -Updated preg_replace() code to handle stuff properly - -Removed ability to specify external PCRE library source to link against - (since our bundled version is patched now) - -1999-05-28 Sascha Schumann - - * apidoc.txt: I think that is the preferred way as of now - -1999-05-28 Zeev Suraski - - * ext/mysql/mysql.c: *** empty log message *** - - * ext/com/COM.c - ext/standard/basic_functions.c - ext/standard/dir.c - main.c - testobj: * Use new Zend macros for standardized definition of classes. - * Reverse bogus shutdown order. - * Use the new object/class support of Zend to make the dir functions work again. - -1999-05-28 Rasmus Lerdorf - - * Makefile.in - main.c - main.h - mod_php4.c - mod_php4.h: Some innocent cleanups - -1999-05-27 Andrei Zmievski - - * ext/pcre/config.m4: We don't need those there. - - * ext/pcre/config.h.stub - ext/pcre/config.m4 - ext/pcre/pcre.c - ext/pcre/php_pcre.h: - Really fix the configuration now so that it's possible to compile both - against the bundled PCRE library and the one external to the source tree. - Crossing my fingers while Zeev compiles this. :) - -1999-05-27 Stig Bakken - - * configure.in.in - scripts/preconfig: self-contained extensions please :-) - -1999-05-27 Zeev Suraski - - * main.c: - Generate Visual Studio compatible error messages when compiling under Win32 - -1999-05-27 Sascha Schumann - - * ext/pcre/pcrelib/Makefile - ext/pcre/pcrelib/Makefile.am - ext/xml/xml.c - configure.in.in - ext/pcre/Makefile.am - ext/pcre/config.m4: - fix CGI build (at least) - - * Makefile.in: add rfc1867.c - -1999-05-27 Zeev Suraski - - * ext/pcre/php_pcre.h: Fix pcre build - - * php.h: Moved all SET_ and RETURN_ macros to Zend - Fixed all RETVAL_ macros - -1999-05-26 Andrei Zmievski - - * ext/pcre/pcrelib/ChangeLog - ext/pcre/pcrelib/LICENCE - ext/pcre/pcrelib/Makefile - ext/pcre/pcrelib/README - ext/pcre/pcrelib/RunTest - ext/pcre/pcrelib/Tech.Notes - ext/pcre/pcrelib/chartables.c - ext/pcre/pcrelib/dftables.c - ext/pcre/pcrelib/get.c - ext/pcre/pcrelib/internal.h - ext/pcre/pcrelib/maketables.c - ext/pcre/pcrelib/pcre.3 - ext/pcre/pcrelib/pcre.c - ext/pcre/pcrelib/pcre.h - ext/pcre/pcrelib/pcreposix.3 - ext/pcre/pcrelib/pcreposix.c - ext/pcre/pcrelib/pcreposix.h - ext/pcre/pcrelib/pcretest.c - ext/pcre/pcrelib/perltest - ext/pcre/pcrelib/pgrep.1 - ext/pcre/pcrelib/pgrep.c - ext/pcre/pcrelib/study.c - ext/pcre/pcrelib/testinput1 - ext/pcre/pcrelib/testinput2 - ext/pcre/pcrelib/testinput3 - ext/pcre/pcrelib/testinput4 - ext/pcre/pcrelib/testoutput1 - ext/pcre/pcrelib/testoutput2 - ext/pcre/pcrelib/testoutput3 - ext/pcre/pcrelib/testoutput4 - ext/pcre/Makefile.am - ext/pcre/config.m4 - ext/pcre/setup.stub: -Added PCRE library source - -Updated configuration process - - * ext/pcre/pcre.c - ext/pcre/php_pcre.h: Added preg_split. Same syntax as regular split(). - - * ext/standard/reg.c: Fixing a couple of long standing bugs. - - * ext/pcre/pcre.c - ext/pcre/php_pcre.h: A few changes here. - - First of all, as per extensive discussion on the list, the functions are now - prefixed with "preg" instead of "pcre". - - Secondly, global matching is now possible using preg_match_all. Please, give - suggestions on a better name if this one doesn't sit well with you. Possible - names are preg_global_match and preg_gmatch. - - preg_match_all takes 4 arguments: a regex pattern, a subject string, - the array for capturing subpatterns, and a parameter that tells how the results - in the subpatterns array are arranged. - - Basically, preg_match_all will go through the subject string and try to capture - all the matches that it finds, not just the first one like preg_match. - - 4th parameter can be PREG_PATTERN_ORDER (default) or PREG_SET_ORDER. - - Example: - preg_match_all("|]+)>|", "
a test
", $out, PREG_PATTERN_ORDER); - - This returns results so that $out[0] is an array of full pattern matches, $out[1] is an array - of first captured subpattern matches, and so on. - - $out[0] -> ("
", "
") - $out[1] -> ("div align=left", "div") - - Example: - preg_match_all("|]+)>|", "
a test
", $out, PREG_SET_ORDER); - - This returns results so that $out[0] is an array of first full pattern match and subpatterns, - $out[1] is an array of second full pattern match and subpatterns. - - $out[0] -> ("
", "div align=left") - $out[1] -> ("
", "div") - - If anyone has a better name for these PREG_ constants and also which one should be the default, - I'd like to hear it. - -1999-05-25 Zeev Suraski - - * SAPI.c - SAPI.h - php4dllts.dsp - rfc1867.c - rfc1867.h: - Add container for file-upload. It's not quite implemented yet. - -1999-05-25 Andrei Zmievski - - * ext/standard/basic_functions.c: Just a little sanity check. - -1999-05-25 Zeev Suraski - - * SAPI.c - SAPI.h: Allow unregistering content types as well. - - * SAPI.h - php4isapi/php4isapi.c - SAPI.c: - * Add generic POST content-type support. Only application/x-www-form-urlencoded - supported at this time, but the framework allows for any other types, including - runtime addition of types. - - * php4isapi/php4isapi.c: Load all ISAPI request headers as variables - -1999-05-24 Zeev Suraski - - * internal_functions_win32.c: include regex in Win32 build - -1999-05-23 Zeev Suraski - - * ext/standard/dns.c: Thou shalt use the API, and thou shalt be safe - -1999-05-22 Andrei Zmievski - - * ext/pcre/pcre.c: Some comments. - -1999-05-22 Sascha Schumann - - * configure.in.in: - add -lregex - - change module name to php4 - -1999-05-22 Andrei Zmievski - - * ext/pcre/pcre.c: Added ability to pass array parameters to pcre_replace. - -1999-05-22 Sascha Schumann - - * Makefile.in: add a $(srcdir) - - * ext/xml/php3_xml.h - ext/xml/xml.c - ext/ldap/php3_ldap.h: fix compile issues in LDAP/XML exts - - * Makefile.in: fix APXS compile - -1999-05-22 Zeev Suraski - - * php_ini.c - main.c: More fixes. Should hopefully work well now. - - * php_ini.c: php_ini fixes - - * cgi_main.c - main.c: * Minor fixes - * Better handling for multiple repeated memory leaks (libzend updated) - - * ext/apache/apache.c - apMakefile.tmpl - apidoc-zend.txt - apidoc.txt - configure.in.in - libphp3.module.in - libphp4.module.in - main.c - mod_php3.c - mod_php3.h - mod_php4.c - mod_php4.h - .cvsignore - ChangeLog - INSTALL - Makefile.in: Time to rename the child - - * main.c: Small fix - -1999-05-21 Zeev Suraski - - * php_ini.c: Fix a memory leak - - * SAPI.c - cgi_main.c - php4isapi/php4isapi.c: This should be centralized... - -1999-05-21 Sascha Schumann - - * ext/mhash/mhash.c - ext/mhash/php_mhash.h - ext/mhash/config.m4: add support for mhash 0.5.0 - - see http://sasweb.de/mhash/ - -1999-05-21 Andrei Zmievski - - * ext/pcre/pcre.c - ext/pcre/php_pcre.h: -Added regex cache - -Made module thread-safe - -1999-05-21 Zeev Suraski - - * cgi_main.c - main.c: * Fix error handling startup on the thread-safe CGI version - * A failed require() is a compile-time error, consider it as one - -1999-05-21 Andrei Zmievski - - * ext/pcre/pcre.c: Get rid of debug printf's. - - * ext/pcre/.cvsignore - ext/pcre/Makefile.am - ext/pcre/config.h.stub - ext/pcre/config.m4 - ext/pcre/pcre.c - ext/pcre/php_pcre.h - ext/pcre/setup.stub: - Initial check-in of PCRE (Perl Compatible Regular Expressions) extension. - - PCRE library can be found at ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/ - - config.m4 will be updated to be more robust later on. - - perl_match() takes a regular expression, the source string, and the array - for subpattern matches. - - perl_replace() takes a regular expression, the search string, and the replacement - string. - - Regular expression is specified using delimiters and options. Example: - - perl_match("/<[a-z]*>/i", $text, $tags); - - More stuff is coming soon. - -1999-05-21 Sascha Schumann - - * ext/zlib/php3_zlib.h - ext/zlib/zlib.c - ext/sysvshm/sysvshm.c - ext/xml/php3_xml.h - ext/xml/xml.c - ext/sysvsem/sysvsem.c - ext/sysvshm/php3_sysvshm.h - ext/sysvsem/php3_sysvsem.h - ext/sybase/php3_sybase-ct.h - ext/sybase/php3_sybase.h - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ext/snmp/php3_snmp.h - ext/snmp/snmp.c - ext/pgsql/pgsql.c - ext/pgsql/php3_pgsql.h - ext/pdf/php3_pdf.h - ext/oracle/php3_oracle.h - ext/pdf/pdf.c - ext/odbc/php3_odbc.h - ext/odbc/php3_velocis.h - ext/odbc/velocis.c - ext/oracle/oracle.c - ext/odbc/odbc.c - ext/mysql/php3_mysql.h - ext/oci8/oci8.c - ext/mysql/mysql.c - ext/msql/php3_msql.h - ext/msql/msql.c - ext/ldap/php3_ldap.h - ext/ldap/ldap.c - ext/interbase/php3_interbase.h - ext/interbase/interbase.c - ext/informix/php_informix.h - ext/informix/readme.ifx - ext/informix/ifx.ec - ext/informix/php3_ifx.h - ext/imap/imap.h - ext/hyperwave/hw.h - ext/imap/imap.c - ext/gettext/php3_gettext.h - ext/hyperwave/hg_comm.h - ext/hyperwave/hw.c - ext/gd/php3_gd.h - ext/gettext/gettext.c - ext/filepro/filepro.h - ext/filepro/php_filepro.h - ext/gd/gd.c - ext/filepro/filepro.c - ext/fdf/php3_fdf.h - ext/dbase/dbase.c - ext/dbase/dbf_head.h - ext/dbase/dbf_misc.h - ext/dbase/dbf_rec.h - ext/dbase/php_dbase.h - ext/fdf/fdf.c - ext/db/db.c - ext/db/php3_db.h - ext/dav/php3_dav.h - ext/com/php3_COM.h - ext/bcmath/bcmath.c - ext/bcmath/number.h - ext/bcmath/php3_bcmath.h - ext/com/COM.c - ext/apache/apache.c - ChangeLog.TODO - genif.sh: - run ext sources through conv_proto - - add necessary phpext_*_ptr - - * ext/standard/microtime.c - ChangeLog.TODO: merge in some PHP3 stuff - - * ext/yp/Makefile.am - ext/yp/config.h.stub - ext/yp/config.m4 - ext/yp/php3_yp.h - ext/yp/setup.stub - ext/yp/yp.c: incorporate YP/NIS support - - * ext/zlib/php3_zlib.h - ext/mcrypt/mcrypt.c - ext/mhash/mhash.c - ext/sysvsem/php3_sysvsem.h - ext/sysvsem/sysvsem.c - ext/sysvshm/php3_sysvshm.h - ext/sysvshm/sysvshm.c - ext/dbase/dbase.c - ext/dbase/dbase.h - ext/dbase/php_dbase.h - ext/gettext/gettext.c - ext/gettext/php3_gettext.h - ext/mcrypt/config.m4: - - fix compile issues for various packages (dbase, sysv*, zlib) - - some cleanup in mhash/mcrypt - - * ext/pgsql/php3_pgsql.h - ext/sysvsem/sysvsem.c: - add phpext_pgsql_ptr - - semaphore update for glibc-2.1 systems - - * ext/mysql/config.m4: Add default path for binary mysql distributions - - * ext/standard/reg.c: remove debug messages - -1999-05-20 Zeev Suraski - - * main.c: Use OutputDebugString() or fprintf(stderr,) for memory leaks - -1999-05-20 Sascha Schumann - - * ext/standard/file.c - ext/standard/fsock.c - ext/standard/fsock.h: Apply the fix for feof() - -1999-05-20 Andi Gutmans - - * ext/standard/info.c - php4isapi/php4isapi.dsp - config.w32.h - configuration-parser.y - php4.dsp - php4dll.dsp - php4dllts.dsp - php4ts.dsp: - Small fixes - -1999-05-16 Sascha Schumann - - * ext/mhash/.cvsignore - ext/mhash/Makefile.am - ext/mhash/config.h.stub - ext/mhash/config.m4 - ext/mhash/mhash.c - ext/mhash/php_mhash.h - ext/mhash/setup.stub: add mhash support - - * ext/standard/global.h - configure.in.in: kill another 64-bit issue. - this affected at least md5 which produced wrong values on 64-bit platforms - - * ext/standard/string.c: char * => unsigned char * - - * ext/standard/filestat.c - ext/standard/fsock.h - ext/standard/head.c - ext/standard/head.h - ext/standard/html.c - ext/standard/html.h - ext/standard/image.c - ext/standard/image.h - ext/standard/info.c - ext/standard/info.h - ext/standard/iptc.c - ext/standard/link.c - ext/standard/mail.c - ext/standard/math.c - ext/standard/md5.c - ext/standard/md5.h - ext/standard/microtime.c - ext/standard/microtime.h - ext/standard/mime.h - ext/standard/pack.h - ext/standard/pageinfo.c - ext/standard/pageinfo.h - ext/standard/php3_browscap.h - ext/standard/php3_crypt.h - ext/standard/php3_dir.h - ext/standard/php3_filestat.h - ext/standard/php3_iptc.h - ext/standard/php3_link.h - ext/standard/php3_mail.h - ext/standard/php3_string.h - ext/standard/php3_syslog.h - ext/standard/phpdir.h - ext/standard/phpmath.h - ext/standard/quot_print.c - ext/standard/quot_print.h - ext/standard/rand.c - ext/standard/reg.c - ext/standard/string.c - ext/standard/syslog.c - ext/standard/uniqid.c - ext/standard/uniqid.h - ext/standard/url.c - ext/standard/url.h - ext/standard/base64.c - ext/standard/base64.h - ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/browscap.c - ext/standard/crypt.c - ext/standard/cyr_convert.c - ext/standard/cyr_convert.h - ext/standard/datetime.c - ext/standard/datetime.h - ext/standard/dir.c - ext/standard/dl.h - ext/standard/dns.c - ext/standard/dns.h - ext/standard/exec.c - ext/standard/exec.h - ext/standard/file.c - ext/standard/file.h: conv_proto *.[ch] - - * scripts/conv_proto: - this script automatically converts the ugly void php3_... prototypes - to PHP_FUNCTION(...) prototypes. Also kills some unnecessary extern - declarations in front of function prototypes. - - * ext/standard/php3_string.h - ext/standard/string.c: add fast bin2hex string function - - * ext/standard/file.c: kill some compiler warnings - -1999-05-15 Zeev Suraski - - * internal_functions_win32.c: *** empty log message *** - -1999-05-14 Zeev Suraski - - * ext/standard/basic_functions.c - ext/standard/dl.h - ext/standard/file.h - ext/standard/fsock.h - ext/standard/head.h - ext/standard/pack.h - ext/standard/php3_browscap.h - ext/standard/php3_crypt.h - ext/standard/php3_dir.h - ext/standard/php3_filestat.h - ext/standard/php3_mail.h - ext/standard/php3_syslog.h - ext/mysql/mysql.c - internal_functions.c.in: - * Include all of the standard modules in internal_functions.c.in. Stig - is that - the way you intended it to be? How does the basic_functions module get in there? - * Fix to get MySQL objects working, even though I'll probably make a dedicated - MySQL object in the future. - -1999-05-13 Zeev Suraski - - * ext/standard/reg.c - ext/standard/reg.h - main.c: * HTTP-auth bugfix - * Patch the regex thread safe code to compile in thread safe mode - -1999-05-12 Zeev Suraski - - * ext/standard/post.c - mod_php3.c: Enable Apache HTTP Auth - - * main.c - php4isapi/php4isapi.c - SAPI.c: - Support HTTP Auth under ISAPI. Now, these short pieces of code took *A LOT* of - research :( - -1999-05-12 Andrei Zmievski - - * ext/standard/basic_functions.c: It's been there long enough. - -1999-05-12 Zeev Suraski - - * php4isapi/php4isapi.c: Minor patches - -1999-05-12 Thies C. Arntzen - - * ext/oci8/php3_oci8.h: compiles - - * php3_compat.h: added _php3_hash_next_index_pointer_insert - -1999-05-12 Sascha Schumann - - * ext/standard/reg.c - ext/standard/reg.h - ext/standard/string.c - internal_functions.c.in: - regex cache (needs some work) - - str_replace changes from php3 - -1999-05-12 Thies C. Arntzen - - * ext/oci8/oci8.c - ext/oci8/php3_oci8.h: up-to-date with 3.0.8 - - * ext/oci8/Makefile.am - ext/oci8/config.h.stub - ext/oci8/config.m4 - ext/oci8/oci8.c - ext/oci8/php3_oci8.h - ext/oci8/setup.stub - ext/oracle/Makefile.am - ext/oracle/config.h.stub - ext/oracle/oci8.c - ext/oracle/php3_oci8.h: - move oci8 from oracle to it's own ext-directory - configure stuff needs more work - but it configures and compiles - - * ext/oracle/oracle.c - ext/oracle/oracle.h - ext/oracle/php3_oracle.h: builds and configures again - -1999-05-12 Rasmus Lerdorf - - * ext/standard/string.c: substr() fix - - * ext/standard/string.c: substr() fix for PHP4 as well - -1999-05-11 Zeev Suraski - - * php4isapi/php4isapi.c - php4isapi/php4isapi.def - ext/standard/head.c - ext/standard/head.h - SAPI.h - cgi_main.c - php4dllts.dsp - SAPI.c: * Finally commit that -q patch - * Refine SAPI built in header support - * Use DllMain() in ISAPI to clean after threads and initialize tsrm/sapi as soon as possible. - -1999-05-11 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: Added compact() function. - -1999-05-11 Zeev Suraski - - * SAPI.c - mod_php3.c: Handle the Location: header centrally for all SAPI modules. - - * ext/standard/post.c - ext/standard/string.c - main.c - php_globals.h - php_ini.c: * Move unclean_shutdown from PHP to Zend. - * The Master/Local headers in the phpinfo() table were reversed. - * Fix a gpc bug - - * mod_php3.c: Support POST in Apache - - * serverapi/isapi_sapi.c - ext/apache/apache.c - ext/standard/info.c - ext/standard/info.h - main.c - php_ini.c: beatify Apache's info func - - * mod_php3.c: Memory leak fix - - * ext/sysvshm/sysvshm.c - ext/sysvsem/sysvsem.c - ext/standard/browscap.c - ext/standard/post.c - ext/standard/reg.c - ext/standard/url.c - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ext/pgsql/pgsql.c - ext/hyperwave/hw.c - ext/interbase/interbase.c - ext/odbc/odbc.c - ext/gd/gdcache.c - ext/gd/gdttf.c - ext/hyperwave/dlist.c - ext/hyperwave/hg_comm.c - Makefile.in - alloca.c - configure.in.in - genif.sh - libphp3.module.in - main.c - mod_php3.c - php.h - php3_sprintf.c - php_regex.h - request_info.c - snprintf.c: * Get Apache to work. POST doesn't work yet. - * There are now -I directives for the absolute path of php4, php4/libzend and the builddir for - the Apache module, so we can #include any php/Zend header. - * Rename config.h to php_config.h - -1999-05-10 Andrei Zmievski - - * ext/standard/basic_functions.c: Minor updates. - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: Added in_array() function. - - * cgi_main.c - main.c: A couple of fixes. - -1999-05-10 Zeev Suraski - - * SAPI.c - cgi_main.c - main.c - php_globals.h: Weed out all BoundsChecker-found bugs - -1999-05-09 Zeev Suraski - - * php4isapi/php4isapi.c - SAPI.c: Only read POST info if the request method is POST. - -1999-05-09 Andi Gutmans - - * php4isapi/php4isapi.c - SAPI.c - SAPI.h - cgi_main.c - ext/standard/basic_functions.c - ext/standard/post.c: - * Make read_post() read input by chunks instead of returning a single string. - This will allow us to efficiently support file upload through SAPI in the future. - * Fixes - -1999-05-09 Zeev Suraski - - * ext/apache/apache.c - ext/gd/gd.c - ext/gd/php3_gd.h - ext/standard/post.c - php_ini.h - request_info.c: A few other minor fixes - - * ext/standard/basic_functions.c - main.c - php4isapi/php4isapi.c: Several minor fixes - - * php4isapi/php4isapi.c - ext/zlib/php3_zlib.h - ext/zlib/zlib.c - ext/xml/xml.c - ext/sybase/php3_sybase-ct.h - ext/sybase/php3_sybase.h - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ext/snmp/snmp.c - ext/standard/dl.c - ext/standard/dl.h - ext/standard/head.c - ext/standard/info.c - ext/standard/info.h - ext/standard/mail.c - ext/standard/php3_mail.h - ext/standard/post.c - ext/oracle/oracle.c - ext/oracle/oracle.h - ext/pdf/pdf.c - ext/pdf/php3_pdf.h - ext/snmp/php3_snmp.h - ext/odbc/odbc.c - ext/odbc/php3_odbc.h - ext/odbc/php3_velocis.h - ext/odbc/velocis.c - ext/oracle/oci8.c - ext/msql/php3_msql.h - ext/mysql/mysql.c - ext/mysql/php3_mysql.h - ext/ldap/ldap.c - ext/ldap/php3_ldap.h - ext/msql/msql.c - ext/interbase/php3_interbase.h - ext/informix/php3_ifx.h - ext/interbase/interbase.c - ext/gettext/gettext.c - ext/gettext/php3_gettext.h - ext/hyperwave/hw.c - ext/hyperwave/hw.h - ext/fdf/fdf.c - ext/fdf/php3_fdf.h - ext/gd/gd.c - ext/dav/dav.c - ext/db/db.c - ext/db/php3_db.h - ext/apache/apache.c - ext/com/COM.c - SAPI.c - SAPI.h - cgi_main.c - dl/mssql/mssql.c - main.c - mod_php3.c - php_ini.c - php_ini.h - request_info.c - request_info.h: - * Finalizing the PHP version of SAPI. Support POST and cookies among other things. - * Fully implement ISAPI support - POST and cookies among other things. - * Almost completely rewrote phpinfo(). Allow modules to easily display their - information in phpinfo() without modifying phpinfo() itself (prototype for - the module info function was changed, thus the large amount of updated module - files). - * Initial extended SAPI support for Apache, completely untested. - * CGI now uses SAPI fully as well. - -1999-05-08 Sascha Schumann - - * genif.sh: get rid of the binary character, execute sed only once - - * genif.sh: this is faster than parsing the file line by line - -1999-05-08 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: -Added extract() function - -Added function_exists() function - - * ext/mysql/php3_mysql.h - configure.in.in - genif.sh: -fixed configure.in.in to use genif.sh instead of genif.pl - -fixed genif.sh - -updated php3_mysql.h to have phpext_mysql_ptr - -1999-05-06 Zeev Suraski - - * SAPI.c: Oh yeah, wrong license - - * SAPI.c - SAPI.h - cgi_main.c - main.c - php4isapi/php4isapi.c: * Get output buffering to work again - * Warn about adding header information after headers are sent - * Several fixes - -1999-05-06 Sascha Schumann - - * ext/mcrypt/php_mcrypt.h: add compat #define - - * genif.sh: - Do we really want to depend on Perl? Shell scripts are handy and run on - virtually every Unix box whereas Perl does not. I don't think Perl should - be required when actually configuring PHP4. Open to comments... - -1999-05-06 Zeev Suraski - - * ext/standard/info.c - ext/standard/post.c: - * Optimize _php3_parse_gpc_data() and clean it up, plus fix a couple of Zend related memory leaks in it - -1999-05-05 Zeev Suraski - - * SAPI.c - SAPI.h - Makefile.in: vpath fix - Apache compatability fix - - * php4isapi/php4isapi.c - ext/standard/basic_functions.c - ext/standard/head.c - main.c - SAPI.c: Fixes - - * SAPI.h: fix - - * php4isapi/php4isapi.c - ext/standard/head.c - SAPI.c - SAPI.h - cgi_main.c - main.c - main.h - output.c - output.h: Get CGI to work with the new headers code. - Now Apache is the only interface that doesn't use it. - - * php4isapi/php4isapi.c - SAPI.c - SAPI.h - main.c - output.c: ISAPI WORKS! - -1999-05-05 Andi Gutmans - - * php4isapi/php4isapi.c - SAPI.c - SAPI.h - ext/standard/head.c - ext/standard/head.h - logos.h - main.c - output.c: Added initial headers support in SAPI - *untested* - It definitely broke the thread-safe CGI, it may have broken other stuff as well. - -1999-05-04 Zeev Suraski - - * internal_functions_win32.c - php4dll.dsp - php4dllts.dsp: Get Win32 to compile again - - * internal_functions_win32.c: - An initial default builtin modules file for Win32 - - * acconfig.h.in - configure.in.in: ZTS fixes - Stig - --enable-thread-safety belongs in libzend, since libzend doesn't #include config.h, whereas - PHP does #include zend_config.h - -1999-05-03 Zeev Suraski - - * configure.in.in - genif.pl: vpath patches (cool job Stig!) - -1999-05-03 Stig Bakken - - * scripts/armerge - ext/gd/php3_gd.h - ext/standard/php3_standard.h - ext/db/db.h - ext/db/php3_db.h - .cvsignore - Makefile.in - acconfig.h.in - acinclude.m4 - buildconf - configure.in.in - ext/bcmath/php3_bcmath.h - ext/db/db.c - foo - genif.pl - internal_functions.c - internal_functions.c.in - internal_functions_registry.h: * added --enable-thread-safety switch - * now generating internal_functions.c - -1999-05-02 Zeev Suraski - - * request_info.c: Get apache uptodate - - * php4isapi/php4isapi.c: Minor rearrangements - - * ext/hyperwave/hw.c - ext/standard/info.c - php4isapi/php4isapi.c - cgi_main.c - fopen-wrappers.c - main.c - request_info.c: Move path_info to the SAPI structure - - * SAPI.h - request_info.c - request_info.h: Get rid of request_info.path_translated - - * mod_php3.c: Apache compile fix - - * cgi_main.c: UNIX CGI build fix - -1999-05-02 Andi Gutmans - - * php4isapi/php4isapi.c - php4isapi/php4isapi.def - SAPI.c - SAPI.h - cgi_main.c - ext/hyperwave/hw.c - ext/standard/post.c - main.c - main.h - mod_php3.c - output.c - request_info.c - request_info.h: - Make ISAPI hook in as an extension too. - - Some work on moving stuff to SAPI. - -1999-05-01 Sascha Schumann - - * ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: func name changes, remove arbitrary limit - - * ext/mcrypt/config.m4 - ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: mcrypt 2.1.18 support, better autoconf checking - -1999-04-30 Thies C. Arntzen - - * ext/oracle/oracle.c - ext/oracle/oracle.h: - forward port of current oracle.c + fixes to make it actually work;-)!!! - - * ext/oracle/config.m4: oracle links again (at least on linux!!!) - -1999-04-28 Zeev Suraski - - * ext/mysql/mysql.c: - Get the MySQL module to use the new INI mechanism feature - - * main.c: Remove redundant code - - * main.c - php_ini.c - php_ini.h: - Additional generalization of the INI mechanism. Avoid needing specialized - message handlers in 99% of the cases. - - * ext/standard/basic_functions.c - ext/odbc/odbc.c - ext/mysql/mysql.c - ext/apache/apache.c - ext/com/COM.c - main.c - php_ini.c - php_ini.h: A step towards generalizing the INI mechanism even more - - * ext/standard/basic_functions.c: get rid of some stupid warnings - -1999-04-28 Andi Gutmans - - * main.c: - Small startup fix. - -1999-04-27 Rasmus Lerdorf - - * ext/standard/file.c - ext/standard/file.h: Add fgetcsv() here as well - -1999-04-27 Zeev Suraski - - * php4isapi/php4isapi.dsp - configuration-parser.y - configuration-scanner.l - main.c - php4dll.dsp - php4dllts.dsp - php_globals.h: - * Get rid of the memory leak messages in case of fatal errors or exit() - * .dsp fixes - * Minor fixes - -1999-04-26 Zeev Suraski - - * ext/standard/basic_functions.c - main.c: * Small startup fix - * Fix min() and max() - - * Makefile.in - cgi_main.c: Temporary fix for CGI compilation under UNIX - - * configuration-parser.y - configuration-scanner.l - php4dll.dsp - php4dllts.dsp: - Somehow the rules for the configuration parser/scanners disappeared - -1999-04-26 Andrei Zmievski - - * acinclude.m4: Fixing a few thing to make AC_CHECK_CC_OPTION work. - -1999-04-26 Zeev Suraski - - * ext/sybase/sybase.c - ext/standard/basic_functions.c - ext/standard/exec.c - ext/standard/head.c - ext/standard/info.c - ext/standard/pageinfo.c - ext/standard/post.c - ext/gd/gd.c - ext/gd/php3_gd.h - ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c - dl/mssql/mssql.c - ext/apache/apache.c - Makefile.in - SAPI.c - configure.in.in - fhttpd.c - main.c - mod_php3.c - php.h - request_info.c - safe_mode.c: * Get the Apache module to compile again - * Get rid of php3_rqst, use SG(server_context) instead (there's still Apache-specific code, - but it nuked a global) - - * php4.dsp - php4dll.dsp - php4dllts.dsp - php4ts.dsp: Match the CVS name - - * php4isapi/php4isapi.c - php4isapi/php4isapi.dsp - ext/standard/datetime.c - ext/standard/head.c - ext/standard/head.h - ext/standard/info.c - ext/standard/info.h - ext/standard/post.c - ext/standard/post.h - ext/standard/basic_functions.c - ext/standard/basic_functions.h - SAPI.c - SAPI.h - cgi_main.c - configuration-parser.y - fopen-wrappers.c - fopen-wrappers.h - getopt.c - getopt.h - main.c - main.h - mod_php3.c - output.c - output.h - php.h - php4.dsp - php4.dsw - php4dll.dsp - php4dllts.dsp - php4libts.dsp - php4ts.dsp - php4ts.dsw - php_globals.h - request_info.c - request_info.h: * Plenty of thread safety and Win32 work. - * Changed PHP4 to compile as a DLL, both ISAPI and the the CGI run with the same DLL. - * Switched to using the DLL runtime library under Win32. PHP will NOT work if - compiled against the static library! - * Removed yesterday's php4libts project (with php4dllts, it's obsolete). - - This *does* affect thread-unsafe Windows as well - the thread unsafe CGI is also - dependant on the thread-unsafe DLL. - -1999-04-26 Andi Gutmans - - * php4libts.dsp: -Add .dsp file - - * php4isapi/php4isapi.dsp - main.c: -More - -1999-04-25 Rasmus Lerdorf - - * ext/gd/config.m4: Make GD config fail if it doesn't find the gd files - -1999-04-25 Sascha Schumann - - * ext/mcrypt/mcrypt.c: PHP3 compat stuff - -1999-04-25 Rasmus Lerdorf - - * Makefile.in - configure.in.in: Ok, apxs build works nicely now - -1999-04-25 Sascha Schumann - - * ext/mcrypt/mcrypt.c: oops, the 0th byte should be set, too - - * ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: final change (?), add get_algorithms_name - - * ext/mcrypt/mcrypt.c: make code more compact - - * ext/mcrypt/mcrypt.c: remove some redundant code - - * ext/mcrypt/mcrypt.c: that was a silly one - - * ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: add OFB mode, the final one - - * ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: add mcrypt_create_iv() - -1999-04-25 Zeev Suraski - - * SAPI.c - SAPI.h - sapi.c - sapi.h: Win32 isn't a good os to commit uppercase files with... - -1999-04-25 Sascha Schumann - - * ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: - cleanup, add new stream mode, allow IV for CBC mode - - * ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: add get_(key|block)_size - -1999-04-25 Andi Gutmans - - * cgi_main.c - sapi.c - sapi.h: Ah, these too - - * output.c - php.h - php4isapi/php4isapi.c - php4isapi/php4isapi.def - php4isapi/php4isapi.dsp - php4ts.dsp - php4ts.dsw - main.c: * Fix a couple of thread safety issues - * Add initial ISAPI support. Very very experimental. - * In the thread safe version, generate php4 as a library so that we can link it with both - php.exe and the ISAPI dll. We should probably consider doing that under all circumstances, - under UNIX as well. - - The thread-unsafe version *should* be unharmed. - -1999-04-25 Sascha Schumann - - * ext/mcrypt/php_mcrypt.h - ext/mcrypt/mcrypt.c: add CBC - - * ext/mcrypt/.cvsignore - ext/mcrypt/Makefile.am - ext/mcrypt/config.h.stub - ext/mcrypt/config.m4 - ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h - ext/mcrypt/setup.stub - acinclude.m4 - internal_functions.c: add mcrypt module - -1999-04-25 Rasmus Lerdorf - - * ext/mysql/config.m4 - Makefile.in - acconfig.h.in - configure.in.in - ext/ldap/config.m4: Ok, this beast compiles via --with-apxs - Not sure if it actually works yet though. I have a feeling there are - some -fpic flags missing in the libzend build. Will test later on - today. - -1999-04-25 Sascha Schumann - - * scripts/preconfig: - -f tests for plain files only. We need a way to find out whether we could do any damage to existing files. If we cannot write to them, we probably cannot do harmful things hopefully. - -1999-04-25 Thies C. Arntzen - - * ext/standard/php3_var.h - ext/standard/var.c: serialize & unserialize working (with mem-leak) - -1999-04-25 Rasmus Lerdorf - - * ext/mysql/config.m4 - ext/standard/config.m4: - Argh! That typo took me over an hour to find. Grr.. - -1999-04-25 Andrei Zmievski - - * scripts/preconfig: test -e fails in sh. Used test -f instead. - -1999-04-24 Sascha Schumann - - * acinclude.m4 - configure.in.in: unreliable check whether cc option can be used really - - * scripts/preconfig: security check and disclaimer for generated files - -1999-04-24 Rasmus Lerdorf - - * acconfig.h.in: - Oops, would be a good idea to edit the .in file instead of acconfig.h - - * ext/standard/config.m4: libbind check - -1999-04-24 Sascha Schumann - - * configure.in.in: add function checks - -1999-04-24 Andrei Zmievski - - * configure.in.in - scripts/preconfig: Change cmp'risons to be cross-shell compatible. - -1999-04-24 Sascha Schumann - - * ext/standard/datetime.c: bugfix port - - * acconfig.h.in - configure.in.in: port from PHP3 - - * ext/standard/flock_compat.h: include some header files explicitly - -1999-04-24 Zeev Suraski - - * php4.dsp - php4ts.dsp: Use relative paths - -1999-04-24 Thies C. Arntzen - - * ext/oracle/oci8.c - ext/oracle/php3_oci8.h: forward-port of php3-CVS version - my 1st zend-array stuff (ocifetchinto) is WORKING!! - - * ext/standard/php3_var.h - ext/standard/var.c: made var_dump zend-aware.... - "tubu"); - - var_dump($ar); - ?> - works again!!! - - zeev, andi -> please review what i've done!!! - - (no i can start "debugging" other stuff, as i often use var_dump) - -1999-04-24 Zeev Suraski - - * apidoc-zend.txt: Add my API letters to the CVS - - * php4ts.dsp - php_globals.h - main.c: Small fixes - - * main.c: We'd have to find a different way of allowing timeouts in Win32 - - * win32/sendmail.c - win32/time.c - win32/wsyslog.c - serverapi/sapi.h - win32/pwd.c - ext/standard/post.c - ext/standard/reg.c - ext/standard/string.c - ext/standard/uniqid.c - ext/standard/url.c - ext/standard/dl.c - ext/standard/dns.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/filestat.c - ext/standard/formatted_print.c - ext/standard/fsock.c - ext/standard/head.c - ext/standard/html.c - ext/standard/image.c - ext/standard/info.c - ext/standard/mail.c - ext/standard/math.c - ext/standard/md5.c - ext/standard/microtime.c - ext/standard/mime.c - ext/standard/pack.c - ext/standard/pageinfo.c - ext/standard/browscap.c - ext/standard/datetime.c - ext/standard/dir.c - ext/odbc/odbc.c - ext/standard/base64.c - ext/standard/basic_functions.c - ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c - ext/bcmath/number.c - ext/apache/apache.c - ext/bcmath/bcmath.c - main.c - main.h - mod_php3.c - output.c - php.h - php3_threads.c - php3_threads.h - php4.dsp - php4ts.dsp - request_info.c - safe_mode.c - bison.simple - configuration-parser.y - control_structures.h - fhttpd.c - fopen-wrappers.c: - A lot of cleanups... Removed old thread-safe code and other redundant code and files - -1999-04-23 Zeev Suraski - - * ext/standard/head.c - main.c - main.h - php_globals.h: Remove redundant code - - * ext/standard/head.c - main.c - main.h - php_globals.h: Thread-safe header_is_being_sent - - * win32/pwd.c - win32/sendmail.c - win32/time.c - win32/winutil.c - win32/wsyslog.c - ext/standard/string.c - ext/standard/syslog.c - ext/standard/uniqid.c - ext/standard/url.c - ext/standard/var.c - ext/zlib/zlib.c - ext/standard/base64.c - ext/standard/basic_functions.c - ext/standard/browscap.c - ext/standard/datetime.c - ext/standard/dir.c - ext/standard/dl.c - ext/standard/dns.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/filestat.c - ext/standard/formatted_print.c - ext/standard/fsock.c - ext/standard/head.c - ext/standard/html.c - ext/standard/info.c - ext/standard/link.c - ext/standard/mail.c - ext/standard/math.c - ext/standard/md5.c - ext/standard/microtime.c - ext/standard/mime.c - ext/standard/pack.c - ext/standard/pageinfo.c - ext/standard/post.c - ext/standard/reg.c - ext/imap/imap.h - ext/informix/ifx.ec - ext/ldap/ldap.c - ext/msql/msql.c - ext/gd/gd.c - ext/dbase/dbase.c - ext/filepro/filepro.c - dl/mssql/mssql.c - ext/apache/apache.c - ext/bcmath/number.c - tls.h - fhttpd.c - fopen-wrappers.c - main.c - mod_php3.c - php3_realpath.c - request_info.c - safe_mode.c - tls.c: Remove tls.[ch] - - * ext/ldap/ldap.c - ext/imap/imap.c: cleanups - - * ext/bcmath/bcmath.c - ext/mysql/mysql.c: * MySQL fix (thanks Stig) - * Remove reundant includes from bcmath - -1999-04-23 Stig Bakken - - * libphp3.module.in: use only EXTRA_LIBS - -1999-04-23 Zeev Suraski - - * ext/mysql/mysql.c - ext/mysql/php3_mysql.h: Minor MySQL thread safety issues - - * main.c: Testing unified diffs - -1999-04-23 Rasmus Lerdorf - - * ext/standard/config.m4: - Ok, finally.. These now work nicely on a RH-5.2 box: - --with-mysql --with-ldap --with-imap --with-zlib --with-snmp - - * ext/zlib/zlib.c: Make zlib compile - -1999-04-23 Zeev Suraski - - * php4ts.dsp - main.c: *** empty log message *** - -1999-04-23 Rasmus Lerdorf - - * ext/ldap/ldap.c - ext/mysql/config.m4 - ext/snmp/config.m4: Module work - -1999-04-22 Zeev Suraski - - * Makefile.in: vpath fix - -1999-04-22 Rasmus Lerdorf - - * ext/zlib/Makefile.in - ext/sysvshm/Makefile.in - ext/sysvsem/Makefile.in - ext/sybase/Makefile.in - ext/imap/Makefile.in - ext/imap/config.m4 - ext/xml/Makefile.in - ext/snmp/Makefile.in: This is generated - - * ext/zlib/Makefile.in - ext/sysvshm/Makefile.in - ext/xml/Makefile.in - ext/sysvsem/Makefile.in - ext/imap/Makefile.in - ext/imap/config.m4 - ext/snmp/Makefile.in - ext/sybase/Makefile.in - acconfig.h.in: - Bring imap build rules up to date. We still have a problem here though. - In this new build structure we are adding libraries to $LIBS as we add - modules instead of doing an AC_SUBST into the Makefile. One reason for - doing the subst in php3 was to get around the libraries that could not - be included in $LIBS because doing so would mess up the various configure - tests. For example, you can't do a -limap as part of the various simple - configure compile programs because -limap requires a bunch of callback - symbols to be present. - -1999-04-22 Andi Gutmans - - * php4.dsp: - Update the regular VC project file. - -1999-04-22 Stig Bakken - - * ext/db/config.m4: db was not linked in - - * ext/zlib/.cvsignore - ext/zlib/Makefile.am - ext/zlib/Makefile.in - ext/zlib/config.h.stub - ext/zlib/config.m4 - ext/zlib/php3_zlib.h - ext/zlib/setup.stub - ext/zlib/zlib.c - ext/sysvshm/.cvsignore - ext/sysvshm/Makefile.am - ext/sysvshm/Makefile.in - ext/sysvshm/config.h.stub - ext/sysvshm/config.m4 - ext/sysvshm/php3_sysvshm.h - ext/sysvshm/setup.stub - ext/sysvshm/sysvshm.c - ext/xml/.cvsignore - ext/xml/Makefile.am - ext/xml/Makefile.in - ext/xml/config.h.stub - ext/xml/config.m4 - ext/xml/php3_xml.h - ext/xml/xml.c - ext/sybase/.cvsignore - ext/sybase/Makefile.am - ext/sybase/Makefile.in - ext/sybase/config.h.stub - ext/sybase/config.m4 - ext/sybase/php3_sybase-ct.h - ext/sybase/php3_sybase.h - ext/sybase/setup.stub - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ext/sysvsem/.cvsignore - ext/sysvsem/Makefile.am - ext/sysvsem/Makefile.in - ext/sysvsem/config.h.stub - ext/sysvsem/config.m4 - ext/sysvsem/php3_sysvsem.h - ext/sysvsem/setup.stub - ext/sysvsem/sysvsem.c - ext/snmp/config.m4 - ext/snmp/php3_snmp.h - ext/snmp/snmp.c - ext/standard/Makefile.am - ext/standard/basic_functions.c - ext/standard/config.h.stub - ext/standard/config.m4 - ext/standard/fsock.c - ext/standard/mime.c - ext/standard/mime.h - ext/standard/php3_standard.h - ext/standard/post.c - ext/standard/post.h - ext/standard/string.c - ext/standard/var.c - ext/interbase/.cvsignore - ext/interbase/Makefile.am - ext/interbase/config.h.stub - ext/interbase/config.m4 - ext/interbase/interbase.c - ext/interbase/php3_interbase.h - ext/interbase/setup.stub - ext/pdf/.cvsignore - ext/pdf/Makefile.am - ext/pdf/config.h.stub - ext/pdf/config.m4 - ext/pdf/pdf.c - ext/pdf/php3_pdf.h - ext/pdf/setup.stub - ext/pgsql/.cvsignore - ext/pgsql/Makefile.am - ext/pgsql/config.h.stub - ext/pgsql/config.m4 - ext/pgsql/pgsql.c - ext/pgsql/php3_pgsql.h - ext/pgsql/setup.stub - ext/snmp/.cvsignore - ext/snmp/Makefile.am - ext/snmp/Makefile.in - ext/snmp/config.h.stub - ext/imap/Makefile.in - ext/informix/Makefile.am - ext/informix/config.h.stub - ext/informix/readme.ifx - ext/informix/setup.stub - Makefile.in - acconfig.h.in - acinclude.m4 - configure.in.in - fhttpd.c - internal_functions.c - main.c - setup: last bunch of extensions moving to ext/ - fhttpd module taken out of functions, functions is ready to go. - The only extensions I have tested are gd+freetype and odbc(solid). - Please try compiling in your favourite extensions and let me know how it - works. - - * ext/ldap/.cvsignore - ext/ldap/Makefile.am - ext/ldap/config.h.stub - ext/ldap/config.m4 - ext/ldap/ldap.c - ext/ldap/php3_ldap.h - ext/ldap/setup.stub - ext/standard/config.h.stub - Makefile.in - acconfig.h.in - configure.in.in - ext/imap/.cvsignore - ext/imap/Makefile.am - ext/imap/Makefile.in - ext/imap/config.h.stub - ext/imap/config.m4 - ext/imap/imap.c - ext/imap/imap.h - ext/imap/setup.stub - internal_functions.c - setup: moved imap and ldap - - * serverapi/nsapi_sapi.c - ext/standard/formatted_print.c - ext/standard/head.c - ext/standard/head.h - ext/standard/info.c - ext/standard/pack.c - ext/standard/php3_crypt.h - ext/standard/php3_standard.h - ext/odbc/odbc.c - ext/standard/Makefile.am - ext/standard/crypt.c - ext/standard/dl.c - ext/standard/dl.h - ext/standard/exec.c - ext/standard/file.c - ext/hyperwave/hw.c - ext/informix/.cvsignore - ext/informix/Makefile.am - ext/informix/config.h.stub - ext/informix/config.m4 - ext/informix/ifx.ec - ext/informix/php3_ifx.h - ext/informix/setup.stub - ext/gd/gd.c - ext/fdf/config.h.stub - ext/fdf/config.m4 - ext/fdf/fdf.c - ext/fdf/php3_fdf.h - ext/fdf/setup.stub - ext/apache/apache.c - ext/fdf/.cvsignore - ext/fdf/Makefile.am - Makefile.in - acconfig.h.in - configuration-parser.y - configure.in.in - fopen-wrappers.c - internal_functions.c - main.c - output.c - setup - tls.h: moved fdf, hyperwave, informix and some smaller files - -1999-04-21 Stig Bakken - - * ext/hyperwave/debug.h - acconfig.h.in - acinclude.m4 - configure.in.in - ext/db/.cvsignore - ext/db/Makefile.am - ext/db/config.h.stub - ext/db/config.m4 - ext/db/db.c - ext/db/db.h - internal_functions.c - Makefile.in: moved db - - * ext/bcmath/.cvsignore - ext/bcmath/Makefile.am - ext/bcmath/bcmath.c - ext/bcmath/config.h.stub - ext/bcmath/config.m4 - ext/bcmath/number.c - ext/bcmath/number.h - ext/bcmath/php3_bcmath.h - ext/bcmath/setup.stub - Makefile.in - acconfig.h.in - configure.in.in - internal_functions.c - php.h - setup - tls.h: moved bcmath - - * ext/com/.cvsignore - ext/com/COM.c - ext/com/php3_COM.h - ext/hyperwave/.cvsignore - ext/hyperwave/DList.h - ext/hyperwave/Makefile.am - ext/hyperwave/config.h.stub - ext/hyperwave/config.m4 - ext/hyperwave/dlist.c - ext/hyperwave/hg_comm.c - ext/hyperwave/hg_comm.h - ext/hyperwave/hw.c - ext/hyperwave/hw.h - ext/hyperwave/hw_error.h - ext/hyperwave/setup.stub - ext/apache/.cvsignore - ext/apache/Makefile.am - ext/apache/apache.c - ext/apache/config.m4 - Makefile.in - acconfig.h.in - configure.in.in - setup: moved apache, com and hyperwave into ext/ - - * ext/oracle/.cvsignore - ext/oracle/Makefile.am - ext/oracle/config.h.stub - ext/oracle/config.m4 - ext/oracle/oci8.c - ext/oracle/oracle.c - ext/oracle/oracle.h - ext/oracle/oracle_hack.c - ext/oracle/php3_oci8.h - ext/oracle/setup.stub - ext/dav/.cvsignore - ext/dav/Makefile.am - ext/dav/config.h.stub - ext/dav/config.m4 - ext/dav/dav.c - ext/dav/php3_dav.h - ext/dav/setup.stub - ext/ext_skel - ext/msql/.cvsignore - ext/msql/Makefile.am - ext/msql/config.h.stub - ext/msql/config.m4 - ext/msql/msql.c - ext/msql/php3_msql.h - ext/msql/setup.stub - ext/mysql/setup.stub - Makefile.in - acconfig.h.in - acinclude.m4 - configure.in.in - internal_functions.c - setup: moved dav, msql and oracle to ext/ - - * acconfig.h.in - configure.in.in - Makefile.in - ext/filepro/config.h.stub - ext/filepro/config.m4 - ext/filepro/filepro.c - ext/filepro/filepro.h - ext/filepro/setup.stub - ext/filepro/.cvsignore - ext/filepro/Makefile.am: moved filepro to ext - - * ext/mysql/config.m4: - mysql should work again now, can someone with mysql installed test it? - - * ext/gd/gd.c: gd compile fix - - * Makefile.in - ext/mysql/config.h.stub - ext/mysql/config.m4 - ext/mysql/mysql.c - ext/mysql/php3_mysql.h - ext/mysql/setup.stub - ext/mysql/.cvsignore - ext/mysql/Makefile.am - acconfig.h.in - configure.in.in - internal_functions.c: moving mysql to ext/ - - * ext/ext_skel: create .cvsignore only once :-) - - * ext/ext_skel: create .cvsignore as well - - * buildconf: state which aclocal.m4 and configure files are created - - * scripts/armerge: merge the object files in a temporary directory - -1999-04-21 Zeev Suraski - - * php4ts.dsp: Thread safe project update - -1999-04-21 Stig Bakken - - * php.h: added PHP_API_VERSION, simply set it to 19990421 for now - -1999-04-21 Zeev Suraski - - * php.h: Minor fixes - - * ext/standard/Makefile.am - ext/standard/file.c - ext/standard/flock_compat.c - ext/standard/flock_compat.h - ext/standard/string.c - config.w32.h - php.h - php4.dsp - php_compat.c - php_compat.h - Makefile.in: - * Rename php_compat.[ch] to flock_compat.[ch] and move it to ext/standard - * Fix Win32 compilation - -1999-04-21 Sascha Schumann - - * ext/gettext/php3_gettext.h: forgot that one - - * ext/standard/file.h - ChangeLog.TODO - ext/standard/file.c: cleanup, flock() support - - * ext/standard/file.c - ext/standard/php3_string.h - ChangeLog.TODO - internal_functions.c: crypt constants - - * php_compat.c - configure.in.in - internal_functions.c: cleanup - -1999-04-21 Zeev Suraski - - * configuration-parser.y - ext/standard/basic_functions.c - ext/standard/syslog.c - main.c - php4ts.dsw - php_ini.c - testfunc: - Thread safety patch. It works now with just-in-time resource initialization! - -1999-04-21 Sascha Schumann - - * ext/gettext/.cvsignore - ext/gettext/Makefile.am - ext/gettext/config.h.stub - ext/gettext/config.m4 - ext/gettext/gettext.c - ext/gettext/setup.stub: incorporate gettext support - - * ext/standard/datetime.c - ext/standard/reg.c - ext/standard/string.c - ChangeLog.TODO - Makefile.in - fopen-wrappers.c - php.h - php_compat.c - php_compat.h: port some fixes, add compat routines - - * ChangeLog.TODO - ext/standard/string.c: str_replace fix - -1999-04-21 Stig Bakken - - * ext/ext_skel: make config.h.stub as well - - * acinclude.m4: - remove old libtool and automake stuff that was borrowed using 3.0 - -1999-04-21 Zeev Suraski - - * php4.dsp - php4.dsw - php4ts.dsp - php4ts.dsw: Update thread-safe projects - -1999-04-21 Sascha Schumann - - * .cvsignore: config.h.in is a generated file and should be ignored by CVS - -1999-04-21 Stig Bakken - - * buildconf: move automake back to before autoconf - - * buildconf - scripts/preconfig: - autoheader must be called after autoconf, automake after autoheader - -1999-04-21 Sascha Schumann - - * ext/ext_skel: generates basic skeleton for new extension - -1999-04-21 Zeev Suraski - - * ext/standard/basic_functions.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/filestat.c - ext/standard/link.c - fopen-wrappers.c - main.c - main.h - php.h - php4.dsw - php_globals.h - configuration-parser.y: More thread safety work - -1999-04-20 Stig Bakken - - * buildconf - config.h.in - ext/dbase/config.h.stub - ext/gd/config.h.stub - ext/odbc/config.h.stub: added ext/*/config.h.stub files - removed config.h.in (generated) - - * scripts/preconfig - ext/odbc/config.m4 - ext/odbc/odbc.c - ext/odbc/php3_odbc.h - Makefile.in - acconfig.h.in - acinclude.m4 - build-defs.h.in - config.h.in - internal_functions.c - php.h: odbc compiles and runs on UNIX again (tested with Solid 2.3) - -1999-04-19 Stig Bakken - - * buildconf: convert libzend to automake - -1999-04-19 Andi Gutmans - - * php4.dsp: Rearrange the .dsp for the new ODBC layout - -1999-04-19 Stig Bakken - - * .cvsignore: ignore acconfig.h - - * ext/odbc/odbc.c: include the right header files - - * scripts/preconfig - acconfig.h - acconfig.h.in: - generate acconfig.h from acconfig.h.in and ext/*/config.h.stub - - * ext/odbc/.cvsignore - ext/odbc/Makefile.am - ext/odbc/config.m4 - ext/odbc/odbc.c - ext/odbc/php3_odbc.h - ext/odbc/php3_velocis.h - ext/odbc/setup.stub - ext/odbc/velocis.c - Makefile.in - configure.in.in - internal_functions.c - setup: moved odbc into ext/ - - * buildconf: keep old files if they are not modified - - * configure.in.in - internal_functions.c - setup - Makefile.in: moved dbase into ext/ - - * ext/dbase/.cvsignore - ext/dbase/Makefile.am - ext/dbase/config.m4 - ext/dbase/dbase.c - ext/dbase/dbase.h - ext/dbase/dbf.h - ext/dbase/dbf_head.c - ext/dbase/dbf_head.h - ext/dbase/dbf_misc.c - ext/dbase/dbf_misc.h - ext/dbase/dbf_ndx.c - ext/dbase/dbf_ndx.h - ext/dbase/dbf_rec.c - ext/dbase/dbf_rec.h - ext/dbase/setup.stub: - moved dbase into ext/ along with the bundled library - dbase programs are no longer included - - * buildconf: run automake and run autoconf in libzend - -1999-04-18 Zeev Suraski - - * ext/Makefile.am - main.c: Ah, so that file is generated too - - * scripts/mkextlib.in - Makefile.in - buildconf - configure.in.in: - * Added buildconf, runs all the scripts necessary to build configure (Stig - if there's any way - to detect whether we need to run 'automake --add-missing', please add it...) - * Make vpath work again - * Minor UNIX bugfixes - - * ext/standard/pack.c - ext/standard/string.c - ext/standard/var.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/formatted_print.c - ext/standard/fsock.c - ext/standard/fsock.h - ext/standard/info.c - main.c - php4.dsp: Make Win32 happy with the recent changes. - - * win32/php_registry.h - win32/registry.c: Forgot to add these - Win32 registry support - - * main.c - php3_compat.h: Win32 registry support - -1999-04-17 Andi Gutmans - - * ext/standard/basic_functions.c: - - Make gettype() behave like it used to where it returned "object" for - objects. - -1999-04-17 Stig Bakken - - * scripts/armerge - configure.in.in - ext/gd/config.m4 - libphp3.module.in - Makefile.in: Apache module compiles again - - * aclocal.m4: this file is now generated - - * ext/standard/info.c: - make sure the images on the phpinfo() page point to PHP-enabled pages - - * .cvsignore: ignore configure.in - - * configure.in: this file is now generated - - * scripts/.cvsignore - scripts/armerge - scripts/config-stubs - scripts/mkextlib.in - scripts/preconfig - ext/standard/math.c - ext/standard/md5.c - ext/standard/md5.h - ext/standard/microtime.c - ext/standard/microtime.h - ext/standard/pack.c - ext/standard/pack.h - ext/standard/pageinfo.c - ext/standard/pageinfo.h - ext/standard/php3_browscap.h - ext/standard/php3_dir.h - ext/standard/php3_filestat.h - ext/standard/php3_iptc.h - ext/standard/php3_link.h - ext/standard/php3_mail.h - ext/standard/php3_standard.h - ext/standard/php3_string.h - ext/standard/php3_syslog.h - ext/standard/php3_var.h - ext/standard/phpdir.h - ext/standard/phpmath.h - ext/standard/quot_print.c - ext/standard/quot_print.h - ext/standard/rand.c - ext/standard/reg.c - ext/standard/reg.h - ext/standard/soundex.c - ext/standard/string.c - ext/standard/syslog.c - ext/standard/type.c - ext/standard/type.h - ext/standard/uniqid.c - ext/standard/uniqid.h - ext/standard/url.c - ext/standard/url.h - ext/standard/var.c - ext/gd/.cvsignore - ext/gd/Makefile.am - ext/gd/config.m4 - ext/gd/gd.c - ext/gd/php3_gd.h - ext/gd/setup.stub - ext/standard/.cvsignore - ext/standard/Makefile.am - ext/standard/base64.c - ext/standard/base64.h - ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/browscap.c - ext/standard/config.m4 - ext/standard/cyr_convert.c - ext/standard/cyr_convert.h - ext/standard/datetime.c - ext/standard/datetime.h - ext/standard/dir.c - ext/standard/dns.c - ext/standard/dns.h - ext/standard/exec.c - ext/standard/exec.h - ext/standard/file.c - ext/standard/file.h - ext/standard/filestat.c - ext/standard/formatted_print.c - ext/standard/fsock.c - ext/standard/fsock.h - ext/standard/global.h - ext/standard/html.c - ext/standard/html.h - ext/standard/image.c - ext/standard/image.h - ext/standard/info.c - ext/standard/info.h - ext/standard/iptc.c - ext/standard/link.c - ext/standard/mail.c - .cvsignore - Makefile.in - acinclude.m4 - aclocal.m4 - configuration-parser.y - configure.in - configure.in.in - ext/.cvsignore - ext/Makefile.am - fopen-wrappers.c - internal_functions.c - main.c - php_version.h - safe_mode.c - setup: - First commit of re-structuring phase one. We have started using automake in - sub-directories and started to move extension code into ext/. For now, - I have moved the "standard" extension (which is quite a mix of everything - right now) and the GD extension into their own subdirs in ext/. - The configure script now also runs configure in the libzend directory - automatically and makes sure php4 and libzend use the same config.cache file. - To avoid running configure in libzend, use the --no-recursion option. - "make" in php4 also builds libzend now. - The Apache module doesn't compile right now, but a fix for that is - coming up. - -1999-04-16 Stig Bakken - - * ext/gd/gd.c - ext/gd/gdcache.c - ext/gd/gdcache.h - ext/gd/gdttf.c - ext/gd/gdttf.h: - updated GD from php3 repository, using it as a test extension for the new - directory structure - -1999-04-16 Andi Gutmans - - * main.c - php4.dsp: - Make the memory leak message print PHP4. - -1999-04-12 Zeev Suraski - - * php_ini.c: NULL's should remain NULLs (at least in strings) - -1999-04-12 Stig Bakken - - * php_ini.c: - tolerate uninitialized ini settings in php_ini_{long,double,string}() - -1999-04-12 Sascha Schumann - - * ChangeLog.TODO: This should help in keeping PHP4 up to date - -1999-04-10 Zeev Suraski - - * main.c: Test patch... - - * main.c: test patch - - * main.c: Oops - - * mod_php3.h - Makefile.in - main.c - mod_php3.c: php3_ini? What's that? - - * configuration-parser.y - fopen-wrappers.c - internal_functions.c - main.c - mod_php3.c - mod_php3.h - php.h - php_globals.h - php_ini.c - php_ini.h - request_info.c - tls.h: Buh-bye php3_ini - - * main.c - mod_php3.c - mod_php3.h - php_globals.h - win32/sendmail.c: A lot of php3_ini -> php_ini work - - * configuration-parser.y - fopen-wrappers.c - main.c - mod_php3.c - mod_php3.h - php_globals.h: Move safe_mode to the new php_ini mechanism - - * main.c - mod_php3.c - mod_php3.h - php_globals.h: - Move asp_tags and short_open_tag to the new php_ini mechanism - - * php_ini.c: * php_ini fixes - * convert the MySQL module to use the new php_ini mechanism - -1999-04-09 Zeev Suraski - - * mod_php3.c - php_ini.c: Apache php_ini support - - * main.c: testing 123 - - * main.c: test, ignore - - * php_ini.c: Testing 123 - - * php_ini.c: *** empty log message *** - - * mod_php3.c: Get the apache module to compile - - * php_globals.h: *** empty log message *** - - * main.c - mod_php3.h - php.h - php4.dsp - php_ini.c - php_ini.h: * A lot of work on php_ini stuff - * A lot of work on getting rid from php3_ini - -1999-04-08 Zeev Suraski - - * php_ini.c - php_ini.h: Type library support in COM module - - * configuration-parser.y - dl/mssql/mssql.c - dl/mssql/php3_mssql.h - main.c - php_ini.c - php_ini.h: * Add arguments to shutdown function - * Bring php_ini uptodate - - * main.c: Fix for php -v - -1999-04-08 Stig Bakken - - * fopen-wrappers.c: patched in fsock.c from php3 - -1999-04-08 Kristian Köhntopp - - * Makefile.in: Spurious $ removed in Makefile.in - -1999-04-08 Stig Bakken - - * .cvsignore - configure.in - regex/.cvsignore: get rid of extra and doc dirs, more cvs ignore stuff - -1999-04-07 Stig Bakken - - * .cvsignore - configure.in: fix configure warnings - -1999-04-07 Zeev Suraski - - * php4.dsw: Update deps - - * php4.dsp - php4.dsw - regex/debug.ih - regex/engine.ih - regex/main.ih - regex/regcomp.ih - regex/regerror.ih: Win32 patches - - * win32/wsyslog.c: New file. - - * win32/wsyslog.c: PHP 4.0 - - * serverapi/isapiwrapper/cgiwrap.c - serverapi/sapi.h - win32/flock.c - win32/flock.h - win32/grp.h - win32/param.h - win32/pwd.c - win32/pwd.h - win32/readdir.c - win32/readdir.h - win32/sendmail.c - win32/sendmail.h - win32/signal.h - win32/syslog.h - win32/time.c - win32/time.h - win32/unistd.h - win32/wfile.c - win32/wfile.h - win32/winutil.c - win32/winutil.h: New file. - - * serverapi/isapiwrapper/cgiwrap.c - serverapi/sapi.h - win32/flock.c - win32/flock.h - win32/grp.h - win32/param.h - win32/pwd.c - win32/pwd.h - win32/readdir.c - win32/readdir.h - win32/sendmail.c - win32/sendmail.h - win32/signal.h - win32/syslog.h - win32/time.c - win32/time.h - win32/unistd.h - win32/wfile.c - win32/wfile.h - win32/winutil.c - win32/winutil.h: PHP 4.0 - - * serverapi/isapi_sapi.c - serverapi/nsapi_sapi.c: New file. - - * serverapi/isapi_sapi.c - serverapi/nsapi_sapi.c: PHP 4.0 - - * regex/tests - regex/utils.h - serverapi/cgi_sapi.c: New file. - - * regex/tests - regex/utils.h - serverapi/cgi_sapi.c: PHP 4.0 - - * regex/regex2.h - regex/regexec.c - regex/regfree.c - regex/split.c: New file. - - * regex/regex2.h - regex/regexec.c - regex/regfree.c - regex/split.c: PHP 4.0 - - * regex/regex.h - regex/regex.mak: New file. - - * regex/regex.h - regex/regex.mak: PHP 4.0 - - * regex/engine.c - regex/main.c - regex/mkh - regex/regcomp.c - regex/regerror.c - regex/regex.3 - regex/regex.7 - regex/regex.dsp - regex/regex.dsw: New file. - - * regex/engine.c - regex/main.c - regex/mkh - regex/regcomp.c - regex/regerror.c - regex/regex.3 - regex/regex.7 - regex/regex.dsp - regex/regex.dsw: PHP 4.0 - - * regex/debug.c: New file. - - * regex/debug.c: PHP 4.0 - - * regex/README - regex/WHATSNEW - regex/cclass.h - regex/cname.h: New file. - - * regex/README - regex/WHATSNEW - regex/cclass.h - regex/cname.h: PHP 4.0 - - * regex/COPYRIGHT - regex/Makefile.in: New file. - - * regex/COPYRIGHT - regex/Makefile.in: PHP 4.0 - - * dl/vmailmgr/docs.php3 - dl/vmailmgr/php3_vmailmgr.c - dl/vmailmgr/phpvmail.cc - dl/vmailmgr/phpvmail.h: New file. - - * dl/vmailmgr/docs.php3 - dl/vmailmgr/php3_vmailmgr.c - dl/vmailmgr/phpvmail.cc - dl/vmailmgr/phpvmail.h: PHP 4.0 - - * dl/snmp/snmp.c - dl/snmp/winsnmp.c - dl/vmailmgr/Makefile: New file. - - * dl/snmp/snmp.c - dl/snmp/winsnmp.c - dl/vmailmgr/Makefile: PHP 4.0 - - * dl/snmp/README - dl/snmp/php3_snmp.h: New file. - - * dl/snmp/README - dl/snmp/php3_snmp.h: PHP 4.0 - - * dl/mssql/sqlfront.h: New file. - - * dl/mssql/sqlfront.h: PHP 4.0 - - * dl/mssql/mssql.c - dl/mssql/php3_mssql.h - dl/mssql/sqldb.h: New file. - - * dl/mssql/mssql.c - dl/mssql/php3_mssql.h - dl/mssql/sqldb.h: PHP 4.0 - - * dl/log/log_sql.c - dl/mssql/README - dl/mssql/mssql.dsp: New file. - - * dl/log/log_sql.c - dl/mssql/README - dl/mssql/mssql.dsp: PHP 4.0 - - * dl/log/README - dl/log/log.c - dl/log/log.h - dl/log/log_db.c: New file. - - * dl/log/README - dl/log/log.c - dl/log/log.h - dl/log/log_db.c: PHP 4.0 - - * dl/imap/README - dl/imap/examples/dlimap_ping.php3 - dl/imap/examples/espanol/dlimap_ping.php3 - dl/imap/examples/espanol/dlimapbd1.php3 - dl/imap/examples/espanol/dlimapbd2.php3 - dl/imap/examples/espanol/dlimapbd3.php3 - dl/imap/examples/espanol/dlimapbd4.php3 - dl/imap/examples/espanol/dlimapbody.php3 - dl/imap/examples/simple.php3: New file. - - * dl/imap/README - dl/imap/examples/dlimap_ping.php3 - dl/imap/examples/espanol/dlimap_ping.php3 - dl/imap/examples/espanol/dlimapbd1.php3 - dl/imap/examples/espanol/dlimapbd2.php3 - dl/imap/examples/espanol/dlimapbd3.php3 - dl/imap/examples/espanol/dlimapbd4.php3 - dl/imap/examples/espanol/dlimapbody.php3 - dl/imap/examples/simple.php3: PHP 4.0 - - * dl/crypt/sflcryp.c - dl/crypt/sflcryp.h - dl/imap/IMAP_IS_NO_LONGER_HERE: New file. - - * dl/crypt/sflcryp.c - dl/crypt/sflcryp.h - dl/imap/IMAP_IS_NO_LONGER_HERE: PHP 4.0 - - * dl/crypt/crypt.c: New file. - - * dl/crypt/crypt.c: PHP 4.0 - - * dl/crypt/prelude.h: New file. - - * dl/crypt/prelude.h: PHP 4.0 - - * dl/calendar/gregor.c - dl/calendar/jewish.c - dl/calendar/julian.c - dl/calendar/sdncal.h: New file. - - * dl/calendar/gregor.c - dl/calendar/jewish.c - dl/calendar/julian.c - dl/calendar/sdncal.h: PHP 4.0 - - * dl/calendar/dow.c - dl/calendar/french.c: New file. - - * dl/calendar/dow.c - dl/calendar/french.c: PHP 4.0 - - * dl/calendar/calendar.c - dl/phpdl.h - dl/setup - dl/win32vc5.mak: New file. - - * dl/calendar/calendar.c - dl/phpdl.h - dl/setup - dl/win32vc5.mak: PHP 4.0 - - * dl/Makefile.tmpl - dl/README: New file. - - * dl/Makefile.tmpl - dl/README: PHP 4.0 - - * win95nt.h - zlib.mak: New file. - - * win95nt.h - zlib.mak: PHP 4.0 - - * snprintf.c - snprintf.h - stamp-h.in - test.php4 - test.pl - test_class_inheritance - testarray - testarray.pl - testarray2 - testarray2.pl - testclassfunc - testcom - testfe - testfunc - testfunc.pl - testfunc2 - testfunc2.pl - testfuncref - testinclude - testobj - tls.c - tls.h: New file. - - * snprintf.c - snprintf.h - stamp-h.in - test.php4 - test.pl - test_class_inheritance - testarray - testarray.pl - testarray2 - testarray2.pl - testclassfunc - testcom - testfe - testfunc - testfunc.pl - testfunc2 - testfunc2.pl - testfuncref - testinclude - testobj - tls.c - tls.h: PHP 4.0 - - * snmp.mak: New file. - - * snmp.mak: PHP 4.0 - - * setup: New file. - - * setup: PHP 4.0 - - * request_info.h - safe_mode.c - safe_mode.h: New file. - - * request_info.h - safe_mode.c - safe_mode.h: PHP 4.0 - - * press-release-3.0.txt - recurse - request_info.c: New file. - - * press-release-3.0.txt - recurse - request_info.c: PHP 4.0 - - * php4.dsp - php_custom_build.mak - php_ini.c - php_ini.h - php_version.h: New file. - - * php4.dsp - php_custom_build.mak - php_ini.c - php_ini.h - php_version.h: PHP 4.0 - - * php3_realpath.c - php3_realpath.h - php3_sprintf.c - php3_threads.c - php3_threads.h - php3extra.dsw - php3sapi.dsw: New file. - - * php3_realpath.c - php3_realpath.h - php3_sprintf.c - php3_threads.c - php3_threads.h - php3extra.dsw - php3sapi.dsw: PHP 4.0 - - * php3.ini-dist - php3_compat.h: New file. - - * php3.ini-dist - php3_compat.h: PHP 4.0 - - * php.h: New file. - - * php.h: PHP 4.0 - - * msql1.mak - mtparser.bat - mysql.mak - objects - output.c - output.h: New file. - - * msql1.mak - mtparser.bat - mysql.mak - objects - output.c - output.h: PHP 4.0 - - * mod_php3.c - mod_php3.h - msql.mak: New file. - - * mod_php3.c - mod_php3.h - msql.mak: PHP 4.0 - - * main.c - main.h - makeall.bat - makedist - makeparser.bat: New file. - - * main.c - main.h - makeall.bat - makedist - makeparser.bat: PHP 4.0 - - * ltmain.sh: New file. - - * ltmain.sh: PHP 4.0 - - * ltconfig: New file. - - * ltconfig: PHP 4.0 - - * logos.h: New file. - - * logos.h: PHP 4.0 - - * internal_functions_registry.h - ldap.mak - libphp3.module.in: New file. - - * internal_functions_registry.h - ldap.mak - libphp3.module.in: PHP 4.0 - - * install-sh - internal_functions.c: New file. - - * install-sh - internal_functions.c: PHP 4.0 - - * imap4.mak: New file. - - * imap4.mak: PHP 4.0 - - * fopen-wrappers.h - gd.mak - getopt.c - getopt.h - header - hyperwave.mak: New file. - - * fopen-wrappers.h - gd.mak - getopt.c - getopt.h - header - hyperwave.mak: PHP 4.0 - - * fopen-wrappers.c: New file. - - * fopen-wrappers.c: PHP 4.0 - - * dbm.mak - filepro.mak - foo - foo2 - foo3 - foo4 - footer: New file. - - * dbm.mak - filepro.mak - foo - foo2 - foo3 - foo4 - footer: PHP 4.0 - - * configure.in - control_structures.h - crypt.mak - cvsusers - dbase.mak: New file. - - * configure.in - control_structures.h - crypt.mak - cvsusers - dbase.mak: PHP 4.0 - - * config.w32.h - configuration-parser.y - configuration-scanner.l: New file. - - * config.w32.h - configuration-parser.y - configuration-scanner.l: PHP 4.0 - - * config.sub: New file. - - * config.sub: PHP 4.0 - - * config.h.in: New file. - - * config.h.in: PHP 4.0 - - * config.guess: New file. - - * config.guess: PHP 4.0 - - * calendar.mak: New file. - - * calendar.mak: PHP 4.0 - - * bison.simple - build-defs.h.in: New file. - - * bison.simple - build-defs.h.in: PHP 4.0 - - * apMakefile.tmpl - apidoc.txt: New file. - - * apMakefile.tmpl - apidoc.txt: PHP 4.0 - - * alloca.c - apMakefile.libdir: New file. - - * alloca.c - apMakefile.libdir: PHP 4.0 - - * Makefile.in - README.QNX - README.WIN32 - TODO - WISHLIST - WISHLIST-3.1 - acconfig.h - aclocal.m4: New file. - - * Makefile.in - README.QNX - README.WIN32 - TODO - WISHLIST - WISHLIST-3.1 - acconfig.h - aclocal.m4: PHP 4.0 - - * LICENSE: New file. - - * LICENSE: PHP 4.0 - - * FUNCTION_LIST.txt - INSTALL: New file. - - * FUNCTION_LIST.txt - INSTALL: PHP 4.0 - - * CREDITS - EXTENSION_STATUS: New file. - - * CREDITS - EXTENSION_STATUS: PHP 4.0 - - * CODING_STANDARDS: New file. - - * CODING_STANDARDS: PHP 4.0 - - * COPYING: New file. - - * COPYING: PHP 4.0 - - * CHANGES: New file. - - * CHANGES: PHP 4.0 - - * BUGS - ChangeLog: New file. - - * BUGS - ChangeLog: PHP 4.0 - diff --git a/FUNCTION_LIST.txt b/FUNCTION_LIST.txt deleted file mode 100644 index 2d567f7be6bff..0000000000000 --- a/FUNCTION_LIST.txt +++ /dev/null @@ -1,538 +0,0 @@ -Functions: - -Functions marked with 'u' do not work, or may not work correctly under windows. - -basic_functions - include - _include - isset - - intval - doubleval - strval - short_tags - sleep -u usleep - ksort - asort - sort - count - chr - ord - flush - end - prev - next - reset - current - key - gettype - settype - min - max - - addslashes - chop - pos - - fsockopen - getimagesize - htmlspecialchars - md5 - - parse_url - - parse_str - phpinfo - phpversion - strlen - strtok - strtoupper - strtolower - strchr - basename - dirname - stripslashes - strstr - strrchr - substr - quotemeta - urlencode - urldecode - ucfirst - strtr - sprintf - printf - - exec - system - escapeshellcmd - passthru - - soundex - - rand - srand - getrandmax - gethostbyaddr - gethostbyname - explode - implode - error_reporting - clearstatcache - - get_current_user - getmyuid - getmypid -u getmyinode - getlastmod - - base64_decode - base64_encode - - abs - ceil - floor - sin - cos - tan - asin - acos - atan - pi - pow - exp - log - log10 - sqrt - bindec - hexdec - octdec - decbin - decoct - dechex - - getenv - putenv - - time - mktime - date - gmdate - getdate - checkdate - microtime - uniqid - -u linkinfo -u readlink -u symlink -u link -u unlink - - -bcmath_functions - bcadd - bcsub - bcmul - bcdiv - bcmod - bcpow - bcsqrt - bcscale - bccomp - -dir_functions - opendir - closedir - chdir - rewinddir - readdir - dir - -dl_functions - dl(string module_name); dynamicly load a module - -dns_functions - gethostbyaddr - gethostbyname - -file_functions - pclose - popen - readfile - rewind - rmdir - umask - fclose - feof - fgets - fgetss - fopen - fpassthru - fseek - ftell - fputs - mkdir - rename - copy - tempnam - file - -filestat_functions - fileatime - filectime -u filegroup -u fileinode - filemtime -u fileowner - fileperms - filesize - filetype - stat -u chown -u chgrp -u chmod - touch - file_exists - is_executable - is_dir - is_readable - is_writeable -u is_link - -header_functions - setcookie - header - -mail_functions - mail - -reg_functions - ereg - ereg_replace - eregi - eregi_replace - split - sql_regcase - -syslog_functions (writes to event log on win NT) - openlog - syslog - closelog - -The following are optional modules and may or may not be compiled into php, or may be compiled as a loadable module. - -odbc_functions (obsolete, use uodbc below) - sqlconnect - sqldisconnect - sqlfetch - sqlexecdirect - sqlgetdata - sqlfree - sqlrowcount - -uodbc_functions - (int) odbc_autocommit($connection_id, $OnOff) - (void) odbc_close($connection_id) - (void) odbc_close_all(void) - (int) odbc_commit($connection_id) - (int) odbc_connect($dsn, $user, $password) - (int) odbc_pconnect($dsn, $user, $password) - (string) odbc_cursor($result_id) - (int) odbc_do($connection_id, $query_string) - (int) odbc_exec($connection_id, $query_string) - (int) odbc_prepare($connection_id, $query_string) - (int) odbc_execute($result_id, $array) - (int) odbc_fetch_row($result_id, $row_number) - (int) odbc_fetch_into($result_id, $row_number, $array_ptr) - (int) odbc_field_len($result_id, $field_number) - (string) odbc_field_name($result_id, $field_number) - (string) odbc_field_type($result_id, $field) - (int) odbc_free_result($result_id) - (int) odbc_num_fields($result_id) - (int) odbc_num_rows($result_id) - (string) odbc_result($result_id, $field) - (int) odbc_result_all($result_id, $format) - (int) odbc_rollback($connection_id) - -msql_functions - msql_connect - msql_pconnect - msql_close - msql_select_db - msql_create_db - msql_drop_db - msql_query - msql - msql_list_dbs - msql_list_tables - msql_list_fields - msql_result - msql_num_rows - msql_num_fields - msql_fetch_row - msql_fetch_array - msql_fetch_object - msql_data_seek - msql_fetch_field - msql_field_seek - msql_free_result - msql_fieldname - msql_fieldtable - msql_fieldlen - msql_fieldtype - msql_fieldflags - msql_regcase - /* for downwards compatability */ - msql_selectdb - msql_createdb - msql_dropdb - msql_freeresult - msql_numfields - msql_numrows - msql_listdbs - msql_listtables - msql_listfields - msql_dbname - msql_tablename - -ldap_functions - ldap_connect - ldap_bind - ldap_unbind - ldap_read - ldap_list - ldap_search - ldap_free_result - ldap_count_entries - ldap_first_entry - ldap_next_entry - ldap_get_entries - ldap_free_entry - ldap_first_attribute - ldap_next_attribute - ldap_get_attributes - ldap_get_values - ldap_get_dn - ldap_dn2ufn - ldap_add - ldap_delete - ldap_modify - -gd_functions - imagearc - imagechar - imagecharup - imagecolorallocate - imagecolorclosest - imagecolorexact - imagecolortransparent - imagecopyresized - imagecreate - imagecreatefromgif - imagedestroy - imagefill - imagefilledpolygon - imagefilledrectangle - imagefilltoborder - imagegif - imageinterlace - imageline - imagepolygon - imagerectangle - imagesetpixel - imagestring - imagestringup - imagesx - imagesy - -filepro_functions - filepro - filepro_rowcount - filepro_fieldname - filepro_fieldtype - filepro_fieldwidth - filepro_fieldcount - filepro_retrieve - -dbm_functions - dblist - dbmopen - dbmclose - dbminsert - dbmfetch - dbmreplace - dbmexists - dbmdelete - dbmfirstkey - dbmnextkey - -dbase_functions - dbase_open - dbase_create - dbase_close - dbase_numrecords - dbase_numfields - dbase_add_record - dbase_get_record - dbase_delete_record - dbase_pack - -calendar_functions - jdtogregorian - gregoriantojd - jdtojulian - juliantojd - jdtojewish - jewishtojd - jdtofrench - frenchtojd - jddayofweek - jdmonthname - -adabas_functions -(int) ada_afetch($result_id, $rownumber, $result array) -(int) ada_autocommit($connection_id, $OnOff) -(void) ada_close($connection_id) - ada_closeall -(int) ada_commit($connection_id) -(int) ada_connect($dsn, $user, $password) -(int) ada_exec($connection_id, $query_string) -(int) ada_fetchrow($result_id, $row?number) - ada_fieldlen -(string) ada_fieldname($result_id, $field_number) -(string) ada_fieldtype($result_id, $field) -(int) ada_freeresult($result_id) -(int) ada_numfields($result_id) -(int) ada_numrows($result_id) -(string) ada_result($result_id, $field) -(int) ada_resultall($result_id, $format) -(int) ada_rollback($connection_id) -***(int) ada_fieldnum($result_id, $field_name) (this function is not in adabase.c - -crypt_functions - crypt - -mysql_functions - mysql_connect - mysql_pconnect - mysql_close - mysql_select_db - mysql_create_db - mysql_drop_db - mysql_query - mysql - mysql_list_dbs - mysql_list_tables - mysql_list_fields - mysql_affected_rows - mysql_insert_id - mysql_result - mysql_num_rows - mysql_num_fields - mysql_fetch_row - mysql_fetch_array - mysql_fetch_object - mysql_data_seek - mysql_fetch_lengths - mysql_fetch_field - mysql_field_seek - mysql_free_result - mysql_fieldname - mysql_fieldtable - mysql_fieldlen - mysql_fieldtype - mysql_fieldflags - /* for downwards compatability */ - mysql_selectdb - mysql_createdb - mysql_dropdb - mysql_freeresult - mysql_numfields - mysql_numrows - mysql_listdbs - mysql_listtables - mysql_listfields - mysql_dbname - mysql_tablename - -oracle_functions - ora_close - ora_commit - ora_commitoff - ora_commiton - ora_error - ora_errorcode - ora_exec - ora_fetch - ora_getcolumn - ora_logoff - ora_logon - ora_open - ora_parse - ora_rollback - -pgsql_functions - pg_connect - pg_pconnect - pg_close - pg_dbname - pg_errormessage - pg_options - pg_port - pg_tty - pg_host - pg_exec - pg_numrows - pg_numfields - pg_fieldname - pg_fieldsize - pg_fieldtype - pg_fieldnum - pg_result - pg_fieldprtlen - pg_getlastoid - pg_freeresult - pg_locreate - pg_lounlink - pg_loopen - pg_loclose - pg_loread - pg_lowrite - pg_loreadall - -sybase_functions - sybase_connect - sybase_pconnect - sybase_close - sybase_select_db - sybase_query - sybase_free_result - sybase_get_last_message - sybase_num_rows - sybase_num_fields - sybase_fetch_row - sybase_fetch_array - sybase_fetch_object - sybase_data_seek - sybase_fetch_field - sybase_field_seek - sybase_result - -sybase_old_functions - sybsql_seek - sybsql_exit - sybsql_dbuse - sybsql_query - sybsql_isrow - sybsql_result - sybsql_connect - sybsql_nextrow - sybsql_numrows - sybsql_getfield - sybsql_numfields - sybsql_fieldname - sybsql_result_all - sybsql_checkconnect - diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 5311acab3c125..0000000000000 --- a/INSTALL +++ /dev/null @@ -1,188 +0,0 @@ -Installation Instructions for PHP 4.0 -------------------------------------- - -Note! As of 4.0b3, PHP will require GNU make. - -For the impatient here is a quick set of steps that will build PHP as -an Apache module for Apache 1.3.x with MySQL support. A more verbose -explanation follows. - - -QUICK INSTALL - -$ gunzip -c apache_1.3.x.tar.gz | tar xf - -$ cd apache_1.3.x -$ ./configure -$ cd .. - -$ gunzip -c php-4.0.x.tar.gz | tar xf - -$ cd php-4.0.x -$ ./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars -$ make -$ make install - -$ cd ../apache_1.3.x -$ ./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a - (The above line is correct! Yes, we know libphp4.a does not exist at this - stage. It isn't supposed to. It will be created.) -make - (you should now have an httpd binary which you can copy to your Apache bin dir) -cd ../php-4.0.x -cp php.ini-dist /usr/local/lib/php.ini -You can edit /usr/local/lib/php.ini file to set PHP options. -Edit your httpd.conf or srm.conf file and add: - AddType application/x-httpd-php .php - - -VERBOSE INSTALL - -Installing PHP can be done in four simple steps: - -1. Unpack your distribution file. - - You will have downloaded a file named something like php4xn.tar.gz. - Unzip this file with a command like: gunzip php4xn.tar.gz - - Next you have to untar it with: tar -xvf php4xn.tar - - This will create a php-4.0.x directory. cd into this new directory. - -2. Configure PHP. - - You now have to choose the options you would like. There are quite - a few of them. To see a list, type: ./configure --help - - You can also use the supplied 'setup' script, which will ask you - a series of questions and automatically run the configure script - for you. - - The only options that you are likely to want to use are the ones in - the last section entitled, "--enable and --with options recognized:" - - A popular choice is to build the Apache module version. You need - to know where the source code directory for your Apache server is - located. Then use an option like: --with-apache=/usr/local/src/apache - if that is your Apache source code directory. If you only specify - --with-apache, then it will default to look for your Apache source - in /usr/local/etc/httpd. - - NOTE: The directory you specify should be the top-level of the - unpacked Apache (or Stronghold) distribution. The configure program - will automatically look for httpd.h in different directories under that - location depending on which version of Apache, including Stronghold, - you are running. - - For MySQL support, since newer versions of MySQL installs its various - components under /usr/local, this is the default. If you have - changed the location you can specify it with: --with-mysql=/opt/local - for example. Otherwise just use: --with-mysql - - *NOTE* If you are using Apache 1.3b6 or later, you should run the - Apache Configure script at least once before compiling PHP. It - doesn't matter how you have Apache configured at this point. - -3. Compile and install the files. Simply type: make install - - For the Apache module version this will copy the appropriate files - to the src/modules/php4 directory in your Apache distribution if - you are using Apache 1.3.x. If you are still running Apache 1.2.x - these files will be copied directly to the main src directory. - - For Apache 1.3b6 and later, you can use the new APACI configuration - mechanism. To automatically build Apache with PHP support, use: - - cd apache_1.3.x - ./configure --prefix=//apache \ - --activate-module=src/modules/php4/libphp4.a - make - make install - - If you do not wish to use this new configuration tool, the old - install procedure (src/Configure) will work fine. - - If you are using the old Apache ./Configure script, you will have to - edit the Apache src/Configuration file manually. If you do not have - this file, copy Configuration.tmpl to Configuration. - - For Apache 1.3.x add: - - AddModule modules/php4/libphp4.a - - For Apache 1.3.x don't do anything else. Just add this line and then - run "./Configure" followed by "make". - - For Apache 1.2.x add: - - Module php4_module mod_php4.o - - For Apache 1.2.x you will also have to look in the libphp4.module file, - which was copied to the src directory. The EXTRA_LIBS line in the Apache - Configuration file needs to be set to use the same libs as specified on - the LIBS line in libphp4.module. You also need to make sure to add - "-L." to the beginning of the EXTRA_LIBS line. - - So, as an example, your EXTRA_LIBS line might look like: - - EXTRA_LIBS=-L. -lphp4 -lgdbm -ldb -L/usr/local/mysql/lib -lmysqlclient - - NOTE: You should not enclose the EXTRA_LIBS line in double-quotes, as it - is in the libphp4.module file. - - Also, look at the RULE_WANTHSREGEX setting in the libphp4.module file - and set the WANTHSREGEX directive accordingly in your Configuration file. - This last step applies to versions of Apache prior to 1.3b3. - - This is a bit of a hassle, but should serve as incentive to move to - Apache 1.3.x where this step has been eliminated. - - Once you are satisfied with your Configuration settings, type: ./Configure - If you get errors, chances are that you forgot a library or made a typo - somewhere. Re-edit Configuration and try again. If it goes well, - type: make - -4. Setting up the server. - - You should now have a new httpd binary. Shut down your existing server, - if you have one, and copy this new binary overtop of it. Perhaps make - a backup of your previous one first. Then edit your conf/srm.conf file - and add the line: - - AddType application/x-httpd-php .php - - There is also an interesting feature which can be quite instructive and - helpful while debugging. That is the option of having colour syntax - highlighting. To enable this, add the following line: - - AddType application/x-httpd-php-source .phps - - Any file ending in .phps will now be displayed with full colour syntax - highlighting instead of being executed. - - When you are finished making changes to your srm.conf file, you can - start up your server. - -USING PHP3 AND PHP4 AS CONCURRENT APACHE MODULES - - Recent operating systems provide the ability to perform versioning and - scoping. This features make it possible to let PHP3 and PHP4 run as - concurrent modules in one Apache server. - - This feature is known to work on the following platforms: - - - Linux with recent binutils (binutils 2.9.1.0.25 tested) - - Solaris 2.5 or better - - FreeBSD (3.2, 4.0 tested) - - To enable it, configure PHP3 and PHP4 to use APXS (--with-apxs) and the - necessary link extensions (--enable-versioning). Otherwise, all standard - installations instructions apply. For example: - - $ ./configure \ - --with-apxs=/apache/bin/apxs \ - --enable-versioning \ - --with-mysql \ - --enable-track-vars - - If this also works on your platform or if you know a way to do it, please - report it to our bug database at http://bugs.php.net - diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 537c22acbbbf0..0000000000000 --- a/LICENSE +++ /dev/null @@ -1,70 +0,0 @@ --------------------------------------------------------------------- - The PHP License, version 2.01 -Copyright (c) 1999 The PHP Group. All rights reserved. --------------------------------------------------------------------- - -Redistribution and use in source and binary forms, with or without -modification, is 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 "PHP" must not be used to endorse or promote products - derived from this software without prior permission from the - PHP Group. This does not apply to add-on libraries or tools - that work in conjunction with PHP. In such a case the PHP - name may be used to indicate that the product supports PHP. - - 4. The PHP Group may publish revised and/or new versions of the - license from time to time. Each version will be given a - distinguishing version number. - Once covered code has been published under a particular version - of the license, you may always continue to use it under the - terms of that version. You may also choose to use such covered - code under the terms of any subsequent version of the license - published by the PHP Group. No one other than the PHP Group has - the right to modify the terms applicable to covered code created - under this License. - - 5. Redistributions of any form whatsoever must retain the following - acknowledgment: - "This product includes PHP, freely available from - http://www.php.net/". - - 6. Permission to freely distribute and use Zend as an integrated - part of PHP is granted, under the conditions of version 0.91 - of the Zend License. - The license is bundled with the Zend engine, and is available - at http://www.zend.com/license/0_91.txt, or by contacting - license@zend.com. - - - -THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``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 PHP -DEVELOPMENT TEAM 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 PHP Group. - -The PHP Group can be contacted via Email at group@php.net. - -For more information on the PHP Group and the PHP project, -please see . diff --git a/MAINTAINERS b/MAINTAINERS deleted file mode 100644 index 912cb1c848327..0000000000000 --- a/MAINTAINERS +++ /dev/null @@ -1,97 +0,0 @@ - List of PHP maintainers - ======================= - -Status legend -------------- - Supported: Someone is actually paid to look after this. - Maintained: Someone actually looks after it. - Odd Fixes: It has a maintainer but they don't have time to do - much other than throw the odd patch in. See below.. - Orphan: No current maintainer [but maybe you could take the - role as you write your new code]. - Obsolete: Old code. Something tagged obsolete generally means - it has been replaced by a better system and you - should be using that. - --------------------------------------------------------------------------------- -EXTENSION: apache -PRIMARY MAINTAINER: Rasmus Lerdorf -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: dba -PRIMARY MAINTAINER: Sascha Schumann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: fdf -PRIMARY MAINTAINER: Uwe Steinmann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: gd -PRIMARY MAINTAINER: Rasmus Lerdorf -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: hyperwave -PRIMARY MAINTAINER: Uwe Steinmann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: informix -PRIMARY MAINTAINER: Danny Heijl -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: java -PRIMARY MAINTAINER: Sam Ruby -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: ldap -PRIMARY MAINTAINER: Rasmus Lerdorf -STATUS: Odd Fixes --------------------------------------------------------------------------------- -EXTENSION: mcrypt -PRIMARY MAINTAINER: Sascha Schumann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: mhash -PRIMARY MAINTAINER: Sascha Schumann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: mssql -PRIMARY MAINTAINER: Frank M. Kromann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: oci8 -PRIMARY MAINTAINER: Thies C. Arntzen -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: oracle -PRIMARY MAINTAINER: Thies C. Arntzen -STATUS: Maintained -COMMENT: Using the new OCI8 driver is encouraged where possible. --------------------------------------------------------------------------------- -EXTENSION: pcre -PRIMARY MAINTAINER: Andrei Zmievski -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: pdf -PRIMARY MAINTAINER: Uwe Steinmann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: session -PRIMARY MAINTAINER: Sascha Schumann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: snmp -PRIMARY MAINTAINER: Rasmus Lerdorf -STATUS: Odd Fixes --------------------------------------------------------------------------------- -EXTENSION: wddx -PRIMARY MAINTAINER: Andrei Zmievski -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: xml -PRIMARY MAINTAINER: Thies C. Arntzen -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: zlib -PRIMARY MAINTAINER: Stefan Roehrich -STATUS: Maintained --------------------------------------------------------------------------------- diff --git a/MODULES_STATUS b/MODULES_STATUS deleted file mode 100644 index 8c49b2116fc7e..0000000000000 --- a/MODULES_STATUS +++ /dev/null @@ -1,20 +0,0 @@ -Module Status ------- ------ -MySQL Working -COM Working -WDDX Working -PCRE Working -DBA Working -mcrypt Working -mhash Working -dbase Working -aspell Working -imap Working -ldap Working -oci8 Working (but no blob-support yet) -oracle Working -iptc Working -informix Working -zlib Working -sysvshm Working -odbc Working (except for persistent connections) diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index d57126e23641c..0000000000000 --- a/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -AUTOMAKE_OPTIONS = foreign - -ZEND_DIR = $(srcdir)/libzend -SUBDIRS = libzend ext sapi $(TSRM_DIR) $(REGEX_DIR) - -BUILDLDFLAGS = $(EXTRA_LDFLAGS) $(LDFLAGS) - -phptemp_LTLIBRARIES = libphp4.la -libphp4_la_SOURCES = \ - main.c internal_functions.c snprintf.c php3_sprintf.c \ - configuration-parser.y configuration-scanner.l request_info.c \ - safe_mode.c fopen-wrappers.c php3_realpath.c alloca.c \ - php_ini.c SAPI.c rfc1867.c dlist.c php_content_types.c strlcpy.c \ - strlcat.c mergesort.c - -libphp4_la_DEPENDENCIES = \ - libzend/libzend.la \ - sapi/$(PHP_SAPI)/libphpsapi_$(PHP_SAPI).la \ - $(REGEX_LIB) \ - $(EXT_LTLIBS) \ - $(TSRM_LIB) - -libphp4_la_LIBADD = $(libphp4_la_DEPENDENCIES) $(EXTRA_LIBS) - -libphp4_la_LDFLAGS = $(BUILDLDFLAGS) $(PHP_RPATHS) - -configuration-parser.h configuration-parser.c: configuration-parser.y - $(YACC) -p cfg -v -d $< -o configuration-parser.c - -configuration-scanner.c: configuration-scanner.l - $(LEX) -Pcfg -o$@ -i $< - -EXTRA_PROGRAMS = php - -noinst_PROGRAMS = $(PHP_PROGRAM) -php_SOURCES = stub.c -php_LDADD = libphp4.la -php_LDFLAGS = -export-dynamic - -install-data-local: - $(INSTALL_IT) diff --git a/NEWS b/NEWS deleted file mode 100644 index 73532da5c6d0b..0000000000000 --- a/NEWS +++ /dev/null @@ -1,309 +0,0 @@ -PHP 4.0 NEWS -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| - -?? ?? ????, Version 4.0 Beta 4 -- Added Berkeley DB3 support in DBA (Sascha) -- Implemented 2-Arg version of strtr($str,$translation_array). This can be used - to revert what htmlspecialchars() did. (Thies) -- Fixed mem-overwrite in XML_Parse_Into_Struct. (Thies) -- Added substr_replace() function. (Andrei) - -November 16 1999, Version 4.0 Beta 3 -- ucfirst()/ucwords() no longer modify arg1. (Thies) -- Fixed strtr() not to modify arg1. (Thies) -- Added Win32 build files for Informix driver and make it - compile with ZTS (danny) -- Added tmpfile() function (Stig) -- Upgraded regex library to alpha3.8 (Sascha) -- Fixed selecting nested-tables in OCI8. (Thies) -- RFC-854 fix for internal FTP-Code. Commands have to end in "\r\n" (Thies) -- Fix OpenLink ODBC support (Stig) -- min(),max(),a[r]sort(),[r]sort(),k[r]sort() now work consistent with the - language-core. (Thies) -- tempnam() now uses mkstemp() if available (Stig) -- serialize() and var_dump() now honor the precision as set in php.ini - for doubles. (Thies) -- Improved the Win32 COM module to support [out] parameters (Boris Wedl) -- Fixed garbage returned at the end of certain Sybase-Columns (Thies) - Patch submitted by: neal@wanlink.com -- Added Microsoft SQL Server module for Win32 (Frank) -- Added support for forcing a variable number of internal function arguments - by reference. (Andi & Zeev, Zend library) -- Implemented getprotoby{name,number} (Evan) -- Added array_pad() function. (Andrei) -- Added new getservby{name,port} functions. (Evan) -- Added session.cookie_path and session.cookie_domain (Sascha) -- Continue processing PHP_INI_SYSTEM knownDirectives after extension= - (Sam Ruby) -- Enable IBM DB2 support - Tested against DB2 6.1 UDB on Linux (Rasmus) -- Added new str_repeat() function. (Andrei) -- Output-Buffering system is now Thread-Safe. (Thies) -- implemented OCI8 $lob->WriteToFile() function - very useful for streaming - large amounts of LOB-Data without to need of a huge buffer. (Thies) -- Added session.use_cookies option (Sascha) -- Added getcwd() function. (Thies) -- XML_Parse_Into_Struct no longer eats data. (Thies) -- Fixed parse_url('-') crash. (Thies) -- added === operator support. (Andi & Thies, Zend library) -- unserialize() now gives a notice when passed invalid data. (Thies) -- Fixed shuffle() so that it no longer breaks on Solaris. (Andrei) -- Added is_resource(), is_bool() functions. (Thies) -- Cleaned up File-Module (Thies) -- Upgraded math-funtions to use new Zend function API (Thies) -- Fixed zombie problem in shell_exec() and $a = `some_command` - constructs. (Thies) -- Thies introduced ZEND_FETCH_RESOURCE2 (Danny). -- Added Informix driver to list of maintained extensions. (Danny). -- Informix driver : Changed ifx.ec to use the new high-performance - ZEND API. (Danny) -- IXF_LIBDIR environment variable specifies alternate Informix library - path for configure (Danny). -- Fixed gmmktime() so that the following should always be true: - gmmktime([args]) == mktime([args]) + date('Z', mktime([args])) (Jouni) -- setlocale doesn't anymore screw up things if you forgot to change it back - to the original settings. (Jouni) -- Switched to new system where ChangeLog is automagically updated from commit - messages. NEWS file is now the place for public announcements. (Andrei) -- Fixed refcount problem in XML module. (Thies) -- Fixed crash in HTTP_RAW_POST_DATA handling (Thies) -- You can use resources as array-indices again (Thies, Zend library) -- Fixed pg_fetch_array() with three arguments (Sascha) - Patch submitted by: brian@soda.berkeley.edu -- Upgraded a lot internal functions to use new Zend function API (Thies) -- fdf support ported; not completely tested with latest version 4.0 for - glibc (Uwe) -- OCI8 connections are now kept open as long as they are referenced (Thies) -- Cleaned up Directory-Module (Thies) -- Small fix in Ora_Close (Thies) -- Ported range() and shuffle() from PHP3 to PHP4 (Andrei) -- Fixed header("HTTP/..."); behaviour (Sascha) -- Improved UNIX build system. Now utilizes libtool (Sascha) -- Upgrade some more internal functions to use new Zend function API. (Thies, - Zend library) -- Fixed backwards incompatibility with ereg() (Thies) -- Updated Zend garbage collection with a much more thorough method. - (Andi, Zend library) -- Added the ability to use variable references in the array() construct. - For example, array("foo" => &$foo). (Andi, Zend library) -- Added array_reverse() function (Andrei) -- Some more XML fixes/cleanups (Thies) -- Updated preg_replace() so that if any argument passed in is an array - it will make a copy of each entry before converting it to string so that - the original is intact. If the subject is an array then it will preserve - the keys in the output as well (Andrei) -- Updated OCI8 to use the new high-performance Zend function API. (Thies) -- Configure speedup (Stig) -- Fixed LOB/Persistent-Connection related OCI8-Crash (Thies) -- Generalized server-API build procedure on UNIX (Stig) -- Added '--disable-rpath' option (Sascha) -- Added AOLserver SAPI module (Sascha) -- Fixed XML Callbacks. (Thies) -- Updated ODBC to use the new high-performance Zend function API (kara) -- Updated zlib to use the new high-performance Zend function API. (Stefan) -- Updated preg_split() to allow returning only non-empty pieces (Andrei) -- Updated PCRE to use the new high-performance Zend function API (Andrei) -- Updated session, dba, mhash, mcrypt, sysvshm, sysvsem, gettext modules to use - the new high-performance Zend function API (Sascha) -- Extended var_dump to handle resource type somewhat (Andrei) -- Updated WDDX to use the new high-performance Zend function API (Andrei) -- Updated XML to use the new high-performance Zend function API. (Thies) -- Updated Oracle to use the new high-performance Zend function API. (Thies) -- Improved the performance of the MySQL module significantly by using the new - high-performance Zend function API. (Zeev) -- Add support for the Easysoft ODBC-ODCB Bridge (martin@easysoft.com) -- Fix bug in odbc_setoption, getParameter call incorrect (martin@easysoft.com) -- Ora_Fetch_Into now resets the returned array in all cases (Thies) -- Fixed NULL-Column problem in Oracle-Driver (Thies) -- Added extra metadata functions to ODBC, SQLTables etc (nick@easysoft.com) -- Fixed SEGV in mcal make_event_object() and - typo in mcal_list_alarms() (Andrew Skalski) -- Fixed Ora_PLogon (Thies) -- Resourcified Oracle (Thies) -- Implemented object serialization/deserialization in WDDX (Andrei) -- Added krsort() function (Thies) -- Added func_num_args(), func_get_arg() and func_get_args() for standard - access to variable number of arguments functions (Zeev) -- Added FTP support (Andrew Skalski) -- Added optional allowable_tags arguments to strip_tags(), gzgetss() and - fgetss() to allow you to specify a string of tags that are not to be - stripped (Rasmus) -- Upgraded var_dump() to take multiple arguments (Andrei) -- Resourcified XML (Thies) -- Fixed a memory leak in the Apache per-directory directives handler (Zeev) -- Added array_count_values() function. (Thies) -- snmp, pgsql, mysql and gd modules can be built as dynamically loaded - modules (Greg) -- OCI8 fix for fetching empty LOBs (Thies) -- Added user-level callbacks for session module (Sascha) -- Added support for unknown POST content types (Zeev) -- Added "wddx" serialization handler for session module (Sascha) - (automatically enabled, if you compile with --with-wddx) -- Fixed unserializing objects (Thies) -- PHP 4.0 now serializes Objects as 'O' (not understood by PHP 3.0), but - unserializes PHP 3.0 serialized objects as expected. (Thies) -- Made serialize/unserialize work on classes. If the class is known at - unserialize() time, you'll get back a fully working object! (Thies) -- Reworked preg_* functions according to the new PCRE API, which also made - them behave much more like Perl ones (Andrei) -- Made it possible to specify external location of PCRE library (Andrei) -- Updated bundled PCRE library to version 2.08 (Andrei) -- count()/is_array/is_object... speedups. (Thies) -- OCI8 supports appending and positioning when saving LOBs (Thies) -- Added metaphone support (Thies) -- OCI8 doesn't use define callbacks any longer. (Thies) -- OCI8 Driver now supports LOBs like PHP 3.0. (Thies) -- var_dump now dumps the properties of an object (Thies) -- Rewrote the GET/POST/Cookie data reader to support multi-dimensional - arrays! (Zeev) -- Renamed allow_builtin_links to expose_php (defaults to On). This directive - tells PHP whether it may expose its existence to the outside world, e.g. - by adding itself to the Web server header (Zeev) -- Added support for transparent session id propagation (Sascha) -- Made WDDX serialize object properties properly (Andrei) -- Fixed WDDX mem leak when undefined variable is passed in - for serialization (Andrei) -- Added session_unset() function (Andrei) -- Fixed double session globals shutdown crash (Andrei) -- Fixed crash related to ignore_user_abort ini entry (Andrei) -- Added support for external entropy sources for session id creation - (on Unices /dev/random and /dev/urandom) (Sascha) -- Added gpc_globals variable directive to php.ini. By default it is On, but - if it is set to Off, GET, POST and Cookie variables will not be inserted - to the global scope. Mostly makes sense when coupled with track_vars (Zeev) -- Added versioning support for shared library (Sascha) - This allows concurrent use of PHP 3.0 and PHP 4.0 as Apache modules. See - the end of the INSTALL file for more information. -- Added second parameter to array_keys which specifies search value - for which the key should be returned (Andrei) -- Resourcified Informix driver (Danny) -- New resource handling for odbc, renamed to php_odbc.[ch] -- Make set_time_limit() work on Unix (Rasmus) -- Added connection handling support (Rasmus) -- Improved the Sybase-CT module to make use of resources (Zeev) -- Improved the mSQL module to make use of resources (Zeev) -- Changed mysql_query() and mysql_db_query() to return false in case of saving - the result set data fails (Zeev) -- Improved the resource mechanism - resources were not getting freed as soon - as they could (Zeev) -- Added shared memory module for session data storage (Sascha) -- Fixed session.auto_start (Sascha) -- Fixed several problems with output buffering and HEAD requests (Zeev) -- Fixed HTTP Status code issue with ISAPI module (Zeev) -- Fixed a problem that prevented $GLOBALS from working properly (Zeev, Zend - library) -- Ported newest GetImageSize (Thies) -- Added session compile support in Win32 (Andi) -- Added -d switch to the CGI binary that allows overriding php.ini values - from the command line (Zeev) -- Fixed a crash that would occur if wddx_deserialize did not receive - a valid packet (Andrei) -- Fixed a bugglet when redefining a class at run-time (Andi, Zend library) -- Fixed sem_get() on AIX (Sascha) -- Fixed fopen() to work with URL's in Win32 (Andi & Zeev) -- Fixed include_path for Win32 (Andi, Zend library) -- Fixed bug in ISAPI header sending function (Charles) -- Fixed memory leak when using undefined values (Andi & Zeev, Zend library) -- Added output_buffering directive to php.ini, to enable output buffering - for all PHP scripts - default is off (Zeev). -- Fixed some more class inheritance issues (Zeev, Zend library) -- Fixed Apache build wrt to shared modules on FreeBSD/Linux (Sascha) -- Added session.extern_referer_chk which checks whether session ids were - referred to by an external site and eliminates them (Sascha) -- Improved session id generation (Sascha) -- Improved speed of uniqid() by using the combined LCG and removing - the extra usleep() (Sascha) -- Introduced general combined linear congruential generator (Sascha) -- Made ldap_close back into an alias for ldap_unbind (Andrei) -- OciFetchInto now resets the returned array in all cases (Thies) -- Fixed mysql_errno() to work with recent versions of MySQL (Zeev) -- Fixed a problem with define() and boolean values (Zeev) -- Fixed inclusion of gd/freetype functions (Sascha) -- Fixed persistency of MHASH_* constants (Sascha) -- Oracle is now ZTS-Safe (Thies) -- Fixed flushing of cached information to disk in DBA's DB2 module (Sascha) -- OCI8 is now ZTS-Safe (Thies) -- Fixed is_writeable/is_writable problem; they are both defined now (Andrei) -- Imported PHP 3.0 diskfreespace() function (Thies) -- Fixed thread-safety issues in the MySQL module (Zeev) -- Fixed thread-safe support for dynamic modules (Zeev) -- Fixed Sybase CT build process (Zeev) - -August 9 1999, Version 4.0 Beta 2 -- Fixed a problem when sending HTTP/1.x header lines using header() (Zeev) -- Win32 builds now include the ODBC module built-in (Zeev) -- Fixed SYSV-SHM interface (Thies). -- Updated hyperwave module, made it thread safe -- Updated pdflib module, version 0.6 of pdflib no longer supported -- Updated fdf module -- Built-in phpinfo() links are now turned off by default. They can be turned - on using the allow_builtin_links INI directive (Zeev) -- Changed phpinfo() to list modules that have no info function (Zeev) -- Modified array_walk() function so that the userland callback is passed - a key and possible user data in addition to the value (Andrei) -- Fixed ldap_search(), ldap_read() and ldap_list() (Zeev) -- Fixed Apache information in phpinfo() (sam@breakfree.com) -- Improved register_shutdown_function() - you may now supply arguments that - will be passed to the shutdown function (Zeev) -- Improved call_user_func() and call_user_method() - they now support passing - arguments by reference (Zeev) -- Fixed usort() and uksort() (Zeev) -- Fixed md5() in the Apache module (Thies) -- Introduced build process for dynamic modules (Stig) -- Improved ISAPI module to supprt large server variables (Zeev) -- Imported PHP 3.0 fixes for problem with PHP as a dynamic module and Redhat - libc2.1 in zlib module (Stefan) -- Fixed sybase_fetch_object() (Zeev) -- Made the IMAP module work with PHP 4.0 (Zeev) -- Fixed a problem with include()/require() of URLs (Sascha, Zeev) -- Fixed a bug in implode() that caused it to corrupt its arguments (Zeev) -- Added get_class($obj), get_parent_class($obj) and method_exists($obj,"name") - (Andi & Zeev) -- Fixed various inheritance problems (Andi & Zeev, Zend library) -- Children now inherit their parent's constructor, if they do not supply a - constructor of their own. -- Fixed runtime inheritance of classes (parent methods/properties were - overriding their children) (Zeev, Zend library) -- Fixed backwards incompatibility with the "new" operator (Andi, Zend library) -- Fixed bugs in uksort() and ksort() sort ordering (Andrei) -- Fixed a memory leak when using assignment-op operators with lvalue of type - string (Zeev, Zend library) -- Fixed a problem in inheritance from classes that are defined in include()d - files (Zeev, Zend library) -- Fixed a problem with the PHP error handler that could result in a crash - on certain operating systems (Zeev) -- Apache php_flag values only recognized 'On' (case sensitive) - changed - to case insensitive (Zeev) -- Fixed a memory leak with switch statement containing return statements - (Andi & Zeev, Zend library) -- Fixed a crash problem in switch statements that had a string offset - as a conditional (Andi & Zeev, Zend library) -- Imported PHP 3.0 fixes for rand() and mt_rand() (Rasmus) -- Added function entries for strip_tags() and similar_text() (Andrei) -- Fixed a bug in WDDX that would cause a crash if a number was passed in - instead of a variable name (Andrei) -- Ported strtotime() function from PHP 3.0 (Andrei) -- Merged in gdttf stuff from PHP 3.0 (Sascha) -- buildconf now checks your installation (Stig) -- XML module now built dynamically with --with-xml=shared (Stig) -- Added a check for freetype.h - fixed build on RedHat 6.0 (Zeev) -- Fixed array_walk() to work in PHP 4.0 (Andrei) -- Ported all remaining date() format options from PHP 3.0 (Andrei) -- $php_errormsg now works (Andrei) -- Added locale support for Perl Compatible Regexp functions (Andrei) -- Informix module ported (Danny) -- Removed --with-shared-apache (Sascha) -- Added patch for reverse lookup table in base64_decode (Sascha) - Submitted by bfranklin@dct.com -- Merged in PHP 3.0 version of str_replace (Sascha) -- Added DBA module (Sascha) -- Added session id detection within REQUEST_URI (Sascha) -- Merged in HP-UX/ANSI compatibility switch from PHP 3.0 (Sascha) -- Fixed rpath handling for utilitites built during Apache build (Sascha) -- Added missing E_ error level constants (Zeev, Zend library) -- Fixed a bug in sending multiple HTTP Cookies under Apache (Zeev) -- Fixed implicit connect on the MySQL, mSQL, PostgreSQL and Sybase - modules (Zeev) -- Gave PHP 4.0's SNMP extension all the functionality of PHP 3.0.12 (SteveL) - -July 19 1999, Version 4.0 Beta 1 -- First public beta of PHP 4.0 diff --git a/README-BCMATH b/README-BCMATH deleted file mode 100644 index 7d5bac19a6196..0000000000000 --- a/README-BCMATH +++ /dev/null @@ -1,17 +0,0 @@ -How to install PHP with the BCMath arbitrary precision math library? --------------------------------------------------------------------- - -Due to license restrictions, the BC math library can no longer be distributed -along with PHP. The BC math library is distributed under the restrictive -GNU Public License, and PHP is no longer distributed under that license, but -under a less restrictive license, the PHP License. - -If you want to enable BC math support (recommended), all you have to do is -simply download http://www.php.net/extra/number4.tar.gz, and untar it on the -top level php4 directory. - -A typical way of doing this would be (assuming that you have lynx): -cd ~/php4 -lynx -dump -source http://www.php.net/extra/number4.tar.gz | gzip -d | tar xvf - - -The PHP Group diff --git a/README.CVS-RULES b/README.CVS-RULES deleted file mode 100644 index e865b470a7508..0000000000000 --- a/README.CVS-RULES +++ /dev/null @@ -1,102 +0,0 @@ -This is the first file you should be reading after you get your CVS account. -We'll assume you're basically familiar with CVS, but feel free to post -your questions on the mailing list. - -PHP is developed through the efforts of a large number of people. -Collaboration is a Good Thing(tm), and CVS lets us do this. Thus, following -some basic rules with regards to CVS usage will: - - a. Make everybody happier, especially those responsible for maintaining - the CVS itself. - b. Keep the changes consistently well documented and easily trackable. - c. Prevent some of those 'Oops' moments. - d. Increase the general level of good will on planet Earth. - - -Having said that, here are the organizational rules: - - 1. Respect other people working on the project. - - 2. Discuss any significant changes on the list before committing. - - 3. Look at MAINTANERS file to see who is the primary maintainer of - the code you want to contribute to. - - 4. If you "strongly disagree" about something another person did, don't - start fighting publicly - take it up in private email. - - 5. If you don't know how to do something, ask first! - - 6. Test your changes before committing them. We mean it. Really. - - -The next few rules are more of a technical nature. - - 1. DO NOT TOUCH ChangeLog! It is automagically updated from the commit - messages every day. Woe be to those who attempt to mess with it. - - 2. All news updates intended for public viewing, such as new features, - bug fixes, improvements, etc., should go into the NEWS file. Also see - the note below about automatically updating NEWS in your commit message. - - 3. Do not commit multiple file and dump all messages in one commit. If you - modified several unrelated files, commit each group separately and - provide a nice commit message for each one. See example below. - - 4. Do write your commit message in such a way that it makes sense even - without the corresponding diff. One should be able to look at it, and - immediately know what was modified. Definitely include the function name - in the message as shown below. - - 5. In your commit messages, keep each line shorter than 80 characters. And - try to align your lines vertically, if they wrap. It looks bad otherwise. - - 6. If you modified a function that is callable from PHP, prepend PHP to - the function name as shown below. - - -The format of the commit messages is pretty simple. - -If a line begins with #, it is taken to be a comment and will not appear -in the ChangeLog. If the line begins with @, it will be redirected to the -NEWS file. Everything else goes into the ChangeLog. - -It is important to note that if your comment or news logline spans multiple -lines, you have to put # or @ at the beginning of _every_ such line. - -Example. Say you modified two files, datetime.c and string.c. In datetime.c -you added a new format option for date() function, and in string.c you fixed -a memory leak in php_trim(). Don't commit both of these at once. Commit them -separately and try to make sure your commit messages look something like the -following. - -For datetime.c: - -(PHP date) Added new 'K' format modifier for printing out number of - days until New Year's Eve. -@- Added new 'K' format modifier that will output the number of days -@ until New Year's Eve. (Bob) - -For string.c: -(php_trim) Fixed a memory leak resulting from improper use of zval_dtor(). -# Man, that thing was leaking all over the place! -@- Memory leak in trim() function has finally been fixed. (Bob) - -The lines above marked with @ will go into NEWS file automagically, and the -# lines will be omitted from the ChangeLog. Alternatively, you might want -to modify NEWS file directly and not use the @ lines. - -If you don't see your messages in ChangeLog and NEWS right away, don't worry! -These files are updated once a day, so your stuff will not show up until -somewhat later. Don't go adding stuff to NEWS by hand if you already put @ -lines in the commit message. - -You can use LXR (http://lxr.php.net/) and Bonsai (http://bonsai.php.net/) -to look at PHP CVS repository in various ways. - -To receive daily updates to ChangeLog and NEWS, send an empty message to -php-cvs-daily-subscribe@lists.php.net. - -Happy hacking, - -PHP Team diff --git a/README.QNX b/README.QNX deleted file mode 100644 index d70d2e5d8b62f..0000000000000 --- a/README.QNX +++ /dev/null @@ -1,57 +0,0 @@ -QNX4 Installation Notes ------------------------ - -NOTE: General installation instructions are in the INSTALL file - - -1. To compile and test PHP3 you have to grab, compile and install: - - GNU dbm library or another db library; - - GNU bison (1.25 or later; 1.25 tested); - - GNU flex (any version supporting -o and -P options; 2.5.4 tested); - - GNU diffutils (any version supporting -w option; 2.7 tested); - -2. To use CVS version you may need also: - - GNU CVS (1.9 tested); - - GNU autoconf (2.12 tested); - - GNU m4 (1.3 or later preferable; 1.4 tested); - -3. To run configure define -lunix in command line: - LDFLAGS=-lunix ./configure - -4. To use Sybase SQL Anywhere define ODBC_QNX and CUSTOM_ODBC_LIBS in - command line and run configure with --with-custom-odbc: - CFLAGS=-DODBC_QNX LDFLAGS=-lunix CUSTOM_ODBC_LIBS="-ldblib -lodbc" ./configure --with-custom-odbc=/usr/lib/sqlany50 - If you have SQL Anywhere version 5.5.00, then you have to add - CFLAGS=-DSQLANY_BUG - to workaround its SQLFreeEnv() bug. Other versions has not been tested, - so try without this flag first. - -5. To build the Apache module, you may have to hardcode an include path for - alloc.h in your Apache base directory: - - APACHE_DIRECTORY/src/httpd.h: - change #include "alloc.h" - to #include "APACHE_DIRECTORY/src/alloc.h" - Unless you want to use system regex library, you have to hardcode also - a path to regex.h: - - APACHE_DIRECTORY/src/conf.h: - change #include - to #include "APACHE_DIRECTORY/src/regex/regex.h" - I don't know so far why this required for QNX, may be it is Watcom - compiler problem. - - If you building Apache module with SQL Anywhere support, you'll get - symbol conflict with BOOL. It is defined in Apache (httpd.h) and in - SQL Anywhere (odbc.h). This has nothing to do with PHP, so you have to - fix it yourself someway. - -6. With above precautions, it should compile as is and pass regression - tests completely: - make - make check - make install - - Don't bother me unless you really sure you made that all but it - still doesn't work. - -June 28, 1998 -Igor Kovalenko -- owl@infomarket.ru diff --git a/TODO b/TODO deleted file mode 100644 index 5f52c65359bba..0000000000000 --- a/TODO +++ /dev/null @@ -1,7 +0,0 @@ -Things to do or at least think about doing in the future. Name in -parenthesis means that person has taken on this project. - -ext/standard ------------- - * strpad() (Andrei) - * advanced sort (Andrei) diff --git a/TODO-LeftOver b/TODO-LeftOver deleted file mode 100644 index 17b9223544aec..0000000000000 --- a/TODO-LeftOver +++ /dev/null @@ -1,75 +0,0 @@ - - -This is the ChangeLog from PHP3 as of Apr 12 1999. - -Entries should be removed from this file, if you transfer changes -over to PHP4. - -============================================================================ - -?? 1999, Version 3.0.8 -- added Oracle-OCI8 persistent connections -- fixed OCIDefineByName crash. -- fixed some NULL-column related problems in OCI8-module. -- Some Informix driver improvements. -- PUT method support (mlemos@acm.org) -- Fix parameter count problem in odbc_setoption() -- Really fix implode() this time. The fix in 3.0.7 was bogus -- Make fgetss() slightly smarter -- Add strip_tags() which uses the fgetss state-machine but acts on a string - -March 1 1999, Version 3.0.7 -- Added pdf_put_image and pdf_execute_image -- Initial work on an ImageMagick module - doesn't do anything yet -- Make configure script detect Netscape's LDAP SDK automagically -- Fixed Oracle-OCI8 module for windows. -- Add OCIRowCount function. (Number of affected rows for update-statements) -- Add OCIDefineByName function. -- Change the behaviour of open_basedir. It's now possible to supply more - than one directory. open_basedir paths from parent directories are now - automatically inherited. -- fix rand() and mt_rand() to make the ranges work correctly -- htmlspecialchars() and htmlentities() are now binary safe. -- Add extract() function. -- Oracle-OCI8 driver now supports BLOBS/CLOBS and IN/OUT binding of local php - variables. -- Clean up apxs build -- Add INSTALL.REDHAT file to walk RedHat users through the install -- Add function_exists() function. -- Add another version of WDDX module - (we need to pick a single implementation here) -- Fixed includes for iODBC to support both the old and the new LGPL version -- Fix implode() bug - When imploding an array that contained unset() elements - it wasn't correctly skipping past these -- Add connection_status() function. This returns the raw bitfield which - indicates whether the script terminated due to a user abort, a timeout - or normally. Note that if ignore_user_abort is enabled, then both the - timeout state and the user abort state can be active -- Add connection_timeout() function. This one can be called in a shutdown - function to tell you if you got there because of a timeout -- Add ignore_user_abort() function and .ini/.conf directive of same name -- Fix connection abort detection code - It should now work reliably with - Apache. Also added a user-level connection_aborted() function designed to - let people check whether the user aborted the connection in a user-level - shutdown function. -- Add pfsockopen() function -- Improvements in FreeType support: Macintosh fonts work, and non-antialiased - output is considerably cleaner -- Fixed checkdate() function, range of valid years is now 0 to 32767 -- hw_insertdocument() returns object id now -- Add pdf_open() warning in configure and documentation -- Add diskfreespace() function -- Added aspell support -- Iptcparse would sometimes find a wrong tag. -- Force var_dump() to output headers -- Add optional 3th parameter to ora_fetchinto. -- Serialize and var_dump no longer show array elements that - have been unset. -- Add IptcEmbed() function (can replace an APP13-Marker in a JPEG file) -- Add OCI8 module for Windows -- Fix bug in pdf_close() function -- Add WDDX support (see http://www.wddx.org for more info) -- Add similar_text() function -- Introduce simple regex compilation cache - - diff --git a/TSRM/Makefile.am b/TSRM/Makefile.am deleted file mode 100644 index a779ca8552d8b..0000000000000 --- a/TSRM/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -## process this file with automake to produce Makefile.am -AUTOMAKE_OPTIONS=foreign -noinst_LTLIBRARIES=libtsrm.la -libtsrm_la_SOURCES = TSRM.c diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c deleted file mode 100644 index 87fb25f37c964..0000000000000 --- a/TSRM/TSRM.c +++ /dev/null @@ -1,434 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Thread Safe Resource Manager | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to the Zend license, that is bundled | - | with this package in the file LICENSE. If you did not receive a | - | copy of the Zend license, please mail us at zend@zend.com so we can | - | send you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include "TSRM.h" -#include -#include - -#if HAVE_STDARG_H -#include -#endif - -typedef struct _tsrm_tls_entry tsrm_tls_entry; - -struct _tsrm_tls_entry { - void **storage; - int count; - THREAD_T thread_id; - tsrm_tls_entry *next; -}; - - -typedef struct { - size_t size; - void (*ctor)(void *resource); - void (*dtor)(void *resource); -} tsrm_resource_type; - - -/* The memory manager table */ -static tsrm_tls_entry **tsrm_tls_table; -static int tsrm_tls_table_size; -static ts_rsrc_id id_count; - -/* The resource sizes table */ -static tsrm_resource_type *resource_types_table; -static int resource_types_table_size; - - -static MUTEX_T tsmm_mutex; /* thread-safe memory manager mutex */ - -/* New thread handlers */ -static void (*tsrm_new_thread_begin_handler)(); -static void (*tsrm_new_thread_end_handler)(); - -/* Debug support */ -static int tsrm_debug(const char *format, ...); -static int tsrm_debug_status; - - -/* Startup TSRM (call once for the entire process) */ -TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_status) -{ - tsrm_tls_table_size = expected_threads; - tsrm_tls_table = (tsrm_tls_entry **) calloc(tsrm_tls_table_size, sizeof(tsrm_tls_entry *)); - if (!tsrm_tls_table) { - return 0; - } - id_count=0; - - resource_types_table_size = expected_resources; - resource_types_table = (tsrm_resource_type *) calloc(resource_types_table_size, sizeof(tsrm_resource_type)); - if (!resource_types_table) { - free(tsrm_tls_table); - return 0; - } - - tsmm_mutex = tsrm_mutex_alloc(); - - tsrm_new_thread_begin_handler = tsrm_new_thread_end_handler = NULL; - - tsrm_debug_status = debug_status; - - tsrm_debug("Started up TSRM, %d expected threads, %d expected resources\n", expected_threads, expected_resources); - return 1; -} - - -/* Shutdown TSRM (call once for the entire process) */ -TSRM_API void tsrm_shutdown() -{ - int i; - - if (tsrm_tls_table) { - for (i=0; inext; - for (j=0; jstorage[j]); - } - free(p->storage); - free(p); - p = next_p; - } - } - free(tsrm_tls_table); - } - if (resource_types_table) { - free(resource_types_table); - } - tsrm_mutex_free(tsmm_mutex); - tsrm_debug("Shutdown TSRM\n"); -} - - -/* allocates a new thread-safe-resource id */ -TSRM_API ts_rsrc_id ts_allocate_id(size_t size, void (*ctor)(void *resource), void (*dtor)(void *resource)) -{ - ts_rsrc_id new_id; - int i; - - tsrm_debug("Obtaining a new resource id, %d bytes\n", size); - - tsrm_mutex_lock(tsmm_mutex); - - /* obtain a resource id */ - new_id = id_count++; - tsrm_debug("Obtained resource id %d\n", new_id); - - /* store the new resource type in the resource sizes table */ - if (resource_types_table_size < id_count) { - resource_types_table = (tsrm_resource_type *) realloc(resource_types_table, sizeof(tsrm_resource_type)*id_count); - if (!resource_types_table) { - return -1; - } - resource_types_table_size = id_count; - } - resource_types_table[new_id].size = size; - resource_types_table[new_id].ctor = ctor; - resource_types_table[new_id].dtor = dtor; - - /* enlarge the arrays for the already active threads */ - for (i=0; icount < id_count) { - int j; - - p->storage = (void *) realloc(p->storage, sizeof(void *)*id_count); - for (j=p->count; jstorage[j] = (void *) malloc(resource_types_table[j].size); - if (resource_types_table[j].ctor) { - resource_types_table[j].ctor(p->storage[j]); - } - } - p->count = id_count; - } - p = p->next; - } - } - tsrm_mutex_unlock(tsmm_mutex); - - tsrm_debug("Successfully allocated new resource id %d\n", new_id); - return new_id; -} - - -static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_T thread_id) -{ - int i; - - (*thread_resources_ptr) = (tsrm_tls_entry *) malloc(sizeof(tsrm_tls_entry)); - (*thread_resources_ptr)->storage = (void **) malloc(sizeof(void *)*id_count); - (*thread_resources_ptr)->count = id_count; - (*thread_resources_ptr)->thread_id = thread_id; - (*thread_resources_ptr)->next = NULL; - - tsrm_mutex_unlock(tsmm_mutex); - - if (tsrm_new_thread_begin_handler) { - tsrm_new_thread_begin_handler(thread_id); - } - for (i=0; istorage[i] = (void *) malloc(resource_types_table[i].size); - if (resource_types_table[i].ctor) { - resource_types_table[i].ctor((*thread_resources_ptr)->storage[i]); - } - } - if (tsrm_new_thread_end_handler) { - tsrm_new_thread_end_handler(thread_id); - } -} - - -/* fetches the requested resource for the current thread */ -void *ts_resource(ts_rsrc_id id) -{ - THREAD_T thread_id = tsrm_thread_id(); - int hash_value; - tsrm_tls_entry *thread_resources; - void *resource; - - tsrm_debug("Fetching resource id %d for thread %ld\n", id, (long) thread_id); - tsrm_mutex_lock(tsmm_mutex); - - hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size); - thread_resources = tsrm_tls_table[hash_value]; - - if (!thread_resources) { - allocate_new_resource(&tsrm_tls_table[hash_value], thread_id); - return ts_resource(id); - /* thread_resources = tsrm_tls_table[hash_value]; */ - } else { - do { - if (thread_resources->thread_id == thread_id) { - break; - } - if (thread_resources->next) { - thread_resources = thread_resources->next; - } else { - allocate_new_resource(&thread_resources->next, thread_id); - return ts_resource(id); - /* - * thread_resources = thread_resources->next; - * break; - */ - } - } while (thread_resources); - } - - resource = thread_resources->storage[id]; - - tsrm_mutex_unlock(tsmm_mutex); - - tsrm_debug("Successfully fetched resource id %d for thread id %ld - %x\n", id, (long) thread_id, (long) resource); - return resource; -} - - -/* frees all resources allocated for the current thread */ -void ts_free_thread() -{ - THREAD_T thread_id = tsrm_thread_id(); - int hash_value; - tsrm_tls_entry *thread_resources; - tsrm_tls_entry *last=NULL; - - tsrm_mutex_lock(tsmm_mutex); - hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size); - thread_resources = tsrm_tls_table[hash_value]; - - while (thread_resources) { - if (thread_resources->thread_id == thread_id) { - int i; - - for (i=0; icount; i++) { - if (resource_types_table[i].dtor) { - resource_types_table[i].dtor(thread_resources->storage[i]); - } - free(thread_resources->storage[i]); - } - free(thread_resources->storage); - if (last) { - last->next = thread_resources->next; - } else { - tsrm_tls_table[hash_value]=NULL; - } - free(thread_resources); - break; - } - if (thread_resources->next) { - last = thread_resources; - } - thread_resources = thread_resources->next; - } - tsrm_mutex_unlock(tsmm_mutex); -} - - -/* deallocates all occurrences of a given id */ -void ts_free_id(ts_rsrc_id id) -{ -} - - - - -/* - * Utility Functions - */ - -/* Obtain the current thread id */ -TSRM_API THREAD_T tsrm_thread_id(void) -{ -#ifdef WIN32 - return GetCurrentThreadId(); -#elif defined(PTHREADS) - return pthread_self(); -#elif defined(NSAPI) - return systhread_current(); -#elif defined(PI3WEB) - return PIThread_getCurrent(); -#endif -} - - -/* Allocate a mutex */ -TSRM_API MUTEX_T tsrm_mutex_alloc( void ) -{ - MUTEX_T mutexp; - -#ifdef WIN32 - mutexp = CreateMutex(NULL,FALSE,NULL); -#elif defined(PTHREADS) - mutexp = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); - pthread_mutex_init(mutexp,NULL); -#elif defined(NSAPI) - mutexp = crit_init(); -#elif defined(PI3WEB) - mutexp = PIPlatform_allocLocalMutex(); -#endif -#ifdef THR_DEBUG - printf("Mutex created thread: %d\n",mythreadid()); -#endif - return( mutexp ); -} - - -/* Free a mutex */ -TSRM_API void tsrm_mutex_free( MUTEX_T mutexp ) -{ - if (mutexp) { -#ifdef WIN32 - CloseHandle(mutexp); -#elif defined(PTHREADS) - free(mutexp); -#elif defined(NSAPI) - crit_terminate(mutexp); -#elif defined(PI3WEB) - PISync_delete(mutexp) -#endif - } -#ifdef THR_DEBUG - printf("Mutex freed thread: %d\n",mythreadid()); -#endif -} - - -/* Lock a mutex */ -TSRM_API int tsrm_mutex_lock( MUTEX_T mutexp ) -{ -#if 0 - tsrm_debug("Mutex locked thread: %ld\n",tsrm_thread_id()); -#endif -#ifdef WIN32 - return WaitForSingleObject(mutexp,1000); -#elif defined(PTHREADS) - return pthread_mutex_lock(mutexp); -#elif defined(NSAPI) - return crit_enter(mutexp); -#elif defined(PI3WEB) - return PISync_lock(mutexp); -#endif -} - - -/* Unlock a mutex */ -TSRM_API int tsrm_mutex_unlock( MUTEX_T mutexp ) -{ -#if 0 - tsrm_debug("Mutex unlocked thread: %ld\n",tsrm_thread_id()); -#endif -#ifdef WIN32 - return ReleaseMutex(mutexp); -#elif defined(PTHREADS) - return pthread_mutex_unlock(mutexp); -#elif defined(NSAPI) - return crit_exit(mutexp); -#elif defined(PI3WEB) - return PISync_unlock(mutexp); -#endif -} - - -TSRM_API void *tsrm_set_new_thread_begin_handler(void (*new_thread_begin_handler)(THREAD_T thread_id)) -{ - void *retval = (void *) tsrm_new_thread_begin_handler; - - tsrm_new_thread_begin_handler = new_thread_begin_handler; - return retval; -} - - -TSRM_API void *tsrm_set_new_thread_end_handler(void (*new_thread_end_handler)(THREAD_T thread_id)) -{ - void *retval = (void *) tsrm_new_thread_end_handler; - - tsrm_new_thread_end_handler = new_thread_end_handler; - return retval; -} - - - -/* - * Debug support - */ - -static int tsrm_debug(const char *format, ...) -{ - if (tsrm_debug_status) { - va_list args; - int size; - - va_start(args, format); - size = vprintf(format, args); - va_end(args); - return size; - } else { - return 0; - } -} - - -void tsrm_debug_set(int status) -{ - tsrm_debug_status = status; -} diff --git a/TSRM/TSRM.dsp b/TSRM/TSRM.dsp deleted file mode 100644 index 7b284ab3eb420..0000000000000 --- a/TSRM/TSRM.dsp +++ /dev/null @@ -1,100 +0,0 @@ -# Microsoft Developer Studio Project File - Name="TSRM" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=TSRM - Win32 Debug_TS -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "TSRM.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "TSRM.mak" CFG="TSRM - Win32 Debug_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "TSRM - Win32 Debug_TS" (based on "Win32 (x86) Static Library") -!MESSAGE "TSRM - Win32 Release_TS" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "TSRM - Win32 Debug_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "TSRM___Win32_Debug_TS" -# PROP BASE Intermediate_Dir "TSRM___Win32_Debug_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_TS" -# PROP Intermediate_Dir "Debug_TS" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "C:\Projects\TSRM" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x40d /d "_DEBUG" -# ADD RSC /l 0x40d /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "TSRM___Win32_Release_TS" -# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_TS" -# PROP Intermediate_Dir "Release_TS" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "TSRM_EXPORTS" /YX /FD /c -# ADD BASE RSC /l 0x40d /d "NDEBUG" -# ADD RSC /l 0x40d /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "TSRM - Win32 Debug_TS" -# Name "TSRM - Win32 Release_TS" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\TSRM.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\TSRM.h -# End Source File -# End Group -# End Target -# End Project diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h deleted file mode 100644 index 10554a9a55a6f..0000000000000 --- a/TSRM/TSRM.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Thread Safe Resource Manager | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to the Zend license, that is bundled | - | with this package in the file LICENSE. If you did not receive a | - | copy of the Zend license, please mail us at zend@zend.com so we can | - | send you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _TSRM_H -#define _TSRM_H - -#ifdef HAVE_CONFIG_H -# undef PACKAGE -# undef VERSION -# include "tsrm_config.h" -# undef PACKAGE -# undef VERSION -#endif - -#if WIN32||WINNT -# include -#elif defined(PTHREADS) -# include -#endif - -typedef int ts_rsrc_id; - -#if WIN32||WINNT -# ifdef TSRM_EXPORTS -# define TSRM_API __declspec(dllexport) -# else -# define TSRM_API __declspec(dllimport) -# endif -#else -# define TSRM_API -#endif - - -/* Define THREAD_T and MUTEX_T */ -#if defined(WIN32) -# define THREAD_T DWORD -# define MUTEX_T void * -#elif defined(PTHREADS) -# define THREAD_T pthread_t -# define MUTEX_T pthread_mutex_t * -#elif defined(NSAPI) -# define THREAD_T SYS_THREAD -# define MUTEX_T CRITICAL -#elif defined(PI3WEB) -# define THREAD_T PIThread * -# define MUTEX_T PISync * -#endif - -typedef void (*ts_allocate_ctor)(void *); - -#define THREAD_HASH_OF(thr,ts) (unsigned long)thr%(unsigned long)ts - -#ifdef __cplusplus -extern "C" { -#endif - -/* startup/shutdown */ -TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_status); -TSRM_API void tsrm_shutdown(); - -/* allocates a new thread-safe-resource id */ -TSRM_API ts_rsrc_id ts_allocate_id(size_t size, ts_allocate_ctor ctor, void (*dtor)(void *resource)); - -/* fetches the requested resource for the current thread */ -TSRM_API void *ts_resource(ts_rsrc_id id); - -/* frees all resources allocated for the current thread */ -TSRM_API void ts_free_thread(); - -/* deallocates all occurrences of a given id */ -TSRM_API void ts_free_id(ts_rsrc_id id); - - -/* Debug support */ -TSRM_API void tsrm_debug_set(int status); - -/* utility functions */ -TSRM_API THREAD_T tsrm_thread_id(void); -TSRM_API MUTEX_T tsrm_mutex_alloc(void); -TSRM_API void tsrm_mutex_free(MUTEX_T mutexp); -TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp); -TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp); - -TSRM_API void *tsrm_set_new_thread_begin_handler(void (*new_thread_begin_handler)(THREAD_T thread_id)); -TSRM_API void *tsrm_set_new_thread_end_handler(void (*new_thread_end_handler)(THREAD_T thread_id)); - -#ifdef __cplusplus -} -#endif - -#endif /* _TSRM_H */ diff --git a/TSRM/acconfig.h b/TSRM/acconfig.h deleted file mode 100644 index 2b94cf35e711d..0000000000000 --- a/TSRM/acconfig.h +++ /dev/null @@ -1 +0,0 @@ -#undef PTHREADS diff --git a/TSRM/acinclude.m4 b/TSRM/acinclude.m4 deleted file mode 100644 index 1953172aef48c..0000000000000 --- a/TSRM/acinclude.m4 +++ /dev/null @@ -1,5 +0,0 @@ - -AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[ - LIBTOOL='$(SHELL) $(top_builddir)/libtool $1' -]) - diff --git a/TSRM/build.mk b/TSRM/build.mk deleted file mode 100644 index aac1a8b982ae5..0000000000000 --- a/TSRM/build.mk +++ /dev/null @@ -1,43 +0,0 @@ -# Makefile to generate build tools -# -# Standard usage: -# make -f build.mk -# -# Written by Sascha Schumann -# -# $Id$ - - -LT_TARGETS = ltmain.sh ltconfig - -config_h_in = tsrm_config.h.in - -makefile_am_files = Makefile.am -makefile_in_files = $(makefile_am_files:.am=.in) -makefile_files = $(makefile_am_files:e.am=e) - -targets = $(makefile_in_files) $(LT_TARGETS) configure $(config_h_in) - -all: $(targets) - -clean: - rm -f $(targets) - -$(LT_TARGETS): - rm -f $(LT_TARGETS) - libtoolize --automake $(AMFLAGS) -f - -$(makefile_in_files): $(makefile_am_files) - automake -a -i $(AMFLAGS) $(makefile_files) - -aclocal.m4: configure.in acinclude.m4 - aclocal - -$(config_h_in): configure.in acconfig.h -# explicitly remove target since autoheader does not seem to work -# correctly otherwise (timestamps are not updated) - @rm -f $@ - autoheader - -configure: aclocal.m4 configure.in - autoconf diff --git a/TSRM/buildconf b/TSRM/buildconf deleted file mode 100755 index fe8dee6f76780..0000000000000 --- a/TSRM/buildconf +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -case "$1" in ---copy) - automake_flags=--copy - shift -;; -esac - -libtoolize --force --automake $automake_flags - -mv aclocal.m4 aclocal.m4.old 2>/dev/null -aclocal -if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then - echo "buildconf: keeping ${1}aclocal.m4" - mv aclocal.m4.old aclocal.m4 -else - echo "buildconf: created or modified ${1}aclocal.m4" -fi - -autoheader - -automake --add-missing --include-deps $automake_flags - -mv configure configure.old 2>/dev/null -autoconf -if cmp configure.old configure > /dev/null 2>&1; then - echo "buildconf: keeping ${1}configure" - mv configure.old configure -else - echo "buildconf: created or modified ${1}configure" -fi - diff --git a/TSRM/configure.in b/TSRM/configure.in deleted file mode 100644 index ded8166948c10..0000000000000 --- a/TSRM/configure.in +++ /dev/null @@ -1,33 +0,0 @@ -dnl $Id$ -dnl -dnl Minimalistic configure.in for TSRM. -dnl - -AC_INIT(TSRM.c) -AM_INIT_AUTOMAKE(TSRM, 1.0) -AM_CONFIG_HEADER(tsrm_config.h) - -AC_PROG_CC -AM_PROG_CC_STDC -AC_PROG_CC_C_O -AC_PROG_RANLIB - -AM_PROG_LIBTOOL -if test "$enable_debug" != "yes"; then - AM_SET_LIBTOOL_VARIABLE([--silent]) -fi - -AC_CHECK_LIB(c_r, pthread_kill) -AC_CHECK_LIB(pthread, pthread_kill) - -AC_CHECK_FUNCS(pthread_kill) - -if test "$ac_cv_func_pthread_kill" != "yes"; then - AC_MSG_ERROR(You need pthreads to build TSRM.) -fi - -AC_DEFINE(PTHREADS) - -AC_CHECK_HEADERS(stdarg.h) - -AC_OUTPUT(Makefile) diff --git a/acconfig.h.in b/acconfig.h.in deleted file mode 100644 index a35e2e4a1bc21..0000000000000 --- a/acconfig.h.in +++ /dev/null @@ -1,126 +0,0 @@ -/* This is the default configuration file to read -*- C -*- */ - -/* these are defined by automake */ -#undef PACKAGE -#undef VERSION - -#undef HAVE_AOLSERVER - -#undef HAVE_STRUCT_FLOCK -#undef HAVE_TM_GMTOFF - -#define CONFIGURATION_FILE_PATH "php.ini" -#define USE_CONFIG_FILE 1 - -#undef HAVE_DMALLOC - -/* Some global constants defined by conigure */ -#undef PHP_BUILD_DATE -#undef PHP_OS -#undef PHP_UNAME - -/* define uint by configure if it is missed (QNX and BSD derived) */ -#undef uint - -/* define ulong by configure if it is missed (most probably is) */ -#undef ulong - -/* type check for in_addr_t */ -#undef in_addr_t - -/* Define if you have dirent.h but opendir() resides in libc rather than in libdir */ -/* This will cause HAVE_DIRENT_H defined twice sometimes, but it should be problem */ -#undef HAVE_DIRENT_H - -/* Define if you have the resolv library (-lresolv). */ -#undef HAVE_LIBRESOLV - -/* Define if you have the pam library (-lpam). */ -#define HAVE_LIBPAM 0 - -/* Define if you have the bind library (-lbind). */ -#define HAVE_LIBBIND 0 - -/* Define if you have Netscape LDAP instead of umich ldap or openldap*/ -#define HAVE_NSLDAP 0 - -/* Define if you want safe mode enabled by default. */ -#define PHP_SAFE_MODE 0 - -/* Set to the path to the dir containing safe mode executables */ -#define PHP_SAFE_MODE_EXEC_DIR /usr/local/php/bin - -/* Define if you want POST/GET/Cookie track variables by default */ -#define PHP_TRACK_VARS 0 - -/* Undefine if you want stricter XML/SGML compliance by default */ -/* (this disables "" by default) */ -#define DEFAULT_SHORT_OPEN_TAG 1 - -/* Undefine if you do not want PHP by default to escape "'" */ -/* in GET/POST/Cookie data */ -#define MAGIC_QUOTES 1 - -/* Define both of these if you want the bundled REGEX library */ -#define REGEX 0 -#define HSREGEX 0 - -/* Define if you have and want to use libnsl */ -#undef HAVE_LIBNSL - -/* Define if you have and want to use libsocket */ -#undef HAVE_LIBSOCKET - -/* Define if you have the sendmail program available */ -#define HAVE_SENDMAIL 0 - -/* Define if you are compiling PHP as an Apache module */ -#define APACHE 0 - -/* Define if you are compiling PHP as an Apache module with mod_charset patch applied (aka Russian Apache)*/ -#define USE_TRANSFER_TABLES 0 - -/* Define if you are compiling PHP as an fhttpd module */ -#define FHTTPD 0 - -/* Define if your Apache creates an ap_config.h header file (only 1.3b6 and later) */ -#define HAVE_AP_CONFIG_H 0 - -/* Define if your Apache has src/include/compat.h */ -#define HAVE_OLD_COMPAT_H 0 - -/* Define if your Apache has src/include/ap_compat.h */ -#define HAVE_AP_COMPAT_H 0 - -#ifndef DEBUG /* should be set to ZEND_DEBUG */ -#define DEBUG 0 -#endif - -/* Define if you want to enable PHP RPC (experimental) */ -#define PHP_RPC 0 - -/* Define if you want to prevent the CGI from working unless REDIRECT_STATUS is defined in the environment */ -#define FORCE_CGI_REDIRECT 0 - -/* Define if you want to prevent the CGI from using path_info and path_translated */ -#define DISCARD_PATH 0 - -/* Define if you want include() and other functions to be able to open - * http and ftp URLs as files. - */ -#define PHP3_URL_FOPEN 0 - -/* Define if you have broken header files like SunOS 4 */ -#define MISSING_FCLOSE_DECL 0 - -/* Define if you have broken sprintf function like SunOS 4 */ -#define BROKEN_SPRINTF 0 - -/* Define to compile PHP/Zend thread safe */ -#undef ZTS - -/* Define when compiling with Zeus support */ -#undef WITH_ZEUS - -/* Define if struct sockaddr contains the field sa_len */ -#undef HAVE_SOCKADDR_SA_LEN diff --git a/acinclude.m4 b/acinclude.m4 deleted file mode 100644 index 85d01850e10e6..0000000000000 --- a/acinclude.m4 +++ /dev/null @@ -1,347 +0,0 @@ -dnl $Id$ -dnl -dnl This file contains local autoconf functions. - -dnl -dnl PHP_SET_SYM_FILE(path) -dnl -dnl set the path of the file which contains the symbol export list -dnl -AC_DEFUN(PHP_SET_SYM_FILE, -[ - PHP_SYM_FILE="$1" -]) - -dnl -dnl PHP_BUILD_SHARED -dnl -AC_DEFUN(PHP_BUILD_SHARED,[ - php_build_target=shared -]) - -dnl -dnl PHP_BUILD_STATIC -dnl -AC_DEFUN(PHP_BUILD_STATIC,[ - php_build_target=static -]) - -dnl -dnl PHP_BUILD_PROGRAM -dnl -AC_DEFUN(PHP_BUILD_PROGRAM,[ - php_build_target=program -]) - -dnl -dnl AC_PHP_ONCE(namespace, variable, code) -dnl -dnl execute code, if variable is not set in namespace -dnl -AC_DEFUN(AC_PHP_ONCE,[ - unique=`echo $ac_n "$2$ac_c" | tr -c -d a-zA-Z0-9` - cmd="echo $ac_n \"\$$1$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "$1$unique=set" - $3 - fi -]) - -dnl -dnl AC_EXPAND_PATH(path, variable) -dnl -dnl expands path to an absolute path and assigns it to variable -dnl -AC_DEFUN(AC_EXPAND_PATH,[ - if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then - $2="$1" - else - ep_dir="`dirname \"$1\"`" - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - $2="$ep_realdir/`basename \"$1\"`" - fi -]) - -dnl -dnl AC_ADD_LIBPATH(path) -dnl -dnl add a library to linkpath/runpath -dnl -AC_DEFUN(AC_ADD_LIBPATH,[ - if test "$1" != "/usr/lib"; then - AC_EXPAND_PATH($1, ai_p) - AC_PHP_ONCE(LIBPATH, $ai_p, [ - EXTRA_LIBS="$EXTRA_LIBS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - ]) - fi -]) - -dnl -dnl AC_BUILD_RPATH() -dnl -dnl builds RPATH from PHP_RPATHS -dnl -AC_DEFUN(AC_BUILD_RPATH,[ - if test "$enable_rpath" = "yes" && test -n "$PHP_RPATHS"; then - OLD_RPATHS="$PHP_RPATHS" - PHP_RPATHS="" - for i in $OLD_RPATHS; do - PHP_RPATHS="$PHP_RPATHS -R $i" - NATIVE_RPATHS="$NATIVE_RPATHS ${ld_runpath_switch}$i" - done - fi -]) - -dnl -dnl AC_ADD_INCLUDE(path) -dnl -dnl add a include path -dnl -AC_DEFUN(AC_ADD_INCLUDE,[ - if test "$1" != "/usr/include"; then - AC_EXPAND_PATH($1, ai_p) - AC_PHP_ONCE(INCLUDEPATH, $ai_p, [ - INCLUDES="$INCLUDES -I$ai_p" - ]) - fi -]) - -dnl -dnl AC_ADD_LIBRARY(library) -dnl -dnl add a library to the link line -dnl -AC_DEFUN(AC_ADD_LIBRARY,[ - AC_PHP_ONCE(LIBRARY, $1, [ - EXTRA_LIBS="$EXTRA_LIBS -l$1" - ]) -]) - -dnl -dnl AC_ADD_LIBRARY_WITH_PATH(library, path) -dnl -dnl add a library to the link line and path to linkpath/runpath -dnl -AC_DEFUN(AC_ADD_LIBRARY_WITH_PATH,[ - AC_ADD_LIBPATH($2) - AC_ADD_LIBRARY($1) -]) - - -AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[ - LIBTOOL='$(SHELL) $(top_builddir)/libtool $1' -]) - -dnl -dnl Check for cc option -dnl -AC_DEFUN(AC_CHECK_CC_OPTION,[ - echo "main(){return 0;}" > conftest.$ac_ext - opt="$1" - var=`echo $ac_n "$opt$ac_c"|tr -c a-zA-Z0-9 _` - AC_MSG_CHECKING([if compiler supports -$1 really]) - ac_php_compile="${CC-cc} -$opt -o conftest $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1" - if eval $ac_php_compile 2>&1 | egrep "$opt" > /dev/null 2>&1 ; then - eval php_cc_$var=no - AC_MSG_RESULT(no) - else - if eval ./conftest 2>/dev/null ; then - eval php_cc_$var=yes - AC_MSG_RESULT(yes) - else - eval php_cc_$var=no - AC_MSG_RESULT(no) - fi - fi -]) - -AC_DEFUN(PHP_REGEX,[ - -if test "$REGEX_TYPE" = "php"; then - REGEX_LIB=regex/libregex.la - REGEX_DIR=regex - AC_DEFINE(HSREGEX) - AC_DEFINE(REGEX,1) -elif test "$REGEX_TYPE" = "system"; then - AC_DEFINE(REGEX,0) -elif test "$REGEX_TYPE" = "apache"; then - AC_DEFINE(REGEX,2) -fi - -AC_MSG_CHECKING(which regex library to use) -AC_MSG_RESULT($REGEX_TYPE) - -AC_SUBST(REGEX_DIR) -AC_SUBST(REGEX_LIB) -AC_SUBST(HSREGEX) -]) - -dnl -dnl See if we have broken header files like SunOS has. -dnl -AC_DEFUN(AC_MISSING_FCLOSE_DECL,[ - AC_MSG_CHECKING([for fclose declaration]) - AC_TRY_COMPILE([#include ],[int (*func)() = fclose],[ - AC_DEFINE(MISSING_FCLOSE_DECL,0) - AC_MSG_RESULT(ok) - ],[ - AC_DEFINE(MISSING_FCLOSE_DECL,1) - AC_MSG_RESULT(missing) - ]) -]) - -dnl -dnl Check for broken sprintf() -dnl -AC_DEFUN(AC_BROKEN_SPRINTF,[ - AC_MSG_CHECKING([for broken sprintf]) - AC_TRY_RUN([main() { char buf[20]; exit (sprintf(buf,"testing 123")!=11); }],[ - AC_DEFINE(BROKEN_SPRINTF,0) - AC_MSG_RESULT(ok) - ],[ - AC_DEFINE(BROKEN_SPRINTF,1) - AC_MSG_RESULT(broken) - ],[ - AC_DEFINE(BROKEN_SPRINTF,0) - AC_MSG_RESULT(cannot check, guessing ok) - ]) -]) - -dnl -dnl PHP_EXTENSION(extname [, shared]) -dnl -dnl Includes an extension in the build. -dnl -dnl "extname" is the name of the ext/ subdir where the extension resides -dnl "shared" can be set to "shared" or "yes" to build the extension as -dnl a dynamically loadable library. -dnl -AC_DEFUN(PHP_EXTENSION,[ - if test -d "$cwd/$srcdir/ext/$1" ; then - EXT_SUBDIRS="$EXT_SUBDIRS $1" - if test "$2" != "shared" -a "$2" != "yes"; then - _extlib="libphpext_$1.a" - EXT_LTLIBS="$EXT_LTLIBS ext/$1/libphpext_$1.la" - EXT_LIBS="$EXT_LIBS $1/$_extlib" - EXT_STATIC="$EXT_STATIC $1" - else - EXT_SHARED="$EXT_SHARED $1" - fi - PHP_OUTPUT(ext/$1/Makefile) - fi -]) - -AC_SUBST(EXT_SUBDIRS) -AC_SUBST(EXT_STATIC) -AC_SUBST(EXT_SHARED) -AC_SUBST(EXT_LIBS) -AC_SUBST(EXT_LTLIBS) - -dnl -dnl Solaris requires main code to be position independent in order -dnl to let shared objects find symbols. Weird. Ugly. -dnl -dnl Must be run after all --with-NN options that let the user -dnl choose dynamic extensions, and after the gcc test. -dnl -AC_DEFUN(PHP_SOLARIS_PIC_WEIRDNESS,[ - AC_MSG_CHECKING(whether -fPIC is required) - if test "$EXT_SHARED" != ""; then - os=`uname -sr 2>/dev/null` - case "$os" in - "SunOS 5.6"|"SunOS 5.7") - case "$CC" in - gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";; - *) CFLAGS="$CFLAGS -fpic";; - esac - AC_MSG_RESULT(yes);; - *) - AC_MSG_RESULT(no);; - esac - else - AC_MSG_RESULT(no) - fi -]) - -dnl -dnl Checks whether $withval is "shared" or starts with "shared,XXX" -dnl and sets $shared to "yes" or "no", and removes "shared,?" stuff -dnl from $withval. -dnl -AC_DEFUN(PHP_WITH_SHARED,[ - case $withval in - shared) - shared=yes - withval=yes - ;; - shared,*) - shared=yes - withval=`echo $withval | sed -e 's/^shared,//'` - ;; - *) - shared=no - ;; - esac -]) - -dnl The problem is that the default compilation flags in Solaris 2.6 won't -dnl let programs access large files; you need to tell the compiler that -dnl you actually want your programs to work on large files. For more -dnl details about this brain damage please see: -dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html - -dnl Written by Paul Eggert . - -AC_DEFUN(AC_SYS_LFS, -[dnl - # If available, prefer support for large files unless the user specified - # one of the CPPFLAGS, LDFLAGS, or LIBS variables. - AC_MSG_CHECKING(whether large file support needs explicit enabling) - ac_getconfs='' - ac_result=yes - ac_set='' - ac_shellvars='CPPFLAGS LDFLAGS LIBS' - for ac_shellvar in $ac_shellvars; do - case $ac_shellvar in - CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;; - *) ac_lfsvar=LFS_$ac_shellvar ;; - esac - eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar - (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; } - ac_getconf=`getconf $ac_lfsvar` - ac_getconfs=$ac_getconfs$ac_getconf - eval ac_test_$ac_shellvar=\$ac_getconf - done - case "$ac_result$ac_getconfs" in - yes) ac_result=no ;; - esac - case "$ac_result$ac_set" in - yes?*) ac_result="yes, but $ac_set is already set, so use its settings" - esac - AC_MSG_RESULT($ac_result) - case $ac_result in - yes) - for ac_shellvar in $ac_shellvars; do - eval $ac_shellvar=\$ac_test_$ac_shellvar - done ;; - esac -]) - -AC_DEFUN(AC_SOCKADDR_SA_LEN,[ - AC_CACHE_CHECK([for field sa_len in struct sockaddr],ac_cv_sockaddr_sa_len,[ - AC_TRY_COMPILE([#include -#include ], - [struct sockaddr s; s.sa_len;], - [ac_cv_sockaddr_sa_len=yes - AC_DEFINE(HAVE_SOCKADDR_SA_LEN)], - [ac_cv_sockaddr_sa_len=no]) - ]) -]) - -dnl ## PHP_AC_OUTPUT(file) -dnl ## adds "file" to the list of files generated by AC_OUTPUT -dnl ## This macro can be used several times. -AC_DEFUN(PHP_OUTPUT,[ - PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1" -]) diff --git a/apidoc-zend.txt b/apidoc-zend.txt deleted file mode 100644 index 4667ed501a544..0000000000000 --- a/apidoc-zend.txt +++ /dev/null @@ -1,276 +0,0 @@ -Following is a merge of two letters I sent to php4beta@lists.php.net, -describing the changes in API between PHP 3.0 and PHP 4.0 (Zend). -This file is by no means thorough documentation of the PHP API, -and is intended for developers who are familiar with the PHP 3.0 API, -and want to port their code to PHP 4.0, or take advantage of its new -features. For highlights about the PHP 3.0 API, consult apidoc.txt. - -Zeev - --------------------------------------------------------------------------- - -I'm going to try to list the important changes in API and programming -techniques that are involved in developing modules for PHP4/Zend, as -opposed to PHP3. Listing the whole PHP4 API is way beyond my scope here, -it's mostly a 'diff' from the apidoc.txt, which you're all pretty familiar -with. -An important note that I neglected to mention yesterday - the php4 tree is -based on the php 3.0.5 tree, plus all 3.0.6 patches hand-patched into it. -Notably, it does NOT include any 3.0.7 patches. All of those have to be -reapplied, with extreme care - modules should be safe to patch (mostly), -but anything that touches the core or main.c will almost definitely require -changes in order to work properly. - -[1] Symbol Tables - -One of the major changes in Zend involves changing the way symbols tables -work. Zend enforces reference counting on all values and resources. This -required changes in the semantics of the hash tables that implement symbol -tables. Instead of storing pval in the hashes, we now store pval *. All -of the API functions in Zend were changed in a way that this change is -completely transparent. However, if you've used 'low level' hash functions -to access or update elements in symbol tables, your code will require -changes. Following are two simple examples, one demonstrates the -difference between PHP3 and Zend when reading a symbol's value, and the -other demonstrates the difference when writing a value. - -php3_read() -{ - pval *foo; - - _php3_hash_find(ht, "foo", sizeof("foo"), &foo); - /* foo->type is the type and foo->value is the value */ -} - - -php4_read() -{ - pval **foo; - - _php3_hash_find(ht, "foo", sizeof("foo"), &foo); - /* (*foo)->type is the type and (*foo)->value is the value */ -} - ---- - -php3_write() -{ - pval newval; - - newval.type = ...; - newval.value = ...; - _php3_hash_update(ht, "bar", sizeof("bar"), &newval, sizeof(pval), NULL); -} - -php4_write() -{ - pval *newval = (pval *) emalloc(sizeof(pval)); - - newval->refcount=1; - newval->is_ref=0; - newval->type = ...; - newval->value = ...; - _php3_hash_update(ht, "bar", sizeof("bar"), &newval, sizeof(pval *), NULL); -} - - -[2] Resources - -One of the 'cute' things about the reference counting support is that it -completely eliminates the problem of resource leaking. A simple loop that -included '$result = mysql_query(...)' in PHP leaked unless the user -remembered to run mysql_free($result) at the end of the loop body, and -nobody really did. In order to take advantage of the automatic resource -deallocation upon destruction, there's virtually one small change you need -to conduct. Change the result type of a resource that you want to destroy -itself as soon as its no longer referenced (just about any resource I can -think of) as IS_RESOURCE, instead of as IS_LONG. The rest is magic. - -A special treatment is required for SQL modules that follow MySQL's -approach for having the link handle as an optional argument. Modules that -follow the MySQL module model, store the last opened link in a global -variable, that they use in case the user neglects to explicitly specify a -link handle. Due to the way referenec counting works, this global -reference is just like any other reference, and must increase that SQL link -resource's reference count (otherwise, it will be closed prematurely). -Simply, when you set the default link to a certain link, increase that -link's reference count by calling zend_list_addref(). -As always, the MySQL module is the one used to demonstrate 'new -technology'. You can look around it and look for IS_RESOURCE, as well as -zend_list_addref(), to see a clear example of how the new API should be used. - - -[3] Thread safety issues - -I'm not going to say that Zend was designed with thread safety in mind, but -from some point, we've decided upon several guidelines that would make the -move to thread safety much, much easier. Generally, we've followed the PHP -3.1 approach of moving global variables to a structure, and encapsulating -all global variable references within macros. There are three main -differences: -1. We grouped related globals in a single structure, instead of grouping -all globals in one structure. -2. We've used much, much shorter macro names to increase the readability -of the source code. -3. Regardless of whether we're compiling in thread safe mode or not, all -global variables are *always* stored in a structure. For example, you -would never have a global variable 'foo', instead, it'll be a property of a -global structure, for example, compiler_globals.foo. That makes -development much, much easier, since your code will simply not compile -unless you remember to put the necessary macro around foo. - -To write code that'll be thread safe in the future (when we release our -thread safe memory manager and work on integrating it), you can take a look -at zend_globals.h. Essentially, two sets of macros are defined, one for -thread safe mode, and one for thread unsafe mode. All global references -are encapsulated within ???G(varname), where ??? is the appropriate prefix -for your structure (for example, so far we have CG(), EG() and AG(), which -stand for the compiler, executor and memory allocator, respectively). -When compiling with thread safety enabled, each function that makes use of -a ???G() macro, must obtain the pointer to its copy of the structure. It -can do so in one of two forms: -1. It can receive it as an argument. -2. It can fetch it. - -Obviously, the first method is preferable since it's much quicker. -However, it's not always possible to send the structure all the way to a -particular function, or it may simply bloat the code too much in some -cases. Functions that receive the globals as an argument, should look like -this: - -rettype functioname(???LS_D) <-- a function with no arguments -rettype functioname(type arg1, ..., type argn ???LS_DC) <-- a funciton with -arguments - -Calls to such functions should look like this: -functionname(???LS_C) <-- a function with no arguments -functionname(arg1, ..., argn ???LS_CC) <-- a function with arguments - -LS stands for 'Local Storage', _C stands for Call and _CC stands for Call -Comma, _D stands for Declaration and _DC stands for Declaration Comma. -Note that there's NO comma between the last argument and ???LS_DC or ???LS_CC. - -In general, every module that makes use of globals should use this approach -if it plans to be thread safe. - - -[4] Generalized INI support - -The code comes to solve several issues: - -a. The ugly long block of code in main.c that reads values from the -cfg_hash into php3_ini. -b. Get rid of php3_ini. The performance penalty of copying it around all -the time in the Apache module probably wasn't too high, but -psychologically, it annoyed me :) -c. Get rid of the ugly code in mod_php4.c, that also reads values from -Apache directives and puts them into the php3_ini structure. -d. Generalize all the code so that you only have to add an entry in one -single place and get it automatically supported in php3.ini, Apache, Win32 -registry, runtime function ini_get() and ini_alter() and any future method -we might have. -e. Allow users to easily override *ANY* php3.ini value, except for ones -they're not supposed to, of course. - -I'm happy to say that I think I pretty much reached all goals. php_ini.c -implements a mechanism that lets you add your INI entry in a single place, -with a default value in case there's no php3.ini value. What you get by -using this mechanism: - -1. Automatic initialization from php3.ini if available, or from the -default value if not. -2. Automatic support in ini_alter(). That means a user can change the -value for this INI entry at runtime, without you having to add in a single -line of code, and definitely no additional function (for example, in PHP3, -we had to add in special dedicated functions, like -set_magic_quotes_runtime() or the likes - no need for that anymore). -3. Automatic support in Apache .conf files. -4. No need for a global php3_ini-like variable that'll store all that -info. You can directly access each INI entry by name, in runtime. 'Sure, -that's not revolutionary, it's just slow' is probably what some of you -think - which is true, but, you can also register a callback function that -is called each time your INI entry is changed, if you wish to store it in a -cached location for intensive use. -5. Ability to access the current active value for a given INI entry, and -the 'master' value. - -Of course, (2) and (3) are only applicable in some cases. Some entries -shouldn't be overriden by users in runtime or through Apache .conf files - -you can, of course, mark them as such. - - -So, enough hype, how does it work. - -Essentially: - -static PHP_INI_MH(OnChangeBar); /* declare a message handler for a change -in "bar" */ - -PHP_INI_BEGIN() - PHP_INI_ENTRY("foo", "1", PHP_INI_ALL, NULL, NULL) - PHP_INI_ENTRY("bar", "bah", PHP_INI_SYSTEM, OnChangeBar, NULL) -PHP_INI_END() - -static PHP_INI_MH(OnChangeBar) -{ - a_global_var_for_bar = new_value; - return SUCCESS; -} - -int whatever_minit(INIT_FUNC_ARGS) -{ - ... - REGISTER_INI_ENTRIES(); - ... -} - - -int whatever_mshutdown(SHUTDOWN_FUNC_ARGS) -{ - ... - UNREGISTER_INI_ENTRIES(); - ... -} - - -and that's it. Here's what it does. As you can probably guess, this code -registers two INI entries - "foo" and "bar". They're given defaults "1" -and "bah" respectively - note that all defaults are always given as -strings. That doesn't reduce your ability to use integer values, simply -specify them as strings. "foo" is marked so that it can be changed by -anyone at any time (PHP_INI_ALL), whereas "foo" is marked so it can be -changed only at startup in the php3.ini only, presumably, by the system -administrator (PHP_INI_SYSTEM). -When "foo" changes, no function is called. Access to it is done using the -macros INI_INT("foo"), INI_FLT("foo") or INI_STR("foo"), which return a -long, double or char * respectively (strings that are returned aren't -duplicated - if they're manipulated, you must duplicate them first). You -can also access the original value (the 'master' value, in case one of them -was overriden by a user) using another pair of macros: -INI_ORIG_INT("foo"), INI_ORIG_FLT("foo") and INI_ORIG_STR("foo"). - -When "bar" changes, a special message handler is called, OnBarChange(). -Always declare those message handlers using PHP_INI_MH(), as they might -change in the future. Message handlers are called as soon as an ini entry -initializes or changes, and allow you to cache a certain INI value in a -quick C structure. In this example, whenever "bar" changes, the new value -is stored in a_global_var_for_bar, which is a global char * pointer, -quickly accessible from other functions. Things get a bit more complicated -when you want to implement a thread-safe module, but it's doable as well. -Message handlers may return SUCCESS to acknowledge the new value, or -FAILURE to reject it. That enables you to reject invalid values for some -INI entries if you want. Finally, you can have a pointer passed to your -message handler - that's the fifth argument to PHP_INI_ENTRY(). It is -passed as mh_arg to the message handler. - -Remember that for certain values, there's really no reason to mess with a -callback function. A perfect example for this are the syntax highlight -colors, which no longer have a dedicated global C slot that stores them, -but instead, are fetched from the php_ini hash on demand. - -"As always", for a perfect working example of this mechanism, consult -functions/mysql.c. This module uses the new INI entry mechanism, and was -also converted to be thread safe in general, and in its php_ini support in -particular. Converting your modules to look like this for thread safety -isn't a bad idea (not necessarily now, but in the long run). - diff --git a/apidoc.txt b/apidoc.txt deleted file mode 100644 index 34eac2896c4c6..0000000000000 --- a/apidoc.txt +++ /dev/null @@ -1,492 +0,0 @@ -PHP Version 3.0 API Documentation - -Table of Contents ------------------ - 1. Function Prototype - 2. Function Arguments - 3. Variable number of function arguments - 4. Using the function arguments - 5. Memory management in functions - 6. Setting variables in the symbol table - 7. Returning values from functions - 8. Returning 'complex' values from functions (arrays or objects) - 9. Using the resource list -10. Using the persistent resource table -11. Adding runtime configuration directives ------------------ - -1. Function Prototype - - All functions look like this: - - PHP_FUNCTION(foo) { - - } - - Even if your function doesn't take any arguments, this is how it is - called. - ------------------ - -2. Function Arguments - - Arguments are always of type pval. This type contains a union which - has the actual type of the argument. So, if your function takes two - arguments, you would do something like the following at the top of your - function: - - pval *arg1, *arg2; - if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&arg1,&arg2)==FAILURE) { - WRONG_PARAM_COUNT; - } - - NOTE: Arguments can be passed either by value or by reference. In both - cases you will need to pass &(pval *) to getParameters. If you want to - check if the n'th parameter was sent to you by reference or not, you can - use the function, ParameterPassedByReference(ht,n). It will return either - 1 or 0. - - When you change any of the passed parameters, whether they are sent by - reference or by value, you can either start over with the parameter by - calling pval_destructor on it, or if it's an ARRAY you want to add to, - you can use functions similar to the ones in internal_functions.h which - manipulate return_value as an ARRAY. - - Also if you change a parameter to IS_STRING make sure you first assign - the new estrdup'ed string and the string length, and only later change the - type to IS_STRING. If you change the string of a parameter which already - IS_STRING or IS_ARRAY you should run pval_destructor on it first. - ------------------ - -3. Variable number of function arguments - - A function can take a variable number of arguments. If your function can - take either 2 or 3 arguments, use the following: - - pval *arg1, *arg2, *arg3; - int arg_count = ARG_COUNT(ht); - - if (arg_count<2 || arg_count>3 || - getParameters(ht,arg_count,&arg1,&arg2,&arg3)==FAILURE) { - WRONG_PARAM_COUNT; - } - ------------------- - -4. Using the function arguments - - The type of each argument is stored in the pval type field: - - - This type can be any of the following: - - IS_STRING String - IS_DOUBLE Double-precision floating point - IS_LONG Long - IS_ARRAY Array - - IS_EMPTY ?? - IS_USER_FUNCTION ?? - IS_INTERNAL_FUNCTION ?? (if some of these cannot be passed to a - function - delete) - IS_CLASS ?? - IS_OBJECT ?? - - If you get an argument of one type and would like to use it as another, - or if you just want to force the argument to be of a certain type, you - can use one of the following conversion functions: - - convert_to_long(arg1); - convert_to_double(arg1); - convert_to_string(arg1); - convert_to_boolean_long(arg1); If the string is "" or "0" it - becomes 0, 1 otherwise - convert_string_to_number(arg1); Converts string to either LONG or - DOUBLE depending on string - - These function all do in-place conversion. They do not return anything. - - The actual argument is stored in a union. - - For type IS_STRING, use arg1->value.str.val - IS_LONG arg1->value.lval - IS_DOUBLE arg1->value.dval - -------------------- - -5. Memory management in functions - - Any memory needed by a function should be allocated with either emalloc() - or estrdup(). These are memory handling abstraction functions that look - and smell like the normal malloc() and strdup() functions. Memory should - be freed with efree(). - - There are two kinds of memory in this program. Memory which is returned - to the parser in a variable and memory which you need for temporary - storage in your internal function. When you assign a string to a - variable which is returned to the parser you need to make sure you first - allocate the memory with either emalloc or estrdup. This memory - should NEVER be freed by you, unless you later, in the same function - overwrite your original assignment (this kind of programming practice is - not good though). - - For any temporary/permanent memory you need in your functions/library you - should use the three emalloc(), estrdup(), and efree() functions. They - behave EXACTLY like their counterpart functions. Anything you emalloc() - or estrdup() you have to efree() at some point or another, unless it's - supposed to stick around until the end of the program, otherwise there - will be a memory leak. The meaning of "the functions behave exactly like - their counterparts" is if you efree() something which was not - emalloc()'ed nor estrdup()'ed you might get a segmentation fault. So - please take care and free all of your wasted memory. One of the biggest - improvements in PHP 3.0 will hopefully be the memory management. - - If you compile with "-DDEBUG", PHP3 will print out a list of all - memory that was allocated using emalloc() and estrdup() but never - freed with efree() when it is done running the specified script. - -------------------- - -6. Setting variables in the symbol table - - A number of macros are available which make it easier to set a variable - in the symbol table: - - SET_VAR_STRING(name,value) ** - SET_VAR_DOUBLE(name,value) - SET_VAR_LONG(name,value) - - ** Be careful here. The value part must be malloc'ed manually because - the memory management code will try to free this pointer later. Do - not pass statically allocated memory into a SET_VAR_STRING - - Symbol tables in PHP 3.0 are implemented as hash tables. At any given time, - &symbol_table is a pointer to the 'main' symbol table, and active_symbol_table - points to the currently active symbol table (these may be identical like in - startup, or different, if you're inside a function). - - The following examples use 'active_symbol_table'. You should replace it with - &symbol_table if you specifically want to work with the 'main' symbol table. - Also, the same funcions may be applied to arrays, as explained below. - - * To check whether a variable named $foo already exists in a symbol table: - if (hash_exists(active_symbol_table,"foo",sizeof("foo"))) { exists... } - else { doesn't exist } - - * If you also need to get the type of the variable, you can use: - hash_find(active_symbol_table,"foo",sizeof("foo"),&pvalue); - check(pvalue.type); - - Arrays in PHP 3.0 are implemented using the same hashtables as symbol tables. - This means the two above functions can also be used to check variables - inside arrays. - - If you want to define a new array in a symbol table, you should do this: - - 1. Possibly check it exists and abort, using hash_exists() - or hash_find(). - 2. Code: - - pval arr; - - if (array_init(&arr) == FAILURE) { failed... }; - hash_update(active_symbol_table,"foo",sizeof("foo"),&arr,sizeof(pval),NULL); - - This code declares a new array, named $foo, in the active symbol table. - This array is empty. - - Here's how to add new entries to it: - - pval entry; - - entry.type = IS_LONG; - entry.value.lval = 5; - - hash_update(arr.value.ht,"bar",sizeof("bar"),&entry,sizeof(pval),NULL); /* defines $foo["bar"] = 5 */ - hash_index_update(arr.value.ht,7,&entry,sizeof(pval),NULL); /* defines $foo[7] = 5 */ - hash_next_index_insert(arr.value.ht,&entry,sizeof(pval),NULL); /* defines the next free place in $foo[], - * $foo[8], to be 5 (works like php2) - */ - - If you'd like to modify a value that you inserted to a hash, you must first retreive it from the hash. To - prevent that overhead, you can supply a pval ** to the hash add function, and it'll be updated with the - pval * address of the inserted element inside the hash. If that value is NULL (like in all of the - above examples) - that parameter is ignored. - - hash_next_index_insert() works more or less using the same logic - "$foo[] = bar;" works in PHP 2.0. - - If you are building an array to return from a function, you can initialize - the array just like above by doing: - - if (array_init(return_value) == FAILURE) { failed...; } - - and then adding values with the helper functions: - - add_next_index_long(return_value,long_value); - add_next_index_double(return_value,double_value); - add_next_index_string(return_value,estrdup(string_value)); - - Of course, if the adding isn't done right after the array - initialization, you'd probably have to look for the array first: - - pval *arr; - - if (hash_find(active_symbol_table,"foo",sizeof("foo"),(void **)&arr)==FAILURE) { can't find... } - else { use arr->value.ht... } - - Note that hash_find receives a pointer to a pval pointer, and - not a pval pointer. - - Just about any hash function returns SUCCESS or FAILURE (except for - hash_exists() that returns a boolean truth value). - -------------------- - -7. Returning 'simple' values from functions (integers, floats or strings) - - A number of macros are available to make it easier to return things from - functions: - - These set the return value and return from the function: - - RETURN_FALSE - RETURN_TRUE - RETURN_LONG(l) - RETURN_STRING(s,dup) If dup is true, duplicates the string - RETURN_STRINGL(s,l,dup) Return string (s) specifying length (l). - RETURN_DOUBLE(d) - - These only set the return value: - - RETVAL_FALSE - RETVAL_TRUE - RETVAL_LONG(l) - RETVAL_STRING(s,dup) If dup is true, duplicates the string - RETVAL_STRINGL(s,l,dup) Return string (s) specifying length (l). - RETVAL_DOUBLE(d) - - The string macros above will all estrdup() the passed 's' argument, - so you can safely free the argument after calling the macro, or - alternatively use statically allocated memory. - - If your function returns boolean success/error responses, always use - RETURN_TRUE and RETURN_FALSE respectively. - -------------------- - -8. Returning 'complex' values from functions (arrays or objects) - - Your function can also return a complex data type such as an object - or an array. - - Returning an object: - - 1. Call object_init(return_value). - 2. Fill it up with values: - - add_property_long(return_value,property_name,l) Add a property named 'property_name', of type long, equals to 'l' - add_property_double(return_value,property_name,d) Same, only a double - add_property_string(return_value,property_name,str) Same, only a string - add_property_stringl(return_value,property_name,str,l) Add a property named 'property_name', of type string, string is 'str' with length 'l' - - 3. Possibly, register functions for this object. In order to - obtain values from the object, the function would have to fetch - "this" from the active_symbol_table. Its type should be IS_OBJECT, - and it's basically a regular hash table (i.e., you can use regular - hash functions on .value.ht). The actual registration of the - function can be done using: - - add_method(return_value,function_name,function_ptr) - - - Returning an array: - - 1. Call array_init(return_value). - 2. Fill it up with values: - - add_assoc_long(return_value,key,l) add associative entry with key 'key' and long value 'l' - add_assoc_double(return_value,key,d) - add_assoc_string(return_value,key,str) - add_assoc_stringl(return_value,key,str,length) specify the string length - - add_index_long(return_value,index,l) add entry in index 'index' with long value 'l' - add_index_double(return_value,index,d) - add_index_string(return_value,index,str) - add_index_stringl(return_value,index,str,length) specify the string length - - add_next_index_long(return_value,l) add an array entry in the next free offset with long value 'l' - add_next_index_double(return_value,d) - add_next_index_string(return_value,str) - add_next_index_stringl(return_value,str,length) specify the string length - -------------------- - -9. Using the resource list - - PHP 3.0 has a standard way of dealing with various types of resources, - that replaces all of the local linked lists in PHP 2.0. - - Available functions: - - php3_list_insert(ptr, type) returns the 'id' of the newly inserted resource - php3_list_delete(id) delete the resource with the specified id - php3_list_find(id,*type) returns the pointer of the resource with the specified id, updates 'type' to the resource's type - - Typically, these functions are used for SQL drivers but they can be - used for anything else, and are used, for instance, for maintaining - file descriptors. - - Typical list code would look like this: - - Adding a new resource: - - RESOURCE *resource; - - ...allocate memory for resource and acquire resource... - /* add a new resource to the list */ - return_value->value.lval = php3_list_insert((void *) resource, LE_RESOURCE_TYPE); - return_value->type = IS_LONG; - - Using an existing resource: - - pval *resource_id; - RESOURCE *resource; - int type; - - convert_to_long(resource_id); - resource = php3_list_find(resource_id->value.lval, &type); - if (type != LE_RESOURCE_TYPE) { - php3_error(E_WARNING,"resource index %d has the wrong type",resource_id->value.lval); - RETURN_FALSE; - } - ...use resource... - - Deleting an existing resource: - - pval *resource_id; - RESOURCE *resource; - int type; - - convert_to_long(resource_id); - php3_list_delete(resource_id->value.lval); - - - The resource types should be registered in php3_list.h, in enum - list_entry_type. In addition, one should add shutdown code for any - new resource type defined, in list.c's list_entry_destructor() (even if - you don't have anything to do on shutdown, you must add an empty case). - -------------------- - -10. Using the persistent resource table - - PHP 3.0 has a standard way of storing persistent resources (i.e., - resources that are kept in between hits). The first module to use - this feature was the MySQL module, and mSQL followed it, so one can - get the general impression of how a persistent resource should be - used by reading mysql.c. The functions you should look at are: - php3_mysql_do_connect() - php3_mysql_connect() - php3_mysql_pconnect() - - The general idea of persistence modules is this: - 1. Code all of your module to work with the regular resource list - mentioned in section (9). - 2. Code extra connect functions that check if the resource already - exists in the persistent resource list. If it does, register it - as in the regular resource list as a pointer to the persistent - resource list (because of 1., the rest of the code - should work immediately). If it doesn't, then create it, add it - to the persistent resource list AND add a pointer to it from the - regular resource list, so all of the code would work since it's - in the regular resource list, but on the next connect, the - resource would be found in the persistent resource list and be - used without having to recreate it. - You should register these resources with a different type (e.g. - LE_MYSQL_LINK for non-persistent link and LE_MYSQL_PLINK for - a persistent link). - - If you read mysql.c, you'll notice that except for the more complex - connect function, nothing in the rest of the module has to be changed. - - The very same interface exists for the regular resource list and the - persistent resource list, only 'list' is replaced with 'plist': - - php3_plist_insert(ptr, type) returns the 'id' of the newly inserted resource - php3_plist_delete(id) delete the resource with the specified id - php3_plist_find(id,*type) returns the pointer of the resource with the specified id, updates 'type' to the resource's type - - However, it's more than likely that these functions would prove - to be useless for you when trying to implement a persistent module. - Typically, one would want to use the fact that the persistent resource - list is really a hash table. For instance, in the MySQL/mSQL modules, - when there's a pconnect() call (persistent connect), the function - builds a string out of the host/user/passwd that were passed to the - function, and hashes the SQL link with this string as a key. The next - time someone calls a pconnect() with the same host/user/passwd, the - same key would be generated, and the function would find the SQL link - in the persistent list. - - Until further documented, you should look at mysql.c or msql.c to - see how one should use the plist's hash table abilities. - - One important thing to note: resources going into the persistent - resource list must *NOT* be allocated with PHP's memory manager, i.e., - they should NOT be created with emalloc(), estrdup(), etc. Rather, - one should use the regular malloc(), strdup(), etc. The reason for - this is simple - at the end of the request (end of the hit), every - memory chunk that was allocated using PHP's memory manager is deleted. - Since the persistent list isn't supposed to be erased at the end - of a request, one mustn't use PHP's memory manager for allocating - resources that go to it. - - Shutting down persistent resources: - - When you register resource that's going to be in the persistent list, - you should add destructors to it both in the non-persistent list - and in the persistent list. - The destructor in the non-persistent list destructor shouldn't do anything. - The one in the persistent list destructor should properly free any - resources obtained by that type (e.g. memory, SQL links, etc). Just like - with the non-persistent resources, you *MUST* add destructors for every - resource, even it requires no destructotion and the destructor would - be empty. - Remember, since emalloc() and friends aren't to be used in conjunction - with the persistent list, you mustn't use efree() here either. - -------------------- - -11. Adding runtime configuration directives - -Many of the features of PHP3 can be configured at runtime. These -configuration directives can appear in either the designated php3.ini -file, or in the case of the Apache module version in the Apache .conf -files. The advantage of having them in the Apache .conf files is that -they can be configured on a per-directory basis. This means that one -directory may have a certain safemodeexecdir for example, while another -directory may have another. This configuration granularity is especially -handy when a server supports multiple virtual hosts. - -The steps required to add a new directive: - - 1. Add directive to php3_ini_structure struct in mod_php4.h. - - 2. In main.c, edit the php3_module_startup function and add the - appropriate cfg_get_string() or cfg_get_long() call. - - 3. Add the directive, restrictions and a comment to the php3_commands - structure in mod_php4.c. Note the restrictions part. RSRC_CONF are - directives that can only be present in the actual Apache .conf files. - Any OR_OPTIONS directives can be present anywhere, include normal - .htaccess files. - - 4. In either php3take1handler() or php3flaghandler() add the appropriate - entry for your directive. - - 5. In the configuration section of the _php3_info() function in - functions/info.c you need to add your new directive. - - 6. And last, you of course have to use your new directive somewhere. - It will be addressable as php3_ini.directive diff --git a/build-defs.h.in b/build-defs.h.in deleted file mode 100644 index 3095d6e874dd4..0000000000000 --- a/build-defs.h.in +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- C -*- - +----------------------------------------------------------------------+ - | 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: Stig Sæther Bakken | - +----------------------------------------------------------------------+ - */ - -#define PHP_ADA_INCLUDE "" -#define PHP_ADA_LFLAGS "" -#define PHP_ADA_LIBS "" -#define PHP_APACHE_INCLUDE "" -#define PHP_APACHE_TARGET "" -#define PHP_FHTTPD_INCLUDE "" -#define PHP_FHTTPD_LIB "" -#define PHP_FHTTPD_TARGET "" -#define PHP_BINNAME "@BINNAME@" -#define PHP_CFLAGS "@CFLAGS@" -#define PHP_DBASE_LIB "" -#define PHP_DEBUG "@DEBUG_CFLAGS@" -#define PHP_GDBM_INCLUDE "" -#define PHP_HSREGEX "" -#define PHP_IBASE_INCLUDE "" -#define PHP_IBASE_LFLAGS "" -#define PHP_IBASE_LIBS "" -#define PHP_IFX_INCLUDE "" -#define PHP_IFX_LFLAGS "" -#define PHP_IFX_LIBS "" -#define PHP_INSTALL_IT "@INSTALL_IT@" -#define PHP_IODBC_INCLUDE "" -#define PHP_IODBC_LFLAGS "" -#define PHP_IODBC_LIBS "" -#define PHP_MSQL_INCLUDE "" -#define PHP_MSQL_LFLAGS "" -#define PHP_MSQL_LIBS "" -#define PHP_MYSQL_INCLUDE "" -#define PHP_MYSQL_LFLAGS "" -#define PHP_MYSQL_LIBS "" -#define PHP_ODBC_TYPE "@ODBC_TYPE@" -#define PHP_ODBC_INCLUDE "@ODBC_INCLUDE@" -#define PHP_ODBC_LFLAGS "@ODBC_LFLAGS@" -#define PHP_ODBC_LIBS "@ODBC_LIBS@" -#define PHP_ORACLE_HOME "" -#define PHP_ORACLE_INCLUDE "" -#define PHP_ORACLE_LFLAGS "" -#define PHP_ORACLE_LIBS "" -#define PHP_ORACLE_SHLIBS "" -#define PHP_ORACLE_STLIBS "" -#define PHP_ORACLE_VERSION "" -#define PHP_PGSQL_INCLUDE "" -#define PHP_PGSQL_LFLAGS "" -#define PHP_PGSQL_LIBS "" -#define PHP_PROG_SENDMAIL "@PROG_SENDMAIL@" -#define PHP_REGEX_LIB "" -#define PHP_SOLID_INCLUDE "" -#define PHP_SOLID_LIBS "" -#define PHP_EMPRESS_INCLUDE "" -#define PHP_EMPRESS_LIBS "" -#define PHP_SYBASE_INCLUDE "" -#define PHP_SYBASE_LFLAGS "" -#define PHP_SYBASE_LIBS "" -#define PHP_DBM_TYPE "" -#define PHP_DBM_LIB "" -#define PHP_LDAP_LFLAGS "" -#define PHP_LDAP_INCLUDE "" -#define PHP_LDAP_LIBS "" -#define PHP_VELOCIS_INCLUDE "" -#define PHP_VELOCIS_LIBS "" - diff --git a/build.mk b/build.mk deleted file mode 100644 index 69c52cee2c214..0000000000000 --- a/build.mk +++ /dev/null @@ -1,86 +0,0 @@ -# Makefile to generate build tools -# -# Standard usage: -# make -f build.mk -# -# To prepare a self-contained distribution: -# make -f build.mk dist -# -# -# Written by Sascha Schumann -# -# $Id$ - -LT_TARGETS = ltconfig ltmain.sh config.guess config.sub - -SUBDIRS = libzend TSRM - -makefile_am_files = Makefile.am $(shell find ext sapi regex -name Makefile.am) -makefile_in_files = $(makefile_am_files:.am=.in) -makefile_files = $(makefile_am_files:e.am=e) - -config_h_in = php_config.h.in - -config_h_files = \ - $(shell echo ext/*/config.h.stub sapi/*/config.h.stub) - -config_m4_files = \ - $(shell echo ext/*/config.m4 sapi/*/config.m4) - -acconfig_h_SOURCES = acconfig.h.in $(config_h_files) - -targets = $(makefile_in_files) configure $(config_h_in) - -all: $(targets) - @for i in $(SUBDIRS); do \ - test -d $$i || (test -d ../$$i && ln -s ../$$i $$i); \ - (cd $$i && $(MAKE) -f build.mk AMFLAGS=$(AMFLAGS)); \ - done - -dist: - @rm -f $(SUBDIRS) 2>/dev/null || true - @for i in $(SUBDIRS); do \ - test -d $$i || (test -d ../$$i && cp -rp ../$$i $$i); \ - done - @find . -type l -exec rm {} \; - $(MAKE) AMFLAGS=--copy -f build.mk - -clean: - rm -f $(targets) - @for i in $(SUBDIRS); do \ - (cd $$i && $(MAKE) -f build.mk clean); \ - done - -cvsclean: - @for i in $(shell find . -follow -name .cvsignore); do \ - (cd `dirname $$i` && rm -rf `cat .cvsignore`); \ - done - @rm -f $(SUBDIRS) 2>/dev/null || true - -acconfig.h: $(acconfig_h_SOURCES) - @echo rebuilding $@ - @cat $(acconfig_h_SOURCES) > $@ - -$(makefile_in_files): $(makefile_am_files) aclocal.m4 - @echo rebuilding Makefile.in\'s - @for i in $(LT_TARGETS); do \ - if test -f "$$i"; then \ - mv $$i $$i.bak; \ - cp $$i.bak $$i; \ - fi; \ - done - @automake -a -i $(AMFLAGS) $(makefile_files) 2>&1 \ - | grep -v PHP_OUTPUT_FILES || true >&2 - @for i in $(LT_TARGETS); do mv $$i.bak $$i; done - -aclocal.m4: configure.in acinclude.m4 - aclocal - -$(config_h_in): configure.in acconfig.h -# explicitly remove target since autoheader does not seem to work -# correctly otherwise (timestamps are not updated) - @rm -f $@ - autoheader - -configure: aclocal.m4 configure.in $(config_m4_files) - autoconf diff --git a/buildconf b/buildconf deleted file mode 100755 index 4c5332d41eea9..0000000000000 --- a/buildconf +++ /dev/null @@ -1,156 +0,0 @@ -#!/bin/sh - -supplied_flag=$1 - -# do some version checking for the tools we use -if test "$1" = "--force"; then - shift -# this is a posix correct "test -nt" -elif test "`ls -t buildconf buildconf.stamp 2>/dev/null |head -1`" != "buildconf"; then - : -else - echo "buildconf: checking installation..." - - # autoconf 2.13 or newer - ac_version=`autoconf --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` - if test "$ac_version" = ""; then - echo "buildconf: autoconf not found." - echo " You need autoconf version 2.13 or newer installed" - echo " to build PHP from CVS." - exit 1 - fi - IFS=.; set $ac_version; IFS=' ' - if test "$1" = "2" -a "$2" -lt "13" || test "$1" -lt "2"; then - echo "buildconf: autoconf version $ac_version found." - echo " You need autoconf version 2.13 or newer installed" - echo " to build PHP from CVS." - exit 1 - else - echo "buildconf: autoconf version $ac_version (ok)" - fi - - # automake 1.4 or newer - am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` - if test "$am_version" = ""; then - echo "buildconf: automake not found." - echo " You need automake version 1.4 or newer installed" - echo " to build PHP from CVS." - exit 1 - fi - IFS=.; set $am_version; IFS=' ' - if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then - echo "buildconf: automake version $am_version found." - echo " You need automake version 1.4 or newer installed" - echo " to build PHP from CVS." - exit 1 - else - echo "buildconf: automake version $am_version (ok)" - fi - - # libtool 1.3.3 or newer - lt_pversion=`libtool --version 2>/dev/null|sed -e 's/^[^0-9]*//' -e 's/[- ].*//'` - if test "$lt_pversion" = ""; then - echo "buildconf: libtool not found." - echo " You need libtool version 1.3 or newer installed" - echo " to build PHP from CVS." - exit 1 - fi - lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'` - IFS=.; set $lt_version; IFS=' ' - if test "$1" -gt "1" || test "$2" -gt "3" || test "$2" = "3" -a "$3" -ge "3" - then - echo "buildconf: libtool version $lt_pversion (ok)" - else - echo "buildconf: libtool version $lt_pversion found." - echo " You need libtool version 1.3.3 or newer installed" - echo " to build PHP from CVS." - exit 1 - fi - touch buildconf.stamp -fi - -am_prefix=`which automake | sed -e 's#/[^/]*/[^/]*$##'` -lt_prefix=`which libtool | sed -e 's#/[^/]*/[^/]*$##'` -if test "$am_prefix" != "$lt_prefix"; then - echo "buildconf: WARNING: automake and libtool are installed in different" - echo " directories. This may cause aclocal to fail." - echo "buildconf: continuing anyway" -fi - -if test "$supplied_flag" = "--copy"; then - automake_flags=--copy -fi - -if test ! -d libzend; then - if test -d ../libzend; then - echo "buildconf: linking ../libzend to ./libzend" - ln -s ../libzend . - else - echo "buildconf: can not find libzend" - echo " libzend should be installed in . or .., how to fetch:" - echo "" - echo " cvs -d :pserver:cvsread@cvs.zend.com:/repository login" - echo " (password \"zend\")" - echo " cvs -d :pserver:cvsread@cvs.zend.com:/repository co libzend" - echo "" - exit 1 - fi -fi -if test ! -d TSRM; then - if test -d ../TSRM; then - echo "buildconf: linking ../TSRM to ./TSRM" - ln -s ../TSRM . - else - echo "buildconf: can not find TSRM" - echo " TSRM should be installed in . or .., how to fetch:" - echo "" - echo " cvs -d :pserver:cvsread@cvs.zend.com:/repository login" - echo " (password \"zend\")" - echo " cvs -d :pserver:cvsread@cvs.zend.com:/repository co TSRM" - echo "" - exit 1 - fi -fi - -./scripts/preconfig - -mv aclocal.m4 aclocal.m4.old 2>/dev/null -aclocal -if test "$?" != "0" -a "$am_prefix" != "$lt_prefix"; then - echo "buildconf: ERROR: aclocal failed, probably because automake and" - echo " libtool are installed with different prefixes;" - echo " automake is installed in $am_prefix, but libtool in $lt_prefix." - echo " Please re-install automake and/or libtool with a common prefix" - echo " and try again." - exit 1 -fi - -if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then - echo "buildconf: keeping aclocal.m4" - mv aclocal.m4.old aclocal.m4 -else - echo "buildconf: created or modified aclocal.m4" -fi - -autoheader - -# find all Makefile.ams -files="Makefile `find ext sapi regex -name Makefile.am | sed 's#\.am##' | tr '\n' ' '`" - -# suppress stupid automake warning -automake --add-missing --include-deps $automake_flags $files 2>&1 | grep -v \$PHP_OUTPUT_FILES >&2 - - -mv configure configure.old 2>/dev/null -autoconf -if cmp configure.old configure > /dev/null 2>&1; then - echo "buildconf: keeping configure" - mv configure.old configure -else - echo "buildconf: created or modified configure" -fi - -if test "$supplied_flag" != "--local"; then - (cd libzend; ./buildconf $automake_flags libzend/) - (cd TSRM; ./buildconf $automake_flags TSRM/) -fi diff --git a/calendar.mak b/calendar.mak deleted file mode 100644 index f82afc2f6c825..0000000000000 --- a/calendar.mak +++ /dev/null @@ -1,244 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on calendar.dsp -!IF "$(CFG)" == "" -CFG=calendar - Win32 Debug -!MESSAGE No configuration specified. Defaulting to calendar - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "calendar - Win32 Release" && "$(CFG)" != "calendar - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "calendar.mak" CFG="calendar - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "calendar - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "calendar - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "calendar - Win32 Release" - -OUTDIR=.\module_release -INTDIR=.\module_release -# Begin Custom Macros -OutDir=.\module_release -# End Custom Macros - -ALL : "$(OUTDIR)\php3_calendar.dll" - - -CLEAN : - -@erase "$(INTDIR)\calendar.obj" - -@erase "$(INTDIR)\dow.obj" - -@erase "$(INTDIR)\french.obj" - -@erase "$(INTDIR)\gregor.obj" - -@erase "$(INTDIR)\jewish.obj" - -@erase "$(INTDIR)\julian.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\php3_calendar.dll" - -@erase "$(OUTDIR)\php3_calendar.exp" - -@erase "$(OUTDIR)\php3_calendar.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\calendar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\calendar.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:1 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_calendar.pdb" /machine:I386 /out:"$(OUTDIR)\php3_calendar.dll" /implib:"$(OUTDIR)\php3_calendar.lib" /libpath:"cgi_release" -LINK32_OBJS= \ - "$(INTDIR)\calendar.obj" \ - "$(INTDIR)\dow.obj" \ - "$(INTDIR)\french.obj" \ - "$(INTDIR)\gregor.obj" \ - "$(INTDIR)\jewish.obj" \ - "$(INTDIR)\julian.obj" - -"$(OUTDIR)\php3_calendar.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "calendar - Win32 Debug" - -OUTDIR=.\module_debug -INTDIR=.\module_debug -# Begin Custom Macros -OutDir=.\module_debug -# End Custom Macros - -ALL : "$(OUTDIR)\php3_calendar.dll" - - -CLEAN : - -@erase "$(INTDIR)\calendar.obj" - -@erase "$(INTDIR)\dow.obj" - -@erase "$(INTDIR)\french.obj" - -@erase "$(INTDIR)\gregor.obj" - -@erase "$(INTDIR)\jewish.obj" - -@erase "$(INTDIR)\julian.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\php3_calendar.dll" - -@erase "$(OUTDIR)\php3_calendar.exp" - -@erase "$(OUTDIR)\php3_calendar.ilk" - -@erase "$(OUTDIR)\php3_calendar.lib" - -@erase "$(OUTDIR)\php3_calendar.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /D "DEBUG" /D "_DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\calendar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\calendar.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:1 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_calendar.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_calendar.dll" /implib:"$(OUTDIR)\php3_calendar.lib" /pdbtype:sept /libpath:"cgi_debug" -LINK32_OBJS= \ - "$(INTDIR)\calendar.obj" \ - "$(INTDIR)\dow.obj" \ - "$(INTDIR)\french.obj" \ - "$(INTDIR)\gregor.obj" \ - "$(INTDIR)\jewish.obj" \ - "$(INTDIR)\julian.obj" - -"$(OUTDIR)\php3_calendar.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("calendar.dep") -!INCLUDE "calendar.dep" -!ELSE -!MESSAGE Warning: cannot find "calendar.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "calendar - Win32 Release" || "$(CFG)" == "calendar - Win32 Debug" -SOURCE=.\dl\calendar\calendar.c - -"$(INTDIR)\calendar.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dl\calendar\dow.c - -"$(INTDIR)\dow.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dl\calendar\french.c - -"$(INTDIR)\french.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dl\calendar\gregor.c - -"$(INTDIR)\gregor.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dl\calendar\jewish.c - -"$(INTDIR)\jewish.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dl\calendar\julian.c - -"$(INTDIR)\julian.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - - -!ENDIF - diff --git a/config.guess b/config.guess deleted file mode 100644 index 6cb567b8ae6c0..0000000000000 --- a/config.guess +++ /dev/null @@ -1,1087 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 -# Free Software Foundation, Inc. -# -# This file 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 2 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Written by Per Bothner . -# The master version of this file is at the FSF in /home/gd/gnu/lib. -# Please send patches to the Autoconf mailing list . -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# - -# Use $HOST_CC if defined. $CC may point to a cross-compiler -if test x"$CC_FOR_BUILD" = x; then - if test x"$HOST_CC" != x; then - CC_FOR_BUILD="$HOST_CC" - else - if test x"$CC" != x; then - CC_FOR_BUILD="$CC" - else - CC_FOR_BUILD=cc - fi - fi -fi - - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 8/24/94.) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - cat <$dummy.s - .globl main - .ent main -main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-cbm-sysv4 - exit 0;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - arc64:OpenBSD:*:*) - echo mips64el-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hkmips:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - SR2?01:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - atari*:NetBSD:*:*) - echo m68k-atari-netbsd${UNAME_RELEASE} - exit 0 ;; - atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; - sun3*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} - exit 0 ;; - sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - macppc:NetBSD:*:*) - echo powerpc-apple-netbsd${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ - -o ${TARGET_BINARY_INTERFACE}x = x ] ; then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i?86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:4) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=4.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[34678]??:HP-UX:*:*) - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - sed 's/^ //' << EOF >$dummy.c - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - ($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` - rm -f $dummy.c $dummy - esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - *9??*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i?86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - hppa*:OpenBSD:*:*) - echo hppa-unknown-openbsd - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*X-MP:*:*:*) - echo xmp-cray-unicos - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} - exit 0 ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} - exit 0 ;; - CRAY*T3E:*:*:*) - echo t3e-cray-unicosmk${UNAME_RELEASE} - exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; - F300:UNIX_System_V:*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - i?86:BSD/386:*:* | i?86:BSD/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - if test -x /usr/bin/objformat; then - if test "elf" = "`/usr/bin/objformat`"; then - echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` - exit 0 - fi - fi - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; - *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix - exit 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - *:Linux:*:*) - # uname on the ARM produces all sorts of strangeness, and we need to - # filter it out. - case "$UNAME_MACHINE" in - armv*) UNAME_MACHINE=$UNAME_MACHINE ;; - arm* | sa110*) UNAME_MACHINE="arm" ;; - esac - - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - ld_help_string=`cd /; ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d - s/[ ][ ]*/ /g - s/.*supported emulations: *// - s/ .*// - p'` - case "$ld_supported_emulations" in - i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; - i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; - sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf32ppc) - # Determine Lib Version - cat >$dummy.c < -#if defined(__GLIBC__) -extern char __libc_version[]; -extern char __libc_release[]; -#endif -main(argc, argv) - int argc; - char *argv[]; -{ -#if defined(__GLIBC__) - printf("%s %s\n", __libc_version, __libc_release); -#else - printf("unkown\n"); -#endif - return 0; -} -EOF - LIBC="" - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy | grep 1\.99 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.c $dummy - echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;; - esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <$dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - LIBC="" - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - - objdump --private-headers $dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >$dummy.c </dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac - # Determine whether the default compiler is a.out or elf - cat >$dummy.c < -#ifdef __cplusplus - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -#else - printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - fi ;; -# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions -# are messed up and put the nodename in both sysname and nodename. - i?86:DYNIX/ptx:4*:*) - echo i386-sequent-sysv4 - exit 0 ;; - i?86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} - fi - exit 0 ;; - i?86:*:5:7*) - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) && UNAME_MACHINE=i585 - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE} - exit 0 ;; - i?86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - pc:*:*:*) - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:*:6*) - echo mips-sony-newsos6 - exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -#if !defined (ultrix) - printf ("vax-dec-bsd\n"); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 -rm -f $dummy.c $dummy - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -#echo '(Unable to guess system type)' 1>&2 - -exit 1 diff --git a/config.sub b/config.sub deleted file mode 100644 index 2436b45347a98..0000000000000 --- a/config.sub +++ /dev/null @@ -1,1215 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc. -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file 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 2 of the License, 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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -if [ x$1 = x ] -then - echo Configuration name missing. 1>&2 - echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 - echo "or $0 ALIAS" 1>&2 - echo where ALIAS is a recognized configuration type. 1>&2 - exit 1 -fi - -# First pass through any local machine types. -case $1 in - *local*) - echo $1 - exit 0 - ;; - *) - ;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - linux-gnu*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=vxworks - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 \ - | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ - | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \ - | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ - | mips64orion | mips64orionel | mipstx39 | mipstx39el \ - | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ - | mips64vr5000 | miprs64vr5000el \ - | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ - | thumb | d10v) - basic_machine=$basic_machine-unknown - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65) - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i[34567]86) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ - | xmp-* | ymp-* \ - | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \ - | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \ - | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ - | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ - | mipstx39-* | mipstx39el-* \ - | f301-* | armv*-* | t3e-* \ - | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ - | thumb-* | v850-* | d30v-* | tic30-* | c30-* ) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-cbm - ;; - amigaos | amigados) - basic_machine=m68k-cbm - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-cbm - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | ymp) - basic_machine=ymp-cray - os=-unicos - ;; - cray2) - basic_machine=cray2-cray - os=-unicos - ;; - [ctj]90-cray) - basic_machine=c90-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - os=-mvs - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i[34567]86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i[34567]86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i[34567]86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i[34567]86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - i386-go32 | go32) - basic_machine=i386-unknown - os=-go32 - ;; - i386-mingw32 | mingw32) - basic_machine=i386-unknown - os=-mingw32 - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | *MiNT) - basic_machine=m68k-atari - os=-mint - ;; - mipsel*-linux*) - basic_machine=mipsel-unknown - os=-linux-gnu - ;; - mips*-linux*) - basic_machine=mips-unknown - os=-linux-gnu - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - msdos) - basic_machine=i386-unknown - os=-msdos - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-corel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - np1) - basic_machine=np1-gould - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | k6 | nexen) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexen-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=rs6000-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sparclite-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=t3e-cray - os=-unicos - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xmp) - basic_machine=xmp-cray - os=-unicos - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - mips) - if [ x$os = x-linux-gnu ]; then - basic_machine=mips-unknown - else - basic_machine=mips-mips - fi - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sparc | sparcv9) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -ns2 ) - os=-nextstep2 - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -*MiNT) - os=-mint - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-corel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f301-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -*MiNT) - vendor=atari - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os diff --git a/configure.in b/configure.in deleted file mode 100644 index f9782e9c98c40..0000000000000 --- a/configure.in +++ /dev/null @@ -1,758 +0,0 @@ -dnl ## $Id$ -*- sh -*- -dnl ## Process this file with autoconf to produce a configure script. - -divert(0) - -AC_INIT(main.c) - -if test "$with_shared_apache" != "no" && test -n "$with_shared_apache" ; then - AC_MSG_ERROR(--with-shared-apache is not supported. Please refer to the documentation for using APXS) -fi - -if test -n "$with_apache" && test -n "$with_apxs"; then - AC_MSG_ERROR(--with-apache and --with-apxs cannot be used together) -fi - -cwd=`pwd` -passthru="$@" - -dnl ## Diversion 1 is the initial checking of OS features, programs, -dnl ## libraries and so on. - -dnl ## In diversion 2 we check for compile-time options to the PHP -dnl ## core and how to deal with different system dependencies. This -dnl ## includes what regex library is used and whether debugging or short -dnl ## tags are enabled, and the default behaviour of php.ini options. -dnl ## This is also where an SAPI interface is selected (choosing between -dnl ## Apache module, CGI etc.) - -dnl ## In diversion 3 we check which extensions should be compiled. -dnl ## All of these are normally in the extension directories. - -dnl ## Diversion 4 is the last one. Here we generate files and clean up. - -divert(1) - -dnl ## This is where the version number is changed from now on! -AM_INIT_AUTOMAKE(php, 4.0b4-dev) - -PHP_VERSION=$VERSION -echo "/* automatically generated by configure */" > php_version.h.new -echo "/* edit configure.in.in to change version number */" >> php_version.h.new -echo "#define PHP_VERSION \"$PHP_VERSION\"" >> php_version.h.new -cmp php_version.h.new php_version.h >/dev/null 2>&1 -if test $? -ne 0 ; then - rm -f php_version.h && mv php_version.h.new php_version.h && \ - echo 'Updated php_version.h' -else - rm -f php_version.h.new -fi -AC_SUBST(PHP_VERSION) - -AM_CONFIG_HEADER(php_config.h) -AM_MAINTAINER_MODE - -phplibdir=$libdir/php -AC_SUBST(phplibdir) - -dnl We want this one before the checks, so the checks can modify CFLAGS. -test -z "$CFLAGS" && auto_cflags=1 - -dnl If we're using cc on HP-UX, add -Ae -D_HPUX_SOURCE [obsolete] -dnl if test -n "$auto_cflags" && test "`uname -s 2>/dev/null`" = "HP-UX"; then -dnl test -n "$GCC" || CFLAGS="-Ae $CFLAGS -D_HPUX_SOURCE" -dnl fi - -dnl Checks for programs. -AC_PROG_YACC -if test "$YACC" != "bison -y"; then - AC_MSG_WARN(You will need bison if you want to regenerate the PHP parsers.) -else - AC_MSG_CHECKING(bison version) - oldIFS=$IFS; IFS=. - set `bison -V | sed -e 's/^GNU Bison version //'` - IFS=$oldIFS - if test "$1" = "1" -a "$2" -lt "25"; then - AC_MSG_WARN(Bison 1.25 or newer needed to regenerate parsers (found $1.$2).) - fi - AC_MSG_RESULT($1.$2 (ok)) -fi - -dnl ## there has to be a better way... -dnl## OLDLIBS=$LIBS; LIBS="" -AC_PROG_CC -dnl## LIBS=$OLDLIBS - -AM_PROG_CC_STDC - -AC_PROG_RANLIB -AC_PROG_CC_C_O -AC_PROG_LN_S -AC_PATH_PROG(PERL_PATH, perl) - -AM_PROG_LEX - -dnl Make flex scanners use const if they can, even if __STDC__ is not -dnl true, for compilers like Sun's that only set __STDC__ true in -dnl "limit-to-ANSI-standard" mode, not in "ANSI-compatible" mode -AC_C_CONST -if test "$ac_cv_c_const" = "yes" ; then - LEX_CFLAGS="-DYY_USE_CONST" -fi -AC_SUBST(LEX_CFLAGS) - -dnl Hack to work around a Mac OS X cpp problem -dnl Known versions needing this workaround are 5.3 and 5.4 -if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then - CPPFLAGS="$CPPFLAGS -traditional-cpp" -fi - -dnl Ugly hack to get around a problem with gcc on AIX. -if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \ - "`uname -sv`" = "AIX 4"; then - CFLAGS=`echo $CFLAGS | sed -e 's/-g//'` -fi - -dnl check for -R, etc. switch -AC_MSG_CHECKING(if compiler supports -R) -AC_CACHE_VAL(php_cv_cc_dashr,[ - SAVE_LIBS="${LIBS}" - LIBS="-R /usr/lib ${LIBS}" - AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no) - LIBS="${SAVE_LIBS}"]) -AC_MSG_RESULT($php_cv_cc_dashr) -if test $php_cv_cc_dashr = "yes"; then - ld_runpath_switch="-R" -else - AC_MSG_CHECKING([if compiler supports -Wl,-rpath,]) - AC_CACHE_VAL(php_cv_cc_rpath,[ - SAVE_LIBS="${LIBS}" - LIBS="-Wl,-rpath,/usr/lib ${LIBS}" - AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no) - LIBS="${SAVE_LIBS}"]) - AC_MSG_RESULT($php_cv_cc_rpath) - if test $php_cv_cc_rpath = "yes"; then - ld_runpath_switch="-Wl,-rpath," - else - dnl something innocuous - ld_runpath_switch="-L" - fi -fi - -dnl AC_PROG_INSTALL -AC_PATH_PROG(PROG_SENDMAIL, sendmail, /usr/lib/sendmail, $PATH /usr/bin /usr/sbin /usr/etc /etc /usr/ucblib) -if test -n "$PROG_SENDMAIL"; then - AC_DEFINE(HAVE_SENDMAIL) -fi - -dnl -dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary -dnl and source packages. This should be harmless on other OSs. -dnl -if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then - CFLAGS="$CFLAGS -I/usr/pkg/include" - LDFLAGS="$LDFLAGS -L/usr/pkg/lib" -fi - -INCLUDES="-I\$(top_builddir)/libzend -I\$(top_srcdir) -I\$(top_srcdir)/libzend" -AC_SUBST(INCLUDES) - -AC_CHECK_LIB(nsl, gethostname, [ - AC_ADD_LIBRARY(nsl) - AC_DEFINE(HAVE_LIBNSL) ], []) - -AC_CHECK_LIB(socket, socket, [ - AC_ADD_LIBRARY(socket) - AC_DEFINE(HAVE_LIBSOCKET) ], []) - -AC_CHECK_LIB(nsl, gethostbyaddr, [ - AC_ADD_LIBRARY(nsl) - AC_DEFINE(HAVE_LIBNSL) ], []) - -AC_CHECK_LIB(crypt, crypt, [ - AC_ADD_LIBRARY(crypt) - AC_DEFINE(HAVE_LIBCRYPT) ], []) - -dnl The sin may be in a library which need not be specifed -dnl as well as res_search resides in libsocket -AC_CHECK_LIB(m, sin) - -dnl The res_search may be in libsocket as well, and if it is -dnl make sure to check for dn_skipname in libresolv, or if res_search -dnl is in neither of these libs, still check for dn_skipname in libresolv -AC_CHECK_LIB(socket, res_search, [ - AC_CHECK_LIB(resolv, dn_skipname) - AC_CHECK_LIB(resolv, __dn_skipname) - LIBS="$LIBS -lsocket" - AC_DEFINE(HAVE_LIBSOCKET) ], [ - AC_CHECK_LIB(resolv, res_search, [ - LIBS="$LIBS -lresolv" - AC_DEFINE(HAVE_LIBRESOLV) - ], [ - AC_CHECK_LIB(resolv, dn_skipname) - AC_CHECK_LIB(resolv, __dn_skipname) - ]) -]) - -dnl Checks for header files. -AC_HEADER_STDC - -dnl In QNX opendir resides in libc but dirent.h is still required -if test "`uname -s 2>/dev/null`" != "QNX"; then - AC_HEADER_DIRENT -else - AC_CHECK_HEADERS(dirent.h) -fi -AC_MISSING_FCLOSE_DECL -dnl QNX requires unix.h to allow functions in libunix to work properly -AC_CHECK_HEADERS( -arpa/inet.h \ -crypt.h \ -dlfcn.h \ -fcntl.h \ -grp.h \ -limits.h \ -locale.h \ -memory.h \ -netinet/in.h \ -pwd.h \ -signal.h \ -stdarg.h \ -stdlib.h \ -string.h \ -sys/file.h \ -sys/mman.h \ -sys/select.h \ -sys/socket.h \ -sys/statfs.h \ -sys/statvfs.h \ -sys/time.h \ -sys/types.h \ -sys/varargs.h \ -sys/wait.h \ -syslog.h \ -unistd.h \ -unix.h \ -) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_STRUCT_TM -AC_STRUCT_TIMEZONE - -AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff, -[AC_TRY_COMPILE([#include -#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;], - ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)]) - -if test "$ac_cv_struct_tm_gmtoff" = yes; then - AC_DEFINE(HAVE_TM_GMTOFF) -fi - -AC_CACHE_CHECK(for struct flock,php_struct_flock, - AC_TRY_COMPILE([ -#include -#include - ], - [struct flock x;], - [ - php_struct_flock=yes - ],[ - php_struct_flock=no - ]) -) -if test "$php_struct_flock" = "yes" ; then - AC_DEFINE(HAVE_STRUCT_FLOCK, 1) -else - AC_DEFINE(HAVE_STRUCT_FLOCK, 0) -fi - -AC_CHECK_SIZEOF(long, 8) -AC_CHECK_SIZEOF(int, 4) - -dnl Check for members of the stat structure -AC_STRUCT_ST_BLKSIZE -dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists -dnl The WARNING_LEVEL required because cc in QNX hates -w option without an argument -if test "`uname -s 2>/dev/null`" != "QNX"; then - AC_STRUCT_ST_BLOCKS -else - AC_MSG_WARN(warnings level for cc set to 0) - WARNING_LEVEL=0 - AC_SUBST(WARNING_LEVEL) -fi -AC_STRUCT_ST_RDEV - -dnl Checks for types -AC_TYPE_SIZE_T -AC_TYPE_UID_T -dnl This is required for QNX and may be some BSD derived systems -AC_CHECK_TYPE( uint, unsigned int ) -AC_CHECK_TYPE( ulong, unsigned long ) - -dnl Checks for library functions. -AC_FUNC_VPRINTF -AC_CHECK_FUNCS( -crypt \ -cuserid \ -flock \ -gcvt \ -getlogin \ -gethostbyaddr \ -gettimeofday \ -inet_aton \ -link \ -lockf \ -lrand48 \ -memcpy \ -memmove \ -mmap \ -putenv \ -random \ -regcomp \ -rint \ -setitimer \ -setlocale \ -setsockopt \ -setvbuf \ -shutdown \ -sin \ -snprintf \ -srand48 \ -srandom \ -statfs \ -statvfs \ -strcasecmp \ -strdup \ -strerror \ -strftime \ -strstr \ -symlink \ -tempnam \ -tzset \ -unsetenv \ -usleep \ -utime \ -vsnprintf \ -) - -AC_REPLACE_FUNCS(strlcat strlcpy) -AC_FUNC_UTIME_NULL -AC_FUNC_ALLOCA -dnl## OLDLIBS=$LIBS; LIBS="" -dnl This is also defined/used in libzend. To avoid a redefinition -dnl we use that version -dnl AC_BROKEN_SPRINTF -dnl## LIBS=$OLDLIBS -AC_REPLACE_FUNCS(getopt) - -dnl AIX keeps in_addr_t in /usr/include/netinet/in.h -dnl AC_MSG_CHECKING(for in_addr_t) -AC_CACHE_VAL(ac_cv_type_$1, -[AC_EGREP_CPP(dnl -changequote(<<,>>)dnl -<>dnl -changequote([,]), [#include -#if STDC_HEADERS -#include -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl - -dnl AC_MSG_RESULT($ac_cv_type_in_addr_t) -if test $ac_cv_type_in_addr_t = no; then - AC_DEFINE(in_addr_t, u_int) -fi - -divert(2) - -abs_srcdir=`(cd $srcdir; pwd)` -abs_builddir=`pwd` -AC_SUBST(abs_srcdir) -AC_SUBST(abs_builddir) - -AC_MSG_CHECKING(whether to use a configuration file) -AC_ARG_WITH(config-file-path, -[ --with-config-file-path=PATH - Sets the path in which to look for php.ini. - defaults to /usr/local/lib], -[ - if test "$withval" = "yes"; then - AC_DEFINE_UNQUOTED(CONFIGURATION_FILE_PATH, "/usr/local/lib") - AC_DEFINE(USE_CONFIG_FILE, 1) - AC_MSG_RESULT(yes) - else - if test "$withval" != "no"; then - AC_DEFINE_UNQUOTED(CONFIGURATION_FILE_PATH, "$withval") - AC_DEFINE(USE_CONFIG_FILE, 1) - AC_MSG_RESULT(yes) - else - AC_DEFINE(CONFIGURATION_FILE_PATH, 0) - AC_DEFINE(USE_CONFIG_FILE, 0) - AC_MSG_RESULT(no) - fi - fi -],[ - AC_DEFINE_UNQUOTED(CONFIGURATION_FILE_PATH, "/usr/local/lib") - AC_DEFINE(USE_CONFIG_FILE, 1) - AC_MSG_RESULT(yes) -]) - - -AC_MSG_CHECKING(whether to include debugging symbols) -AC_ARG_ENABLE(debug, -[ --disable-debug Compile without debugging symbols], -[ - if test "$enableval" = "yes"; then - AC_MSG_RESULT(yes) - AC_DEFINE(DEBUG,1) - PHP_DEBUG=1 - DEBUG_CFLAGS="-g" - test -n "$GCC" && DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall" - test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \ - DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations" - else - AC_MSG_RESULT(no) - AC_DEFINE(DEBUG,0) - PHP_DEBUG=0 - DEBUG_CFLAGS="" - fi -],[ - AC_MSG_RESULT(yes) - AC_DEFINE(DEBUG,1) - PHP_DEBUG=1 - DEBUG_CFLAGS="-g" -]) -AC_SUBST(DEBUG_CFLAGS) -AC_SUBST(PHP_DEBUG) -CFLAGS="$CFLAGS $DEBUG_CFLAGS" - - -AC_MSG_CHECKING(whether to enable safe mode by default) -AC_ARG_ENABLE(safe-mode, -[ --enable-safe-mode Enable safe mode by default.], -[ - if test "$enableval" = "yes"; then - AC_DEFINE(PHP_SAFE_MODE, 1) - AC_MSG_RESULT(yes) - else - AC_DEFINE(PHP_SAFE_MODE, 0) - AC_MSG_RESULT(no) - fi -],[ - AC_DEFINE(PHP_SAFE_MODE, 0) - AC_MSG_RESULT(no) -]) - - -AC_MSG_CHECKING(for safe mode exec dir) -AC_ARG_WITH(exec-dir, -[ --with-exec-dir[=DIR] Only allow executables in DIR when in safe mode - defaults to /usr/local/php/bin], -[ - if test "$withval" != "no"; then - if test "$withval" = "yes"; then - AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin") - AC_MSG_RESULT(/usr/local/php/bin) - else - AC_DEFINE_UNQUOTED(PHP_SAFE_MODE_EXEC_DIR,"$withval") - AC_MSG_RESULT($withval) - fi - else - AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin") - AC_MSG_RESULT(/usr/local/php/bin) - fi -],[ - AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin") - AC_MSG_RESULT(/usr/local/php/bin) -]) - - -AC_MSG_CHECKING(whether to enable track_vars variables by default) -AC_ARG_ENABLE(track-vars, -[ --enable-track-vars Enable GET/POST/Cookie track variables by default.], -[ - if test "$enableval" = "yes"; then - AC_DEFINE(PHP_TRACK_VARS, 1) - AC_MSG_RESULT(yes) - else - AC_DEFINE(PHP_TRACK_VARS, 0) - AC_MSG_RESULT(no) - fi -],[ - AC_DEFINE(PHP_TRACK_VARS, 0) - AC_MSG_RESULT(no) -]) - - -AC_MSG_CHECKING(whether to enable magic quotes by default) -AC_ARG_ENABLE(magic-quotes, -[ --enable-magic-quotes Enable magic quotes by default.], -[ - if test "$enableval" = "yes"; then - AC_DEFINE(MAGIC_QUOTES, 1) - AC_MSG_RESULT(yes) - else - AC_DEFINE(MAGIC_QUOTES, 0) - AC_MSG_RESULT(no) - fi -],[ - AC_DEFINE(MAGIC_QUOTES, 0) - AC_MSG_RESULT(no) -]) - - -AC_MSG_CHECKING(whether to enable runpaths) -AC_ARG_ENABLE(rpath, -[ --disable-rpath Disable passing additional runtime library - search paths], -[ - if test "$enableval" = "no"; then - enable_rpath=no - else - enable_rpath=yes - fi -],[ - enable_rpath=yes -]) -AC_MSG_RESULT($enable_rpath) - -AC_MSG_CHECKING(whether to enable short tags by default) -AC_ARG_ENABLE(short-tags, -[ --disable-short-tags Disable the short-form $srcdir/ext/bcmath/number.c - echo "creating number.h" - echo "/* Dummy File */" > $srcdir/ext/bcmath/number.h -fi - -if test "$no_recursion" != "yes"; then - (set -x; test -d libzend || mkdir libzend; cd libzend; $cwd/$srcdir/libzend/configure --cache-file=../$cache_file $passthru) || exit 1 - if test "$enable_thread_safety" = "yes"; then - (set -x; test -d TSRM || mkdir TSRM; cd TSRM && $cwd/$srcdir/TSRM/configure --cache-file=../$cache_file $passthru) || exit 1 - fi -dnl (set -x; cd $srcdir; sh ltconfig --disable-static --enable-dlopen --cache-file=$cache_file ltmain.sh) -fi - -# run this only when generating all the files? -if true; then - chmod +x scripts/mkextlib - # Hacking while airborne considered harmful. - # - echo "creating internal_functions.c" - extensions=\`grep '^s.@EXT_STATIC@' \$0|sed -e 's/^.*@% *//' -e 's/%.*$//'\` - mv -f internal_functions.c internal_functions.c.old 2>/dev/null - sh $srcdir/genif.sh $srcdir/internal_functions.c.in $srcdir \$extensions > internal_functions.c - if cmp internal_functions.c.old internal_functions.c > /dev/null 2>&1; then - echo "internal_functions.c is unchanged" - mv internal_functions.c.old internal_functions.c - else - rm -f internal_functions.c.old - fi - - # Warn about CGI version with no extra security options. - if test "$PHP_SAPI" = "cgi"; then - if test "$REDIRECT" = "0"; then - if test "$DISCARD_PATH" = "0"; then - echo "+--------------------------------------------------------------------+" - echo "| Warning: |" - echo "| You will be compiling the CGI version of PHP without any |" - echo "| redirection checking. By putting this cgi binary somewhere in |" - echo "| your web space, users may be able to circumvent existing .htaccess |" - echo "| security by loading files directly through the parser. See |" - echo "| http://www.php.net/manual/config-security.php3 for more details. |" - fi - fi - fi - - echo "+--------------------------------------------------------------------+" - echo "| License: |" - echo "| This software is subject to the PHP License, available in this |" - echo "| distribution in the file LICENSE. By continuing this installation |" - echo "| process, you are bound by the terms of this license agreement. |" - echo "| If you do not agree with the terms of this license, you must abort |" - echo "| the installation process at this point. |" - echo "+--------------------------------------------------------------------+" - -fi - -]) - -divert - -dnl ## Local Variables: -dnl ## tab-width: 4 -dnl ## End: diff --git a/crypt.mak b/crypt.mak deleted file mode 100644 index 9488b2871086f..0000000000000 --- a/crypt.mak +++ /dev/null @@ -1,204 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on crypt.dsp -!IF "$(CFG)" == "" -CFG=crypt - Win32 Debug -!MESSAGE No configuration specified. Defaulting to crypt - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "crypt - Win32 Release" && "$(CFG)" != "crypt - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "crypt.mak" CFG="crypt - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "crypt - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "crypt - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "crypt - Win32 Release" - -OUTDIR=.\module_Release -INTDIR=.\module_Release -# Begin Custom Macros -OutDir=.\module_Release -# End Custom Macros - -ALL : "$(OUTDIR)\php3_crypt.dll" - - -CLEAN : - -@erase "$(INTDIR)\crypt.obj" - -@erase "$(INTDIR)\sflcryp.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\php3_crypt.dll" - -@erase "$(OUTDIR)\php3_crypt.exp" - -@erase "$(OUTDIR)\php3_crypt.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /D HAVE_SFLCRYPT=1 /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\crypt.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\crypt.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_crypt.pdb" /machine:I386 /out:"$(OUTDIR)\php3_crypt.dll" /implib:"$(OUTDIR)\php3_crypt.lib" /libpath:"cgi_release" -LINK32_OBJS= \ - "$(INTDIR)\crypt.obj" \ - "$(INTDIR)\sflcryp.obj" - -"$(OUTDIR)\php3_crypt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "crypt - Win32 Debug" - -OUTDIR=.\module_debug -INTDIR=.\module_debug -# Begin Custom Macros -OutDir=.\module_debug -# End Custom Macros - -ALL : "$(OUTDIR)\php3_crypt.dll" - - -CLEAN : - -@erase "$(INTDIR)\crypt.obj" - -@erase "$(INTDIR)\sflcryp.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\php3_crypt.dll" - -@erase "$(OUTDIR)\php3_crypt.exp" - -@erase "$(OUTDIR)\php3_crypt.ilk" - -@erase "$(OUTDIR)\php3_crypt.lib" - -@erase "$(OUTDIR)\php3_crypt.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /I "../../" /D HAVE_SFLCRYPT=1 /D "DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\crypt.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\crypt.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_crypt.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_crypt.dll" /implib:"$(OUTDIR)\php3_crypt.lib" /pdbtype:sept /libpath:"cgi_debug" -LINK32_OBJS= \ - "$(INTDIR)\crypt.obj" \ - "$(INTDIR)\sflcryp.obj" - -"$(OUTDIR)\php3_crypt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("crypt.dep") -!INCLUDE "crypt.dep" -!ELSE -!MESSAGE Warning: cannot find "crypt.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "crypt - Win32 Release" || "$(CFG)" == "crypt - Win32 Debug" -SOURCE=.\dl\crypt\crypt.c - -"$(INTDIR)\crypt.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dl\crypt\sflcryp.c - -"$(INTDIR)\sflcryp.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - - -!ENDIF - diff --git a/dbase.mak b/dbase.mak deleted file mode 100644 index d1dfd306c9e04..0000000000000 --- a/dbase.mak +++ /dev/null @@ -1,234 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on dbase.dsp -!IF "$(CFG)" == "" -CFG=dbase - Win32 Debug -!MESSAGE No configuration specified. Defaulting to dbase - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "dbase - Win32 Release" && "$(CFG)" != "dbase - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "dbase.mak" CFG="dbase - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "dbase - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "dbase - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "dbase - Win32 Release" - -OUTDIR=.\module_release -INTDIR=.\module_release -# Begin Custom Macros -OutDir=.\module_release -# End Custom Macros - -ALL : "$(OUTDIR)\php3_dbase.dll" - - -CLEAN : - -@erase "$(INTDIR)\dbase.obj" - -@erase "$(INTDIR)\dbf_head.obj" - -@erase "$(INTDIR)\dbf_misc.obj" - -@erase "$(INTDIR)\dbf_ndx.obj" - -@erase "$(INTDIR)\dbf_rec.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\php3_dbase.dll" - -@erase "$(OUTDIR)\php3_dbase.exp" - -@erase "$(OUTDIR)\php3_dbase.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "dbase\\" /I "./" /I "../" /D DBASE=1 /D "NDEBUG" /D "THREAD_SAFE" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbase.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbase.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_dbase.pdb" /machine:I386 /out:"$(OUTDIR)\php3_dbase.dll" /implib:"$(OUTDIR)\php3_dbase.lib" /libpath:"cgi_release" -LINK32_OBJS= \ - "$(INTDIR)\dbase.obj" \ - "$(INTDIR)\dbf_head.obj" \ - "$(INTDIR)\dbf_misc.obj" \ - "$(INTDIR)\dbf_ndx.obj" \ - "$(INTDIR)\dbf_rec.obj" - -"$(OUTDIR)\php3_dbase.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "dbase - Win32 Debug" - -OUTDIR=.\module_debug -INTDIR=.\module_debug -# Begin Custom Macros -OutDir=.\module_debug -# End Custom Macros - -ALL : "$(OUTDIR)\php3_dbase.dll" - - -CLEAN : - -@erase "$(INTDIR)\dbase.obj" - -@erase "$(INTDIR)\dbf_head.obj" - -@erase "$(INTDIR)\dbf_misc.obj" - -@erase "$(INTDIR)\dbf_ndx.obj" - -@erase "$(INTDIR)\dbf_rec.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\php3_dbase.dll" - -@erase "$(OUTDIR)\php3_dbase.exp" - -@erase "$(OUTDIR)\php3_dbase.ilk" - -@erase "$(OUTDIR)\php3_dbase.lib" - -@erase "$(OUTDIR)\php3_dbase.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "dbase\\" /I "./" /I "../" /D DBASE=1 /D "DEBUG" /D "_DEBUG" /D "THREAD_SAFE" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbase.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbase.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_dbase.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_dbase.dll" /implib:"$(OUTDIR)\php3_dbase.lib" /pdbtype:sept /libpath:"cgi_debug" -LINK32_OBJS= \ - "$(INTDIR)\dbase.obj" \ - "$(INTDIR)\dbf_head.obj" \ - "$(INTDIR)\dbf_misc.obj" \ - "$(INTDIR)\dbf_ndx.obj" \ - "$(INTDIR)\dbf_rec.obj" - -"$(OUTDIR)\php3_dbase.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("dbase.dep") -!INCLUDE "dbase.dep" -!ELSE -!MESSAGE Warning: cannot find "dbase.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "dbase - Win32 Release" || "$(CFG)" == "dbase - Win32 Debug" -SOURCE=.\functions\dbase.c - -"$(INTDIR)\dbase.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dbase\dbf_head.c - -"$(INTDIR)\dbf_head.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dbase\dbf_misc.c - -"$(INTDIR)\dbf_misc.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dbase\dbf_ndx.c - -"$(INTDIR)\dbf_ndx.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dbase\dbf_rec.c - -"$(INTDIR)\dbf_rec.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - - -!ENDIF - diff --git a/dbm.mak b/dbm.mak deleted file mode 100644 index 3931f58b680e8..0000000000000 --- a/dbm.mak +++ /dev/null @@ -1,201 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on dbm.dsp -!IF "$(CFG)" == "" -CFG=dbm - Win32 Debug -!MESSAGE No configuration specified. Defaulting to dbm - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "dbm - Win32 Release" && "$(CFG)" != "dbm - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "dbm.mak" CFG="dbm - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "dbm - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "dbm - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "dbm - Win32 Release" - -OUTDIR=.\module_release -INTDIR=.\module_release -# Begin Custom Macros -OutDir=.\module_release -# End Custom Macros - -ALL : "$(OUTDIR)\php3_dbm.dll" - - -CLEAN : - -@erase "$(INTDIR)\db.obj" - -@erase "$(INTDIR)\flock.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\php3_dbm.dll" - -@erase "$(OUTDIR)\php3_dbm.exp" - -@erase "$(OUTDIR)\php3_dbm.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D NDBM=1 /D GDBM=0 /D BSD2=1 /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbm.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbm.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.lib libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:2 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_dbm.pdb" /machine:I386 /out:"$(OUTDIR)\php3_dbm.dll" /implib:"$(OUTDIR)\php3_dbm.lib" /libpath:"..\..\lib" /libpath:"cgi_release" -LINK32_OBJS= \ - "$(INTDIR)\db.obj" \ - "$(INTDIR)\flock.obj" - -"$(OUTDIR)\php3_dbm.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "dbm - Win32 Debug" - -OUTDIR=.\module_debug -INTDIR=.\module_debug - -ALL : "c:\php3\php3_dbm.dll" - - -CLEAN : - -@erase "$(INTDIR)\db.obj" - -@erase "$(INTDIR)\flock.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\php3_dbm.exp" - -@erase "$(OUTDIR)\php3_dbm.lib" - -@erase "$(OUTDIR)\php3_dbm.pdb" - -@erase "c:\php3\php3_dbm.dll" - -@erase "c:\php3\php3_dbm.ilk" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /I "../../include" /D NDBM=1 /D GDBM=0 /D BSD2=1 /D "DEBUG" /D "_DEBUG" /D COMPILE_DL=1 /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbm.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbm.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.lib libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:2 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_dbm.pdb" /debug /machine:I386 /out:"c:\php3/php3_dbm.dll" /implib:"$(OUTDIR)\php3_dbm.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug" -LINK32_OBJS= \ - "$(INTDIR)\db.obj" \ - "$(INTDIR)\flock.obj" - -"c:\php3\php3_dbm.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("dbm.dep") -!INCLUDE "dbm.dep" -!ELSE -!MESSAGE Warning: cannot find "dbm.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "dbm - Win32 Release" || "$(CFG)" == "dbm - Win32 Debug" -SOURCE=.\functions\db.c - -"$(INTDIR)\db.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\win32\flock.c - -"$(INTDIR)\flock.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - - -!ENDIF - diff --git a/dlist.c b/dlist.c deleted file mode 100644 index ea707fc6fb9cf..0000000000000 --- a/dlist.c +++ /dev/null @@ -1,421 +0,0 @@ -/**************************************************************************** -* -* Copyright (C) 1991 Kendall Bennett. -* All rights reserved. -* -* Filename: $RCSfile$ -* Version: $Revision$ -* -* Language: ANSI C -* Environment: any -* -* Description: Module to implement doubly linked lists. Includes a routine -* to peform a mergesort on the doubly linked list. -* -* $Id$ -* -* Revision History: -* ----------------- -* -* $Log$ -* Revision 1.1 1999/07/19 18:58:44 andrey -* Moving dlist stuff into core. -* -* Revision 1.2 1999/05/11 00:01:42 zeev -* * Get Apache to work. POST doesn't work yet. -* * There are now -I directives for the absolute path of php4, php4/libzend and the builddir for -* the Apache module, so we can #include any php/Zend header. -* * Rename config.h to php_config.h -* -* Revision 1.1 1999/04/21 23:11:20 ssb -* moved apache, com and hyperwave into ext/ -* -* Revision 1.1.1.1 1999/04/07 21:03:31 zeev -* PHP 4.0 -* -* Revision 1.1.1.1 1999/03/17 04:29:11 andi -* PHP4 -* -* Revision 1.1.1.1 1998/12/21 07:56:22 andi -* Trying to start the zend CVS tree -* -* Revision 1.1 1998/08/12 09:29:16 steinm -* First version of Hyperwave module. -* -* Revision 1.5 91/12/31 19:39:49 kjb -* Modified include file directories. -* -* Revision 1.4 91/10/28 03:16:39 kjb -* Ported to the Iris. -* -* Revision 1.3 91/09/27 03:09:18 kjb -* Cosmetic change. -* -* Revision 1.2 91/09/03 18:27:42 ROOT_DOS -* Ported to UNIX. -* -* Revision 1.1 91/09/01 18:35:23 ROOT_DOS -* Initial revision -* -****************************************************************************/ - -#ifndef MSVC5 -#include "php_config.h" -#endif - -#include -#include -#include -#include "dlist.h" - -#define PUBLIC -#define PRIVATE static - -PUBLIC void *dlst_newnode(int size) -/**************************************************************************** -* -* Function: dlst_newnode -* Parameters: size - Amount of memory to allocate for node -* Returns: Pointer to the allocated node's user space. -* -* Description: Allocates the memory required for a node, adding a small -* header at the start of the node. We return a reference to -* the user space of the node, as if it had been allocated via -* malloc(). -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *node; - - if ( !(node = (PHP_DLST_BUCKET*)malloc(size + sizeof(PHP_DLST_BUCKET))) ) { - fprintf(stderr,"Not enough memory to allocate list node.\n"); -/* raise(SIGABRT);*/ - return NULL; - } - - return PHP_DLST_USERSPACE(node); /* Return pointer to user space */ -} - -PUBLIC void dlst_freenode(void *node) -/**************************************************************************** -* -* Function: dlst_freenode -* Parameters: node - Node to free. -* -* Description: Frees a node previously allocated with lst_newnode(). -* -****************************************************************************/ -{ - free(PHP_DLST_HEADER(node)); -} - -PUBLIC DLIST *dlst_init(void) -/**************************************************************************** -* -* Function: dlst_init -* Returns: Pointer to a newly created list. -* -* Description: Initialises a list and returns a pointer to it. -* -****************************************************************************/ -{ - DLIST *l; - - if ((l = (DLIST*)malloc(sizeof(DLIST))) != NULL) { - l->count = 0; - l->head = &(l->hz[0]); - l->z = &(l->hz[1]); - l->head->next = l->z->next = l->z; - l->z->prev = l->head->prev = l->head; - } - else { - fprintf(stderr,"Insufficient memory to allocate list\n"); - /*raise(SIGABRT);*/ - return NULL; - } - - return l; -} - -PUBLIC void dlst_kill(DLIST *l,void (*freeNode)(void *node)) -/**************************************************************************** -* -* Function: dlst_kill -* Parameters: l - List to kill -* freeNode - Pointer to user routine to free a node -* -* Description: Kills the list l, by deleting all of the elements contained -* within the list one by one and then deleting the list -* itself. Note that we call the user supplied routine -* (*freeNode)() to free each list node. This allows the user -* program to perform any extra processing needed to kill each -* node (if each node contains pointers to other items on the -* heap for example). If no extra processing is required, just -* pass the address of dlst_freenode(), ie: -* -* dlst_kill(myList,dlst_freenode); -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n,*p; - - n = l->head->next; - while (n != l->z) { /* Free all nodes in list */ - p = n; - n = n->next; - (*freeNode)(PHP_DLST_USERSPACE(p)); - } - free(l); /* Free the list itself */ -} - -PUBLIC void dlst_insertafter(DLIST *l,void *node,void *after) -/**************************************************************************** -* -* Function: lst_insertafter -* Parameters: l - List to insert node into -* node - Pointer to user space of node to insert -* after - Pointer to user space of node to insert node after -* -* Description: Inserts a new node into the list after the node 'after'. To -* insert a new node at the beginning of the list, user the -* macro PHP_DLST_HEAD in place of 'after'. ie: -* -* dlst_insertafter(mylist,node,PHP_DLST_HEAD(mylist)); -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n = PHP_DLST_HEADER(node),*a = PHP_DLST_HEADER(after); - - n->next = a->next; - a->next = n; - n->prev = a; - n->next->prev = n; - l->count++; -} - -PUBLIC void *dlst_deletenext(DLIST *l,void *node) -/**************************************************************************** -* -* Function: lst_deletenext -* Parameters: l - List to delete node from. -* node - Node to delete the next node from -* Returns: Pointer to the deleted node's userspace. -* -* Description: Removes the node AFTER 'node' from the list l. -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n = PHP_DLST_HEADER(node); - - node = PHP_DLST_USERSPACE(n->next); - n->next->next->prev = n; - n->next = n->next->next; - l->count--; - return node; -} - -PUBLIC void *dlst_first(DLIST *l) -/**************************************************************************** -* -* Function: dlst_first -* Parameters: l - List to obtain first node from -* Returns: Pointer to first node in list, NULL if list is empty. -* -* Description: Returns a pointer to the user space of the first node in -* the list. If the list is empty, we return NULL. -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n; - - n = l->head->next; - return (n == l->z ? NULL : PHP_DLST_USERSPACE(n)); -} - -PUBLIC void *dlst_last(DLIST *l) -/**************************************************************************** -* -* Function: dlst_last -* Parameters: l - List to obtain last node from -* Returns: Pointer to last node in list, NULL if list is empty. -* -* Description: Returns a pointer to the user space of the last node in -* the list. If the list is empty, we return NULL. -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n; - - n = l->z->prev; - return (n == l->head ? NULL : PHP_DLST_USERSPACE(n)); -} - -PUBLIC void *dlst_next(void *prev) -/**************************************************************************** -* -* Function: dlst_next -* Parameters: prev - Previous node in list to obtain next node from -* Returns: Pointer to the next node in the list, NULL at end of list. -* -* Description: Returns a pointer to the user space of the next node in the -* list given a pointer to the user space of the previous node. -* If we have reached the end of the list, we return NULL. The -* end of the list is detected when the next pointer of a node -* points back to itself, as does the dummy last node's next -* pointer. This enables us to detect the end of the list -* without needed access to the list data structure itself. -* -* NOTE: We do no checking to ensure that 'prev' is NOT a -* NULL pointer. -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n = PHP_DLST_HEADER(prev); - - n = n->next; - return (n == n->next ? NULL : PHP_DLST_USERSPACE(n)); -} - -PUBLIC void *dlst_prev(void *next) -/**************************************************************************** -* -* Function: dlst_prev -* Parameters: next - Next node in list to obtain previous node from -* Returns: Pointer to the previous node in the list, NULL at start list. -* -* Description: Returns a pointer to the user space of the prev node in the -* list given a pointer to the user space of the next node. -* If we have reached the start of the list, we return NULL. The -* start of the list is detected when the prev pointer of a node -* points back to itself, as does the dummy head node's prev -* pointer. This enables us to detect the start of the list -* without needed access to the list data structure itself. -* -* NOTE: We do no checking to ensure that 'next' is NOT a -* NULL pointer. -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n = PHP_DLST_HEADER(next); - - n = n->prev; - return (n == n->prev ? NULL : PHP_DLST_USERSPACE(n)); -} - -/* Static globals required by merge() */ - -static PHP_DLST_BUCKET *z; -static int (*cmp)(void*,void*); - -PRIVATE PHP_DLST_BUCKET *merge(PHP_DLST_BUCKET *a,PHP_DLST_BUCKET *b,PHP_DLST_BUCKET **end) -/**************************************************************************** -* -* Function: merge -* Parameters: a,b - Sublist's to merge -* Returns: Pointer to the merged sublists. -* -* Description: Merges two sorted lists of nodes together into a single -* sorted list. -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *c; - - /* Go through the lists, merging them together in sorted order */ - - c = z; - while (a != z && b != z) { - if ((*cmp)(PHP_DLST_USERSPACE(a),PHP_DLST_USERSPACE(b)) <= 0) { - c->next = a; c = a; a = a->next; - } - else { - c->next = b; c = b; b = b->next; - } - }; - - /* If one of the lists is not exhausted, then re-attach it to the end - * of the newly merged list - */ - - if (a != z) c->next = a; - if (b != z) c->next = b; - - /* Set *end to point to the end of the newly merged list */ - - while (c->next != z) c = c->next; - *end = c; - - /* Determine the start of the merged lists, and reset z to point to - * itself - */ - - c = z->next; z->next = z; - return c; -} - -PUBLIC void dlst_mergesort(DLIST *l,int (*cmp_func)(void*,void*)) -/**************************************************************************** -* -* Function: dlst_mergesort -* Parameters: l - List to merge sort -* cmp_func - Function to compare two user spaces -* -* Description: Mergesort's all the nodes in the list. 'cmp' must point to -* a comparison function that can compare the user spaces of -* two different nodes. 'cmp' should work the same as -* strcmp(), in terms of the values it returns. Rather than -* waste processing time keeping the previous pointers up to -* date while performing the mergesort, we simply run through -* the list at the end of the sort to fix the previous pointers. -* -****************************************************************************/ -{ - int i,N; - PHP_DLST_BUCKET *a,*b; /* Pointers to sublists to merge */ - PHP_DLST_BUCKET *c; /* Pointer to end of sorted sublists */ - PHP_DLST_BUCKET *head; /* Pointer to dummy head node for list */ - PHP_DLST_BUCKET *todo; /* Pointer to sublists yet to be sorted */ - PHP_DLST_BUCKET *t; /* Temporary */ - - /* Set up globals required by merge() and pointer to head */ - - z = l->z; cmp = cmp_func; head = l->head; - - for (N = 1,a = z; a != head->next; N = N + N) { - todo = head->next; c = head; - while (todo != z) { - - /* Build first sublist to be merged, and splice from main list - */ - - a = t = todo; - for (i = 1; i < N; i++) t = t->next; - b = t->next; t->next = z; t = b; - - /* Build second sublist to be merged and splice from main list - */ - - for (i = 1; i < N; i++) t = t->next; - todo = t->next; t->next = z; - - /* Merge the two sublists created, and set 'c' to point to the - * end of the newly merged sublists. - */ - - c->next = merge(a,b,&t); c = t; - } - } - - /* Fix the previous pointers for the list */ - - a = b = l->head; - b = b->next; - while (1) { - b->prev = a; - if (b == z) - break; - a = a->next; - b = b->next; - } -} - diff --git a/dlist.h b/dlist.h deleted file mode 100644 index 7381bb6554815..0000000000000 --- a/dlist.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -* -* Copyright (C) 1991 Kendall Bennett. -* All rights reserved. -* -* Filename: $RCSfile$ -* Version: $Revision$ -* -* Language: ANSI C -* Environment: any -* -* Description: Header file for doubly linked list routines. -* -* $Id$ -* -* Revision History: -* ----------------- -* -* $Log$ -* Revision 1.1 1999/04/21 23:11:20 ssb -* moved apache, com and hyperwave into ext/ -* -* Revision 1.1.1.1 1999/04/07 21:03:20 zeev -* PHP 4.0 -* -* Revision 1.1.1.1 1999/03/17 04:29:11 andi -* PHP4 -* -* Revision 1.1.1.1 1998/12/21 07:56:22 andi -* Trying to start the zend CVS tree -* -* Revision 1.2 1998/08/14 15:51:12 shane -* Some work on getting hyperwave to work on windows. hg_comm needs a lot of work. -* -* Mainly, signals, fnctl, bzero, bcopy, etc are not portable functions. Most of this -* will have to be rewriten for windows. -* -* Revision 1.1 1998/08/12 09:29:16 steinm -* First version of Hyperwave module. -* -* Revision 1.5 91/12/31 19:40:54 kjb -* -* Modified include files directories. -* -* Revision 1.4 91/09/27 03:10:41 kjb -* Added compatibility with C++. -* -* Revision 1.3 91/09/26 10:07:16 kjb -* Took out extern references -* -* Revision 1.2 91/09/01 19:37:20 ROOT_DOS -* Changed DLST_TAIL macro so that it returns a pointer to the REAL last -* node of the list, not the dummy last node (l->z). -* -* Revision 1.1 91/09/01 18:38:23 ROOT_DOS -* Initial revision -* -****************************************************************************/ - -#ifndef __DLIST_H -#define __DLIST_H - -#ifndef __DEBUG_H -/*#include "debug.h"*/ -#endif - -/*---------------------- Macros and type definitions ----------------------*/ - -typedef struct PHP_DLST_BUCKET { - struct PHP_DLST_BUCKET *next; - struct PHP_DLST_BUCKET *prev; - } PHP_DLST_BUCKET; - -/* necessary for AIX 4.2.x */ - -#ifdef hz -#undef hz -#endif - -typedef struct { - int count; /* Number of elements currently in list */ - PHP_DLST_BUCKET *head; /* Pointer to head element of list */ - PHP_DLST_BUCKET *z; /* Pointer to last node of list */ - PHP_DLST_BUCKET hz[2]; /* Space for head and z nodes */ - } DLIST; - -/* Return a pointer to the user space given the address of the header of - * a node. - */ - -#define PHP_DLST_USERSPACE(h) ((void*)((PHP_DLST_BUCKET*)(h) + 1)) - -/* Return a pointer to the header of a node, given the address of the - * user space. - */ - -#define PHP_DLST_HEADER(n) ((PHP_DLST_BUCKET*)(n) - 1) - -/* Return a pointer to the user space of the list's head node. This user - * space does not actually exist, but it is useful to be able to address - * it to enable insertion at the start of the list. - */ - -#define PHP_DLST_HEAD(l) PHP_DLST_USERSPACE((l)->head) - -/* Return a pointer to the user space of the last node in list. */ - -#define PHP_DLST_TAIL(l) PHP_DLST_USERSPACE((l)->z->prev) - -/* Determine if a list is empty - */ - -#define PHP_DLST_EMPTY(l) ((l)->count == 0) - -/*-------------------------- Function Prototypes --------------------------*/ - -#ifdef __cplusplus -extern "C" { -#endif - -void *dlst_newnode(int size); -void dlst_freenode(void *node); -DLIST *dlst_init(void); -void dlst_kill(DLIST *l,void (*freeNode)(void *node)); -void dlst_insertafter(DLIST *l,void *node,void *after); -void *dlst_deletenext(DLIST *l,void *node); -void *dlst_first(DLIST *l); -void *dlst_last(DLIST *l); -void *dlst_next(void *prev); -void *dlst_prev(void *next); -void dlst_mergesort(DLIST *l,int (*cmp_func)(void*,void*)); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ext/Makefile.am b/ext/Makefile.am deleted file mode 100644 index 49372bc0d392e..0000000000000 --- a/ext/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -## Process this file with automake to produce Makefile.in - -SUBDIRS = @EXT_SUBDIRS@ - diff --git a/ext/apache/Makefile.am b/ext/apache/Makefile.am deleted file mode 100644 index 32b246cf00437..0000000000000 --- a/ext/apache/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_apache.la -libphpext_apache_la_SOURCES=apache.c - diff --git a/ext/apache/apache.c b/ext/apache/apache.c deleted file mode 100644 index 8c8d50a82c765..0000000000000 --- a/ext/apache/apache.c +++ /dev/null @@ -1,449 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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: Rasmus Lerdorf | - | Stig Sæther Bakken | - | David Sklar | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ -#include "php.h" -#include "ext/standard/head.h" -#include "php_globals.h" -#include "php_ini.h" -#include "SAPI.h" -#include "sapi/apache/mod_php4.h" -#include "ext/standard/info.h" - -#include -#if HAVE_UNISTD_H -#include -#endif -#include -#include -#include - -#if APACHE -#include "http_request.h" -#include "build-defs.h" - -#define SECTION(name) PUTS("

" name "

\n") - -extern module *top_module; - -PHP_FUNCTION(virtual); -PHP_FUNCTION(getallheaders); -PHP_FUNCTION(apachelog); -PHP_FUNCTION(apache_note); -PHP_FUNCTION(apache_lookup_uri); - -PHP_MINFO_FUNCTION(apache); - -function_entry apache_functions[] = { - PHP_FE(virtual, NULL) - PHP_FE(getallheaders, NULL) - PHP_FE(apache_note, NULL) - PHP_FE(apache_lookup_uri, NULL) - {NULL, NULL, NULL} -}; - - -static PHP_INI_MH(OnChangeApacheInt) -{ - long *p; - char *base = (char *) &php_apache_info; - - p = (long *) (base+(size_t) mh_arg1); - - if (new_value) { - *p = atoi(new_value); - return SUCCESS; - } else { - return FAILURE; - } -} - - -static PHP_INI_MH(OnChangeApacheString) -{ - char **p; - char *base = (char *) &php_apache_info; - - p = (char **) (base+(size_t) mh_arg1); - - if (new_value) { - *p = new_value; - return SUCCESS; - } else { - return FAILURE; - } -} - -PHP_INI_BEGIN() - PHP_INI_ENTRY1("xbithack", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, xbithack)) - PHP_INI_ENTRY1("engine", "1", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, engine)) - PHP_INI_ENTRY1("last_modified", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, last_modified)) - PHP_INI_ENTRY1("dav_script", NULL, PHP_INI_ALL, OnChangeApacheString, (void *) XtOffsetOf(php_apache_info_struct, dav_script)) -PHP_INI_END() - - -static PHP_MINIT_FUNCTION(apache) -{ - REGISTER_INI_ENTRIES(); - return SUCCESS; -} - - -static PHP_MSHUTDOWN_FUNCTION(apache) -{ - UNREGISTER_INI_ENTRIES(); - return SUCCESS; -} - - -php3_module_entry apache_module_entry = { - "Apache", apache_functions, PHP_MINIT(apache), PHP_MSHUTDOWN(apache), NULL, NULL, PHP_MINFO(apache), STANDARD_MODULE_PROPERTIES -}; - -/* {{{ proto string apache_note(string note_name [, string note_value]) - Get and set Apache request notes */ -PHP_FUNCTION(apache_note) -{ - pval *arg_name,*arg_val; - char *note_val; - int arg_count = ARG_COUNT(ht); - SLS_FETCH(); - - if (arg_count<1 || arg_count>2 || - getParameters(ht,arg_count,&arg_name,&arg_val) == FAILURE ) { - WRONG_PARAM_COUNT; - } - - convert_to_string(arg_name); - note_val = (char *) table_get(((request_rec *) SG(server_context))->notes,arg_name->value.str.val); - - if (arg_count == 2) { - convert_to_string(arg_val); - table_set(((request_rec *) SG(server_context))->notes,arg_name->value.str.val,arg_val->value.str.val); - } - - if (note_val) { - RETURN_STRING(note_val,1); - } else { - RETURN_FALSE; - } -} -/* }}} */ - -PHP_MINFO_FUNCTION(apache) -{ - module *modp = NULL; - char output_buf[128]; -#if !defined(WIN32) && !defined(WINNT) - char name[64]; - char *p; -#endif - server_rec *serv; - extern char server_root[MAX_STRING_LEN]; - extern uid_t user_id; - extern char *user_name; - extern gid_t group_id; - extern int max_requests_per_child; - SLS_FETCH(); - - serv = ((request_rec *) SG(server_context))->server; - - PUTS("\n"); - php_info_print_table_header(2, "Entry", "Value"); -#if WIN32|WINNT - PUTS("Apache for Windows 95/NT
"); -#else - php_info_print_table_row(2, "APACHE_INCLUDE", PHP_APACHE_INCLUDE); - php_info_print_table_row(2, "APACHE_TARGET", PHP_APACHE_TARGET); -#endif - php_info_print_table_row(2, "Apache Version", SERVER_VERSION); -#ifdef APACHE_RELEASE - sprintf(output_buf, "%d", APACHE_RELEASE); - php_info_print_table_row(2, "Apache Release", output_buf); -#endif - sprintf(output_buf, "%d", MODULE_MAGIC_NUMBER); - php_info_print_table_row(2, "Apache API Version", output_buf); - sprintf(output_buf, "%s:%u", serv->server_hostname,serv->port); - php_info_print_table_row(2, "Hostname/Port", output_buf); -#if !defined(WIN32) && !defined(WINNT) - sprintf(output_buf, "%s(%d)/%d", user_name,(int)user_id,(int)group_id); - php_info_print_table_row(2, "User/Group", output_buf); - sprintf(output_buf, "per child: %d
keep alive: %s
max per connection: %d",max_requests_per_child,serv->keep_alive ? "on":"off", serv->keep_alive_max); - php_info_print_table_row(2, "Max Requests", output_buf); -#endif - sprintf(output_buf, "connection: %d
keep-alive: %d",serv->timeout,serv->keep_alive_timeout); - php_info_print_table_row(2, "Timeouts", output_buf); -#if !defined(WIN32) && !defined(WINNT) - php_info_print_table_row(2, "Server Root", server_root); - - - PUTS("\n"); - PUTS("
Loaded modules"); - for(modp = top_module; modp; modp = modp->next) { - strlcpy(name, modp->name, sizeof(name)); - if ((p = strrchr(name, '.'))) { - *p='\0'; /* Cut off ugly .c extensions on module names */ - } - PUTS(name); - if (modp->next) { - PUTS(", "); - } - } -#endif - PUTS("
\n"); - - - { - register int i; - array_header *arr; - table_entry *elts; - request_rec *r; - SLS_FETCH(); - - r = ((request_rec *) SG(server_context)); - arr = table_elts(r->subprocess_env); - elts = (table_entry *)arr->elts; - - SECTION("Apache Environment"); - PUTS("\n"); - php_info_print_table_header(2, "Variable", "Value"); - for (i=0; i < arr->nelts; i++) { - php_info_print_table_row(2, elts[i].key, elts[i].val); - } - PUTS("
\n"); - } - - { - array_header *env_arr; - table_entry *env; - int i; - request_rec *r; - SLS_FETCH(); - - r = ((request_rec *) SG(server_context)); - SECTION("HTTP Headers Information"); - PUTS("\n"); - PUTS(" \n"); - php_info_print_table_row(2, "HTTP Request", r->the_request); - env_arr = table_elts(r->headers_in); - env = (table_entry *)env_arr->elts; - for (i = 0; i < env_arr->nelts; ++i) { - if (env[i].key) { - php_info_print_table_row(2, env[i].key, env[i].val); - } - } - PUTS(" \n"); - env_arr = table_elts(r->headers_out); - env = (table_entry *)env_arr->elts; - for(i = 0; i < env_arr->nelts; ++i) { - if (env[i].key) { - php_info_print_table_row(2, env[i].key, env[i].val); - } - } - PUTS("
HTTP Request Headers
HTTP Response Headers
\n\n"); - } - -} - -/* This function is equivalent to - * in mod_include. It does an Apache sub-request. It is useful - * for including CGI scripts or .shtml files, or anything else - * that you'd parse through Apache (for .phtml files, you'd probably - * want to use . This only works when PHP is compiled - * as an Apache module, since it uses the Apache API for doing - * sub requests. - */ -/* {{{ proto int virtual(string filename) - Perform an Apache sub-request */ -PHP_FUNCTION(virtual) -{ - pval *filename; - request_rec *rr = NULL; - SLS_FETCH(); - - if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(filename); - - if (!(rr = sub_req_lookup_uri (filename->value.str.val, ((request_rec *) SG(server_context))))) { - php_error(E_WARNING, "Unable to include '%s' - URI lookup failed", filename->value.str.val); - if (rr) destroy_sub_req (rr); - RETURN_FALSE; - } - - if (rr->status != 200) { - php_error(E_WARNING, "Unable to include '%s' - error finding URI", filename->value.str.val); - if (rr) destroy_sub_req (rr); - RETURN_FALSE; - } - - /* Cannot include another PHP file because of global conflicts */ - if (rr->content_type && - !strcmp(rr->content_type, PHP3_MIME_TYPE)) { - php_error(E_WARNING, "Cannot include a PHP file " - "(use <?include \"%s\"> instead)", filename->value.str.val); - if (rr) destroy_sub_req (rr); - RETURN_FALSE; - } - - if (run_sub_req(rr)) { - php_error(E_WARNING, "Unable to include '%s' - request execution failed", filename->value.str.val); - if (rr) destroy_sub_req (rr); - RETURN_FALSE; - } else { - if (rr) destroy_sub_req (rr); - RETURN_TRUE; - } -} -/* }}} */ - -/* {{{ proto array getallheaders(void) - Fetch all HTTP request headers */ -PHP_FUNCTION(getallheaders) -{ - array_header *env_arr; - table_entry *tenv; - int i; - SLS_FETCH(); - PLS_FETCH(); - - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } - env_arr = table_elts(((request_rec *) SG(server_context))->headers_in); - tenv = (table_entry *)env_arr->elts; - for (i = 0; i < env_arr->nelts; ++i) { - if (!tenv[i].key || - (PG(safe_mode) && - !strncasecmp(tenv[i].key, "authorization", 13))) { - continue; - } - if (add_assoc_string(return_value, tenv[i].key,(tenv[i].val==NULL) ? "" : tenv[i].val, 1)==FAILURE) { - RETURN_FALSE; - } - } -} -/* }}} */ - -/* {{{ proto class apache_lookup_uri(string URI) - Perform a partial request of the given URI to obtain information about it */ -PHP_FUNCTION(apache_lookup_uri) -{ - pval *filename; - request_rec *rr=NULL; - SLS_FETCH(); - - if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(filename); - - if(!(rr = sub_req_lookup_uri(filename->value.str.val, ((request_rec *) SG(server_context))))) { - php_error(E_WARNING, "URI lookup failed", filename->value.str.val); - RETURN_FALSE; - } - object_init(return_value); - add_property_long(return_value,"status",rr->status); - if (rr->the_request) { - add_property_string(return_value,"the_request",rr->the_request,1); - } - if (rr->status_line) { - add_property_string(return_value,"status_line",(char *)rr->status_line,1); - } - if (rr->method) { - add_property_string(return_value,"method",(char *)rr->method,1); - } - if (rr->content_type) { - add_property_string(return_value,"content_type",(char *)rr->content_type,1); - } - if (rr->handler) { - add_property_string(return_value,"handler",(char *)rr->handler,1); - } - if (rr->uri) { - add_property_string(return_value,"uri",rr->uri,1); - } - if (rr->filename) { - add_property_string(return_value,"filename",rr->filename,1); - } - if (rr->path_info) { - add_property_string(return_value,"path_info",rr->path_info,1); - } - if (rr->args) { - add_property_string(return_value,"args",rr->args,1); - } - if (rr->boundary) { - add_property_string(return_value,"boundary",rr->boundary,1); - } - add_property_long(return_value,"no_cache",rr->no_cache); - add_property_long(return_value,"no_local_copy",rr->no_local_copy); - add_property_long(return_value,"allowed",rr->allowed); - add_property_long(return_value,"sent_bodyct",rr->sent_bodyct); - add_property_long(return_value,"bytes_sent",rr->bytes_sent); - add_property_long(return_value,"byterange",rr->byterange); - add_property_long(return_value,"clength",rr->clength); - -#if MODULE_MAGIC_NUMBER >= 19980324 - if (rr->unparsed_uri) { - add_property_string(return_value,"unparsed_uri",rr->unparsed_uri,1); - } - if(rr->mtime) { - add_property_long(return_value,"mtime",rr->mtime); - } -#endif - if(rr->request_time) { - add_property_long(return_value,"request_time",rr->request_time); - } - - destroy_sub_req(rr); -} -/* }}} */ - -#if 0 -This function is most likely a bad idea. Just playing with it for now. - -PHP_FUNCTION(apache_exec_uri) -{ - pval *filename; - request_rec *rr=NULL; - SLS_FETCH(); - - if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(filename); - - if(!(rr = ap_sub_req_lookup_uri(filename->value.str.val, ((request_rec *) SG(server_context))))) { - php_error(E_WARNING, "URI lookup failed", filename->value.str.val); - RETURN_FALSE; - } - RETVAL_LONG(ap_run_sub_req(rr)); - ap_destroy_sub_req(rr); -} -#endif - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/apache/config.m4 b/ext/apache/config.m4 deleted file mode 100644 index 88575c9e9854c..0000000000000 --- a/ext/apache/config.m4 +++ /dev/null @@ -1,2 +0,0 @@ -dnl $Id$ - diff --git a/ext/aspell/Makefile.am b/ext/aspell/Makefile.am deleted file mode 100644 index 355308958b775..0000000000000 --- a/ext/aspell/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_aspell.la -libphpext_aspell_la_SOURCES=aspell.c - diff --git a/ext/aspell/aspell.c b/ext/aspell/aspell.c deleted file mode 100644 index fcfb33cbceaf4..0000000000000 --- a/ext/aspell/aspell.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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: | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" -#if defined(COMPILE_DL) -#include "phpdl.h" -#endif -#include -#include -#include - -#if HAVE_ASPELL - -#include "php3_aspell.h" -#if APACHE -# ifndef DEBUG -# undef palloc -# endif -#endif -#include - -function_entry aspell_functions[] = { - PHP_FE(aspell_new, NULL) - PHP_FE(aspell_check, NULL) - PHP_FE(aspell_check_raw, NULL) - PHP_FE(aspell_suggest, NULL) - {NULL, NULL, NULL} -}; - -static int le_aspell; - -php3_module_entry aspell_module_entry = { - "Aspell", aspell_functions, PHP_MINIT(aspell), NULL, NULL, NULL, PHP_MINFO(aspell), STANDARD_MODULE_PROPERTIES -}; - - -#if COMPILE_DL -DLEXPORT php3_module_entry *get_module(void) { return &aspell_module_entry; } -#endif - -PHP_MINIT_FUNCTION(aspell) -{ - le_aspell = register_list_destructors(php3_aspell_close,NULL); - return SUCCESS; - -} -void php3_aspell_close(aspell *sc) -{ - aspell_free(sc); -} - -/* {{{ proto int aspell_new(string master[, string personal]) - Load a dictionary */ -PHP_FUNCTION(aspell_new) -{ - pval *master, *personal; - int argc; - aspell *sc; - int ind; - - argc = ARG_COUNT(ht); - if (argc < 1 || argc > 2 || getParameters(ht, argc, &master,&personal) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(master); - if(argc==2) - { - convert_to_string(personal) ; - sc=aspell_new(master->value.str.val,personal->value.str.val); - } - else - sc=aspell_new(master->value.str.val,""); - - ind = php3_list_insert(sc, le_aspell); - RETURN_LONG(ind); -} -/* }}} */ - - -/* {{{ proto array aspell_suggest(aspell int,string word) - Return array of Suggestions */ -PHP_FUNCTION(aspell_suggest) -{ - pval *scin, *word; - int argc; - aspell *sc; - int ind,type; - aspellSuggestions *sug; - size_t i; - - - argc = ARG_COUNT(ht); - if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scin); - convert_to_string(word); - sc= (aspell *) php3_list_find(scin->value.lval, &type); - if(!sc) - { - php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval); - RETURN_FALSE; - } - - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } - - sug = aspell_suggest(sc, word->value.str.val); - for (i = 0; i != sug->size; ++i) { - add_next_index_string(return_value,(char *)sug->data[i],1); - } - aspell_free_suggestions(sug); -} -/* }}} */ - -/* {{{ proto int aspell_check(aspell int,string word) - Return if word is valid */ -PHP_FUNCTION(aspell_check) -{ - int type; - pval *scin,*word; - aspell *sc; - - int argc; - argc = ARG_COUNT(ht); - if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scin); - convert_to_string(word); - sc= (aspell *) php3_list_find(scin->value.lval, &type); - if(!sc) - { - php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval); - RETURN_FALSE; - } - if (aspell_check(sc, word->value.str.val)) - { - RETURN_TRUE; - } - else - { - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto int aspell_check_raw(aspell int,string word) - Return if word is valid, ignoring case or trying to trim it in any way*/ -PHP_FUNCTION(aspell_check_raw) -{ - pval *scin,*word; - int type; - int argc; - aspell *sc; - - argc = ARG_COUNT(ht); - if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scin); - convert_to_string(word); - sc= (aspell *) php3_list_find(scin->value.lval, &type); - if(!sc) - { - php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval); - RETURN_FALSE; - } - if (aspell_check_raw(sc, word->value.str.val)) - { - RETURN_TRUE; - } - else - { - RETURN_FALSE; - } -} -/* }}} */ - -PHP_MINFO_FUNCTION(aspell) -{ - php_printf("ASpell support enabled"); - -} - -#endif diff --git a/ext/aspell/config.h.stub b/ext/aspell/config.h.stub deleted file mode 100644 index 4be31d352aa18..0000000000000 --- a/ext/aspell/config.h.stub +++ /dev/null @@ -1,4 +0,0 @@ -/* Define if you want the ASPELL interface */ -#ifndef HAVE_ASPELL -#define HAVE_ASPELL 0 -#endif diff --git a/ext/aspell/config.m4 b/ext/aspell/config.m4 deleted file mode 100644 index bfec9c42234fe..0000000000000 --- a/ext/aspell/config.m4 +++ /dev/null @@ -1,28 +0,0 @@ -dnl $Id$ - -AC_MSG_CHECKING(for ASPELL support) -AC_ARG_WITH(aspell, -[ --with-aspell[=DIR] Include ASPELL support.], -[ - if test "$withval" != "no"; then - if test "$withval" = "yes"; then - ASPELL_DIR=/usr/local - else - ASPELL_DIR=$withval - fi - - AC_ADD_INCLUDE($ASPELL_DIR/include) - AC_ADD_LIBRARY_WITH_PATH(aspell, $ASPELL_DIR/lib) - - if test ! -f "$ASPELL_DIR/include/aspell-c.h"; then - AC_MSG_ERROR(Could not find aspell-c.h in $ASPELL_DIR/include - please copy it manually from the aspell sources to $ASPELL_DIR/include) - fi - AC_DEFINE(HAVE_ASPELL) - AC_MSG_RESULT(yes) - PHP_EXTENSION(aspell) - else - AC_MSG_ERROR(no) - fi -],[ - AC_MSG_RESULT(no) -]) diff --git a/ext/aspell/php3_aspell.h b/ext/aspell/php3_aspell.h deleted file mode 100644 index d0c8b35a8225e..0000000000000 --- a/ext/aspell/php3_aspell.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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 | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef _ASPELL_H -#define _ASPELL_H -#if HAVE_ASPELL -extern php3_module_entry aspell_module_entry; -#define aspell_module_ptr &aspell_module_entry - -extern PHP_MINIT_FUNCTION(aspell); -extern PHP_MINFO_FUNCTION(aspell); -extern void php3_aspell_close(); - -PHP_FUNCTION(aspell_new); -PHP_FUNCTION(aspell_check); -PHP_FUNCTION(aspell_check_raw); -PHP_FUNCTION(aspell_suggest); - -#else -#define aspell_module_ptr NULL -#endif - -#define phpext_aspell_ptr aspell_module_ptr - -#endif /* _ASPELL_H */ diff --git a/ext/bcmath/Makefile.am b/ext/bcmath/Makefile.am deleted file mode 100644 index e529f579aef92..0000000000000 --- a/ext/bcmath/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_bcmath.la -libphpext_bcmath_la_SOURCES=bcmath.c number.c diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c deleted file mode 100644 index d4a7032376a86..0000000000000 --- a/ext/bcmath/bcmath.c +++ /dev/null @@ -1,434 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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: Andi Gutmans | - +----------------------------------------------------------------------+ - */ - -#include "php.h" - -#if WITH_BCMATH - -#include "number.h" -#include "php3_bcmath.h" - -function_entry bcmath_functions[] = { - PHP_FE(bcadd, NULL) - PHP_FE(bcsub, NULL) - PHP_FE(bcmul, NULL) - PHP_FE(bcdiv, NULL) - PHP_FE(bcmod, NULL) - PHP_FE(bcpow, NULL) - PHP_FE(bcsqrt, NULL) - PHP_FE(bcscale, NULL) - PHP_FE(bccomp, NULL) - {NULL, NULL, NULL} -}; - -php3_module_entry bcmath_module_entry = { - "bcmath", bcmath_functions, NULL, NULL, PHP_RINIT(bcmath), PHP_RSHUTDOWN(bcmath), NULL, STANDARD_MODULE_PROPERTIES -}; - -#if COMPILE_DL -php3_module_entry *get_module() { return &bcmath_module_entry; }; -#endif - -#ifndef THREAD_SAFE -static long bc_precision; -#endif - -PHP_RINIT_FUNCTION(bcmath) -{ - init_numbers(); - if (cfg_get_long("bcmath.scale",&bc_precision)==FAILURE) { - bc_precision=0; - } - return SUCCESS; -} - -PHP_RSHUTDOWN_FUNCTION(bcmath) -{ - destruct_numbers(); - return SUCCESS; -} - -/* {{{ proto string bcadd(string left_operand, string right_operand [, int scale]) - Returns the sum of two arbitrary precision numbers */ -PHP_FUNCTION(bcadd) -{ - pval *left, *right,*scale_param; - bc_num first, second, result; - int scale=bc_precision; - - switch (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 3: - if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - init_num(&result); - str2num(&first,left->value.str.val,scale); - str2num(&second,right->value.str.val,scale); - bc_add (first,second,&result, scale); - return_value->value.str.val = num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - free_num(&first); - free_num(&second); - free_num(&result); - return; -} -/* }}} */ - -/* {{{ proto string bcsub(string left_operand, string right_operand [, int scale]) - Returns the difference between two arbitrary precision numbers (subtration) */ -PHP_FUNCTION(bcsub) -{ - pval *left, *right,*scale_param; - bc_num first, second, result; - int scale=bc_precision; - - switch (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 3: - if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - init_num(&result); - str2num(&first,left->value.str.val,scale); - str2num(&second,right->value.str.val,scale); - bc_sub (first,second,&result, scale); - return_value->value.str.val = num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - free_num(&first); - free_num(&second); - free_num(&result); - return; -} -/* }}} */ - -/* {{{ proto string bcmul(string left_operand, string right_operand [, int scale]) - Returns the multiplication of two arbitrary precision numbers */ -PHP_FUNCTION(bcmul) -{ - pval *left, *right,*scale_param; - bc_num first, second, result; - int scale=bc_precision; - - switch (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 3: - if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - init_num(&result); - str2num(&first,left->value.str.val,scale); - str2num(&second,right->value.str.val,scale); - bc_multiply (first,second,&result, scale); - return_value->value.str.val = num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - free_num(&first); - free_num(&second); - free_num(&result); - return; -} -/* }}} */ - -/* {{{ proto string bcdiv(string left_operand, string right_operand [, int scale]) - Returns the quotient of two arbitrary precision numbers (division) */ -PHP_FUNCTION(bcdiv) -{ - pval *left, *right,*scale_param; - bc_num first, second, result; - int scale=bc_precision; - - switch (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 3: - if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - init_num(&result); - str2num(&first,left->value.str.val,scale); - str2num(&second,right->value.str.val,scale); - switch (bc_divide (first,second,&result, scale)) { - case 0: /* OK */ - return_value->value.str.val = num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - break; - case -1: /* division by zero */ - php_error(E_WARNING,"Division by zero"); - break; - } - free_num(&first); - free_num(&second); - free_num(&result); - return; -} -/* }}} */ - -/* {{{ proto string bcmod(string left_operand, string right_operand) - Returns the modulus of the two arbitrary precision operands */ -PHP_FUNCTION(bcmod) -{ - pval *left, *right; - bc_num first, second, result; - - switch (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - init_num(&result); - str2num(&first,left->value.str.val,0); - str2num(&second,right->value.str.val,0); - switch (bc_modulo(first,second,&result, 0)) { - case 0: - return_value->value.str.val = num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - break; - case -1: - php_error(E_WARNING,"Division by zero"); - break; - } - free_num(&first); - free_num(&second); - free_num(&result); - return; -} -/* }}} */ - -/* {{{ proto string bcpow(string x, string y [, int scale]) - Returns the value of an arbitrary precision number raised to the power of another */ -PHP_FUNCTION(bcpow) -{ - pval *left, *right,*scale_param; - bc_num first, second, result; - int scale=bc_precision; - - switch (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 3: - if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - init_num(&result); - str2num(&first,left->value.str.val,scale); - str2num(&second,right->value.str.val,scale); - bc_raise (first,second,&result, scale); - return_value->value.str.val = num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - free_num(&first); - free_num(&second); - free_num(&result); - return; -} -/* }}} */ - -/* {{{ proto string bcsqrt(string operand [, int scale]) - Returns the square root of an arbitray precision number */ -PHP_FUNCTION(bcsqrt) -{ - pval *left,*scale_param; - bc_num result; - int scale=bc_precision; - - switch (ARG_COUNT(ht)) { - case 1: - if (getParameters(ht, 1, &left) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 2: - if (getParameters(ht, 2, &left, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - init_num(&result); - str2num(&result,left->value.str.val,scale); - if (bc_sqrt (&result, scale) != 0) { - return_value->value.str.val = num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - } else { - php_error(E_WARNING,"Square root of negative number"); - } - free_num(&result); - return; -} -/* }}} */ - -/* {{{ proto string bccomp(string left_operand, string right_operand [, int scale]) - Compares two arbitrary precision numbers */ -PHP_FUNCTION(bccomp) -{ - pval *left, *right, *scale_param; - bc_num first, second; - int scale=bc_precision; - - switch (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 3: - if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - - str2num(&first,left->value.str.val,scale); - str2num(&second,right->value.str.val,scale); - return_value->value.lval = bc_compare(first,second); - return_value->type = IS_LONG; - - free_num(&first); - free_num(&second); - return; -} -/* }}} */ - -/* {{{ proto string bcscale(int scale) - Sets default scale parameter for all bc math functions */ -PHP_FUNCTION(bcscale) -{ - pval *new_scale; - - if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &new_scale)==FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(new_scale); - bc_precision = new_scale->value.lval; - RETURN_TRUE; -} -/* }}} */ - - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/bcmath/config.h.stub b/ext/bcmath/config.h.stub deleted file mode 100644 index 6346c81f10c93..0000000000000 --- a/ext/bcmath/config.h.stub +++ /dev/null @@ -1,2 +0,0 @@ -/* Define if you want to enable bc style precision math support */ -#define WITH_BCMATH 0 diff --git a/ext/bcmath/config.m4 b/ext/bcmath/config.m4 deleted file mode 100644 index 960d3863f662d..0000000000000 --- a/ext/bcmath/config.m4 +++ /dev/null @@ -1,20 +0,0 @@ -dnl $Id$ - -AC_MSG_CHECKING(whether to enable bc style precision math functions) -AC_ARG_ENABLE(bcmath, -[ --enable-bcmath Compile with bc style precision math functions. - Read README-BCMATH for instructions on how to - get this module installed. ], -[ - if test "$enableval" = "yes"; then - AC_DEFINE(WITH_BCMATH, 1) - AC_MSG_RESULT(yes) - PHP_EXTENSION(bcmath) - else - AC_DEFINE(WITH_BCMATH, 0) - AC_MSG_RESULT(no) - fi -],[ - AC_DEFINE(WITH_BCMATH, 0) - AC_MSG_RESULT(no) -]) diff --git a/ext/bcmath/php3_bcmath.h b/ext/bcmath/php3_bcmath.h deleted file mode 100644 index a6007e60d1bc4..0000000000000 --- a/ext/bcmath/php3_bcmath.h +++ /dev/null @@ -1,64 +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: Andi Gutmans | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef _PHP3_BCMATH_H -#define _PHP3_BCMATH_H - -#if COMPILE_DL -#undef WITH_BCMATH -#define WITH_BCMATH 1 -#endif - -#if WITH_BCMATH - -extern php3_module_entry bcmath_module_entry; -#define phpext_bcmath_ptr &bcmath_module_entry - -extern PHP_RINIT_FUNCTION(bcmath); -extern PHP_RSHUTDOWN_FUNCTION(bcmath); -PHP_FUNCTION(bcadd); -PHP_FUNCTION(bcsub); -PHP_FUNCTION(bcmul); -PHP_FUNCTION(bcdiv); -PHP_FUNCTION(bcmod); -PHP_FUNCTION(bcpow); -PHP_FUNCTION(bcsqrt); -PHP_FUNCTION(bccomp); -PHP_FUNCTION(bcscale); - -#else - -#define phpext_bcmath_ptr NULL - -#endif - -#endif /* _PHP3_BCMATH_H */ diff --git a/ext/bcmath/setup.stub b/ext/bcmath/setup.stub deleted file mode 100644 index c1cf263ef51d5..0000000000000 --- a/ext/bcmath/setup.stub +++ /dev/null @@ -1,6 +0,0 @@ -# $Source$ -# $Id$ - -define_option enable-bcmath 'Enable bc style precision math functions' yesno \ - yes \ -' Enables bc style arbitrary precision math functions.' diff --git a/ext/com/php_COM.h b/ext/com/php_COM.h deleted file mode 100644 index 64d9c16548763..0000000000000 --- a/ext/com/php_COM.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _PHP_COM_H -#define _PHP_COM_H - -#if WIN32|WINNT - -extern PHP_MINIT_FUNCTION(COM); -extern PHP_MSHUTDOWN_FUNCTION(COM); -PHP_FUNCTION(COM_load); -PHP_FUNCTION(COM_invoke); - -PHP_FUNCTION(com_propget); -PHP_FUNCTION(com_propput); -extern zend_module_entry COM_module_entry; -#define COM_module_ptr &COM_module_entry - -#else - -#define COM_module_ptr NULL - -#endif /* Win32|WINNT */ - -#define phpext_COM_ptr COM_module_ptr - -#endif /* _PHP_COM_H */ diff --git a/ext/dav/Makefile.am b/ext/dav/Makefile.am deleted file mode 100644 index 63d0510a9789a..0000000000000 --- a/ext/dav/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_dav.la -libphpext_dav_la_SOURCES=dav.c - diff --git a/ext/dav/config.h.stub b/ext/dav/config.h.stub deleted file mode 100644 index 90a0bc1de466c..0000000000000 --- a/ext/dav/config.h.stub +++ /dev/null @@ -1,2 +0,0 @@ -/* Define to compile with mod_dav support */ -#define HAVE_MOD_DAV 0 diff --git a/ext/dav/config.m4 b/ext/dav/config.m4 deleted file mode 100644 index c2b83adbc72b9..0000000000000 --- a/ext/dav/config.m4 +++ /dev/null @@ -1,29 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension dav -dnl don't forget to call PHP_EXTENSION(dav) - -AC_MSG_CHECKING(whether to enable DAV support through mod_dav) -AC_ARG_WITH(mod-dav, -[ --with-mod-dav=DIR Include DAV support through Apache's mod_dav, - DIR is mod_dav's installation directory (Apache - module version only!)], -[ - if test "$withval" = "yes"; then - AC_MSG_ERROR(Must give parameter to --with-mod-dav!) - else - if test "$withval" != "no"; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MOD_DAV, 1) - CFLAGS="$CFLAGS -DHAVE_MOD_DAV -I$withval" - INCLUDES="$INCLUDES -I$withval" - PHP_EXTENSION(dav) - else - AC_MSG_RESULT(no) - AC_DEFINE(HAVE_MOD_DAV, 0) - fi - fi -],[ - AC_MSG_RESULT(no) - AC_DEFINE(HAVE_MOD_DAV, 0) -]) - diff --git a/ext/dav/dav.c b/ext/dav/dav.c deleted file mode 100644 index 5ca8a39012471..0000000000000 --- a/ext/dav/dav.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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 Sæther Bakken | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#define IS_EXT_MODULE -#if COMPILE_DL -# if PHP_31 -# include "../phpdl.h" -# else -# include "dl/phpdl.h" -# endif -#endif -#include "php.h" -#include "php3_dav.h" - -#if defined(THREAD_SAFE) && !PHP_31 -# undef THREAD_SAFE -#endif - -#if HAVE_MOD_DAV - -# include "mod_dav.h" -# include "phpdav.h" -# include "variables.h" - -/* {{{ thread safety stuff */ - -# ifdef THREAD_SAFE -# define DAV_GLOBAL(a) phpdav_globals->a -# define DAV_TLS_VARS phpdav_global_struct *phpdav_globals = TlsGetValue(PHPDAVTls); - -void *phpdav_mutex; -DWORD PHPDAVTls; -static int numthreads=0; - -typedef struct phpdav_global_struct { - phpdav_module php3_dav_module; -} phpdav_global_struct; - -# else /* !defined(THREAD_SAFE) */ -# define DAV_GLOBAL(a) a -# define DAV_TLS_VARS - -phpdav_module php3_dav_module; - -# endif /* defined(THREAD_SAFE) */ - -# define DAV_HANDLER(a) DAV_GLOBAL(php3_dav_module).a##_handler -# define DAV_SET_HANDLER(a,b) \ - dav_set_handler(&DAV_GLOBAL(php3_dav_module).a##_handler,(b)) - - -/* }}} */ -/* {{{ dynamically loadable module stuff */ - -# if COMPILE_DL -DLEXPORT php3_module_entry *get_module() { return &phpdav_module_entry; }; -# endif /* COMPILE_DL */ - -/* }}} */ -/* {{{ function prototypes */ - -int php3_minit_phpdav(INIT_FUNC_ARGS); -int php3_rinit_phpdav(INIT_FUNC_ARGS); -int php3_mshutdown_phpdav(SHUTDOWN_FUNC_ARGS); -int php3_rshutdown_phpdav(SHUTDOWN_FUNC_ARGS); -void php3_info_phpdav(ZEND_MODULE_INFO_FUNC_ARGS); - -/* }}} */ -/* {{{ extension definition structures */ - -function_entry phpdav_functions[] = { - PHP_FE(dav_set_mkcol_handlers, NULL) - {NULL, NULL, NULL} -}; - -php3_module_entry phpdav_module_entry = { - "DAV", /* extension name */ - phpdav_functions, /* extension function list */ - php3_minit_phpdav, /* extension-wide startup function */ - php3_mshutdown_phpdav, /* extension-wide shutdown function */ - php3_rinit_phpdav, /* per-request startup function */ - php3_rshutdown_phpdav, /* per-request shutdown function */ - php3_info_phpdav, /* information function */ - STANDARD_MODULE_PROPERTIES -}; - -/* }}} */ -/* {{{ startup, shutdown and info functions */ - - /* {{{ php3_minit_phpdav */ - -int php3_minit_phpdav(INIT_FUNC_ARGS) -{ -#if defined(THREAD_SAFE) - phpdav_global_struct *phpdav_globals; - PHP3_MUTEX_ALLOC(phpdav_mutex); - PHP3_MUTEX_LOCK(phpdav_mutex); - numthreads++; - if (numthreads==1){ - if (!PHP3_TLS_PROC_STARTUP(PHPDAVTls)){ - PHP3_MUTEX_UNLOCK(phpdav_mutex); - PHP3_MUTEX_FREE(phpdav_mutex); - return FAILURE; - } - } - PHP3_MUTEX_UNLOCK(phdpav_mutex); - if(!PHP3_TLS_THREAD_INIT(PHPDAVTls,phpdav_globals,phpdav_global_struct)){ - PHP3_MUTEX_FREE(phpdav_mutex); - return FAILURE; - } -#endif - return SUCCESS; -} - -/* }}} */ - /* {{{ php3_rinit_phpdav */ - -int php3_rinit_phpdav(INIT_FUNC_ARGS) -{ - return SUCCESS; -} - -/* }}} */ - /* {{{ php3_mshutdown_phpdav() */ - -int php3_mshutdown_phpdav(SHUTDOWN_FUNC_ARGS) -{ - DAV_TLS_VARS; -#ifdef THREAD_SAFE - PHP3_TLS_THREAD_FREE(phpdav_globals); - PHP3_MUTEX_LOCK(phpdav_mutex); - numthreads--; - if (numthreads < 1) { - PHP3_TLS_PROC_SHUTDOWN(PHPDAVTls); - PHP3_MUTEX_UNLOCK(phpdav_mutex); - PHP3_MUTEX_FREE(phpdav_mutex); - return SUCCESS; - } - PHP3_MUTEX_UNLOCK(phpdav_mutex); -#endif - return SUCCESS; -} - -/* }}} */ - /* {{{ php3_rshutdown_phpdav() */ - -int php3_rshutdown_phpdav(SHUTDOWN_FUNC_ARGS) -{ - if (DAV_HANDLER(mkcol_test)) { - efree(DAV_HANDLER(mkcol_test)); - } - if (DAV_HANDLER(mkcol_create)) { - efree(DAV_HANDLER(mkcol_create)); - } - return SUCCESS; -} - -/* }}} */ - /* {{{ php3_info_phpdav() */ - -void php3_info_phpdav(ZEND_MODULE_INFO_FUNC_ARGS) -{ -} - -/* }}} */ - -/* }}} */ -/* {{{ extension-internal functions */ - - /* {{{ dav_set_handler() */ - -static void -dav_set_handler(char **nameBufp, pval *data) -{ - if (data->value.str.len > 0) { - if (*nameBufp != NULL) { - efree(*nameBufp); - } - *nameBufp = php3i_pval_strdup(data); - } else { - if (*nameBufp != NULL) { - efree(*nameBufp); - } - *nameBufp = NULL; - } -} - -/* }}} */ - /* {{{ dav_call_handler() */ - -static int -dav_call_handler(char *funcName, int argc, pval **argv) -{ - if (funcName) { - pval *retval, *func; - int i, ret; - HashTable *function_table; - - func = php3i_string_pval(funcName); - retval = emalloc(sizeof(pval)); - function_table = php3i_get_function_table(); - if (call_user_function(function_table, NULL, func, retval, argc, argv) == FAILURE) { - php3tls_pval_destructor(retval); - efree(retval); - return HTTP_INTERNAL_SERVER_ERROR; - } - php3tls_pval_destructor(func); - efree(func); - for (i = 0; i < argc; i++) { - php3tls_pval_destructor(argv[i]); - efree(argv[i]); - } - convert_to_long(retval); - ret = retval->value.lval; - efree(retval); - return ret; - } - return DECLINED; -} - -/* }}} */ - -int phpdav_mkcol_test_handler(request_rec *r) -{ - pval *arg; - - if (DAV_HANDLER(mkcol_test) == NULL) { - return DECLINED; - } - arg = php3i_string_pval(r->filename); - return dav_call_handler(DAV_HANDLER(mkcol_test), 1, &arg); -} - -int phpdav_mkcol_create_handler(request_rec *r) -{ - pval *arg; - - if (DAV_HANDLER(mkcol_create) == NULL) { - return DECLINED; - } - arg = php3i_string_pval(r->filename); - return dav_call_handler(DAV_HANDLER(mkcol_create), 1, &arg); -} - -/* }}} */ - -/************************* EXTENSION FUNCTIONS *************************/ - -/* {{{ proto void dav_set_mkcol_handlers(string test, string create) - Sets the function to test whether a DAV collection exists for MKCOL */ -PHP_FUNCTION(dav_set_mkcol_handlers) -{ - pval *test, *create; - DAV_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &test, &create) == FAILURE) { - WRONG_PARAM_COUNT; - } - DAV_SET_HANDLER(mkcol_test, test); - DAV_SET_HANDLER(mkcol_create, create); - RETVAL_TRUE; -} -/* }}} */ - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/dav/php3_dav.h b/ext/dav/php3_dav.h deleted file mode 100644 index b1ab062de18b2..0000000000000 --- a/ext/dav/php3_dav.h +++ /dev/null @@ -1,66 +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: Stig Sæther Bakken | - +----------------------------------------------------------------------+ - */ - -/* $Id */ - -#ifndef _PHP_DAV_H -# define _PHP_DAV_H - -# if HAVE_MOD_DAV - -typedef struct { - int foo; - char *mkcol_test_handler; - char *mkcol_create_handler; -} phpdav_module; - -extern php3_module_entry phpdav_module_entry; -# define phpdav_module_ptr &phpdav_module_entry - -int phpdav_mkcol_test_handler(request_rec *); - -PHP_FUNCTION(dav_set_mkcol_handlers); - -# else /* !HAVE_MOD_DAV */ - -# define phpdav_module_ptr NULL - -# endif /* HAVE_MOD_DAV */ - -#define phpext_dav_ptr phpdav_module_ptr - -#endif /* _PHP_DAV_H */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/dav/setup.stub b/ext/dav/setup.stub deleted file mode 100644 index 881144c1cafd6..0000000000000 --- a/ext/dav/setup.stub +++ /dev/null @@ -1,2 +0,0 @@ -# $Id$ -# This extension is still very much under construction. diff --git a/ext/db/Makefile.am b/ext/db/Makefile.am deleted file mode 100644 index 7dc6e32d07d72..0000000000000 --- a/ext/db/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_db.la -libphpext_db_la_SOURCES=db.c - diff --git a/ext/db/config.h.stub b/ext/db/config.h.stub deleted file mode 100644 index e952d61fac142..0000000000000 --- a/ext/db/config.h.stub +++ /dev/null @@ -1,5 +0,0 @@ -/* Define if you have an ndbm compatible library (-ldbm). */ -#define NDBM 0 - -/* Define if you have the gdbm library (-lgdbm). */ -#define GDBM 0 diff --git a/ext/db/config.m4 b/ext/db/config.m4 deleted file mode 100644 index 319174dd51842..0000000000000 --- a/ext/db/config.m4 +++ /dev/null @@ -1,55 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension db -dnl don't forget to call PHP_EXTENSION(db) - -divert(1) - -AC_CHECK_HEADERS(db1/ndbm.h) - -# Checks for libraries. -# Prefer gdbm, Berkeley DB and ndbm/dbm, in that order -AC_DEFUN(AC_PREFERRED_DB_LIB,[ - AC_CHECK_LIB(gdbm, gdbm_open,[AC_DEFINE(GDBM) DBM_TYPE=gdbm; DBM_LIB=-lgdbm], - [AC_CHECK_LIB(db, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldb], - [AC_CHECK_LIB(c, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=], - [AC_CHECK_LIB(dbm, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldbm], - [DBM_TYPE=""])])])]) - AC_MSG_CHECKING([preferred dbm library]) - if test "a$DBM_TYPE" = a; then - AC_MSG_RESULT(none found) - AC_MSG_WARN(No dbm library found - using built-in flatfile support) - else - AC_MSG_RESULT($DBM_TYPE chosen) - fi - AC_SUBST(DBM_LIB) - AC_SUBST(DBM_TYPE) -]) - -AC_PREFERRED_DB_LIB - -divert(3) - -if test "$DBM_LIB" = "-lgdbm"; then - AC_CHECK_HEADER(gdbm.h, [ GDBM_INCLUDE="" ], [ - AC_MSG_RESULT("Try /usr/local/include/gdbm.h"); - AC_CHECK_HEADER(/usr/local/include/gdbm.h, [ GDBM_INCLUDE="-I/usr/local/include" ],[ - AC_MSG_RESULT("Try /opt/local/include/gdbm.h"); - AC_CHECK_HEADER(/opt/local/include/gdbm.h, [ GDBM_INCLUDE="-I/opt/local/include" ],[ - dnl if in /usr/pkg/include, do not add anything. See above. - AC_MSG_RESULT("Try /usr/pkg/include/gdbm.h"); - AC_CHECK_HEADER(/usr/pkg/include/gdbm.h, [ GDBM_INCLUDE="" ],[ - AC_MSG_RESULT("Giving up - You need to install gdbm.h somewhere"); - exit - ]) - ]) - ]) - ]) -fi - -if test -n "$DBM_LIB"; then - INCLUDES="$INCLUDES $GDBM_INCLUDE" - EXTRA_LIBS="$EXTRA_LIBS $DBM_LIB" -fi - -PHP_EXTENSION(db) - diff --git a/ext/db/db.c b/ext/db/db.c deleted file mode 100644 index 527e2c665b4c3..0000000000000 --- a/ext/db/db.c +++ /dev/null @@ -1,1162 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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: Rasmus Lerdorf | - | Jim Winstead | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ -#define IS_EXT_MODULE -#if COMPILE_DL -# include "dl/phpdl.h" -#endif - -#if 1 - -#include "php.h" -#include "php_globals.h" -#include "safe_mode.h" -#include "fopen-wrappers.h" -#include "ext/standard/flock_compat.h" - -#include -#include -#include -#if HAVE_UNISTD_H -#include -#endif - -#ifdef PHP_31 -#include "os/nt/flock.h" -#else -#if WIN32|WINNT -#include "win32/flock.h" -#else -#include -#endif -#endif - -#if HAVE_FCNTL_H -#include -#endif - -#if GDBM -#include - -#define DBM_TYPE GDBM_FILE -#define DBM_MODE_TYPE int -#define DBM_WRITE_MODE GDBM_WRITER -#define DBM_CREATE_MODE GDBM_WRCREAT -#define DBM_NEW_MODE GDBM_NEWDB -#define DBM_DEFAULT_MODE GDBM_READER -#define DBM_OPEN(filename, mode) gdbm_open(filename, 512, mode, 0666, 0) -#define DBM_CLOSE(dbf) gdbm_close(dbf) -#define DBM_STORE(dbf, key, value, mode) gdbm_store(dbf, key, value, mode) -#define DBM_FETCH(dbf, key) gdbm_fetch(dbf, key) -#define DBM_EXISTS(dbf, key) gdbm_exists(dbf, key) -#define DBM_DELETE(dbf, key) gdbm_delete(dbf, key) -#define DBM_FIRSTKEY(dbf) gdbm_firstkey(dbf) -#define DBM_NEXTKEY(dbf, key) gdbm_nextkey(dbf, key) - -#define DBM_INSERT GDBM_INSERT -#define DBM_REPLACE GDBM_REPLACE -#endif - -#if NDBM && !GDBM -#if BSD2 -#define DB_DBM_HSEARCH 1 -#include -#else -#ifdef HAVE_DB1_NDBM_H -#include -#else -#include -#endif -#endif - -#define DBM_TYPE DBM * -#define DBM_MODE_TYPE int -#define DBM_WRITE_MODE O_RDWR -#define DBM_CREATE_MODE O_RDWR | O_APPEND | O_CREAT -#define DBM_NEW_MODE O_RDWR | O_CREAT | O_TRUNC -#define DBM_DEFAULT_MODE O_RDONLY -#define DBM_OPEN(filename, mode) dbm_open(filename, mode, 0666) -#define DBM_CLOSE(dbf) dbm_close(dbf) -#define DBM_STORE(dbf, key, value, mode) dbm_store(dbf, key, value, mode) -#define DBM_FETCH(dbf, key) dbm_fetch(dbf, key) -#define DBM_EXISTS(dbf, key) _php3_dbm_exists(dbf, key) -#define DBM_DELETE(dbf, key) dbm_delete(dbf, key) -#define DBM_FIRSTKEY(dbf) dbm_firstkey(dbf) -#define DBM_NEXTKEY(dbf, key) dbm_nextkey(dbf) - -static int _php3_dbm_exists(DBM *dbf, datum key_datum) { - datum value_datum; - int ret; - - value_datum = dbm_fetch(dbf, key_datum); - if (value_datum.dptr) - ret = 1; - else - ret = 0; - return ret; -} -#endif - -#if !NDBM && !GDBM -#define DBM_TYPE FILE * - -#define DBM_MODE_TYPE char * -#define DBM_WRITE_MODE "r+b" -#define DBM_CREATE_MODE "a+b" -#define DBM_NEW_MODE "w+b" -#define DBM_DEFAULT_MODE "r" -#define DBM_OPEN(filename, mode) fopen(filename, mode) -#define DBM_CLOSE(dbf) fclose(dbf) -#define DBM_STORE(dbf, key, value, mode) flatfile_store(dbf, key, value, mode) -#define DBM_FETCH(dbf, key) flatfile_fetch(dbf, key) -#define DBM_EXISTS(dbf, key) flatfile_findkey(dbf, key) -#define DBM_DELETE(dbf, key) flatfile_delete(dbf, key) -#define DBM_FIRSTKEY(dbf) flatfile_firstkey(dbf) -#define DBM_NEXTKEY(dbf, key) flatfile_nextkey(dbf) - -#define DBM_INSERT 0 -#define DBM_REPLACE 1 - -typedef struct { - char *dptr; - int dsize; -} datum; - -int flatfile_store(FILE *dbf, datum key, datum value, int mode); -datum flatfile_fetch(FILE *dbf, datum key); -int flatfile_findkey(FILE *dbf, datum key); -int flatfile_delete(FILE *dbf, datum key); -datum flatfile_firstkey(FILE *dbf); -datum flatfile_nextkey(FILE *dbf); - -#endif - -#include "php3_db.h" -#include "ext/standard/php3_string.h" - -#if THREAD_SAFE -DWORD DbmTls; -static int numthreads=0; - -typedef struct dbm_global_struct{ - int le_db; -}dbm_global_struct; - -#define DBM_GLOBAL(a) dbm_globals->a -#define DBM_TLS_VARS dbm_global_struct *dbm_globals = TlsGetValue(DbmTls); - -#else -static int le_db; -#define DBM_GLOBAL(a) a -#define DBM_TLS_VARS -#endif - -/*needed for blocking calls in windows*/ -void *dbm_mutex; - -dbm_info *_php3_finddbm(pval *id,HashTable *list) -{ - list_entry *le; - dbm_info *info; - int numitems, i; - int info_type; - DBM_TLS_VARS; - - if (id->type == IS_STRING) { - numitems = zend_hash_num_elements(list); - for (i=1; i<=numitems; i++) { - if (zend_hash_index_find(list, i, (void **) &le)==FAILURE) { - continue; - } - if (le->type == DBM_GLOBAL(le_db)) { - info = (dbm_info *)(le->ptr); - if (!strcmp(info->filename, id->value.str.val)) { - return (dbm_info *)(le->ptr); - } - } - } - } - - /* didn't find it as a database filename, try as a number */ - convert_to_long(id); - info = php3_list_find(id->value.lval, &info_type); - if (info_type != DBM_GLOBAL(le_db)) - return NULL; - return info; -} - -static char *php3_get_info_db(void) -{ - static char temp1[128]; - static char temp[256]; - - temp1[0]='\0'; - temp[0]='\0'; - -#ifdef DB_VERSION_STRING /* using sleepycat dbm */ - strcat(temp,DB_VERSION_STRING); -#endif - -#if GDBM - sprintf(temp1,"%s",gdbm_version); - strcat(temp,temp1); -#endif - -#if NDBM && !GDBM - strcat(temp,"ndbm support enabled"); -#endif - -#if !GDBM && !NDBM - strcat(temp,"flat file support enabled"); -#endif - -#if NFS_HACK - strcat(temp,"NFS hack in effect"); -#endif - - if (!*temp) - strcat(temp,"No database support"); - - return temp; -} - - -PHP_MINFO_FUNCTION(db) -{ - php_printf(php3_get_info_db()); -} - -PHP_FUNCTION(dblist) -{ - char *str = php3_get_info_db(); - RETURN_STRING(str,1); -} - - -PHP_FUNCTION(dbmopen) { - pval *filename, *mode; - dbm_info *info=NULL; - int ret; - DBM_TLS_VARS; - - if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&filename,&mode)==FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string(filename); - convert_to_string(mode); - - info = _php3_dbmopen(filename->value.str.val, mode->value.str.val); - if (info) { - ret = php3_list_insert(info, DBM_GLOBAL(le_db)); - RETURN_LONG(ret); - } else { - RETURN_FALSE; - } -} - -dbm_info *_php3_dbmopen(char *filename, char *mode) { - dbm_info *info; - int ret, lock=0; - char *lockfn = NULL; - int lockfd = 0; - -#if NFS_HACK - int last_try = 0; - struct stat sb; - int retries = 0; -#endif - - DBM_TYPE dbf=NULL; - DBM_MODE_TYPE imode; - PLS_FETCH(); - - if (filename == NULL) { - php_error(E_WARNING, "NULL filename passed to _php3_dbmopen()"); - return NULL; - } - - if (PG(safe_mode) && (!_php3_checkuid(filename, 2))) { - return NULL; - } - - if (_php3_check_open_basedir(filename)) { - return NULL; - } - - switch (*mode) { - case 'w': - imode = DBM_WRITE_MODE; - lock = 1; - break; - case 'c': - imode = DBM_CREATE_MODE; - lock = 1; - break; - case 'n': - imode = DBM_NEW_MODE; - lock = 1; - break; - default: - imode = DBM_DEFAULT_MODE; - lock = 0; - break; - } - - if (lock) { - lockfn = emalloc(strlen(filename) + 5); - strcpy(lockfn, filename); - strcat(lockfn, ".lck"); - -#if NFS_HACK - while((last_try = stat(lockfn,&sb))==0) { - retries++; - sleep(1); - if (retries>30) break; - } - if (last_try!=0) { - lockfd = open(lockfn,O_RDWR|O_CREAT,0644); - close(lockfd); - } else { - php_error(E_WARNING, "File appears to be locked [%s]\n",lockfn); - return -1; - } -#else /* NFS_HACK */ - - lockfd = open(lockfn,O_RDWR|O_CREAT,0644); - - if (lockfd) { - flock(lockfd,LOCK_EX); - close(lockfd); - } else { - php_error(E_WARNING, "Unable to establish lock: %s",filename); - } -#endif /* else NFS_HACK */ - - } - - dbf = DBM_OPEN(filename, imode); - -#if !NDBM && !GDBM - if (dbf) { - setvbuf(dbf, NULL, _IONBF, 0); - } -#endif - - if (dbf) { - info = (dbm_info *)emalloc(sizeof(dbm_info)); - if (!info) { - php_error(E_ERROR, "problem allocating memory!"); - return NULL; - } - - info->filename = estrdup(filename); - info->lockfn = lockfn; - info->lockfd = lockfd; - info->dbf = dbf; - - return info; - } else { -#if GDBM - php_error(E_WARNING, "dbmopen_gdbm(%s): %d [%s], %d [%s]",filename,gdbm_errno,gdbm_strerror(gdbm_errno),errno,strerror(errno)); - if (gdbm_errno) - ret = gdbm_errno; - else if (errno) - ret = errno; - else - ret = -1; -#else -#if NDBM -#if DEBUG - php_error(E_WARNING, "dbmopen_ndbm(%s): errno = %d [%s]\n",filename,errno,strerror(errno)); -#endif - if (errno) ret=errno; - else ret = -1; -#else -#if DEBUG - php_error(E_WARNING, "dbmopen_flatfile(%s): errno = %d [%s]\n",filename,errno,strerror(errno)); -#endif - if (errno) ret=errno; - else ret = -1; -#endif -#endif - -#if NFS_HACK - if (lockfn) { - unlink(lockfn); - } -#endif - if (lockfn) efree(lockfn); - } - - return NULL; -} - -PHP_FUNCTION(dbmclose) { - pval *id; - - if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&id)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(id); - - if (php3_list_delete(id->value.lval) == SUCCESS) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } -} - -int _php3_dbmclose(dbm_info *info) { - int ret = 0; - DBM_TYPE dbf; - int lockfd; - - dbf = info->dbf; - -#if NFS_HACK - unlink(info->lockfn); -#else - if (info->lockfn) { - lockfd = open(info->lockfn,O_RDWR,0644); - flock(lockfd,LOCK_UN); - close(lockfd); - } -#endif - - if (dbf) - DBM_CLOSE(dbf); - - /* free the memory used by the dbm_info struct */ - if (info->filename) efree(info->filename); - if (info->lockfn) efree(info->lockfn); - efree(info); - - return(ret); -} - -/* - * ret = -1 means that database was opened for read-only - * ret = 0 success - * ret = 1 key already exists - nothing done - */ -PHP_FUNCTION(dbminsert) -{ - pval *id, *key, *value; - dbm_info *info; - int ret; - - if (ARG_COUNT(ht)!=3||getParameters(ht,3,&id,&key,&value) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(key); - convert_to_string(value); - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - ret = _php3_dbminsert(info, key->value.str.val, value->value.str.val); - RETURN_LONG(ret); -} - -int _php3_dbminsert(dbm_info *info, char *key, char *value) { - datum key_datum, value_datum; - int ret; - DBM_TYPE dbf; - - php_stripslashes(key,NULL); - php_stripslashes(value,NULL); - - value_datum.dptr = estrdup(value); - value_datum.dsize = strlen(value); - - key_datum.dptr = estrdup(key); - key_datum.dsize = strlen(key); -#if GDBM_FIX - key_datum.dsize++; -#endif - - dbf = info->dbf; - if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); - return 1; - } - - ret = DBM_STORE(dbf, key_datum, value_datum, DBM_INSERT); - - /* free the memory */ - efree(key_datum.dptr); efree(value_datum.dptr); - - return(ret); -} - -PHP_FUNCTION(dbmreplace) -{ - pval *id, *key, *value; - dbm_info *info; - int ret; - - if (ARG_COUNT(ht)!=3||getParameters(ht,3,&id,&key,&value) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(key); - convert_to_string(value); - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - ret = _php3_dbmreplace(info, key->value.str.val, value->value.str.val); - RETURN_LONG(ret); -} - -int _php3_dbmreplace(dbm_info *info, char *key, char *value) { - DBM_TYPE dbf; - int ret; - datum key_datum, value_datum; - PLS_FETCH(); - - if (PG(magic_quotes_runtime)) { - php_stripslashes(key,NULL); - php_stripslashes(value,NULL); - } - - value_datum.dptr = estrdup(value); - value_datum.dsize = strlen(value); - - key_datum.dptr = estrdup(key); - key_datum.dsize = strlen(key); -#if GDBM_FIX - key_datum.dsize++; -#endif - - dbf = info->dbf; - if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); - return 1; - } - - ret = DBM_STORE(dbf, key_datum, value_datum, DBM_REPLACE); - - /* free the memory */ - efree(key_datum.dptr); efree(value_datum.dptr); - - return(ret); -} - -PHP_FUNCTION(dbmfetch) -{ - pval *id, *key; - dbm_info *info; - - if (ARG_COUNT(ht)!=2||getParameters(ht,2,&id,&key)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(key); - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - return_value->value.str.val = _php3_dbmfetch(info, key->value.str.val); - if (return_value->value.str.val) { - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - } else { - RETURN_FALSE; - } -} - -char *_php3_dbmfetch(dbm_info *info, char *key) { - datum key_datum, value_datum; - char *ret; - DBM_TYPE dbf; - PLS_FETCH(); - - key_datum.dptr = key; - key_datum.dsize = strlen(key); -#if GDBM_FIX - key_datum.dsize++; -#endif - value_datum.dptr = NULL; - value_datum.dsize = 0; - - dbf = info->dbf; - if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); - return(NULL); - } - - value_datum = DBM_FETCH(dbf, key_datum); - - if (value_datum.dptr) { - ret = (char *)emalloc(sizeof(char) * value_datum.dsize + 1); - strncpy(ret, value_datum.dptr, value_datum.dsize); - ret[value_datum.dsize] = '\0'; - -#if GDBM -/* all but NDBM use malloc to allocate the content blocks, so we need to free it */ - free(value_datum.dptr); -#else -# if !NDBM - efree(value_datum.dptr); -# endif -#endif - } - else - ret = NULL; - - if (ret && PG(magic_quotes_runtime)) { - ret = php_addslashes(ret, value_datum.dsize, NULL, 1); - } - return(ret); -} - - -PHP_FUNCTION(dbmexists) -{ - pval *id, *key; - dbm_info *info; - int ret; - - if (ARG_COUNT(ht)!=2||getParameters(ht,2,&id,&key)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(key); - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - ret = _php3_dbmexists(info, key->value.str.val); - RETURN_LONG(ret); -} - -int _php3_dbmexists(dbm_info *info, char *key) { - datum key_datum; - int ret; - DBM_TYPE dbf; - - key_datum.dptr = key; - key_datum.dsize = strlen(key); -#if GDBM_FIX - key_datum.dsize++; -#endif - - dbf = info->dbf; - if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); - return(0); - } - - ret = DBM_EXISTS(dbf, key_datum); - - return(ret); -} - -PHP_FUNCTION(dbmdelete) -{ - pval *id, *key; - dbm_info *info; - int ret; - - if (ARG_COUNT(ht)!=2||getParameters(ht,2,&id,&key)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(key); - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - ret = _php3_dbmdelete(info, key->value.str.val); - RETURN_LONG(ret); -} - -int _php3_dbmdelete(dbm_info *info, char *key) { - datum key_datum; - int ret; - DBM_TYPE dbf; - - key_datum.dptr = key; - key_datum.dsize = strlen(key); -#if GDBM_FIX - key_datum.dsize++; -#endif - - dbf = info->dbf; - if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); - return(0); - } - - ret = DBM_DELETE(dbf, key_datum); - return(ret); -} - -PHP_FUNCTION(dbmfirstkey) -{ - pval *id; - dbm_info *info; - char *ret; - - if (ARG_COUNT(ht)!=1||getParameters(ht,1,&id)==FAILURE) { - WRONG_PARAM_COUNT; - } - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - ret = _php3_dbmfirstkey(info); - if (!ret) { - RETURN_FALSE; - } else { - return_value->value.str.val = ret; - return_value->value.str.len = strlen(ret); - return_value->type = IS_STRING; - } -} - -char *_php3_dbmfirstkey(dbm_info *info) { - datum ret_datum; - char *ret; - DBM_TYPE dbf; - - dbf = info->dbf; - if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); - return(NULL); - } - - /* explicitly zero-out ret_datum */ - ret_datum.dptr = NULL; - ret_datum.dsize = 0; - - ret_datum = DBM_FIRSTKEY(dbf); - - if (!ret_datum.dptr) - return NULL; - - ret = (char *)emalloc((ret_datum.dsize + 1) * sizeof(char)); - strncpy(ret, ret_datum.dptr, ret_datum.dsize); - ret[ret_datum.dsize] = '\0'; - -#if !NDBM & !GDBM - efree(ret_datum.dptr); -#endif - - return (ret); -} - -PHP_FUNCTION(dbmnextkey) -{ - pval *id, *key; - dbm_info *info; - char *ret; - - if (ARG_COUNT(ht)!=2||getParameters(ht,2,&id,&key)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(key); - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - ret = _php3_dbmnextkey(info, key->value.str.val); - if (!ret) { - RETURN_FALSE; - } else { - return_value->value.str.val = ret; - return_value->value.str.len = strlen(ret); - return_value->type = IS_STRING; - } -} - -char *_php3_dbmnextkey(dbm_info *info, char *key) { - datum key_datum, ret_datum; - char *ret; - DBM_TYPE dbf; - PLS_FETCH(); - - key_datum.dptr = key; - key_datum.dsize = strlen(key); -#if GDBM_FIX - key_datum.dsize++; -#endif - - dbf = info->dbf; - if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); - return(NULL); - } - - /* explicitly zero-out ret_datum */ - ret_datum.dptr = NULL; - ret_datum.dsize = 0; - - ret_datum = DBM_NEXTKEY(dbf, key_datum); - - if (ret_datum.dptr) { - ret = (char *)emalloc(sizeof(char) * ret_datum.dsize + 1); - strncpy(ret, ret_datum.dptr, ret_datum.dsize); - ret[ret_datum.dsize] = '\0'; -#if GDBM -/* GDBM uses malloc to allocate the value_datum block, so we need to free it */ - free(ret_datum.dptr); -#else -# if !NDBM - efree(ret_datum.dptr); -# endif -#endif - } - else ret=NULL; - - if (ret && PG(magic_quotes_runtime)) { - ret = php_addslashes(ret, ret_datum.dsize, NULL, 1); - } - return(ret); -} - - -#if !GDBM && !NDBM -static long CurrentFlatFilePos = 0L; - -int flatfile_store(FILE *dbf, datum key_datum, datum value_datum, int mode) { - int ret; - - if (mode == DBM_INSERT) { - if (flatfile_findkey(dbf, key_datum)) { - return 1; - } - fseek(dbf,0L,SEEK_END); - fprintf(dbf,"%d\n",key_datum.dsize); - fflush(dbf); - ret = write(fileno(dbf),key_datum.dptr,key_datum.dsize); - fprintf(dbf,"%d\n",value_datum.dsize); - fflush(dbf); - ret = write(fileno(dbf),value_datum.dptr,value_datum.dsize); - } else { /* DBM_REPLACE */ - flatfile_delete(dbf,key_datum); - fprintf(dbf,"%d\n",key_datum.dsize); - fflush(dbf); - ret = write(fileno(dbf),key_datum.dptr,key_datum.dsize); - fprintf(dbf,"%d\n",value_datum.dsize); - ret = write(fileno(dbf),value_datum.dptr,value_datum.dsize); - } - - if (ret>0) - ret=0; - return ret; -} - -datum flatfile_fetch(FILE *dbf, datum key_datum) { - datum value_datum = {NULL, 0}; - int num=0, buf_size=1024; - char *buf; - - if (flatfile_findkey(dbf,key_datum)) { - buf = emalloc((buf_size+1) * sizeof(char)); - if (fgets(buf, 15, dbf)) { - num = atoi(buf); - if (num > buf_size) { - buf_size+=num; - buf = emalloc((buf_size+1)*sizeof(char)); - } - read(fileno(dbf),buf,num); - value_datum.dptr = buf; - value_datum.dsize = num; - } - } - return value_datum; -} - -int flatfile_delete(FILE *dbf, datum key_datum) { - char *key = key_datum.dptr; - int size = key_datum.dsize; - - char *buf; - int num, buf_size = 1024; - long pos; - - rewind(dbf); - - buf = emalloc((buf_size + 1)*sizeof(char)); - while(!feof(dbf)) { - /* read in the length of the key name */ - if (!fgets(buf, 15, dbf)) - break; - num = atoi(buf); - if (num > buf_size) { - buf_size += num; - if (buf) efree(buf); - buf = emalloc((buf_size+1)*sizeof(char)); - } - pos = ftell(dbf); - - /* read in the key name */ - num = fread(buf, sizeof(char), num, dbf); - if (num<0) break; - *(buf+num) = '\0'; - - if (size == num && !memcmp(buf, key, size)) { - fseek(dbf, pos, SEEK_SET); - fputc(0, dbf); - fflush(dbf); - fseek(dbf, 0L, SEEK_END); - if (buf) efree(buf); - return SUCCESS; - } - - /* read in the length of the value */ - if (!fgets(buf,15,dbf)) - break; - num = atoi(buf); - if (num > buf_size) { - buf_size+=num; - if (buf) efree(buf); - buf = emalloc((buf_size+1)*sizeof(char)); - } - /* read in the value */ - num = fread(buf, sizeof(char), num, dbf); - if (num<0) - break; - } - if (buf) efree(buf); - return FAILURE; -} - -int flatfile_findkey(FILE *dbf, datum key_datum) { - char *buf = NULL; - int num; - int buf_size=1024; - int ret=0; - void *key = key_datum.dptr; - int size = key_datum.dsize; - - rewind(dbf); - buf = emalloc((buf_size+1)*sizeof(char)); - while (!feof(dbf)) { - if (!fgets(buf,15,dbf)) break; - num = atoi(buf); - if (num > buf_size) { - if (buf) efree(buf); - buf_size+=num; - buf = emalloc((buf_size+1)*sizeof(char)); - } - num = fread(buf, sizeof(char), num, dbf); - if (num<0) break; - *(buf+num) = '\0'; - if (size == num) { - if (!memcmp(buf,key,size)) { - ret = 1; - break; - } - } - if (!fgets(buf,15,dbf)) - break; - num = atoi(buf); - if (num > buf_size) { - if (buf) efree(buf); - buf_size+=num; - buf = emalloc((buf_size+1)*sizeof(char)); - } - num = fread(buf, sizeof(char), num, dbf); - if (num<0) break; - *(buf+num) = '\0'; - } - if (buf) efree(buf); - return(ret); -} - -datum flatfile_firstkey(FILE *dbf) { - datum buf; - int num; - int buf_size=1024; - - rewind(dbf); - buf.dptr = emalloc((buf_size+1)*sizeof(char)); - while(!feof(dbf)) { - if (!fgets(buf.dptr,15,dbf)) break; - num = atoi(buf.dptr); - if (num > buf_size) { - buf_size+=num; - if (buf.dptr) efree(buf.dptr); - buf.dptr = emalloc((buf_size+1)*sizeof(char)); - } - num=read(fileno(dbf),buf.dptr,num); - if (num<0) break; - buf.dsize = num; - if (*(buf.dptr)!=0) { - CurrentFlatFilePos = ftell(dbf); - return(buf); - } - if (!fgets(buf.dptr,15,dbf)) break; - num = atoi(buf.dptr); - if (num > buf_size) { - buf_size+=num; - if (buf.dptr) efree(buf.dptr); - buf.dptr = emalloc((buf_size+1)*sizeof(char)); - } - num=read(fileno(dbf),buf.dptr,num); - if (num<0) break; - } - if (buf.dptr) efree(buf.dptr); - buf.dptr = NULL; - return(buf); -} - -datum flatfile_nextkey(FILE *dbf) { - datum buf; - int num; - int buf_size=1024; - - fseek(dbf,CurrentFlatFilePos,SEEK_SET); - buf.dptr = emalloc((buf_size+1)*sizeof(char)); - while(!feof(dbf)) { - if (!fgets(buf.dptr,15,dbf)) break; - num = atoi(buf.dptr); - if (num > buf_size) { - buf_size+=num; - if (buf.dptr) efree(buf.dptr); - buf.dptr = emalloc((buf_size+1)*sizeof(char)); - } - num=read(fileno(dbf),buf.dptr,num); - if (num<0) break; - if (!fgets(buf.dptr,15,dbf)) break; - num = atoi(buf.dptr); - if (num > buf_size) { - buf_size+=num; - if (buf.dptr) efree(buf.dptr); - buf.dptr = emalloc((buf_size+1)*sizeof(char)); - } - num=read(fileno(dbf),buf.dptr,num); - if (num<0) break; - buf.dsize = num; - if (*(buf.dptr)!=0) { - CurrentFlatFilePos = ftell(dbf); - return(buf); - } - } - if (buf.dptr) efree(buf.dptr); - buf.dptr = NULL; - return(buf); -} -#endif - - -PHP_MINIT_FUNCTION(db) -{ -#if defined(THREAD_SAFE) - dbm_global_struct *dbm_globals; - PHP3_MUTEX_ALLOC(dbm_mutex); - PHP3_MUTEX_LOCK(dbm_mutex); - numthreads++; - if (numthreads==1){ - if (!PHP3_TLS_PROC_STARTUP(DbmTls)){ - PHP3_MUTEX_UNLOCK(dbm_mutex); - PHP3_MUTEX_FREE(dbm_mutex); - return FAILURE; - } - } - PHP3_MUTEX_UNLOCK(dbm_mutex); - if(!PHP3_TLS_THREAD_INIT(DbmTls,dbm_globals,dbm_global_struct)){ - PHP3_MUTEX_FREE(dbm_mutex); - return FAILURE; - } -#endif - - DBM_GLOBAL(le_db) = register_list_destructors(_php3_dbmclose,NULL); - return SUCCESS; -} - -static PHP_MSHUTDOWN_FUNCTION(db) -{ - DBM_TLS_VARS; -#ifdef THREAD_SAFE - PHP3_TLS_THREAD_FREE(dbm_globals); - PHP3_MUTEX_LOCK(dbm_mutex); - numthreads--; - if (numthreads<1) { - PHP3_TLS_PROC_SHUTDOWN(DbmTls); - PHP3_MUTEX_UNLOCK(dbm_mutex); - PHP3_MUTEX_FREE(dbm_mutex); - return SUCCESS; - } - PHP3_MUTEX_UNLOCK(dbm_mutex); -#endif - return SUCCESS; -} - -PHP_RINIT_FUNCTION(db) -{ -#if !GDBM && !NDBM - CurrentFlatFilePos = 0L; -#endif - return SUCCESS; -} - - -function_entry dbm_functions[] = { - PHP_FE(dblist, NULL) - PHP_FE(dbmopen, NULL) - PHP_FE(dbmclose, NULL) - PHP_FE(dbminsert, NULL) - PHP_FE(dbmfetch, NULL) - PHP_FE(dbmreplace, NULL) - PHP_FE(dbmexists, NULL) - PHP_FE(dbmdelete, NULL) - PHP_FE(dbmfirstkey, NULL) - PHP_FE(dbmnextkey, NULL) - {NULL,NULL,NULL} -}; - -php3_module_entry dbm_module_entry = { - "DBM", dbm_functions, PHP_MINIT(db), PHP_MSHUTDOWN(db), PHP_RINIT(db), NULL, PHP_MINFO(db), STANDARD_MODULE_PROPERTIES -}; - -#if COMPILE_DL -DLEXPORT php3_module_entry *get_module(void) { return &dbm_module_entry; } -#endif - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/db/php3_db.h b/ext/db/php3_db.h deleted file mode 100644 index 17069e6bcd0de..0000000000000 --- a/ext/db/php3_db.h +++ /dev/null @@ -1,95 +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 | - | Jim Winstead | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - - -#ifndef _PHP3_DB_H -#define _PHP3_DB_H - - -#ifndef DLEXPORT -#define DLEXPORT -#endif - - -extern php3_module_entry dbm_module_entry; -#define phpext_db_ptr &dbm_module_entry - - - -typedef struct dbm_info { - char *filename; - char *lockfn; - int lockfd; - void *dbf; -} dbm_info; - -/* - we're not going to bother with flatfile on win32 - because the dbm module will be external, and we - do not want flatfile compiled staticly -*/ -#if defined(MSVC5) && !defined(COMPILE_DL) -#undef phpext_db_ptr -#define phpext_db_ptr NULL -#endif - -dbm_info *_php3_finddbm(pval *id,HashTable *list); -int _php3_dbmclose(dbm_info *info); -dbm_info *_php3_dbmopen(char *filename, char *mode); -int _php3_dbminsert(dbm_info *info, char *key, char *value); -char *_php3_dbmfetch(dbm_info *info, char *key); -int _php3_dbmreplace(dbm_info *info, char *key, char *value); -int _php3_dbmexists(dbm_info *info, char *key); -int _php3_dbmdelete(dbm_info *info, char *key); -char *_php3_dbmfirstkey(dbm_info *info); -char *_php3_dbmnextkey(dbm_info *info, char *key); - -/* db file functions */ -PHP_MINIT_FUNCTION(db); -PHP_RINIT_FUNCTION(db); -PHP_MINFO_FUNCTION(db); - -PHP_FUNCTION(dblist); -PHP_FUNCTION(dbmopen); -PHP_FUNCTION(dbmclose); -PHP_FUNCTION(dbminsert); -PHP_FUNCTION(dbmfetch); -PHP_FUNCTION(dbmreplace); -PHP_FUNCTION(dbmexists); -PHP_FUNCTION(dbmdelete); -PHP_FUNCTION(dbmfirstkey); -PHP_FUNCTION(dbmnextkey); - -#undef phpext_db_ptr -#define phpext_db_ptr NULL - -#endif /* _PHP3_DB_H */ diff --git a/ext/dba/Makefile.am b/ext/dba/Makefile.am deleted file mode 100644 index 2ab929391ee59..0000000000000 --- a/ext/dba/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_dba.la -libphpext_dba_la_SOURCES=dba.c dba_cdb.c dba_db2.c dba_dbm.c dba_gdbm.c \ - dba_ndbm.c dba_db3.c - diff --git a/ext/dba/config.h.stub b/ext/dba/config.h.stub deleted file mode 100644 index df25632a4b03f..0000000000000 --- a/ext/dba/config.h.stub +++ /dev/null @@ -1,19 +0,0 @@ -/* define if you want to use the dba extension */ - -#define NDBM_DB1_NDBM_H 0 -#define NDBM_NDBM_H 0 -#define DB2_DB2_DB_H 0 -#define DB2_DB_DB2_H 0 -#define DB2_DB_H 0 -#define DB2_DB2_H 0 -#define DB3_DB_H 0 -#define HAVE_DBA 0 -#define DBA_GDBM 0 -#define DBA_NDBM 0 -#define DBA_DBOPEN 0 -#define DBA_DB2 0 -#define DBA_DB3 0 -#define DBA_DBM 0 -#define DBA_CDB 0 - - diff --git a/ext/dba/config.m4 b/ext/dba/config.m4 deleted file mode 100644 index 7ddcd8eb3bc73..0000000000000 --- a/ext/dba/config.m4 +++ /dev/null @@ -1,238 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension dba -dnl don't forget to call PHP_EXTENSION(dba) - -AC_DEFUN(AC_TEMP_LDFLAGS,[ - old_LDFLAGS="$LDFLAGS" - LDFLAGS="$1 $LDFLAGS" - $2 - LDFLAGS="$old_LDFLAGS" -]) - - -dnl Assign INCLUDE/LFLAGS from PREFIX -AC_DEFUN(AC_DBA_STD_ASSIGN,[ - if test "$THIS_PREFIX" != "" -a "$THIS_PREFIX" != "/usr"; then - THIS_INCLUDE="$THIS_PREFIX/include" - THIS_LFLAGS="$THIS_PREFIX/lib" - fi -]) - -dnl Standard check -AC_DEFUN(AC_DBA_STD_CHECK,[ - THIS_RESULT="yes" - if test "$THIS_PREFIX" != "/usr"; then - if test "$THIS_INCLUDE" = "" ; then - AC_MSG_ERROR(cannot find necessary header file(s)) - elif test "$THIS_LIBS" = "" ; then - AC_MSG_ERROR(cannot find necessary library) - fi - fi -]) - -dnl Attach THIS_x to DBA_x -AC_DEFUN(AC_DBA_STD_ATTACH,[ - AC_ADD_INCLUDE($THIS_INCLUDE) - AC_ADD_LIBRARY_WITH_PATH($THIS_LIBS, $THIS_LFLAGS) - - THIS_INCLUDE="" - THIS_LIBS="" - THIS_LFLAGS="" - THIS_PREFIX="" -]) - -dnl Print the result message -AC_DEFUN(AC_DBA_STD_RESULT,[ - if test "$THIS_RESULT" = "yes"; then - HAVE_DBA=1 - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - THIS_RESULT="" -]) - - - -AC_ARG_WITH(gdbm, -[ --with-gdbm[=DIR] Include GDBM support],[ - if test "$withval" != "no"; then - for i in /usr/local /usr $withval; do - if test -f "$i/include/gdbm.h"; then - THIS_PREFIX="$i" - fi - done - - unset ac_cv_lib_gdbm_gdbm_open - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB(gdbm, gdbm_open, [AC_DEFINE(DBA_GDBM, 1) THIS_LIBS="gdbm"]) - ]) - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_DBA_STD_ATTACH - fi -]) -AC_MSG_CHECKING(for GDBM support) -AC_DBA_STD_RESULT - -AC_ARG_WITH(ndbm, -[ --with-ndbm[=DIR] Include NDBM support],[ - if test "$withval" != "no"; then - for i in /usr/local /usr $withval; do - if test -f "$i/include/db1/ndbm.h" ; then - THIS_PREFIX="$i" - NDBM_EXTRA="NDBM_DB1_NDBM_H" - elif test -f "$i/include/ndbm.h" ; then - THIS_PREFIX="$i" - NDBM_EXTRA="NDBM_NDBM_H" - fi - done - - if test "$NDBM_EXTRA" != ""; then - eval "AC_DEFINE($NDBM_EXTRA, 1)" - fi - - for LIB in db1 ndbm c; do - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, dbm_open, [AC_DEFINE(DBA_NDBM,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_DBA_STD_ATTACH - fi -]) -AC_MSG_CHECKING(for NDBM support) -AC_DBA_STD_RESULT - -AC_ARG_WITH(db2, -[ --with-db2[=DIR] Include Berkeley DB2 support],[ - if test "$withval" != "no"; then - for i in /usr/local /usr /usr/BerkeleyDB $withval; do - if test -f "$i/db2/db.h"; then - THIS_PREFIX="$i" - DB2_EXTRA="db2" - elif test -f "$i/include/db2/db.h"; then - THIS_PREFIX="$i" - DB2_EXTRA="DB2_DB2_DB_H" - elif test -f "$i/include/db/db2.h"; then - THIS_PREFIX="$i" - DB2_EXTRA="DB2_DB_DB2_H" - elif test -f "$i/include/db2.h"; then - THIS_PREFIX="$i" - DB2_EXTRA="DB2_DB2_H" - elif test -f "$i/include/db.h" ; then - THIS_PREFIX="$i" - DB2_EXTRA="DB2_DB_H" - fi - done - - if test "$DB2_EXTRA" = "db2" ; then - DBA_INCLUDE="$DBA_INCLUDE -I$THIS_PREFIX/db2" - DB2_EXTRA="DB2_DB_H" - fi - - if test -n "$DB2_EXTRA"; then - eval "AC_DEFINE($DB2_EXTRA, 1)" - fi - - for LIB in db db2 c; do - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, db_appinit, [AC_DEFINE(DBA_DB2,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_DBA_STD_ATTACH - fi -]) -AC_MSG_CHECKING(for Berkeley DB2 support) -AC_DBA_STD_RESULT - -AC_ARG_WITH(db3, -[ --with-db3[=DIR] Include Berkeley DB3 support],[ - if test "$withval" != "no"; then - for i in /usr/local /usr $withval; do - if test -f "$i/include/db.h" ; then - THIS_PREFIX="$i" - DB3_EXTRA="DB3_DB_H" - fi - done - - if test -n "$DB3_EXTRA"; then - eval "AC_DEFINE($DB3_EXTRA, 1)" - fi - - for LIB in db; do - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, db_create, [AC_DEFINE(DBA_DB3,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_DBA_STD_ATTACH - fi -]) -AC_MSG_CHECKING(for Berkeley DB3 support) -AC_DBA_STD_RESULT - -AC_ARG_WITH(dbm, -[ --with-dbm[=DIR] Include DBM support],[ - if test "$withval" != "no"; then - for i in /usr/local /usr $withval; do - if test -f "$i/include/dbm.h" ; then - THIS_PREFIX="$i" - fi - done - - for LIB in db1 dbm c; do - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, dbminit, [AC_DEFINE(DBA_DBM,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_DBA_STD_ATTACH - fi -]) -AC_MSG_CHECKING(for DBM support) -AC_DBA_STD_RESULT - -AC_ARG_WITH(cdb, -[ --with-cdb[=DIR] Include CDB support],[ - if test "$withval" != "no"; then - for i in /usr/local /usr $withval; do - if test -f "$i/include/cdb.h" ; then - THIS_PREFIX="$i" - fi - done - - for LIB in cdb c; do - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, cdb_bread, [AC_DEFINE(DBA_CDB,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_DBA_STD_ATTACH - fi -]) -AC_MSG_CHECKING(for CDB support) -AC_DBA_STD_RESULT - -AC_MSG_CHECKING(whether to enable DBA interface) -if test "$HAVE_DBA" = "1"; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_DBA, 1) - PHP_EXTENSION(dba) -else - AC_MSG_RESULT(no) - AC_DEFINE(HAVE_DBA, 0) -fi - diff --git a/ext/dba/dba.c b/ext/dba/dba.c deleted file mode 100644 index dd5eeb9cd2919..0000000000000 --- a/ext/dba/dba.c +++ /dev/null @@ -1,483 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if HAVE_DBA - -#include "php3_dba.h" - -#include "php3_gdbm.h" -#include "php3_ndbm.h" -#include "php3_dbm.h" -#include "php3_cdb.h" -#include "php3_db2.h" -#include "php3_db3.h" - -function_entry dba_functions[] = { - PHP_FE(dba_open, NULL) - PHP_FE(dba_popen, NULL) - PHP_FE(dba_close, NULL) - PHP_FE(dba_delete, NULL) - PHP_FE(dba_exists, NULL) - PHP_FE(dba_fetch, NULL) - PHP_FE(dba_insert, NULL) - PHP_FE(dba_replace, NULL) - PHP_FE(dba_firstkey, NULL) - PHP_FE(dba_nextkey, NULL) - PHP_FE(dba_optimize, NULL) - PHP_FE(dba_sync, NULL) - {NULL,NULL,NULL} -}; - -static PHP_MINIT_FUNCTION(dba); -static PHP_MSHUTDOWN_FUNCTION(dba); -static PHP_MINFO_FUNCTION(dba); - -php3_module_entry dba_module_entry = { - "DataBase API", dba_functions, - PHP_MINIT(dba), - PHP_MSHUTDOWN(dba), - NULL, NULL, - PHP_MINFO(dba), - STANDARD_MODULE_PROPERTIES -}; - -typedef struct dba_handler { - char *name; - int (*open)(dba_info *); - void (*close)(dba_info *); - char* (*fetch)(dba_info *, char *, int, int *); - int (*update)(dba_info *, char *, int, char *, int, int); - int (*exists)(dba_info *, char *, int); - int (*delete)(dba_info *, char *, int); - char* (*firstkey)(dba_info *, int *); - char* (*nextkey)(dba_info *, int *); - int (*optimize)(dba_info *); - int (*sync)(dba_info *); -} dba_handler; - -/* {{{ macromania */ - -#define DBA_ID_PARS \ - pval **id; \ - dba_info *info = NULL; \ - int type, ac = ARG_COUNT(ht) - -/* these are used to get the standard arguments */ - -#define DBA_GET1 \ - if(ac != 1 || getParametersEx(ac, &id) != SUCCESS) { \ - WRONG_PARAM_COUNT; \ - } - -#define DBA_GET2 \ - pval **key; \ - if(ac != 2 || getParametersEx(ac, &key, &id) != SUCCESS) { \ - WRONG_PARAM_COUNT; \ - } \ - convert_to_string_ex(key) - -#define DBA_IF_NOT_CORRECT_TYPE(link_id) \ - info = php3_list_find(link_id, &type); \ - if(!info || (type != GLOBAL(le_db) && type != GLOBAL(le_pdb))) - -#define DBA_ID_GET \ - convert_to_long_ex(id); \ - DBA_IF_NOT_CORRECT_TYPE((*id)->value.lval) { \ - php_error(E_WARNING, "Unable to find DBA identifier %d", \ - (*id)->value.lval); \ - RETURN_FALSE; \ - } - -#define DBA_ID_GET1 DBA_ID_PARS; DBA_GET1; DBA_ID_GET -#define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_ID_GET - -/* a DBA handler must have specific routines */ - -#define DBA_HND(x) \ -{\ - #x, dba_open_##x, dba_close_##x, dba_fetch_##x, dba_update_##x, \ - dba_exists_##x, dba_delete_##x, dba_firstkey_##x, dba_nextkey_##x, \ - dba_optimize_##x, dba_sync_##x \ -}, - -/* check whether the user has write access */ -#define DBA_WRITE_CHECK \ - if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \ - php_error(E_WARNING, "you cannot perform a modification to a database without proper access"); \ - RETURN_FALSE; \ - } - -#define GLOBAL(a) a - -/* }}} */ - -/* {{{ globals */ - -static dba_handler handler[] = { -#if DBA_GDBM - DBA_HND(gdbm) -#endif -#if DBA_DBM - DBA_HND(dbm) -#endif -#if DBA_NDBM - DBA_HND(ndbm) -#endif -#if DBA_CDB - DBA_HND(cdb) -#endif -#if DBA_DB2 - DBA_HND(db2) -#endif -#if DBA_DB3 - DBA_HND(db3) -#endif - { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } -}; - -static int le_db; -static int le_pdb; -static HashTable ht_keys; -/* }}} */ - -/* {{{ helper routines */ - /* {{{ dba_close */ - -static void dba_close(dba_info *info) -{ - if(info->hnd) info->hnd->close(info); - if(info->path) free(info->path); - free(info); -} -/* }}} */ - /* {{{ php3_minit_dba */ - -static PHP_MINIT_FUNCTION(dba) -{ - zend_hash_init(&ht_keys, 0, NULL, NULL, 1); - GLOBAL(le_db) = register_list_destructors(dba_close, NULL); - GLOBAL(le_pdb) = register_list_destructors(NULL, dba_close); - return SUCCESS; -} -/* }}} */ - /* {{{ php3_mshutdown_dba */ - -static PHP_MSHUTDOWN_FUNCTION(dba) -{ - zend_hash_destroy(&ht_keys); - return SUCCESS; -} -/* }}} */ - /* {{{ php3_info_dba */ - -static PHP_MINFO_FUNCTION(dba) -{ - dba_handler *hptr; - - PUTS("V1 ($Id$)"); - for(hptr = handler; hptr->name; hptr++) { - PUTS(" "); - PUTS(hptr->name); - } -} -/* }}} */ - /* {{{ _php3_dba_update */ - -static void _php3_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode) -{ - DBA_ID_PARS; - pval **val, **key; - - if(ac != 3 || getParametersEx(ac, &key, &val, &id) != SUCCESS) { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(key); - convert_to_string_ex(val); - DBA_ID_GET; - - DBA_WRITE_CHECK; - - if(info->hnd->update(info, VALLEN(key), VALLEN(val), mode) == SUCCESS) - RETURN_TRUE; - RETURN_FALSE; -} -/* }}} */ - /* {{{ _php3_dba_open */ - -#define FREENOW if(args) efree(args); if(key) efree(key) - -static void _php3_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) -{ - pval ***args = (pval ***) NULL; - int ac = ARG_COUNT(ht); - dba_mode_t modenr; - dba_info *info; - dba_handler *hptr; - char *key = NULL; - int keylen = 0; - int listid; - int i; - - if(ac < 3) { - WRONG_PARAM_COUNT; - } - - /* we pass additional args to the respective handler */ - args = emalloc(ac * sizeof(pval *)); - if(getParametersArrayEx(ac, args) != SUCCESS) { - FREENOW; - WRONG_PARAM_COUNT; - } - - /* we only take string arguments */ - for(i = 0; i < ac; i++) { - convert_to_string_ex(args[i]); - keylen += (*args[i])->value.str.len; - } - - if(persistent) { - /* calculate hash */ - key = emalloc(keylen); - keylen = 0; - - for(i = 0; i < ac; i++) { - memcpy(key+keylen,(*args[i])->value.str.val,(*args[i])->value.str.len); - keylen += (*args[i])->value.str.len; - } - - if(zend_hash_find(&ht_keys, key, keylen, (void **) &info) == SUCCESS) { - FREENOW; - RETURN_LONG(php3_list_insert(info, GLOBAL(le_pdb))); - } - } - - for(hptr = handler; hptr->name && - strcasecmp(hptr->name, (*args[2])->value.str.val); hptr++); - - if(!hptr->name) { - php_error(E_WARNING, "no such handler: %s", (*args[2])->value.str.val); - FREENOW; - RETURN_FALSE; - } - - switch((*args[1])->value.str.val[0]) { - case 'c': - modenr = DBA_CREAT; - break; - case 'w': - modenr = DBA_WRITER; - break; - case 'r': - modenr = DBA_READER; - break; - case 'n': - modenr = DBA_TRUNC; - break; - default: - php_error(E_WARNING,"illegal DBA mode: %s",(*args[1])->value.str.val); - FREENOW; - RETURN_FALSE; - } - - info = malloc(sizeof(*info)); - memset(info, 0, sizeof(info)); - info->path = strdup((*args[0])->value.str.val); - info->mode = modenr; - info->argc = ac - 3; - info->argv = args + 3; - info->hnd = NULL; - - if(hptr->open(info) != SUCCESS) { - dba_close(info); - php_error(E_WARNING, "driver initialization failed"); - FREENOW; - RETURN_FALSE; - } - info->hnd = hptr; - info->argc = 0; - info->argv = NULL; - - listid = php3_list_insert(info, persistent?GLOBAL(le_pdb):GLOBAL(le_db)); - if(persistent) { - zend_hash_update(&ht_keys, key, keylen, info, sizeof(*info), NULL); - } - - FREENOW; - RETURN_LONG(listid); -} -#undef FREENOW -/* }}} */ -/* }}} */ - -/* {{{ proto int dba_popen(string path, string mode, string handlername[, ...]) - opens path using the specified handler in mode persistently */ -PHP_FUNCTION(dba_popen) -{ - _php3_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - -/* {{{ proto int dba_open(string path, string mode, string handlername[, ...]) - opens path using the specified handler in mode*/ -PHP_FUNCTION(dba_open) -{ - _php3_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto void dba_close(int handle) - closes database */ -PHP_FUNCTION(dba_close) -{ - DBA_ID_GET1; - - php3_list_delete((*id)->value.lval); -} -/* }}} */ - -/* {{{ proto bool dba_exists(string key, int handle) - checks, if the specified key exists */ -PHP_FUNCTION(dba_exists) -{ - DBA_ID_GET2; - - if(info->hnd->exists(info, VALLEN(key)) == SUCCESS) { - RETURN_TRUE; - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto string dba_fetch(string key, int handle) - fetches the data associated with key */ -PHP_FUNCTION(dba_fetch) -{ - char *val; - int len = 0; - DBA_ID_GET2; - - if((val = info->hnd->fetch(info, VALLEN(key), &len)) != NULL) { - RETURN_STRINGL(val, len, 0); - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto string dba_firstkey(int handle) - resets the internal key pointer and returns the first key */ -PHP_FUNCTION(dba_firstkey) -{ - char *fkey; - int len; - DBA_ID_GET1; - - fkey = info->hnd->firstkey(info, &len); - if(fkey) - RETURN_STRINGL(fkey, len, 0); - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto string dba_nextkey(int handle) - returns the next key */ -PHP_FUNCTION(dba_nextkey) -{ - char *nkey; - int len; - DBA_ID_GET1; - - nkey = info->hnd->nextkey(info, &len); - if(nkey) - RETURN_STRINGL(nkey, len, 0); - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto bool dba_delete(string key, int handle) - deletes the entry associated with key */ -PHP_FUNCTION(dba_delete) -{ - DBA_ID_GET2; - - DBA_WRITE_CHECK; - - if(info->hnd->delete(info, VALLEN(key)) == SUCCESS) - RETURN_TRUE; - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto bool dba_insert(string key, string value, int handle) - inserts value as key, returns false, if key exists already */ -PHP_FUNCTION(dba_insert) -{ - _php3_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - -/* {{{ proto bool dba_replace(string key, string value, int handle) - inserts value as key, replaces key, if key exists already */ -PHP_FUNCTION(dba_replace) -{ - _php3_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto bool dba_optimize(int handle) - optimizes (e.g. clean up, vacuum) database */ -PHP_FUNCTION(dba_optimize) -{ - DBA_ID_GET1; - - DBA_WRITE_CHECK; - if(info->hnd->optimize(info) == SUCCESS) { - RETURN_TRUE; - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto bool dba_sync(int handle) - synchronizes database */ -PHP_FUNCTION(dba_sync) -{ - DBA_ID_GET1; - - if(info->hnd->sync(info) == SUCCESS) { - RETURN_TRUE; - } - RETURN_FALSE; -} -/* }}} */ - -#endif diff --git a/ext/dba/dba_cdb.c b/ext/dba/dba_cdb.c deleted file mode 100644 index 55683590c58e8..0000000000000 --- a/ext/dba/dba_cdb.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_CDB -#include "php3_cdb.h" - -#include -#include -#include - -#include -#include - -#define CDB_INFO \ - dba_cdb *cdb = (dba_cdb *) info->dbf - -typedef struct { - int fd; - uint32 eod; /* size of constant database */ - uint32 pos; /* current position for traversing */ -} dba_cdb; - -DBA_OPEN_FUNC(cdb) -{ - int gmode = 0; - dba_cdb *cdb; - dba_info *pinfo = (dba_info *) info; - - switch(info->mode) { - case DBA_READER: - gmode = O_RDONLY; break; - /* currently not supported: */ -#if 0 - case DBA_WRITER: - gmode = O_RDWR; break; -#endif - default: - return FAILURE; - } - - cdb = malloc(sizeof *cdb); - memset(cdb, 0, sizeof *cdb); - - cdb->fd = open(info->path, gmode); - if(cdb->fd < 0) { - free(cdb); - return FAILURE; - } - - pinfo->dbf = cdb; - return SUCCESS; -} - -DBA_CLOSE_FUNC(cdb) -{ - CDB_INFO; - - close(cdb->fd); - free(cdb); -} - -DBA_FETCH_FUNC(cdb) -{ - CDB_INFO; - int len; - char *new = NULL; - - if(cdb_seek(cdb->fd, key, keylen, &len) == 1) { - new = emalloc(len); - read(cdb->fd, new, len); - if(newlen) *newlen = len; - } - - return new; -} - -DBA_UPDATE_FUNC(cdb) -{ - /* if anyone figures out cdbmake.c, let me know */ - return FAILURE; -} - -DBA_EXISTS_FUNC(cdb) -{ - CDB_INFO; - int len; - - if(cdb_seek(cdb->fd, key, keylen, &len) == 1) - return SUCCESS; - return FAILURE; -} - -DBA_DELETE_FUNC(cdb) -{ - return FAILURE; -} - - -#define CREAD(n) if(read(cdb->fd, buf, n) < n) return NULL -#define CSEEK(n) \ - if(n >= cdb->eod) return NULL; \ - if(lseek(cdb->fd, (off_t)n, SEEK_SET) != (off_t) n) return NULL - -DBA_FIRSTKEY_FUNC(cdb) -{ - CDB_INFO; - uint32 len; - char buf[8]; - char *key; - - cdb->eod = -1; - CSEEK(0); - CREAD(4); - cdb->eod = cdb_unpack(buf); - - CSEEK(2048); - CREAD(8); - len = cdb_unpack(buf); - - key = emalloc(len + 1); - if(read(cdb->fd, key, len) < len) { - efree(key); - key = NULL; - } else - key[len] = '\0'; - /* header + klenlen + dlenlen + klen + dlen */ - cdb->pos = 2048 + 4 + 4 + len + cdb_unpack(buf + 4); - - return key; -} - -DBA_NEXTKEY_FUNC(cdb) -{ - CDB_INFO; - uint32 len; - char buf[8]; - char *nkey; - - CSEEK(cdb->pos); - CREAD(8); - len = cdb_unpack(buf); - - nkey = emalloc(len + 1); - if(read(cdb->fd, nkey, len) < len) { - efree(nkey); - return NULL; - } - nkey[len] = '\0'; - if(newlen) *newlen = len; - - cdb->pos += 8 + len + cdb_unpack(buf + 4); - - return nkey; -#if 0 - /* this code cdb_seeks and is thus slower than directly seeking - in the file */ - CDB_INFO; - char *nkey = NULL; - uint32 len; - char buf[8]; - - if(cdb_seek(cdb->fd, key, keylen, &len) == 1) { - if(lseek(cdb->fd, (off_t) len, SEEK_CUR) >= (off_t) cdb->eod) - return NULL; - CREAD(8); - len = cdb_unpack(buf); - - nkey = emalloc(len + 1); - if(read(cdb->fd, nkey, len) < len) { - efree(nkey); - nkey = NULL; - } else - nkey[len] = '\0'; - } - return nkey; -#endif -} - -DBA_OPTIMIZE_FUNC(cdb) -{ - return SUCCESS; -} - -DBA_SYNC_FUNC(cdb) -{ - /* this is read-only */ - return SUCCESS; -} - -#endif diff --git a/ext/dba/dba_db2.c b/ext/dba/dba_db2.c deleted file mode 100644 index 77f010a7f2120..0000000000000 --- a/ext/dba/dba_db2.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_DB2 -#include "php3_db2.h" -#include - -#include -#if DB2_DB2_DB_H -#include -#elif DB2_DB_DB2_H -#include -#elif DB2_DB2_H -#include -#elif DB2_DB_H -#include -#endif - -#define DB2_DATA dba_db2_data *dba = info->dbf -#define DB2_GKEY \ - DBT gkey; \ - memset(&gkey, 0, sizeof(gkey)); \ - gkey.data = (char *) key; gkey.size = keylen - -typedef struct { - DB *dbp; - DBC *cursor; -} dba_db2_data; - -DBA_OPEN_FUNC(db2) -{ - DB *dbp; - DBTYPE type; - int gmode = 0; - int filemode = 0644; - struct stat check_stat; - - type = info->mode == DBA_READER ? DB_UNKNOWN : - info->mode == DBA_TRUNC ? DB_BTREE : - stat(info->path, &check_stat) ? DB_BTREE : DB_UNKNOWN; - - gmode = info->mode == DBA_READER ? DB_RDONLY : - info->mode == DBA_CREAT ? DB_CREATE : - info->mode == DBA_WRITER ? 0 : - info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1; - - if(gmode == -1) - return FAILURE; - - if(info->argc > 0) { - convert_to_long_ex(info->argv[0]); - filemode = (*info->argv[0])->value.lval; - } - - if(!db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) { - info->dbf = malloc(sizeof(dba_db2_data)); - memset(info->dbf, 0, sizeof(dba_db2_data)); - ((dba_db2_data *) info->dbf)->dbp = dbp; - return SUCCESS; - } - return FAILURE; -} - -DBA_CLOSE_FUNC(db2) -{ - DB2_DATA; - - if(dba->cursor) dba->cursor->c_close(dba->cursor); - dba->dbp->close(dba->dbp, 0); - free(dba); -} - -DBA_FETCH_FUNC(db2) -{ - DBT gval; - char *new = NULL; - DB2_DATA; - DB2_GKEY; - - memset(&gval, 0, sizeof(gval)); - if(!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) { - if(newlen) *newlen = gval.size; - new = estrndup(gval.data, gval.size); - } - return new; -} - -DBA_UPDATE_FUNC(db2) -{ - DBT gval; - DB2_DATA; - DB2_GKEY; - - memset(&gval, 0, sizeof(gval)); - gval.data = (char *) val; - gval.size = vallen; - - if(!dba->dbp->put(dba->dbp, NULL, &gkey, &gval, - mode == 1 ? DB_NOOVERWRITE : 0)) { - return SUCCESS; - } - return FAILURE; -} - -DBA_EXISTS_FUNC(db2) -{ - DBT gval; - DB2_DATA; - DB2_GKEY; - - memset(&gval, 0, sizeof(gval)); - if(!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) { - return SUCCESS; - } - return FAILURE; -} - -DBA_DELETE_FUNC(db2) -{ - DB2_DATA; - DB2_GKEY; - - return dba->dbp->del(dba->dbp, NULL, &gkey, 0) ? FAILURE : SUCCESS; -} - -DBA_FIRSTKEY_FUNC(db2) -{ - DB2_DATA; - - if(dba->cursor) { - dba->cursor->c_close(dba->cursor); - } - - dba->cursor = NULL; -#if (DB_VERSION_MAJOR > 2) || (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR > 6) || (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 6 && DB_VERSION_PATCH >= 4) - if(dba->dbp->cursor(dba->dbp, NULL, &dba->cursor, 0)) { -#else - if(dba->dbp->cursor(dba->dbp, NULL, &dba->cursor)) { -#endif - return NULL; - } - - /* we should introduce something like PARAM_PASSTHRU... */ - return dba_nextkey_db2(info, newlen); -} - -DBA_NEXTKEY_FUNC(db2) -{ - DB2_DATA; - DBT gkey, gval; - char *nkey = NULL; - - memset(&gkey, 0, sizeof(gkey)); - memset(&gval, 0, sizeof(gval)); - - if(!dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT)) { - if(gkey.data) { - nkey = estrndup(gkey.data, gkey.size); - if(newlen) *newlen = gkey.size; - } - } - return nkey; -} - -DBA_OPTIMIZE_FUNC(db2) -{ - return SUCCESS; -} - -DBA_SYNC_FUNC(db2) -{ - DB2_DATA; - - return dba->dbp->sync(dba->dbp, 0) ? FAILURE : SUCCESS; -} - -#endif diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c deleted file mode 100644 index dece9634a4023..0000000000000 --- a/ext/dba/dba_db3.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_DB3 -#include "php3_db3.h" -#include - -#include -#if DB3_DB3_DB_H -#include -#elif DB3_DB_DB3_H -#include -#elif DB3_DB3_H -#include -#elif DB3_DB_H -#include -#endif - -#define DB3_DATA dba_db3_data *dba = info->dbf -#define DB3_GKEY \ - DBT gkey; \ - memset(&gkey, 0, sizeof(gkey)); \ - gkey.data = (char *) key; gkey.size = keylen - -typedef struct { - DB *dbp; - DBC *cursor; -} dba_db3_data; - -DBA_OPEN_FUNC(db3) -{ - DB *dbp = NULL; - DBTYPE type; - int gmode = 0; - int filemode = 0644; - struct stat check_stat; - - type = info->mode == DBA_READER ? DB_UNKNOWN : - info->mode == DBA_TRUNC ? DB_BTREE : - stat(info->path, &check_stat) ? DB_BTREE : DB_UNKNOWN; - - gmode = info->mode == DBA_READER ? DB_RDONLY : - info->mode == DBA_CREAT ? DB_CREATE : - info->mode == DBA_WRITER ? 0 : - info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1; - - if (gmode == -1) - return FAILURE; - - if (info->argc > 0) { - convert_to_long_ex(info->argv[0]); - filemode = (*info->argv[0])->value.lval; - } - - if (db_create(&dbp, NULL, 0) == 0 && - dbp->open(dbp, info->path, NULL, type, gmode, filemode) == 0) { - dba_db3_data *data; - - data = malloc(sizeof(*data)); - data->dbp = dbp; - data->cursor = NULL; - info->dbf = data; - - return SUCCESS; - } else if (dbp != NULL) { - dbp->close(dbp, 0); - } - - return FAILURE; -} - -DBA_CLOSE_FUNC(db3) -{ - DB3_DATA; - - if (dba->cursor) dba->cursor->c_close(dba->cursor); - dba->dbp->close(dba->dbp, 0); - free(dba); -} - -DBA_FETCH_FUNC(db3) -{ - DBT gval; - char *new = NULL; - DB3_DATA; - DB3_GKEY; - - memset(&gval, 0, sizeof(gval)); - if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) { - if (newlen) *newlen = gval.size; - new = estrndup(gval.data, gval.size); - } - return new; -} - -DBA_UPDATE_FUNC(db3) -{ - DBT gval; - DB3_DATA; - DB3_GKEY; - - memset(&gval, 0, sizeof(gval)); - gval.data = (char *) val; - gval.size = vallen; - - if (!dba->dbp->put(dba->dbp, NULL, &gkey, &gval, - mode == 1 ? DB_NOOVERWRITE : 0)) { - return SUCCESS; - } - return FAILURE; -} - -DBA_EXISTS_FUNC(db3) -{ - DBT gval; - DB3_DATA; - DB3_GKEY; - - memset(&gval, 0, sizeof(gval)); - if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) { - return SUCCESS; - } - return FAILURE; -} - -DBA_DELETE_FUNC(db3) -{ - DB3_DATA; - DB3_GKEY; - - return dba->dbp->del(dba->dbp, NULL, &gkey, 0) ? FAILURE : SUCCESS; -} - -DBA_FIRSTKEY_FUNC(db3) -{ - DB3_DATA; - - if (dba->cursor) { - dba->cursor->c_close(dba->cursor); - } - - dba->cursor = NULL; - if (dba->dbp->cursor(dba->dbp, NULL, &dba->cursor, 0) != 0) { - return NULL; - } - - /* we should introduce something like PARAM_PASSTHRU... */ - return dba_nextkey_db3(info, newlen); -} - -DBA_NEXTKEY_FUNC(db3) -{ - DB3_DATA; - DBT gkey, gval; - char *nkey = NULL; - - memset(&gkey, 0, sizeof(gkey)); - memset(&gval, 0, sizeof(gval)); - - if (dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT) == 0) { - if (gkey.data) { - nkey = estrndup(gkey.data, gkey.size); - if (newlen) *newlen = gkey.size; - } - } - - return nkey; -} - -DBA_OPTIMIZE_FUNC(db3) -{ - return SUCCESS; -} - -DBA_SYNC_FUNC(db3) -{ - DB3_DATA; - - return dba->dbp->sync(dba->dbp, 0) ? FAILURE : SUCCESS; -} - -#endif diff --git a/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c deleted file mode 100644 index b8b4ea95f2d37..0000000000000 --- a/ext/dba/dba_dbm.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_DBM -#include "php3_dbm.h" - -#include - -#include -#include -#include -#include - -#define DBM_DATA dba_dbm_data *dba = info->dbf -#define DBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen - -#ifndef PATH_MAX -#define PATH_MAX 255 -#endif - -#define TRUNC_IT(extension, mode) \ - snprintf(buf, PATH_MAX, "%s" extension, info->path); \ - buf[PATH_MAX] = '\0'; \ - if((fd = open(buf, O_CREAT | mode | O_WRONLY, filemode)) == -1) \ - return FAILURE; \ - close(fd); - - -typedef struct { - datum nextkey; -} dba_dbm_data; - -DBA_OPEN_FUNC(dbm) -{ - int fd; - int filemode = 0644; - - if(info->argc > 0) { - convert_to_long_ex(info->argv[0]); - filemode = (*info->argv[0])->value.lval; - } - - if(info->mode == DBA_TRUNC) { - char buf[PATH_MAX + 1]; - - /* dbm/ndbm original */ - TRUNC_IT(".pag", O_TRUNC); - TRUNC_IT(".dir", O_TRUNC); - } - - if(info->mode == DBA_CREAT) { - char buf[PATH_MAX + 1]; - - TRUNC_IT(".pag", 0); - TRUNC_IT(".dir", 0); - } - - if(dbminit((char *) info->path) == -1) { - return FAILURE; - } - - info->dbf = calloc(sizeof(dba_dbm_data), 1); - return SUCCESS; -} - -DBA_CLOSE_FUNC(dbm) -{ - free(info->dbf); - dbmclose(); -} - -DBA_FETCH_FUNC(dbm) -{ - datum gval; - char *new = NULL; - - DBM_GKEY; - gval = fetch(gkey); - if(gval.dptr) { - if(newlen) *newlen = gval.dsize; - new = estrndup(gval.dptr, gval.dsize); - } - return new; -} - -DBA_UPDATE_FUNC(dbm) -{ - datum gval; - - DBM_GKEY; - gval.dptr = (char *) val; - gval.dsize = vallen; - - return (store(gkey, gval) == -1 ? FAILURE : SUCCESS); -} - -DBA_EXISTS_FUNC(dbm) -{ - datum gval; - DBM_GKEY; - - gval = fetch(gkey); - if(gval.dptr) { - return SUCCESS; - } - return FAILURE; -} - -DBA_DELETE_FUNC(dbm) -{ - DBM_GKEY; - return(delete(gkey) == -1 ? FAILURE : SUCCESS); -} - -DBA_FIRSTKEY_FUNC(dbm) -{ - DBM_DATA; - datum gkey; - char *key = NULL; - - gkey = firstkey(); - if(gkey.dptr) { - if(newlen) *newlen = gkey.dsize; - key = estrndup(gkey.dptr, gkey.dsize); - dba->nextkey = gkey; - } else - dba->nextkey.dptr = NULL; - return key; -} - -DBA_NEXTKEY_FUNC(dbm) -{ - DBM_DATA; - datum gkey; - char *nkey = NULL; - - if(!dba->nextkey.dptr) return NULL; - - gkey = nextkey(dba->nextkey); - if(gkey.dptr) { - if(newlen) *newlen = gkey.dsize; - nkey = estrndup(gkey.dptr, gkey.dsize); - dba->nextkey = gkey; - } else - dba->nextkey.dptr = NULL; - return nkey; -} - -DBA_OPTIMIZE_FUNC(dbm) -{ - /* dummy */ - return SUCCESS; -} - -DBA_SYNC_FUNC(dbm) -{ - return SUCCESS; -} - -#endif diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c deleted file mode 100644 index 6fde65ec73405..0000000000000 --- a/ext/dba/dba_gdbm.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_GDBM -#include "php3_gdbm.h" - -#include - -#define GDBM_DATA dba_gdbm_data *dba = info->dbf -#define GDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen - -typedef struct { - GDBM_FILE dbf; - datum nextkey; -} dba_gdbm_data; - -DBA_OPEN_FUNC(gdbm) -{ - GDBM_FILE dbf; - int gmode = 0; - int filemode = 0644; - - gmode = info->mode == DBA_READER ? GDBM_READER : - info->mode == DBA_WRITER ? GDBM_WRITER : - info->mode == DBA_CREAT ? GDBM_WRCREAT : - info->mode == DBA_TRUNC ? GDBM_NEWDB : -1; - - if(gmode == -1) - return FAILURE; - - if(info->argc > 0) { - convert_to_long_ex(info->argv[0]); - filemode = (*info->argv[0])->value.lval; - } - - dbf = gdbm_open(info->path, 0, gmode, filemode, NULL); - - if(dbf) { - info->dbf = malloc(sizeof(dba_gdbm_data)); - memset(info->dbf, 0, sizeof(dba_gdbm_data)); - ((dba_gdbm_data *) info->dbf)->dbf = dbf; - return SUCCESS; - } - return FAILURE; -} - -DBA_CLOSE_FUNC(gdbm) -{ - GDBM_DATA; - - if(dba->nextkey.dptr) free(dba->nextkey.dptr); - gdbm_close(dba->dbf); - free(dba); -} - -DBA_FETCH_FUNC(gdbm) -{ - GDBM_DATA; - datum gval; - char *new = NULL; - - GDBM_GKEY; - gval = gdbm_fetch(dba->dbf, gkey); - if(gval.dptr) { - if(newlen) *newlen = gval.dsize; - new = estrndup(gval.dptr, gval.dsize); - free(gval.dptr); - } - return new; -} - -DBA_UPDATE_FUNC(gdbm) -{ - datum gval; - GDBM_DATA; - - GDBM_GKEY; - gval.dptr = (char *) val; - gval.dsize = vallen; - - if(gdbm_store(dba->dbf, gkey, gval, - mode == 1 ? GDBM_INSERT : GDBM_REPLACE) == 0) - return SUCCESS; - printf("XXX %s\n", gdbm_strerror(gdbm_errno)); - return FAILURE; -} - -DBA_EXISTS_FUNC(gdbm) -{ - GDBM_DATA; - GDBM_GKEY; - - return gdbm_exists(dba->dbf, gkey) ? SUCCESS : FAILURE; -} - -DBA_DELETE_FUNC(gdbm) -{ - GDBM_DATA; - GDBM_GKEY; - - return gdbm_delete(dba->dbf, gkey) == -1 ? FAILURE : SUCCESS; -} - -DBA_FIRSTKEY_FUNC(gdbm) -{ - GDBM_DATA; - datum gkey; - char *key = NULL; - - if(dba->nextkey.dptr) { - free(dba->nextkey.dptr); - } - - gkey = gdbm_firstkey(dba->dbf); - if(gkey.dptr) { - key = estrndup(gkey.dptr, gkey.dsize); - if(newlen) *newlen = gkey.dsize; - dba->nextkey = gkey; - } else { - dba->nextkey.dptr = NULL; - } - return key; -} - -DBA_NEXTKEY_FUNC(gdbm) -{ - GDBM_DATA; - char *nkey = NULL; - datum gkey; - - if(!dba->nextkey.dptr) return NULL; - - gkey = gdbm_nextkey(dba->dbf, dba->nextkey); - free(dba->nextkey.dptr); - if(gkey.dptr) { - nkey = estrndup(gkey.dptr, gkey.dsize); - if(newlen) *newlen = gkey.dsize; - dba->nextkey = gkey; - } else { - dba->nextkey.dptr = NULL; - } - return nkey; -} - -DBA_OPTIMIZE_FUNC(gdbm) -{ - GDBM_DATA; - gdbm_reorganize(dba->dbf); - return SUCCESS; -} - -DBA_SYNC_FUNC(gdbm) -{ - GDBM_DATA; - - gdbm_sync(dba->dbf); - return SUCCESS; -} -#endif diff --git a/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c deleted file mode 100644 index 3c10868aaba21..0000000000000 --- a/ext/dba/dba_ndbm.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_NDBM -#include "php3_ndbm.h" - -#include - -#if NDBM_DB1_NDBM_H -#include -#elif NDBM_NDBM_H -#include -#endif - -#define NDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen - -DBA_OPEN_FUNC(ndbm) -{ - DBM *dbf; - int gmode = 0; - int filemode = 0644; - dba_info *pinfo = (dba_info *) info; - - switch(info->mode) { - case DBA_READER: - gmode = O_RDONLY; - break; - case DBA_WRITER: - gmode = O_RDWR; - break; - case DBA_CREAT: - gmode = O_RDWR | O_CREAT; - break; - case DBA_TRUNC: - gmode = O_RDWR | O_CREAT | O_TRUNC; - break; - default: - return FAILURE; - } - - if(info->argc > 0) { - convert_to_long_ex(info->argv[0]); - filemode = (*info->argv[0])->value.lval; - } - - dbf = dbm_open(info->path, gmode, filemode); - - if(dbf) { - pinfo->dbf = dbf; - return SUCCESS; - } - return FAILURE; -} - -DBA_CLOSE_FUNC(ndbm) -{ - dbm_close(info->dbf); -} - -DBA_FETCH_FUNC(ndbm) -{ - datum gval; - char *new = NULL; - - NDBM_GKEY; - gval = dbm_fetch(info->dbf, gkey); - if(gval.dptr) { - if(newlen) *newlen = gval.dsize; - new = estrndup(gval.dptr, gval.dsize); - } - return new; -} - -DBA_UPDATE_FUNC(ndbm) -{ - datum gval; - - NDBM_GKEY; - gval.dptr = (char *) val; - gval.dsize = vallen; - - if(!dbm_store(info->dbf, gkey, gval, mode == 1 ? DBM_INSERT : DBM_REPLACE)) - return SUCCESS; - return FAILURE; -} - -DBA_EXISTS_FUNC(ndbm) -{ - datum gval; - NDBM_GKEY; - gval = dbm_fetch(info->dbf, gkey); - if(gval.dptr) { - return SUCCESS; - } - return FAILURE; -} - -DBA_DELETE_FUNC(ndbm) -{ - NDBM_GKEY; - return(dbm_delete(info->dbf, gkey) == -1 ? FAILURE : SUCCESS); -} - -DBA_FIRSTKEY_FUNC(ndbm) -{ - datum gkey; - char *key = NULL; - - gkey = dbm_firstkey(info->dbf); - if(gkey.dptr) { - if(newlen) *newlen = gkey.dsize; - key = estrndup(gkey.dptr, gkey.dsize); - } - return key; -} - -DBA_NEXTKEY_FUNC(ndbm) -{ - datum gkey; - char *nkey = NULL; - - gkey = dbm_nextkey(info->dbf); - if(gkey.dptr) { - if(newlen) *newlen = gkey.dsize; - nkey = estrndup(gkey.dptr, gkey.dsize); - } - return nkey; -} - -DBA_OPTIMIZE_FUNC(ndbm) -{ - return SUCCESS; -} - -DBA_SYNC_FUNC(ndbm) -{ - return SUCCESS; -} -#endif diff --git a/ext/dba/php3_cdb.h b/ext/dba/php3_cdb.h deleted file mode 100644 index 162fa8bdb2616..0000000000000 --- a/ext/dba/php3_cdb.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _PHP3_CDB_H -#define _PHP3_CDB_H - -#if DBA_CDB - -#include "php3_dba.h" - -DBA_FUNCS(cdb); - -#endif - -#endif diff --git a/ext/dba/php3_db2.h b/ext/dba/php3_db2.h deleted file mode 100644 index 0f8c458db93a3..0000000000000 --- a/ext/dba/php3_db2.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _PHP3_DB2_H -#define _PHP3_DB2_H - -#if DBA_DB2 - -#include "php3_dba.h" - -DBA_FUNCS(db2); - -#endif - -#endif diff --git a/ext/dba/php3_db3.h b/ext/dba/php3_db3.h deleted file mode 100644 index 4c00dfd448e7b..0000000000000 --- a/ext/dba/php3_db3.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _PHP3_DB3_H -#define _PHP3_DB3_H - -#if DBA_DB3 - -#include "php3_dba.h" - -DBA_FUNCS(db3); - -#endif - -#endif diff --git a/ext/dba/php3_dba.h b/ext/dba/php3_dba.h deleted file mode 100644 index 4a1470c5034d3..0000000000000 --- a/ext/dba/php3_dba.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef _DBA_H -#define _DBA_H - -#if HAVE_DBA - -typedef enum { - DBA_READER = 1, - DBA_WRITER, - DBA_TRUNC, - DBA_CREAT -} dba_mode_t; - -typedef struct dba_info { - /* public */ - void *dbf; /* ptr to private data or whatever */ - char *path; - dba_mode_t mode; - /* arg[cv] are only available when the dba_open handler is called! */ - int argc; - pval ***argv; - /* private */ - struct dba_handler *hnd; -} dba_info; - -extern php3_module_entry dba_module_entry; -#define dba_module_ptr &dba_module_entry - -/* common prototypes which must be supplied by modules */ - -#define DBA_OPEN_FUNC(x) \ - int dba_open_##x(dba_info *info) -#define DBA_CLOSE_FUNC(x) \ - void dba_close_##x(dba_info *info) -#define DBA_FETCH_FUNC(x) \ - char *dba_fetch_##x(dba_info *info, char *key, int keylen, int *newlen) -#define DBA_UPDATE_FUNC(x) \ - int dba_update_##x(dba_info *info, char *key, int keylen, char *val, int vallen, int mode) -#define DBA_EXISTS_FUNC(x) \ - int dba_exists_##x(dba_info *info, char *key, int keylen) -#define DBA_DELETE_FUNC(x) \ - int dba_delete_##x(dba_info *info, char *key, int keylen) -#define DBA_FIRSTKEY_FUNC(x) \ - char *dba_firstkey_##x(dba_info *info, int *newlen) -#define DBA_NEXTKEY_FUNC(x) \ - char *dba_nextkey_##x(dba_info *info, int *newlen) -#define DBA_OPTIMIZE_FUNC(x) \ - int dba_optimize_##x(dba_info *info) -#define DBA_SYNC_FUNC(x) \ - int dba_sync_##x(dba_info *info) - -#define DBA_FUNCS(x) \ - DBA_OPEN_FUNC(x); \ - DBA_CLOSE_FUNC(x); \ - DBA_FETCH_FUNC(x); \ - DBA_UPDATE_FUNC(x); \ - DBA_DELETE_FUNC(x); \ - DBA_EXISTS_FUNC(x); \ - DBA_FIRSTKEY_FUNC(x); \ - DBA_NEXTKEY_FUNC(x); \ - DBA_OPTIMIZE_FUNC(x); \ - DBA_SYNC_FUNC(x) - -#define VALLEN(p) (*p)->value.str.val, (*p)->value.str.len - -PHP_FUNCTION(dba_open); -PHP_FUNCTION(dba_popen); -PHP_FUNCTION(dba_close); -PHP_FUNCTION(dba_firstkey); -PHP_FUNCTION(dba_nextkey); -PHP_FUNCTION(dba_replace); -PHP_FUNCTION(dba_insert); -PHP_FUNCTION(dba_delete); -PHP_FUNCTION(dba_exists); -PHP_FUNCTION(dba_fetch); -PHP_FUNCTION(dba_optimize); -PHP_FUNCTION(dba_sync); - -#else -#define dba_module_ptr NULL -#endif - -#define phpext_dba_ptr dba_module_ptr - -#endif diff --git a/ext/dba/php3_dbm.h b/ext/dba/php3_dbm.h deleted file mode 100644 index 5007c84b3ebef..0000000000000 --- a/ext/dba/php3_dbm.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _PHP3_DBM_H -#define _PHP3_DBM_H - -#if DBA_DBM - -#include "php3_dba.h" - -DBA_FUNCS(dbm); - -#endif - -#endif diff --git a/ext/dba/php3_gdbm.h b/ext/dba/php3_gdbm.h deleted file mode 100644 index 9a18b531d4e60..0000000000000 --- a/ext/dba/php3_gdbm.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _PHP3_GDBM_H -#define _PHP3_GDBM_H - -#if DBA_GDBM - -#include "php3_dba.h" - -DBA_FUNCS(gdbm); - -#endif - -#endif diff --git a/ext/dba/php3_ndbm.h b/ext/dba/php3_ndbm.h deleted file mode 100644 index 398b8e39a189b..0000000000000 --- a/ext/dba/php3_ndbm.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _PHP3_NDBM_H -#define _PHP3_NDBM_H - -#if DBA_NDBM - -#include "php3_dba.h" - -DBA_FUNCS(ndbm); - -#endif - -#endif diff --git a/ext/dba/setup.stub b/ext/dba/setup.stub deleted file mode 100644 index 0df17de7d1615..0000000000000 --- a/ext/dba/setup.stub +++ /dev/null @@ -1,6 +0,0 @@ -# $Source$ -# $Id$ - -define_option with-dba 'dba support?' yesnodir no \ -' Whether to build the dba extension.' - diff --git a/ext/dbase/Makefile.am b/ext/dbase/Makefile.am deleted file mode 100644 index 0805cabe74862..0000000000000 --- a/ext/dbase/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -## Process this file with automake to produce Makefile.in -*- makefile -*- -noinst_LTLIBRARIES=libphpext_dbase.la -libphpext_dbase_la_SOURCES=dbf_head.c dbf_rec.c dbf_misc.c dbf_ndx.c dbase.c - diff --git a/ext/dbase/config.h.stub b/ext/dbase/config.h.stub deleted file mode 100644 index c8bf0adbe22d0..0000000000000 --- a/ext/dbase/config.h.stub +++ /dev/null @@ -1,3 +0,0 @@ -/* Define if you want to use the supplied dbase library */ -#define DBASE 0 - diff --git a/ext/dbase/config.m4 b/ext/dbase/config.m4 deleted file mode 100644 index 29f54923bf0d6..0000000000000 --- a/ext/dbase/config.m4 +++ /dev/null @@ -1,21 +0,0 @@ -dnl $Id$ - -AC_MSG_CHECKING(whether to include the bundled dbase library) -AC_ARG_WITH(dbase, -[ --with-dbase Include the bundled dbase library], -[ - if test "$withval" = "yes"; then - AC_MSG_RESULT(yes) - AC_DEFINE(DBASE,1) - PHP_EXTENSION(dbase) - else - AC_MSG_RESULT(no) - AC_DEFINE(DBASE,0) - DBASE_LIB= - fi -],[ - AC_MSG_RESULT(no) - AC_DEFINE(DBASE,0) - DBASE_LIB= -]) -AC_SUBST(DBASE_LIB) diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c deleted file mode 100644 index 196b25c191688..0000000000000 --- a/ext/dbase/dbase.c +++ /dev/null @@ -1,752 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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: Jim Winstead (jimw@php.net) | - +----------------------------------------------------------------------+ - */ -#if defined(COMPILE_DL) -#include "dl/phpdl.h" -#endif - -#include - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#include "php.h" -#include "safe_mode.h" -#include "fopen-wrappers.h" -#include "php_globals.h" - -#if DBASE -#include "php_dbase.h" -#include "dbf.h" -#if defined(THREAD_SAFE) -DWORD DbaseTls; -static int numthreads=0; -void *dbase_mutex; - -typedef struct dbase_global_struct{ - int le_dbhead; -}dbase_global_struct; - -#define DBase_GLOBAL(a) dbase_globals->a - -#define DBase_TLS_VARS \ - dbase_global_struct *dbase_globals; \ - dbase_globals=TlsGetValue(DbaseTls); - -#else -static int le_dbhead; -#define DBase_GLOBAL(a) a -#define DBase_TLS_VARS -#endif - -#include -#include - - -static void _close_dbase(dbhead_t *dbhead) -{ - close(dbhead->db_fd); - free_dbf_head(dbhead); -} - - -PHP_MINIT_FUNCTION(dbase) -{ -#if defined(THREAD_SAFE) - dbase_global_struct *dbase_globals; -#if !defined(COMPILE_DL) - CREATE_MUTEX(dbase_mutex,"DBase_TLS"); - SET_MUTEX(dbase_mutex); - numthreads++; - if (numthreads==1){ - if ((DbaseTls=TlsAlloc())==0xFFFFFFFF){ - FREE_MUTEX(dbase_mutex); - return 0; - }} - FREE_MUTEX(dbase_mutex); -#endif - dbase_globals = (dbase_global_struct *) LocalAlloc(LPTR, sizeof(dbase_global_struct)); - TlsSetValue(DbaseTls, (void *) dbase_globals); -#endif - DBase_GLOBAL(le_dbhead) = register_list_destructors(_close_dbase,NULL); - return SUCCESS; -} - -static PHP_MSHUTDOWN_FUNCTION(dbase) -{ -#if defined(THREAD_SAFE) - dbase_global_struct *dbase_globals; - dbase_globals = TlsGetValue(DbaseTls); - if (dbase_globals != 0) - LocalFree((HLOCAL) dbase_globals); -#if !defined(COMPILE_DL) - SET_MUTEX(dbase_mutex); - numthreads--; - if (!numthreads){ - if (!TlsFree(DbaseTls)){ - FREE_MUTEX(dbase_mutex); - return 0; - }} - FREE_MUTEX(dbase_mutex); -#endif -#endif - return SUCCESS; -} - -/* {{{ proto int dbase_open(string name, int mode) - Opens a dBase-format database file */ -PHP_FUNCTION(dbase_open) { - pval *dbf_name, *options; - dbhead_t *dbh; - int handle; - DBase_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbf_name,&options)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(dbf_name); - convert_to_long(options); - - if (PG(safe_mode) && (!_php3_checkuid(dbf_name->value.str.val, 2))) { - RETURN_FALSE; - } - - if (_php3_check_open_basedir(dbf_name->value.str.val)) { - RETURN_FALSE; - } - - dbh = dbf_open(dbf_name->value.str.val, options->value.lval); - if (dbh == NULL) { - php_error(E_WARNING, "unable to open database %s", dbf_name->value.str.val); - RETURN_FALSE; - } - - handle = php3_list_insert(dbh, DBase_GLOBAL(le_dbhead)); - RETURN_LONG(handle); -} -/* }}} */ - -/* {{{ proto bool dbase_close(int identifier) - Closes an open dBase-format database file */ -PHP_FUNCTION(dbase_close) { - pval *dbh_id; - dbhead_t *dbh; - int dbh_type; - DBase_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - dbh = php3_list_find(dbh_id->value.lval, &dbh_type); - if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) { - php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval); - RETURN_FALSE; - } - - php3_list_delete(dbh_id->value.lval); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int dbase_numrecords(int identifier) - Returns the number of records in the database */ -PHP_FUNCTION(dbase_numrecords) { - pval *dbh_id; - dbhead_t *dbh; - int dbh_type; - DBase_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - dbh = php3_list_find(dbh_id->value.lval, &dbh_type); - if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) { - php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval); - RETURN_FALSE; - } - - RETURN_LONG(dbh->db_records); -} -/* }}} */ - -/* {{{ proto int dbase_numfields(int identifier) - Returns the number of fields (columns) in the database */ -PHP_FUNCTION(dbase_numfields) { - pval *dbh_id; - dbhead_t *dbh; - int dbh_type; - DBase_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - dbh = php3_list_find(dbh_id->value.lval, &dbh_type); - if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) { - php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval); - RETURN_FALSE; - } - - RETURN_LONG(dbh->db_nfields); -} -/* }}} */ - -/* {{{ proto bool dbase_pack(int identifier) - Packs the database (deletes records marked for deletion) */ -PHP_FUNCTION(dbase_pack) { - pval *dbh_id; - dbhead_t *dbh; - int dbh_type; - DBase_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - dbh = php3_list_find(dbh_id->value.lval, &dbh_type); - if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) { - php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval); - RETURN_FALSE; - } - - pack_dbf(dbh); - put_dbf_info(dbh); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool dbase_add_record(int identifier, array data) - Adds a record to the database */ -PHP_FUNCTION(dbase_add_record) { - pval *dbh_id, *fields, *field; - dbhead_t *dbh; - int dbh_type; - - int num_fields; - dbfield_t *dbf, *cur_f; - char *cp, *t_cp; - int i; - DBase_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&fields)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - if (fields->type != IS_ARRAY) { - php_error(E_WARNING, "Expected array as second parameter"); - RETURN_FALSE; - } - - dbh = php3_list_find(dbh_id->value.lval, &dbh_type); - if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) { - php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval); - RETURN_FALSE; - } - - num_fields = zend_hash_num_elements(fields->value.ht); - - if (num_fields != dbh->db_nfields) { - php_error(E_WARNING, "Wrong number of fields specified"); - RETURN_FALSE; - } - - cp = t_cp = (char *)emalloc(dbh->db_rlen + 1); - if (!cp) { - php_error(E_WARNING, "unable to allocate memory"); - RETURN_FALSE; - } - *t_cp++ = VALID_RECORD; - - dbf = dbh->db_fields; - for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) { - if (zend_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) { - php_error(E_WARNING, "unexpected error"); - efree(cp); - RETURN_FALSE; - } - convert_to_string(field); - sprintf(t_cp, cur_f->db_format, field->value.str.val); - t_cp += cur_f->db_flen; - } - - dbh->db_records++; - if (put_dbf_record(dbh, dbh->db_records, cp) < 0) { - php_error(E_WARNING, "unable to put record at %ld", dbh->db_records); - efree(cp); - RETURN_FALSE; - } - - put_dbf_info(dbh); - efree(cp); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool dbase_replace_record(int identifier, array data, int recnum) - Replaces a record to the database */ -void php3_dbase_replace_record(INTERNAL_FUNCTION_PARAMETERS) { - pval *dbh_id, *fields, *field, *recnum; - dbhead_t *dbh; - int dbh_type; - - int num_fields; - dbfield_t *dbf, *cur_f; - char *cp, *t_cp; - int i; - DBase_TLS_VARS; - - if (ARG_COUNT(ht) != 3 || getParameters(ht,3,&dbh_id,&fields,&recnum)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - convert_to_long(recnum); - if (fields->type != IS_ARRAY) { - php_error(E_WARNING, "Expected array as second parameter"); - RETURN_FALSE; - } - - dbh = php3_list_find(dbh_id->value.lval, &dbh_type); - if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) { - php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval); - RETURN_FALSE; - } - - num_fields = zend_hash_num_elements(fields->value.ht); - - if (num_fields != dbh->db_nfields) { - php_error(E_WARNING, "Wrong number of fields specified"); - RETURN_FALSE; - } - - cp = t_cp = (char *)emalloc(dbh->db_rlen + 1); - if (!cp) { - php_error(E_WARNING, "unable to allocate memory"); - RETURN_FALSE; - } - *t_cp++ = VALID_RECORD; - - dbf = dbh->db_fields; - for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) { - if (zend_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) { - php_error(E_WARNING, "unexpected error"); - efree(cp); - RETURN_FALSE; - } - convert_to_string(field); - sprintf(t_cp, cur_f->db_format, field->value.str.val); - t_cp += cur_f->db_flen; - } - - if (put_dbf_record(dbh, recnum->value.lval, cp) < 0) { - php_error(E_WARNING, "unable to put record at %ld", dbh->db_records); - efree(cp); - RETURN_FALSE; - } - - put_dbf_info(dbh); - efree(cp); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool dbase_delete_record(int identifier, int record) - Marks a record to be deleted */ -PHP_FUNCTION(dbase_delete_record) { - pval *dbh_id, *record; - dbhead_t *dbh; - int dbh_type; - DBase_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - convert_to_long(record); - - dbh = php3_list_find(dbh_id->value.lval, &dbh_type); - if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) { - php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval); - RETURN_FALSE; - } - - if (del_dbf_record(dbh, record->value.lval) < 0) { - if (record->value.lval > dbh->db_records) { - php_error(E_WARNING, "record %d out of bounds", record->value.lval); - } else { - php_error(E_WARNING, "unable to delete record %d", record->value.lval); - } - RETURN_FALSE; - } - - put_dbf_info(dbh); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto array dbase_get_record(int identifier, int record) - Returns an array representing a record from the database */ -PHP_FUNCTION(dbase_get_record) { - pval *dbh_id, *record; - dbhead_t *dbh; - int dbh_type; - dbfield_t *dbf, *cur_f; - char *data, *fnp, *str_value; - size_t cursize = 0; - DBase_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - convert_to_long(record); - - dbh = php3_list_find(dbh_id->value.lval, &dbh_type); - if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) { - php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval); - RETURN_FALSE; - } - - if ((data = get_dbf_record(dbh, record->value.lval)) == NULL) { - php_error(E_WARNING, "Tried to read bad record %d", record->value.lval); - RETURN_FALSE; - } - - dbf = dbh->db_fields; - - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } - - fnp = NULL; - for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) { - /* get the value */ - str_value = (char *)emalloc(cur_f->db_flen + 1); - - if(cursize <= cur_f->db_flen) { - cursize = cur_f->db_flen + 1; - fnp = erealloc(fnp, cursize); - } - snprintf(str_value, cursize, cur_f->db_format, get_field_val(data, cur_f, fnp)); - - /* now convert it to the right php internal type */ - switch (cur_f->db_type) { - case 'C': - case 'D': - add_next_index_string(return_value,str_value,1); - break; - case 'N': /* FALLS THROUGH */ - case 'L': /* FALLS THROUGH */ - if (cur_f->db_fdc == 0) { - add_next_index_long(return_value, strtol(str_value, NULL, 10)); - } else { - add_next_index_double(return_value, atof(str_value)); - } - break; - case 'M': - /* this is a memo field. don't know how to deal with - this yet */ - break; - default: - /* should deal with this in some way */ - break; - } - efree(str_value); - } - efree(fnp); - - /* mark whether this record was deleted */ - if (data[0] == '*') { - add_assoc_long(return_value,"deleted",1); - } - else { - add_assoc_long(return_value,"deleted",0); - } - - free(data); -} -/* }}} */ - -/* From Martin Kuba */ -/* {{{ proto array dbase_get_record_with_names(int identifier, int record) - Returns an associative array representing a record from the database */ -PHP_FUNCTION(dbase_get_record_with_names) { - pval *dbh_id, *record; - dbhead_t *dbh; - int dbh_type; - dbfield_t *dbf, *cur_f; - char *data, *fnp, *str_value; - DBase_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - convert_to_long(record); - - dbh = php3_list_find(dbh_id->value.lval, &dbh_type); - if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) { - php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval); - RETURN_FALSE; - } - - if ((data = get_dbf_record(dbh, record->value.lval)) == NULL) { - php_error(E_WARNING, "Tried to read bad record %d", record->value.lval); - RETURN_FALSE; - } - - dbf = dbh->db_fields; - - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } - - fnp = (char *)emalloc(dbh->db_rlen); - for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) { - /* get the value */ - str_value = (char *)emalloc(cur_f->db_flen + 1); - sprintf(str_value, cur_f->db_format, get_field_val(data, cur_f, fnp)); - - /* now convert it to the right php internal type */ - switch (cur_f->db_type) { - case 'C': - case 'D': - add_assoc_string(return_value,cur_f->db_fname,str_value,1); - break; - case 'N': /* FALLS THROUGH */ - case 'L': /* FALLS THROUGH */ - if (cur_f->db_fdc == 0) { - add_assoc_long(return_value,cur_f->db_fname,strtol(str_value, NULL, 10)); - } else { - add_assoc_double(return_value,cur_f->db_fname,atof(str_value)); - } - break; - case 'M': - /* this is a memo field. don't know how to deal with this yet */ - break; - default: - /* should deal with this in some way */ - break; - } - efree(str_value); - } - efree(fnp); - - /* mark whether this record was deleted */ - if (data[0] == '*') { - add_assoc_long(return_value,"deleted",1); - } else { - add_assoc_long(return_value,"deleted",0); - } - - free(data); -} -/* }}} */ - -/* {{{ proto bool dbase_create(string filename, array fields) - Creates a new dBase-format database file */ -PHP_FUNCTION(dbase_create) { - pval *filename, *fields, *field, *value; - int fd; - dbhead_t *dbh; - - int num_fields; - dbfield_t *dbf, *cur_f; - int i, rlen, handle; - DBase_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&filename,&fields)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(filename); - - if (fields->type != IS_ARRAY) { - php_error(E_WARNING, "Expected array as second parameter"); - RETURN_FALSE; - } - - if (PG(safe_mode) && (!_php3_checkuid(filename->value.str.val, 2))) { - RETURN_FALSE; - } - - if (_php3_check_open_basedir(filename->value.str.val)) { - RETURN_FALSE; - } - - if ((fd = open(filename->value.str.val, O_BINARY|O_RDWR|O_CREAT, 0644)) < 0) { - php_error(E_WARNING, "Unable to create database (%d): %s", errno, strerror(errno)); - RETURN_FALSE; - } - - num_fields = zend_hash_num_elements(fields->value.ht); - - /* have to use regular malloc() because this gets free()d by - code in the dbase library */ - dbh = (dbhead_t *)malloc(sizeof(dbhead_t)); - dbf = (dbfield_t *)malloc(sizeof(dbfield_t) * num_fields); - if (!dbh || !dbf) { - php_error(E_WARNING, "Unable to allocate memory for header info"); - RETURN_FALSE; - } - - /* initialize the header structure */ - dbh->db_fields = dbf; - dbh->db_fd = fd; - dbh->db_dbt = DBH_TYPE_NORMAL; - strcpy(dbh->db_date, "19930818"); - dbh->db_records = 0; - dbh->db_nfields = num_fields; - dbh->db_hlen = sizeof(struct dbf_dhead) + 2 + num_fields * sizeof(struct dbf_dfield); - - rlen = 1; - - for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) { - /* look up the first field */ - if (zend_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) { - php_error(E_WARNING, "unable to find field %d", i); - free_dbf_head(dbh); - RETURN_FALSE; - } - - if (field->type != IS_ARRAY) { - php_error(E_WARNING, "second parameter must be array of arrays"); - free_dbf_head(dbh); - RETURN_FALSE; - } - - /* field name */ - if (zend_hash_index_find(field->value.ht, 0, (void **)&value) == FAILURE) { - php_error(E_WARNING, "expected field name as first element of list in field %d", i); - free_dbf_head(dbh); - RETURN_FALSE; - } - convert_to_string(value); - if (value->value.str.len > 10 || value->value.str.len == 0) { - php_error(E_WARNING, "invalid field name '%s' (must be non-empty and less than or equal to 10 characters)", value->value.str.val); - free_dbf_head(dbh); - RETURN_FALSE; - } - copy_crimp(cur_f->db_fname, value->value.str.val, value->value.str.len); - - /* field type */ - if (zend_hash_index_find(field->value.ht,1,(void **)&value) == FAILURE) { - php_error(E_WARNING, "expected field type as sececond element of list in field %d", i); - RETURN_FALSE; - } - convert_to_string(value); - cur_f->db_type = toupper(*value->value.str.val); - - cur_f->db_fdc = 0; - - /* verify the field length */ - switch (cur_f->db_type) { - case 'L': - cur_f->db_flen = 1; - break; - case 'M': - cur_f->db_flen = 9; - dbh->db_dbt = DBH_TYPE_MEMO; - /* should create the memo file here, probably */ - break; - case 'D': - cur_f->db_flen = 8; - break; - case 'N': - case 'C': - /* field length */ - if (zend_hash_index_find(field->value.ht,2,(void **)&value) == FAILURE) { - php_error(E_WARNING, "expected field length as third element of list in field %d", i); - free_dbf_head(dbh); - RETURN_FALSE; - } - convert_to_long(value); - cur_f->db_flen = value->value.lval; - - if (cur_f->db_type == 'N') { - if (zend_hash_index_find(field->value.ht,3,(void **)&value) == FAILURE) { - php_error(E_WARNING, "expected field precision as fourth element of list in field %d", i); - free_dbf_head(dbh); - RETURN_FALSE; - } - convert_to_long(value); - cur_f->db_fdc = value->value.lval; - } - break; - default: - php_error(E_WARNING, "unknown field type '%c'", cur_f->db_type); - } - cur_f->db_foffset = rlen; - rlen += cur_f->db_flen; - - cur_f->db_format = get_dbf_f_fmt(cur_f); - } - - dbh->db_rlen = rlen; - put_dbf_info(dbh); - - handle = php3_list_insert(dbh, DBase_GLOBAL(le_dbhead)); - RETURN_LONG(handle); -} -/* }}} */ - -function_entry dbase_functions[] = { - PHP_FE(dbase_open, NULL) - PHP_FE(dbase_create, NULL) - PHP_FE(dbase_close, NULL) - PHP_FE(dbase_numrecords, NULL) - PHP_FE(dbase_numfields, NULL) - PHP_FE(dbase_add_record, NULL) - PHP_FE(dbase_replace_record, NULL) - PHP_FE(dbase_get_record, NULL) - PHP_FE(dbase_get_record_with_names, NULL) - PHP_FE(dbase_delete_record, NULL) - PHP_FE(dbase_pack, NULL) - {NULL, NULL, NULL} -}; - -php3_module_entry dbase_module_entry = { - "DBase", dbase_functions, PHP_MINIT(dbase), PHP_MSHUTDOWN(dbase), NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES -}; - - -#if defined(COMPILE_DL) -DLEXPORT php3_module_entry *get_module(void) { return &dbase_module_entry; } - -#if (WIN32|WINNT) && defined(THREAD_SAFE) - -/*NOTE: You should have an odbc.def file where you -export DllMain*/ -BOOL WINAPI DllMain(HANDLE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved) -{ - return 1; -} -#endif -#endif - -#endif -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/dbase/dbf.h b/ext/dbase/dbf.h deleted file mode 100644 index 08bc70dd41870..0000000000000 --- a/ext/dbase/dbf.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Brad Eacker, - * (Music, Intuition, Software, and Computers) - * All Rights Reserved - */ - -/* - * dbf header structure on disk (pc dbase III) - * - * Basic info taken from: - * "File Formats for Popular PC Software" - * Jeff Walden - * (c) 1986 John Wiley & Sons, Inc. - */ - -#ifndef _DBF_H_ -#define _DBF_H_ - -#include -#include -#ifdef WIN32 -#include -#else -#include -#endif - -/* So we can use O_BINARY on non-Win32 systems. */ -#if !defined(O_BINARY) && !defined(WIN32) -#define O_BINARY (0) -#endif - -struct dbf_dhead { - char dbh_dbt; /* memo (dbt) file present */ - char dbh_date[3]; /* last update YY, MM, DD */ - char dbh_records[4]; /* number of records LE */ - char dbh_hlen[2]; /* header length LE */ - char dbh_rlen[2]; /* record length LE */ - char dbh_res[20]; /* padding */ -}; -#define DBH_DATE_YEAR 0 /* byte offset for year in dbh_date */ -#define DBH_DATE_MONTH 1 -#define DBH_DATE_DAY 2 - -/* - * field description on disk - */ - -#define DBF_NAMELEN 11 - -struct dbf_dfield { - char dbf_name[DBF_NAMELEN]; /* name of field */ - char dbf_type; /* type of field */ - char dbf_fda[4]; /* something for dbase III */ - char dbf_flen[2]; /* field length [and decimal if N] */ - char dbf_res[14]; /* padding */ -}; - -struct db_field { - char db_fname[DBF_NAMELEN+1]; /* 0 terminated */ - char db_type; /* type of field */ - int db_flen; /* length of field */ - int db_fdc; /* number of decimals in field */ - - char *db_format; /* format for printing %s etc */ - int db_foffset; /* offset within record */ -}; -typedef struct db_field dbfield_t; - -struct db_head { - int db_fd; - unsigned char db_dbt; /* dbt present */ - char db_date[9]; /* date of last update in db format */ - long db_records; /* number of records */ - int db_hlen; /* header length */ - int db_rlen; /* record length */ - - int db_nfields; /* number of fields */ - dbfield_t *db_fields; /* field info */ - char *db_name; /* name of dbf file */ - int db_cur_rec; /* current record */ -}; -typedef struct db_head dbhead_t; - -#define DBH_TYPE_NORMAL 0x03 -#define DBH_TYPE_MEMO 0x83 - -#define VALID_RECORD ' ' -#define DELETED_RECORD '*' - -#include "dbf_head.h" -#include "dbf_misc.h" -#include "dbf_rec.h" - -#endif /* _DBF_H_ */ diff --git a/ext/dbase/dbf_head.c b/ext/dbase/dbf_head.c deleted file mode 100644 index 1f104e3d81aaa..0000000000000 --- a/ext/dbase/dbf_head.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Brad Eacker, - * (Music, Intuition, Software, and Computers) - * All Rights Reserved - */ - -#include -#include - -#include "dbf.h" - -void free_dbf_head(dbhead_t *dbh); -int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf); - -/* - * get the header info from the file - * basic header info & field descriptions - */ -dbhead_t *get_dbf_head(int fd) -{ - dbhead_t *dbh; - struct dbf_dhead dbhead; - dbfield_t *dbf, *cur_f; - int ret, nfields, offset; - - if ((dbh = (dbhead_t *)malloc(sizeof(dbhead_t))) == NULL) - return NULL; - if (lseek(fd, 0, 0) < 0) - return NULL; - if ((ret = read(fd, &dbhead, sizeof(dbhead))) < 0) - return NULL; - - /* build in core info */ - dbh->db_fd = fd; - dbh->db_dbt = dbhead.dbh_dbt; - dbh->db_records = get_long(dbhead.dbh_records); - dbh->db_hlen = get_short(dbhead.dbh_hlen); - dbh->db_rlen = get_short(dbhead.dbh_rlen); - - db_set_date(dbh->db_date, dbhead.dbh_date[DBH_DATE_YEAR] + 1900, - dbhead.dbh_date[DBH_DATE_MONTH], - dbhead.dbh_date[DBH_DATE_DAY]); - - dbh->db_nfields = nfields = (dbh->db_hlen - sizeof(struct dbf_dhead)) / - sizeof(struct dbf_dfield); - - /* get all the field info */ - dbf = (dbfield_t *)malloc(sizeof(dbfield_t) * nfields); - - offset = 1; - for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) { - if (get_dbf_field(dbh, cur_f) < 0) { - free_dbf_head(dbh); - return NULL; - } - cur_f->db_foffset = offset; - offset += cur_f->db_flen; - } - dbh->db_fields = dbf; - - return dbh; -} - -/* - * free up the header info built above - */ -void free_dbf_head(dbhead_t *dbh) -{ - dbfield_t *dbf, *cur_f; - int nfields; - - dbf = dbh->db_fields; - nfields = dbh->db_nfields; - for (cur_f = dbf; cur_f < &dbf[nfields]; cur_f++) { - if (cur_f->db_format) { - free(cur_f->db_format); - } - } - - free(dbf); - free(dbh); -} - -/* - * put out the header info - */ -int put_dbf_head(dbhead_t *dbh) -{ - int fd = dbh->db_fd; - struct dbf_dhead dbhead; - int ret; - - memset (&dbhead, 0, sizeof(dbhead)); - - /* build on disk info */ - dbhead.dbh_dbt = dbh->db_dbt; - put_long(dbhead.dbh_records, dbh->db_records); - put_short(dbhead.dbh_hlen, dbh->db_hlen); - put_short(dbhead.dbh_rlen, dbh->db_rlen); - - /* put the date spec'd into the on disk header */ - dbhead.dbh_date[DBH_DATE_YEAR] =(char)(db_date_year(dbh->db_date) - - 1900); - dbhead.dbh_date[DBH_DATE_MONTH]=(char)(db_date_month(dbh->db_date)); - dbhead.dbh_date[DBH_DATE_DAY] =(char)(db_date_day(dbh->db_date)); - - if (lseek(fd, 0, 0) < 0) - return -1; - if ((ret = write(fd, &dbhead, sizeof(dbhead))) < 0) - return -1; - return ret; -} - -/* - * get a field off the disk from the current file offset - */ -int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf) -{ - struct dbf_dfield dbfield; - int ret; - - if ((ret = read(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) { - return ret; - } - - /* build the field name */ - copy_crimp(dbf->db_fname, dbfield.dbf_name, DBF_NAMELEN); - - dbf->db_type = dbfield.dbf_type; - switch (dbf->db_type) { - case 'N': - dbf->db_flen = dbfield.dbf_flen[0]; - dbf->db_fdc = dbfield.dbf_flen[1]; - break; - default: - dbf->db_flen = get_short(dbfield.dbf_flen); - } - - if ((dbf->db_format = get_dbf_f_fmt(dbf)) == NULL) { - return 1; - } - - return 0; -} - -/* - * put a field out on the disk at the current file offset - */ -int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf) -{ - struct dbf_dfield dbfield; - char *scp, *dcp; - int ret; - - memset (&dbfield, 0, sizeof(dbfield)); - - /* build the on disk field info */ - scp = dbf->db_fname; dcp = dbfield.dbf_name; - - strncpy(dbfield.dbf_name, dbf->db_fname, DBF_NAMELEN); - - dbfield.dbf_type = dbf->db_type; - switch (dbf->db_type) { - case 'N': - dbfield.dbf_flen[0] = dbf->db_flen; - dbfield.dbf_flen[1] = dbf->db_fdc; - break; - default: - put_short(dbfield.dbf_flen, dbf->db_flen); - } - - /* now write it out to disk */ - if ((ret = write(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) { - return ret; - } - return 1; -} - -/* - * put out all the info at the top of the file... - */ -static char end_stuff[2] = {0x0d, 0}; - -void put_dbf_info(dbhead_t *dbh) -{ - dbfield_t *dbf; - char *cp; - int fcnt; - - if ((cp = db_cur_date(NULL))) { - strncpy(dbh->db_date, cp, 8); - free(cp); - } - put_dbf_head(dbh); - dbf = dbh->db_fields; - for (fcnt = dbh->db_nfields; fcnt > 0; fcnt--, dbf++) - put_dbf_field(dbh, dbf); - write(dbh->db_fd, end_stuff, 1); -} - -char *get_dbf_f_fmt(dbfield_t *dbf) -{ - char format[100]; - - /* build the field format for printf */ - switch (dbf->db_type) { - case 'C': - sprintf(format, "%%-%ds", dbf->db_flen); - break; - case 'N': - case 'L': - case 'D': - sprintf(format, "%%%ds", dbf->db_flen); - break; - case 'M': - strcpy(format, "%s"); - break; - } - return (char *)strdup(format); -} - -dbhead_t *dbf_open(char *dp, int o_flags) -{ - int fd; - char *cp; - dbhead_t *dbh; - - cp = dp; - if ((fd = open(cp, o_flags|O_BINARY)) < 0) { - cp = (char *)malloc(256); - strcpy(cp, dp); strcat(cp, ".dbf"); - if ((fd = open(cp, o_flags)) < 0) { - perror("open"); - return NULL; - } - } - - if ((dbh = get_dbf_head(fd)) == 0) { - fprintf(stderr, "Unable to get header\n"); - return NULL; - } - dbh->db_name = cp; - dbh->db_cur_rec = 0; - - return dbh; -} - -void dbf_head_info(dbhead_t *dbh) -{ - int nfields; - dbfield_t *dbf, *cur_f; - - nfields = dbh->db_nfields; - printf("# fields: %d, record len: %d, total records %ld\n", - nfields, dbh->db_rlen, dbh->db_records); - dbf = dbh->db_fields; - for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) { - printf("# %s, %c, %d, %d\n", cur_f->db_fname, - cur_f->db_type, cur_f->db_flen, cur_f->db_fdc); - } -} diff --git a/ext/dbase/dbf_head.h b/ext/dbase/dbf_head.h deleted file mode 100644 index 1643151dd116d..0000000000000 --- a/ext/dbase/dbf_head.h +++ /dev/null @@ -1,9 +0,0 @@ -extern dbhead_t *get_dbf_head(int fd); -void free_dbf_head(dbhead_t *dbh); -extern int put_dbf_head(dbhead_t *dbh); -extern int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf); -extern int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf); -void put_dbf_info(dbhead_t *dbh); -extern char *get_dbf_f_fmt(dbfield_t *dbf); -extern dbhead_t *dbf_open(char *dp, int o_flags); -void dbf_head_info(dbhead_t *dbh); diff --git a/ext/dbase/dbf_misc.c b/ext/dbase/dbf_misc.c deleted file mode 100644 index 84573e47a4457..0000000000000 --- a/ext/dbase/dbf_misc.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Brad Eacker, - * (Music, Intuition, Software, and Computers) - * All Rights Reserved - */ -#include -#include -#include - -#include "dbf_misc.h" - -/* - * routine to change little endian long to host long - */ -long get_long(char *cp) -{ - int ret; - unsigned char *source = (unsigned char *)cp; - - ret = *source++; - ret += ((*source++)<<8); - ret += ((*source++)<<16); - ret += ((*source++)<<24); - - return ret; -} - -void put_long(char *cp, long lval) -{ - *cp++ = lval & 0xff; - *cp++ = (lval >> 8) & 0xff; - *cp++ = (lval >> 16) & 0xff; - *cp++ = (lval >> 24) & 0xff; -} - -/* - * routine to change little endian short to host short - */ -int get_short(char *cp) -{ - int ret; - unsigned char *source = (unsigned char *)cp; - - ret = *source++; - ret += ((*source++)<<8); - - return ret; -} - -void put_short(char *cp, int sval) -{ - *cp++ = sval & 0xff; - *cp++ = (sval >> 8) & 0xff; -} - -double get_double(char *cp) -{ - double ret; - unsigned char *dp = (unsigned char *)&ret; - - dp[7] = *cp++; - dp[6] = *cp++; - dp[5] = *cp++; - dp[4] = *cp++; - dp[3] = *cp++; - dp[2] = *cp++; - dp[1] = *cp++; - dp[0] = *cp++; - - return ret; -} - -void put_double(char *cp, double fval) -{ - unsigned char *dp = (unsigned char *)&fval; - - cp[7] = *dp++; - cp[6] = *dp++; - cp[5] = *dp++; - cp[4] = *dp++; - cp[3] = *dp++; - cp[2] = *dp++; - cp[1] = *dp++; - cp[0] = *dp++; -} - -void copy_fill(char *dp, char *sp, int len) -{ - while (*sp && len > 0) { - *dp++ = *sp++; - len--; - } - while (len-- > 0) - *dp++ = ' '; -} - -void copy_crimp(char *dp, char *sp, int len) -{ - while (len-- > 0) { - *dp++ = *sp++; - } - *dp = 0; - for (dp-- ; *dp == ' '; dp--) { - *dp = 0; - } - -} - -void db_set_date(char *cp, int year, int month, int day) -{ - if (month > 12) - month = 0; - if (day > 31) - day = 0; - sprintf(cp, "%d", year); - cp[4] = month / 10 + '0'; - cp[5] = month % 10 + '0'; - cp[6] = day / 10 + '0'; - cp[7] = day % 10 + '0'; - cp[8] = 0; -} - -int db_date_year(char *cp) -{ - int year, i; - - for (year = 0, i = 0; i < 4; i++) - year = year * 10 + (cp[i] - '0'); - return year; -} - -int db_date_month(char *cp) -{ - int month, i; - - for (month = 0, i = 4; i < 6; i++) - month = month * 10 + (cp[i] - '0'); - return month; -} - -int db_date_day(char *cp) -{ - int day, i; - - for (day = 0, i = 6; i < 8; i++) - day = day * 10 + (cp[i] - '0'); - return day; -} - -#include - -char *db_cur_date(char *cp) -{ - struct tm *ctm; - time_t c_time; - - c_time = time((time_t *)NULL); - ctm = localtime(&c_time); - if (cp == NULL) - cp = (char *)malloc(9); - - if (ctm == NULL || cp == NULL) - return NULL; - - db_set_date(cp, ctm->tm_year + 1900, ctm->tm_mon + 1, ctm->tm_mday); - - return cp; -} diff --git a/ext/dbase/dbf_misc.h b/ext/dbase/dbf_misc.h deleted file mode 100644 index 37fe8b0ea98ae..0000000000000 --- a/ext/dbase/dbf_misc.h +++ /dev/null @@ -1,13 +0,0 @@ -void put_long(char *cp, long lval); -extern long get_long(char *cp); -extern int get_short(char *cp); -void put_short(char *cp, int sval); -void put_double(char *cp, double fval); -extern double get_double(char *cp); -void copy_fill(char *dp, char *sp, int len); -void copy_crimp(char *dp, char *sp, int len); -void db_set_date(char *cp, int year, int month, int day); -extern int db_date_year(char *cp); -extern int db_date_month(char *cp); -extern int db_date_day(char *cp); -extern char *db_cur_date(char *cp); diff --git a/ext/dbase/dbf_ndx.c b/ext/dbase/dbf_ndx.c deleted file mode 100644 index 9263b02b0c37f..0000000000000 --- a/ext/dbase/dbf_ndx.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Brad Eacker, - * (Music, Intuition, Software, and Computers) - * All Rights Reserved - */ - -#include -#include - -#include "dbf.h" -#include "dbf_ndx.h" - -/* - * get the ndx header for this file - */ -ndx_header_t *ndx_get_header(int fd) -{ - dndx_header_t *dp; - ndx_header_t *np; - - if ((dp = (dndx_header_t *)malloc(NDX_PAGE_SZ)) == NULL) - return NULL; - if ((np = (ndx_header_t *)malloc(sizeof(ndx_header_t))) == NULL) { - free(dp); - return NULL; - } - if ((lseek(fd, 0, 0) < 0) || (read(fd, dp, NDX_PAGE_SZ) < 0)) { - free(dp); free(np); - return NULL; - } - np->ndx_hpage = dp; - np->ndx_fd = fd; - np->ndx_start_pg = get_long(dp->dndx_st_pg); - np->ndx_total_pgs = get_long(dp->dndx_tot_pg); - np->ndx_key_len = get_short(dp->dndx_key_len); - np->ndx_keys_ppg = get_short(dp->dndx_keys_ppg); - np->ndx_key_type = get_short(dp->dndx_key_type); - np->ndx_key_size = get_long(dp->dndx_size_key); - np->ndx_key_name = dp->dndx_key_name; - np->ndx_unique = dp->dndx_unique; - - np->ndx_fp = NULL; - - return np; -} - -static ndx_page_t *ndx_get_page(ndx_header_t *hp, int pageno) -{ - ndx_page_t *fp; - dndx_page_t *dp; - ndx_record_t *rp; - -#if DEBUG - printf("getting page %d", pageno); -#endif - if ((fp = (ndx_page_t *)malloc(sizeof(ndx_page_t))) == NULL) - return NULL; - if ((dp = (dndx_page_t *)malloc(NDX_PAGE_SZ)) == NULL) { - free(fp); - return NULL; - } - if ((rp = (ndx_record_t *)malloc(sizeof(ndx_record_t) * hp->ndx_keys_ppg)) == NULL) { - free(dp); free(fp); - return NULL; - } - fp->ndxp_page_data = dp; - if ((lseek(hp->ndx_fd, pageno * NDX_PAGE_SZ, 0) < 0) || - (read(hp->ndx_fd, dp, NDX_PAGE_SZ) < 0)) { - free(fp); free(dp); - return NULL; - } - fp->ndxp_parent = NULL; - fp->ndxp_page_no = pageno; - fp->ndxp_num_keys = get_long(dp->dndxp_num_keys); - memset(rp, 0, sizeof(ndx_record_t) * hp->ndx_keys_ppg); - fp->ndxp_records = rp; - fp->ndxp_header_p = hp; -#if DEBUG - printf(", n_keys %ld\n", fp->ndxp_num_keys); -#endif - return fp; -} - -/* - * get the first entry for this ndx - */ -static ndx_page_t *ndx_get_first_pg(ndx_header_t *hp) -{ - ndx_page_t *fp; - - if (hp->ndx_fp) - return hp->ndx_fp; - if ((fp = ndx_get_page(hp, hp->ndx_start_pg))) { - hp->ndx_fp = fp; - } - return fp; -} - -static ndx_record_t *ndx_get_record(ndx_page_t *fp, int rec_no) -{ - ndx_record_t *rp; - ndx_header_t *hp = fp->ndxp_header_p; - struct dndx_record *drp; - -#if DEBUG - printf("page %ld, rec %d: ", fp->ndxp_page_no, rec_no); -#endif - if (rec_no >= fp->ndxp_num_keys) - return NULL; - rp = &(fp->ndxp_records[rec_no]); - if (!rp->ndxr_page) { - rp->ndxr_page = fp; - drp = (dndx_record_t *)((char *)&fp->ndxp_page_data->dndx_rp - + rec_no * hp->ndx_key_size); - rp->ndxr_left = get_long(drp->dndx_left_pg); - rp->ndxr_rec = get_long(drp->dndx_dbf_rec); - rp->ndxr_key_data = &drp->dndx_key_data; - rp->ndxr_p_nrec = rec_no; - } -#if DEBUG - printf("left %ld, dbf_rec %ld, data '%s'\n", rp->ndxr_left, - rp->ndxr_rec, rp->ndxr_key_data); -#endif - return rp; -} - -static ndx_record_t *ndx_scan_down(ndx_header_t *hp, ndx_page_t *fp, int recno) -{ - ndx_page_t *np; - ndx_record_t *rp; - - while ((rp = ndx_get_record(fp, recno)) && (rp->ndxr_rec == 0)) { - np = ndx_get_page(hp, rp->ndxr_left); - np->ndxp_parent = fp; - np->ndxp_par_rno = recno; - fp = np; - recno = 0; - } - return rp; -} - -static ndx_record_t *ndx_scan_up(ndx_header_t *hp, ndx_page_t *fp, int recno) -{ - ndx_record_t *rp; - - if (fp == NULL) - rp = NULL; - else if (recno < fp->ndxp_num_keys) { - rp = ndx_scan_down(hp, fp, recno); - } else { - rp = ndx_scan_up(hp, fp->ndxp_parent, fp->ndxp_par_rno + 1); - } - return rp; -} - -ndx_record_t *ndx_get_first_rec(ndx_header_t *hp) -{ - ndx_page_t *fp; - ndx_record_t *rp = NULL; - - if ((fp = ndx_get_first_pg(hp))) { - fp->ndxp_last_key = 0; - rp = ndx_scan_down(hp, fp, 0); - } - hp->ndx_cur_rec = rp; - return rp; -} - -ndx_record_t *ndx_get_next_rec(ndx_header_t *hp, ndx_record_t *rp) -{ - ndx_page_t *fp; - int rec_no; - - fp = rp->ndxr_page; - rec_no = rp->ndxr_p_nrec + 1; - if (rec_no < fp->ndxp_num_keys) { - rp = ndx_scan_down(hp, fp, rec_no); - } else { - rp = ndx_scan_up(hp, fp->ndxp_parent, fp->ndxp_par_rno + 1); - } - return rp; -} - diff --git a/ext/dbase/dbf_ndx.h b/ext/dbase/dbf_ndx.h deleted file mode 100644 index 3faff04025835..0000000000000 --- a/ext/dbase/dbf_ndx.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 1993 Brad Eacker, - * (Music, Intuition, Software, and Computers) - * All Rights Reserved - */ - -/* - * dbf .ndx header structure on disk and in memory - * - * Basic info taken from: - * "Clipper Programming Guide, 3rd Edition, Version 5.01" - * by Rick Spence - */ - -#ifndef _DBF_NDX_H_ -#define _DBF_NDX_H_ - -#include "dbf.h" - -#define NDX_PAGE_SZ 512 - -/* on disk ndx header */ -struct dndx_header { - char dndx_st_pg[4]; /* starting page number */ - char dndx_tot_pg[4]; /* total number of pages */ - char dndx_filler1[4]; /* space */ - char dndx_key_len[2]; /* key length */ - char dndx_keys_ppg[2]; /* number of keys per page */ - char dndx_key_type[2]; /* key type */ - char dndx_size_key[4]; /* size of the key record */ - char dndx_filler2; /* space */ - char dndx_unique; /* whether or not done with unique */ - char dndx_key_name[488]; /* string defining the key */ -}; -typedef struct dndx_header dndx_header_t; - -/* in memory ndx header */ -struct ndx_header { - long ndx_start_pg; - long ndx_total_pgs; - unsigned short ndx_key_len; - unsigned short ndx_keys_ppg; - unsigned short ndx_key_type; - char ndx_unique; - long ndx_key_size; - char *ndx_key_name; - int ndx_fd; - struct ndx_page *ndx_fp; - dndx_header_t *ndx_hpage; - struct ndx_record *ndx_cur_rec; -}; -typedef struct ndx_header ndx_header_t; - -/* these are the possible values in the key type field */ -#define NDX_CHAR_TYPE 00 -#define NDX_NUM_TYPE 01 - -/* on disk key record */ -struct dndx_record { - char dndx_left_pg[4]; /* number of left page */ - char dndx_dbf_rec[4]; /* dbf record number */ - char dndx_key_data; /* key data */ -}; -typedef struct dndx_record dndx_record_t; - -struct ndx_record { - long ndxr_left; - long ndxr_rec; - char *ndxr_key_data; - struct ndx_page *ndxr_page; /* page pointer to where we are from*/ - int ndxr_p_nrec; /* number of the record within page */ -}; -typedef struct ndx_record ndx_record_t; - -struct dndx_page { - char dndxp_num_keys[4]; /* number of keys on this page */ - struct dndx_record dndx_rp; -}; -typedef struct dndx_page dndx_page_t; - -struct ndx_page { - long ndxp_page_no; - long ndxp_num_keys; - dndx_page_t *ndxp_page_data; - ndx_header_t *ndxp_header_p; - long ndxp_last_key; - struct ndx_page *ndxp_parent; /* parent page */ - int ndxp_par_rno; /* record number within parent */ - struct ndx_record *ndxp_records; -}; -typedef struct ndx_page ndx_page_t; - -extern ndx_header_t *ndx_get_header(int); - -extern ndx_record_t *ndx_get_first_rec(ndx_header_t *); -extern ndx_record_t *ndx_get_next_rec(ndx_header_t *, ndx_record_t *); - -#endif /* _DBF_NDX_H_ */ diff --git a/ext/dbase/dbf_rec.c b/ext/dbase/dbf_rec.c deleted file mode 100644 index fa342005fb779..0000000000000 --- a/ext/dbase/dbf_rec.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 1993 Brad Eacker, - * (Music, Intuition, Software, and Computers) - * All Rights Reserved - */ - -#include -#include - -#include "dbf.h" - -int get_piece(dbhead_t *dbh, long offset, char *cp, int len); -int put_piece(dbhead_t *dbh, long offset, char *cp, int len); - -/* - * get a record off the database - */ -char *get_dbf_record(dbhead_t *dbh, long rec_num) -{ - long offset; - char *cp; - - if (rec_num > dbh->db_records) { - return NULL; - } - if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) { - return NULL; - } - - /* go to the correct spot on the file */ - offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen; - if (get_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) { - free(cp); - cp = NULL; - } - if (cp) - dbh->db_cur_rec = rec_num; - return cp; -} - -int -get_piece(dbhead_t *dbh, long offset, char *cp, int len) -{ - /* go to the correct spot on the file */ - if ( lseek(dbh->db_fd, offset, 0) < 0 ) { - return -1; - } - - /* read the record into the allocated space */ - return read(dbh->db_fd, cp, len); -} - -/* - * put a record to the database - */ -long put_dbf_record(dbhead_t *dbh, long rec_num, char *cp) -{ - long offset; - - if (rec_num == 0) { - rec_num = dbh->db_records; - } - if (rec_num > dbh->db_records) { - return 0L; - } - /* go to the correct spot on the file */ - offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen; - if (put_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) { - rec_num = -1; - } - return rec_num; -} - -int put_piece(dbhead_t *dbh, long offset, char *cp, int len) -{ - /* go to the correct spot on the file */ - if ( lseek(dbh->db_fd, offset, 0) < 0 ) { - return -1; - } - - /* write the record into the file */ - return write(dbh->db_fd, cp, len); -} - -int del_dbf_record(dbhead_t *dbh, long rec_num) -{ - int ret = 0; - char *cp; - - if (rec_num > dbh->db_records) - return -1; - if ((cp = get_dbf_record(dbh, rec_num))) { - *cp = DELETED_RECORD; - ret = put_dbf_record(dbh, rec_num, cp); - free(cp); - } - return ret; -} - -void pack_dbf(dbhead_t *dbh) -{ - long out_off, in_off; - int rec_cnt, new_cnt; - char *cp; - - if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) { - return; - } - in_off = out_off = dbh->db_hlen; - - new_cnt = 0; - rec_cnt = dbh->db_records; - while (rec_cnt > 0) { - if (get_piece(dbh, in_off, cp, dbh->db_rlen) < 0) - break; - - if (*cp != DELETED_RECORD) { - /* write the record into the file */ - if (put_piece(dbh, out_off, cp, dbh->db_rlen) < 0) - break; - out_off += dbh->db_rlen; - new_cnt++; - } - in_off += dbh->db_rlen; - rec_cnt--; - } - free(cp); - if (rec_cnt == 0) - dbh->db_records = new_cnt; -} - -/* routine to get a field from a record */ -char *get_field_val(char *rp, dbfield_t *fldp, char *cp) -{ - int flen = fldp->db_flen; - - if ( !cp ) - cp = (char *)malloc(flen + 1); - if ( cp ) { - strncpy(cp, &rp[fldp->db_foffset], flen); - cp[flen] = 0; - } - return cp; -} - -void put_field_val(char *rp, dbfield_t *fldp, char *cp) -{ - strncpy(&rp[fldp->db_foffset], cp, fldp->db_flen); -} - -/* - * output a record - */ -void out_rec(dbhead_t *dbh, dbfield_t *dbf, char *cp) -{ - dbfield_t *cur_f; - int nfields = dbh->db_nfields; - char *fnp = (char *)malloc(dbh->db_rlen); - - printf("%c", *cp); - for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) { - printf(" "); - printf(cur_f->db_format, get_field_val(cp, cur_f, fnp)); - } - printf("\n"); - free(fnp); -} - -/* check for record validity */ -int is_valid_rec(char *cp) -{ - if (cp && (*cp == VALID_RECORD)) - return 1; - else - return 0; -} - -/* get the next record */ -char *dbf_get_next(dbhead_t *dbh) -{ - return get_dbf_record(dbh, dbh->db_cur_rec + 1); -} diff --git a/ext/dbase/dbf_rec.h b/ext/dbase/dbf_rec.h deleted file mode 100644 index 6407c702f6672..0000000000000 --- a/ext/dbase/dbf_rec.h +++ /dev/null @@ -1,10 +0,0 @@ -extern char *get_dbf_record(dbhead_t *dbh, long rec_num); -extern long put_dbf_record(dbhead_t *dbh, long rec_num, char *cp); -extern int put_piece(dbhead_t *dbh, long offset, char *cp, int len); -extern int del_dbf_record(dbhead_t *dbh, long rec_num); -void pack_dbf(dbhead_t *dbh); -extern char *get_field_val(char *rp, dbfield_t *fldp, char *cp); -void put_field_val(char *rp, dbfield_t *fldp, char *cp); -void out_rec(dbhead_t *dbh, dbfield_t *dbf, char *cp); -extern int is_valid_rec(char *cp); -extern char *dbf_get_next(dbhead_t *dbh); diff --git a/ext/dbase/php_dbase.h b/ext/dbase/php_dbase.h deleted file mode 100644 index 1f083e7b3aedf..0000000000000 --- a/ext/dbase/php_dbase.h +++ /dev/null @@ -1,55 +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: Jim Winstead (jimw@php.net) | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef _DBASE_H -#define _DBASE_H -#if DBASE -extern php3_module_entry dbase_module_entry; -#define dbase_module_ptr &dbase_module_entry - -extern PHP_MINIT_FUNCTION(dbase); -PHP_FUNCTION(dbase_open); -PHP_FUNCTION(dbase_create); -PHP_FUNCTION(dbase_close); -PHP_FUNCTION(dbase_numrecords); -PHP_FUNCTION(dbase_numfields); -PHP_FUNCTION(dbase_add_record); -PHP_FUNCTION(dbase_get_record); -PHP_FUNCTION(dbase_delete_record); -PHP_FUNCTION(dbase_pack); -PHP_FUNCTION(dbase_get_record_with_names); -#else -#define dbase_module_ptr NULL -#endif - -#define phpext_dbase_ptr dbase_module_ptr - -#endif /* _DBASE_H */ diff --git a/ext/dbase/setup.stub b/ext/dbase/setup.stub deleted file mode 100644 index 427ecf069d47b..0000000000000 --- a/ext/dbase/setup.stub +++ /dev/null @@ -1,4 +0,0 @@ -# $Id$ -*- sh -*- - -define_option with-dbase 'dBase support? ' yesno no \ -' Whether to use the bundled dbase library.' diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c deleted file mode 100644 index bd40cb2191e34..0000000000000 --- a/ext/ereg/ereg.c +++ /dev/null @@ -1,653 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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: Rasmus Lerdorf | - | Jim Winstead | - | Jaakko Hyvätti | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#include -#include "php.h" -#include "php3_string.h" -#include "reg.h" - -unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; - -function_entry reg_functions[] = { - PHP_FE(ereg, third_argument_force_ref) - PHP_FE(ereg_replace, NULL) - PHP_FE(eregi, third_argument_force_ref) - PHP_FE(eregi_replace, NULL) - PHP_FE(split, NULL) - PHP_FALIAS(join, implode, NULL) - PHP_FE(sql_regcase, NULL) - {NULL, NULL, NULL} -}; - - -static PHP_MINIT_FUNCTION(regex); -static PHP_MSHUTDOWN_FUNCTION(regex); -static PHP_MINFO_FUNCTION(regex); - -zend_module_entry regexp_module_entry = { - "Regular Expressions", - reg_functions, - PHP_MINIT(regex), PHP_MSHUTDOWN(regex), - NULL, NULL, PHP_MINFO(regex), - STANDARD_MODULE_PROPERTIES -}; - -#ifdef ZTS -int reg_globals_id; -#else -static php_reg_globals reg_globals; -#endif - -typedef struct { - regex_t preg; - int cflags; -} reg_cache; - -static int _php_regcomp(regex_t *preg, const char *pattern, int cflags) -{ - int r = 0; - int patlen = strlen(pattern); - reg_cache *rc = NULL; - REGLS_FETCH(); - - if(zend_hash_find(®(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == FAILURE || - rc->cflags != cflags) { - r = regcomp(preg, pattern, cflags); - if(!r) { - reg_cache rcp; - - rcp.cflags = cflags; - memcpy(&rcp.preg, preg, sizeof(*preg)); - zend_hash_update(®(ht_rc), (char *) pattern, patlen+1, - (void *) &rcp, sizeof(rcp), NULL); - } - } else { - memcpy(preg, &rc->preg, sizeof(*preg)); - } - - return r; -} - -static int _free_reg_cache(reg_cache *rc) -{ - regfree(&rc->preg); - return 1; -} - -#undef regfree -#define regfree(a); -#undef regcomp -#define regcomp(a,b,c) _php_regcomp(a,b,c) - -static void php_reg_init_globals(php_reg_globals *reg_globals) -{ - zend_hash_init(®_globals->ht_rc, 0, NULL, (int (*)(void *)) _free_reg_cache, 1); -} - -static PHP_MINIT_FUNCTION(regex) -{ -#ifdef ZTS - reg_globals_id = ts_allocate_id(sizeof(php_reg_globals), php_reg_init_globals, NULL); -#else - php_reg_init_globals(®_globals); -#endif - - return SUCCESS; -} - -static PHP_MSHUTDOWN_FUNCTION(regex) -{ - REGLS_FETCH(); - - zend_hash_destroy(®(ht_rc)); - return SUCCESS; -} - -static PHP_MINFO_FUNCTION(regex) -{ -#if HSREGEX - PUTS("Bundled regex library enabled\n"); -#else - PUTS("System regex library enabled\n"); -#endif -} - - -/* This is the maximum number of (..) constructs we'll generate from a - call to ereg() or eregi() with the optional third argument. */ -#define NS 10 - -/* - * _php3_reg_eprint - convert error number to name - */ -static void _php3_reg_eprint(int err, regex_t *re) { - char *buf = NULL, *message = NULL; - size_t len; - size_t buf_len; - -#ifdef REG_ITOA - /* get the length of the message */ - buf_len = regerror(REG_ITOA | err, re, NULL, 0); - if (buf_len) { - buf = (char *)emalloc(buf_len * sizeof(char)); - if (!buf) return; /* fail silently */ - /* finally, get the error message */ - regerror(REG_ITOA | err, re, buf, buf_len); - } -#else - buf_len = 0; -#endif - len = regerror(err, re, NULL, 0); - if (len) { - message = (char *)emalloc((buf_len + len + 2) * sizeof(char)); - if (!message) { - return; /* fail silently */ - } - if (buf_len) { - snprintf(message, buf_len, "%s: ", buf); - buf_len += 1; /* so pointer math below works */ - } - /* drop the message into place */ - regerror(err, re, message + buf_len, len); - - php_error(E_WARNING, "%s", message); - } - - STR_FREE(buf); - STR_FREE(message); -} - -static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) -{ - pval *regex, /* Regular expression */ - *findin, /* String to apply expression to */ - *array = NULL; /* Optional register array */ - regex_t re; - regmatch_t subs[NS]; - int err, i, match_len, string_len; - int copts = 0; - off_t start, end; - char *buf = NULL; - char *string = NULL; - - if (icase) - copts |= REG_ICASE; - - switch(ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, ®ex, &findin) == FAILURE) { - WRONG_PARAM_COUNT; - } - /* don't bother doing substring matching if we're not going - to make use of the information */ - copts |= REG_NOSUB; - break; - case 3: - if (getParameters(ht, 3, ®ex, &findin, &array) == FAILURE) { - WRONG_PARAM_COUNT; - } - if (!ParameterPassedByReference(ht, 3)) { - php_error(E_WARNING, "Array to be filled with values must be passed by reference."); - RETURN_FALSE; - } - break; - default: - WRONG_PARAM_COUNT; - } - - - /* compile the regular expression from the supplied regex */ - if (regex->type == IS_STRING) { - err = regcomp(&re, regex->value.str.val, REG_EXTENDED | copts); - } else { - /* we convert numbers to integers and treat them as a string */ - if (regex->type == IS_DOUBLE) - convert_to_long(regex); /* get rid of decimal places */ - convert_to_string(regex); - /* don't bother doing an extended regex with just a number */ - err = regcomp(&re, regex->value.str.val, copts); - } - - if (err) { - _php3_reg_eprint(err, &re); - RETURN_FALSE; - } - - /* make a copy of the string we're looking in */ - convert_to_string(findin); - string = estrndup(findin->value.str.val, findin->value.str.len); - - /* actually execute the regular expression */ - err = regexec(&re, string, (size_t) NS, subs, 0); - if (err && err != REG_NOMATCH) { - _php3_reg_eprint(err, &re); - regfree(&re); - RETURN_FALSE; - } - match_len = 1; - - if (array && err != REG_NOMATCH) { - match_len = (int) (subs[0].rm_eo - subs[0].rm_so); - string_len = strlen(string) + 1; - - buf = emalloc(string_len); - if (!buf) { - php_error(E_WARNING, "Unable to allocate memory in _php3_ereg"); - RETURN_FALSE; - } - - pval_destructor(array); /* start with clean array */ - array_init(array); - - for (i = 0; i < NS; i++) { - start = subs[i].rm_so; - end = subs[i].rm_eo; - if (start != -1 && end > 0 && start < string_len && end < string_len && start < end) { - add_index_stringl(array, i, string+start, end-start, 1); - } else { - add_index_bool(array, i, 0); - } - } - efree(buf); - } - - efree(string); - if (err == REG_NOMATCH) { - RETVAL_FALSE; - } else { - if (match_len == 0) - match_len = 1; - RETVAL_LONG(match_len); - } - regfree(&re); -} - -/* {{{ proto int ereg(string pattern, string string [, array registers]) - Regular expression match */ -PHP_FUNCTION(ereg) -{ - _php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto int eregi(string pattern, string string [, array registers]) - Case-insensitive regular expression match */ -PHP_FUNCTION(eregi) -{ - _php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - -/* this is the meat and potatoes of regex replacement! */ -char *_php3_regreplace(const char *pattern, const char *replace, const char *string, int icase, int extended) -{ - regex_t re; - regmatch_t subs[NS]; - - char *buf, /* buf is where we build the replaced string */ - *nbuf, /* nbuf is used when we grow the buffer */ - *walkbuf; /* used to walk buf when replacing backrefs */ - const char *walk; /* used to walk replacement string for backrefs */ - int buf_len; - int pos, tmp, string_len, new_l; - int err, copts = 0; - - string_len = strlen(string); - - if (icase) - copts = REG_ICASE; - if (extended) - copts |= REG_EXTENDED; - err = regcomp(&re, pattern, copts); - if (err) { - _php3_reg_eprint(err, &re); - return ((char *) -1); - } - - /* start with a buffer that is twice the size of the stringo - we're doing replacements in */ - buf_len = 2 * string_len + 1; - buf = emalloc(buf_len * sizeof(char)); - if (!buf) { - php_error(E_WARNING, "Unable to allocate memory in _php3_regreplace"); - regfree(&re); - return ((char *) -1); - } - - err = pos = 0; - buf[0] = '\0'; - - while (!err) { - err = regexec(&re, &string[pos], (size_t) NS, subs, (pos ? REG_NOTBOL : 0)); - - if (err && err != REG_NOMATCH) { - _php3_reg_eprint(err, &re); - regfree(&re); - return ((char *) -1); - } - if (!err) { - /* backref replacement is done in two passes: - 1) find out how long the string will be, and allocate buf - 2) copy the part before match, replacement and backrefs to buf - - Jaakko Hyvätti - */ - - new_l = strlen(buf) + subs[0].rm_so; /* part before the match */ - walk = replace; - while (*walk) - if ('\\' == *walk - && '0' <= walk[1] && '9' >= walk[1] - && subs[walk[1] - '0'].rm_so > -1 - && subs[walk[1] - '0'].rm_eo > -1) { - new_l += subs[walk[1] - '0'].rm_eo - - subs[walk[1] - '0'].rm_so; - walk += 2; - } else { - new_l++; - walk++; - } - - if (new_l + 1 > buf_len) { - buf_len = 1 + buf_len + 2 * new_l; - nbuf = emalloc(buf_len); - strcpy(nbuf, buf); - efree(buf); - buf = nbuf; - } - tmp = strlen(buf); - /* copy the part of the string before the match */ - strncat(buf, &string[pos], subs[0].rm_so); - - /* copy replacement and backrefs */ - walkbuf = &buf[tmp + subs[0].rm_so]; - walk = replace; - while (*walk) - if ('\\' == *walk - && '0' <= walk[1] && '9' >= walk[1] - && subs[walk[1] - '0'].rm_so > -1 - && subs[walk[1] - '0'].rm_eo > -1) { - tmp = subs[walk[1] - '0'].rm_eo - - subs[walk[1] - '0'].rm_so; - memcpy (walkbuf, - &string[pos + subs[walk[1] - '0'].rm_so], - tmp); - walkbuf += tmp; - walk += 2; - } else - *walkbuf++ = *walk++; - *walkbuf = '\0'; - - /* and get ready to keep looking for replacements */ - if (subs[0].rm_so == subs[0].rm_eo) { - if (subs[0].rm_so + pos >= string_len) - break; - new_l = strlen (buf) + 1; - if (new_l + 1 > buf_len) { - buf_len = 1 + buf_len + 2 * new_l; - nbuf = emalloc(buf_len * sizeof(char)); - strcpy(nbuf, buf); - efree(buf); - buf = nbuf; - } - pos += subs[0].rm_eo + 1; - buf [new_l-1] = string [pos-1]; - buf [new_l] = '\0'; - } else { - pos += subs[0].rm_eo; - } - } else { /* REG_NOMATCH */ - new_l = strlen(buf) + strlen(&string[pos]); - if (new_l + 1 > buf_len) { - buf_len = new_l + 1; /* now we know exactly how long it is */ - nbuf = emalloc(buf_len * sizeof(char)); - strcpy(nbuf, buf); - efree(buf); - buf = nbuf; - } - /* stick that last bit of string on our output */ - strcat(buf, &string[pos]); - } - } - - /* don't want to leak memory .. */ - regfree(&re); - - /* whew. */ - return (buf); -} - -static void _php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS, int icase) -{ - pval *arg_pattern, - *arg_replace, - *arg_string; - char *pattern; - char *string; - char *replace; - char *ret; - - if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg_pattern, &arg_replace, &arg_string) == FAILURE) { - WRONG_PARAM_COUNT; - } - - if (arg_pattern->type == IS_STRING) { - if (arg_pattern->value.str.val && arg_pattern->value.str.len) - pattern = estrndup(arg_pattern->value.str.val,arg_pattern->value.str.len); - else - pattern = empty_string; - } else { - convert_to_long(arg_pattern); - pattern = emalloc(2); - pattern[0] = (char) arg_pattern->value.lval; - pattern[1] = '\0'; - } - - if (arg_replace->type == IS_STRING) { - if (arg_replace->value.str.val && arg_replace->value.str.len) - replace = estrndup(arg_replace->value.str.val, arg_replace->value.str.len); - else - replace = empty_string; - } else { - convert_to_long(arg_replace); - replace = emalloc(2); - replace[0] = (char) arg_replace->value.lval; - replace[1] = '\0'; - } - - convert_to_string(arg_string); - if (arg_string->value.str.val && arg_string->value.str.len) - string = estrndup(arg_string->value.str.val, arg_string->value.str.len); - else - string = empty_string; - - /* do the actual work */ - ret = _php3_regreplace(pattern, replace, string, icase, 1); - if (ret == (char *) -1) { - RETVAL_FALSE; - } else { - RETVAL_STRING(ret,1); - STR_FREE(ret); - } - STR_FREE(string); - STR_FREE(replace); - STR_FREE(pattern); -} - -/* {{{ proto string ereg_replace(string pattern, string string [, array registers]) - Replace regular expression */ -PHP_FUNCTION(ereg_replace) -{ - _php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto string eregi_replace(string pattern, string string [, array registers]) - Case insensitive replace regular expression */ -PHP_FUNCTION(eregi_replace) -{ - _php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - -/* ("root", "passwd", "uid", "gid", "other:stuff:like:/bin/sh") - = split(":", $passwd_file, 5); */ -/* {{{ proto array split(string pattern, string string [, int limit]) - split string into array by regular expression */ -PHP_FUNCTION(split) -{ - pval *spliton, *str, *arg_count = NULL; - regex_t re; - regmatch_t subs[1]; - char *strp, *endp; - int err, size, count; - - switch (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &spliton, &str) == FAILURE) - WRONG_PARAM_COUNT; - count = -1; - break; - case 3: - if (getParameters(ht, 3, &spliton, &str, &arg_count) == FAILURE) - WRONG_PARAM_COUNT; - convert_to_long(arg_count); - count = arg_count->value.lval; - break; - default: - WRONG_PARAM_COUNT; - } - - convert_to_string(spliton); - convert_to_string(str); - - strp = str->value.str.val; - endp = str->value.str.val + strlen(str->value.str.val); - - err = regcomp(&re, spliton->value.str.val, REG_EXTENDED); - if (err) { - php_error(E_WARNING, "unexpected regex error (%d)", err); - RETURN_FALSE; - } - - if (array_init(return_value) == FAILURE) { - regfree(&re); - RETURN_FALSE; - } - - /* churn through str, generating array entries as we go */ - while ((count == -1 || count > 1) && !(err = regexec(&re, strp, 1, subs, 0))) { - if (subs[0].rm_so == 0 && subs[0].rm_eo) { - /* match is at start of string, return empty string */ - add_next_index_stringl(return_value, empty_string, 0, 1); - /* skip ahead the length of the regex match */ - strp+=subs[0].rm_eo; - } else if (subs[0].rm_so==0 && subs[0].rm_eo==0) { - /* No more matches */ - regfree(&re); - php_error(E_WARNING, "bad regular expression for split()"); - zend_hash_destroy(return_value->value.ht); - efree(return_value->value.ht); - RETURN_FALSE; - } else { - /* On a real match */ - - /* make a copy of the substring */ - size = subs[0].rm_so; - - /* add it to the array */ - add_next_index_stringl(return_value, strp, size, 1); - - /* point at our new starting point */ - strp = strp + subs[0].rm_eo; - } - - /* if we're only looking for a certain number of points, - stop looking once we hit it */ - if (count != -1) { - count--; - } - } - - /* see if we encountered an error */ - if (err && err != REG_NOMATCH) { - php_error(E_WARNING, "unexpected regex error (%d)", err); - regfree(&re); - zend_hash_destroy(return_value->value.ht); - efree(return_value->value.ht); - RETURN_FALSE; - } - - /* otherwise we just have one last element to add to the array */ - size = endp - strp; - - add_next_index_stringl(return_value, strp, size, 1); - - regfree(&re); - - return; -} -/* }}} */ - -/* {{{ proto string sql_regcase(string string) - Make regular expression for case insensitive match */ -PHPAPI PHP_FUNCTION(sql_regcase) -{ - pval *string; - char *tmp; - unsigned char c; - register int i, j; - - if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &string)==FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string(string); - - tmp = (char *) emalloc(string->value.str.len*4+1); - - for (i=j=0; ivalue.str.len; i++) { - c = (unsigned char) string->value.str.val[i]; - if(isalpha(c)) { - tmp[j++] = '['; - tmp[j++] = toupper(c); - tmp[j++] = tolower(c); - tmp[j++] = ']'; - } else { - tmp[j++] = c; - } - } - tmp[j]=0; - - tmp = erealloc(tmp, j + 1); - - RETVAL_STRINGL(tmp, j, 0); -} -/* }}} */ - - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/ereg/php_ereg.h b/ext/ereg/php_ereg.h deleted file mode 100644 index c261abf4d2e3d..0000000000000 --- a/ext/ereg/php_ereg.h +++ /dev/null @@ -1,71 +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 | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef _REG_H -#define _REG_H - -extern php3_module_entry regexp_module_entry; -#define regexp_module_ptr ®exp_module_entry - -char *_php3_regreplace(const char *pattern, const char *replace, const char *string, int icase, int extended); - -PHP_FUNCTION(ereg); -PHP_FUNCTION(eregi); -PHP_FUNCTION(eregi_replace); -PHP_FUNCTION(ereg_replace); -PHP_FUNCTION(split); -PHPAPI PHP_FUNCTION(sql_regcase); - -typedef struct { - HashTable ht_rc; -} php_reg_globals; - - -#ifdef ZTS -#define REGLS_D php_reg_globals *reg_globals -#define REGLS_DC , REGLS_D -#define REGLS_C reg_globals -#define REGLS_CC , REGLS_C -#define REG(v) (reg_globals->v) -#define REGLS_FETCH() php_reg_globals *reg_globals = ts_resource(reg_globals_id) -#else -#define REGLS_D -#define REGLS_DC -#define REGLS_C -#define REGLS_CC -#define REG(v) (reg_globals.v) -#define REGLS_FETCH() -#endif - -#define phpext_regex_ptr regexp_module_ptr - -#endif /* _REG_H */ diff --git a/ext/ereg/php_regex.h b/ext/ereg/php_regex.h deleted file mode 100644 index 62279c4c08db2..0000000000000 --- a/ext/ereg/php_regex.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _PHP_REGEX_H -#define _PHP_REGEX_H - -#if REGEX == 1 -/* 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 -#endif - -#endif /* _PHP_REGEX_H */ diff --git a/ext/ereg/regex/COPYRIGHT b/ext/ereg/regex/COPYRIGHT deleted file mode 100644 index d43362fbfc9a7..0000000000000 --- a/ext/ereg/regex/COPYRIGHT +++ /dev/null @@ -1,20 +0,0 @@ -Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved. -This software is not subject to any license of the American Telephone -and Telegraph Company or of the Regents of the University of California. - -Permission is granted to anyone to use this software for any purpose on -any computer system, and to alter it and redistribute it, subject -to the following restrictions: - -1. The author is not responsible for the consequences of use of this - software, no matter how awful, even if they arise from flaws in it. - -2. The origin of this software must not be misrepresented, either by - explicit claim or by omission. Since few users ever read sources, - credits must appear in the documentation. - -3. Altered versions must be plainly marked as such, and must not be - misrepresented as being the original software. Since few users - ever read sources, credits must appear in the documentation. - -4. This notice may not be removed or altered. diff --git a/ext/ereg/regex/Makefile.am b/ext/ereg/regex/Makefile.am deleted file mode 100644 index 993db56b1ac15..0000000000000 --- a/ext/ereg/regex/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -noinst_LTLIBRARIES = libregex.la - -libregex_la_SOURCES = regcomp.c regexec.c regerror.c regfree.c diff --git a/ext/ereg/regex/README b/ext/ereg/regex/README deleted file mode 100644 index cea9b67b6665d..0000000000000 --- a/ext/ereg/regex/README +++ /dev/null @@ -1,32 +0,0 @@ -alpha3.4 release. -Thu Mar 17 23:17:18 EST 1994 -henry@zoo.toronto.edu - -See WHATSNEW for change listing. - -installation notes: --------- -Read the comments at the beginning of Makefile before running. - -Utils.h contains some things that just might have to be modified on -some systems, as well as a nested include (ugh) of . - -The "fake" directory contains quick-and-dirty fakes for some header -files and routines that old systems may not have. Note also that --DUSEBCOPY will make utils.h substitute bcopy() for memmove(). - -After that, "make r" will build regcomp.o, regexec.o, regfree.o, -and regerror.o (the actual routines), bundle them together into a test -program, and run regression tests on them. No output is good output. - -"make lib" builds just the .o files for the actual routines (when -you're happy with testing and have adjusted CFLAGS for production), -and puts them together into libregex.a. You can pick up either the -library or *.o ("make lib" makes sure there are no other .o files left -around to confuse things). - -Main.c, debug.c, split.c are used for regression testing but are not part -of the RE routines themselves. - -Regex.h goes in /usr/include. All other .h files are internal only. --------- diff --git a/ext/ereg/regex/WHATSNEW b/ext/ereg/regex/WHATSNEW deleted file mode 100644 index 6e82e1dae0cd2..0000000000000 --- a/ext/ereg/regex/WHATSNEW +++ /dev/null @@ -1,92 +0,0 @@ -New in alpha3.4: The complex bug alluded to below has been fixed (in a -slightly kludgey temporary way that may hurt efficiency a bit; this is -another "get it out the door for 4.4" release). The tests at the end of -the tests file have accordingly been uncommented. The primary sign of -the bug was that something like a?b matching ab matched b rather than ab. -(The bug was essentially specific to this exact situation, else it would -have shown up earlier.) - -New in alpha3.3: The definition of word boundaries has been altered -slightly, to more closely match the usual programming notion that "_" -is an alphabetic. Stuff used for pre-ANSI systems is now in a subdir, -and the makefile no longer alludes to it in mysterious ways. The -makefile has generally been cleaned up some. Fixes have been made -(again!) so that the regression test will run without -DREDEBUG, at -the cost of weaker checking. A workaround for a bug in some folks' - has been added. And some more things have been added to -tests, including a couple right at the end which are commented out -because the code currently flunks them (complex bug; fix coming). -Plus the usual minor cleanup. - -New in alpha3.2: Assorted bits of cleanup and portability improvement -(the development base is now a BSDI system using GCC instead of an ancient -Sun system, and the newer compiler exposed some glitches). Fix for a -serious bug that affected REs using many [] (including REG_ICASE REs -because of the way they are implemented), *sometimes*, depending on -memory-allocation patterns. The header-file prototypes no longer name -the parameters, avoiding possible name conflicts. The possibility that -some clot has defined CHAR_MIN as (say) `-128' instead of `(-128)' is -now handled gracefully. "uchar" is no longer used as an internal type -name (too many people have the same idea). Still the same old lousy -performance, alas. - -New in alpha3.1: Basically nothing, this release is just a bookkeeping -convenience. Stay tuned. - -New in alpha3.0: Performance is no better, alas, but some fixes have been -made and some functionality has been added. (This is basically the "get -it out the door in time for 4.4" release.) One bug fix: regfree() didn't -free the main internal structure (how embarrassing). It is now possible -to put NULs in either the RE or the target string, using (resp.) a new -REG_PEND flag and the old REG_STARTEND flag. The REG_NOSPEC flag to -regcomp() makes all characters ordinary, so you can match a literal -string easily (this will become more useful when performance improves!). -There are now primitives to match beginnings and ends of words, although -the syntax is disgusting and so is the implementation. The REG_ATOI -debugging interface has changed a bit. And there has been considerable -internal cleanup of various kinds. - -New in alpha2.3: Split change list out of README, and moved flags notes -into Makefile. Macro-ized the name of regex(7) in regex(3), since it has -to change for 4.4BSD. Cleanup work in engine.c, and some new regression -tests to catch tricky cases thereof. - -New in alpha2.2: Out-of-date manpages updated. Regerror() acquires two -small extensions -- REG_ITOA and REG_ATOI -- which avoid debugging kludges -in my own test program and might be useful to others for similar purposes. -The regression test will now compile (and run) without REDEBUG. The -BRE \$ bug is fixed. Most uses of "uchar" are gone; it's all chars now. -Char/uchar parameters are now written int/unsigned, to avoid possible -portability problems with unpromoted parameters. Some unsigned casts have -been introduced to minimize portability problems with shifting into sign -bits. - -New in alpha2.1: Lots of little stuff, cleanup and fixes. The one big -thing is that regex.h is now generated, using mkh, rather than being -supplied in the distribution; due to circularities in dependencies, -you have to build regex.h explicitly by "make h". The two known bugs -have been fixed (and the regression test now checks for them), as has a -problem with assertions not being suppressed in the absence of REDEBUG. -No performance work yet. - -New in alpha2: Backslash-anything is an ordinary character, not an -error (except, of course, for the handful of backslashed metacharacters -in BREs), which should reduce script breakage. The regression test -checks *where* null strings are supposed to match, and has generally -been tightened up somewhat. Small bug fixes in parameter passing (not -harmful, but technically errors) and some other areas. Debugging -invoked by defining REDEBUG rather than not defining NDEBUG. - -New in alpha+3: full prototyping for internal routines, using a little -helper program, mkh, which extracts prototypes given in stylized comments. -More minor cleanup. Buglet fix: it's CHAR_BIT, not CHAR_BITS. Simple -pre-screening of input when a literal string is known to be part of the -RE; this does wonders for performance. - -New in alpha+2: minor bits of cleanup. Notably, the number "32" for the -word width isn't hardwired into regexec.c any more, the public header -file prototypes the functions if __STDC__ is defined, and some small typos -in the manpages have been fixed. - -New in alpha+1: improvements to the manual pages, and an important -extension, the REG_STARTEND option to regexec(). diff --git a/ext/ereg/regex/cclass.h b/ext/ereg/regex/cclass.h deleted file mode 100644 index 0c293028e9d52..0000000000000 --- a/ext/ereg/regex/cclass.h +++ /dev/null @@ -1,31 +0,0 @@ -/* character-class table */ -static struct cclass { - char *name; - char *chars; - char *multis; -} cclasses[] = { - "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ -0123456789", "", - "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", - "", - "blank", " \t", "", - "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\ -\25\26\27\30\31\32\33\34\35\36\37\177", "", - "digit", "0123456789", "", - "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ -0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", - "", - "lower", "abcdefghijklmnopqrstuvwxyz", - "", - "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ -0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", - "", - "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", - "", - "space", "\t\n\v\f\r ", "", - "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "", - "xdigit", "0123456789ABCDEFabcdef", - "", - NULL, 0, "" -}; diff --git a/ext/ereg/regex/cname.h b/ext/ereg/regex/cname.h deleted file mode 100644 index 02e86e912e3d7..0000000000000 --- a/ext/ereg/regex/cname.h +++ /dev/null @@ -1,102 +0,0 @@ -/* character-name table */ -static struct cname { - char *name; - char code; -} cnames[] = { - "NUL", '\0', - "SOH", '\001', - "STX", '\002', - "ETX", '\003', - "EOT", '\004', - "ENQ", '\005', - "ACK", '\006', - "BEL", '\007', - "alert", '\007', - "BS", '\010', - "backspace", '\b', - "HT", '\011', - "tab", '\t', - "LF", '\012', - "newline", '\n', - "VT", '\013', - "vertical-tab", '\v', - "FF", '\014', - "form-feed", '\f', - "CR", '\015', - "carriage-return", '\r', - "SO", '\016', - "SI", '\017', - "DLE", '\020', - "DC1", '\021', - "DC2", '\022', - "DC3", '\023', - "DC4", '\024', - "NAK", '\025', - "SYN", '\026', - "ETB", '\027', - "CAN", '\030', - "EM", '\031', - "SUB", '\032', - "ESC", '\033', - "IS4", '\034', - "FS", '\034', - "IS3", '\035', - "GS", '\035', - "IS2", '\036', - "RS", '\036', - "IS1", '\037', - "US", '\037', - "space", ' ', - "exclamation-mark", '!', - "quotation-mark", '"', - "number-sign", '#', - "dollar-sign", '$', - "percent-sign", '%', - "ampersand", '&', - "apostrophe", '\'', - "left-parenthesis", '(', - "right-parenthesis", ')', - "asterisk", '*', - "plus-sign", '+', - "comma", ',', - "hyphen", '-', - "hyphen-minus", '-', - "period", '.', - "full-stop", '.', - "slash", '/', - "solidus", '/', - "zero", '0', - "one", '1', - "two", '2', - "three", '3', - "four", '4', - "five", '5', - "six", '6', - "seven", '7', - "eight", '8', - "nine", '9', - "colon", ':', - "semicolon", ';', - "less-than-sign", '<', - "equals-sign", '=', - "greater-than-sign", '>', - "question-mark", '?', - "commercial-at", '@', - "left-square-bracket", '[', - "backslash", '\\', - "reverse-solidus", '\\', - "right-square-bracket", ']', - "circumflex", '^', - "circumflex-accent", '^', - "underscore", '_', - "low-line", '_', - "grave-accent", '`', - "left-brace", '{', - "left-curly-bracket", '{', - "vertical-line", '|', - "right-brace", '}', - "right-curly-bracket", '}', - "tilde", '~', - "DEL", '\177', - NULL, 0, -}; diff --git a/ext/ereg/regex/debug.c b/ext/ereg/regex/debug.c deleted file mode 100644 index c0feaeb1694b0..0000000000000 --- a/ext/ereg/regex/debug.c +++ /dev/null @@ -1,242 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "utils.h" -#include "regex2.h" -#include "debug.ih" - -/* - - regprint - print a regexp for debugging - == void regprint(regex_t *r, FILE *d); - */ -void -regprint(r, d) -regex_t *r; -FILE *d; -{ - register struct re_guts *g = r->re_g; - register int i; - register int c; - register int last; - int nincat[NC]; - - fprintf(d, "%ld states, %d categories", (long)g->nstates, - g->ncategories); - fprintf(d, ", first %ld last %ld", (long)g->firststate, - (long)g->laststate); - if (g->iflags&USEBOL) - fprintf(d, ", USEBOL"); - if (g->iflags&USEEOL) - fprintf(d, ", USEEOL"); - if (g->iflags&BAD) - fprintf(d, ", BAD"); - if (g->nsub > 0) - fprintf(d, ", nsub=%ld", (long)g->nsub); - if (g->must != NULL) - fprintf(d, ", must(%ld) `%*s'", (long)g->mlen, (int)g->mlen, - g->must); - if (g->backrefs) - fprintf(d, ", backrefs"); - if (g->nplus > 0) - fprintf(d, ", nplus %ld", (long)g->nplus); - fprintf(d, "\n"); - s_print(g, d); - for (i = 0; i < g->ncategories; i++) { - nincat[i] = 0; - for (c = CHAR_MIN; c <= CHAR_MAX; c++) - if (g->categories[c] == i) - nincat[i]++; - } - fprintf(d, "cc0#%d", nincat[0]); - for (i = 1; i < g->ncategories; i++) - if (nincat[i] == 1) { - for (c = CHAR_MIN; c <= CHAR_MAX; c++) - if (g->categories[c] == i) - break; - fprintf(d, ", %d=%s", i, regchar(c)); - } - fprintf(d, "\n"); - for (i = 1; i < g->ncategories; i++) - if (nincat[i] != 1) { - fprintf(d, "cc%d\t", i); - last = -1; - for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */ - if (c <= CHAR_MAX && g->categories[c] == i) { - if (last < 0) { - fprintf(d, "%s", regchar(c)); - last = c; - } - } else { - if (last >= 0) { - if (last != c-1) - fprintf(d, "-%s", - regchar(c-1)); - last = -1; - } - } - fprintf(d, "\n"); - } -} - -/* - - s_print - print the strip for debugging - == static void s_print(register struct re_guts *g, FILE *d); - */ -static void -s_print(g, d) -register struct re_guts *g; -FILE *d; -{ - register sop *s; - register cset *cs; - register int i; - register int done = 0; - register sop opnd; - register int col = 0; - register int last; - register sopno offset = 2; -# define GAP() { if (offset % 5 == 0) { \ - if (col > 40) { \ - fprintf(d, "\n\t"); \ - col = 0; \ - } else { \ - fprintf(d, " "); \ - col++; \ - } \ - } else \ - col++; \ - offset++; \ - } - - if (OP(g->strip[0]) != OEND) - fprintf(d, "missing initial OEND!\n"); - for (s = &g->strip[1]; !done; s++) { - opnd = OPND(*s); - switch (OP(*s)) { - case OEND: - fprintf(d, "\n"); - done = 1; - break; - case OCHAR: - if (strchr("\\|()^$.[+*?{}!<> ", (char)opnd) != NULL) - fprintf(d, "\\%c", (char)opnd); - else - fprintf(d, "%s", regchar((char)opnd)); - break; - case OBOL: - fprintf(d, "^"); - break; - case OEOL: - fprintf(d, "$"); - break; - case OBOW: - fprintf(d, "\\{"); - break; - case OEOW: - fprintf(d, "\\}"); - break; - case OANY: - fprintf(d, "."); - break; - case OANYOF: - fprintf(d, "[(%ld)", (long)opnd); - cs = &g->sets[opnd]; - last = -1; - for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */ - if (CHIN(cs, i) && i < g->csetsize) { - if (last < 0) { - fprintf(d, "%s", regchar(i)); - last = i; - } - } else { - if (last >= 0) { - if (last != i-1) - fprintf(d, "-%s", - regchar(i-1)); - last = -1; - } - } - fprintf(d, "]"); - break; - case OBACK_: - fprintf(d, "(\\<%ld>", (long)opnd); - break; - case O_BACK: - fprintf(d, "<%ld>\\)", (long)opnd); - break; - case OPLUS_: - fprintf(d, "(+"); - if (OP(*(s+opnd)) != O_PLUS) - fprintf(d, "<%ld>", (long)opnd); - break; - case O_PLUS: - if (OP(*(s-opnd)) != OPLUS_) - fprintf(d, "<%ld>", (long)opnd); - fprintf(d, "+)"); - break; - case OQUEST_: - fprintf(d, "(?"); - if (OP(*(s+opnd)) != O_QUEST) - fprintf(d, "<%ld>", (long)opnd); - break; - case O_QUEST: - if (OP(*(s-opnd)) != OQUEST_) - fprintf(d, "<%ld>", (long)opnd); - fprintf(d, "?)"); - break; - case OLPAREN: - fprintf(d, "((<%ld>", (long)opnd); - break; - case ORPAREN: - fprintf(d, "<%ld>))", (long)opnd); - break; - case OCH_: - fprintf(d, "<"); - if (OP(*(s+opnd)) != OOR2) - fprintf(d, "<%ld>", (long)opnd); - break; - case OOR1: - if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_) - fprintf(d, "<%ld>", (long)opnd); - fprintf(d, "|"); - break; - case OOR2: - fprintf(d, "|"); - if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH) - fprintf(d, "<%ld>", (long)opnd); - break; - case O_CH: - if (OP(*(s-opnd)) != OOR1) - fprintf(d, "<%ld>", (long)opnd); - fprintf(d, ">"); - break; - default: - fprintf(d, "!%ld(%ld)!", OP(*s), opnd); - break; - } - if (!done) - GAP(); - } -} - -/* - - regchar - make a character printable - == static char *regchar(int ch); - */ -static char * /* -> representation */ -regchar(ch) -int ch; -{ - static char buf[10]; - - if (isprint(ch) || ch == ' ') - sprintf(buf, "%c", ch); - else - sprintf(buf, "\\%o", ch); - return(buf); -} diff --git a/ext/ereg/regex/debug.ih b/ext/ereg/regex/debug.ih deleted file mode 100644 index 5f40ff7917876..0000000000000 --- a/ext/ereg/regex/debug.ih +++ /dev/null @@ -1,14 +0,0 @@ -/* ========= begin header generated by ./mkh ========= */ -#ifdef __cplusplus -extern "C" { -#endif - -/* === debug.c === */ -void regprint(regex_t *r, FILE *d); -static void s_print(register struct re_guts *g, FILE *d); -static char *regchar(int ch); - -#ifdef __cplusplus -} -#endif -/* ========= end header generated by ./mkh ========= */ diff --git a/ext/ereg/regex/engine.c b/ext/ereg/regex/engine.c deleted file mode 100644 index 0b88dcf1ed87c..0000000000000 --- a/ext/ereg/regex/engine.c +++ /dev/null @@ -1,1019 +0,0 @@ -/* - * The matching engine and friends. This file is #included by regexec.c - * after suitable #defines of a variety of macros used herein, so that - * different state representations can be used without duplicating masses - * of code. - */ - -#ifdef SNAMES -#define matcher smatcher -#define fast sfast -#define slow sslow -#define dissect sdissect -#define backref sbackref -#define step sstep -#define print sprint -#define at sat -#define match smat -#endif -#ifdef LNAMES -#define matcher lmatcher -#define fast lfast -#define slow lslow -#define dissect ldissect -#define backref lbackref -#define step lstep -#define print lprint -#define at lat -#define match lmat -#endif - -/* another structure passed up and down to avoid zillions of parameters */ -struct match { - struct re_guts *g; - int eflags; - regmatch_t *pmatch; /* [nsub+1] (0 element unused) */ - char *offp; /* offsets work from here */ - char *beginp; /* start of string -- virtual NUL precedes */ - char *endp; /* end of string -- virtual NUL here */ - char *coldp; /* can be no match starting before here */ - char **lastpos; /* [nplus+1] */ - STATEVARS; - states st; /* current states */ - states fresh; /* states for a fresh start */ - states tmp; /* temporary */ - states empty; /* empty set of states */ -}; - -#include "engine.ih" - -#ifdef REDEBUG -#define SP(t, s, c) print(m, t, s, c, stdout) -#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2) -#define NOTE(str) { if (m->eflags®_TRACE) printf("=%s\n", (str)); } -#else -#define SP(t, s, c) /* nothing */ -#define AT(t, p1, p2, s1, s2) /* nothing */ -#define NOTE(s) /* nothing */ -#endif - -/* - - matcher - the actual matching engine - == static int matcher(register struct re_guts *g, char *string, \ - == size_t nmatch, regmatch_t pmatch[], int eflags); - */ -static int /* 0 success, REG_NOMATCH failure */ -matcher(g, string, nmatch, pmatch, eflags) -register struct re_guts *g; -char *string; -size_t nmatch; -regmatch_t pmatch[]; -int eflags; -{ - register char *endp; - register size_t i; - struct match mv; - register struct match *m = &mv; - register char *dp; - const register sopno gf = g->firststate+1; /* +1 for OEND */ - const register sopno gl = g->laststate; - char *start; - char *stop; - - /* simplify the situation where possible */ - if (g->cflags®_NOSUB) - nmatch = 0; - if (eflags®_STARTEND) { - start = string + pmatch[0].rm_so; - stop = string + pmatch[0].rm_eo; - } else { - start = string; - stop = start + strlen(start); - } - if (stop < start) - return(REG_INVARG); - - /* prescreening; this does wonders for this rather slow code */ - if (g->must != NULL) { - for (dp = start; dp < stop; dp++) - if (*dp == g->must[0] && stop - dp >= g->mlen && - memcmp(dp, g->must, (size_t)g->mlen) == 0) - break; - if (dp == stop) /* we didn't find g->must */ - return(REG_NOMATCH); - } - - /* match struct setup */ - m->g = g; - m->eflags = eflags; - m->pmatch = NULL; - m->lastpos = NULL; - m->offp = string; - m->beginp = start; - m->endp = stop; - STATESETUP(m, 4); - SETUP(m->st); - SETUP(m->fresh); - SETUP(m->tmp); - SETUP(m->empty); - CLEAR(m->empty); - - /* this loop does only one repetition except for backrefs */ - for (;;) { - endp = fast(m, start, stop, gf, gl); - if (endp == NULL) { /* a miss */ - STATETEARDOWN(m); - return(REG_NOMATCH); - } - if (nmatch == 0 && !g->backrefs) - break; /* no further info needed */ - - /* where? */ - assert(m->coldp != NULL); - for (;;) { - NOTE("finding start"); - endp = slow(m, m->coldp, stop, gf, gl); - if (endp != NULL) - break; - assert(m->coldp < m->endp); - m->coldp++; - } - if (nmatch == 1 && !g->backrefs) - break; /* no further info needed */ - - /* oh my, he wants the subexpressions... */ - if (m->pmatch == NULL) - m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) * - sizeof(regmatch_t)); - if (m->pmatch == NULL) { - STATETEARDOWN(m); - return(REG_ESPACE); - } - for (i = 1; i <= m->g->nsub; i++) - m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1; - if (!g->backrefs && !(m->eflags®_BACKR)) { - NOTE("dissecting"); - dp = dissect(m, m->coldp, endp, gf, gl); - } else { - if (g->nplus > 0 && m->lastpos == NULL) - m->lastpos = (char **)malloc((g->nplus+1) * - sizeof(char *)); - if (g->nplus > 0 && m->lastpos == NULL) { - free(m->pmatch); - STATETEARDOWN(m); - return(REG_ESPACE); - } - NOTE("backref dissect"); - dp = backref(m, m->coldp, endp, gf, gl, (sopno)0); - } - if (dp != NULL) - break; - - /* uh-oh... we couldn't find a subexpression-level match */ - assert(g->backrefs); /* must be back references doing it */ - assert(g->nplus == 0 || m->lastpos != NULL); - for (;;) { - if (dp != NULL || endp <= m->coldp) - break; /* defeat */ - NOTE("backoff"); - endp = slow(m, m->coldp, endp-1, gf, gl); - if (endp == NULL) - break; /* defeat */ - /* try it on a shorter possibility */ -#ifndef NDEBUG - for (i = 1; i <= m->g->nsub; i++) { - assert(m->pmatch[i].rm_so == -1); - assert(m->pmatch[i].rm_eo == -1); - } -#endif - NOTE("backoff dissect"); - dp = backref(m, m->coldp, endp, gf, gl, (sopno)0); - } - assert(dp == NULL || dp == endp); - if (dp != NULL) /* found a shorter one */ - break; - - /* despite initial appearances, there is no match here */ - NOTE("false alarm"); - start = m->coldp + 1; /* recycle starting later */ - assert(start <= stop); - } - - /* fill in the details if requested */ - if (nmatch > 0) { - pmatch[0].rm_so = m->coldp - m->offp; - pmatch[0].rm_eo = endp - m->offp; - } - if (nmatch > 1) { - assert(m->pmatch != NULL); - for (i = 1; i < nmatch; i++) - if (i <= m->g->nsub) - pmatch[i] = m->pmatch[i]; - else { - pmatch[i].rm_so = -1; - pmatch[i].rm_eo = -1; - } - } - - if (m->pmatch != NULL) - free((char *)m->pmatch); - if (m->lastpos != NULL) - free((char *)m->lastpos); - STATETEARDOWN(m); - return(0); -} - -/* - - dissect - figure out what matched what, no back references - == static char *dissect(register struct match *m, char *start, \ - == char *stop, sopno startst, sopno stopst); - */ -static char * /* == stop (success) always */ -dissect(m, start, stop, startst, stopst) -register struct match *m; -char *start; -char *stop; -sopno startst; -sopno stopst; -{ - register int i; - register sopno ss; /* start sop of current subRE */ - register sopno es; /* end sop of current subRE */ - register char *sp; /* start of string matched by it */ - register char *stp; /* string matched by it cannot pass here */ - register char *rest; /* start of rest of string */ - register char *tail; /* string unmatched by rest of RE */ - register sopno ssub; /* start sop of subsubRE */ - register sopno esub; /* end sop of subsubRE */ - register char *ssp; /* start of string matched by subsubRE */ - register char *sep; /* end of string matched by subsubRE */ - register char *oldssp; /* previous ssp */ - register char *dp; - - AT("diss", start, stop, startst, stopst); - sp = start; - for (ss = startst; ss < stopst; ss = es) { - /* identify end of subRE */ - es = ss; - switch (OP(m->g->strip[es])) { - case OPLUS_: - case OQUEST_: - es += OPND(m->g->strip[es]); - break; - case OCH_: - while (OP(m->g->strip[es]) != O_CH) - es += OPND(m->g->strip[es]); - break; - } - es++; - - /* figure out what it matched */ - switch (OP(m->g->strip[ss])) { - case OEND: - assert(nope); - break; - case OCHAR: - sp++; - break; - case OBOL: - case OEOL: - case OBOW: - case OEOW: - break; - case OANY: - case OANYOF: - sp++; - break; - case OBACK_: - case O_BACK: - assert(nope); - break; - /* cases where length of match is hard to find */ - case OQUEST_: - stp = stop; - for (;;) { - /* how long could this one be? */ - rest = slow(m, sp, stp, ss, es); - assert(rest != NULL); /* it did match */ - /* could the rest match the rest? */ - tail = slow(m, rest, stop, es, stopst); - if (tail == stop) - break; /* yes! */ - /* no -- try a shorter match for this one */ - stp = rest - 1; - assert(stp >= sp); /* it did work */ - } - ssub = ss + 1; - esub = es - 1; - /* did innards match? */ - if (slow(m, sp, rest, ssub, esub) != NULL) { - dp = dissect(m, sp, rest, ssub, esub); - assert(dp == rest); - } else /* no */ - assert(sp == rest); - sp = rest; - break; - case OPLUS_: - stp = stop; - for (;;) { - /* how long could this one be? */ - rest = slow(m, sp, stp, ss, es); - assert(rest != NULL); /* it did match */ - /* could the rest match the rest? */ - tail = slow(m, rest, stop, es, stopst); - if (tail == stop) - break; /* yes! */ - /* no -- try a shorter match for this one */ - stp = rest - 1; - assert(stp >= sp); /* it did work */ - } - ssub = ss + 1; - esub = es - 1; - ssp = sp; - oldssp = ssp; - for (;;) { /* find last match of innards */ - sep = slow(m, ssp, rest, ssub, esub); - if (sep == NULL || sep == ssp) - break; /* failed or matched null */ - oldssp = ssp; /* on to next try */ - ssp = sep; - } - if (sep == NULL) { - /* last successful match */ - sep = ssp; - ssp = oldssp; - } - assert(sep == rest); /* must exhaust substring */ - assert(slow(m, ssp, sep, ssub, esub) == rest); - dp = dissect(m, ssp, sep, ssub, esub); - assert(dp == sep); - sp = rest; - break; - case OCH_: - stp = stop; - for (;;) { - /* how long could this one be? */ - rest = slow(m, sp, stp, ss, es); - assert(rest != NULL); /* it did match */ - /* could the rest match the rest? */ - tail = slow(m, rest, stop, es, stopst); - if (tail == stop) - break; /* yes! */ - /* no -- try a shorter match for this one */ - stp = rest - 1; - assert(stp >= sp); /* it did work */ - } - ssub = ss + 1; - esub = ss + OPND(m->g->strip[ss]) - 1; - assert(OP(m->g->strip[esub]) == OOR1); - for (;;) { /* find first matching branch */ - if (slow(m, sp, rest, ssub, esub) == rest) - break; /* it matched all of it */ - /* that one missed, try next one */ - assert(OP(m->g->strip[esub]) == OOR1); - esub++; - assert(OP(m->g->strip[esub]) == OOR2); - ssub = esub + 1; - esub += OPND(m->g->strip[esub]); - if (OP(m->g->strip[esub]) == OOR2) - esub--; - else - assert(OP(m->g->strip[esub]) == O_CH); - } - dp = dissect(m, sp, rest, ssub, esub); - assert(dp == rest); - sp = rest; - break; - case O_PLUS: - case O_QUEST: - case OOR1: - case OOR2: - case O_CH: - assert(nope); - break; - case OLPAREN: - i = OPND(m->g->strip[ss]); - assert(0 < i && i <= m->g->nsub); - m->pmatch[i].rm_so = sp - m->offp; - break; - case ORPAREN: - i = OPND(m->g->strip[ss]); - assert(0 < i && i <= m->g->nsub); - m->pmatch[i].rm_eo = sp - m->offp; - break; - default: /* uh oh */ - assert(nope); - break; - } - } - - assert(sp == stop); - return(sp); -} - -/* - - backref - figure out what matched what, figuring in back references - == static char *backref(register struct match *m, char *start, \ - == char *stop, sopno startst, sopno stopst, sopno lev); - */ -static char * /* == stop (success) or NULL (failure) */ -backref(m, start, stop, startst, stopst, lev) -register struct match *m; -char *start; -char *stop; -sopno startst; -sopno stopst; -sopno lev; /* PLUS nesting level */ -{ - register int i; - register sopno ss; /* start sop of current subRE */ - register char *sp; /* start of string matched by it */ - register sopno ssub; /* start sop of subsubRE */ - register sopno esub; /* end sop of subsubRE */ - register char *ssp; /* start of string matched by subsubRE */ - register char *dp; - register size_t len; - register int hard; - register sop s; - register regoff_t offsave; - register cset *cs; - - AT("back", start, stop, startst, stopst); - sp = start; - - /* get as far as we can with easy stuff */ - hard = 0; - for (ss = startst; !hard && ss < stopst; ss++) - switch (OP(s = m->g->strip[ss])) { - case OCHAR: - if (sp == stop || *sp++ != (char)OPND(s)) - return(NULL); - break; - case OANY: - if (sp == stop) - return(NULL); - sp++; - break; - case OANYOF: - cs = &m->g->sets[OPND(s)]; - if (sp == stop || !CHIN(cs, *sp++)) - return(NULL); - break; - case OBOL: - if ( (sp == m->beginp && !(m->eflags®_NOTBOL)) || - (sp < m->endp && *(sp-1) == '\n' && - (m->g->cflags®_NEWLINE)) ) - { /* yes */ } - else - return(NULL); - break; - case OEOL: - if ( (sp == m->endp && !(m->eflags®_NOTEOL)) || - (sp < m->endp && *sp == '\n' && - (m->g->cflags®_NEWLINE)) ) - { /* yes */ } - else - return(NULL); - break; - case OBOW: - if (( (sp == m->beginp && !(m->eflags®_NOTBOL)) || - (sp < m->endp && *(sp-1) == '\n' && - (m->g->cflags®_NEWLINE)) || - (sp > m->beginp && - !ISWORD(*(sp-1))) ) && - (sp < m->endp && ISWORD(*sp)) ) - { /* yes */ } - else - return(NULL); - break; - case OEOW: - if (( (sp == m->endp && !(m->eflags®_NOTEOL)) || - (sp < m->endp && *sp == '\n' && - (m->g->cflags®_NEWLINE)) || - (sp < m->endp && !ISWORD(*sp)) ) && - (sp > m->beginp && ISWORD(*(sp-1))) ) - { /* yes */ } - else - return(NULL); - break; - case O_QUEST: - break; - case OOR1: /* matches null but needs to skip */ - ss++; - s = m->g->strip[ss]; - do { - assert(OP(s) == OOR2); - ss += OPND(s); - } while (OP(s = m->g->strip[ss]) != O_CH); - /* note that the ss++ gets us past the O_CH */ - break; - default: /* have to make a choice */ - hard = 1; - break; - } - if (!hard) { /* that was it! */ - if (sp != stop) - return(NULL); - return(sp); - } - ss--; /* adjust for the for's final increment */ - - /* the hard stuff */ - AT("hard", sp, stop, ss, stopst); - s = m->g->strip[ss]; - switch (OP(s)) { - case OBACK_: /* the vilest depths */ - i = OPND(s); - assert(0 < i && i <= m->g->nsub); - if (m->pmatch[i].rm_eo == -1) - return(NULL); - assert(m->pmatch[i].rm_so != -1); - len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so; - assert(stop - m->beginp >= len); - if (sp > stop - len) - return(NULL); /* not enough left to match */ - ssp = m->offp + m->pmatch[i].rm_so; - if (memcmp(sp, ssp, len) != 0) - return(NULL); - while (m->g->strip[ss] != SOP(O_BACK, i)) - ss++; - return(backref(m, sp+len, stop, ss+1, stopst, lev)); - break; - case OQUEST_: /* to null or not */ - dp = backref(m, sp, stop, ss+1, stopst, lev); - if (dp != NULL) - return(dp); /* not */ - return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev)); - break; - case OPLUS_: - assert(m->lastpos != NULL); - assert(lev+1 <= m->g->nplus); - m->lastpos[lev+1] = sp; - return(backref(m, sp, stop, ss+1, stopst, lev+1)); - break; - case O_PLUS: - if (sp == m->lastpos[lev]) /* last pass matched null */ - return(backref(m, sp, stop, ss+1, stopst, lev-1)); - /* try another pass */ - m->lastpos[lev] = sp; - dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev); - if (dp == NULL) - return(backref(m, sp, stop, ss+1, stopst, lev-1)); - else - return(dp); - break; - case OCH_: /* find the right one, if any */ - ssub = ss + 1; - esub = ss + OPND(s) - 1; - assert(OP(m->g->strip[esub]) == OOR1); - for (;;) { /* find first matching branch */ - dp = backref(m, sp, stop, ssub, esub, lev); - if (dp != NULL) - return(dp); - /* that one missed, try next one */ - if (OP(m->g->strip[esub]) == O_CH) - return(NULL); /* there is none */ - esub++; - assert(OP(m->g->strip[esub]) == OOR2); - ssub = esub + 1; - esub += OPND(m->g->strip[esub]); - if (OP(m->g->strip[esub]) == OOR2) - esub--; - else - assert(OP(m->g->strip[esub]) == O_CH); - } - break; - case OLPAREN: /* must undo assignment if rest fails */ - i = OPND(s); - assert(0 < i && i <= m->g->nsub); - offsave = m->pmatch[i].rm_so; - m->pmatch[i].rm_so = sp - m->offp; - dp = backref(m, sp, stop, ss+1, stopst, lev); - if (dp != NULL) - return(dp); - m->pmatch[i].rm_so = offsave; - return(NULL); - break; - case ORPAREN: /* must undo assignment if rest fails */ - i = OPND(s); - assert(0 < i && i <= m->g->nsub); - offsave = m->pmatch[i].rm_eo; - m->pmatch[i].rm_eo = sp - m->offp; - dp = backref(m, sp, stop, ss+1, stopst, lev); - if (dp != NULL) - return(dp); - m->pmatch[i].rm_eo = offsave; - return(NULL); - break; - default: /* uh oh */ - assert(nope); - break; - } - - /* "can't happen" */ - assert(nope); - /* NOTREACHED */ - return((char *)NULL); /* dummy */ -} - -/* - - fast - step through the string at top speed - == static char *fast(register struct match *m, char *start, \ - == char *stop, sopno startst, sopno stopst); - */ -static char * /* where tentative match ended, or NULL */ -fast(m, start, stop, startst, stopst) -register struct match *m; -char *start; -char *stop; -sopno startst; -sopno stopst; -{ - register states st = m->st; - register states fresh = m->fresh; - register states tmp = m->tmp; - register char *p = start; - register int c = (start == m->beginp) ? OUT : *(start-1); - register int lastc; /* previous c */ - register int flagch; - register int i; - register char *coldp; /* last p after which no match was underway */ - - CLEAR(st); - SET1(st, startst); - st = step(m->g, startst, stopst, st, NOTHING, st); - ASSIGN(fresh, st); - SP("start", st, *p); - coldp = NULL; - for (;;) { - /* next character */ - lastc = c; - c = (p == m->endp) ? OUT : *p; - if (EQ(st, fresh)) - coldp = p; - - /* is there an EOL and/or BOL between lastc and c? */ - flagch = '\0'; - i = 0; - if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || - (lastc == OUT && !(m->eflags®_NOTBOL)) ) { - flagch = BOL; - i = m->g->nbol; - } - if ( (c == '\n' && m->g->cflags®_NEWLINE) || - (c == OUT && !(m->eflags®_NOTEOL)) ) { - flagch = (flagch == BOL) ? BOLEOL : EOL; - i += m->g->neol; - } - if (i != 0) { - for (; i > 0; i--) - st = step(m->g, startst, stopst, st, flagch, st); - SP("boleol", st, c); - } - - /* how about a word boundary? */ - if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && - (c != OUT && ISWORD(c)) ) { - flagch = BOW; - } - if ( (lastc != OUT && ISWORD(lastc)) && - (flagch == EOL || (c != OUT && !ISWORD(c))) ) { - flagch = EOW; - } - if (flagch == BOW || flagch == EOW) { - st = step(m->g, startst, stopst, st, flagch, st); - SP("boweow", st, c); - } - - /* are we done? */ - if (ISSET(st, stopst) || p == stop) - break; /* NOTE BREAK OUT */ - - /* no, we must deal with this character */ - ASSIGN(tmp, st); - ASSIGN(st, fresh); - assert(c != OUT); - st = step(m->g, startst, stopst, tmp, c, st); - SP("aft", st, c); - assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); - p++; - } - - assert(coldp != NULL); - m->coldp = coldp; - if (ISSET(st, stopst)) - return(p+1); - else - return(NULL); -} - -/* - - slow - step through the string more deliberately - == static char *slow(register struct match *m, char *start, \ - == char *stop, sopno startst, sopno stopst); - */ -static char * /* where it ended */ -slow(m, start, stop, startst, stopst) -register struct match *m; -char *start; -char *stop; -sopno startst; -sopno stopst; -{ - register states st = m->st; - register states empty = m->empty; - register states tmp = m->tmp; - register char *p = start; - register int c = (start == m->beginp) ? OUT : *(start-1); - register int lastc; /* previous c */ - register int flagch; - register int i; - register char *matchp; /* last p at which a match ended */ - - AT("slow", start, stop, startst, stopst); - CLEAR(st); - SET1(st, startst); - SP("sstart", st, *p); - st = step(m->g, startst, stopst, st, NOTHING, st); - matchp = NULL; - for (;;) { - /* next character */ - lastc = c; - c = (p == m->endp) ? OUT : *p; - - /* is there an EOL and/or BOL between lastc and c? */ - flagch = '\0'; - i = 0; - if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || - (lastc == OUT && !(m->eflags®_NOTBOL)) ) { - flagch = BOL; - i = m->g->nbol; - } - if ( (c == '\n' && m->g->cflags®_NEWLINE) || - (c == OUT && !(m->eflags®_NOTEOL)) ) { - flagch = (flagch == BOL) ? BOLEOL : EOL; - i += m->g->neol; - } - if (i != 0) { - for (; i > 0; i--) - st = step(m->g, startst, stopst, st, flagch, st); - SP("sboleol", st, c); - } - - /* how about a word boundary? */ - if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && - (c != OUT && ISWORD(c)) ) { - flagch = BOW; - } - if ( (lastc != OUT && ISWORD(lastc)) && - (flagch == EOL || (c != OUT && !ISWORD(c))) ) { - flagch = EOW; - } - if (flagch == BOW || flagch == EOW) { - st = step(m->g, startst, stopst, st, flagch, st); - SP("sboweow", st, c); - } - - /* are we done? */ - if (ISSET(st, stopst)) - matchp = p; - if (EQ(st, empty) || p == stop) - break; /* NOTE BREAK OUT */ - - /* no, we must deal with this character */ - ASSIGN(tmp, st); - ASSIGN(st, empty); - assert(c != OUT); - st = step(m->g, startst, stopst, tmp, c, st); - SP("saft", st, c); - assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); - p++; - } - - return(matchp); -} - - -/* - - step - map set of states reachable before char to set reachable after - == static states step(register struct re_guts *g, sopno start, sopno stop, \ - == register states bef, int ch, register states aft); - == #define BOL (OUT+1) - == #define EOL (BOL+1) - == #define BOLEOL (BOL+2) - == #define NOTHING (BOL+3) - == #define BOW (BOL+4) - == #define EOW (BOL+5) - == #define CODEMAX (BOL+5) // highest code used - == #define NONCHAR(c) ((c) > CHAR_MAX) - == #define NNONCHAR (CODEMAX-CHAR_MAX) - */ -static states -step(g, start, stop, bef, ch, aft) -register struct re_guts *g; -sopno start; /* start state within strip */ -sopno stop; /* state after stop state within strip */ -register states bef; /* states reachable before */ -int ch; /* character or NONCHAR code */ -register states aft; /* states already known reachable after */ -{ - register cset *cs; - register sop s; - register sopno pc; - register onestate here; /* note, macros know this name */ - register sopno look; - register long i; - - for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) { - s = g->strip[pc]; - switch (OP(s)) { - case OEND: - assert(pc == stop-1); - break; - case OCHAR: - /* only characters can match */ - assert(!NONCHAR(ch) || ch != (char)OPND(s)); - if (ch == (char)OPND(s)) - FWD(aft, bef, 1); - break; - case OBOL: - if (ch == BOL || ch == BOLEOL) - FWD(aft, bef, 1); - break; - case OEOL: - if (ch == EOL || ch == BOLEOL) - FWD(aft, bef, 1); - break; - case OBOW: - if (ch == BOW) - FWD(aft, bef, 1); - break; - case OEOW: - if (ch == EOW) - FWD(aft, bef, 1); - break; - case OANY: - if (!NONCHAR(ch)) - FWD(aft, bef, 1); - break; - case OANYOF: - cs = &g->sets[OPND(s)]; - if (!NONCHAR(ch) && CHIN(cs, ch)) - FWD(aft, bef, 1); - break; - case OBACK_: /* ignored here */ - case O_BACK: - FWD(aft, aft, 1); - break; - case OPLUS_: /* forward, this is just an empty */ - FWD(aft, aft, 1); - break; - case O_PLUS: /* both forward and back */ - FWD(aft, aft, 1); - i = ISSETBACK(aft, OPND(s)); - BACK(aft, aft, OPND(s)); - if (!i && ISSETBACK(aft, OPND(s))) { - /* oho, must reconsider loop body */ - pc -= OPND(s) + 1; - INIT(here, pc); - } - break; - case OQUEST_: /* two branches, both forward */ - FWD(aft, aft, 1); - FWD(aft, aft, OPND(s)); - break; - case O_QUEST: /* just an empty */ - FWD(aft, aft, 1); - break; - case OLPAREN: /* not significant here */ - case ORPAREN: - FWD(aft, aft, 1); - break; - case OCH_: /* mark the first two branches */ - FWD(aft, aft, 1); - assert(OP(g->strip[pc+OPND(s)]) == OOR2); - FWD(aft, aft, OPND(s)); - break; - case OOR1: /* done a branch, find the O_CH */ - if (ISSTATEIN(aft, here)) { - for (look = 1; - OP(s = g->strip[pc+look]) != O_CH; - look += OPND(s)) - assert(OP(s) == OOR2); - FWD(aft, aft, look); - } - break; - case OOR2: /* propagate OCH_'s marking */ - FWD(aft, aft, 1); - if (OP(g->strip[pc+OPND(s)]) != O_CH) { - assert(OP(g->strip[pc+OPND(s)]) == OOR2); - FWD(aft, aft, OPND(s)); - } - break; - case O_CH: /* just empty */ - FWD(aft, aft, 1); - break; - default: /* ooooops... */ - assert(nope); - break; - } - } - - return(aft); -} - -#ifdef REDEBUG -/* - - print - print a set of states - == #ifdef REDEBUG - == static void print(struct match *m, char *caption, states st, \ - == int ch, FILE *d); - == #endif - */ -static void -print(m, caption, st, ch, d) -struct match *m; -char *caption; -states st; -int ch; -FILE *d; -{ - register struct re_guts *g = m->g; - register int i; - register int first = 1; - - if (!(m->eflags®_TRACE)) - return; - - fprintf(d, "%s", caption); - if (ch != '\0') - fprintf(d, " %s", pchar(ch)); - for (i = 0; i < g->nstates; i++) - if (ISSET(st, i)) { - fprintf(d, "%s%d", (first) ? "\t" : ", ", i); - first = 0; - } - fprintf(d, "\n"); -} - -/* - - at - print current situation - == #ifdef REDEBUG - == static void at(struct match *m, char *title, char *start, char *stop, \ - == sopno startst, sopno stopst); - == #endif - */ -static void -at(m, title, start, stop, startst, stopst) -struct match *m; -char *title; -char *start; -char *stop; -sopno startst; -sopno stopst; -{ - if (!(m->eflags®_TRACE)) - return; - - printf("%s %s-", title, pchar(*start)); - printf("%s ", pchar(*stop)); - printf("%ld-%ld\n", (long)startst, (long)stopst); -} - -#ifndef PCHARDONE -#define PCHARDONE /* never again */ -/* - - pchar - make a character printable - == #ifdef REDEBUG - == static char *pchar(int ch); - == #endif - * - * Is this identical to regchar() over in debug.c? Well, yes. But a - * duplicate here avoids having a debugging-capable regexec.o tied to - * a matching debug.o, and this is convenient. It all disappears in - * the non-debug compilation anyway, so it doesn't matter much. - */ -static char * /* -> representation */ -pchar(ch) -int ch; -{ - static char pbuf[10]; - - if (isprint(ch) || ch == ' ') - sprintf(pbuf, "%c", ch); - else - sprintf(pbuf, "\\%o", ch); - return(pbuf); -} -#endif -#endif - -#undef matcher -#undef fast -#undef slow -#undef dissect -#undef backref -#undef step -#undef print -#undef at -#undef match diff --git a/ext/ereg/regex/engine.ih b/ext/ereg/regex/engine.ih deleted file mode 100644 index cc98334e752c8..0000000000000 --- a/ext/ereg/regex/engine.ih +++ /dev/null @@ -1,35 +0,0 @@ -/* ========= begin header generated by ./mkh ========= */ -#ifdef __cplusplus -extern "C" { -#endif - -/* === engine.c === */ -static int matcher(register struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], int eflags); -static char *dissect(register struct match *m, char *start, char *stop, sopno startst, sopno stopst); -static char *backref(register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev); -static char *fast(register struct match *m, char *start, char *stop, sopno startst, sopno stopst); -static char *slow(register struct match *m, char *start, char *stop, sopno startst, sopno stopst); -static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft); -#define BOL (OUT+1) -#define EOL (BOL+1) -#define BOLEOL (BOL+2) -#define NOTHING (BOL+3) -#define BOW (BOL+4) -#define EOW (BOL+5) -#define CODEMAX (BOL+5) /* highest code used */ -#define NONCHAR(c) ((c) > CHAR_MAX) -#define NNONCHAR (CODEMAX-CHAR_MAX) -#ifdef REDEBUG -static void print(struct match *m, char *caption, states st, int ch, FILE *d); -#endif -#ifdef REDEBUG -static void at(struct match *m, char *title, char *start, char *stop, sopno startst, sopno stopst); -#endif -#ifdef REDEBUG -static char *pchar(int ch); -#endif - -#ifdef __cplusplus -} -#endif -/* ========= end header generated by ./mkh ========= */ diff --git a/ext/ereg/regex/main.c b/ext/ereg/regex/main.c deleted file mode 100644 index 657338a2c1998..0000000000000 --- a/ext/ereg/regex/main.c +++ /dev/null @@ -1,510 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "main.ih" - -char *progname; -int debug = 0; -int line = 0; -int status = 0; - -int copts = REG_EXTENDED; -int eopts = 0; -regoff_t startoff = 0; -regoff_t endoff = 0; - - -extern int split(); -extern void regprint(); - -/* - - main - do the simple case, hand off to regress() for regression - */ -int main(argc, argv) -int argc; -char *argv[]; -{ - regex_t re; -# define NS 10 - regmatch_t subs[NS]; - char erbuf[100]; - int err; - size_t len; - int c; - int errflg = 0; - register int i; - extern int optind; - extern char *optarg; - - progname = argv[0]; - - while ((c = getopt(argc, argv, "c:e:S:E:x")) != EOF) - switch (c) { - case 'c': /* compile options */ - copts = options('c', optarg); - break; - case 'e': /* execute options */ - eopts = options('e', optarg); - break; - case 'S': /* start offset */ - startoff = (regoff_t)atoi(optarg); - break; - case 'E': /* end offset */ - endoff = (regoff_t)atoi(optarg); - break; - case 'x': /* Debugging. */ - debug++; - break; - case '?': - default: - errflg++; - break; - } - if (errflg) { - fprintf(stderr, "usage: %s ", progname); - fprintf(stderr, "[-c copt][-C][-d] [re]\n"); - exit(2); - } - - if (optind >= argc) { - regress(stdin); - exit(status); - } - - err = regcomp(&re, argv[optind++], copts); - if (err) { - len = regerror(err, &re, erbuf, sizeof(erbuf)); - fprintf(stderr, "error %s, %d/%d `%s'\n", - eprint(err), len, sizeof(erbuf), erbuf); - exit(status); - } - regprint(&re, stdout); - - if (optind >= argc) { - regfree(&re); - exit(status); - } - - if (eopts®_STARTEND) { - subs[0].rm_so = startoff; - subs[0].rm_eo = strlen(argv[optind]) - endoff; - } - err = regexec(&re, argv[optind], (size_t)NS, subs, eopts); - if (err) { - len = regerror(err, &re, erbuf, sizeof(erbuf)); - fprintf(stderr, "error %s, %d/%d `%s'\n", - eprint(err), len, sizeof(erbuf), erbuf); - exit(status); - } - if (!(copts®_NOSUB)) { - len = (int)(subs[0].rm_eo - subs[0].rm_so); - if (subs[0].rm_so != -1) { - if (len != 0) - printf("match `%.*s'\n", (int)len, - argv[optind] + subs[0].rm_so); - else - printf("match `'@%.1s\n", - argv[optind] + subs[0].rm_so); - } - for (i = 1; i < NS; i++) - if (subs[i].rm_so != -1) - printf("(%d) `%.*s'\n", i, - (int)(subs[i].rm_eo - subs[i].rm_so), - argv[optind] + subs[i].rm_so); - } - exit(status); -} - -/* - - regress - main loop of regression test - == void regress(FILE *in); - */ -void -regress(in) -FILE *in; -{ - char inbuf[1000]; -# define MAXF 10 - char *f[MAXF]; - int nf; - int i; - char erbuf[100]; - size_t ne; - char *badpat = "invalid regular expression"; -# define SHORT 10 - char *bpname = "REG_BADPAT"; - regex_t re; - - while (fgets(inbuf, sizeof(inbuf), in) != NULL) { - line++; - if (inbuf[0] == '#' || inbuf[0] == '\n') - continue; /* NOTE CONTINUE */ - inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */ - if (debug) - fprintf(stdout, "%d:\n", line); - nf = split(inbuf, f, MAXF, "\t\t"); - if (nf < 3) { - fprintf(stderr, "bad input, line %d\n", line); - exit(1); - } - for (i = 0; i < nf; i++) - if (strcmp(f[i], "\"\"") == 0) - f[i] = ""; - if (nf <= 3) - f[3] = NULL; - if (nf <= 4) - f[4] = NULL; - try(f[0], f[1], f[2], f[3], f[4], options('c', f[1])); - if (opt('&', f[1])) /* try with either type of RE */ - try(f[0], f[1], f[2], f[3], f[4], - options('c', f[1]) &~ REG_EXTENDED); - } - - ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf)); - if (strcmp(erbuf, badpat) != 0 || ne != strlen(badpat)+1) { - fprintf(stderr, "end: regerror() test gave `%s' not `%s'\n", - erbuf, badpat); - status = 1; - } - ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, (size_t)SHORT); - if (strncmp(erbuf, badpat, SHORT-1) != 0 || erbuf[SHORT-1] != '\0' || - ne != strlen(badpat)+1) { - fprintf(stderr, "end: regerror() short test gave `%s' not `%.*s'\n", - erbuf, SHORT-1, badpat); - status = 1; - } - ne = regerror(REG_ITOA|REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf)); - if (strcmp(erbuf, bpname) != 0 || ne != strlen(bpname)+1) { - fprintf(stderr, "end: regerror() ITOA test gave `%s' not `%s'\n", - erbuf, bpname); - status = 1; - } - re.re_endp = bpname; - ne = regerror(REG_ATOI, &re, erbuf, sizeof(erbuf)); - if (atoi(erbuf) != (int)REG_BADPAT) { - fprintf(stderr, "end: regerror() ATOI test gave `%s' not `%ld'\n", - erbuf, (long)REG_BADPAT); - status = 1; - } else if (ne != strlen(erbuf)+1) { - fprintf(stderr, "end: regerror() ATOI test len(`%s') = %ld\n", - erbuf, (long)REG_BADPAT); - status = 1; - } -} - -/* - - try - try it, and report on problems - == void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts); - */ -void -try(f0, f1, f2, f3, f4, opts) -char *f0; -char *f1; -char *f2; -char *f3; -char *f4; -int opts; /* may not match f1 */ -{ - regex_t re; -# define NSUBS 10 - regmatch_t subs[NSUBS]; -# define NSHOULD 15 - char *should[NSHOULD]; - int nshould; - char erbuf[100]; - int err; - int len; - char *type = (opts & REG_EXTENDED) ? "ERE" : "BRE"; - register int i; - char *grump; - char f0copy[1000]; - char f2copy[1000]; - - strcpy(f0copy, f0); - re.re_endp = (opts®_PEND) ? f0copy + strlen(f0copy) : NULL; - fixstr(f0copy); - err = regcomp(&re, f0copy, opts); - if (err != 0 && (!opt('C', f1) || err != efind(f2))) { - /* unexpected error or wrong error */ - len = regerror(err, &re, erbuf, sizeof(erbuf)); - fprintf(stderr, "%d: %s error %s, %d/%d `%s'\n", - line, type, eprint(err), len, - sizeof(erbuf), erbuf); - status = 1; - } else if (err == 0 && opt('C', f1)) { - /* unexpected success */ - fprintf(stderr, "%d: %s should have given REG_%s\n", - line, type, f2); - status = 1; - err = 1; /* so we won't try regexec */ - } - - if (err != 0) { - regfree(&re); - return; - } - - strcpy(f2copy, f2); - fixstr(f2copy); - - if (options('e', f1)®_STARTEND) { - if (strchr(f2, '(') == NULL || strchr(f2, ')') == NULL) - fprintf(stderr, "%d: bad STARTEND syntax\n", line); - subs[0].rm_so = strchr(f2, '(') - f2 + 1; - subs[0].rm_eo = strchr(f2, ')') - f2; - } - err = regexec(&re, f2copy, NSUBS, subs, options('e', f1)); - - if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) { - /* unexpected error or wrong error */ - len = regerror(err, &re, erbuf, sizeof(erbuf)); - fprintf(stderr, "%d: %s exec error %s, %d/%d `%s'\n", - line, type, eprint(err), len, - sizeof(erbuf), erbuf); - status = 1; - } else if (err != 0) { - /* nothing more to check */ - } else if (f3 == NULL) { - /* unexpected success */ - fprintf(stderr, "%d: %s exec should have failed\n", - line, type); - status = 1; - err = 1; /* just on principle */ - } else if (opts®_NOSUB) { - /* nothing more to check */ - } else if ((grump = check(f2, subs[0], f3)) != NULL) { - fprintf(stderr, "%d: %s %s\n", line, type, grump); - status = 1; - err = 1; - } - - if (err != 0 || f4 == NULL) { - regfree(&re); - return; - } - - for (i = 1; i < NSHOULD; i++) - should[i] = NULL; - nshould = split(f4, should+1, NSHOULD-1, ","); - if (nshould == 0) { - nshould = 1; - should[1] = ""; - } - for (i = 1; i < NSUBS; i++) { - grump = check(f2, subs[i], should[i]); - if (grump != NULL) { - fprintf(stderr, "%d: %s $%d %s\n", line, - type, i, grump); - status = 1; - err = 1; - } - } - - regfree(&re); -} - -/* - - options - pick options out of a regression-test string - == int options(int type, char *s); - */ -int -options(type, s) -int type; /* 'c' compile, 'e' exec */ -char *s; -{ - register char *p; - register int o = (type == 'c') ? copts : eopts; - register char *legal = (type == 'c') ? "bisnmp" : "^$#tl"; - - for (p = s; *p != '\0'; p++) - if (strchr(legal, *p) != NULL) - switch (*p) { - case 'b': - o &= ~REG_EXTENDED; - break; - case 'i': - o |= REG_ICASE; - break; - case 's': - o |= REG_NOSUB; - break; - case 'n': - o |= REG_NEWLINE; - break; - case 'm': - o &= ~REG_EXTENDED; - o |= REG_NOSPEC; - break; - case 'p': - o |= REG_PEND; - break; - case '^': - o |= REG_NOTBOL; - break; - case '$': - o |= REG_NOTEOL; - break; - case '#': - o |= REG_STARTEND; - break; - case 't': /* trace */ - o |= REG_TRACE; - break; - case 'l': /* force long representation */ - o |= REG_LARGE; - break; - case 'r': /* force backref use */ - o |= REG_BACKR; - break; - } - return(o); -} - -/* - - opt - is a particular option in a regression string? - == int opt(int c, char *s); - */ -int /* predicate */ -opt(c, s) -int c; -char *s; -{ - return(strchr(s, c) != NULL); -} - -/* - - fixstr - transform magic characters in strings - == void fixstr(register char *p); - */ -void -fixstr(p) -register char *p; -{ - if (p == NULL) - return; - - for (; *p != '\0'; p++) - if (*p == 'N') - *p = '\n'; - else if (*p == 'T') - *p = '\t'; - else if (*p == 'S') - *p = ' '; - else if (*p == 'Z') - *p = '\0'; -} - -/* - - check - check a substring match - == char *check(char *str, regmatch_t sub, char *should); - */ -char * /* NULL or complaint */ -check(str, sub, should) -char *str; -regmatch_t sub; -char *should; -{ - register int len; - register int shlen; - register char *p; - static char grump[500]; - register char *at = NULL; - - if (should != NULL && strcmp(should, "-") == 0) - should = NULL; - if (should != NULL && should[0] == '@') { - at = should + 1; - should = ""; - } - - /* check rm_so and rm_eo for consistency */ - if (sub.rm_so > sub.rm_eo || (sub.rm_so == -1 && sub.rm_eo != -1) || - (sub.rm_so != -1 && sub.rm_eo == -1) || - (sub.rm_so != -1 && sub.rm_so < 0) || - (sub.rm_eo != -1 && sub.rm_eo < 0) ) { - sprintf(grump, "start %ld end %ld", (long)sub.rm_so, - (long)sub.rm_eo); - return(grump); - } - - /* check for no match */ - if (sub.rm_so == -1 && should == NULL) - return(NULL); - if (sub.rm_so == -1) - return("did not match"); - - /* check for in range */ - if (sub.rm_eo > strlen(str)) { - sprintf(grump, "start %ld end %ld, past end of string", - (long)sub.rm_so, (long)sub.rm_eo); - return(grump); - } - - len = (int)(sub.rm_eo - sub.rm_so); - shlen = (int)strlen(should); - p = str + sub.rm_so; - - /* check for not supposed to match */ - if (should == NULL) { - sprintf(grump, "matched `%.*s'", len, p); - return(grump); - } - - /* check for wrong match */ - if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) { - sprintf(grump, "matched `%.*s' instead", len, p); - return(grump); - } - if (shlen > 0) - return(NULL); - - /* check null match in right place */ - if (at == NULL) - return(NULL); - shlen = strlen(at); - if (shlen == 0) - shlen = 1; /* force check for end-of-string */ - if (strncmp(p, at, shlen) != 0) { - sprintf(grump, "matched null at `%.20s'", p); - return(grump); - } - return(NULL); -} - -/* - - eprint - convert error number to name - == static char *eprint(int err); - */ -static char * -eprint(err) -int err; -{ - static char epbuf[100]; - size_t len; - - len = regerror(REG_ITOA|err, (regex_t *)NULL, epbuf, sizeof(epbuf)); - assert(len <= sizeof(epbuf)); - return(epbuf); -} - -/* - - efind - convert error name to number - == static int efind(char *name); - */ -static int -efind(name) -char *name; -{ - static char efbuf[100]; - regex_t re; - - sprintf(efbuf, "REG_%s", name); - assert(strlen(efbuf) < sizeof(efbuf)); - re.re_endp = efbuf; - (void) regerror(REG_ATOI, &re, efbuf, sizeof(efbuf)); - return(atoi(efbuf)); -} diff --git a/ext/ereg/regex/main.ih b/ext/ereg/regex/main.ih deleted file mode 100644 index 5a0118ac44167..0000000000000 --- a/ext/ereg/regex/main.ih +++ /dev/null @@ -1,19 +0,0 @@ -/* ========= begin header generated by ./mkh ========= */ -#ifdef __cplusplus -extern "C" { -#endif - -/* === main.c === */ -void regress(FILE *in); -void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts); -int options(int type, char *s); -int opt(int c, char *s); -void fixstr(register char *p); -char *check(char *str, regmatch_t sub, char *should); -static char *eprint(int err); -static int efind(char *name); - -#ifdef __cplusplus -} -#endif -/* ========= end header generated by ./mkh ========= */ diff --git a/ext/ereg/regex/mkh b/ext/ereg/regex/mkh deleted file mode 100644 index 252b246c7bd25..0000000000000 --- a/ext/ereg/regex/mkh +++ /dev/null @@ -1,76 +0,0 @@ -#! /bin/sh -# mkh - pull headers out of C source -PATH=/bin:/usr/bin ; export PATH - -# egrep pattern to pick out marked lines -egrep='^ =([ ]|$)' - -# Sed program to process marked lines into lines for the header file. -# The markers have already been removed. Two things are done here: removal -# of backslashed newlines, and some fudging of comments. The first is done -# because -o needs to have prototypes on one line to strip them down. -# Getting comments into the output is tricky; we turn C++-style // comments -# into /* */ comments, after altering any existing */'s to avoid trouble. -peel=' /\\$/N - /\\\n[ ]*/s///g - /\/\//s;\*/;* /;g - /\/\//s;//\(.*\);/*\1 */;' - -for a -do - case "$a" in - -o) # old (pre-function-prototype) compiler - # add code to comment out argument lists - peel="$peel - "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1(/*\2*/);' - shift - ;; - -b) # funny Berkeley __P macro - peel="$peel - "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1 __P((\2));' - shift - ;; - -s) # compiler doesn't like `static foo();' - # add code to get rid of the `static' - peel="$peel - "'/^static[ ][^\/]*[a-zA-Z0-9_)](.*)/s;static.;;' - shift - ;; - -p) # private declarations - egrep='^ ==([ ]|$)' - shift - ;; - -i) # wrap in #ifndef, argument is name - ifndef="$2" - shift ; shift - ;; - *) break - ;; - esac -done - -if test " $ifndef" != " " -then - echo "#ifndef $ifndef" - echo "#define $ifndef /* never again */" -fi -echo "/* ========= begin header generated by $0 ========= */" -echo '#ifdef __cplusplus' -echo 'extern "C" {' -echo '#endif' -for f -do - echo - echo "/* === $f === */" - egrep "$egrep" $f | sed 's/^ ==*[ ]//;s/^ ==*$//' | sed "$peel" - echo -done -echo '#ifdef __cplusplus' -echo '}' -echo '#endif' -echo "/* ========= end header generated by $0 ========= */" -if test " $ifndef" != " " -then - echo "#endif" -fi -exit 0 diff --git a/ext/ereg/regex/regcomp.c b/ext/ereg/regex/regcomp.c deleted file mode 100644 index 2569b1c6298f5..0000000000000 --- a/ext/ereg/regex/regcomp.c +++ /dev/null @@ -1,1605 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#define POSIX_MISTAKE - -#include "utils.h" -#include "regex2.h" - -#include "cclass.h" -#include "cname.h" - -/* - * parse structure, passed up and down to avoid global variables and - * other clumsinesses - */ -struct parse { - char *next; /* next character in RE */ - char *end; /* end of string (-> NUL normally) */ - int error; /* has an error been seen? */ - sop *strip; /* malloced strip */ - sopno ssize; /* malloced strip size (allocated) */ - sopno slen; /* malloced strip length (used) */ - int ncsalloc; /* number of csets allocated */ - struct re_guts *g; -# define NPAREN 10 /* we need to remember () 1-9 for back refs */ - sopno pbegin[NPAREN]; /* -> ( ([0] unused) */ - sopno pend[NPAREN]; /* -> ) ([0] unused) */ -}; - -#include "regcomp.ih" - -static char nuls[10]; /* place to point scanner in event of error */ - -/* - * macros for use with parse structure - * BEWARE: these know that the parse structure is named `p' !!! - */ -#define PEEK() (*p->next) -#define PEEK2() (*(p->next+1)) -#define MORE() (p->next < p->end) -#define MORE2() (p->next+1 < p->end) -#define SEE(c) (MORE() && PEEK() == (c)) -#define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b)) -#define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0) -#define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0) -#define NEXT() (p->next++) -#define NEXT2() (p->next += 2) -#define NEXTn(n) (p->next += (n)) -#define GETNEXT() (*p->next++) -#define SETERROR(e) seterr(p, (e)) -#define REQUIRE(co, e) ((co) || SETERROR(e)) -#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e)) -#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e)) -#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e)) -#define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd)) -#define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos) -#define AHEAD(pos) dofwd(p, pos, HERE()-(pos)) -#define ASTERN(sop, pos) EMIT(sop, HERE()-pos) -#define HERE() (p->slen) -#define THERE() (p->slen - 1) -#define THERETHERE() (p->slen - 2) -#define DROP(n) (p->slen -= (n)) - -#ifndef NDEBUG -static int never = 0; /* for use in asserts; shuts lint up */ -#else -#define never 0 /* some s have bugs too */ -#endif - -/* - - regcomp - interface for parser and compilation - = API_EXPORT(int) regcomp(regex_t *, const char *, int); - = #define REG_BASIC 0000 - = #define REG_EXTENDED 0001 - = #define REG_ICASE 0002 - = #define REG_NOSUB 0004 - = #define REG_NEWLINE 0010 - = #define REG_NOSPEC 0020 - = #define REG_PEND 0040 - = #define REG_DUMP 0200 - */ -API_EXPORT(int) /* 0 success, otherwise REG_something */ -regcomp(preg, pattern, cflags) -regex_t *preg; -const char *pattern; -int cflags; -{ - struct parse pa; - register struct re_guts *g; - register struct parse *p = &pa; - register int i; - register size_t len; -#ifdef REDEBUG -# define GOODFLAGS(f) (f) -#else -# define GOODFLAGS(f) ((f)&~REG_DUMP) -#endif - - cflags = GOODFLAGS(cflags); - if ((cflags®_EXTENDED) && (cflags®_NOSPEC)) - return(REG_INVARG); - - if (cflags®_PEND) { - if (preg->re_endp < pattern) - return(REG_INVARG); - len = preg->re_endp - pattern; - } else - len = strlen((char *)pattern); - - /* do the mallocs early so failure handling is easy */ - g = (struct re_guts *)malloc(sizeof(struct re_guts) + - (NC-1)*sizeof(cat_t)); - if (g == NULL) - return(REG_ESPACE); - p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */ - p->strip = (sop *)malloc(p->ssize * sizeof(sop)); - p->slen = 0; - if (p->strip == NULL) { - free((char *)g); - return(REG_ESPACE); - } - - /* set things up */ - p->g = g; - p->next = (char *)pattern; /* convenience; we do not modify it */ - p->end = p->next + len; - p->error = 0; - p->ncsalloc = 0; - for (i = 0; i < NPAREN; i++) { - p->pbegin[i] = 0; - p->pend[i] = 0; - } - g->csetsize = NC; - g->sets = NULL; - g->setbits = NULL; - g->ncsets = 0; - g->cflags = cflags; - g->iflags = 0; - g->nbol = 0; - g->neol = 0; - g->must = NULL; - g->mlen = 0; - g->nsub = 0; - g->ncategories = 1; /* category 0 is "everything else" */ - g->categories = &g->catspace[-(CHAR_MIN)]; - (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t)); - g->backrefs = 0; - - /* do it */ - EMIT(OEND, 0); - g->firststate = THERE(); - if (cflags®_EXTENDED) - p_ere(p, OUT); - else if (cflags®_NOSPEC) - p_str(p); - else - p_bre(p, OUT, OUT); - EMIT(OEND, 0); - g->laststate = THERE(); - - /* tidy up loose ends and fill things in */ - categorize(p, g); - stripsnug(p, g); - findmust(p, g); - g->nplus = pluscount(p, g); - g->magic = MAGIC2; - preg->re_nsub = g->nsub; - preg->re_g = g; - preg->re_magic = MAGIC1; -#ifndef REDEBUG - /* not debugging, so can't rely on the assert() in regexec() */ - if (g->iflags&BAD) - SETERROR(REG_ASSERT); -#endif - - /* win or lose, we're done */ - if (p->error != 0) /* lose */ - regfree(preg); - return(p->error); -} - -/* - - p_ere - ERE parser top level, concatenation and alternation - == static void p_ere(register struct parse *p, int stop); - */ -static void -p_ere(p, stop) -register struct parse *p; -int stop; /* character this ERE should end at */ -{ - register char c; - register sopno prevback = 0; - register sopno prevfwd = 0; - register sopno conc; - register int first = 1; /* is this the first alternative? */ - - for (;;) { - /* do a bunch of concatenated expressions */ - conc = HERE(); - while (MORE() && (c = PEEK()) != '|' && c != stop) - p_ere_exp(p); - REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */ - - if (!EAT('|')) - break; /* NOTE BREAK OUT */ - - if (first) { - INSERT(OCH_, conc); /* offset is wrong */ - prevfwd = conc; - prevback = conc; - first = 0; - } - ASTERN(OOR1, prevback); - prevback = THERE(); - AHEAD(prevfwd); /* fix previous offset */ - prevfwd = HERE(); - EMIT(OOR2, 0); /* offset is very wrong */ - } - - if (!first) { /* tail-end fixups */ - AHEAD(prevfwd); - ASTERN(O_CH, prevback); - } - - assert(!MORE() || SEE(stop)); -} - -/* - - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op - == static void p_ere_exp(register struct parse *p); - */ -static void -p_ere_exp(p) -register struct parse *p; -{ - register char c; - register sopno pos; - register int count; - register int count2; - register sopno subno; - int wascaret = 0; - - assert(MORE()); /* caller should have ensured this */ - c = GETNEXT(); - - pos = HERE(); - switch (c) { - case '(': - REQUIRE(MORE(), REG_EPAREN); - p->g->nsub++; - subno = p->g->nsub; - if (subno < NPAREN) - p->pbegin[subno] = HERE(); - EMIT(OLPAREN, subno); - if (!SEE(')')) - p_ere(p, ')'); - if (subno < NPAREN) { - p->pend[subno] = HERE(); - assert(p->pend[subno] != 0); - } - EMIT(ORPAREN, subno); - MUSTEAT(')', REG_EPAREN); - break; -#ifndef POSIX_MISTAKE - case ')': /* happens only if no current unmatched ( */ - /* - * You may ask, why the ifndef? Because I didn't notice - * this until slightly too late for 1003.2, and none of the - * other 1003.2 regular-expression reviewers noticed it at - * all. So an unmatched ) is legal POSIX, at least until - * we can get it fixed. - */ - SETERROR(REG_EPAREN); - break; -#endif - case '^': - EMIT(OBOL, 0); - p->g->iflags |= USEBOL; - p->g->nbol++; - wascaret = 1; - break; - case '$': - EMIT(OEOL, 0); - p->g->iflags |= USEEOL; - p->g->neol++; - break; - case '|': - SETERROR(REG_EMPTY); - break; - case '*': - case '+': - case '?': - SETERROR(REG_BADRPT); - break; - case '.': - if (p->g->cflags®_NEWLINE) - nonnewline(p); - else - EMIT(OANY, 0); - break; - case '[': - p_bracket(p); - break; - case '\\': - REQUIRE(MORE(), REG_EESCAPE); - c = GETNEXT(); - ordinary(p, c); - break; - case '{': /* okay as ordinary except if digit follows */ - REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT); - /* FALLTHROUGH */ - default: - ordinary(p, c); - break; - } - - if (!MORE()) - return; - c = PEEK(); - /* we call { a repetition if followed by a digit */ - if (!( c == '*' || c == '+' || c == '?' || - (c == '{' && MORE2() && isdigit(PEEK2())) )) - return; /* no repetition, we're done */ - NEXT(); - - REQUIRE(!wascaret, REG_BADRPT); - switch (c) { - case '*': /* implemented as +? */ - /* this case does not require the (y|) trick, noKLUDGE */ - INSERT(OPLUS_, pos); - ASTERN(O_PLUS, pos); - INSERT(OQUEST_, pos); - ASTERN(O_QUEST, pos); - break; - case '+': - INSERT(OPLUS_, pos); - ASTERN(O_PLUS, pos); - break; - case '?': - /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */ - INSERT(OCH_, pos); /* offset slightly wrong */ - ASTERN(OOR1, pos); /* this one's right */ - AHEAD(pos); /* fix the OCH_ */ - EMIT(OOR2, 0); /* offset very wrong... */ - AHEAD(THERE()); /* ...so fix it */ - ASTERN(O_CH, THERETHERE()); - break; - case '{': - count = p_count(p); - if (EAT(',')) { - if (isdigit(PEEK())) { - count2 = p_count(p); - REQUIRE(count <= count2, REG_BADBR); - } else /* single number with comma */ - count2 = INFINITY; - } else /* just a single number */ - count2 = count; - repeat(p, pos, count, count2); - if (!EAT('}')) { /* error heuristics */ - while (MORE() && PEEK() != '}') - NEXT(); - REQUIRE(MORE(), REG_EBRACE); - SETERROR(REG_BADBR); - } - break; - } - - if (!MORE()) - return; - c = PEEK(); - if (!( c == '*' || c == '+' || c == '?' || - (c == '{' && MORE2() && isdigit(PEEK2())) ) ) - return; - SETERROR(REG_BADRPT); -} - -/* - - p_str - string (no metacharacters) "parser" - == static void p_str(register struct parse *p); - */ -static void -p_str(p) -register struct parse *p; -{ - REQUIRE(MORE(), REG_EMPTY); - while (MORE()) - ordinary(p, GETNEXT()); -} - -/* - - p_bre - BRE parser top level, anchoring and concatenation - == static void p_bre(register struct parse *p, register int end1, \ - == register int end2); - * Giving end1 as OUT essentially eliminates the end1/end2 check. - * - * This implementation is a bit of a kludge, in that a trailing $ is first - * taken as an ordinary character and then revised to be an anchor. The - * only undesirable side effect is that '$' gets included as a character - * category in such cases. This is fairly harmless; not worth fixing. - * The amount of lookahead needed to avoid this kludge is excessive. - */ -static void -p_bre(p, end1, end2) -register struct parse *p; -register int end1; /* first terminating character */ -register int end2; /* second terminating character */ -{ - register sopno start = HERE(); - register int first = 1; /* first subexpression? */ - register int wasdollar = 0; - - if (EAT('^')) { - EMIT(OBOL, 0); - p->g->iflags |= USEBOL; - p->g->nbol++; - } - while (MORE() && !SEETWO(end1, end2)) { - wasdollar = p_simp_re(p, first); - first = 0; - } - if (wasdollar) { /* oops, that was a trailing anchor */ - DROP(1); - EMIT(OEOL, 0); - p->g->iflags |= USEEOL; - p->g->neol++; - } - - REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */ -} - -/* - - p_simp_re - parse a simple RE, an atom possibly followed by a repetition - == static int p_simp_re(register struct parse *p, int starordinary); - */ -static int /* was the simple RE an unbackslashed $? */ -p_simp_re(p, starordinary) -register struct parse *p; -int starordinary; /* is a leading * an ordinary character? */ -{ - register int c; - register int count; - register int count2; - register sopno pos; - register int i; - register sopno subno; -# define BACKSL (1<g->cflags®_NEWLINE) - nonnewline(p); - else - EMIT(OANY, 0); - break; - case '[': - p_bracket(p); - break; - case BACKSL|'{': - SETERROR(REG_BADRPT); - break; - case BACKSL|'(': - p->g->nsub++; - subno = p->g->nsub; - if (subno < NPAREN) - p->pbegin[subno] = HERE(); - EMIT(OLPAREN, subno); - /* the MORE here is an error heuristic */ - if (MORE() && !SEETWO('\\', ')')) - p_bre(p, '\\', ')'); - if (subno < NPAREN) { - p->pend[subno] = HERE(); - assert(p->pend[subno] != 0); - } - EMIT(ORPAREN, subno); - REQUIRE(EATTWO('\\', ')'), REG_EPAREN); - break; - case BACKSL|')': /* should not get here -- must be user */ - case BACKSL|'}': - SETERROR(REG_EPAREN); - break; - case BACKSL|'1': - case BACKSL|'2': - case BACKSL|'3': - case BACKSL|'4': - case BACKSL|'5': - case BACKSL|'6': - case BACKSL|'7': - case BACKSL|'8': - case BACKSL|'9': - i = (c&~BACKSL) - '0'; - assert(i < NPAREN); - if (p->pend[i] != 0) { - assert(i <= p->g->nsub); - EMIT(OBACK_, i); - assert(p->pbegin[i] != 0); - assert(OP(p->strip[p->pbegin[i]]) == OLPAREN); - assert(OP(p->strip[p->pend[i]]) == ORPAREN); - (void) dupl(p, p->pbegin[i]+1, p->pend[i]); - EMIT(O_BACK, i); - } else - SETERROR(REG_ESUBREG); - p->g->backrefs = 1; - break; - case '*': - REQUIRE(starordinary, REG_BADRPT); - /* FALLTHROUGH */ - default: - ordinary(p, (char)c); /* takes off BACKSL, if any */ - break; - } - - if (EAT('*')) { /* implemented as +? */ - /* this case does not require the (y|) trick, noKLUDGE */ - INSERT(OPLUS_, pos); - ASTERN(O_PLUS, pos); - INSERT(OQUEST_, pos); - ASTERN(O_QUEST, pos); - } else if (EATTWO('\\', '{')) { - count = p_count(p); - if (EAT(',')) { - if (MORE() && isdigit(PEEK())) { - count2 = p_count(p); - REQUIRE(count <= count2, REG_BADBR); - } else /* single number with comma */ - count2 = INFINITY; - } else /* just a single number */ - count2 = count; - repeat(p, pos, count, count2); - if (!EATTWO('\\', '}')) { /* error heuristics */ - while (MORE() && !SEETWO('\\', '}')) - NEXT(); - REQUIRE(MORE(), REG_EBRACE); - SETERROR(REG_BADBR); - } - } else if (c == (unsigned char)'$') /* $ (but not \$) ends it */ - return(1); - - return(0); -} - -/* - - p_count - parse a repetition count - == static int p_count(register struct parse *p); - */ -static int /* the value */ -p_count(p) -register struct parse *p; -{ - register int count = 0; - register int ndigits = 0; - - while (MORE() && isdigit(PEEK()) && count <= DUPMAX) { - count = count*10 + (GETNEXT() - '0'); - ndigits++; - } - - REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR); - return(count); -} - -/* - - p_bracket - parse a bracketed character list - == static void p_bracket(register struct parse *p); - * - * Note a significant property of this code: if the allocset() did SETERROR, - * no set operations are done. - */ -static void -p_bracket(p) -register struct parse *p; -{ - register cset *cs = allocset(p); - register int invert = 0; - - /* Dept of Truly Sickening Special-Case Kludges */ - if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) { - EMIT(OBOW, 0); - NEXTn(6); - return; - } - if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) { - EMIT(OEOW, 0); - NEXTn(6); - return; - } - - if (EAT('^')) - invert++; /* make note to invert set at end */ - if (EAT(']')) - CHadd(cs, ']'); - else if (EAT('-')) - CHadd(cs, '-'); - while (MORE() && PEEK() != ']' && !SEETWO('-', ']')) - p_b_term(p, cs); - if (EAT('-')) - CHadd(cs, '-'); - MUSTEAT(']', REG_EBRACK); - - if (p->error != 0) /* don't mess things up further */ - return; - - if (p->g->cflags®_ICASE) { - register int i; - register int ci; - - for (i = p->g->csetsize - 1; i >= 0; i--) - if (CHIN(cs, i) && isalpha(i)) { - ci = othercase(i); - if (ci != i) - CHadd(cs, ci); - } - if (cs->multis != NULL) - mccase(p, cs); - } - if (invert) { - register int i; - - for (i = p->g->csetsize - 1; i >= 0; i--) - if (CHIN(cs, i)) - CHsub(cs, i); - else - CHadd(cs, i); - if (p->g->cflags®_NEWLINE) - CHsub(cs, '\n'); - if (cs->multis != NULL) - mcinvert(p, cs); - } - - assert(cs->multis == NULL); /* xxx */ - - if (nch(p, cs) == 1) { /* optimize singleton sets */ - ordinary(p, firstch(p, cs)); - freeset(p, cs); - } else - EMIT(OANYOF, freezeset(p, cs)); -} - -/* - - p_b_term - parse one term of a bracketed character list - == static void p_b_term(register struct parse *p, register cset *cs); - */ -static void -p_b_term(p, cs) -register struct parse *p; -register cset *cs; -{ - register char c; - register char start, finish; - register int i; - - /* classify what we've got */ - switch ((MORE()) ? PEEK() : '\0') { - case '[': - c = (MORE2()) ? PEEK2() : '\0'; - break; - case '-': - SETERROR(REG_ERANGE); - return; /* NOTE RETURN */ - break; - default: - c = '\0'; - break; - } - - switch (c) { - case ':': /* character class */ - NEXT2(); - REQUIRE(MORE(), REG_EBRACK); - c = PEEK(); - REQUIRE(c != '-' && c != ']', REG_ECTYPE); - p_b_cclass(p, cs); - REQUIRE(MORE(), REG_EBRACK); - REQUIRE(EATTWO(':', ']'), REG_ECTYPE); - break; - case '=': /* equivalence class */ - NEXT2(); - REQUIRE(MORE(), REG_EBRACK); - c = PEEK(); - REQUIRE(c != '-' && c != ']', REG_ECOLLATE); - p_b_eclass(p, cs); - REQUIRE(MORE(), REG_EBRACK); - REQUIRE(EATTWO('=', ']'), REG_ECOLLATE); - break; - default: /* symbol, ordinary character, or range */ -/* xxx revision needed for multichar stuff */ - start = p_b_symbol(p); - if (SEE('-') && MORE2() && PEEK2() != ']') { - /* range */ - NEXT(); - if (EAT('-')) - finish = '-'; - else - finish = p_b_symbol(p); - } else - finish = start; -/* xxx what about signed chars here... */ - REQUIRE(start <= finish, REG_ERANGE); - for (i = start; i <= finish; i++) - CHadd(cs, i); - break; - } -} - -/* - - p_b_cclass - parse a character-class name and deal with it - == static void p_b_cclass(register struct parse *p, register cset *cs); - */ -static void -p_b_cclass(p, cs) -register struct parse *p; -register cset *cs; -{ - register char *sp = p->next; - register struct cclass *cp; - register size_t len; - register char *u; - register char c; - - while (MORE() && isalpha(PEEK())) - NEXT(); - len = p->next - sp; - for (cp = cclasses; cp->name != NULL; cp++) - if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') - break; - if (cp->name == NULL) { - /* oops, didn't find it */ - SETERROR(REG_ECTYPE); - return; - } - - u = cp->chars; - while ((c = *u++) != '\0') - CHadd(cs, c); - for (u = cp->multis; *u != '\0'; u += strlen(u) + 1) - MCadd(p, cs, u); -} - -/* - - p_b_eclass - parse an equivalence-class name and deal with it - == static void p_b_eclass(register struct parse *p, register cset *cs); - * - * This implementation is incomplete. xxx - */ -static void -p_b_eclass(p, cs) -register struct parse *p; -register cset *cs; -{ - register char c; - - c = p_b_coll_elem(p, '='); - CHadd(cs, c); -} - -/* - - p_b_symbol - parse a character or [..]ed multicharacter collating symbol - == static char p_b_symbol(register struct parse *p); - */ -static char /* value of symbol */ -p_b_symbol(p) -register struct parse *p; -{ - register char value; - - REQUIRE(MORE(), REG_EBRACK); - if (!EATTWO('[', '.')) - return(GETNEXT()); - - /* collating symbol */ - value = p_b_coll_elem(p, '.'); - REQUIRE(EATTWO('.', ']'), REG_ECOLLATE); - return(value); -} - -/* - - p_b_coll_elem - parse a collating-element name and look it up - == static char p_b_coll_elem(register struct parse *p, int endc); - */ -static char /* value of collating element */ -p_b_coll_elem(p, endc) -register struct parse *p; -int endc; /* name ended by endc,']' */ -{ - register char *sp = p->next; - register struct cname *cp; - register int len; - - while (MORE() && !SEETWO(endc, ']')) - NEXT(); - if (!MORE()) { - SETERROR(REG_EBRACK); - return(0); - } - len = p->next - sp; - for (cp = cnames; cp->name != NULL; cp++) - if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') - return(cp->code); /* known name */ - if (len == 1) - return(*sp); /* single character */ - SETERROR(REG_ECOLLATE); /* neither */ - return(0); -} - -/* - - othercase - return the case counterpart of an alphabetic - == static char othercase(int ch); - */ -static char /* if no counterpart, return ch */ -othercase(ch) -int ch; -{ - assert(isalpha(ch)); - if (isupper(ch)) - return(tolower(ch)); - else if (islower(ch)) - return(toupper(ch)); - else /* peculiar, but could happen */ - return(ch); -} - -/* - - bothcases - emit a dualcase version of a two-case character - == static void bothcases(register struct parse *p, int ch); - * - * Boy, is this implementation ever a kludge... - */ -static void -bothcases(p, ch) -register struct parse *p; -int ch; -{ - register char *oldnext = p->next; - register char *oldend = p->end; - char bracket[3]; - - assert(othercase(ch) != ch); /* p_bracket() would recurse */ - p->next = bracket; - p->end = bracket+2; - bracket[0] = ch; - bracket[1] = ']'; - bracket[2] = '\0'; - p_bracket(p); - assert(p->next == bracket+2); - p->next = oldnext; - p->end = oldend; -} - -/* - - ordinary - emit an ordinary character - == static void ordinary(register struct parse *p, register int ch); - */ -static void -ordinary(p, ch) -register struct parse *p; -register int ch; -{ - register cat_t *cap = p->g->categories; - - if ((p->g->cflags®_ICASE) && isalpha(ch) && othercase(ch) != ch) - bothcases(p, ch); - else { - EMIT(OCHAR, (unsigned char)ch); - if (cap[ch] == 0) - cap[ch] = p->g->ncategories++; - } -} - -/* - - nonnewline - emit REG_NEWLINE version of OANY - == static void nonnewline(register struct parse *p); - * - * Boy, is this implementation ever a kludge... - */ -static void -nonnewline(p) -register struct parse *p; -{ - register char *oldnext = p->next; - register char *oldend = p->end; - char bracket[4]; - - p->next = bracket; - p->end = bracket+3; - bracket[0] = '^'; - bracket[1] = '\n'; - bracket[2] = ']'; - bracket[3] = '\0'; - p_bracket(p); - assert(p->next == bracket+3); - p->next = oldnext; - p->end = oldend; -} - -/* - - repeat - generate code for a bounded repetition, recursively if needed - == static void repeat(register struct parse *p, sopno start, int from, int to); - */ -static void -repeat(p, start, from, to) -register struct parse *p; -sopno start; /* operand from here to end of strip */ -int from; /* repeated from this number */ -int to; /* to this number of times (maybe INFINITY) */ -{ - register sopno finish = HERE(); -# define N 2 -# define INF 3 -# define REP(f, t) ((f)*8 + (t)) -# define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N) - register sopno copy; - - if (p->error != 0) /* head off possible runaway recursion */ - return; - - assert(from <= to); - - switch (REP(MAP(from), MAP(to))) { - case REP(0, 0): /* must be user doing this */ - DROP(finish-start); /* drop the operand */ - break; - case REP(0, 1): /* as x{1,1}? */ - case REP(0, N): /* as x{1,n}? */ - case REP(0, INF): /* as x{1,}? */ - /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */ - INSERT(OCH_, start); /* offset is wrong... */ - repeat(p, start+1, 1, to); - ASTERN(OOR1, start); - AHEAD(start); /* ... fix it */ - EMIT(OOR2, 0); - AHEAD(THERE()); - ASTERN(O_CH, THERETHERE()); - break; - case REP(1, 1): /* trivial case */ - /* done */ - break; - case REP(1, N): /* as x?x{1,n-1} */ - /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */ - INSERT(OCH_, start); - ASTERN(OOR1, start); - AHEAD(start); - EMIT(OOR2, 0); /* offset very wrong... */ - AHEAD(THERE()); /* ...so fix it */ - ASTERN(O_CH, THERETHERE()); - copy = dupl(p, start+1, finish+1); - assert(copy == finish+4); - repeat(p, copy, 1, to-1); - break; - case REP(1, INF): /* as x+ */ - INSERT(OPLUS_, start); - ASTERN(O_PLUS, start); - break; - case REP(N, N): /* as xx{m-1,n-1} */ - copy = dupl(p, start, finish); - repeat(p, copy, from-1, to-1); - break; - case REP(N, INF): /* as xx{n-1,INF} */ - copy = dupl(p, start, finish); - repeat(p, copy, from-1, to); - break; - default: /* "can't happen" */ - SETERROR(REG_ASSERT); /* just in case */ - break; - } -} - -/* - - seterr - set an error condition - == static int seterr(register struct parse *p, int e); - */ -static int /* useless but makes type checking happy */ -seterr(p, e) -register struct parse *p; -int e; -{ - if (p->error == 0) /* keep earliest error condition */ - p->error = e; - p->next = nuls; /* try to bring things to a halt */ - p->end = nuls; - return(0); /* make the return value well-defined */ -} - -/* - - allocset - allocate a set of characters for [] - == static cset *allocset(register struct parse *p); - */ -static cset * -allocset(p) -register struct parse *p; -{ - register int no = p->g->ncsets++; - register size_t nc; - register size_t nbytes; - register cset *cs; - register size_t css = (size_t)p->g->csetsize; - register int i; - - if (no >= p->ncsalloc) { /* need another column of space */ - p->ncsalloc += CHAR_BIT; - nc = p->ncsalloc; - assert(nc % CHAR_BIT == 0); - nbytes = nc / CHAR_BIT * css; - if (p->g->sets == NULL) - p->g->sets = (cset *)malloc(nc * sizeof(cset)); - else - p->g->sets = (cset *)realloc((char *)p->g->sets, - nc * sizeof(cset)); - if (p->g->setbits == NULL) - p->g->setbits = (uch *)malloc(nbytes); - else { - p->g->setbits = (uch *)realloc((char *)p->g->setbits, - nbytes); - /* xxx this isn't right if setbits is now NULL */ - for (i = 0; i < no; i++) - p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT); - } - if (p->g->sets != NULL && p->g->setbits != NULL) - (void) memset((char *)p->g->setbits + (nbytes - css), - 0, css); - else { - no = 0; - SETERROR(REG_ESPACE); - /* caller's responsibility not to do set ops */ - } - } - - assert(p->g->sets != NULL); /* xxx */ - cs = &p->g->sets[no]; - cs->ptr = p->g->setbits + css*((no)/CHAR_BIT); - cs->mask = 1 << ((no) % CHAR_BIT); - cs->hash = 0; - cs->smultis = 0; - cs->multis = NULL; - - return(cs); -} - -/* - - freeset - free a now-unused set - == static void freeset(register struct parse *p, register cset *cs); - */ -static void -freeset(p, cs) -register struct parse *p; -register cset *cs; -{ - register size_t i; - register cset *top = &p->g->sets[p->g->ncsets]; - register size_t css = (size_t)p->g->csetsize; - - for (i = 0; i < css; i++) - CHsub(cs, i); - if (cs == top-1) /* recover only the easy case */ - p->g->ncsets--; -} - -/* - - freezeset - final processing on a set of characters - == static int freezeset(register struct parse *p, register cset *cs); - * - * The main task here is merging identical sets. This is usually a waste - * of time (although the hash code minimizes the overhead), but can win - * big if REG_ICASE is being used. REG_ICASE, by the way, is why the hash - * is done using addition rather than xor -- all ASCII [aA] sets xor to - * the same value! - */ -static int /* set number */ -freezeset(p, cs) -register struct parse *p; -register cset *cs; -{ - register uch h = cs->hash; - register size_t i; - register cset *top = &p->g->sets[p->g->ncsets]; - register cset *cs2; - register size_t css = (size_t)p->g->csetsize; - - /* look for an earlier one which is the same */ - for (cs2 = &p->g->sets[0]; cs2 < top; cs2++) - if (cs2->hash == h && cs2 != cs) { - /* maybe */ - for (i = 0; i < css; i++) - if (!!CHIN(cs2, i) != !!CHIN(cs, i)) - break; /* no */ - if (i == css) - break; /* yes */ - } - - if (cs2 < top) { /* found one */ - freeset(p, cs); - cs = cs2; - } - - return((int)(cs - p->g->sets)); -} - -/* - - firstch - return first character in a set (which must have at least one) - == static int firstch(register struct parse *p, register cset *cs); - */ -static int /* character; there is no "none" value */ -firstch(p, cs) -register struct parse *p; -register cset *cs; -{ - register size_t i; - register size_t css = (size_t)p->g->csetsize; - - for (i = 0; i < css; i++) - if (CHIN(cs, i)) - return((char)i); - assert(never); - return(0); /* arbitrary */ -} - -/* - - nch - number of characters in a set - == static int nch(register struct parse *p, register cset *cs); - */ -static int -nch(p, cs) -register struct parse *p; -register cset *cs; -{ - register size_t i; - register size_t css = (size_t)p->g->csetsize; - register int n = 0; - - for (i = 0; i < css; i++) - if (CHIN(cs, i)) - n++; - return(n); -} - -/* - - mcadd - add a collating element to a cset - == static void mcadd(register struct parse *p, register cset *cs, \ - == register char *cp); - */ -static void -mcadd(p, cs, cp) -register struct parse *p; -register cset *cs; -register char *cp; -{ - register size_t oldend = cs->smultis; - - cs->smultis += strlen(cp) + 1; - if (cs->multis == NULL) - cs->multis = malloc(cs->smultis); - else - cs->multis = realloc(cs->multis, cs->smultis); - if (cs->multis == NULL) { - SETERROR(REG_ESPACE); - return; - } - - (void) strcpy(cs->multis + oldend - 1, cp); - cs->multis[cs->smultis - 1] = '\0'; -} - -/* - - mcsub - subtract a collating element from a cset - == static void mcsub(register cset *cs, register char *cp); - */ -static void -mcsub(cs, cp) -register cset *cs; -register char *cp; -{ - register char *fp = mcfind(cs, cp); - register size_t len = strlen(fp); - - assert(fp != NULL); - (void) memmove(fp, fp + len + 1, - cs->smultis - (fp + len + 1 - cs->multis)); - cs->smultis -= len; - - if (cs->smultis == 0) { - free(cs->multis); - cs->multis = NULL; - return; - } - - cs->multis = realloc(cs->multis, cs->smultis); - assert(cs->multis != NULL); -} - -/* - - mcin - is a collating element in a cset? - == static int mcin(register cset *cs, register char *cp); - */ -static int -mcin(cs, cp) -register cset *cs; -register char *cp; -{ - return(mcfind(cs, cp) != NULL); -} - -/* - - mcfind - find a collating element in a cset - == static char *mcfind(register cset *cs, register char *cp); - */ -static char * -mcfind(cs, cp) -register cset *cs; -register char *cp; -{ - register char *p; - - if (cs->multis == NULL) - return(NULL); - for (p = cs->multis; *p != '\0'; p += strlen(p) + 1) - if (strcmp(cp, p) == 0) - return(p); - return(NULL); -} - -/* - - mcinvert - invert the list of collating elements in a cset - == static void mcinvert(register struct parse *p, register cset *cs); - * - * This would have to know the set of possibilities. Implementation - * is deferred. - */ -static void -mcinvert(p, cs) -register struct parse *p; -register cset *cs; -{ - assert(cs->multis == NULL); /* xxx */ -} - -/* - - mccase - add case counterparts of the list of collating elements in a cset - == static void mccase(register struct parse *p, register cset *cs); - * - * This would have to know the set of possibilities. Implementation - * is deferred. - */ -static void -mccase(p, cs) -register struct parse *p; -register cset *cs; -{ - assert(cs->multis == NULL); /* xxx */ -} - -/* - - isinsets - is this character in any sets? - == static int isinsets(register struct re_guts *g, int c); - */ -static int /* predicate */ -isinsets(g, c) -register struct re_guts *g; -int c; -{ - register uch *col; - register int i; - register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT; - register unsigned uc = (unsigned char)c; - - for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize) - if (col[uc] != 0) - return(1); - return(0); -} - -/* - - samesets - are these two characters in exactly the same sets? - == static int samesets(register struct re_guts *g, int c1, int c2); - */ -static int /* predicate */ -samesets(g, c1, c2) -register struct re_guts *g; -int c1; -int c2; -{ - register uch *col; - register int i; - register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT; - register unsigned uc1 = (unsigned char)c1; - register unsigned uc2 = (unsigned char)c2; - - for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize) - if (col[uc1] != col[uc2]) - return(0); - return(1); -} - -/* - - categorize - sort out character categories - == static void categorize(struct parse *p, register struct re_guts *g); - */ -static void -categorize(p, g) -struct parse *p; -register struct re_guts *g; -{ - register cat_t *cats = g->categories; - register int c; - register int c2; - register cat_t cat; - - /* avoid making error situations worse */ - if (p->error != 0) - return; - - for (c = CHAR_MIN; c <= CHAR_MAX; c++) - if (cats[c] == 0 && isinsets(g, c)) { - cat = g->ncategories++; - cats[c] = cat; - for (c2 = c+1; c2 <= CHAR_MAX; c2++) - if (cats[c2] == 0 && samesets(g, c, c2)) - cats[c2] = cat; - } -} - -/* - - dupl - emit a duplicate of a bunch of sops - == static sopno dupl(register struct parse *p, sopno start, sopno finish); - */ -static sopno /* start of duplicate */ -dupl(p, start, finish) -register struct parse *p; -sopno start; /* from here */ -sopno finish; /* to this less one */ -{ - register sopno ret = HERE(); - register sopno len = finish - start; - - assert(finish >= start); - if (len == 0) - return(ret); - enlarge(p, p->ssize + len); /* this many unexpected additions */ - assert(p->ssize >= p->slen + len); - (void) memcpy((char *)(p->strip + p->slen), - (char *)(p->strip + start), (size_t)len*sizeof(sop)); - p->slen += len; - return(ret); -} - -/* - - doemit - emit a strip operator - == static void doemit(register struct parse *p, sop op, size_t opnd); - * - * It might seem better to implement this as a macro with a function as - * hard-case backup, but it's just too big and messy unless there are - * some changes to the data structures. Maybe later. - */ -static void -doemit(p, op, opnd) -register struct parse *p; -sop op; -size_t opnd; -{ - /* avoid making error situations worse */ - if (p->error != 0) - return; - - /* deal with oversize operands ("can't happen", more or less) */ - assert(opnd < 1<slen >= p->ssize) - enlarge(p, (p->ssize+1) / 2 * 3); /* +50% */ - assert(p->slen < p->ssize); - - /* finally, it's all reduced to the easy case */ - p->strip[p->slen++] = SOP(op, opnd); -} - -/* - - doinsert - insert a sop into the strip - == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos); - */ -static void -doinsert(p, op, opnd, pos) -register struct parse *p; -sop op; -size_t opnd; -sopno pos; -{ - register sopno sn; - register sop s; - register int i; - - /* avoid making error situations worse */ - if (p->error != 0) - return; - - sn = HERE(); - EMIT(op, opnd); /* do checks, ensure space */ - assert(HERE() == sn+1); - s = p->strip[sn]; - - /* adjust paren pointers */ - assert(pos > 0); - for (i = 1; i < NPAREN; i++) { - if (p->pbegin[i] >= pos) { - p->pbegin[i]++; - } - if (p->pend[i] >= pos) { - p->pend[i]++; - } - } - - memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos], - (HERE()-pos-1)*sizeof(sop)); - p->strip[pos] = s; -} - -/* - - dofwd - complete a forward reference - == static void dofwd(register struct parse *p, sopno pos, sop value); - */ -static void -dofwd(p, pos, value) -register struct parse *p; -register sopno pos; -sop value; -{ - /* avoid making error situations worse */ - if (p->error != 0) - return; - - assert(value < 1<strip[pos] = OP(p->strip[pos]) | value; -} - -/* - - enlarge - enlarge the strip - == static void enlarge(register struct parse *p, sopno size); - */ -static void -enlarge(p, size) -register struct parse *p; -register sopno size; -{ - register sop *sp; - - if (p->ssize >= size) - return; - - sp = (sop *)realloc(p->strip, size*sizeof(sop)); - if (sp == NULL) { - SETERROR(REG_ESPACE); - return; - } - p->strip = sp; - p->ssize = size; -} - -/* - - stripsnug - compact the strip - == static void stripsnug(register struct parse *p, register struct re_guts *g); - */ -static void -stripsnug(p, g) -register struct parse *p; -register struct re_guts *g; -{ - g->nstates = p->slen; - g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop)); - if (g->strip == NULL) { - SETERROR(REG_ESPACE); - g->strip = p->strip; - } -} - -/* - - findmust - fill in must and mlen with longest mandatory literal string - == static void findmust(register struct parse *p, register struct re_guts *g); - * - * This algorithm could do fancy things like analyzing the operands of | - * for common subsequences. Someday. This code is simple and finds most - * of the interesting cases. - * - * Note that must and mlen got initialized during setup. - */ -static void -findmust(p, g) -struct parse *p; -register struct re_guts *g; -{ - register sop *scan; - sop *start = NULL; - register sop *newstart = NULL; - register sopno newlen; - register sop s; - register char *cp; - register sopno i; - - /* avoid making error situations worse */ - if (p->error != 0) - return; - - /* find the longest OCHAR sequence in strip */ - newlen = 0; - scan = g->strip + 1; - do { - s = *scan++; - switch (OP(s)) { - case OCHAR: /* sequence member */ - if (newlen == 0) /* new sequence */ - newstart = scan - 1; - newlen++; - break; - case OPLUS_: /* things that don't break one */ - case OLPAREN: - case ORPAREN: - break; - case OQUEST_: /* things that must be skipped */ - case OCH_: - scan--; - do { - scan += OPND(s); - s = *scan; - /* assert() interferes w debug printouts */ - if (OP(s) != O_QUEST && OP(s) != O_CH && - OP(s) != OOR2) { - g->iflags |= BAD; - return; - } - } while (OP(s) != O_QUEST && OP(s) != O_CH); - /* fallthrough */ - default: /* things that break a sequence */ - if (newlen > g->mlen) { /* ends one */ - start = newstart; - g->mlen = newlen; - } - newlen = 0; - break; - } - } while (OP(s) != OEND); - - if (g->mlen == 0) /* there isn't one */ - return; - - /* turn it into a character string */ - g->must = malloc((size_t)g->mlen + 1); - if (g->must == NULL) { /* argh; just forget it */ - g->mlen = 0; - return; - } - cp = g->must; - scan = start; - for (i = g->mlen; i > 0; i--) { - while (OP(s = *scan++) != OCHAR) - continue; - assert(cp < g->must + g->mlen); - *cp++ = (char)OPND(s); - } - assert(cp == g->must + g->mlen); - *cp++ = '\0'; /* just on general principles */ -} - -/* - - pluscount - count + nesting - == static sopno pluscount(register struct parse *p, register struct re_guts *g); - */ -static sopno /* nesting depth */ -pluscount(p, g) -struct parse *p; -register struct re_guts *g; -{ - register sop *scan; - register sop s; - register sopno plusnest = 0; - register sopno maxnest = 0; - - if (p->error != 0) - return(0); /* there may not be an OEND */ - - scan = g->strip + 1; - do { - s = *scan++; - switch (OP(s)) { - case OPLUS_: - plusnest++; - break; - case O_PLUS: - if (plusnest > maxnest) - maxnest = plusnest; - plusnest--; - break; - } - } while (OP(s) != OEND); - if (plusnest != 0) - g->iflags |= BAD; - return(maxnest); -} diff --git a/ext/ereg/regex/regcomp.ih b/ext/ereg/regex/regcomp.ih deleted file mode 100644 index 0776e7185cd97..0000000000000 --- a/ext/ereg/regex/regcomp.ih +++ /dev/null @@ -1,51 +0,0 @@ -/* ========= begin header generated by ./mkh ========= */ -#ifdef __cplusplus -extern "C" { -#endif - -/* === regcomp.c === */ -static void p_ere(register struct parse *p, int stop); -static void p_ere_exp(register struct parse *p); -static void p_str(register struct parse *p); -static void p_bre(register struct parse *p, register int end1, register int end2); -static int p_simp_re(register struct parse *p, int starordinary); -static int p_count(register struct parse *p); -static void p_bracket(register struct parse *p); -static void p_b_term(register struct parse *p, register cset *cs); -static void p_b_cclass(register struct parse *p, register cset *cs); -static void p_b_eclass(register struct parse *p, register cset *cs); -static char p_b_symbol(register struct parse *p); -static char p_b_coll_elem(register struct parse *p, int endc); -static char othercase(int ch); -static void bothcases(register struct parse *p, int ch); -static void ordinary(register struct parse *p, register int ch); -static void nonnewline(register struct parse *p); -static void repeat(register struct parse *p, sopno start, int from, int to); -static int seterr(register struct parse *p, int e); -static cset *allocset(register struct parse *p); -static void freeset(register struct parse *p, register cset *cs); -static int freezeset(register struct parse *p, register cset *cs); -static int firstch(register struct parse *p, register cset *cs); -static int nch(register struct parse *p, register cset *cs); -static void mcadd(register struct parse *p, register cset *cs, register char *cp); -static void mcsub(register cset *cs, register char *cp); -static int mcin(register cset *cs, register char *cp); -static char *mcfind(register cset *cs, register char *cp); -static void mcinvert(register struct parse *p, register cset *cs); -static void mccase(register struct parse *p, register cset *cs); -static int isinsets(register struct re_guts *g, int c); -static int samesets(register struct re_guts *g, int c1, int c2); -static void categorize(struct parse *p, register struct re_guts *g); -static sopno dupl(register struct parse *p, sopno start, sopno finish); -static void doemit(register struct parse *p, sop op, size_t opnd); -static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos); -static void dofwd(register struct parse *p, sopno pos, sop value); -static void enlarge(register struct parse *p, sopno size); -static void stripsnug(register struct parse *p, register struct re_guts *g); -static void findmust(register struct parse *p, register struct re_guts *g); -static sopno pluscount(register struct parse *p, register struct re_guts *g); - -#ifdef __cplusplus -} -#endif -/* ========= end header generated by ./mkh ========= */ diff --git a/ext/ereg/regex/regerror.c b/ext/ereg/regex/regerror.c deleted file mode 100644 index 9158870322d81..0000000000000 --- a/ext/ereg/regex/regerror.c +++ /dev/null @@ -1,126 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "utils.h" -#include "regerror.ih" - -/* - = #define REG_OKAY 0 - = #define REG_NOMATCH 1 - = #define REG_BADPAT 2 - = #define REG_ECOLLATE 3 - = #define REG_ECTYPE 4 - = #define REG_EESCAPE 5 - = #define REG_ESUBREG 6 - = #define REG_EBRACK 7 - = #define REG_EPAREN 8 - = #define REG_EBRACE 9 - = #define REG_BADBR 10 - = #define REG_ERANGE 11 - = #define REG_ESPACE 12 - = #define REG_BADRPT 13 - = #define REG_EMPTY 14 - = #define REG_ASSERT 15 - = #define REG_INVARG 16 - = #define REG_ATOI 255 // convert name to number (!) - = #define REG_ITOA 0400 // convert number to name (!) - */ -static struct rerr { - int code; - char *name; - char *explain; -} rerrs[] = { - REG_OKAY, "REG_OKAY", "no errors detected", - REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match", - REG_BADPAT, "REG_BADPAT", "invalid regular expression", - REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element", - REG_ECTYPE, "REG_ECTYPE", "invalid character class", - REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)", - REG_ESUBREG, "REG_ESUBREG", "invalid backreference number", - REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced", - REG_EPAREN, "REG_EPAREN", "parentheses not balanced", - REG_EBRACE, "REG_EBRACE", "braces not balanced", - REG_BADBR, "REG_BADBR", "invalid repetition count(s)", - REG_ERANGE, "REG_ERANGE", "invalid character range", - REG_ESPACE, "REG_ESPACE", "out of memory", - REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid", - REG_EMPTY, "REG_EMPTY", "empty (sub)expression", - REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug", - REG_INVARG, "REG_INVARG", "invalid argument to regex routine", - -1, "", "*** unknown regexp error code ***", -}; - -/* - - regerror - the interface to error numbers - = API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t); - */ -/* ARGSUSED */ -API_EXPORT(size_t) -regerror(errcode, preg, errbuf, errbuf_size) -int errcode; -const regex_t *preg; -char *errbuf; -size_t errbuf_size; -{ - register struct rerr *r; - register size_t len; - register int target = errcode &~ REG_ITOA; - register char *s; - char convbuf[50]; - - if (errcode == REG_ATOI) - s = regatoi(preg, convbuf); - else { - for (r = rerrs; r->code >= 0; r++) - if (r->code == target) - break; - - if (errcode®_ITOA) { - if (r->code >= 0) - (void) strcpy(convbuf, r->name); - else - sprintf(convbuf, "REG_0x%x", target); - assert(strlen(convbuf) < sizeof(convbuf)); - s = convbuf; - } else - s = r->explain; - } - - len = strlen(s) + 1; - if (errbuf_size > 0) { - if (errbuf_size > len) - (void) strcpy(errbuf, s); - else { - (void) strncpy(errbuf, s, errbuf_size-1); - errbuf[errbuf_size-1] = '\0'; - } - } - - return(len); -} - -/* - - regatoi - internal routine to implement REG_ATOI - == static char *regatoi(const regex_t *preg, char *localbuf); - */ -static char * -regatoi(preg, localbuf) -const regex_t *preg; -char *localbuf; -{ - register struct rerr *r; - - for (r = rerrs; r->code >= 0; r++) - if (strcmp(r->name, preg->re_endp) == 0) - break; - if (r->code < 0) - return("0"); - - sprintf(localbuf, "%d", r->code); - return(localbuf); -} diff --git a/ext/ereg/regex/regerror.ih b/ext/ereg/regex/regerror.ih deleted file mode 100644 index 2cb668c24f07e..0000000000000 --- a/ext/ereg/regex/regerror.ih +++ /dev/null @@ -1,12 +0,0 @@ -/* ========= begin header generated by ./mkh ========= */ -#ifdef __cplusplus -extern "C" { -#endif - -/* === regerror.c === */ -static char *regatoi(const regex_t *preg, char *localbuf); - -#ifdef __cplusplus -} -#endif -/* ========= end header generated by ./mkh ========= */ diff --git a/ext/ereg/regex/regex.3 b/ext/ereg/regex/regex.3 deleted file mode 100644 index 100c8a7f71c72..0000000000000 --- a/ext/ereg/regex/regex.3 +++ /dev/null @@ -1,502 +0,0 @@ -.TH REGEX 3 "17 May 1993" -.BY "Henry Spencer" -.de ZR -.\" one other place knows this name: the SEE ALSO section -.IR regex (7) \\$1 -.. -.SH NAME -regcomp, regexec, regerror, regfree \- regular-expression library -.SH SYNOPSIS -.ft B -.\".na -#include -.br -#include -.HP 10 -int regcomp(regex_t\ *preg, const\ char\ *pattern, int\ cflags); -.HP -int\ regexec(const\ regex_t\ *preg, const\ char\ *string, -size_t\ nmatch, regmatch_t\ pmatch[], int\ eflags); -.HP -size_t\ regerror(int\ errcode, const\ regex_t\ *preg, -char\ *errbuf, size_t\ errbuf_size); -.HP -void\ regfree(regex_t\ *preg); -.\".ad -.ft -.SH DESCRIPTION -These routines implement POSIX 1003.2 regular expressions (``RE''s); -see -.ZR . -.I Regcomp -compiles an RE written as a string into an internal form, -.I regexec -matches that internal form against a string and reports results, -.I regerror -transforms error codes from either into human-readable messages, -and -.I regfree -frees any dynamically-allocated storage used by the internal form -of an RE. -.PP -The header -.I -declares two structure types, -.I regex_t -and -.IR regmatch_t , -the former for compiled internal forms and the latter for match reporting. -It also declares the four functions, -a type -.IR regoff_t , -and a number of constants with names starting with ``REG_''. -.PP -.I Regcomp -compiles the regular expression contained in the -.I pattern -string, -subject to the flags in -.IR cflags , -and places the results in the -.I regex_t -structure pointed to by -.IR preg . -.I Cflags -is the bitwise OR of zero or more of the following flags: -.IP REG_EXTENDED \w'REG_EXTENDED'u+2n -Compile modern (``extended'') REs, -rather than the obsolete (``basic'') REs that -are the default. -.IP REG_BASIC -This is a synonym for 0, -provided as a counterpart to REG_EXTENDED to improve readability. -.IP REG_NOSPEC -Compile with recognition of all special characters turned off. -All characters are thus considered ordinary, -so the ``RE'' is a literal string. -This is an extension, -compatible with but not specified by POSIX 1003.2, -and should be used with -caution in software intended to be portable to other systems. -REG_EXTENDED and REG_NOSPEC may not be used -in the same call to -.IR regcomp . -.IP REG_ICASE -Compile for matching that ignores upper/lower case distinctions. -See -.ZR . -.IP REG_NOSUB -Compile for matching that need only report success or failure, -not what was matched. -.IP REG_NEWLINE -Compile for newline-sensitive matching. -By default, newline is a completely ordinary character with no special -meaning in either REs or strings. -With this flag, -`[^' bracket expressions and `.' never match newline, -a `^' anchor matches the null string after any newline in the string -in addition to its normal function, -and the `$' anchor matches the null string before any newline in the -string in addition to its normal function. -.IP REG_PEND -The regular expression ends, -not at the first NUL, -but just before the character pointed to by the -.I re_endp -member of the structure pointed to by -.IR preg . -The -.I re_endp -member is of type -.IR const\ char\ * . -This flag permits inclusion of NULs in the RE; -they are considered ordinary characters. -This is an extension, -compatible with but not specified by POSIX 1003.2, -and should be used with -caution in software intended to be portable to other systems. -.PP -When successful, -.I regcomp -returns 0 and fills in the structure pointed to by -.IR preg . -One member of that structure -(other than -.IR re_endp ) -is publicized: -.IR re_nsub , -of type -.IR size_t , -contains the number of parenthesized subexpressions within the RE -(except that the value of this member is undefined if the -REG_NOSUB flag was used). -If -.I regcomp -fails, it returns a non-zero error code; -see DIAGNOSTICS. -.PP -.I Regexec -matches the compiled RE pointed to by -.I preg -against the -.IR string , -subject to the flags in -.IR eflags , -and reports results using -.IR nmatch , -.IR pmatch , -and the returned value. -The RE must have been compiled by a previous invocation of -.IR regcomp . -The compiled form is not altered during execution of -.IR regexec , -so a single compiled RE can be used simultaneously by multiple threads. -.PP -By default, -the NUL-terminated string pointed to by -.I string -is considered to be the text of an entire line, minus any terminating -newline. -The -.I eflags -argument is the bitwise OR of zero or more of the following flags: -.IP REG_NOTBOL \w'REG_STARTEND'u+2n -The first character of -the string -is not the beginning of a line, so the `^' anchor should not match before it. -This does not affect the behavior of newlines under REG_NEWLINE. -.IP REG_NOTEOL -The NUL terminating -the string -does not end a line, so the `$' anchor should not match before it. -This does not affect the behavior of newlines under REG_NEWLINE. -.IP REG_STARTEND -The string is considered to start at -\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_so\fR -and to have a terminating NUL located at -\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_eo\fR -(there need not actually be a NUL at that location), -regardless of the value of -.IR nmatch . -See below for the definition of -.IR pmatch -and -.IR nmatch . -This is an extension, -compatible with but not specified by POSIX 1003.2, -and should be used with -caution in software intended to be portable to other systems. -Note that a non-zero \fIrm_so\fR does not imply REG_NOTBOL; -REG_STARTEND affects only the location of the string, -not how it is matched. -.PP -See -.ZR -for a discussion of what is matched in situations where an RE or a -portion thereof could match any of several substrings of -.IR string . -.PP -Normally, -.I regexec -returns 0 for success and the non-zero code REG_NOMATCH for failure. -Other non-zero error codes may be returned in exceptional situations; -see DIAGNOSTICS. -.PP -If REG_NOSUB was specified in the compilation of the RE, -or if -.I nmatch -is 0, -.I regexec -ignores the -.I pmatch -argument (but see below for the case where REG_STARTEND is specified). -Otherwise, -.I pmatch -points to an array of -.I nmatch -structures of type -.IR regmatch_t . -Such a structure has at least the members -.I rm_so -and -.IR rm_eo , -both of type -.I regoff_t -(a signed arithmetic type at least as large as an -.I off_t -and a -.IR ssize_t ), -containing respectively the offset of the first character of a substring -and the offset of the first character after the end of the substring. -Offsets are measured from the beginning of the -.I string -argument given to -.IR regexec . -An empty substring is denoted by equal offsets, -both indicating the character following the empty substring. -.PP -The 0th member of the -.I pmatch -array is filled in to indicate what substring of -.I string -was matched by the entire RE. -Remaining members report what substring was matched by parenthesized -subexpressions within the RE; -member -.I i -reports subexpression -.IR i , -with subexpressions counted (starting at 1) by the order of their opening -parentheses in the RE, left to right. -Unused entries in the array\(emcorresponding either to subexpressions that -did not participate in the match at all, or to subexpressions that do not -exist in the RE (that is, \fIi\fR\ > \fIpreg\fR\->\fIre_nsub\fR)\(emhave both -.I rm_so -and -.I rm_eo -set to \-1. -If a subexpression participated in the match several times, -the reported substring is the last one it matched. -(Note, as an example in particular, that when the RE `(b*)+' matches `bbb', -the parenthesized subexpression matches each of the three `b's and then -an infinite number of empty strings following the last `b', -so the reported substring is one of the empties.) -.PP -If REG_STARTEND is specified, -.I pmatch -must point to at least one -.I regmatch_t -(even if -.I nmatch -is 0 or REG_NOSUB was specified), -to hold the input offsets for REG_STARTEND. -Use for output is still entirely controlled by -.IR nmatch ; -if -.I nmatch -is 0 or REG_NOSUB was specified, -the value of -.IR pmatch [0] -will not be changed by a successful -.IR regexec . -.PP -.I Regerror -maps a non-zero -.I errcode -from either -.I regcomp -or -.I regexec -to a human-readable, printable message. -If -.I preg -is non-NULL, -the error code should have arisen from use of -the -.I regex_t -pointed to by -.IR preg , -and if the error code came from -.IR regcomp , -it should have been the result from the most recent -.I regcomp -using that -.IR regex_t . -.RI ( Regerror -may be able to supply a more detailed message using information -from the -.IR regex_t .) -.I Regerror -places the NUL-terminated message into the buffer pointed to by -.IR errbuf , -limiting the length (including the NUL) to at most -.I errbuf_size -bytes. -If the whole message won't fit, -as much of it as will fit before the terminating NUL is supplied. -In any case, -the returned value is the size of buffer needed to hold the whole -message (including terminating NUL). -If -.I errbuf_size -is 0, -.I errbuf -is ignored but the return value is still correct. -.PP -If the -.I errcode -given to -.I regerror -is first ORed with REG_ITOA, -the ``message'' that results is the printable name of the error code, -e.g. ``REG_NOMATCH'', -rather than an explanation thereof. -If -.I errcode -is REG_ATOI, -then -.I preg -shall be non-NULL and the -.I re_endp -member of the structure it points to -must point to the printable name of an error code; -in this case, the result in -.I errbuf -is the decimal digits of -the numeric value of the error code -(0 if the name is not recognized). -REG_ITOA and REG_ATOI are intended primarily as debugging facilities; -they are extensions, -compatible with but not specified by POSIX 1003.2, -and should be used with -caution in software intended to be portable to other systems. -Be warned also that they are considered experimental and changes are possible. -.PP -.I Regfree -frees any dynamically-allocated storage associated with the compiled RE -pointed to by -.IR preg . -The remaining -.I regex_t -is no longer a valid compiled RE -and the effect of supplying it to -.I regexec -or -.I regerror -is undefined. -.PP -None of these functions references global variables except for tables -of constants; -all are safe for use from multiple threads if the arguments are safe. -.SH IMPLEMENTATION CHOICES -There are a number of decisions that 1003.2 leaves up to the implementor, -either by explicitly saying ``undefined'' or by virtue of them being -forbidden by the RE grammar. -This implementation treats them as follows. -.PP -See -.ZR -for a discussion of the definition of case-independent matching. -.PP -There is no particular limit on the length of REs, -except insofar as memory is limited. -Memory usage is approximately linear in RE size, and largely insensitive -to RE complexity, except for bounded repetitions. -See BUGS for one short RE using them -that will run almost any system out of memory. -.PP -A backslashed character other than one specifically given a magic meaning -by 1003.2 (such magic meanings occur only in obsolete [``basic''] REs) -is taken as an ordinary character. -.PP -Any unmatched [ is a REG_EBRACK error. -.PP -Equivalence classes cannot begin or end bracket-expression ranges. -The endpoint of one range cannot begin another. -.PP -RE_DUP_MAX, the limit on repetition counts in bounded repetitions, is 255. -.PP -A repetition operator (?, *, +, or bounds) cannot follow another -repetition operator. -A repetition operator cannot begin an expression or subexpression -or follow `^' or `|'. -.PP -`|' cannot appear first or last in a (sub)expression or after another `|', -i.e. an operand of `|' cannot be an empty subexpression. -An empty parenthesized subexpression, `()', is legal and matches an -empty (sub)string. -An empty string is not a legal RE. -.PP -A `{' followed by a digit is considered the beginning of bounds for a -bounded repetition, which must then follow the syntax for bounds. -A `{' \fInot\fR followed by a digit is considered an ordinary character. -.PP -`^' and `$' beginning and ending subexpressions in obsolete (``basic'') -REs are anchors, not ordinary characters. -.SH SEE ALSO -grep(1), regex(7) -.PP -POSIX 1003.2, sections 2.8 (Regular Expression Notation) -and -B.5 (C Binding for Regular Expression Matching). -.SH DIAGNOSTICS -Non-zero error codes from -.I regcomp -and -.I regexec -include the following: -.PP -.nf -.ta \w'REG_ECOLLATE'u+3n -REG_NOMATCH regexec() failed to match -REG_BADPAT invalid regular expression -REG_ECOLLATE invalid collating element -REG_ECTYPE invalid character class -REG_EESCAPE \e applied to unescapable character -REG_ESUBREG invalid backreference number -REG_EBRACK brackets [ ] not balanced -REG_EPAREN parentheses ( ) not balanced -REG_EBRACE braces { } not balanced -REG_BADBR invalid repetition count(s) in { } -REG_ERANGE invalid character range in [ ] -REG_ESPACE ran out of memory -REG_BADRPT ?, *, or + operand invalid -REG_EMPTY empty (sub)expression -REG_ASSERT ``can't happen''\(emyou found a bug -REG_INVARG invalid argument, e.g. negative-length string -.fi -.SH HISTORY -Written by Henry Spencer at University of Toronto, -henry@zoo.toronto.edu. -.SH BUGS -This is an alpha release with known defects. -Please report problems. -.PP -There is one known functionality bug. -The implementation of internationalization is incomplete: -the locale is always assumed to be the default one of 1003.2, -and only the collating elements etc. of that locale are available. -.PP -The back-reference code is subtle and doubts linger about its correctness -in complex cases. -.PP -.I Regexec -performance is poor. -This will improve with later releases. -.I Nmatch -exceeding 0 is expensive; -.I nmatch -exceeding 1 is worse. -.I Regexec -is largely insensitive to RE complexity \fIexcept\fR that back -references are massively expensive. -RE length does matter; in particular, there is a strong speed bonus -for keeping RE length under about 30 characters, -with most special characters counting roughly double. -.PP -.I Regcomp -implements bounded repetitions by macro expansion, -which is costly in time and space if counts are large -or bounded repetitions are nested. -An RE like, say, -`((((a{1,100}){1,100}){1,100}){1,100}){1,100}' -will (eventually) run almost any existing machine out of swap space. -.PP -There are suspected problems with response to obscure error conditions. -Notably, -certain kinds of internal overflow, -produced only by truly enormous REs or by multiply nested bounded repetitions, -are probably not handled well. -.PP -Due to a mistake in 1003.2, things like `a)b' are legal REs because `)' is -a special character only in the presence of a previous unmatched `('. -This can't be fixed until the spec is fixed. -.PP -The standard's definition of back references is vague. -For example, does -`a\e(\e(b\e)*\e2\e)*d' match `abbbd'? -Until the standard is clarified, -behavior in such cases should not be relied on. -.PP -The implementation of word-boundary matching is a bit of a kludge, -and bugs may lurk in combinations of word-boundary matching and anchoring. diff --git a/ext/ereg/regex/regex.7 b/ext/ereg/regex/regex.7 deleted file mode 100644 index d89012bda1dcd..0000000000000 --- a/ext/ereg/regex/regex.7 +++ /dev/null @@ -1,233 +0,0 @@ -.TH REGEX 7 "7 Feb 1994" -.BY "Henry Spencer" -.SH NAME -regex \- POSIX 1003.2 regular expressions -.SH DESCRIPTION -Regular expressions (``RE''s), -as defined in POSIX 1003.2, come in two forms: -modern REs (roughly those of -.IR egrep ; -1003.2 calls these ``extended'' REs) -and obsolete REs (roughly those of -.IR ed ; -1003.2 ``basic'' REs). -Obsolete REs mostly exist for backward compatibility in some old programs; -they will be discussed at the end. -1003.2 leaves some aspects of RE syntax and semantics open; -`\(dg' marks decisions on these aspects that -may not be fully portable to other 1003.2 implementations. -.PP -A (modern) RE is one\(dg or more non-empty\(dg \fIbranches\fR, -separated by `|'. -It matches anything that matches one of the branches. -.PP -A branch is one\(dg or more \fIpieces\fR, concatenated. -It matches a match for the first, followed by a match for the second, etc. -.PP -A piece is an \fIatom\fR possibly followed -by a single\(dg `*', `+', `?', or \fIbound\fR. -An atom followed by `*' matches a sequence of 0 or more matches of the atom. -An atom followed by `+' matches a sequence of 1 or more matches of the atom. -An atom followed by `?' matches a sequence of 0 or 1 matches of the atom. -.PP -A \fIbound\fR is `{' followed by an unsigned decimal integer, -possibly followed by `,' -possibly followed by another unsigned decimal integer, -always followed by `}'. -The integers must lie between 0 and RE_DUP_MAX (255\(dg) inclusive, -and if there are two of them, the first may not exceed the second. -An atom followed by a bound containing one integer \fIi\fR -and no comma matches -a sequence of exactly \fIi\fR matches of the atom. -An atom followed by a bound -containing one integer \fIi\fR and a comma matches -a sequence of \fIi\fR or more matches of the atom. -An atom followed by a bound -containing two integers \fIi\fR and \fIj\fR matches -a sequence of \fIi\fR through \fIj\fR (inclusive) matches of the atom. -.PP -An atom is a regular expression enclosed in `()' (matching a match for the -regular expression), -an empty set of `()' (matching the null string)\(dg, -a \fIbracket expression\fR (see below), `.' -(matching any single character), `^' (matching the null string at the -beginning of a line), `$' (matching the null string at the -end of a line), a `\e' followed by one of the characters -`^.[$()|*+?{\e' -(matching that character taken as an ordinary character), -a `\e' followed by any other character\(dg -(matching that character taken as an ordinary character, -as if the `\e' had not been present\(dg), -or a single character with no other significance (matching that character). -A `{' followed by a character other than a digit is an ordinary -character, not the beginning of a bound\(dg. -It is illegal to end an RE with `\e'. -.PP -A \fIbracket expression\fR is a list of characters enclosed in `[]'. -It normally matches any single character from the list (but see below). -If the list begins with `^', -it matches any single character -(but see below) \fInot\fR from the rest of the list. -If two characters in the list are separated by `\-', this is shorthand -for the full \fIrange\fR of characters between those two (inclusive) in the -collating sequence, -e.g. `[0-9]' in ASCII matches any decimal digit. -It is illegal\(dg for two ranges to share an -endpoint, e.g. `a-c-e'. -Ranges are very collating-sequence-dependent, -and portable programs should avoid relying on them. -.PP -To include a literal `]' in the list, make it the first character -(following a possible `^'). -To include a literal `\-', make it the first or last character, -or the second endpoint of a range. -To use a literal `\-' as the first endpoint of a range, -enclose it in `[.' and `.]' to make it a collating element (see below). -With the exception of these and some combinations using `[' (see next -paragraphs), all other special characters, including `\e', lose their -special significance within a bracket expression. -.PP -Within a bracket expression, a collating element (a character, -a multi-character sequence that collates as if it were a single character, -or a collating-sequence name for either) -enclosed in `[.' and `.]' stands for the -sequence of characters of that collating element. -The sequence is a single element of the bracket expression's list. -A bracket expression containing a multi-character collating element -can thus match more than one character, -e.g. if the collating sequence includes a `ch' collating element, -then the RE `[[.ch.]]*c' matches the first five characters -of `chchcc'. -.PP -Within a bracket expression, a collating element enclosed in `[=' and -`=]' is an equivalence class, standing for the sequences of characters -of all collating elements equivalent to that one, including itself. -(If there are no other equivalent collating elements, -the treatment is as if the enclosing delimiters were `[.' and `.]'.) -For example, if o and \o'o^' are the members of an equivalence class, -then `[[=o=]]', `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous. -An equivalence class may not\(dg be an endpoint -of a range. -.PP -Within a bracket expression, the name of a \fIcharacter class\fR enclosed -in `[:' and `:]' stands for the list of all characters belonging to that -class. -Standard character class names are: -.PP -.RS -.nf -.ta 3c 6c 9c -alnum digit punct -alpha graph space -blank lower upper -cntrl print xdigit -.fi -.RE -.PP -These stand for the character classes defined in -.IR ctype (3). -A locale may provide others. -A character class may not be used as an endpoint of a range. -.PP -There are two special cases\(dg of bracket expressions: -the bracket expressions `[[:<:]]' and `[[:>:]]' match the null string at -the beginning and end of a word respectively. -A word is defined as a sequence of -word characters -which is neither preceded nor followed by -word characters. -A word character is an -.I alnum -character (as defined by -.IR ctype (3)) -or an underscore. -This is an extension, -compatible with but not specified by POSIX 1003.2, -and should be used with -caution in software intended to be portable to other systems. -.PP -In the event that an RE could match more than one substring of a given -string, -the RE matches the one starting earliest in the string. -If the RE could match more than one substring starting at that point, -it matches the longest. -Subexpressions also match the longest possible substrings, subject to -the constraint that the whole match be as long as possible, -with subexpressions starting earlier in the RE taking priority over -ones starting later. -Note that higher-level subexpressions thus take priority over -their lower-level component subexpressions. -.PP -Match lengths are measured in characters, not collating elements. -A null string is considered longer than no match at all. -For example, -`bb*' matches the three middle characters of `abbbc', -`(wee|week)(knights|nights)' matches all ten characters of `weeknights', -when `(.*).*' is matched against `abc' the parenthesized subexpression -matches all three characters, and -when `(a*)*' is matched against `bc' both the whole RE and the parenthesized -subexpression match the null string. -.PP -If case-independent matching is specified, -the effect is much as if all case distinctions had vanished from the -alphabet. -When an alphabetic that exists in multiple cases appears as an -ordinary character outside a bracket expression, it is effectively -transformed into a bracket expression containing both cases, -e.g. `x' becomes `[xX]'. -When it appears inside a bracket expression, all case counterparts -of it are added to the bracket expression, so that (e.g.) `[x]' -becomes `[xX]' and `[^x]' becomes `[^xX]'. -.PP -No particular limit is imposed on the length of REs\(dg. -Programs intended to be portable should not employ REs longer -than 256 bytes, -as an implementation can refuse to accept such REs and remain -POSIX-compliant. -.PP -Obsolete (``basic'') regular expressions differ in several respects. -`|', `+', and `?' are ordinary characters and there is no equivalent -for their functionality. -The delimiters for bounds are `\e{' and `\e}', -with `{' and `}' by themselves ordinary characters. -The parentheses for nested subexpressions are `\e(' and `\e)', -with `(' and `)' by themselves ordinary characters. -`^' is an ordinary character except at the beginning of the -RE or\(dg the beginning of a parenthesized subexpression, -`$' is an ordinary character except at the end of the -RE or\(dg the end of a parenthesized subexpression, -and `*' is an ordinary character if it appears at the beginning of the -RE or the beginning of a parenthesized subexpression -(after a possible leading `^'). -Finally, there is one new type of atom, a \fIback reference\fR: -`\e' followed by a non-zero decimal digit \fId\fR -matches the same sequence of characters -matched by the \fId\fRth parenthesized subexpression -(numbering subexpressions by the positions of their opening parentheses, -left to right), -so that (e.g.) `\e([bc]\e)\e1' matches `bb' or `cc' but not `bc'. -.SH SEE ALSO -regex(3) -.PP -POSIX 1003.2, section 2.8 (Regular Expression Notation). -.SH BUGS -Having two kinds of REs is a botch. -.PP -The current 1003.2 spec says that `)' is an ordinary character in -the absence of an unmatched `('; -this was an unintentional result of a wording error, -and change is likely. -Avoid relying on it. -.PP -Back references are a dreadful botch, -posing major problems for efficient implementations. -They are also somewhat vaguely defined -(does -`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?). -Avoid using them. -.PP -1003.2's specification of case-independent matching is vague. -The ``one case implies all cases'' definition given above -is current consensus among implementors as to the right interpretation. -.PP -The syntax for word boundaries is incredibly ugly. diff --git a/ext/ereg/regex/regex.dsp b/ext/ereg/regex/regex.dsp deleted file mode 100644 index e8f1ad42995e4..0000000000000 --- a/ext/ereg/regex/regex.dsp +++ /dev/null @@ -1,106 +0,0 @@ -# Microsoft Developer Studio Project File - Name="regex" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=regex - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "regex.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "regex - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "regex - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "regex - Win32 Release" -# Name "regex - Win32 Debug" -# Begin Source File - -SOURCE=.\regcomp.c -# End Source File -# Begin Source File - -SOURCE=.\regerror.c -# End Source File -# Begin Source File - -SOURCE=.\regexec.c -# End Source File -# Begin Source File - -SOURCE=.\regfree.c -# End Source File -# End Target -# End Project diff --git a/ext/ereg/regex/regex.dsw b/ext/ereg/regex/regex.dsw deleted file mode 100644 index 7b7df8126c4b5..0000000000000 --- a/ext/ereg/regex/regex.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 5.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "regex"=.\regex.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/ext/ereg/regex/regex.h b/ext/ereg/regex/regex.h deleted file mode 100644 index b39c5e178c6b7..0000000000000 --- a/ext/ereg/regex/regex.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef _HSREGEX_H_ -#define _HSREGEX_H_ -#ifndef _HSREGEX_H -#define _HSREGEX_H /* never again */ -/* ========= begin header generated by ././mkh ========= */ -#ifdef __cplusplus -extern "C" { -#endif - -/* === regex2.h === */ -#ifdef WIN32 -#define API_EXPORT(type) __declspec(dllexport) type __stdcall -#else -#define API_EXPORT(type) type -#endif - -typedef off_t regoff_t; -typedef struct { - int re_magic; - size_t re_nsub; /* number of parenthesized subexpressions */ - const char *re_endp; /* end pointer for REG_PEND */ - struct re_guts *re_g; /* none of your business :-) */ -} regex_t; -typedef struct { - regoff_t rm_so; /* start of match */ - regoff_t rm_eo; /* end of match */ -} regmatch_t; - - -/* === regcomp.c === */ -API_EXPORT(int) regcomp(regex_t *, const char *, int); -#define REG_BASIC 0000 -#define REG_EXTENDED 0001 -#define REG_ICASE 0002 -#define REG_NOSUB 0004 -#define REG_NEWLINE 0010 -#define REG_NOSPEC 0020 -#define REG_PEND 0040 -#define REG_DUMP 0200 - - -/* === regerror.c === */ -#define REG_OKAY 0 -#define REG_NOMATCH 1 -#define REG_BADPAT 2 -#define REG_ECOLLATE 3 -#define REG_ECTYPE 4 -#define REG_EESCAPE 5 -#define REG_ESUBREG 6 -#define REG_EBRACK 7 -#define REG_EPAREN 8 -#define REG_EBRACE 9 -#define REG_BADBR 10 -#define REG_ERANGE 11 -#define REG_ESPACE 12 -#define REG_BADRPT 13 -#define REG_EMPTY 14 -#define REG_ASSERT 15 -#define REG_INVARG 16 -#define REG_ATOI 255 /* convert name to number (!) */ -#define REG_ITOA 0400 /* convert number to name (!) */ -API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t); - - -/* === regexec.c === */ -API_EXPORT(int) regexec(const regex_t *, const char *, size_t, regmatch_t [], int); -#define REG_NOTBOL 00001 -#define REG_NOTEOL 00002 -#define REG_STARTEND 00004 -#define REG_TRACE 00400 /* tracing of execution */ -#define REG_LARGE 01000 /* force large representation */ -#define REG_BACKR 02000 /* force use of backref code */ - - -/* === regfree.c === */ -API_EXPORT(void) regfree(regex_t *); - -#ifdef __cplusplus -} -#endif -/* ========= end header generated by ././mkh ========= */ -#endif -#endif diff --git a/ext/ereg/regex/regex.mak b/ext/ereg/regex/regex.mak deleted file mode 100644 index b87ded340b396..0000000000000 --- a/ext/ereg/regex/regex.mak +++ /dev/null @@ -1,304 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on regex.dsp -!IF "$(CFG)" == "" -CFG=regex - Win32 Release -!MESSAGE No configuration specified. Defaulting to regex - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "regex - Win32 Release" && "$(CFG)" != "regex - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -CPP=cl.exe - -!IF "$(CFG)" == "regex - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\regex.lib" - -!ELSE - -ALL : "$(OUTDIR)\regex.lib" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\regcomp.obj" - -@erase "$(INTDIR)\regerror.obj" - -@erase "$(INTDIR)\regexec.obj" - -@erase "$(INTDIR)\regfree.obj" - -@erase "$(INTDIR)\vc50.idb" - -@erase "$(OUTDIR)\regex.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\ - /Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib" -LIB32_OBJS= \ - "$(INTDIR)\regcomp.obj" \ - "$(INTDIR)\regerror.obj" \ - "$(INTDIR)\regexec.obj" \ - "$(INTDIR)\regfree.obj" - -"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ELSEIF "$(CFG)" == "regex - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc" - -!ELSE - -ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\regcomp.obj" - -@erase "$(INTDIR)\regcomp.sbr" - -@erase "$(INTDIR)\regerror.obj" - -@erase "$(INTDIR)\regerror.sbr" - -@erase "$(INTDIR)\regexec.obj" - -@erase "$(INTDIR)\regexec.sbr" - -@erase "$(INTDIR)\regfree.obj" - -@erase "$(INTDIR)\regfree.sbr" - -@erase "$(INTDIR)\vc50.idb" - -@erase "$(OUTDIR)\regex.bsc" - -@erase "$(OUTDIR)\regex.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /MDd /W3 /GX /Z7 /Od /I "." /D "WIN32" /D "_DEBUG" /D\ - "_WINDOWS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\\" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=.\Debug/ -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc" -BSC32_SBRS= \ - "$(INTDIR)\regcomp.sbr" \ - "$(INTDIR)\regerror.sbr" \ - "$(INTDIR)\regexec.sbr" \ - "$(INTDIR)\regfree.sbr" - -"$(OUTDIR)\regex.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LIB32=link.exe -lib -LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib" -LIB32_OBJS= \ - "$(INTDIR)\regcomp.obj" \ - "$(INTDIR)\regerror.obj" \ - "$(INTDIR)\regexec.obj" \ - "$(INTDIR)\regfree.obj" - -"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ENDIF - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - - -!IF "$(CFG)" == "regex - Win32 Release" || "$(CFG)" == "regex - Win32 Debug" -SOURCE=.\regcomp.c - -!IF "$(CFG)" == "regex - Win32 Release" - -DEP_CPP_REGCO=\ - ".\cclass.h"\ - ".\cname.h"\ - ".\regcomp.ih"\ - ".\regex.h"\ - ".\regex2.h"\ - ".\utils.h"\ - - -"$(INTDIR)\regcomp.obj" : $(SOURCE) $(DEP_CPP_REGCO) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "regex - Win32 Debug" - -DEP_CPP_REGCO=\ - ".\cclass.h"\ - ".\cname.h"\ - ".\regcomp.ih"\ - ".\regex.h"\ - ".\regex2.h"\ - ".\utils.h"\ - {$(INCLUDE)}"sys\types.h"\ - - -"$(INTDIR)\regcomp.obj" "$(INTDIR)\regcomp.sbr" : $(SOURCE) $(DEP_CPP_REGCO)\ - "$(INTDIR)" - - -!ENDIF - -SOURCE=.\regerror.c - -!IF "$(CFG)" == "regex - Win32 Release" - -DEP_CPP_REGER=\ - ".\regerror.ih"\ - ".\regex.h"\ - ".\utils.h"\ - - -"$(INTDIR)\regerror.obj" : $(SOURCE) $(DEP_CPP_REGER) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "regex - Win32 Debug" - -DEP_CPP_REGER=\ - ".\regerror.ih"\ - ".\regex.h"\ - ".\utils.h"\ - {$(INCLUDE)}"sys\types.h"\ - - -"$(INTDIR)\regerror.obj" "$(INTDIR)\regerror.sbr" : $(SOURCE) $(DEP_CPP_REGER)\ - "$(INTDIR)" - - -!ENDIF - -SOURCE=.\regexec.c - -!IF "$(CFG)" == "regex - Win32 Release" - -DEP_CPP_REGEX=\ - ".\engine.c"\ - ".\engine.ih"\ - ".\regex.h"\ - ".\regex2.h"\ - ".\utils.h"\ - - -"$(INTDIR)\regexec.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "regex - Win32 Debug" - -DEP_CPP_REGEX=\ - ".\engine.c"\ - ".\engine.ih"\ - ".\regex.h"\ - ".\regex2.h"\ - ".\utils.h"\ - {$(INCLUDE)}"sys\types.h"\ - - -"$(INTDIR)\regexec.obj" "$(INTDIR)\regexec.sbr" : $(SOURCE) $(DEP_CPP_REGEX)\ - "$(INTDIR)" - - -!ENDIF - -SOURCE=.\regfree.c - -!IF "$(CFG)" == "regex - Win32 Release" - -DEP_CPP_REGFR=\ - ".\regex.h"\ - ".\regex2.h"\ - ".\utils.h"\ - - -"$(INTDIR)\regfree.obj" : $(SOURCE) $(DEP_CPP_REGFR) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "regex - Win32 Debug" - -DEP_CPP_REGFR=\ - ".\regex.h"\ - ".\regex2.h"\ - ".\utils.h"\ - {$(INCLUDE)}"sys\types.h"\ - - -"$(INTDIR)\regfree.obj" "$(INTDIR)\regfree.sbr" : $(SOURCE) $(DEP_CPP_REGFR)\ - "$(INTDIR)" - - -!ENDIF - -SOURCE=.\engine.c - -!ENDIF - diff --git a/ext/ereg/regex/regex2.h b/ext/ereg/regex/regex2.h deleted file mode 100644 index 7cd39a59ae53a..0000000000000 --- a/ext/ereg/regex/regex2.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * First, the stuff that ends up in the outside-world include file - = #ifdef WIN32 - = #define API_EXPORT(type) __declspec(dllexport) type __stdcall - = #else - = #define API_EXPORT(type) type - = #endif - = - = typedef off_t regoff_t; - = typedef struct { - = int re_magic; - = size_t re_nsub; // number of parenthesized subexpressions - = const char *re_endp; // end pointer for REG_PEND - = struct re_guts *re_g; // none of your business :-) - = } regex_t; - = typedef struct { - = regoff_t rm_so; // start of match - = regoff_t rm_eo; // end of match - = } regmatch_t; - */ -/* - * internals of regex_t - */ -#define MAGIC1 ((('r'^0200)<<8) | 'e') - -/* - * The internal representation is a *strip*, a sequence of - * operators ending with an endmarker. (Some terminology etc. is a - * historical relic of earlier versions which used multiple strips.) - * Certain oddities in the representation are there to permit running - * the machinery backwards; in particular, any deviation from sequential - * flow must be marked at both its source and its destination. Some - * fine points: - * - * - OPLUS_ and O_PLUS are *inside* the loop they create. - * - OQUEST_ and O_QUEST are *outside* the bypass they create. - * - OCH_ and O_CH are *outside* the multi-way branch they create, while - * OOR1 and OOR2 are respectively the end and the beginning of one of - * the branches. Note that there is an implicit OOR2 following OCH_ - * and an implicit OOR1 preceding O_CH. - * - * In state representations, an operator's bit is on to signify a state - * immediately *preceding* "execution" of that operator. - */ -typedef long sop; /* strip operator */ -typedef long sopno; -#define OPRMASK 0x7c000000 -#define OPDMASK 0x03ffffff -#define OPSHIFT (26) -#define OP(n) ((n)&OPRMASK) -#define OPND(n) ((n)&OPDMASK) -#define SOP(op, opnd) ((op)|(opnd)) -/* operators meaning operand */ -/* (back, fwd are offsets) */ -#define OEND (1< uch [csetsize] */ - uch mask; /* bit within array */ - uch hash; /* hash code */ - size_t smultis; - char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */ -} cset; -/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */ -#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c)) -#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c)) -#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask) -#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */ -#define MCsub(p, cs, cp) mcsub(p, cs, cp) -#define MCin(p, cs, cp) mcin(p, cs, cp) - -/* stuff for character categories */ -typedef unsigned char cat_t; - -/* - * main compiled-expression structure - */ -struct re_guts { - int magic; -# define MAGIC2 ((('R'^0200)<<8)|'E') - sop *strip; /* malloced area for strip */ - int csetsize; /* number of bits in a cset vector */ - int ncsets; /* number of csets in use */ - cset *sets; /* -> cset [ncsets] */ - uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */ - int cflags; /* copy of regcomp() cflags argument */ - sopno nstates; /* = number of sops */ - sopno firststate; /* the initial OEND (normally 0) */ - sopno laststate; /* the final OEND */ - int iflags; /* internal flags */ -# define USEBOL 01 /* used ^ */ -# define USEEOL 02 /* used $ */ -# define BAD 04 /* something wrong */ - int nbol; /* number of ^ used */ - int neol; /* number of $ used */ - int ncategories; /* how many character categories */ - cat_t *categories; /* ->catspace[-CHAR_MIN] */ - char *must; /* match must contain this string */ - int mlen; /* length of must */ - size_t nsub; /* copy of re_nsub */ - int backrefs; /* does it use back references? */ - sopno nplus; /* how deep does it nest +s? */ - /* catspace must be last */ - cat_t catspace[1]; /* actually [NC] */ -}; - -/* misc utilities */ -#define OUT (CHAR_MAX+1) /* a non-character value */ -#define ISWORD(c) (isalnum(c) || (c) == '_') diff --git a/ext/ereg/regex/regex_extra.h b/ext/ereg/regex/regex_extra.h deleted file mode 100644 index 3db9e4ad1a8e8..0000000000000 --- a/ext/ereg/regex/regex_extra.h +++ /dev/null @@ -1,23 +0,0 @@ -/* do not frame this - we must be able to include this file multiple times */ - -#undef regexec -#undef regerror -#undef regfree -#undef regcomp - -#if (defined(REGEX) && REGEX == 1) || (!defined(REGEX)) - -#if !(WIN32|WINNT) - -#ifndef PHP_NO_ALIASES - -#define regexec php_regexec -#define regerror php_regerror -#define regfree php_regfree -#define regcomp php_regcomp - -#endif - -#endif - -#endif diff --git a/ext/ereg/regex/regexec.c b/ext/ereg/regex/regexec.c deleted file mode 100644 index 7888d02368c12..0000000000000 --- a/ext/ereg/regex/regexec.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * the outer shell of regexec() - * - * This file includes engine.c *twice*, after muchos fiddling with the - * macros that code uses. This lets the same code operate on two different - * representations for state sets. - */ -#include -#include -#include -#include -#include -#include -#include - -#include "utils.h" -#include "regex2.h" - -static int nope = 0; /* for use in asserts; shuts lint up */ - -/* macros for manipulating states, small version */ -#define states unsigned -#define states1 unsigned /* for later use in regexec() decision */ -#define CLEAR(v) ((v) = 0) -#define SET0(v, n) ((v) &= ~((unsigned)1 << (n))) -#define SET1(v, n) ((v) |= (unsigned)1 << (n)) -#define ISSET(v, n) ((v) & ((unsigned)1 << (n))) -#define ASSIGN(d, s) ((d) = (s)) -#define EQ(a, b) ((a) == (b)) -#define STATEVARS int dummy /* dummy version */ -#define STATESETUP(m, n) /* nothing */ -#define STATETEARDOWN(m) /* nothing */ -#define SETUP(v) ((v) = 0) -#define onestate unsigned -#define INIT(o, n) ((o) = (unsigned)1 << (n)) -#define INC(o) ((o) <<= 1) -#define ISSTATEIN(v, o) ((v) & (o)) -/* some abbreviations; note that some of these know variable names! */ -/* do "if I'm here, I can also be there" etc without branches */ -#define FWD(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) << (n)) -#define BACK(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) >> (n)) -#define ISSETBACK(v, n) ((v) & ((unsigned)here >> (n))) -/* function names */ -#define SNAMES /* engine.c looks after details */ - -#include "engine.c" - -/* now undo things */ -#undef states -#undef CLEAR -#undef SET0 -#undef SET1 -#undef ISSET -#undef ASSIGN -#undef EQ -#undef STATEVARS -#undef STATESETUP -#undef STATETEARDOWN -#undef SETUP -#undef onestate -#undef INIT -#undef INC -#undef ISSTATEIN -#undef FWD -#undef BACK -#undef ISSETBACK -#undef SNAMES - -/* macros for manipulating states, large version */ -#define states char * -#define CLEAR(v) memset(v, 0, m->g->nstates) -#define SET0(v, n) ((v)[n] = 0) -#define SET1(v, n) ((v)[n] = 1) -#define ISSET(v, n) ((v)[n]) -#define ASSIGN(d, s) memcpy(d, s, m->g->nstates) -#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0) -#define STATEVARS int vn; char *space -#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \ - if ((m)->space == NULL) return(REG_ESPACE); \ - (m)->vn = 0; } -#define STATETEARDOWN(m) { free((m)->space); } -#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates]) -#define onestate int -#define INIT(o, n) ((o) = (n)) -#define INC(o) ((o)++) -#define ISSTATEIN(v, o) ((v)[o]) -/* some abbreviations; note that some of these know variable names! */ -/* do "if I'm here, I can also be there" etc without branches */ -#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here]) -#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here]) -#define ISSETBACK(v, n) ((v)[here - (n)]) -/* function names */ -#define LNAMES /* flag */ - -#include "engine.c" - -/* - - regexec - interface for matching - = API_EXPORT(int) regexec(const regex_t *, const char *, size_t, \ - = regmatch_t [], int); - = #define REG_NOTBOL 00001 - = #define REG_NOTEOL 00002 - = #define REG_STARTEND 00004 - = #define REG_TRACE 00400 // tracing of execution - = #define REG_LARGE 01000 // force large representation - = #define REG_BACKR 02000 // force use of backref code - * - * We put this here so we can exploit knowledge of the state representation - * when choosing which matcher to call. Also, by this point the matchers - * have been prototyped. - */ -API_EXPORT(int) /* 0 success, REG_NOMATCH failure */ -regexec(preg, string, nmatch, pmatch, eflags) -const regex_t *preg; -const char *string; -size_t nmatch; -regmatch_t pmatch[]; -int eflags; -{ - register struct re_guts *g = preg->re_g; -#ifdef REDEBUG -# define GOODFLAGS(f) (f) -#else -# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND)) -#endif - - if (preg->re_magic != MAGIC1 || g->magic != MAGIC2) - return(REG_BADPAT); - assert(!(g->iflags&BAD)); - if (g->iflags&BAD) /* backstop for no-debug case */ - return(REG_BADPAT); - eflags = GOODFLAGS(eflags); - - if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags®_LARGE)) - return(smatcher(g, (char *)string, nmatch, pmatch, eflags)); - else - return(lmatcher(g, (char *)string, nmatch, pmatch, eflags)); -} diff --git a/ext/ereg/regex/regfree.c b/ext/ereg/regex/regfree.c deleted file mode 100644 index 9fd618a13b83a..0000000000000 --- a/ext/ereg/regex/regfree.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include -#include - -#include "utils.h" -#include "regex2.h" - -/* - - regfree - free everything - = API_EXPORT(void) regfree(regex_t *); - */ -API_EXPORT(void) -regfree(preg) -regex_t *preg; -{ - register struct re_guts *g; - - if (preg->re_magic != MAGIC1) /* oops */ - return; /* nice to complain, but hard */ - - g = preg->re_g; - if (g == NULL || g->magic != MAGIC2) /* oops again */ - return; - preg->re_magic = 0; /* mark it invalid */ - g->magic = 0; /* mark it invalid */ - - if (g->strip != NULL) - free((char *)g->strip); - if (g->sets != NULL) - free((char *)g->sets); - if (g->setbits != NULL) - free((char *)g->setbits); - if (g->must != NULL) - free(g->must); - free((char *)g); -} diff --git a/ext/ereg/regex/split.c b/ext/ereg/regex/split.c deleted file mode 100644 index 188bdb775b9ff..0000000000000 --- a/ext/ereg/regex/split.c +++ /dev/null @@ -1,316 +0,0 @@ -#include -#include - -/* - - split - divide a string into fields, like awk split() - = int split(char *string, char *fields[], int nfields, char *sep); - */ -int /* number of fields, including overflow */ -split(string, fields, nfields, sep) -char *string; -char *fields[]; /* list is not NULL-terminated */ -int nfields; /* number of entries available in fields[] */ -char *sep; /* "" white, "c" single char, "ab" [ab]+ */ -{ - register char *p = string; - register char c; /* latest character */ - register char sepc = sep[0]; - register char sepc2; - register int fn; - register char **fp = fields; - register char *sepp; - register int trimtrail; - - /* white space */ - if (sepc == '\0') { - while ((c = *p++) == ' ' || c == '\t') - continue; - p--; - trimtrail = 1; - sep = " \t"; /* note, code below knows this is 2 long */ - sepc = ' '; - } else - trimtrail = 0; - sepc2 = sep[1]; /* now we can safely pick this up */ - - /* catch empties */ - if (*p == '\0') - return(0); - - /* single separator */ - if (sepc2 == '\0') { - fn = nfields; - for (;;) { - *fp++ = p; - fn--; - if (fn == 0) - break; - while ((c = *p++) != sepc) - if (c == '\0') - return(nfields - fn); - *(p-1) = '\0'; - } - /* we have overflowed the fields vector -- just count them */ - fn = nfields; - for (;;) { - while ((c = *p++) != sepc) - if (c == '\0') - return(fn); - fn++; - } - /* not reached */ - } - - /* two separators */ - if (sep[2] == '\0') { - fn = nfields; - for (;;) { - *fp++ = p; - fn--; - while ((c = *p++) != sepc && c != sepc2) - if (c == '\0') { - if (trimtrail && **(fp-1) == '\0') - fn++; - return(nfields - fn); - } - if (fn == 0) - break; - *(p-1) = '\0'; - while ((c = *p++) == sepc || c == sepc2) - continue; - p--; - } - /* we have overflowed the fields vector -- just count them */ - fn = nfields; - while (c != '\0') { - while ((c = *p++) == sepc || c == sepc2) - continue; - p--; - fn++; - while ((c = *p++) != '\0' && c != sepc && c != sepc2) - continue; - } - /* might have to trim trailing white space */ - if (trimtrail) { - p--; - while ((c = *--p) == sepc || c == sepc2) - continue; - p++; - if (*p != '\0') { - if (fn == nfields+1) - *p = '\0'; - fn--; - } - } - return(fn); - } - - /* n separators */ - fn = 0; - for (;;) { - if (fn < nfields) - *fp++ = p; - fn++; - for (;;) { - c = *p++; - if (c == '\0') - return(fn); - sepp = sep; - while ((sepc = *sepp++) != '\0' && sepc != c) - continue; - if (sepc != '\0') /* it was a separator */ - break; - } - if (fn < nfields) - *(p-1) = '\0'; - for (;;) { - c = *p++; - sepp = sep; - while ((sepc = *sepp++) != '\0' && sepc != c) - continue; - if (sepc == '\0') /* it wasn't a separator */ - break; - } - p--; - } - - /* not reached */ -} - -#ifdef TEST_SPLIT - - -/* - * test program - * pgm runs regression - * pgm sep splits stdin lines by sep - * pgm str sep splits str by sep - * pgm str sep n splits str by sep n times - */ -int -main(argc, argv) -int argc; -char *argv[]; -{ - char buf[512]; - register int n; -# define MNF 10 - char *fields[MNF]; - - if (argc > 4) - for (n = atoi(argv[3]); n > 0; n--) { - (void) strcpy(buf, argv[1]); - } - else if (argc > 3) - for (n = atoi(argv[3]); n > 0; n--) { - (void) strcpy(buf, argv[1]); - (void) split(buf, fields, MNF, argv[2]); - } - else if (argc > 2) - dosplit(argv[1], argv[2]); - else if (argc > 1) - while (fgets(buf, sizeof(buf), stdin) != NULL) { - buf[strlen(buf)-1] = '\0'; /* stomp newline */ - dosplit(buf, argv[1]); - } - else - regress(); - - exit(0); -} - -dosplit(string, seps) -char *string; -char *seps; -{ -# define NF 5 - char *fields[NF]; - register int nf; - - nf = split(string, fields, NF, seps); - print(nf, NF, fields); -} - -print(nf, nfp, fields) -int nf; -int nfp; -char *fields[]; -{ - register int fn; - register int bound; - - bound = (nf > nfp) ? nfp : nf; - printf("%d:\t", nf); - for (fn = 0; fn < bound; fn++) - printf("\"%s\"%s", fields[fn], (fn+1 < nf) ? ", " : "\n"); -} - -#define RNF 5 /* some table entries know this */ -struct { - char *str; - char *seps; - int nf; - char *fi[RNF]; -} tests[] = { - "", " ", 0, { "" }, - " ", " ", 2, { "", "" }, - "x", " ", 1, { "x" }, - "xy", " ", 1, { "xy" }, - "x y", " ", 2, { "x", "y" }, - "abc def g ", " ", 5, { "abc", "def", "", "g", "" }, - " a bcd", " ", 4, { "", "", "a", "bcd" }, - "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" }, - " a b c d ", " ", 6, { "", "a", "b", "c", "d " }, - - "", " _", 0, { "" }, - " ", " _", 2, { "", "" }, - "x", " _", 1, { "x" }, - "x y", " _", 2, { "x", "y" }, - "ab _ cd", " _", 2, { "ab", "cd" }, - " a_b c ", " _", 5, { "", "a", "b", "c", "" }, - "a b c_d e f", " _", 6, { "a", "b", "c", "d", "e f" }, - " a b c d ", " _", 6, { "", "a", "b", "c", "d " }, - - "", " _~", 0, { "" }, - " ", " _~", 2, { "", "" }, - "x", " _~", 1, { "x" }, - "x y", " _~", 2, { "x", "y" }, - "ab _~ cd", " _~", 2, { "ab", "cd" }, - " a_b c~", " _~", 5, { "", "a", "b", "c", "" }, - "a b_c d~e f", " _~", 6, { "a", "b", "c", "d", "e f" }, - "~a b c d ", " _~", 6, { "", "a", "b", "c", "d " }, - - "", " _~-", 0, { "" }, - " ", " _~-", 2, { "", "" }, - "x", " _~-", 1, { "x" }, - "x y", " _~-", 2, { "x", "y" }, - "ab _~- cd", " _~-", 2, { "ab", "cd" }, - " a_b c~", " _~-", 5, { "", "a", "b", "c", "" }, - "a b_c-d~e f", " _~-", 6, { "a", "b", "c", "d", "e f" }, - "~a-b c d ", " _~-", 6, { "", "a", "b", "c", "d " }, - - "", " ", 0, { "" }, - " ", " ", 2, { "", "" }, - "x", " ", 1, { "x" }, - "xy", " ", 1, { "xy" }, - "x y", " ", 2, { "x", "y" }, - "abc def g ", " ", 4, { "abc", "def", "g", "" }, - " a bcd", " ", 3, { "", "a", "bcd" }, - "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" }, - " a b c d ", " ", 6, { "", "a", "b", "c", "d " }, - - "", "", 0, { "" }, - " ", "", 0, { "" }, - "x", "", 1, { "x" }, - "xy", "", 1, { "xy" }, - "x y", "", 2, { "x", "y" }, - "abc def g ", "", 3, { "abc", "def", "g" }, - "\t a bcd", "", 2, { "a", "bcd" }, - " a \tb\t c ", "", 3, { "a", "b", "c" }, - "a b c d e ", "", 5, { "a", "b", "c", "d", "e" }, - "a b\tc d e f", "", 6, { "a", "b", "c", "d", "e f" }, - " a b c d e f ", "", 6, { "a", "b", "c", "d", "e f " }, - - NULL, NULL, 0, { NULL }, -}; - -regress() -{ - char buf[512]; - register int n; - char *fields[RNF+1]; - register int nf; - register int i; - register int printit; - register char *f; - - for (n = 0; tests[n].str != NULL; n++) { - (void) strcpy(buf, tests[n].str); - fields[RNF] = NULL; - nf = split(buf, fields, RNF, tests[n].seps); - printit = 0; - if (nf != tests[n].nf) { - printf("split `%s' by `%s' gave %d fields, not %d\n", - tests[n].str, tests[n].seps, nf, tests[n].nf); - printit = 1; - } else if (fields[RNF] != NULL) { - printf("split() went beyond array end\n"); - printit = 1; - } else { - for (i = 0; i < nf && i < RNF; i++) { - f = fields[i]; - if (f == NULL) - f = "(NULL)"; - if (strcmp(f, tests[n].fi[i]) != 0) { - printf("split `%s' by `%s', field %d is `%s', not `%s'\n", - tests[n].str, tests[n].seps, - i, fields[i], tests[n].fi[i]); - printit = 1; - } - } - } - if (printit) - print(nf, RNF, fields); - } -} -#endif diff --git a/ext/ereg/regex/tests b/ext/ereg/regex/tests deleted file mode 100644 index c05846177f594..0000000000000 --- a/ext/ereg/regex/tests +++ /dev/null @@ -1,475 +0,0 @@ -# regular expression test set -# Lines are at least three fields, separated by one or more tabs. "" stands -# for an empty field. First field is an RE. Second field is flags. If -# C flag given, regcomp() is expected to fail, and the third field is the -# error name (minus the leading REG_). -# -# Otherwise it is expected to succeed, and the third field is the string to -# try matching it against. If there is no fourth field, the match is -# expected to fail. If there is a fourth field, it is the substring that -# the RE is expected to match. If there is a fifth field, it is a comma- -# separated list of what the subexpressions should match, with - indicating -# no match for that one. In both the fourth and fifth fields, a (sub)field -# starting with @ indicates that the (sub)expression is expected to match -# a null string followed by the stuff after the @; this provides a way to -# test where null strings match. The character `N' in REs and strings -# is newline, `S' is space, `T' is tab, `Z' is NUL. -# -# The full list of flags: -# - placeholder, does nothing -# b RE is a BRE, not an ERE -# & try it as both an ERE and a BRE -# C regcomp() error expected, third field is error name -# i REG_ICASE -# m ("mundane") REG_NOSPEC -# s REG_NOSUB (not really testable) -# n REG_NEWLINE -# ^ REG_NOTBOL -# $ REG_NOTEOL -# # REG_STARTEND (see below) -# p REG_PEND -# -# For REG_STARTEND, the start/end offsets are those of the substring -# enclosed in (). - -# basics -a & a a -abc & abc abc -abc|de - abc abc -a|b|c - abc a - -# parentheses and perversions thereof -a(b)c - abc abc -a\(b\)c b abc abc -a( C EPAREN -a( b a( a( -a\( - a( a( -a\( bC EPAREN -a\(b bC EPAREN -a(b C EPAREN -a(b b a(b a(b -# gag me with a right parenthesis -- 1003.2 goofed here (my fault, partly) -a) - a) a) -) - ) ) -# end gagging (in a just world, those *should* give EPAREN) -a) b a) a) -a\) bC EPAREN -\) bC EPAREN -a()b - ab ab -a\(\)b b ab ab - -# anchoring and REG_NEWLINE -^abc$ & abc abc -a^b - a^b -a^b b a^b a^b -a$b - a$b -a$b b a$b a$b -^ & abc @abc -$ & abc @ -^$ & "" @ -$^ - "" @ -\($\)\(^\) b "" @ -# stop retching, those are legitimate (although disgusting) -^^ - "" @ -$$ - "" @ -b$ & abNc -b$ &n abNc b -^b$ & aNbNc -^b$ &n aNbNc b -^$ &n aNNb @Nb -^$ n abc -^$ n abcN @ -$^ n aNNb @Nb -\($\)\(^\) bn aNNb @Nb -^^ n^ aNNb @Nb -$$ n aNNb @NN -^a ^ a -a$ $ a -^a ^n aNb -^b ^n aNb b -a$ $n bNa -b$ $n bNa b -a*(^b$)c* - b b -a*\(^b$\)c* b b b - -# certain syntax errors and non-errors -| C EMPTY -| b | | -* C BADRPT -* b * * -+ C BADRPT -? C BADRPT -"" &C EMPTY -() - abc @abc -\(\) b abc @abc -a||b C EMPTY -|ab C EMPTY -ab| C EMPTY -(|a)b C EMPTY -(a|)b C EMPTY -(*a) C BADRPT -(+a) C BADRPT -(?a) C BADRPT -({1}a) C BADRPT -\(\{1\}a\) bC BADRPT -(a|*b) C BADRPT -(a|+b) C BADRPT -(a|?b) C BADRPT -(a|{1}b) C BADRPT -^* C BADRPT -^* b * * -^+ C BADRPT -^? C BADRPT -^{1} C BADRPT -^\{1\} bC BADRPT - -# metacharacters, backslashes -a.c & abc abc -a[bc]d & abd abd -a\*c & a*c a*c -a\\b & a\b a\b -a\\\*b & a\*b a\*b -a\bc & abc abc -a\ &C EESCAPE -a\\bc & a\bc a\bc -\{ bC BADRPT -a\[b & a[b a[b -a[b &C EBRACK -# trailing $ is a peculiar special case for the BRE code -a$ & a a -a$ & a$ -a\$ & a -a\$ & a$ a$ -a\\$ & a -a\\$ & a$ -a\\$ & a\$ -a\\$ & a\ a\ - -# back references, ugh -a\(b\)\2c bC ESUBREG -a\(b\1\)c bC ESUBREG -a\(b*\)c\1d b abbcbbd abbcbbd bb -a\(b*\)c\1d b abbcbd -a\(b*\)c\1d b abbcbbbd -^\(.\)\1 b abc -a\([bc]\)\1d b abcdabbd abbd b -a\(\([bc]\)\2\)*d b abbccd abbccd -a\(\([bc]\)\2\)*d b abbcbd -# actually, this next one probably ought to fail, but the spec is unclear -a\(\(b\)*\2\)*d b abbbd abbbd -# here is a case that no NFA implementation does right -\(ab*\)[ab]*\1 b ababaaa ababaaa a -# check out normal matching in the presence of back refs -\(a\)\1bcd b aabcd aabcd -\(a\)\1bc*d b aabcd aabcd -\(a\)\1bc*d b aabd aabd -\(a\)\1bc*d b aabcccd aabcccd -\(a\)\1bc*[ce]d b aabcccd aabcccd -^\(a\)\1b\(c\)*cd$ b aabcccd aabcccd - -# ordinary repetitions -ab*c & abc abc -ab+c - abc abc -ab?c - abc abc -a\(*\)b b a*b a*b -a\(**\)b b ab ab -a\(***\)b bC BADRPT -*a b *a *a -**a b a a -***a bC BADRPT - -# the dreaded bounded repetitions -{ & { { -{abc & {abc {abc -{1 C BADRPT -{1} C BADRPT -a{b & a{b a{b -a{1}b - ab ab -a\{1\}b b ab ab -a{1,}b - ab ab -a\{1,\}b b ab ab -a{1,2}b - aab aab -a\{1,2\}b b aab aab -a{1 C EBRACE -a\{1 bC EBRACE -a{1a C EBRACE -a\{1a bC EBRACE -a{1a} C BADBR -a\{1a\} bC BADBR -a{,2} - a{,2} a{,2} -a\{,2\} bC BADBR -a{,} - a{,} a{,} -a\{,\} bC BADBR -a{1,x} C BADBR -a\{1,x\} bC BADBR -a{1,x C EBRACE -a\{1,x bC EBRACE -a{300} C BADBR -a\{300\} bC BADBR -a{1,0} C BADBR -a\{1,0\} bC BADBR -ab{0,0}c - abcac ac -ab\{0,0\}c b abcac ac -ab{0,1}c - abcac abc -ab\{0,1\}c b abcac abc -ab{0,3}c - abbcac abbc -ab\{0,3\}c b abbcac abbc -ab{1,1}c - acabc abc -ab\{1,1\}c b acabc abc -ab{1,3}c - acabc abc -ab\{1,3\}c b acabc abc -ab{2,2}c - abcabbc abbc -ab\{2,2\}c b abcabbc abbc -ab{2,4}c - abcabbc abbc -ab\{2,4\}c b abcabbc abbc -((a{1,10}){1,10}){1,10} - a a a,a - -# multiple repetitions -a** &C BADRPT -a++ C BADRPT -a?? C BADRPT -a*+ C BADRPT -a*? C BADRPT -a+* C BADRPT -a+? C BADRPT -a?* C BADRPT -a?+ C BADRPT -a{1}{1} C BADRPT -a*{1} C BADRPT -a+{1} C BADRPT -a?{1} C BADRPT -a{1}* C BADRPT -a{1}+ C BADRPT -a{1}? C BADRPT -a*{b} - a{b} a{b} -a\{1\}\{1\} bC BADRPT -a*\{1\} bC BADRPT -a\{1\}* bC BADRPT - -# brackets, and numerous perversions thereof -a[b]c & abc abc -a[ab]c & abc abc -a[^ab]c & adc adc -a[]b]c & a]c a]c -a[[b]c & a[c a[c -a[-b]c & a-c a-c -a[^]b]c & adc adc -a[^-b]c & adc adc -a[b-]c & a-c a-c -a[b &C EBRACK -a[] &C EBRACK -a[1-3]c & a2c a2c -a[3-1]c &C ERANGE -a[1-3-5]c &C ERANGE -a[[.-.]--]c & a-c a-c -a[1- &C ERANGE -a[[. &C EBRACK -a[[.x &C EBRACK -a[[.x. &C EBRACK -a[[.x.] &C EBRACK -a[[.x.]] & ax ax -a[[.x,.]] &C ECOLLATE -a[[.one.]]b & a1b a1b -a[[.notdef.]]b &C ECOLLATE -a[[.].]]b & a]b a]b -a[[:alpha:]]c & abc abc -a[[:notdef:]]c &C ECTYPE -a[[: &C EBRACK -a[[:alpha &C EBRACK -a[[:alpha:] &C EBRACK -a[[:alpha,:] &C ECTYPE -a[[:]:]]b &C ECTYPE -a[[:-:]]b &C ECTYPE -a[[:alph:]] &C ECTYPE -a[[:alphabet:]] &C ECTYPE -[[:alnum:]]+ - -%@a0X- a0X -[[:alpha:]]+ - -%@aX0- aX -[[:blank:]]+ - aSSTb SST -[[:cntrl:]]+ - aNTb NT -[[:digit:]]+ - a019b 019 -[[:graph:]]+ - Sa%bS a%b -[[:lower:]]+ - AabC ab -[[:print:]]+ - NaSbN aSb -[[:punct:]]+ - S%-&T %-& -[[:space:]]+ - aSNTb SNT -[[:upper:]]+ - aBCd BC -[[:xdigit:]]+ - p0f3Cq 0f3C -a[[=b=]]c & abc abc -a[[= &C EBRACK -a[[=b &C EBRACK -a[[=b= &C EBRACK -a[[=b=] &C EBRACK -a[[=b,=]] &C ECOLLATE -a[[=one=]]b & a1b a1b - -# complexities -a(((b)))c - abc abc -a(b|(c))d - abd abd -a(b*|c)d - abbd abbd -# just gotta have one DFA-buster, of course -a[ab]{20} - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab -# and an inline expansion in case somebody gets tricky -a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab -# and in case somebody just slips in an NFA... -a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) - aaaaabaaaabaaaabaaaabweeknights aaaaabaaaabaaaabaaaabweeknights -# fish for anomalies as the number of states passes 32 -12345678901234567890123456789 - a12345678901234567890123456789b 12345678901234567890123456789 -123456789012345678901234567890 - a123456789012345678901234567890b 123456789012345678901234567890 -1234567890123456789012345678901 - a1234567890123456789012345678901b 1234567890123456789012345678901 -12345678901234567890123456789012 - a12345678901234567890123456789012b 12345678901234567890123456789012 -123456789012345678901234567890123 - a123456789012345678901234567890123b 123456789012345678901234567890123 -# and one really big one, beyond any plausible word width -1234567890123456789012345678901234567890123456789012345678901234567890 - a1234567890123456789012345678901234567890123456789012345678901234567890b 1234567890123456789012345678901234567890123456789012345678901234567890 -# fish for problems as brackets go past 8 -[ab][cd][ef][gh][ij][kl][mn] - xacegikmoq acegikm -[ab][cd][ef][gh][ij][kl][mn][op] - xacegikmoq acegikmo -[ab][cd][ef][gh][ij][kl][mn][op][qr] - xacegikmoqy acegikmoq -[ab][cd][ef][gh][ij][kl][mn][op][q] - xacegikmoqy acegikmoq - -# subtleties of matching -abc & xabcy abc -a\(b\)?c\1d b acd -aBc i Abc Abc -a[Bc]*d i abBCcd abBCcd -0[[:upper:]]1 &i 0a1 0a1 -0[[:lower:]]1 &i 0A1 0A1 -a[^b]c &i abc -a[^b]c &i aBc -a[^b]c &i adc adc -[a]b[c] - abc abc -[a]b[a] - aba aba -[abc]b[abc] - abc abc -[abc]b[abd] - abd abd -a(b?c)+d - accd accd -(wee|week)(knights|night) - weeknights weeknights -(we|wee|week|frob)(knights|night|day) - weeknights weeknights -a[bc]d - xyzaaabcaababdacd abd -a[ab]c - aaabc abc -abc s abc abc -a* & b @b - -# Let's have some fun -- try to match a C comment. -# first the obvious, which looks okay at first glance... -/\*.*\*/ - /*x*/ /*x*/ -# but... -/\*.*\*/ - /*x*/y/*z*/ /*x*/y/*z*/ -# okay, we must not match */ inside; try to do that... -/\*([^*]|\*[^/])*\*/ - /*x*/ /*x*/ -/\*([^*]|\*[^/])*\*/ - /*x*/y/*z*/ /*x*/ -# but... -/\*([^*]|\*[^/])*\*/ - /*x**/y/*z*/ /*x**/y/*z*/ -# and a still fancier version, which does it right (I think)... -/\*([^*]|\*+[^*/])*\*+/ - /*x*/ /*x*/ -/\*([^*]|\*+[^*/])*\*+/ - /*x*/y/*z*/ /*x*/ -/\*([^*]|\*+[^*/])*\*+/ - /*x**/y/*z*/ /*x**/ -/\*([^*]|\*+[^*/])*\*+/ - /*x****/y/*z*/ /*x****/ -/\*([^*]|\*+[^*/])*\*+/ - /*x**x*/y/*z*/ /*x**x*/ -/\*([^*]|\*+[^*/])*\*+/ - /*x***x/y/*z*/ /*x***x/y/*z*/ - -# subexpressions -a(b)(c)d - abcd abcd b,c -a(((b)))c - abc abc b,b,b -a(b|(c))d - abd abd b,- -a(b*|c|e)d - abbd abbd bb -a(b*|c|e)d - acd acd c -a(b*|c|e)d - ad ad @d -a(b?)c - abc abc b -a(b?)c - ac ac @c -a(b+)c - abc abc b -a(b+)c - abbbc abbbc bbb -a(b*)c - ac ac @c -(a|ab)(bc([de]+)f|cde) - abcdef abcdef a,bcdef,de -# the regression tester only asks for 9 subexpressions -a(b)(c)(d)(e)(f)(g)(h)(i)(j)k - abcdefghijk abcdefghijk b,c,d,e,f,g,h,i,j -a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l - abcdefghijkl abcdefghijkl b,c,d,e,f,g,h,i,j,k -a([bc]?)c - abc abc b -a([bc]?)c - ac ac @c -a([bc]+)c - abc abc b -a([bc]+)c - abcc abcc bc -a([bc]+)bc - abcbc abcbc bc -a(bb+|b)b - abb abb b -a(bbb+|bb+|b)b - abb abb b -a(bbb+|bb+|b)b - abbb abbb bb -a(bbb+|bb+|b)bb - abbb abbb b -(.*).* - abcdef abcdef abcdef -(a*)* - bc @b @b - -# do we get the right subexpression when it is used more than once? -a(b|c)*d - ad ad - -a(b|c)*d - abcd abcd c -a(b|c)+d - abd abd b -a(b|c)+d - abcd abcd c -a(b|c?)+d - ad ad @d -a(b|c?)+d - abcd abcd @d -a(b|c){0,0}d - ad ad - -a(b|c){0,1}d - ad ad - -a(b|c){0,1}d - abd abd b -a(b|c){0,2}d - ad ad - -a(b|c){0,2}d - abcd abcd c -a(b|c){0,}d - ad ad - -a(b|c){0,}d - abcd abcd c -a(b|c){1,1}d - abd abd b -a(b|c){1,1}d - acd acd c -a(b|c){1,2}d - abd abd b -a(b|c){1,2}d - abcd abcd c -a(b|c){1,}d - abd abd b -a(b|c){1,}d - abcd abcd c -a(b|c){2,2}d - acbd acbd b -a(b|c){2,2}d - abcd abcd c -a(b|c){2,4}d - abcd abcd c -a(b|c){2,4}d - abcbd abcbd b -a(b|c){2,4}d - abcbcd abcbcd c -a(b|c){2,}d - abcd abcd c -a(b|c){2,}d - abcbd abcbd b -a(b+|((c)*))+d - abd abd @d,@d,- -a(b+|((c)*))+d - abcd abcd @d,@d,- - -# check out the STARTEND option -[abc] &# a(b)c b -[abc] &# a(d)c -[abc] &# a(bc)d b -[abc] &# a(dc)d c -. &# a()c -b.*c &# b(bc)c bc -b.* &# b(bc)c bc -.*c &# b(bc)c bc - -# plain strings, with the NOSPEC flag -abc m abc abc -abc m xabcy abc -abc m xyz -a*b m aba*b a*b -a*b m ab -"" mC EMPTY - -# cases involving NULs -aZb & a a -aZb &p a -aZb &p# (aZb) aZb -aZ*b &p# (ab) ab -a.b &# (aZb) aZb -a.* &# (aZb)c aZb - -# word boundaries (ick) -[[:<:]]a & a a -[[:<:]]a & ba -[[:<:]]a & -a a -a[[:>:]] & a a -a[[:>:]] & ab -a[[:>:]] & a- a -[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc abc -[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc-q abc -[[:<:]]a.c[[:>:]] & axc-dayc-dazce-abc axc -[[:<:]]b.c[[:>:]] & a_bxc-byc_d-bzc-q bzc -[[:<:]].x..[[:>:]] & y_xa_-_xb_y-_xc_-axdc _xc_ -[[:<:]]a_b[[:>:]] & x_a_b - -# past problems, and suspected problems -(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A]) - A1 A1 -abcdefghijklmnop i abcdefghijklmnop abcdefghijklmnop -abcdefghijklmnopqrstuv i abcdefghijklmnopqrstuv abcdefghijklmnopqrstuv -(ALAK)|(ALT[AB])|(CC[123]1)|(CM[123]1)|(GAMC)|(LC[23][EO ])|(SEM[1234])|(SL[ES][12])|(SLWW)|(SLF )|(SLDT)|(VWH[12])|(WH[34][EW])|(WP1[ESN]) - CC11 CC11 -CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a - CC11 CC11 -Char \([a-z0-9_]*\)\[.* b Char xyz[k Char xyz[k xyz -a?b - ab ab --\{0,1\}[0-9]*$ b -5 -5 diff --git a/ext/ereg/regex/utils.h b/ext/ereg/regex/utils.h deleted file mode 100644 index cd4a96025f24a..0000000000000 --- a/ext/ereg/regex/utils.h +++ /dev/null @@ -1,25 +0,0 @@ -/* utility definitions */ - -#include "regex_extra.h" - -#ifdef _POSIX2_RE_DUP_MAX -#define DUPMAX _POSIX2_RE_DUP_MAX -#else -#define DUPMAX 255 -#endif -#define INFINITY (DUPMAX + 1) -#define NC (CHAR_MAX - CHAR_MIN + 1) -typedef unsigned char uch; - -/* switch off assertions (if not already off) if no REDEBUG */ -#ifndef REDEBUG -#ifndef NDEBUG -#define NDEBUG /* no assertions please */ -#endif -#endif -#include - -/* for old systems with bcopy() but no memmove() */ -#ifdef USEBCOPY -#define memmove(d, s, c) bcopy(s, d, c) -#endif diff --git a/ext/ext_skel b/ext/ext_skel deleted file mode 100755 index 70af96d8cd5ac..0000000000000 --- a/ext/ext_skel +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh - -extname="$1" -EXTNAME=`echo $1|tr a-z A-Z` - -givup() { - echo $* - exit 1 -} - -if test "$extname" = ""; then - givup "usage: $0 extension-name" -fi - -if test -d "$extname" ; then - givup "Directory $extname already exists." -fi - -test -f ext_skel || givup "ext_skel must be in the current directory" - -if echo '\c' | grep -s c >/dev/null 2>&1 -then - ECHO_N="echo -n" - ECHO_C="" -else - ECHO_N="echo" - ECHO_C='\c' -fi - -echo "Creating directory" - -mkdir $extname || givup "Cannot create directory $extname" - -cd $extname -chmod 755 . - -$ECHO_N "Creating basic files:$ECHO_C" - -$ECHO_N " config.m4$ECHO_C" -cat >config.m4 <Makefile.am <.cvsignore <config.h.stub< | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -/* FdfTk lib 2.0 is a Complete C/C++ FDF Toolkit available from - http://beta1.adobe.com/ada/acrosdk/forms.html. */ - -/* Note that there is no code from the FdfTk lib in this file */ - -#if !PHP_31 && defined(THREAD_SAFE) -#undef THREAD_SAFE -#endif - -#include "php.h" -#include "ext/standard/head.h" -#include -#include "php3_fdf.h" - -#if HAVE_SYS_WAIT_H -# include -#endif -#if HAVE_UNISTD_H -# include -#endif -#if WIN32|WINNT -# include -# include -#endif - -#if HAVE_FDFLIB - -#ifdef THREAD_SAFE -DWORD FDFlibTls; -static int numthreads=0; - -typedef struct fdflib_global_struct{ - int le_fdf; -} fdflib_global_struct; - -# define FDF_GLOBAL(a) fdflib_globals->a -# define FDF_TLS_VARS fdflib_global_struct *fdflib_globals=TlsGetValue(FDFlibTls) - -#else -# define FDF_GLOBAL(a) a -# define FDF_TLS_VARS -int le_fdf_info; -int le_fdf; -#endif - -function_entry fdf_functions[] = { - PHP_FE(fdf_open, NULL) - PHP_FE(fdf_create, NULL) - PHP_FE(fdf_close, NULL) - PHP_FE(fdf_save, NULL) - PHP_FE(fdf_get_value, NULL) - PHP_FE(fdf_set_value, NULL) - PHP_FE(fdf_next_field_name, NULL) - PHP_FE(fdf_set_ap, NULL) - PHP_FE(fdf_set_status, NULL) - PHP_FE(fdf_get_status, NULL) - PHP_FE(fdf_set_file, NULL) - PHP_FE(fdf_get_file, NULL) - PHP_FE(fdf_add_template, NULL) - {NULL, NULL, NULL} -}; - -php3_module_entry fdf_module_entry = { - "fdf", fdf_functions, PHP_MINIT(fdf), PHP_MSHUTDOWN(fdf), NULL, NULL, - PHP_MINFO(fdf), STANDARD_MODULE_PROPERTIES -}; - -#if COMPILE_DL -#include "dl/phpdl.h" -DLEXPORT php3_module_entry *get_module(void) { return &fdf_module_entry; } -#endif - -static void phpi_FDFClose(FDFDoc fdf) { - (void)FDFClose(fdf); -} - -PHP_MINIT_FUNCTION(fdf) -{ - FDFErc err; - FDF_GLOBAL(le_fdf) = register_list_destructors(phpi_FDFClose, NULL); - err = FDFInitialize(); - if(err == FDFErcOK) - return SUCCESS; - return FAILURE; -} - -PHP_MINFO_FUNCTION(fdf) -{ - /* need to use a PHPAPI function here because it is external module in windows */ - php_printf("FdfTk Version %s", FDFGetVersion()); -} - -PHP_MSHUTDOWN_FUNCTION(fdf) -{ - FDFErc err; - err = FDFFinalize(); - if(err == FDFErcOK) - return SUCCESS; - return FAILURE; -} - -/* {{{ proto int fdf_open(string filename) - Opens a new fdf document */ -PHP_FUNCTION(fdf_open) { - pval *file; - int id, type; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string(file); - - err = FDFOpen(file->value.str.val, 0, &fdf); - if(err != FDFErcOK) - printf("Aiii, error\n"); - if(!fdf) - RETURN_FALSE; - - id = php3_list_insert(fdf,FDF_GLOBAL(le_fdf)); - RETURN_LONG(id); -} /* }}} */ - -/* {{{ proto void fdf_close(int fdfdoc) - Closes the fdf document */ -PHP_FUNCTION(fdf_close) { - pval *arg1; - int id, type; - FDFDoc fdf; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - -/* FDFClose(fdf); */ - php3_list_delete(id); - - RETURN_TRUE; -} /* }}} */ - -/* {{{ proto void fdf_create(void) - Creates a new fdf document */ -PHP_FUNCTION(fdf_create) { - int id, type; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - err = FDFCreate(&fdf); - if(err != FDFErcOK) - printf("Aiii, error\n"); - if(!fdf) - RETURN_FALSE; - - id = php3_list_insert(fdf,FDF_GLOBAL(le_fdf)); - RETURN_LONG(id); -} -/* }}} */ - -/* {{{ proto void fdf_get_value(int fdfdoc, string fieldname) - Gets the value of a field as string */ -PHP_FUNCTION(fdf_get_value) { - pval *arg1, *arg2; - int id, type; - ASInt32 nr; - char *buffer; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFGetValue(fdf, arg2->value.str.val, NULL, 0, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - /* In the inofficial version of FdfTK 4.0 (as FDFGetVersion says. The - library has a name with version 3.0, don't know what adobe has in - mind) the number of bytes of the value doesn't include the trailing - '\0'. This was not the case in 2.0 - */ - if(strcmp(FDFGetVersion(), "2.0")) - nr++; - buffer = emalloc(nr); - err = FDFGetValue(fdf, arg2->value.str.val, buffer, nr, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_STRING(buffer, 0); -} -/* }}} */ - -/* {{{ proto void fdf_set_value(int fdfdoc, string fieldname, string value, int isName) - Sets the value of a field */ -PHP_FUNCTION(fdf_set_value) { - pval *arg1, *arg2, *arg3, *arg4; - int id, type; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - convert_to_string(arg3); - convert_to_long(arg4); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFSetValue(fdf, arg2->value.str.val, arg3->value.str.val, (ASBool) arg4->value.lval); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto void fdf_next_field_name(int fdfdoc [, string fieldname]) - Gets the name of the next field name or the first field name */ -PHP_FUNCTION(fdf_next_field_name) { - pval *argv[2]; - int id, type, argc; - ASInt32 nr; - char *buffer, *fieldname; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - argc = ARG_COUNT(ht); - if((argc > 2) || (argc < 1)) - WRONG_PARAM_COUNT; - - if (getParametersArray(ht, argc, argv) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(argv[0]); - if(argc == 2) { - convert_to_string(argv[1]); - fieldname = argv[1]->value.str.val; - } else { - fieldname = NULL; - } - id=argv[0]->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFNextFieldName(fdf, fieldname, NULL, 0, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - if(nr == 0) - RETURN_STRING(empty_string, 1); - - buffer = emalloc(nr); - err = FDFNextFieldName(fdf, fieldname, buffer, nr, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_STRING(buffer, 0); -} -/* }}} */ - -/* {{{ proto void fdf_set_ap(int fdfdoc, string fieldname, int face, string filename, int pagenr) - Sets the value of a field */ -PHP_FUNCTION(fdf_set_ap) { - pval *arg1, *arg2, *arg3, *arg4, *arg5; - int id, type; - FDFDoc fdf; - FDFErc err; - FDFAppFace face; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 5 || getParameters(ht, 5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - convert_to_long(arg3); - convert_to_string(arg4); - convert_to_long(arg5); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - switch(arg3->value.lval) { - case 1: - face = FDFNormalAP; - break; - case 2: - face = FDFRolloverAP; - break; - case 3: - face = FDFDownAP; - break; - default: - face = FDFNormalAP; - } - - err = FDFSetAP(fdf, arg2->value.str.val, face, NULL, arg4->value.str.val, (ASInt32) arg5->value.lval); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto void fdf_set_status(int fdfdoc, string status) - Sets the value in the /Status key. */ -PHP_FUNCTION(fdf_set_status) { - pval *arg1, *arg2; - int id, type; - ASInt32 nr; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFSetStatus(fdf, arg2->value.str.val); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto void fdf_get_status(int fdfdoc) - Gets the value in the /Status key. */ -PHP_FUNCTION(fdf_get_status) { - pval *arg1; - int id, type; - ASInt32 nr; - char *buf; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFGetStatus(fdf, NULL, 0, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - if(nr == 0) - RETURN_STRING(empty_string, 1); - buf = emalloc(nr); - err = FDFGetStatus(fdf, buf, nr, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_STRING(buf, 0); -} -/* }}} */ - -/* {{{ proto void fdf_set_file(int fdfdoc, string filename) - Sets the value of the FDF's /F key */ -PHP_FUNCTION(fdf_set_file) { - pval *arg1, *arg2; - int id, type; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFSetFile(fdf, arg2->value.str.val); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto void fdf_get_file(int fdfdoc) - Gets the value in the /F key. */ -PHP_FUNCTION(fdf_get_file) { - pval *arg1; - int id, type; - ASInt32 nr; - char *buf; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFGetFile(fdf, NULL, 0, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - if(nr == 0) - RETURN_STRING(empty_string, 1); - buf = emalloc(nr); - err = FDFGetFile(fdf, buf, nr, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_STRING(buf, 0); -} -/* }}} */ - -/* {{{ proto void fdf_save(int fdfdoc, string filename) - Writes out an FDF file. */ -PHP_FUNCTION(fdf_save) { - pval *arg1, *arg2; - int id, type; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFSave(fdf, arg2->value.str.val); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_TRUE; -} /* }}} */ - -/* {{{ proto void fdf_add_template(int fdfdoc, int newpage, string filename, string template, int rename) - Adds a template to the FDF*/ -PHP_FUNCTION(fdf_add_template) { - pval *arg1, *arg2, *arg3, *arg4, *arg5; - int id, type; - FDFDoc fdf; - FDFErc err; - pdfFileSpecRec filespec; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 5 || getParameters(ht, 5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_long(arg2); - convert_to_string(arg3); - convert_to_string(arg4); - convert_to_long(arg5); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php3_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - filespec.FS = NULL; - filespec.F = arg3->value.str.val; - filespec.Mac = NULL; - filespec.DOS = NULL; - filespec.Unix = NULL; - filespec.ID[0] = NULL; - filespec.ID[1] = NULL; - filespec.bVolatile = false; - err = FDFAddTemplate(fdf, arg2->value.lval, &filespec, arg4->value.str.val, arg5->value.lval); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_TRUE; -} -/* }}} */ - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/fdf/php3_fdf.h b/ext/fdf/php3_fdf.h deleted file mode 100644 index dd8a560839570..0000000000000 --- a/ext/fdf/php3_fdf.h +++ /dev/null @@ -1,65 +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: Uwe Steinmann | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#ifndef _PHP3_FDF_H -#define _PHP3_FDF_H - -#if HAVE_FDFLIB -#if WIN32|WINNT -#else -#define UNIX_DEV -#endif - -#include - -extern php3_module_entry fdf_module_entry; -#define phpext_fdf_ptr &fdf_module_entry - -extern PHP_MINIT_FUNCTION(fdf); -extern PHP_MSHUTDOWN_FUNCTION(fdf); -PHP_MINFO_FUNCTION(fdf); - -PHP_FUNCTION(fdf_open); -PHP_FUNCTION(fdf_close); -PHP_FUNCTION(fdf_create); -PHP_FUNCTION(fdf_save); -PHP_FUNCTION(fdf_get_value); -PHP_FUNCTION(fdf_set_value); -PHP_FUNCTION(fdf_next_field_name); -PHP_FUNCTION(fdf_set_ap); -PHP_FUNCTION(fdf_get_status); -PHP_FUNCTION(fdf_set_status); -PHP_FUNCTION(fdf_set_file); -PHP_FUNCTION(fdf_get_file); -PHP_FUNCTION(fdf_add_template); -#else -#define phpext_fdf_ptr NULL -#endif -#endif /* _PHP3_FDF_H */ diff --git a/ext/fdf/setup.stub b/ext/fdf/setup.stub deleted file mode 100644 index 9637713bdebe9..0000000000000 --- a/ext/fdf/setup.stub +++ /dev/null @@ -1,7 +0,0 @@ -# $Source$ -# $Id$ - -define_option with-fdftk 'Acrobat Forms (Ftf Toolkit 2.0) support? ' yesnodir \ - 'no /usr/local ftktk install' \ -' Whether to use the Ftf Toolkit support to write/read .fdf-files.\n - Tested for version 2.0!' diff --git a/ext/filepro/Makefile.am b/ext/filepro/Makefile.am deleted file mode 100644 index 4a97e91f971a2..0000000000000 --- a/ext/filepro/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_filepro.la -libphpext_filepro_la_SOURCES=filepro.c - diff --git a/ext/filepro/config.h.stub b/ext/filepro/config.h.stub deleted file mode 100644 index 0a273b1502092..0000000000000 --- a/ext/filepro/config.h.stub +++ /dev/null @@ -1,2 +0,0 @@ -#define HAVE_FILEPRO 0 - diff --git a/ext/filepro/config.m4 b/ext/filepro/config.m4 deleted file mode 100644 index 2c0fd3b43b333..0000000000000 --- a/ext/filepro/config.m4 +++ /dev/null @@ -1,17 +0,0 @@ -dnl $Id$ - -AC_MSG_CHECKING(whether to include the bundled filePro support) -AC_ARG_WITH(filepro, -[ --with-filepro Include the bundled read-only filePro support],[ - if test "$withval" != "no"; then - AC_DEFINE(HAVE_FILEPRO, 1) - AC_MSG_RESULT(yes) - PHP_EXTENSION(filepro) - else - AC_DEFINE(HAVE_FILEPRO, 0) - AC_MSG_RESULT(no) - fi -],[ - AC_DEFINE(HAVE_FILEPRO, 0) - AC_MSG_RESULT(no) -]) diff --git a/ext/filepro/filepro.c b/ext/filepro/filepro.c deleted file mode 100644 index 83a63e8f3e72b..0000000000000 --- a/ext/filepro/filepro.c +++ /dev/null @@ -1,540 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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: Chad Robinson | - +----------------------------------------------------------------------+ - - filePro 4.x support developed by Chad Robinson, chadr@brttech.com - Contact Chad Robinson at BRT Technical Services Corp. for details. - filePro is a registered trademark by Fiserv, Inc. This file contains - no code or information that is not freely available from the filePro - web site at http://www.fileproplus.com/ - - */ - -#include "php.h" -#include "safe_mode.h" -#include "fopen-wrappers.h" -#include -#if MSVC5 -#include -#else -#include -#endif -#include -#include "php_globals.h" - -#include "php_filepro.h" -#if HAVE_FILEPRO - -typedef struct fp_field { - char *name; - char *format; - int width; - struct fp_field *next; -} FP_FIELD; - -#ifdef THREAD_SAFE -DWORD FPTls; -static int numthreads=0; - -typedef struct fp_global_struct{ - char *fp_database; - signed int fp_fcount; - signed int fp_keysize; - FP_FIELD *fp_fieldlist; -}fp_global_struct; - -#define FP_GLOBAL(a) fp_globals->a - -#define FP_TLS_VARS \ - fp_global_struct *fp_globals; \ - fp_globals=TlsGetValue(FPTls); - -#else -#define FP_GLOBAL(a) a -#define FP_TLS_VARS -static char *fp_database = NULL; /* Database directory */ -static signed int fp_fcount = -1; /* Column count */ -static signed int fp_keysize = -1; /* Size of key records */ -static FP_FIELD *fp_fieldlist = NULL; /* List of fields */ -#endif - - -PHP_MINIT_FUNCTION(filepro) -{ -#ifdef THREAD_SAFE - fp_global_struct *fp_globals; -#if !COMPILE_DL - CREATE_MUTEX(fp_mutex,"FP_TLS"); - SET_MUTEX(fp_mutex); - numthreads++; - if (numthreads==1){ - if ((FPTls=TlsAlloc())==0xFFFFFFFF){ - FREE_MUTEX(fp_mutex); - return 0; - }} - FREE_MUTEX(fp_mutex); -#endif - fp_globals = (fp_global_struct *) LocalAlloc(LPTR, sizeof(fp_global_struct)); - TlsSetValue(FPTls, (void *) fp_globals); -#endif - FP_GLOBAL(fp_database)=NULL; - FP_GLOBAL(fp_fcount)=-1; - FP_GLOBAL(fp_keysize)=-1; - FP_GLOBAL(fp_fieldlist)=NULL; - - return SUCCESS; -} - -PHP_MSHUTDOWN_FUNCTION(filepro) -{ -#ifdef THREAD_SAFE - fp_global_struct *fp_globals; - fp_globals = TlsGetValue(FPTls); - if (fp_globals != 0) - LocalFree((HLOCAL) fp_globals); -#if !COMPILE_DL - SET_MUTEX(fp_mutex); - numthreads--; - if (!numthreads){ - if (!TlsFree(FPTls)){ - FREE_MUTEX(fp_mutex); - return 0; - }} - FREE_MUTEX(fp_mutex); -#endif -#endif - return SUCCESS; -} - - -function_entry filepro_functions[] = { - PHP_FE(filepro, NULL) - PHP_FE(filepro_rowcount, NULL) - PHP_FE(filepro_fieldname, NULL) - PHP_FE(filepro_fieldtype, NULL) - PHP_FE(filepro_fieldwidth, NULL) - PHP_FE(filepro_fieldcount, NULL) - PHP_FE(filepro_retrieve, NULL) - {NULL, NULL, NULL} -}; - -php3_module_entry filepro_module_entry = { - "FilePro", filepro_functions, PHP_MINIT(filepro), PHP_MSHUTDOWN(filepro), NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES -}; - - -#if COMPILE_DL -#include "dl/phpdl.h" -DLEXPORT php3_module_entry *get_module(void) { return &filepro_module_entry; } -#if (WIN32|WINNT) && defined(THREAD_SAFE) - -/*NOTE: You should have an odbc.def file where you -export DllMain*/ -BOOL WINAPI DllMain(HANDLE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved) -{ - switch( ul_reason_for_call ) { - case DLL_PROCESS_ATTACH: - if ((FPTls=TlsAlloc())==0xFFFFFFFF){ - return 0; - } - break; - case DLL_THREAD_ATTACH: - break; - case DLL_THREAD_DETACH: - break; - case DLL_PROCESS_DETACH: - if (!TlsFree(FPTls)){ - return 0; - } - break; - } - return 1; -} -#endif -#endif - -/* - * LONG filePro(STRING directory) - * - * Read and verify the map file. We store the field count and field info - * internally, which means we become unstable if you modify the table while - * a user is using it! We cannot lock anything since Web connections don't - * provide the ability to later unlock what we locked. Be smart, be safe. - */ -PHP_FUNCTION(filepro) -{ - pval *dir; - FILE *fp; - char workbuf[256]; /* FIX - should really be the max filename length */ - char readbuf[256]; - int i; - FP_FIELD *new_field, *tmp; - FP_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &dir) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string(dir); - - /* FIX - we should really check and free these if they are used! */ - FP_GLOBAL(fp_database) = NULL; - FP_GLOBAL(fp_fieldlist) = NULL; - FP_GLOBAL(fp_fcount) = -1; - FP_GLOBAL(fp_keysize) = -1; - - sprintf(workbuf, "%s/map", dir->value.str.val); - - if (PG(safe_mode) && (!_php3_checkuid(workbuf, 2))) { - RETURN_FALSE; - } - - if (_php3_check_open_basedir(workbuf)) { - RETURN_FALSE; - } - - if (!(fp = fopen(workbuf, "r"))) { - php_error(E_WARNING, "filePro: cannot open map: [%d] %s", - errno, strerror(errno)); - RETURN_FALSE; - } - if (!fgets(readbuf, 250, fp)) { - fclose(fp); - php_error(E_WARNING, "filePro: cannot read map: [%d] %s", - errno, strerror(errno)); - RETURN_FALSE; - } - - /* Get the field count, assume the file is readable! */ - if (strcmp(strtok(readbuf, ":"), "map")) { - php_error(E_WARNING, "filePro: map file corrupt or encrypted"); - RETURN_FALSE; - } - FP_GLOBAL(fp_keysize) = atoi(strtok(NULL, ":")); - strtok(NULL, ":"); - FP_GLOBAL(fp_fcount) = atoi(strtok(NULL, ":")); - - /* Read in the fields themselves */ - for (i = 0; i < FP_GLOBAL(fp_fcount); i++) { - if (!fgets(readbuf, 250, fp)) { - fclose(fp); - php_error(E_WARNING, "filePro: cannot read map: [%d] %s", - errno, strerror(errno)); - RETURN_FALSE; - } - new_field = emalloc(sizeof(FP_FIELD)); - new_field->next = NULL; - new_field->name = estrdup(strtok(readbuf, ":")); - new_field->width = atoi(strtok(NULL, ":")); - new_field->format = estrdup(strtok(NULL, ":")); - - /* Store in forward-order to save time later */ - if (!FP_GLOBAL(fp_fieldlist)) { - FP_GLOBAL(fp_fieldlist) = new_field; - } else { - for (tmp = FP_GLOBAL(fp_fieldlist); tmp; tmp = tmp->next) { - if (!tmp->next) { - tmp->next = new_field; - tmp = new_field; - } - } - } - } - fclose(fp); - - FP_GLOBAL(fp_database) = estrndup(dir->value.str.val,dir->value.str.len); - - RETVAL_TRUE; -} - - -/* - * LONG filePro_rowcount(void) - * - * Count the used rows in the database. filePro just marks deleted records - * as deleted; they are not removed. Since no counts are maintained we need - * to go in and count records ourselves. - * - * Errors return false, success returns the row count. - */ -PHP_FUNCTION(filepro_rowcount) -{ - FILE *fp; - char workbuf[MAXPATHLEN]; - char readbuf[256]; - int recsize = 0, records = 0; - FP_TLS_VARS; - - if (ARG_COUNT(ht) != 0) { - WRONG_PARAM_COUNT; - } - - if (!FP_GLOBAL(fp_database)) { - php_error(E_WARNING, - "filePro: must set database directory first!\n"); - RETURN_FALSE; - } - - recsize = FP_GLOBAL(fp_keysize) + 19; /* 20 bytes system info -1 to save time later */ - - /* Now read the records in, moving forward recsize-1 bytes each time */ - sprintf(workbuf, "%s/key", FP_GLOBAL(fp_database)); - - if (PG(safe_mode) && (!_php3_checkuid(workbuf, 2))) { - RETURN_FALSE; - } - - if (_php3_check_open_basedir(workbuf)) { - RETURN_FALSE; - } - - if (!(fp = fopen(workbuf, "r"))) { - php_error(E_WARNING, "filePro: cannot open key: [%d] %s", - errno, strerror(errno)); - RETURN_FALSE; - } - while (!feof(fp)) { - if (fread(readbuf, 1, 1, fp) == 1) { - if (readbuf[0]) - records++; - fseek(fp, recsize, SEEK_CUR); - } - } - fclose(fp); - - RETVAL_LONG(records); -} - - -/* - * STRING filePro_fieldname(LONG field_number) - * - * Errors return false, success returns the name of the field. - */ -PHP_FUNCTION(filepro_fieldname) -{ - pval *fno; - FP_FIELD *lp; - int i; - FP_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &fno) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(fno); - - if (!FP_GLOBAL(fp_database)) { - php_error(E_WARNING, - "filePro: must set database directory first!\n"); - RETURN_FALSE; - } - - for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp; lp = lp->next, i++) { - if (i == fno->value.lval) { - RETURN_STRING(lp->name,1); - } - } - - php_error(E_WARNING, - "filePro: unable to locate field number %d.\n", - fno->value.lval); - - RETVAL_FALSE; -} - - -/* - * STRING filePro_fieldtype(LONG field_number) - * - * Errors return false, success returns the type (edit) of the field - */ -PHP_FUNCTION(filepro_fieldtype) -{ - pval *fno; - FP_FIELD *lp; - int i; - FP_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &fno) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(fno); - - if (!FP_GLOBAL(fp_database)) { - php_error(E_WARNING, - "filePro: must set database directory first!\n"); - RETURN_FALSE; - } - - for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp; lp = lp->next, i++) { - if (i == fno->value.lval) { - RETURN_STRING(lp->format,1); - } - } - php_error(E_WARNING, - "filePro: unable to locate field number %d.\n", - fno->value.lval); - RETVAL_FALSE; -} - - -/* - * STRING filePro_fieldwidth(int field_number) - * - * Errors return false, success returns the character width of the field. - */ -PHP_FUNCTION(filepro_fieldwidth) -{ - pval *fno; - FP_FIELD *lp; - int i; - FP_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &fno) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(fno); - - if (!FP_GLOBAL(fp_database)) { - php_error(E_WARNING, - "filePro: must set database directory first!\n"); - RETURN_FALSE; - } - - for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp; lp = lp->next, i++) { - if (i == fno->value.lval) { - RETURN_LONG(lp->width); - } - } - php_error(E_WARNING, - "filePro: unable to locate field number %d.\n", - fno->value.lval); - RETVAL_FALSE; -} - - -/* - * LONG filePro_fieldcount(void) - * - * Errors return false, success returns the field count. - */ -PHP_FUNCTION(filepro_fieldcount) -{ - FP_TLS_VARS; - - if (ARG_COUNT(ht) != 0) { - WRONG_PARAM_COUNT; - } - - if (!FP_GLOBAL(fp_database)) { - php_error(E_WARNING, - "filePro: must set database directory first!\n"); - RETURN_FALSE; - } - - /* Read in the first line from the map file */ - RETVAL_LONG(FP_GLOBAL(fp_fcount)); -} - - -/* - * STRING filePro_retrieve(int row_number, int field_number) - * - * Errors return false, success returns the datum. - */ -PHP_FUNCTION(filepro_retrieve) -{ - pval *rno, *fno; - FP_FIELD *lp; - FILE *fp; - char workbuf[MAXPATHLEN]; - char readbuf[1024]; /* FIX - Work out better buffering! */ - int i, fnum, rnum; - long offset; - FP_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &rno, &fno) == FAILURE) { - WRONG_PARAM_COUNT; - } - - if (!FP_GLOBAL(fp_database)) { - php_error(E_WARNING, - "filePro: must set database directory first!\n"); - RETURN_FALSE; - } - - convert_to_long(rno); - convert_to_long(fno); - - fnum = fno->value.lval; - rnum = rno->value.lval; - - if (rnum < 0 || fnum < 0 || fnum >= FP_GLOBAL(fp_fcount)) { - php_error(E_WARNING, "filepro: parameters out of range"); - RETURN_FALSE; - } - - offset = (rnum + 1) * (FP_GLOBAL(fp_keysize) + 20) + 20; /* Record location */ - for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp && i < fnum; lp = lp->next, i++) { - offset += lp->width; - } - if (!lp) { - php_error(E_WARNING, "filePro: cannot locate field"); - RETURN_FALSE; - } - - /* Now read the record in */ - sprintf(workbuf, "%s/key", FP_GLOBAL(fp_database)); - - if (PG(safe_mode) && (!_php3_checkuid(workbuf, 2))) { - RETURN_FALSE; - } - - if (_php3_check_open_basedir(workbuf)) { - RETURN_FALSE; - } - - if (!(fp = fopen(workbuf, "r"))) { - php_error(E_WARNING, "filePro: cannot open key: [%d] %s", - errno, strerror(errno)); - fclose(fp); - RETURN_FALSE; - } - fseek(fp, offset, SEEK_SET); - if (fread(readbuf, lp->width, 1, fp) != 1) { - php_error(E_WARNING, "filePro: cannot read data: [%d] %s", - errno, strerror(errno)); - fclose(fp); - RETURN_FALSE; - } - readbuf[lp->width] = '\0'; - fclose(fp); - RETURN_STRING(readbuf,1); -} - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/filepro/php_filepro.h b/ext/filepro/php_filepro.h deleted file mode 100644 index 850eeb8dcd261..0000000000000 --- a/ext/filepro/php_filepro.h +++ /dev/null @@ -1,58 +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: Chad Robinson | - +----------------------------------------------------------------------+ - - filePro 4.x support developed by Chad Robinson, chadr@brttech.com - Contact Chad Robinson at BRT Technical Services Corp. for details. - filePro is a registered trademark by Fiserv, Inc. This file contains - no code or information that is not freely available from the filePro - web site at http://www.fileproplus.com/ - - */ - -/* $Id$ */ - -#ifndef _FILEPRO_H -#define _FILEPRO_H -#if HAVE_FILEPRO -extern php3_module_entry filepro_module_entry; -#define phpext_filepro_ptr &filepro_module_entry - -PHP_FUNCTION(filepro); -PHP_FUNCTION(filepro_rowcount); -PHP_FUNCTION(filepro_fieldname); -PHP_FUNCTION(filepro_fieldtype); -PHP_FUNCTION(filepro_fieldwidth); -PHP_FUNCTION(filepro_fieldcount); -PHP_FUNCTION(filepro_retrieve); - -extern PHP_MINIT_FUNCTION(filepro); -extern PHP_MSHUTDOWN_FUNCTION(filepro); -#else -#define phpext_filepro_ptr NULL -#endif -#endif /* _FILEPRO_H */ diff --git a/ext/filepro/setup.stub b/ext/filepro/setup.stub deleted file mode 100644 index 7107744f020fb..0000000000000 --- a/ext/filepro/setup.stub +++ /dev/null @@ -1,5 +0,0 @@ -# $Source$ -# $Id$ - -define_option with-filepro 'filePro support? ' yesno no \ -' Whether to use the bundled filePro library. Read-access only.' diff --git a/ext/ftp/Makefile.am b/ext/ftp/Makefile.am deleted file mode 100644 index 8ba82c10d1c4f..0000000000000 --- a/ext/ftp/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_ftp.la -libphpext_ftp_la_SOURCES=php_ftp.c ftp.c diff --git a/ext/ftp/config.h.stub b/ext/ftp/config.h.stub deleted file mode 100644 index d63248456cd1f..0000000000000 --- a/ext/ftp/config.h.stub +++ /dev/null @@ -1,2 +0,0 @@ -/* define if you want to use the ftp extension */ -#define HAVE_FTP 0 diff --git a/ext/ftp/config.m4 b/ext/ftp/config.m4 deleted file mode 100644 index 7b01e6b54d5fb..0000000000000 --- a/ext/ftp/config.m4 +++ /dev/null @@ -1,18 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension ftp -dnl don't forget to call PHP_EXTENSION(ftp) - -AC_MSG_CHECKING(for FTP support) -AC_ARG_WITH(ftp, -[ --with-ftp Include FTP support.], -[ - if test "$withval" != "no"; then - AC_DEFINE(HAVE_FTP) - PHP_EXTENSION(ftp) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi -],[ - AC_MSG_RESULT(no) -]) diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c deleted file mode 100644 index 47131efa31dae..0000000000000 --- a/ext/ftp/ftp.c +++ /dev/null @@ -1,1165 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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: | - | Andrew Skalski | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if HAVE_FTP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if HAVE_SYS_TIME_H -#include -#endif - -#include "ftp.h" - -/* sends an ftp command, returns true on success, false on error. - * it sends the string "cmd args\r\n" if args is non-null, or - * "cmd\r\n" if args is null - */ -static int ftp_putcmd( ftpbuf_t *ftp, - const char *cmd, - const char *args); - -/* wrapper around send/recv to handle timeouts */ -static int my_send(int s, void *buf, size_t len); -static int my_recv(int s, void *buf, size_t len); -static int my_connect(int s, const struct sockaddr *addr, - int addrlen); -static int my_accept(int s, struct sockaddr *addr, int *addrlen); - -/* reads a line the socket , returns true on success, false on error */ -static int ftp_readline(ftpbuf_t *ftp); - -/* reads an ftp response, returns true on success, false on error */ -static int ftp_getresp(ftpbuf_t *ftp); - -/* sets the ftp transfer type */ -static int ftp_type(ftpbuf_t *ftp, ftptype_t type); - -/* opens up a data stream */ -static databuf_t* ftp_getdata(ftpbuf_t *ftp); - -/* accepts the data connection, returns updated data buffer */ -static databuf_t* data_accept(databuf_t *data); - -/* closes the data connection, returns NULL */ -static databuf_t* data_close(databuf_t *data); - -/* generic file lister */ -static char** ftp_genlist(ftpbuf_t *ftp, - const char *cmd, const char *path); - -/* IP and port conversion box */ -union ipbox { - unsigned long l[2]; - unsigned short s[4]; - unsigned char c[8]; -}; - - -ftpbuf_t* -ftp_open(const char *host, short port) -{ - int fd = -1; - ftpbuf_t *ftp; - struct sockaddr_in addr; - struct hostent *he; - int size; - - - /* set up the address */ - if ((he = gethostbyname(host)) == NULL) { -#if 0 - herror("gethostbyname"); -#endif - return NULL; - } - - memset(&addr, 0, sizeof(addr)); - memcpy(&addr.sin_addr, he->h_addr, he->h_length); - addr.sin_family = AF_INET; - addr.sin_port = port ? port : htons(21); - - - /* alloc the ftp structure */ - ftp = calloc(1, sizeof(*ftp)); - if (ftp == NULL) { - perror("calloc"); - return NULL; - } - - /* connect */ - if ((fd = socket(PF_INET, SOCK_STREAM, 0)) == -1) { - perror("socket"); - goto bail; - } - - if (my_connect(fd, (struct sockaddr*) &addr, sizeof(addr)) == -1) { - perror("connect"); - goto bail; - } - - size = sizeof(addr); - if (getsockname(fd, (struct sockaddr*) &addr, &size) == -1) { - perror("getsockname"); - goto bail; - } - - ftp->localaddr = addr.sin_addr; - ftp->fd = fd; - - if (!ftp_getresp(ftp) || ftp->resp != 220) { - goto bail; - } - - return ftp; - -bail: - if (fd != -1) - close(fd); - free(ftp); - return NULL; -} - - -ftpbuf_t* -ftp_close(ftpbuf_t *ftp) -{ - if (ftp == NULL) - return NULL; - if (ftp->fd) - close(ftp->fd); - ftp_gc(ftp); - free(ftp); - return NULL; -} - - -void -ftp_gc(ftpbuf_t *ftp) -{ - if (ftp == NULL) - return; - - free(ftp->pwd); - ftp->pwd = NULL; - free(ftp->syst); - ftp->syst = NULL; -} - - -int -ftp_quit(ftpbuf_t *ftp) -{ - if (ftp == NULL) - return 0; - - if (!ftp_putcmd(ftp, "QUIT", NULL)) - return 0; - if (!ftp_getresp(ftp) || ftp->resp != 221) - return 0; - - free(ftp->pwd); - ftp->pwd = NULL; - - return 1; -} - - -int -ftp_login(ftpbuf_t *ftp, const char *user, const char *pass) -{ - if (ftp == NULL) - return 0; - - if (!ftp_putcmd(ftp, "USER", user)) - return 0; - if (!ftp_getresp(ftp)) - return 0; - if (ftp->resp == 230) - return 1; - if (ftp->resp != 331) - return 0; - if (!ftp_putcmd(ftp, "PASS", pass)) - return 0; - if (!ftp_getresp(ftp)) - return 0; - return (ftp->resp == 230); -} - - -int -ftp_reinit(ftpbuf_t *ftp) -{ - if (ftp == NULL) - return 0; - - ftp_gc(ftp); - - if (!ftp_putcmd(ftp, "REIN", NULL)) - return 0; - if (!ftp_getresp(ftp) || ftp->resp != 220) - return 0; - - return 1; -} - - -const char* -ftp_syst(ftpbuf_t *ftp) -{ - char *syst, *end; - - if (ftp == NULL) - return NULL; - - /* default to cached value */ - if (ftp->syst) - return ftp->syst; - - if (!ftp_putcmd(ftp, "SYST", NULL)) - return NULL; - if (!ftp_getresp(ftp) || ftp->resp != 215) - return NULL; - - syst = ftp->inbuf; - if ((end = strchr(syst, ' '))) - *end = 0; - ftp->syst = strdup(syst); - if (end) - *end = ' '; - - return ftp->syst; -} - - -const char* -ftp_pwd(ftpbuf_t *ftp) -{ - char *pwd, *end; - - if (ftp == NULL) - return NULL; - - /* default to cached value */ - if (ftp->pwd) - return ftp->pwd; - - if (!ftp_putcmd(ftp, "PWD", NULL)) - return NULL; - if (!ftp_getresp(ftp) || ftp->resp != 257) - return NULL; - - /* copy out the pwd from response */ - if ((pwd = strchr(ftp->inbuf, '"')) == NULL) - return NULL; - end = strrchr(++pwd, '"'); - *end = 0; - ftp->pwd = strdup(pwd); - *end = '"'; - - return ftp->pwd; -} - - -int -ftp_chdir(ftpbuf_t *ftp, const char *dir) -{ - if (ftp == NULL) - return 0; - - free(ftp->pwd); - ftp->pwd = NULL; - - if (!ftp_putcmd(ftp, "CWD", dir)) - return 0; - if (!ftp_getresp(ftp) || ftp->resp != 250) - return 0; - - return 1; -} - - -int -ftp_cdup(ftpbuf_t *ftp) -{ - if (ftp == NULL) - return 0; - - free(ftp->pwd); - ftp->pwd = NULL; - - if (!ftp_putcmd(ftp, "CDUP", NULL)) - return 0; - if (!ftp_getresp(ftp) || ftp->resp != 250) - return 0; - - return 1; -} - - -char* -ftp_mkdir(ftpbuf_t *ftp, const char *dir) -{ - char *mkd, *end; - - if (ftp == NULL) - return NULL; - - if (!ftp_putcmd(ftp, "MKD", dir)) - return NULL; - if (!ftp_getresp(ftp) || ftp->resp != 257) - return NULL; - - /* copy out the dir from response */ - if ((mkd = strchr(ftp->inbuf, '"')) == NULL) - return NULL; - end = strrchr(++mkd, '"'); - *end = 0; - mkd = strdup(mkd); - *end = '"'; - - return mkd; -} - - -int -ftp_rmdir(ftpbuf_t *ftp, const char *dir) -{ - if (ftp == NULL) - return 0; - - if (!ftp_putcmd(ftp, "RMD", dir)) - return 0; - if (!ftp_getresp(ftp) || ftp->resp != 250) - return 0; - - return 1; -} - - -char** -ftp_nlist(ftpbuf_t *ftp, const char *path) -{ - return ftp_genlist(ftp, "NLST", path); -} - - -char** -ftp_list(ftpbuf_t *ftp, const char *path) -{ - return ftp_genlist(ftp, "LIST", path); -} - - -int -ftp_type(ftpbuf_t *ftp, ftptype_t type) -{ - char typechar[2] = "?"; - - if (ftp == NULL) - return 0; - - if (type == ftp->type) - return 1; - - if (type == FTPTYPE_ASCII) - typechar[0] = 'A'; - else if (type == FTPTYPE_IMAGE) - typechar[0] = 'I'; - else - return 0; - - if (!ftp_putcmd(ftp, "TYPE", typechar)) - return 0; - if (!ftp_getresp(ftp) || ftp->resp != 200) - return 0; - - ftp->type = type; - - return 1; -} - - -int -ftp_pasv(ftpbuf_t *ftp, int pasv) -{ - char *ptr; - union ipbox ipbox; - unsigned long b[6]; - int n; - - if (ftp == NULL) - return 0; - - if (pasv && ftp->pasv == 2) - return 1; - - ftp->pasv = 0; - if (!pasv) - return 1; - - if (!ftp_putcmd(ftp, "PASV", NULL)) - return 0; - if (!ftp_getresp(ftp) || ftp->resp != 227) - return 0; - - /* parse out the IP and port */ - for (ptr = ftp->inbuf; *ptr && !isdigit(*ptr); ptr++); - n = sscanf(ptr, "%lu,%lu,%lu,%lu,%lu,%lu", - &b[0], &b[1], &b[2], &b[3], &b[4], &b[5]); - if (n != 6) - return 0; - - for (n=0; n<6; n++) - ipbox.c[n] = b[n]; - - memset(&ftp->pasvaddr, 0, sizeof(ftp->pasvaddr)); - ftp->pasvaddr.sin_family = AF_INET; - ftp->pasvaddr.sin_addr.s_addr = ipbox.l[0]; - ftp->pasvaddr.sin_port = ipbox.s[2]; - - ftp->pasv = 2; - - return 1; -} - - -int -ftp_get(ftpbuf_t *ftp, FILE *outfp, const char *path, ftptype_t type) -{ - databuf_t *data = NULL; - char *ptr; - int lastch; - int rcvd; - - if (ftp == NULL) - return 0; - - if (!ftp_type(ftp, type)) - goto bail; - - if ((data = ftp_getdata(ftp)) == NULL) - goto bail; - - if (!ftp_putcmd(ftp, "RETR", path)) - goto bail; - if (!ftp_getresp(ftp) || ftp->resp != 150) - goto bail; - - if ((data = data_accept(data)) == NULL) - goto bail; - - lastch = 0; - while ((rcvd = my_recv(data->fd, data->buf, FTP_BUFSIZE))) { - if (rcvd == -1) - goto bail; - - if (type == FTPTYPE_ASCII) { - for (ptr = data->buf; rcvd; rcvd--, ptr++) { - if (lastch == '\r' && *ptr != '\n') - putc('\r', outfp); - if (*ptr != '\r') - putc(*ptr, outfp); - lastch = *ptr; - } - } - else { - fwrite(data->buf, rcvd, 1, outfp); - } - } - - if (type == FTPTYPE_ASCII && lastch == '\r') - putc('\r', outfp); - - data = data_close(data); - - if (ferror(outfp)) - goto bail; - - if (!ftp_getresp(ftp) || ftp->resp != 226) - goto bail; - - return 1; -bail: - data_close(data); - return 0; -} - - -int -ftp_put(ftpbuf_t *ftp, const char *path, FILE *infp, ftptype_t type) -{ - databuf_t *data = NULL; - int size; - char *ptr; - int ch; - - if (ftp == NULL) - return 0; - - if (!ftp_type(ftp, type)) - goto bail; - - if ((data = ftp_getdata(ftp)) == NULL) - goto bail; - - if (!ftp_putcmd(ftp, "STOR", path)) - goto bail; - if (!ftp_getresp(ftp) || ftp->resp != 150) - goto bail; - - if ((data = data_accept(data)) == NULL) - goto bail; - - size = 0; - ptr = data->buf; - while ((ch = getc(infp)) != EOF) { - /* flush if necessary */ - if (FTP_BUFSIZE - size < 2) { - if (my_send(data->fd, data->buf, size) != size) - goto bail; - ptr = data->buf; - size = 0; - } - - if (ch == '\n' && type == FTPTYPE_ASCII) { - *ptr++ = '\r'; - size++; - } - - *ptr++ = ch; - size++; - } - - if (size && my_send(data->fd, data->buf, size) != size) - goto bail; - - if (ferror(infp)) - goto bail; - - data = data_close(data); - - if (!ftp_getresp(ftp) || ftp->resp != 226) - goto bail; - - return 1; -bail: - data_close(data); - return 0; -} - - -int -ftp_size(ftpbuf_t *ftp, const char *path) -{ - if (ftp == NULL) - return -1; - - if (!ftp_putcmd(ftp, "SIZE", path)) - return -1; - if (!ftp_getresp(ftp) || ftp->resp != 213) - return -1; - - return atoi(ftp->inbuf); -} - - -time_t -ftp_mdtm(ftpbuf_t *ftp, const char *path) -{ - time_t stamp; - struct tm *gmt; - struct tm tm; - char *ptr; - int n; - - if (ftp == NULL) - return -1; - - if (!ftp_putcmd(ftp, "MDTM", path)) - return -1; - if (!ftp_getresp(ftp) || ftp->resp != 213) - return -1; - - /* parse out the timestamp */ - for (ptr = ftp->inbuf; *ptr && !isdigit(*ptr); ptr++); - n = sscanf(ptr, "%4u%2u%2u%2u%2u%2u", - &tm.tm_year, &tm.tm_mon, &tm.tm_mday, - &tm.tm_hour, &tm.tm_min, &tm.tm_sec); - if (n != 6) - return -1; - tm.tm_year -= 1900; - tm.tm_mon--; - tm.tm_isdst = -1; - - /* figure out the GMT offset */ - stamp = time(NULL); - gmt = gmtime(&stamp); - gmt->tm_isdst = -1; - - /* apply the GMT offset */ - tm.tm_sec += stamp - mktime(gmt); - tm.tm_isdst = gmt->tm_isdst; - - stamp = mktime(&tm); - - return stamp; -} - - -int -ftp_delete(ftpbuf_t *ftp, const char *path) -{ - if (ftp == NULL) - return 0; - - if (!ftp_putcmd(ftp, "DELE", path)) - return 0; - if (!ftp_getresp(ftp) || ftp->resp != 250) - return 0; - - return 1; -} - - -int -ftp_rename(ftpbuf_t *ftp, const char *src, const char *dest) -{ - if (ftp == NULL) - return 0; - - if (!ftp_putcmd(ftp, "RNFR", src)) - return 0; - if (!ftp_getresp(ftp) || ftp->resp != 350) - return 0; - - if (!ftp_putcmd(ftp, "RNTO", dest)) - return 0; - if (!ftp_getresp(ftp) || ftp->resp != 250) - return 0; - - return 1; -} - -/* static functions */ - -int -ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args) -{ - int size; - char *data; - - /* build the output buffer */ - if (args) { - /* "cmd args\r\n\0" */ - if (strlen(cmd) + strlen(args) + 4 > FTP_BUFSIZE) - return 0; - size = sprintf(ftp->outbuf, "%s %s\r\n", cmd, args); - } - else { - /* "cmd\r\n\0" */ - if (strlen(cmd) + 3 > FTP_BUFSIZE) - return 0; - size = sprintf(ftp->outbuf, "%s\r\n", cmd); - } - - data = ftp->outbuf; - if (my_send(ftp->fd, data, size) != size) - return 0; - - return 1; -} - - -int -ftp_readline(ftpbuf_t *ftp) -{ - int size, rcvd; - char *data, *eol; - - /* shift the extra to the front */ - size = FTP_BUFSIZE; - rcvd = 0; - if (ftp->extra) { - memmove(ftp->inbuf, ftp->extra, ftp->extralen); - rcvd = ftp->extralen; - } - - data = ftp->inbuf; - - do { - size -= rcvd; - for (eol = data; rcvd; rcvd--, eol++) { - if (*eol == '\r') { - *eol = 0; - ftp->extra = eol + 1; - if (rcvd > 1 && *(eol + 1) == '\n') { - ftp->extra++; - rcvd--; - } - if ((ftp->extralen = --rcvd) == 0) - ftp->extra = NULL; - return 1; - } - else if (*eol == '\n') { - *eol = 0; - ftp->extra = eol + 1; - if ((ftp->extralen = --rcvd) == 0) - ftp->extra = NULL; - return 1; - } - } - - data = eol; - if ((rcvd = my_recv(ftp->fd, data, size)) < 1) - return 0; - } while (size); - - return 0; -} - - -int -ftp_getresp(ftpbuf_t *ftp) -{ - char *buf; - - if (ftp == NULL) - return 0; - buf = ftp->inbuf; - ftp->resp = 0; - - - while (1) { - if (!ftp_readline(ftp)) - return 0; - if (ftp->inbuf[3] == '-') - continue; - else if (ftp->inbuf[3] != ' ') - return 0; - break; - } - - /* translate the tag */ - if ( !isdigit(ftp->inbuf[0]) || - !isdigit(ftp->inbuf[1]) || - !isdigit(ftp->inbuf[2])) - { - return 0; - } - - ftp->resp = 100 * (ftp->inbuf[0] - '0') + - 10 * (ftp->inbuf[1] - '0') + - (ftp->inbuf[2] - '0'); - - memmove(ftp->inbuf, ftp->inbuf + 4, FTP_BUFSIZE - 4); - - return 1; -} - - -int -my_send(int s, void *buf, size_t len) -{ - fd_set write_set; - struct timeval tv; - int n, size, sent; - - size = len; - while (size) { - tv.tv_sec = FTP_TIMEOUT; - tv.tv_usec = 0; - - FD_ZERO(&write_set); - FD_SET(s, &write_set); - n = select(s + 1, NULL, &write_set, NULL, &tv); - if (n < 1) { - if (n == 0) - errno = ETIMEDOUT; - return -1; - } - - sent = send(s, buf, size, 0); - if (sent == -1) - return -1; - - buf += sent; - size -= sent; - } - - return len; -} - - -int -my_recv(int s, void *buf, size_t len) -{ - fd_set read_set; - struct timeval tv; - int n; - - tv.tv_sec = FTP_TIMEOUT; - tv.tv_usec = 0; - - FD_ZERO(&read_set); - FD_SET(s, &read_set); - n = select(s + 1, &read_set, NULL, NULL, &tv); - if (n < 1) { - if (n == 0) - errno = ETIMEDOUT; - return -1; - } - - return recv(s, buf, len, 0); -} - - -int -my_connect(int s, const struct sockaddr *addr, int addrlen) -{ - fd_set conn_set; - int flags; - int n; - int error = 0; - struct timeval tv; - - flags = fcntl(s, F_GETFL, 0); - fcntl(s, F_SETFL, flags | O_NONBLOCK); - - n = connect(s, addr, addrlen); - if (n == -1 && errno != EINPROGRESS) - return -1; - - if (n) { - FD_ZERO(&conn_set); - FD_SET(s, &conn_set); - - tv.tv_sec = FTP_TIMEOUT; - tv.tv_usec = 0; - - n = select(s + 1, &conn_set, &conn_set, NULL, &tv); - if (n < 1) { - if (n == 0) - errno = ETIMEDOUT; - return -1; - } - - if (FD_ISSET(s, &conn_set)) { - n = sizeof(error); - n = getsockopt(s, SOL_SOCKET, SO_ERROR, &error, &n); - if (n == -1 || error) { - if (error) - errno = error; - return -1; - } - } - } - - fcntl(s, F_SETFL, flags); - - return 0; -} - - -int -my_accept(int s, struct sockaddr *addr, int *addrlen) -{ - fd_set accept_set; - struct timeval tv; - int n; - - tv.tv_sec = FTP_TIMEOUT; - tv.tv_usec = 0; - FD_ZERO(&accept_set); - FD_SET(s, &accept_set); - - n = select(s + 1, &accept_set, NULL, NULL, &tv); - if (n < 1) { - if (n == 0) - errno = ETIMEDOUT; - return -1; - } - - return accept(s, addr, addrlen); -} - - -databuf_t* -ftp_getdata(ftpbuf_t *ftp) -{ - int fd = -1; - databuf_t *data; - struct sockaddr_in addr; - int size; - union ipbox ipbox; - char arg[sizeof("255,255,255,255,255,255")]; - - - /* ask for a passive connection if we need one */ - if (ftp->pasv && !ftp_pasv(ftp, 1)) - return NULL; - - /* alloc the data structure */ - data = calloc(1, sizeof(*data)); - if (data == NULL) { - perror("calloc"); - return NULL; - } - data->listener = -1; - data->fd = -1; - data->type = ftp->type; - - /* bind/listen */ - if ((fd = socket(PF_INET, SOCK_STREAM, 0)) == -1) { - perror("socket"); - goto bail; - } - - /* passive connection handler */ - if (ftp->pasv) { - /* clear the ready status */ - ftp->pasv = 1; - - /* connect */ - if (my_connect(fd, (struct sockaddr*) &ftp->pasvaddr, - sizeof(ftp->pasvaddr)) == -1) - { - perror("connect"); - close(fd); - free(data); - return NULL; - } - - data->fd = fd; - - return data; - } - - - /* active (normal) connection */ - - /* bind to a local address */ - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_addr.s_addr = INADDR_ANY; - addr.sin_port = 0; - - if (bind(fd, (struct sockaddr*) &addr, sizeof(addr)) == -1) { - perror("bind"); - goto bail; - } - - size = sizeof(addr); - if (getsockname(fd, (struct sockaddr*) &addr, &size) == -1) { - perror("getsockname"); - goto bail; - } - - if (listen(fd, 5) == -1) { - perror("listen"); - goto bail; - } - - data->listener = fd; - - /* send the PORT */ - ipbox.l[0] = ftp->localaddr.s_addr; - ipbox.s[2] = addr.sin_port; - sprintf(arg, "%u,%u,%u,%u,%u,%u", - ipbox.c[0], ipbox.c[1], ipbox.c[2], ipbox.c[3], - ipbox.c[4], ipbox.c[5]); - - if (!ftp_putcmd(ftp, "PORT", arg)) - goto bail; - if (!ftp_getresp(ftp) || ftp->resp != 200) - goto bail; - - return data; - -bail: - if (fd != -1) - close(fd); - free(data); - return NULL; -} - - -databuf_t* -data_accept(databuf_t *data) -{ - struct sockaddr_in addr; - int size; - - if (data->fd != -1) - return data; - - size = sizeof(addr); - data->fd = my_accept(data->listener, (struct sockaddr*) &addr, &size); - close(data->listener); - data->listener = -1; - - if (data->fd == -1) { - free(data); - return NULL; - } - - return data; -} - - -databuf_t* -data_close(databuf_t *data) -{ - if (data == NULL) - return NULL; - if (data->listener != -1) - close(data->listener); - if (data->fd != -1) - close(data->fd); - free(data); - return NULL; -} - - -char** -ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path) -{ - FILE *tmpfp = NULL; - databuf_t *data = NULL; - char *ptr; - int ch, lastch; - int size, rcvd; - int lines; - char **ret = NULL; - char **entry; - char *text; - - - if ((tmpfp = tmpfile()) == NULL) - return NULL; - - if (!ftp_type(ftp, FTPTYPE_ASCII)) - goto bail; - - if ((data = ftp_getdata(ftp)) == NULL) - goto bail; - - if (!ftp_putcmd(ftp, cmd, path)) - goto bail; - if (!ftp_getresp(ftp) || ftp->resp != 150) - goto bail; - - /* pull data buffer into tmpfile */ - if ((data = data_accept(data)) == NULL) - goto bail; - - size = 0; - lines = 0; - lastch = 0; - while ((rcvd = my_recv(data->fd, data->buf, FTP_BUFSIZE))) { - if (rcvd == -1) - goto bail; - - fwrite(data->buf, rcvd, 1, tmpfp); - - size += rcvd; - for (ptr = data->buf; rcvd; rcvd--, ptr++) { - if (*ptr == '\n' && lastch == '\r') - lines++; - else - size++; - lastch = *ptr; - } - } - - data = data_close(data); - - if (ferror(tmpfp)) - goto bail; - - - - rewind(tmpfp); - - ret = malloc((lines + 1) * sizeof(char**) + size * sizeof(char*)); - if (ret == NULL) { - perror("malloc"); - goto bail; - } - - entry = ret; - text = (char*) (ret + lines + 1); - *entry = text; - lastch = 0; - while ((ch = getc(tmpfp)) != EOF) { - if (ch == '\n' && lastch == '\r') { - *(text - 1) = 0; - *++entry = text; - } - else { - *text++ = ch; - } - lastch = ch; - } - *entry = NULL; - - if (ferror(tmpfp)) - goto bail; - - fclose(tmpfp); - - if (!ftp_getresp(ftp) || ftp->resp != 226) { - free(ret); - return NULL; - } - - return ret; -bail: - data_close(data); - fclose(tmpfp); - free(ret); - return NULL; -} - -#endif /* HAVE_FTP */ diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h deleted file mode 100644 index b202981d9a4ac..0000000000000 --- a/ext/ftp/ftp.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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: | - | Andrew Skalski | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef _FTP_H -#define _FTP_H - -#include -#include - - -/* XXX these should be configurable at runtime XXX */ -#define FTP_BUFSIZE 4096 -#define FTP_TIMEOUT 90 - -typedef enum ftptype { - FTPTYPE_ASCII, - FTPTYPE_IMAGE, -} ftptype_t; - -typedef struct ftpbuf -{ - int fd; /* control connection */ - struct in_addr localaddr; /* local inet address */ - int resp; /* last response code */ - char inbuf[FTP_BUFSIZE]; /* last response text */ - char *extra; /* extra characters */ - int extralen; /* number of extra chars */ - char outbuf[FTP_BUFSIZE]; /* command output buffer */ - char *pwd; /* cached pwd */ - char *syst; /* cached system type */ - ftptype_t type; /* current transfer type */ - int pasv; /* 0=off; 1=pasv; 2=ready */ - struct sockaddr_in pasvaddr; /* passive mode address */ -} ftpbuf_t; - -typedef struct databuf -{ - int listener; /* listener socket */ - int fd; /* data connection */ - ftptype_t type; /* transfer type */ - char buf[FTP_BUFSIZE]; /* data buffer */ -} databuf_t; - - -/* open a FTP connection, returns ftpbuf (NULL on error) - * port is the ftp port in network byte order, or 0 for the default - */ -ftpbuf_t* ftp_open(const char *host, short port); - -/* quits from the ftp session (it still needs to be closed) - * return true on success, false on error - */ -int ftp_quit(ftpbuf_t *ftp); - -/* frees up any cached data held in the ftp buffer */ -void ftp_gc(ftpbuf_t *ftp); - -/* close the FTP connection and return NULL */ -ftpbuf_t* ftp_close(ftpbuf_t *ftp); - -/* logs into the FTP server, returns true on success, false on error */ -int ftp_login(ftpbuf_t *ftp, const char *user, const char *pass); - -/* reinitializes the connection, returns true on success, false on error */ -int ftp_reinit(ftpbuf_t *ftp); - -/* returns the remote system type (NULL on error) */ -const char* ftp_syst(ftpbuf_t *ftp); - -/* returns the present working directory (NULL on error) */ -const char* ftp_pwd(ftpbuf_t *ftp); - -/* changes directories, return true on success, false on error */ -int ftp_chdir(ftpbuf_t *ftp, const char *dir); - -/* changes to parent directory, return true on success, false on error */ -int ftp_cdup(ftpbuf_t *ftp); - -/* creates a directory, return the directory name on success, NULL on error. - * the return value must be freed - */ -char* ftp_mkdir(ftpbuf_t *ftp, const char *dir); - -/* removes a directory, return true on success, false on error */ -int ftp_rmdir(ftpbuf_t *ftp, const char *dir); - -/* returns a NULL-terminated array of filenames in the given path - * or NULL on error. the return array must be freed (but don't - * free the array elements) - */ -char** ftp_nlist(ftpbuf_t *ftp, const char *path); - -/* returns a NULL-terminated array of lines returned by the ftp - * LIST command for the given path or NULL on error. the return - * array must be freed (but don't - * free the array elements) - */ -char** ftp_list(ftpbuf_t *ftp, const char *path); - -/* switches passive mode on or off - * returns true on success, false on error - */ -int ftp_pasv(ftpbuf_t *ftp, int pasv); - -/* retrieves a file and saves its contents to outfp - * returns true on success, false on error - */ -int ftp_get(ftpbuf_t *ftp, FILE *outfp, const char *path, - ftptype_t type); - -/* stores the data from infp as a file on the remote server - * returns true on success, false on error - */ -int ftp_put(ftpbuf_t *ftp, const char *path, FILE *infp, - ftptype_t type); - -/* returns the size of the given file, or -1 on error */ -int ftp_size(ftpbuf_t *ftp, const char *path); - -/* returns the last modified time of the given file, or -1 on error */ -time_t ftp_mdtm(ftpbuf_t *ftp, const char *path); - -/* renames a file on the server */ -int ftp_rename(ftpbuf_t *ftp, const char *src, const char *dest); - -/* deletes the file from the server */ -int ftp_delete(ftpbuf_t *ftp, const char *path); - -#endif diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c deleted file mode 100644 index e8b34c60c4056..0000000000000 --- a/ext/ftp/php_ftp.c +++ /dev/null @@ -1,791 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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: | - | Andrew Skalski | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if HAVE_FTP - -#ifndef ZEND_VERSION -#include "internal_functions.h" -#include "php3_list.h" -#define php_error php3_error -#endif - -#include "php_ftp.h" -#include "ftp.h" - -static int le_ftpbuf; - - -function_entry php3_ftp_functions[] = { - PHP_FE(ftp_connect, NULL) - PHP_FE(ftp_login, NULL) - PHP_FE(ftp_pwd, NULL) - PHP_FE(ftp_cdup, NULL) - PHP_FE(ftp_chdir, NULL) - PHP_FE(ftp_mkdir, NULL) - PHP_FE(ftp_rmdir, NULL) - PHP_FE(ftp_nlist, NULL) - PHP_FE(ftp_rawlist, NULL) - PHP_FE(ftp_systype, NULL) - PHP_FE(ftp_pasv, NULL) - PHP_FE(ftp_get, NULL) - PHP_FE(ftp_fget, NULL) - PHP_FE(ftp_put, NULL) - PHP_FE(ftp_fput, NULL) - PHP_FE(ftp_size, NULL) - PHP_FE(ftp_mdtm, NULL) - PHP_FE(ftp_rename, NULL) - PHP_FE(ftp_delete, NULL) - PHP_FE(ftp_quit, NULL) - {NULL, NULL, NULL} -}; - -php3_module_entry php3_ftp_module_entry = { - "FTP Functions", - php3_ftp_functions, -#ifdef ZEND_VERSION - PHP_MINIT(ftp), -#else - php3_minit_ftp, -#endif - NULL, - NULL, - NULL, - NULL, - STANDARD_MODULE_PROPERTIES -}; - -static void ftp_destructor_ftpbuf(ftpbuf_t *ftp) -{ - ftp_close(ftp); -} - -#ifndef ZEND_VERSION -int php3_minit_ftp(INIT_FUNC_ARGS) -#else -PHP_MINIT_FUNCTION(ftp) -#endif -{ - le_ftpbuf = register_list_destructors(ftp_destructor_ftpbuf, NULL); - REGISTER_MAIN_LONG_CONSTANT("FTP_ASCII", FTPTYPE_ASCII, - CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("FTP_BINARY", FTPTYPE_IMAGE, - CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("FTP_IMAGE", FTPTYPE_IMAGE, - CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("FTP_TEXT", FTPTYPE_ASCII, - CONST_PERSISTENT | CONST_CS); - return SUCCESS; -} - - -#define FTPBUF(ftp, pval) { \ - int id, type; \ - convert_to_long(pval); \ - id = (pval)->value.lval; \ - (ftp) = php3_list_find(id, &type); \ - if (!(ftp) || type != le_ftpbuf) { \ - php_error(E_WARNING, "Unable to find ftpbuf %d", id); \ - RETURN_FALSE; \ - } \ - } - -#define XTYPE(xtype, pval) { \ - convert_to_long(pval); \ - if ( pval->value.lval != FTPTYPE_ASCII && \ - pval->value.lval != FTPTYPE_IMAGE) \ - { \ - php_error(E_WARNING, "arg4 must be FTP_ASCII or FTP_IMAGE"); \ - RETURN_FALSE; \ - } \ - (xtype) = pval->value.lval; \ - } - -#define FILEP(fp, pval) { \ - ZEND_FETCH_RESOURCE(fp, FILE *, &pval, -1, "File-Handle", php_file_le_fopen()); \ - } - -/* {{{ proto int ftp_connect(string host [, int port]) - Open a FTP stream */ -PHP_FUNCTION(ftp_connect) -{ - pval *arg1, *arg2; - ftpbuf_t *ftp; - short port = 0; - - /* arg1 - hostname - * arg2 - [port] - */ - switch (ARG_COUNT(ht)) { - case 1: - if (getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 2: - if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(arg2); - port = arg2->value.lval; - break; - default: - WRONG_PARAM_COUNT; - } - - convert_to_string(arg1); - - /* connect */ - ftp = ftp_open(arg1->value.str.val, htons(port)); - if (ftp == NULL) - RETURN_FALSE; - - RETURN_LONG(php3_list_insert(ftp, le_ftpbuf)); -} -/* }}} */ - -/* {{{ proto int ftp_login(int stream, string username, string password) - Logs into the FTP server. */ -PHP_FUNCTION(ftp_login) -{ - pval *arg1, *arg2, *arg3; - ftpbuf_t *ftp; - - /* arg1 - ftp - * arg2 - username - * arg3 - password - */ - if ( ARG_COUNT(ht) != 3 || - getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_string(arg2); - convert_to_string(arg3); - - FTPBUF(ftp, arg1); - - /* log in */ - if (!ftp_login(ftp, arg2->value.str.val, arg3->value.str.val)) { - php_error(E_WARNING, "ftp_login: %s", ftp->inbuf); - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto string ftp_pwd(int stream) - Returns the present working directory. */ -PHP_FUNCTION(ftp_pwd) -{ - pval *arg1; - ftpbuf_t *ftp; - const char *pwd; - - /* arg1 - ftp - */ - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - - pwd = ftp_pwd(ftp); - if (pwd == NULL) { - php_error(E_WARNING, "ftp_pwd: %s", ftp->inbuf); - RETURN_FALSE; - } - - RETURN_STRING((char*) pwd, 1); -} -/* }}} */ - -/* {{{ proto int ftp_cdup(int stream) - Changes to the parent directory */ -PHP_FUNCTION(ftp_cdup) -{ - pval *arg1; - ftpbuf_t *ftp; - - /* arg1 - ftp - */ - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - - if (!ftp_cdup(ftp)) { - php_error(E_WARNING, "ftp_cdup: %s", ftp->inbuf); - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int ftp_chdir(int stream, string directory) - Changes directories */ -PHP_FUNCTION(ftp_chdir) -{ - pval *arg1, *arg2; - ftpbuf_t *ftp; - - /* arg1 - ftp - * arg2 - directory - */ - if ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_string(arg2); - - FTPBUF(ftp, arg1); - - /* change directories */ - if (!ftp_chdir(ftp, arg2->value.str.val)) { - php_error(E_WARNING, "ftp_chdir: %s", ftp->inbuf); - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto string ftp_mkdir(int stream, string directory) - Creates a directory */ -PHP_FUNCTION(ftp_mkdir) -{ - pval *arg1, *arg2; - ftpbuf_t *ftp; - char *ret, *tmp; - - /* arg1 - ftp - * arg2 - directory - */ - if ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_string(arg2); - - FTPBUF(ftp, arg1); - - /* change directories */ - tmp = ftp_mkdir(ftp, arg2->value.str.val); - if (tmp == NULL) { - php_error(E_WARNING, "ftp_mkdir: %s", ftp->inbuf); - RETURN_FALSE; - } - - if ((ret = estrdup(tmp)) == NULL) { - free(tmp); - php_error(E_WARNING, "estrdup failed"); - RETURN_FALSE; - } - - RETURN_STRING(ret, 0); -} -/* }}} */ - -/* {{{ proto int ftp_rmdir(int stream, string directory) - Removes a directory */ -PHP_FUNCTION(ftp_rmdir) -{ - pval *arg1, *arg2; - ftpbuf_t *ftp; - - /* arg1 - ftp - * arg2 - directory - */ - if ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_string(arg2); - - FTPBUF(ftp, arg1); - - /* change directories */ - if (!ftp_rmdir(ftp, arg2->value.str.val)) { - php_error(E_WARNING, "ftp_rmdir: %s", ftp->inbuf); - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto array ftp_nlist(int stream, string directory) - Returns an array of filenames in the given directory */ -PHP_FUNCTION(ftp_nlist) -{ - pval *arg1, *arg2; - ftpbuf_t *ftp; - char **nlist, **ptr; - - /* arg1 - ftp - * arg2 - directory - */ - if ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_string(arg2); - - FTPBUF(ftp, arg1); - - /* get list of files */ - nlist = ftp_nlist(ftp, arg2->value.str.val); - if (nlist == NULL) { - RETURN_FALSE; - } - - array_init(return_value); - for (ptr = nlist; *ptr; ptr++) - add_next_index_string(return_value, *ptr, 1); - free(nlist); -} -/* }}} */ - -/* {{{ proto array ftp_rawlist(int stream, string directory) - Returns a detailed listing of a directory as an array of output lines */ -PHP_FUNCTION(ftp_rawlist) -{ - pval *arg1, *arg2; - ftpbuf_t *ftp; - char **llist, **ptr; - - /* arg1 - ftp - * arg2 - directory - */ - if ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_string(arg2); - - FTPBUF(ftp, arg1); - - /* get directory listing */ - llist = ftp_list(ftp, arg2->value.str.val); - if (llist == NULL) { - RETURN_FALSE; - } - - array_init(return_value); - for (ptr = llist; *ptr; ptr++) - add_next_index_string(return_value, *ptr, 1); - free(llist); -} -/* }}} */ - -/* {{{ proto string ftp_systype(int stream) - Returns the system type identifier */ -PHP_FUNCTION(ftp_systype) -{ - pval *arg1; - ftpbuf_t *ftp; - const char *syst; - - - /* arg1 - ftp - * arg2 - directory - */ - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - - syst = ftp_syst(ftp); - if (syst == NULL) { - php_error(E_WARNING, "ftp_syst: %s", ftp->inbuf); - RETURN_FALSE; - } - - RETURN_STRING((char*) syst, 1); -} -/* }}} */ - -/* {{{ proto int ftp_fget(int stream, int fp, string remote_file, int mode) - Retrieves a file from the FTP server and writes it to an open file. */ -PHP_FUNCTION(ftp_fget) -{ - pval *arg1, *arg2, *arg3, *arg4; - ftpbuf_t *ftp; - ftptype_t xtype; - FILE *fp; - - /* arg1 - ftp - * arg2 - fp - * arg3 - remote file - * arg4 - transfer mode - */ - if ( ARG_COUNT(ht) != 4 || - getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - FILEP(fp, arg2); - convert_to_string(arg3); - XTYPE(xtype, arg4); - - if (!ftp_get(ftp, fp, arg3->value.str.val, xtype) || ferror(fp)) { - php_error(E_WARNING, "ftp_get: %s", ftp->inbuf); - RETURN_FALSE; - } - - if (ferror(fp)) { - php_error(E_WARNING, "error writing %s", arg2->value.str.val); - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int ftp_pasv(int stream, int pasv) - Turns passive mode on or off. */ -PHP_FUNCTION(ftp_pasv) -{ - pval *arg1, *arg2; - ftpbuf_t *ftp; - - /* arg1 - ftp - * arg2 - pasv - */ - if ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - convert_to_long(arg2); - - if (!ftp_pasv(ftp, (arg2->value.lval) ? 1 : 0)) - RETURN_FALSE; - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int ftp_get(int stream, string local_file, string remote_file, int mode) - Retrieves a file from the FTP server and writes it to a local file. */ -PHP_FUNCTION(ftp_get) -{ - pval *arg1, *arg2, *arg3, *arg4; - ftpbuf_t *ftp; - ftptype_t xtype; - FILE *outfp, *tmpfp; - int ch; - - - /* arg1 - ftp - * arg2 - destination (local) file - * arg3 - source (remote) file - * arg4 - transfer mode - */ - if ( ARG_COUNT(ht) != 4 || - getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - convert_to_string(arg2); - convert_to_string(arg3); - XTYPE(xtype, arg4); - - /* get to temporary file, so if there is an error, no existing - * file gets clobbered - */ - if ((tmpfp = tmpfile()) == NULL) { - php_error(E_WARNING, "error opening tmpfile"); - RETURN_FALSE; - } - - if ( !ftp_get(ftp, tmpfp, arg3->value.str.val, xtype) || - ferror(tmpfp)) - { - fclose(tmpfp); - php_error(E_WARNING, "ftp_get: %s", ftp->inbuf); - RETURN_FALSE; - } - - if ((outfp = fopen(arg2->value.str.val, "w")) == NULL) { - fclose(tmpfp); - php_error(E_WARNING, "error opening %s", arg2->value.str.val); - RETURN_FALSE; - } - - rewind(tmpfp); - while ((ch = getc(tmpfp)) != EOF) - putc(ch, outfp); - - if (ferror(tmpfp) || ferror(outfp)) { - fclose(tmpfp); - fclose(outfp); - php_error(E_WARNING, "error writing %s", arg2->value.str.val); - RETURN_FALSE; - } - - fclose(tmpfp); - fclose(outfp); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int ftp_fput(int stream, string local_file, string remote_file, int mode) - Stores a file from an open file to the FTP server. */ -PHP_FUNCTION(ftp_fput) -{ - pval *arg1, *arg2, *arg3, *arg4; - ftpbuf_t *ftp; - ftptype_t xtype; - FILE *fp; - - /* arg1 - ftp - * arg2 - remote file - * arg3 - fp - * arg4 - transfer mode - */ - if ( ARG_COUNT(ht) != 4 || - getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - convert_to_string(arg2); - FILEP(fp, arg3); - XTYPE(xtype, arg4); - - if (!ftp_put(ftp, arg2->value.str.val, fp, xtype)) { - php_error(E_WARNING, "ftp_put: %s", ftp->inbuf); - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int ftp_put(int stream, string remote_file, string local_file, int mode) - Stores a file on the FTP server */ -PHP_FUNCTION(ftp_put) -{ - pval *arg1, *arg2, *arg3, *arg4; - ftpbuf_t *ftp; - ftptype_t xtype; - FILE *infp; - - - /* arg1 - ftp - * arg2 - destination (remote) file - * arg3 - source (local) file - * arg4 - transfer mode - */ - if ( ARG_COUNT(ht) != 4 || - getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - convert_to_string(arg2); - convert_to_string(arg3); - XTYPE(xtype, arg4); - - if ((infp = fopen(arg3->value.str.val, "r")) == NULL) { - php_error(E_WARNING, "error opening %s", arg3->value.str.val); - RETURN_FALSE; - } - if ( !ftp_put(ftp, arg2->value.str.val, infp, xtype) || - ferror(infp)) - { - fclose(infp); - php_error(E_WARNING, "ftp_put: %s", ftp->inbuf); - RETURN_FALSE; - } - fclose(infp); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int ftp_size(int stream, string path) - Returns the size of the file, or -1 on error. */ -PHP_FUNCTION(ftp_size) -{ - pval *arg1, *arg2; - ftpbuf_t *ftp; - - /* arg1 - ftp - * arg2 - path - */ - if ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - convert_to_string(arg2); - - /* get file size */ - RETURN_LONG(ftp_size(ftp, arg2->value.str.val)); -} -/* }}} */ - -/* {{{ proto int ftp_mdtm(int stream, string path) - Returns the last modification time of the file, or -1 on error */ -PHP_FUNCTION(ftp_mdtm) -{ - pval *arg1, *arg2; - ftpbuf_t *ftp; - - /* arg1 - ftp - * arg2 - path - */ - if ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - convert_to_string(arg2); - - /* get file mod time */ - RETURN_LONG(ftp_mdtm(ftp, arg2->value.str.val)); -} -/* }}} */ - -/* {{{ proto int ftp_rename(int stream, string src, string dest) - Renames the given file to a new path */ -PHP_FUNCTION(ftp_rename) -{ - pval *arg1, *arg2, *arg3; - ftpbuf_t *ftp; - - /* arg1 - ftp - * arg2 - src - * arg3 - dest - */ - if ( ARG_COUNT(ht) != 3 || - getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - convert_to_string(arg2); - convert_to_string(arg3); - - /* rename the file */ - if (!ftp_rename(ftp, arg2->value.str.val, arg3->value.str.val)) { - php_error(E_WARNING, "ftp_rename: %s", ftp->inbuf); - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int ftp_delete(int stream, string path) - Deletes a file */ -PHP_FUNCTION(ftp_delete) -{ - pval *arg1, *arg2; - ftpbuf_t *ftp; - - /* arg1 - ftp - * arg2 - path - */ - if ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - convert_to_string(arg2); - - /* delete the file */ - if (!ftp_delete(ftp, arg2->value.str.val)) { - php_error(E_WARNING, "ftp_delete: %s", ftp->inbuf); - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int ftp_quit(int stream) - Closes the FTP stream */ -PHP_FUNCTION(ftp_quit) -{ - pval *arg1; - int id, type; - - /* arg1 - ftp - */ - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - id = arg1->value.lval; - if (php3_list_find(id, &type) && type == le_ftpbuf) - php3_list_delete(id); - - RETURN_TRUE; -} -/* }}} */ - -#endif /* HAVE_FTP */ diff --git a/ext/ftp/php_ftp.h b/ext/ftp/php_ftp.h deleted file mode 100644 index 7da896cc8d9a6..0000000000000 --- a/ext/ftp/php_ftp.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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: | - | Andrew Skalski | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef _INCLUDED_FTP_H -#define _INCLUDED_FTP_H - -#if COMPILE_DL -#undef HAVE_FTP -#define HAVE_FTP 1 -#endif - -#if HAVE_FTP - -extern php3_module_entry php3_ftp_module_entry; -#define php3_ftp_module_ptr &php3_ftp_module_entry - -#ifdef ZEND_VERSION -PHP_MINIT_FUNCTION(ftp); -#else -int php3_minit_ftp(INIT_FUNC_ARGS); -#endif - -PHP_FUNCTION(ftp_connect); -PHP_FUNCTION(ftp_login); -PHP_FUNCTION(ftp_pwd); -PHP_FUNCTION(ftp_cdup); -PHP_FUNCTION(ftp_chdir); -PHP_FUNCTION(ftp_mkdir); -PHP_FUNCTION(ftp_rmdir); -PHP_FUNCTION(ftp_nlist); -PHP_FUNCTION(ftp_rawlist); -PHP_FUNCTION(ftp_systype); -PHP_FUNCTION(ftp_pasv); -PHP_FUNCTION(ftp_get); -PHP_FUNCTION(ftp_fget); -PHP_FUNCTION(ftp_put); -PHP_FUNCTION(ftp_fput); -PHP_FUNCTION(ftp_size); -PHP_FUNCTION(ftp_mdtm); -PHP_FUNCTION(ftp_rename); -PHP_FUNCTION(ftp_delete); -PHP_FUNCTION(ftp_quit); - -#define phpext_ftp_ptr php3_ftp_module_ptr - -#else -#define php3_ftp_module_ptr NULL -#endif /* HAVE_FTP */ - -#endif diff --git a/ext/gd/Makefile.am b/ext/gd/Makefile.am deleted file mode 100644 index fca3e4c513e69..0000000000000 --- a/ext/gd/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -## Process this file with automake to produce Makefile.in - -SRC=gd.c gdcache.c gdttf.c -noinst_LTLIBRARIES=@GD_STATIC@ -EXTRA_LTLIBRARIES=libphpext_gd.la gd.la -libphpext_gd_la_SOURCES=$(SRC) - -phplib_LTLIBRARIES=@GD_SHARED@ -gd_la_SOURCES=$(SRC) -gd_la_LIBADD=@GD_LFLAGS@ @GD_LIBS@ -gd_la_LDFLAGS=-avoid-version -module -rpath $(phplibdir) -EXTRA_LIBS= - diff --git a/ext/gd/config.h.stub b/ext/gd/config.h.stub deleted file mode 100644 index d13e8df475c8d..0000000000000 --- a/ext/gd/config.h.stub +++ /dev/null @@ -1,11 +0,0 @@ -/* Define if you have the gd library (-lgd). */ -#define HAVE_LIBGD 0 - -/* Define if you have the gd version 1.3 library (-lgd). */ -#define HAVE_LIBGD13 0 - -#undef HAVE_GDIMAGECOLORRESOLVE -#undef FREETYPE_4BIT_ANTIALIAS_HACK -#undef HAVE_LIBFREETYPE -#undef HAVE_LIBTTF -#undef HAVE_GD_PNG diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 deleted file mode 100644 index 51fac09457a58..0000000000000 --- a/ext/gd/config.m4 +++ /dev/null @@ -1,190 +0,0 @@ -shared=no -AC_MSG_CHECKING(whether to include GD support) -AC_ARG_WITH(gd, -[ --without-gd Disable GD support. - --with-gd[=DIR] Include GD support (DIR is GD's install dir). - Set DIR to "shared" to build as a dl, or - "shared,DIR" to build as a dl and still specify DIR.], -[ - PHP_WITH_SHARED - - case "$withval" in - no) - AC_MSG_RESULT(no) ;; - yes) - AC_DEFINE(HAVE_LIBGD) - if test "$shared" = "yes"; then - AC_MSG_RESULT(yes (shared)) - GD_LIBS="-lgd" - else - AC_MSG_RESULT(yes (static)) - AC_ADD_LIBRARY(gd) - fi - old_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -L$GD_LIB" - old_LIBS=$LIBS - AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ]) - LIBS="$LIBS -lpng -lz" - AC_CHECK_LIB(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE,1)]) - AC_CHECK_LIB(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1)]) - - LIBS=$old_LIBS - LDFLAGS=$old_LDFLAGS - if test "$ac_cv_lib_gd_gdImageCreateFromPng" = "yes"; then - AC_ADD_LIBRARY(png) - AC_ADD_LIBRARY(z) - fi - ac_cv_lib_gd_gdImageLine=yes - ;; - *) -dnl A whole whack of possible places where this might be - test -f $withval/include/gd1.3/gd.h && GD_INCLUDE="$withval/include/gd1.3" - test -f $withval/include/gd/gd.h && GD_INCLUDE="$withval/include/gd" - test -f $withval/include/gd.h && GD_INCLUDE="$withval/include" - test -f $withval/gd1.3/gd.h && GD_INCLUDE="$withval/gd1.3" - test -f $withval/gd/gd.h && GD_INCLUDE="$withval/gd" - test -f $withval/gd.h && GD_INCLUDE="$withval" - - test -f $withval/lib/libgd.so && GD_LIB="$withval/lib" - test -f $withval/lib/gd/libgd.so && GD_LIB="$withval/lib/gd" - test -f $withval/lib/gd1.3/libgd.so && GD_LIB="$withval/lib/gd1.3" - test -f $withval/libgd.so && GD_LIB="$withval" - test -f $withval/gd/libgd.so && GD_LIB="$withval/gd" - test -f $withval/gd1.3/libgd.so && GD_LIB="$withval/gd1.3" - - test -f $withval/lib/libgd.a && GD_LIB="$withval/lib" - test -f $withval/lib/gd/libgd.a && GD_LIB="$withval/lib/gd" - test -f $withval/lib/gd1.3/libgd.a && GD_LIB="$withval/lib/gd1.3" - test -f $withval/libgd.a && GD_LIB="$withval" - test -f $withval/gd/libgd.a && GD_LIB="$withval/gd" - test -f $withval/gd1.3/libgd.a && GD_LIB="$withval/gd1.3" - if test -n "$GD_INCLUDE" && test -n "$GD_LIB" ; then - AC_DEFINE(HAVE_LIBGD) - if test "$shared" = "yes"; then - AC_MSG_RESULT(yes (shared)) - GD_LIBS="-lgd" - GD_LFLAGS="-L$GD_LIB" - else - AC_MSG_RESULT(yes (static)) - AC_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB) - fi - old_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -L$GD_LIB" - old_LIBS=$LIBS - AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ]) - LIBS="$LIBS -lpng -lz" - AC_CHECK_LIB(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE,1)]) - AC_CHECK_LIB(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1)]) - - LIBS=$old_LIBS - LDFLAGS=$old_LDFLAGS - if test "$ac_cv_lib_gd_gdImageCreateFromPng" = "yes"; then - AC_ADD_LIBRARY(png) - AC_ADD_LIBRARY(z) - fi - ac_cv_lib_gd_gdImageLine=yes - else - AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $withval]) - fi ;; - esac -],[ - AC_CHECK_LIB(gd, gdImageLine) - AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ]) - if test "$ac_cv_lib_gd_gdImageLine" = "yes"; then - old_LIBS=$LIBS - AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ]) - LIBS="$LIBS -lpng -lz" - AC_CHECK_LIB(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE,1)]) - AC_CHECK_LIB(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1)]) - - LIBS=$old_LIBS - LDFLAGS=$old_LDFLAGS - if test "$ac_cv_lib_gd_gdImageCreateFromPng" = "yes"; then - AC_ADD_LIBRARY(png) - AC_ADD_LIBRARY(z) - fi - ac_cv_lib_gd_gdImageLine=yes - fi -]) -if test "$ac_cv_lib_gd_gdImageLine" = "yes"; then - CHECK_TTF="yes" - AC_ARG_WITH(ttf, - [ --with-ttf[=DIR] Include Freetype support],[ - if test $withval = "no" ; then - CHECK_TTF="" - else - CHECK_TTF="$withval" - fi - ]) - - AC_MSG_CHECKING(whether to include ttf support) - if test -n "$CHECK_TTF" ; then - for i in /usr /usr/local "$CHECK_TTF" ; do - if test -f "$i/include/truetype.h" ; then - FREETYPE_DIR="$i" - fi - if test -f "$i/include/freetype.h" ; then - TTF_DIR="$i" - fi - done - if test -n "$FREETYPE_DIR" ; then - AC_DEFINE(HAVE_LIBFREETYPE) - if test "$shared" = "yes"; then - GD_LIBS="$GD_LIBS -lfreetype" - GD_LFLAGS="$GD_LFLAGS -L$FREETYPE_DIR/lib" - else - AC_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE_DIR/lib) - fi - AC_ADD_INCLUDE($FREETYPE_DIR/include) - AC_MSG_RESULT(yes) - else - if test -n "$TTF_DIR" ; then - AC_DEFINE(HAVE_LIBTTF) - if test "$shared" = "yes"; then - GD_LIBS="$GD_LIBS -lttf" - GD_LFLAGS="$GD_LFLAGS -L$TTF_DIR/lib" - else - AC_ADD_LIBRARY_WITH_PATH(ttf, $TTF_DIR/lib) - fi - AC_ADD_INCLUDE($TTF_DIR/include) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - fi - else - AC_MSG_RESULT(no) - fi - - if test -f /usr/pkg/include/gd/gd.h -a -z "$GD_INCLUDE" ; then - GD_INCLUDE="/usr/pkg/include/gd" - fi - - AC_MSG_CHECKING(whether to enable 4bit antialias hack with FreeType2) - AC_ARG_ENABLE(freetype-4bit-antialias-hack, - [ --enable-freetype-4bit-antialias-hack - Include support for FreeType2 (experimental).],[ - if test "$enableval" = "yes" ; then - AC_DEFINE(FREETYPE_4BIT_ANTIALIAS_HACK, 1) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - ],[ - AC_MSG_RESULT(no) - ]) - - AC_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE) - AC_ADD_INCLUDE($GD_INCLUDE) - PHP_EXTENSION(gd, $shared) - if test "$shared" != "yes"; then - GD_STATIC="libphpext_gd.la" - else - GD_SHARED="gd.la" - fi -fi - -AC_SUBST(GD_LFLAGS) -AC_SUBST(GD_LIBS) -AC_SUBST(GD_STATIC) -AC_SUBST(GD_SHARED) diff --git a/ext/gd/gd.c b/ext/gd/gd.c deleted file mode 100644 index b2b7a8bcf9c7a..0000000000000 --- a/ext/gd/gd.c +++ /dev/null @@ -1,1921 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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: Rasmus Lerdorf | - | Stig Bakken | - | Jim Winstead | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, - Cold Spring Harbor Labs. */ - -/* Note that there is no code from the gd package in this file */ - -#include "php.h" -#include "ext/standard/head.h" -#include -#include "SAPI.h" -#include "php3_gd.h" - -#if HAVE_SYS_WAIT_H -# include -#endif -#if HAVE_UNISTD_H -# include -#endif -#if WIN32|WINNT -# include -# include -#endif - -#if HAVE_LIBGD -#include -#include /* 1 Tiny font */ -#include /* 2 Small font */ -#include /* 3 Medium bold font */ -#include /* 4 Large font */ -#include /* 5 Giant font */ -#ifdef ENABLE_GD_TTF -# include "gdttf.h" -#endif - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -#ifdef ENABLE_GD_TTF -static void php3_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int); -#endif - -#ifdef THREAD_SAFE -DWORD GDlibTls; -static int numthreads=0; -void *gdlib_mutex=NULL; - -typedef struct gdlib_global_struct{ - int le_gd; - int le_gd_font; -} gdlib_global_struct; - -# define GD_GLOBAL(a) gdlib_globals->a -# define GD_TLS_VARS gdlib_global_struct *gdlib_globals = TlsGetValue(GDlibTls); - -#else -# define GD_GLOBAL(a) a -# define GD_TLS_VARS -int le_gd; -int le_gd_font; -#endif - -function_entry gd_functions[] = { - PHP_FE(imagearc, NULL) - PHP_FE(imagechar, NULL) - PHP_FE(imagecharup, NULL) - PHP_FE(imagecolorallocate, NULL) - PHP_FE(imagecolorat, NULL) - PHP_FE(imagecolorclosest, NULL) - PHP_FE(imagecolordeallocate, NULL) - PHP_FE(imagecolorresolve, NULL) - PHP_FE(imagecolorexact, NULL) - PHP_FE(imagecolorset, NULL) - PHP_FE(imagecolortransparent, NULL) - PHP_FE(imagecolorstotal, NULL) - PHP_FE(imagecolorsforindex, NULL) - PHP_FE(imagecopy, NULL) - PHP_FE(imagecopyresized, NULL) - PHP_FE(imagecreate, NULL) -#ifdef HAVE_GD_PNG - PHP_FE(imagecreatefrompng, NULL) - PHP_FE(imagepng, NULL) -#else - PHP_FE(imagecreatefromgif, NULL) - PHP_FE(imagegif, NULL) -#endif - PHP_FE(imagedestroy, NULL) - PHP_FE(imagefill, NULL) - PHP_FE(imagefilledpolygon, NULL) - PHP_FE(imagefilledrectangle, NULL) - PHP_FE(imagefilltoborder, NULL) - PHP_FE(imagefontwidth, NULL) - PHP_FE(imagefontheight, NULL) - PHP_FE(imageinterlace, NULL) - PHP_FE(imageline, NULL) - PHP_FE(imageloadfont, NULL) - PHP_FE(imagepolygon, NULL) - PHP_FE(imagerectangle, NULL) - PHP_FE(imagesetpixel, NULL) - PHP_FE(imagestring, NULL) - PHP_FE(imagestringup, NULL) - PHP_FE(imagesx, NULL) - PHP_FE(imagesy, NULL) - PHP_FE(imagedashedline, NULL) -#ifdef ENABLE_GD_TTF - PHP_FE(imagettfbbox, NULL) - PHP_FE(imagettftext, NULL) -#endif - {NULL, NULL, NULL} -}; - -php3_module_entry gd_module_entry = { - "gd", gd_functions, PHP_MINIT(gd), PHP_MSHUTDOWN(gd), NULL, NULL, PHP_MINFO(gd), STANDARD_MODULE_PROPERTIES -}; - -#if COMPILE_DL -# if PHP_31 -# include "../phpdl.h" -# else -# include "dl/phpdl.h" -# endif -DLEXPORT php3_module_entry *get_module(void) { return &gd_module_entry; } -#endif - - -#define PolyMaxPoints 256 - - -PHP_MINIT_FUNCTION(gd) -{ -#if defined(THREAD_SAFE) - gdlib_global_struct *gdlib_globals; - PHP3_MUTEX_ALLOC(gdlib_mutex); - PHP3_MUTEX_LOCK(gdlib_mutex); - numthreads++; - if (numthreads==1){ - if (!PHP3_TLS_PROC_STARTUP(GDlibTls)){ - PHP3_MUTEX_UNLOCK(gdlib_mutex); - PHP3_MUTEX_FREE(gdlib_mutex); - return FAILURE; - } - } - PHP3_MUTEX_UNLOCK(gdlib_mutex); - if(!PHP3_TLS_THREAD_INIT(GDlibTls,gdlib_globals,gdlib_global_struct)){ - PHP3_MUTEX_FREE(gdlib_mutex); - return FAILURE; - } -#endif - GD_GLOBAL(le_gd) = register_list_destructors(gdImageDestroy, NULL); - GD_GLOBAL(le_gd_font) = register_list_destructors(php3_free_gd_font, NULL); - return SUCCESS; -} - -PHP_MINFO_FUNCTION(gd) -{ - /* need to use a PHPAPI function here because it is external module in windows */ -#if HAVE_LIBGD13 - php_printf("Version 1.3"); -#else - php_printf("Version 1.2"); -#endif -#ifdef ENABLE_GD_TTF - php_printf(" with FreeType support"); -#endif -} - -PHP_MSHUTDOWN_FUNCTION(gd) -{ - GD_TLS_VARS; -#ifdef THREAD_SAFE - PHP3_TLS_THREAD_FREE(gdlib_globals); - PHP3_MUTEX_LOCK(gdlib_mutex); - numthreads--; - if (numthreads<1) { - PHP3_TLS_PROC_SHUTDOWN(GDlibTls); - PHP3_MUTEX_UNLOCK(gdlib_mutex); - PHP3_MUTEX_FREE(gdlib_mutex); - return SUCCESS; - } - PHP3_MUTEX_UNLOCK(gdlib_mutex); -#endif - return SUCCESS; -} - -/* Need this for cpdf. See also comment in file.c php3i_get_le_fp() */ -PHPAPI int phpi_get_le_gd(void){ - GD_TLS_VARS; - return GD_GLOBAL(le_gd); -} - -#ifndef HAVE_GDIMAGECOLORRESOLVE - -/********************************************************************/ -/* gdImageColorResolve is a replacement for the old fragment: */ -/* */ -/* if ((color=gdImageColorExact(im,R,G,B)) < 0) */ -/* if ((color=gdImageColorAllocate(im,R,G,B)) < 0) */ -/* color=gdImageColorClosest(im,R,G,B); */ -/* */ -/* in a single function */ - -int -gdImageColorResolve(gdImagePtr im, int r, int g, int b) -{ - int c; - int ct = -1; - int op = -1; - long rd, gd, bd, dist; - long mindist = 3*255*255; /* init to max poss dist */ - - for (c = 0; c < im->colorsTotal; c++) { - if (im->open[c]) { - op = c; /* Save open slot */ - continue; /* Color not in use */ - } - rd = (long)(im->red [c] - r); - gd = (long)(im->green[c] - g); - bd = (long)(im->blue [c] - b); - dist = rd * rd + gd * gd + bd * bd; - if (dist < mindist) { - if (dist == 0) { - return c; /* Return exact match color */ - } - mindist = dist; - ct = c; - } - } - /* no exact match. We now know closest, but first try to allocate exact */ - if (op == -1) { - op = im->colorsTotal; - if (op == gdMaxColors) { /* No room for more colors */ - return ct; /* Return closest available color */ - } - im->colorsTotal++; - } - im->red [op] = r; - im->green[op] = g; - im->blue [op] = b; - im->open [op] = 0; - return op; /* Return newly allocated color */ -} - -#endif - -void php3_free_gd_font(gdFontPtr fp) -{ - if (fp->data) { - efree(fp->data); - } - efree(fp); -} - -/* {{{ proto int imageloadfont(string filename) -Load a new font */ -PHP_FUNCTION(imageloadfont) { - pval *file; - int hdr_size = sizeof(gdFont) - sizeof(char *); - int ind, body_size, n=0, b; - gdFontPtr font; - FILE *fp; - int issock=0, socketd=0; - GD_TLS_VARS; - - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string(file); - -#if WIN32|WINNT - fp = fopen(file->value.str.val, "rb"); -#else - fp = php3_fopen_wrapper(file->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd); -#endif - if (fp == NULL) { - php_error(E_WARNING, "ImageFontLoad: unable to open file"); - RETURN_FALSE; - } - - /* Only supports a architecture-dependent binary dump format - * at the moment. - * The file format is like this on machines with 32-byte integers: - * - * byte 0-3: (int) number of characters in the font - * byte 4-7: (int) value of first character in the font (often 32, space) - * byte 8-11: (int) pixel width of each character - * byte 12-15: (int) pixel height of each character - * bytes 16-: (char) array with character data, one byte per pixel - * in each character, for a total of - * (nchars*width*height) bytes. - */ - font = (gdFontPtr)emalloc(sizeof(gdFont)); - b = 0; - while (b < hdr_size && (n = fread(&font[b], 1, hdr_size - b, fp))) - b += n; - if (!n) { - fclose(fp); - efree(font); - if (feof(fp)) { - php_error(E_WARNING, "ImageFontLoad: end of file while reading header"); - } else { - php_error(E_WARNING, "ImageFontLoad: error while reading header"); - } - RETURN_FALSE; - } - body_size = font->w * font->h * font->nchars; - font->data = emalloc(body_size); - b = 0; - while (b < body_size && (n = fread(&font->data[b], 1, body_size - b, fp))) - b += n; - if (!n) { - fclose(fp); - efree(font->data); - efree(font); - if (feof(fp)) { - php_error(E_WARNING, "ImageFontLoad: end of file while reading body"); - } else { - php_error(E_WARNING, "ImageFontLoad: error while reading body"); - } - RETURN_FALSE; - } - fclose(fp); - - /* Adding 5 to the font index so we will never have font indices - * that overlap with the old fonts (with indices 1-5). The first - * list index given out is always 1. - */ - ind = 5 + php3_list_insert(font, GD_GLOBAL(le_gd_font)); - - RETURN_LONG(ind); -} -/* }}} */ - -/* {{{ proto int imagecreate(int x_size, int y_size) -Create a new image */ -PHP_FUNCTION(imagecreate) -{ - pval *x_size, *y_size; - int ind; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &x_size, &y_size) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(x_size); - convert_to_long(y_size); - - im = gdImageCreate(x_size->value.lval, y_size->value.lval); - ind = php3_list_insert(im, GD_GLOBAL(le_gd)); - - RETURN_LONG(ind); -} -/* }}} */ - -#ifdef HAVE_GD_PNG - -/* {{{ proto int imagecreatefrompng(string filename) -Create a new image from file or URL */ -void php3_imagecreatefrompng (INTERNAL_FUNCTION_PARAMETERS) { - pval *file; - int ind; - gdImagePtr im; - char *fn=NULL; - FILE *fp; - int issock=0, socketd=0; - GD_TLS_VARS; - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(file); - fn = file->value.str.val; -#if WIN32|WINNT - fp = fopen(file->value.str.val, "rb"); -#else - fp = php3_fopen_wrapper(file->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd); -#endif - if (!fp) { - php3_strip_url_passwd(fn); - php3_error(E_WARNING, - "ImageCreateFromPng: Unable to open %s for reading", fn); - RETURN_FALSE; - } - im = gdImageCreateFromPng (fp); - fflush(fp); - fclose(fp); - ind = php3_list_insert(im, GD_GLOBAL(le_gd)); - RETURN_LONG(ind); -} -/* }}} */ - -/* {{{ proto int imagepng(int im [, string filename]) -Output image to browser or file */ -void php3_imagepng (INTERNAL_FUNCTION_PARAMETERS) { - pval *imgind, *file; - gdImagePtr im; - char *fn=NULL; - FILE *fp; - int argc; - int ind_type; - int output=1; - GD_TLS_VARS; - argc = ARG_COUNT(ht); - if (argc < 1 || argc > 2 || getParameters(ht, argc, &imgind, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(imgind); - if (argc == 2) { - convert_to_string(file); - fn = file->value.str.val; - if (!fn || fn == empty_string || _php3_check_open_basedir(fn)) { - php3_error(E_WARNING, "ImagePng: Invalid filename"); - RETURN_FALSE; - } - } - im = php3_list_find(imgind->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php3_error(E_WARNING, "ImagePng: unable to find image pointer"); - RETURN_FALSE; - } - if (argc == 2) { - fp = fopen(fn, "wb"); - if (!fp) { - php3_error(E_WARNING, "ImagePng: unable to open %s for writing", fn); - RETURN_FALSE; - } - gdImagePng (im,fp); - fflush(fp); - fclose(fp); - } - else { - int b; - FILE *tmp; - char buf[4096]; - tmp = tmpfile(); - if (tmp == NULL) { - php3_error(E_WARNING, "Unable to open temporary file"); - RETURN_FALSE; - } - output = php3_header(); - if (output) { - gdImagePng (im, tmp); - fseek(tmp, 0, SEEK_SET); -#if APACHE && defined(CHARSET_EBCDIC) - /* This is a binary file already: avoid EBCDIC->ASCII conversion */ - ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0); -#endif - while ((b = fread(buf, 1, sizeof(buf), tmp)) > 0) { - php3_write(buf, b); - } - } - fclose(tmp); - /* the temporary file is automatically deleted */ - } - RETURN_TRUE; -} -/* }}} */ - -#else - -/* {{{ proto int imagecreatefromgif(string filename) -Create a new image from file or URL */ -PHP_FUNCTION(imagecreatefromgif ) -{ - pval *file; - int ind; - gdImagePtr im; - char *fn=NULL; - FILE *fp; - int issock=0, socketd=0; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string(file); - - fn = file->value.str.val; - -#if WIN32|WINNT - fp = fopen(file->value.str.val, "rb"); -#else - fp = php3_fopen_wrapper(file->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd); -#endif - if (!fp) { - php3_strip_url_passwd(fn); - php_error(E_WARNING, - "ImageCreateFromGif: Unable to open %s for reading", fn); - RETURN_FALSE; - } - - im = gdImageCreateFromGif (fp); - - fflush(fp); - fclose(fp); - - ind = php3_list_insert(im, GD_GLOBAL(le_gd)); - - RETURN_LONG(ind); -} -/* }}} */ - -/* {{{ proto int imagegif(int im [, string filename]) -Output image to browser or file */ -PHP_FUNCTION(imagegif ) -{ - pval *imgind, *file; - gdImagePtr im; - char *fn=NULL; - FILE *fp; - int argc; - int ind_type; - int output=1; - GD_TLS_VARS; - - argc = ARG_COUNT(ht); - if (argc < 1 || argc > 2 || getParameters(ht, argc, &imgind, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - - if (argc == 2) { - convert_to_string(file); - fn = file->value.str.val; - if (!fn || fn == empty_string || _php3_check_open_basedir(fn)) { - php_error(E_WARNING, "ImageGif: Invalid filename"); - RETURN_FALSE; - } - } - - im = php3_list_find(imgind->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageGif: unable to find image pointer"); - RETURN_FALSE; - } - - if (argc == 2) { - fp = fopen(fn, "wb"); - if (!fp) { - php_error(E_WARNING, "ImageGif: unable to open %s for writing", fn); - RETURN_FALSE; - } - gdImageGif (im,fp); - fflush(fp); - fclose(fp); - } - else { - int b; - FILE *tmp; - char buf[4096]; - - tmp = tmpfile(); - if (tmp == NULL) { - php_error(E_WARNING, "Unable to open temporary file"); - RETURN_FALSE; - } - - output = php3_header(); - - if (output) { - SLS_FETCH(); - - gdImageGif (im, tmp); - fseek(tmp, 0, SEEK_SET); -#if APACHE && defined(CHARSET_EBCDIC) - /* This is a binary file already: avoid EBCDIC->ASCII conversion */ - ap_bsetflag(((request_rec *) SG(server_context))->connection->client, B_EBCDIC2ASCII, 0); -#endif - while ((b = fread(buf, 1, sizeof(buf), tmp)) > 0) { - php3_write(buf, b); - } - } - - fclose(tmp); - /* the temporary file is automatically deleted */ - } - - RETURN_TRUE; -} -/* }}} */ - -#endif /* HAVE_IMAGECREATEFROMPNG */ - -/* {{{ proto int imagedestroy(int im) -Destroy an image */ -PHP_FUNCTION(imagedestroy) -{ - pval *imgind; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &imgind) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - - php3_list_delete(imgind->value.lval); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int imagecolorallocate(int im, int red, int green, int blue) -Allocate a color for an image */ -PHP_FUNCTION(imagecolorallocate) -{ - pval *imgind, *red, *green, *blue; - int ind, ind_type; - int col; - int r, g, b; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &imgind, &red, - &green, &blue) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(red); - convert_to_long(green); - convert_to_long(blue); - - ind = imgind->value.lval; - r = red->value.lval; - g = green->value.lval; - b = blue->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorAllocate: Unable to find image pointer"); - RETURN_FALSE; - } - col = gdImageColorAllocate(im, r, g, b); - RETURN_LONG(col); -} -/* }}} */ - -/* im, x, y */ -/* {{{ proto int imagecolorat(int im, int x, int y) -Get the index of the color of a pixel */ -PHP_FUNCTION(imagecolorat) -{ - pval *imgind, *x, *y; - int ind, ind_type; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &imgind, &x, &y) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(x); - convert_to_long(y); - - ind = imgind->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorAt: Unable to find image pointer"); - RETURN_FALSE; - } - if (gdImageBoundsSafe(im, x->value.lval, y->value.lval)) { -#if HAVE_LIBGD13 - RETURN_LONG(im->pixels[y->value.lval][x->value.lval]); -#else - RETURN_LONG(im->pixels[x->value.lval][y->value.lval]); -#endif - } - else { - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto int imagecolorclosest(int im, int red, int green, int blue) -Get the index of the closest color to the specified color */ -PHP_FUNCTION(imagecolorclosest) -{ - pval *imgind, *red, *green, *blue; - int ind, ind_type; - int col; - int r, g, b; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &imgind, &red, - &green, &blue) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(red); - convert_to_long(green); - convert_to_long(blue); - - ind = imgind->value.lval; - r = red->value.lval; - g = green->value.lval; - b = blue->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorClosest: Unable to find image pointer"); - RETURN_FALSE; - } - col = gdImageColorClosest(im, r, g, b); - RETURN_LONG(col); -} -/* }}} */ - -/* {{{ proto int imagecolordeallocate(int im, int index) -De-allocate a color for an image */ -PHP_FUNCTION(imagecolordeallocate) -{ - pval *imgind, *index; - int ind, ind_type, col; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &imgind, &index) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(index); - ind = imgind->value.lval; - col = index->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorDeallocate: Unable to find image pointer"); - RETURN_FALSE; - } - - if (col >= 0 && col < gdImageColorsTotal(im)) { - gdImageColorDeallocate(im, col); - RETURN_TRUE; - } - else { - php_error(E_WARNING, "Color index out of range"); - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto int imagecolorresolve(int im, int red, int green, int blue) -Get the index of the specified color or its closest possible alternative */ -PHP_FUNCTION(imagecolorresolve) -{ - pval *imgind, *red, *green, *blue; - int ind, ind_type; - int col; - int r, g, b; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &imgind, &red, - &green, &blue) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(red); - convert_to_long(green); - convert_to_long(blue); - - ind = imgind->value.lval; - r = red->value.lval; - g = green->value.lval; - b = blue->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorResolve: Unable to find image pointer"); - RETURN_FALSE; - } - col = gdImageColorResolve(im, r, g, b); - RETURN_LONG(col); -} -/* }}} */ - -/* {{{ proto int imagecolorexact(int im, int red, int green, int blue) -Get the index of the specified color */ -PHP_FUNCTION(imagecolorexact) -{ - pval *imgind, *red, *green, *blue; - int ind, ind_type; - int col; - int r, g, b; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &imgind, &red, - &green, &blue) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(red); - convert_to_long(green); - convert_to_long(blue); - - ind = imgind->value.lval; - r = red->value.lval; - g = green->value.lval; - b = blue->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorExact: Unable to find image pointer"); - RETURN_FALSE; - } - col = gdImageColorExact(im, r, g, b); - RETURN_LONG(col); -} -/* }}} */ - -/* {{{ proto int imagecolorset(int im, int col, int red, int green, int blue) -Set the color for the specified palette index */ -PHP_FUNCTION(imagecolorset) -{ - pval *imgind, *color, *red, *green, *blue; - int ind, ind_type; - int col; - int r, g, b; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 5 || getParameters(ht, 5, &imgind, &color, &red, &green, &blue) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(color); - convert_to_long(red); - convert_to_long(green); - convert_to_long(blue); - - ind = imgind->value.lval; - col = color->value.lval; - r = red->value.lval; - g = green->value.lval; - b = blue->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorSet: Unable to find image pointer"); - RETURN_FALSE; - } - if (col >= 0 && col < gdImageColorsTotal(im)) { - im->red[col] = r; - im->green[col] = g; - im->blue[col] = b; - } - else { - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto array imagecolorsforindex(int im, int col) -Get the colors for an index */ -PHP_FUNCTION(imagecolorsforindex) -{ - pval *imgind, *index; - int col, ind, ind_type; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &imgind, &index) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(index); - ind = imgind->value.lval; - col = index->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorsForIndex: Unable to find image pointer"); - RETURN_FALSE; - } - - if (col >= 0 && col < gdImageColorsTotal(im)) { - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } - add_assoc_long(return_value,"red",im->red[col]); - add_assoc_long(return_value,"green",im->green[col]); - add_assoc_long(return_value,"blue",im->blue[col]); - } - else { - php_error(E_WARNING, "Color index out of range"); - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto int imagesetpixel(int im, int x, int y, int col) -Set a single pixel */ -PHP_FUNCTION(imagesetpixel) -{ - pval *imarg, *xarg, *yarg, *colarg; - gdImagePtr im; - int col, y, x; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || - getParameters(ht, 4, &imarg, &xarg, &yarg, &colarg) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(imarg); - convert_to_long(xarg); - convert_to_long(yarg); - convert_to_long(colarg); - - col = colarg->value.lval; - y = yarg->value.lval; - x = xarg->value.lval; - - im = php3_list_find(imarg->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageSetPixel(im,x,y,col); - - RETURN_TRUE; -} -/* }}} */ - -/* im, x1, y1, x2, y2, col */ -/* {{{ proto int imageline(int im, int x1, int y1, int x2, int y2, int col) -Draw a line */ -PHP_FUNCTION(imageline) -{ - pval *IM, *COL, *X1, *Y1, *X2, *Y2; - gdImagePtr im; - int col, y2, x2, y1, x1; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 6 || - getParameters(ht, 6, &IM, &X1, &Y1, &X2, &Y2, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(X1); - convert_to_long(Y1); - convert_to_long(X2); - convert_to_long(Y2); - convert_to_long(COL); - - x1 = X1->value.lval; - y1 = Y1->value.lval; - x2 = X2->value.lval; - y2 = Y2->value.lval; - col = COL->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageLine(im,x1,y1,x2,y2,col); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int imagedashedline(int im, int x1, int y1, int x2, int y2, int col) -Draw a dashed line */ -PHP_FUNCTION(imagedashedline) -{ - pval *IM, *COL, *X1, *Y1, *X2, *Y2; - gdImagePtr im; - int col, y2, x2, y1, x1; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 6 || getParameters(ht, 6, &IM, &X1, &Y1, &X2, &Y2, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(X1); - convert_to_long(Y1); - convert_to_long(X2); - convert_to_long(Y2); - convert_to_long(COL); - - x1 = X1->value.lval; - y1 = Y1->value.lval; - x2 = X2->value.lval; - y2 = Y2->value.lval; - col = COL->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageDashedLine(im,x1,y1,x2,y2,col); - RETURN_TRUE; -} -/* }}} */ - -/* im, x1, y1, x2, y2, col */ -/* {{{ proto int imagerectangle(int im, int x1, int y1, int x2, int y2, int col) -Draw a rectangle */ -PHP_FUNCTION(imagerectangle) -{ - pval *IM, *COL, *X1, *Y1, *X2, *Y2; - gdImagePtr im; - int col, y2, x2, y1, x1; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 6 || - getParameters(ht, 6, &IM, &X1, &Y1, &X2, &Y2, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(X1); - convert_to_long(Y1); - convert_to_long(X2); - convert_to_long(Y2); - convert_to_long(COL); - - x1 = X1->value.lval; - y1 = Y1->value.lval; - x2 = X2->value.lval; - y2 = Y2->value.lval; - col = COL->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageRectangle(im,x1,y1,x2,y2,col); - RETURN_TRUE; -} -/* }}} */ - -/* im, x1, y1, x2, y2, col */ -/* {{{ proto int imagefilledrectangle(int im, int x1, int y1, int x2, int y2, int col) -Draw a filled rectangle */ -PHP_FUNCTION(imagefilledrectangle) -{ - pval *IM, *COL, *X1, *Y1, *X2, *Y2; - gdImagePtr im; - int col, y2, x2, y1, x1; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 6 || - getParameters(ht, 6, &IM, &X1, &Y1, &X2, &Y2, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(X1); - convert_to_long(Y1); - convert_to_long(X2); - convert_to_long(Y2); - convert_to_long(COL); - - x1 = X1->value.lval; - y1 = Y1->value.lval; - x2 = X2->value.lval; - y2 = Y2->value.lval; - col = COL->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageFilledRectangle(im,x1,y1,x2,y2,col); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int imagearc(int im, int cx, int cy, int w, int h, int s, int e, int col) -Draw a partial ellipse */ -PHP_FUNCTION(imagearc) -{ - pval *COL, *E, *ST, *H, *W, *CY, *CX, *IM; - gdImagePtr im; - int col, e, st, h, w, cy, cx; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 8 || - getParameters(ht, 8, &IM, &CX, &CY, &W, &H, &ST, &E, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(CX); - convert_to_long(CY); - convert_to_long(W); - convert_to_long(H); - convert_to_long(ST); - convert_to_long(E); - convert_to_long(COL); - - col = COL->value.lval; - e = E->value.lval; - st = ST->value.lval; - h = H->value.lval; - w = W->value.lval; - cy = CY->value.lval; - cx = CX->value.lval; - - if (e < 0) { - e %= 360; - } - if (st < 0) { - st %= 360; - } - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageArc(im,cx,cy,w,h,st,e,col); - RETURN_TRUE; -} -/* }}} */ - -/* im, x, y, border, col */ -/* {{{ proto int imagefilltoborder(int im, int x, int y, int border, int col) -Flood fill to specific color */ -PHP_FUNCTION(imagefilltoborder) -{ - pval *IM, *X, *Y, *BORDER, *COL; - gdImagePtr im; - int col, border, y, x; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 5 || - getParameters(ht, 5, &IM, &X, &Y, &BORDER, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(X); - convert_to_long(Y); - convert_to_long(BORDER); - convert_to_long(COL); - - col = COL->value.lval; - border = BORDER->value.lval; - y = Y->value.lval; - x = X->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageFillToBorder(im,x,y,border,col); - RETURN_TRUE; -} -/* }}} */ - -/* im, x, y, col */ -/* {{{ proto int imagefill(int im, int x, int y, int col) -Flood fill */ -PHP_FUNCTION(imagefill) -{ - pval *IM, *X, *Y, *COL; - gdImagePtr im; - int col, y, x; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || - getParameters(ht, 4, &IM, &X, &Y, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(X); - convert_to_long(Y); - convert_to_long(COL); - - col = COL->value.lval; - y = Y->value.lval; - x = X->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageFill(im,x,y,col); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int imagecolorstotal(int im) -Find out the number of colors in an image's palette */ -PHP_FUNCTION(imagecolorstotal) -{ - pval *IM; - gdImagePtr im; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &IM) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(IM); - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - RETURN_LONG(gdImageColorsTotal(im)); -} -/* }}} */ - -/* im, col */ -/* {{{ proto int imagecolortransparent(int im [, int col]) -Define a color as transparent */ -PHP_FUNCTION(imagecolortransparent) -{ - pval *IM, *COL = NULL; - gdImagePtr im; - int col; - int ind_type; - GD_TLS_VARS; - - switch(ARG_COUNT(ht)) { - case 1: - if (getParameters(ht, 1, &IM) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 2: - if (getParameters(ht, 2, &IM, &COL) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(COL); - break; - default: - WRONG_PARAM_COUNT; - } - convert_to_long(IM); - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - if (COL != NULL) { - col = COL->value.lval; - gdImageColorTransparent(im,col); - } - col = gdImageGetTransparent(im); - RETURN_LONG(col); -} -/* }}} */ - -/* im, interlace */ -/* {{{ proto int imageinterlace(int im [, int interlace]) -Enable or disable interlace */ -PHP_FUNCTION(imageinterlace) -{ - pval *IM, *INT = NULL; - gdImagePtr im; - int interlace; - int ind_type; - GD_TLS_VARS; - - switch(ARG_COUNT(ht)) { - case 1: - if (getParameters(ht, 1, &IM) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 2: - if (getParameters(ht, 2, &IM, &INT) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(INT); - break; - default: - WRONG_PARAM_COUNT; - } - convert_to_long(IM); - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - if (INT != NULL) { - interlace = INT->value.lval; - gdImageInterlace(im,interlace); - } - interlace = gdImageGetInterlaced(im); - RETURN_LONG(interlace); -} -/* }}} */ - -/* arg = 0 normal polygon - arg = 1 filled polygon */ -/* im, points, num_points, col */ -static void _php3_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) { - pval *IM, *POINTS, *NPOINTS, *COL, **var; - gdImagePtr im; - gdPoint points[PolyMaxPoints]; - int npoints, col, nelem, i; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || - getParameters(ht, 4, &IM, &POINTS, &NPOINTS, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(NPOINTS); - convert_to_long(COL); - - npoints = NPOINTS->value.lval; - col = COL->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - if (POINTS->type != IS_ARRAY) { - php_error(E_WARNING, "2nd argument to imagepolygon not an array"); - RETURN_FALSE; - } - -/* - ** we shouldn't need this check, should we? ** - - if (!ParameterPassedByReference(ht, 2)) { - php_error(E_WARNING, "2nd argument to imagepolygon not passed by reference"); - RETURN_FALSE; - } -*/ - - nelem = zend_hash_num_elements(POINTS->value.ht); - if (nelem < 6) { - php_error(E_WARNING, - "you must have at least 3 points in your array"); - RETURN_FALSE; - } - - if (nelem < npoints * 2) { - php_error(E_WARNING, - "trying to use %d points in array with only %d points", - npoints, nelem/2); - RETURN_FALSE; - } - - if (npoints > PolyMaxPoints) { - php_error(E_WARNING, "maximum %d points", PolyMaxPoints); - RETURN_FALSE; - } - - for (i = 0; i < npoints; i++) { - if (zend_hash_index_find(POINTS->value.ht, (i * 2), (void **)&var) == SUCCESS) { - SEPARATE_ZVAL(var); - convert_to_long(*var); - points[i].x = (*var)->value.lval; - } - if (zend_hash_index_find(POINTS->value.ht, (i * 2) + 1, (void **)&var) == SUCCESS) { - SEPARATE_ZVAL(var); - convert_to_long(*var); - points[i].y = (*var)->value.lval; - } - } - - if (filled) { - gdImageFilledPolygon(im, points, npoints, col); - } - else { - gdImagePolygon(im, points, npoints, col); - } - - RETURN_TRUE; -} - - -/* {{{ proto int imagepolygon(int im, array point, int num_points, int col) -Draw a polygon */ -PHP_FUNCTION(imagepolygon) -{ - _php3_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto int imagefilledpolygon(int im, array point, int num_points, int col) -Draw a filled polygon */ -PHP_FUNCTION(imagefilledpolygon) -{ - _php3_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - - -static gdFontPtr _php3_find_gd_font(int size) -{ - gdFontPtr font; - int ind_type; - GD_TLS_VARS; - - switch (size) { - case 1: - font = gdFontTiny; - break; - case 2: - font = gdFontSmall; - break; - case 3: - font = gdFontMediumBold; - break; - case 4: - font = gdFontLarge; - break; - case 5: - font = gdFontGiant; - break; - default: - font = php3_list_find(size - 5, &ind_type); - if (!font || ind_type != GD_GLOBAL(le_gd_font)) { - if (size < 1) { - font = gdFontTiny; - } else { - font = gdFontGiant; - } - } - break; - } - - return font; -} - - -/* - * arg = 0 ImageFontWidth - * arg = 1 ImageFontHeight - */ -static void _php3_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg) -{ - pval *SIZE; - gdFontPtr font; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &SIZE) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(SIZE); - font = _php3_find_gd_font(SIZE->value.lval); - RETURN_LONG(arg ? font->h : font->w); -} - - -/* {{{ proto int imagefontwidth(int font) -Get font width */ -PHP_FUNCTION(imagefontwidth) -{ - _php3_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto int imagefontheight(int font) -Get font height */ -PHP_FUNCTION(imagefontheight) -{ - _php3_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - - -/* workaround for a bug in gd 1.2 */ -void _php3_gdimagecharup(gdImagePtr im, gdFontPtr f, int x, int y, int c, - int color) -{ - int cx, cy, px, py, fline; - cx = 0; - cy = 0; - if ((c < f->offset) || (c >= (f->offset + f->nchars))) { - return; - } - fline = (c - f->offset) * f->h * f->w; - for (py = y; (py > (y - f->w)); py--) { - for (px = x; (px < (x + f->h)); px++) { - if (f->data[fline + cy * f->w + cx]) { - gdImageSetPixel(im, px, py, color); - } - cy++; - } - cy = 0; - cx++; - } -} - -/* - * arg = 0 ImageChar - * arg = 1 ImageCharUp - * arg = 2 ImageString - * arg = 3 ImageStringUp - */ -static void _php3_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode) { - pval *IM, *SIZE, *X, *Y, *C, *COL; - gdImagePtr im; - int ch = 0, col, x, y, size, i, l = 0; - unsigned char *string = NULL; - int ind_type; - gdFontPtr font; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 6 || - getParameters(ht, 6, &IM, &SIZE, &X, &Y, &C, &COL) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(SIZE); - convert_to_long(X); - convert_to_long(Y); - convert_to_string(C); - convert_to_long(COL); - - col = COL->value.lval; - - if (mode < 2) { - ch = (int)((unsigned char)*(C->value.str.val)); - } else { - string = (unsigned char *) estrndup(C->value.str.val,C->value.str.len); - l = strlen(string); - } - - y = Y->value.lval; - x = X->value.lval; - size = SIZE->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - if (string) { - efree(string); - } - RETURN_FALSE; - } - - font = _php3_find_gd_font(size); - - switch(mode) { - case 0: - gdImageChar(im, font, x, y, ch, col); - break; - case 1: - _php3_gdimagecharup(im, font, x, y, ch, col); - break; - case 2: - for (i = 0; (i < l); i++) { - gdImageChar(im, font, x, y, (int)((unsigned char)string[i]), - col); - x += font->w; - } - break; - case 3: { - for (i = 0; (i < l); i++) { - /* _php3_gdimagecharup(im, font, x, y, (int)string[i], col); */ - gdImageCharUp(im, font, x, y, (int)string[i], col); - y -= font->w; - } - break; - } - } - if (string) { - efree(string); - } - RETURN_TRUE; -} - -/* {{{ proto int imagechar(int im, int font, int x, int y, string c, int col) -Draw a character */ -PHP_FUNCTION(imagechar) { - _php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto int imagecharup(int im, int font, int x, int y, string c, int col) -Draw a character rotated 90 degrees counter-clockwise */ -PHP_FUNCTION(imagecharup) { - _php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - -/* {{{ proto int imagestring(int im, int font, int x, int y, string str, int col) -Draw a string horizontally */ -PHP_FUNCTION(imagestring) { - _php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2); -} -/* }}} */ - -/* {{{ proto int imagestringup(int im, int font, int x, int y, string str, int col) -Draw a string vertically - rotated 90 degrees counter-clockwise */ -PHP_FUNCTION(imagestringup) { - _php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3); -} -/* }}} */ - -/* {{{ proto int imagecopy(int dst_im, int src_im, int dstX, int dstY, int srcX, int srcY, int srcW, int srcH) -Copy part of an image */ -PHP_FUNCTION(imagecopy) -{ - pval *SIM, *DIM, *SX, *SY, *SW, *SH, *DX, *DY; - gdImagePtr im_dst; - gdImagePtr im_src; - int srcH, srcW, srcY, srcX, dstY, dstX; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 8 || - getParameters(ht, 8, &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH) - == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(SIM); - convert_to_long(DIM); - convert_to_long(SX); - convert_to_long(SY); - convert_to_long(SW); - convert_to_long(SH); - convert_to_long(DX); - convert_to_long(DY); - - srcX = SX->value.lval; - srcY = SY->value.lval; - srcH = SH->value.lval; - srcW = SW->value.lval; - dstX = DX->value.lval; - dstY = DY->value.lval; - - im_src = php3_list_find(SIM->value.lval, &ind_type); - if (!im_src || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - im_dst = php3_list_find(DIM->value.lval, &ind_type); - if (!im_dst || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageCopy(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int imagecopyresized(int dst_im, int src_im, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH); -Copy and resize part of an image */ -PHP_FUNCTION(imagecopyresized) -{ - pval *SIM, *DIM, *SX, *SY, *SW, *SH, *DX, *DY, *DW, *DH; - gdImagePtr im_dst; - gdImagePtr im_src; - int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 10 || - getParameters(ht, 10, &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, - &SW, &SH) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(SIM); - convert_to_long(DIM); - convert_to_long(SX); - convert_to_long(SY); - convert_to_long(SW); - convert_to_long(SH); - convert_to_long(DX); - convert_to_long(DY); - convert_to_long(DW); - convert_to_long(DH); - - srcX = SX->value.lval; - srcY = SY->value.lval; - srcH = SH->value.lval; - srcW = SW->value.lval; - dstX = DX->value.lval; - dstY = DY->value.lval; - dstH = DH->value.lval; - dstW = DW->value.lval; - - im_src = php3_list_find(SIM->value.lval, &ind_type); - if (!im_src || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - im_dst = php3_list_find(DIM->value.lval, &ind_type); - if (!im_dst || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageCopyResized(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, - srcW, srcH); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int imagesx(int im) -Get image width */ -PHP_FUNCTION(imagesx) -{ - pval *IM; - gdImagePtr im; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &IM) == FAILURE) { - WRONG_PARAM_COUNT; - } - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - RETURN_LONG(gdImageSX(im)); -} -/* }}} */ - -/* {{{ proto int imagesy(int im) -Get image height */ -PHP_FUNCTION(imagesy) -{ - pval *IM; - gdImagePtr im; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &IM) == FAILURE) { - WRONG_PARAM_COUNT; - } - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - RETURN_LONG(gdImageSY(im)); -} -/* }}} */ - -#ifdef ENABLE_GD_TTF - -#define TTFTEXT_DRAW 0 -#define TTFTEXT_BBOX 1 - -/* {{{ proto array imagettfbbox(int size, int angle, string font_file, string text) -Give the bounding box of a text using TrueType fonts */ -PHP_FUNCTION(imagettfbbox) -{ - php3_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_BBOX); -} -/* }}} */ - -/* {{{ proto array imagettftext(int im, int size, int angle, int x, int y, int col, string font_file, string text) -Write text to the image using a TrueType font */ -PHP_FUNCTION(imagettftext) -{ - php3_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW); -} -/* }}} */ - -static -void php3_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode) -{ - pval *IM, *PTSIZE, *ANGLE, *X, *Y, *C, *FONTNAME, *COL; - gdImagePtr im; - int col, x, y, l=0, i; - int brect[8]; - double ptsize, angle; - unsigned char *string = NULL, *fontname = NULL; - int ind_type; - char *error; - - GD_TLS_VARS; - - if (mode == TTFTEXT_BBOX) { - if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &PTSIZE, &ANGLE, &FONTNAME, &C) == FAILURE) { - WRONG_PARAM_COUNT; - } - } else { - if (ARG_COUNT(ht) != 8 || getParameters(ht, 8, &IM, &PTSIZE, &ANGLE, &X, &Y, &COL, &FONTNAME, &C) == FAILURE) { - WRONG_PARAM_COUNT; - } - } - - convert_to_double(PTSIZE); - convert_to_double(ANGLE); - convert_to_string(FONTNAME); - convert_to_string(C); - if (mode == TTFTEXT_BBOX) { - im = NULL; - col = x = y = -1; - } else { - convert_to_long(X); - convert_to_long(Y); - convert_to_long(IM); - convert_to_long(COL); - col = COL->value.lval; - y = Y->value.lval; - x = X->value.lval; - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - } - - ptsize = PTSIZE->value.dval; - angle = ANGLE->value.dval * (M_PI/180); /* convert to radians */ - - string = (unsigned char *) C->value.str.val; - l = strlen(string); - fontname = (unsigned char *) FONTNAME->value.str.val; - - error = gdttf(im, brect, col, fontname, ptsize, angle, x, y, string); - - if (error) { - php_error(E_WARNING, error); - RETURN_FALSE; - } - - - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } - - /* return array with the text's bounding box */ - for (i = 0; i < 8; i++) { - add_next_index_long(return_value, brect[i]); - } -} -#endif -#endif - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/gd/gdcache.c b/ext/gd/gdcache.c deleted file mode 100644 index b89f5610acc1e..0000000000000 --- a/ext/gd/gdcache.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * $Id$ - * - * Caches of pointers to user structs in which the least-recently-used - * element is replaced in the event of a cache miss after the cache has - * reached a given size. - * - * John Ellson (ellson@lucent.com) Oct 31, 1997 - * - * Test this with: - * gcc -o gdcache -g -Wall -DTEST gdcache.c - * - * The cache is implemented by a singly-linked list of elements - * each containing a pointer to a user struct that is being managed by - * the cache. - * - * The head structure has a pointer to the most-recently-used - * element, and elements are moved to this position in the list each - * time they are used. The head also contains pointers to three - * user defined functions: - * - a function to test if a cached userdata matches some keydata - * - a function to provide a new userdata struct to the cache - * if there has been a cache miss. - * - a function to release a userdata struct when it is - * no longer being managed by the cache - * - * In the event of a cache miss the cache is allowed to grow up to - * a specified maximum size. After the maximum size is reached then - * the least-recently-used element is discarded to make room for the - * new. The most-recently-returned value is always left at the - * beginning of the list after retrieval. - * - * In the current implementation the cache is traversed by a linear - * search from most-recent to least-recent. This linear search - * probably limits the usefulness of this implementation to cache - * sizes of a few tens of elements. - */ - -/* This just seems unessacary */ -#if (WIN32|WINNT) -#define ENABLE_GD_TTF -#else -#include "php_config.h" -#endif -#if HAVE_LIBTTF|HAVE_LIBFREETYPE - -#include "gdcache.h" - -/*********************************************************/ -/* implementation */ -/*********************************************************/ - - -/* create a new cache */ -gdCache_head_t * -gdCacheCreate( - int size, - gdCacheTestFn_t gdCacheTest, - gdCacheFetchFn_t gdCacheFetch, - gdCacheReleaseFn_t gdCacheRelease ) -{ - gdCache_head_t *head; - - head = (gdCache_head_t *)malloc(sizeof(gdCache_head_t)); - head->mru = NULL; - head->size = size; - head->gdCacheTest = gdCacheTest; - head->gdCacheFetch = gdCacheFetch; - head->gdCacheRelease = gdCacheRelease; - return head; -} - -void -gdCacheDelete( gdCache_head_t *head ) -{ - gdCache_element_t *elem, *prev; - - elem = head->mru; - while(elem) { - (*(head->gdCacheRelease))(elem->userdata); - prev = elem; - elem = elem->next; - free((char *)prev); - } - free((char *)head); -} - -void * -gdCacheGet( gdCache_head_t *head, void *keydata ) -{ - int i=0; - gdCache_element_t *elem, *prev = NULL, *prevprev = NULL; - void *userdata; - - elem = head->mru; - while(elem) { - if ((*(head->gdCacheTest))(elem->userdata, keydata)) { - if (i) { /* if not already most-recently-used */ - /* relink to top of list */ - prev->next = elem->next; - elem->next = head->mru; - head->mru = elem; - } - return elem->userdata; - } - prevprev = prev; - prev = elem; - elem = elem->next; - i++; - } - userdata = (*(head->gdCacheFetch))(&(head->error), keydata); - if (! userdata) { - /* if there was an error in the fetch then don't cache */ - return NULL; - } - if (i < head->size) { /* cache still growing - add new elem */ - elem = (gdCache_element_t *)malloc(sizeof(gdCache_element_t)); - } - else { /* cache full - replace least-recently-used */ - /* preveprev becomes new end of list */ - prevprev->next = NULL; - elem = prev; - (*(head->gdCacheRelease))(elem->userdata); - } - /* relink to top of list */ - elem->next = head->mru; - head->mru = elem; - elem->userdata = userdata; - return userdata; -} - - - -/*********************************************************/ -/* test stub */ -/*********************************************************/ - - -#ifdef GDCACHE_TEST - -#include - -typedef struct { - int key; - int value; -} key_value_t; - -static int -cacheTest( void *map, void *key ) -{ - return (((key_value_t *)map)->key == *(int *)key); -} - -static void * -cacheFetch( char **error, void *key ) -{ - key_value_t *map; - - map = (key_value_t *)malloc(sizeof(key_value_t)); - map->key = *(int *)key; - map->value = 3; - - *error = NULL; - return (void *)map; -} - -static void -cacheRelease( void *map) -{ - free( (char *)map ); -} - -int -main(char *argv[], int argc) -{ - gdCache_head_t *cacheTable; - int elem, key; - - cacheTable = gdCacheCreate(3, cacheTest, cacheFetch, cacheRelease); - - key = 20; - elem = *(int *)gdCacheGet(cacheTable, &key); - key = 30; - elem = *(int *)gdCacheGet(cacheTable, &key); - key = 40; - elem = *(int *)gdCacheGet(cacheTable, &key); - key = 50; - elem = *(int *)gdCacheGet(cacheTable, &key); - key = 30; - elem = *(int *)gdCacheGet(cacheTable, &key); - key = 30; - elem = *(int *)gdCacheGet(cacheTable, &key); - - gdCacheDelete(cacheTable); - - return 0; -} - -#endif - -#endif /* ENABLE_GD_TTF */ diff --git a/ext/gd/gdcache.h b/ext/gd/gdcache.h deleted file mode 100644 index cdfbf71f95f14..0000000000000 --- a/ext/gd/gdcache.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * $Id$ - * - * Caches of pointers to user structs in which the least-recently-used - * element is replaced in the event of a cache miss after the cache has - * reached a given size. - * - * John Ellson (ellson@lucent.com) Oct 31, 1997 - * - * Test this with: - * gcc -o gdcache -g -Wall -DTEST gdcache.c - * - * The cache is implemented by a singly-linked list of elements - * each containing a pointer to a user struct that is being managed by - * the cache. - * - * The head structure has a pointer to the most-recently-used - * element, and elements are moved to this position in the list each - * time they are used. The head also contains pointers to three - * user defined functions: - * - a function to test if a cached userdata matches some keydata - * - a function to provide a new userdata struct to the cache - * if there has been a cache miss. - * - a function to release a userdata struct when it is - * no longer being managed by the cache - * - * In the event of a cache miss the cache is allowed to grow up to - * a specified maximum size. After the maximum size is reached then - * the least-recently-used element is discarded to make room for the - * new. The most-recently-returned value is always left at the - * beginning of the list after retrieval. - * - * In the current implementation the cache is traversed by a linear - * search from most-recent to least-recent. This linear search - * probably limits the usefulness of this implementation to cache - * sizes of a few tens of elements. - */ - -/*********************************************************/ -/* header */ -/*********************************************************/ - -#ifndef _OSD_POSIX -#include -#else -#include /* BS2000/OSD defines malloc() & friends in stdlib.h */ -#endif -#ifndef NULL -#define NULL (void *)0 -#endif - -/* user defined function templates */ -typedef int (*gdCacheTestFn_t)(void *userdata, void *keydata); -typedef void *(*gdCacheFetchFn_t)(char **error, void *keydata); -typedef void (*gdCacheReleaseFn_t)(void *userdata); - -/* element structure */ -typedef struct gdCache_element_s gdCache_element_t; -struct gdCache_element_s { - gdCache_element_t *next; - void *userdata; -}; - -/* head structure */ -typedef struct gdCache_head_s gdCache_head_t; -struct gdCache_head_s { - gdCache_element_t *mru; - int size; - char *error; - gdCacheTestFn_t gdCacheTest; - gdCacheFetchFn_t gdCacheFetch; - gdCacheReleaseFn_t gdCacheRelease; -}; - -/* function templates */ -gdCache_head_t * -gdCacheCreate( - int size, - gdCacheTestFn_t gdCacheTest, - gdCacheFetchFn_t gdCacheFetch, - gdCacheReleaseFn_t gdCacheRelease ); - -void -gdCacheDelete( gdCache_head_t *head ); - -void * -gdCacheGet( gdCache_head_t *head, void *keydata ); diff --git a/ext/gd/gdt1.c b/ext/gd/gdt1.c deleted file mode 100644 index d26a4926d46db..0000000000000 --- a/ext/gd/gdt1.c +++ /dev/null @@ -1,532 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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: Jouni Ahto | - | | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -void _php3_free_ps_font(gd_ps_font *f_ind) -{ - T1_DeleteFont(f_ind->font_id); - efree(f_ind); -} - -void _php3_free_ps_enc(char **enc) -{ - T1_DeleteEncoding(enc); -} - -/* {{{ proto int imagepsloadfont(string pathname) -Load a new font from specified file */ -void php3_imagepsloadfont(INTERNAL_FUNCTION_PARAMETERS) { - pval *file; - int l_ind; - gd_ps_font *f_ind; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string(file); - - f_ind = emalloc(sizeof(gd_ps_font)); - f_ind->font_id = T1_AddFont(file->value.str.val); - - if (f_ind->font_id < 0) { - l_ind = f_ind->font_id; - efree(f_ind); - switch (l_ind) { - case -1: - php3_error(E_WARNING, "Couldn't find the font file"); - RETURN_FALSE; - break; - case -2: - case -3: - php3_error(E_WARNING, "Memory allocation fault in t1lib"); - RETURN_FALSE; - break; - default: - php3_error(E_WARNING, "An unknown error occurred in t1lib"); - RETURN_FALSE; - break; - } - } - - T1_LoadFont(f_ind->font_id); - f_ind->extend = 1; - l_ind = php3_list_insert(f_ind, GD_GLOBAL(le_ps_font)); - RETURN_LONG(l_ind); -} -/* }}} */ - -/* {{{ The function in t1lib which this function uses seem to be buggy... -proto int imagepscopyfont(int font_index) -Make a copy of a font for purposes like extending or reenconding */ -/* -void php3_imagepscopyfont(INTERNAL_FUNCTION_PARAMETERS) { - pval *fnt; - int l_ind, type; - gd_ps_font *nf_ind, *of_ind; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &fnt) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(fnt); - - of_ind = php3_list_find(fnt->value.lval, &type); - - if (type != GD_GLOBAL(le_ps_font)) { - php3_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); - RETURN_FALSE; - } - - nf_ind = emalloc(sizeof(gd_ps_font)); - nf_ind->font_id = T1_CopyFont(of_ind->font_id); - - if (nf_ind->font_id < 0) { - l_ind = nf_ind->font_id; - efree(nf_ind); - switch (l_ind) { - case -1: - php3_error(E_WARNING, "FontID %d is not loaded in memory", l_ind); - RETURN_FALSE; - break; - case -2: - php3_error(E_WARNING, "Tried to copy a logical font"); - RETURN_FALSE; - break; - case -3: - php3_error(E_WARNING, "Memory allocation fault in t1lib"); - RETURN_FALSE; - break; - default: - php3_error(E_WARNING, "An unknown error occurred in t1lib"); - RETURN_FALSE; - break; - } - } - - nf_ind->extend = 1; - l_ind = php3_list_insert(nf_ind, GD_GLOBAL(le_ps_font)); - RETURN_LONG(l_ind); -} -*/ -/* }}} */ - -/* {{{ proto bool imagepsfreefont(int font_index) -Free memory used by a font */ -void php3_imagepsfreefont(INTERNAL_FUNCTION_PARAMETERS) { - pval *fnt; - int type; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &fnt) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(fnt); - - php3_list_find(fnt->value.lval, &type); - - if (type != GD_GLOBAL(le_ps_font)) { - php3_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); - RETURN_FALSE; - } - - php3_list_delete(fnt->value.lval); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool imagepsencodefont(int font_index, string filename) -To change a fonts character encoding vector */ -void php3_imagepsencodefont(INTERNAL_FUNCTION_PARAMETERS) { - pval *fnt, *enc; - char **enc_vector; - int type; - gd_ps_font *f_ind; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &fnt, &enc) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(fnt); - convert_to_string(enc); - - f_ind = php3_list_find(fnt->value.lval, &type); - - if (type != GD_GLOBAL(le_ps_font)) { - php3_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); - RETURN_FALSE; - } - - if ((enc_vector = T1_LoadEncoding(enc->value.str.val)) == NULL) { - php3_error(E_WARNING, "Couldn't load encoding vector from %s", enc->value.str.val); - RETURN_FALSE; - } - - T1_DeleteAllSizes(f_ind->font_id); - if (T1_ReencodeFont(f_ind->font_id, enc_vector)) { - T1_DeleteEncoding(enc_vector); - php3_error(E_WARNING, "Couldn't reencode font"); - RETURN_FALSE; - } - php3_list_insert(enc_vector, GD_GLOBAL(le_ps_enc)); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool imagepsextendfont(int font_index, double extend) -Extend or or condense (if extend < 1) a font */ -void php3_imagepsextendfont(INTERNAL_FUNCTION_PARAMETERS) { - pval *fnt, *ext; - int type; - gd_ps_font *f_ind; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &fnt, &ext) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(fnt); - convert_to_double(ext); - - f_ind = php3_list_find(fnt->value.lval, &type); - - if (type != GD_GLOBAL(le_ps_font)) { - php3_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); - RETURN_FALSE; - } - - if (T1_ExtendFont(f_ind->font_id, ext->value.dval) != 0) RETURN_FALSE; - f_ind->extend = ext->value.dval; - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool imagepsslantfont(int font_index, double slant) -Slant a font */ -void php3_imagepsslantfont(INTERNAL_FUNCTION_PARAMETERS) { - pval *fnt, *slt; - int type; - gd_ps_font*f_ind; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &fnt, &slt) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(fnt); - convert_to_double(slt); - - f_ind = php3_list_find(fnt->value.lval, &type); - - if (type != GD_GLOBAL(le_ps_font)) { - php3_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); - RETURN_FALSE; - } - - if (T1_SlantFont(f_ind->font_id, slt->value.dval) != 0) RETURN_FALSE; - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto array imagepstext(int image, string text, int font, int size, int xcoord, int ycoord [, int space, int tightness, double angle, int antialias]) -Rasterize a string over an image */ -void php3_imagepstext(INTERNAL_FUNCTION_PARAMETERS) { - pval *img, *str, *fnt, *sz, *fg, *bg, *sp, *px, *py, *aas, *wd, *ang; - int i, j, x, y; - int space, type; - gd_ps_font *f_ind; - int h_lines, v_lines, c_ind; - int rd, gr, bl, fg_rd, fg_gr, fg_bl, bg_rd, bg_gr, bg_bl; - int aa[16], aa_steps; - int width, amount_kern, add_width; - double angle; - unsigned long aa_greys[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - gdImagePtr bg_img; - GLYPH *str_img; -#ifdef HAVE_LIBT1_OUTLINE - T1_OUTLINE *char_path, *str_path; - T1_TMATRIX *transform = NULL; -#endif - - switch(ARG_COUNT(ht)) { - case 8: - if (getParameters(ht, 8, &img, &str, &fnt, &sz, &fg, &bg, &px, &py) == FAILURE) { - RETURN_FALSE; - } - convert_to_string(str); - convert_to_long(fnt); - convert_to_long(sz); - convert_to_long(fg); - convert_to_long(bg); - convert_to_long(px); - convert_to_long(py); - x = px->value.lval; - y = py->value.lval; - space = 0; - aa_steps = 4; - width = 0; - angle = 0; - break; - case 12: - if (getParameters(ht, 12, &img, &str, &fnt, &sz, &fg, &bg, &px, &py, &sp, &wd, &ang, &aas) == FAILURE) { - RETURN_FALSE; - } - convert_to_string(str); - convert_to_long(fnt); - convert_to_long(sz); - convert_to_long(sp); - convert_to_long(fg); - convert_to_long(bg); - convert_to_long(px); - convert_to_long(py); - x = px->value.lval; - y = py->value.lval; - convert_to_long(sp); - space = sp->value.lval; - convert_to_long(aas); - aa_steps = aas->value.lval; - convert_to_long(wd); - width = wd->value.lval; - convert_to_double(ang); - angle = ang->value.dval; - break; - default: - WRONG_PARAM_COUNT; - } - - bg_img = php3_list_find(img->value.lval, &type); - - if (!bg_img || type != GD_GLOBAL(le_gd)) { - php3_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - f_ind = php3_list_find(fnt->value.lval, &type); - - if (!f_ind || type != GD_GLOBAL(le_ps_font)) { - php3_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); - RETURN_FALSE; - } - - fg_rd = gdImageRed(bg_img, fg->value.lval); - fg_gr = gdImageGreen(bg_img, fg->value.lval); - fg_bl = gdImageBlue(bg_img, fg->value.lval); - bg_rd = gdImageRed(bg_img, bg->value.lval); - bg_gr = gdImageGreen(bg_img, bg->value.lval); - bg_bl = gdImageBlue(bg_img, bg->value.lval); - - for (i = 0; i < aa_steps; i++) { - rd = bg_rd+(double)(fg_rd-bg_rd)/aa_steps*(i+1); - gr = bg_gr+(double)(fg_gr-bg_gr)/aa_steps*(i+1); - bl = bg_bl+(double)(fg_bl-bg_bl)/aa_steps*(i+1); - aa[i] = gdImageColorResolve(bg_img, rd, gr, bl); - } - - T1_AASetBitsPerPixel(8); - - switch (aa_steps) { - case 4: - T1_AASetGrayValues(0, 1, 2, 3, 4); - T1_AASetLevel(T1_AA_LOW); - break; - case 16: - T1_AAHSetGrayValues(aa_greys); - T1_AASetLevel(T1_AA_HIGH); - break; - default: - php3_error(E_WARNING, "Invalid value %d as number of steps for antialiasing", aa_steps); - RETURN_FALSE; - } - - if (angle) { - transform = T1_RotateMatrix(NULL, angle); - } - - if (width) { -#ifdef HAVE_LIBT1_OUTLINE - str_path = T1_GetCharOutline(f_ind->font_id, str->value.str.val[0], sz->value.lval, transform); - - for (i = 1; i < str->value.str.len; i++) { - amount_kern = (int) T1_GetKerning(f_ind->font_id, str->value.str.val[i-1], str->value.str.val[i]); - amount_kern += str->value.str.val[i-1] == ' ' ? space : 0; - add_width = (int) (amount_kern+width)/f_ind->extend; - - char_path = T1_GetMoveOutline(f_ind->font_id, add_width, 0, 0, sz->value.lval, transform); - str_path = T1_ConcatOutlines(str_path, char_path); - - char_path = T1_GetCharOutline(f_ind->font_id, str->value.str.val[i], sz->value.lval, transform); - str_path = T1_ConcatOutlines(str_path, char_path); - } - str_img = T1_AAFillOutline(str_path, 0); -#else - php3_error(E_WARNING, "Setting space between characters in function ImagePSText is supported only with t1lib version 0.9 or above"); - RETURN_FALSE; -#endif - } else { - str_img = T1_AASetString(f_ind->font_id, str->value.str.val, str->value.str.len, - space, T1_KERNING, sz->value.lval, transform); - } - - if (T1_errno) RETURN_FALSE; - - h_lines = str_img->metrics.ascent - str_img->metrics.descent; - v_lines = str_img->metrics.rightSideBearing - str_img->metrics.leftSideBearing; - - for (i = 0; i < v_lines; i++) { - for (j = 0; j < h_lines; j++) { - switch (str_img->bits[j*v_lines+i]) { - case 0: - break; - default: - c_ind = aa[str_img->bits[j*v_lines+i]-1]; - gdImageSetPixel(bg_img, x+str_img->metrics.leftSideBearing+i, y-str_img->metrics.ascent+j, c_ind); - } - } - } - - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } - - add_next_index_long(return_value, str_img->metrics.leftSideBearing); - add_next_index_long(return_value, str_img->metrics.descent); - add_next_index_long(return_value, str_img->metrics.rightSideBearing); - add_next_index_long(return_value, str_img->metrics.ascent); - -} -/* }}} */ - -/* {{{ proto array imagepsbbox(string text, int font, int size[, int space, int tightness, int angle]) -Return the bounding box needed by a string if rasterized */ -void php3_imagepsbbox(INTERNAL_FUNCTION_PARAMETERS) { - pval *str, *fnt, *sz, *sp, *wd, *ang; - int i, space, add_width, char_width, amount_kern, type; - int cur_x, cur_y, dx, dy; - int x1, y1, x2, y2, x3, y3, x4, y4; - gd_ps_font *f_ind; - int per_char = 0; - double angle, sin_a, cos_a; - BBox char_bbox, str_bbox = {0, 0, 0, 0}; - - switch(ARG_COUNT(ht)) { - case 3: - if (getParameters(ht, 3, &str, &fnt, &sz) == FAILURE) { - RETURN_FALSE; - } - convert_to_string(str); - convert_to_long(fnt); - convert_to_long(sz); - space = 0; - break; - case 6: - if (getParameters(ht, 6, &str, &fnt, &sz, &sp, &wd, &ang) == FAILURE) { - RETURN_FALSE; - } - convert_to_string(str); - convert_to_long(fnt); - convert_to_long(sz); - convert_to_long(sp); - space = sp->value.lval; - convert_to_long(wd); - add_width = wd->value.lval; - convert_to_double(ang); - angle = ang->value.dval * M_PI / 180; - sin_a = sin(angle); - cos_a = cos(angle); - per_char = add_width || angle ? 1 : 0; - break; - default: - WRONG_PARAM_COUNT; - } - - f_ind = php3_list_find(fnt->value.lval, &type); - - if (type != GD_GLOBAL(le_ps_font)) { - php3_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); - RETURN_FALSE; - } - -#define max(a, b) (a > b ? a : b) -#define min(a, b) (a < b ? a : b) -#define new_x(a, b) (int) ((a) * cos_a - (b) * sin_a) -#define new_y(a, b) (int) ((a) * sin_a + (b) * cos_a) - - if (per_char) { - space += T1_GetCharWidth(f_ind->font_id, ' '); - cur_x = cur_y = 0; - - for (i = 0; i < str->value.str.len; i++) { - if (str->value.str.val[i] == ' ') { - char_bbox.llx = char_bbox.lly = char_bbox.ury = 0; - char_bbox.urx = char_width = space; - } else { - char_bbox = T1_GetCharBBox(f_ind->font_id, str->value.str.val[i]); - char_width = T1_GetCharWidth(f_ind->font_id, str->value.str.val[i]); - } - amount_kern = i ? T1_GetKerning(f_ind->font_id, str->value.str.val[i-1], str->value.str.val[i]) : 0; - - /* Transfer character bounding box to right place */ - x1 = new_x(char_bbox.llx, char_bbox.lly) + cur_x; - y1 = new_y(char_bbox.llx, char_bbox.lly) + cur_y; - x2 = new_x(char_bbox.llx, char_bbox.ury) + cur_x; - y2 = new_y(char_bbox.llx, char_bbox.ury) + cur_y; - x3 = new_x(char_bbox.urx, char_bbox.ury) + cur_x; - y3 = new_y(char_bbox.urx, char_bbox.ury) + cur_y; - x4 = new_x(char_bbox.urx, char_bbox.lly) + cur_x; - y4 = new_y(char_bbox.urx, char_bbox.lly) + cur_y; - - /* Find min & max values and compare them with current bounding box */ - str_bbox.llx = min(str_bbox.llx, min(x1, min(x2, min(x3, x4)))); - str_bbox.lly = min(str_bbox.lly, min(y1, min(y2, min(y3, y4)))); - str_bbox.urx = max(str_bbox.urx, max(x1, max(x2, max(x3, x4)))); - str_bbox.ury = max(str_bbox.ury, max(y1, max(y2, max(y3, y4)))); - - /* Move to the next base point */ - dx = new_x(char_width + add_width + amount_kern, 0); - dy = new_y(char_width + add_width + amount_kern, 0); - cur_x += dx; - cur_y += dy; - /* - printf("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", x1, y1, x2, y2, x3, y3, x4, y4, char_bbox.llx, char_bbox.lly, char_bbox.urx, char_bbox.ury, char_width, amount_kern, cur_x, cur_y, dx, dy); - */ - } - - } else { - str_bbox = T1_GetStringBBox(f_ind->font_id, str->value.str.val, str->value.str.len, space, T1_KERNING); - } - if (T1_errno) RETURN_FALSE; - - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } - /* - printf("%d %d %d %d\n", str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury); - */ - add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*sz->value.lval/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*sz->value.lval/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*sz->value.lval/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*sz->value.lval/1000)); -} -/* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/gd/gdt1.h b/ext/gd/gdt1.h deleted file mode 100644 index 253823fea49e2..0000000000000 --- a/ext/gd/gdt1.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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: Jouni Ahto | - | | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/gd/gdttf.c b/ext/gd/gdttf.c deleted file mode 100644 index df1e549734d3f..0000000000000 --- a/ext/gd/gdttf.c +++ /dev/null @@ -1,878 +0,0 @@ -/* gd interface to freetype library */ -/* */ -/* John Ellson ellson@lucent.com */ - -/* $Id$ */ - -#if WIN32|WINNT -#include "config.w32.h" -#else -#include "php_config.h" -#endif -#if HAVE_LIBTTF|HAVE_LIBFREETYPE -#include -#include -#include -#include -#include -#include "gdttf.h" -#include "gdcache.h" -#if HAVE_LIBFREETYPE -#include -#else -#include -#endif - -/* number of fonts cached before least recently used is replaced */ -#define FONTCACHESIZE 6 - -/* number of character glyphs cached per font before - least-recently-used is replaced */ -#define GLYPHCACHESIZE 120 - -/* number of bitmaps cached per glyph before - least-recently-used is replaced */ -#define BITMAPCACHESIZE 8 - -/* number of antialias color lookups cached */ -#if FREETYPE_4BIT_ANTIALIAS_HACK -#define TWEENCOLORCACHESIZE 128 -#else -#define TWEENCOLORCACHESIZE 32 -#endif - -/* ptsize below which anti-aliasing is ineffective */ -#define MINANTIALIASPTSIZE 0 - -/* display resolution - (Not really. This has to be 72 or hinting is wrong) */ -#define RESOLUTION 72 - -/* Number of colors used for anti-aliasing */ -#if FREETYPE_4BIT_ANTIALIAS_HACK -#define NUMCOLORS 16 -#else -#define NUMCOLORS 4 -#endif - -/* Line separation as a factor of font height. - No space between if LINESPACE = 1.00 - Line separation will be rounded up to next pixel row*/ -#define LINESPACE 1.05 - -#ifndef TRUE -#define FALSE 0 -#define TRUE !FALSE -#endif - -#define MAX(a,b) ((a)>(b)?(a):(b)) -#define MIN(a,b) ((a)<(b)?(a):(b)) - -typedef struct { - char *fontname; /* key */ - double ptsize; /* key */ - double angle; /* key */ - double sin_a, cos_a; - TT_Engine *engine; - TT_Face face; - TT_Face_Properties properties; - TT_Instance instance; - TT_CharMap char_map; - TT_Matrix matrix; - TT_Instance_Metrics imetrics; - gdCache_head_t *glyphCache; -} font_t; - -typedef struct { - char *fontname; /* key */ - double ptsize; /* key */ - double angle; /* key */ - TT_Engine *engine; -} fontkey_t; - -typedef struct { - int character; /* key */ - int hinting; /* key */ - TT_Glyph glyph; - TT_Glyph_Metrics metrics; - TT_Outline outline; - TT_Pos oldx, oldy; - TT_Raster_Map Bit; - int gray_render; - int xmin, xmax, ymin, ymax; - gdCache_head_t *bitmapCache; -} glyph_t; - -typedef struct { - int character; /* key */ - int hinting; /* key */ - int gray_render; - font_t *font; -} glyphkey_t; - -typedef struct { - int xoffset; /* key */ - int yoffset; /* key */ - char *bitmap; -} bitmap_t; - -typedef struct { - int xoffset; /* key */ - int yoffset; /* key */ - glyph_t *glyph; -} bitmapkey_t; - -typedef struct { - unsigned char pixel; /* key */ - unsigned char bgcolor; /* key */ - int fgcolor; /* key */ /* -ve means no antialias */ - gdImagePtr im; /* key */ - unsigned char tweencolor; -} tweencolor_t; - -typedef struct { - unsigned char pixel; /* key */ - unsigned char bgcolor; /* key */ - int fgcolor; /* key */ /* -ve means no antialias */ - gdImagePtr im; /* key */ -} tweencolorkey_t; - -/* forward declarations so that glyphCache can be initialized by font code */ -static int glyphTest ( void *element, void *key ); -static void *glyphFetch ( char **error, void *key ); -static void glyphRelease( void *element ); - -/* forward declarations so that bitmapCache can be initialized by glyph code */ -static int bitmapTest ( void *element, void *key ); -static void *bitmapFetch ( char **error, void *key ); -static void bitmapRelease( void *element ); - -/* local prototype */ -char *gdttfchar(gdImage *im, int fg, font_t *font, int x, int y, TT_F26Dot6 x1, TT_F26Dot6 y1, TT_F26Dot6 *advance, TT_BBox **bbox, char **next); - -#ifndef HAVE_GDIMAGECOLORRESOLVE - -int gdImageColorResolve(gdImagePtr im, int r, int g, int b); - -/********************************************************************/ -/* gdImageColorResolve is a replacement for the old fragment: */ -/* */ -/* if ((color=gdImageColorExact(im,R,G,B)) < 0) */ -/* if ((color=gdImageColorAllocate(im,R,G,B)) < 0) */ -/* color=gdImageColorClosest(im,R,G,B); */ -/* */ -/* in a single function */ - -static int -gdImageColorResolve(gdImagePtr im, int r, int g, int b) -{ - int c; - int ct = -1; - int op = -1; - long rd, gd, bd, dist; - long mindist = 3*255*255; /* init to max poss dist */ - - for (c = 0; c < im->colorsTotal; c++) { - if (im->open[c]) { - op = c; /* Save open slot */ - continue; /* Color not in use */ - } - rd = (long)(im->red [c] - r); - gd = (long)(im->green[c] - g); - bd = (long)(im->blue [c] - b); - dist = rd * rd + gd * gd + bd * bd; - if (dist < mindist) { - if (dist == 0) { - return c; /* Return exact match color */ - } - mindist = dist; - ct = c; - } - } - /* no exact match. We now know closest, but first try to allocate exact */ - if (op == -1) { - op = im->colorsTotal; - if (op == gdMaxColors) { /* No room for more colors */ - return ct; /* Return closest available color */ - } - im->colorsTotal++; - } - im->red [op] = r; - im->green[op] = g; - im->blue [op] = b; - im->open [op] = 0; - return op; /* Return newly allocated color */ -} -#endif - -/******************************************************************** - * gdTcl_UtfToUniChar is borrowed from ... - */ -/* - * tclUtf.c -- - * - * Routines for manipulating UTF-8 strings. - * - * Copyright (c) 1997-1998 Sun Microsystems, Inc. - * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * SCCS: @(#) tclUtf.c 1.25 98/01/28 18:02:43 - */ - -/* - *--------------------------------------------------------------------------- - * - * gdTcl_UtfToUniChar -- - * - * Extract the Tcl_UniChar represented by the UTF-8 string. Bad - * UTF-8 sequences are converted to valid Tcl_UniChars and processing - * continues. Equivalent to Plan 9 chartorune(). - * - * The caller must ensure that the source buffer is long enough that - * this routine does not run off the end and dereference non-existent - * memory looking for trail bytes. If the source buffer is known to - * be '\0' terminated, this cannot happen. Otherwise, the caller - * should call Tcl_UtfCharComplete() before calling this routine to - * ensure that enough bytes remain in the string. - * - * Results: - * *chPtr is filled with the Tcl_UniChar, and the return value is the - * number of bytes from the UTF-8 string that were consumed. - * - * Side effects: - * None. - * - *--------------------------------------------------------------------------- - */ - -#ifndef CHARSET_EBCDIC -#define ASC(ch) (ch) -#else /*CHARSET_EBCDIC*/ -#define ASC(ch) os_toascii[(unsigned char) (ch)] -#endif /*CHARSET_EBCDIC*/ - -#define Tcl_UniChar int -#define TCL_UTF_MAX 3 -static int -gdTcl_UtfToUniChar(char *str, Tcl_UniChar *chPtr) -/* str is the UTF8 next character pointer */ -/* chPtr is the int for the result */ -{ - int byte; - - /* HTML4.0 entities in decimal form, e.g. Å */ - byte = *((unsigned char *) str); - if (byte == '&') { - int i, n=0; - - byte = *((unsigned char *) (str+1)); - if (byte == '#') { - for (i = 2; i < 8; i++) { - byte = *((unsigned char *) (str+i)); - if (byte >= '0' && byte <= '9') { - n = (n * 10) + (byte - '0'); - } - else - break; - } - if (byte == ';') { - *chPtr = (Tcl_UniChar) n; - return ++i; - } - } - } - - /* - * Unroll 1 to 3 byte UTF-8 sequences, use loop to handle longer ones. - */ - - byte = ASC(*((unsigned char *) str)); - if (byte < 0xC0) { - /* - * Handles properly formed UTF-8 characters between 0x01 and 0x7F. - * Also treats \0 and naked trail bytes 0x80 to 0xBF as valid - * characters representing themselves. - */ - - *chPtr = (Tcl_UniChar) byte; - return 1; - } else if (byte < 0xE0) { - if ((ASC(str[1]) & 0xC0) == 0x80) { - /* - * Two-byte-character lead-byte followed by a trail-byte. - */ - - *chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6) | (ASC(str[1]) & 0x3F)); - return 2; - } - /* - * A two-byte-character lead-byte not followed by trail-byte - * represents itself. - */ - - *chPtr = (Tcl_UniChar) byte; - return 1; - } else if (byte < 0xF0) { - if (((ASC(str[1]) & 0xC0) == 0x80) && ((ASC(str[2]) & 0xC0) == 0x80)) { - /* - * Three-byte-character lead byte followed by two trail bytes. - */ - - *chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12) - | ((ASC(str[1]) & 0x3F) << 6) | (ASC(str[2]) & 0x3F)); - return 3; - } - /* - * A three-byte-character lead-byte not followed by two trail-bytes - * represents itself. - */ - - *chPtr = (Tcl_UniChar) byte; - return 1; - } -#if TCL_UTF_MAX > 3 - else { - int ch, total, trail; - - total = totalBytes[byte]; - trail = total - 1; - if (trail > 0) { - ch = byte & (0x3F >> trail); - do { - str++; - if ((ASC(*str) & 0xC0) != 0x80) { - *chPtr = byte; - return 1; - } - ch <<= 6; - ch |= (ASC(*str) & 0x3F); - trail--; - } while (trail > 0); - *chPtr = ch; - return total; - } - } -#endif - - *chPtr = (Tcl_UniChar) byte; - return 1; -} - -/********************************************************************/ -/* font cache functions */ - -static int -fontTest ( void *element, void *key ) -{ - font_t *a=(font_t *)element; - fontkey_t *b=(fontkey_t *)key; - - return ( strcmp(a->fontname, b->fontname) == 0 - && a->ptsize == b->ptsize - && a->angle == b->angle); -} - -static void * -fontFetch ( char **error, void *key ) -{ - TT_Error err; - font_t *a; - fontkey_t *b=(fontkey_t *)key; - int i, n; - short platform, encoding; - - a = (font_t *)malloc(sizeof(font_t)); - a->fontname = (char *)malloc(strlen(b->fontname) + 1); - strcpy(a->fontname,b->fontname); - a->ptsize = b->ptsize; - a->angle = b->angle; - a->sin_a = sin(a->angle); - a->cos_a = cos(a->angle); - a->engine = b->engine; - if ((err = TT_Open_Face(*b->engine, a->fontname, &a->face))) { -#if HAVE_LIBFREETYPE - if (err == 0x008) { /* The FT2 oldapi is missing this code */ -#else - if (err == TT_Err_Could_Not_Open_File) { -#endif - *error = "Could not find/open font"; - } - else { - *error = "Could not read font"; - } - return NULL; - } - /* get face properties and allocate preload arrays */ - TT_Get_Face_Properties(a->face, &a->properties); - - /* create instance */ - if (TT_New_Instance(a->face, &a->instance)) { - *error = "Could not create face instance"; - return NULL; - } - - if (TT_Set_Instance_Resolutions(a->instance, RESOLUTION, RESOLUTION)) { - *error = "Could not set device resolutions"; - return NULL; - } - - if (TT_Set_Instance_CharSize(a->instance, (TT_F26Dot6)(a->ptsize*64))) { - *error = "Could not set character size"; - return NULL; - } - - TT_Get_Instance_Metrics(a->instance, &a->imetrics); - - /* First, look for a Unicode charmap */ - n = TT_Get_CharMap_Count(a->face); - - for (i = 0; i < n; i++) { - TT_Get_CharMap_ID(a->face, i, &platform, &encoding); - if ((platform == 3 && encoding == 1) || - (platform == 2 && encoding == 1) || - (platform == 0)) { - TT_Get_CharMap(a->face, i, &a->char_map); - i = n+1; - } - } - - if (i == n) { - *error = "Sorry, but this font doesn't contain any Unicode mapping table"; - return NULL; - } - - a->matrix.xx = (TT_Fixed) (a->cos_a * (1<<16)); - a->matrix.yx = (TT_Fixed) (a->sin_a * (1<<16)); - a->matrix.xy = - a->matrix.yx; - a->matrix.yy = a->matrix.xx; - - a->glyphCache = gdCacheCreate( GLYPHCACHESIZE, - glyphTest, glyphFetch, glyphRelease); - - return (void *)a; -} - -static void -fontRelease( void *element ) -{ - font_t *a=(font_t *)element; - - gdCacheDelete(a->glyphCache); - TT_Done_Instance(a->instance); - TT_Close_Face(a->face); - free(a->fontname); - free( (char *)element ); -} - -/********************************************************************/ -/* glyph cache functions */ - -static int -glyphTest ( void *element, void *key ) -{ - glyph_t *a=(glyph_t *)element; - glyphkey_t *b=(glyphkey_t *)key; - - return (a->character == b->character - && a->hinting == b->hinting - && a->gray_render == b->gray_render); -} - -static void * -glyphFetch ( char **error, void *key ) -{ - glyph_t *a; - glyphkey_t *b=(glyphkey_t *)key; - short glyph_code; - int flags, err; - int crect[8], xmin, xmax, ymin, ymax; - double cos_a, sin_a; - - a = (glyph_t *)malloc(sizeof(glyph_t)); - a->character = b->character; - a->hinting = b->hinting; - a->gray_render = b->gray_render; - a->oldx = a->oldy = 0; - - /* create glyph container */ - if ((TT_New_Glyph(b->font->face, &a->glyph))) { - *error = "Could not create glyph container"; - return NULL; - } - - flags = TTLOAD_SCALE_GLYPH; - if (a->hinting && b->font->angle == 0.0) { - flags |= TTLOAD_HINT_GLYPH; - } - glyph_code = TT_Char_Index(b->font->char_map, a->character); - if ((err=TT_Load_Glyph(b->font->instance, a->glyph, glyph_code, flags))) { - *error = "TT_Load_Glyph problem"; - return NULL; - } - - TT_Get_Glyph_Metrics(a->glyph, &a->metrics); - if (b->font->angle != 0.0) { - TT_Get_Glyph_Outline(a->glyph, &a->outline); - TT_Transform_Outline(&a->outline, &b->font->matrix); - } - - /* calculate bitmap size */ - xmin = a->metrics.bbox.xMin -64; - ymin = a->metrics.bbox.yMin -64; - xmax = a->metrics.bbox.xMax +64; - ymax = a->metrics.bbox.yMax +64; - - cos_a = b->font->cos_a; - sin_a = b->font->sin_a; - crect[0] = (int)(xmin * cos_a - ymin * sin_a); - crect[1] = (int)(xmin * sin_a + ymin * cos_a); - crect[2] = (int)(xmax * cos_a - ymin * sin_a); - crect[3] = (int)(xmax * sin_a + ymin * cos_a); - crect[4] = (int)(xmax * cos_a - ymax * sin_a); - crect[5] = (int)(xmax * sin_a + ymax * cos_a); - crect[6] = (int)(xmin * cos_a - ymax * sin_a); - crect[7] = (int)(xmin * sin_a + ymax * cos_a); - a->xmin = MIN(MIN(crect[0],crect[2]),MIN(crect[4],crect[6])); - a->xmax = MAX(MAX(crect[0],crect[2]),MAX(crect[4],crect[6])); - a->ymin = MIN(MIN(crect[1],crect[3]),MIN(crect[5],crect[7])); - a->ymax = MAX(MAX(crect[1],crect[3]),MAX(crect[5],crect[7])); - - /* allocate bitmap large enough for character */ - a->Bit.rows = (a->ymax - a->ymin + 32 + 64) / 64; - a->Bit.width = (a->xmax - a->xmin + 32 + 64) / 64; - a->Bit.flow = TT_Flow_Up; - if (a->gray_render) { - a->Bit.cols = a->Bit.width; /* 1 byte per pixel */ - } - else { - a->Bit.cols = (a->Bit.width + 7) / 8; /* 1 bit per pixel */ - } - a->Bit.cols = (a->Bit.cols + 3) & ~3; /* pad to 32 bits */ - a->Bit.size = a->Bit.rows * a->Bit.cols; /* # of bytes in buffer */ - a->Bit.bitmap = NULL; - - a->bitmapCache = gdCacheCreate( BITMAPCACHESIZE, - bitmapTest, bitmapFetch, bitmapRelease); - - return (void *)a; -} - -static void -glyphRelease( void *element ) -{ - glyph_t *a=(glyph_t *)element; - - gdCacheDelete(a->bitmapCache); - TT_Done_Glyph( a->glyph ); - free( (char *)element ); -} - -/********************************************************************/ -/* bitmap cache functions */ - -static int -bitmapTest ( void *element, void *key ) -{ - bitmap_t *a=(bitmap_t *)element; - bitmapkey_t *b=(bitmapkey_t *)key; - - if (a->xoffset == b->xoffset && a->yoffset == b->yoffset) { - b->glyph->Bit.bitmap = a->bitmap; - return TRUE; - } - return FALSE; -} - -static void * -bitmapFetch ( char **error, void *key ) -{ - bitmap_t *a; - bitmapkey_t *b=(bitmapkey_t *)key; - - a = (bitmap_t *)malloc(sizeof(bitmap_t)); - a->xoffset = b->xoffset; - a->yoffset = b->yoffset; - - b->glyph->Bit.bitmap = a->bitmap = (char *)malloc(b->glyph->Bit.size); - memset(a->bitmap, 0, b->glyph->Bit.size); - /* render glyph */ - if (b->glyph->gray_render) { - TT_Get_Glyph_Pixmap(b->glyph->glyph, &b->glyph->Bit, - a->xoffset, a->yoffset); - } - else { - TT_Get_Glyph_Bitmap(b->glyph->glyph, &b->glyph->Bit, - a->xoffset, a->yoffset); - } - return (void *)a; -} - -static void -bitmapRelease( void *element ) -{ - bitmap_t *a=(bitmap_t *)element; - - free( a->bitmap ); - free( (char *)element ); -} - -/********************************************************************/ -/* tweencolor cache functions */ - -static int -tweenColorTest (void *element, void *key) -{ - tweencolor_t *a=(tweencolor_t *)element; - tweencolorkey_t *b=(tweencolorkey_t *)key; - - return (a->pixel == b->pixel - && a->bgcolor == b->bgcolor - && a->fgcolor == b->fgcolor - && a->im == b->im); -} - -static void * -tweenColorFetch (char **error, void *key) -{ - tweencolor_t *a; - tweencolorkey_t *b=(tweencolorkey_t *)key; - int pixel, npixel, bg, fg; - gdImagePtr im; - - a = (tweencolor_t *)malloc(sizeof(tweencolor_t)); - pixel = a->pixel = b->pixel; - bg = a->bgcolor = b->bgcolor; - fg = a->fgcolor = b->fgcolor; - im = b->im; - - /* if fg is specified by a negative color idx, then don't antialias */ - if (fg <0) { - a->tweencolor = -fg; - } else { - npixel = NUMCOLORS - pixel; - a->tweencolor = gdImageColorResolve(im, - (pixel * im->red [fg] + npixel * im->red [bg]) / NUMCOLORS, - (pixel * im->green[fg] + npixel * im->green[bg]) / NUMCOLORS, - (pixel * im->blue [fg] + npixel * im->blue [bg]) / NUMCOLORS); - } - *error = NULL; - return (void *)a; -} - -static void -tweenColorRelease(void *element) -{ - free((char *)element); -} - -/********************************************************************/ -/* gdttfchar - render one character onto a gd image */ - -static int OneTime=0; -static gdCache_head_t *tweenColorCache; - -char * -gdttfchar(gdImage *im, int fg, font_t *font, - int x, int y, /* string start pos in pixels */ - TT_F26Dot6 x1, TT_F26Dot6 y1, /* char start offset (*64) from x,y */ - TT_F26Dot6 *advance, - TT_BBox **bbox, - char **next) -{ - int pc, ch, len; - int row, col; - int x2, y2; /* char start pos in pixels */ - int x3, y3; /* current pixel pos */ - unsigned char *pixel; - - glyph_t *glyph; - glyphkey_t glyphkey; - bitmapkey_t bitmapkey; - tweencolor_t *tweencolor; - tweencolorkey_t tweencolorkey; - - /****** set up tweenColorCache on first call ************/ - if (! OneTime) { - tweenColorCache = gdCacheCreate(TWEENCOLORCACHESIZE, - tweenColorTest, tweenColorFetch, tweenColorRelease); - OneTime++; - } - /**************/ - - len = gdTcl_UtfToUniChar(*next, &ch); - *next += len; - - glyphkey.character = ch; - glyphkey.hinting = 1; - /* if fg is specified by a negative color idx, then don't antialias */ - glyphkey.gray_render = ((font->ptsize < MINANTIALIASPTSIZE) || (fg <0))?FALSE:TRUE; - glyphkey.font = font; - glyph = (glyph_t *)gdCacheGet(font->glyphCache, &glyphkey); - if (! glyph) - return font->glyphCache->error; - - *bbox = &glyph->metrics.bbox; - *advance = glyph->metrics.advance; - - /* if null *im, or invalid color, then assume user just wants brect */ - if (!im || fg > 255 || fg < -255) - return (char *)NULL; - - /* render (via cache) a bitmap for the current fractional offset */ - bitmapkey.xoffset = ((x1+32) & 63) - 32 - ((glyph->xmin+32) & -64); - bitmapkey.yoffset = ((y1+32) & 63) - 32 - ((glyph->ymin+32) & -64); - bitmapkey.glyph = glyph; - gdCacheGet(glyph->bitmapCache, &bitmapkey); - - /* copy to gif, mapping colors */ - x2 = x + (((glyph->xmin+32) & -64) + ((x1+32) & -64)) / 64; - y2 = y - (((glyph->ymin+32) & -64) + ((y1+32) & -64)) / 64; - tweencolorkey.fgcolor = fg; - tweencolorkey.im = im; - for (row = 0; row < glyph->Bit.rows; row++) { - if (glyph->gray_render) - pc = row * glyph->Bit.cols; - else - pc = row * glyph->Bit.cols * 8; - y3 = y2 - row; - if (y3 >= im->sy || y3 < 0) continue; - for (col = 0; col < glyph->Bit.width; col++, pc++) { - if (glyph->gray_render) { - tweencolorkey.pixel = - *((unsigned char *)(glyph->Bit.bitmap) + pc); - } else { - tweencolorkey.pixel = - (((*((unsigned char *)(glyph->Bit.bitmap) + pc/8)) - <<(pc%8))&128)?4:0; - } - /* if not background */ - if (tweencolorkey.pixel > 0) { - x3 = x2 + col; - if (x3 >= im->sx || x3 < 0) continue; -#if HAVE_LIBGD13 - pixel = &im->pixels[y3][x3]; -#else - pixel = &im->pixels[x3][y3]; -#endif - tweencolorkey.bgcolor = *pixel; - tweencolor = (tweencolor_t *)gdCacheGet( - tweenColorCache, &tweencolorkey); - *pixel = tweencolor->tweencolor; - } - } - } - return (char *)NULL; -} - -/********************************************************************/ -/* gdttf - render a utf8 string onto a gd image */ - -char * -gdttf(gdImage *im, int *brect, int fg, char *fontname, - double ptsize, double angle, int x, int y, char *string) -{ - TT_F26Dot6 ur_x=0, ur_y=0, ll_x=0, ll_y=0; - TT_F26Dot6 advance_x, advance_y, advance, x1, y1; - TT_BBox *bbox; - double sin_a, cos_a; - int i=0, ch; - font_t *font; - fontkey_t fontkey; - char *error, *next; - - /****** initialize font engine on first call ************/ - static gdCache_head_t *fontCache; - static TT_Engine engine; - - if (! fontCache) { - if (TT_Init_FreeType(&engine)) { - return "Failure to initialize font engine"; - } - fontCache = gdCacheCreate( FONTCACHESIZE, - fontTest, fontFetch, fontRelease); - } - /**************/ - - /* get the font (via font cache) */ - fontkey.fontname = fontname; - fontkey.ptsize = ptsize; - fontkey.angle = angle; - fontkey.engine = &engine; - font = (font_t *)gdCacheGet(fontCache, &fontkey); - if (! font) { - return fontCache->error; - } - sin_a = font->sin_a; - cos_a = font->cos_a; - advance_x = advance_y = 0; - - next=string; - while (*next) { - ch = *next; - - /* carriage returns */ - if (ch == '\r') { - advance_x = 0; - next++; - continue; - } - /* newlines */ - if (ch == '\n') { - advance_y -= (TT_F26Dot6)(font->imetrics.y_ppem * LINESPACE * 64); - advance_y = (advance_y-32) & -64; /* round to next pixel row */ - next++; - continue; - } - - x1 = (TT_F26Dot6)(advance_x * cos_a - advance_y * sin_a); - y1 = (TT_F26Dot6)(advance_x * sin_a + advance_y * cos_a); - - if ((error=gdttfchar(im, fg, font, x, y, x1, y1, &advance, &bbox, &next))) - return error; - - if (! i++) { /* if first character, init BB corner values */ - ll_x = bbox->xMin; - ll_y = bbox->yMin; - ur_x = bbox->xMax; - ur_y = bbox->yMax; - } - else { - if (! advance_x) ll_x = MIN(bbox->xMin, ll_x); - ll_y = MIN(advance_y + bbox->yMin, ll_y); - ur_x = MAX(advance_x + bbox->xMax, ur_x); - if (! advance_y) ur_y = MAX(bbox->yMax, ur_y); - } - advance_x += advance; - } - - /* rotate bounding rectangle */ - brect[0] = (int)(ll_x * cos_a - ll_y * sin_a); - brect[1] = (int)(ll_x * sin_a + ll_y * cos_a); - brect[2] = (int)(ur_x * cos_a - ll_y * sin_a); - brect[3] = (int)(ur_x * sin_a + ll_y * cos_a); - brect[4] = (int)(ur_x * cos_a - ur_y * sin_a); - brect[5] = (int)(ur_x * sin_a + ur_y * cos_a); - brect[6] = (int)(ll_x * cos_a - ur_y * sin_a); - brect[7] = (int)(ll_x * sin_a + ur_y * cos_a); - - /* scale, round and offset brect */ - i = 0; - while (i<8) { - brect[i] = x + (brect[i] + 32) / 64; - i++; - brect[i] = y - (brect[i] + 32) / 64; - i++; - } - - return (char *)NULL; -} - -#endif /* HAVE_LIBTTF|HAVE_LIBFREETYPE */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/gd/gdttf.h b/ext/gd/gdttf.h deleted file mode 100644 index 86a5eca1fe751..0000000000000 --- a/ext/gd/gdttf.h +++ /dev/null @@ -1,16 +0,0 @@ -/* $Id$ */ - -#ifdef _OSD_POSIX -#ifndef APACHE -#error On this EBCDIC platform, PHP3 is only supported as an Apache module. -#else /*APACHE*/ -#ifndef CHARSET_EBCDIC -#define CHARSET_EBCDIC /* this machine uses EBCDIC, not ASCII! */ -#endif -#include "ebcdic.h" -#endif /*APACHE*/ -#endif /*_OSD_POSIX*/ - -char * gdttf(gdImage *im, int *brect, int fg, char *fontname, - double ptsize, double angle, int x, int y, char *string); - diff --git a/ext/gd/php3_gd.h b/ext/gd/php3_gd.h deleted file mode 100644 index a6d349e252f4b..0000000000000 --- a/ext/gd/php3_gd.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997 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 | - | Stig Bakken | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef _PHP3_GD_H -#define _PHP3_GD_H - -#define HAVE_GDIMAGECREATEFROMPNG 1 - -#if HAVE_LIBTTF|HAVE_LIBFREETYPE -#define ENABLE_GD_TTF -#endif - -#if COMPILE_DL -#undef HAVE_LIBGD -#define HAVE_LIBGD 1 -#endif - -#if HAVE_LIBGD - -#include - -extern php3_module_entry gd_module_entry; -#define phpext_gd_ptr &gd_module_entry - -/* gd.c functions */ -PHP_MINFO_FUNCTION(gd); -extern PHP_MINIT_FUNCTION(gd); -extern PHP_MSHUTDOWN_FUNCTION(gd); - -extern int gdImageColorResolve(gdImagePtr, int, int, int); -PHP_FUNCTION(imagearc); -PHP_FUNCTION(imagechar); -PHP_FUNCTION(imagecharup); -PHP_FUNCTION(imagecolorallocate); -PHP_FUNCTION(imagecolorat); -PHP_FUNCTION(imagecolorclosest); -PHP_FUNCTION(imagecolordeallocate); -PHP_FUNCTION(imagecolorresolve); -PHP_FUNCTION(imagecolorexact); -PHP_FUNCTION(imagecolorset); -PHP_FUNCTION(imagecolorstotal); -PHP_FUNCTION(imagecolorsforindex); -PHP_FUNCTION(imagecolortransparent); -PHP_FUNCTION(imagecopy); -PHP_FUNCTION(imagecopyresized); -PHP_FUNCTION(imagecreate); -PHP_FUNCTION(imagecreatefromgif ); -PHP_FUNCTION(imagedestroy); -PHP_FUNCTION(imagefill); -PHP_FUNCTION(imagefilledpolygon); -PHP_FUNCTION(imagefilledrectangle); -PHP_FUNCTION(imagefilltoborder); -PHP_FUNCTION(imagefontwidth); -PHP_FUNCTION(imagefontheight); -PHP_FUNCTION(imagegif ); -PHP_FUNCTION(imageinterlace); -PHP_FUNCTION(imageline); -PHP_FUNCTION(imageloadfont); -PHP_FUNCTION(imagepolygon); -PHP_FUNCTION(imagerectangle); -PHP_FUNCTION(imagesetpixel); -PHP_FUNCTION(imagestring); -PHP_FUNCTION(imagestringup); -PHP_FUNCTION(imagesx); -PHP_FUNCTION(imagesy); -PHP_FUNCTION(imagecreatefrompng); -PHP_FUNCTION(imagepng); -void php3_free_gd_font(gdFontPtr); -void _php3_gdimagecharup(gdImagePtr, gdFontPtr, int, int, int, int); -PHP_FUNCTION(imagedashedline); -#ifdef ENABLE_GD_TTF -PHP_FUNCTION(imagettfbbox); -PHP_FUNCTION(imagettftext); -#endif -#else - -#define phpext_gd_ptr NULL - -#endif - -#endif /* _PHP3_GD_H */ diff --git a/ext/gd/setup.stub b/ext/gd/setup.stub deleted file mode 100644 index 64668ae0fbf9a..0000000000000 --- a/ext/gd/setup.stub +++ /dev/null @@ -1,6 +0,0 @@ -define_option with-gd 'GD support?' yesnodir \ - "yes /usr GD install" \ -' Whether to include GD support. If PHP can find the GD libraries\n - on your system, it will be included automatically. You should enter\n - something here if you do not want to include GD support or if you\n - have installed GD in some unusual directory.' diff --git a/ext/gettext/Makefile.am b/ext/gettext/Makefile.am deleted file mode 100644 index d6ef557cce241..0000000000000 --- a/ext/gettext/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_gettext.la -libphpext_gettext_la_SOURCES=gettext.c - diff --git a/ext/gettext/config.h.stub b/ext/gettext/config.h.stub deleted file mode 100644 index 54fe1349ce29d..0000000000000 --- a/ext/gettext/config.h.stub +++ /dev/null @@ -1,3 +0,0 @@ -/* define if you want to use the gettext extension */ - -#define HAVE_LIBINTL 0 diff --git a/ext/gettext/config.m4 b/ext/gettext/config.m4 deleted file mode 100644 index b14673527acff..0000000000000 --- a/ext/gettext/config.m4 +++ /dev/null @@ -1,45 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension gettext -dnl don't forget to call PHP_EXTENSION(gettext) - -AC_MSG_CHECKING(whether to include GNU gettext support) -AC_ARG_WITH(gettext, -[ --with-gettext[=DIR] Include GNU gettext support. DIR is the gettext - install directory, defaults to /usr/local], -[ - if test "$withval" != "no"; then - if test "$withval" = "yes"; then - GETTEXT_INCDIR=/usr/local/include - test -f /usr/local/include/libintl.h && GETTEXT_INCDIR=/usr/local/include/ - GETTEXT_LIBDIR=/usr/local/lib - else - GETTEXT_INCDIR=$withval/include - test -f $withval/include/libintl.h && GETTEXT_INCDIR=$withval/include - GETTEXT_LIBDIR=$withval/lib - fi - GETTEXT_INCLUDE=-I$GETTEXT_INCDIR - GETTEXT_LFLAGS=-L$GETTEXT_LIBDIR - O_CPPFLAGS="$CPPFLAGS" - O_LDFLAGS=$LDFLAGS - CPPFLAGS="$CPPFLAGS -I$GETTEXT_INCDIR" - LDFLAGS="$LDFLAGS -L$GETTEXT_LIBDIR" - GETTEXT_LIBS= - AC_MSG_RESULT(yes) - AC_CHECK_LIB(intl, bindtextdomain, GETTEXT_LIBS="-lintl",[ - AC_CHECK_LIB(c, bindtextdomain, GETTEXT_LIBS=,[ - AC_MSG_ERROR(Unable to find required gettext library) - ],) - ],) - - AC_DEFINE(HAVE_LIBINTL) - PHP_EXTENSION(gettext) - - EXTRA_LIBS="$EXTRA_LIBS $GETTEXT_LFLAGS $GETTEXT_LIBS" - INCLUDES="$INCLUDES $GETTEXT_INCLUDE" - - else - AC_MSG_RESULT(no) - fi -],[ - AC_MSG_RESULT(no) -]) diff --git a/ext/gettext/gettext.c b/ext/gettext/gettext.c deleted file mode 100644 index 25679d3fe4986..0000000000000 --- a/ext/gettext/gettext.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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. | - +----------------------------------------------------------------------+ - | Author: Alex Plotnick | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include -#include "php.h" -#include "php3_gettext.h" - -#if HAVE_LIBINTL - -#include - -function_entry php3_gettext_functions[] = { - PHP_FE(textdomain, NULL) - PHP_FE(gettext, NULL) - PHP_FALIAS(_, gettext, NULL) - PHP_FE(dgettext, NULL) - PHP_FE(dcgettext, NULL) - PHP_FE(bindtextdomain, NULL) - {NULL, NULL, NULL} -}; - -php3_module_entry php3_gettext_module_entry = { - "gettext", php3_gettext_functions, NULL, NULL, NULL, NULL, PHP_MINFO(gettext), STANDARD_MODULE_PROPERTIES -}; - -PHP_MINFO_FUNCTION(gettext) -{ - php_printf("GNU gettext support active."); -} - -PHP_FUNCTION(textdomain) -{ - pval **domain; - char *domain_name, *retval; - char *val; - - if (ARG_COUNT(ht) != 1 || getParametersEx(1, &domain) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(domain); - - val = (*domain)->value.str.val; - if (strcmp(val, "") && strcmp(val, "0")) { - domain_name = val; - } else { - domain_name = NULL; - } - - retval = textdomain(domain_name); - - RETURN_STRING(retval, 1); -} - -PHP_FUNCTION(gettext) -{ - pval **msgid; - char *msgstr; - - if (ARG_COUNT(ht) != 1 || getParametersEx(1, &msgid) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(msgid); - - msgstr = gettext((*msgid)->value.str.val); - - RETURN_STRING(msgstr, 1); -} - -PHP_FUNCTION(dgettext) -{ - pval **domain_name, **msgid; - char *msgstr; - - if (ARG_COUNT(ht) != 2 - || getParametersEx(2, &domain_name, &msgid) == FAILURE) - { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(domain_name); - convert_to_string_ex(msgid); - - msgstr = dgettext((*domain_name)->value.str.val, (*msgid)->value.str.val); - - RETURN_STRING(msgstr, 1); -} - -PHP_FUNCTION(dcgettext) -{ - pval **domain_name, **msgid, **category; - char *msgstr; - - if (ARG_COUNT(ht) != 3 - || getParametersEx(3, &domain_name, &msgid, &category) == FAILURE) - { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(domain_name); - convert_to_string_ex(msgid); - convert_to_long_ex(category); - - msgstr = dcgettext((*domain_name)->value.str.val, - (*msgid)->value.str.val, - (*category)->value.lval); - - RETURN_STRING(msgstr, 1); -} - -PHP_FUNCTION(bindtextdomain) -{ - pval **domain_name, **dir; - char *retval, *dir_name; - char *val; - - if (ARG_COUNT(ht) != 2 - || getParametersEx(2, &domain_name, &dir) == FAILURE) - { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(domain_name); - convert_to_string_ex(dir); - - val = (*dir)->value.str.val; - if (strcmp(val, "") && strcmp(val, "0")) { - dir_name = val; - } else { - dir_name = NULL; - } - - retval = bindtextdomain((*domain_name)->value.str.val, dir_name); - - RETURN_STRING(retval, 1); -} - -#endif /* HAVE_LIBINTL */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/gettext/php3_gettext.h b/ext/gettext/php3_gettext.h deleted file mode 100644 index e01d041b9430e..0000000000000 --- a/ext/gettext/php3_gettext.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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. | - +----------------------------------------------------------------------+ - | Author: Alex Plotnick | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef _GETTEXT_H -#define _GETTEXT_H - -#if HAVE_LIBINTL -#ifndef INIT_FUNC_ARGS -#include "modules.h" -#endif - -extern php3_module_entry php3_gettext_module_entry; -#define gettext_module_ptr &php3_gettext_module_entry - -PHP_MINFO_FUNCTION(gettext); - -PHP_FUNCTION(textdomain); -PHP_FUNCTION(gettext); -PHP_FUNCTION(dgettext); -PHP_FUNCTION(dcgettext); -PHP_FUNCTION(bindtextdomain); - -#else -#define gettext_module_ptr NULL -#endif /* HAVE_LIBINTL */ - -#define phpext_gettext_ptr gettext_module_ptr - -#endif /* _GETTEXT_H */ diff --git a/ext/gettext/setup.stub b/ext/gettext/setup.stub deleted file mode 100644 index cc9fdd43c8dbf..0000000000000 --- a/ext/gettext/setup.stub +++ /dev/null @@ -1,6 +0,0 @@ -# $Id$ - -define_option with-gettext 'gettext support?' yesnodir \ - "yes /usr/local" \ -' Whether to include gettext support.' - diff --git a/ext/hyperwave/Makefile.am b/ext/hyperwave/Makefile.am deleted file mode 100644 index 17277ee0f2025..0000000000000 --- a/ext/hyperwave/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_hyperwave.la -libphpext_hyperwave_la_SOURCES=hw.c hg_comm.c - diff --git a/ext/hyperwave/config.h.stub b/ext/hyperwave/config.h.stub deleted file mode 100644 index d8e8bf43ab1a2..0000000000000 --- a/ext/hyperwave/config.h.stub +++ /dev/null @@ -1,2 +0,0 @@ -/* Define if you want Hyperwave support */ -#define HYPERWAVE 0 diff --git a/ext/hyperwave/config.m4 b/ext/hyperwave/config.m4 deleted file mode 100644 index ef48f249548bb..0000000000000 --- a/ext/hyperwave/config.m4 +++ /dev/null @@ -1,18 +0,0 @@ -dnl $Id$ - -AC_MSG_CHECKING(for Hyperwave support) -AC_ARG_WITH(hyperwave, -[ --with-hyperwave Include Hyperwave support], -[ - if test "$withval" != "no"; then - AC_DEFINE(HYPERWAVE,1) - AC_MSG_RESULT(yes) - PHP_EXTENSION(hyperwave) - else - AC_DEFINE(HYPERWAVE,0) - AC_MSG_RESULT(no) - fi -],[ - AC_DEFINE(HYPERWAVE,0) - AC_MSG_RESULT(no) -]) diff --git a/ext/hyperwave/debug.h b/ext/hyperwave/debug.h deleted file mode 100644 index 7b6756a5ab561..0000000000000 --- a/ext/hyperwave/debug.h +++ /dev/null @@ -1,194 +0,0 @@ -/**************************************************************************** -* -* Copyright (C) 1991 Kendall Bennett. -* All rights reserved. -* -* Filename: $RCSfile$ -* Version: $Revision$ -* -* Language: ANSI C -* Environment: any -* -* Description: General header file for portable code. -* -* $Id$ -* -* Revision History: -* ----------------- -* -* $Log$ -* Revision 1.1.1.1 1999/04/07 21:03:29 zeev -* PHP 4.0 -* -* Revision 1.1.1.1 1999/03/17 04:29:10 andi -* PHP4 -* -* Revision 1.1.1.1 1998/12/21 07:56:22 andi -* Trying to start the zend CVS tree -* -* Revision 1.1 1998/08/12 09:29:16 steinm -* First version of Hyperwave module. -* -* Revision 1.6 92/03/15 12:51:48 kjb -* Added MK_FP macro and ushort typedef. -* -* Revision 1.5 91/10/28 03:17:33 kjb -* Ported to the Iris. -* -* Revision 1.4 91/09/26 15:29:02 kjb -* Added stuff for the SGI Iris 4D. -* -* Revision 1.3 91/09/26 10:07:04 kjb -* Added general typedef stuff. -* -* Revision 1.2 91/09/03 18:19:14 ROOT_DOS -* Added a few defines that are supplied by for UNIX compatibility. -* -* Revision 1.1 91/08/16 13:19:06 ROOT_DOS -* Initial revision -* -****************************************************************************/ - -#ifndef __DEBUG_H -#define __DEBUG_H - -#ifdef DEBUG -# define D(x) x -#else -# define D(x) -#endif - -#define PRIVATE static -#define PUBLIC - -#ifdef __MSDOS__ /* Compiling for MSDOS */ -# define MS(x) x -# define UX(x) -# define IR(x) -# define _8086 /* We know we have an 8086 type processor */ -#if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__) -# define LDATA -# define NULL 0L -#else -# define NULL 0 -#endif -#else __MSDOS__ -#ifdef __IRIS4D__ /* Compiling for the SGI Iris 4D */ -# define MS(x) -# define UX(x) x /* The Iris is a UNIX machine */ -# define IR(x) x -# define O_BINARY 0 /* no binary input mode in UNIX open() */ -# define MAXFILE 255 /* These are defined in , but */ -# define MAXDIR 255 /* on UNIX machines, we just define */ -# define MAXPATH 255 /* them all to be the same size */ -# define far /* Near and far do not exist under */ -# define near /* UNIX or the Iris. */ -# define NULL ((void *)0) -#else __IRIS4D__ /* Assume UNIX compilation */ -# define MS(x) -# define UX(x) x -# define IR(x) -# define O_BINARY 0 /* no binary input mode in UNIX open() */ -# define MAXFILE 255 /* These are defined in , but */ -# define MAXDIR 255 /* on UNIX machines, we just define */ -# define MAXPATH 255 /* them all to be the same size */ -# define far /* Near and far do not exist under */ -# define near /* UNIX or the Iris. */ -# ifndef NULL -# define NULL ((void *)0) -# endif -#endif __IRIS4D__ -#endif __MSDOS__ - -/**************************************************************************** -* -* SEG(p) Evaluates to the segment portion of an 8086 address. -* OFF(p) Evaluates to the offset portion of an 8086 address. -* FP(s,o) Creates a far pointer given a segment offset pair. -* PHYS(p) Evaluates to a long holding a physical address -* -****************************************************************************/ - -#ifdef _8086 -# define SEG(p) ( ((unsigned *)&(void far *)(p))[1] ) -# define OFF(p) ( (unsigned)(p) ) -# define FP(s,o) ( (void far *)( ((unsigned long)s << 16) + \ - (unsigned long)o )) -# define PHYS(p) ( (unsigned long)OFF(p) + \ - ((unsigned long)SEG(p) << 4)) -#else -# define PHYS(p) (p) -#endif _8086 - -/**************************************************************************** -* -* NUMELE(array) Evaluates to the array size in elements -* LASTELE(array) Evaluates to a pointer to the last element -* INBOUNDS(array,p) Evaluates to true if p points into the array -* RANGE(a,b,c) Evaluates to true if a <= b <= c -* max(a,b) Evaluates to a or b, whichever is larger -* min(a,b) Evaluates to a or b, whichever is smaller -* ABS(a) Evaluates to the absolute value of a -* NBITS(type) Returns the number of bits in a variable of the -* indicated type -* MAXINT Evaluates to the value of the largest signed integer -* -****************************************************************************/ - -#define NUMELE(a) (sizeof(a)/sizeof(*(a))) -#define LASTELE(a) ((a) + (NUMELE(a)-1)) -#ifdef LDATA -#define TOOHIGH(a,p) ((long)PHYS(p) - (long)PHYS(a) > (long)(NUMELE(a)-1)) -#define TOOLOW(a,p) ((long)PHYS(p) - (long)PHYS(a) < 0) -#else -#define TOOHIGH(a,p) ((long)(p) - (long)(a) > (long)(NUMELE(a)-1)) -#define TOOLOW(a,p) ((long)(p) - (long)(a) < 0) -#endif -#define INBOUNDS(a,p) ( ! (TOOHIGH(a,p) || TOOLOW(a,p)) ) - -#define _IS(t,x) (((t)1 << (x)) != 0) /* Evaluates true if the width of */ - /* variable of type t is < x. */ - /* The != 0 assures that the */ - /* answer is 1 or 0 */ - -#define NBITS(t) (4 * (1 + _IS(t,4) + _IS(t,8) + _IS(t,12) + _IS(t,16) \ - + _IS(t,20) + _IS(t,24) + _IS(t,28) + _IS(t,32))) - -#define MAXINT (((unsigned)~0) >> 1) - -#ifndef MAX -# define MAX(a,b) ( ((a) > (b)) ? (a) : (b)) -#endif -#ifndef MIN -# define MIN(a,b) ( ((a) < (b)) ? (a) : (b)) -#endif -#ifndef ABS -# define ABS(a) ((a) >= 0 ? (a) : -(a)) -#endif - -#define RANGE(a,b,c) ( (a) <= (b) && (b) <= (c) ) - -/* General typedefs */ - -#ifndef __GENDEFS -#define __GENDEFS -typedef void *ptr; -typedef void near *nearptr; -typedef void far *farptr; -/*typedef unsigned char uchar; -typedef unsigned short ushort; -typedef unsigned int uint; -typedef unsigned long ulong;*/ -typedef int bool; -#endif __GENDEFS - -/* Boolean truth values */ - -#define false 0 -#define true 1 -#define FALSE 0 -#define TRUE 1 -#define NO 0 -#define YES 1 - -#endif __DEBUG_H diff --git a/ext/hyperwave/hg_comm.c b/ext/hyperwave/hg_comm.c deleted file mode 100644 index 915c4e1ce42ec..0000000000000 --- a/ext/hyperwave/hg_comm.c +++ /dev/null @@ -1,4921 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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: Uwe Steinmann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -/* #define HW_DEBUG */ - -#include -#include "php.h" -#include "php_globals.h" -#include "SAPI.h" - -#if HYPERWAVE - -#include -#include -#include -#if WIN32|WINNT -# include -# define EWOULDBLOCK WSAEWOULDBLOCK -# define ETIMEDOUT WSAETIMEDOUT -# define bcopy memcpy -# define bzero(a,b) memset(a,0,b) -#else -# include -# include -# include -# include -# include -#endif -#include -#include -#include "hg_comm.h" -#include "dlist.h" -#include "ext/standard/head.h" - -static int set_nonblocking(int fd); -static int set_blocking(int fd); - -static int hg_read_exact(int sockfd, char *buf, int size); -static int hg_read(int sockfd, char *buf, int size); -static int hg_write(int sockfd, char *buf, int size); - -static int send_hg_msg(int sockfd, hg_msg *msg, int length); -static void build_msg_header(hg_msg *msg, int length, int version_msgid, int msg_type); -static char *build_msg_int(char *buf, int val); -static char *build_msg_str(char *buf, char *str); -static int swap(int val); - - -int version = HW_VERSION; -/* F_DISTRIBUTED has the effect that all object ids are - virtual. This means whenever an object is requested a - new id is generated for this session. Wavemaster and - Harmony set this flag. How do I know? tcpdump tells - a lot if the output is investigated. The bit is also - need to allow access on other server through the local - server. The hw_mapid() function won't work unless you - set F_DISTRIBUTED */ -/* int version = HW_VERSION | F_DISTRIBUTED; */ -/* int version = HW_VERSION | F_DISTRIBUTED | F_COMPRESSED; */ -static int msgid = 1; -static int sock_flags = -1; -static int non_blocking = 0; -static int swap_on = 0; -static int rtimeout = 40; -static int wtimeout = 40; -static int lowerror = 0; - -/*********************************************************************** -* Function fnInsStr() * -* * -* Insert string in string at position. The old string will be freed * -* with efree!!! The new string is allocated with malloc. * -* Parameter: string *str: string in which insstr is to be inserted * -* int pos: Position where string is to inserted (0=first) * -* string *insstr: string to be inserted * -* Return: pointer to new string or NULL. If NULL is returned the * -* memory for the old string has not been freed. * -***********************************************************************/ -char *fnInsStr(char *str, int pos, char *insstr) -{ - char *newstr, *ptr; - - if((str == NULL) || (insstr == NULL)) - return NULL; - if(pos > (int)strlen(str)) - return NULL; - - if(insstr[0] == '\0') - return str; - - if(NULL == (newstr = malloc(strlen(str) + strlen(insstr) + 1))) { - lowerror = LE_MALLOC; - return NULL; - } - - ptr = newstr; - memcpy(newstr, str, pos); - ptr += pos; - strcpy(ptr, insstr); - ptr += strlen(insstr); - strcpy(ptr, str+pos); - - free(str); - return newstr; -} - -/*********************************************************************** -* Function fnAddAnchor() * -* * -* Inserts new anchor into anchor list. * -* Parameter: DLIST pList: Anchor list * -* int objectID: object ID of Anchor * -* int start: start position * -* int end: end position * -* Return: Pointer to new anchor, NULL if error * -***********************************************************************/ -ANCHOR *fnAddAnchor(DLIST *pAnchorList, - int objectID, - int start, int end) -{ - ANCHOR *cur_ptr; - - if((cur_ptr = (ANCHOR *) dlst_newnode(sizeof(ANCHOR))) == NULL) { - return NULL; - } - - memset(cur_ptr, 0, sizeof(ANCHOR)); - cur_ptr->start = start; - cur_ptr->end = end; - cur_ptr->id = objectID; - cur_ptr->destdocname = NULL; - cur_ptr->nameanchor = NULL; - cur_ptr->link = NULL; - cur_ptr->tagattr = NULL; - cur_ptr->htmlattr = NULL; - cur_ptr->codebase = NULL; - cur_ptr->code = NULL; - cur_ptr->keyword = NULL; - cur_ptr->fragment = NULL; - - dlst_insertafter(pAnchorList, cur_ptr, PHP_DLST_HEAD(pAnchorList)); - - return(cur_ptr); -} - -/*********************************************************************** -* Function fnDeleteAnchor() * -* * -* Inserts new anchor into anchor list. * -* Parameter: ptr: pointer to node * -* Return: void * -***********************************************************************/ -void fnDeleteAnchor(ANCHOR *ptr) -{ - - if(ptr->destdocname) efree(ptr->destdocname); - if(ptr->nameanchor) efree(ptr->nameanchor); - if(ptr->link) efree(ptr->link); - if(ptr->tagattr) efree(ptr->tagattr); - if(ptr->htmlattr) efree(ptr->htmlattr); - if(ptr->codebase) efree(ptr->codebase); - if(ptr->code) efree(ptr->code); - if(ptr->keyword) efree(ptr->keyword); - if(ptr->fragment) efree(ptr->fragment); - - dlst_freenode(ptr); -} - -/*********************************************************************** -* Function fnCmpAnchors() * -* * -* Compares to Anchors by its start position * -* Parameter: ANCHOR a1: First Anchor * -* ANCHOR a2: Second Anchor * -* Return: As strcmp * -***********************************************************************/ -int fnCmpAnchors(ANCHOR *a1, ANCHOR *a2) -{ - if(a1->start < a2->start) - return -1; - if(a1->start == a2->start) { - /* It's importent to check this case as well, because a link with - a bigger end has to be inserted first. - */ - if(a1->end < a2->end) - return -1; - /* If both start and end are equal (yes, it is possible) - we will Src Anchor before a Dest anchor. There has been - a case where an IMG was surrounded by a NAME which was - surrounded by a HREF. In such a case the HREF doesn't - work. - */ - if(a1->end == a2->end) { - if(a1->tanchor > a2->tanchor) - return -1; - } - } - - return 1; -} - -/*********************************************************************** -* Function fnCreateAnchorList() * -* * -* Returns a list of Anchors converted from an object record * -* Parameter: int objectID: the object for which the list is created * -* char **anchors: object records of anchors * -* char **dest: object records of destinations * -* int ancount: number of anchors * -* Return: List of Anchors, NULL if error * -***********************************************************************/ -DLIST *fnCreateAnchorList(hw_objectID objectID, char **anchors, char **docofanchorrec, char **reldestrec, int ancount, int anchormode) -{ - int start, end, i, destid, anchordestid, objectID; - ANCHOR *cur_ptr = NULL; - DLIST *pAnchorList = dlst_init(); - - for(i=ancount-1; i>=0; i--) { - char *object = NULL; - char *docofanchorptr = NULL; - char *reldestptr = NULL; - char *str, *str1, link[200]; - - if(NULL != anchors[i]) { - object = anchors[i]; - docofanchorptr = docofanchorrec[i]; - reldestptr = reldestrec[i]; - - /* Determine Position. Doesn't matter if Src or Dest - The Position field should always be there. Though there - are case in which the position has no meaning, e.g. if - a document is annotated and the annotation text doesn't - contain a link of type annotation, - In such a case the Position has the value 'invisible' */ - str = strstr(object, "Position"); - str += 9; - if(0 != strncmp(str, "invisible", 9)) { - sscanf(str, "0x%X 0x%X", &start, &end); - - /* Determine ObjectID */ - objectID = 0; - if(NULL != (str = strstr(object, "ObjectID"))) { - str += 9; - sscanf(str, "0x%X", &objectID); - } - - cur_ptr = fnAddAnchor(pAnchorList, objectID, start, end); - - /* Determine Type of Anchor */ - str = strstr(object, "TAnchor"); - str += 8; - if(*str == 'S') { - char destdocname[200]; - char nameanchor[200]; - cur_ptr->tanchor = 1; - - cur_ptr->destdocname = NULL; - if(NULL != (str = strstr(object, "Dest"))) { - char *tempptr; - - /* No need to care about the value of Dest, because we take the info - from docofanchorptr. - Since the anchor has a destination there are two possibilities. - 1. The destination is an anchor or - 2. or the destination is a document already. - In both cases docofanchorptr has the proper info because GETDOCBYANCHOR - is such a nice message. - */ - switch(anchormode) { - case 0: - tempptr = docofanchorptr; - break; - default: - tempptr = reldestptr; - } - if(NULL != tempptr) { - destid = 0; - if(NULL != (str = strstr(tempptr, "ObjectID="))) { - str += 9; - sscanf(str, "0x%X", &destid); - } - /* This is basically for NAME tags. There is no need - to add the destname if it is the document itself. - */ -/* if(destid == objectID) { - cur_ptr->destdocname = NULL; - } else { */ - /* It's always nice to deal with names, so let's first check - for a name. If there is none we take the ObjectID. - */ - if(NULL != (str = strstr(tempptr, "Name="))) { - str += 5; - } else if(NULL != (str = strstr(tempptr, "ObjectID="))) { - str += 9; - } - if(sscanf(str, "%s\n", destdocname)) { - cur_ptr->destdocname = estrdup(destdocname); - } -/* } */ - } - } - - /* Get the Id of the anchor destination and the document id that belongs - to that anchor. We need that soon in order to determine if the anchor - points to a document or a dest anchor in a document. - */ - anchordestid = 0; - if(NULL != (str = strstr(object, "Dest="))) { - str += 5; - sscanf(str, "0x%X", &anchordestid); - } - - /* if anchordestid != destid then the destination is an anchor in a document whose - name (objectID) is already in destdocname. We will have to extend the link - by '#...' - */ - cur_ptr->nameanchor = NULL; - if(anchordestid != destid) { - if(NULL != (str = strstr(object, "Dest="))) { - str += 5; - if(sscanf(str, "%s\n", nameanchor)) - cur_ptr->nameanchor = estrdup(nameanchor); - } - } - - if(!cur_ptr->destdocname) { - cur_ptr->link = NULL; - if(NULL != (str = strstr(object, "Hint=URL:"))) { - str += 9; - if(sscanf(str, "%s\n", link)) - cur_ptr->link = estrdup(link); - } else if(NULL != (str = strstr(object, "Hint="))) { - str += 5; - if(sscanf(str, "%s\n", link)) - cur_ptr->link = estrdup(link); - } - } - - cur_ptr->fragment = NULL; - if(NULL != (str = strstr(object, "Fragment="))) { - str += 9; - if(sscanf(str, "%s\n", link)) - cur_ptr->fragment = estrdup(link); - } - - cur_ptr->htmlattr = NULL; - if(NULL != (str = strstr(object, "HtmlAttr="))) { - str += 9; - str1 = str; - while((*str1 != '\n') && (*str1 != '\0')) - str1++; - cur_ptr->htmlattr = emalloc(str1 - str + 1); - strncpy(cur_ptr->htmlattr, str, str1 - str); - cur_ptr->htmlattr[str1 - str] = '\0'; - } - - if(NULL != (str = strstr(object, "LinkType="))) { - str += 9; - if(strncmp(str, "background", 10) == 0) - cur_ptr->linktype=HW_BACKGROUND_LINK; - else - if(strncmp(str, "intag", 5) == 0) { - cur_ptr->linktype=HW_INTAG_LINK; - cur_ptr->tagattr = NULL; - if(NULL != (str = strstr(object, "TagAttr="))) { - str += 8; - str1 = str; - while((*str1 != '\n') && (*str1 != '\0')) - str1++; - cur_ptr->tagattr = emalloc(str1 - str + 1); - memcpy(cur_ptr->tagattr, str, str1 - str); - cur_ptr->tagattr[str1 - str] = '\0'; - } - } else - if(strncmp(str, "applet", 6) == 0) { - cur_ptr->linktype=HW_APPLET_LINK; - cur_ptr->codebase = NULL; - if(NULL != (str = strstr(object, "CodeBase="))) { - str += 9; - str1 = str; - while((*str1 != '\n') && (*str1 != '\0')) - str1++; - cur_ptr->codebase = emalloc(str1 - str + 1); - memcpy(cur_ptr->codebase, str, str1 - str); - cur_ptr->codebase[str1 - str] = '\0'; - } - cur_ptr->code = NULL; - if(NULL != (str = strstr(object, "Code="))) { - str += 5; - str1 = str; - while((*str1 != '\n') && (*str1 != '\0')) - str1++; - cur_ptr->code = emalloc(str1 - str + 1); - memcpy(cur_ptr->code, str, str1 - str); - cur_ptr->code[str1 - str] = '\0'; - } - } else - cur_ptr->linktype=HW_DEFAULT_LINK; - } else - cur_ptr->linktype=HW_DEFAULT_LINK; - - } else { /* Destination Anchor */ - char nameanchor[200]; - - cur_ptr->tanchor = 2; - cur_ptr->link = NULL; - - /* Here is the only additional info for the name attribute */ - cur_ptr->nameanchor = NULL; - if(NULL != (str = strstr(object, "ObjectID="))) { - str += 9; - if(sscanf(str, "%s\n", nameanchor)) - cur_ptr->nameanchor = estrdup(nameanchor); - } - - cur_ptr->keyword = NULL; - if(NULL != (str = strstr(object, "Keyword="))) { - str += 8; - if(sscanf(str, "%s\n", nameanchor)) - cur_ptr->keyword = estrdup(nameanchor); - } - - } - - efree(anchors[i]); - if(docofanchorrec[i]) efree(docofanchorrec[i]); - if(reldestrec[i]) efree(reldestrec[i]); - } - } - } - return pAnchorList; -} - -/*********************************************************************** -* Function fnInsAnchorsIntoText() * -* * -* Returns the text document with all anchors inserted form list * -* Parameter: char *text: text without anchors * -* DList *pAnchorList: list of anchors * -* Return: Text with anchors * -***********************************************************************/ -#define BUFFERLEN 200 -char *fnInsAnchorsIntoText(char *text, DLIST *pAnchorList, char **bodytag, char *urlprefix) { - ANCHOR *cur_ptr; - char bgstr[BUFFERLEN], istr[BUFFERLEN]; - char *scriptname; - char *newtext; - int offset = 0; - int laststart=0; - -/* The following is very tricky and depends on how rewriting is setup on your webserver. - If you skip the scriptname in the url you will have to map each hyperwave name to http://. - This may not always be a good idea. The best solution is probably to provide a prefix for such - a case which is an optional parameter to hw_gettext hw_pipedocument. -*/ - if(urlprefix) { - scriptname = urlprefix; - } else { -#if APACHE - { - int j; - array_header *arr = table_elts(((request_rec *) SG(server_context))->subprocess_env); - table_entry *elts = (table_entry *)arr->elts; - - for (j=0; j < arr->nelts; j++) { - if(0 == strcmp(elts[j].key, "SCRIPT_NAME")) - break; - } - scriptname = elts[j].val; - } -#else - scriptname = getenv("SCRIPT_FILENAME"); -#endif - } - - newtext = text; - bgstr[0] = '\0'; - dlst_mergesort(pAnchorList, fnCmpAnchors); - - cur_ptr = (ANCHOR *) dlst_last(pAnchorList); - while(NULL != cur_ptr) { - istr[0] = '\0'; - if(cur_ptr->tanchor == 1) { /* Src Anchor */ - if(laststart >= cur_ptr->end) - offset = 0; - if((cur_ptr->link != NULL) && (cur_ptr->link[0] != '\0')) { - /* The link is only set if the Link points to an external document */ - switch(cur_ptr->linktype) { - case HW_BACKGROUND_LINK: - snprintf(bgstr, BUFFERLEN, " background='%s'", cur_ptr->link); - break; - case HW_INTAG_LINK: - snprintf(istr, BUFFERLEN, " %s='%s'", cur_ptr->tagattr, cur_ptr->link); - offset -= 4; /* because there is no closing tag */ -/* laststart = cur_ptr->start; */ - break; - case HW_APPLET_LINK: - if(cur_ptr->codebase) - snprintf(istr, BUFFERLEN, " CODEBASE='%s' CODE='%s'", cur_ptr->codebase, cur_ptr->code); - else - snprintf(istr, BUFFERLEN, " CODEBASE='/' CODE='%s'", cur_ptr->code); - break; - default: - newtext = fnInsStr(newtext, cur_ptr->end+offset, ""); - if(cur_ptr->fragment) - snprintf(istr, BUFFERLEN, "", cur_ptr->link, cur_ptr->fragment, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr); - else - snprintf(istr, BUFFERLEN, "", cur_ptr->link, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr); - } - } else { - switch(cur_ptr->linktype) { - case HW_BACKGROUND_LINK: - if(NULL != cur_ptr->destdocname) - snprintf(bgstr, BUFFERLEN, " background='%s/%s'", scriptname == NULL ? "" : scriptname, cur_ptr->destdocname); - else - bgstr[0] = '\0'; - break; - case HW_INTAG_LINK: - if(cur_ptr->fragment) -/* snprintf(istr, BUFFERLEN, " %s='%s/%s#%s'", cur_ptr->tagattr, scriptname == NULL ? "." : scriptname, cur_ptr->destdocname, cur_ptr->fragment);*/ - snprintf(istr, BUFFERLEN, " %s='#%s'", cur_ptr->tagattr, cur_ptr->fragment); - else - snprintf(istr, BUFFERLEN, " %s='%s/%s'", cur_ptr->tagattr, scriptname == NULL ? "." : scriptname, cur_ptr->destdocname); - offset -= 4; /* because there is no closing tag */ -/* laststart = cur_ptr->start; */ - break; - case HW_APPLET_LINK: - if(cur_ptr->codebase) -/* snprintf(istr, BUFFERLEN, " CODEBASE='%s%s' CODE='%s'", scriptname == NULL ? "" : scriptname, cur_ptr->codebase, cur_ptr->code); */ - snprintf(istr, BUFFERLEN, " CODEBASE='%s' CODE='%s'", cur_ptr->codebase, cur_ptr->code); - else - snprintf(istr, BUFFERLEN, " CODEBASE='/' CODE='%s'", cur_ptr->code); - break; - default: - newtext = fnInsStr(newtext, cur_ptr->end+offset, ""); - - if(cur_ptr->nameanchor) - snprintf(istr, BUFFERLEN, "", scriptname == NULL ? "schade" : scriptname, cur_ptr->destdocname, cur_ptr->nameanchor, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr); - else - if(cur_ptr->fragment) - snprintf(istr, BUFFERLEN, "", scriptname == NULL ? "" : scriptname, cur_ptr->destdocname, cur_ptr->fragment, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr); - else - snprintf(istr, BUFFERLEN, "", scriptname == NULL ? "" : scriptname, cur_ptr->destdocname, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr); - } - } - newtext = fnInsStr(newtext, cur_ptr->start, istr); - /* In case there are several TAGS nested, we accumulate the offset - You wonder what the 4 means? It's the length of */ - offset += strlen(istr) + 4; - laststart = cur_ptr->start; - } else { - if(laststart >= cur_ptr->end) - offset = 0; - newtext = fnInsStr(newtext, cur_ptr->end+offset, ""); - - /* If we have a keyword, we assume we had a fragment which has been used - instead of the destdocname - */ - if(cur_ptr->keyword) - snprintf(istr, BUFFERLEN, "", cur_ptr->keyword); - else if(cur_ptr->nameanchor) - snprintf(istr, BUFFERLEN, "", cur_ptr->nameanchor); - newtext = fnInsStr(newtext, cur_ptr->start, istr); - /* In case there are several TAGS nested, we accumulate the offset - You wonder what the 4 means? It's the length of */ - offset += strlen(istr) + 4; - laststart = cur_ptr->start; - } - cur_ptr = (ANCHOR *) dlst_prev(cur_ptr); - } - snprintf(istr, BUFFERLEN, "", bgstr); - *bodytag = estrdup(istr); - return(newtext); -} -#undef BUFFERLEN - -/*********************************************************************** -* Function fnAttributeValue() * -* * -* Returns the value of an attribute * -* Parameter: char *object: object record * -* char *attrname: attribute name * -* Return: char*: attribute value, NULL if name not found * -***********************************************************************/ -char *fnAttributeValue(char *object, char *attrname) -{ - char *str, *str1, *attrvalue; - int len; - - str = strstr(object, attrname); - if(NULL == str) - return(NULL); - str += strlen(attrname); - str++; - str1 = str; - while((*str1 != '\0') && (*str1 != '\n')) - str1++; - len = str1 - str; - if(NULL == (attrvalue = emalloc(len+1))) { - lowerror = LE_MALLOC; - return NULL; - } - memcpy(attrvalue, str, len); - attrvalue[len] = '\0'; - return(attrvalue); -} - -/*********************************************************************** -* Function fnAttributeCompare() * -* * -* Checks if an attribute in an objrec has a certain value * -* Parameter: char *object: object record * -* char *attrname: attribute name * -* char *value: value of attribute * -* Return: char*: as strcmp * -***********************************************************************/ -int fnAttributeCompare(char *object, char *attrname, char *value) -{ - char *str, *str1; - int len; - - if((NULL == object) || (NULL == attrname) || (NULL == value)) - return -2; - - /* Find the attribute Name and make sure it is followed by - a '=' sign and preceded by a '\n'; - */ - str = strstr(object, attrname); - if((NULL == str) || - (str[strlen(attrname)] != '=') || - (str[-1] != '\n')) { - return(-2); - } - str += strlen(attrname); /* skip the attribute name */ - str++; /* skip the equal sign */ - - /* Search for end of attribute value */ - str1 = str; - while((*str1 != '\0') && (*str1 != '\n')) - str1++; - len = str1 - str; - return(strncmp(str, value, len)); -} - -/********************************************************************* -* Function fnCOpenDataCon() * -* * -* Opens data connection on client side. This function is called * -* right after the client has requested any data from the server * -* Parameter: int sockfd: socket of control connection * -* int *port: port of control und data connection * -* Return : sockfd on success, <0 if error * -*********************************************************************/ -static int fnCOpenDataCon(int sockfd, int *port) - { - int fd; - struct sockaddr_in serv_addr; - int len; - int option = 1; - -/* len = sizeof(com_addr); - if(getsockname(sockfd, (struct sockaddr *) &com_addr, &len) < 0) - { - return(-1); - } - - *port = htons(com_addr.sin_port); */ - - /* - ** Open a TCP socket (an Internet stream socket) - */ - if((fd = socket(AF_INET, SOCK_STREAM, 0)) == SOCK_ERR) - { - return(-1); - } - - /* - ** Make sure that address may be reused - */ -#if defined(SUN) || (WIN32|WINNT) - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&option, sizeof(option)); -#else - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)); -#endif - - /* - ** Open connection aktiv - ** Let bind() select a port number - */ - bzero((char *) &serv_addr, sizeof(serv_addr)); - if(bind(fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) - { - return(-1); - } - - /* - ** Get the port number bind selected - */ - len = sizeof (serv_addr); - if(getsockname(fd, (struct sockaddr *)&serv_addr, &len) < 0) - { - return(-1); - } - *port = ntohs(serv_addr.sin_port); - - listen(fd, 5); - - return(fd); - } - -/*====================================================================== - * - * Read/write routines with timeout detection. - * - * Usage: write_to(fd, buffer, n, timeout) - * read_to(fd, buffer, n, timeout) - * - * David Chavez - * Engineering Services & Software - * 7841 New Salem Street - * San Diego, CA 92126 - * USA - * - * dec@essw.com - * - *====================================================================*/ -#if WIN32|WINNT -#include -#else -#include -#include -#include -#endif -#include -#include - -#if !(WIN32|WINNT) -static sigset_t newmask, oldmask, zeromask; -#endif - -static int set_noblock(int fd) -{ -#if WIN32|WINNT - u_long argp=1; - - return ioctlsocket (fd, FIONBIO , &argp); -#else - - sigemptyset(&zeromask); - sigemptyset(&newmask); - sigaddset(&newmask, SIGHUP); - sigaddset(&newmask, SIGUSR1); - sigaddset(&newmask, SIGUSR2); - if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0) return -1; - - return fcntl(fd, F_SETFL, O_NONBLOCK | O_NDELAY /* | FNBIO*/); -#endif -} - -int write_to(int fd, void *buffer, int n, int timeout) -{ - int nrem, nw; - char *bptr; - int error; -#if defined(SYSV) || (WIN32|WINNT) - int width = 20; -#else - int width = getdtablesize(); -#endif - fd_set writefds; - struct timeval select_timeout; - - select_timeout.tv_sec = timeout; -#if WIN32|WINNT - select_timeout.tv_usec = 0; -#else /* is this just a typo? */ - select_timeout.tv_usec = 0.; -#endif - - /* Set fd to non-blocking */ - - if (set_noblock(fd) != 0) return -1; - - /* Write to fd until no more can be written */ - - FD_ZERO(&writefds); - - FD_SET((unsigned int)fd, &writefds); - - for( nrem = n, bptr = buffer; nrem;) - { - if(( error = select(width, - (fd_set *) 0, - &writefds, - (fd_set *) 0, - &select_timeout)) <= 0 && errno != EINTR) break; - - if(errno != EINTR && ( nw = write(fd, bptr, nrem)) <= 0) { - /* - * check for error number - and keep trying to - * write - */ - if(errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR) - { - continue; - } - else - { - error = nw; - break; - } - } else { - nrem -= nw; - bptr += nw; - } - } -#if !(WIN32|WINNT) - if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) return -1; -#endif - if( ! error ) { - errno = ETIMEDOUT; - return(-2); - } else if (error < 0) { - return(error); - } else { - return(n); - } -} - -int read_to(int fd, char *buffer, int n, int timeout) - { - int nrem, nread, nr; - char *bptr; - int error; - -#if defined(SYSV) || (WIN32|WINNT) - int width = 20; -#else - int width = getdtablesize(); -#endif - fd_set readfds; - struct timeval select_timeout; - - select_timeout.tv_sec = timeout; -#if WIN32|WINNT - select_timeout.tv_usec = 0; -#else - select_timeout.tv_usec = 0.; -#endif - - /* Set fd to non-blocking */ - - if (set_noblock(fd) != 0) return -1; - - FD_ZERO(&readfds); - - FD_SET((unsigned int)fd, &readfds); - - for( nrem = n, bptr = buffer, nread = 0; nrem;) - { - if(( error = select(width, - &readfds, - (fd_set *) 0, - (fd_set *) 0, - &select_timeout)) <= 0 && errno != EINTR) break; - - if(errno != EINTR && (nr = read (fd, bptr, nrem)) < 0) - { - /* - * check for error number - and keep trying to - * read - */ - if(errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR) - { - continue; - } - else - { - error = nr; - break; - } - } - else if(nr == 0) - { - break; - } - else - { - nread += nr; - bptr += nr; - nrem -= nr; - } - } - -#if !(WIN32|WINNT) - if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) return -1; -#endif - if( ! error ) - { - errno = ETIMEDOUT; - return(-2); - } - else if ( error < 0) - { - return(-1); - } - else - { - return(nread); - } - } - -void set_swap(int do_swap) -{ - swap_on = do_swap; -} - -/*********************************************************************** -* Function open_hg_connection() * -* * -***********************************************************************/ -int open_hg_connection(char *server_name, int port) -{ - int sockfd; - int option = 1; - struct sockaddr_in server_addr; - struct hostent *hp; - if ( (hp = gethostbyname(server_name)) == NULL ) { - return(-1); - } - - bzero((char *)&server_addr, sizeof(server_addr)); - server_addr.sin_family = AF_INET; - if ( port != 0 ) - server_addr.sin_port = htons(port); - else - server_addr.sin_port = htons(HG_SERVER_PORT); -/* bcopy(hp->h_addr, (char *) &server_addr.sin_addr, hp->h_length); */ - server_addr.sin_addr = *(struct in_addr *) hp->h_addr; - - if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) == SOCK_ERR ) { - return(-2); - } - -#if defined(SUN) || (WIN32|WINNT) - setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&option, sizeof(option)); -#else - setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)); -#endif /* SUN */ - - if (connect(sockfd, (struct sockaddr *) &server_addr, sizeof(server_addr)) < 0) { - HWSOCK_FCLOSE(sockfd); - return(-3); - } - -#if !(WIN32|WINNT) - if ( (sock_flags = fcntl(sockfd, F_GETFL, 0)) == -1 ) -#endif - - if ( set_nonblocking(sockfd) == -1 ) { - HWSOCK_FCLOSE(sockfd); - return(-4); - } - - return(sockfd); -} - - -/*********************************************************************** -* Function initialize_hg_connection() * -* * -***********************************************************************/ -int initialize_hg_connection(int sockfd, int *do_swap, int *version, char **userdata, char **server_string, char *username, char *password) -{ - char buf, c; - char *tmp; - hg_msg *ready_msg, *retmsg, msg; - int i = 0x01; - int length; - - *do_swap = 0; - buf = 'T'; - if ( hg_write(sockfd, &buf, 1) == -1 ) { - return(-2); - } - - if ( hg_read_exact(sockfd, &buf, 1) == -1 ) { - return(-3); - } - if ( buf == 'F' ) { - return(-4); - } - if ( buf != 'T' ) { - return(-5); - } - - buf = c = ( *(char *)&i ) ? 'l' : 'B'; - if ( hg_write(sockfd, &buf, 1) == -1 ) { - return(-6); - } - if ( hg_read_exact(sockfd, &buf, 1) == -1 ) { - return(-7); - } - if ( c != buf ) { - swap_on = 1; - *do_swap = 1; - } else { - swap_on = 0; - *do_swap = 0; - } - - if ( send_ready(sockfd) == -1) { - return(-8); - } - - /* Receive return from Ready message */ - if ( (ready_msg = recv_ready(sockfd)) == NULL ) { - return(-9); - } - - if ((ready_msg->version_msgid & F_VERSION) < HW_VERSION) - return(-8); - *version = ready_msg->version_msgid; - *server_string = strdup(ready_msg->buf+4); - efree(ready_msg->buf); - efree(ready_msg); - - /* If we have a username and password then do the identification. */ - if((NULL != username) && (NULL != password)) { - length = HEADER_LENGTH + sizeof(int) + strlen(username) + 1 + strlen(password) + 1; - - build_msg_header(&msg, length, msgid++, IDENTIFY_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, 0); - tmp = build_msg_str(tmp, username); - tmp = build_msg_str(tmp, password); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-10); - } - efree(msg.buf); - } - - if((NULL != username) && (NULL != password)) { - /* Receive return form identify message */ - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) - return(-11); - - *userdata = retmsg->buf; - efree(retmsg); - } - - return(0); -} - - -static int set_nonblocking(int fd) -{ -#if WIN32|WINNT - unsigned int argp=0; - -/* if ( sock_flags == -1 ) - getsockopt (fd, SOL_SOCKET, optname, optval, optlen); -*/ if(ioctlsocket (fd, FIONBIO , &argp) == -1) - return(-1); -#else - if ( sock_flags == -1 ) - sock_flags = fcntl(fd, F_GETFL, 0); - if ( fcntl(fd, F_SETFL, O_NONBLOCK) == -1 ) - return(-1); -#endif - non_blocking = 1; - return(0); -} - - -static int set_blocking(int fd) -{ -#if WIN32|WINNT - unsigned int argp=1; - - if(ioctlsocket (fd, FIONBIO , &argp) == -1) - return(-1); -#else - if ( fcntl(fd, F_SETFL, sock_flags) == -1 ) - return(-1); -#endif - return(0); -} - - -static int hg_read_exact(int sockfd, char *buf, int size) -{ - int len = 0; - - len = read_to(sockfd, (void *) buf, size, rtimeout); - if ( len < 0 ) - return -1; - return(0); -} - - -static int hg_read(int sockfd, char *buf, int size) -{ - int try = 0; - int len = 0; - - if ( !non_blocking ) - set_nonblocking(sockfd); - while ( len == 0 ) { - len = recv(sockfd, (void *) buf, size, 0); - if ( len == -1 ) { - if ( (errno == EAGAIN) || (errno == EWOULDBLOCK) ) { - if ( ++try > 5 ) - return(-1); - sleep(1); - } - else return(-1); - } - } - return(len); -} - - -static int hg_write(int sockfd, char *buf, int size) -{ - int try = 0; - int len = 0; - - if ( !non_blocking ) - set_nonblocking(sockfd); - while ( size > 0 ) { - len = send(sockfd, (void *) buf, size, 0); - if ( len == -1 ) { - if ( (errno == EAGAIN) || (errno == EWOULDBLOCK) ) { - if ( ++try > 5 ) - return(-1); - sleep(1); - } - else return(-1); - } - else { - size -= len; - buf += len; - try = 0; - } - } - return(0); -} - - -hg_msg *recv_hg_msg(int sockfd) -{ - hg_msg *msg; - - if ( (msg = (hg_msg *)emalloc(sizeof(hg_msg))) == NULL ) { -/* php3_printf("recv_hg_msg"); */ - lowerror = LE_MALLOC; - return(NULL); - } - - if ( hg_read_exact(sockfd, (char *)&(msg->length), 4) == -1 ) { -/* php3_printf("recv_hg_msg: hg_read (1) returned -1\n"); */ - efree(msg); - return(NULL); - } - - if ( hg_read_exact(sockfd, (char *)&(msg->version_msgid), 4) == -1 ) { -/* php3_printf("recv_hg_msg: hg_read (2) returned -1\n"); */ - efree(msg); - return(NULL); - } - - if ( hg_read_exact(sockfd, (char *)&(msg->msg_type), 4) == -1 ) { -/* php3_printf("recv_hg_msg: hg_read (3) returned -1\n"); */ - efree(msg); - return(NULL); - } - - if ( msg->length > HEADER_LENGTH ) { - if ( (msg->buf = (char *) emalloc(msg->length-HEADER_LENGTH)) == NULL ) { -/* php3_printf("recv_hg_msg"); */ - lowerror = LE_MALLOC; - efree(msg); - return(NULL); - } - if ( hg_read_exact(sockfd, msg->buf, msg->length-HEADER_LENGTH) == -1 ) { -/* php3_printf("recv_hg_msg: hg_read (4) returned -1\n"); */ - efree(msg->buf); - efree(msg); - return(NULL); - } - } - else - msg->buf = NULL; - -#ifdef HW_DEBUG - php3_printf(" Recv msg: type = %d -- id = %d
\n", msg->msg_type, msg->version_msgid); -#endif - return(msg); -} - - -hg_msg *recv_ready(int sockfd) -{ - hg_msg *ready_msg; - - if ( (ready_msg = recv_hg_msg(sockfd)) == NULL ) { -/* php3_printf("recv_ready: recv_hg_msg returned NULL\n"); */ - return(NULL); - } - if ( ready_msg->msg_type != READY_MESSAGE ) { -/* php3_printf("recv_ready: recv_hg_msg returned wrong message: %d, %d \n", ready_msg->length, ready_msg->msg_type); */ - efree(ready_msg); - return(NULL); - } - - return(ready_msg); -} - - -hg_msg *recv_command(int sockfd) -{ - hg_msg *comm_msg; - - if ( (comm_msg = recv_hg_msg(sockfd)) == NULL ) { -/* fprintf(stderr, "recv_command: recv_hg_msg returned NULL\n"); */ - return(NULL); - } - if ( comm_msg->msg_type != COMMAND_MESSAGE ) { -/* fprintf(stderr, "recv_command: recv_hg_msg returned wrong message\n"); */ - return(NULL); - } - - return(comm_msg); -} - -int send_dummy(int sockfd, hw_objectID objectID, int msgid, char **attributes) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, msgid); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - *attributes = NULL; - return(-1); - } - - if(0 == (int) *(retmsg->buf)) { - *attributes = estrdup(retmsg->buf+sizeof(int)); - efree(retmsg->buf); - efree(retmsg); - } else { - error = *((int *) retmsg->buf); - *attributes = NULL; - efree(retmsg->buf); - efree(retmsg); - return error; - } - - return(0); -} - -static int bh_send_deleteobject(int sockfd, hw_objectID objectID) { - hg_msg msg; - int length; - char *tmp; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, DELETEOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - efree(msg.buf); - - return(msgid-1); -} - -static int uh_send_deleteobject(int sockfd) { - hg_msg *retmsg; - int error; - - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - return(-1); - } - - if(NULL == retmsg->buf) { - efree(retmsg); - return -1; - } - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return(error); -} - -int send_deleteobject(int sockfd, hw_objectID objectID) -{ - if(0 > bh_send_deleteobject(sockfd, objectID)) - return -1; - return(uh_send_deleteobject(sockfd)); -} - -static int bh_send_changeobject(int sockfd, hw_objectID objectID, char *mod) { - hg_msg msg; - int length; - char *tmp; - - length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(mod) + 1; - - build_msg_header(&msg, length, msgid++, CHANGEOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - tmp = build_msg_str(tmp, mod); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - efree(msg.buf); - - return(msgid-1); -} - -static int uh_send_changeobject(int sockfd) { - hg_msg *retmsg; - int error; - - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - return(-1); - } - - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return(error); -} - -int send_changeobject(int sockfd, hw_objectID objectID, char *modification) -{ - if(0 > bh_send_changeobject(sockfd, objectID, modification)) - return -1; - return(uh_send_changeobject(sockfd)); -} - -int send_groupchangeobject(int sockfd, hw_objectID objectID, char *modification) -{ - hw_objectID *childIDs; - int count, i, error; - - if(0 == (error = send_lock(sockfd, objectID))) { - send_changeobject(sockfd, objectID, modification); - send_unlock(sockfd, objectID); - }/* else - fprintf(stderr, "Could not lock 0x%X (error = %d)\n", objectID, error); */ - - if(0 == send_children(sockfd, objectID, &childIDs, &count)) { -/* fprintf(stderr, "Changing Children of 0x%X\n", objectID); */ - for(i=0; i send_groupchangeobject(sockfd, childIDs[i], modification)) -/* fprintf(stderr, "Cannot change 0x%X\n", objectID) */; - if(childIDs) - efree(childIDs); - }/* else - fprintf(stderr, "No Children of 0x%X\n", objectID); */ - return(0); -} - -static int bh_send_getobject(int sockfd, hw_objectID objectID) { - hg_msg msg; - int length; - char *tmp; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - efree(msg.buf); - - return(msgid-1); -} - -static int uh_send_getobject(int sockfd, char **attributes) { - hg_msg *retmsg; - int error; - - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - *attributes = NULL; - return(-1); - } - - if(0 == (int) *(retmsg->buf)) { - *attributes = estrdup(retmsg->buf+sizeof(int)); - efree(retmsg->buf); - efree(retmsg); - } else { - error = *((int *) retmsg->buf); - *attributes = NULL; - efree(retmsg->buf); - efree(retmsg); - return error; - } - - return(0); -} - -int send_getobject(int sockfd, hw_objectID objectID, char **attributes) -{ - if(0 > bh_send_getobject(sockfd, objectID)) - return -1; - return(uh_send_getobject(sockfd, attributes)); -} - -int send_getandlock(int sockfd, hw_objectID objectID, char **attributes) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETANDLOCK_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - *attributes = NULL; - return(-1); - } - - if(0 == (error = (int) *(retmsg->buf))) { - *attributes = estrdup(retmsg->buf+sizeof(int)); - } else { - *attributes = NULL; - } - - efree(retmsg->buf); - efree(retmsg); - return error; -} - -int send_lock(int sockfd, hw_objectID objectID) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETANDLOCK_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - return(-1); - } - - error = *((int *) retmsg->buf); - - efree(retmsg->buf); - efree(retmsg); - return error; -} - -int send_insertobject(int sockfd, char *objrec, char *parms, hw_objectID *objectID) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - int *ptr; - - length = HEADER_LENGTH + strlen(objrec) + 1 + strlen(parms) + 1; - - build_msg_header(&msg, length, msgid++, INSERTOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_str(msg.buf, objrec); - tmp = build_msg_str(tmp, parms); -/*fprintf(stderr,"objrec = %s, parms = %s\n", objrec, parms); */ - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - *objectID = 0; - return(-1); - } - - ptr = (int *) retmsg->buf; - if(0 == (error = *ptr)) { - ptr++; - *objectID = *ptr; - } else { - *objectID = 0; - } - efree(retmsg->buf); - efree(retmsg); - return error; -} - -int send_unlock(int sockfd, hw_objectID objectID) -{ - hg_msg msg; - int length, error; - char *tmp; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, UNLOCK_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - return 0; -} - -int send_incollections(int sockfd, int retcol, int cobjids, hw_objectID *objectIDs, int ccollids, hw_objectID *collIDs, int *count, hw_objectID **retIDs) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - int *ptr, *ptr1, i; - - length = HEADER_LENGTH + sizeof(hw_objectID) + (cobjids + ccollids) * sizeof(hw_objectID) + 2 * sizeof(int); - - build_msg_header(&msg, length, msgid++, INCOLLECTIONS_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-3); - } - - tmp = build_msg_int(msg.buf, retcol); - tmp = build_msg_int(tmp, cobjids); - for(i=0; ibuf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = *ptr; - ptr++; - if(NULL != (*retIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = *retIDs; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - if(retmsg->buf) efree(retmsg->buf); - if(retmsg) efree(retmsg); - return error; - } - return(0); -} - - -int send_inscoll(int sockfd, hw_objectID objectID, char *objrec, hw_objectID *new_objectID) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - int *ptr; - - length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(objrec) + 1; - - build_msg_header(&msg, length, msgid++, INSCOLL_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-3); - } - - tmp = build_msg_int(msg.buf, objectID); - tmp = build_msg_str(tmp, objrec); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-2); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if(retmsg == NULL) { - return(-1); - } - - ptr = (int *) retmsg->buf; - if(0 != (error = *ptr)) { - efree(retmsg->buf); - efree(retmsg); - *new_objectID = 0; - return error; - } - - ptr++; - *new_objectID = *ptr; - efree(retmsg->buf); - efree(retmsg); - return 0; -} - -int send_insdoc(int sockfd, hw_objectID objectID, char *objrec, char *text, hw_objectID *new_objectID) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - int *ptr; - - length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(objrec) + 1; - if(text) { - length += strlen(text); - length++; - } - - build_msg_header(&msg, length, msgid++, INSDOC_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-3); - } - - tmp = build_msg_int(msg.buf, objectID); - tmp = build_msg_str(tmp, objrec); - if(text) - tmp = build_msg_str(tmp, text); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-2); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if(retmsg == NULL) { - return(-1); - } - - ptr = (int *) retmsg->buf; - if(0 != (error = *ptr)) { - efree(retmsg->buf); - efree(retmsg); - *new_objectID = 0; - return error; - } - - ptr++; - *new_objectID = *ptr; - efree(retmsg->buf); - efree(retmsg); - return 0; -} - -int send_getdestforanchorsobj(int sockfd, char **anchorrec, char ***destrec, int count); -int send_getreldestforanchorsobj(int sockfd, char **anchorrec, char ***reldestrec, int count, int rootID, int thisID); - -int send_gettext(int sockfd, hw_objectID objectID, int mode, int rootid, char **objattr, char **bodytag, char **text, int *count, char *urlprefix) -{ - hg_msg msg, *retmsg; - int length, *ptr, ancount, error; - char *tmp, *attributes, *documenttype; - char **anchors; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if(retmsg == NULL) { - attributes = NULL; - return(-1); - } - - ptr = (int *) retmsg->buf; - if(*ptr == 0) { - attributes = estrdup(retmsg->buf+sizeof(int)); - efree(retmsg->buf); - efree(retmsg); - } else { - error = *ptr; - attributes = NULL; - efree(retmsg->buf); - efree(retmsg); - return error; - } - - length = HEADER_LENGTH + strlen(attributes) + 1; - build_msg_header(&msg, length, msgid++, GETTEXT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_str(msg.buf, attributes); - - documenttype = fnAttributeValue(attributes, "DocumentType"); - *objattr = strdup(attributes); - efree(attributes); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if (retmsg == NULL) { - *text = NULL; - return(-1); - } - - ptr = (int *) retmsg->buf; - if(*ptr == 0) { - ptr++; - *count = retmsg->length-HEADER_LENGTH-sizeof(int); - if(NULL != (*text = malloc(*count + 1))) { - memcpy(*text, retmsg->buf+sizeof(int), *count); -/* *text[*count] = 0; */ - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *ptr; - efree(retmsg->buf); - efree(retmsg); - *text = NULL; - return(error); - } - efree(retmsg->buf); - efree(retmsg); - - if((documenttype != NULL) && (strcmp(documenttype, "Image") != 0)) { - if(send_getanchorsobj(sockfd, objectID, &anchors, &ancount) == 0) { - char **destrec, **reldestrec; - DLIST *pAnchorList; - - send_getdestforanchorsobj(sockfd, anchors, &destrec, ancount); - send_getreldestforanchorsobj(sockfd, anchors, &reldestrec, ancount, rootid, objectID); - pAnchorList = fnCreateAnchorList(objectID, anchors, destrec, reldestrec, ancount, mode); - /* Free only the array, the objrecs has been freed in fnCreateAnchorList() */ - if(anchors) efree(anchors); - if(destrec) efree(destrec); - if(reldestrec) efree(reldestrec); - - if(pAnchorList != NULL) { - char *newtext; - char *body; - - newtext = fnInsAnchorsIntoText(*text, pAnchorList, &body, urlprefix); - dlst_kill(pAnchorList, fnDeleteAnchor); - *bodytag = strdup(body); - efree(body); - *text = newtext; - *count = strlen(newtext); - } - } - } - - if(documenttype) efree(documenttype); - return(0); -} - -int send_edittext(int sockfd, char *objattr, char *text) -{ - hg_msg msg, *retmsg; - int length, *ptr, error; - char *tmp, *path, *objid; - hw_objectID objectID; - - objid = fnAttributeValue(objattr, "ObjectID"); - if(objid == NULL) - return(-1); - if(!sscanf(objid, "0x%x", &objectID)) - return(-2); - - path = fnAttributeValue(objattr, "Path"); - if(path == NULL) - return(-3); - - length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(path) + 1 + 1 + strlen(text) + 1; - build_msg_header(&msg, length, msgid++, EDITTEXT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-4); - } - - tmp = build_msg_int(msg.buf, objectID); - tmp = build_msg_str(tmp, path); - tmp = build_msg_str(tmp, ""); - tmp = build_msg_str(tmp, text); - - if(path) efree(path); - if(objid) efree(objid); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-5); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if (retmsg == NULL) { - *text = '\0'; - return(-6); - } - - ptr = (int *) retmsg->buf; - error = *ptr; - efree(retmsg->buf); - efree(retmsg); - return(error); -} - -int send_getcgi(int sockfd, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count) -{ - hg_msg msg, *retmsg; - int length, *ptr, error, new_attr_len; - char *tmp, *attributes, *new_attr; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if(retmsg == NULL) { - attributes = NULL; - return(-1); - } - - ptr = (int *) retmsg->buf; - if(*ptr == 0) { - attributes = estrdup(retmsg->buf+sizeof(int)); - efree(retmsg->buf); - efree(retmsg); - } else { - error = *ptr; - attributes = NULL; - efree(retmsg->buf); - efree(retmsg); - return error; - } - - new_attr_len = strlen(attributes) + strlen(cgi_env_str) + 2; - new_attr = malloc(new_attr_len); - strcpy(new_attr, attributes); - strcat(new_attr, cgi_env_str); - length = HEADER_LENGTH + strlen(new_attr) + 1 + sizeof(int); - build_msg_header(&msg, length, msgid++, GETCGI_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_str(msg.buf, new_attr); - tmp = build_msg_int(tmp, 0); - - *objattr = strdup(attributes); - efree(attributes); - free(new_attr); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if (retmsg == NULL) { - *text = NULL; - return(-1); - } - - /* Attention: It looks like the documentation is not quite right. - According to the docs the buffer starts with an integer which - is followed by the output of the cgi script. This seems not to - be true. There is another integer right after the error. - The output of the cgi script is also preceded by the 'Content-type' - header. */ - ptr = (int *) retmsg->buf; - if(*ptr++ == 1024) { - *count = *ptr++; - if(NULL != (*text = malloc(*count + 1))) { - memcpy(*text, ptr, *count); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *ptr + 1024; /* move errors to >2024 */ - efree(retmsg->buf); - efree(retmsg); - *text = NULL; - return(error); - } - efree(retmsg->buf); - efree(retmsg); - - return(0); -} - -int send_getremote(int sockfd, hw_objectID objectID, char **objattr, char **text, int *count) -{ - hg_msg msg, *retmsg; - int length, *ptr, error; - char *tmp, *attributes; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if(retmsg == NULL) { - attributes = NULL; - return(-1); - } - - ptr = (int *) retmsg->buf; - if(*ptr == 0) { - attributes = estrdup(retmsg->buf+sizeof(int)); - efree(retmsg->buf); - efree(retmsg); - } else { - error = *ptr; - attributes = NULL; - efree(retmsg->buf); - efree(retmsg); - return error; - } - - length = HEADER_LENGTH + strlen(attributes) + 1 + sizeof(int); - build_msg_header(&msg, length, msgid++, GETREMOTE_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_str(msg.buf, attributes); - tmp = build_msg_int(tmp, 0); - - *objattr = strdup(attributes); - efree(attributes); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if (retmsg == NULL) { - *text = NULL; - return(-1); - } - - ptr = (int *) retmsg->buf; - if(*ptr == 1024) { - *count = retmsg->length-HEADER_LENGTH-sizeof(int)-sizeof(int); - if(NULL != (*text = malloc(*count + 1))) { - memcpy(*text, ptr+2, *count); -/* *text[*count] = 0; */ - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *ptr + 1024; /* move errors to >2024 */ - efree(retmsg->buf); - efree(retmsg); - *text = NULL; - return(error); - } - efree(retmsg->buf); - efree(retmsg); - - return(0); -} - -int send_getremotechildren(int sockfd, char *attributes, char **text, int **childIDs, int *count) -{ - hg_msg msg, *retmsg; - int length, *ptr, *ptr1, error; - char *tmp; - -/* length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if(retmsg == NULL) { - attributes = NULL; - return(-1); - } - - ptr = (int *) retmsg->buf; - if(*ptr == 0) { - attributes = estrdup(retmsg->buf+sizeof(int)); - efree(retmsg->buf); - efree(retmsg); - } else { - error = *ptr; - attributes = NULL; - efree(retmsg->buf); - efree(retmsg); - return error; - } -*/ - length = HEADER_LENGTH + strlen(attributes) + 1 + sizeof(int); - build_msg_header(&msg, length, msgid++, GETREMOTECHILDREN_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_str(msg.buf, attributes); - tmp = build_msg_int(tmp, 0); - -/* efree(attributes); */ - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if (retmsg == NULL) { - *childIDs = NULL; - return(-1); - } - ptr = (int *) retmsg->buf; - if(*ptr++ == 1024) { - int i, remlen, sum; - *count = *ptr; - ptr++; - if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = *childIDs; - sum = 0; - for(i=0; i<*count; ptr++, i++) { - ptr1[i] = *ptr; - sum += *ptr; - } - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - - remlen = retmsg->length - HEADER_LENGTH - *count * sizeof(int) - 2 * sizeof(int); -/*ptr1[i-1] = remlen; */ -/*ptr1[i-2] = sum; */ -/*ptr1[i-3] = *count; */ - if(NULL != (*text = emalloc(remlen + 1))) { - memcpy(*text, ptr, remlen); - } else { - efree(childIDs); - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - efree(retmsg->buf); - efree(retmsg); - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - *childIDs = NULL; - *text = NULL; - return error; - } - return(0); -} - -int send_mvcpdocscollscoll(int sockfd, hw_objectID *objectIDs, int count, int from, int dest, int cpmv, int doccoll) -{ - hg_msg msg, *retmsg; - int length, i, error; - char *tmp; - - if(count <= 0) - return 0; - - /* HEADER_LENGTH + cpmv + from + dest + count + nr of obj */ - length = HEADER_LENGTH + sizeof(hw_objectID) + sizeof(hw_objectID) + sizeof(hw_objectID) + sizeof(hw_objectID) + count * sizeof(hw_objectID); - - switch(doccoll) { - case DOCUMENT: - build_msg_header(&msg, length, msgid++, MVCPDOCSCOLL_MESSAGE); - break; - case COLLECTION: - build_msg_header(&msg, length, msgid++, MVCPCOLLSCOLL_MESSAGE); - break; - } - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, cpmv); - tmp = build_msg_int(tmp, from); - tmp = build_msg_int(tmp, dest); - tmp = build_msg_int(tmp, count); - for(i=0; ibuf); - efree(retmsg->buf); - efree(retmsg); - return(error); -} - -int send_docbyanchor(int sockfd, hw_objectID objectID, hw_objectID *anchorID) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - int *ptr; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETDOCBYANCHOR_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - return(-1); - } - - ptr = (int *) retmsg->buf; - error = *ptr++; - if(error == 0) { - *anchorID = *ptr; - } else { - *anchorID = 0; - } - efree(retmsg->buf); - efree(retmsg); - return error; -} - -int send_docbyanchorobj(int sockfd, hw_objectID objectID, char **objrec) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - int *ptr, anchorID; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETDOCBYANCHOR_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - return(-1); - } - - ptr = (int *) retmsg->buf; - error = *ptr++; - if(error == 0) { - anchorID = *ptr; - } else { - anchorID = 0; - } - efree(retmsg->buf); - efree(retmsg); - - if(0 > bh_send_getobject(sockfd, anchorID)) - return -1; - return(uh_send_getobject(sockfd, objrec)); -} - -int send_children(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count) -{ - hg_msg msg, *retmsg; - int length, i, error; - char *tmp; - int *ptr, *ptr1; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, CHILDREN_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if (-1 == send_hg_msg(sockfd, &msg, length)) { - efree(msg.buf); - return(-2); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - return(-3); - } - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = *ptr++; - if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = *childIDs; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - - return(0); -} - -int send_childrenobj(int sockfd, hw_objectID objectID, char ***childrec, int *count) -{ - hg_msg msg, *retmsg; - int length, i, error; - char *tmp, **objptr; - int *childIDs = NULL; - int *ptr; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, CHILDREN_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) - return(-1); - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = *ptr++; - if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) { - for(i=0; i<*count; ptr++, i++) - childIDs[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - - /* Now get for each child collection the object record */ - for(i=0; i<*count; i++) { - - length = HEADER_LENGTH + sizeof(hw_objectID); - build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - efree(childIDs); - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, childIDs[i]); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(childIDs); - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - } - efree(childIDs); - - if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) { - /* if emalloc fails, get at least all remaining messages from server */ - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - efree(retmsg->buf); - efree(retmsg); - } - *childrec = NULL; - lowerror = LE_MALLOC; - return(-1); - } else { - *childrec = objptr; - - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - if ( retmsg != NULL ) { - if(0 == (int) *(retmsg->buf)) { - *objptr = estrdup(retmsg->buf+sizeof(int)); - objptr++; - efree(retmsg->buf); - efree(retmsg); - } else { - *objptr = NULL; - objptr++; - efree(retmsg->buf); - efree(retmsg); - } - } - } - } - - return(0); -} - -int send_getchildcoll(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - int *ptr, i, *ptr1; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETCHILDCOLL_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - return(-1); - } - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = *ptr++; - if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = *childIDs; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - - return(0); -} - -int send_getchildcollobj(int sockfd, hw_objectID objectID, char ***childrec, int *count) -{ - hg_msg msg, *retmsg; - int length, i, error; - char *tmp, **objptr; - int *childIDs = NULL; - int *ptr; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETCHILDCOLL_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) - return(-1); - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = *ptr++; - if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) { - for(i=0; i<*count; ptr++, i++) - childIDs[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - - /* Now get for each child collection the object record */ - for(i=0; i<*count; i++) { - - length = HEADER_LENGTH + sizeof(hw_objectID); - build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - efree(childIDs); - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, childIDs[i]); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(childIDs); - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - } - efree(childIDs); - - if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) { - /* if emalloc fails, get at least all remaining messages from server */ - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - efree(retmsg->buf); - efree(retmsg); - } - *childrec = NULL; - lowerror = LE_MALLOC; - return(-1); - } else { - *childrec = objptr; - - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - if ( retmsg != NULL ) { - if(0 == (int) *(retmsg->buf)) { - *objptr = estrdup(retmsg->buf+sizeof(int)); - objptr++; - efree(retmsg->buf); - efree(retmsg); - } else { - *objptr = NULL; - objptr++; - efree(retmsg->buf); - efree(retmsg); - } - } - } - } - - return(0); -} - -int send_getchilddoccoll(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETCHILDDOCCOLL_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } else { - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg != NULL ) { - int *ptr, i, *ptr1; - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = *ptr++; - if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = *childIDs; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - } - } - - return(0); - -} - -int send_getchilddoccollobj(int sockfd, hw_objectID objectID, hw_objrec ***childrec, int *count) -{ - hg_msg msg, *retmsg; - int length, i, error; - char *tmp, **objptr; - int *childIDs = NULL; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETCHILDDOCCOLL_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - efree(msg.buf); - - retmsg = recv_hg_msg(sockfd); - if ( retmsg != NULL ) { - int *ptr, i; - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg->buf) efree(retmsg->buf); - return -1; - } - if(*ptr++ == 0) { - *count = *ptr++; - if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) { - for(i=0; i<*count; ptr++, i++) - childIDs[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - } - - /* Now get for each child collection the object record */ - for(i=0; i<*count; i++) { - length = HEADER_LENGTH + sizeof(hw_objectID); - build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, childIDs[i]); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - } - - if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) { - /* if emalloc fails, get at least all remaining messages from server */ - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - efree(retmsg->buf); - efree(retmsg); - } - *childrec = NULL; - lowerror = LE_MALLOC; - return(-1); - } else { - *childrec = objptr; - - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - if ( retmsg != NULL ) { - if(0 == (int) *(retmsg->buf)) { - *objptr = estrdup(retmsg->buf+sizeof(int)); - objptr++; - efree(retmsg->buf); - efree(retmsg); - } else { - *objptr = NULL; - objptr++; - efree(retmsg->buf); - efree(retmsg); - } - } - } - } - - return(0); -} - -int send_getanchors(int sockfd, hw_objectID objectID, int **anchorIDs, int *count) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - int *ptr, i, *ptr1; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETANCHORS_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - efree(msg.buf); - - if (NULL == (retmsg = recv_hg_msg(sockfd))) - return(-1); - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = *ptr++; - if(NULL != (*anchorIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = *anchorIDs; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - - return(0); -} - -int send_getanchorsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - int *ptr, i, *ptr1; - int *anchorIDs = NULL; - char **objptr; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, 50, GETANCHORS_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - efree(msg.buf); - - if (NULL == (retmsg = recv_hg_msg(sockfd))) - return(-1); - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = *ptr++; - if(NULL != (anchorIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = anchorIDs; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - - /* Now get for each anchor the object record */ - for(i=0; i<*count; i++) { - - length = HEADER_LENGTH + sizeof(hw_objectID); - build_msg_header(&msg, length, anchorIDs[i], GETOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, anchorIDs[i]); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - } - if(anchorIDs) efree(anchorIDs); - - if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) { - /* if emalloc fails, get at least all remaining messages from server */ - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - efree(retmsg->buf); - efree(retmsg); - } - *childrec = NULL; - lowerror = LE_MALLOC; - return(-1); - } else { - *childrec = objptr; - - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - if ( retmsg != NULL ) { - if(0 == (int) *(retmsg->buf)) { - *objptr = estrdup(retmsg->buf+sizeof(int)); - objptr++; - efree(retmsg->buf); - efree(retmsg); - } else { - *objptr = NULL; - objptr++; - efree(retmsg->buf); - efree(retmsg); - } - } - } - } - - return(0); -} - -int send_getdestforanchorsobj(int sockfd, char **anchorrec, char ***destrec, int count) -{ - int i; - char *objptr, **destptr; - char *str; - int objectID; - - if(NULL == (destptr = (char **) emalloc(count * sizeof(hw_objrec *)))) { - lowerror = LE_MALLOC; - return -1; - } - - /* Now get for each anchor the object record of its destination */ - for(i=0; i send_docbyanchorobj(sockfd, objectID, &objptr)) { - efree(destptr); - return -1; - } - destptr[i] = objptr; - /* if we can't get the object rec of the dest, than this document - is probably not accessible for us. For later functions simply - set anchorrec[i] to NULL */ - if(destptr[i] == NULL) { - if(anchorrec[i]) efree(anchorrec[i]); - anchorrec[i] = NULL; - } - } else { - destptr[i] = NULL; - } - } - *destrec = destptr; - - return(0); -} - -int send_getreldestforanchorsobj(int sockfd, char **anchorrec, char ***reldestrec, int count, int rootID, int thisID) -{ - int i; - char *docofanchorptr, **reldestptr; - char *str; - int destobjectID; - - if(NULL == (reldestptr = (char **) emalloc(count * sizeof(char *)))) { - lowerror = LE_MALLOC; - return -1; - } - - /* Now get for each anchor the object record of its destination */ - for(i=0; i send_docbyanchorobj(sockfd, destobjectID, &docofanchorptr)) { - efree(reldestptr); - return -1; - } - reldestptr[i] = docofanchorptr; - /* if we can't get the object rec of the dest, than this document - is probably not accessible for us. For later functions simply - set anchorrec[i] to NULL */ - if(reldestptr[i] == NULL) { - if(anchorrec[i]) efree(anchorrec[i]); - anchorrec[i] = NULL; - } else { - int j, *retthisIDs, *retdestIDs, equaltill, mincount, countthis, countdest, destdocid; - char destdocname[200]; - char anchorstr[300]; - char temp[200]; - char *strptr; - - if(NULL != (str = strstr(docofanchorptr, "Name="))) { - str += 5; - sscanf(str, "%s\n", destdocname); - } - if(NULL != (str = strstr(docofanchorptr, "ObjectID="))) { - str += 9; - sscanf(str, "0x%X", &destdocid); - } - - send_incollections(sockfd, 1, 1, &thisID, 1, &rootID, &countthis, &retthisIDs); - send_incollections(sockfd, 1, 1, &destdocid, 1, &rootID, &countdest, &retdestIDs); - -/* -fprintf(stderr, "%d: ", thisID); -for(k=0; k= 0) && (pcount != 0) && (parentIDs != NULL) && (pid != 0)) { -/*fprintf(stderr, "Get parents for %d\n", pid); */ - if(0 != send_getparents(sockfd, pid, &parentIDs, &pcount)) { - efree(pathIDs); - return -1; - } - pid = 0; - for(i=0; i 5 -> 4 -> 20 - ** (this means: 20 is child of 4, 4 is child of 5, 5 is child - ** of 1) it will return 1,4,5 instead of 1,5,4 - ** Consequently, we have to create the correct path, by checking - ** for the parents and identifying it in the list. - ** But there is another problem. If the id for which the list of - ** of collection is generated is a colletion itself, it will - ** show up in the list as well. In order to make the algorithmn - ** work proberly it has to be the last member of the list. - */ - for(i=0; ibuf; - efree(retmsg); - - return(0); -} - -int send_objectbyidquery(int sockfd, hw_objectID *IDs, int *count, char *query, char ***objrecs) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp, *str; - int *ptr, i, *ptr1; - int *offsets, *childIDs; - char **childrec; - - length = HEADER_LENGTH + sizeof(int) + sizeof(int) + *count * sizeof(hw_objectID); - if(query) - length = length + strlen(query) + 1; - - build_msg_header(&msg, length, msgid++, OBJECTBYIDQUERY_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, 1); - tmp = build_msg_int(tmp, *count); - for(i=0; i<*count; i++) - tmp = build_msg_int(tmp, IDs[i]); - if(query) - tmp = build_msg_str(tmp, query); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) - return(-1); - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ != 0) { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - - *count = *ptr++; - if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = childIDs; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - if(NULL != (offsets = emalloc(*count * sizeof(int)))) { - ptr1 = offsets; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - } else { - efree(retmsg->buf); - efree(retmsg); - efree(childIDs); - lowerror = LE_MALLOC; - return(-1); - } - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - - str = (char *)ptr; - if(NULL == (childrec = (char **) emalloc(*count * sizeof(hw_objrec *)))) { - efree(offsets); - efree(childIDs); - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } else { - for(i=0; i<*count; i++) { - childrec[i] = estrdup(str); - str += offsets[i]; - } - *objrecs = childrec; - } - - efree(retmsg->buf); - efree(retmsg); - efree(childIDs); - efree(offsets); - return(0); -} - -int send_getobjbyquery(int sockfd, char *query, int maxhits, hw_objectID **childIDs, int *count) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - int *ptr, i, *ptr1; - - length = HEADER_LENGTH + strlen(query) + 1; - - build_msg_header(&msg, length, msgid++, GETOBJBYQUERY_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_str(msg.buf, query); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) - return(-1); - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = (*ptr < maxhits) ? *ptr : maxhits; - ptr++; - if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = *childIDs; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - return(0); -} - -int send_getobjbyqueryobj(int sockfd, char *query, int maxhits, char ***childrec, int *count) -{ - hg_msg msg, *retmsg; - int length, i, error; - char *tmp; - int *childIDs = NULL; - char **objptr; - int *ptr, *ptr1; - - length = HEADER_LENGTH + strlen(query) + 1; - - build_msg_header(&msg, length, msgid++, GETOBJBYQUERY_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_str(msg.buf, query); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) - return(-1); - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = (*ptr < maxhits) ? *ptr : maxhits; - ptr++; - if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = childIDs; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - - /* Now get for each child collection the object record */ - for(i=0; i<*count; i++) { - length = HEADER_LENGTH + sizeof(hw_objectID); - build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - efree(childIDs); - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, childIDs[i]); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - efree(childIDs); - return(-1); - } - - efree(msg.buf); - } - efree(childIDs); - - if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) { - /* if emalloc fails, get at least all remaining messages from server */ - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - efree(retmsg->buf); - efree(retmsg); - } - *childrec = NULL; - lowerror = LE_MALLOC; - return(-1); - } else { - *childrec = objptr; - - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - if ( retmsg != NULL ) { - if(0 == (int) *(retmsg->buf)) { - *objptr = estrdup(retmsg->buf+sizeof(int)); - objptr++; - efree(retmsg->buf); - efree(retmsg); - } else { - *objptr = NULL; - objptr++; - efree(retmsg->buf); - efree(retmsg); - } - } - } - } - - return(0); -} - -int send_getobjbyquerycoll(int sockfd, hw_objectID collID, char *query, int maxhits, hw_objectID **childIDs, int *count) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp; - int *ptr, i, *ptr1; - - length = HEADER_LENGTH + strlen(query) + 1 + sizeof(int) + sizeof(collID); - - build_msg_header(&msg, length, msgid++, GETOBJBYQUERYCOLL_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, 1); - tmp = build_msg_int(tmp, collID); - tmp = build_msg_str(tmp, query); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) - return(-1); - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = (*ptr < maxhits) ? *ptr : maxhits; - ptr++; - if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = *childIDs; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - return(0); -} - -int send_getobjbyquerycollobj(int sockfd, hw_objectID collID, char *query, int maxhits, char ***childrec, int *count) -{ - hg_msg msg, *retmsg; - int length, i, error; - char *tmp; - hw_objectID *childIDs = NULL; - char **objptr; - int *ptr, *ptr1; - - length = HEADER_LENGTH + strlen(query) + 1 + sizeof(int) + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETOBJBYQUERYCOLL_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, 1); - tmp = build_msg_int(tmp, collID); - tmp = build_msg_str(tmp, query); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) - return -1; - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = (*ptr < maxhits) ? *ptr : maxhits; - ptr++; - if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = childIDs; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - - /* Now get for each child collection the object record */ - for(i=0; i<*count; i++) { - length = HEADER_LENGTH + sizeof(hw_objectID); - build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - efree(childIDs); - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, childIDs[i]); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - efree(childIDs); - return(-1); - } - - efree(msg.buf); - } - efree(childIDs); - - if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) { - /* if emalloc fails, get at least all remaining messages from server */ - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - efree(retmsg->buf); - efree(retmsg); - } - *childrec = NULL; - lowerror = LE_MALLOC; - return(-1); - } else { - *childrec = objptr; - - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - if ( retmsg != NULL ) { - if(0 == (int) *(retmsg->buf)) { - *objptr = estrdup(retmsg->buf+sizeof(int)); - objptr++; - efree(retmsg->buf); - efree(retmsg); - } else { - *objptr = NULL; - objptr++; - efree(retmsg->buf); - efree(retmsg); - } - } - } - } - - return(0); -} - -int send_getparents(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count) -{ - hg_msg msg, *retmsg; - int length, i, error; - char *tmp; - int *ptr, *ptr1; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETPARENT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if (-1 == send_hg_msg(sockfd, &msg, length)) { - efree(msg.buf); - return(-2); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - return(-3); - } - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = *ptr++; - if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = *childIDs; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - - return(0); -} - -int send_getparentsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count) -{ - hg_msg msg, *retmsg; - int length, i, error; - char *tmp; - hw_objectID *childIDs = NULL; - char **objptr; - int *ptr; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETPARENT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if (-1 == send_hg_msg(sockfd, &msg, length)) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - return(-1); - } - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = *ptr++; - if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) { - for(i=0; i<*count; ptr++, i++) - childIDs[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - - /* Now get for each parent the object record */ - for(i=0; i<*count; i++) { - length = HEADER_LENGTH + sizeof(hw_objectID); - build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, childIDs[i]); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - } - efree(childIDs); - - if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) { - /* if emalloc fails, get at least all remaining messages from server */ - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - efree(retmsg->buf); - efree(retmsg); - } - *childrec = NULL; - lowerror = LE_MALLOC; - return(-1); - } else { - *childrec = objptr; - - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - if ( retmsg != NULL ) { - if(0 == (int) *(retmsg->buf)) { - *objptr = estrdup(retmsg->buf+sizeof(int)); - objptr++; - efree(retmsg->buf); - efree(retmsg); - } else { - *objptr = NULL; - objptr++; - efree(retmsg->buf); - efree(retmsg); - } - } - } - } - return(0); -} - -int send_pipedocument(int sockfd, char *host, hw_objectID objectID, int mode, int rootid, char **objattr, char **bodytag, char **text, int *count, char *urlprefix) -{ - hg_msg msg, *retmsg; - int length, len; - char *tmp, header[80], *head_ptr, *sizestr; - struct sockaddr_in serv_addr; - struct hostent *hostptr; - char *hostip = NULL; - char *attributes = NULL; - char *documenttype; - char **anchors; - int newfd, fd, port, size, error, ancount; - int *ptr; - - if(-1 == (fd = fnCOpenDataCon(sockfd, &port))) { - /* not set yet efree(msg.buf); */ - return(-1); - } - - /* - ** Get information about host - */ - if(host) { - if((hostptr = gethostbyname(host)) == NULL) { - php3_error(E_WARNING, "gethostbyname failed for %s", host); - HWSOCK_FCLOSE(fd); - return(-2); - } - } else { - HWSOCK_FCLOSE(fd); - return(-2); - } - - switch(hostptr->h_addrtype) { - struct in_addr *ptr1; - char *ptr; - case AF_INET: - ptr = hostptr->h_addr_list[0]; - ptr1 = (struct in_addr *) ptr; - hostip = inet_ntoa(*ptr1); - break; - default: - HWSOCK_FCLOSE(fd); - return(-3); - break; - } - - /* Bottom half of send_getobject */ - if(0 > bh_send_getobject(sockfd, objectID)) { - HWSOCK_FCLOSE(fd); - return -4; - } - - /* Upper half of send_getobject */ - if(0 > (error = uh_send_getobject(sockfd, &attributes))) { - HWSOCK_FCLOSE(fd); - return error; - } - - length = HEADER_LENGTH + sizeof(hw_objectID) + sizeof(int) + strlen(hostip) + 1 + strlen("Refno=0x12345678") + 1; - build_msg_header(&msg, length, msgid++, PIPEDOCUMENT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - if(attributes) efree(attributes); - lowerror = LE_MALLOC; - return(-5); - } - - tmp = build_msg_int(msg.buf, objectID); - tmp = build_msg_int(tmp, port); - tmp = build_msg_str(tmp, hostip); - tmp = build_msg_str(tmp, "Refno=0x12345678"); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - if(attributes) efree(attributes); - efree(msg.buf); - HWSOCK_FCLOSE(fd); - return(-6); - } - efree(msg.buf); - - /* Just check if the command was understood */ - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - if(attributes) efree(attributes); - HWSOCK_FCLOSE(fd); - return(-7); - } - - ptr = (int *) retmsg->buf; - if((ptr == NULL) || (*ptr != 0)) { - error = *ptr; - if(retmsg->buf) efree(retmsg->buf); - efree(retmsg); - if(attributes) efree(attributes); - HWSOCK_FCLOSE(fd); - return(error); - } - - efree(retmsg->buf); - efree(retmsg); - - /* passively open the data connection. The HG server is probably - already waiting for us. - */ - len = sizeof(serv_addr); - if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) { -/* php3_printf("client: can't open data connection to server\n"); */ - if(attributes) efree(attributes); - HWSOCK_FCLOSE(fd); - return(-8); - } else { - HWSOCK_FCLOSE(fd); - } - - /* First of all read the header */ - head_ptr = header; - while((read_to(newfd, head_ptr, 1, rtimeout) == 1) && (*head_ptr != '\0')) { - head_ptr++; - } - - /* Let's see how big the document is and read it into var text */ - sizestr = strstr(header, "sz="); - if(sizestr) { - sizestr += 3; - sscanf(sizestr, "%d\n", &size); - *count = size; - if((size != 0) && (NULL != (*text = malloc(size+1)))) { - read_to(newfd, *text, size, rtimeout); - (*text)[size] = '\0'; - } - } else { - *text = NULL; - } - - /* close the data connection */ - HWSOCK_FCLOSE(newfd); - - documenttype = fnAttributeValue(attributes, "DocumentType"); - - /* Make a copy with strdup (not estrdup), because we want to - keep the attributes in hw_document struct. - */ - *objattr = strdup(attributes); - efree(attributes); - - if((documenttype != NULL) && (!strcmp(documenttype, "text") != 0)) { - if(send_getanchorsobj(sockfd, objectID, &anchors, &ancount) == 0) { - char **destrec, **reldestrec; - DLIST *pAnchorList = NULL; - - send_getdestforanchorsobj(sockfd, anchors, &destrec, ancount); - send_getreldestforanchorsobj(sockfd, anchors, &reldestrec, ancount, rootid, objectID); - pAnchorList = fnCreateAnchorList(objectID, anchors, destrec, reldestrec, ancount, mode); - /* Free only the array, the objrecs has been freed in fnCreateAnchorList() */ - if(anchors) efree(anchors); - if(destrec) efree(destrec); - if(reldestrec) efree(reldestrec); - - if(pAnchorList != NULL) { - char *newtext; - char *body; - - newtext = fnInsAnchorsIntoText(*text, pAnchorList, &body, urlprefix); - dlst_kill(pAnchorList, fnDeleteAnchor); - *bodytag = strdup(body); - efree(body); - *text = newtext; - *count = strlen(newtext); - } - } - } else { - *bodytag = NULL; - } - - if(documenttype) efree(documenttype); - return(0); -} - -int send_pipecgi(int sockfd, char *host, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count) -{ - hg_msg msg, *retmsg; - int length, len, new_attr_len; - char *tmp, header[80], *head_ptr, *sizestr; - struct sockaddr_in serv_addr; - struct hostent *hostptr; - char *hostip = NULL; - char *attributes = NULL; - char *documenttype, *new_attr; - int newfd, fd, port, size, error; - int *ptr; - - if(-1 == (fd = fnCOpenDataCon(sockfd, &port))) { - /* not set yet? efree(msg.buf); */ - return(-1); - } - - /* - ** Get information about host - */ - if(host) { - if((hostptr = gethostbyname(host)) == NULL) { - php3_error(E_WARNING, "gethostbyname failed for %s", host); - HWSOCK_FCLOSE(fd); - return(-1); - } - } else { - HWSOCK_FCLOSE(fd); - return(-1); - } - - switch(hostptr->h_addrtype) { - struct in_addr *ptr1; - char *ptr; - case AF_INET: - ptr = hostptr->h_addr_list[0]; - ptr1 = (struct in_addr *) ptr; - hostip = inet_ntoa(*ptr1); - break; - default: -/* php3_printf(stderr, "unknown address type\n"); */ - break; - } - - /* Bottom half of send_getobject */ - if(0 > bh_send_getobject(sockfd, objectID)) { - HWSOCK_FCLOSE(fd); - return -1; - } - - /* Upper half of send_getobject */ - if(0 > (error = uh_send_getobject(sockfd, &attributes))) { - HWSOCK_FCLOSE(fd); - return error; - } - - new_attr_len = strlen(attributes) + strlen(cgi_env_str) + 2; - new_attr = malloc(new_attr_len); - strcpy(new_attr, attributes); - strcat(new_attr, cgi_env_str); - length = HEADER_LENGTH + strlen(new_attr) + 1 + sizeof(int) + strlen(hostip) + 1 + sizeof(int) + sizeof(int); - build_msg_header(&msg, length, msgid++, PIPECGI_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - if(attributes) efree(attributes); - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_str(msg.buf, hostip); - tmp = build_msg_int(tmp, port); - tmp = build_msg_str(tmp, new_attr); - tmp = build_msg_int(tmp, 1); - tmp = build_msg_int(tmp, 0x12345678); - free(new_attr); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - if(attributes) efree(attributes); - efree(msg.buf); - HWSOCK_FCLOSE(fd); - return(-1); - } - efree(msg.buf); - - /* Just check if the command was understood */ - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - if(attributes) efree(attributes); - HWSOCK_FCLOSE(fd); - return(-1); - } - - ptr = (int *) retmsg->buf; - if((ptr == NULL) || (*ptr != 0)) { - if(retmsg->buf) efree(retmsg->buf); - efree(retmsg); - if(attributes) efree(attributes); - HWSOCK_FCLOSE(fd); - return(-1); - } - - efree(retmsg->buf); - efree(retmsg); - - /* passively open the data connection. The HG server is probably - already waiting for us. - */ - len = sizeof(serv_addr); - if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) { - if(attributes) efree(attributes); - HWSOCK_FCLOSE(fd); - return(-1); - } else { - HWSOCK_FCLOSE(fd); - } - - /* First of all read the header */ - head_ptr = header; - while((read_to(newfd, head_ptr, 1, rtimeout) == 1) && (*head_ptr != '\0')) { - head_ptr++; - } - - /* Let's see how big the document is and read it into var text */ - sizestr = strstr(header, "sz="); - if(sizestr) { - sizestr += 3; - sscanf(sizestr, "%d\n", &size); - *count = size; - if((size != 0) && (NULL != (*text = malloc(size+1)))) { - read_to(newfd, *text, size, rtimeout); - } - } else { - *text = NULL; - } - - /* close the data connection */ - HWSOCK_FCLOSE(newfd); - - documenttype = fnAttributeValue(attributes, "DocumentType"); - - /* Make a copy with strdup (not estrdup), because we want to - keep the attributes in hw_document struct. - */ - *objattr = strdup(attributes); - efree(attributes); - - if(documenttype) efree(documenttype); - return(0); -} - -int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectRec, char *text, int count, hw_objectID *objectID) -{ - hg_msg msg, *retmsg; - int length, len; - char *tmp, header[80], parms[30], *head_ptr; - struct sockaddr_in serv_addr; - struct hostent *hostptr; - char *hostip = NULL; - int newfd, fd, port, error; - int *ptr; - - /* First of all we have to insert the document record */ - sprintf(parms, "Parent=0x%x", parentID); - length = HEADER_LENGTH + strlen(objectRec) + 1 + strlen(parms) + 1; - - build_msg_header(&msg, length, msgid++, INSERTOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_str(msg.buf, objectRec); - tmp = build_msg_str(tmp, parms); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-2); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - return(-3); - } - - ptr = (int *) retmsg->buf; - if(0 == (error = *ptr)) { - ptr++; - *objectID = *ptr; - } else { - if(retmsg->buf) efree(retmsg->buf); - efree(retmsg); - return(error); - } - - efree(retmsg->buf); - efree(retmsg); - - /* - ** Get information about host - */ - if(host) { - if((hostptr = gethostbyname(host)) == NULL) { - php3_error(E_WARNING, "gethostbyname failed for %s", host); - /* close(fd); fd is not set yet */ - return(-4); - } - } else { - /* close(fd); fd is not set yet */ - return(-5); - } - - switch(hostptr->h_addrtype) { - struct in_addr *ptr1; - char *ptr; - case AF_INET: - ptr = hostptr->h_addr_list[0]; - ptr1 = (struct in_addr *) ptr; - hostip = inet_ntoa(*ptr1); - break; - default: -/* fprintf(stderr, "unknown address type\n"); */ - break; - } - - if(-1 == (fd = fnCOpenDataCon(sockfd, &port))) { - efree(msg.buf); - return(-6); - } - - /* Start building the PUTDOCUMENT message. I works even if - the Refno is skipped. I guess the path can be omitted too. */ - length = HEADER_LENGTH + sizeof(hw_objectID) + sizeof(int) + strlen(hostip) + 1 + strlen("Hyperwave") + 1+ strlen("Refno=0x12345678") + 1; - - build_msg_header(&msg, length, msgid++, PUTDOCUMENT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-7); - } - - tmp = build_msg_int(msg.buf, *objectID); - tmp = build_msg_int(tmp, port); - tmp = build_msg_str(tmp, hostip); - tmp = build_msg_str(tmp, "Hyperwave"); - tmp = build_msg_str(tmp, "Refno=0x12345678"); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - HWSOCK_FCLOSE(fd); - return(-8); - } - efree(msg.buf); - - /* passively open the data connection. The HG server is probably - already waiting for us. - */ - len = sizeof(serv_addr); - if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) { - HWSOCK_FCLOSE(fd); - return(-9); - } else { - HWSOCK_FCLOSE(fd); - } - - /* First of all write the header. According to the documentation - there should be a header first. Well, after some investigation - with tcpdump I found out, that Harmony and wavemaster don't - sent it. The also do not sent the Refno in the PUTDOCUMENT msg. - Anyway, we sent both. */ - head_ptr = header; - sprintf(header, "HGHDR\nsz=%d\nref=12345678\n", count); - len = strlen(header) + 1; - if(len != write_to(newfd, header, len, wtimeout)) { - HWSOCK_FCLOSE(newfd); - return(-10); - } - - /* And now the document */ - if(count != write_to(newfd, text, count, wtimeout)) { - HWSOCK_FCLOSE(newfd); - return(-11); - } - - /* The data connection has to be close before the return - msg can be read. The server will not sent it before. */ - HWSOCK_FCLOSE(newfd); - - /* Just check if the command was understood */ - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - HWSOCK_FCLOSE(fd); - return(-12); - } - - ptr = (int *) retmsg->buf; - if((ptr == NULL) || (*ptr != 0)) { - if(retmsg->buf) efree(retmsg->buf); - efree(retmsg); - HWSOCK_FCLOSE(fd); - return(-13); - } - - efree(retmsg->buf); - efree(retmsg); - - return(0); -} - -int send_getsrcbydest(int sockfd, hw_objectID objectID, char ***childrec, int *count) -{ - hg_msg msg, *retmsg; - int length, i, error; - char *tmp; - int *childIDs = NULL; - char **objptr; - int *ptr, *ptr1; - - length = HEADER_LENGTH + sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, GETSRCBYDEST_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, objectID); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) - return(-1); - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *count = *ptr; - ptr++; - if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) { - ptr1 = childIDs; - for(i=0; i<*count; ptr++, i++) - ptr1[i] = *ptr; - efree(retmsg->buf); - efree(retmsg); - } else { - efree(retmsg->buf); - efree(retmsg); - lowerror = LE_MALLOC; - return(-1); - } - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - - /* Now get for each source the object record */ - for(i=0; i<*count; i++) { - length = HEADER_LENGTH + sizeof(hw_objectID); - build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - efree(childIDs); - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, childIDs[i]); - - if ( send_hg_msg(sockfd, &msg, length) == -1 ) { - efree(childIDs); - efree(msg.buf); - return(-1); - } - - efree(msg.buf); - } - efree(childIDs); - - if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) { - /* if emalloc fails, get at least all remaining messages from server */ - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - efree(retmsg->buf); - efree(retmsg); - } - *childrec = NULL; - lowerror = LE_MALLOC; - return(-1); - } else { - *childrec = objptr; - - for(i=0; i<*count; i++) { - retmsg = recv_hg_msg(sockfd); - if ( retmsg != NULL ) { - if(0 == (int) *(retmsg->buf)) { - *objptr = estrdup(retmsg->buf+sizeof(int)); - objptr++; - efree(retmsg->buf); - efree(retmsg); - } else { - *objptr = NULL; - objptr++; - efree(retmsg->buf); - efree(retmsg); - } - } - } - } - - return(0); -} - -int send_mapid(int sockfd, int servid, hw_objectID id, int *virtid) -{ - hg_msg msg, *retmsg; - int length, i, error; - char *tmp; - int *ptr, *ptr1; - - length = HEADER_LENGTH + 2 * sizeof(hw_objectID); - - build_msg_header(&msg, length, msgid++, HG_MAPID); - - if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - lowerror = LE_MALLOC; - return(-1); - } - - tmp = build_msg_int(msg.buf, servid); - tmp = build_msg_int(tmp, id); - - if (-1 == send_hg_msg(sockfd, &msg, length)) { - efree(msg.buf); - return(-2); - } - - efree(msg.buf); - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - return(-3); - } - - ptr = (int *) retmsg->buf; - if(ptr == NULL) { - if(retmsg) efree(retmsg); - return -1; - } - if(*ptr++ == 0) { - *virtid = *ptr; - } else { - error = *((int *) retmsg->buf); - efree(retmsg->buf); - efree(retmsg); - return error; - } - - return(0); -} - -#define BUFFERLEN 200 -char *get_hw_info(hw_connection *conn) { - char temp[BUFFERLEN]; - int len; - struct sockaddr_in serv_addr; - - len = sizeof (serv_addr); - if(getsockname(conn->socket, (struct sockaddr *)&serv_addr, &len) < 0) - return(NULL); - - snprintf(temp, BUFFERLEN, "%s, %s, %d, %s, %d, %d", conn->server_string, conn->hostname, - conn->version, conn->username, - serv_addr.sin_port, conn->swap_on); - return(estrdup(temp)); -} -#undef BUFFERLEN - -static int send_hg_msg(int sockfd, hg_msg *msg, int length) -{ - char *buf, *tmp; - -#ifdef HW_DEBUG - php3_printf("Sending msg: type = %d -- id = %d
\n", msg->msg_type, msg->version_msgid); -#endif - if ( length < HEADER_LENGTH ) { -/* fprintf(stderr, "send_hg_msg: bad msg\n"); */ - return(-1); - } - - if ( (tmp = buf = (char *)emalloc(length)) == NULL ) { -/* perror("send_hg_msg"); */ - lowerror = LE_MALLOC; - return(-1); - } - - memcpy(tmp, (char *) &(msg->length), 4); - tmp += 4; - memcpy(tmp, (char *) &(msg->version_msgid), 4); - tmp += 4; - memcpy(tmp, (char *) &(msg->msg_type), 4); - if ( msg->length > HEADER_LENGTH ) { - tmp += 4; - memcpy(tmp, msg->buf, length-HEADER_LENGTH); - } - - if ( hg_write(sockfd, buf, length) == -1 ) { - efree(buf); - return(-1); - } - - efree(buf); - return(0); -} - - -int send_ready(int sockfd) -{ - hg_msg ready_msg; - - build_msg_header(&ready_msg, HEADER_LENGTH, version, READY_MESSAGE); - ready_msg.buf = NULL; - - if ( send_hg_msg(sockfd, &ready_msg, HEADER_LENGTH) == -1 ) { - return(-1); - } - - return(0); -} - - -int send_command(int sockfd, int command, char **answer) -{ - hg_msg comm_msg, *retmsg; - char *comm_str, *tmp; - int respond = 1; - int length; - - if ( command == STAT_COMMAND ) - comm_str = STAT_COMMAND_STR; - else - comm_str = WHO_COMMAND_STR; - length = HEADER_LENGTH + sizeof(respond) + strlen(comm_str) + 1; - - build_msg_header(&comm_msg, length, msgid++, COMMAND_MESSAGE); - - if ( (comm_msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { -/* perror("send_command"); */ - lowerror = LE_MALLOC; - return(-1); - } - - - tmp = build_msg_int(comm_msg.buf, respond); - tmp = build_msg_str(tmp, comm_str); - - - if ( send_hg_msg(sockfd, &comm_msg, length) == -1 ) { - efree(comm_msg.buf); - return(-1); - } - efree(comm_msg.buf); - - /* Just check if the command was understood */ - retmsg = recv_hg_msg(sockfd); - if ( retmsg == NULL ) { - return(-1); - } - - *answer = retmsg->buf; - efree(retmsg); - - return(0); -} - - -static void build_msg_header(hg_msg *msg, int length, int version_msgid, int msg_type) -{ - if ( swap_on ) { - msg->length = swap(length); - msg->version_msgid = swap(version_msgid); - msg->msg_type = swap(msg_type); - } - else { - msg->length = length; - msg->version_msgid = version_msgid; - msg->msg_type = msg_type; - } -} - - -static char *build_msg_int(char *buf, int val) { - int tmp; - -#ifdef HW_DEBUG - php3_printf(" Added int to header: %d
\n", val); -#endif - tmp = swap_on ? swap(val) : val; - memcpy(buf, (char *)&tmp, 4); - - return(buf+4); -} - - -static char *build_msg_str(char *buf, char *str) -{ - int len = strlen(str)+1; - -#ifdef HW_DEBUG - php3_printf(" Added str to header: %s (%d)
\n", str, strlen(str)); -#endif - - memcpy(buf, str, len); - - return(buf+len); -} - - -static int swap(int val) -{ - int tmp; - - ((char*)&tmp)[0] = ((char*)&val)[3]; - ((char*)&tmp)[1] = ((char*)&val)[2]; - ((char*)&tmp)[2] = ((char*)&val)[1]; - ((char*)&tmp)[3] = ((char*)&val)[0]; - - return(tmp); -} - - -void close_hg_connection(int sockfd) -{ - shutdown(sockfd, 2); - HWSOCK_FCLOSE(sockfd); -} - -#endif - -/* - * Local variables: - * tab-width: 4 - * End: - */ - diff --git a/ext/hyperwave/hg_comm.h b/ext/hyperwave/hg_comm.h deleted file mode 100644 index 5056060310501..0000000000000 --- a/ext/hyperwave/hg_comm.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 PHP Development Team (See Credits file) | - +----------------------------------------------------------------------+ - | 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 2 of the License, 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. | - +----------------------------------------------------------------------+ - | Authors: Rasmus Lerdorf | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef _HG_COMM_H -#define _HG_COMM_H - -#if HYPERWAVE - -#include "hw_error.h" -#define HG_SERVER_PORT 418 - -#define F_DISTRIBUTED 0x80000000 -#define F_COMPRESSED 0x40000000 -#define F_VERSION 0x00003fff -#define HW_VERSION 717L /* 7.17 */ - -#define HEADER_LENGTH 12 - -#define STAT_COMMAND_STR "stat" -#define WHO_COMMAND_STR "who" -#define STAT_COMMAND 1 -#define WHO_COMMAND 2 - -#define GETDOCBYANCHOR_MESSAGE 2 -#define GETCHILDCOLL_MESSAGE 3 -#define GETPARENT_MESSAGE 4 -#define GETCHILDDOCCOLL_MESSAGE 5 -#define GETOBJECT_MESSAGE 7 -#define GETANCHORS_MESSAGE 8 -#define GETOBJBYQUERY_MESSAGE 9 -#define GETOBJBYQUERYCOLL_MESSAGE 10 -#define OBJECTBYIDQUERY_MESSAGE 11 -#define GETTEXT_MESSAGE 12 -#define INSDOC_MESSAGE 14 -#define INSCOLL_MESSAGE 17 -#define GETSRCBYDEST_MESSAGE 19 -#define MVCPDOCSCOLL_MESSAGE 22 -#define MVCPCOLLSCOLL_MESSAGE 23 -#define IDENTIFY_MESSAGE 24 -#define READY_MESSAGE 25 -#define COMMAND_MESSAGE 26 -#define CHANGEOBJECT_MESSAGE 27 -#define EDITTEXT_MESSAGE 28 -#define GETANDLOCK_MESSAGE 29 -#define UNLOCK_MESSAGE 30 -#define INCOLLECTIONS_MESSAGE 31 -#define INSERTOBJECT_MESSAGE 32 -#define PIPEDOCUMENT_MESSAGE 36 -#define DELETEOBJECT_MESSAGE 37 -#define PUTDOCUMENT_MESSAGE 38 -#define GETREMOTE_MESSAGE 39 -#define GETREMOTECHILDREN_MESSAGE 40 -#define HG_MAPID 43 -#define CHILDREN_MESSAGE 44 -#define GETCGI_MESSAGE 45 -#define PIPECGI_MESSAGE 46 - -#define HW_DEFAULT_LINK 0 -#define HW_IMAGE_LINK 1 -#define HW_BACKGROUND_LINK 2 -#define HW_INTAG_LINK 3 -#define HW_APPLET_LINK 4 - -#define COPY 0 -#define MOVE 1 -#define DOCUMENT 0 -#define COLLECTION 1 - - -#if WIN32|WINNT -# define SOCK_ERR INVALID_SOCKET -# define SOCK_CONN_ERR SOCKET_ERROR -# define HWSOCK_FCLOSE(s) closesocket(s) -#else -# define SOCK_ERR -1 -# define SOCK_CONN_ERR -1 -# define HWSOCK_FCLOSE(s) close(s) -#endif - - -/* Low error messages */ -#define LE_MALLOC -1 - -typedef struct { - int id; /* object ID of anchor */ - int tanchor; /* Type of anchor. Can be 1=Src, 2=Dest */ - int start; /* start of anchor */ - int end; /* end of anchor */ - char *nameanchor; /* name tag attribute of destination document */ - /* if anchor is of type Src the following are used as well */ - char *destdocname; /* name of destination document */ - char *link; /* url for external destination */ - int linktype; /* type of link. see above */ - char *tagattr; /* more attributes of tag, like Border=0 */ - char *htmlattr; /* */ - char *codebase; /* codebase of applet */ - char *code; /* code of applet */ - char *fragment; /* name link of Src */ - - /* if anchor is of type Dest the following are used as well */ - char *keyword; /* name link of Dest */ - } ANCHOR; - -typedef struct { - int length; - int version_msgid; - int msg_type; - char *buf; -} hg_msg; - -typedef struct { - int socket; - int swap_on; - int version; - char *server_string; - char *hostname; - char *username; - int lasterror; - int linkroot; -} hw_connection; - -typedef int hw_objectID; -typedef char hw_objrec; - -extern void set_swap(int do_swap); -extern int open_hg_connection(char *server_name, int port); -extern void close_hg_connection(int sockfd); -extern int initialize_hg_connection(int sockfd, int *do_swap, int *version, char **userdata, char **server_string, char *username, char *password); - -extern int send_ready(int sockfd); -extern int send_command(int sockfd, int command, char **answer); - -extern hg_msg *recv_hg_msg(int sockfd); -extern hg_msg *recv_ready(int sockfd); -extern hg_msg *recv_command(int sockfd); - -extern char *fnInsStr(char *str, int pos, char *insstr); -extern int fnAttributeCompare(char *object, char *attrname, char *value); -extern int getrellink(int sockfd, int rootID, int thisID, int destID, char **reldesstr); - -extern int send_deleteobject(int sockfd, hw_objectID objectID); -extern int send_changeobject(int sockfd, hw_objectID objectID, char *mod); -extern int send_groupchangeobject(int sockfd, hw_objectID objectID, char *mod); -extern int send_getobject(int sockfd, hw_objectID objectID, char **attributes); -extern int send_getandlock(int sockfd, hw_objectID objectID, char **attributes); -extern int send_lock(int sockfd, hw_objectID objectID); -extern int send_unlock(int sockfd, hw_objectID objectID); -extern int send_gettext(int sockfd, hw_objectID objectID, int mode, int rootid, char **objattr, char **bodytag, char **text, int *count, char *urlprefix); -extern int send_edittext(int sockfd, char *objattr, char *text); -extern int send_getcgi(int sockfd, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count); -extern int send_getremote(int sockfd, hw_objectID objectID, char **objattr, char **text, int *count); -extern int send_getremotechildren(int sockfd, char *attributes, char **text, int **childIDs, int *count); -extern int send_docbyanchor(int sockfd, hw_objectID objectID, hw_objectID *anchorID); -extern int send_docbyanchorobj(int sockfd, hw_objectID objectID, char **objrec); -extern int send_mvcpdocscollscoll(int sockfd, hw_objectID *objectIDs, int count, int from, int dest, int cpmv, int docscoll); -extern int send_childrenobj(int sockfd, hw_objectID objectID, char ***childrec, int *count); -extern int send_getchildcoll(int sockfd, int objectID, hw_objectID **childIDs, int *count); -extern int send_getchildcollobj(int sockfd, hw_objectID objectID, hw_objrec ***childrec, int *count); -extern int send_getchilddoccoll(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count); -extern int send_getchilddoccollobj(int sockfd, hw_objectID objectID, hw_objrec ***childrec, int *count); -extern int send_getanchors(int sockfd, hw_objectID objectID, hw_objectID **anchorIDs, int *count); -extern int send_getanchorsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count); -extern int send_objectbyidquery(int sockfd, hw_objectID *IDs, int *count, char *query, char ***objrecs); -extern int send_getobjbyquery(int sockfd, char *query, int maxhits, hw_objectID **childIDs, int *count); -extern int send_getobjbyqueryobj(int sockfd, char *query, int maxhits, char ***childrec, int *count); -extern int send_getobjbyquerycoll(int sockfd, hw_objectID collID, char *query, int maxhits, hw_objectID **childIDs, int *count); -extern int send_getobjbyquerycollobj(int sockfd, hw_objectID collID, char *query, int maxhits, char ***childrec, int *count); -extern int send_identify(int sockfd, char *name, char *passwd, char **userdata); -extern int send_getparents(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count); -extern int send_children(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count); -extern int send_getparentsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count); -extern int send_pipedocument(int sockfd, char *hostname, hw_objectID objectID, int mode, int rootid, char** objattr, char **bodytag, char **text, int *count, char *urlprefix); -extern int send_pipecgi(int sockfd, char *host, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count); -extern int send_putdocument(int sockfd, char *hostname, hw_objectID parentID, char *objectRec, char *text, int count, hw_objectID *objectID); -extern int send_inscoll(int sockfd, hw_objectID objectID, char *objrec, hw_objectID *new_objectID); -extern int send_insertobject(int sockfd, char *objrec, char *parms, hw_objectID *objectID); -extern int send_insdoc(int sockfd, hw_objectID objectID, char *objrec, char *text, hw_objectID *new_objectID); -extern int send_incollections(int sockfd, int retcol, int cobjids, hw_objectID *objectIDs, int ccollids, hw_objectID *collIDs, int *count, hw_objectID **retIDs); -extern int send_getsrcbydest(int sockfd, hw_objectID objid, char ***childrec, int *count); -extern int send_mapid(int sockfd, int servid, hw_objectID id, int *virtid); -extern int send_dummy(int sockfd, hw_objectID objectID, int msgid, char **attributes); -extern char *get_hw_info(hw_connection *conn); - -#define send_mvcpdocscoll(sockfd,objectIDs,count,from,dest,mvcp) \ - send_mvcpdocscollscoll(sockfd,objectIDs,count,from,dest,mvcp,DOCUMENT) -#define send_mvcpcollscoll(sockfd,objectIDs,count,from,dest,mvcp) \ - send_mvcpdocscollscoll(sockfd,objectIDs,count,from,dest,mvcp,COLLECTION) - -#endif -#endif diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c deleted file mode 100644 index 87925916c776e..0000000000000 --- a/ext/hyperwave/hw.c +++ /dev/null @@ -1,3717 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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: Uwe Steinmann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ -#if COMPILE_DL -#include "dl/phpdl.h" -#endif - -#include -#include - -#include "php.h" -#include "php_globals.h" -#include "ext/standard/php3_standard.h" -#include "ext/standard/head.h" -#include "ext/standard/info.h" -#include "SAPI.h" - -#if WIN32|WINNT -#include -#else -#include "build-defs.h" -#endif - -#if HYPERWAVE - -#include "php_ini.h" -#include "php3_hyperwave.h" - -//hw_module php3_hw_module; - -#define HW_ATTR_NONE 1 -#define HW_ATTR_LANG 2 -#define HW_ATTR_NR 3 - -function_entry hw_functions[] = { - PHP_FE(hw_connect, NULL) - PHP_FE(hw_pconnect, NULL) - PHP_FE(hw_close, NULL) - PHP_FE(hw_root, NULL) - PHP_FE(hw_info, NULL) - PHP_FE(hw_connection_info, NULL) - PHP_FE(hw_error, NULL) - PHP_FE(hw_errormsg, NULL) - PHP_FE(hw_getparentsobj, NULL) - PHP_FE(hw_getparents, NULL) - PHP_FE(hw_children, NULL) - PHP_FE(hw_childrenobj, NULL) - PHP_FE(hw_getchildcoll, NULL) - PHP_FE(hw_getchildcollobj, NULL) - PHP_FE(hw_getobject, NULL) - PHP_FE(hw_getandlock, NULL) - PHP_FE(hw_unlock, NULL) - PHP_FE(hw_gettext, NULL) - PHP_FE(hw_edittext, NULL) - PHP_FE(hw_getcgi, NULL) - PHP_FE(hw_getremote, NULL) - PHP_FE(hw_getremotechildren, NULL) - PHP_FE(hw_pipedocument, NULL) - PHP_FE(hw_pipecgi, NULL) - PHP_FE(hw_insertdocument, NULL) - PHP_FE(hw_mv, NULL) - PHP_FE(hw_cp, NULL) - PHP_FE(hw_deleteobject, NULL) - PHP_FE(hw_changeobject, NULL) - PHP_FE(hw_modifyobject, NULL) - PHP_FE(hw_docbyanchor, NULL) - PHP_FE(hw_docbyanchorobj, NULL) - PHP_FE(hw_getobjectbyquery, NULL) - PHP_FE(hw_getobjectbyqueryobj, NULL) - PHP_FE(hw_getobjectbyquerycoll, NULL) - PHP_FE(hw_getobjectbyquerycollobj, NULL) - PHP_FE(hw_getchilddoccoll, NULL) - PHP_FE(hw_getchilddoccollobj, NULL) - PHP_FE(hw_getanchors, NULL) - PHP_FE(hw_getanchorsobj, NULL) - PHP_FE(hw_getusername, NULL) - PHP_FE(hw_setlinkroot, NULL) - PHP_FE(hw_identify, NULL) - PHP_FE(hw_free_document, NULL) - PHP_FE(hw_new_document, NULL) - PHP_FE(hw_output_document, NULL) - PHP_FE(hw_document_size, NULL) - PHP_FE(hw_document_attributes, NULL) - PHP_FE(hw_document_bodytag, NULL) - PHP_FE(hw_document_content, NULL) - PHP_FE(hw_document_setcontent, NULL) - PHP_FE(hw_objrec2array, NULL) - PHP_FE(hw_array2objrec, NULL) - PHP_FE(hw_incollections, NULL) - PHP_FE(hw_inscoll, NULL) - PHP_FE(hw_insertobject, NULL) - PHP_FE(hw_insdoc, NULL) - PHP_FE(hw_getsrcbydestobj, NULL) - PHP_FE(hw_getrellink, NULL) - PHP_FE(hw_who, NULL) - PHP_FE(hw_stat, NULL) - PHP_FE(hw_mapid, NULL) - PHP_FE(hw_dummy, NULL) - {NULL, NULL, NULL} -}; - -php3_module_entry hw_module_entry = { - "HyperWave", hw_functions, PHP_MINIT(hw), PHP_MSHUTDOWN(hw), NULL, NULL, PHP_MINFO(hw), 0, 0, 0, NULL -}; - -#ifdef ZTS -int hw_globals_id; -#else -PHP_HW_API php_hw_globals hw_globals; -#endif - -#ifdef COMPILE_DL -DLEXPORT php3_module_entry *get_module(void) { return &hw_module_entry; } -#endif - -void print_msg(hg_msg *msg, char *str, int txt); - -#if COMPILE_DL -DLEXPORT php3_module_entry *get_module(void) { return &hw_module_entry; } -#endif - -void _close_hw_link(hw_connection *conn) -{ - if(conn->hostname) - free(conn->hostname); - if(conn->username) - free(conn->username); - close(conn->socket); - free(conn); - HwSG(num_links)--; -} - -void _close_hw_plink(hw_connection *conn) -{ - if(conn->hostname) - free(conn->hostname); - if(conn->username) - free(conn->username); - close(conn->socket); - free(conn); - HwSG(num_links)--; - HwSG(num_persistent)--; -} - -void _free_hw_document(hw_document *doc) -{ - if(doc->data) - free(doc->data); - if(doc->attributes) - free(doc->attributes); - if(doc->bodytag) - free(doc->bodytag); - free(doc); -} - -#ifdef ZTS -static void php_hw_init_globals(php_hw_globals *hw_globals) -{ - HwSG(num_persistent) = 0; -} -#endif - -static PHP_INI_MH(OnHyperwavePort) { - HwSLS_FETCH(); - - if (new_value==NULL) { - HwSG(default_port) = HG_SERVER_PORT; - } else { - HwSG(default_port) = atoi(new_value); - } - return SUCCESS; -} - -PHP_INI_BEGIN() - STD_PHP_INI_ENTRY("hyerwave.allow_persistent", "0", PHP_INI_SYSTEM, OnUpdateInt, allow_persistent, php_hw_globals, hw_globals) - PHP_INI_ENTRY("hyperwave.default_port", "418", PHP_INI_ALL, OnHyperwavePort) -PHP_INI_END() - -PHP_MINIT_FUNCTION(hw) { - -#ifdef ZTS - hw_globals_id = ts_allocate_id(sizeof(php_hw_globals), php_hw_init_globals, NULL); -#else - HwSG(num_persistent)=0; -#endif - REGISTER_INI_ENTRIES(); - HwSG(le_socketp) = register_list_destructors(_close_hw_link,NULL); - HwSG(le_psocketp) = register_list_destructors(NULL,_close_hw_plink); - HwSG(le_document) = register_list_destructors(_free_hw_document,NULL); - hw_module_entry.type = type; - -// REGISTER_LONG_CONSTANT("HW_ATTR_LANG", HW_ATTR_LANG, CONST_CS | CONST_PERSISTENT); -// REGISTER_LONG_CONSTANT("HW_ATTR_NR", HW_ATTR_NR, CONST_CS | CONST_PERSISTENT); -// REGISTER_LONG_CONSTANT("HW_ATTR_NONE", HW_ATTR_NONE, CONST_CS | CONST_PERSISTENT); - return SUCCESS; -} - -PHP_MSHUTDOWN_FUNCTION(hw) -{ - UNREGISTER_INI_ENTRIES(); - return SUCCESS; -} - -/* creates an array in return value and frees all memory - * Also adds as an assoc. array at the end of the return array with - * statistics. - */ -int make_return_objrec(pval **return_value, char **objrecs, int count) -{ - zval *stat_arr; - int i; - int hidden, collhead, fullcollhead, total; - int collheadnr, fullcollheadnr; - - if (array_init(*return_value) == FAILURE) { - /* Ups, failed! Let's at least free the memory */ - for(i=0; i