mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-08 09:47:30 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1408a2e29c |
No files matched your search
+27
-111
@@ -5,9 +5,8 @@ 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. Since we are now
|
||||
well into the version 4 releases, many sections have been recoded to use
|
||||
these rules.
|
||||
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
|
||||
@@ -44,9 +43,9 @@ Exceptions:
|
||||
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. php_addslashes())
|
||||
recalculated with strlen() (e.g. _php3_addslashes())
|
||||
|
||||
[5] Use php_error() to report any errors/warnings during code execution.
|
||||
[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,
|
||||
@@ -60,74 +59,28 @@ Exceptions:
|
||||
check its man page again, and only then, consider using it, and even then,
|
||||
try avoiding it.
|
||||
|
||||
[7] Use ZEND_* macros instead of PHP_* macros. Use of PHP_* macros is not
|
||||
recommended. Since most of the PHP_* macros are ZEND_* macro aliases, using
|
||||
the PHP_* macros makes browsing the source code with a tag search harder.
|
||||
|
||||
[8] Use assert(). assert.h is included in php.h if it is available. Not only
|
||||
does good assertion catch bugs, but it also helps with code readability.
|
||||
- Do not use assert for error handling. Use assert only for the
|
||||
condition that must be always true.
|
||||
- Do not use assignments in assert conditions. If you assign inside an
|
||||
assert condition, you risk an elusive bug that would be very difficult
|
||||
to spot in a debug build, due to the side effect of the assignment.
|
||||
Function calls in assert conditions may also cause this problem, if
|
||||
they modify one of their arguments or global variables.
|
||||
|
||||
Naming Conventions
|
||||
------------------
|
||||
|
||||
[1] Function names for user-level functions should be enclosed with in
|
||||
the PHP_FUNCTION() macro. They should be in lowercase, with words
|
||||
underscore delimited, with care taken to minimize the letter count.
|
||||
Abbreviations should not be used when they greatly decrease the
|
||||
readability of the function name itself.
|
||||
[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.
|
||||
|
||||
Good:
|
||||
'mcrypt_enc_self_test'
|
||||
'mysql_list_fields'
|
||||
|
||||
Ok:
|
||||
'mcrypt_module_get_algo_supported_key_sizes'
|
||||
(could be 'mcrypt_mod_get_algo_sup_key_sizes'?)
|
||||
'get_html_translation_table'
|
||||
(could be 'html_get_trans_table'?)
|
||||
|
||||
Bad:
|
||||
'hw_GetObjectByQueryCollObj'
|
||||
'pg_setclientencoding'
|
||||
'jf_n_s_i'
|
||||
|
||||
|
||||
[2] If they are part of a "parent set" of functions, that parent should
|
||||
be included in the user function name, and should be clearly related
|
||||
to the parent program or function family. This should be in the form
|
||||
of parent_*.
|
||||
|
||||
A family of 'foo' functions, for example:
|
||||
Good:
|
||||
'foo_select_bar'
|
||||
'foo_insert_baz'
|
||||
'foo_delete_baz'
|
||||
|
||||
Bad:
|
||||
'fooselect_bar'
|
||||
'fooinsertbaz'
|
||||
'delete_foo_baz'
|
||||
|
||||
[3] Function names used by user functions should be prefixed
|
||||
with "_php_", and followed by a word or an underscore-delimited list of
|
||||
[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'.
|
||||
|
||||
[4] Variable names must be meaningful. One letter variable names must be
|
||||
[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++) ...).
|
||||
|
||||
[5] Variable names should be in lowercase. Use underscores to separate
|
||||
[4] Variable names should be in lowercase; Use underscores to seperate
|
||||
between words.
|
||||
|
||||
|
||||
|
||||
Syntax and indentation
|
||||
----------------------
|
||||
|
||||
@@ -141,34 +94,25 @@ Syntax and indentation
|
||||
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 he or she is not used to, but,
|
||||
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 declaration
|
||||
indentation and comment styles and up to function decleration
|
||||
syntax.
|
||||
|
||||
(see also http://www.tuxedo.org/~esr/jargon/html/entry/indent-style.html)
|
||||
|
||||
[3] Be generous with whitespace and braces. Always prefer:
|
||||
|
||||
if (foo) {
|
||||
[3] Be generous with whitespace and braces. Always prefer
|
||||
if (foo) {
|
||||
bar;
|
||||
}
|
||||
|
||||
to:
|
||||
|
||||
to
|
||||
if(foo)bar;
|
||||
|
||||
Keep one empty line between the variable declaration section and
|
||||
|
||||
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.
|
||||
|
||||
[4] When indenting, use the tab character. A tab is expected to represent
|
||||
four spaces. It is important to maintain consistency in indenture so
|
||||
that definitions, comments, and control structures line up correctly.
|
||||
|
||||
Documentation and Folding Hooks
|
||||
-------------------------------
|
||||
|
||||
@@ -178,18 +122,18 @@ 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)
|
||||
Returns the absolute value of the number */
|
||||
PHP_FUNCTION(abs)
|
||||
{
|
||||
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 and vim (set fdm=marker). 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.
|
||||
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
|
||||
@@ -199,35 +143,7 @@ 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]]])
|
||||
Returns a header object with the defined parameters */
|
||||
|
||||
And yes, please keep the prototype on a single line, even if that line
|
||||
is massive.
|
||||
And yes, please keep everything on a single line, even if that line is massive.
|
||||
|
||||
New and Experimental Functions
|
||||
-----------------------------------
|
||||
To reduce the problems normally associated with the first public
|
||||
implementation of a new set of functions, it has been suggested
|
||||
that the first implementation include a file labeled 'EXPERIMENTAL'
|
||||
in the function directory, and that the functions follow the
|
||||
standard prefixing conventions during their initial implementation.
|
||||
|
||||
The file labelled 'EXPERIMENTAL' should include the following
|
||||
information:
|
||||
Any authoring information (known bugs, future directions of the module).
|
||||
Ongoing status notes which may not be appropriate for CVS comments.
|
||||
|
||||
Aliases & Legacy Documentation
|
||||
-----------------------------------
|
||||
You may also have some deprecated aliases with close to duplicate
|
||||
names, for example, somedb_select_result and somedb_selectresult. For
|
||||
documentation purposes, these will only be documented by the most
|
||||
current name, with the aliases listed in the documentation for
|
||||
the parent function. For ease of reference, user-functions with
|
||||
completely different names, that alias to the same function (such as
|
||||
highlight_file and show_source), will be separately documented. The
|
||||
proto should still be included, describing which function is aliased.
|
||||
|
||||
Backwards compatible functions and names should be maintained as long
|
||||
as the code can be reasonably be kept as part of the codebase. See
|
||||
/phpdoc/README for more information on documentation.
|
||||
@@ -1,2 +1,3 @@
|
||||
For the list of people who've put work into PHP, please see
|
||||
http://www.php.net/credits.php
|
||||
For the list of people who've put work into PHP 4.0, please see
|
||||
http://www.php.net/version4/credits.php
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+860
@@ -0,0 +1,860 @@
|
||||
PHP 3.0 CHANGE LOG ChangeLog
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
|
||||
December 24 1998, Version 3.0.6
|
||||
- Fix GetImageSize() to work with non-standard jpg images
|
||||
- Add Mersenne Twister functions (mt_rand, mt_srand, etc)
|
||||
- Add str_replace() function
|
||||
- Add chunk_split() function
|
||||
- Fixed a bug in the memory limit code, in cases where $php_errormsg was
|
||||
also used.
|
||||
- Add iptcparse() function
|
||||
- Adobe FDF supported
|
||||
- getallheaders() NULL string fix <michale@utko.fee.vutbr.cz>
|
||||
- Add all configuration directives to phpinfo() page
|
||||
- Functions pack() and unpack() rewritten to be binary and buffer overrun
|
||||
safe and behave like the Perl functions for all implemented format codes.
|
||||
- Ensured that msql_error() will not return error messages generated by
|
||||
previously-run scripts.
|
||||
- Add base_convert() function
|
||||
- Make sprintf() and printf() output binary safe
|
||||
- Made gzgetc binary safe
|
||||
- Add convert_cyr_string() and quoted_printable_decode() functions
|
||||
- Fix ldap_free_result() core dump bug
|
||||
- Add support for current OpenLDAP-2.0-devel library
|
||||
- Add php3_asp_tags directive so it can be set from Apache config files
|
||||
- Added UTF-8 support in the XML extension
|
||||
- Make rand(min,max) safer on older platforms where the low-order bits have
|
||||
short cycles.
|
||||
- Added new pdf (Portable Document Format) module
|
||||
- Added an XML parsing extension using James Clark's "expat" library
|
||||
- Optimized parts of the token cache code.
|
||||
- Terminate on out-of-memory errors. Until now, PHP could crash in out of
|
||||
memory situations (clean-up, no real effect).
|
||||
- Unterminated comments in include files were being reported with the wrong line
|
||||
number. Fixed.
|
||||
- Added ImageCopy() and ImageColorDeallocate(). ImageCopy() is about
|
||||
20% faster than ImageCopyResized(). ImageColorDeallocate() marks
|
||||
palette entries free for reuse (by <mka@satama.com>).
|
||||
- In the CGI version, it was impossible to access resources (e.g. SQL links,
|
||||
images) from user-defined shutdown functions. Fixed.
|
||||
- Added optional third parameter to strpos() to specify the offset to
|
||||
start searching from.
|
||||
- Fixed a crash bug in unset() when unsetting illegal variables (rare).
|
||||
- Made ImageInterlace and ImageTransparentColor parameters optional, and made
|
||||
them return the current/new settings.
|
||||
- Optimized GetImageSize() <thies@digicol.de>.
|
||||
- Made odbc_autocommit() without args return status
|
||||
- Added connect workaround for OpenLink ODBC
|
||||
- Added minimal InterBase support. Tested only on 4.0 & Linux.
|
||||
- Fixed some memory leaks and bogus error messages in the URL handler of
|
||||
the various file open functions. Should only affect error handling
|
||||
in bad URLs.
|
||||
|
||||
October 5 1998 Version 3.0.5
|
||||
- mysql_field_flags now reports all MySQL flags and the result is suitable
|
||||
for automatic parsing. Compatibility warning: The result format has
|
||||
changed. If you have scripts parsing the result of this function, you
|
||||
may need to adapt them.
|
||||
- Made nl2br() binary safe (not that it's of much use).
|
||||
- Fixed a bug in the API function getThis(). It affected mostly the dir
|
||||
functions, if nested within objects.
|
||||
- Fixed a problem in require() in conjunction with switch(), and in some other
|
||||
cases. Also fixed an identical problem with the call_user_function() API
|
||||
function.
|
||||
- Removed -lpthread when compiling with MySQL support. It caused various
|
||||
serious problems when compiled into Apache.
|
||||
- Add serialize() and unserialize() functions from jkl@njet.net
|
||||
- Fix in_addr_t check for systems with in_addr_t in netinet/in.h
|
||||
- Add atan2() function
|
||||
|
||||
September 22 1998 Version 3.0.4
|
||||
- Added uksort() - array key sort using a user defined comparison function.
|
||||
- Added 'j' support to date() - generates the day of the month, without
|
||||
possible leading zeros.
|
||||
- Added support for multiple crypt() encryptions if the system supports it
|
||||
- Added optional support for ASP-style <% %> and <%= tags
|
||||
- Fixed data loss problems with very large numeric array indices on 64-bit
|
||||
platforms (e.g. DEC UNIX).
|
||||
- 2 cursor_type parameters for ifx_query() and ifx_prepare changed
|
||||
to 1 (bitmask). Added a few constants for use in Informix module.
|
||||
- Added php3.ini option ifx.charasvarchar. If set, trailing blanks
|
||||
are stripped from fixed-length char columns. (Makes life easier
|
||||
for people using Informix SE.)
|
||||
- Static SNMP module which compiles with ucd-snmp 3.5.2
|
||||
- fixed imap_header & header_info from crashing when a header line
|
||||
is > 1024 characters.
|
||||
- Added patch for rfc822_parse_adr to return an array of objects instead
|
||||
of a single object.
|
||||
- Informix Online 7.x & SE 7.x support now fairly complete and stable
|
||||
- Add dbase_get_record_with_names() function
|
||||
- Added a special case for open_basedir. When open_basedir is set to "."
|
||||
the directory in which the script is stored will be used as basedir.
|
||||
- Include alloca.c in the distribution for platforms without alloca().
|
||||
- Improved stripping of URL passwords from error messages - the length of the
|
||||
username/password isn't obvious now, and all protocols are handled properly
|
||||
(most importantly, http).
|
||||
- Copying objects that had member functions with static variables produced
|
||||
undetermined results. Fixed.
|
||||
- Added function lstat() and cleaned up the status functions,
|
||||
added tests for file status functions (this may break on some plattforms)
|
||||
- Fixed is_link() - it was returning always false.
|
||||
- Fixed apache_note() - it was corrupting memory.
|
||||
- New Function. void get_meta_tags(string filename); Parses filename until
|
||||
closing head tag and turns all meta tags into variables prefixed with 'meta_'.
|
||||
The below meta tag would produce $meta_test="some string here"
|
||||
<meta name="test" content="some string here">
|
||||
- Generalized some internal functions in order to better support calling
|
||||
user-level functions from C code. Fixes a few sporadic problems related
|
||||
to constructors inside eval() and more.
|
||||
- Fixed an endless loop in explode(), strstr() and strpos() in case of an
|
||||
invalid empty delimiter.
|
||||
- rand() now accepts two optional arguments, which denote the requested range
|
||||
of the generated number. E.g., rand(3,7) would generate a random number
|
||||
between 3 and 7.
|
||||
- Added M_PI constant.
|
||||
- Added deg2rad() and rad2deg() for converting radians<->degrees.
|
||||
- ImageArc() misbehaved when given negative angles, fixed.
|
||||
- Fixed a bug in ereg() that may have caused buglets under some circumstances.
|
||||
- Added imap_status
|
||||
- Shutdown functions, registered via register_shutdown_function(), could never
|
||||
generate output in the Apache module version. Fixed.
|
||||
- Brought IMAP docs into sync with acutal imap code
|
||||
- imap_fetchstructure now takes in optional flags
|
||||
- Fix potential core dumps in imap_append and imap_fetchtext_full
|
||||
- Fix problem in SetCookie() function related to long cookies
|
||||
- Add uasort() function to go along with usort (like sort() and asort())
|
||||
- Add port number to Host header as per section 14.23 of the HTTP 1.1 RFC
|
||||
- Fix imap_reopen to only take 2 arguments with an optional 3rd flags arg
|
||||
- Add optional 2nd argument to imap_close
|
||||
- Add CL_EXPUNGE flag to imap_open() flags
|
||||
- Fix 4th arg on imap_append(). It was getting converted to a long by mistake.
|
||||
- Fix shutdown warning in the LDAP module
|
||||
- *COMPATIBILITY WARNING* imap_fetchstructure() "parametres" object and property
|
||||
name changed to "parameters" to match the documentation and to be consistent
|
||||
with the rest of the API.
|
||||
- Delete uploaded temporary files automatically at the end of a request
|
||||
- Add upload_max_filesize and correponsing php3_upload_max_filesize directive
|
||||
to control the maximum size of an uploaded file. Setting this to 0 would
|
||||
completely eliminate file uploads.
|
||||
- Force $PHP_SELF to PATH_INFO value when running in CGI FORCE_CGI_REDIRECT mode
|
||||
- Add apache_lookup_uri() function which does an internal sub-request lookup
|
||||
and returns an object containing the request_rec fields for the URI. (Yes,
|
||||
you have to be a bit of a gearhead to figure this one out)
|
||||
- Fix a few signed char problems causing functions like ucfirst() not to work
|
||||
correctly with non-English charsets
|
||||
- md5() function not binary safe - fixed
|
||||
|
||||
August 15 1998 Version 3.0.3
|
||||
- Changed the name of fopen_basedir to open_basedir, to be a little more
|
||||
accurate about what it does.
|
||||
- Added Hyperwave module
|
||||
- Added config-option (php3_)enable_dl <on/off>. This enables/disables the
|
||||
dl() function. In safe-mode dl() is always disabled.
|
||||
- Auto-prepended files were crashing under some circumstances - fixed.
|
||||
- Win32 mail fixes provided by walton@nordicdms.com
|
||||
- Comparing between arrays and/or objects now generates a warning (it always
|
||||
returns false, as it used to; no comparison is made)
|
||||
- Fixed a bug in the syntax highlighting code, that made ending-double-quotes
|
||||
appear twice under certain circumstances.
|
||||
- Fix bug in filetype() function related to symlinks
|
||||
- Started integrating Informix SE support to PHP configure/makefile setup.
|
||||
- gdttf roundoff fixes from ellson@lucent.com
|
||||
- Added initial Informix SE support files from Danny Heijl - This code still
|
||||
needs to be integrated into the PHP configure/makefile setup and the code
|
||||
itself needs more work.
|
||||
- return in the global scope now terminates the execution of the current file.
|
||||
- Added the ability to register shutdown function(s), via
|
||||
register_shutdown_function($function_name).
|
||||
- Clean up const warnings
|
||||
- Add write support to ftp fopen wrappers
|
||||
- Add strspn() and strcspn() functions
|
||||
- On systems without strerror use Apache version if compiling as Apache module
|
||||
- The PHP start tag was being ignored under some circumstances - fixed.
|
||||
- The db, dbase and filepro functions are now Safe-Mode aware.
|
||||
- Added config-option (php3_)fopen_basedir <path>. This limits the directory-
|
||||
tree scripts can open files in to <path>.
|
||||
- Fixed pg_loreadall that didn't always return all the contents in a PostgreSQL
|
||||
large object. Also, doesn't pass through anything if method is HEAD.
|
||||
- configure fix to create target Apache module dir
|
||||
- Fix core dump in imageTTFtext() function
|
||||
- Added static IMAP support
|
||||
- Syntax highlighting was generating additional whitespace - fixed.
|
||||
- Added ucwords. Works like ucfirst, but works on all words within a string.
|
||||
- Added array_walk() - apply user function to every element of an array
|
||||
- Added usort() - array sort that accepts a user defined comparison function!
|
||||
- Added the ability to call user-level functions and object methods on demand
|
||||
from the C source using a completely generalized, slick API function.
|
||||
Miracles do happen every once in a while.
|
||||
- Added constructors. Don't even squeek about destructors! :) (we mean that)
|
||||
- Make pg_lowrite() binary safe
|
||||
- Fixed mod_charset option in ./setup
|
||||
- Fixed rewinddir() and dir()::rewind() under Win32 (they didn't work before).
|
||||
- Add Win32 COM support! By-name referencing is supported using the IDispatch
|
||||
interface (automation). Available functions - COM_Load(), COM_Invoke(),
|
||||
COM_PropGet() and COM_PropSet().
|
||||
|
||||
July 20 1998 Version 3.0.2a
|
||||
- Fix a quirk in the configuration file parser, the endless fountain of joy
|
||||
and fun.
|
||||
- Fix a bug in the API function add_method() that made dir() crash.
|
||||
|
||||
July 18 1998 Version 3.0.2
|
||||
- Compile cleanups for *BSD
|
||||
- Add support for the OpenLink ODBC Drivers
|
||||
- Add PHP_SELF, PHP_AUTH_* and HTTP_*_VARS PHP variables to phpinfo() output
|
||||
- Add workaround for broken makes
|
||||
- Add Apache 1.3.1 support (some Apache header files were moved around)
|
||||
- Added apache_note() function.
|
||||
- Fix order of system libraries and detect libresolv correctly
|
||||
- Fixed a bug in the Sybase-DB module. Several numeric field types were
|
||||
getting truncated when having large values.
|
||||
- Added testpages for unified odbc
|
||||
- Fix php -s seg fault when filename was missing
|
||||
- Made getdate() without args default to current time
|
||||
- Added ImageColorResolve() and some fixes to the freetype support.
|
||||
- Added strcasecmp()
|
||||
- Added error_prepend_string and error_append_string .ini and .conf directives
|
||||
to make it possible to configure the look of error messages displayed by PHP
|
||||
to some extent
|
||||
- Added E_ERROR, E_WARNING, E_NOTICE, E_PARSE and E_ALL constants, that can be
|
||||
used in conjunction with error_reporting()
|
||||
(e.g. error_reporting(E_ERROR|E_WARNING|E_NOTICE);
|
||||
- Fixed a crash problem with classes that contained function(s) with default
|
||||
values.
|
||||
- Fixed a problem in the browscap module. Browscap files weren't being read
|
||||
properly.
|
||||
- Fix -L path in libphp4.module to make ApacheSSL compile without errors
|
||||
- Fix StripSlashes so it correctly decodes a \0 to a NUL
|
||||
|
||||
July 04 1998 Version 3.0.1
|
||||
- echo/print of empty strings don't trigger sending the header anymore.
|
||||
- Implemented shift left and shift right operators (<< and >>)
|
||||
- Compile fix for cc on HP-UX.
|
||||
- Look for beta-version Solid libraries as well.
|
||||
- Make GD module show more info in phpinfo().
|
||||
- Compile fix for NextStep 3.0.
|
||||
- Fix for Oracle extension on OSF/1.
|
||||
- Fix gd 1.3 bug in ImageColorAt().
|
||||
- pg_loread() hopefully handles binary data now.
|
||||
- Turned off some warnings in dns.c
|
||||
- Added ImageTTFBBox() and made ImageTTFText() return bounding box.
|
||||
- Added constants for Ora_Bind()'s modes.
|
||||
- Renamed all hash_*() routines to _php3_hash_*() to avoid clashes with other
|
||||
libraries.
|
||||
- Changed uodbc default LONG behaviour: longreadlen 4096 bytes, binmode 1.
|
||||
The module now actually uses the php.ini settings.
|
||||
- New PostgreSQL functions: pg_fetch_row(), pg_fetch_array()
|
||||
and pg_fetch_object()
|
||||
- Fix a segmentation fault when calling invalid functions in certain
|
||||
circumstances
|
||||
- Fix bug that caused link-related functions to not pay attention to
|
||||
run-time safe mode setting (it was using whatever was set at compile time).
|
||||
- Fix bug in exec() function when used in safe mode
|
||||
|
||||
June 6 1998 Version 3.0
|
||||
- Add checkdnsrr function (check availability DNS records)
|
||||
- Add getmxrr function (get MX hostnames and weights)
|
||||
- Fixed bug in nl2br() function
|
||||
- Fix for an RC5 related problem in the Sybase module, when dealing
|
||||
with very long data types.
|
||||
- Speed up string concatenation by roughly a factor of 2
|
||||
- Add escape-handling to date function
|
||||
- Make base64 functions binary safe
|
||||
- Add strrpos function to complement strpos function added in RC5
|
||||
- Add ltrim function (strips only at the start of string)
|
||||
- Add rtrim as an alias to chop() for completeness sake
|
||||
- Add trim function (similar to chop, except it strips at the start as well)
|
||||
- Added 2 optional args to fsockopen function - errno and errstr
|
||||
- Fixed bug in split() function related to leading matches
|
||||
- Fixed problem in error_log() function (thanks to Jan Legenhausen)
|
||||
- empty("0") was returning true - fixed
|
||||
- Removed the old sybsql module. Use the new sybase_*() functions instead.
|
||||
- Several fixes to the configuration file parser
|
||||
- LDAP fixes - fixed return values on several functions
|
||||
|
||||
May 23 1998 Version 3.0RC5
|
||||
- The BC math library functions now compile in by default.
|
||||
- Fixed a bug in virtual() and other types of SSI's (e.g. <!--#exec). Under
|
||||
certain circumstances, this used to result in random problems.
|
||||
- Fixed a bug in virtual(). It was misbehaving if it was called before any
|
||||
other output.
|
||||
- Added mysql.default_port, mysql.default_host, mysql.default_user and
|
||||
mysql.default_password ini-file directives.
|
||||
- Improved handling of the MySQL default port. It now honors /etc/services
|
||||
and $MYSQL_TCP_PORT.
|
||||
- Fixed a crash in opening of broken ftp:// URLs, and improved error reporting
|
||||
in opening of URLs.
|
||||
- Fixed several non-critical scanner issues with syntax highlighting mode and
|
||||
the <script language=php> tag.
|
||||
- Fixed fseek on windows. (windows only): fseek will not return proper results
|
||||
on files opened as text mode. PHP uses binary mode as the default for file
|
||||
operations, but this can be overiden by fopen. Do not open files in text
|
||||
mode and use fseek on them!
|
||||
- Add strpos() function
|
||||
- Added zlib module, requires zlib >= 1.0.9
|
||||
- Improved the module API implementation. Dynamic modules may now register
|
||||
persistent resources (not that it makes much sense, but at least PHP
|
||||
won't crash). The API itself remains unchanged.
|
||||
- bcmod() wasn't always behaving like modulus should behave (it was behaving
|
||||
exactly like GNU bc's % operator). Fixed.
|
||||
- Changed the Sybase-DB module to always return strings, instead of auto-typing
|
||||
result sets. This was done for consistency with the other database modules,
|
||||
and in order to avoid overflows due to the platform-dependant limitations
|
||||
of the numeric data types of PHP. You can turn compatability mode on using
|
||||
the sybase.compatability_mode directive in the php3.ini file.
|
||||
- Fixed problems with the TINYINT field in the Sybase-CT module.
|
||||
- Applied some small speed optimizations to the Sybase-DB module querying code.
|
||||
- Added 'numeric' and 'type' properties to the object returned by
|
||||
sybase_fetch_field().
|
||||
- The 'new' operator doesn't accept all expressions anymore. Instead, it
|
||||
accepts a class name, or a variable reference (scalar, array element, etc).
|
||||
- Add ora_numcols() function
|
||||
- Add ora_do() and ora_fetch_into() functions to Oracle driver
|
||||
- Add persistent connection support to Oracle driver
|
||||
- Make Oracle driver clean up open connections and open cursors automatically
|
||||
- Added fread() and fwrite() that properly handle binary data.
|
||||
- Add Ora_ColumnSize() to Oracle code
|
||||
- The string "0" means FALSE again. This was done in order to maintain type
|
||||
conversion consistency.
|
||||
- Added solid_fetch_prev() for fetching the previous result row from Solid.
|
||||
- Huge integers are now automatically converted to floating point numbers
|
||||
(that have a wider range).
|
||||
- Floating point numbers are now displayed using scientific notation when
|
||||
they're extremely big or extremely small. The 'precision' php3.ini directive
|
||||
no longer designates the number of decimal digits, but rather, the maximum
|
||||
number of significant digits required.
|
||||
- Added support for scientific notation for floating point numbers (e.g. 1E7)
|
||||
throughout the entire language.
|
||||
- Fixed a potential/probable memory corruption problem with HEAD request
|
||||
handling.
|
||||
- Using un-encapsulated strings now generates a NOTICE-level warning
|
||||
(e.g. $a = foo; instead of $a = "foo";)
|
||||
- Added defined("name") function to check if a certain constant is defined
|
||||
or not.
|
||||
- Support new Apache mechanism for setting SERVER_SUBVERSION
|
||||
- Added PHP_OS and PHP_VERSION constants
|
||||
- Added the ability to define constants in runtime! Constants are script-wide,
|
||||
(there's no scope, once the constant is defined, it's valid everywhere).
|
||||
Syntax is define("name", $value [, $case_insensitive]). 'name' can be any name
|
||||
that is a valid variable name, *without* the $ prefix. 'value' can be
|
||||
any *scalar* value. If the optional 'case_insensitive' parameter is 1,
|
||||
then the constant is created case-insensitive (the default is case
|
||||
sensitive). Note: define() is currently *NOT* supported in preprocessed
|
||||
scripts.
|
||||
- Added general support for constants. The Syslog constants (e.g.
|
||||
LOG_ERR, LOG_CRIT, etc.) should be accessed as constants from now on (that
|
||||
is, without a $ prefix). You can still set define_syslog_variables to On
|
||||
in the php3.ini file if you want to define the various $ variables. The
|
||||
default for this directive in the php3.ini-dist file has been changed to
|
||||
Off.
|
||||
- The configuration file path variable now expands . and .. into their
|
||||
respective directories. You can obtain the path of the php3.ini file
|
||||
that was used by printing get_cfg_var("cfg_file_path").
|
||||
- Fixed a crash-recovery parser crash ($a=7; $a[3]+=5;)
|
||||
- Add gmmktime() function
|
||||
- Fixed a crash with implode() and empty arrays.
|
||||
- Fixed a bug that, under fairly rare circumstances, caused PHP not to
|
||||
recognize if(), require() and other statements as statements, and
|
||||
to complain about them as being unsupported functions.
|
||||
- Beautified php3.ini-dist and added more comments to it. Also changed
|
||||
the behavior of the configuration file parser to be brighter about
|
||||
the various constants (TRUE/FALSE/ON/OFF etc).
|
||||
- Fixed a bug in openlog() - the specified device name was being mangled.
|
||||
- Memory leaks were sometimes reported erroneously - fixed.
|
||||
- Improved the convertor to handle some quirks of the PHP/FI 2 parser with
|
||||
comments.
|
||||
- Fixed number_format() to properly handle negative numbers, and optimized it
|
||||
a bit.
|
||||
- Fixed static variables inside class member functions. Note that using such
|
||||
static variables inside member functions usually defeats the purpose of
|
||||
objects, so it is not recommended.
|
||||
- Fixed a bug in fpassthru() (the file was being closed twice).
|
||||
- Added strftime().
|
||||
- Add set_socket_blocking() function to control blocking on socket fd's
|
||||
- The sendmail_path in php3.ini was being ignored - fixed.
|
||||
- Fixed a bug with file upload, with files that contained the MIME boundary
|
||||
inside them.
|
||||
- Fixed a bug with form variables of type array, with spaces in their
|
||||
index (e.g. name="foo[bar bar]").
|
||||
- gd-1.3 autodetect and support
|
||||
- Year 2000 compliance is now togglable from the php3.ini file. Setting PHP
|
||||
to be y2k compliant effects the way it creates cookies, and means it'll
|
||||
NOT work with many browsers out there that are not y2k compliant! For
|
||||
that reason, the default for this option is off.
|
||||
- safe mode / fix from monti@vesatec.com
|
||||
- Integrated the FreeType support in the GD extension.
|
||||
- Added --with-gd=DIR and --without-gd options to configure
|
||||
|
||||
April 18 1998 Version 3.0 Release Candidate 4
|
||||
- Auto-prepended and auto-appended files were reporting the wrong filename
|
||||
in errors and in __FILE__ - fixed.
|
||||
- Fix GPC problem related to mixed scalar and array vars with the same name
|
||||
- Made putenv() Apache-safe. Environment variables may no longer leak in
|
||||
between requests.
|
||||
- The trailing semicolon is no longer required in class declarations.
|
||||
- Fixed a memory leak in the (array) and (object) operators under certain
|
||||
conditions.
|
||||
- <script> tags weren't working unless short tags were enabled - Fixed.
|
||||
- Fixed a bug in certain array indices that weren't treated as numbers
|
||||
even though they looked like numbers (e.g. "10", "20").
|
||||
- Changes to support renamed API functions in Apache-1.3
|
||||
- Fixed the -p and -e command line switches
|
||||
- Fix a segfault when calling command line version without parameters
|
||||
- Fix for feof() when used on a socket
|
||||
- Fix off-by-one error in fgets() when used on a socket
|
||||
- Fix bug in ImageSetPixel() (Thanks to ecain@Phosphor.net)
|
||||
|
||||
March 31 1998 Version 3.0 Release Candidate 3
|
||||
- Tiny bugfix for magic_quotes_sybase
|
||||
- Fix Apache build problems introduced in RC2
|
||||
- $a["0"]==$a[0] fix
|
||||
- Apache-1.3 build changes to support 100% automatic builds and shared library
|
||||
module builds. See INSTALL file.
|
||||
|
||||
March 30 1998 Version 3.0 Release Candidate 2
|
||||
- Changed the socket implementation under UNIX to not use FILE pointers, in
|
||||
order to work around the buggy Solaris libc (and possibly buggy libc's
|
||||
in other platforms).
|
||||
- Fixed a bug in min() and max() with certain arrays.
|
||||
- *WARNING* Move Apache 1.3 php3 file install to src/modules/php4 instead of
|
||||
src/modules/extra. Make sure you change your AddModule line correctly
|
||||
in your Apache Configuration file. This change is to take advantage of
|
||||
new Apache-1.3 configuration mechanism which makes it easier to build an
|
||||
Apache server with PHP automatically enabled. It will also help building
|
||||
a shared library module version of PHP soon.
|
||||
- Fixed a crash bug with auto-appended files.
|
||||
- Made --enable-discard-path work on all Unix servers #!/path/php CGI scripts
|
||||
should now work everywhere. I have tested on Apache, WN and Netscape 2.0
|
||||
- Made $a["123"] and $a[123] be identical. $a["0123"] is still different,
|
||||
though.
|
||||
- Added 'precision' ini directive, to set the number of decimal digits
|
||||
displayed for floating point numbers (default - 6).
|
||||
- Made integer/integer divisions evaluate to floating point numbers when
|
||||
applicable (e.g., 5/2==2.5(float), but 4/2==2(int))
|
||||
- Get rid of reliance on tied streams and move all socket reads and writes
|
||||
to recv/send calls
|
||||
- Cleaned up head.c a bit and fixed CGI SetCookie order problem
|
||||
- Changed default variable parsing order to Get-Cookie-Post (GPC)
|
||||
- Fixed setup so it has all configure options and defaults.
|
||||
- Added optional decimal point and thousands seperator to number_format()
|
||||
e.g., number_format(1500,2,',','.') == 1.500,00
|
||||
- Fixed cgi bug in windows that prevented files from being parsed on many
|
||||
systems and servers.
|
||||
|
||||
March 23 1998 Version 3.0 Release Candidate
|
||||
- Added support for the Raima database (ALPHA)
|
||||
- Fixed a bug in persistent PostgreSQL links and the connection-string method.
|
||||
- Added EXTENSION_STATUS file, that specifies the stability and status of
|
||||
every module in the distribution.
|
||||
- Added optional parameters to user functions with default values, variables
|
||||
that are forced to be passed by reference and variables that can be
|
||||
optionally passed by reference. The ini file directive
|
||||
'ignore_missing_userfunc_args' is no longer supported.
|
||||
- Added fhttpd support (by Alex Belits)
|
||||
- Improved performance by approximately 20-30%.
|
||||
- Added mysql_error(), mysql_errno() (if available) and msql_error().
|
||||
Errors coming back from the database backend no longer issue warnings.
|
||||
Instead, use these functions to retreive the error.
|
||||
- Patched count(), each(), prev(), next(), reset() and end() to work around
|
||||
the implementation side effects of unset(). As far as the users are
|
||||
concerned, this should be transparent now (even though it's slower now,
|
||||
until it's thoroughly fixed in 3.1).
|
||||
- Added number_format(). number_format(2499,2)=='2,499.00'.
|
||||
- error_reporting() now sets the error reporting level to the supplied
|
||||
argument, without any interpretations.
|
||||
- Fixed a lookahead parser bug that occured under rare circumstances.
|
||||
- Change the comparison operators to compare numeric strings as numbers. If
|
||||
you want to compare them as strings, you can use the new C-like strcmp()
|
||||
- Fixed Ora_GetColumn() bug when fetching strings
|
||||
- Added Ora_ColumnName() and Ora_ColumnType()
|
||||
- Preliminary LONG and LONG RAW support in Oracle extension
|
||||
- Add \123 and \xAB style octal and hex escapes to "" and `` strings
|
||||
- Add "-c" command line flag for specifying path to php3.ini file
|
||||
- Improved list() so that elements can be skipped, for example:
|
||||
list($name,,,$realname) = explode(":",fgets($passwd_file));
|
||||
- Fixed a tiny bug in the hash initialization which caused excessive use of
|
||||
memory. Report and fix by short@k332.feld.cvut.cz
|
||||
- Fixed strtolower() and strtoupper() to work with 8-bit chars
|
||||
- Fixed to compile and run on SunOS 4.1
|
||||
- Fixed a crash in soundex() of an empty string
|
||||
- Fixed parse_str() - it wasn't always defining the right variables,
|
||||
and didn't work with arrays.
|
||||
- Made [m,My]SQL create/drop database functions return success status
|
||||
- Fixed some memory leak/crash problems in the Adabas module
|
||||
- Added each() in order to allow for easy and correct array traversing.
|
||||
- Make Apache module version respect LOCALE setting
|
||||
- Add support for Apache 1.3b6+ ap_config.h file
|
||||
- Fixed a nasty corruption bug in eval() and show_source() that resulted in
|
||||
script termination (e.g. eval("exit();").
|
||||
- Fixed a syntax highlighting problem with keywords used as variable
|
||||
names.
|
||||
- Fixed a possible crash and/or file descriptor leak
|
||||
- Fixed line number being off by one in #! shell style execution
|
||||
- Made it possible to disable auto_prepend/append with "none" filename
|
||||
- Allow safe CGI calling through #!php style scripts
|
||||
|
||||
March 2 1998 Version 3.0b6
|
||||
- Made [s]printf handle %ld
|
||||
- Changed CGI version to only open regular files as input script
|
||||
- Added ignore_missing_userfunc_args directive to suppress warnings messages
|
||||
about missing arguments to user-defined functions
|
||||
- Added Postgres function - pg_cmdtuples(), by Vladimir Litovka
|
||||
- Disabled command line options if used as CGI
|
||||
- Changed CGI version to use PATH_TRANSLATED as the script file name
|
||||
- Link with solid shared library instead of static one
|
||||
- Fixed a crash with functions that aren't being called correctly
|
||||
- Fixed file descriptor leak in auto-prepend/append
|
||||
- Imap module is usable. See README in dl/imap.
|
||||
|
||||
February 24 1998 Version 3.0b5
|
||||
- Made the URL aware file functions be enabled by default
|
||||
- Fixed an unlikely crash bug in the parser, with uninitialized array elements
|
||||
which are refered to as objects.
|
||||
- Fixed several fields that were being incorrectly read in Sybase CT.
|
||||
- Fix Apache-1.3 related SIGHUP problem which was preventing php3.ini from
|
||||
getting re-read on a SIGHUP
|
||||
- *** WARNING *** Downwards incompatible change: The plus operator (+) is not
|
||||
longer overloaded as concatenation for strings. Instead, it converts its
|
||||
arguments to numbers and performs numeric addition.
|
||||
- Add Stig and Tin's bdf2gdfont script to extra/gd directory
|
||||
- Added join() as an alias to implode()
|
||||
- Made implode() accept arguments in the order used by explode() as well
|
||||
- Made $php_errormsg local in function calls
|
||||
- Fixed Apache configuration directive bugs
|
||||
- Added a number of .ini directives to Apache .conf directive list
|
||||
- Fixed a 'memory leak' with strtok()
|
||||
- echo/print now handle binary data correctly.
|
||||
- NEW now accepts any expression for the class name argument.
|
||||
- Add ImageDashedLine() GD function
|
||||
- Add arg_separator .ini directive so the '&' GET method separator can be
|
||||
changed to ';' for example. Corresponding php3_arg_separator Apache .conf
|
||||
directive works as well.
|
||||
- Walked around an implementation side effect of switch(). <? switch(expr) { ?>
|
||||
now works.
|
||||
- Added memory caching, resulting in a significant performance boost
|
||||
- Added support for for(): .. endfor; loops
|
||||
- Added a new predicate - empty($var). Returns true if $var is not set,
|
||||
or is FALSE. Returns false otherwise.
|
||||
- Added is_integer() (same as is_long()) and is_real() (same as is_double()).
|
||||
- Added sizeof() as an alias to the count() function
|
||||
- Added --enable-force-cgi-redirect, to prevent the CGI from working if
|
||||
someone directly accesses PHP not through Apache's CGI redirect
|
||||
(off by default).
|
||||
- Fixed marking of deleted dBase records. Noticed by Simon Gornall
|
||||
<simon@oyster.co.uk>.
|
||||
- Fixed fixed "%%" bug in [s]printf
|
||||
- Fixed a UMR (initialized memory read) in the Oracle code
|
||||
- Potential fix for mysql-related SIGPIPE problem which caused httpd to spin
|
||||
- Made PHP responsive to the Apache link status (stop executing if the link
|
||||
dies).
|
||||
- Fixed a crash bug with StrongHold and secure pages
|
||||
- Fixed StrongHold installation
|
||||
- Optimized the function call sequence a bit.
|
||||
- Fixed Sybase/CT date/datetime/money fields work to correctly.
|
||||
- Fixed Apache module startup problems - php3_module_startup should only be
|
||||
called once.
|
||||
- Fixed ord() with characters >127
|
||||
- Fixed bug in file_exists() function
|
||||
- Fixed stripslashes() to remove the escaping quote (instead of backslash)
|
||||
in case magic_quotes_sybase is true.
|
||||
- Also make echo and print automatically remove trailing decimal zeros.
|
||||
- Added htmlentities(), currently handling only ISO-8859-1 entities
|
||||
- "0" is no longer considered false, the only string which is false is the
|
||||
empty string "".
|
||||
- Added 'true' and 'false' keywords
|
||||
- Added 'xor' (logical exclusive or)
|
||||
- Automatic conversion from double to string removes decimal trailing zeros.
|
||||
- Added arsort() and rsort() to sort in descending order.
|
||||
- Turned on "XLATOPT_NOCNV" by default for uODBC/Solid.
|
||||
- Added support for a port number in the mysql_(p)connect() functions
|
||||
- Fixed a file descriptor leak in the configuration parser.
|
||||
- Fixed a few buglets with syntax highlighting with certain language keywords
|
||||
- Added functions to control minimum severity level of Sybase messages to
|
||||
display.
|
||||
- Added highlight_string() - behaves like highlight_file(), only instead
|
||||
of highlighting a file, it syntax highlights the contents of its
|
||||
argument.
|
||||
- Renamed show_source() to highlight_file(). show_source() is still
|
||||
supported for downwards compatability.
|
||||
- Fixed a bug in class inheritence - member functions with upper case
|
||||
letters in their names couldn't be redefined.
|
||||
- Made chown(), chgrp() and chmod() return TRUE/FALSE instead of 0/-1.
|
||||
|
||||
February 02 1998 Version 3.0b4
|
||||
- Fixed a segfault bug in one of the unified ODBC error messages.
|
||||
- Set default file modes to binary on Win32 (solved a lot of bs)
|
||||
- Fixed file copy on Win32
|
||||
- MIME file uploads fixed on Win32
|
||||
- Added contributed icons by Colin Viebrock (undex extra/icons)
|
||||
- Fixed the debugger enough to call it "beta code".
|
||||
- Fixed some leaks in the Oracle module, tidied up the code a bit.
|
||||
- Added __FILE__ and __LINE__ which evaluate to the currently parsed file
|
||||
and currently parsed line respectively.
|
||||
- Added ImageColorAt(), ImageColorSet(), ImageColorsForIndex(), and
|
||||
ImageColorsTotal() to allow manipulating the palette of GIF images.
|
||||
- Rename '--enable-url-includes' option to '--enable-url-fopen-wrapper' to
|
||||
better describe what it does, and pay attention to the setting.
|
||||
- Added optional parameter to the file(), readfile() and fopen() functions
|
||||
to look for files located in the include path.
|
||||
- Fixed bug that allowed the file() and readfile() to open files in the
|
||||
include path inadvertantly.
|
||||
- Fixed a (documented) bug in printf()/sprintf() with hard limited strings
|
||||
and alignment (e.g. %-.20s).
|
||||
- Optimized several quoted string routines.
|
||||
- Added error_log ini directive to select where errors get logged when
|
||||
log_errors is turned on or the error_log() function is used.
|
||||
- Added the ability to direct errors to log files instead of or in addition
|
||||
to the script output. Use the new display_errors and log_errors
|
||||
php3.ini directives.
|
||||
- Made environment variables uneraseable by POST/GET/Cookie variables.
|
||||
- Fixed a bug in the elseif() construct. The expression was being evaluated
|
||||
even if a previous if/elseif already evaluated to true and got executed.
|
||||
- Fixed a bug in the exit code parameter of system()
|
||||
- Tighten up all exec() related functions in safe mode
|
||||
- Added error_log() function to log messages to the server error log, or
|
||||
stderr for the CGI version.
|
||||
- Added support for a general memory limit of scripts.
|
||||
- Fixed a segfault bug that occured under certain circumstances with shell
|
||||
escapes ($foo = `...`)
|
||||
- Made keywords be valid property names of objects.
|
||||
- Fixed a segfault bug when creating new objects of an unknown class.
|
||||
- Fixed a problem with the maximum execution time limit, that may have
|
||||
prevented this feature from working on certain platforms.
|
||||
- PHP would now warn you with E_NOTICE about unknown escape characters,
|
||||
e.g. "\f". It would still be considered as a backslash followed by f,
|
||||
but the proper way of writing this is "\\f" or '\f'.
|
||||
- Added support for ${...} inside encapsulated strings. Supported: ${foo},
|
||||
${foo[bar]}, ${foo[0]}, ${$foo[$bar]}, ${$foo->bar} and ${$foo}
|
||||
- Fixed a bug in automatic persistent link reconnect of the Sybase/DB module.
|
||||
Thanks to Steve Willer for finding that 'stealth' bug!
|
||||
- Fixed a crash bug in the GET/POST/Cookie parser in case of regular
|
||||
and array variables with the same name.
|
||||
- Added round() function.
|
||||
- Can't use encapsed strings as variable names anymore, ie. $"blah blah".
|
||||
- Fixed bug in gethostby*() functions that resulted in a core dump.
|
||||
(Noticed by torben@coastnet.com.)
|
||||
- Fixed bug in dbase_get_record that prevented number and date fields
|
||||
from being properly decoded. (Thanks again to colins@infofind.com.)
|
||||
- Make dbase_get_record include a 'deleted' field that indicates whether
|
||||
that record had been marked for deletion.
|
||||
- Fixed bug in dbase library that stomped on the deleted flag of the first
|
||||
record in the file if it was set. (Thanks to colins@infofind.com.)
|
||||
- Fixed putenv() to not report a memory leak and possibly prevent a bug
|
||||
from that memory being freed.
|
||||
- Added setlocale()
|
||||
- Added pg_fieldisnull() (by Stephan Duehr)
|
||||
- Changed pg_exec() to always return a result identifier on succees
|
||||
- Solid linking fixes (tries to find the right library)
|
||||
- Fixed a but with date() and the 'w' element.
|
||||
- Tried to eliminate unimportant memory leak notifications.
|
||||
- Made min() and max() backwards compatible and able to handle doubles.
|
||||
- Add fgetc() function
|
||||
- Fixed bug in getmyuid(), getmyinode() and getlastmod(). Thanks to
|
||||
khim@sch57.msk.ru for pointing this out.
|
||||
- Fixed http:// URL includes with no path specified send request for /.
|
||||
- Added GetAllHeaders() (Apache-only)
|
||||
- Added workaround that made the Image text functions 8-bit clean
|
||||
- Made snmp internally compilable for Win32 (not the unix one though),
|
||||
only adds 2k to binary size, so no reason not to have it there.
|
||||
- Fixed ldap loading on Win32
|
||||
- Fixed MySQL Info function on Win32 platform
|
||||
- Fixed compilation of syntax highlighting mode
|
||||
|
||||
January 17 1998 Version 3.0b3
|
||||
- Added mysql support under windows ;) happy happy joy joy
|
||||
- Fixed dbase.dll for Win32 to actualy load now.
|
||||
- Enhanced the convertor to recognize ?> as a php-close-block as well.
|
||||
- Fixed potential SetCookie() core dumps
|
||||
- Changed print to be an expression instead of a statement. That means you can
|
||||
now do stuff like foobar() or print("Unable to foobar!"). echo has NOT been
|
||||
changed.
|
||||
- Removed the flex optimization flags to reduce the size of the scanner
|
||||
- Added memory leak logging into apache log files (apache module only)
|
||||
- Fixed a nasty bug in one of the internal stacks. This may have caused
|
||||
random crashes in several occassions.
|
||||
- Fixed bug in ImageGif() making it hang sometimes
|
||||
- Added ImageLoadFont(), ImageFontWidth() and ImageFontHeight()
|
||||
- error_reporting() now returns the old error reporting level
|
||||
- Fixed url includes/opens not working under Win32
|
||||
- Fixed errorneous handling of multipart/form-data input
|
||||
- Added rawurlencode(), rawurldecode() and changed urlencode() and urldecode()
|
||||
a bit too.
|
||||
- Fixed a bug in [s]printf, sign was forgotten for doubles.
|
||||
- Fixed a segfault bug in pg_fieldprtlen(), and made it accept field names
|
||||
in addition to field offsets.
|
||||
- Made the setup script a little more user-friendly.
|
||||
- Added is_long(), is_double(), is_string(), is_array() and is_object()
|
||||
- Fixed a bug in freeing of mSQL results.
|
||||
- Improved pg_exec() to properly return true or false with queries that don't
|
||||
return rows (i.e. insert, update, create, etc)
|
||||
- Added get_cfg_var() to enable checking cfg file directives from within
|
||||
a script.
|
||||
- Fixed a bug with urlencode() and characters 0x80-0xff
|
||||
- Changed the behaviour of ereg_replace to more intuitive. The
|
||||
backslashes other than valid existing back references in the second
|
||||
argument are no more evaluated as escape sequences.
|
||||
- Fixed a bug in the configuration file loader and safe mode.
|
||||
- Fixed a bug with configuration variables taken from the environment.
|
||||
- Added <script language=php> </script> as PHP open/close tags, to allow
|
||||
the use of editors such as Microsoft Frontpage.
|
||||
- Fixed a bug in the default php3.ini directory - it wasn't defaulting to
|
||||
/usr/local/lib properly.
|
||||
- Added support for \r\n line endings
|
||||
- Fixed a bug that may have prevented POST method variables from working
|
||||
with certain scripts when using the CGI version.
|
||||
- Convertor: Added support for single-quoted strings
|
||||
- Fixed segfault bug in the Adabas module, with queries that don't return
|
||||
rows (update, insert, etc).
|
||||
|
||||
December 22 1997 Version 3.0b2
|
||||
- Changed variable type conversions that do not specify base to always use
|
||||
base 10. "010" is no more 8, it is 10. Use intval ($x, 0) to get C-style
|
||||
octal and hex numbers recognized.
|
||||
- Fixed a possible segfault bug in several functions, when using the concat
|
||||
operator and possibly other operators/functions.
|
||||
- # is no longer accepted as a comment in php3.ini. Use ; instead.
|
||||
- Added browscap support
|
||||
- Configuration file directives are now case-sensitive
|
||||
- Fixed msql_tablename() and msql_dbname()
|
||||
- Added a PHP/FI 2.0 -> PHP 3.0 convertor
|
||||
- Added support for shell/perl-style single quotes
|
||||
- Added support for execution of external programs using backquotes ($a=`ls -l`)
|
||||
- fixed mail() on windows, also fixed memory leaks in mail on windows
|
||||
- added sendmail_from to handle return route on windows
|
||||
- Changed the way the config file is searched. The file name is now
|
||||
php3.ini (hardcoded), and it'll be looked for in: local directory, $PHPRC
|
||||
and builtin path designated by ./configure under UNIX or Windows directory
|
||||
under Windows.
|
||||
- Fixed ereg_replace replacing empty matches and a one off buffer overflow
|
||||
- Fixed File upload on windows platform
|
||||
- Fixed a bug that caused 'HTTP/1.1 100 Continue' messages with
|
||||
Internet Explorer 4.0 and certain scripts that receive POST variables
|
||||
- Get/POST/Cookie data variables are from now *ALWAYS* strings. If you want
|
||||
to use them in integer/real context, you must explicitly change their types.
|
||||
This was done in order to avoid possible loss of data when doing these
|
||||
conversions automatically.
|
||||
- Variables named as keywords are now allowed (e.g. $function, $class, etc)
|
||||
- Fixed a problem with msql() and mysql() with NULL fields
|
||||
- Fixed a segfault bug with class declarations
|
||||
- Fixed bugs with FOR loops and include() from within eval()
|
||||
- Changed include() to be executed conditionally. PHP-3.0 efficient
|
||||
unconditional include is now require()
|
||||
|
||||
December 08 1997 Version 3.0b1
|
||||
- Switched to public beta test phase
|
||||
- Generalized unset() and isset() to work on any type of variables, including
|
||||
specific array indices or object properties (e.g., unset($a[4]) now works).
|
||||
- Added support for object references inside encapsulated strings
|
||||
(for example, 'echo "Username: $user->name"' now works)
|
||||
- Added arbitary precision math support (basic operations with
|
||||
unlimited range numbers, and support for unlimited decimal digits)
|
||||
- Apache module can now handle preprocessed scripts (by using:
|
||||
AddType application/x-httpd-php3-preprocessed .php3p
|
||||
in the Apache configuration)
|
||||
- Made settype() pass its first parameter by value. Improved it to be able
|
||||
to convert to arrays and objects (originally by Steve Willer)
|
||||
- Implemented CPU time limit on scripts when setitimer() is available
|
||||
- Computed field names in the Sybase/CT and Sybase/DB modules are now named
|
||||
computed, computed1, computed2, ...
|
||||
- Added Sybase/CT client/server message handlers and updated the Sybase/DB ones
|
||||
- Made the regexp function automatically take arguments by reference
|
||||
when necessary
|
||||
- Added builtin support for auto append and prepend in the parser level
|
||||
- Improved the Sybase/CT sybase_query(). Should be more stable now, and
|
||||
hopefully work with a wider range of queries. It's difficult to work
|
||||
without docs, though, so it may still not be 100% right...
|
||||
- Changed error messages to show error type, file and line with bold
|
||||
- Added support for autoprepend and autoprepend
|
||||
- Added some more warning flags if gcc is used
|
||||
|
||||
December 03 1997 Version 3.0a4
|
||||
- Improved the internal functions API - no need to explicitly pass
|
||||
parameters by reference to internal functions that specifically
|
||||
require them, e.g. sort(), ksort(), reset(), count(), etc.
|
||||
This is *STILL* downwards compatible with the previous alphas,
|
||||
in the sense that you can explicitly pass the arguments by reference
|
||||
if you want to.
|
||||
- use srandom/random instead of srand/rand if available
|
||||
- Added [m,My]sql_listfields() for downwards compatability
|
||||
- -p now replaces .php3 extension with .php3p (otherwise it adds .php3p)
|
||||
- Added C++ style comments (// comment)
|
||||
- Fixed # commenting to terminate at a close PHP tag
|
||||
- Added \0 back reference for full string match to *reg*_replace and
|
||||
added backslash escaping to replace string
|
||||
- Fixed a few bugs in the Sybase DB-library module.
|
||||
- Added Sybase CT-library support. It should be considered experimental.
|
||||
Syntax is identical to the one of the DB-library. Allows people to
|
||||
connect to MS-SQL servers from Linux without having to pay for a
|
||||
library!
|
||||
- Beautified phpinfo()
|
||||
- Add ImageColorClosest() and ImageColorExact() GD functions
|
||||
- Make all .ini directives work as Apache .conf directives as well
|
||||
- Added PHP2-like File() function with PHP3 URL support
|
||||
- Upgraded the Sybase interface. It's practically MySQL compatible now!
|
||||
Among other things, added sybase_fetch_array() and sybase_fetch_object().
|
||||
- Fixed problem in multi dimensional array handling and self modifying
|
||||
operators (+=, -=, etc).
|
||||
- Safe Mode file open implementation
|
||||
- SVR3 portability problem fix
|
||||
|
||||
November 23 1997 Version 3.0a3
|
||||
- Made the global statement behave like PHP 2 with undefined variables
|
||||
- Added msql_fetch_object() and msql_fetch_array()
|
||||
- Switched between the 1st and 2nd parameters to explode(), so that it acts
|
||||
like split()
|
||||
- Fixed passthru(), exec() and system() functions
|
||||
- Implemented second optional parameter to intval() to specify conversion base
|
||||
(The default is to assume you want to do a base 10 conversion.)
|
||||
- Implemented SQL safe mode for MySQL
|
||||
- Read UploadTmpDir from php3.ini instead of apache conf files
|
||||
- Added mysql_fetch_object() and mysql_fetch_array()
|
||||
- Changed function->old_function. function is now an alias to cfunction.
|
||||
- Split the magic_quotes directive to get/post/data and other
|
||||
- Added generic copy() function
|
||||
- Added a $GLOBALS[] array, which contains all global variables
|
||||
- Fix broken getimagesize() function
|
||||
- Made mysql_fetch_field() and msql_fetch_field() optionally accept a 2nd argument
|
||||
- Fixed mysql_data_seek() and msql_data_seek()
|
||||
- Changed list assignment to list(...) and array init to array(...)
|
||||
- Made <?php_track_vars?> work
|
||||
- cgi when not in debug mode uses regular malloc(), free() functions now
|
||||
- Added preliminary support for perl-style list assignments
|
||||
- Fixed a bug in mysql_result() and msql_result() when specifying table
|
||||
- renamed internal error-handling function and levels
|
||||
- Added basename and dirname functions similar to sh counterparts
|
||||
- Added base64_encode() and base64_decode()
|
||||
- Support Basic authorization for http url includes
|
||||
- Added parse_url() function to extract url components
|
||||
- Made it possible to use anonymous ftp on URL includes
|
||||
- Fixed url includes to handle different URLs better
|
||||
- Fixed mysql_field*() functions
|
||||
- Made mysql_connect() smarter, after a mysql_close() (applies to msql and pgsql too)
|
||||
|
||||
November 6 1997 Version 3.0a2
|
||||
- Fixed a segfault bug caused by non-persistent connect in [m,My,Postgres]SQL modules
|
||||
- Fix command line argument handling
|
||||
- Made empty array list assignments work ($a=({});)
|
||||
- Made '$' escaping optional when a variable name parsing isn't possible
|
||||
- Added support for mysql_[p]connect(host) and mysql_[p]connect(host,user)
|
||||
- New layout in phpinfo()
|
||||
- Update Oracle extension to use php3_list functions
|
||||
- Add includepath support
|
||||
- Add #!php shell script escape support
|
||||
- Change name of CGI/command line version from php3.cgi to php
|
||||
- Add SNMP extension
|
||||
- show_source() support
|
||||
- Parsing of command-line args for CGI version
|
||||
- Support for backreferences in ereg_replace
|
||||
- Support for hexadecimal numbers directly at the scanner level
|
||||
- Support octal numbers directly at the scanner level
|
||||
- Fixed problem with huge html files (with little or no php code)
|
||||
- Fix eval() empty string argument core dump
|
||||
- renamed 'install' to 'setup' to be more accurate and avoid name conflict
|
||||
- Fixed Oracle compilation
|
||||
- Fixed mSQL 1.0 compilation
|
||||
- Fixed a problem in the mSQL, MySQL and PostgresSQL drivers and NULL fields.
|
||||
- Fixed the GLOBAL statement to be able to declare an array.
|
||||
|
||||
October 29 1997 Version 3.0a1
|
||||
- Start with excellent new parser from Andi and Zeev
|
||||
@@ -0,0 +1,75 @@
|
||||
|
||||
|
||||
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 <mka@satama.com>
|
||||
- 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
|
||||
|
||||
|
||||
-473
@@ -1,473 +0,0 @@
|
||||
List of PHP maintainers
|
||||
=======================
|
||||
|
||||
Maintenance 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.
|
||||
Unknown: Not known at this time.
|
||||
|
||||
Status legend
|
||||
-------------
|
||||
Working: Working under both Windows and Unix.
|
||||
Windows: Working only under Windows.
|
||||
Unix: Working only under Unix.
|
||||
Experimental: Under development or initial release.
|
||||
Not Working: Not working.
|
||||
Unknown: Status unknown.
|
||||
|
||||
|
||||
== Server APIs ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: aolserver
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: apache
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: apache2
|
||||
PRIMARY MAINTAINER: Aaron Bannert <aaron@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cgi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: fhttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: isapi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: nsapi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: phttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pi3web
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: roxen
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: servlet
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: thttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: webjames
|
||||
PRIMARY MAINTAINER: Alex Waugh <alex@alexwaugh.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
== Database extensions ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dba
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dbase
|
||||
PRIMARY MAINTAINER: Jim Winstead <jimw@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dbx
|
||||
PRIMARY MAINTAINER: Marc Boeren <M.Boeren@guidance.nl>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.6
|
||||
COMMENT: DB abstraction for odbc, mysql, pgsql, mssql, fbsql and more, see documentation
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: filepro
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: hyperwave
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: informix
|
||||
PRIMARY MAINTAINER: Danny Heijl <Danny.Heijl@cevi.be>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ingres_ii
|
||||
PRIMARY MAINTAINER: David Hénot <henot@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: interbase
|
||||
PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: msql
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: msession
|
||||
PRIMARY MAINTAINER Mark L. Woodward mlwmohawk@mohawksoft.com
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working/Experimental
|
||||
COMMENT: Tested on Linux, should work on other UNIX platforms. Backend server code can compile under Windows.
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mssql
|
||||
PRIMARY MAINTAINER: Frank M. Kromann <fmk@swwwing.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Tested on phpts and isapi versions
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mysql
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pgsql
|
||||
PRIMARY MAINTAINER: Yasuo Ohgaki <yohgaki@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Use PostgreSQL 7.0.x or later. PostgreSQL 6.5.3 or less have fatal bug.
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sybase
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Not Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sybase_ct
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: oci8
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: odbc
|
||||
PRIMARY MAINTAINER: Daniel R. Kalowsky <kalowsky@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Working except for persistent connections
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: oracle
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Using the new OCI8 driver is encouraged where possible.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
== Other extensions ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: aspell
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
COMMENT: For aspell .27 and greater, check out the pspell extension
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: bcmath
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: bz2
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: calendar
|
||||
PRIMARY MAINTAINER: Hartmut Holzgraefe <hartmut@six.de>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: com
|
||||
PRIMARY MAINTAINER: Harald Radi <h.radi@nme.at>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cpdf
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: crack
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.5
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ctype
|
||||
PRIMARY MAINTAINER: Hartmut Holzgraefe <hartmut@six.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: curl
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cybercash
|
||||
PRIMARY MAINTAINER: Evan Klinger <evan715@sirius.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: domxml
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dotnet
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: exif
|
||||
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: fdf
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ftp
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: gd
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: gettext
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: gmp
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: icap
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Obsolete
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: imap
|
||||
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: java
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ldap
|
||||
PRIMARY MAINTAINER: Stig Venaas <venaas@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mbstring
|
||||
PRIMARY MAINTAINER: Rui Hirokawa <hirokawa@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mcal
|
||||
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mcrypt
|
||||
PRIMARY MAINTAINER: Derick Rethans <d.rethans@jdimedia.nl>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mhash
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: muscat
|
||||
PRIMARY MAINTAINER: Sam Liddicott <sam@ananova.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.5
|
||||
COMMENT: Not tested against windows, only core API completed, rest under development
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: openssl
|
||||
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: overload
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pcre
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pdf
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pfpro
|
||||
PRIMARY MAINTAINER: David Croft <david@infotrek.co.uk>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: posix
|
||||
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: printer
|
||||
PRIMARY MAINTAINER: Daniel Beulshausen <daniel@php4win.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.4
|
||||
COMMENT: Only for Win32
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pspell
|
||||
PRIMARY MAINTAINER: Vlad Krupin <phpdevel@echospace.com>
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: qtdom
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: readline
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: recode
|
||||
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sablot
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Obsolete
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: satellite
|
||||
PRIMARY MAINTAINER: David Eriksson <eriksson@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: session
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: shmop
|
||||
PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: snmp
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sockets
|
||||
PRIMARY MAINTAINER: Chris Vandomelen <chrisv@b0rked.dhs.org>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: swf
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Depreciated (Use the ming swf extension instead)
|
||||
COMMENT: Only for Unix (won't change)
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sysvsem
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sysvshm
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: vpopmail
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.5
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: wddx
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xml
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xslt
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANC: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: yaz
|
||||
PRIMARY MAINTAINER: Adam Dickmeiss <adam@indexdata.dk>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: yp
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: zlib
|
||||
PRIMARY MAINTAINER: Stefan Roehrich <sr@linux.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: zziplib
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.5
|
||||
-------------------------------------------------------------------------------
|
||||
# iptc?
|
||||
@@ -0,0 +1,538 @@
|
||||
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
|
||||
|
||||
@@ -1,104 +1,21 @@
|
||||
Installation Instructions for PHP 4
|
||||
-----------------------------------
|
||||
Installation Instructions for PHP 4.0
|
||||
-------------------------------------
|
||||
|
||||
STOP!
|
||||
|
||||
Before going any further, please remember you are going to find more
|
||||
up to date instructions in the online manual, located here:
|
||||
|
||||
http://www.php.net/manual/en/install.apache.php
|
||||
|
||||
It is strongly recommended that you read the manual page before going
|
||||
further. However, for the impatient, here is a quick set of steps that
|
||||
will build PHP as (first) a dynamic Apache module (DSO) for Apache 1.3.x
|
||||
with MySQL support and then a static module. A more verbose explanation follows.
|
||||
|
||||
For installing PHP on other web servers, refer to one of the following
|
||||
files:
|
||||
|
||||
sapi/aolserver/README
|
||||
sapi/pi3web/README
|
||||
sapi/servlet/README
|
||||
sapi/thttpd/README
|
||||
README.Zeus
|
||||
|
||||
Some notes:
|
||||
|
||||
1: Only install either the static module or the dynamic one. Do not
|
||||
install both.
|
||||
|
||||
2: If you are recompiling PHP to add new extensions or upgrading
|
||||
something like GD, remove the config.cache file before you re-run
|
||||
configure.
|
||||
|
||||
3: If you are on Linux and have installed shared libraries, make
|
||||
sure the location of these shared libraries are listed in your
|
||||
/etc/ld.so.conf file. For example, if you have:
|
||||
|
||||
/usr/local/lib/mysql/libmysqlclient.so
|
||||
|
||||
Make sure /etc/ld.so.conf contains:
|
||||
|
||||
/usr/local/lib/mysql
|
||||
|
||||
Then run ldconfig.
|
||||
|
||||
If you want both PHP 3 and 4 modules in the same Apache server, check the
|
||||
bottom of this file for instructions.
|
||||
|
||||
INSTALLATION WITH THE ZEUS WEB SERVER:
|
||||
--Please see the 'README.Zeus' file included in this distribution
|
||||
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 (DSO)
|
||||
|
||||
For this to work your Apache httpd must have mod_so enabled.
|
||||
Check using httpd -l. You should see something like:
|
||||
|
||||
Compiled-in modules:
|
||||
http_core.c
|
||||
mod_so.c
|
||||
|
||||
Chances are you will see a lot more modules than these two. That's ok,
|
||||
as long as mod_so.c shows up you can proceed with the following steps:
|
||||
|
||||
$ gunzip -c php-4.x.y.tar.gz | tar xf -
|
||||
$ cd php-4.x.y
|
||||
$ ./configure --with-mysql --with-apxs
|
||||
$ make
|
||||
$ make install
|
||||
|
||||
If you get an error telling you that the apxs script could not be found,
|
||||
look for it on your system and if you find it, provide the full path to it
|
||||
as: --with-apxs=/path/to/apxs
|
||||
|
||||
Make sure you specify the version of apxs that is actually installed on
|
||||
your system and NOT the one that is in the apache source tarball.
|
||||
|
||||
Next you must copy php.ini-dist to the appropriate place (normally
|
||||
/usr/local/lib/php.ini) and edit it as necessary to set PHP options.
|
||||
|
||||
The only thing left to do is to edit your httpd.conf file and make sure the
|
||||
PHP 4 mime type is there and uncommented. You need a line that looks like
|
||||
this:
|
||||
|
||||
AddType application/x-httpd-php .php
|
||||
|
||||
Then restart your server (apachectl restart) and you should be able to
|
||||
serve up PHP files now. Make a test file called test.php and put some
|
||||
PHP tags in it. Like <?phpinfo()?>, for example.
|
||||
|
||||
|
||||
QUICK INSTALL (Static)
|
||||
QUICK INSTALL
|
||||
|
||||
$ gunzip -c apache_1.3.x.tar.gz | tar xf -
|
||||
$ cd apache_1.3.x
|
||||
$ ./configure
|
||||
$ cd ..
|
||||
|
||||
$ gunzip -c php-4.x.y.tar.gz | tar xf -
|
||||
$ cd php-4.x.y
|
||||
$ ./configure --with-mysql --with-apache=../apache_1.3.x
|
||||
$ 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
|
||||
|
||||
@@ -106,11 +23,10 @@ $ 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 if
|
||||
is is your first install then you need to "make install" as well)
|
||||
$ cd ../php-4.x.y
|
||||
$ cp php.ini-dist /usr/local/lib/php.ini
|
||||
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
|
||||
@@ -118,72 +34,25 @@ Edit your httpd.conf or srm.conf file and add:
|
||||
|
||||
VERBOSE INSTALL
|
||||
|
||||
Chances are you are reading this because the quick install steps above
|
||||
did not work for you. If this is the case, congratulations, you are
|
||||
among the elite few that actually reads documentation. It really is
|
||||
not a difficult install and once you have done it once you will fly
|
||||
through it.
|
||||
|
||||
Installing PHP can be done in four simple steps:
|
||||
|
||||
1. Unpack your distribution file.
|
||||
|
||||
You will have downloaded a file named something like php-4.x.y.tar.gz.
|
||||
Unzip this file with a command like: gunzip php-4.x.y.tar.gz
|
||||
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 php-4.x.y.tar
|
||||
Next you have to untar it with: tar -xvf php4xn.tar
|
||||
|
||||
This will create a php-4.x.y directory. cd into this new directory.
|
||||
This will create a php-4.0.x directory. cd into this new directory.
|
||||
|
||||
2a. Configure PHP (Dynamic Module) - Skip to 2b if you wish to build
|
||||
a static module
|
||||
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
|
||||
|
||||
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. In order to
|
||||
build PHP as a dynamic module for Apache-1.3.x you have to first have
|
||||
Apache installed. Assuming Apache is already installed, make sure
|
||||
the shared object module is enabled. To check this, type: httpd -l
|
||||
You should see something like:
|
||||
|
||||
Compiled-in modules:
|
||||
http_core.c
|
||||
mod_so.c
|
||||
|
||||
You will most likely have a lot more modules than what is shown here.
|
||||
As long as mod_so.c shows up in the list, PHP should be happy.
|
||||
|
||||
Now, type: ./configure --with-mysql --with-apxs
|
||||
|
||||
If you get an error telling you that the apxs script could not be found,
|
||||
look for it on your system and if you find it, provide the full path to it
|
||||
as: --with-apxs=/path/to/apxs
|
||||
|
||||
Make sure you specify the version of apxs that is actually installed on
|
||||
your system and NOT the one that is in the apache source tarball.
|
||||
|
||||
You might also want other flags on this configure line. --with-mysql
|
||||
is just an example.
|
||||
|
||||
There are a few things that can go wrong during this configure step.
|
||||
The most common is that you have asked for an option and that the
|
||||
configure script can not find the files required to enable this
|
||||
option in PHP. Chances are you can provide the full path to the
|
||||
base directory under which the related files were installed. For
|
||||
example, if you have installed the GD library in /opt/gd which means
|
||||
that /opt/gd/include has your GD header files and /opt/gd/lib contains
|
||||
your GD library files, you would use --with-gd=/opt/gd
|
||||
|
||||
Skip to step 3 for compilation and installation instructions.
|
||||
|
||||
2b. Configure PHP (Static Module) - Skip if you performed 2a
|
||||
|
||||
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:"
|
||||
@@ -210,16 +79,8 @@ Installing PHP can be done in four simple steps:
|
||||
Apache Configure script at least once before compiling PHP. It
|
||||
doesn't matter how you have Apache configured at this point.
|
||||
|
||||
Skip to step 3b at this point.
|
||||
|
||||
3. Compile and install the files. Simply type: make install
|
||||
|
||||
3a. Dynamic Module Installation
|
||||
|
||||
Nothing else is needed here. Proceed to step 4a.
|
||||
|
||||
3b. Static Module Installation
|
||||
|
||||
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
|
||||
@@ -277,49 +138,11 @@ Installing PHP can be done in four simple steps:
|
||||
somewhere. Re-edit Configuration and try again. If it goes well,
|
||||
type: make
|
||||
|
||||
Assuming it compiles without errors, proceed to step 4b.
|
||||
|
||||
4a. Setting up the server. (Dynamic Module)
|
||||
|
||||
The make install command in step 3 should have done most of your
|
||||
work for you. It actually edits your httpd.conf file and tries to
|
||||
enable the dynamic PHP module. To verify this, look for a line that
|
||||
looks like this:
|
||||
|
||||
LoadModule php4_module libexec/libphp4.so
|
||||
|
||||
The actual path before the libphp4.so part might differ slightly. This
|
||||
is likely fine. If you are paranoid you can examine the output from the
|
||||
make install step to see where the libphp4.so file was actually put and
|
||||
place the full path to this file on this LoadModule line.
|
||||
|
||||
If somewhere in your httpd.conf file you have a ClearModuleList line
|
||||
then you also need this line:
|
||||
|
||||
AddModule mod_php4.c
|
||||
|
||||
And finally you need to tell Apache which file extension should trigger
|
||||
PHP. You do this by creating a special mime type and associating it
|
||||
with an extension. We suggest using:
|
||||
|
||||
AddType application/x-httpd-php .php
|
||||
|
||||
You are however free to use any extension you wish, including .html.
|
||||
|
||||
Note! If a line has a # at the beginning, then it is commented out
|
||||
and you need to remove the # for that line to take effect.
|
||||
|
||||
Finally you need to copy php.ini-dist to the appropriate place
|
||||
(normally /usr/local/lib/php.ini) and edit if necessary.
|
||||
|
||||
Once you have made these changes you should be ready to restart your
|
||||
server and try it out. Type: apachectl restart
|
||||
|
||||
4b. Setting up the server. (Static Module)
|
||||
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/httpd.conf file
|
||||
a backup of your previous one first. Then edit your conf/srm.conf file
|
||||
and add the line:
|
||||
|
||||
AddType application/x-httpd-php .php
|
||||
@@ -333,76 +156,22 @@ Installing PHP can be done in four simple steps:
|
||||
Any file ending in .phps will now be displayed with full colour syntax
|
||||
highlighting instead of being executed.
|
||||
|
||||
Note that on some older server setups, the AddType lines are in the
|
||||
conf/srm.conf file instead of conf/httpd.conf.
|
||||
|
||||
Note! If a line has a # at the beginning, then it is commented out
|
||||
and you need to remove the # for that line to take effect.
|
||||
|
||||
When you are finished making changes to your httpd.conf file, you need
|
||||
to copy php.ini-dist to the appropriate place (normally
|
||||
/usr/local/lib/php.ini) and edit if necessary. You can then
|
||||
When you are finished making changes to your srm.conf file, you can
|
||||
start up your server.
|
||||
|
||||
5. Testing it all worked
|
||||
USING PHP3 AND PHP4 AS CONCURRENT APACHE MODULES
|
||||
|
||||
Create a test file named test.php in your web tree somewhere and
|
||||
put some test PHP tags in it. <?phpinfo()?> is a good first test.
|
||||
This tag tells PHP to do a braindump and tells you all sorts of things
|
||||
about itself.
|
||||
|
||||
|
||||
WHY DISABLING -fPIC WORKS ON LINUX
|
||||
|
||||
From: Martin v. Loewis <martin@loewis.home.cs.tu-berlin.de>
|
||||
To: glibc-linux@ricardo.ecn.wfu.edu
|
||||
Subject: Re: Shared library -shared vs. -fpic
|
||||
|
||||
[In reply to Kaz Kylheku <kaz@ashi.footprints.net>]
|
||||
|
||||
> PIC stands for Position-Independent Code.
|
||||
|
||||
Correct.
|
||||
|
||||
> Code isn't position-independent (or ``relocatable'') cannot be
|
||||
> loaded at an arbitrary address;
|
||||
|
||||
Wrong.
|
||||
|
||||
> it requires some references to be patched at load time.
|
||||
|
||||
Correct.
|
||||
|
||||
> Shared libraries need to be relocatable because it's not known
|
||||
> beforehand what address they will be loaded at
|
||||
|
||||
Correct, depending on the meaning of "relocatable". PIC code typically
|
||||
does not contain relocations; that's why its position-independent.
|
||||
|
||||
> Just because you don't specify -fPIC doesn't mean that the compiler
|
||||
> won't emit position-independent code; the option prevents it from
|
||||
> emitting position-dependent code in situations where it otherwise
|
||||
> would.
|
||||
|
||||
Correct. However, a non-trivial shared library typically won't be
|
||||
position-independent unless explicitly compiled with
|
||||
-fPIC. Linux/glibc indeed does not require a shared library to be
|
||||
position-independent; instead, it will perform the relocations in the
|
||||
binary, even if they refer to code pages. As a result, those relocated
|
||||
pages won't be shared across processes, anymore.
|
||||
|
||||
Regards,
|
||||
Martin
|
||||
|
||||
USING PHP 3 AND PHP 4 AS CONCURRENT APACHE MODULES
|
||||
|
||||
With some (newer) installations of Apache, it's possible to compile both
|
||||
PHP 3 and PHP 4, and run them concurrently.
|
||||
|
||||
Note, it's only really wise to do this if you need to use the PHP 3 engine
|
||||
to maintain backwards compatibility.
|
||||
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.
|
||||
|
||||
To enable it, configure PHP 3 and PHP 4 to use APXS (--with-apxs) and the
|
||||
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:
|
||||
|
||||
@@ -410,8 +179,8 @@ USING PHP 3 AND PHP 4 AS CONCURRENT APACHE MODULES
|
||||
--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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.0
|
||||
Copyright (c) 1999 - 2002 The PHP Group. All rights reserved.
|
||||
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
|
||||
@@ -8,38 +8,43 @@ 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.
|
||||
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.
|
||||
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 written permission. For
|
||||
written permission, please contact group@php.net.
|
||||
|
||||
4. Products derived from this software may not be called "PHP", nor
|
||||
may "PHP" appear in their name, without prior written permission
|
||||
from group@php.net. You may indicate that your software works in
|
||||
conjunction with PHP by saying "Foo for PHP" instead of calling
|
||||
it "PHP Foo" or "phpfoo"
|
||||
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.
|
||||
|
||||
5. The PHP Group may publish revised and/or new versions of the
|
||||
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
|
||||
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.
|
||||
|
||||
6. Redistributions of any form whatsoever must retain the following
|
||||
5. Redistributions of any form whatsoever must retain the following
|
||||
acknowledgment:
|
||||
"This product includes PHP, freely available from
|
||||
<http://www.php.net/>".
|
||||
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,
|
||||
@@ -59,10 +64,7 @@ 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.
|
||||
The PHP Group can be contacted via Email at php-group@php.net.
|
||||
|
||||
For more information on the PHP Group and the PHP project,
|
||||
please see <http://www.php.net>.
|
||||
|
||||
This product includes the Zend Engine, freely available at
|
||||
<http://www.zend.com>.
|
||||
@@ -0,0 +1,20 @@
|
||||
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)
|
||||
@@ -1,18 +0,0 @@
|
||||
$(builddir)/zend_language_scanner.lo: $(builddir)/zend_language_parser.h
|
||||
$(builddir)/zend_ini_scanner.lo: $(builddir)/zend_ini_parser.h
|
||||
|
||||
$(builddir)/zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
|
||||
$(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
|
||||
|
||||
$(builddir)/zend_language_parser.h: $(builddir)/zend_language_parser.c
|
||||
$(builddir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
|
||||
$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@
|
||||
|
||||
$(builddir)/zend_ini_parser.h: $(builddir)/zend_ini_parser.c
|
||||
$(builddir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
|
||||
$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
|
||||
|
||||
$(builddir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
|
||||
$(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
|
||||
|
||||
$(builddir)/zend_indent.lo $(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(builddir)/zend_language_parser.h
|
||||
@@ -1,74 +0,0 @@
|
||||
mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
|
||||
INSTALL = $(top_srcdir)/build/shtool install -c
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
|
||||
DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
|
||||
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS)
|
||||
|
||||
|
||||
all: $(all_targets)
|
||||
|
||||
build-modules: $(PHP_MODULES)
|
||||
|
||||
libphp4.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(COMMON_FLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
|
||||
|
||||
libs/libphp4.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
|
||||
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp4.so
|
||||
|
||||
php: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
|
||||
$(BUILD_CGI)
|
||||
|
||||
sapi/cli/php: $(PHP_GLOBAL_OBJS) $(PHP_CLI_OBJS)
|
||||
$(BUILD_CLI)
|
||||
|
||||
install: $(install_targets)
|
||||
|
||||
|
||||
install-cli: sapi/cli/php
|
||||
@echo "Installing PHP CLI binary: $(INSTALL_ROOT)$(bindir)/"
|
||||
@$(INSTALL_CLI)
|
||||
|
||||
install-sapi: libphp4.la
|
||||
@echo "Installing PHP SAPI module"
|
||||
-@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
|
||||
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
|
||||
-@if test ! -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); then \
|
||||
for i in 0.0.0 0.0 0; do \
|
||||
if test -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i; then \
|
||||
$(LN_S) $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); \
|
||||
break; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
@$(INSTALL_IT)
|
||||
|
||||
install-modules: build-modules
|
||||
@test -d modules && \
|
||||
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR) && \
|
||||
echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/" && \
|
||||
rm -f modules/*.la && \
|
||||
cp modules/* $(INSTALL_ROOT)$(EXTENSION_DIR) >/dev/null 2>&1 || true
|
||||
|
||||
install-tester:
|
||||
@echo "Installing regression tester: $(INSTALL_ROOT)$(PEAR_INSTALLDIR)/"
|
||||
@$(mkinstalldirs) $(PEAR_INSTALLDIR)
|
||||
@$(INSTALL) -m 755 $(top_srcdir)/run-tests.php $(INSTALL_ROOT)$(PEAR_INSTALLDIR)
|
||||
|
||||
install-su: install-pear install-tester
|
||||
|
||||
test: sapi/cli/php
|
||||
@TEST_PHP_EXECUTABLE=$(top_builddir)/sapi/cli/php \
|
||||
$(top_builddir)/sapi/cli/php -c php.ini-dist $(top_srcdir)/run-tests.php
|
||||
|
||||
clean:
|
||||
find . -name \*.lo -o -name \*.o -o -name \*.la -o -name \*.a| xargs rm -f
|
||||
find . -name .libs -a -type d|xargs rm -rf
|
||||
rm -f libphp4.la php sapi/cli/php modules/* libs/*
|
||||
|
||||
distclean: clean
|
||||
rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php4.spec sapi/apache/libphp4.module buildmk.stamp
|
||||
find . -name Makefile | xargs rm -f
|
||||
|
||||
.PHONY: all clean install distclean test
|
||||
.NOEXPORT:
|
||||
+240
@@ -0,0 +1,240 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP HTML Embedded Scripting Language Version 4.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. |
|
||||
# +----------------------------------------------------------------------+
|
||||
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
bindir = @bindir@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ZEND_DIR = $(srcdir)/libzend
|
||||
TSRM_DIR = @TSRM_DIR@
|
||||
SUBDIRS=libzend ext $(TSRM_DIR)
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
LN_S = @LN_S@
|
||||
CC = @CC@
|
||||
AR = ar rc
|
||||
BINNAME = @BINNAME@
|
||||
INSTALL_IT = @INSTALL_IT@
|
||||
EXTRA_LIBS = @EXTRA_LIBS@
|
||||
EXT_LIBS = @EXT_LIBS@
|
||||
INCLUDES = @INCLUDES@
|
||||
INCLUDE = -I$(srcdir) -I. -I$(ZEND_DIR) -I$(srcdir)/TSRM $(INCLUDES)
|
||||
PROF_CFLAGS =
|
||||
CFLAGS_SHLIB = @CFLAGS_SHLIB@
|
||||
LDFLAGS_SHLIB = @LDFLAGS_SHLIB@
|
||||
LDFLAGS_SHLIB_EXPORT = @LDFLAGS_SHLIB_EXPORT@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
DEFS = @DEFS@
|
||||
CFLAGS = @CFLAGS@ @DEBUG_CFLAGS@ $(PROF_CFLAGS)
|
||||
COMPILE = $(CC) $(CFLAGS) $(CFLAGS_SHLIB) $(CPPFLAGS) $(INCLUDE) $(DEFS) @STRONGHOLD@
|
||||
LDFLAGS = @VERSION_SCRIPT@ @RPATHS@ @LDFLAGS@ $(LDFLAGS_SHLIB) $(LDFLAGS_SHLIB_EXPORT) -L$(ZEND_DIR)
|
||||
REGCFLAGS = $(CFLAGS)
|
||||
RANLIB = @RANLIB@
|
||||
YACC = @YACC@
|
||||
MAINT = @MAINT@
|
||||
APXS = @APXS@
|
||||
APXS_LDFLAGS = $(EXTRA_LIBS) $(LIBS)
|
||||
APXS_EXP = @APXS_EXP@
|
||||
WARNING_LEVEL = @WARNING_LEVEL@
|
||||
LEX_CFLAGS = -w$(WARNING_LEVEL) @LEX_CFLAGS@
|
||||
EXT_SHARED = @EXT_SHARED@
|
||||
LIBOBJS=@LIBOBJS@
|
||||
|
||||
SOURCE = main.c internal_functions.c snprintf.c php3_sprintf.c \
|
||||
configuration-parser.c configuration-scanner.c request_info.c \
|
||||
safe_mode.c fopen-wrappers.c php3_realpath.c alloca.c output.c \
|
||||
php_ini.c SAPI.c cgi_main.c rfc1867.c dlist.c php_content_types.c \
|
||||
aolserver.c
|
||||
|
||||
OBJS = $(SOURCE:.c=.o) $(LIBOBJS)
|
||||
PHPLIBS = -Llibzend -lzend -Lext -lphpext
|
||||
LIBS = $(PHPLIBS) $(EXTRA_LIBS) @LIBS@
|
||||
|
||||
all: $(BINNAME)
|
||||
|
||||
all-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-depend-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
for subdir in $(SUBDIRS); do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) || fail=yes; \
|
||||
done && test -z "$$fail"
|
||||
|
||||
# CGI binary or fhttpd module
|
||||
php: all-recursive $(OBJS) @REGEX_LIB@ @FHTTPD_LIB@
|
||||
$(CC) $(CFLAGS) -o $(BINNAME) $(LDFLAGS) $(OBJS) $(LIBS)
|
||||
|
||||
# Apache modules
|
||||
libphp4.a libmodphp4.a: all-recursive $(OBJS) @REGEX_LIB@
|
||||
$(AR) $@.tmp $(OBJS)
|
||||
$(srcdir)/scripts/armerge $@ $@.tmp ext/libphpext.a libzend/libzend.a @TSRM_LIB@
|
||||
@rm -f $@.tmp
|
||||
$(RANLIB) $(BINNAME)
|
||||
|
||||
# Apache modules
|
||||
libmodphp4-so.a: all-recursive $(OBJS) @REGEX_LIB@
|
||||
$(AR) $@.tmp $(OBJS)
|
||||
$(srcdir)/scripts/armerge $@ $@.tmp ext/libphpext.a libzend/libzend.a @TSRM_LIB@
|
||||
@rm -f $@.tmp
|
||||
$(RANLIB) libmodphp4-so.a
|
||||
|
||||
# Apache 1.3 shared module
|
||||
libphp4.so: $(srcdir)/mod_php4.c libmodphp4-so.a @REGEX_LIB@
|
||||
-@test -f ./mod_php4.c || test -L ./mod_php4.c || $(LN_S) $(srcdir)/mod_php4.c ./mod_php4.c
|
||||
-@test -f ./mod_php4.c || test -h ./mod_php4.c || $(LN_S) $(srcdir)/mod_php4.c ./mod_php4.c
|
||||
$(APXS) $(INCLUDE) -c -o libphp4.so @VERSION_SCRIPT@ @RPATHS@ ./mod_php4.c libmodphp4-so.a $(APXS_LDFLAGS) $(APXS_EXP)
|
||||
|
||||
php4_aol.so: libmodphp4-so.a
|
||||
g++ $(LDFLAGS) -shared aolserver.o -o $@ libmodphp4-so.a $(LIBS)
|
||||
|
||||
regex/libregex.a:
|
||||
(cd regex; $(MAKE) lib)
|
||||
|
||||
configuration-parser.h configuration-parser.c: $(srcdir)/configuration-parser.y
|
||||
bison -p cfg -v -d $(srcdir)/configuration-parser.y -o configuration-parser.c
|
||||
|
||||
configuration-scanner.o: configuration-scanner.c
|
||||
$(COMPILE) $(LEX_CFLAGS) -c configuration-scanner.c
|
||||
|
||||
configuration-scanner.c: $(srcdir)/configuration-scanner.l
|
||||
flex -Pcfg -oconfiguration-scanner.c -i $(srcdir)/configuration-scanner.l
|
||||
|
||||
clean: clean-recursive
|
||||
-rm -f libphp4.a libmodphp4.a libphp4.so php *.o
|
||||
-rm -f test/php.desc test/php.in test/php.out test/php.test
|
||||
-rm -f test/a.tmp test/b.tmp test/test.dbm*
|
||||
|
||||
distclean: clean distclean-recursive
|
||||
-rm -f *-parser.[ch] *-scanner.c *.output
|
||||
-rm -f config.status config.cache config.log
|
||||
-rm -f Makefile Makefile.depend php_config.h build-defs.h
|
||||
-rm -f libphp4.module stamp-h buildconf.stamp
|
||||
-rm -f regex/*.o regex/*.a regex/*.ih
|
||||
-rm -f doc/checkdoc doc/funcparse doc/version.ent
|
||||
-rm -f do-conf test/test.log
|
||||
-rm -f doc/Makefile regex/Makefile
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
tar chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
|
||||
distdir:
|
||||
-rm -rf $(distdir)
|
||||
files=`echo *` ;\
|
||||
mkdir $(distdir) ;\
|
||||
for file in $$files ; do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file ; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
(cd $(distdir) ; $(MAKE) distclean)
|
||||
cd $(distdir)/libzend ;\
|
||||
flex -Pzend -ozend-scanner.c -i zend-scanner.l ;\
|
||||
bison -p zend -v -d zend-parser.y -o zend-parser.c
|
||||
cd $(distdir) ;\
|
||||
flex -Pcfg -oconfiguration-scanner.c -i configuration-scanner.l ;\
|
||||
bison -p cfg -v -d configuration-parser.y -o configuration-parser.c
|
||||
find $(distdir) -name CVS -o -name .cvsignore | xargs rm -rf
|
||||
|
||||
maintainer-clean-depend: maintainer-clean-depend-recursive
|
||||
|
||||
bench: $(BINNAME)
|
||||
./$(BINNAME) -c. tests/bench.phtml
|
||||
|
||||
# can't use a single rule for this because 'test' is a directory
|
||||
test: regression
|
||||
regression check: $(BINNAME)
|
||||
cd test && ./testall
|
||||
|
||||
config.status: configure
|
||||
./config.status --recheck
|
||||
|
||||
build-defs.h php_config.h: stamp-h
|
||||
stamp-h: php_config.h.in config.status
|
||||
CONFIG_FILES='build-defs.h stamp-h' ./config.status
|
||||
|
||||
Makefile: Makefile.in config.status
|
||||
CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
|
||||
|
||||
#
|
||||
# You must use '--enable-maintainer-mode' with configure to enable
|
||||
# these rules, which requires autoconf be installed.
|
||||
#
|
||||
configure: @MAINT@ configure.in aclocal.m4
|
||||
cd $(srcdir) && autoconf
|
||||
|
||||
php_config.h.in: @MAINT@ stamp-h.in
|
||||
stamp-h.in: configure.in aclocal.m4 acconfig.h
|
||||
cd ${srcdir} && autoheader && touch ${srcdir}/stamp-h.in
|
||||
|
||||
install: install-recursive $(BINNAME)
|
||||
$(INSTALL_IT)
|
||||
|
||||
install-recursive:
|
||||
if test "$(EXT_SHARED)" != ""; then \
|
||||
for dir in X $(EXT_SHARED); do \
|
||||
test -d ext/$$dir && (cd ext/$$dir; $(MAKE) install); \
|
||||
done; \
|
||||
fi
|
||||
|
||||
indent: clean
|
||||
indent -v -kr -cli4 -ts4 \
|
||||
-T pval -T HashTable -T Bucket -T Token -T TokenCache -T TokenCacheManager \
|
||||
-T switch_expr -T internal_function -T control_structure_data \
|
||||
-T MemoryHashTable -T MemoryBucket \
|
||||
-T pvalue_value -T Stack *.c *.h
|
||||
rm -f *~
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
parser-scanner: configuration-parser.c configuration-scanner.c
|
||||
|
||||
depend: parser-scanner
|
||||
$(CC) $(CFLAGS) -MM $(SOURCE) | perl -pe 's|regex/regex.h||;' > Makefile.depend
|
||||
$(CC) $(CFLAGS) -MM $(FUNCTIONS_SOURCE) | perl -pe 's|^(.+\.o)|functions/$$1|; s|regex/regex.h||;' >> Makefile.depend
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 4
|
||||
# End:
|
||||
@@ -0,0 +1,17 @@
|
||||
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
|
||||
@@ -1,115 +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. Please have a look at
|
||||
http://cvsbook.red-bean.com/ for more detailed information on CVS.
|
||||
|
||||
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 EXTENSIONS 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. Every
|
||||
entry in NEWS has to have a name after it, so if you did it with someone's
|
||||
help, put both your names there. Your name WILL NOT be automatically put
|
||||
at the end of the NEWS entry - so, please provide it yourself.
|
||||
|
||||
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!
|
||||
@- Fixed memory leak in trim(). (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 fix some bugs, you should note the bug ID numbers in your
|
||||
commit message. Bug ID should be prefixed by "#" for easier access to
|
||||
bug report when developers are browsing CVS via. LXR or Bonsai.
|
||||
|
||||
Example:
|
||||
|
||||
Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
@ Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
|
||||
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
|
||||
@@ -1,39 +0,0 @@
|
||||
Between PHP 4.0.6 and 4.1.0, the Zend module struct changed in a way
|
||||
that broke both source and binary compatibility. If you are
|
||||
maintaining a third party extension, here's how to update it:
|
||||
|
||||
If this was your old module entry:
|
||||
|
||||
zend_module_entry foo_module_entry = {
|
||||
"foo", /* extension name */
|
||||
foo_functions, /* extension function list */
|
||||
NULL, /* extension-wide startup function */
|
||||
NULL, /* extension-wide shutdown function */
|
||||
PHP_RINIT(foo), /* per-request startup function */
|
||||
PHP_RSHUTDOWN(foo), /* per-request shutdown function */
|
||||
PHP_MINFO(foo), /* information function */
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
Here's how it should look if you want your code to build with PHP
|
||||
4.1.0 and up:
|
||||
|
||||
zend_module_entry foo_module_entry = {
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
STANDARD_MODULE_HEADER,
|
||||
#endif
|
||||
"foo", /* extension name */
|
||||
foo_functions, /* extension function list */
|
||||
NULL, /* extension-wide startup function */
|
||||
NULL, /* extension-wide shutdown function */
|
||||
PHP_RINIT(foo), /* per-request startup function */
|
||||
PHP_RSHUTDOWN(foo), /* per-request shutdown function */
|
||||
PHP_MINFO(foo), /* information function */
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
FOO_VERSION, /* extension version number (string) */
|
||||
#endif
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
If you don't care about source compatibility with earlier PHP releases
|
||||
than 4.1.0, you can drop the #if/#endif lines.
|
||||
-189
@@ -1,189 +0,0 @@
|
||||
|
||||
WHAT IT IS
|
||||
|
||||
It's a tool for automatically creating the basic framework for a PHP module
|
||||
and writing C code handling arguments passed to your functions from a simple
|
||||
configuration file. See an example at the end of this file.
|
||||
|
||||
HOW TO USE IT
|
||||
|
||||
Very simple. First, cd do directory ext/ in PHP 4 sources. If you just need
|
||||
the basic framework and will be writing all the code in your functions
|
||||
yourself, you can now do
|
||||
|
||||
./ext_skel --extname=module_name
|
||||
|
||||
and everything you need is placed in directory module_name.
|
||||
|
||||
[ Note that GNU awk is likely required for this script to work. Debian
|
||||
systems seem to default to using mawk, so you may need to change the
|
||||
#! line in skeleton/create_stubs to use gawk explicitly. ]
|
||||
|
||||
If you don't need to test the existence of any external header files,
|
||||
libraries or functions in them, the module is already almost ready to be
|
||||
compiled in PHP. Just remove 3 comments in your_module_name/config.m4,
|
||||
cd back up to PHP sources top directory, and do
|
||||
|
||||
./buildconf; ./configure --enable-module_name; make
|
||||
|
||||
But if you already have planned the overall scheme of your module, what
|
||||
functions it will contain, their return types and the arguments they take
|
||||
(a very good idea) and don't want to bother yourself with creating function
|
||||
definitions and handling arguments passed yourself, it's time to create a
|
||||
function definitions file, which you will give as an argument to ext_skel
|
||||
with option
|
||||
|
||||
--proto=filename.
|
||||
|
||||
FORMAT OF FUNCTION DEFINITIONS FILE
|
||||
|
||||
All the definitions must be on one line. In it's simplest form, it's just
|
||||
the function name, ie.
|
||||
|
||||
my_function
|
||||
|
||||
but then you'll be left with an almost empty function body without any
|
||||
argument handling.
|
||||
|
||||
Arguments are given in parenthesis after the function name, and are of
|
||||
the form 'argument_type argument_name'. Arguments are separated from each
|
||||
other with a comma and optional space. Argument_type can be one of int,
|
||||
bool, double, float, string, array, object or mixed.
|
||||
|
||||
An optional argument is separated from the previous by an optional space,
|
||||
then '[' and of course comma and optional space, like all the other
|
||||
arguments. You should close a row of optional arguments with same amount of
|
||||
']'s as there where '['s. Currently, it does not harm if you forget to do it
|
||||
or there is a wrong amount of ']'s, but this may change in the future.
|
||||
|
||||
An additional short description may be added after the parameters.
|
||||
If present it will be filled into the 'proto' header comments in the stubs
|
||||
code and the <refpurpose> tag in the XML documentation.
|
||||
|
||||
An example:
|
||||
|
||||
my_function(int arg1, int arg2 [, int arg3 [, int arg4]]) this is my 1st
|
||||
|
||||
Arguments arg3 and arg4 are optional.
|
||||
|
||||
If possible, the function definition should also contain it's return type
|
||||
in front of the definition. It's not actually used for any C code generating
|
||||
purposes but PHP in-source documentation instead, and as such, very useful.
|
||||
It can be any of int, double, string, bool, array, object, resource, mixed
|
||||
or void.
|
||||
|
||||
The file must contain nothing else but function definitions, no comments or
|
||||
empty lines.
|
||||
|
||||
OTHER OPTIONS
|
||||
|
||||
--no-help
|
||||
|
||||
By default, ext_skel creates both comments in the source code and a test
|
||||
function to help first time module writers to get started and testing
|
||||
configuring and compiling their module. This option turns off all such things
|
||||
which may just annoy experienced PHP module coders. Especially useful with
|
||||
|
||||
--stubs=file
|
||||
|
||||
which will leave out also all module specific stuff and write just function
|
||||
stubs with function value declarations and passed argument handling, and
|
||||
function entries and definitions at the end of the file, for copying and
|
||||
pasting into an already existing module.
|
||||
|
||||
--assign-params
|
||||
--string-lens
|
||||
|
||||
By default, function proto 'void foo(string bar)' creates the following:
|
||||
...
|
||||
zval **bar;
|
||||
... (zend_get_parameters_ex() called in the middle...)
|
||||
convert_to_string_ex(bar);
|
||||
|
||||
Specifying both of these options changes the generated code to:
|
||||
...
|
||||
zval **bar_arg;
|
||||
int bar_len;
|
||||
char *bar = NULL;
|
||||
... (zend_get_parameters_ex() called in the middle...)
|
||||
convert_to_string_ex(bar_arg);
|
||||
bar = Z_STRVAL_PP(bar_arg);
|
||||
bar_len = Z_STRLEN_PP(bar_arg);
|
||||
|
||||
You shouldn't have to ask what happens if you leave --string-lens out. If you
|
||||
have to, it's questionable whether you should be reading this document.
|
||||
|
||||
--with-xml[=file]
|
||||
|
||||
Creates the basics for phpdoc .xml file.
|
||||
|
||||
--full-xml
|
||||
|
||||
Not implemented yet. When or if there will ever be created a framework for
|
||||
self-contained extensions to use phpdoc system for their documentation, this
|
||||
option enables it on the created xml file.
|
||||
|
||||
CURRENT LIMITATIONS, BUGS AND OTHER ODDITIES
|
||||
|
||||
Only arguments of types int, bool, double, float, string and array are
|
||||
handled. For other types you must write the code yourself. And for type
|
||||
mixed, it wouldn't even be possible to write anything, because only you
|
||||
know what to expect.
|
||||
|
||||
It can't handle correctly, and probably never will, variable list of
|
||||
of arguments. (void foo(int bar [, ...])
|
||||
|
||||
Don't trust the generated code too much. It tries to be useful in most of
|
||||
the situations you might encounter, but automatic code generation will never
|
||||
beat a programmer who knows the real situation at hand. ext_skel is generally
|
||||
best suited for quickly generating a wrapper for c-library functions you
|
||||
might want to have available in PHP too.
|
||||
|
||||
This program doesn't have a --help option. It has --no-help instead.
|
||||
|
||||
EXAMPLE
|
||||
|
||||
The following _one_ line
|
||||
|
||||
bool my_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
|
||||
will create this function definition for you (note that there are a few
|
||||
question marks to be replaced by you, and you must of course add your own
|
||||
value definitions too):
|
||||
|
||||
/* {{{ proto bool my_drawtext(resource image, string text, resource font, int x, int y[, int color])
|
||||
*/
|
||||
PHP_FUNCTION(my_drawtext)
|
||||
{
|
||||
zval **image, **text, **font, **x, **y, **color;
|
||||
int argc;
|
||||
int image_id = -1;
|
||||
int font_id = -1;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (argc < 5 || argc > 6 || zend_get_parameters_ex(argc, &image, &text, &font, &x, &y, &color) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(???, ???, image, image_id, "???", ???_rsrc_id);
|
||||
ZEND_FETCH_RESOURCE(???, ???, font, font_id, "???", ???_rsrc_id);
|
||||
|
||||
switch (argc) {
|
||||
case 6:
|
||||
convert_to_long_ex(color);
|
||||
/* Fall-through. */
|
||||
case 5:
|
||||
convert_to_long_ex(y);
|
||||
convert_to_long_ex(x);
|
||||
/* font: fetching resources already handled. */
|
||||
convert_to_string_ex(text);
|
||||
/* image: fetching resources already handled. */
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
php_error(E_WARNING, "my_drawtext: not yet implemented");
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
New parameter parsing functions
|
||||
===============================
|
||||
|
||||
It should be easier to parse input parameters to an extension function.
|
||||
Hence, borrowing from Python's example, there are now a set of functions
|
||||
that given the string of type specifiers, can parse the input parameters
|
||||
and store the results in the user specified variables. This avoids most
|
||||
of the IS_* checks and convert_to_* conversions. The functions also
|
||||
check for the appropriate number of parameters, and try to output
|
||||
meaningful error messages.
|
||||
|
||||
|
||||
Prototypes
|
||||
----------
|
||||
/* Implemented. */
|
||||
int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...);
|
||||
int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...);
|
||||
|
||||
The zend_parse_parameters() function takes the number of parameters
|
||||
passed to the extension function, the type specifier string, and the
|
||||
list of pointers to variables to store the results in. The _ex() version
|
||||
also takes 'flags' argument -- current only ZEND_PARSE_PARAMS_QUIET can
|
||||
be used as 'flags' to specify that the function should operate quietly
|
||||
and not output any error messages.
|
||||
|
||||
Both functions return SUCCESS or FAILURE depending on the result.
|
||||
|
||||
The auto-conversions are performed as necessary. Arrays, objects, and
|
||||
resources cannot be autoconverted.
|
||||
|
||||
|
||||
Type specifiers
|
||||
---------------
|
||||
l - long
|
||||
d - double
|
||||
s - string (with possible null bytes) and its length
|
||||
b - boolean, stored in zend_bool
|
||||
r - resource (stored in zval)
|
||||
a - array
|
||||
o - object (of any type)
|
||||
O - object (of specific type, specified by class entry)
|
||||
z - the actual zval
|
||||
|
||||
The following characters also have a meaning in the specifier string:
|
||||
| - indicates that the remaining parameters are optional, they
|
||||
should be initialized to default values by the extension since they
|
||||
will not be touched by the parsing function if they are not
|
||||
passed to it.
|
||||
/ - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows
|
||||
! - the parameter it follows can be of specified type or NULL (only applies
|
||||
to 'a', 'o', 'O', 'r', and 'z'). If NULL is passed, the results
|
||||
pointer is set to NULL as well.
|
||||
|
||||
Examples
|
||||
--------
|
||||
/* Gets a long, a string and its length, and a zval */
|
||||
long l;
|
||||
char *s;
|
||||
int s_len;
|
||||
zval *param;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsz",
|
||||
&l, &s, &s_len, ¶m) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Gets an object of class specified by my_ce, and an optional double. */
|
||||
zval *obj;
|
||||
double d = 0.5;
|
||||
zend_class_entry my_ce;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d",
|
||||
&obj, my_ce, &d) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Gets an object or null, and an array.
|
||||
If null is passed for object, obj will be set to NULL. */
|
||||
zval *obj;
|
||||
zval *arr;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o!a",
|
||||
&obj, &arr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Gets a separated array which can also be null. */
|
||||
zval *arr;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!",
|
||||
&arr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Get only the first three parameters (useful for varargs functions). */
|
||||
zval *z;
|
||||
zend_bool b;
|
||||
zval *r;
|
||||
if (zend_parse_parameters(3 TSRMLS_CC, "zbr!",
|
||||
&z, &b, &r) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Get either a set of 3 longs or a string. */
|
||||
long l1, l2, l3;
|
||||
char *s;
|
||||
/*
|
||||
* The function expects a pointer to a integer in this case, not a long
|
||||
* or any other type. If you specify a type which is larger
|
||||
* than a 'int', the upper bits might not be initialized
|
||||
* properly, leading to random crashes on platforms like
|
||||
* Tru64 or Linux/Alpha.
|
||||
*/
|
||||
int length;
|
||||
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"lll", &l1, &l2, &l3) == SUCCESS) {
|
||||
/* manipulate longs */
|
||||
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"s", &s, &length) == SUCCESS) {
|
||||
/* manipulate string */
|
||||
} else {
|
||||
/* output error */
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
$Id$
|
||||
=============================================================================
|
||||
|
||||
HOW TO CREATE A SELF-CONTAINED PHP EXTENSION
|
||||
|
||||
A self-contained extension can be distributed independently of
|
||||
the PHP source. To create such an extension, three things are
|
||||
required:
|
||||
|
||||
- Configuration file (config.m4)
|
||||
- Source code for your module
|
||||
|
||||
We will describe now how to create these and how to put things
|
||||
together.
|
||||
|
||||
PREPARING YOUR SYSTEM
|
||||
|
||||
While the result will run on any system, a developer's setup needs these
|
||||
tools:
|
||||
|
||||
GNU autoconf
|
||||
GNU automake
|
||||
GNU libtool
|
||||
GNU m4
|
||||
|
||||
All of these are available from
|
||||
|
||||
ftp://ftp.gnu.org/pub/gnu/
|
||||
|
||||
CONVERTING AN EXISTING EXTENSION
|
||||
|
||||
Just to show you how easy it is to create a self-contained
|
||||
extension, we will convert an embedded extension into a
|
||||
self-contained one. Install PHP and execute the following
|
||||
commands.
|
||||
|
||||
$ mkdir /tmp/newext
|
||||
$ cd /tmp/newext
|
||||
|
||||
You now have an empty directory. We will copy the files from
|
||||
the mysql extension:
|
||||
|
||||
$ cp -rp php-4.0.X/ext/mysql/* .
|
||||
|
||||
It is time to finish the module. Run:
|
||||
|
||||
$ phpize
|
||||
|
||||
You can now ship the contents of the directory - the extension
|
||||
can live completely on its own.
|
||||
|
||||
The user instructions boil down to
|
||||
|
||||
$ ./configure \
|
||||
[--with-php-config=/path/to/php-config] \
|
||||
[--with-mysql=MYSQL-DIR]
|
||||
$ make install
|
||||
|
||||
The MySQL module will either use the embedded MySQL client
|
||||
library or the MySQL installation in MYSQL-DIR.
|
||||
|
||||
|
||||
DEFINING THE NEW EXTENSION
|
||||
|
||||
Our demo extension is called "foobar".
|
||||
|
||||
It consists of two source files "foo.c" and "bar.c"
|
||||
(and any arbitrary amount of header files, but that is not
|
||||
important here).
|
||||
|
||||
The demo extension does not reference any external
|
||||
libraries (that is important, because the user does not
|
||||
need to specify anything).
|
||||
|
||||
|
||||
LTLIBRARY_SOURCES specifies the names of the sources files. You can
|
||||
name an arbitrary number of source files here.
|
||||
|
||||
CREATING THE M4 CONFIGURATION FILE
|
||||
|
||||
The m4 configuration can perform additional checks. For a
|
||||
self-contained extension, you do not need more than a few
|
||||
macro calls.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PHP_ARG_ENABLE(foobar,whether to enable foobar,
|
||||
[ --enable-foobar Enable foobar])
|
||||
|
||||
if test "$PHP_FOOBAR" != "no"; then
|
||||
PHP_NEW_EXTENSION(foobar, foo.c bar.c, $ext_shared)
|
||||
fi
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PHP_ARG_ENABLE will automatically set the correct variables, so
|
||||
that the extension will be enabled by PHP_NEW_EXTENSION in shared mode.
|
||||
|
||||
The first argument of PHP_NEW_EXTENSION describes the name of the
|
||||
extension. The second names the source-code files. The third passes
|
||||
$ext_shared which is set by PHP_ARG_ENABLE/WITH to PHP_NEW_EXTENSION.
|
||||
|
||||
Please use always PHP_ARG_ENABLE or PHP_ARG_WITH. Even if you do not
|
||||
plan to distribute your module with PHP, these facilities allow you
|
||||
to integrate your module easily into the main PHP module framework.
|
||||
|
||||
CREATING SOURCE FILES
|
||||
|
||||
ext_skel can be of great help when creating the common code for all modules
|
||||
in PHP for you and also writing basic function definitions and C code for
|
||||
handling arguments passed to your functions. See README.EXT_SKEL for further
|
||||
information.
|
||||
|
||||
As for the rest, you are currently alone here. There are a lot of existing
|
||||
modules, use a simple module as a starting point and add your own code.
|
||||
|
||||
|
||||
CREATING THE SELF-CONTAINED EXTENSION
|
||||
|
||||
Put config.m4 and the source files into one directory. Afterwards,
|
||||
run phpize (this is installed during make install by PHP 4.0).
|
||||
For example, if you configured PHP with --prefix=/php, you would run
|
||||
|
||||
$ /php/bin/phpize
|
||||
|
||||
This will automatically copy the necessary build files and create
|
||||
configure from your config.m4.
|
||||
|
||||
And that's it. You now have a self-contained extension.
|
||||
|
||||
INSTALLING A SELF-CONTAINED EXTENSION
|
||||
|
||||
An extension can be installed by running:
|
||||
|
||||
$ ./configure \
|
||||
[--with-php-config=/path/to/php-config]
|
||||
$ make install
|
||||
|
||||
ADDING SHARED MODULE SUPPORT TO A MODULE
|
||||
|
||||
In order to be useful, a self-contained extension must be loadable
|
||||
as a shared module. I will explain now how you can add shared module
|
||||
support to an existing module called foo.
|
||||
|
||||
1. In config.m4, use PHP_ARG_WITH/PHP_ARG_ENABLE. Then you will
|
||||
automatically be able to use --with-foo=shared[,..] or
|
||||
--enable-foo=shared[,..].
|
||||
|
||||
2. In config.m4, use PHP_NEW_EXTENSION(foo,.., $ext_shared) to enable
|
||||
building the extension.
|
||||
|
||||
3. Add the following lines to your C source file:
|
||||
|
||||
#ifdef COMPILE_DL_FOO
|
||||
ZEND_GET_MODULE(foo)
|
||||
#endif
|
||||
-367
@@ -1,367 +0,0 @@
|
||||
An Overview of the PHP Streams abstraction
|
||||
==========================================
|
||||
$Id$
|
||||
|
||||
Please send comments to: Wez Furlong <wez@thebrainroom.com>
|
||||
|
||||
Why Streams?
|
||||
============
|
||||
You may have noticed a shed-load of issock parameters flying around the PHP
|
||||
code; we don't want them - they are ugly and cumbersome and force you to
|
||||
special case sockets and files everytime you need to work with a "user-level"
|
||||
PHP file pointer.
|
||||
Streams take care of that and present the PHP extension coder with an ANSI
|
||||
stdio-alike API that looks much nicer and can be extended to support non file
|
||||
based data sources.
|
||||
|
||||
Using Streams
|
||||
=============
|
||||
Streams use a php_stream* parameter just as ANSI stdio (fread etc.) use a
|
||||
FILE* parameter.
|
||||
|
||||
The main functions are:
|
||||
|
||||
PHPAPI size_t php_stream_read(php_stream * stream, char * buf, size_t count);
|
||||
PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t
|
||||
count);
|
||||
PHPAPI int php_stream_eof(php_stream * stream);
|
||||
PHPAPI int php_stream_getc(php_stream * stream);
|
||||
PHPAPI char *php_stream_gets(php_stream * stream, char *buf, size_t maxlen);
|
||||
PHPAPI int php_stream_close(php_stream * stream);
|
||||
PHPAPI int php_stream_flush(php_stream * stream);
|
||||
PHPAPI int php_stream_seek(php_stream * stream, off_t offset, int whence);
|
||||
PHPAPI off_t php_stream_tell(php_stream * stream);
|
||||
|
||||
These (should) behave in the same way as the ANSI stdio functions with similar
|
||||
names: fread, fwrite, feof, fgetc, fgets, fclose, fflush, fseek, ftell.
|
||||
|
||||
Opening Streams
|
||||
===============
|
||||
In most cases, you should use this API:
|
||||
|
||||
PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode,
|
||||
int options, char **opened_path TSRMLS_DC);
|
||||
|
||||
Where:
|
||||
path is the file or resource to open.
|
||||
mode is the stdio compatible mode eg: "wb", "rb" etc.
|
||||
options is a combination of the following values:
|
||||
IGNORE_PATH (default) - don't use include path to search for the file
|
||||
USE_PATH - use include path to search for the file
|
||||
IGNORE_URL - do not use plugin wrappers
|
||||
REPORT_ERRORS - show errors in a standard format if something
|
||||
goes wrong.
|
||||
STREAM_MUST_SEEK - If you really need to be able to seek the stream
|
||||
and don't need to be able to write to the original
|
||||
file/URL, use this option to arrange for the stream
|
||||
to be copied (if needed) into a stream that can
|
||||
be seek()ed.
|
||||
|
||||
opened_path is used to return the path of the actual file opened,
|
||||
but if you used STREAM_MUST_SEEK, may not be valid. You are
|
||||
responsible for efree()ing opened_path. opened_path may be (and usually
|
||||
is) NULL.
|
||||
|
||||
If you need to open a specific stream, or convert standard resources into
|
||||
streams there are a range of functions to do this defined in php_streams.h.
|
||||
A brief list of the most commonly used functions:
|
||||
|
||||
PHPAPI php_stream *php_stream_fopen_from_file(FILE *file, const char *mode);
|
||||
Convert a FILE * into a stream.
|
||||
|
||||
PHPAPI php_stream *php_stream_fopen_tmpfile(void);
|
||||
Open a FILE * with tmpfile() and convert into a stream.
|
||||
|
||||
PHPAPI php_stream *php_stream_fopen_temporary_file(const char *dir,
|
||||
const char *pfx, char **opened_path TSRMLS_DC);
|
||||
Generate a temporary file name and open it.
|
||||
|
||||
There are some network enabled relatives in php_network.h:
|
||||
|
||||
PHPAPI php_stream *php_stream_sock_open_from_socket(int socket, int persistent);
|
||||
Convert a socket into a stream.
|
||||
|
||||
PHPAPI php_stream *php_stream_sock_open_host(const char *host, unsigned short port,
|
||||
int socktype, int timeout, int persistent);
|
||||
Open a connection to a host and return a stream.
|
||||
|
||||
PHPAPI php_stream *php_stream_sock_open_unix(const char *path, int persistent,
|
||||
struct timeval *timeout);
|
||||
Open a UNIX domain socket.
|
||||
|
||||
|
||||
Stream Utilities
|
||||
================
|
||||
|
||||
If you need to copy some data from one stream to another, you will be please
|
||||
to know that the streams API provides a standard way to do this:
|
||||
|
||||
PHPAPI size_t php_stream_copy_to_stream(php_stream *src,
|
||||
php_stream *dest, size_t maxlen);
|
||||
|
||||
If you want to copy all remaining data from the src stream, pass
|
||||
PHP_STREAM_COPY_ALL as the maxlen parameter, otherwise maxlen indicates the
|
||||
number of bytes to copy.
|
||||
This function will try to use mmap where available to make the copying more
|
||||
efficient.
|
||||
|
||||
If you want to read the contents of a stream into an allocated memory buffer,
|
||||
you should use:
|
||||
|
||||
PHPAPI size_t php_stream_copy_to_mem(php_stream *src, char **buf,
|
||||
size_t maxlen, int persistent);
|
||||
|
||||
This function will set buf to the address of the buffer that it allocated,
|
||||
which will be maxlen bytes in length, or will be the entire length of the
|
||||
data remaining on the stream if you set maxlen to PHP_STREAM_COPY_ALL.
|
||||
The buffer is allocated using pemalloc(); you need to call pefree() to
|
||||
release the memory when you are done.
|
||||
As with copy_to_stream, this function will try use mmap where it can.
|
||||
|
||||
If you have an existing stream and need to be able to seek() it, you
|
||||
can use this function to copy the contents into a new stream that can
|
||||
be seek()ed:
|
||||
|
||||
PHPAPI int php_stream_make_seekable(php_stream *origstream, php_stream **newstream);
|
||||
|
||||
It returns one of the following values:
|
||||
#define PHP_STREAM_UNCHANGED 0 /* orig stream was seekable anyway */
|
||||
#define PHP_STREAM_RELEASED 1 /* newstream should be used; origstream is no longer valid */
|
||||
#define PHP_STREAM_FAILED 2 /* an error occurred while attempting conversion */
|
||||
#define PHP_STREAM_CRITICAL 3 /* an error occurred; origstream is in an unknown state; you should close origstream */
|
||||
|
||||
make_seekable will always set newstream to be the stream that is valid
|
||||
if the function succeeds.
|
||||
When you have finished, remember to close the stream.
|
||||
|
||||
NOTE: If you only need to seek forwards, there is no need to call this
|
||||
function, as the php_stream_seek can emulate forward seeking when the
|
||||
whence parameter is SEEK_CUR.
|
||||
|
||||
NOTE: Writing to the stream may not affect the original source, so it
|
||||
only makes sense to use this for read-only use.
|
||||
|
||||
NOTE: If the origstream is network based, this function will block
|
||||
until the whole contents have been downloaded.
|
||||
|
||||
NOTE: Never call this function with an origstream that is referenced
|
||||
as a resource! It will close the origstream on success, and this
|
||||
can lead to a crash when the resource is later used/released.
|
||||
|
||||
NOTE: If you are opening a stream and need it to be seekable, use the
|
||||
STREAM_MUST_SEEK option to php_stream_open_wrapper();
|
||||
|
||||
Casting Streams
|
||||
===============
|
||||
What if your extension needs to access the FILE* of a user level file pointer?
|
||||
You need to "cast" the stream into a FILE*, and this is how you do it:
|
||||
|
||||
FILE * fp;
|
||||
php_stream * stream; /* already opened */
|
||||
|
||||
if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void*)&fp, REPORT_ERRORS) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
The prototype is:
|
||||
|
||||
PHPAPI int php_stream_cast(php_stream * stream, int castas, void ** ret, int
|
||||
show_err);
|
||||
|
||||
The show_err parameter, if non-zero, will cause the function to display an
|
||||
appropriate error message of type E_WARNING if the cast fails.
|
||||
|
||||
castas can be one of the following values:
|
||||
PHP_STREAM_AS_STDIO - a stdio FILE*
|
||||
PHP_STREAM_AS_FD - a generic file descriptor
|
||||
PHP_STREAM_AS_SOCKETD - a socket descriptor
|
||||
|
||||
If you ask a socket stream for a FILE*, the abstraction will use fdopen to
|
||||
create it for you. Be warned that doing so may cause buffered data to be lost
|
||||
if you mix ANSI stdio calls on the FILE* with php stream calls on the stream.
|
||||
|
||||
If your system has the fopencookie function, php streams can synthesize a
|
||||
FILE* on top of any stream, which is useful for SSL sockets, memory based
|
||||
streams, data base streams etc. etc.
|
||||
|
||||
In situations where this is not desireable, you should query the stream
|
||||
to see if it naturally supports FILE *. You can use this code snippet
|
||||
for this purpose:
|
||||
|
||||
if (php_stream_is(stream, PHP_STREAM_IS_STDIO)) {
|
||||
/* can safely cast to FILE* with no adverse side effects */
|
||||
}
|
||||
|
||||
You can use:
|
||||
|
||||
PHPAPI int php_stream_can_cast(php_stream * stream, int castas)
|
||||
|
||||
to find out if a stream can be cast, without actually performing the cast, so
|
||||
to check if a stream is a socket you might use:
|
||||
|
||||
if (php_stream_can_cast(stream, PHP_STREAM_AS_SOCKETD) == SUCCESS) {
|
||||
/* it can be a socket */
|
||||
}
|
||||
|
||||
Please note the difference between php_stream_is and php_stream_can_cast;
|
||||
stream_is tells you if the stream is a particular type of stream, whereas
|
||||
can_cast tells you if the stream can be forced into the form you request.
|
||||
The former doesn't change anything, while the later *might* change some
|
||||
state in the stream.
|
||||
|
||||
Stream Internals
|
||||
================
|
||||
|
||||
There are two main structures associated with a stream - the php_stream
|
||||
itself, which holds some state information (and possibly a buffer) and a
|
||||
php_stream_ops structure, which holds the "virtual method table" for the
|
||||
underlying implementation.
|
||||
|
||||
The php_streams ops struct consists of pointers to methods that implement
|
||||
read, write, close, flush, seek, gets and cast operations. Of these, an
|
||||
implementation need only implement write, read, close and flush. The gets
|
||||
method is intended to be used for streams if there is an underlying method
|
||||
that can efficiently behave as fgets. The ops struct also contains a label
|
||||
for the implementation that will be used when printing error messages - the
|
||||
stdio implementation has a label of "STDIO" for example.
|
||||
|
||||
The idea is that a stream implementation defines a php_stream_ops struct, and
|
||||
associates it with a php_stream using php_stream_alloc.
|
||||
|
||||
As an example, the php_stream_fopen() function looks like this:
|
||||
|
||||
PHPAPI php_stream * php_stream_fopen(const char * filename, const char * mode)
|
||||
{
|
||||
FILE * fp = fopen(filename, mode);
|
||||
php_stream * ret;
|
||||
|
||||
if (fp) {
|
||||
ret = php_stream_alloc(&php_stream_stdio_ops, fp, 0, 0, mode);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
php_stream_stdio_ops is a php_stream_ops structure that can be used to handle
|
||||
FILE* based streams.
|
||||
|
||||
A socket based stream would use code similar to that above to create a stream
|
||||
to be passed back to fopen_wrapper (or it's yet to be implemented successor).
|
||||
|
||||
The prototype for php_stream_alloc is this:
|
||||
|
||||
PHPAPI php_stream * php_stream_alloc(php_stream_ops * ops, void * abstract,
|
||||
size_t bufsize, int persistent, const char * mode)
|
||||
|
||||
ops is a pointer to the implementation,
|
||||
abstract holds implementation specific data that is relevant to this instance
|
||||
of the stream,
|
||||
bufsize is the size of the buffer to use - if 0, then buffering at the stream
|
||||
level will be disabled (recommended for underlying sources that implement
|
||||
their own buffering - such a FILE*),
|
||||
persistent controls how the memory is to be allocated - persistently so that
|
||||
it lasts across requests, or non-persistently so that it is freed at the end
|
||||
of a request (it uses pemalloc),
|
||||
mode is the stdio-like mode of operation - php streams places no real meaning
|
||||
in the mode parameter, except that it checks for a 'w' in the string when
|
||||
attempting to write (this may change).
|
||||
|
||||
The mode parameter is passed on to fdopen/fopencookie when the stream is cast
|
||||
into a FILE*, so it should be compatible with the mode parameter of fopen().
|
||||
|
||||
Writing your own stream implementation
|
||||
======================================
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
RULE #1: when writing your own streams: make sure you have configured PHP with
|
||||
--enable-debug.
|
||||
I've taken some great pains to hook into the zend memory manager to help track
|
||||
down allocation problems. It will also help you spot incorrect use of the
|
||||
STREAMS_DC, STREAMS_CC and the semi-private STREAMS_REL_CC macros for function
|
||||
definitions.
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
RULE #2: Please use the stdio stream as a reference; it will help you
|
||||
understand the semantics of the stream operations, and it will always
|
||||
be more up to date than these docs :-)
|
||||
|
||||
First, you need to figure out what data you need to associate with the
|
||||
php_stream. For example, you might need a pointer to some memory for memory
|
||||
based streams, or if you were making a stream to read data from an RDBMS like
|
||||
mysql, you might want to store the connection and rowset handles.
|
||||
|
||||
The stream has a field called abstract that you can use to hold this data.
|
||||
If you need to store more than a single field of data, define a structure to
|
||||
hold it, allocate it (use pemalloc with the persistent flag set
|
||||
appropriately), and use the abstract pointer to refer to it.
|
||||
|
||||
For structured state you might have this:
|
||||
|
||||
struct my_state {
|
||||
MYSQL conn;
|
||||
MYSQL_RES * result;
|
||||
};
|
||||
|
||||
struct my_state * state = pemalloc(sizeof(struct my_state), persistent);
|
||||
|
||||
/* initialize the connection, and run a query, using the fields in state to
|
||||
* hold the results */
|
||||
|
||||
state->result = mysql_use_result(&state->conn);
|
||||
|
||||
/* now allocate the stream itself */
|
||||
stream = php_stream_alloc(&my_ops, state, 0, persistent, "r");
|
||||
|
||||
/* now stream->abstract == state */
|
||||
|
||||
Once you have that part figured out, you can write your implementation and
|
||||
define the your own php_stream_ops struct (we called it my_ops in the above
|
||||
example).
|
||||
|
||||
For example, for reading from this wierd mysql stream:
|
||||
|
||||
static size_t php_mysqlop_read(php_stream * stream, char * buf, size_t count)
|
||||
{
|
||||
struct my_state * state = (struct my_state*)stream->abstract;
|
||||
|
||||
if (buf == NULL && count == 0) {
|
||||
/* in this special case, php_streams is asking if we have reached the
|
||||
* end of file */
|
||||
if (... at end of file ...)
|
||||
return EOF;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* pull out some data from the stream and put it in buf */
|
||||
... mysql_fetch_row(state->result) ...
|
||||
/* we could do something strange, like format the data as XML here,
|
||||
and place that in the buf, but that brings in some complexities,
|
||||
such as coping with a buffer size too small to hold the data,
|
||||
so I won't even go in to how to do that here */
|
||||
}
|
||||
|
||||
Implement the other operations - remember that write, read, close and flush
|
||||
are all mandatory. The rest are optional. Declare your stream ops struct:
|
||||
|
||||
php_stream_ops my_ops = {
|
||||
php_mysqlop_write, php_mysqlop_read, php_mysqlop_close,
|
||||
php_mysqlop_flush, NULL, NULL, NULL,
|
||||
"Strange mySQL example"
|
||||
}
|
||||
|
||||
Thats it!
|
||||
|
||||
Take a look at the STDIO implementation in streams.c for more information
|
||||
about how these operations work.
|
||||
The main thing to remember is that in your close operation you need to release
|
||||
and free the resources you allocated for the abstract field. In the case of
|
||||
the example above, you need to use mysql_free_result on the rowset, close the
|
||||
connection and then use pefree to dispose of the struct you allocated.
|
||||
You may read the stream->persistent field to determine if your struct was
|
||||
allocated in persistent mode or not.
|
||||
|
||||
vim:tw=78:et
|
||||
@@ -1,121 +0,0 @@
|
||||
Submitting Patch for PHP
|
||||
========================
|
||||
|
||||
This document describes how to submit a patch for PHP. Since you are
|
||||
reading this document, you are willing to submit a patch for PHP.
|
||||
Please keep reading! Submitting a patch for PHP is easy. The hard
|
||||
part is making it acceptable for inclusion into our repository. :-)
|
||||
|
||||
How to create patch?
|
||||
--------------------
|
||||
We are working with CVS. You need to get CVS source to create a patch
|
||||
that we accept. Visit http://www.php.net/anoncvs.php to get CVS
|
||||
source. You can check out older versions, but make sure you get
|
||||
the default branch (i.e. Do not use -r option when you check out the
|
||||
CVS source)
|
||||
|
||||
Read CODING_STANDARDS file before you start working.
|
||||
|
||||
Now you are ready to create a patch. Modify source to fix a bug in PHP or
|
||||
add a new feature to PHP. After you finished editing, please test your
|
||||
patch. Read README.TESTING for testing.
|
||||
|
||||
After you finish testing your patch, take diff file using
|
||||
"cvs diff > your.patch" command.
|
||||
|
||||
Read README.TESTING for submitting a test script for your patch. This is
|
||||
not strictly required, but it is preferred to submit a test script along
|
||||
with your patch. Making new test script is very easy. It also helps us
|
||||
to understand what you have been fixed or added to PHP.
|
||||
|
||||
|
||||
Tips for creating patch
|
||||
-----------------------
|
||||
If you would like to fix multiple bugs. It is easier for us if you
|
||||
could create 1 patch for 1 bug, but this is not strictly required.
|
||||
Note though that you might get little response, if your patch is
|
||||
too hard to review.
|
||||
|
||||
If you would like change/add many lines, it is better to ask module
|
||||
maintainer and/or php-dev@lists.php.net, or pear-dev@lists.php.net if
|
||||
you are patching PEAR. Official module maintainers can be found in
|
||||
EXTENSIONS file in PHP source.
|
||||
|
||||
If you are new to CVS (Concurrent Versions System), visit
|
||||
http://cvshome.org/ for details.
|
||||
|
||||
|
||||
Recommended CVS client settings for creating patch file
|
||||
------------------------------------------------------
|
||||
Recommended ~/.cvsrc file setting is:
|
||||
------
|
||||
cvs -z3
|
||||
update -d -P
|
||||
checkout -P
|
||||
diff -u
|
||||
|
||||
------
|
||||
diff -u means:
|
||||
-u Use the unified output format.
|
||||
|
||||
With this CVS setting, you don't have to worry about adding/deleting
|
||||
newlines and spaces.
|
||||
|
||||
|
||||
Check list for submitting patch
|
||||
-------------------------------
|
||||
- Did you run "make test" to check if your patch didn't break
|
||||
other features?
|
||||
- Did you compile PHP with --enable-debug and check php/webserver
|
||||
error logs when you test your patch?
|
||||
- Did you build PHP for multi-threaded web servers. (Optional)
|
||||
- Did you create test script for "make test"? (Recommended)
|
||||
- Did you check your patch is unified format and it does not
|
||||
contain white space changes? (If you are not using recommended
|
||||
cvs setting)
|
||||
- Did you update CVS source before you take final patch?
|
||||
- Did you read the patch again?
|
||||
|
||||
|
||||
Where to send your patch?
|
||||
-------------------------
|
||||
If you are patching C source, send the patch to php-dev@lists.php.net.
|
||||
If you are patching a module, you should also send the patch to the
|
||||
maintainer. Official module maintainers are listed in EXTENSION file
|
||||
in source.
|
||||
|
||||
If you are patching PEAR, send the patch to pear-dev@lists.php.net.
|
||||
|
||||
Please add the prefix "[PATCH]" to your email subject and make sure
|
||||
to include the patch as a MIME attachment even if it is short.
|
||||
Test scripts should be included in the same email.
|
||||
Explain what has been fixed/added/changed by your patch.
|
||||
|
||||
Finally, add the bug Id(s) which can be closed by your patch, if any.
|
||||
|
||||
|
||||
What happens after you submit your patch
|
||||
--------------------------------------
|
||||
If your patch is easy to review and has obviously no side-effects,
|
||||
it might take up to a few hours until someone commits it.
|
||||
|
||||
Because this is a volunteer-driven effort, more complex patches will
|
||||
require more patience on your side.
|
||||
|
||||
If you did not receive any feedback in a few days, please consider
|
||||
resubmitting the description of your patch, along-side with
|
||||
these questions:
|
||||
|
||||
- Is my patch too hard to review? Because of which factors?
|
||||
- Should I split it up in multiple parts?
|
||||
- Are there any unwanted whitespace changes?
|
||||
|
||||
|
||||
What happens when your patch is applied?
|
||||
----------------------------------------
|
||||
Your name will be included together with your email address in the CVS
|
||||
commit log. If your patch affects end-users, a brief description
|
||||
and your name might be added to the NEWS file.
|
||||
|
||||
|
||||
Thank you for submitting patch for PHP!
|
||||
-175
@@ -1,175 +0,0 @@
|
||||
[IMPORTANT NOTICE]
|
||||
------------------
|
||||
Do _not_ ask to developers why some or all tests are failed under
|
||||
your environment! Let us know if you find why it fails. Thank you.
|
||||
|
||||
|
||||
[Testing Basics]
|
||||
----------------
|
||||
To execute test scripts, you must build PHP with some SAPI, then you
|
||||
type "make test" to execute all or some test scripts saved under
|
||||
"tests" directory under source root directory.
|
||||
|
||||
Usage:
|
||||
make test
|
||||
|
||||
"make test" basically executes "run-tests.php" script
|
||||
under source root. Therefore you can execute the script
|
||||
as follows
|
||||
|
||||
./sapi/cli/php -c /path/to/php.ini/ run-tests.php [ext/some_extension_name]
|
||||
|
||||
|
||||
|
||||
[Which "php" executable "make test" look for]
|
||||
---------------------------------------------
|
||||
"make test" executes "run-tests.php" script with "php" binary. Some
|
||||
test scripts such as session must be executed by CGI SAPI. Therefore,
|
||||
you must build PHP with CGI SAPI to perform all tests.
|
||||
|
||||
If PHP is not build with CGI SAPI, "run-tests.php" script uses CLI
|
||||
SAPI. Tests that may not executed by CLI SAPI will be skipped.
|
||||
|
||||
NOTE: PHP binary executing "run-tests.php" and php binary used for
|
||||
executing test scripts may differ. If you use different PHP binary for
|
||||
executing "run-tests.php" script, you may get errors.
|
||||
|
||||
|
||||
[Which php.ini is used]
|
||||
-----------------------
|
||||
"make test" force to use php.ini-dist as default config file. If
|
||||
you would like to test with other configuration file, user
|
||||
"run-tests.php" script.
|
||||
|
||||
Example:
|
||||
./sapi/cli/php -c /path/to/php.ini/ ext/standard
|
||||
|
||||
If you use php.ini other than php.ini-dist, you may see more failed
|
||||
tests.
|
||||
|
||||
|
||||
[Which test scripts are executed]
|
||||
---------------------------------
|
||||
"run-tests.php" ("make test") executes all test scripts by default
|
||||
by looking all directory named "tests". If there are files have "phpt"
|
||||
extension, "run-tests.php" takes test php code from the file and
|
||||
executes it.
|
||||
|
||||
Tester can easily executes tests selectively with as follows.
|
||||
|
||||
Example:
|
||||
./sapi/cli/php -c /path/to/php.ini/ run-tests.php ext/mbstring
|
||||
|
||||
|
||||
[Test results]
|
||||
--------------
|
||||
Test results are printed to standard output. If there is a failed test,
|
||||
"run-tests.php" script saves the result, expected result and code
|
||||
executed to the test script directory. For example, if
|
||||
ext/myext/tests/myext.phpt is failed to pass, following files are
|
||||
created:
|
||||
|
||||
ext/myext/tests/myext.out - output from test script
|
||||
ext/myext/tests/myext.exp - expected output
|
||||
ext/myext/tests/myext.php - test script executed
|
||||
|
||||
Tester can verify these files, if failed test is actually a bug
|
||||
or not.
|
||||
|
||||
|
||||
[Creating new test files]
|
||||
-------------------------
|
||||
Writing test file is very easy if you are used to PHP. Test file
|
||||
has following format. Here is a actual test file from iconv module.
|
||||
|
||||
===== ext/iconv/002.phpt =======
|
||||
--TEST--
|
||||
UCS4BE to ASCII
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php include('002.inc'); ?>
|
||||
--EXPECT--
|
||||
abcd
|
||||
abcd
|
||||
===== end of ext/iconv/002.phpt =======
|
||||
|
||||
"--TEST--" is title of the test.
|
||||
"--SKIPIF--" is condition when to skip this test.
|
||||
"--POST--" is POST variable passed to test script.
|
||||
"--GET--" is GET variable passed to test script.
|
||||
"--FILE--" is the test script.
|
||||
"--EXPECT--" is the expected output from the test script.
|
||||
|
||||
ext/iconv/002.phpt uses 2 files. "skipif.inc" is used to skip
|
||||
test when test cannot be performed such as iconv module is not
|
||||
compiled or loaded.
|
||||
|
||||
==== ext/iconv/skipif.inc ====
|
||||
<?php
|
||||
// This script prints "skip" if condition does not meet.
|
||||
|
||||
if (!extension_loaded("iconv") && ini_get("enable_dl")) {
|
||||
$dlext = (substr(PHP_OS, 0, 3) == "WIN") ? ".dll" : ".so";
|
||||
@dl("iconv$dlext");
|
||||
}
|
||||
if (!extension_loaded("iconv")) {
|
||||
die("skip\n");
|
||||
}
|
||||
?>
|
||||
==== end of ext/iconv/skipif.inc ====
|
||||
|
||||
ext/inconv/002.inc is the test script. "run-tests.php" script
|
||||
executes test script with CGI executable.
|
||||
|
||||
==== ext/iconv/002.inc ===
|
||||
<?php
|
||||
/*
|
||||
Expected output:
|
||||
abcd
|
||||
abcd
|
||||
*/
|
||||
|
||||
$s = unpack("V*", iconv("ascii","UCS-4LE", "abcd"));
|
||||
foreach($s as $c) { print "&#$c;"; } print "\n";
|
||||
|
||||
$s = pack("NNNN", 97, 98, 99, 100);
|
||||
$q = iconv("UCS-4BE", "ascii", $s);
|
||||
print $q; print "\n";
|
||||
?>
|
||||
=== end of ext/iconv/002.inc ===
|
||||
|
||||
Test script and skipif code may be directly write into *.phpt.
|
||||
However, it is recommended to use other files for ease of writing
|
||||
test script. For instance, you can execute test script under
|
||||
ext/iconv as follows:
|
||||
|
||||
./sapi/cli/php -c /path/to/php.ini/ ext/iconv
|
||||
|
||||
|
||||
[How to help us]
|
||||
----------------
|
||||
If you find bug in PHP, you can submit bug report AND test script
|
||||
for us. You don't have to write complete script, just give us test
|
||||
script with following format. Please test the script and make sure
|
||||
you write the correct ACTUAL OUTPUT and EXPECTED OUTPUT before you
|
||||
submit.
|
||||
|
||||
<?php
|
||||
/*
|
||||
Bug #12345
|
||||
substr() bug. Do not return expected string.
|
||||
|
||||
ACTUAL OUTPUT
|
||||
XYXA
|
||||
|
||||
EXPECTED OUTPUT
|
||||
ABCD
|
||||
*/
|
||||
|
||||
$str = "XYZABCD";
|
||||
echo substr($str,3,7);
|
||||
|
||||
?>
|
||||
@@ -1,123 +0,0 @@
|
||||
PHP Build System V5 Overview
|
||||
|
||||
- supports Makefile.ins during transition phase
|
||||
- not-really-portable Makefile includes have been eliminated
|
||||
- supports seperate build directories without VPATH by using
|
||||
explicit rules only
|
||||
- does not waste disk-space/CPU-time for building temporary libraries
|
||||
=> especially noticeable on slower systems
|
||||
- slow recursive make replaced with one global Makefile
|
||||
- eases integration of proper dependencies
|
||||
- adds PHP_DEFINE(what[, value]) which creates a single include-file
|
||||
per what. This will allow more fine-grained dependencies.
|
||||
- abandoning the "one library per directory" concept
|
||||
- improved integration of the CLI
|
||||
- several new targets
|
||||
build-modules: builds and copies dynamic modules into modules/
|
||||
install-cli: installs the CLI only, so that the install-sapi
|
||||
target does only what its name says
|
||||
- finally abandoned automake (still requires aclocal at this time)
|
||||
- changed some configure-time constructs to run at buildconf-time
|
||||
- upgraded shtool to 1.5.4
|
||||
- removed $(moduledir) (use EXTENSION_DIR)
|
||||
|
||||
The Reason For a New System
|
||||
|
||||
It became more and more apparent that there is a severe need
|
||||
for addressing the portability concerns and improving the chance
|
||||
that your build is correct (how often have you been told to
|
||||
"make clean"? When this is done, you won't need to anymore).
|
||||
|
||||
|
||||
If You Build PHP on a Unix System
|
||||
|
||||
|
||||
You, as a user of PHP, will notice no changes. Of course, the build
|
||||
system will be faster, look better and work smarter.
|
||||
|
||||
|
||||
|
||||
If You Are Developing PHP
|
||||
|
||||
|
||||
|
||||
|
||||
Extension developers:
|
||||
|
||||
Makefile.ins are abandoned. The files which are to be compiled
|
||||
are specified in the config.m4 now using the following macro:
|
||||
|
||||
PHP_NEW_EXTENSION(foo, foo.c bar.c baz.cpp, $ext_shared)
|
||||
|
||||
E.g. this enables the extension foo which consists of three source-code
|
||||
modules, two in C and one in C++. And dependending on the user's
|
||||
wishes, the extension will even be built as a dynamic module.
|
||||
|
||||
The full syntax:
|
||||
|
||||
PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags]]])
|
||||
|
||||
Please have a look at acinclude.m4 for the gory details and meanings
|
||||
of the other parameters.
|
||||
|
||||
And that's basically it for the extension side.
|
||||
|
||||
If you previously built sub-libraries for this module, add
|
||||
the source-code files here as well. If you need to specify
|
||||
separate include directories, do it this way:
|
||||
|
||||
PHP_NEW_EXTENSION(foo, foo.c mylib/bar.c mylib/gregor.c,,,-I@ext_srcdir@/lib)
|
||||
|
||||
E.g. this builds the three files which are located relative to the
|
||||
extension source directory and compiles all three files with the
|
||||
special include directive (@ext_srcdir@ is automatically replaced).
|
||||
|
||||
Now, you need to tell the build system that you want to build files
|
||||
in a directory called $ext_builddir/lib:
|
||||
|
||||
PHP_ADD_BUILD_DIR($ext_builddir/lib)
|
||||
|
||||
Make sure to call this after PHP_NEW_EXTENSION, because $ext_builddir
|
||||
is only set by the latter.
|
||||
|
||||
If you have a complex extension, you might to need add special
|
||||
Make rules. You can do this by calling PHP_ADD_MAKEFILE_FRAGMENT
|
||||
in your config.m4 after PHP_NEW_EXTENSION.
|
||||
|
||||
This will read a file in the source-dir of your extension called
|
||||
Makefile.frag. In this file, $(builddir) and $(srcdir) will be
|
||||
replaced by the values which are correct for your extension
|
||||
and which are again determined by the PHP_NEW_EXTENSION macro.
|
||||
|
||||
Make sure to prefix *all* relative paths correctly with either
|
||||
$(builddir) or $(srcdir). Because the build system does not
|
||||
change the working directory anymore, we must use either
|
||||
absolute paths or relative ones to the top build-directory.
|
||||
Correct prefixing ensures that.
|
||||
|
||||
|
||||
SAPI developers:
|
||||
|
||||
Instead of using PHP_SAPI=foo/PHP_BUILD_XYZ, you will need to type
|
||||
|
||||
PHP_SELECT_SAPI(name, type, sources.c)
|
||||
|
||||
I.e. specify the source-code files as above and also pass the
|
||||
information regarding how PHP is supposed to be built (shared
|
||||
module, program, etc).
|
||||
|
||||
For example for APXS:
|
||||
|
||||
PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php4.c php_apache.c)
|
||||
|
||||
|
||||
|
||||
General info
|
||||
|
||||
The foundation for the new system is the flexible handling of
|
||||
sources and their contexts. With the help of macros you
|
||||
can define special flags for each source-file, where it is
|
||||
located, in which target context it can work, etc.
|
||||
|
||||
Have a look at the well documented macros
|
||||
PHP_ADD_SOURCES(_X) in acinclude.m4.
|
||||
-126
@@ -1,126 +0,0 @@
|
||||
Using PHP4 with the Zeus Web Server
|
||||
-----------------------------------
|
||||
|
||||
Zeus fully supports running PHP in combination with our
|
||||
webserver. There are three different interfaces that can be used to
|
||||
enable PHP:
|
||||
|
||||
* CGI
|
||||
* ISAPI
|
||||
* FastCGI
|
||||
|
||||
Of the three, we recommend using FastCGI, which has been tested and
|
||||
benchmarked as providing the best performance and reliability.
|
||||
|
||||
Full details of how to install PHP are available from our
|
||||
website, at:
|
||||
|
||||
http://support.zeus.com/products/php.html
|
||||
|
||||
If you have any problems, please check the support site for more
|
||||
up-to-date information and advice.
|
||||
|
||||
|
||||
Quick guide to installing FastCGI with Zeus
|
||||
-------------------------------------------
|
||||
|
||||
Step 1 - obtain and install FastCGI development kit.
|
||||
|
||||
Grab the package from:
|
||||
http://www.fastcgi.com/dist/devkit_2.2.0.tar.gz
|
||||
|
||||
Extract the package and follow the instructions:
|
||||
./configure
|
||||
make
|
||||
make export
|
||||
(run the last as root)
|
||||
|
||||
This will install to /usr/local/lib/libfcgi.a
|
||||
and /usr/local/include/*fcgi*
|
||||
|
||||
|
||||
|
||||
Step 2 - Compile PHP as FastCGI.
|
||||
|
||||
Compile as follows:
|
||||
./configure --with-fastcgi
|
||||
make
|
||||
|
||||
Note that PHP has many options to the configure script -
|
||||
e.g. --with-mysql. You will probably want to select your usual options
|
||||
before compiling; the above is just a bare minimum, for illustration.
|
||||
|
||||
After compilation finishes, you will be left with an executable
|
||||
program called 'php'. Copy this into your document root, under a
|
||||
dedicated FastCGI directory (e.g. $DOCROOT/fcgi-bin/php)
|
||||
|
||||
|
||||
Step 3 - configure Zeus
|
||||
|
||||
Four stages:
|
||||
- enable FastCGI
|
||||
- configure FastCGI
|
||||
- setup alias for FastCGI
|
||||
- setup alias for PHP
|
||||
|
||||
1) Using the admin server, go to the 'module configuration' page for
|
||||
your virtual server, and ensure that 'fastcgi' is enabled (select the
|
||||
tickbox to the left).
|
||||
|
||||
2) While we can run FastCGI's locally, there are known problems with
|
||||
some OS's (specifically, the communication between web server and
|
||||
FastCGI happens over a unix domain socket, and some OS's have trouble
|
||||
sustaining high connection rates over these sockets). So instead, we
|
||||
are going to set up the PHP FastCGI to run 'remotely' over localhost
|
||||
(this uses TCP sockets, which do not suffer this problem). Go to the
|
||||
'fastcgi configuration' page, and under 'add remote fastcgi':
|
||||
Add Remote FastCGI
|
||||
Docroot path /fcgi-bin/php
|
||||
Remote machine localhost:8002
|
||||
The first entry is where you saved PHP, above.
|
||||
The second entry is localhost:<any unused port>
|
||||
We will start the FastCGI listening on this port shortly.
|
||||
Click 'update' to commit these changes.
|
||||
|
||||
3) Go to the path mapping module and add an alias for FastCGI:
|
||||
Add Alias
|
||||
Docroot path /fcgi-bin
|
||||
Filesystem directory /path/to/docroot/fcgi-bin
|
||||
Alias type fastcgi
|
||||
Click 'update' to commit these changes
|
||||
|
||||
4) Also on the path mapping module, add a handler for PHP:
|
||||
Add handler
|
||||
File extension php
|
||||
Handler /fcgi-bin/php
|
||||
Click 'update' to commit these changes
|
||||
|
||||
Finally restart your virtual server for these changes to take effect.
|
||||
|
||||
|
||||
Step 4 - start PHP as a FastCGI runner
|
||||
|
||||
When you start PHP, it will pre-fork a given number of child processes
|
||||
to handle incoming PHP requests. Each process will handle a given
|
||||
number of requests before exiting (and being replaced by a newly
|
||||
forked process). You can control these two parameters by setting the
|
||||
following environment variables BEFORE starting the FastCGI runner:
|
||||
|
||||
PHP_FCGI_CHILDREN - the number of child processes to pre-fork. If not
|
||||
set, defaults to 8.
|
||||
|
||||
PHP_FCGI_MAX_REQUESTS - the number of requests each PHP child process
|
||||
handles before exiting. If not set, defaults to 500.
|
||||
|
||||
To start the FastCGI runner, execute '$ZEUSHOME/web/bin/fcgirunner
|
||||
8002 $DOCROOT/fcgi-bin/php'. Substitute the appropriate values for
|
||||
$ZEUSHOME and $DOCROOT; also substitute for 8002 the port you chose,
|
||||
above.
|
||||
|
||||
To stop the runner (e.g. to experiment with the above environment
|
||||
variables) you will need to manually stop and running PHP
|
||||
processes. (Use 'ps' and 'kill'). As it is PHP which is forking lots
|
||||
of children and not the runner, Zeus unfortunately cannot keep track
|
||||
of what processes are running, sorry. A typical command line may look
|
||||
like 'ps -efl | grep $DOCROOT/fcgi-bin/php | grep -v grep | awk
|
||||
'{print $4}' | xargs kill'
|
||||
@@ -1,170 +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.
|
||||
|
||||
Zend
|
||||
----
|
||||
For PHP 4.3.0:
|
||||
* Allow foreach ($array as $k => &$val) syntax. right now we cannot
|
||||
traverse an array without copying each element.
|
||||
* Allow foreach ($array as $k => list($a, $b)) syntax for multi
|
||||
dimensional arrays.
|
||||
* Look at replacing c-lib call tolower().
|
||||
* Make hash API functions work with HASH_OF() to save time.
|
||||
* Allow to set a default value for call-by-reference-parameters.
|
||||
eg: function hello (&$pallo = NULL) {}
|
||||
* Disallow function(method) redefinition in class.
|
||||
* Add configure test to determine if dlsym() requires underscore and set
|
||||
DLSYM_NEEDS_UNDERSCORE accordingly. Perl and zsh have it in configure,
|
||||
for example. (DONE?)
|
||||
|
||||
For PHP 5.0.0:
|
||||
* Native large number support (probably with GNU GMP)
|
||||
* Const'ify APIs. Right now, many functions leave parameters untouched,
|
||||
but don't declare those as const. This makes interaction with other
|
||||
interfaces difficult which pass const parameters to us.
|
||||
|
||||
|
||||
global
|
||||
------
|
||||
For PHP 4.3.0:
|
||||
* Add aliases to functions to conform to new naming conventions, e.g.
|
||||
str_to_upper().
|
||||
* Make all extensions thread-safe.
|
||||
* Make everything on the language-level independent of your locale
|
||||
settings.
|
||||
* Change PHP error messages, so that they point to pages or sections
|
||||
in the PHP Manual.
|
||||
* Make sure that all ZTS globals get destructed. Most ts_allocate_id()
|
||||
calls should have a dtor entry.
|
||||
* Activate all extensions by default that don't rely on external
|
||||
dependencies. (eg ftp) (DONE?)
|
||||
* on some platforms unimplemented function will just do nothing
|
||||
(e.g. symlink) they should print a warning or not even be defined!
|
||||
(DONE ?)
|
||||
* Use arg_separator.input to implode args in the CGI sapi extension
|
||||
and arg_separator.input to explode in php_build_argv(). (DONE?)
|
||||
* Change the odbc_fetch_into() function to require ALWAYS the first two
|
||||
parameters ($conn_id and $array), and make the third (row) be optional.
|
||||
* Remove --with-openlink configure option (--with-iodbc replaces it).
|
||||
* Implement flush feature suitable for nested output buffers.
|
||||
|
||||
For PHP 5.0.0
|
||||
* bundle and use curl lib for fopen wrapper.
|
||||
* --enable-all in configure. (--enable-shared=max ...)
|
||||
* make configure print out a summary when it's done (like XEmacs)
|
||||
* replace standard functions which work on static data with
|
||||
reentrancy-safe functions (DONE?).
|
||||
* make SAPI conform to CGI/1.1. Currently, all SAPI modules
|
||||
define REMOTE_ADDR etc. themselves and reach only various level
|
||||
of compliance.
|
||||
* see what functions might need to be changed to use HashPosition, so
|
||||
that the internal array pointer is not affected.
|
||||
* Move most extensions and PEAR packages out of the PHP CVS tree,
|
||||
include them again during release packaging.
|
||||
|
||||
|
||||
Other
|
||||
* use thread-safe resolver functions (either require BIND 8 or adns).
|
||||
* implement javadoc based function docs template system.
|
||||
* provide optional IPv6 support.
|
||||
* find a better way to implement script timeouts. SIGVTALRM is used
|
||||
by some POSIX threads implementations (i.e. OpenBSD) and is not
|
||||
available in ZTS mode.
|
||||
|
||||
|
||||
documentation
|
||||
-------------
|
||||
* Add remarks in the documentation which functions are not implemented
|
||||
on win32.
|
||||
* Add remarks in the documentation which functions are not binary-safe.
|
||||
* Update curl documentation (DONE?)
|
||||
* Add developer documentation.
|
||||
* Add detailed documentation for Java extension.
|
||||
|
||||
ext/bz2
|
||||
-------
|
||||
* Add ini setting for decompression buffer size. The default 4k is to small
|
||||
for big files and takes ages to decompress. However, 40k which perform
|
||||
quite good with big files may be to much under certain environments as
|
||||
default setting. There should be consideren different default sizes for
|
||||
different SAPIS (e.g. apache and cli).
|
||||
|
||||
ext/curl
|
||||
--------
|
||||
* Have a warning scheme for when people use unsupported features.
|
||||
|
||||
ext/oci8
|
||||
--------
|
||||
* All OCIFetch*() functions should return 0 for no more data and false on
|
||||
error.
|
||||
* Have a flag that trims trailing spaces from CHAR fields on retrieval.
|
||||
* Make allow_call_time_pass_reference=Off working.
|
||||
* For additional todo information, see oci8.c, in ext/oci8
|
||||
|
||||
ext/pcre
|
||||
--------
|
||||
* Allow user to set PCRE_NOTEMPTY, PCRE_ANCHORED at execution time, maybe
|
||||
|
||||
ext/pcntl
|
||||
---------
|
||||
* Change internal callback handler to use TICKS
|
||||
* Remove all zend_extension code
|
||||
* Add object callback support to pcntl_signal()
|
||||
|
||||
ext/pgsql
|
||||
---------
|
||||
For PHP 4.3.0:
|
||||
* Add pg_metadata() with metadata cache feature.
|
||||
* Add pg_convert() to check and convert array value for query.
|
||||
* Add pg_insert/pg_update/pg_delete/pg_select for simple query.
|
||||
|
||||
ext/session
|
||||
-----------
|
||||
For PHP 4.3.0:
|
||||
* session_abort() to abort session. ie: Do not save session data.
|
||||
* Allow unset($_SESSION) or unset($HTTP_SESSION_VARS) to unset
|
||||
session vars regardless of register_globals setting.
|
||||
|
||||
Other:
|
||||
* Maybe implement finer-grained session variables that could be
|
||||
locked individually.
|
||||
* Write a network-transparent storage back-end with fallover
|
||||
facilities
|
||||
* Provide a callback facility which is executed upon encountering
|
||||
an unknown class name during deserialization
|
||||
|
||||
ext/sockets
|
||||
-----------
|
||||
* Implement IPv6
|
||||
* Review/Fix vectors
|
||||
|
||||
ext/standard
|
||||
------------
|
||||
* Add a version number to data serialized via serialize().
|
||||
* Possibly modify parsing of GPC data to automatically create arrays if
|
||||
variable name is seen more than once.
|
||||
* Implement regex-cache for url-functions.
|
||||
* stri_replace(). (Andrei)
|
||||
* Move socket related functions to fsock.c.
|
||||
* NOT binary safe:
|
||||
strtok()
|
||||
basename()
|
||||
dirname()
|
||||
strrpos()
|
||||
strrchr()
|
||||
strip_tags()
|
||||
|
||||
ext/wddx
|
||||
--------
|
||||
* See if we can support the remaining data types:
|
||||
dateTime
|
||||
binary
|
||||
|
||||
http://www.wddx.org/WDDX_SDK_10a/7__References/WDDX_DTD.htm
|
||||
(Andrei)
|
||||
|
||||
* implement wddx_packet_as_javascript(). (Andrei)
|
||||
|
||||
other cool stuff
|
||||
----------------
|
||||
* PVM extension
|
||||
@@ -1,3 +0,0 @@
|
||||
- clean up .cvsignores
|
||||
- purge Makefile.ins and replace PHP_EXTENSION in config.m4s
|
||||
with appropiate calls to PHP_NEW_EXTENSION
|
||||
@@ -1,26 +0,0 @@
|
||||
Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
- Neither name of the copyright holders nor the names of their contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,6 +0,0 @@
|
||||
## process this file with automake to produce Makefile.am
|
||||
AUTOMAKE_OPTIONS=foreign
|
||||
noinst_LTLIBRARIES=libtsrm.la
|
||||
libtsrm_la_SOURCES = TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c
|
||||
|
||||
depend:
|
||||
@@ -1,2 +0,0 @@
|
||||
- Improve the lock in ts_resource_ex() in order to cover less code.
|
||||
This can probably be done by more careful hash table access
|
||||
-603
@@ -1,603 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Thread Safe Resource Manager |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski|
|
||||
| This source file is subject to the TSRM license, that is bundled |
|
||||
| with this package in the file LICENSE |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
#ifdef ZTS
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#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;
|
||||
ts_allocate_ctor ctor;
|
||||
ts_allocate_dtor dtor;
|
||||
} tsrm_resource_type;
|
||||
|
||||
|
||||
/* The memory manager table */
|
||||
static tsrm_tls_entry **tsrm_tls_table=NULL;
|
||||
static int tsrm_tls_table_size;
|
||||
static ts_rsrc_id id_count;
|
||||
|
||||
/* The resource sizes table */
|
||||
static tsrm_resource_type *resource_types_table=NULL;
|
||||
static int resource_types_table_size;
|
||||
|
||||
|
||||
static MUTEX_T tsmm_mutex; /* thread-safe memory manager mutex */
|
||||
|
||||
/* New thread handlers */
|
||||
static tsrm_thread_begin_func_t tsrm_new_thread_begin_handler;
|
||||
static tsrm_thread_end_func_t tsrm_new_thread_end_handler;
|
||||
|
||||
/* Debug support */
|
||||
int tsrm_error(int level, const char *format, ...);
|
||||
|
||||
/* Read a resource from a thread's resource storage */
|
||||
static int tsrm_error_level;
|
||||
static FILE *tsrm_error_file;
|
||||
|
||||
#if TSRM_DEBUG
|
||||
#define TSRM_ERROR(args) tsrm_error args
|
||||
#define TSRM_SAFE_RETURN_RSRC(array, offset, range) \
|
||||
{ \
|
||||
int unshuffled_offset = TSRM_UNSHUFFLE_RSRC_ID(offset); \
|
||||
\
|
||||
if (offset==0) { \
|
||||
return &array; \
|
||||
} else if ((unshuffled_offset)>=0 && (unshuffled_offset)<(range)) { \
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Successfully fetched resource id %d for thread id %ld - 0x%0.8X", \
|
||||
unshuffled_offset, (long) thread_resources->thread_id, array[unshuffled_offset])); \
|
||||
return array[unshuffled_offset]; \
|
||||
} else { \
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Resource id %d is out of range (%d..%d)", \
|
||||
unshuffled_offset, TSRM_SHUFFLE_RSRC_ID(0), TSRM_SHUFFLE_RSRC_ID(thread_resources->count-1))); \
|
||||
return NULL; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define TSRM_ERROR
|
||||
#define TSRM_SAFE_RETURN_RSRC(array, offset, range) \
|
||||
if (offset==0) { \
|
||||
return &array; \
|
||||
} else { \
|
||||
return array[TSRM_UNSHUFFLE_RSRC_ID(offset)]; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PTHREADS)
|
||||
/* Thread local storage */
|
||||
static pthread_key_t tls_key;
|
||||
#elif defined(TSRM_ST)
|
||||
static int tls_key;
|
||||
#elif defined(TSRM_WIN32)
|
||||
static DWORD tls_key;
|
||||
#endif
|
||||
|
||||
|
||||
/* Startup TSRM (call once for the entire process) */
|
||||
TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename)
|
||||
{
|
||||
#if defined(GNUPTH)
|
||||
pth_init();
|
||||
#elif defined(PTHREADS)
|
||||
pthread_key_create( &tls_key, 0 );
|
||||
#elif defined(TSRM_ST)
|
||||
st_init();
|
||||
st_key_create(&tls_key, 0);
|
||||
#elif defined(TSRM_WIN32)
|
||||
tls_key = TlsAlloc();
|
||||
#endif
|
||||
|
||||
tsrm_error_file = stderr;
|
||||
tsrm_error_set(debug_level, debug_filename);
|
||||
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) {
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate 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) {
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate resource types table"));
|
||||
free(tsrm_tls_table);
|
||||
tsrm_tls_table = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsmm_mutex = tsrm_mutex_alloc();
|
||||
|
||||
tsrm_new_thread_begin_handler = tsrm_new_thread_end_handler = NULL;
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Started up TSRM, %d expected threads, %d expected resources", expected_threads, expected_resources));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Shutdown TSRM (call once for the entire process) */
|
||||
TSRM_API void tsrm_shutdown(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (tsrm_tls_table) {
|
||||
for (i=0; i<tsrm_tls_table_size; i++) {
|
||||
tsrm_tls_entry *p = tsrm_tls_table[i], *next_p;
|
||||
|
||||
while (p) {
|
||||
int j;
|
||||
|
||||
next_p = p->next;
|
||||
for (j=0; j<id_count; j++) {
|
||||
free(p->storage[j]);
|
||||
}
|
||||
free(p->storage);
|
||||
free(p);
|
||||
p = next_p;
|
||||
}
|
||||
}
|
||||
free(tsrm_tls_table);
|
||||
tsrm_tls_table = NULL;
|
||||
}
|
||||
if (resource_types_table) {
|
||||
free(resource_types_table);
|
||||
resource_types_table=NULL;
|
||||
}
|
||||
tsrm_mutex_free(tsmm_mutex);
|
||||
tsmm_mutex = NULL;
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Shutdown TSRM"));
|
||||
if (tsrm_error_file!=stderr) {
|
||||
fclose(tsrm_error_file);
|
||||
}
|
||||
#if defined(GNUPTH)
|
||||
pth_kill();
|
||||
#elif defined(PTHREADS)
|
||||
pthread_key_delete(tls_key);
|
||||
#elif defined(TSRM_WIN32)
|
||||
TlsFree(tls_key);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* allocates a new thread-safe-resource id */
|
||||
TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor)
|
||||
{
|
||||
int i;
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtaining a new resource id, %d bytes", size));
|
||||
|
||||
tsrm_mutex_lock(tsmm_mutex);
|
||||
|
||||
/* obtain a resource id */
|
||||
*rsrc_id = TSRM_SHUFFLE_RSRC_ID(id_count++);
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtained resource id %d", *rsrc_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) {
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate storage for resource"));
|
||||
*rsrc_id = 0;
|
||||
return 0;
|
||||
}
|
||||
resource_types_table_size = id_count;
|
||||
}
|
||||
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].size = size;
|
||||
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].ctor = ctor;
|
||||
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].dtor = dtor;
|
||||
|
||||
/* enlarge the arrays for the already active threads */
|
||||
for (i=0; i<tsrm_tls_table_size; i++) {
|
||||
tsrm_tls_entry *p = tsrm_tls_table[i];
|
||||
|
||||
while (p) {
|
||||
if (p->count < id_count) {
|
||||
int j;
|
||||
|
||||
p->storage = (void *) realloc(p->storage, sizeof(void *)*id_count);
|
||||
for (j=p->count; j<id_count; j++) {
|
||||
p->storage[j] = (void *) malloc(resource_types_table[j].size);
|
||||
if (resource_types_table[j].ctor) {
|
||||
resource_types_table[j].ctor(p->storage[j], &p->storage);
|
||||
}
|
||||
}
|
||||
p->count = id_count;
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully allocated new resource id %d", *rsrc_id));
|
||||
return *rsrc_id;
|
||||
}
|
||||
|
||||
|
||||
static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_T thread_id)
|
||||
{
|
||||
int i;
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Creating data structures for thread %x", thread_id));
|
||||
(*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;
|
||||
|
||||
#if defined(PTHREADS)
|
||||
/* Set thread local storage to this new thread resources structure */
|
||||
pthread_setspecific(tls_key, (void *) *thread_resources_ptr);
|
||||
#elif defined(TSRM_ST)
|
||||
st_thread_setspecific(tls_key, (void *) *thread_resources_ptr);
|
||||
#elif defined(TSRM_WIN32)
|
||||
TlsSetValue(tls_key, (void *) *thread_resources_ptr);
|
||||
#endif
|
||||
|
||||
if (tsrm_new_thread_begin_handler) {
|
||||
tsrm_new_thread_begin_handler(thread_id, &((*thread_resources_ptr)->storage));
|
||||
}
|
||||
for (i=0; i<id_count; i++) {
|
||||
(*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size);
|
||||
if (resource_types_table[i].ctor) {
|
||||
resource_types_table[i].ctor((*thread_resources_ptr)->storage[i], &(*thread_resources_ptr)->storage);
|
||||
}
|
||||
}
|
||||
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
|
||||
if (tsrm_new_thread_end_handler) {
|
||||
tsrm_new_thread_end_handler(thread_id, &((*thread_resources_ptr)->storage));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* fetches the requested resource for the current thread */
|
||||
TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
|
||||
{
|
||||
THREAD_T thread_id;
|
||||
int hash_value;
|
||||
tsrm_tls_entry *thread_resources;
|
||||
|
||||
if (!th_id) {
|
||||
#if defined(PTHREADS)
|
||||
/* Fast path for looking up the resources for the current
|
||||
* thread. Its used by just about every call to
|
||||
* ts_resource_ex(). This avoids the need for a mutex lock
|
||||
* and our hashtable lookup.
|
||||
*/
|
||||
thread_resources = pthread_getspecific(tls_key);
|
||||
#elif defined(TSRM_ST)
|
||||
thread_resources = st_thread_getspecific(tls_key);
|
||||
#elif defined(TSRM_WIN32)
|
||||
thread_resources = TlsGetValue(tls_key);
|
||||
#else
|
||||
thread_resources = NULL;
|
||||
#endif
|
||||
if (thread_resources) {
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for current thread %d", id, (long) thread_resources->thread_id));
|
||||
/* Read a specific resource from the thread's resources.
|
||||
* This is called outside of a mutex, so have to be aware about external
|
||||
* changes to the structure as we read it.
|
||||
*/
|
||||
TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
|
||||
}
|
||||
thread_id = tsrm_thread_id();
|
||||
} else {
|
||||
thread_id = *th_id;
|
||||
}
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for thread %ld", 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_ex(id, &thread_id);
|
||||
} 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_ex(id, &thread_id);
|
||||
/*
|
||||
* thread_resources = thread_resources->next;
|
||||
* break;
|
||||
*/
|
||||
}
|
||||
} while (thread_resources);
|
||||
}
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
/* Read a specific resource from the thread's resources.
|
||||
* This is called outside of a mutex, so have to be aware about external
|
||||
* changes to the structure as we read it.
|
||||
*/
|
||||
TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
|
||||
}
|
||||
|
||||
|
||||
/* frees all resources allocated for the current thread */
|
||||
void ts_free_thread(void)
|
||||
{
|
||||
tsrm_tls_entry *thread_resources;
|
||||
int i;
|
||||
THREAD_T thread_id = tsrm_thread_id();
|
||||
int hash_value;
|
||||
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) {
|
||||
for (i=0; i<thread_resources->count; i++) {
|
||||
if (resource_types_table[i].dtor) {
|
||||
resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
|
||||
}
|
||||
}
|
||||
for (i=0; i<thread_resources->count; i++) {
|
||||
free(thread_resources->storage[i]);
|
||||
}
|
||||
free(thread_resources->storage);
|
||||
if (last) {
|
||||
last->next = thread_resources->next;
|
||||
} else {
|
||||
tsrm_tls_table[hash_value] = thread_resources->next;
|
||||
}
|
||||
#if defined(PTHREADS)
|
||||
pthread_setspecific(tls_key, 0);
|
||||
#elif defined(TSRM_WIN32)
|
||||
TlsSetValue(tls_key, 0);
|
||||
#endif
|
||||
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 TSRM_WIN32
|
||||
return GetCurrentThreadId();
|
||||
#elif defined(NETWARE)
|
||||
return NXThreadGetId();
|
||||
#elif defined(GNUPTH)
|
||||
return pth_self();
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_self();
|
||||
#elif defined(NSAPI)
|
||||
return systhread_current();
|
||||
#elif defined(PI3WEB)
|
||||
return PIThread_getCurrent();
|
||||
#elif defined(TSRM_ST)
|
||||
return st_thread_self();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Allocate a mutex */
|
||||
TSRM_API MUTEX_T tsrm_mutex_alloc(void)
|
||||
{
|
||||
MUTEX_T mutexp;
|
||||
#ifdef NETWARE
|
||||
long flags = 0; /* Don't require NX_MUTEX_RECURSIVE, I guess */
|
||||
NXHierarchy_t order = 0;
|
||||
NX_LOCK_INFO_ALLOC (lockInfo, "PHP-TSRM", 0);
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
mutexp = malloc(sizeof(CRITICAL_SECTION));
|
||||
InitializeCriticalSection(mutexp);
|
||||
#elif defined(NETWARE)
|
||||
mutexp = NXMutexAlloc(flags, order, &lockInfo); /* return value ignored for now */
|
||||
#elif defined(GNUPTH)
|
||||
mutexp = (MUTEX_T) malloc(sizeof(*mutexp));
|
||||
pth_mutex_init(mutexp);
|
||||
#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();
|
||||
#elif defined(TSRM_ST)
|
||||
mutexp = st_mutex_new();
|
||||
#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 TSRM_WIN32
|
||||
DeleteCriticalSection(mutexp);
|
||||
#elif defined(NETWARE)
|
||||
NXMutexFree(mutexp);
|
||||
#elif defined(GNUPTH)
|
||||
free(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
pthread_mutex_destroy(mutexp);
|
||||
free(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
crit_terminate(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
PISync_delete(mutexp);
|
||||
#elif defined(TSRM_ST)
|
||||
st_mutex_destroy(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)
|
||||
{
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex locked thread: %ld", tsrm_thread_id()));
|
||||
#ifdef TSRM_WIN32
|
||||
EnterCriticalSection(mutexp);
|
||||
return 1;
|
||||
#elif defined(NETWARE)
|
||||
return NXLock(mutexp);
|
||||
#elif defined(GNUPTH)
|
||||
return pth_mutex_acquire(mutexp, 0, NULL);
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_mutex_lock(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
return crit_enter(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
return PISync_lock(mutexp);
|
||||
#elif defined(TSRM_ST)
|
||||
return st_mutex_lock(mutexp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Unlock a mutex */
|
||||
TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
|
||||
{
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex unlocked thread: %ld", tsrm_thread_id()));
|
||||
#ifdef TSRM_WIN32
|
||||
LeaveCriticalSection(mutexp);
|
||||
return 1;
|
||||
#elif defined(NETWARE)
|
||||
return NXUnlock(mutexp);
|
||||
#elif defined(GNUPTH)
|
||||
return pth_mutex_release(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_mutex_unlock(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
return crit_exit(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
return PISync_unlock(mutexp);
|
||||
#elif defined(TSRM_ST)
|
||||
return st_mutex_unlock(mutexp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler)
|
||||
{
|
||||
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(tsrm_thread_end_func_t new_thread_end_handler)
|
||||
{
|
||||
void *retval = (void *) tsrm_new_thread_end_handler;
|
||||
|
||||
tsrm_new_thread_end_handler = new_thread_end_handler;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Debug support
|
||||
*/
|
||||
|
||||
#if TSRM_DEBUG
|
||||
int tsrm_error(int level, const char *format, ...)
|
||||
{
|
||||
if (level<=tsrm_error_level) {
|
||||
va_list args;
|
||||
int size;
|
||||
|
||||
fprintf(tsrm_error_file, "TSRM: ");
|
||||
va_start(args, format);
|
||||
size = vfprintf(tsrm_error_file, format, args);
|
||||
va_end(args);
|
||||
fprintf(tsrm_error_file, "\n");
|
||||
fflush(tsrm_error_file);
|
||||
return size;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void tsrm_error_set(int level, char *debug_filename)
|
||||
{
|
||||
tsrm_error_level = level;
|
||||
|
||||
#if TSRM_DEBUG
|
||||
if (tsrm_error_file!=stderr) { /* close files opened earlier */
|
||||
fclose(tsrm_error_file);
|
||||
}
|
||||
|
||||
if (debug_filename) {
|
||||
tsrm_error_file = fopen(debug_filename, "w");
|
||||
if (!tsrm_error_file) {
|
||||
tsrm_error_file = stderr;
|
||||
}
|
||||
} else {
|
||||
tsrm_error_file = stderr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* ZTS */
|
||||
-186
@@ -1,186 +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 "TSRM - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "TSRM - Win32 Release_TSDbg" (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 "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=1 /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 "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /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
|
||||
|
||||
!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS_inline"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "TSRM___Win32_Release_TS_inline"
|
||||
# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS_inline"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release_TS_inline"
|
||||
# PROP Intermediate_Dir "Release_TS_inline"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "TSRM_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /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
|
||||
|
||||
!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TSDbg"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "TSRM___Win32_Release_TSDbg"
|
||||
# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TSDbg"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release_TSDbg"
|
||||
# PROP Intermediate_Dir "Release_TSDbg"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /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"
|
||||
# Name "TSRM - Win32 Release_TS_inline"
|
||||
# Name "TSRM - Win32 Release_TSDbg"
|
||||
# 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
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_strtok_r.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_virtual_cwd.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_win32.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\readdir.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TSRM.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_config.w32.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_config_common.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_strtok_r.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_virtual_cwd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_win32.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
-150
@@ -1,150 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Thread Safe Resource Manager |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski|
|
||||
| This source file is subject to the TSRM license, that is bundled |
|
||||
| with this package in the file LICENSE |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef TSRM_H
|
||||
#define TSRM_H
|
||||
|
||||
/* #ifndef WIN32 */
|
||||
#if !defined(WIN32) && !defined(NETWARE)
|
||||
# include "tsrm_config.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
# define TSRM_WIN32
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
# ifdef TSRM_EXPORTS
|
||||
# define TSRM_API __declspec(dllexport)
|
||||
# else
|
||||
# define TSRM_API __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define TSRM_API
|
||||
#endif
|
||||
|
||||
/* Only compile multi-threading functions if we're in ZTS mode */
|
||||
#ifdef ZTS
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
# include <windows.h>
|
||||
#elif defined(NETWARE)
|
||||
# include <nks/thread.h>
|
||||
# include <nks/synch.h>
|
||||
#elif defined(GNUPTH)
|
||||
# include <pth.h>
|
||||
#elif defined(PTHREADS)
|
||||
# include <pthread.h>
|
||||
#elif defined(TSRM_ST)
|
||||
# include <st.h>
|
||||
#endif
|
||||
|
||||
typedef int ts_rsrc_id;
|
||||
|
||||
/* Define THREAD_T and MUTEX_T */
|
||||
#ifdef TSRM_WIN32
|
||||
# define THREAD_T DWORD
|
||||
# define MUTEX_T CRITICAL_SECTION *
|
||||
#elif defined(NETWARE)
|
||||
# define THREAD_T NXThreadId_t
|
||||
# define MUTEX_T NXMutex_t *
|
||||
#elif defined(GNUPTH)
|
||||
# define THREAD_T pth_t
|
||||
# define MUTEX_T pth_mutex_t *
|
||||
#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 *
|
||||
#elif defined(TSRM_ST)
|
||||
# define THREAD_T st_thread_t
|
||||
# define MUTEX_T st_mutex_t
|
||||
#endif
|
||||
|
||||
typedef void (*ts_allocate_ctor)(void *, void ***);
|
||||
typedef void (*ts_allocate_dtor)(void *, 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_level, char *debug_filename);
|
||||
TSRM_API void tsrm_shutdown(void);
|
||||
|
||||
/* allocates a new thread-safe-resource id */
|
||||
TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor);
|
||||
|
||||
/* fetches the requested resource for the current thread */
|
||||
TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id);
|
||||
#define ts_resource(id) ts_resource_ex(id, NULL)
|
||||
|
||||
/* frees all resources allocated for the current thread */
|
||||
TSRM_API void ts_free_thread(void);
|
||||
|
||||
/* deallocates all occurrences of a given id */
|
||||
TSRM_API void ts_free_id(ts_rsrc_id id);
|
||||
|
||||
|
||||
/* Debug support */
|
||||
#define TSRM_ERROR_LEVEL_ERROR 1
|
||||
#define TSRM_ERROR_LEVEL_CORE 2
|
||||
#define TSRM_ERROR_LEVEL_INFO 3
|
||||
|
||||
typedef void (*tsrm_thread_begin_func_t)(THREAD_T thread_id, void ***tsrm_ls);
|
||||
typedef void (*tsrm_thread_end_func_t)(THREAD_T thread_id, void ***tsrm_ls);
|
||||
|
||||
|
||||
TSRM_API int tsrm_error(int level, const char *format, ...);
|
||||
TSRM_API void tsrm_error_set(int level, char *debug_filename);
|
||||
|
||||
/* 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(tsrm_thread_begin_func_t new_thread_begin_handler);
|
||||
TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler);
|
||||
|
||||
#define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1)
|
||||
#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
|
||||
|
||||
#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL)
|
||||
#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
|
||||
#define TSRMLS_D void ***tsrm_ls
|
||||
#define TSRMLS_DC , TSRMLS_D
|
||||
#define TSRMLS_C tsrm_ls
|
||||
#define TSRMLS_CC , TSRMLS_C
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* non ZTS */
|
||||
|
||||
#define TSRMLS_FETCH()
|
||||
#define TSRMLS_D void
|
||||
#define TSRMLS_DC
|
||||
#define TSRMLS_C
|
||||
#define TSRMLS_CC
|
||||
|
||||
#endif /* ZTS */
|
||||
|
||||
#endif /* TSRM_H */
|
||||
@@ -1 +0,0 @@
|
||||
#undef PTHREADS
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
|
||||
])
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl Minimalistic configure.in for TSRM.
|
||||
dnl
|
||||
|
||||
AC_INIT(TSRM.c)
|
||||
AM_INIT_AUTOMAKE(TSRM, 1.0, nodefine)
|
||||
AM_CONFIG_HEADER(tsrm_config.h)
|
||||
|
||||
sinclude(tsrm.m4)
|
||||
|
||||
TSRM_BASIC_CHECKS
|
||||
TSRM_THREADS_CHECKS
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
if test "$enable_debug" != "yes"; then
|
||||
AM_SET_LIBTOOL_VARIABLE([--silent])
|
||||
fi
|
||||
|
||||
dnl TSRM_PTHREAD
|
||||
|
||||
AC_CHECK_HEADERS(
|
||||
utime.h \
|
||||
dirent.h \
|
||||
stdarg.h \
|
||||
alloca.h \
|
||||
unistd.h \
|
||||
limits.h
|
||||
)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
@@ -1,44 +0,0 @@
|
||||
#ifndef READDIR_H
|
||||
#define READDIR_H
|
||||
|
||||
|
||||
/*
|
||||
* Structures and types used to implement opendir/readdir/closedir
|
||||
* on Windows 95/NT.
|
||||
*/
|
||||
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
/* struct dirent - same as Unix */
|
||||
|
||||
struct dirent {
|
||||
long d_ino; /* inode (always 1 in WIN32) */
|
||||
off_t d_off; /* offset to this dirent */
|
||||
unsigned short d_reclen; /* length of d_name */
|
||||
char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */
|
||||
};
|
||||
|
||||
|
||||
/* typedef DIR - not the same as Unix */
|
||||
typedef struct {
|
||||
long handle; /* _findfirst/_findnext handle */
|
||||
short offset; /* offset into directory */
|
||||
short finished; /* 1 if there are not more files */
|
||||
struct _finddata_t fileinfo; /* from _findfirst/_findnext */
|
||||
char *dir; /* the dir we are reading */
|
||||
struct dirent dent; /* the dirent to return */
|
||||
} DIR;
|
||||
|
||||
/* Function prototypes */
|
||||
DIR *opendir(const char *);
|
||||
struct dirent *readdir(DIR *);
|
||||
int readdir_r(DIR *, struct dirent *, struct dirent **);
|
||||
int closedir(DIR *);
|
||||
void rewinddir(DIR *);
|
||||
|
||||
|
||||
#endif /* READDIR_H */
|
||||
-160
@@ -1,160 +0,0 @@
|
||||
dnl Copyright (c) 1999, 2000 Sascha Schumann. All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
dnl modification, are permitted provided that the following conditions
|
||||
dnl are met:
|
||||
dnl
|
||||
dnl 1. Redistributions of source code must retain the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer.
|
||||
dnl
|
||||
dnl 2. Redistributions in binary form must reproduce the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer in
|
||||
dnl the documentation and/or other materials provided with the
|
||||
dnl distribution.
|
||||
dnl
|
||||
dnl THIS SOFTWARE IS PROVIDED BY SASCHA SCHUMANN ``AS IS'' AND ANY
|
||||
dnl EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
dnl PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SASCHA SCHUMANN OR
|
||||
dnl HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
dnl NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
dnl STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
dnl OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
dnl
|
||||
dnl PTHREADS_FLAGS
|
||||
dnl
|
||||
dnl Set some magic defines to achieve POSIX threads conformance
|
||||
dnl
|
||||
AC_DEFUN(PTHREADS_FLAGS,[
|
||||
if test -z "$host_alias" && test -n "$host"; then
|
||||
host_alias=$host
|
||||
fi
|
||||
if test -z "$host_alias"; then
|
||||
AC_MSG_ERROR(host_alias is not set. Make sure to run config.guess)
|
||||
fi
|
||||
case $host_alias in
|
||||
*solaris*)
|
||||
PTHREAD_FLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";;
|
||||
*freebsd*)
|
||||
PTHREAD_FLAGS="-D_REENTRANT -D_THREAD_SAFE";;
|
||||
*linux*)
|
||||
PTHREAD_FLAGS=-D_REENTRANT;;
|
||||
*aix*)
|
||||
PTHREAD_FLAGS=-D_THREAD_SAFE;;
|
||||
*irix*)
|
||||
PTHREAD_FLAGS=-D_POSIX_THREAD_SAFE_FUNCTIONS;;
|
||||
*hpux*)
|
||||
PTHREAD_FLAGS=-D_REENTRANT;;
|
||||
*sco*)
|
||||
PTHREAD_FLAGS=-D_REENTRANT;;
|
||||
dnl Solves sigwait() problem, creates problems with u_long etc.
|
||||
dnl PTHREAD_FLAGS="-D_REENTRANT -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE_EXTENDED=1";;
|
||||
esac
|
||||
|
||||
if test -n "$PTHREAD_FLAGS"; then
|
||||
CPPFLAGS="$CPPFLAGS $PTHREAD_FLAGS"
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl PTHREADS_CHECK_COMPILE
|
||||
dnl
|
||||
dnl Check whether the current setup can use POSIX threads calls
|
||||
dnl
|
||||
AC_DEFUN(PTHREADS_CHECK_COMPILE, [
|
||||
AC_TRY_RUN( [
|
||||
#include <pthread.h>
|
||||
#include <stddef.h>
|
||||
|
||||
void *thread_routine(void *data) {
|
||||
return data;
|
||||
}
|
||||
|
||||
int main() {
|
||||
pthread_t thd;
|
||||
pthread_mutexattr_t mattr;
|
||||
int data = 1;
|
||||
pthread_mutexattr_init(&mattr);
|
||||
return pthread_create(&thd, NULL, thread_routine, &data);
|
||||
} ], [
|
||||
pthreads_working=yes
|
||||
], [
|
||||
pthreads_working=no
|
||||
], pthreads_working=no ) ] )dnl
|
||||
dnl
|
||||
dnl PTHREADS_CHECK()
|
||||
dnl
|
||||
dnl Try to find a way to enable POSIX threads
|
||||
dnl
|
||||
dnl Magic flags
|
||||
dnl -kthread gcc (FreeBSD)
|
||||
dnl -Kthread UDK cc (UnixWare)
|
||||
dnl -mt WorkShop cc (Solaris)
|
||||
dnl -mthreads gcc (AIX)
|
||||
dnl -pthread gcc (Linux, FreeBSD, NetBSD, OpenBSD)
|
||||
dnl -pthreads gcc (Solaris)
|
||||
dnl -qthreaded AIX cc V5
|
||||
dnl -threads gcc (HP-UX)
|
||||
dnl
|
||||
AC_DEFUN(PTHREADS_CHECK,[
|
||||
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_LIBS=$LIBS
|
||||
PTHREADS_ASSIGN_VARS
|
||||
PTHREADS_CHECK_COMPILE
|
||||
LIBS=$save_LIBS
|
||||
CFLAGS=$save_CFLAGS
|
||||
|
||||
AC_CACHE_CHECK(for pthreads_cflags,ac_cv_pthreads_cflags,[
|
||||
ac_cv_pthreads_cflags=
|
||||
if test "$pthreads_working" != "yes"; then
|
||||
for flag in -kthread -pthread -pthreads -mthreads -Kthread -threads -mt -qthreaded; do
|
||||
ac_save=$CFLAGS
|
||||
CFLAGS="$CFLAGS $flag"
|
||||
PTHREADS_CHECK_COMPILE
|
||||
CFLAGS=$ac_save
|
||||
if test "$pthreads_working" = "yes"; then
|
||||
ac_cv_pthreads_cflags=$flag
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
|
||||
ac_cv_pthreads_lib=
|
||||
if test "$pthreads_working" != "yes"; then
|
||||
for lib in pthread pthreads c_r; do
|
||||
ac_save=$LIBS
|
||||
LIBS="$LIBS -l$lib"
|
||||
PTHREADS_CHECK_COMPILE
|
||||
LIBS=$ac_save
|
||||
if test "$pthreads_working" = "yes"; then
|
||||
ac_cv_pthreads_lib=$lib
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
if test "$pthreads_working" = "yes"; then
|
||||
threads_result="POSIX-Threads found"
|
||||
else
|
||||
threads_result="POSIX-Threads not found"
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl
|
||||
AC_DEFUN(PTHREADS_ASSIGN_VARS,[
|
||||
if test -n "$ac_cv_pthreads_lib"; then
|
||||
LIBS="$LIBS -l$ac_cv_pthreads_lib"
|
||||
fi
|
||||
|
||||
if test -n "$ac_cv_pthreads_cflags"; then
|
||||
CFLAGS="$CFLAGS $ac_cv_pthreads_cflags"
|
||||
fi
|
||||
])dnl
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
|
||||
dnl TSRM_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT_FOUND)
|
||||
AC_DEFUN(TSRM_CHECK_GCC_ARG,[
|
||||
gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
|
||||
AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
|
||||
echo 'void somefunc() { };' > conftest.c
|
||||
cmd='$CC $1 -c conftest.c'
|
||||
if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then
|
||||
ac_result=no
|
||||
else
|
||||
ac_result=yes
|
||||
fi
|
||||
eval $gcc_arg_name=$ac_result
|
||||
rm -f conftest.*
|
||||
])
|
||||
if eval test "\$$gcc_arg_name" = "yes"; then
|
||||
$2
|
||||
else
|
||||
:
|
||||
$3
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN(TSRM_BASIC_CHECKS,[
|
||||
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
dnl AC_REQUIRE([AM_PROG_CC_STDC])dnl
|
||||
AC_REQUIRE([AC_PROG_CC_C_O])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
|
||||
AC_CHECK_HEADERS(stdarg.h)
|
||||
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN(TSRM_CHECK_PTH,[
|
||||
|
||||
AC_MSG_CHECKING(for GNU Pth)
|
||||
PTH_PREFIX="`$1 --prefix`"
|
||||
if test -z "$PTH_PREFIX"; then
|
||||
AC_MSG_RESULT(Please check your Pth installation)
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS `$1 --cflags`"
|
||||
LDFLAGS="$LDFLAGS `$1 --ldflags`"
|
||||
LIBS="$LIBS `$1 --libs`"
|
||||
|
||||
AC_DEFINE(GNUPTH, 1, [Whether you use GNU Pth])
|
||||
AC_MSG_RESULT(yes - installed in $PTH_PREFIX)
|
||||
|
||||
])
|
||||
|
||||
AC_DEFUN(TSRM_CHECK_ST,[
|
||||
if test -r "$1/include/st.h"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$1/include"
|
||||
LDFLAGS="$LDFLAGS -L$1/lib"
|
||||
elif test -r "$1/st.h"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$1"
|
||||
LDFLAGS="$LDFLAGS -L$1"
|
||||
fi
|
||||
AC_CHECK_HEADERS(st.h,[],[
|
||||
AC_MSG_ERROR([Sorry[,] I was unable to locate the State Threads header file. Please specify the prefix using --with-tsrm-st=/prefix])
|
||||
])
|
||||
LIBS="$LIBS -lst"
|
||||
AC_MSG_CHECKING(for SGI's State Threads)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(TSRM_ST, 1, [ ])
|
||||
])
|
||||
|
||||
sinclude(threads.m4)
|
||||
sinclude(TSRM/threads.m4)
|
||||
|
||||
AC_DEFUN(TSRM_CHECK_PTHREADS,[
|
||||
|
||||
PTHREADS_CHECK
|
||||
|
||||
if test "$pthreads_working" != "yes"; then
|
||||
AC_MSG_ERROR(Your system seems to lack POSIX threads.)
|
||||
fi
|
||||
|
||||
AC_DEFINE(PTHREADS, 1, Whether to use Pthreads)
|
||||
|
||||
AC_MSG_CHECKING(for POSIX threads)
|
||||
AC_MSG_RESULT(yes)
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN(TSRM_THREADS_CHECKS,[
|
||||
|
||||
dnl For the thread implementations, we always use --with-*
|
||||
dnl to maintain consistency
|
||||
|
||||
AC_ARG_WITH(tsrm-pth,
|
||||
[ --with-tsrm-pth[=pth-config] Use GNU Pth.],[
|
||||
TSRM_PTH=$withval
|
||||
],[
|
||||
TSRM_PTH=no
|
||||
])
|
||||
|
||||
AC_ARG_WITH(tsrm-st,
|
||||
[ --with-tsrm-st],[
|
||||
TSRM_ST=$withval
|
||||
],[
|
||||
TSRM_ST=no
|
||||
])
|
||||
|
||||
AC_ARG_WITH(tsrm-pthreads,
|
||||
[ --with-tsrm-pthreads Use POSIX threads (default)],[
|
||||
TSRM_PTHREADS=$withval
|
||||
],[
|
||||
TSRM_PTHREADS=yes
|
||||
])
|
||||
|
||||
test "$TSRM_PTH" = "yes" && TSRM_PTH=pth-config
|
||||
|
||||
if test "$TSRM_PTH" != "no"; then
|
||||
TSRM_CHECK_PTH($TSRM_PTH)
|
||||
elif test "$TSRM_ST" != "no"; then
|
||||
TSRM_CHECK_ST($TSRM_ST)
|
||||
elif test "$TSRM_PTHREADS" != "no"; then
|
||||
TSRM_CHECK_PTHREADS
|
||||
fi
|
||||
|
||||
])
|
||||
@@ -1,9 +0,0 @@
|
||||
#ifndef TSRM_CONFIG_NW_H
|
||||
#define TSRM_CONFIG_NW_H
|
||||
|
||||
#define HAVE_UTIME 1
|
||||
|
||||
/* Though we have alloca(), this seems to be causing some problem with the stack pointer -- hence not using it */
|
||||
/* #define HAVE_ALLOCA 1 */
|
||||
|
||||
#endif
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef TSRM_CONFIG_W32_H
|
||||
#define TSRM_CONFIG_W32_H
|
||||
|
||||
#define HAVE_UTIME 1
|
||||
#define HAVE_ALLOCA 1
|
||||
|
||||
#undef inline
|
||||
#ifdef ZEND_WIN32_FORCE_INLINE
|
||||
# define inline __forceinline
|
||||
#else
|
||||
# define inline
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,60 +0,0 @@
|
||||
#ifndef TSRM_CONFIG_COMMON_H
|
||||
#define TSRM_CONFIG_COMMON_H
|
||||
|
||||
#if WINNT|WIN32
|
||||
# define TSRM_WIN32
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
# include "tsrm_config.w32.h"
|
||||
#elif defined(NETWARE)
|
||||
# include "tsrm_config.nw.h"
|
||||
#else
|
||||
# include "tsrm_config.h"
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
/* AIX requires this to be the first thing in the file. */
|
||||
#ifndef __GNUC__
|
||||
# if HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
# else
|
||||
# ifndef alloca /* predefined by HP cc +Olibcalls */
|
||||
char *alloca ();
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
# ifdef PATH_MAX
|
||||
# define MAXPATHLEN PATH_MAX
|
||||
# else
|
||||
# define MAXPATHLEN 256
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2))
|
||||
# define tsrm_do_alloca(p) alloca(p)
|
||||
# define tsrm_free_alloca(p)
|
||||
#else
|
||||
# define tsrm_do_alloca(p) malloc(p)
|
||||
# define tsrm_free_alloca(p) free(p)
|
||||
#endif
|
||||
|
||||
#endif /* TSRM_CONFIG_COMMON_H */
|
||||
-260
@@ -1,260 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Venkat Raghavan S <rvenkat@novell.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
#ifdef NETWARE
|
||||
|
||||
#ifdef USE_MKFIFO
|
||||
#include <sys/stat.h>
|
||||
#elif !defined(USE_PIPE_OPEN) /* NXFifoOpen */
|
||||
#include <nks/fsio.h>
|
||||
#endif
|
||||
|
||||
#include <nks/vm.h>
|
||||
#include <nks/memory.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "mktemp.h"
|
||||
|
||||
/* strtok() call in LibC is abending when used in a different address space -- hence using
|
||||
PHP's version itself for now : Venkat (30/4/02) */
|
||||
#include "tsrm_strtok_r.h"
|
||||
#define tsrm_strtok_r(a,b,c) strtok((a),(b))
|
||||
|
||||
#define WHITESPACE " \t"
|
||||
#define MAX_ARGS 10
|
||||
|
||||
|
||||
TSRM_API FILE* popen(const char *commandline, const char *type)
|
||||
{
|
||||
char *command = NULL, *argv[MAX_ARGS] = {'\0'}, **env = NULL;
|
||||
char *tempName = "sys:/php/temp/phpXXXXXX.tmp";
|
||||
char *filePath = NULL;
|
||||
char *ptr = NULL;
|
||||
int ptrLen = 0, argc = 0, i = 0, envCount = 0, err = 0;
|
||||
FILE *stream = NULL;
|
||||
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
||||
int pipe_handle;
|
||||
int mode = O_RDONLY;
|
||||
#else
|
||||
NXHandle_t pipe_handle;
|
||||
NXMode_t mode = NX_O_RDONLY;
|
||||
#endif
|
||||
NXExecEnvSpec_t envSpec;
|
||||
NXNameSpec_t nameSpec;
|
||||
NXVmId_t newVM = 0;
|
||||
|
||||
/* Check for validity of input parameters */
|
||||
if (!commandline || !type)
|
||||
return NULL;
|
||||
|
||||
/* Get temporary file name */
|
||||
filePath = mktemp(tempName);
|
||||
/*consoleprintf ("PHP | popen: file path = %s, mode = %s\n", filePath, type);*/
|
||||
if (!filePath)
|
||||
return NULL;
|
||||
|
||||
/* Set pipe mode according to type -- for now allow only "r" or "w" */
|
||||
if (strcmp(type, "r") == 0)
|
||||
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
||||
mode = O_RDONLY;
|
||||
#else
|
||||
mode = NX_O_RDONLY;
|
||||
#endif
|
||||
else if (strcmp(type, "w") == 0)
|
||||
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
||||
mode = O_WRONLY;
|
||||
#else
|
||||
mode = NX_O_WRONLY;
|
||||
#endif
|
||||
else
|
||||
return NULL;
|
||||
|
||||
#ifdef USE_PIPE_OPEN
|
||||
pipe_handle = pipe_open(filePath, mode);
|
||||
/*consoleprintf ("PHP | popen: pipe_open() returned %d\n", pipe_handle);*/
|
||||
if (pipe_handle == -1)
|
||||
return NULL;
|
||||
#elif defined(USE_MKFIFO)
|
||||
pipe_handle = mkfifo(filePath, mode);
|
||||
consoleprintf ("PHP | popen: mkfifo() returned %d\n", pipe_handle);
|
||||
if (pipe_handle == -1)
|
||||
return NULL;
|
||||
#else
|
||||
/*
|
||||
- NetWare doesn't require first parameter
|
||||
- Allowing LibC to choose the buffer size for now
|
||||
*/
|
||||
err = NXFifoOpen(0, filePath, mode, 0, &pipe_handle);
|
||||
/*consoleprintf ("PHP | popen: NXFifoOpen() returned %d\n", err);*/
|
||||
if (err)
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
/* Copy the environment variables in preparation for the spawn call */
|
||||
|
||||
envCount = NXGetEnvCount() + 1; /* add one for NULL */
|
||||
env = (char**)NXMemAlloc(sizeof(char*) * envCount, 0);
|
||||
if (!env)
|
||||
return NULL;
|
||||
|
||||
err = NXCopyEnv(env, envCount);
|
||||
consoleprintf ("PHP | popen: NXCopyEnv() returned %d\n", err);
|
||||
if (err)
|
||||
{
|
||||
NXMemFree (env);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Separate commandline string into words */
|
||||
consoleprintf ("PHP | popen: commandline = %s\n", commandline);
|
||||
ptr = tsrm_strtok_r((char*)commandline, WHITESPACE, NULL);
|
||||
ptrLen = strlen(ptr);
|
||||
|
||||
command = (char*)malloc(ptrLen + 1);
|
||||
if (!command)
|
||||
{
|
||||
NXMemFree (env);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy (command, ptr);
|
||||
|
||||
ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL);
|
||||
while (ptr && (argc < MAX_ARGS))
|
||||
{
|
||||
ptrLen = strlen(ptr);
|
||||
|
||||
argv[argc] = (char*)malloc(ptrLen + 1);
|
||||
if (!argv[argc])
|
||||
{
|
||||
NXMemFree (env);
|
||||
|
||||
if (command)
|
||||
free (command);
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
if (argv[i])
|
||||
free (argv[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy (argv[argc], ptr);
|
||||
|
||||
argc++;
|
||||
|
||||
ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL);
|
||||
}
|
||||
consoleprintf ("PHP | popen: commandline string parsed into tokens\n");
|
||||
/* Setup the execution environment and spawn new process */
|
||||
|
||||
envSpec.esFlags = 0; /* Not used */
|
||||
envSpec.esArgc = argc;
|
||||
envSpec.esArgv = (void**)argv;
|
||||
envSpec.esEnv = (void**)env;
|
||||
|
||||
envSpec.esStdin.ssType =
|
||||
envSpec.esStdout.ssType = NX_OBJ_FIFO;
|
||||
envSpec.esStderr.ssType = NX_OBJ_FILE;
|
||||
/*
|
||||
envSpec.esStdin.ssHandle =
|
||||
envSpec.esStdout.ssHandle =
|
||||
envSpec.esStderr.ssHandle = -1;
|
||||
*/
|
||||
envSpec.esStdin.ssPathCtx =
|
||||
envSpec.esStdout.ssPathCtx =
|
||||
envSpec.esStderr.ssPathCtx = NULL;
|
||||
|
||||
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
||||
if (mode == O_RDONLY)
|
||||
#else
|
||||
if (mode == NX_O_RDONLY)
|
||||
#endif
|
||||
{
|
||||
envSpec.esStdin.ssPath = filePath;
|
||||
envSpec.esStdout.ssPath = stdout;
|
||||
}
|
||||
else /* Write Only */
|
||||
{
|
||||
envSpec.esStdin.ssPath = stdin;
|
||||
envSpec.esStdout.ssPath = filePath;
|
||||
}
|
||||
|
||||
envSpec.esStderr.ssPath = stdout;
|
||||
|
||||
nameSpec.ssType = NX_OBJ_FIFO;
|
||||
/* nameSpec.ssHandle = 0; */ /* Not used */
|
||||
nameSpec.ssPathCtx = NULL; /* Not used */
|
||||
nameSpec.ssPath = argv[0];
|
||||
consoleprintf ("PHP | popen: environment setup\n");
|
||||
err = NXVmSpawn(&nameSpec, &envSpec, 0, &newVM);
|
||||
consoleprintf ("PHP | popen: NXVmSpawn() returned %d\n", err);
|
||||
if (!err)
|
||||
/* Get file pointer corresponding to the pipe (file) opened */
|
||||
stream = fdopen(pipe_handle, type);
|
||||
|
||||
/* Clean-up */
|
||||
|
||||
if (env)
|
||||
NXMemFree (env);
|
||||
|
||||
if (pipe_handle)
|
||||
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
||||
close(pipe_handle);
|
||||
#else
|
||||
NXClose(pipe_handle);
|
||||
#endif
|
||||
|
||||
if (command)
|
||||
free (command);
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
if (argv[i])
|
||||
free (argv[i]);
|
||||
}
|
||||
consoleprintf ("PHP | popen: all clean-up done, returning...\n");
|
||||
return stream;
|
||||
}
|
||||
|
||||
TSRM_API int pclose(FILE* stream)
|
||||
{
|
||||
int err = 0;
|
||||
NXHandle_t fd = 0;
|
||||
|
||||
/* Get the process associated with this pipe (file) handle and terminate it */
|
||||
fd = fileno(stream);
|
||||
NXClose (fd);
|
||||
|
||||
err = fclose(stream);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Venkat Raghavan S <rvenkat@novell.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TSRM_NW_H
|
||||
#define TSRM_NW_H
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
TSRM_API FILE* popen(const char *command, const char *type);
|
||||
TSRM_API int pclose(FILE* stream);
|
||||
|
||||
#endif
|
||||
@@ -1,63 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "tsrm_config_common.h"
|
||||
#include "tsrm_strtok_r.h"
|
||||
|
||||
static inline int in_character_class(char ch, const char *delim)
|
||||
{
|
||||
while (*delim) {
|
||||
if (*delim == ch) {
|
||||
return 1;
|
||||
}
|
||||
delim++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *tsrm_strtok_r(char *s, const char *delim, char **last)
|
||||
{
|
||||
char *token;
|
||||
|
||||
if (s == NULL) {
|
||||
s = *last;
|
||||
}
|
||||
|
||||
while (*s && in_character_class(*s, delim)) {
|
||||
s++;
|
||||
}
|
||||
if (!*s) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
token = s;
|
||||
|
||||
while (*s && !in_character_class(*s, delim)) {
|
||||
s++;
|
||||
}
|
||||
if (!*s) {
|
||||
*last = s;
|
||||
} else {
|
||||
*s = '\0';
|
||||
*last = s + 1;
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
main()
|
||||
{
|
||||
char foo[] = "/foo/bar//\\barbara";
|
||||
char *last;
|
||||
char *token;
|
||||
|
||||
token = tsrm_strtok_r(foo, "/\\", &last);
|
||||
while (token) {
|
||||
printf ("Token = '%s'\n", token);
|
||||
token = tsrm_strtok_r(NULL, "/\\", &last);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef TSRM_STRTOK_R
|
||||
#define TSRM_STRTOK_R
|
||||
|
||||
char *tsrm_strtok_r(char *s, const char *delim, char **last);
|
||||
|
||||
#endif
|
||||
@@ -1,864 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Sascha Schumann <sascha@schumann.cx> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "tsrm_virtual_cwd.h"
|
||||
#include "tsrm_strtok_r.h"
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include <io.h>
|
||||
#include "tsrm_win32.h"
|
||||
#endif
|
||||
|
||||
#ifdef NETWARE
|
||||
/*#include "pipe.h"*/
|
||||
#include "tsrm_nw.h"
|
||||
#endif
|
||||
|
||||
#define VIRTUAL_CWD_DEBUG 0
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
/* Only need mutex for popen() in Windows and NetWare, because it doesn't chdir() on UNIX */
|
||||
#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS)
|
||||
MUTEX_T cwd_mutex;
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
static ts_rsrc_id cwd_globals_id;
|
||||
#else
|
||||
static virtual_cwd_globals cwd_globals;
|
||||
#endif
|
||||
|
||||
cwd_state main_cwd_state; /* True global */
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(mode) ((mode) & _S_IFDIR)
|
||||
#endif
|
||||
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(mode) ((mode) & _S_IFREG)
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include <tchar.h>
|
||||
#define tsrm_strtok_r(a,b,c) _tcstok((a),(b))
|
||||
#define TOKENIZER_STRING "/\\"
|
||||
|
||||
static int php_check_dots(const char *element, int n)
|
||||
{
|
||||
while (n-- > 0) if (element[n] != '.') break;
|
||||
|
||||
return (n != -1);
|
||||
}
|
||||
|
||||
#define IS_DIRECTORY_UP(element, len) \
|
||||
(len >= 2 && !php_check_dots(element, len))
|
||||
|
||||
#define IS_DIRECTORY_CURRENT(element, len) \
|
||||
(len == 1 && ptr[0] == '.')
|
||||
|
||||
#elif defined(NETWARE)
|
||||
/* NetWare has strtok() (in LibC) and allows both slashes in paths, like Windows --
|
||||
but rest of the stuff is like Unix */
|
||||
/* strtok() call in LibC is abending when used in a different address space -- hence using
|
||||
PHP's version itself for now */
|
||||
/*#define tsrm_strtok_r(a,b,c) strtok((a),(b))*/
|
||||
#define TOKENIZER_STRING "/\\"
|
||||
|
||||
#else
|
||||
#define TOKENIZER_STRING "/"
|
||||
#endif
|
||||
|
||||
|
||||
/* default macros */
|
||||
|
||||
#ifndef IS_DIRECTORY_UP
|
||||
#define IS_DIRECTORY_UP(element, len) \
|
||||
(len == 2 && memcmp(element, "..", 2) == 0)
|
||||
#endif
|
||||
|
||||
#ifndef IS_DIRECTORY_CURRENT
|
||||
#define IS_DIRECTORY_CURRENT(element, len) \
|
||||
(len == 1 && ptr[0] == '.')
|
||||
#endif
|
||||
|
||||
/* define this to check semantics */
|
||||
#define IS_DIR_OK(s) (1)
|
||||
|
||||
#ifndef IS_DIR_OK
|
||||
#define IS_DIR_OK(state) (php_is_dir_ok(state) == 0)
|
||||
#endif
|
||||
|
||||
|
||||
#define CWD_STATE_COPY(d, s) \
|
||||
(d)->cwd_length = (s)->cwd_length; \
|
||||
(d)->cwd = (char *) malloc((s)->cwd_length+1); \
|
||||
memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1);
|
||||
|
||||
#define CWD_STATE_FREE(s) \
|
||||
free((s)->cwd);
|
||||
|
||||
static int php_is_dir_ok(const cwd_state *state)
|
||||
{
|
||||
#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
|
||||
struct stat buf;
|
||||
|
||||
if (stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode))
|
||||
#else
|
||||
struct stat_libc buf;
|
||||
|
||||
if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISDIR(buf.st_mode))
|
||||
#endif
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int php_is_file_ok(const cwd_state *state)
|
||||
{
|
||||
#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
|
||||
struct stat buf;
|
||||
|
||||
if (stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode))
|
||||
#else
|
||||
struct stat_libc buf;
|
||||
|
||||
if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISREG(buf.st_mode))
|
||||
#endif
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void cwd_globals_ctor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
|
||||
{
|
||||
CWD_STATE_COPY(&cwd_globals->cwd, &main_cwd_state);
|
||||
}
|
||||
|
||||
static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
|
||||
{
|
||||
CWD_STATE_FREE(&cwd_globals->cwd);
|
||||
}
|
||||
|
||||
static char *tsrm_strndup(const char *s, size_t length)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = (char *) malloc(length+1);
|
||||
if (!p) {
|
||||
return (char *)NULL;
|
||||
}
|
||||
if (length) {
|
||||
memcpy(p,s,length);
|
||||
}
|
||||
p[length]=0;
|
||||
return p;
|
||||
}
|
||||
|
||||
CWD_API void virtual_cwd_startup(void)
|
||||
{
|
||||
char cwd[MAXPATHLEN];
|
||||
char *result;
|
||||
|
||||
result = getcwd(cwd, sizeof(cwd));
|
||||
if (!result) {
|
||||
cwd[0] = '\0';
|
||||
}
|
||||
main_cwd_state.cwd = strdup(cwd);
|
||||
main_cwd_state.cwd_length = strlen(cwd);
|
||||
|
||||
#ifdef ZTS
|
||||
ts_allocate_id(&cwd_globals_id, sizeof(virtual_cwd_globals), (ts_allocate_ctor) cwd_globals_ctor, (ts_allocate_dtor) cwd_globals_dtor);
|
||||
#else
|
||||
cwd_globals_ctor(&cwd_globals TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
#if defined(TSRM_WIN32) && defined(ZTS)
|
||||
cwd_mutex = tsrm_mutex_alloc();
|
||||
#endif
|
||||
}
|
||||
|
||||
CWD_API void virtual_cwd_shutdown(void)
|
||||
{
|
||||
#ifndef ZTS
|
||||
cwd_globals_dtor(&cwd_globals TSRMLS_CC);
|
||||
#endif
|
||||
#if defined(TSRM_WIN32) && defined(ZTS)
|
||||
tsrm_mutex_free(cwd_mutex);
|
||||
#endif
|
||||
|
||||
free(main_cwd_state.cwd); /* Don't use CWD_STATE_FREE because the non global states will probably use emalloc()/efree() */
|
||||
}
|
||||
|
||||
CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC)
|
||||
{
|
||||
cwd_state *state;
|
||||
|
||||
state = &CWDG(cwd);
|
||||
|
||||
if (state->cwd_length == 0) {
|
||||
char *retval;
|
||||
|
||||
*length = 1;
|
||||
retval = (char *) malloc(2);
|
||||
retval[0] = DEFAULT_SLASH;
|
||||
retval[1] = '\0';
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
/* If we have something like C: */
|
||||
if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') {
|
||||
char *retval;
|
||||
|
||||
*length = state->cwd_length+1;
|
||||
retval = (char *) malloc(*length+1);
|
||||
memcpy(retval, state->cwd, *length);
|
||||
retval[*length-1] = DEFAULT_SLASH;
|
||||
retval[*length] = '\0';
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
*length = state->cwd_length;
|
||||
return strdup(state->cwd);
|
||||
}
|
||||
|
||||
|
||||
/* Same semantics as UNIX getcwd() */
|
||||
CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC)
|
||||
{
|
||||
size_t length;
|
||||
char *cwd;
|
||||
|
||||
cwd = virtual_getcwd_ex(&length TSRMLS_CC);
|
||||
|
||||
if (buf == NULL) {
|
||||
return cwd;
|
||||
}
|
||||
if (length > size-1) {
|
||||
free(cwd);
|
||||
errno = ERANGE; /* Is this OK? */
|
||||
return NULL;
|
||||
}
|
||||
memcpy(buf, cwd, length+1);
|
||||
free(cwd);
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Resolve path relatively to state and put the real path into state */
|
||||
/* returns 0 for ok, 1 for error */
|
||||
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path)
|
||||
{
|
||||
int path_length = strlen(path);
|
||||
char *ptr, *path_copy;
|
||||
char *tok = NULL;
|
||||
int ptr_length;
|
||||
cwd_state *old_state;
|
||||
int ret = 0;
|
||||
int copy_amount = -1;
|
||||
char *free_path;
|
||||
unsigned char is_absolute = 0;
|
||||
#ifndef TSRM_WIN32
|
||||
char resolved_path[MAXPATHLEN];
|
||||
#endif
|
||||
|
||||
if (path_length == 0)
|
||||
return (0);
|
||||
|
||||
#if !defined(TSRM_WIN32) && !defined(__BEOS__) && !defined(NETWARE)
|
||||
if (IS_ABSOLUTE_PATH(path, path_length)) {
|
||||
if (realpath(path, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
}
|
||||
} else { /* Concat current directory with relative path and then run realpath() on it */
|
||||
char *tmp;
|
||||
char *ptr;
|
||||
|
||||
ptr = tmp = (char *) malloc(state->cwd_length+path_length+sizeof("/"));
|
||||
if (!tmp) {
|
||||
return 1;
|
||||
}
|
||||
memcpy(ptr, state->cwd, state->cwd_length);
|
||||
ptr += state->cwd_length;
|
||||
*ptr++ = DEFAULT_SLASH;
|
||||
memcpy(ptr, path, path_length);
|
||||
ptr += path_length;
|
||||
*ptr = '\0';
|
||||
if (realpath(tmp, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
#endif
|
||||
free_path = path_copy = tsrm_strndup(path, path_length);
|
||||
|
||||
old_state = (cwd_state *) malloc(sizeof(cwd_state));
|
||||
CWD_STATE_COPY(old_state, state);
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path);
|
||||
#endif
|
||||
if (IS_ABSOLUTE_PATH(path_copy, path_length)) {
|
||||
/* COPY_WHEN_ABSOLUTE needs to account for volume name that is unique to NetWare absolute paths */
|
||||
#ifndef NETWARE
|
||||
copy_amount = COPY_WHEN_ABSOLUTE;
|
||||
#else
|
||||
copy_amount = COPY_WHEN_ABSOLUTE(path_copy);
|
||||
#endif
|
||||
is_absolute = 1;
|
||||
#ifdef TSRM_WIN32
|
||||
} else if (IS_UNC_PATH(path_copy, path_length)) {
|
||||
copy_amount = 2;
|
||||
is_absolute = 1;
|
||||
} else if (IS_SLASH(path_copy[0])) {
|
||||
copy_amount = 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (copy_amount != -1) {
|
||||
state->cwd = (char *) realloc(state->cwd, copy_amount + 1);
|
||||
if (copy_amount) {
|
||||
if (is_absolute) {
|
||||
memcpy(state->cwd, path_copy, copy_amount);
|
||||
path_copy += copy_amount;
|
||||
} else {
|
||||
memcpy(state->cwd, old_state->cwd, copy_amount);
|
||||
}
|
||||
}
|
||||
state->cwd[copy_amount] = '\0';
|
||||
state->cwd_length = copy_amount;
|
||||
}
|
||||
|
||||
|
||||
ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok);
|
||||
while (ptr) {
|
||||
ptr_length = strlen(ptr);
|
||||
|
||||
if (IS_DIRECTORY_UP(ptr, ptr_length)) {
|
||||
char save;
|
||||
|
||||
save = DEFAULT_SLASH;
|
||||
|
||||
#define PREVIOUS state->cwd[state->cwd_length - 1]
|
||||
|
||||
while (IS_ABSOLUTE_PATH(state->cwd, state->cwd_length) &&
|
||||
!IS_SLASH(PREVIOUS)) {
|
||||
save = PREVIOUS;
|
||||
PREVIOUS = '\0';
|
||||
state->cwd_length--;
|
||||
}
|
||||
|
||||
if (!IS_ABSOLUTE_PATH(state->cwd, state->cwd_length)) {
|
||||
state->cwd[state->cwd_length++] = save;
|
||||
state->cwd[state->cwd_length] = '\0';
|
||||
} else {
|
||||
PREVIOUS = '\0';
|
||||
state->cwd_length--;
|
||||
}
|
||||
} else if (!IS_DIRECTORY_CURRENT(ptr, ptr_length)) {
|
||||
state->cwd = (char *) realloc(state->cwd, state->cwd_length+ptr_length+1+1);
|
||||
#ifdef TSRM_WIN32
|
||||
/* Windows 9x will consider C:\\Foo as a network path. Avoid it. */
|
||||
if ((state->cwd[state->cwd_length-1]!='\\' && state->cwd[state->cwd_length-1]!='/') ||
|
||||
IsDBCSLeadByte(state->cwd[state->cwd_length-2])) {
|
||||
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
|
||||
}
|
||||
#elif defined(NETWARE)
|
||||
/* If the token is a volume name, it will have colon at the end -- so, no slash before it */
|
||||
if (ptr[ptr_length-1] != ':') {
|
||||
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
|
||||
}
|
||||
#else
|
||||
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
|
||||
#endif
|
||||
memcpy(&state->cwd[state->cwd_length], ptr, ptr_length+1);
|
||||
state->cwd_length += ptr_length;
|
||||
}
|
||||
ptr = tsrm_strtok_r(NULL, TOKENIZER_STRING, &tok);
|
||||
}
|
||||
|
||||
/* COPY_WHEN_ABSOLUTE needs to account for volume name that is unique to NetWare absolute paths */
|
||||
#ifndef NETWARE
|
||||
if (state->cwd_length == COPY_WHEN_ABSOLUTE) {
|
||||
#else
|
||||
if (state->cwd_length == COPY_WHEN_ABSOLUTE(state->cwd)) {
|
||||
#endif
|
||||
state->cwd = (char *) realloc(state->cwd, state->cwd_length+1+1);
|
||||
state->cwd[state->cwd_length] = DEFAULT_SLASH;
|
||||
state->cwd[state->cwd_length+1] = '\0';
|
||||
state->cwd_length++;
|
||||
}
|
||||
|
||||
if (verify_path && verify_path(state)) {
|
||||
CWD_STATE_FREE(state);
|
||||
|
||||
*state = *old_state;
|
||||
|
||||
ret = 1;
|
||||
} else {
|
||||
CWD_STATE_FREE(old_state);
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
free(old_state);
|
||||
|
||||
free(free_path);
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd);
|
||||
#endif
|
||||
return (ret);
|
||||
}
|
||||
|
||||
CWD_API int virtual_chdir(const char *path TSRMLS_DC)
|
||||
{
|
||||
return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok)?-1:0;
|
||||
}
|
||||
|
||||
CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC)
|
||||
{
|
||||
int length = strlen(path);
|
||||
char *temp;
|
||||
int retval;
|
||||
|
||||
if (length == 0) {
|
||||
return 1; /* Can't cd to empty string */
|
||||
}
|
||||
while(--length >= 0 && !IS_SLASH(path[length])) {
|
||||
}
|
||||
|
||||
if (length == -1) {
|
||||
/* No directory only file name */
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* COPY_WHEN_ABSOLUTE needs to account for volume name that is unique to NetWare absolute paths */
|
||||
#ifndef NETWARE
|
||||
if (length == COPY_WHEN_ABSOLUTE && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */
|
||||
#else
|
||||
if (length == COPY_WHEN_ABSOLUTE(path) && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */
|
||||
#endif
|
||||
length++;
|
||||
}
|
||||
temp = (char *) tsrm_do_alloca(length+1);
|
||||
memcpy(temp, path, length);
|
||||
temp[length] = 0;
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf (stderr, "Changing directory to %s\n", temp);
|
||||
#endif
|
||||
retval = p_chdir(temp TSRMLS_CC);
|
||||
tsrm_free_alloca(temp);
|
||||
return retval;
|
||||
}
|
||||
|
||||
CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
retval = virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
if (!retval) {
|
||||
int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length;
|
||||
memcpy(real_path, new_state.cwd, len);
|
||||
real_path[len] = '\0';
|
||||
return real_path;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
retval = virtual_file_ex(&new_state, path, verify_path);
|
||||
|
||||
*filepath = new_state.cwd;
|
||||
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC)
|
||||
{
|
||||
return virtual_filepath_ex(path, filepath, php_is_file_ok TSRMLS_CC);
|
||||
}
|
||||
|
||||
CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
FILE *f;
|
||||
|
||||
if (path[0] == '\0') { /* Fail to open empty path */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
f = fopen(new_state.cwd, mode);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return f;
|
||||
}
|
||||
|
||||
#if HAVE_UTIME
|
||||
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int ret;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, filename, NULL);
|
||||
|
||||
ret = utime(new_state.cwd, buf);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int ret;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, filename, NULL);
|
||||
|
||||
ret = chmod(new_state.cwd, mode);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int ret;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, filename, NULL);
|
||||
|
||||
ret = chown(new_state.cwd, owner, group);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int f;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
if (flags & O_CREAT) {
|
||||
mode_t mode;
|
||||
va_list arg;
|
||||
|
||||
va_start(arg, flags);
|
||||
mode = (mode_t) va_arg(arg, int);
|
||||
va_end(arg);
|
||||
|
||||
f = open(new_state.cwd, flags, mode);
|
||||
} else {
|
||||
f = open(new_state.cwd, flags);
|
||||
}
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return f;
|
||||
}
|
||||
|
||||
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int f;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
f = creat(new_state.cwd, mode);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return f;
|
||||
}
|
||||
|
||||
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC)
|
||||
{
|
||||
cwd_state old_state;
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&old_state, &CWDG(cwd));
|
||||
virtual_file_ex(&old_state, oldname, NULL);
|
||||
oldname = old_state.cwd;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, newname, NULL);
|
||||
newname = new_state.cwd;
|
||||
|
||||
retval = rename(oldname, newname);
|
||||
|
||||
CWD_STATE_FREE(&old_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
|
||||
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
retval = stat(new_state.cwd, buf);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
#else
|
||||
CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
retval = stat(new_state.cwd, (struct stat*)buf);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
retval = lstat(new_state.cwd, buf);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_unlink(const char *path TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
retval = unlink(new_state.cwd);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, pathname, NULL);
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
retval = mkdir(new_state.cwd);
|
||||
#else
|
||||
retval = mkdir(new_state.cwd, mode);
|
||||
#endif
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, pathname, NULL);
|
||||
|
||||
retval = rmdir(new_state.cwd);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
DIR *opendir(const char *name);
|
||||
#endif
|
||||
|
||||
CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
DIR *retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, pathname, NULL);
|
||||
|
||||
retval = opendir(new_state.cwd);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
|
||||
/* On Windows the trick of prepending "cd cwd; " doesn't work so we need to perform
|
||||
a real chdir() and mutex it
|
||||
*/
|
||||
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
{
|
||||
char prev_cwd[MAXPATHLEN];
|
||||
char *getcwd_result;
|
||||
FILE *retval;
|
||||
|
||||
getcwd_result = getcwd(prev_cwd, MAXPATHLEN);
|
||||
if (!getcwd_result) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_mutex_lock(cwd_mutex);
|
||||
#endif
|
||||
|
||||
chdir(CWDG(cwd).cwd);
|
||||
retval = popen(command, type);
|
||||
chdir(prev_cwd);
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_mutex_unlock(cwd_mutex);
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#elif defined(NETWARE)
|
||||
|
||||
/* On NetWare, the trick of prepending "cd cwd; " doesn't work so we need to perform
|
||||
a VCWD_CHDIR() and mutex it
|
||||
*/
|
||||
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
{
|
||||
char prev_cwd[MAXPATHLEN];
|
||||
char *getcwd_result;
|
||||
FILE *retval;
|
||||
|
||||
getcwd_result = VCWD_GETCWD(prev_cwd, MAXPATHLEN);
|
||||
if (!getcwd_result) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_mutex_lock(cwd_mutex);
|
||||
#endif
|
||||
|
||||
VCWD_CHDIR(CWDG(cwd).cwd);
|
||||
retval = popen(command, type);
|
||||
VCWD_CHDIR(prev_cwd);
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_mutex_unlock(cwd_mutex);
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#else /* Unix */
|
||||
|
||||
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
{
|
||||
int command_length;
|
||||
char *command_line;
|
||||
char *ptr;
|
||||
FILE *retval;
|
||||
|
||||
command_length = strlen(command);
|
||||
|
||||
ptr = command_line = (char *) malloc(command_length + sizeof("cd ; ") + CWDG(cwd).cwd_length+1);
|
||||
if (!command_line) {
|
||||
return NULL;
|
||||
}
|
||||
memcpy(ptr, "cd ", sizeof("cd ")-1);
|
||||
ptr += sizeof("cd ")-1;
|
||||
|
||||
if (CWDG(cwd).cwd_length == 0) {
|
||||
*ptr++ = DEFAULT_SLASH;
|
||||
} else {
|
||||
memcpy(ptr, CWDG(cwd).cwd, CWDG(cwd).cwd_length);
|
||||
ptr += CWDG(cwd).cwd_length;
|
||||
}
|
||||
|
||||
*ptr++ = ' ';
|
||||
*ptr++ = ';';
|
||||
*ptr++ = ' ';
|
||||
|
||||
memcpy(ptr, command, command_length+1);
|
||||
retval = popen(command_line, type);
|
||||
|
||||
free(command_line);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,241 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Sascha Schumann <sascha@schumann.cx> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef VIRTUAL_CWD_H
|
||||
#define VIRTUAL_CWD_H
|
||||
|
||||
#include "TSRM.h"
|
||||
#include "tsrm_config_common.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_UTIME_H
|
||||
#include <utime.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include "readdir.h"
|
||||
#include <sys/utime.h>
|
||||
/* mode_t isn't defined on Windows */
|
||||
typedef unsigned short mode_t;
|
||||
|
||||
#define DEFAULT_SLASH '\\'
|
||||
#define DEFAULT_DIR_SEPARATOR ';'
|
||||
#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
|
||||
#define IS_SLASH_P(c) (*(c) == '/' || \
|
||||
(*(c) == '\\' && !IsDBCSLeadByte(*(c-1))))
|
||||
#define COPY_WHEN_ABSOLUTE 2
|
||||
#define IS_ABSOLUTE_PATH(path, len) \
|
||||
(len >= 2 && isalpha(path[0]) && path[1] == ':')
|
||||
#define IS_UNC_PATH(path, len) \
|
||||
(len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1]))
|
||||
|
||||
#elif defined(NETWARE)
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#define DEFAULT_SLASH '/'
|
||||
#define DEFAULT_DIR_SEPARATOR ';'
|
||||
#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
|
||||
#define COPY_WHEN_ABSOLUTE(path) \
|
||||
(strchr(path, ':') - path + 1) /* Take the volume name which ends with a colon */
|
||||
#define IS_ABSOLUTE_PATH(path, len) \
|
||||
(strchr(path, ':') != NULL) /* Colon indicates volume name */
|
||||
|
||||
#else
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#define DEFAULT_SLASH '/'
|
||||
|
||||
#ifdef __riscos__
|
||||
#define DEFAULT_DIR_SEPARATOR ';'
|
||||
#else
|
||||
#define DEFAULT_DIR_SEPARATOR ':'
|
||||
#endif
|
||||
|
||||
#define IS_SLASH(c) ((c) == '/')
|
||||
#define IS_SLASH_P(c) (*(c) == '/')
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef COPY_WHEN_ABSOLUTE
|
||||
#define COPY_WHEN_ABSOLUTE 0
|
||||
#endif
|
||||
|
||||
#ifndef IS_ABSOLUTE_PATH
|
||||
#define IS_ABSOLUTE_PATH(path, len) \
|
||||
(IS_SLASH(path[0]))
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_EXPORTS
|
||||
#define CWD_EXPORTS
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
# ifdef CWD_EXPORTS
|
||||
# define CWD_API __declspec(dllexport)
|
||||
# else
|
||||
# define CWD_API __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
#define CWD_API
|
||||
#endif
|
||||
|
||||
typedef struct _cwd_state {
|
||||
char *cwd;
|
||||
int cwd_length;
|
||||
} cwd_state;
|
||||
|
||||
typedef int (*verify_path_func)(const cwd_state *);
|
||||
|
||||
CWD_API void virtual_cwd_startup(void);
|
||||
CWD_API void virtual_cwd_shutdown(void);
|
||||
CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC);
|
||||
CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC);
|
||||
CWD_API int virtual_chdir(const char *path TSRMLS_DC);
|
||||
CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC);
|
||||
CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC);
|
||||
CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC);
|
||||
CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC);
|
||||
CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC);
|
||||
CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...);
|
||||
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC);
|
||||
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC);
|
||||
#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
|
||||
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
#else
|
||||
CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC);
|
||||
#endif
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
#endif
|
||||
CWD_API int virtual_unlink(const char *path TSRMLS_DC);
|
||||
CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC);
|
||||
CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC);
|
||||
CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC);
|
||||
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC);
|
||||
#if HAVE_UTIME
|
||||
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC);
|
||||
#endif
|
||||
CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC);
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path);
|
||||
|
||||
typedef struct _virtual_cwd_globals {
|
||||
cwd_state cwd;
|
||||
} virtual_cwd_globals;
|
||||
|
||||
#ifdef ZTS
|
||||
# define CWDG(v) TSRMG(cwd_globals_id, virtual_cwd_globals *, v)
|
||||
#else
|
||||
# define CWDG(v) (cwd_globals.v)
|
||||
#endif
|
||||
|
||||
/* The actual macros to be used in programs using TSRM
|
||||
* If the program defines VIRTUAL_DIR it will use the
|
||||
* virtual_* functions
|
||||
*/
|
||||
|
||||
#ifdef VIRTUAL_DIR
|
||||
|
||||
#define VCWD_GETCWD(buff, size) virtual_getcwd(buff, size TSRMLS_CC)
|
||||
#define VCWD_FOPEN(path, mode) virtual_fopen(path, mode TSRMLS_CC)
|
||||
/* Because open() has two modes, we have to macros to replace it */
|
||||
#define VCWD_OPEN(path, flags) virtual_open(path TSRMLS_CC, flags)
|
||||
#define VCWD_OPEN_MODE(path, flags, mode) virtual_open(path TSRMLS_CC, flags, mode)
|
||||
#define VCWD_CREAT(path, mode) virtual_creat(path, mode TSRMLS_CC)
|
||||
#define VCWD_CHDIR(path) virtual_chdir(path TSRMLS_CC)
|
||||
#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, virtual_chdir TSRMLS_CC)
|
||||
#define VCWD_GETWD(buf)
|
||||
#define VCWD_REALPATH(path, real_path) virtual_realpath(path, real_path TSRMLS_CC)
|
||||
#define VCWD_RENAME(oldname, newname) virtual_rename(oldname, newname TSRMLS_CC)
|
||||
#define VCWD_STAT(path, buff) virtual_stat(path, buff TSRMLS_CC)
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
#define VCWD_LSTAT(path, buff) virtual_stat(path, buff TSRMLS_CC)
|
||||
#else
|
||||
#define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC)
|
||||
#endif
|
||||
#define VCWD_UNLINK(path) virtual_unlink(path TSRMLS_CC)
|
||||
#define VCWD_MKDIR(pathname, mode) virtual_mkdir(pathname, mode TSRMLS_CC)
|
||||
#define VCWD_RMDIR(pathname) virtual_rmdir(pathname TSRMLS_CC)
|
||||
#define VCWD_OPENDIR(pathname) virtual_opendir(pathname TSRMLS_CC)
|
||||
#define VCWD_POPEN(command, type) virtual_popen(command, type TSRMLS_CC)
|
||||
#if HAVE_UTIME
|
||||
#define VCWD_UTIME(path, time) virtual_utime(path, time TSRMLS_CC)
|
||||
#endif
|
||||
#define VCWD_CHMOD(path, mode) virtual_chmod(path, mode TSRMLS_CC)
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group TSRMLS_CC)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define VCWD_GETCWD(buff, size) getcwd(buff, size)
|
||||
#define VCWD_FOPEN(path, mode) fopen(path, mode)
|
||||
#define VCWD_OPEN(path, flags) open(path, flags)
|
||||
#define VCWD_OPEN_MODE(path, flags, mode) open(path, flags, mode)
|
||||
#define VCWD_CREAT(path, mode) creat(path, mode)
|
||||
#define VCWD_RENAME(oldname, newname) rename(oldname, newname)
|
||||
#define VCWD_CHDIR(path) chdir(path)
|
||||
#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, chdir)
|
||||
#define VCWD_GETWD(buf) getwd(buf)
|
||||
#define VCWD_STAT(path, buff) stat(path, buff)
|
||||
#define VCWD_LSTAT(path, buff) lstat(path, buff)
|
||||
#define VCWD_UNLINK(path) unlink(path)
|
||||
#define VCWD_MKDIR(pathname, mode) mkdir(pathname, mode)
|
||||
#define VCWD_RMDIR(pathname) rmdir(pathname)
|
||||
#define VCWD_OPENDIR(pathname) opendir(pathname)
|
||||
#define VCWD_POPEN(command, type) popen(command, type)
|
||||
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
#define VCWD_REALPATH(path, real_path) realpath(path, real_path)
|
||||
#else
|
||||
#define VCWD_REALPATH(path, real_path) strcpy(real_path, path)
|
||||
#endif
|
||||
|
||||
#if HAVE_UTIME
|
||||
#define VCWD_UTIME(path, time) utime(path, time)
|
||||
#endif
|
||||
#define VCWD_CHMOD(path, mode) chmod(path, mode)
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
#define VCWD_CHOWN(path, owner, group) chown(path, owner, group)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* VIRTUAL_CWD_H */
|
||||
@@ -1,359 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Daniel Beulshausen <daniel@php4win.de> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <process.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include <windows.h>
|
||||
#include "tsrm_win32.h"
|
||||
|
||||
#ifdef ZTS
|
||||
static ts_rsrc_id win32_globals_id;
|
||||
#else
|
||||
static tsrm_win32_globals win32_globals;
|
||||
#endif
|
||||
|
||||
static void tsrm_win32_ctor(tsrm_win32_globals *globals TSRMLS_DC)
|
||||
{
|
||||
globals->process = NULL;
|
||||
globals->shm = NULL;
|
||||
globals->process_size = 0;
|
||||
globals->shm_size = 0;
|
||||
globals->comspec = _strdup((GetVersion()<0x80000000)?"cmd.exe":"command.com");
|
||||
}
|
||||
|
||||
static void tsrm_win32_dtor(tsrm_win32_globals *globals TSRMLS_DC)
|
||||
{
|
||||
shm_pair *ptr;
|
||||
|
||||
if (globals->process) {
|
||||
free(globals->process);
|
||||
}
|
||||
|
||||
if (globals->shm) {
|
||||
for (ptr = globals->shm; ptr < (globals->shm + globals->shm_size); ptr++) {
|
||||
UnmapViewOfFile(ptr->addr);
|
||||
CloseHandle(ptr->segment);
|
||||
UnmapViewOfFile(ptr->descriptor);
|
||||
CloseHandle(ptr->info);
|
||||
}
|
||||
free(globals->shm);
|
||||
}
|
||||
|
||||
free(globals->comspec);
|
||||
}
|
||||
|
||||
TSRM_API void tsrm_win32_startup(void)
|
||||
{
|
||||
#ifdef ZTS
|
||||
ts_allocate_id(&win32_globals_id, sizeof(tsrm_win32_globals), (ts_allocate_ctor)tsrm_win32_ctor, (ts_allocate_ctor)tsrm_win32_dtor);
|
||||
#else
|
||||
tsrm_win32_ctor(&win32_globals TSRMLS_CC);
|
||||
#endif
|
||||
}
|
||||
|
||||
TSRM_API void tsrm_win32_shutdown(void)
|
||||
{
|
||||
#ifndef ZTS
|
||||
tsrm_win32_dtor(&win32_globals TSRMLS_CC);
|
||||
#endif
|
||||
}
|
||||
|
||||
static process_pair *process_get(FILE *stream TSRMLS_DC)
|
||||
{
|
||||
process_pair *ptr;
|
||||
process_pair *newptr;
|
||||
|
||||
for (ptr = TWG(process); ptr < (TWG(process) + TWG(process_size)); ptr++) {
|
||||
if (ptr->stream == stream) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr < (TWG(process) + TWG(process_size))) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
newptr = (process_pair*)realloc((void*)TWG(process), (TWG(process_size)+1)*sizeof(process_pair));
|
||||
if (newptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TWG(process) = newptr;
|
||||
ptr = newptr + TWG(process_size);
|
||||
TWG(process_size)++;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static shm_pair *shm_get(int key, void *addr)
|
||||
{
|
||||
shm_pair *ptr;
|
||||
shm_pair *newptr;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) {
|
||||
if (!ptr->descriptor) {
|
||||
continue;
|
||||
}
|
||||
if (!addr && ptr->descriptor->shm_perm.key == key) {
|
||||
break;
|
||||
} else if (ptr->addr == addr) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr < (TWG(shm) + TWG(shm_size))) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
newptr = (shm_pair*)realloc((void*)TWG(shm), (TWG(shm_size)+1)*sizeof(shm_pair));
|
||||
if (newptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TWG(shm) = newptr;
|
||||
ptr = newptr + TWG(shm_size);
|
||||
TWG(shm_size)++;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static HANDLE dupHandle(HANDLE fh, BOOL inherit) {
|
||||
HANDLE copy, self = GetCurrentProcess();
|
||||
if (!DuplicateHandle(self, fh, self, ©, 0, inherit, DUPLICATE_SAME_ACCESS|DUPLICATE_CLOSE_SOURCE)) {
|
||||
return NULL;
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
TSRM_API FILE *popen(const char *command, const char *type)
|
||||
{
|
||||
FILE *stream = NULL;
|
||||
int fno, str_len = strlen(type), read, mode;
|
||||
STARTUPINFO startup;
|
||||
PROCESS_INFORMATION process;
|
||||
SECURITY_ATTRIBUTES security;
|
||||
HANDLE in, out;
|
||||
char *cmd;
|
||||
process_pair *proc;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
security.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
security.bInheritHandle = TRUE;
|
||||
security.lpSecurityDescriptor = NULL;
|
||||
|
||||
if (!str_len || !CreatePipe(&in, &out, &security, 2048L)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(&startup, 0, sizeof(STARTUPINFO));
|
||||
memset(&process, 0, sizeof(PROCESS_INFORMATION));
|
||||
|
||||
startup.cb = sizeof(STARTUPINFO);
|
||||
startup.dwFlags = STARTF_USESTDHANDLES;
|
||||
startup.hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
||||
|
||||
read = (type[0] == 'r') ? TRUE : FALSE;
|
||||
mode = ((str_len == 2) && (type[1] == 'b')) ? O_BINARY : O_TEXT;
|
||||
|
||||
|
||||
if (read) {
|
||||
in = dupHandle(in, FALSE);
|
||||
startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
startup.hStdOutput = out;
|
||||
} else {
|
||||
out = dupHandle(out, FALSE);
|
||||
startup.hStdInput = in;
|
||||
startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
}
|
||||
|
||||
cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c "));
|
||||
sprintf(cmd, "%s /c %s", TWG(comspec), command);
|
||||
if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, NORMAL_PRIORITY_CLASS, NULL, NULL, &startup, &process)) {
|
||||
return NULL;
|
||||
}
|
||||
free(cmd);
|
||||
|
||||
CloseHandle(process.hThread);
|
||||
proc = process_get(NULL TSRMLS_CC);
|
||||
|
||||
if (read) {
|
||||
fno = _open_osfhandle((long)in, _O_RDONLY | mode);
|
||||
CloseHandle(out);
|
||||
} else {
|
||||
fno = _open_osfhandle((long)out, _O_WRONLY | mode);
|
||||
CloseHandle(in);
|
||||
}
|
||||
|
||||
stream = _fdopen(fno, type);
|
||||
proc->prochnd = process.hProcess;
|
||||
proc->stream = stream;
|
||||
return stream;
|
||||
}
|
||||
|
||||
TSRM_API int pclose(FILE *stream)
|
||||
{
|
||||
DWORD termstat = 0;
|
||||
process_pair *process;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if ((process = process_get(stream TSRMLS_CC)) == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
fflush(process->stream);
|
||||
fclose(process->stream);
|
||||
|
||||
WaitForSingleObject(process->prochnd, INFINITE);
|
||||
GetExitCodeProcess(process->prochnd, &termstat);
|
||||
process->stream = NULL;
|
||||
CloseHandle(process->prochnd);
|
||||
|
||||
return termstat;
|
||||
}
|
||||
|
||||
TSRM_API int shmget(int key, int size, int flags)
|
||||
{
|
||||
shm_pair *shm;
|
||||
char shm_segment[26], shm_info[29];
|
||||
HANDLE shm_handle, info_handle;
|
||||
BOOL created = FALSE;
|
||||
|
||||
if (size < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
sprintf(shm_segment, "TSRM_SHM_SEGMENT:%d", key);
|
||||
sprintf(shm_info, "TSRM_SHM_DESCRIPTOR:%d", key);
|
||||
|
||||
shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment);
|
||||
info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
|
||||
|
||||
if ((!shm_handle && !info_handle)) {
|
||||
if (flags & IPC_EXCL) {
|
||||
return -1;
|
||||
}
|
||||
if (flags & IPC_CREAT) {
|
||||
shm_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, size, shm_segment);
|
||||
info_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descriptor), shm_info);
|
||||
created = TRUE;
|
||||
}
|
||||
if ((!shm_handle || !info_handle)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
shm = shm_get(key, NULL);
|
||||
shm->segment = shm_handle;
|
||||
shm->info = info_handle;
|
||||
shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
|
||||
|
||||
if (created) {
|
||||
shm->descriptor->shm_perm.key = key;
|
||||
shm->descriptor->shm_segsz = size;
|
||||
shm->descriptor->shm_ctime = time(NULL);
|
||||
shm->descriptor->shm_cpid = getpid();
|
||||
shm->descriptor->shm_perm.mode = flags;
|
||||
|
||||
shm->descriptor->shm_perm.cuid = shm->descriptor->shm_perm.cgid= 0;
|
||||
shm->descriptor->shm_perm.gid = shm->descriptor->shm_perm.uid = 0;
|
||||
shm->descriptor->shm_atime = shm->descriptor->shm_dtime = 0;
|
||||
shm->descriptor->shm_lpid = shm->descriptor->shm_nattch = 0;
|
||||
shm->descriptor->shm_perm.mode = shm->descriptor->shm_perm.seq = 0;
|
||||
}
|
||||
|
||||
if (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz ) {
|
||||
CloseHandle(shm->segment);
|
||||
UnmapViewOfFile(shm->descriptor);
|
||||
CloseHandle(shm->info);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
TSRM_API void *shmat(int key, const void *shmaddr, int flags)
|
||||
{
|
||||
shm_pair *shm = shm_get(key, NULL);
|
||||
|
||||
if (!shm->segment) {
|
||||
return (void*)-1;
|
||||
}
|
||||
|
||||
shm->descriptor->shm_atime = time(NULL);
|
||||
shm->descriptor->shm_lpid = getpid();
|
||||
shm->descriptor->shm_nattch++;
|
||||
|
||||
shm->addr = MapViewOfFileEx(shm->segment, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
|
||||
|
||||
return shm->addr;
|
||||
}
|
||||
|
||||
TSRM_API int shmdt(const void *shmaddr)
|
||||
{
|
||||
shm_pair *shm = shm_get(0, (void*)shmaddr);
|
||||
|
||||
if (!shm->segment) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
shm->descriptor->shm_dtime = time(NULL);
|
||||
shm->descriptor->shm_lpid = getpid();
|
||||
shm->descriptor->shm_nattch--;
|
||||
|
||||
return UnmapViewOfFile(shm->addr) ? 0 : -1;
|
||||
}
|
||||
|
||||
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) {
|
||||
shm_pair *shm = shm_get(key, NULL);
|
||||
|
||||
if (!shm->segment) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (cmd) {
|
||||
case IPC_STAT:
|
||||
memcpy(buf, shm->descriptor, sizeof(struct shmid_ds));
|
||||
return 0;
|
||||
|
||||
case IPC_SET:
|
||||
shm->descriptor->shm_ctime = time(NULL);
|
||||
shm->descriptor->shm_perm.uid = buf->shm_perm.uid;
|
||||
shm->descriptor->shm_perm.gid = buf->shm_perm.gid;
|
||||
shm->descriptor->shm_perm.mode = buf->shm_perm.mode;
|
||||
return 0;
|
||||
|
||||
case IPC_RMID:
|
||||
if (shm->descriptor->shm_nattch < 1) {
|
||||
shm->descriptor->shm_perm.key = -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Daniel Beulshausen <daniel@php4win.de> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef TSRM_WIN32_H
|
||||
#define TSRM_WIN32_H
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include <windows.h>
|
||||
|
||||
struct ipc_perm {
|
||||
int key;
|
||||
unsigned short uid;
|
||||
unsigned short gid;
|
||||
unsigned short cuid;
|
||||
unsigned short cgid;
|
||||
unsigned short mode;
|
||||
unsigned short seq;
|
||||
};
|
||||
|
||||
struct shmid_ds {
|
||||
struct ipc_perm shm_perm;
|
||||
int shm_segsz;
|
||||
time_t shm_atime;
|
||||
time_t shm_dtime;
|
||||
time_t shm_ctime;
|
||||
unsigned short shm_cpid;
|
||||
unsigned short shm_lpid;
|
||||
short shm_nattch;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
FILE *stream;
|
||||
HANDLE prochnd;
|
||||
} process_pair;
|
||||
|
||||
typedef struct {
|
||||
void *addr;
|
||||
HANDLE info;
|
||||
HANDLE segment;
|
||||
struct shmid_ds *descriptor;
|
||||
} shm_pair;
|
||||
|
||||
typedef struct {
|
||||
process_pair *process;
|
||||
shm_pair *shm;
|
||||
int process_size;
|
||||
int shm_size;
|
||||
char *comspec;
|
||||
} tsrm_win32_globals;
|
||||
|
||||
#ifdef ZTS
|
||||
# define TWG(v) TSRMG(win32_globals_id, tsrm_win32_globals *, v)
|
||||
#else
|
||||
# define TWG(v) (win32_globals.v)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define IPC_PRIVATE 0
|
||||
#define IPC_CREAT 00001000
|
||||
#define IPC_EXCL 00002000
|
||||
#define IPC_NOWAIT 00004000
|
||||
|
||||
#define IPC_RMID 0
|
||||
#define IPC_SET 1
|
||||
#define IPC_STAT 2
|
||||
#define IPC_INFO 3
|
||||
|
||||
#define SHM_R PAGE_READONLY
|
||||
#define SHM_W PAGE_READWRITE
|
||||
|
||||
#define SHM_RDONLY FILE_MAP_READ
|
||||
#define SHM_RND FILE_MAP_WRITE
|
||||
#define SHM_REMAP FILE_MAP_COPY
|
||||
|
||||
|
||||
TSRM_API void tsrm_win32_startup(void);
|
||||
TSRM_API void tsrm_win32_shutdown(void);
|
||||
|
||||
TSRM_API FILE *popen(const char *command, const char *type);
|
||||
TSRM_API int pclose(FILE *stream);
|
||||
|
||||
TSRM_API int shmget(int key, int size, int flags);
|
||||
TSRM_API void *shmat(int key, const void *shmaddr, int flags);
|
||||
TSRM_API int shmdt(const void *shmaddr);
|
||||
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf);
|
||||
|
||||
#endif
|
||||
+120
-1
@@ -1 +1,120 @@
|
||||
/* Leave this file alone */
|
||||
/* 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 "<?expression?>" 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
|
||||
+112
-1502
File diff suppressed because it is too large.
Load diff
+343
@@ -0,0 +1,343 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| 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: Sascha Schumann <sascha@schumann.cx> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* conflict between PHP and aolserver */
|
||||
#define Debug php_Debug
|
||||
#include "php.h"
|
||||
#undef Debug
|
||||
|
||||
#ifdef HAVE_AOLSERVER
|
||||
|
||||
#include "php_ini.h"
|
||||
#include "php_globals.h"
|
||||
#include "SAPI.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "ns.h"
|
||||
|
||||
#include "php_version.h"
|
||||
|
||||
int Ns_ModuleVersion = 1;
|
||||
|
||||
#define NSLS_D ns_globals_struct *ns_context
|
||||
#define NSLS_DC , NSLS_D
|
||||
#define NSLS_C ns_context
|
||||
#define NSLS_CC , NSLS_C
|
||||
#define NSG(v) (ns_context->v)
|
||||
#define NSLS_FETCH() ns_globals_struct *ns_context = ts_resource(ns_globals_id)
|
||||
|
||||
static int ns_globals_id;
|
||||
|
||||
typedef struct {
|
||||
sapi_module_struct *sapi_module;
|
||||
char *ns_server;
|
||||
char *ns_module;
|
||||
} php_ns_context;
|
||||
|
||||
typedef struct {
|
||||
Ns_Conn *conn;
|
||||
Ns_DString content_type;
|
||||
} ns_globals_struct;
|
||||
|
||||
static void php_ns_config(php_ns_context *ctx);
|
||||
|
||||
static int
|
||||
php_ns_sapi_ub_write(const char *str, uint str_length)
|
||||
{
|
||||
int sent_bytes;
|
||||
NSLS_FETCH();
|
||||
|
||||
sent_bytes = Ns_ConnWrite(NSG(conn), (void *) str, str_length);
|
||||
|
||||
return sent_bytes;
|
||||
}
|
||||
|
||||
static int
|
||||
php_ns_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC)
|
||||
{
|
||||
char *header_name, *header_content;
|
||||
char *p;
|
||||
NSLS_FETCH();
|
||||
|
||||
header_name = sapi_header->header;
|
||||
header_content = p = strchr(header_name, ':');
|
||||
|
||||
if(!p) return 0;
|
||||
|
||||
*p = '\0';
|
||||
do {
|
||||
header_content++;
|
||||
} while(*header_content == ' ');
|
||||
|
||||
if(!strcasecmp(header_name, "Content-type")) {
|
||||
Ns_ConnSetTypeHeader(NSG(conn), header_content);
|
||||
} else {
|
||||
Ns_ConnSetHeaders(NSG(conn), header_name, header_content);
|
||||
}
|
||||
|
||||
*p = ':';
|
||||
|
||||
efree(sapi_header->header);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
php_ns_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
|
||||
{
|
||||
NSLS_FETCH();
|
||||
|
||||
if(SG(sapi_headers).send_default_content_type) {
|
||||
Ns_ConnSetRequiredHeaders(NSG(conn), "text/html", 0);
|
||||
}
|
||||
Ns_ConnFlushHeaders(NSG(conn), SG(sapi_headers).http_response_code);
|
||||
return SAPI_HEADER_SENT_SUCCESSFULLY;
|
||||
}
|
||||
|
||||
static int
|
||||
php_ns_sapi_read_post(char *buf, uint count_bytes SLS_DC)
|
||||
{
|
||||
uint total_read = 0;
|
||||
NSLS_FETCH();
|
||||
|
||||
total_read = Ns_ConnRead(NSG(conn), buf, count_bytes);
|
||||
|
||||
if(total_read == NS_ERROR) {
|
||||
total_read = -1;
|
||||
}
|
||||
|
||||
return total_read;
|
||||
}
|
||||
|
||||
static char *
|
||||
php_ns_sapi_read_cookies(SLS_D)
|
||||
{
|
||||
int i;
|
||||
char *http_cookie = NULL;
|
||||
NSLS_FETCH();
|
||||
|
||||
i = Ns_SetFind(NSG(conn->headers), "cookie");
|
||||
if(i != -1) {
|
||||
http_cookie = Ns_SetValue(NSG(conn->headers), i);
|
||||
}
|
||||
|
||||
return http_cookie;
|
||||
}
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
"PHP Language",
|
||||
|
||||
php_module_startup, /* startup */
|
||||
php_module_shutdown_wrapper, /* shutdown */
|
||||
|
||||
php_ns_sapi_ub_write, /* unbuffered write */
|
||||
|
||||
php_error, /* error handler */
|
||||
|
||||
php_ns_sapi_header_handler, /* header handler */
|
||||
php_ns_sapi_send_headers, /* send headers handler */
|
||||
NULL, /* send header handler */
|
||||
|
||||
php_ns_sapi_read_post, /* read POST data */
|
||||
php_ns_sapi_read_cookies, /* read Cookies */
|
||||
|
||||
STANDARD_SAPI_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
static void
|
||||
php_ns_hash_environment(NSLS_D CLS_DC ELS_DC PLS_DC SLS_DC)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < Ns_SetSize(NSG(conn->headers)); i++) {
|
||||
char *key = Ns_SetKey(NSG(conn->headers), i);
|
||||
char *value = Ns_SetValue(NSG(conn->headers), i);
|
||||
char *p;
|
||||
zval *pval;
|
||||
char buf[512];
|
||||
int buf_len;
|
||||
|
||||
buf_len = snprintf(buf, 511, "HTTP_%s", key);
|
||||
for(p = buf; *p; p++) {
|
||||
*p = toupper(*p);
|
||||
if(*p < 'A' || *p > 'Z') {
|
||||
*p = '_';
|
||||
}
|
||||
}
|
||||
|
||||
MAKE_STD_ZVAL(pval);
|
||||
pval->type = IS_STRING;
|
||||
pval->value.str.len = strlen(value);
|
||||
pval->value.str.val = estrndup(value, pval->value.str.len);
|
||||
|
||||
zend_hash_update(&EG(symbol_table), buf, buf_len + 1, &pval, sizeof(zval *), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
php_ns_module_main(NSLS_D SLS_DC)
|
||||
{
|
||||
zend_file_handle file_handle;
|
||||
CLS_FETCH();
|
||||
ELS_FETCH();
|
||||
PLS_FETCH();
|
||||
|
||||
file_handle.type = ZEND_HANDLE_FILENAME;
|
||||
file_handle.filename = SG(request_info).path_translated;
|
||||
|
||||
php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC);
|
||||
php_ns_hash_environment(NSLS_C CLS_CC ELS_CC PLS_CC SLS_CC);
|
||||
php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
|
||||
php_request_shutdown(NULL);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
php_ns_request_ctor(NSLS_D SLS_DC)
|
||||
{
|
||||
char *server;
|
||||
Ns_DString ds;
|
||||
char *root;
|
||||
|
||||
server = Ns_ConnServer(NSG(conn));
|
||||
|
||||
SG(request_info).query_string = NSG(conn->request->query);
|
||||
|
||||
Ns_DStringInit(&ds);
|
||||
Ns_UrlToFile(&ds, server, NSG(conn->request->url));
|
||||
SG(request_info).path_translated = strdup(Ns_DStringValue(&ds));
|
||||
Ns_DStringFree(&ds);
|
||||
root = Ns_PageRoot(server);
|
||||
SG(request_info).request_uri = SG(request_info).path_translated + strlen(root);
|
||||
SG(request_info).request_method = NSG(conn)->request->method;
|
||||
SG(request_info).content_length = Ns_ConnContentLength(NSG(conn));
|
||||
Ns_DStringInit(&NSG(content_type));
|
||||
Ns_ConnCopyToDString(NSG(conn), SG(request_info).content_length, &NSG(content_type));
|
||||
SG(request_info).content_type = Ns_DStringValue(&NSG(content_type));
|
||||
SG(request_info).auth_user = NULL;
|
||||
SG(request_info).auth_password = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
php_ns_request_dtor(NSLS_D SLS_DC)
|
||||
{
|
||||
free(SG(request_info).path_translated);
|
||||
Ns_DStringFree(&NSG(content_type));
|
||||
}
|
||||
|
||||
static int
|
||||
php_ns_request_handler(void *context, Ns_Conn *conn)
|
||||
{
|
||||
int status = NS_OK;
|
||||
SLS_FETCH();
|
||||
NSLS_FETCH();
|
||||
|
||||
NSG(conn) = conn;
|
||||
|
||||
php_ns_request_ctor(NSLS_C SLS_CC);
|
||||
|
||||
status = php_ns_module_main(NSLS_C SLS_CC);
|
||||
|
||||
php_ns_request_dtor(NSLS_C SLS_CC);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static void
|
||||
php_ns_config(php_ns_context *ctx)
|
||||
{
|
||||
int i;
|
||||
char *path;
|
||||
Ns_Set *set;
|
||||
|
||||
path = Ns_ConfigPath(ctx->ns_server, ctx->ns_module, NULL);
|
||||
set = Ns_ConfigGetSection(path);
|
||||
|
||||
for(i = 0; set && i < Ns_SetSize(set); i++) {
|
||||
char *key = Ns_SetKey(set, i);
|
||||
char *value = Ns_SetValue(set, i);
|
||||
|
||||
if(!strcasecmp(key, "map")) {
|
||||
Ns_Log(Notice, "Registering PHP for \"%s\"", value);
|
||||
Ns_RegisterRequest(ctx->ns_server, "GET", value, php_ns_request_handler, NULL, ctx, 0);
|
||||
Ns_RegisterRequest(ctx->ns_server, "POST", value, php_ns_request_handler, NULL, ctx, 0);
|
||||
Ns_RegisterRequest(ctx->ns_server, "HEAD", value, php_ns_request_handler, NULL, ctx, 0);
|
||||
} else if(!strcasecmp(key, "php_value")) {
|
||||
char *val;
|
||||
|
||||
val = strchr(value, ' ');
|
||||
if(val) {
|
||||
char *new_key;
|
||||
|
||||
new_key = estrndup(value, val - value);
|
||||
|
||||
do {
|
||||
val++;
|
||||
} while(*val == ' ');
|
||||
|
||||
Ns_Log(Debug, "PHP configuration option '%s=%s'", new_key, val);
|
||||
php_alter_ini_entry(new_key, strlen(new_key) + 1, val,
|
||||
strlen(val) + 1, PHP_INI_SYSTEM);
|
||||
|
||||
efree(new_key);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
php_ns_server_shutdown(void *context)
|
||||
{
|
||||
php_ns_context *ctx = (php_ns_context *) context;
|
||||
|
||||
ctx->sapi_module->shutdown(ctx->sapi_module);
|
||||
sapi_shutdown();
|
||||
tsrm_shutdown();
|
||||
|
||||
free(ctx->ns_module);
|
||||
free(ctx->ns_server);
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
int Ns_ModuleInit(char *server, char *module)
|
||||
{
|
||||
php_ns_context *ctx;
|
||||
|
||||
tsrm_startup(1, 1, 0);
|
||||
sapi_startup(&sapi_module);
|
||||
sapi_module.startup(&sapi_module);
|
||||
|
||||
ns_globals_id = ts_allocate_id(sizeof(ns_globals_struct), NULL, NULL);
|
||||
|
||||
ctx = malloc(sizeof *ctx);
|
||||
ctx->sapi_module = &sapi_module;
|
||||
ctx->ns_server = strdup(server);
|
||||
ctx->ns_module = strdup(module);
|
||||
|
||||
php_ns_config(ctx);
|
||||
|
||||
Ns_RegisterServerShutdown(server, php_ns_server_shutdown, ctx);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
File renamed without changes.
@@ -12,7 +12,7 @@ OBJS_LIB=libmodphp4.a
|
||||
|
||||
# objects for building the shared object library
|
||||
SHLIB_OBJS=mod_php4.so-o
|
||||
SHLIB_OBJS_LIB=libmodphp4.a
|
||||
SHLIB_OBJS_LIB=libmodphp4-so.a
|
||||
|
||||
# the general targets
|
||||
all: lib
|
||||
@@ -34,7 +34,7 @@ libphp4.: $(OBJS) $(OBJS_LIB)
|
||||
# build the shared object library by linking the object files
|
||||
libphp4.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
|
||||
rm -f $@
|
||||
$(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS) $(PHP_LIBS)
|
||||
$(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS)
|
||||
|
||||
# 1. extension .o for shared objects cannot be used here because
|
||||
# first these files aren't still shared objects and second we
|
||||
@@ -45,9 +45,9 @@ libphp4.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
|
||||
# extension .so-o
|
||||
.SUFFIXES: .o .so-o
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(PHP_CFLAGS) $(CPPFLAGS) $(SPACER) $<
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
|
||||
.c.so-o:
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(PHP_CFLAGS) $(CPPFLAGS) $(SPACER) $< && mv $*.o $*.so-o
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(SPACER) $< && mv $*.o $*.so-o
|
||||
|
||||
# cleanup
|
||||
clean:
|
||||
@@ -59,7 +59,7 @@ clean:
|
||||
depend:
|
||||
cp Makefile.tmpl Makefile.tmpl.bak \
|
||||
&& sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
|
||||
&& gcc -MM $(INCLUDES) $(CFLAGS) $(PHP_CFLAGS) $(CPPFLAGS) *.c >> Makefile.new \
|
||||
&& gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
|
||||
&& sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' Makefile.new \
|
||||
> Makefile.tmpl \
|
||||
&& rm Makefile.new
|
||||
@@ -70,7 +70,7 @@ $(OBJS): Makefile
|
||||
|
||||
# DO NOT REMOVE
|
||||
mod_php4.o: mod_php4.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
|
||||
$(INCDIR)/buff.h \
|
||||
$(INCDIR)/alloc.h $(INCDIR)/buff.h \
|
||||
$(INCDIR)/http_config.h \
|
||||
$(INCDIR)/http_core.h $(INCDIR)/http_main.h \
|
||||
$(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
|
||||
+2
-6
@@ -64,7 +64,7 @@ php3_write()
|
||||
|
||||
php4_write()
|
||||
{
|
||||
pval *newval = ALLOC_ZVAL();
|
||||
pval *newval = (pval *) emalloc(sizeof(pval));
|
||||
|
||||
newval->refcount=1;
|
||||
newval->is_ref=0;
|
||||
@@ -150,10 +150,6 @@ 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.
|
||||
|
||||
If you do not pass the structure as an argument you can always fetch it by
|
||||
using the appropriate ???LS_FETCH() macros within a functions variable
|
||||
declarations.
|
||||
|
||||
In general, every module that makes use of globals should use this approach
|
||||
if it plans to be thread safe.
|
||||
|
||||
@@ -242,7 +238,7 @@ 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 "bar" is marked so it can be
|
||||
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
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/* -*- 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 <ssb@guardian.no> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#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 ""
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 The PHP Group |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | This source file is subject to version 2.02 of the PHP license, |
|
||||
# | that is bundled with this package in the file LICENSE, and is |
|
||||
# | available at through the world-wide-web at |
|
||||
# | http://www.php.net/license/2_02.txt. |
|
||||
# | If you did not receive a copy of the PHP license and are unable to |
|
||||
# | obtain it through the world-wide-web, please send a note to |
|
||||
# | license@php.net so we can mail you a copy immediately. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
#
|
||||
# Makefile to generate build tools
|
||||
#
|
||||
|
||||
ZENDDIR = Zend
|
||||
|
||||
SUBDIRS = $(ZENDDIR) TSRM
|
||||
|
||||
STAMP = buildmk.stamp
|
||||
|
||||
ALWAYS = generated_lists
|
||||
|
||||
|
||||
all: $(STAMP) $(ALWAYS)
|
||||
@$(MAKE) AMFLAGS=$(AMFLAGS) -s -f build/build2.mk
|
||||
|
||||
generated_lists:
|
||||
@echo makefile_am_files = $(ZENDDIR)/Makefile.am \
|
||||
TSRM/Makefile.am > $@
|
||||
@echo config_h_files = $(ZENDDIR)/acconfig.h TSRM/acconfig.h >> $@
|
||||
@echo config_m4_files = $(ZENDDIR)/Zend.m4 TSRM/tsrm.m4 TSRM/threads.m4 \
|
||||
$(ZENDDIR)/acinclude.m4 ext/*/config*.m4 sapi/*/config.m4 >> $@
|
||||
|
||||
$(STAMP): build/buildcheck.sh
|
||||
@build/buildcheck.sh $(STAMP)
|
||||
|
||||
snapshot:
|
||||
distname='$(DISTNAME)'; \
|
||||
if test -z "$$distname"; then \
|
||||
distname='php4-snapshot'; \
|
||||
fi; \
|
||||
myname=`basename \`pwd\`` ; \
|
||||
cd .. && cp -rp $$myname $$distname; \
|
||||
cd $$distname; \
|
||||
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/build.mk; \
|
||||
cd ..; \
|
||||
tar cf $$distname.tar $$distname; \
|
||||
rm -rf $$distname $$distname.tar.*; \
|
||||
bzip2 -9 $$distname.tar; \
|
||||
md5sum $$distname.tar.bz2; \
|
||||
sync; sleep 2; \
|
||||
md5sum $$distname.tar.bz2; \
|
||||
bzip2 -t $$distname.tar.bz2
|
||||
|
||||
cvsclean:
|
||||
@for i in `find . -name .cvsignore`; do \
|
||||
(cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore` *.o *.a .libs || true); \
|
||||
done
|
||||
|
||||
.PHONY: $(ALWAYS) snapshot cvsclean
|
||||
@@ -1,59 +0,0 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 The PHP Group |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | This source file is subject to version 2.02 of the PHP license, |
|
||||
# | that is bundled with this package in the file LICENSE, and is |
|
||||
# | available at through the world-wide-web at |
|
||||
# | http://www.php.net/license/2_02.txt. |
|
||||
# | If you did not receive a copy of the PHP license and are unable to |
|
||||
# | obtain it through the world-wide-web, please send a note to |
|
||||
# | license@php.net so we can mail you a copy immediately. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
include generated_lists
|
||||
|
||||
TOUCH_FILES = mkinstalldirs install-sh missing
|
||||
|
||||
LT_TARGETS = ltmain.sh config.guess config.sub
|
||||
|
||||
makefile_in_files = $(makefile_am_files:.am=.in)
|
||||
makefile_files = $(makefile_am_files:e.am=e)
|
||||
|
||||
config_h_in = main/php_config.h.in
|
||||
|
||||
acconfig_h_SOURCES = acconfig.h.in $(config_h_files)
|
||||
|
||||
targets = $(TOUCH_FILES) configure $(config_h_in)
|
||||
|
||||
|
||||
all: $(targets)
|
||||
|
||||
acconfig.h: $(acconfig_h_SOURCES)
|
||||
@echo rebuilding $@
|
||||
cat $(acconfig_h_SOURCES) > $@
|
||||
|
||||
SUPPRESS_WARNINGS = (egrep -v '(AC_TRY_RUN called without default to allow cross compiling|AC_PROG_CXXCPP was called before AC_PROG_CXX|defined in acinclude.m4 but never used|AC_PROG_LEX invoked multiple times)'||true)
|
||||
|
||||
$(config_h_in): configure acconfig.h
|
||||
# explicitly remove target since autoheader does not seem to work
|
||||
# correctly otherwise (timestamps are not updated)
|
||||
@echo rebuilding $@
|
||||
@rm -f $@
|
||||
@autoheader 2>&1 | $(SUPPRESS_WARNINGS)
|
||||
|
||||
$(TOUCH_FILES):
|
||||
touch $(TOUCH_FILES)
|
||||
|
||||
aclocal.m4: configure.in acinclude.m4
|
||||
aclocal 2>&1 | $(SUPPRESS_WARNINGS)
|
||||
|
||||
configure: aclocal.m4 configure.in $(config_m4_files)
|
||||
@echo rebuilding $@
|
||||
@autoconf 2>&1 | $(SUPPRESS_WARNINGS)
|
||||
@@ -1,107 +0,0 @@
|
||||
#! /bin/sh
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-2002 The PHP Group |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | This source file is subject to version 2.02 of the PHP license, |
|
||||
# | that is bundled with this package in the file LICENSE, and is |
|
||||
# | available at through the world-wide-web at |
|
||||
# | http://www.php.net/license/2_02.txt. |
|
||||
# | If you did not receive a copy of the PHP license and are unable to |
|
||||
# | obtain it through the world-wide-web, please send a note to |
|
||||
# | license@php.net so we can mail you a copy immediately. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Authors: Stig Bakken <ssb@fast.no> |
|
||||
# | Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id: buildcheck.sh,v 1.19 2002-07-21 13:09:07 sas Exp $
|
||||
#
|
||||
|
||||
echo "buildconf: checking installation..."
|
||||
|
||||
stamp=$1
|
||||
|
||||
# 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 -z "$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
|
||||
|
||||
|
||||
if test "$1" = "2" && test "$2" -ge "50"; then
|
||||
echo "buildconf: Your version of autoconf likely contains buggy cache code."
|
||||
echo " Running cvsclean for you."
|
||||
echo " To avoid this, install autoconf-2.13 and automake-1.5."
|
||||
./cvsclean
|
||||
stamp=
|
||||
fi
|
||||
|
||||
|
||||
# automake 1.4 or newer
|
||||
am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
|
||||
am_version_clean=`echo $am_version|sed -e 's/-p[0-9]*$//'`
|
||||
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_clean; 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.4 or newer
|
||||
# Prefer glibtool over libtool for Mac OS X compatibility
|
||||
libtool=`which glibtool 2> /dev/null`
|
||||
if test ! -f "$libtool"; then libtool=`which libtool`; fi
|
||||
lt_pversion=`$libtool --version 2>/dev/null|sed -n -e 's/^[^0-9]*//' -e 1's/[- ].*//p'`
|
||||
if test "$lt_pversion" = ""; then
|
||||
echo "buildconf: libtool not found."
|
||||
echo " You need libtool version 1.4 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" -ge "4";
|
||||
then
|
||||
echo "buildconf: libtool version $lt_pversion (ok)"
|
||||
else
|
||||
echo "buildconf: libtool version $lt_pversion found."
|
||||
echo " You need libtool version 1.4 or newer installed"
|
||||
echo " to build PHP from CVS."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
am_prefix=`which automake | sed -e 's#/[^/]*/[^/]*$##'`
|
||||
lt_prefix=`echo $libtool | sed -e 's#/[^/]*/[^/]*$##'`
|
||||
if test "$am_prefix" != "$lt_prefix"; then
|
||||
echo "WARNING: automake and libtool are installed in different"
|
||||
echo " directories. This may cause aclocal to fail."
|
||||
echo " continuing anyway"
|
||||
fi
|
||||
|
||||
test -n "$stamp" && touch $stamp
|
||||
|
||||
exit 0
|
||||
@@ -1,41 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
# $Id: genif.sh,v 1.3 2002-03-22 10:22:41 sas Exp $
|
||||
# replacement for genif.pl
|
||||
|
||||
infile=$1
|
||||
shift
|
||||
srcdir=$1
|
||||
shift
|
||||
extra_module_ptrs=$1
|
||||
shift
|
||||
awk=$1
|
||||
shift
|
||||
|
||||
if test -z "$infile" || test -z "$srcdir"; then
|
||||
echo "please supply infile and srcdir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
module_ptrs=$extra_module_ptrs
|
||||
header_list=
|
||||
olddir=`pwd`
|
||||
cd $srcdir
|
||||
|
||||
for ext in ${1+"$@"} ; do
|
||||
module_ptrs=" phpext_${ext}_ptr,@NEWLINE@$module_ptrs"
|
||||
header_list="$header_list ext/$ext/*.h"
|
||||
done
|
||||
|
||||
includes=`$awk -f ./build/print_include.awk $header_list`
|
||||
|
||||
cd $olddir
|
||||
|
||||
cat $infile | \
|
||||
sed \
|
||||
-e "s'@EXT_INCLUDE_CODE@'$includes'" \
|
||||
-e "s'@EXT_MODULE_PTRS@'$module_ptrs'" \
|
||||
-e 's/@NEWLINE@/\
|
||||
/g'
|
||||
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 4 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 2000 The PHP Group |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | This source file is subject to version 2.02 of the PHP license, |
|
||||
# | that is bundled with this package in the file LICENSE, and is |
|
||||
# | available at through the world-wide-web at |
|
||||
# | http://www.php.net/license/2_02.txt. |
|
||||
# | If you did not receive a copy of the PHP license and are unable to |
|
||||
# | obtain it through the world-wide-web, please send a note to |
|
||||
# | license@php.net so we can mail you a copy immediately. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# echo top_srcdir top_builddir srcdir CPP [CPP-ARGS] filenames | \
|
||||
# awk -f mkdep.awk > dependencies
|
||||
|
||||
|
||||
{
|
||||
top_srcdir=$1
|
||||
top_builddir=$2
|
||||
srcdir=$3
|
||||
cmd=$4
|
||||
|
||||
for (i = 5; i <= NF; i++) {
|
||||
if (match($i, "^-[A-Z]") == 0)
|
||||
break;
|
||||
cmd=cmd " " $i
|
||||
}
|
||||
|
||||
dif=i-1
|
||||
|
||||
for (; i <= NF; i++)
|
||||
filenames[i-dif]=$i
|
||||
|
||||
no_files=NF-dif
|
||||
|
||||
for(i = 1; i <= no_files; i++) {
|
||||
if (system("test -r " filenames[i]) != 0)
|
||||
continue
|
||||
|
||||
target=filenames[i]
|
||||
sub(srcdir "/", "", target)
|
||||
target2=target
|
||||
sub("\.(c|cpp)$", ".lo", target);
|
||||
sub("\.(c|cpp)$", ".slo", target2);
|
||||
|
||||
for (e in used)
|
||||
delete used[e]
|
||||
|
||||
cmdx=cmd " " filenames[i]
|
||||
done=0
|
||||
while ((cmdx | getline) > 0) {
|
||||
if (match($0, "^# [0-9]* \".*\.h\"") != 0) {
|
||||
if (sub(top_srcdir, "$(top_srcdir)", $3) == 0)
|
||||
sub(top_builddir, "$(top_builddir)", $3)
|
||||
if (substr($3,2,1) != "/" && used[$3] != 1) {
|
||||
if (done == 0)
|
||||
printf(target " " target2 ":")
|
||||
done=1
|
||||
printf(" \\\n\t" substr($3,2,length($3)-2))
|
||||
used[$3] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (done == 1)
|
||||
print "\n"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
/phpext_/ {
|
||||
if (old_filename != FILENAME) {
|
||||
printf "#include \"" FILENAME "\"@NEWLINE@"
|
||||
old_filename = FILENAME
|
||||
}
|
||||
}
|
||||
-787
@@ -1,787 +0,0 @@
|
||||
#!/bin/sh
|
||||
##
|
||||
## GNU shtool -- The GNU Portable Shell Tool
|
||||
## Copyright (c) 1994-2001 Ralf S. Engelschall <rse@engelschall.com>
|
||||
##
|
||||
## See http://www.gnu.org/software/shtool/ for more information.
|
||||
## See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
|
||||
##
|
||||
## Version: 1.5.4 (14-Jun-2001)
|
||||
## Contents: 3/17 available modules
|
||||
##
|
||||
|
||||
##
|
||||
## 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
## USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
|
||||
##
|
||||
## NOTICE: Given that you include this file verbatim into your own
|
||||
## source tree, you are justified in saying that it remains separate
|
||||
## from your package, and that this way you are simply just using GNU
|
||||
## shtool. So, in this situation, there is no requirement that your
|
||||
## package itself is licensed under the GNU General Public License in
|
||||
## order to take advantage of GNU shtool.
|
||||
##
|
||||
|
||||
##
|
||||
## Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]
|
||||
##
|
||||
## Available commands:
|
||||
## echo Print string with optional construct expansion
|
||||
## install Install a program, script or datafile
|
||||
## mkdir Make one or more directories
|
||||
##
|
||||
## Not available commands (because module was not built-in):
|
||||
## mdate Pretty-print modification time of a file or dir
|
||||
## table Pretty-print a field-separated list as a table
|
||||
## prop Display progress with a running propeller
|
||||
## move Move files with simultaneous substitution
|
||||
## mkln Make link with calculation of relative paths
|
||||
## mkshadow Make a shadow tree through symbolic links
|
||||
## fixperm Fix file permissions inside a source tree
|
||||
## tarball Roll distribution tarballs
|
||||
## guessos Simple operating system guesser
|
||||
## arx Extended archive command
|
||||
## slo Separate linker options by library class
|
||||
## scpp Sharing C Pre-Processor
|
||||
## version Maintain a version information file
|
||||
## path Deal with program paths
|
||||
##
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "$0:Error: invalid command line" 1>&2
|
||||
echo "$0:Hint: run \`$0 -h' for usage" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
|
||||
echo "This is GNU shtool, version 1.5.4 (14-Jun-2001)"
|
||||
echo "Copyright (c) 1994-2001 Ralf S. Engelschall <rse@engelschall.com>"
|
||||
echo "Report bugs to <bug-shtool@gnu.org>"
|
||||
echo ''
|
||||
echo "Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]"
|
||||
echo ''
|
||||
echo 'Available global <options>:'
|
||||
echo ' -v, --version display shtool version information'
|
||||
echo ' -h, --help display shtool usage help page (this one)'
|
||||
echo ' -d, --debug display shell trace information'
|
||||
echo ' -r, --recreate recreate this shtool script via shtoolize'
|
||||
echo ''
|
||||
echo 'Available <cmd-name> [<cmd-options>] [<cmd-args>]:'
|
||||
echo ' echo [-n] [-e] [<str> ...]'
|
||||
echo ' install [-v] [-t] [-c] [-C] [-s] [-m<mode>] [-o<owner>] [-g<group>]'
|
||||
echo ' [-e<sed-cmd>] <file> [<file> ...] <path>'
|
||||
echo ' mkdir [-t] [-f] [-p] [-m<mode>] <dir> [<dir> ...]'
|
||||
echo ''
|
||||
echo 'Not available <cmd-name> (because module was not built-in):'
|
||||
echo ' mdate [-n] [-z] [-s] [-d] [-f<str>] [-o<spec>] <path>'
|
||||
echo ' table [-F<sep>] [-w<width>] [-c<cols>] [-s<strip>] <str><sep><str>...'
|
||||
echo ' prop [-p<str>]'
|
||||
echo ' move [-v] [-t] [-e] [-p] <src-file> <dst-file>'
|
||||
echo ' mkln [-t] [-f] [-s] <src-path> [<src-path> ...] <dst-path>'
|
||||
echo ' mkshadow [-v] [-t] [-a] <src-dir> <dst-dir>'
|
||||
echo ' fixperm [-v] [-t] <path> [<path> ...]'
|
||||
echo ' tarball [-t] [-v] [-o<tarball>] [-c<prog>] [-d<dir>] [-u<user>]'
|
||||
echo ' [-g<group>] [-e<pattern>] <path> [<path> ...]'
|
||||
echo ' guessos '
|
||||
echo ' arx [-t] [-C<cmd>] <op> <archive> [<file> ...]'
|
||||
echo ' slo [-p<str>] -- -L<dir> -l<lib> [-L<dir> -l<lib> ...]'
|
||||
echo ' scpp [-v] [-p] [-f<filter>] [-o<ofile>] [-t<tfile>] [-M<mark>]'
|
||||
echo ' [-D<dname>] [-C<cname>] <file> [<file> ...]'
|
||||
echo ' version [-l<lang>] [-n<name>] [-p<prefix>] [-s<version>] [-e]'
|
||||
echo ' [-i<knob>] [-d<type>] <file>'
|
||||
echo ' path [-s] [-r] [-d] [-b] [-m] [-p<path>] <str> [<str> ...]'
|
||||
echo ''
|
||||
exit 0
|
||||
fi
|
||||
if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then
|
||||
echo "GNU shtool 1.5.4 (14-Jun-2001)"
|
||||
exit 0
|
||||
fi
|
||||
if [ ".$1" = ".-r" -o ".$1" = ."--recreate" ]; then
|
||||
shtoolize -ofoo echo install mkdir
|
||||
exit 0
|
||||
fi
|
||||
if [ ".$1" = ".-d" -o ".$1" = ."--debug" ]; then
|
||||
shift
|
||||
set -x
|
||||
fi
|
||||
name=`echo "$0" | sed -e 's;.*/\([^/]*\)$;\1;' -e 's;-sh$;;' -e 's;\.sh$;;'`
|
||||
case "$name" in
|
||||
echo|install|mkdir )
|
||||
# implicit tool command selection
|
||||
tool="$name"
|
||||
;;
|
||||
* )
|
||||
# explicit tool command selection
|
||||
tool="$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
arg_spec=""
|
||||
opt_spec=""
|
||||
gen_tmpfile=no
|
||||
|
||||
##
|
||||
## DISPATCH INTO SCRIPT PROLOG
|
||||
##
|
||||
|
||||
case $tool in
|
||||
echo )
|
||||
str_tool="echo"
|
||||
str_usage="[-n] [-e] [<str> ...]"
|
||||
arg_spec="0+"
|
||||
opt_spec="n.e."
|
||||
opt_n=no
|
||||
opt_e=no
|
||||
;;
|
||||
install )
|
||||
str_tool="install"
|
||||
str_usage="[-v] [-t] [-c] [-C] [-s] [-m<mode>] [-o<owner>] [-g<group>] [-e<sed-cmd>] <file> [<file> ...] <path>"
|
||||
arg_spec="2+"
|
||||
opt_spec="v.t.c.C.s.m:o:g:e+"
|
||||
opt_v=no
|
||||
opt_t=no
|
||||
opt_c=no
|
||||
opt_C=no
|
||||
opt_s=no
|
||||
opt_m="0755"
|
||||
opt_o=""
|
||||
opt_g=""
|
||||
opt_e=""
|
||||
;;
|
||||
mkdir )
|
||||
str_tool="mkdir"
|
||||
str_usage="[-t] [-f] [-p] [-m<mode>] <dir> [<dir> ...]"
|
||||
arg_spec="1+"
|
||||
opt_spec="t.f.p.m:"
|
||||
opt_t=no
|
||||
opt_f=no
|
||||
opt_p=no
|
||||
opt_m=""
|
||||
;;
|
||||
-* )
|
||||
echo "$0:Error: unknown option \`$tool'" 2>&1
|
||||
echo "$0:Hint: run \`$0 -h' for usage" 2>&1
|
||||
exit 1
|
||||
;;
|
||||
* )
|
||||
echo "$0:Error: unknown command \`$tool'" 2>&1
|
||||
echo "$0:Hint: run \`$0 -h' for usage" 2>&1
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
##
|
||||
## COMMON UTILITY CODE
|
||||
##
|
||||
|
||||
# determine name of tool
|
||||
if [ ".$tool" != . ]; then
|
||||
# used inside shtool script
|
||||
toolcmd="$0 $tool"
|
||||
toolcmdhelp="shtool $tool"
|
||||
msgprefix="shtool:$tool"
|
||||
else
|
||||
# used as standalone script
|
||||
toolcmd="$0"
|
||||
toolcmdhelp="sh $0"
|
||||
msgprefix="$str_tool"
|
||||
fi
|
||||
|
||||
# parse argument specification string
|
||||
eval `echo $arg_spec |\
|
||||
sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'`
|
||||
|
||||
# parse option specification string
|
||||
eval `echo h.$opt_spec |\
|
||||
sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'`
|
||||
|
||||
# interate over argument line
|
||||
opt_PREV=''
|
||||
while [ $# -gt 0 ]; do
|
||||
# special option stops processing
|
||||
if [ ".$1" = ".--" ]; then
|
||||
shift
|
||||
break
|
||||
fi
|
||||
|
||||
# determine option and argument
|
||||
opt_ARG_OK=no
|
||||
if [ ".$opt_PREV" != . ]; then
|
||||
# merge previous seen option with argument
|
||||
opt_OPT="$opt_PREV"
|
||||
opt_ARG="$1"
|
||||
opt_ARG_OK=yes
|
||||
opt_PREV=''
|
||||
else
|
||||
# split argument into option and argument
|
||||
case "$1" in
|
||||
-[a-zA-Z0-9]*)
|
||||
eval `echo "x$1" |\
|
||||
sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \
|
||||
-e 's/";\(.*\)$/"; opt_ARG="\1"/'`
|
||||
;;
|
||||
-[a-zA-Z0-9])
|
||||
opt_OPT=`echo "x$1" | cut -c3-`
|
||||
opt_ARG=''
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# eat up option
|
||||
shift
|
||||
|
||||
# determine whether option needs an argument
|
||||
eval "opt_MODE=\$opt_MODE_${opt_OPT}"
|
||||
if [ ".$opt_ARG" = . -a ".$opt_ARG_OK" != .yes ]; then
|
||||
if [ ".$opt_MODE" = ".:" -o ".$opt_MODE" = ".+" ]; then
|
||||
opt_PREV="$opt_OPT"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
# process option
|
||||
case $opt_MODE in
|
||||
'.' )
|
||||
# boolean option
|
||||
eval "opt_${opt_OPT}=yes"
|
||||
;;
|
||||
':' )
|
||||
# option with argument (multiple occurances override)
|
||||
eval "opt_${opt_OPT}=\"\$opt_ARG\""
|
||||
;;
|
||||
'+' )
|
||||
# option with argument (multiple occurances append)
|
||||
eval "opt_${opt_OPT}=\"\$opt_${opt_OPT} \$opt_ARG\""
|
||||
;;
|
||||
* )
|
||||
echo "$msgprefix:Error: unknown option: \`-$opt_OPT'" 1>&2
|
||||
echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ ".$opt_PREV" != . ]; then
|
||||
echo "$msgprefix:Error: missing argument to option \`-$opt_PREV'" 1>&2
|
||||
echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# process help option
|
||||
if [ ".$opt_h" = .yes ]; then
|
||||
echo "Usage: $toolcmdhelp $str_usage"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# complain about incorrect number of arguments
|
||||
case $arg_MODE in
|
||||
'=' )
|
||||
if [ $# -ne $arg_NUMS ]; then
|
||||
echo "$msgprefix:Error: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2
|
||||
echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
'+' )
|
||||
if [ $# -lt $arg_NUMS ]; then
|
||||
echo "$msgprefix:Error: invalid number of arguments (at least $arg_NUMS expected)" 1>&2
|
||||
echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# establish a temporary file on request
|
||||
if [ ".$gen_tmpfile" = .yes ]; then
|
||||
if [ ".$TMPDIR" != . ]; then
|
||||
tmpdir="$TMPDIR"
|
||||
elif [ ".$TEMPDIR" != . ]; then
|
||||
tmpdir="$TEMPDIR"
|
||||
else
|
||||
tmpdir="/tmp"
|
||||
fi
|
||||
tmpfile="$tmpdir/.shtool.$$"
|
||||
rm -f $tmpfile >/dev/null 2>&1
|
||||
touch $tmpfile
|
||||
chmod 600 $tmpfile
|
||||
fi
|
||||
|
||||
##
|
||||
## DISPATCH INTO SCRIPT BODY
|
||||
##
|
||||
|
||||
case $tool in
|
||||
|
||||
echo )
|
||||
##
|
||||
## echo -- Print string with optional construct expansion
|
||||
## Copyright (c) 1998-2001 Ralf S. Engelschall <rse@engelschall.com>
|
||||
## Originally written for WML as buildinfo
|
||||
##
|
||||
|
||||
text="$*"
|
||||
|
||||
# check for broken escape sequence expansion
|
||||
seo=''
|
||||
bytes=`echo '\1' | wc -c | awk '{ printf("%s", $1); }'`
|
||||
if [ ".$bytes" != .3 ]; then
|
||||
bytes=`echo -E '\1' | wc -c | awk '{ printf("%s", $1); }'`
|
||||
if [ ".$bytes" = .3 ]; then
|
||||
seo='-E'
|
||||
fi
|
||||
fi
|
||||
|
||||
# check for existing -n option (to suppress newline)
|
||||
minusn=''
|
||||
bytes=`echo -n 123 2>/dev/null | wc -c | awk '{ printf("%s", $1); }'`
|
||||
if [ ".$bytes" = .3 ]; then
|
||||
minusn='-n'
|
||||
fi
|
||||
|
||||
# determine terminal bold sequence
|
||||
term_bold=''
|
||||
term_norm=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[Bb]'`" != . ]; then
|
||||
case $TERM in
|
||||
# for the most important terminal types we directly know the sequences
|
||||
xterm|xterm*|vt220|vt220*)
|
||||
term_bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
|
||||
term_norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
|
||||
;;
|
||||
vt100|vt100*)
|
||||
term_bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
|
||||
term_norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
|
||||
;;
|
||||
# for all others, we try to use a possibly existing `tput' or `tcout' utility
|
||||
* )
|
||||
paths=`echo $PATH | sed -e 's/:/ /g'`
|
||||
for tool in tput tcout; do
|
||||
for dir in $paths; do
|
||||
if [ -r "$dir/$tool" ]; then
|
||||
for seq in bold md smso; do # 'smso' is last
|
||||
bold="`$dir/$tool $seq 2>/dev/null`"
|
||||
if [ ".$bold" != . ]; then
|
||||
term_bold="$bold"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ".$term_bold" != . ]; then
|
||||
for seq in sgr0 me rmso reset; do # 'reset' is last
|
||||
norm="`$dir/$tool $seq 2>/dev/null`"
|
||||
if [ ".$norm" != . ]; then
|
||||
term_norm="$norm"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ".$term_bold" != . -a ".$term_norm" != . ]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
if [ ".$term_bold" = . -o ".$term_norm" = . ]; then
|
||||
echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2
|
||||
fi
|
||||
fi
|
||||
|
||||
# determine user name
|
||||
username=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uUgG]'`" != . ]; then
|
||||
username="$LOGNAME"
|
||||
if [ ".$username" = . ]; then
|
||||
username="$USER"
|
||||
if [ ".$username" = . ]; then
|
||||
username="`(whoami) 2>/dev/null |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$username" = . ]; then
|
||||
username="`(who am i) 2>/dev/null |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$username" = . ]; then
|
||||
username='unknown'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# determine user id
|
||||
userid=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%U'`" != . ]; then
|
||||
userid="`(id -u) 2>/dev/null`"
|
||||
if [ ".$userid" = . ]; then
|
||||
str="`(id) 2>/dev/null`"
|
||||
if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then
|
||||
userid=`echo $str | sed -e 's/^uid[ ]*=[ ]*//' -e 's/(.*//'`
|
||||
fi
|
||||
if [ ".$userid" = . ]; then
|
||||
userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
|
||||
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$userid" = . ]; then
|
||||
userid=`(ypcat passwd) 2>/dev/null |
|
||||
egrep "^${username}:" | \
|
||||
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$userid" = . ]; then
|
||||
userid='?'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# determine (primary) group id
|
||||
groupid=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[gG]'`" != . ]; then
|
||||
groupid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
|
||||
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$groupid" = . ]; then
|
||||
groupid=`(ypcat passwd) 2>/dev/null | egrep "^${username}:" | \
|
||||
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$groupid" = . ]; then
|
||||
groupid='?'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# determine (primary) group name
|
||||
groupname=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%g'`" != . ]; then
|
||||
groupname=`egrep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
|
||||
sed -e 's/:.*$//'`
|
||||
if [ ".$groupname" = . ]; then
|
||||
groupname=`(ypcat group) 2>/dev/null | \
|
||||
egrep "^[^:]*:[^:]*:${groupid}:" | \
|
||||
sed -e 's/:.*$//'`
|
||||
if [ ".$groupname" = . ]; then
|
||||
groupname='?'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# determine host and domain name
|
||||
hostname=''
|
||||
domainname=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%h'`" != . ]; then
|
||||
hostname="`(uname -n) 2>/dev/null |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$hostname" = . ]; then
|
||||
hostname="`(hostname) 2>/dev/null |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$hostname" = . ]; then
|
||||
hostname='unknown'
|
||||
fi
|
||||
fi
|
||||
case $hostname in
|
||||
*.* )
|
||||
domainname=".`echo $hostname | cut -d. -f2-`"
|
||||
hostname="`echo $hostname | cut -d. -f1`"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%d'`" != . ]; then
|
||||
if [ ".$domainname" = . ]; then
|
||||
if [ -f /etc/resolv.conf ]; then
|
||||
domainname="`egrep '^[ ]*domain' /etc/resolv.conf | head -1 |\
|
||||
sed -e 's/.*domain//' \
|
||||
-e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
|
||||
-e 's/^\.//' -e 's/^/./' |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$domainname" = . ]; then
|
||||
domainname="`egrep '^[ ]*search' /etc/resolv.conf | head -1 |\
|
||||
sed -e 's/.*search//' \
|
||||
-e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
|
||||
-e 's/ .*//' -e 's/ .*//' \
|
||||
-e 's/^\.//' -e 's/^/./' |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# determine current time
|
||||
time_day=''
|
||||
time_month=''
|
||||
time_year=''
|
||||
time_monthname=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[DMYm]'`" != . ]; then
|
||||
time_day=`date '+%d'`
|
||||
time_month=`date '+%m'`
|
||||
time_year=`date '+%Y' 2>/dev/null`
|
||||
if [ ".$time_year" = . ]; then
|
||||
time_year=`date '+%y'`
|
||||
case $time_year in
|
||||
[5-9][0-9]) time_year="19$time_year" ;;
|
||||
[0-4][0-9]) time_year="20$time_year" ;;
|
||||
esac
|
||||
fi
|
||||
case $time_month in
|
||||
1|01) time_monthname='Jan' ;;
|
||||
2|02) time_monthname='Feb' ;;
|
||||
3|03) time_monthname='Mar' ;;
|
||||
4|04) time_monthname='Apr' ;;
|
||||
5|05) time_monthname='May' ;;
|
||||
6|06) time_monthname='Jun' ;;
|
||||
7|07) time_monthname='Jul' ;;
|
||||
8|08) time_monthname='Aug' ;;
|
||||
9|09) time_monthname='Sep' ;;
|
||||
10) time_monthname='Oct' ;;
|
||||
11) time_monthname='Nov' ;;
|
||||
12) time_monthname='Dec' ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# expand special ``%x'' constructs
|
||||
if [ ".$opt_e" = .yes ]; then
|
||||
text=`echo $seo "$text" |\
|
||||
sed -e "s/%B/${term_bold}/g" \
|
||||
-e "s/%b/${term_norm}/g" \
|
||||
-e "s/%u/${username}/g" \
|
||||
-e "s/%U/${userid}/g" \
|
||||
-e "s/%g/${groupname}/g" \
|
||||
-e "s/%G/${groupid}/g" \
|
||||
-e "s/%h/${hostname}/g" \
|
||||
-e "s/%d/${domainname}/g" \
|
||||
-e "s/%D/${time_day}/g" \
|
||||
-e "s/%M/${time_month}/g" \
|
||||
-e "s/%Y/${time_year}/g" \
|
||||
-e "s/%m/${time_monthname}/g" 2>/dev/null`
|
||||
fi
|
||||
|
||||
# create output
|
||||
if [ .$opt_n = .no ]; then
|
||||
echo $seo "$text"
|
||||
else
|
||||
# the harder part: echo -n is best, because
|
||||
# awk may complain about some \xx sequences.
|
||||
if [ ".$minusn" != . ]; then
|
||||
echo $seo $minusn "$text"
|
||||
else
|
||||
echo dummy | awk '{ printf("%s", TEXT); }' TEXT="$text"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
install )
|
||||
##
|
||||
## install -- Install a program, script or datafile
|
||||
## Copyright (c) 1997-2001 Ralf S. Engelschall <rse@engelschall.com>
|
||||
## Originally written for shtool
|
||||
##
|
||||
|
||||
# determine source(s) and destination
|
||||
argc=$#
|
||||
srcs=""
|
||||
while [ $# -gt 1 ]; do
|
||||
srcs="$srcs $1"
|
||||
shift
|
||||
done
|
||||
dstpath="$1"
|
||||
|
||||
# type check for destination
|
||||
dstisdir=0
|
||||
if [ -d $dstpath ]; then
|
||||
dstpath=`echo "$dstpath" | sed -e 's:/$::'`
|
||||
dstisdir=1
|
||||
fi
|
||||
|
||||
# consistency check for destination
|
||||
if [ $argc -gt 2 -a $dstisdir = 0 ]; then
|
||||
echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# iterate over all source(s)
|
||||
for src in $srcs; do
|
||||
dst=$dstpath
|
||||
|
||||
# if destination is a directory, append the input filename
|
||||
if [ $dstisdir = 1 ]; then
|
||||
dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'`
|
||||
dst="$dst/$dstfile"
|
||||
fi
|
||||
|
||||
# check for correct arguments
|
||||
if [ ".$src" = ".$dst" ]; then
|
||||
echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2
|
||||
continue
|
||||
fi
|
||||
if [ -d "$src" ]; then
|
||||
echo "$msgprefix:Warning: source \`$src' is a directory - skipped" 1>&2
|
||||
continue
|
||||
fi
|
||||
|
||||
# make a temp file name in the destination directory
|
||||
dsttmp=`echo $dst |\
|
||||
sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \
|
||||
-e "s;\$;/#INST@$$#;"`
|
||||
|
||||
# verbosity
|
||||
if [ ".$opt_v" = .yes ]; then
|
||||
echo "$src -> $dst" 1>&2
|
||||
fi
|
||||
|
||||
# copy or move the file name to the temp name
|
||||
# (because we might be not allowed to change the source)
|
||||
if [ ".$opt_C" = .yes ]; then
|
||||
opt_c=yes
|
||||
fi
|
||||
if [ ".$opt_c" = .yes ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "cp $src $dsttmp" 1>&2
|
||||
fi
|
||||
cp $src $dsttmp || exit $?
|
||||
else
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "mv $src $dsttmp" 1>&2
|
||||
fi
|
||||
mv $src $dsttmp || exit $?
|
||||
fi
|
||||
|
||||
# adjust the target file
|
||||
if [ ".$opt_e" != . ]; then
|
||||
sed='sed'
|
||||
for e in $opt_e; do
|
||||
sed="$sed -e '$e'"
|
||||
done
|
||||
cp $dsttmp $dsttmp.old
|
||||
eval "$sed <$dsttmp.old >$dsttmp" || exit $?
|
||||
rm -f $dsttmp.old
|
||||
fi
|
||||
if [ ".$opt_s" = .yes ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "strip $dsttmp" 1>&2
|
||||
fi
|
||||
strip $dsttmp || exit $?
|
||||
fi
|
||||
if [ ".$opt_o" != . ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chown $opt_o $dsttmp" 1>&2
|
||||
fi
|
||||
chown $opt_o $dsttmp || exit $?
|
||||
fi
|
||||
if [ ".$opt_g" != . ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chgrp $opt_g $dsttmp" 1>&2
|
||||
fi
|
||||
chgrp $opt_g $dsttmp || exit $?
|
||||
fi
|
||||
if [ ".$opt_m" != ".-" ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chmod $opt_m $dsttmp" 1>&2
|
||||
fi
|
||||
chmod $opt_m $dsttmp || exit $?
|
||||
fi
|
||||
|
||||
# determine whether to do a quick install
|
||||
# (has to be done _after_ the strip was already done)
|
||||
quick=no
|
||||
if [ ".$opt_C" = .yes ]; then
|
||||
if [ -r $dst ]; then
|
||||
if cmp -s $src $dst; then
|
||||
quick=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# finally, install the file to the real destination
|
||||
if [ $quick = yes ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "rm -f $dsttmp" 1>&2
|
||||
fi
|
||||
rm -f $dsttmp
|
||||
else
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "rm -f $dst && mv $dsttmp $dst" 1>&2
|
||||
fi
|
||||
rm -f $dst && mv $dsttmp $dst
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
||||
mkdir )
|
||||
##
|
||||
## mkdir -- Make one or more directories
|
||||
## Copyright (c) 1996-2001 Ralf S. Engelschall <rse@engelschall.com>
|
||||
## Originally written for public domain by Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
## Cleaned up and enhanced for shtool
|
||||
##
|
||||
|
||||
errstatus=0
|
||||
for p in ${1+"$@"}; do
|
||||
# if the directory already exists...
|
||||
if [ -d "$p" ]; then
|
||||
if [ ".$opt_f" = .no -a ".$opt_p" = .no ]; then
|
||||
echo "$msgprefix:Error: directory already exists: $p" 1>&2
|
||||
errstatus=1
|
||||
break
|
||||
else
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
# if the directory has to be created...
|
||||
if [ ".$opt_p" = .no ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "mkdir $p" 1>&2
|
||||
fi
|
||||
mkdir $p || errstatus=$?
|
||||
if [ ".$opt_m" != . ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chmod $opt_m $p" 1>&2
|
||||
fi
|
||||
chmod $opt_m $p || errstatus=$?
|
||||
fi
|
||||
else
|
||||
# the smart situation
|
||||
set fnord `echo ":$p" |\
|
||||
sed -e 's/^:\//%/' \
|
||||
-e 's/^://' \
|
||||
-e 's/\// /g' \
|
||||
-e 's/^%/\//'`
|
||||
shift
|
||||
pathcomp=''
|
||||
for d in ${1+"$@"}; do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp="./$pathcomp" ;;
|
||||
esac
|
||||
if [ ! -d "$pathcomp" ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "mkdir $pathcomp" 1>&2
|
||||
fi
|
||||
mkdir $pathcomp || errstatus=$?
|
||||
if [ ".$opt_m" != . ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chmod $opt_m $pathcomp" 1>&2
|
||||
fi
|
||||
chmod $opt_m $pathcomp || errstatus=$?
|
||||
fi
|
||||
fi
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
fi
|
||||
done
|
||||
exit $errstatus
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
##EOF##
|
||||
@@ -1,24 +1,151 @@
|
||||
#!/bin/sh
|
||||
# $Id$
|
||||
|
||||
while test $# -gt 0; do
|
||||
if test "$1" = "--copy"; then
|
||||
automake_flags=--copy
|
||||
fi
|
||||
|
||||
if test "$1" = "--ZendEngine2"; then
|
||||
ZENDDIR=ZendEngine2
|
||||
echo "Using Zend Engine 2 code"
|
||||
fi
|
||||
supplied_flag=$1
|
||||
|
||||
# do some version checking for the tools we use
|
||||
if test "$1" = "--force"; then
|
||||
shift
|
||||
done
|
||||
# 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..."
|
||||
|
||||
if test -z "$ZENDDIR"; then
|
||||
ZENDDIR=Zend
|
||||
echo "using default Zend directory"
|
||||
# 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
|
||||
|
||||
rm -f generated_lists
|
||||
|
||||
${MAKE:-make} -s -f build/build.mk AMFLAGS="$automake_flags" ZENDDIR="$ZENDDIR"
|
||||
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
|
||||
|
||||
libtoolize --automake $automake_flags --force
|
||||
|
||||
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
|
||||
|
||||
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 configure"
|
||||
mv configure.old configure
|
||||
else
|
||||
echo "buildconf: created or modified configure"
|
||||
fi
|
||||
|
||||
(cd libzend; ./buildconf libzend/)
|
||||
(cd TSRM; ./buildconf TSRM/)
|
||||
+244
@@ -0,0 +1,244 @@
|
||||
# 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
|
||||
|
||||
+501
@@ -0,0 +1,501 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| 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 <rasmus@lerdorf.on.ca> |
|
||||
| Stig Bakken <ssb@fast.no> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "php.h"
|
||||
#include "php_globals.h"
|
||||
|
||||
#include "SAPI.h"
|
||||
|
||||
#if CGI_BINARY
|
||||
|
||||
#include <stdio.h>
|
||||
#include "php.h"
|
||||
#ifdef MSVC5
|
||||
#include "win32/time.h"
|
||||
#include "win32/signal.h"
|
||||
#include <process.h>
|
||||
#else
|
||||
#include "build-defs.h"
|
||||
#endif
|
||||
#if HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#if HAVE_SETLOCALE
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#include "zend.h"
|
||||
#include "php_ini.h"
|
||||
#include "php_globals.h"
|
||||
#include "main.h"
|
||||
#include "fopen-wrappers.h"
|
||||
#include "ext/standard/php3_standard.h"
|
||||
#include "snprintf.h"
|
||||
#if WIN32|WINNT
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include "win32/syslog.h"
|
||||
#include "win32/php_registry.h"
|
||||
#else
|
||||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
#include "zend_compile.h"
|
||||
#include "zend_execute.h"
|
||||
#include "zend_highlight.h"
|
||||
#include "zend_indent.h"
|
||||
|
||||
|
||||
#if USE_SAPI
|
||||
#include "serverapi/sapi.h"
|
||||
void *gLock;
|
||||
#ifndef THREAD_SAFE
|
||||
struct sapi_request_info *sapi_rqst;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MSVC5 || !defined(HAVE_GETOPT)
|
||||
#include "php_getopt.h"
|
||||
#endif
|
||||
|
||||
PHPAPI extern char *php3_ini_path;
|
||||
|
||||
#define PHP_MODE_STANDARD 1
|
||||
#define PHP_MODE_HIGHLIGHT 2
|
||||
#define PHP_MODE_INDENT 3
|
||||
|
||||
PHPAPI extern char *optarg;
|
||||
PHPAPI extern int optind;
|
||||
|
||||
|
||||
static int zend_cgibin_ub_write(const char *str, uint str_length)
|
||||
{
|
||||
return fwrite(str, 1, str_length, stdout);
|
||||
}
|
||||
|
||||
|
||||
static void sapi_cgi_send_header(sapi_header_struct *sapi_header, void *server_context)
|
||||
{
|
||||
if (sapi_header) {
|
||||
PHPWRITE_H(sapi_header->header, sapi_header->header_len);
|
||||
}
|
||||
PHPWRITE_H("\r\n", 2);
|
||||
}
|
||||
|
||||
|
||||
static int sapi_cgi_read_post(char *buffer, uint count_bytes SLS_DC)
|
||||
{
|
||||
uint read_bytes=0, tmp_read_bytes;
|
||||
|
||||
count_bytes = MIN(count_bytes, SG(request_info).content_length-SG(read_post_bytes));
|
||||
while (read_bytes < count_bytes) {
|
||||
tmp_read_bytes = read(0, buffer+read_bytes, count_bytes-read_bytes);
|
||||
if (tmp_read_bytes<=0) {
|
||||
break;
|
||||
}
|
||||
read_bytes += tmp_read_bytes;
|
||||
}
|
||||
return read_bytes;
|
||||
}
|
||||
|
||||
|
||||
static char *sapi_cgi_read_cookies(SLS_D)
|
||||
{
|
||||
return getenv("HTTP_COOKIE");
|
||||
}
|
||||
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
"PHP Language", /* name */
|
||||
|
||||
php_module_startup, /* startup */
|
||||
php_module_shutdown_wrapper, /* shutdown */
|
||||
|
||||
zend_cgibin_ub_write, /* unbuffered write */
|
||||
|
||||
php_error, /* error handler */
|
||||
|
||||
NULL, /* header handler */
|
||||
NULL, /* send headers handler */
|
||||
sapi_cgi_send_header, /* send header handler */
|
||||
|
||||
sapi_cgi_read_post, /* read POST data */
|
||||
sapi_cgi_read_cookies, /* read Cookies */
|
||||
|
||||
STANDARD_SAPI_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
|
||||
static void php_cgi_usage(char *argv0)
|
||||
{
|
||||
char *prog;
|
||||
|
||||
prog = strrchr(argv0, '/');
|
||||
if (prog) {
|
||||
prog++;
|
||||
} else {
|
||||
prog = "php";
|
||||
}
|
||||
|
||||
php_printf("Usage: %s [-q] [-h]"
|
||||
" [-s]"
|
||||
" [-v] [-i] [-f <file>] | "
|
||||
"{<file> [args...]}\n"
|
||||
" -q Quiet-mode. Suppress HTTP Header output.\n"
|
||||
" -s Display colour syntax highlighted source.\n"
|
||||
" -f<file> Parse <file>. Implies `-q'\n"
|
||||
" -v Version number\n"
|
||||
" -c<path> Look for php.ini file in this directory\n"
|
||||
#if SUPPORT_INTERACTIVE
|
||||
" -a Run interactively\n"
|
||||
#endif
|
||||
" -d foo[=bar] Define INI entry foo with value 'bar'\n"
|
||||
" -e Generate extended information for debugger/profiler\n"
|
||||
" -i PHP information\n"
|
||||
" -h This help\n", prog);
|
||||
}
|
||||
|
||||
|
||||
static void init_request_info(SLS_D)
|
||||
{
|
||||
char *content_length = getenv("CONTENT_LENGTH");
|
||||
|
||||
SG(request_info).request_method = getenv("REQUEST_METHOD");
|
||||
SG(request_info).query_string = getenv("QUERY_STRING");
|
||||
SG(request_info).request_uri = getenv("PATH_INFO");
|
||||
SG(request_info).path_translated = NULL; /* we have to update it later, when we have that information */
|
||||
SG(request_info).content_type = getenv("CONTENT_TYPE");
|
||||
SG(request_info).content_length = (content_length?atoi(content_length):0);
|
||||
|
||||
/* CGI does not support HTTP authentication */
|
||||
SG(request_info).auth_user = NULL;
|
||||
SG(request_info).auth_password = NULL;
|
||||
}
|
||||
|
||||
|
||||
void define_command_line_ini_entry(char *arg)
|
||||
{
|
||||
char *name, *value;
|
||||
|
||||
name = arg;
|
||||
value = strchr(arg, '=');
|
||||
if (value) {
|
||||
*value = 0;
|
||||
value++;
|
||||
} else {
|
||||
value = "1";
|
||||
}
|
||||
php_alter_ini_entry(name, strlen(name), value, strlen(value), PHP_INI_SYSTEM);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int cgi = 0, c, i, len;
|
||||
zend_file_handle file_handle;
|
||||
char *s;
|
||||
/* temporary locals */
|
||||
int cgi_started=0;
|
||||
int behavior=PHP_MODE_STANDARD;
|
||||
int no_headers=0;
|
||||
#if SUPPORT_INTERACTIVE
|
||||
int interactive=0;
|
||||
#endif
|
||||
/* end of temporary locals */
|
||||
#ifdef ZTS
|
||||
zend_compiler_globals *compiler_globals;
|
||||
zend_executor_globals *executor_globals;
|
||||
php_core_globals *core_globals;
|
||||
sapi_globals_struct *sapi_globals;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef ZTS
|
||||
if (setjmp(EG(bailout))!=0) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_startup(1,1,0);
|
||||
#endif
|
||||
|
||||
sapi_startup(&sapi_module);
|
||||
|
||||
#if WIN32|WINNT
|
||||
_fmode = _O_BINARY; /*sets default for file streams to binary */
|
||||
setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */
|
||||
setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */
|
||||
setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
|
||||
#endif
|
||||
|
||||
|
||||
/* Make sure we detect we are a cgi - a bit redundancy here,
|
||||
but the default case is that we have to check only the first one. */
|
||||
if (getenv("SERVER_SOFTWARE")
|
||||
|| getenv("SERVER_NAME")
|
||||
|| getenv("GATEWAY_INTERFACE")
|
||||
|| getenv("REQUEST_METHOD")) {
|
||||
cgi = 1;
|
||||
if (argc > 1)
|
||||
request_info.php_argv0 = strdup(argv[1]);
|
||||
else request_info.php_argv0 = NULL;
|
||||
#if FORCE_CGI_REDIRECT
|
||||
if (!getenv("REDIRECT_STATUS")) {
|
||||
PUTS("<b>Security Alert!</b> PHP CGI cannot be accessed directly.\n\
|
||||
\n\
|
||||
<P>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\
|
||||
means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\
|
||||
set. This variable is set, for example, by Apache's Action directive redirect.\n\
|
||||
<P>You may disable this restriction by recompiling the PHP binary with the\n\
|
||||
--disable-force-cgi-redirect switch. If you do this and you have your PHP CGI\n\
|
||||
binary accessible somewhere in your web tree, people will be able to circumvent\n\
|
||||
.htaccess security by loading files through the PHP parser. A good way around\n\
|
||||
this is to define doc_root in your php.ini file to something other than your\n\
|
||||
top-level DOCUMENT_ROOT. This way you can separate the part of your web space\n\n\
|
||||
which uses PHP from the normal part using .htaccess security. If you do not have\n\
|
||||
any .htaccess restrictions anywhere on your site you can leave doc_root undefined.\n\
|
||||
\n");
|
||||
|
||||
/* remove that detailed explanation some time */
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
#endif /* FORCE_CGI_REDIRECT */
|
||||
}
|
||||
|
||||
if (php_module_startup(&sapi_module)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
#ifdef ZTS
|
||||
compiler_globals = ts_resource(compiler_globals_id);
|
||||
executor_globals = ts_resource(executor_globals_id);
|
||||
core_globals = ts_resource(core_globals_id);
|
||||
sapi_globals = ts_resource(sapi_globals_id);
|
||||
if (setjmp(EG(bailout))!=0) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
SG(request_info).path_translated = NULL;
|
||||
init_request_info(SLS_C);
|
||||
SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */
|
||||
CG(extended_info) = 0;
|
||||
|
||||
if (!cgi) { /* never execute the arguments if you are a CGI */
|
||||
request_info.php_argv0 = NULL;
|
||||
while ((c = getopt(argc, argv, "c:d:qvisnaeh?vf:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
if (!cgi_started){
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
}
|
||||
cgi_started=1;
|
||||
SG(request_info).path_translated = estrdup(optarg);
|
||||
/* break missing intentionally */
|
||||
case 'q':
|
||||
no_headers = 1;
|
||||
break;
|
||||
case 'v':
|
||||
if (!cgi_started) {
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
}
|
||||
php_printf("%s\n", PHP_VERSION);
|
||||
exit(1);
|
||||
break;
|
||||
case 'i':
|
||||
if (!cgi_started) {
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
}
|
||||
cgi_started=1;
|
||||
php_print_info(0xFFFFFFFF);
|
||||
exit(1);
|
||||
break;
|
||||
case 's':
|
||||
behavior=PHP_MODE_HIGHLIGHT;
|
||||
break;
|
||||
case 'n':
|
||||
behavior=PHP_MODE_INDENT;
|
||||
break;
|
||||
case 'c':
|
||||
php3_ini_path = strdup(optarg); /* intentional leak */
|
||||
break;
|
||||
case 'a':
|
||||
#if SUPPORT_INTERACTIVE
|
||||
printf("Interactive mode enabled\n\n");
|
||||
interactive=1;
|
||||
#else
|
||||
printf("Interactive mode not supported!\n\n");
|
||||
#endif
|
||||
break;
|
||||
case 'e':
|
||||
CG(extended_info) = 1;
|
||||
break;
|
||||
case 'h':
|
||||
case '?':
|
||||
php_output_startup();
|
||||
SG(headers_sent) = 1;
|
||||
php_cgi_usage(argv[0]);
|
||||
exit(1);
|
||||
break;
|
||||
case 'd':
|
||||
define_command_line_ini_entry(optarg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* not cgi */
|
||||
|
||||
#if SUPPORT_INTERACTIVE
|
||||
EG(interactive) = interactive;
|
||||
#endif
|
||||
|
||||
if (!cgi_started) {
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
}
|
||||
file_handle.filename = "-";
|
||||
file_handle.type = ZEND_HANDLE_FP;
|
||||
file_handle.handle.fp = stdin;
|
||||
|
||||
|
||||
if (!cgi) {
|
||||
if (!SG(request_info).query_string) {
|
||||
for (i = optind, len = 0; i < argc; i++)
|
||||
len += strlen(argv[i]) + 1;
|
||||
|
||||
s = malloc(len + 1); /* leak - but only for command line version, so ok */
|
||||
*s = '\0'; /* we are pretending it came from the environment */
|
||||
for (i = optind, len = 0; i < argc; i++) {
|
||||
strcat(s, argv[i]);
|
||||
if (i < (argc - 1))
|
||||
strcat(s, "+");
|
||||
}
|
||||
SG(request_info).query_string = s;
|
||||
}
|
||||
if (!SG(request_info).path_translated && argc > optind)
|
||||
SG(request_info).path_translated = argv[optind];
|
||||
}
|
||||
/* If for some reason the CGI interface is not setting the
|
||||
PATH_TRANSLATED correctly, SG(request_info).path_translated is NULL.
|
||||
We still call php3_fopen_for_parser, because if you set doc_root
|
||||
or user_dir configuration directives, PATH_INFO is used to construct
|
||||
the filename as a side effect of php3_fopen_for_parser.
|
||||
*/
|
||||
if(cgi) {
|
||||
SG(request_info).path_translated = getenv("PATH_TRANSLATED");
|
||||
}
|
||||
if (cgi || SG(request_info).path_translated) {
|
||||
file_handle.handle.fp = php3_fopen_for_parser();
|
||||
file_handle.filename = SG(request_info).path_translated;
|
||||
}
|
||||
|
||||
if (cgi && !file_handle.handle.fp) {
|
||||
PUTS("No input file specified.\n");
|
||||
#if 0 /* this is here for debuging under windows */
|
||||
if (argc) {
|
||||
i = 0;
|
||||
php_printf("\nargc %d\n",argc);
|
||||
while (i <= argc) {
|
||||
php_printf("%s\n",argv[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
php_request_shutdown((void *) 0);
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
} else if (file_handle.handle.fp && file_handle.handle.fp!=stdin) {
|
||||
/* #!php support */
|
||||
c = fgetc(file_handle.handle.fp);
|
||||
if (c == '#') {
|
||||
while (c != 10 && c != 13) {
|
||||
c = fgetc(file_handle.handle.fp); /* skip to end of line */
|
||||
}
|
||||
CG(zend_lineno)++;
|
||||
} else {
|
||||
rewind(file_handle.handle.fp);
|
||||
}
|
||||
}
|
||||
|
||||
switch (behavior) {
|
||||
case PHP_MODE_STANDARD:
|
||||
php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
|
||||
break;
|
||||
case PHP_MODE_HIGHLIGHT: {
|
||||
zend_syntax_highlighter_ini syntax_highlighter_ini;
|
||||
|
||||
if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
|
||||
php_get_highlight_struct(&syntax_highlighter_ini);
|
||||
zend_highlight(&syntax_highlighter_ini);
|
||||
fclose(file_handle.handle.fp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case PHP_MODE_INDENT:
|
||||
open_file_for_scanning(&file_handle CLS_CC);
|
||||
zend_indent();
|
||||
fclose(file_handle.handle.fp);
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
php3_header(); /* Make sure headers have been sent */
|
||||
php_request_shutdown((void *) 0);
|
||||
php_module_shutdown();
|
||||
#ifdef ZTS
|
||||
tsrm_shutdown();
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
Vendored
-1325
File diff suppressed because it is too large.
Load diff
Vendored
-1443
File diff suppressed because it is too large.
Load diff
-1251
File diff suppressed because it is too large.
Load diff
+1100
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,204 @@
|
||||
# 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
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
# 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
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
# 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
|
||||
|
||||
@@ -0,0 +1,421 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* 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
|
||||
@@ -0,0 +1,10 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS = @EXT_SUBDIRS@
|
||||
EXT_STATIC = @EXT_STATIC@
|
||||
|
||||
noinst_LIBRARIES=libphpext.a
|
||||
|
||||
libphpext.a: @EXT_LIBS@
|
||||
top_srcdir=$(top_srcdir) $(top_builddir)/scripts/mkextlib $@ $(EXT_STATIC)
|
||||
@test "`uname -s`" = "Rhapsody" && $(RANLIB) $@ || exit 0
|
||||
@@ -0,0 +1,6 @@
|
||||
# $Id$
|
||||
|
||||
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
|
||||
noinst_LIBRARIES=libphpext_apache.a
|
||||
libphpext_apache_a_SOURCES=apache.c
|
||||
|
||||
@@ -0,0 +1,449 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| 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 <rasmus@lerdorf.on.ca> |
|
||||
| Stig Sæther Bakken <ssb@guardian.no> |
|
||||
| David Sklar <sklar@student.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
#include "php.h"
|
||||
#include "ext/standard/head.h"
|
||||
#include "php_globals.h"
|
||||
#include "php_ini.h"
|
||||
#include "SAPI.h"
|
||||
#include "mod_php4.h"
|
||||
#include "ext/standard/info.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if APACHE
|
||||
#include "http_request.h"
|
||||
#include "build-defs.h"
|
||||
|
||||
#define SECTION(name) PUTS("<hr><h2>" name "</h2>\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("<table border=5 width=\"600\">\n");
|
||||
php_info_print_table_header(2, "Entry", "Value");
|
||||
#if WIN32|WINNT
|
||||
PUTS("Apache for Windows 95/NT<br>");
|
||||
#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<br>keep alive: %s<br>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<br>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("<tr><td valign=\"top\" bgcolor=\"" PHP_ENTRY_NAME_COLOR "\">Loaded modules</td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">");
|
||||
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("</td></tr>\n");
|
||||
PUTS("</table>\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("<table border=5 width=\"600\">\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("</table>\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("<table border=5 width=\"600\">\n");
|
||||
PUTS(" <tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Request Headers</th></tr>\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(" <tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Response Headers</th></tr>\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("</table>\n\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* This function is equivalent to <!--#include virtual...-->
|
||||
* 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 <?Include>. 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 <code><?include \"%s\"></code> 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:
|
||||
*/
|
||||
@@ -0,0 +1,5 @@
|
||||
dnl $Id$
|
||||
|
||||
if test -n "$APACHE_INCLUDE"; then
|
||||
PHP_EXTENSION(apache)
|
||||
fi
|
||||
@@ -1,2 +0,0 @@
|
||||
aspell
|
||||
Rasmus Lerdorf
|
||||
@@ -0,0 +1,6 @@
|
||||
# $Id$
|
||||
|
||||
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
|
||||
noinst_LIBRARIES=libphpext_aspell.a
|
||||
libphpext_aspell_a_SOURCES=aspell.c
|
||||
|
||||
+66
-90
@@ -1,30 +1,25 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 The PHP Group |
|
||||
| Copyright (c) 1997, 1998, 1999 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| 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_02.txt. |
|
||||
| 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: Rasmus Lerdorf <rasmus@php.net> |
|
||||
| Authors: |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
|
||||
#ifdef COMPILE_DL_ASPELL
|
||||
#if defined(COMPILE_DL)
|
||||
#include "phpdl.h"
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
@@ -33,12 +28,14 @@
|
||||
|
||||
#if HAVE_ASPELL
|
||||
|
||||
#include "php_aspell.h"
|
||||
#include "php3_aspell.h"
|
||||
#if APACHE
|
||||
# ifndef DEBUG
|
||||
# undef palloc
|
||||
# endif
|
||||
#endif
|
||||
#include <aspell-c.h>
|
||||
#include "ext/standard/info.h"
|
||||
|
||||
/* {{{ aspell_functions[]
|
||||
*/
|
||||
function_entry aspell_functions[] = {
|
||||
PHP_FE(aspell_new, NULL)
|
||||
PHP_FE(aspell_check, NULL)
|
||||
@@ -46,87 +43,79 @@ function_entry aspell_functions[] = {
|
||||
PHP_FE(aspell_suggest, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
static int le_aspell;
|
||||
|
||||
zend_module_entry aspell_module_entry = {
|
||||
STANDARD_MODULE_HEADER,
|
||||
"aspell", aspell_functions, PHP_MINIT(aspell), NULL, NULL, NULL, PHP_MINFO(aspell), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES
|
||||
php3_module_entry aspell_module_entry = {
|
||||
"Aspell", aspell_functions, PHP_MINIT(aspell), NULL, NULL, NULL, PHP_MINFO(aspell), STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
#ifdef COMPILE_DL_ASPELL
|
||||
ZEND_GET_MODULE(aspell)
|
||||
|
||||
#if COMPILE_DL
|
||||
DLEXPORT php3_module_entry *get_module(void) { return &aspell_module_entry; }
|
||||
#endif
|
||||
|
||||
/* {{{ php_aspell_close
|
||||
*/
|
||||
static void php_aspell_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
aspell *sc = (aspell *)rsrc->ptr;
|
||||
|
||||
aspell_free(sc);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MINIT_FUNCTION
|
||||
*/
|
||||
PHP_MINIT_FUNCTION(aspell)
|
||||
{
|
||||
le_aspell = zend_register_list_destructors_ex(php_aspell_close, NULL, "aspell", module_number);
|
||||
le_aspell = register_list_destructors(php3_aspell_close,NULL);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int aspell_new(string master [, string personal])
|
||||
}
|
||||
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;
|
||||
pval *master, *personal;
|
||||
int argc;
|
||||
aspell *sc;
|
||||
int ind;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &master, &personal) == FAILURE) {
|
||||
argc = ARG_COUNT(ht);
|
||||
if (argc < 1 || argc > 2 || getParameters(ht, argc, &master,&personal) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string_ex(master);
|
||||
convert_to_string(master);
|
||||
if(argc==2)
|
||||
{
|
||||
convert_to_string_ex(personal) ;
|
||||
sc=aspell_new(Z_STRVAL_PP(master), Z_STRVAL_PP(personal));
|
||||
convert_to_string(personal) ;
|
||||
sc=aspell_new(master->value.str.val,personal->value.str.val);
|
||||
}
|
||||
else
|
||||
sc=aspell_new(Z_STRVAL_PP(master), "");
|
||||
sc=aspell_new(master->value.str.val,"");
|
||||
|
||||
ind = zend_list_insert(sc, le_aspell);
|
||||
ind = php3_list_insert(sc, le_aspell);
|
||||
RETURN_LONG(ind);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array aspell_suggest(aspell int, string word)
|
||||
|
||||
/* {{{ proto array aspell_suggest(aspell int,string word)
|
||||
Return array of Suggestions */
|
||||
PHP_FUNCTION(aspell_suggest)
|
||||
{
|
||||
pval **scin, **word;
|
||||
pval *scin, *word;
|
||||
int argc;
|
||||
aspell *sc;
|
||||
int ind, type;
|
||||
int ind,type;
|
||||
aspellSuggestions *sug;
|
||||
size_t i;
|
||||
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (argc != 2 || zend_get_parameters_ex(argc, &scin, &word) == FAILURE) {
|
||||
argc = ARG_COUNT(ht);
|
||||
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scin);
|
||||
convert_to_string_ex(word);
|
||||
sc = (aspell *)zend_list_find(Z_LVAL_PP(scin), &type);
|
||||
convert_to_long(scin);
|
||||
convert_to_string(word);
|
||||
sc= (aspell *) php3_list_find(scin->value.lval, &type);
|
||||
if(!sc)
|
||||
{
|
||||
php_error(E_WARNING, "%s(): %d is not an ASPELL result index", get_active_function_name(TSRMLS_C), Z_LVAL_PP(scin));
|
||||
php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -134,36 +123,36 @@ PHP_FUNCTION(aspell_suggest)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
sug = aspell_suggest(sc, Z_STRVAL_PP(word));
|
||||
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);
|
||||
add_next_index_string(return_value,(char *)sug->data[i],1);
|
||||
}
|
||||
aspell_free_suggestions(sug);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int aspell_check(aspell int, string word)
|
||||
/* {{{ proto int aspell_check(aspell int,string word)
|
||||
Return if word is valid */
|
||||
PHP_FUNCTION(aspell_check)
|
||||
{
|
||||
int type;
|
||||
pval **scin, **word;
|
||||
pval *scin,*word;
|
||||
aspell *sc;
|
||||
|
||||
int argc;
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (argc != 2 || zend_get_parameters_ex(argc, &scin, &word) == FAILURE) {
|
||||
argc = ARG_COUNT(ht);
|
||||
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scin);
|
||||
convert_to_string_ex(word);
|
||||
sc= (aspell *) zend_list_find(Z_LVAL_PP(scin), &type);
|
||||
convert_to_long(scin);
|
||||
convert_to_string(word);
|
||||
sc= (aspell *) php3_list_find(scin->value.lval, &type);
|
||||
if(!sc)
|
||||
{
|
||||
php_error(E_WARNING, "%s(): %d is not an ASPELL result index", get_active_function_name(TSRMLS_C), Z_LVAL_PP(scin));
|
||||
php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (aspell_check(sc, Z_STRVAL_PP(word)))
|
||||
if (aspell_check(sc, word->value.str.val))
|
||||
{
|
||||
RETURN_TRUE;
|
||||
}
|
||||
@@ -174,28 +163,28 @@ PHP_FUNCTION(aspell_check)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int aspell_check_raw(aspell int, string word)
|
||||
Return if word is valid, ignoring case or trying to trim it in any way */
|
||||
/* {{{ 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;
|
||||
pval *scin,*word;
|
||||
int type;
|
||||
int argc;
|
||||
aspell *sc;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (argc != 2 || zend_get_parameters_ex(argc, &scin, &word) == FAILURE) {
|
||||
argc = ARG_COUNT(ht);
|
||||
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scin);
|
||||
convert_to_string_ex(word);
|
||||
sc = (aspell *)zend_list_find(Z_LVAL_PP(scin), &type);
|
||||
convert_to_long(scin);
|
||||
convert_to_string(word);
|
||||
sc= (aspell *) php3_list_find(scin->value.lval, &type);
|
||||
if(!sc)
|
||||
{
|
||||
php_error(E_WARNING, "%s(): %d is not an ASPELL result index", get_active_function_name(TSRMLS_C), Z_LVAL_PP(scin));
|
||||
php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (aspell_check_raw(sc, Z_STRVAL_PP(word)))
|
||||
if (aspell_check_raw(sc, word->value.str.val))
|
||||
{
|
||||
RETURN_TRUE;
|
||||
}
|
||||
@@ -206,23 +195,10 @@ PHP_FUNCTION(aspell_check_raw)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MINFO_FUNCTION
|
||||
*/
|
||||
PHP_MINFO_FUNCTION(aspell)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "ASpell Support", "enabled");
|
||||
php_info_print_table_end();
|
||||
php_printf("ASpell support enabled");
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
@@ -0,0 +1,4 @@
|
||||
/* Define if you want the ASPELL interface */
|
||||
#ifndef HAVE_ASPELL
|
||||
#define HAVE_ASPELL 0
|
||||
#endif
|
||||
@@ -1,6 +1,4 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
AC_MSG_CHECKING(for ASPELL support)
|
||||
AC_ARG_WITH(aspell,
|
||||
@@ -13,17 +11,17 @@ AC_ARG_WITH(aspell,
|
||||
ASPELL_DIR=$withval
|
||||
fi
|
||||
|
||||
PHP_ADD_INCLUDE($ASPELL_DIR/include)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(aspell, $ASPELL_DIR/lib)
|
||||
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,1,[Whether you have aspell])
|
||||
AC_DEFINE(HAVE_ASPELL)
|
||||
AC_MSG_RESULT(yes)
|
||||
PHP_NEW_EXTENSION(aspell, aspell.c)
|
||||
PHP_EXTENSION(aspell)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR(no)
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| 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 <rasmus@lerdorf.on.ca> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/* $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 */
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Rasmus Lerdorf <rasmus@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef PHP_ASPELL_H
|
||||
#define PHP_ASPELL_H
|
||||
#if HAVE_ASPELL
|
||||
extern zend_module_entry aspell_module_entry;
|
||||
#define aspell_module_ptr &aspell_module_entry
|
||||
|
||||
PHP_MINIT_FUNCTION(aspell);
|
||||
PHP_MINFO_FUNCTION(aspell);
|
||||
|
||||
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 /* PHP_ASPELL_H */
|
||||
@@ -1,2 +0,0 @@
|
||||
BC Math
|
||||
Andi Gutmans
|
||||
@@ -0,0 +1,5 @@
|
||||
# $Id$
|
||||
|
||||
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
|
||||
noinst_LIBRARIES=libphpext_bcmath.a
|
||||
libphpext_bcmath_a_SOURCES=bcmath.c number.c
|
||||
+173
-226
@@ -1,34 +1,27 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2002 The PHP Group |
|
||||
| Copyright (c) 1997, 1998, 1999 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| 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_02.txt. |
|
||||
| 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: Andi Gutmans <andi@zend.com> |
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
*/
|
||||
|
||||
#include "php.h"
|
||||
|
||||
#if WITH_BCMATH
|
||||
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_bcmath.h"
|
||||
#include "ext/bcmath/libbcmath/src/bcmath.h"
|
||||
#include "number.h"
|
||||
#include "php3_bcmath.h"
|
||||
|
||||
function_entry bcmath_functions[] = {
|
||||
PHP_FE(bcadd, NULL)
|
||||
@@ -43,159 +36,115 @@ function_entry bcmath_functions[] = {
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
zend_module_entry bcmath_module_entry = {
|
||||
STANDARD_MODULE_HEADER,
|
||||
"bcmath",
|
||||
bcmath_functions,
|
||||
NULL,
|
||||
NULL,
|
||||
PHP_RINIT(bcmath),
|
||||
PHP_RSHUTDOWN(bcmath),
|
||||
PHP_MINFO(bcmath),
|
||||
NO_VERSION_YET,
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
php3_module_entry bcmath_module_entry = {
|
||||
"bcmath", bcmath_functions, NULL, NULL, PHP_RINIT(bcmath), PHP_RSHUTDOWN(bcmath), NULL, STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
#ifdef COMPILE_DL_BCMATH
|
||||
ZEND_GET_MODULE(bcmath)
|
||||
#if COMPILE_DL
|
||||
php3_module_entry *get_module() { return &bcmath_module_entry; };
|
||||
#endif
|
||||
|
||||
#ifndef THREAD_SAFE
|
||||
static long bc_precision;
|
||||
#endif
|
||||
|
||||
/* Storage used for special numbers. */
|
||||
extern bc_num _zero_;
|
||||
extern bc_num _one_;
|
||||
extern bc_num _two_;
|
||||
|
||||
|
||||
/* Make a copy of a number! Just increments the reference count! */
|
||||
bc_num copy_num (bc_num num)
|
||||
PHP_RINIT_FUNCTION(bcmath)
|
||||
{
|
||||
num->n_refs++;
|
||||
return num;
|
||||
init_numbers();
|
||||
if (cfg_get_long("bcmath.scale",&bc_precision)==FAILURE) {
|
||||
bc_precision=0;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize a number NUM by making it a copy of zero. */
|
||||
void init_num (bc_num *num)
|
||||
{
|
||||
*num = copy_num (_zero_);
|
||||
}
|
||||
|
||||
|
||||
PHP_RSHUTDOWN_FUNCTION(bcmath)
|
||||
{
|
||||
bc_free_num(&_zero_);
|
||||
bc_free_num(&_one_);
|
||||
bc_free_num(&_two_);
|
||||
|
||||
destruct_numbers();
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
PHP_RINIT_FUNCTION(bcmath)
|
||||
{
|
||||
if (cfg_get_long("bcmath.scale", &bc_precision)==FAILURE) {
|
||||
bc_precision=0;
|
||||
}
|
||||
|
||||
bc_init_numbers();
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
PHP_MINFO_FUNCTION(bcmath)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "BCMath support", "enabled");
|
||||
php_info_print_table_end();
|
||||
}
|
||||
|
||||
/* {{{ 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;
|
||||
pval *left, *right,*scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
|
||||
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), scale);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), scale);
|
||||
bc_add (first, second, &result, scale);
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
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 */
|
||||
Returns the difference between two arbitrary precision numbers (subtration) */
|
||||
PHP_FUNCTION(bcsub)
|
||||
{
|
||||
pval **left, **right, **scale_param;
|
||||
pval *left, *right,*scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
|
||||
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), scale);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), scale);
|
||||
bc_sub (first, second, &result, scale);
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
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;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -204,41 +153,41 @@ PHP_FUNCTION(bcsub)
|
||||
Returns the multiplication of two arbitrary precision numbers */
|
||||
PHP_FUNCTION(bcmul)
|
||||
{
|
||||
pval **left, **right, **scale_param;
|
||||
pval *left, *right,*scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
|
||||
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), scale);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), scale);
|
||||
bc_multiply (first, second, &result, scale);
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
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;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -247,47 +196,47 @@ PHP_FUNCTION(bcmul)
|
||||
Returns the quotient of two arbitrary precision numbers (division) */
|
||||
PHP_FUNCTION(bcdiv)
|
||||
{
|
||||
pval **left, **right, **scale_param;
|
||||
pval *left, *right,*scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
|
||||
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), scale);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), scale);
|
||||
switch (bc_divide (first, second, &result, scale)) {
|
||||
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 */
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
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, "%s(): Division by zero", get_active_function_name(TSRMLS_C));
|
||||
php_error(E_WARNING,"Division by zero");
|
||||
break;
|
||||
}
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
free_num(&first);
|
||||
free_num(&second);
|
||||
free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -296,12 +245,12 @@ PHP_FUNCTION(bcdiv)
|
||||
Returns the modulus of the two arbitrary precision operands */
|
||||
PHP_FUNCTION(bcmod)
|
||||
{
|
||||
pval **left, **right;
|
||||
pval *left, *right;
|
||||
bc_num first, second, result;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
@@ -309,26 +258,26 @@ PHP_FUNCTION(bcmod)
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), 0);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), 0);
|
||||
switch (bc_modulo(first, second, &result, 0)) {
|
||||
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:
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
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, "%s(): Division by zero", get_active_function_name(TSRMLS_C));
|
||||
php_error(E_WARNING,"Division by zero");
|
||||
break;
|
||||
}
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
free_num(&first);
|
||||
free_num(&second);
|
||||
free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -337,41 +286,41 @@ PHP_FUNCTION(bcmod)
|
||||
Returns the value of an arbitrary precision number raised to the power of another */
|
||||
PHP_FUNCTION(bcpow)
|
||||
{
|
||||
pval **left, **right, **scale_param;
|
||||
pval *left, *right,*scale_param;
|
||||
bc_num first, second, result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
|
||||
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), scale);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), scale);
|
||||
bc_raise (first, second, &result, scale);
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
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;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -380,38 +329,38 @@ PHP_FUNCTION(bcpow)
|
||||
Returns the square root of an arbitray precision number */
|
||||
PHP_FUNCTION(bcsqrt)
|
||||
{
|
||||
pval **left, **scale_param;
|
||||
pval *left,*scale_param;
|
||||
bc_num result;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 1:
|
||||
if (zend_get_parameters_ex(1, &left)== FAILURE) {
|
||||
if (getParameters(ht, 1, &left) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &scale_param) == FAILURE) {
|
||||
if (getParameters(ht, 2, &left, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
convert_to_string_ex(left);
|
||||
bc_init_num(&result);
|
||||
bc_str2num(&result, Z_STRVAL_PP(left), scale);
|
||||
convert_to_string(left);
|
||||
init_num(&result);
|
||||
str2num(&result,left->value.str.val,scale);
|
||||
if (bc_sqrt (&result, scale) != 0) {
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
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, "%s(): Square root of negative number", get_active_function_name(TSRMLS_C));
|
||||
php_error(E_WARNING,"Square root of negative number");
|
||||
}
|
||||
bc_free_num(&result);
|
||||
free_num(&result);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -420,40 +369,40 @@ PHP_FUNCTION(bcsqrt)
|
||||
Compares two arbitrary precision numbers */
|
||||
PHP_FUNCTION(bccomp)
|
||||
{
|
||||
pval **left, **right, **scale_param;
|
||||
pval *left, *right, *scale_param;
|
||||
bc_num first, second;
|
||||
int scale=bc_precision;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
switch (ARG_COUNT(ht)) {
|
||||
case 2:
|
||||
if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
|
||||
if (getParameters(ht, 2, &left, &right) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
|
||||
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(scale_param);
|
||||
scale = (int) Z_LVAL_PP(scale_param);
|
||||
convert_to_long(scale_param);
|
||||
scale = (int) scale_param->value.lval;
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
|
||||
convert_to_string_ex(left);
|
||||
convert_to_string_ex(right);
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
convert_to_string(left);
|
||||
convert_to_string(right);
|
||||
init_num(&first);
|
||||
init_num(&second);
|
||||
|
||||
bc_str2num(&first, Z_STRVAL_PP(left), scale);
|
||||
bc_str2num(&second, Z_STRVAL_PP(right), scale);
|
||||
Z_LVAL_P(return_value) = bc_compare(first, second);
|
||||
Z_TYPE_P(return_value) = IS_LONG;
|
||||
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;
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
free_num(&first);
|
||||
free_num(&second);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -462,14 +411,14 @@ PHP_FUNCTION(bccomp)
|
||||
Sets default scale parameter for all bc math functions */
|
||||
PHP_FUNCTION(bcscale)
|
||||
{
|
||||
pval **new_scale;
|
||||
pval *new_scale;
|
||||
|
||||
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &new_scale)==FAILURE) {
|
||||
if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &new_scale)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_long_ex(new_scale);
|
||||
bc_precision = Z_LVAL_PP(new_scale);
|
||||
convert_to_long(new_scale);
|
||||
bc_precision = new_scale->value.lval;
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -482,6 +431,4 @@ PHP_FUNCTION(bcscale)
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Define if you want to enable bc style precision math support */
|
||||
#define WITH_BCMATH 0
|
||||
+18
-15
@@ -1,17 +1,20 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
PHP_ARG_ENABLE(bcmath, whether to enable bc style precision math functions,
|
||||
[ --enable-bcmath Enable bc style precision math functions.])
|
||||
|
||||
if test "$PHP_BCMATH" != "no"; then
|
||||
AC_DEFINE(WITH_BCMATH, 1, [Whether you have bcmath])
|
||||
PHP_NEW_EXTENSION(bcmath, bcmath.c number.c \
|
||||
libbcmath/src/add.c libbcmath/src/div.c libbcmath/src/init.c libbcmath/src/neg.c libbcmath/src/outofmem.c libbcmath/src/raisemod.c libbcmath/src/rt.c libbcmath/src/sub.c \
|
||||
libbcmath/src/compare.c libbcmath/src/divmod.c libbcmath/src/int2num.c libbcmath/src/num2long.c libbcmath/src/output.c libbcmath/src/recmul.c \
|
||||
libbcmath/src/sqrt.c libbcmath/src/zero.c libbcmath/src/debug.c libbcmath/src/doaddsub.c libbcmath/src/nearzero.c libbcmath/src/num2str.c libbcmath/src/raise.c \
|
||||
libbcmath/src/rmzero.c libbcmath/src/str2num.c,
|
||||
$ext_shared,,-I@ext_srcdir@/libbcmath/src)
|
||||
PHP_ADD_BUILD_DIR($ext_builddir/libbcmath/src)
|
||||
fi
|
||||
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)
|
||||
])
|
||||
@@ -1,3 +0,0 @@
|
||||
Phil Nelson <philnelson@acm.org> wrote bcmath library.
|
||||
|
||||
|
||||
@@ -1,515 +0,0 @@
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations
|
||||
below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
^L
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it
|
||||
becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
^L
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control
|
||||
compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
^L
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
^L
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
^L
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
^L
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply, and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License
|
||||
may add an explicit geographical distribution limitation excluding those
|
||||
countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
^L
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
^L
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms
|
||||
of the ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library.
|
||||
It is safest to attach them to the start of each source file to most
|
||||
effectively convey the exclusion of warranty; and each file should
|
||||
have at least the "copyright" line and a pointer to where the full
|
||||
notice is found.
|
||||
|
||||
|
||||
<one line to give the library's name and a brief idea of what it
|
||||
does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper
|
||||
mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or
|
||||
your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James
|
||||
Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
Loaded 100 of 2105 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user