This commit is contained in:
Zeev Suraski 1999-04-07 21:05:13 +00:00
parent d94f3e22ae
commit aceaabceff
189 changed files with 43488 additions and 0 deletions

11
BUGS Normal file
View file

@ -0,0 +1,11 @@
If you think you've found a bug in PHP3, you can report it on the bug
reporting page at:
http://www.php.net/
Current Known Bugs:
* split() function doesn't return regex errors nicely
* Preprocessed scripts don't work with require() and define()
* unset() doesn't actually erase the variables it just marks them as uninitialized
* Some parts in the language core prevent more than 256 arguments in function
calls from being possible

624
CHANGES Normal file
View file

@ -0,0 +1,624 @@
Noticeable Changes between PHP/FI 2.0 and PHP 3.0
=================================================
This file was designed to be viewed with a tab size of 4 characters.
This file is divided into 4 sections:
1. Downwards incompatible language changes. This section includes all of
the changes in the core language which may require people to modify
their scripts before using them with PHP 3.0. It does NOT list
changes made in the behavior of specific functions.
2. New language features. This section includes all of the new additions
to the core language, that may be used to enhance scripts designed for
PHP 3.0. Likewise, it does not include a listing of new functions.
3. Structural changes not directly effecting the end user. The core
of PHP 3.0 is a complete rewrite. As such, many issues effecting
PHP/FI 2.0 were addressed and vastly improved in this version,
resulting in a much more stable and efficient implementation. This
section lists these changes in design.
4. Other changes that don't fit in any of the above categories.
Please remember that PHP 3.0's core is a complete rewrite, and thus,
there may be other undocumented incompatibilities we haven't thought
of ourselves. If you think you've found a incompatibility (or a new
feature) which is not listed here, please mail us at
php-dev@php.iquest.net.
- Zeev
------------------------------------------------------------------------------
Downwards incompatible language changes
=======================================
[1] The close-PHP tag has changed from > to ?>
This means that instead of writing:
<?echo $title;>
You should write:
<?echo $title;?>
PHP3 also includes support for a longer-form start tag that is
XML-compliant:
<?php echo $title;?>
The ability to use the short start tag ('<?') can be turned on and
off using the short_tags() function. Whether it is enabled or not by
default is a compile-time option (normally set to enabled by default).
[2] Semicolons in if/elseif/else must be replaced with colons.
For example, the equivalent of:
if (expr);
statements
...
elseif (expr);
statements
...
else;
statements
endif;
in PHP 3.0 would be:
if (expr):
statements
...
elseif (expr):
statements
...
else:
statements
endif;
Note that the endif is followed by a semicolon and not a colon even in
PHP 3.0, which marks the end of the entire IF sentence.
Also note that the implementation of the colon-mode and curly-braces
mode in PHP 3.0 is identical, one isn't buggier than the other (note
that I'm not saying they're not buggy, though :)
[3] Semicolons in while loops must also be replaced with colons.
For example, the equivalent of:
while (expr);
statements
...
endwhile;
in PHP 3.0 would be:
while (expr):
statements
...
endwhile;
Note that the endwhile is followed by a semicolon and not a colon even
in PHP 3.0, which marks the end of the WHILE sentence. As with the IF
statement, the implementation of the colon-mode and curly-braces mode
in PHP 3.0 is identical, one isn't buggier than the other.
Also note that failing to change the semicolon to a colon can result in
scripts that get stuck in the while loop because the loop-condition never
changes.
[4] $foo[0] is no longer identical to $foo.
In PHP/FI 2.0, a side-effect of the implementation caused $foo[0] to be
identical to $foo. This is not the case in PHP 3.0.
[5] Expressions determine their types differently.
The way expressions are evaluated has changed radically in PHP 3.0.
Expressions are no longer given the type of the left argument, but are
assigned types taking both types into account, and regardless of which
is on the left side and which is on the right side. On simple scripts
that should probably not effect you, but if you've relied on this fact
(even without realizing you do) it may change the way your scripts work.
Consider the next example:
$a[0]=5;
$a[1]=7;
$key = key($a);
while ("" != $key) {
echo "$key\n";
next($a);
}
In PHP/FI 2.0, this would display both of $a's indices. In PHP 3.0, it
wouldn't display anything. The reason is that in PHP/FI 2.0, because the
left argument's type was string, a string comparison was made, and indeed
"" does not equal "0", and the loop went through. In PHP 3.0, when a
string is compared with an integer, an integer comparison is made (the
string is converted to an integer). This results in comparing atoi("")
which is 0, and $key which is also 0, and since 0==0, the loop doesn't
go through even once. The fix for this is simple, by replacing the
while statement with:
while ("" != stringval($key)) {
This would first convert the integer 0 to a string "0", and then
compare "" and "0", which are not equal, and the loop would go through
as expected. As mentioned later, casting operators are supported in
PHP 3.0 for a quicker and more readable way of changing variables'
types. For example, you could use:
while ("" != (string)$key) {
[6] The structure of error messages has changed.
Although the error messages are usually more accurate, you won't be shown
the actual line of text and actual place in which the error occured.
You'll be supplied with the line number in which the error has occured,
though.
[7] The format string argument to echo is no longer supported.
Use printf(format,arg1,arg2,arg3,...) instead (unlimited arguments).
[8] The use of read-mode $array[] is no longer supported.
That is, you cannot traverse an array by having a loop that does $data =
$array[]. Use current() and next() instead. Also, $array1[] = $array2
does not append the values of $array2 to $array1, but appends $array2
as the last entry of $array1 (see the multidimensional array support).
[9] Apache versions older than 1.2 are not supported anymore.
The apache module requires apache 1.2 or later (1.3-beta is supported).
[10] Indirect references inside quoted strings
PHP2-style indirect reference inside quoted strings is no longer
supported. That is, if $foo="bar", and $bar="abc", in PHP2,
"$$foo" would print out "abc". In PHP3, this would print
"$bar" (the contents of $foo is replaced with "bar").
To use indirect reference in PHP3 inside quoted strings, you should use
the new notation: "${$foo}". The standard $$foo notation will work
outside of the quoted string.
[11]
Some functions have changed names, are missing, or have been deprecated
by other functions
As a whole new rewrite, written by many more people and supporting many
more APIs than it's predecessor, there's a good chance some of the functions
you're used to from PHP/FI 2 aren't available in release 3, or have changed
names. Many functions that do exist behave a bit differently, mainly
because they return different values for errors (false) but also for other
reasons. We can't list all of these functions here, simply because drawing
a full comparison between the function sets of the two versions is way too
much work. If a converted PHP/FI 2 script doesn't work for you, nothing
can replace the good old human eye going over the code, doublechecking
with the online manual that each function still does what you expected it
to do.
[12] Other incompatibilities.
It's not too unlikely that other documented behavior of PHP2 has changed
in this release. If you think you've found an example, please mail
us at php-dev@php.iquest.net. Even if you've found an undocumented
feature of PHP2 that stopped working in PHP3, we'd like to know about it
(although it's more than likely that it will not be supported).
------------------------------------------------------------------------------
New Language Features
=====================
[1] Expressions
PHP 3.0 includes a rich implementation of expressions, much more advanced
than this of 2.0. Just about any complex C-like or perl-like expression
would work. Support was added for assignment operators (+=, -=, *= etc),
pre and post increment/decerement (e.g. $i++, ++$i) and the questionmark
operator ( (expr?expr:expr) ). Every assignment is now an expression
with a value, which means stuff like $a = $b = $c = $d = 0; would work.
It is difficult to describe the power of expressions within a few lines
of text, but if you're familiar with them, you probably get the picture.
[2] for loops are now supported.
for loops were fairly difficult to implement (in fact, we didn't find
any parallel interpreter that supports for loops anywhere (no, perl is
not an interpreter)). The bottom line is that for loops work, and are
around 5% slower than comparable while loops (that may vary), but often
they're much nicer.
The syntax is identical to the one of C:
for (expr; expr; expr) statement;
or
for (expr; expr; expr) { statements ... }
The first expression is executed the first time the loop is encountered,
the loop is run as long as the second expression is evaluated as TRUE,
and after each iteration, the 3rd expression is evaluated.
Colon-mode FOR loops are also supported:
for (expr; expr; expr):
statements
...
endfor;
[3] do..while(expr) loops are now supported.
Like with its C parallel, the statements inside a do..while loop are
run once the first time the loop is encountered, and then as long as
the expression evaluates as true.
For example:
do {
statements;
} while ($i++ < $max);
[4] break and continue statements are now supported inside loops.
You can break out of loops, or continue to the next iteration of the
loop using these statements. A special feature of PHP is the ability
to specify an expression argument to break or continue, which specifies
how many loops you want to break out from or continue to. For example:
for ($i=0; $i<10; $i++) {
for ($j=0; $j<10; $j++) {
if ($j>5)
break;
if ($i>5)
break 2;
}
}
The first break statement would end the inner loop every time $j is
greater than 5. The second break statement would end both the inner
and outer loop when $i is greater than 5.
Note: For this matter, switch statements are considered as loops. So
if you write "break 2;" inside a switch statement, you would be asking
to break out of the switch, and the innermost loop in which is nested.
[5] Switched to C-style declaration of functions.
Here's a pretty useless function which makes a good example:
function concat($str1,$str2)
{
return $str1.$str2;
}
NOTE: The old style function definition is still supported, to
allow easier upgrading from PHP/FI 2.0 scripts. Simply
change 'function' to 'old_function' for these functions.
[6] OOP support
Classes and inheritance are supported to a limited extent in PHP 3.0.
Here's how to declare a simple class:
class simple_class {
var $property1,$property2;
var $property3=5;
function display() {
printf("p1=%d, p2=%d, p3=%d\n",
$this->property1,
$this->property2,
$this->property3);
}
function init($p1,$p2) {
$this->property1 = $p1;
$this->property2 = $p2;
}
};
Here's how to create an object of that class:
$obj = new simple_class;
At this point, $obj is an object with 2 uninitialized variables, 1
initialized variable, and 2 member functions. No protection is made on
the internals of the object, and using its properties is simple:
$obj->property1 = 7;
would assign 7 to $property1 inside $obj. Calling member functions is
also simple:
$obj->display()
would run the display() member function of $obj. Note that the
implementation of display() uses the special variable $this, which is
replaced with the object the function is called on.
Inheritance is pretty simple too:
class complex_class extends simple_class {
var $property4="test";
function display() {
printf("p1=%d, p2=%d, p3=%d, p4=%d\n",
$this->property1,
$this->property2,
$this->property3,
$this->property4);
}
}
Basically, the class complex_class inherits everything from its parent,
simple_class, except properties or member functions which override the
ones in the parent. In this example, since we supply an alternative
display() function, it would be used with complex_class objects instead
of the display() function that was declared in simple_class. On the other
hand, since we don't supply an alternative init() function, complex_class
objects would have the same init() function as simple_class objects do.
As with expressions, it's impossible to teach OOP in a few lines, and
personally I'm unclear as to how useful this would be in day to day
scripting. If you like this, play with this until you figure it out :)
Objects can reside in arrays, and can contain arrays. However,
a limitation of the current implementation doesn't allow an object
to contain an array of objects (actually, this is allowed, but
there's no way to address the properties of such an object directly,
but only indirectly). For example, assuming $a[3] is an object,
$a[3]->b[2] is an object as well, you can't address the properties
of $a[3]->b[2] (i.e. you can't write $a[3]->b[2]->foo = "bar", for
instance).
[7] Function pointers are now supported.
A simple illustrative example:
$func_ptr = "time";
$current_time = $func_ptr();
is identical to
$current_time = time();
[8] Indirect references are much more powerful.
For example, one can use the dollar operator an infinite amount of times:
$a = "b";
$b = "c";
$c = "d";
$d = "e";
$e = "Testing\n";
echo $$$$$a;
Would display $e's content, which is "Testing\n".
In addition, one can use complex expressions to generate variable names
using a perl-like notation:
$i="123";
${"test".$i} = 5;
would assign 5 to $test123.
[9] A string concatenation operator was added, '+' no longer concatenates strings.
A perl-like string concatenation operator was added, the '.' operator.
It converts both of its arguments to strings, and concatenates them.
For example:
$result = "abcd".5;
assigns "abcd5" to result. Note that under PHP 3.0, the '+' operator
no longer performs concatenation if its arguments are strings. Use
the '.' operator instead.
[10] Supports passing function arguments by references instead of by value.
Support for passing function arguments by reference instead of by value
has been added. This doesn't result in having to change the function
implementations in any way, but, when calling the function, you can
decide on whether the variable you supply would actually be changed by
the function, or a copy of it.
Example:
function inc($arg)
{
$arg++;
}
$i=0;
inc($i); # here $i in the outer scope wouldn't change, and remain 0
inc(&$i); # here $i is passed by reference, and would change to 1
[11] Support for multidimensional arrays.
(Or as Andi calls them, 'hyperdimensional variables'.)
The easiest way to define this support of PHP 3.0 is inductive -
arrays can contain any type of variables, including other arrays.
A simple example:
$a[0]=5;
$a[1]["testing"]=17;
$b["foo"]=$a;
Ok, so it may be not so simple. Play with it, it's pretty powerful.
[12] Array initialization is now supported.
For example, let's say you want to initialize a lookup table to convert
number to month names:
$months = array("January", "February", "March",
"April", "May", "June", "July", "August",
"September", "October", "November", "December");
would assign $months[0] to be January, $months[1] to be February, etc.
Alternately, you may want the count to start at '1' instead of 0.
You can do so easily:
$months = array(1=>"January", "February", "March",
"April", "May", "June", "July", "August",
"September", "October", "November", "December");
Also, you can specify an index for every entry, not just the first one:
$first_names = array("Doe"=>"John", "Gates"=>"William",
"Clinton"=>"Bill" });
would assign $first_names["Doe"]="John", etc.
[13] Perl style lists now supported.
Multiple values from arrays may now be assigned into several
variables using one assignment. For example:
$str = "johndoe:x:555:555:Doe, John:/home/johndoe:/bin/tcsh";
list($username,$passwd,$uid,$gid,$realname,$homedir,$shell) =
explode(":",$str);
Would assign 'johndoe' into $username, 'x' into $passwd, etc.
[14] Colons are supported in 'case' and 'default' statements.
For example:
switch($value) {
case 'A':
statement;
break;
case 'B':
statement;
break;
case 'C':
statement;
/* fall-through */
default:
statement;
}
Semicolons are still supported, but when writing new scripts, they
should be phased out in favour of colons.
------------------------------------------------------------------------------
Non Language Related New Features
=================================
[1] Persistent resource lists.
In plain english this means that there's now an easy way of writing the
SQL drivers so that they don't open and close the SQL link every time,
but instead open it the first time it's required, and then use it on
every later hit. As of PHP 3.0a1, only the MySQL, mSQL and PostgresSQL
drivers have been changed (rewritten) to take advantage of this option.
To use it, use mysql_pconnect() instead of mysql_connect() (or the
equivalents for the two other databases).
[2] Configuration file.
PHP now has its own configuration file, and many compile-time options
of PHP2 are now configurable at runtime.
[3] Syntax Highlighting.
A syntax highlighter has been built into PHP 3.0, which means PHP 3.0 can
display your code, syntax highlighted, instead of executing it.
There are currently two ways to use the syntax highlighter. One is to
use the show_source() statement. This statement is identical to the
include() statement, except instead of executing the file, it displays
its source syntax highlighted.
The second way is possible only when running as an apache module, and is
to define a special extension for PHP 3.0 source files (e.g. .php3s)
and instruct apache to automatically syntax highlight them.
[4] Loadable modules.
This would have a huge impact on the Windows version, and would probably
be used in the UNIX environment as well. One can now add PHP internal
functions in runtime by loading a dynamic module. This is known to work
under Solaris, Linux and Win32 at this time, but would be ported to any
other capable platform if an incompatability is found.
------------------------------------------------------------------------------
Other Interesting Issues
========================
[1] Improved performance.
The performance of PHP 3.0 is much better than the one of PHP/FI 2.0.
Memory consumption has been dramatically reduced in many cases, due
to the use of an internal memory manager, instead of apache's pools.
Speedwise, PHP 3.0 is somewhere between 2 and 3 times faster than
PHP/FI 2.0.
[2] More reliable parser.
After PHP 3.0 is well tested, it'll be pretty safe to say that it's
more reliable than PHP/FI 2.0 is. While PHP/FI 2.0 performed well on
simple, and fairly complex scripts, a fundamental design difference
from PHP 3.0 makes it more prone to errors. In PHP 3.0, obscure parser
problems are much less likely.
[3] Improved C API.
If you're a C coder, adding functionality to PHP was never easier.
A pretty well documented API is available (apidoc.txt), and you no longer
have to touch the parser or scanner code when adding your function.
Also, it's more complicated to 'go wrong' when implementing a PHP3
function than it was in PHP2 (no stack to maintain) - but of course,
you can mess up here too :)
[4] Name change.
PHP/FI 2.0 was renamed to PHP 3.0, and the meaning has changed from
'Personal Home Pages / Forms Interpreter' to 'PHP: Hypertext Preprocessor'.
'Personal' home pages was an understatement for PHP/FI 2.0, and is
definitely an understatement for PHP 3.0.

149
CODING_STANDARDS Normal file
View file

@ -0,0 +1,149 @@
PHP Coding Standards
====================
This file lists several standards that any programmer, adding or changing
code in PHP, should follow. Since this file was added at a very late
stage of the development of PHP v3.0, the code base does not (yet) fully
follow it, but it's going in that general direction.
This is an initial version - it'll most probably grow as time passes.
Code Implementation
-------------------
[1] Functions that are given pointers to resources should not free them
For instance, function int mail(char *to, char *from) should NOT free
to and/or from.
Exceptions:
- The function's designated behavior is freeing that resource. E.g. efree()
- The function is given a boolean argument, that controls whether or not
the function may free its arguments (if true - the function must free its
arguments, if false - it must not)
- Low-level parser routines, that are tightly integrated with the token
cache and the bison code for minimum memory copying overhead.
[2] Functions that are tightly integrated with other functions within the
same module, and rely on each other non-trivial behavior, should be
documented as such and declared 'static'. They should be avoided if
possible.
[3] Use definitions and macros whenever possible, so that constants have
meaningful names and can be easily manipulated. The only exceptions
to this rule are 0 and 1, when used as false and true (respectively).
Any other use of a numeric constant to specify different behavior
or actions should be done through a #define.
[4] When writing functions that deal with strings, be sure to remember
that PHP holds the length property of each string, and that it
shouldn't be calculated with strlen(). Write your functions in a such
a way so that they'll take advantage of the length property, both
for efficiency and in order for them to be binary-safe.
Functions that change strings and obtain their new lengths while
doing so, should return that new length, so it doesn't have to be
recalculated with strlen() (e.g. _php3_addslashes())
[5] Use php3_error() to report any errors/warnings during code execution.
Use descriptive error messages, and try to avoid using identical
error strings for different stages of an error. For example,
if in order to obtain a URL you have to parse the URL, connect,
and retreive the text, assuming something can go wrong at each
of these stages, don't report an error "Unable to get URL"
on all of them, but instead, write something like "Unable
to parse URL", "Unable to connect to URL server" and "Unable
to fetch URL text", respectively.
[6] NEVER USE strncat(). If you're absolutely sure you know what you're doing,
check its man page again, and only then, consider using it, and even then,
try avoiding it.
Naming Conventions
------------------
[1] Function names for user functions implementation should be prefixed with
"php3_", and followed by a word or an underscore-delimited list of words,
in lowercase letters, that describes the function.
[2] Function names used by user functions implementations should be prefixed
with "_php3_", and followed by a word or an underscore-delimited list of
words, in lowercase letters, that describes the function. If applicable,
they should be declared 'static'.
[3] Variable names must be meaningful. One letter variable names must be
avoided, except for places where the variable has no real meaning or
a trivial meaning (e.g. for (i=0; i<100; i++) ...).
[4] Variable names should be in lowercase; Use underscores to seperate
between words.
Syntax and indentation
----------------------
[1] Never use C++ style comments (i.e. // comment). Always use C-style
comments instead. PHP is written in C, and is aimed at compiling
under any ANSI-C compliant compiler. Even though many compilers
accept C++-style comments in C code, you have to ensure that your
code would compile with other compilers as well.
The only exception to this rule is code that is Win32-specific,
because the Win32 port is MS-Visual C++ specific, and this compiler
is known to accept C++-style comments in C code.
[2] Use K&R-style. Of course, we can't and don't want to
force anybody to use a style she's not used to, but
at the very least, when you write code that goes into the core
of PHP or one of its standard modules, please maintain the K&R
style. This applies to just about everything, starting with
indentation and comment styles and up to function decleration
syntax.
[3] Be generous with whitespace and braces. Always prefer
if (foo) {
bar;
}
to
if(foo)bar;
Keep one empty line between the variable decleration section and
the statements in a block, as well as between logical statement
groups in a block. Maintain at least one empty line between
two functions, preferably two.
Documentation and Folding Hooks
-------------------------------
In order to make sure that the online documentation stays in line with
the code, each user-level function should have its user-level function
prototype before it along with a brief one-line description of what the
function does. It would look like this:
/* {{{ proto int abs(int number)
Return the absolute value of the number */
void php3_abs(INTERNAL_FUNCTION_PARAMETERS) {
...
}
/* }}} */
The {{{ symbols are the default folding symbols for the folding mode in
Emacs. vim will soon have support for folding as well. Folding is very
useful when dealing with large files because you can scroll through the
file quickly and just unfold the function you wish to work on. The }}}
at the end of each function marks the end of the fold, and should be on
a separate line.
The "proto" keyword there is just a helper for the doc/genfuncsummary script
which generates a full function summary. Having this keyword in front of the
function prototypes allows us to put folds elsewhere in the code without
messing up the function summary.
Optional arguments are written like this:
/* {{{ proto object imap_header(int stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]])
And yes, please keep everything on a single line, even if that line is massive.

339
COPYING Normal file
View file

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, 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 or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
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 give any other recipients of the Program a copy of this License
along with the Program.
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 Program or any portion
of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
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 Program, 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 Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) 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; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, 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 executable. However, as a
special exception, the source code 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.
If distribution of executable or 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 counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program 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.
5. 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 Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program 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 to
this License.
7. 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 Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program 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 Program.
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.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program 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.
9. The Free Software Foundation may publish revised and/or new versions
of the 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 Program
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 Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, 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
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. 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 program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

176
CREDITS Normal file
View file

@ -0,0 +1,176 @@
PHP Version 3.0 Development Team
------------------------------------------------------------------------------
Core Developers
===============
Rasmus Lerdorf (rasmus@lerdorf.on.ca)
* Original language definition and implementation
* CGI loader and many internal functions
* Apache module support
* SNMP module
* Original mSQL, MySQL and Sybase modules
* Oracle module work
Andi Gutmans (andi@php.net) and Zeev Suraski (zeev@php.net)
* New language definition and implementation
* Internal functions API design
* General hash table implementation for symbol tables, arrays and objects
* Memory manager
* Token cache manager
* A lot of internal functions (including hebrev :) and migration from PHP 2.0
* Syntax highlighting mode
* Configuration file parser
* New persistent/multilink MySQL, PosgresSQL, Sybase and mSQL modules
* Win32 COM support
Stig Bakken (ssb@guardian.no)
* Oracle support
* configure/install script work
* sprintf reimplementation
* XML support
* SGML documentation framework
Shane Caraveo (shane@caraveo.com)
* Porting to Visual C++
* Generalization to support different server APIs
* Work on ISAPI and NSAPI APIs
Jim Winstead (jimw@php.net)
* Lots of PHP2 -> PHP3 porting
* dBase support
* URL parsing functions
* Makefile work
* Regex rewrite
* Win32 work
------------------------------------------------------------------------------
Major Contributors
==================
* Jouni Ahto (jah@cultnet.fi)
Postgres, Informix
* Alex Belits (abelits@phobos.illtel.denver.co.us)
fhttpd support
* Bjørn Borud (borud@guardian.no)
soundex code and lots of enthusiasm
* Christian Cartus (chc@idgruppe.de)
Informix Universal Server support
* John Ellson (ellson@lucent.com)
Freetype support
* Dean Gaudet (dgaudet@arctic.org)
Apache module debugging + helpful hints along the way
* Mitch Golden (mgolden@interport.net)
Oracle testing and bug fixes
* Danny Heijl (Danny.Heijl@cevi.be)
Informix SE support
* Mark Henderson (mark@togglemedia.com)
Various odds and ends
* Jaakko Hyvätti (jaakko@hyvatti.iki.fi)
Prototype cop, regular expression code fixes, CGI security issues
* Amitay Isaacs (amitay@w-o-i.com)
LDAP
* Andreas Karajannis (Andreas.Karajannis@gmd.de)
Adabas D, ODBC, Oracle
* Igor Kovalenko (owl@infomarket.ru)
QNX support issues
* Richard Lynch (lynch@lscorp.com)
Documentation
* Tom May (tom@go2net.com)
Sybase-CT work
* Muhammad A Muquit (MA_Muquit@fccc.ed)
Original Sybase module
* Mark Musone (musone@edgeglobal.com)
IMAP
* Jeroen van der Most (jvdmost@digiface.nl)
Solid
* Chad Robinson (chadr@brttech.com)
Documentation, FilePro
* Lachlan Roche (lr@www.wwi.com.au)
MD5
* Stefan Roehrich (sr@linux.de)
zlib
* Nikolay P. Romanyuk (mag@redcom.ru)
Velocis support
* Brian Schaffner (brian@tool.net)
ODBC support, PHP3 API testing
* Egon Schmid (eschmid@delos.lf.net)
Documentation
* (sopwith@redhat.com)
Solid
* Colin Viebrock (cmv@privateworld.com)
Website graphic design and layout, PHP logo
* Eric Warnke (ericw@albany.edu)
LDAP
* Lars Torben Wilson (torben@netmill.com)
Documentation
* Uwe Steinmann (Uwe.Steinmann@fernuni-hagen.de)
Hyperwave, PDF, Acrobat FDF Toolkit
------------------------------------------------------------------------------
Beta Testers
------------
* Niklas Saers (berenmls@saers.com)
FreeBSD/x86
* Chuck Hagenbuch <chuck@osmos.ml.org>
Linux/x86 glibc2, MySQL, mod_ssl
* Sascha Schumann (sas@schell.de)
FreeBSD/x86, PostgreSQL, IMAP, gdttf
* Jim Jagielski (jim@jagunet.com)
A/UX, FreeBSD/x86
* Jouni Ahto (jah@cultnet.fi)
Debian Linux 2.0
------------------------------------------------------------------------------
Andi Gutmans and Zeev Suraski would like to thank Professor Michael Rodeh for
his positive input during the initial development of the interpreter.

859
ChangeLog Normal file
View file

@ -0,0 +1,859 @@
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 libphp3.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/php3 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

54
EXTENSION_STATUS Normal file
View file

@ -0,0 +1,54 @@
The core of PHP 3.0 is considered to be stable at this time. However, some of
the modules that are bundled with it are still undergoing development, or
contain known bugs. The purpose of this file is to document the status of
each module (extension). Patches to unstable modules will be available through
the CVS, and through periodic maintenance releases.
Stability scale:
Rock solid - We believe it's safe to base a production site on it.
Stable - It should be safe to base a production site on it.
Isn't rated as rock-solid because it contained problems
in the not-so-far past, or doesn't have enough users
to test it to know it's rock solid.
Beta - This module probably contains bugs, sometimes even known
bugs. You can give it a try and there's a good chance
it'll work fine, but it might not be a good idea to base
a production site on it.
Alpha - This module is in initial development steps. Don't trust
it, play with it at your own risk.
Deprecated - This module is only available for downwards compatability,
and will not be supported in any way. The code quality
is usually around the Beta status.
The standard disclaimers apply, that is, if a rock-solid module blows up on
you and ruins your site, nobody in the PHP development team is responsible.
We'll probably try to help, though.
Extension Name Status Comments
-----------------------------------------------------------------------------
DBM Rock Solid That relies on a working DBM library.
The flatfile support is probably not
as stable.
MySQL Rock Solid
mSQL Rock Solid
Sybase DB Stable
Sybase CT Stable
BC Math Rock Solid Arbitary precision math library
Postgres SQL Stable Postgres 6.2 and earlier is stable,
but problems were reported with 6.3
Debugger Beta
Unified ODBC Beta
Solid Deprecated Replaced by Unified ODBC
iODBC Deprecated Replaced by Unified ODBC
Adabas Deprecated Replaced by Unified ODBC
LDAP Stable Lightweight Directory Access Protocol.
dBase
FilePro
Oracle Beta Not tested thoroughly enough.
IMAP Beta Bundled in the dl/ directory
SNMP Stable Very solid, but also very limited.
Only supports GET and WALK requests.
Raima Velocis Beta If use with Unified ODBC, replaced
by Unified ODBC
Raima Velocis Alpha If use without Unified ODBC

538
FUNCTION_LIST.txt Normal file
View file

@ -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

159
INSTALL Normal file
View file

@ -0,0 +1,159 @@
Installation Instructions for PHP3
----------------------------------
For the impatient here is a quick set of steps that will build PHP3
as an Apache module for Apache 1.3.0 with MySQL support. A more verbose
explanation follows.
QUICK INSTALL
gunzip apache_1.3.x.tar.gz
tar xvf apache_1.3.x.tar
gunzip php-3.0.x.tar.gz
tar xvf php-3.0.x.tar
cd apache_1.3.x
./configure --prefix=/www
cd ../php-3.0.x
./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars
make
make install
cd ../apache_1.3.x
./configure --prefix=/www --activate-module=src/modules/php3/libphp3.a
(The above line is correct! Yes, we know libphp3.a does not exist at this
stage. It isn't supposed to. It will be created.)
make
(you should now have an httpd binary which you can copy to your Apache bin dir)
cd ../php-3.0.x
cp php3.ini-dist /usr/local/lib/php3.ini
You can edit /usr/local/lib/php3.ini file to set PHP options.
Edit your httpd.conf or srm.conf file and add:
AddType application/x-httpd-php3 .php3
VERBOSE INSTALL
Installing PHP3 can be done in four simple steps:
1. Unpack your distribution file.
You will have downloaded a file named something like php3xn.tar.gz.
Unzip this file with a command like: gunzip php3xn.tar.gz
Next you have to untar it with: tar -xvf php3xn.tar
This will create a php-3.0.x directory. cd into this new directory.
2. Configure PHP3.
You now have to choose the options you would like. There are quite
a few of them. To see a list, type: ./configure --help
You can also use the supplied 'setup' script, which will ask you
a series of questions and automatically run the configure script
for you.
The only options that you are likely to want to use are the ones in
the last section entitled, "--enable and --with options recognized:"
A popular choice is to build the Apache module version. You need
to know where the source code directory for your Apache server is
located. Then use an option like: --with-apache=/usr/local/src/apache
if that is your Apache source code directory. If you only specify
--with-apache, then it will default to look for your Apache source
in /usr/local/etc/httpd.
NOTE: The directory you specify should be the top-level of the
unpacked Apache (or Stronghold) distribution. The configure program
will automatically look for httpd.h in different directories under that
location depending on which version of Apache, including Stronghold,
you are running.
For MySQL support, since newer versions of MySQL installs its various
components under /usr/local, this is the default. If you have
changed the location you can specify it with: --with-mysql=/opt/local
for example. Otherwise just use: --with-mysql
*NOTE* If you are using Apache 1.3b6 or later, you should run the
Apache Configure script at least once before compiling PHP. It
doesn't matter how you have Apache configured at this point.
3. Compile and install the files. Simply type: make install
For the Apache module version this will copy the appropriate files
to the src/modules/php3 directory in your Apache distribution if
you are using Apache 1.3.x. If you are still running Apache 1.2.x
these files will be copied directly to the main src directory.
For Apache 1.3b6 and later, you can use the new APACI configuration
mechanism. To automatically build Apache with PHP support, use:
cd apache_1.3.x
./configure --prefix=/<path>/apache \
--activate-module=src/modules/php3/libphp3.a
make
make install
If you do not wish to use this new configuration tool, the old
install procedure (src/Configure) will work fine.
If you are using the old Apache ./Configure script, you will have to
edit the Apache src/Configuration file manually. If you do not have
this file, copy Configuration.tmpl to Configuration.
For Apache 1.3.x add:
AddModule modules/php3/libphp3.a
For Apache 1.3.x don't do anything else. Just add this line and then
run "./Configure" followed by "make".
For Apache 1.2.x add:
Module php3_module mod_php3.o
For Apache 1.2.x you will also have to look in the libphp3.module file,
which was copied to the src directory. The EXTRA_LIBS line in the Apache
Configuration file needs to be set to use the same libs as specified on
the LIBS line in libphp3.module. You also need to make sure to add
"-L." to the beginning of the EXTRA_LIBS line.
So, as an example, your EXTRA_LIBS line might look like:
EXTRA_LIBS=-L. -lphp3 -lgdbm -ldb -L/usr/local/mysql/lib -lmysqlclient
NOTE: You should not enclose the EXTRA_LIBS line in double-quotes, as it
is in the libphp3.module file.
Also, look at the RULE_WANTHSREGEX setting in the libphp3.module file
and set the WANTHSREGEX directive accordingly in your Configuration file.
This last step applies to versions of Apache prior to 1.3b3.
This is a bit of a hassle, but should serve as incentive to move to
Apache 1.3.x where this step has been eliminated.
Once you are satisfied with your Configuration settings, type: ./Configure
If you get errors, chances are that you forgot a library or made a typo
somewhere. Re-edit Configuration and try again. If it goes well,
type: make
4. Setting up the server.
You should now have a new httpd binary. Shut down your existing server,
if you have one, and copy this new binary overtop of it. Perhaps make
a backup of your previous one first. Then edit your conf/srm.conf file
and add the line:
AddType application/x-httpd-php3 .php3
There is also an interesting feature which can be quite instructive and
helpful while debugging. That is the option of having colour syntax
highlighting. To enable this, add the following line:
AddType application/x-httpd-php3-source .phps
Any file ending in .phps will now be displayed with full colour syntax
highlighting instead of being executed.
When you are finished making changes to your srm.conf file, you can
start up your server.

64
LICENSE Normal file
View file

@ -0,0 +1,64 @@
--------------------------------------------------------------------
Copyright (c) 1998 The PHP Development Team. All rights reserved.
--------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Commercial redistribution of larger works derived from, or
works which bundle PHP, requires written permission from the
PHP Development Team. You may charge a fee for the physical
act of transferring a copy, and must make it clear that the
fee being charged is for the distribution, and not for the
software itself. You may, at your option, offer warranty
protection in exchange for a fee.
2. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
3. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
4. All advertising materials mentioning features or use of this
software must display the following acknowledgment:
"This product includes software written by the PHP Development
Team"
5. The name "PHP" must not be used to endorse or promote products
derived from this software without prior written permission
from the PHP Development Team. 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.
6. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes software written by the PHP Development
Team".
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------
This software consists of voluntary contributions made by many
individuals on behalf of the PHP Development Team.
The PHP Development Team can be contacted via Email at core@php.net.
For more information on the PHP Development Team and the PHP
project, please see <http://www.php.net>.

1078
Makefile.in Normal file

File diff suppressed because it is too large Load diff

57
README.QNX Normal file
View file

@ -0,0 +1,57 @@
QNX4 Installation Notes
-----------------------
NOTE: General installation instructions are in the INSTALL file
1. To compile and test PHP3 you have to grab, compile and install:
- GNU dbm library or another db library;
- GNU bison (1.25 or later; 1.25 tested);
- GNU flex (any version supporting -o and -P options; 2.5.4 tested);
- GNU diffutils (any version supporting -w option; 2.7 tested);
2. To use CVS version you may need also:
- GNU CVS (1.9 tested);
- GNU autoconf (2.12 tested);
- GNU m4 (1.3 or later preferable; 1.4 tested);
3. To run configure define -lunix in command line:
LDFLAGS=-lunix ./configure
4. To use Sybase SQL Anywhere define ODBC_QNX and CUSTOM_ODBC_LIBS in
command line and run configure with --with-custom-odbc:
CFLAGS=-DODBC_QNX LDFLAGS=-lunix CUSTOM_ODBC_LIBS="-ldblib -lodbc" ./configure --with-custom-odbc=/usr/lib/sqlany50
If you have SQL Anywhere version 5.5.00, then you have to add
CFLAGS=-DSQLANY_BUG
to workaround its SQLFreeEnv() bug. Other versions has not been tested,
so try without this flag first.
5. To build the Apache module, you may have to hardcode an include path for
alloc.h in your Apache base directory:
- APACHE_DIRECTORY/src/httpd.h:
change #include "alloc.h"
to #include "APACHE_DIRECTORY/src/alloc.h"
Unless you want to use system regex library, you have to hardcode also
a path to regex.h:
- APACHE_DIRECTORY/src/conf.h:
change #include <regex.h>
to #include "APACHE_DIRECTORY/src/regex/regex.h"
I don't know so far why this required for QNX, may be it is Watcom
compiler problem.
If you building Apache module with SQL Anywhere support, you'll get
symbol conflict with BOOL. It is defined in Apache (httpd.h) and in
SQL Anywhere (odbc.h). This has nothing to do with PHP, so you have to
fix it yourself someway.
6. With above precautions, it should compile as is and pass regression
tests completely:
make
make check
make install
Don't bother me unless you really sure you made that all but it
still doesn't work.
June 28, 1998
Igor Kovalenko -- owl@infomarket.ru

59
README.WIN32 Normal file
View file

@ -0,0 +1,59 @@
Windows 95/NT Specific Notes on Compilation
Windows compilation has only been tested with Microsoft Visual C++
Version 5 Standard Edition. The PHP executable has only had limited
testing under Windows 95. SAFE MODE and any User or Group functionality
has not been ported/tested.
-----------------------------------------------------------------------
Compiling PHP with MSVC5
There are three msvc workspaces provided with this distribution. The one
most people will use is php3.dsw. This contains project files for two
versions on PHP, one with mySQL compiled internaly, and one without (both
have ODBC internaly compiled). It also contains all the modules.
The next workspace is php3extras.dsw. This project contains the converter
and a program called phpwatch, which is a simple program to watch debugger
output under windows. The 'socket' program is also available from the php
site, which is a better alternative to phpwatch.
The third workspace is php3sapi.dsw. These projects are experimental and
will probably not compile most of the time. It contains preliminary work
on the server api's for windows.
-----------------------------------------------------------------------
Base Configuration and Configuration Issues
*The base configuration for the windows php version contains odbc
support. Support for other database modules will be provided as external dll files.
*ODBC can be used to connect to many of the databases previously
supported by php (though they can still be compiled in if you have
the libraries!)
-----------------------------------------------------------------------
Makefiles
Be sure to edit any windows makefile and change the include directories
to be appropriate for your system.
-----------------------------------------------------------------------
CGI Version
The makefile for the cgi version of php is located in the win32
subdirectory of the php source tree. This make file is specificaly
for Visual C++ V5.
-----------------------------------------------------------------------
ISAPI/NSAPI/WSAPI/Apache Versions
These versions are not yet working. They are located in the php3sapi.dsw
workspace.
-----------------------------------------------------------------------
Other Libraries
See the php faq at php.net for information on where to obtain the various
libraries needed to compile some modules.

100
TODO Normal file
View file

@ -0,0 +1,100 @@
$Id$
+----
| * -- to be done
| ? -- to be done sometime if possible
| P -- in progress (name should appear in parentheses after task)
| D -- delayed until later date (specify in parentheses after task)
| U -- done, untested
| V -- done
+----
Configuration Issues
--------------------
* properly detect dbm routines when they're in libc
* add the appropriate #define magic for memmove and friends (see
GNU autoconf info pages for details)
* make it possible to disable support for some extensions (gd, dbm)
* make it possible to build selected extensions so they are
dynamically-loadable
Core Language Issues
--------------------
* go through PHP2's php.h and see how each special #define might be
applied/supported in PHP3
* move Treatdata() to language-scanner.lex where hash_environment()
is called including a decision about priority of variables and moving
Treatdata() to use hash_add() instead of hash_update() for insertions
to the symbol table.
* go through FIXME and XXX lines (egrep 'FIXME|XXX' *.[ch])
* make lexer and parser thread-safe
* verify that binary strings are handled correctly
V don't evaluate truth expressions more than once
V make unset() work on arrays (tricky)
Core Functions
--------------
* go through all file functions and make sure they are opened in binary
mode in win32 if needed (ie copy)
* go through all functions and look at PHP_SAFE_MODE issues
* have a look at return codes of fsockopen() function - we should
probably RETURN_FALSE and then set an error code somewhere (Rasmus)
* go through FIXME and XXX lines (egrep 'FIXME|XXX' functions/*.[ch])
* add user-level flock() implementation to let people lock and unlock files
* add "'" modifier to sprintf to group thousands by comma
* Add an improved eval() that doesn't "leak"
? sorting of objects with a user-defined comparison function (like Perl)
(this shouldn't be expected before 3.1, if at all).
Extensions
----------
* add version strings for all extensions
* Oracle persistent connections
U gd support for windows
* Illustra support (APIS)
? CQL++ support (http://www.cql.com/)
? GNU SQL support (does anybody actually use this?)
? DB2 support (http://www.sleepycat.com/)
? Shore support (http://www.cs.wisc.edu/shore/)
? PGP Interface (use PGPlib?)
? more Perl-like regex handling?
Server Support
--------------
P ISAPI (Shane)
* process cookies
* blocking functions
* make sure it's Microsoft-clean so it can be used with other ISAPI
implementations
* WSAPI
* NSAPI
* process cookies
* check POST method handling code
* use Netscape memory allocation inside emalloc() and company
* FastCGI support - see http://fastcgi.idle.com/
Win32 Specific
--------------
* implement some kind of syslog->file log support for win95.
* change all file open/read/write functions from c library to win32
api file functions. The win32 api functions handle both disk files
and network files. This will allow include and require to use http
or ftp files as the unix version does, and do away with my
workaround to support this. (3.1?)
* implement symlinks via windows shell links (shortcuts). This will
work only at the script level and is not a c language level port.
Testing
-------
* truss/strace a typical PHP request and see if there are some system
calls that could be optimized out
* verify that regression tests exist for all core functions
Miscellaneous
-------------
* remove hard-coded compilation options
? locale issues - funny things happen in PHP2 when the locale is set to
use , instead of . as the decimal seperator. ie. 1.5+1.5 = 1
? SSI->PHP3 conversion script
? SQL-based access logging (start with examples/log-*.php3)

17
WISHLIST Normal file
View file

@ -0,0 +1,17 @@
- Persistant per-process scripting
Apache 1.3 has added things that makes this much easier than before.
The module structure now contains a child_init hook and a child_exit
hook where you can register functions to be called when an httpd
process starts up and when one shuts down (due to MaxRequestsPerChild
or a Kill). The only real trick now is to come up with some sort of
syntax for specifying what to do from the child_init call and the
child_exit call.
One idea is to be able to add a <PHP>...</PHP> block to the Apache
httpd.conf file which would somehow define a series of PHP statements
to be executed from the child_* calls. One for startup and another
block for shutdown. These blocks would work with the per-process
memory pool, so any variables initialized here would have a lifespan
equal to that of the httpd process. Basically request-spanning
global variables.

55
WISHLIST-3.1 Normal file
View file

@ -0,0 +1,55 @@
V Do yystype_ptr and hash pointers the right way - use the hash
pointer and the bucket pointer, instead of a pointer to the data.
Allows for a real unset() among other things.
V Improve performance of simple variable lookups
* Improve string performance by using smarter memory allocation methods
- Improve preprocessor (handle require() efficiently), possibly handle
automatic preprocessing for sites based on timestamp
V Use a reference count mechanism to prevent unnecessary duplication of data.
* Write and stabilize a complete persistent data API. Feature wishlist:
- memory manager using shared memory
- process-global symbol table
- make api inter-thread capable for win32 and some far off future where unix
version will be multithreaded
V Handle out of memory (inside emalloc()?)
* Try to figure out a way to declare *real* global variables
* Improve the reading of configuration variables into php3_ini (generalize)
Make it possible to implement config_get("configuration_variable") and
config_set("configuration_variable","value") that'll work with *php3_ini*,
not the configuration hash!
* Bundle some nice classes (like Bjørn's graphing class)
* Bundle some database abstraction classes
* Distribute binaries
* Clean up API and modules to make .so modules portable across CGI and server
binaries
* dbm cleanup (don't arbitrarily pick, and support multiple concurrent formats)
* start system defines so that we can move away from the standard c lib on
windows to the win32 lib. (file functions primarily)
* COM implementation so php can be used as an asp language (cant find any docs
on how this is done though)
* Clean up the file structure so the top-level directory isn't such a mess.
* Bring the module concept to maturity: use libtool and make it
possible to decide at compile time whether you want to compile a
module statically or dynamically. Remove the distinction between
the stuff currently in dl/ and functions/.
* a way of letting each module specify its options, so ini file options and
Apache directives can be set up from the same specification.
V Make it possible to declare smarter user functions: (done in 3.0)
- Optional parameters
- Parameters that are forced/prefered by reference
* Make object parsing more general, and allow nested arrays/objects with
unlimited levels.
V Make it possible to copy references of variables.
* data tainting (like perl -T)
* multi-dimensional array support in GET/POST/COOKIE handling code
* Persistent functions and classes
* odbc_fetch_assoc
* Add env handling to gpc_order
* Populate track_vars regardless of gpc_order
* a real exec() function
* Support passing arguments to functions by name (e.g. foo(arg1 => "bar", arg2 => "foobar"))
* Add an optional setting to destroy persistent resources if a PHP script terminates
abnormally
V COM automation support for Win32
? Add a setting for making function names case sensitive
* stat() files before feeding them to flex - it doesn't handle special files very well

261
acconfig.h Normal file
View file

@ -0,0 +1,261 @@
/* This is the default configuration file to read */
#define CONFIGURATION_FILE_PATH "php3.ini"
#define USE_CONFIG_FILE 1
/* 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
/* crypt capability checks */
#undef PHP3_STD_DES_CRYPT
#undef PHP3_EXT_DES_CRYPT
#undef PHP3_MD5_CRYPT
#undef PHP3_BLOWFISH_CRYPT
/* 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 */
#define HAVE_DIRENT_H 0
/* Define if you have the resolv library (-lresolv). */
#define HAVE_LIBRESOLV 0
/* Define if you have the gd library (-lgd). */
#define HAVE_LIBGD 0
/* Define if you have the zlib library */
#define HAVE_ZLIB 0
/* Define if you have the gd version 1.3 library (-lgd). */
#define HAVE_LIBGD13 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 if you want the logging to go to ndbm/gdbm/flatfile */
#define LOG_DBM 0
#define LOG_DBM_DIR "."
/* Define if you want the logging to go to a mysql database */
#define LOG_MYSQL 0
/* Define if you want the logging to go to a mysql database */
#define LOG_MSQL 0
/* Define these if you are using an SQL database for logging */
#define LOG_SQL_HOST ""
#define LOG_SQL_DB ""
/* Define if you an ndbm compatible library (-ldbm). */
#define NDBM 0
/* Define if you have the gdbm library (-lgdbm). */
#define GDBM 0
/* Define both of these if you want the bundled REGEX library */
#define REGEX 0
#define HSREGEX 0
/* Define if you want Solid database support */
#define HAVE_SOLID 0
/* Define if you want to use the supplied dbase library */
#define DBASE 0
/* Define if you want Hyperwave support */
#define HYPERWAVE 0
/* Define if you have the crypt() function */
#define HAVE_CRYPT 1
/* Define if you have the Oracle database client libraries */
#define HAVE_ORACLE 0
/* Define if you have the Oracle version 8 database client libraries */
#define HAVE_OCI8 0
/* Define if you want to use the iODBC database driver */
#define HAVE_IODBC 0
/* Define if you want to use the OpenLink ODBC database driver */
#define HAVE_OPENLINK 0
/* Define if you have the AdabasD client libraries */
#define HAVE_ADABAS 0
/* Define if you want the LDAP directory interface */
#define HAVE_LDAP 0
/* Define if you want the SNMP interface */
#define HAVE_SNMP 0
/* Define if you want the IMAP directory interface */
#define HAVE_IMAP 0
/* Define if you want to use a custom ODBC database driver */
#define HAVE_CODBC 0
/* Define to use the unified ODBC interface */
#define HAVE_UODBC 0
/* Define if you have libdl (used for dynamic linking) */
#define HAVE_LIBDL 0
/* Define if you have libdnet_stub (used for Sybase support) */
#define HAVE_LIBDNET_STUB 0
/* Define if you have and want to use libcrypt */
#define HAVE_LIBCRYPT 0
/* Define if you have and want to use libnsl */
#define HAVE_LIBNSL 0
/* Define if you have and want to use libsocket */
#define HAVE_LIBSOCKET 0
/* 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 HAVE_EMPRESS
#define HAVE_EMPRESS 0
#endif
#define HAVE_SYBASE 0
#define HAVE_SYBASE_CT 0
#ifndef HAVE_MYSQL
#define HAVE_MYSQL 0
#endif
#ifndef HAVE_MSQL
#define HAVE_MSQL 0
#endif
#ifndef HAVE_PGSQL
#define HAVE_PGSQL 0
#endif
#ifndef HAVE_VELOCIS
#define HAVE_VELOCIS 0
#endif
#ifndef HAVE_IFX
#define HAVE_IFX 0
#endif
#ifndef HAVE_IFX_IUS
#define HAVE_IFX_IUS 0
#endif
#ifndef IFX_VERSION
#define IFX_VERSION 0
#endif
#ifndef HAVE_IBASE
#define HAVE_IBASE 0
#endif
#ifndef HAVE_PQCMDTUPLES
#define HAVE_PQCMDTUPLES 0
#endif
#define MSQL1 0
#define HAVE_FILEPRO 0
#define HAVE_SOLID 0
#define DEBUG 0
/* Define if your system has the gettimeofday() call */
#define HAVE_GETTIMEOFDAY 0
/* Define if your system has the putenv() library call */
#define HAVE_PUTENV 0
/* Define if you want to enable PHP RPC (experimental) */
#define PHP_RPC 0
/* Define if you want to enable bc style precision math support */
#define WITH_BCMATH 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 to enable memory limit support */
#define MEMORY_LIMIT 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 want System V semaphore support.
*/
#define HAVE_SYSVSEM 0
/* Define if you have union semun.
*/
#define HAVE_SEMUN 0
/* Define if you want System V shared memory support.
*/
#define HAVE_SYSVSHM 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 if you have the expat (XML Parser Toolkit) library */
#define HAVE_LIBEXPAT 0
/* Define if you have the pdflib library */
#define HAVE_PDFLIB 0
/* Define if you have the fdftk library */
#define HAVE_FDFLIB 0
/* Define to compile with mod_dav support */
#define HAVE_MOD_DAV 0

417
aclocal.m4 vendored Normal file
View file

@ -0,0 +1,417 @@
dnl $Id$
dnl
dnl This file contains local autoconf functions.
AC_DEFUN(AC_ORACLE_VERSION,[
AC_MSG_CHECKING([Oracle version])
if test -f "$ORACLEINST_TOP/orainst/unix.rgs"
then
ORACLE_VERSION=`grep '"ocommon"' $ORACLEINST_TOP/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
test -z "$ORACLE_VERSION" && ORACLE_VERSION=7.3
else
ORACLE_VERSION=8.0
fi
AC_MSG_RESULT($ORACLE_VERSION)
])
dnl
dnl Test mSQL version by checking if msql.h has "IDX_TYPE" defined.
dnl
AC_DEFUN(AC_MSQL_VERSION,[
AC_MSG_CHECKING([mSQL version])
ac_php_oldcflags=$CFLAGS
CFLAGS="$MSQL_INCLUDE $CFLAGS";
AC_TRY_COMPILE([#include <sys/types.h>
#include "msql.h"],[int i = IDX_TYPE],[
AC_DEFINE(MSQL1,0)
MSQL_VERSION="2.0 or newer"
],[
AC_DEFINE(MSQL1,1)
MSQL_VERSION="1.0"
])
CFLAGS=$ac_php_oldcflags
AC_MSG_RESULT($MSQL_VERSION)
])
dnl
dnl Figure out which library file to link with for the Solid support.
dnl
AC_DEFUN(AC_FIND_SOLID_LIBS,[
AC_MSG_CHECKING([Solid library file])
ac_solid_uname_s=`uname -s 2>/dev/null`
case $ac_solid_uname_s in
AIX) ac_solid_os=a3x;;
HP-UX) ac_solid_os=h9x;;
IRIX) ac_solid_os=irx;;
Linux) ac_solid_os=lux;;
SunOS) ac_solid_os=ssx;; # should we deal with SunOS 4?
FreeBSD) ac_solid_os=fbx;;
# "uname -s" on SCO makes no sense.
esac
SOLID_LIBS=`echo $1/scl${ac_solid_os}*.so | cut -d' ' -f1`
if test ! -f $SOLID_LIBS; then
SOLID_LIBS=`echo $1/scl${ac_solid_os}*.a | cut -d' ' -f1`
fi
if test ! -f $SOLID_LIBS; then
SOLID_LIBS=`echo $1/scl2x${ac_solid_os}*.a | cut -d' ' -f1`
fi
if test ! -f $SOLID_LIBS; then
SOLID_LIBS=`echo $1/scl2x${ac_solid_os}*.a | cut -d' ' -f1`
fi
if test ! -f $SOLID_LIBS; then
SOLID_LIBS=`echo $1/bcl${ac_solid_os}*.so | cut -d' ' -f1`
fi
if test ! -f $SOLID_LIBS; then
SOLID_LIBS=`echo $1/bcl${ac_solid_os}*.a | cut -d' ' -f1`
fi
AC_MSG_RESULT(`echo $SOLID_LIBS | sed -e 's!.*/!!'`)
])
dnl
dnl Figure out which library file to link with for the Empress support.
dnl
AC_DEFUN(AC_FIND_EMPRESS_LIBS,[
AC_MSG_CHECKING([Empress library file])
EMPRESS_LIBS=`echo $1/empodbc.so | cut -d' ' -f1`
if test ! -f $EMPRESS_LIBS; then
EMPRESS_LIBS=`echo $1/empodbc.a | cut -d' ' -f1`
fi
AC_MSG_RESULT(`echo $EMPRESS_LIBS | sed -e 's!.*/!!'`)
])
dnl
dnl See if we have broken header files like SunOS has.
dnl
AC_DEFUN(AC_MISSING_FCLOSE_DECL,[
AC_MSG_CHECKING([for fclose declaration])
AC_TRY_COMPILE([#include <stdio.h>],[int (*func)() = fclose],[
AC_DEFINE(MISSING_FCLOSE_DECL,0)
AC_MSG_RESULT(ok)
],[
AC_DEFINE(MISSING_FCLOSE_DECL,1)
AC_MSG_RESULT(missing)
])
])
# Checks for libraries.
# Prefer gdbm, Berkeley DB and ndbm/dbm, in that order
AC_DEFUN(AC_PREFERRED_DB_LIB,[
AC_CHECK_LIB(gdbm, gdbm_open,[AC_DEFINE(GDBM) DBM_TYPE=gdbm; DBM_LIB=-lgdbm],
[AC_CHECK_LIB(db, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldb],
[AC_CHECK_LIB(c, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=],
[AC_CHECK_LIB(dbm, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldbm],
[DBM_TYPE=""])])])])
AC_MSG_CHECKING([preferred dbm library])
if test "a$DBM_TYPE" = a; then
AC_MSG_RESULT(none found)
AC_MSG_WARN(No dbm library found - using built-in flatfile support)
else
AC_MSG_RESULT($DBM_TYPE chosen)
fi
AC_SUBST(DBM_LIB)
AC_SUBST(DBM_TYPE)
])
dnl
dnl Check for broken sprintf()
dnl
AC_DEFUN(AC_BROKEN_SPRINTF,[
AC_MSG_CHECKING([for broken sprintf])
AC_TRY_RUN([main() { char buf[20]; exit (sprintf(buf,"testing 123")!=11); }],[
AC_DEFINE(BROKEN_SPRINTF,0)
AC_MSG_RESULT(ok)
],[
AC_DEFINE(BROKEN_SPRINTF,1)
AC_MSG_RESULT(broken)
],[
AC_DEFINE(BROKEN_SPRINTF,0)
AC_MSG_RESULT(cannot check, guessing ok)
])
])
dnl
dnl Check for crypt() capabilities
dnl
AC_DEFUN(AC_CRYPT_CAP,[
AC_MSG_CHECKING([for standard DES crypt])
AC_TRY_RUN([
main() {
#if HAVE_CRYPT
exit (strcmp((char *)crypt("rasmuslerdorf","rl"),"rl.3StKT.4T8M"));
#else
exit(0);
#endif
}],[
AC_DEFINE(PHP3_STD_DES_CRYPT,1)
AC_MSG_RESULT(yes)
],[
AC_DEFINE(PHP3_STD_DES_CRYPT,0)
AC_MSG_RESULT(no)
],[
AC_DEFINE(PHP3_STD_DES_CRYPT,1)
AC_MSG_RESULT(cannot check, guessing yes)
])
AC_MSG_CHECKING([for extended DES crypt])
AC_TRY_RUN([
main() {
#if HAVE_CRYPT
exit (strcmp((char *)crypt("rasmuslerdorf","_J9..rasm"),"_J9..rasmBYk8r9AiWNc"));
#else
exit(0);
#endif
}],[
AC_DEFINE(PHP3_EXT_DES_CRYPT,1)
AC_MSG_RESULT(yes)
],[
AC_DEFINE(PHP3_EXT_DES_CRYPT,0)
AC_MSG_RESULT(no)
],[
AC_DEFINE(PHP3_EXT_DES_CRYPT,0)
AC_MSG_RESULT(cannot check, guessing no)
])
AC_MSG_CHECKING([for MD5 crypt])
AC_TRY_RUN([
main() {
#if HAVE_CRYPT
char salt[15], answer[40];
salt[0]='$'; salt[1]='1'; salt[2]='$';
salt[3]='r'; salt[4]='a'; salt[5]='s';
salt[6]='m'; salt[7]='u'; salt[8]='s';
salt[9]='l'; salt[10]='e'; salt[11]='$';
salt[12]='\0';
strcpy(answer,salt);
strcat(answer,"rISCgZzpwk3UhDidwXvin0");
exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
#else
exit(0);
#endif
}],[
AC_DEFINE(PHP3_MD5_CRYPT,1)
AC_MSG_RESULT(yes)
],[
AC_DEFINE(PHP3_MD5_CRYPT,0)
AC_MSG_RESULT(no)
],[
AC_DEFINE(PHP3_MD5_CRYPT,0)
AC_MSG_RESULT(cannot check, guessing no)
])
AC_MSG_CHECKING([for Blowfish crypt])
AC_TRY_RUN([
main() {
#if HAVE_CRYPT
char salt[25], answer[70];
salt[0]='$'; salt[1]='2'; salt[2]='a'; salt[3]='$'; salt[4]='0'; salt[5]='7'; salt[6]='$'; salt[7]='\0';
strcat(salt,"rasmuslerd");
strcpy(answer,salt);
strcpy(&answer[16],"O............gl95GkTKn53Of.H4YchXl5PwvvW.5ri");
exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
#else
exit(0);
#endif
}],[
AC_DEFINE(PHP3_BLOWFISH_CRYPT,1)
AC_MSG_RESULT(yes)
],[
AC_DEFINE(PHP3_BLOWFISH_CRYPT,0)
AC_MSG_RESULT(no)
],[
AC_DEFINE(PHP3_BLOWFISH_CRYPT,0)
AC_MSG_RESULT(cannot check, guessing no)
])
])
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
## Copyright (C) 1996, 1997 Free Software Foundation, Inc.
## Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
##
## 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.
##
## As a special exception to the GNU General Public License, if you
## distribute this file as part of a program that contains a
## configuration script generated by Autoconf, you may include it under
## the same distribution terms that you use for the rest of that program.
# serial 9 AM_PROG_LIBTOOL
AC_DEFUN(AM_PROG_LIBTOOL,
[AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PROG_RANLIB])
AC_REQUIRE([AM_PROG_LD])
AC_REQUIRE([AC_PROG_LN_S])
# Always use our own libtool.
LIBTOOL='$(top_builddir)/libtool'
AC_SUBST(LIBTOOL)
dnl Allow the --disable-shared flag to stop us from building shared libs.
AC_ARG_ENABLE(shared,
[ --enable-shared build shared libraries [default=yes]],
test "$enableval" = no && libtool_shared=" --disable-shared",
libtool_shared=)
dnl Allow the --disable-static flag to stop us from building static libs.
AC_ARG_ENABLE(static,
[ --enable-static build static libraries [default=yes]],
test "$enableval" = no && libtool_static=" --disable-static",
libtool_static=)
libtool_flags="$libtool_shared$libtool_static"
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
[case "$host" in
*-*-irix6*)
for f in '-32' '-64' '-cckr' '-n32' '-mips1' '-mips2' '-mips3' '-mips4'; do
if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then
LD="${LD-ld} $f"
fi
done
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
CFLAGS="$CFLAGS -belf"
;;
esac]
# Actually configure libtool. ac_aux_dir is where install-sh is found.
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
LD="$LD" RANLIB="$RANLIB" LN_S="$LN_S" \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|| AC_MSG_ERROR([libtool configure failed])
])
# AM_PROG_LD - find the path to the GNU or non-GNU linker
AC_DEFUN(AM_PROG_LD,
[AC_ARG_WITH(gnu-ld,
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
if test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL(ac_cv_path_LD,
[case "$LD" in
/*)
ac_cv_path_LD="$LD" # Let the user override the test with a path.
;;
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/ld"; then
ac_cv_path_LD="$ac_dir/ld"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then
test "$with_gnu_ld" = yes && break
else
test "$with_gnu_ld" != yes && break
fi
fi
done
IFS="$ac_save_ifs"
;;
esac])
LD="$ac_cv_path_LD"
if test -n "$LD"; then
AC_MSG_RESULT($LD)
else
AC_MSG_RESULT(no)
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_SUBST(LD)
AM_PROG_LD_GNU
])
AC_DEFUN(AM_PROG_LD_GNU,
[AC_CACHE_CHECK([whether we are using GNU ld], ac_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then
ac_cv_prog_gnu_ld=yes
else
ac_cv_prog_gnu_ld=no
fi])
])
# the following 'borrwed' from automake until we switch over
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
# serial 1
AC_DEFUN(AM_MAINTAINER_MODE,
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
USE_MAINTAINER_MODE=$enableval,
USE_MAINTAINER_MODE=no)
AC_MSG_RESULT($USE_MAINTAINER_MODE)
if test $USE_MAINTAINER_MODE = yes; then
MAINT=
else
MAINT='#M#'
fi
AC_SUBST(MAINT)dnl
]
)
# another one stolen from automake temporarily
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "$@" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])

4
apMakefile.libdir Normal file
View file

@ -0,0 +1,4 @@
This is a place-holder which indicates to Configure that it shouldn't
provide the default targets when building the Makefile in this directory.
Instead it'll just prepend all the important variable definitions, and
copy the Makefile.tmpl onto the end.

77
apMakefile.tmpl Normal file
View file

@ -0,0 +1,77 @@
##
## Apache 1.3 Makefile template for PHP3 Module
## [src/modules/php3/Makefile.tmpl]
##
# the parametrized target
LIB=libphp3.$(LIBEXT)
# objects for building the static library
OBJS=mod_php3.o
OBJS_LIB=libmodphp3.a
# objects for building the shared object library
SHLIB_OBJS=mod_php3.so-o
SHLIB_OBJS_LIB=libmodphp3-so.a
# the general targets
all: lib
lib: $(LIB)
# build the static library by merging the object files
libphp3.a: $(OBJS) $(OBJS_LIB)
cp $(OBJS_LIB) $@
ar r $@ $(OBJS)
$(RANLIB) $@
# ugly hack to support older Apache-1.3 betas that don't set $LIBEXT
libphp3.: $(OBJS) $(OBJS_LIB)
cp $(OBJS_LIB) $@
ar r $@ $(OBJS)
$(RANLIB) $@
cp libphp3. libphp3.a
# build the shared object library by linking the object files
libphp3.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
rm -f $@
$(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
# have to use a different name to trigger the different
# implicit Make rule
# 2. extension -so.o (as used elsewhere) cannot be used because
# the suffix feature of Make really wants just .x, so we use
# extension .so-o
.SUFFIXES: .o .so-o
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
.c.so-o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(SPACER) $< && mv $*.o $*.so-o
# cleanup
clean:
-rm -f $(OBJS) $(SHLIB_OBJS) $(LIB)
# We really don't expect end users to use this rule. It works only with
# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
# using it.
depend:
cp Makefile.tmpl Makefile.tmpl.bak \
&& sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
&& gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
&& sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' Makefile.new \
> Makefile.tmpl \
&& rm Makefile.new
#Dependencies
$(OBJS): Makefile
# DO NOT REMOVE
mod_php3.o: mod_php3.c $(INCDIR)/httpd.h $(INCDIR)/conf.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 \
$(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php3.h

492
apidoc.txt Normal file
View file

@ -0,0 +1,492 @@
PHP Version 3.0 API Documentation
Table of Contents
-----------------
1. Function Prototype
2. Function Arguments
3. Variable number of function arguments
4. Using the function arguments
5. Memory management in functions
6. Setting variables in the symbol table
7. Returning values from functions
8. Returning 'complex' values from functions (arrays or objects)
9. Using the resource list
10. Using the persistent resource table
11. Adding runtime configuration directives
-----------------
1. Function Prototype
All functions look like this:
void php3_foo(INTERNAL_FUNCTION_PARAMETERS) {
}
Even if your function doesn't take any arguments, this is how it is
called.
-----------------
2. Function Arguments
Arguments are always of type pval. This type contains a union which
has the actual type of the argument. So, if your function takes two
arguments, you would do something like the following at the top of your
function:
pval *arg1, *arg2;
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&arg1,&arg2)==FAILURE) {
WRONG_PARAM_COUNT;
}
NOTE: Arguments can be passed either by value or by reference. In both
cases you will need to pass &(pval *) to getParameters. If you want to
check if the n'th parameter was sent to you by reference or not, you can
use the function, ParameterPassedByReference(ht,n). It will return either
1 or 0.
When you change any of the passed parameters, whether they are sent by
reference or by value, you can either start over with the parameter by
calling pval_destructor on it, or if it's an ARRAY you want to add to,
you can use functions similar to the ones in internal_functions.h which
manipulate return_value as an ARRAY.
Also if you change a parameter to IS_STRING make sure you first assign
the new estrdup'ed string and the string length, and only later change the
type to IS_STRING. If you change the string of a parameter which already
IS_STRING or IS_ARRAY you should run pval_destructor on it first.
-----------------
3. Variable number of function arguments
A function can take a variable number of arguments. If your function can
take either 2 or 3 arguments, use the following:
pval *arg1, *arg2, *arg3;
int arg_count = ARG_COUNT(ht);
if (arg_count<2 || arg_count>3 ||
getParameters(ht,arg_count,&arg1,&arg2,&arg3)==FAILURE) {
WRONG_PARAM_COUNT;
}
------------------
4. Using the function arguments
The type of each argument is stored in the pval type field:
This type can be any of the following:
IS_STRING String
IS_DOUBLE Double-precision floating point
IS_LONG Long
IS_ARRAY Array
IS_EMPTY ??
IS_USER_FUNCTION ??
IS_INTERNAL_FUNCTION ?? (if some of these cannot be passed to a
function - delete)
IS_CLASS ??
IS_OBJECT ??
If you get an argument of one type and would like to use it as another,
or if you just want to force the argument to be of a certain type, you
can use one of the following conversion functions:
convert_to_long(arg1);
convert_to_double(arg1);
convert_to_string(arg1);
convert_to_boolean_long(arg1); If the string is "" or "0" it
becomes 0, 1 otherwise
convert_string_to_number(arg1); Converts string to either LONG or
DOUBLE depending on string
These function all do in-place conversion. They do not return anything.
The actual argument is stored in a union.
For type IS_STRING, use arg1->value.str.val
IS_LONG arg1->value.lval
IS_DOUBLE arg1->value.dval
-------------------
5. Memory management in functions
Any memory needed by a function should be allocated with either emalloc()
or estrdup(). These are memory handling abstraction functions that look
and smell like the normal malloc() and strdup() functions. Memory should
be freed with efree().
There are two kinds of memory in this program. Memory which is returned
to the parser in a variable and memory which you need for temporary
storage in your internal function. When you assign a string to a
variable which is returned to the parser you need to make sure you first
allocate the memory with either emalloc or estrdup. This memory
should NEVER be freed by you, unless you later, in the same function
overwrite your original assignment (this kind of programming practice is
not good though).
For any temporary/permanent memory you need in your functions/library you
should use the three emalloc(), estrdup(), and efree() functions. They
behave EXACTLY like their counterpart functions. Anything you emalloc()
or estrdup() you have to efree() at some point or another, unless it's
supposed to stick around until the end of the program, otherwise there
will be a memory leak. The meaning of "the functions behave exactly like
their counterparts" is if you efree() something which was not
emalloc()'ed nor estrdup()'ed you might get a segmentation fault. So
please take care and free all of your wasted memory. One of the biggest
improvements in PHP 3.0 will hopefully be the memory management.
If you compile with "-DDEBUG", PHP3 will print out a list of all
memory that was allocated using emalloc() and estrdup() but never
freed with efree() when it is done running the specified script.
-------------------
6. Setting variables in the symbol table
A number of macros are available which make it easier to set a variable
in the symbol table:
SET_VAR_STRING(name,value) **
SET_VAR_DOUBLE(name,value)
SET_VAR_LONG(name,value)
** Be careful here. The value part must be malloc'ed manually because
the memory management code will try to free this pointer later. Do
not pass statically allocated memory into a SET_VAR_STRING
Symbol tables in PHP 3.0 are implemented as hash tables. At any given time,
&symbol_table is a pointer to the 'main' symbol table, and active_symbol_table
points to the currently active symbol table (these may be identical like in
startup, or different, if you're inside a function).
The following examples use 'active_symbol_table'. You should replace it with
&symbol_table if you specifically want to work with the 'main' symbol table.
Also, the same funcions may be applied to arrays, as explained below.
* To check whether a variable named $foo already exists in a symbol table:
if (hash_exists(active_symbol_table,"foo",sizeof("foo"))) { exists... }
else { doesn't exist }
* If you also need to get the type of the variable, you can use:
hash_find(active_symbol_table,"foo",sizeof("foo"),&pvalue);
check(pvalue.type);
Arrays in PHP 3.0 are implemented using the same hashtables as symbol tables.
This means the two above functions can also be used to check variables
inside arrays.
If you want to define a new array in a symbol table, you should do this:
1. Possibly check it exists and abort, using hash_exists()
or hash_find().
2. Code:
pval arr;
if (array_init(&arr) == FAILURE) { failed... };
hash_update(active_symbol_table,"foo",sizeof("foo"),&arr,sizeof(pval),NULL);
This code declares a new array, named $foo, in the active symbol table.
This array is empty.
Here's how to add new entries to it:
pval entry;
entry.type = IS_LONG;
entry.value.lval = 5;
hash_update(arr.value.ht,"bar",sizeof("bar"),&entry,sizeof(pval),NULL); /* defines $foo["bar"] = 5 */
hash_index_update(arr.value.ht,7,&entry,sizeof(pval),NULL); /* defines $foo[7] = 5 */
hash_next_index_insert(arr.value.ht,&entry,sizeof(pval),NULL); /* defines the next free place in $foo[],
* $foo[8], to be 5 (works like php2)
*/
If you'd like to modify a value that you inserted to a hash, you must first retreive it from the hash. To
prevent that overhead, you can supply a pval ** to the hash add function, and it'll be updated with the
pval * address of the inserted element inside the hash. If that value is NULL (like in all of the
above examples) - that parameter is ignored.
hash_next_index_insert() works more or less using the same logic
"$foo[] = bar;" works in PHP 2.0.
If you are building an array to return from a function, you can initialize
the array just like above by doing:
if (array_init(return_value) == FAILURE) { failed...; }
and then adding values with the helper functions:
add_next_index_long(return_value,long_value);
add_next_index_double(return_value,double_value);
add_next_index_string(return_value,estrdup(string_value));
Of course, if the adding isn't done right after the array
initialization, you'd probably have to look for the array first:
pval *arr;
if (hash_find(active_symbol_table,"foo",sizeof("foo"),(void **)&arr)==FAILURE) { can't find... }
else { use arr->value.ht... }
Note that hash_find receives a pointer to a pval pointer, and
not a pval pointer.
Just about any hash function returns SUCCESS or FAILURE (except for
hash_exists() that returns a boolean truth value).
-------------------
7. Returning 'simple' values from functions (integers, floats or strings)
A number of macros are available to make it easier to return things from
functions:
These set the return value and return from the function:
RETURN_FALSE
RETURN_TRUE
RETURN_LONG(l)
RETURN_STRING(s,dup) If dup is true, duplicates the string
RETURN_STRINGL(s,l,dup) Return string (s) specifying length (l).
RETURN_DOUBLE(d)
These only set the return value:
RETVAL_FALSE
RETVAL_TRUE
RETVAL_LONG(l)
RETVAL_STRING(s,dup) If dup is true, duplicates the string
RETVAL_STRINGL(s,l,dup) Return string (s) specifying length (l).
RETVAL_DOUBLE(d)
The string macros above will all estrdup() the passed 's' argument,
so you can safely free the argument after calling the macro, or
alternatively use statically allocated memory.
If your function returns boolean success/error responses, always use
RETURN_TRUE and RETURN_FALSE respectively.
-------------------
8. Returning 'complex' values from functions (arrays or objects)
Your function can also return a complex data type such as an object
or an array.
Returning an object:
1. Call object_init(return_value).
2. Fill it up with values:
add_property_long(return_value,property_name,l) Add a property named 'property_name', of type long, equals to 'l'
add_property_double(return_value,property_name,d) Same, only a double
add_property_string(return_value,property_name,str) Same, only a string
add_property_stringl(return_value,property_name,str,l) Add a property named 'property_name', of type string, string is 'str' with length 'l'
3. Possibly, register functions for this object. In order to
obtain values from the object, the function would have to fetch
"this" from the active_symbol_table. Its type should be IS_OBJECT,
and it's basically a regular hash table (i.e., you can use regular
hash functions on .value.ht). The actual registration of the
function can be done using:
add_method(return_value,function_name,function_ptr)
Returning an array:
1. Call array_init(return_value).
2. Fill it up with values:
add_assoc_long(return_value,key,l) add associative entry with key 'key' and long value 'l'
add_assoc_double(return_value,key,d)
add_assoc_string(return_value,key,str)
add_assoc_stringl(return_value,key,str,length) specify the string length
add_index_long(return_value,index,l) add entry in index 'index' with long value 'l'
add_index_double(return_value,index,d)
add_index_string(return_value,index,str)
add_index_stringl(return_value,index,str,length) specify the string length
add_next_index_long(return_value,l) add an array entry in the next free offset with long value 'l'
add_next_index_double(return_value,d)
add_next_index_string(return_value,str)
add_next_index_stringl(return_value,str,length) specify the string length
-------------------
9. Using the resource list
PHP 3.0 has a standard way of dealing with various types of resources,
that replaces all of the local linked lists in PHP 2.0.
Available functions:
php3_list_insert(ptr, type) returns the 'id' of the newly inserted resource
php3_list_delete(id) delete the resource with the specified id
php3_list_find(id,*type) returns the pointer of the resource with the specified id, updates 'type' to the resource's type
Typically, these functions are used for SQL drivers but they can be
used for anything else, and are used, for instance, for maintaining
file descriptors.
Typical list code would look like this:
Adding a new resource:
RESOURCE *resource;
...allocate memory for resource and acquire resource...
/* add a new resource to the list */
return_value->value.lval = php3_list_insert((void *) resource, LE_RESOURCE_TYPE);
return_value->type = IS_LONG;
Using an existing resource:
pval *resource_id;
RESOURCE *resource;
int type;
convert_to_long(resource_id);
resource = php3_list_find(resource_id->value.lval, &type);
if (type != LE_RESOURCE_TYPE) {
php3_error(E_WARNING,"resource index %d has the wrong type",resource_id->value.lval);
RETURN_FALSE;
}
...use resource...
Deleting an existing resource:
pval *resource_id;
RESOURCE *resource;
int type;
convert_to_long(resource_id);
php3_list_delete(resource_id->value.lval);
The resource types should be registered in php3_list.h, in enum
list_entry_type. In addition, one should add shutdown code for any
new resource type defined, in list.c's list_entry_destructor() (even if
you don't have anything to do on shutdown, you must add an empty case).
-------------------
10. Using the persistent resource table
PHP 3.0 has a standard way of storing persistent resources (i.e.,
resources that are kept in between hits). The first module to use
this feature was the MySQL module, and mSQL followed it, so one can
get the general impression of how a persistent resource should be
used by reading mysql.c. The functions you should look at are:
php3_mysql_do_connect()
php3_mysql_connect()
php3_mysql_pconnect()
The general idea of persistence modules is this:
1. Code all of your module to work with the regular resource list
mentioned in section (9).
2. Code extra connect functions that check if the resource already
exists in the persistent resource list. If it does, register it
as in the regular resource list as a pointer to the persistent
resource list (because of 1., the rest of the code
should work immediately). If it doesn't, then create it, add it
to the persistent resource list AND add a pointer to it from the
regular resource list, so all of the code would work since it's
in the regular resource list, but on the next connect, the
resource would be found in the persistent resource list and be
used without having to recreate it.
You should register these resources with a different type (e.g.
LE_MYSQL_LINK for non-persistent link and LE_MYSQL_PLINK for
a persistent link).
If you read mysql.c, you'll notice that except for the more complex
connect function, nothing in the rest of the module has to be changed.
The very same interface exists for the regular resource list and the
persistent resource list, only 'list' is replaced with 'plist':
php3_plist_insert(ptr, type) returns the 'id' of the newly inserted resource
php3_plist_delete(id) delete the resource with the specified id
php3_plist_find(id,*type) returns the pointer of the resource with the specified id, updates 'type' to the resource's type
However, it's more than likely that these functions would prove
to be useless for you when trying to implement a persistent module.
Typically, one would want to use the fact that the persistent resource
list is really a hash table. For instance, in the MySQL/mSQL modules,
when there's a pconnect() call (persistent connect), the function
builds a string out of the host/user/passwd that were passed to the
function, and hashes the SQL link with this string as a key. The next
time someone calls a pconnect() with the same host/user/passwd, the
same key would be generated, and the function would find the SQL link
in the persistent list.
Until further documented, you should look at mysql.c or msql.c to
see how one should use the plist's hash table abilities.
One important thing to note: resources going into the persistent
resource list must *NOT* be allocated with PHP's memory manager, i.e.,
they should NOT be created with emalloc(), estrdup(), etc. Rather,
one should use the regular malloc(), strdup(), etc. The reason for
this is simple - at the end of the request (end of the hit), every
memory chunk that was allocated using PHP's memory manager is deleted.
Since the persistent list isn't supposed to be erased at the end
of a request, one mustn't use PHP's memory manager for allocating
resources that go to it.
Shutting down persistent resources:
When you register resource that's going to be in the persistent list,
you should add destructors to it both in the non-persistent list
and in the persistent list.
The destructor in the non-persistent list destructor shouldn't do anything.
The one in the persistent list destructor should properly free any
resources obtained by that type (e.g. memory, SQL links, etc). Just like
with the non-persistent resources, you *MUST* add destructors for every
resource, even it requires no destructotion and the destructor would
be empty.
Remember, since emalloc() and friends aren't to be used in conjunction
with the persistent list, you mustn't use efree() here either.
-------------------
11. Adding runtime configuration directives
Many of the features of PHP3 can be configured at runtime. These
configuration directives can appear in either the designated php3.ini
file, or in the case of the Apache module version in the Apache .conf
files. The advantage of having them in the Apache .conf files is that
they can be configured on a per-directory basis. This means that one
directory may have a certain safemodeexecdir for example, while another
directory may have another. This configuration granularity is especially
handy when a server supports multiple virtual hosts.
The steps required to add a new directive:
1. Add directive to php3_ini_structure struct in mod_php3.h.
2. In main.c, edit the php3_module_startup function and add the
appropriate cfg_get_string() or cfg_get_long() call.
3. Add the directive, restrictions and a comment to the php3_commands
structure in mod_php3.c. Note the restrictions part. RSRC_CONF are
directives that can only be present in the actual Apache .conf files.
Any OR_OPTIONS directives can be present anywhere, include normal
.htaccess files.
4. In either php3take1handler() or php3flaghandler() add the appropriate
entry for your directive.
5. In the configuration section of the _php3_info() function in
functions/info.c you need to add your new directive.
6. And last, you of course have to use your new directive somewhere.
It will be addressable as php3_ini.directive

705
bison.simple Normal file
View file

@ -0,0 +1,705 @@
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
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, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C. */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
#pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#ifdef __cplusplus
extern "C" {
void *alloca (unsigned int);
};
#else /* not __cplusplus */
void *alloca ();
#endif /* not __cplusplus */
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc. */
#endif /* not GNU C. */
#endif /* alloca not defined. */
/* This is the parser code that is written into each bison parser
when the %semantic_parser declaration is not specified in the grammar.
It was written by Richard Stallman by simplifying the hairy parser
used when %semantic_parser is specified. */
/* Note: there must be only one dollar sign in this file.
It is replaced by the list of actions, each action
as one case of the switch. */
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
#define YYACCEPT return(0)
#define YYABORT return(1)
#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror.
This remains here temporarily to ease the
transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(token, value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ yychar = (token), yylval = (value); \
yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
#ifndef YYPURE
#define YYLEX yylex()
#endif
#ifdef YYPURE
#ifdef YYLSP_NEEDED
#ifdef YYLEX_PARAM
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
#else
#define YYLEX yylex(&yylval, &yylloc)
#endif
#else /* not YYLSP_NEEDED */
#ifdef YYLEX_PARAM
#define YYLEX yylex(&yylval, YYLEX_PARAM)
#else
#ifdef PHP3_THREAD_SAFE /* PHP 3 Specific useage */
#define YYLEX yylex(&yylval,php3_globals,php_gbl)
#else
#define YYLEX yylex(&yylval)
#endif /* not using tls */
#endif
#endif /* not YYLSP_NEEDED */
#endif
/* If nonreentrant, generate the variables here */
#ifndef YYPURE
int yychar; /* the lookahead symbol */
YYSTYPE yylval; /* the semantic value of the */
/* lookahead symbol */
#ifdef YYLSP_NEEDED
YYLTYPE yylloc; /* location data for the lookahead */
/* symbol */
#endif
int yynerrs; /* number of parse errors so far */
#endif /* not YYPURE */
#if YYDEBUG != 0
int yydebug; /* nonzero means print parse trace */
/* Since this is uninitialized, it does not stop multiple parsers
from coexisting. */
#endif
/* YYINITDEPTH indicates the initial size of the parser's stacks */
#ifndef YYINITDEPTH
#define YYINITDEPTH 200
#endif
/* YYMAXDEPTH is the maximum size the stacks can grow to
(effective only if the built-in stack extension method is used). */
#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif
/* Prevent warning if -Wstrict-prototypes. */
#ifdef __GNUC__
/* int yyparse (void); */
#endif
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
#else /* not GNU C or C++ */
#ifndef __cplusplus
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
static void
__yy_memcpy (to, from, count)
char *to;
char *from;
int count;
{
register char *f = from;
register char *t = to;
register int i = count;
while (i-- > 0)
*t++ = *f++;
}
#else /* __cplusplus */
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
static void
__yy_memcpy (char *to, char *from, int count)
{
register char *f = from;
register char *t = to;
register int i = count;
while (i-- > 0)
*t++ = *f++;
}
#endif
#endif
#line 196 "bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
It should actually point to an object.
Grammar actions can access the variable by casting it
to the proper pointer type. */
#ifdef YYPARSE_PARAM
#ifdef __cplusplus
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
#define YYPARSE_PARAM_DECL
#else /* not __cplusplus */
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
#endif /* not __cplusplus */
#else /* not YYPARSE_PARAM */
#define YYPARSE_PARAM_ARG
#define YYPARSE_PARAM_DECL
#endif /* not YYPARSE_PARAM */
#ifndef TLS_VARS
#define TLS_VARS
#endif
#ifndef YY_TLS_VARS
#define YY_TLS_VARS
#endif
int
yyparse(YYPARSE_PARAM_ARG)
YYPARSE_PARAM_DECL
{
register int yystate;
register int yyn;
register short *yyssp;
register YYSTYPE *yyvsp;
int yyerrstatus; /* number of tokens to shift before error messages enabled */
int yychar1 = 0; /* lookahead token as an internal (translated) token number */
short yyssa[YYINITDEPTH]; /* the state stack */
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
#ifdef YYLSP_NEEDED
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
YYLTYPE *yyls = yylsa;
YYLTYPE *yylsp;
#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
#else
#define YYPOPSTACK (yyvsp--, yyssp--)
#endif
int yystacksize = YYINITDEPTH;
#ifdef YYPURE
int yychar;
YYSTYPE yylval;
int yynerrs;
#ifdef YYLSP_NEEDED
YYLTYPE yylloc;
#endif
#endif
YYSTYPE yyval; /* the variable used to return */
/* semantic values from the action */
/* routines */
int yylen;
YY_TLS_VARS;
TLS_VARS;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Starting parse\n");
#endif
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
yyssp = yyss - 1;
yyvsp = yyvs;
#ifdef YYLSP_NEEDED
yylsp = yyls;
#endif
/* Push a new state, which is found in yystate . */
/* In all cases, when you get here, the value and location stacks
have just been pushed. so pushing a state here evens the stacks. */
yynewstate:
*++yyssp = yystate;
if (yyssp >= yyss + yystacksize - 1)
{
/* Give user a chance to reallocate the stack */
/* Use copies of these so that the &'s don't force the real ones into memory. */
YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss;
#ifdef YYLSP_NEEDED
YYLTYPE *yyls1 = yyls;
#endif
/* Get the current used size of the three stacks, in elements. */
int size = yyssp - yyss + 1;
#ifdef yyoverflow
/* Each stack pointer address is followed by the size of
the data in use in that stack, in bytes. */
#ifdef YYLSP_NEEDED
/* This used to be a conditional around just the two extra args,
but that might be undefined if yyoverflow is a macro. */
yyoverflow("parser stack overflow",
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
&yyls1, size * sizeof (*yylsp),
&yystacksize);
#else
yyoverflow("parser stack overflow",
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
&yystacksize);
#endif
yyss = yyss1; yyvs = yyvs1;
#ifdef YYLSP_NEEDED
yyls = yyls1;
#endif
#else /* no yyoverflow */
/* Extend the stack our own way. */
if (yystacksize >= YYMAXDEPTH)
{
yyerror("parser stack overflow");
return 2;
}
yystacksize *= 2;
if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
__yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
__yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
__yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
#endif
#endif /* no yyoverflow */
yyssp = yyss + size - 1;
yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED
yylsp = yyls + size - 1;
#endif
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif
if (yyssp >= yyss + yystacksize - 1)
YYABORT;
}
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Entering state %d\n", yystate);
#endif
goto yybackup;
yybackup:
/* Do appropriate processing given the current state. */
/* Read a lookahead token if we need one and don't already have one. */
/* yyresume: */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* yychar is either YYEMPTY or YYEOF
or a valid token in external form. */
if (yychar == YYEMPTY)
{
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Reading a token: ");
#endif
yychar = YYLEX;
}
/* Convert token to internal form (in yychar1) for indexing tables with */
if (yychar <= 0) /* This means end of input. */
{
yychar1 = 0;
yychar = YYEOF; /* Don't call YYLEX any more */
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Now at end of input.\n");
#endif
}
else
{
yychar1 = YYTRANSLATE(yychar);
#if YYDEBUG != 0
if (yydebug)
{
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
/* Give the individual parser a way to print the precise meaning
of a token, for further debugging info. */
#ifdef YYPRINT
YYPRINT (stderr, yychar, yylval);
#endif
fprintf (stderr, ")\n");
}
#endif
}
yyn += yychar1;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
goto yydefault;
yyn = yytable[yyn];
/* yyn is what to do for this token type in this state.
Negative => reduce, -yyn is rule number.
Positive => shift, yyn is new state.
New state is final state => don't bother to shift,
just return success.
0, or most negative number => error. */
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrlab;
if (yyn == YYFINAL)
YYACCEPT;
/* Shift the lookahead token. */
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
yychar = YYEMPTY;
*++yyvsp = yylval;
#ifdef YYLSP_NEEDED
*++yylsp = yylloc;
#endif
/* count tokens shifted since error; after three, turn off error status. */
if (yyerrstatus) yyerrstatus--;
yystate = yyn;
goto yynewstate;
/* Do the default action for the current state. */
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
/* Do a reduction. yyn is the number of a rule to reduce with. */
yyreduce:
yylen = yyr2[yyn];
if (yylen > 0)
yyval = yyvsp[1-yylen]; /* implement default value of the action */
#if YYDEBUG != 0
if (yydebug)
{
int i;
fprintf (stderr, "Reducing via rule %d (line %d), ",
yyn, yyrline[yyn]);
/* Print the symbols being reduced, and their result. */
for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
fprintf (stderr, "%s ", yytname[yyrhs[i]]);
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
}
#endif
$ /* the action file gets copied in in place of this dollarsign */
#line 498 "bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
#ifdef YYLSP_NEEDED
yylsp -= yylen;
#endif
#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, "state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
*++yyvsp = yyval;
#ifdef YYLSP_NEEDED
yylsp++;
if (yylen == 0)
{
yylsp->first_line = yylloc.first_line;
yylsp->first_column = yylloc.first_column;
yylsp->last_line = (yylsp-1)->last_line;
yylsp->last_column = (yylsp-1)->last_column;
yylsp->text = 0;
}
else
{
yylsp->last_line = (yylsp+yylen-1)->last_line;
yylsp->last_column = (yylsp+yylen-1)->last_column;
}
#endif
/* Now "shift" the result of the reduction.
Determine what state that goes to,
based on the state we popped back to
and the rule number reduced by. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTBASE];
goto yynewstate;
yyerrlab: /* here on detecting error */
if (! yyerrstatus)
/* If not already recovering from an error, report this error. */
{
++yynerrs;
#ifdef YYERROR_VERBOSE
yyn = yypact[yystate];
if (yyn > YYFLAG && yyn < YYLAST)
{
int size = 0;
char *msg;
int x, count;
count = 0;
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
size += strlen(yytname[x]) + 15, count++;
msg = (char *) malloc(size + 15);
if (msg != 0)
{
strcpy(msg, "parse error");
if (count < 5)
{
count = 0;
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
{
strcat(msg, count == 0 ? ", expecting `" : " or `");
strcat(msg, yytname[x]);
strcat(msg, "'");
count++;
}
}
yyerror(msg);
free(msg);
}
else
yyerror ("parse error; also virtual memory exceeded");
}
else
#endif /* YYERROR_VERBOSE */
yyerror("parse error");
}
goto yyerrlab1;
yyerrlab1: /* here on error raised explicitly by an action */
if (yyerrstatus == 3)
{
/* if just tried and failed to reuse lookahead token after an error, discard it. */
/* return failure if at end of input */
if (yychar == YYEOF)
YYABORT;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif
yychar = YYEMPTY;
}
/* Else will try to reuse lookahead token
after shifting the error token. */
yyerrstatus = 3; /* Each real token shifted decrements this */
goto yyerrhandle;
yyerrdefault: /* current state does not do anything special for the error token. */
#if 0
/* This is wrong; only states that explicitly want error tokens
should shift them. */
yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
if (yyn) goto yydefault;
#endif
yyerrpop: /* pop the current state because it cannot handle the error token */
if (yyssp == yyss) YYABORT;
yyvsp--;
yystate = *--yyssp;
#ifdef YYLSP_NEEDED
yylsp--;
#endif
#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, "Error: state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
yyerrhandle:
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yyerrdefault;
yyn += YYTERROR;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
goto yyerrdefault;
yyn = yytable[yyn];
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrpop;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrpop;
if (yyn == YYFINAL)
YYACCEPT;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Shifting error token, ");
#endif
*++yyvsp = yylval;
#ifdef YYLSP_NEEDED
*++yylsp = yylloc;
#endif
yystate = yyn;
goto yynewstate;
}

85
build-defs.h.in Normal file
View file

@ -0,0 +1,85 @@
/* -*- 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 "@ADA_INCLUDE@"
#define PHP_ADA_LFLAGS "@ADA_LFLAGS@"
#define PHP_ADA_LIBS "@ADA_LIBS@"
#define PHP_APACHE_INCLUDE "@APACHE_INCLUDE@"
#define PHP_APACHE_TARGET "@APACHE_TARGET@"
#define PHP_FHTTPD_INCLUDE "@FHTTPD_INCLUDE@"
#define PHP_FHTTPD_LIB "@FHTTPD_LIB@"
#define PHP_FHTTPD_TARGET "@FHTTPD_TARGET@"
#define PHP_BINNAME "@BINNAME@"
#define PHP_CFLAGS "@CFLAGS@"
#define PHP_DBASE_LIB "@DBASE_LIB@"
#define PHP_DEBUG "@PHP_DEBUG@"
#define PHP_GDBM_INCLUDE "@GDBM_INCLUDE@"
#define PHP_HSREGEX "@HSREGEX@"
#define PHP_IBASE_INCLUDE "@IBASE_INCLUDE@"
#define PHP_IBASE_LFLAGS "@IBASE_LFLAGS@"
#define PHP_IBASE_LIBS "@IBASE_LIBS@"
#define PHP_IFX_INCLUDE "@IFX_INCLUDE@"
#define PHP_IFX_LFLAGS "@IFX_LFLAGS@"
#define PHP_IFX_LIBS "@IFX_LIBS@"
#define PHP_INSTALL_IT "@INSTALL_IT@"
#define PHP_IODBC_INCLUDE "@IODBC_INCLUDE@"
#define PHP_IODBC_LFLAGS "@IODBC_LFLAGS@"
#define PHP_IODBC_LIBS "@IODBC_LIBS@"
#define PHP_MSQL_INCLUDE "@MSQL_INCLUDE@"
#define PHP_MSQL_LFLAGS "@MSQL_LFLAGS@"
#define PHP_MSQL_LIBS "@MSQL_LIBS@"
#define PHP_MYSQL_INCLUDE "@MYSQL_INCLUDE@"
#define PHP_MYSQL_LFLAGS "@MYSQL_LFLAGS@"
#define PHP_MYSQL_LIBS "@MYSQL_LIBS@"
#define PHP_ORACLE_HOME "@ORACLE_HOME@"
#define PHP_ORACLE_INCLUDE "@ORACLE_INCLUDE@"
#define PHP_ORACLE_LFLAGS "@ORACLE_LFLAGS@"
#define PHP_ORACLE_LIBS "@ORACLE_LIBS@"
#define PHP_ORACLE_SHLIBS "@ORACLE_SHLIBS@"
#define PHP_ORACLE_STLIBS "@ORACLE_STLIBS@"
#define PHP_ORACLE_VERSION "@ORACLE_VERSION@"
#define PHP_PGSQL_INCLUDE "@PGSQL_INCLUDE@"
#define PHP_PGSQL_LFLAGS "@PGSQL_LFLAGS@"
#define PHP_PGSQL_LIBS "@PGSQL_LIBS@"
#define PHP_PROG_SENDMAIL "@PROG_SENDMAIL@"
#define PHP_REGEX_LIB "@REGEX_LIB@"
#define PHP_SOLID_INCLUDE "@SOLID_INCLUDE@"
#define PHP_SOLID_LIBS "@SOLID_LIBS@"
#define PHP_EMPRESS_INCLUDE "@EMPRESS_INCLUDE@"
#define PHP_EMPRESS_LIBS "@EMPRESS_LIBS@"
#define PHP_SYBASE_INCLUDE "@SYBASE_INCLUDE@"
#define PHP_SYBASE_LFLAGS "@SYBASE_LFLAGS@"
#define PHP_SYBASE_LIBS "@SYBASE_LIBS@"
#define PHP_DBM_TYPE "@DBM_TYPE@"
#define PHP_DBM_LIB "@DBM_LIB@"
#define PHP_LDAP_LFLAGS "@LDAP_LFLAGS@"
#define PHP_LDAP_INCLUDE "@LDAP_INCLUDE@"
#define PHP_LDAP_LIBS "@LDAP_LIBS@"
#define PHP_VELOCIS_INCLUDE "@VELOCIS_INCLUDE@"
#define PHP_VELOCIS_LIBS "@VELOCIS_LIBS@"

244
calendar.mak Normal file
View file

@ -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

743
config.guess vendored Normal file
View file

@ -0,0 +1,743 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Written by Per Bothner <bothner@cygnus.com>.
# The master version of this file is at the FSF in /home/gd/gnu/lib.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit system type (host/target name).
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
alpha:OSF1:*:*)
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-cbm-sysv4
exit 0;;
amiga:NetBSD:*:*)
echo m68k-cbm-netbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arc64:OpenBSD:*:*)
echo mips64el-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
hkmips:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sgi:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
SR2?01:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit 0;;
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit 0 ;;
NILE:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
i86pc:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
atari*:NetBSD:*:*)
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
atari*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:NetBSD:*:*)
echo m68k-sun-netbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
2020:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
sed 's/^ //' << EOF >dummy.c
int main (argc, argv) int argc; char **argv; {
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
${CC-cc} dummy.c -o dummy \
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit 0 ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit 0 ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else echo i586-dg-dgux${UNAME_RELEASE}
fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit 0 ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit 0 ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit 0 ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit 0 ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit 0 ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i?86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
sed 's/^ //' << EOF >dummy.c
#include <sys/systemcfg.h>
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit 0 ;;
*:AIX:*:4)
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=4.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit 0 ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit 0 ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit 0 ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
9000/[3478]??:HP-UX:*:*)
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
9000/8?? ) HP_ARCH=hppa1.0 ;;
esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
sed 's/^ //' << EOF >dummy.c
#include <unistd.h>
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit 0 ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
i?86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit 0 ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit 0 ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
CRAY*X-MP:*:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
exit 0 ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
F300:UNIX_System_V:*:*)
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
F301:UNIX_System_V:*:*)
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
i?86:BSD/386:*:* | *:BSD/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:CYGWIN*:*)
echo i386-pc-cygwin32
exit 0 ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin32
exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us.
ld_help_string=`ld --help 2>&1`
if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
echo "powerpc-unknown-linux-gnu" ; exit 0
elif test "${UNAME_MACHINE}" = "alpha" ; then
echo alpha-unknown-linux-gnu ; exit 0
elif test "${UNAME_MACHINE}" = "sparc" ; then
echo sparc-unknown-linux-gnu ; exit 0
elif test "${UNAME_MACHINE}" = "mips" ; then
cat >dummy.c <<EOF
main(argc, argv)
int argc;
char *argv[];
{
#ifdef __MIPSEB__
printf ("%s-unknown-linux-gnu\n", argv[1]);
#endif
#ifdef __MIPSEL__
printf ("%sel-unknown-linux-gnu\n", argv[1]);
#endif
return 0;
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
else
# Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
# useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
test ! -d /usr/lib/ldscripts/. \
&& echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
# Determine whether the default compiler is a.out or elf
cat >dummy.c <<EOF
main(argc, argv)
int argc;
char *argv[];
{
#ifdef __ELF__
printf ("%s-pc-linux-gnu\n", argv[1]);
#else
printf ("%s-pc-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
# are messed up and put the nodename in both sysname and nodename.
i?86:DYNIX/ptx:4*:*)
echo i386-sequent-sysv4
exit 0 ;;
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
fi
exit 0 ;;
i?86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit 0 ;;
paragon:*:*:*)
echo i860-intel-osf1
exit 0 ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit 0 ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
m68*:LynxOS:2.*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i?86:LynxOS:2.*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit 0 ;;
BS2000:POSIX-BC:*:*) # EBCDIC based mainframe with POSIX subsystem
echo bs2000-siemens-sysv4
exit 0 ;;
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit 0 ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
cat >dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
#if !defined (ultrix)
printf ("vax-dec-bsd\n"); exit (0);
#else
printf ("vax-dec-ultrix\n"); exit (0);
#endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit 0 ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
c34*)
echo c34-convex-bsd
exit 0 ;;
c38*)
echo c38-convex-bsd
exit 0 ;;
c4*)
echo c4-convex-bsd
exit 0 ;;
esac
fi
#echo '(Unable to guess system type)' 1>&2
exit 1

489
config.h.in Normal file
View file

@ -0,0 +1,489 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if your struct stat has st_blksize. */
#undef HAVE_ST_BLKSIZE
/* Define if your struct stat has st_blocks. */
#undef HAVE_ST_BLOCKS
/* Define if your struct stat has st_rdev. */
#undef HAVE_ST_RDEV
/* Define if your struct tm has tm_zone. */
#undef HAVE_TM_ZONE
/* Define if you don't have tm_zone but do have the external array
tzname. */
#undef HAVE_TZNAME
/* Define if utime(file, NULL) sets file's timestamp to the present. */
#undef HAVE_UTIME_NULL
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#undef STACK_DIRECTION
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* This is the default configuration file to read */
#define CONFIGURATION_FILE_PATH "php3.ini"
#define USE_CONFIG_FILE 1
/* 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
/* crypt capability checks */
#undef PHP3_STD_DES_CRYPT
#undef PHP3_EXT_DES_CRYPT
#undef PHP3_MD5_CRYPT
#undef PHP3_BLOWFISH_CRYPT
/* Define if you have the resolv library (-lresolv). */
#define HAVE_LIBRESOLV 0
/* Define if you have the gd library (-lgd). */
#define HAVE_LIBGD 0
/* Define if you have the zlib library */
#define HAVE_ZLIB 0
/* Define if you have the gd version 1.3 library (-lgd). */
#define HAVE_LIBGD13 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 if you an ndbm compatible library (-ldbm). */
#define NDBM 0
/* Define if you have the gdbm library (-lgdbm). */
#define GDBM 0
/* Define both of these if you want the bundled REGEX library */
#define REGEX 0
#define HSREGEX 0
/* Define if you want Solid database support */
#define HAVE_SOLID 0
/* Define if you want to use the supplied dbase library */
#define DBASE 0
/* Define if you want Hyperwave support */
#define HYPERWAVE 0
/* Define if you have the Oracle database client libraries */
#define HAVE_ORACLE 0
/* Define if you have the Oracle version 8 database client libraries */
#define HAVE_OCI8 0
/* Define if you want to use the iODBC database driver */
#define HAVE_IODBC 0
/* Define if you want to use the OpenLink ODBC database driver */
#define HAVE_OPENLINK 0
/* Define if you have the AdabasD client libraries */
#define HAVE_ADABAS 0
/* Define if you want the LDAP directory interface */
#define HAVE_LDAP 0
/* Define if you want the SNMP interface */
#define HAVE_SNMP 0
/* Define if you want the IMAP directory interface */
#define HAVE_IMAP 0
/* Define if you want to use a custom ODBC database driver */
#define HAVE_CODBC 0
/* Define to use the unified ODBC interface */
#define HAVE_UODBC 0
/* Define if you have libdl (used for dynamic linking) */
#define HAVE_LIBDL 0
/* Define if you have libdnet_stub (used for Sybase support) */
#define HAVE_LIBDNET_STUB 0
/* Define if you have and want to use libcrypt */
#define HAVE_LIBCRYPT 0
/* Define if you have and want to use libnsl */
#define HAVE_LIBNSL 0
/* Define if you have and want to use libsocket */
#define HAVE_LIBSOCKET 0
/* 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 HAVE_EMPRESS
#define HAVE_EMPRESS 0
#endif
#define HAVE_SYBASE 0
#define HAVE_SYBASE_CT 0
#ifndef HAVE_MYSQL
#define HAVE_MYSQL 0
#endif
#ifndef HAVE_MSQL
#define HAVE_MSQL 0
#endif
#ifndef HAVE_PGSQL
#define HAVE_PGSQL 0
#endif
#ifndef HAVE_VELOCIS
#define HAVE_VELOCIS 0
#endif
#ifndef HAVE_IFX
#define HAVE_IFX 0
#endif
#ifndef HAVE_IFX_IUS
#define HAVE_IFX_IUS 0
#endif
#ifndef IFX_VERSION
#define IFX_VERSION 0
#endif
#ifndef HAVE_IBASE
#define HAVE_IBASE 0
#endif
#ifndef HAVE_PQCMDTUPLES
#define HAVE_PQCMDTUPLES 0
#endif
#define MSQL1 0
#define HAVE_FILEPRO 0
#define HAVE_SOLID 0
#define DEBUG 0
/* Define if you want to enable bc style precision math support */
#define WITH_BCMATH 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 to enable memory limit support */
#define MEMORY_LIMIT 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 want System V semaphore support.
*/
#define HAVE_SYSVSEM 0
/* Define if you have union semun.
*/
#define HAVE_SEMUN 0
/* Define if you want System V shared memory support.
*/
#define HAVE_SYSVSHM 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 if you have the expat (XML Parser Toolkit) library */
#define HAVE_LIBEXPAT 0
/* Define if you have the pdflib library */
#define HAVE_PDFLIB 0
/* Define if you have the fdftk library */
#define HAVE_FDFLIB 0
/* Define to compile with mod_dav support */
#define HAVE_MOD_DAV 0
/* Define if you have the crypt function. */
#undef HAVE_CRYPT
/* Define if you have the cuserid function. */
#undef HAVE_CUSERID
/* Define if you have the flock function. */
#undef HAVE_FLOCK
/* Define if you have the gcvt function. */
#undef HAVE_GCVT
/* Define if you have the getlogin function. */
#undef HAVE_GETLOGIN
/* Define if you have the getopt function. */
#undef HAVE_GETOPT
/* Define if you have the gettimeofday function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the link function. */
#undef HAVE_LINK
/* Define if you have the lockf function. */
#undef HAVE_LOCKF
/* Define if you have the lrand48 function. */
#undef HAVE_LRAND48
/* Define if you have the memcpy function. */
#undef HAVE_MEMCPY
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the random function. */
#undef HAVE_RANDOM
/* Define if you have the regcomp function. */
#undef HAVE_REGCOMP
/* Define if you have the rint function. */
#undef HAVE_RINT
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
/* Define if you have the setsockopt function. */
#undef HAVE_SETSOCKOPT
/* Define if you have the setvbuf function. */
#undef HAVE_SETVBUF
/* Define if you have the snprintf function. */
#undef HAVE_SNPRINTF
/* Define if you have the srand48 function. */
#undef HAVE_SRAND48
/* Define if you have the srandom function. */
#undef HAVE_SRANDOM
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
/* Define if you have the strftime function. */
#undef HAVE_STRFTIME
/* Define if you have the strstr function. */
#undef HAVE_STRSTR
/* Define if you have the symlink function. */
#undef HAVE_SYMLINK
/* Define if you have the tempnam function. */
#undef HAVE_TEMPNAM
/* Define if you have the tzset function. */
#undef HAVE_TZSET
/* Define if you have the unsetenv function. */
#undef HAVE_UNSETENV
/* Define if you have the usleep function. */
#undef HAVE_USLEEP
/* Define if you have the utime function. */
#undef HAVE_UTIME
/* Define if you have the vsnprintf function. */
#undef HAVE_VSNPRINTF
/* Define if you have the <crypt.h> header file. */
#undef HAVE_CRYPT_H
/* Define if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* Define if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define if you have the <errmsg.h> header file. */
#undef HAVE_ERRMSG_H
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <grp.h> header file. */
#undef HAVE_GRP_H
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the <mysql.h> header file. */
#undef HAVE_MYSQL_H
/* Define if you have the <ndir.h> header file. */
#undef HAVE_NDIR_H
/* Define if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <sys/dir.h> header file. */
#undef HAVE_SYS_DIR_H
/* Define if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define if you have the <sys/ndir.h> header file. */
#undef HAVE_SYS_NDIR_H
/* Define if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have the <sys/varargs.h> header file. */
#undef HAVE_SYS_VARARGS_H
/* Define if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
/* Define if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <unix.h> header file. */
#undef HAVE_UNIX_H
/* Define if you have the gd library (-lgd). */
#undef HAVE_LIBGD
/* Define if you have the m library (-lm). */
#undef HAVE_LIBM
/* Define if you have the resolv library (-lresolv). */
#undef HAVE_LIBRESOLV
/* Define if you have the ttf library (-lttf). */
#undef HAVE_LIBTTF

939
config.sub vendored Normal file
View file

@ -0,0 +1,939 @@
#! /bin/sh
# Configuration validation subroutine script, version 1.1.
# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
if [ x$1 = x ]
then
echo Configuration name missing. 1>&2
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
echo "or $0 ALIAS" 1>&2
echo where ALIAS is a recognized configuration type. 1>&2
exit 1
fi
# First pass through any local machine types.
case $1 in
*local*)
echo $1
exit 0
;;
*)
;;
esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
linux-gnu*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
;;
esac
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple)
os=
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco5)
os=sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*)
os=-lynxos
;;
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
-psos*)
os=-psos
;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arm \
| arme[lb] | pyramid | mn10300 \
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
| alpha | we32k | ns16k | clipper | i370 | sh \
| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
| pdp11 | mips64el | mips64orion | mips64orionel \
| sparc | sparclet | sparclite | sparc64)
basic_machine=$basic_machine-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i[3456]86)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \
| m88k-* | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
| hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
| mips64el-* | mips64orion-* | mips64orionel-* | f301-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-cbm
;;
amigados)
basic_machine=m68k-cbm
os=-amigados
;;
amigaunix | amix)
basic_machine=m68k-cbm
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
aux)
basic_machine=m68k-apple
os=-aux
;;
balance)
basic_machine=ns32k-sequent
os=-dynix
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
;;
convex-c2)
basic_machine=c2-convex
os=-bsd
;;
convex-c32)
basic_machine=c32-convex
os=-bsd
;;
convex-c34)
basic_machine=c34-convex
os=-bsd
;;
convex-c38)
basic_machine=c38-convex
os=-bsd
;;
cray | ymp)
basic_machine=ymp-cray
os=-unicos
;;
cray2)
basic_machine=cray2-cray
os=-unicos
;;
[ctj]90-cray)
basic_machine=c90-cray
os=-unicos
;;
crds | unos)
basic_machine=m68k-crds
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
;;
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
basic_machine=m68k-bull
os=-sysv3
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;;
encore | umax | mmax)
basic_machine=ns32k-encore
;;
fx2800)
basic_machine=i860-alliant
;;
genix)
basic_machine=ns32k-ns
;;
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
h3050r* | hiux*)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
;;
hp300-*)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=-bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=-hpux
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppa-next)
os=-nextstep3
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
os=-mvs
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i[3456]86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i[3456]86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i[3456]86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i[3456]86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
-irix*)
;;
*)
os=-irix4
;;
esac
;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
miniframe)
basic_machine=m68000-convergent
;;
mipsel*-linux*)
basic_machine=mipsel-unknown
os=-linux
;;
mips*-linux*)
basic_machine=mips-unknown
os=-linux
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
;;
news1000)
basic_machine=m68030-sony
os=-newsos
;;
news-3600 | risc-news)
basic_machine=mips-sony
os=-newsos
;;
next | m*-next )
basic_machine=m68k-next
case $os in
-nextstep* )
;;
-ns2*)
os=-nextstep2
;;
*)
os=-nextstep3
;;
esac
;;
nh3000)
basic_machine=m68k-harris
os=-cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=-cxux
;;
nindy960)
basic_machine=i960-intel
os=-nindy
;;
np1)
basic_machine=np1-gould
;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
paragon)
basic_machine=i860-intel
os=-osf
;;
pbd)
basic_machine=sparc-tti
;;
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pentium | p5)
basic_machine=i586-intel
;;
pentiumpro | p6)
basic_machine=i686-intel
;;
pentium-* | p5-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
k5)
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
basic_machine=i586-amd
;;
nexen)
# We don't have specific support for Nexgen yet, so just call it a Pentium
basic_machine=i586-nexgen
;;
pn)
basic_machine=pn-gould
;;
power) basic_machine=rs6000-ibm
;;
ppc) basic_machine=powerpc-unknown
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
sequent)
basic_machine=i386-sequent
;;
sh)
basic_machine=sh-hitachi
os=-hms
;;
sps7)
basic_machine=m68k-bull
os=-sysv2
;;
spur)
basic_machine=spur-unknown
;;
sun2)
basic_machine=m68000-sun
;;
sun2os3)
basic_machine=m68000-sun
os=-sunos3
;;
sun2os4)
basic_machine=m68000-sun
os=-sunos4
;;
sun3os3)
basic_machine=m68k-sun
os=-sunos3
;;
sun3os4)
basic_machine=m68k-sun
os=-sunos4
;;
sun4os3)
basic_machine=sparc-sun
os=-sunos3
;;
sun4os4)
basic_machine=sparc-sun
os=-sunos4
;;
sun4sol2)
basic_machine=sparc-sun
os=-solaris2
;;
sun3 | sun3-*)
basic_machine=m68k-sun
;;
sun4)
basic_machine=sparc-sun
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
symmetry)
basic_machine=i386-sequent
os=-dynix
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
udi29k)
basic_machine=a29k-amd
os=-udi
;;
ultra3)
basic_machine=a29k-nyu
os=-sym1
;;
vaxv)
basic_machine=vax-dec
os=-sysv
;;
vms)
basic_machine=vax-dec
os=-vms
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
;;
vxworks68)
basic_machine=m68k-wrs
os=-vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
os=-vxworks
;;
xmp)
basic_machine=xmp-cray
os=-unicos
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
none)
basic_machine=none-none
os=-none
;;
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
mips)
if [ x$os = x-linux ]; then
basic_machine=mips-unknown
else
basic_machine=mips-mips
fi
;;
romp)
basic_machine=romp-ibm
;;
rs6000)
basic_machine=rs6000-ibm
;;
vax)
basic_machine=vax-dec
;;
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;;
sparc)
basic_machine=sparc-sun
;;
cydra)
basic_machine=cydra-cydrome
;;
orion)
basic_machine=orion-highlevel
;;
orion105)
basic_machine=clipper-highlevel
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
;;
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
;;
*)
;;
esac
# Decode manufacturer-specific aliases for certain operating systems.
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
-solaris)
os=-solaris2
;;
-unixware* | svr4*)
os=-sysv4
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -linux-gnu* | -uxpv*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
;;
-osfrose*)
os=-osfrose
;;
-osf*)
os=-osf
;;
-utek*)
os=-bsd
;;
-dynix*)
os=-bsd
;;
-acis*)
os=-aos
;;
-ctix* | -uts*)
os=-sysv
;;
-ns2 )
os=-nextstep2
;;
# Preserve the version number of sinix5.
-sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
;;
-sinix*)
os=-sysv4
;;
-triton*)
os=-sysv3
;;
-oss*)
os=-sysv3
;;
-svr4)
os=-sysv4
;;
-svr3)
os=-sysv3
;;
-sysvr4)
os=-sysv4
;;
# This must come after -sysvr4.
-sysv*)
;;
-xenix)
os=-xenix
;;
-none)
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
exit 1
;;
esac
else
# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.
# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system. Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
case $basic_machine in
*-acorn)
os=-riscix1.2
;;
arm*-semi)
os=-aout
;;
pdp11-*)
os=-none
;;
*-dec | vax-*)
os=-ultrix4.2
;;
m68*-apollo)
os=-domain
;;
i386-sun)
os=-sunos4.0.2
;;
m68000-sun)
os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
sparc-* | *-sun)
os=-sunos4.1.1
;;
*-ibm)
os=-aix
;;
*-hp)
os=-hpux
;;
*-hitachi)
os=-hiux
;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=-sysv
;;
*-cbm)
os=-amigados
;;
*-dg)
os=-dgux
;;
*-dolphin)
os=-sysv3
;;
m68k-ccur)
os=-rtu
;;
m88k-omron*)
os=-luna
;;
*-next )
os=-nextstep
;;
*-sequent)
os=-ptx
;;
*-crds)
os=-unos
;;
*-ns)
os=-genix
;;
i370-*)
os=-mvs
;;
*-next)
os=-nextstep3
;;
*-gould)
os=-sysv
;;
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
os=-irix
;;
*-siemens)
os=-sysv4
;;
*-masscomp)
os=-rtu
;;
f301-fujitsu)
os=-uxpv
;;
*)
os=-none
;;
esac
fi
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
*-unknown)
case $os in
-riscix*)
vendor=acorn
;;
-sunos*)
vendor=sun
;;
-aix*)
vendor=ibm
;;
-hpux*)
vendor=hp
;;
-hiux*)
vendor=hitachi
;;
-unos*)
vendor=crds
;;
-dgux*)
vendor=dg
;;
-luna*)
vendor=omron
;;
-genix*)
vendor=ns
;;
-mvs*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-vxsim* | -vxworks*)
vendor=wrs
;;
-aux*)
vendor=apple
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os

1965
configure.in Normal file

File diff suppressed because it is too large Load diff

46
control_structures.h Normal file
View file

@ -0,0 +1,46 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef _CONTROL_STRUCTURES_H
#define _CONTROL_STRUCTURES_H
#ifndef THREAD_SAFE
extern unsigned int param_index;
extern char *class_name;
extern HashTable *class_symbol_table;
#endif
extern inline void start_display_source(int start_in_php INLINE_TLS);
#endif

204
crypt.mak Normal file
View file

@ -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

62
cvsusers Normal file
View file

@ -0,0 +1,62 @@
CVS login Name Email Works on
andi Andi Gutmans andi@php.net Core + API
jim Jim Winstead jimw@php.net Everything
rasmus Rasmus Lerdorf rasmus@php.net Everything
shane Shane Caraveo shane@php.net WIN32 + API
ssb Stig Bakken stig@php.net Everything
zeev Zeev Suraski zeev@php.net Everything
jaakko Jaakko Hyvatti jaakko@hyvatti.iki.fi Everything
veebert Rex Logan veebert@dimensional.com IMAP
chad Chad Robinson chadr@brttech.com Documentation
myddryn PostgreSQL
wojtek
mitch Mitch Golden Oracle
brian
lr Lachlan Roche lr@www.wwi.com.au MD5
damian
ian
jah Jouni Ahto jah@cultnet.fi Postgres, Informix
adam
amitay Amitay Isaacs amitay@w-o-i.com LDAP
dizzy
mark
guy
jeffhu Jeffrey Hulten jeffh@premier1.net WIN32 + modules(?)
eschmid Egon Schmid eschmid@delos.lf.net Documentation
cslawi Torben Wilson torben@netmill.com Documentation
bwk
eric
tcobb Troy Cobb www
gareth www
willer Steve Willer willer@interlog.com pack
cmv Colin Viebrock cmv@privateworld.com www
soderman
tin
musone Mark Musone musone@afterfive.com IMAP
abelits Alex Belits abelits@phobos.illtel.denver.co.us fhttpd module
ars Ariel Shkedi ars@ziplink.net setup
mag Nikolay P. Romanyuk mag@redcom.ru Raima DB
rse Ralf S. Engelschall rse@engelschall.com Apache configuration
sr Stefan Roehrich sr@linux.de zlib module
owl Igor Kovalenko owl@infomarket.ru QNX support
pcurtis Paul Curtis pcurtis@netscape.com NSAPI work (??)
lynch Richard Lynch lynch@lscorp.com Documentation
steffann Sander Steffann steffann@nederland.net Safe Mode
wdiestel Wolfram Diestel wdiestel@debis.com Oracle WebServer cartridge
fmk Frank M. Kromann fmk@businessnet.dk Direct MS-SQL, NaVision, Lotus Notes
steinm Uwe Steinmann Uwe.Steinmann@fernuni-hagen.de Hyperwave Module
danny Danny Heijl Danny.Heijl@cevi.be Informix
kara Andreas Karajannis Andreas.Karajannis@gmd.de ODBC, Oracle
nyenyon Christian Cartus chc@idgruppe.de Informix
kk Kristian Köhntopp kk@shonline.de Documentation
ted Ted Rolle ted.rolle@usa.net Documentation
holger Holger Zimmermann zimpel@t-online.de Pi3Web support
sgk Shigeru Kanemoto sgk@happysize.co.jp Japanese language support
jimjag Jim Jagielski jim@jaguNET.com Misc scraps
martin Martin Kraemer Martin.Kraemer@Mch.SNI.De EBCDIC (BS2000 mainframe port)
kwazy Landon Bradshaw landon@bradshaw.org Documentation
thies Thies C. Arntzen thies@digicol.de implement IPTC reader, maybe some oracle stuff
cschneid Christian Schneider cschneid@relog.ch gzip run-time encoding of output stream
tommay Tom May tom@go2net.com Sybase-CT
swilliam Steve Williams swilliam@empress.com Empress support in unified ODBC
sas Sascha Schumann sas@schell.de Various tweaks

234
dbase.mak Normal file
View file

@ -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

201
dbm.mak Normal file
View file

@ -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

20
ext/ereg/regex/COPYRIGHT Normal file
View file

@ -0,0 +1,20 @@
Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
This software is not subject to any license of the American Telephone
and Telegraph Company or of the Regents of the University of California.
Permission is granted to anyone to use this software for any purpose on
any computer system, and to alter it and redistribute it, subject
to the following restrictions:
1. The author is not responsible for the consequences of use of this
software, no matter how awful, even if they arise from flaws in it.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission. Since few users ever read sources,
credits must appear in the documentation.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software. Since few users
ever read sources, credits must appear in the documentation.
4. This notice may not be removed or altered.

141
ext/ereg/regex/Makefile.in Normal file
View file

@ -0,0 +1,141 @@
SHELL = /bin/sh
srcdir=@srcdir@
VPATH=@srcdir@
CC=@CC@
RANLIB=@RANLIB@
# You probably want to take -DREDEBUG out of CFLAGS, and put something like
# -O in, *after* testing (-DREDEBUG strengthens testing by enabling a lot of
# internal assertion checking and some debugging facilities).
# Put -Dconst= in for a pre-ANSI compiler.
# Do not take -DPOSIX_MISTAKE out.
# REGCFLAGS isn't important to you (it's for my use in some special contexts).
CFLAGS=-I$(srcdir) -DPOSIX_MISTAKE @CFLAGS@
# If you have a pre-ANSI compiler, put -o into MKHFLAGS. If you want
# the Berkeley __P macro, put -b in.
MKHFLAGS=
# Flags for linking but not compiling, if any.
LDFLAGS=@LDFLAGS@
# Extra libraries for linking, if any.
LIBS=
# Internal stuff, should not need changing.
OBJPRODN=regcomp.o regexec.o regerror.o regfree.o
OBJS=$(OBJPRODN) split.o debug.o main.o
H=cclass.h cname.h regex2.h utils.h
REGSRC=regcomp.c regerror.c regexec.c regfree.c
ALLSRC=$(REGSRC) engine.c debug.c main.c split.c
# Stuff that matters only if you're trying to lint the package.
LINTFLAGS=-I. -Dstatic= -Dconst= -DREDEBUG
LINTC=regcomp.c regexec.c regerror.c regfree.c debug.c main.c
JUNKLINT=possible pointer alignment|null effect
# arrangements to build forward-reference header files
.SUFFIXES: .ih .h
.c.ih:
sh $(srcdir)/mkh $(MKHFLAGS) -p $< >$(srcdir)/$@
all lib: libregex.a
libregex.a: $(OBJPRODN)
rm -f libregex.a
ar cr libregex.a $(OBJPRODN)
$(RANLIB) libregex.a
default: r
purge:
rm -f *.o
# stuff to build regex.h
REGEXH=regex.h
REGEXHSRC=regex2.h $(REGSRC)
$(REGEXH): $(REGEXHSRC) mkh
sh ./mkh $(MKHFLAGS) -i _REGEX_H_ $(REGEXHSRC) >regex.h
#cmp -s regex.tmp regex.h 2>/dev/null || cp regex.tmp regex.h
#rm -f regex.tmp
# dependencies
$(OBJPRODN) debug.o: utils.h regex.h regex2.h
regcomp.o: cclass.h cname.h regcomp.ih
regexec.o: engine.c engine.ih
regerror.o: regerror.ih
debug.o: debug.ih
main.o: main.ih
# tester
re: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
# regression test
r: re tests
./re <tests
./re -el <tests
./re -er <tests
# 57 variants, and other stuff, for development use -- not useful to you
ra: ./re tests
-./re <tests
-./re -el <tests
-./re -er <tests
rx: ./re tests
./re -x <tests
./re -x -el <tests
./re -x -er <tests
t: ./re tests
-time ./re <tests
-time ./re -cs <tests
-time ./re -el <tests
-time ./re -cs -el <tests
l: $(LINTC)
lint $(LINTFLAGS) -h $(LINTC) 2>&1 | egrep -v '$(JUNKLINT)' | tee lint
fullprint:
ti README WHATSNEW notes todo | list
ti *.h | list
list *.c
list regex.3 regex.7
print:
ti README WHATSNEW notes todo | list
ti *.h | list
list reg*.c engine.c
mf.tmp: Makefile
sed '/^REGEXH=/s/=.*/=regex.h/' Makefile | sed '/#DEL$$/d' >$@
DTRH=cclass.h cname.h regex2.h utils.h
PRE=COPYRIGHT README WHATSNEW
POST=mkh regex.3 regex.7 tests $(DTRH) $(ALLSRC) fake/*.[ch]
FILES=$(PRE) Makefile $(POST)
DTR=$(PRE) Makefile=mf.tmp $(POST)
dtr: $(FILES) mf.tmp
makedtr $(DTR) >$@
rm mf.tmp
cio: $(FILES)
cio $(FILES)
rdf: $(FILES)
rcsdiff -c $(FILES) 2>&1 | p
# various forms of cleanup
tidy:
rm -f junk* core core.* *.core dtr *.tmp lint
clean: tidy
rm -f *.o *.s re libregex.a
# don't do this one unless you know what you're doing
spotless: clean
rm -f mkh regex.h

32
ext/ereg/regex/README Normal file
View file

@ -0,0 +1,32 @@
alpha3.4 release.
Thu Mar 17 23:17:18 EST 1994
henry@zoo.toronto.edu
See WHATSNEW for change listing.
installation notes:
--------
Read the comments at the beginning of Makefile before running.
Utils.h contains some things that just might have to be modified on
some systems, as well as a nested include (ugh) of <assert.h>.
The "fake" directory contains quick-and-dirty fakes for some header
files and routines that old systems may not have. Note also that
-DUSEBCOPY will make utils.h substitute bcopy() for memmove().
After that, "make r" will build regcomp.o, regexec.o, regfree.o,
and regerror.o (the actual routines), bundle them together into a test
program, and run regression tests on them. No output is good output.
"make lib" builds just the .o files for the actual routines (when
you're happy with testing and have adjusted CFLAGS for production),
and puts them together into libregex.a. You can pick up either the
library or *.o ("make lib" makes sure there are no other .o files left
around to confuse things).
Main.c, debug.c, split.c are used for regression testing but are not part
of the RE routines themselves.
Regex.h goes in /usr/include. All other .h files are internal only.
--------

92
ext/ereg/regex/WHATSNEW Normal file
View file

@ -0,0 +1,92 @@
New in alpha3.4: The complex bug alluded to below has been fixed (in a
slightly kludgey temporary way that may hurt efficiency a bit; this is
another "get it out the door for 4.4" release). The tests at the end of
the tests file have accordingly been uncommented. The primary sign of
the bug was that something like a?b matching ab matched b rather than ab.
(The bug was essentially specific to this exact situation, else it would
have shown up earlier.)
New in alpha3.3: The definition of word boundaries has been altered
slightly, to more closely match the usual programming notion that "_"
is an alphabetic. Stuff used for pre-ANSI systems is now in a subdir,
and the makefile no longer alludes to it in mysterious ways. The
makefile has generally been cleaned up some. Fixes have been made
(again!) so that the regression test will run without -DREDEBUG, at
the cost of weaker checking. A workaround for a bug in some folks'
<assert.h> has been added. And some more things have been added to
tests, including a couple right at the end which are commented out
because the code currently flunks them (complex bug; fix coming).
Plus the usual minor cleanup.
New in alpha3.2: Assorted bits of cleanup and portability improvement
(the development base is now a BSDI system using GCC instead of an ancient
Sun system, and the newer compiler exposed some glitches). Fix for a
serious bug that affected REs using many [] (including REG_ICASE REs
because of the way they are implemented), *sometimes*, depending on
memory-allocation patterns. The header-file prototypes no longer name
the parameters, avoiding possible name conflicts. The possibility that
some clot has defined CHAR_MIN as (say) `-128' instead of `(-128)' is
now handled gracefully. "uchar" is no longer used as an internal type
name (too many people have the same idea). Still the same old lousy
performance, alas.
New in alpha3.1: Basically nothing, this release is just a bookkeeping
convenience. Stay tuned.
New in alpha3.0: Performance is no better, alas, but some fixes have been
made and some functionality has been added. (This is basically the "get
it out the door in time for 4.4" release.) One bug fix: regfree() didn't
free the main internal structure (how embarrassing). It is now possible
to put NULs in either the RE or the target string, using (resp.) a new
REG_PEND flag and the old REG_STARTEND flag. The REG_NOSPEC flag to
regcomp() makes all characters ordinary, so you can match a literal
string easily (this will become more useful when performance improves!).
There are now primitives to match beginnings and ends of words, although
the syntax is disgusting and so is the implementation. The REG_ATOI
debugging interface has changed a bit. And there has been considerable
internal cleanup of various kinds.
New in alpha2.3: Split change list out of README, and moved flags notes
into Makefile. Macro-ized the name of regex(7) in regex(3), since it has
to change for 4.4BSD. Cleanup work in engine.c, and some new regression
tests to catch tricky cases thereof.
New in alpha2.2: Out-of-date manpages updated. Regerror() acquires two
small extensions -- REG_ITOA and REG_ATOI -- which avoid debugging kludges
in my own test program and might be useful to others for similar purposes.
The regression test will now compile (and run) without REDEBUG. The
BRE \$ bug is fixed. Most uses of "uchar" are gone; it's all chars now.
Char/uchar parameters are now written int/unsigned, to avoid possible
portability problems with unpromoted parameters. Some unsigned casts have
been introduced to minimize portability problems with shifting into sign
bits.
New in alpha2.1: Lots of little stuff, cleanup and fixes. The one big
thing is that regex.h is now generated, using mkh, rather than being
supplied in the distribution; due to circularities in dependencies,
you have to build regex.h explicitly by "make h". The two known bugs
have been fixed (and the regression test now checks for them), as has a
problem with assertions not being suppressed in the absence of REDEBUG.
No performance work yet.
New in alpha2: Backslash-anything is an ordinary character, not an
error (except, of course, for the handful of backslashed metacharacters
in BREs), which should reduce script breakage. The regression test
checks *where* null strings are supposed to match, and has generally
been tightened up somewhat. Small bug fixes in parameter passing (not
harmful, but technically errors) and some other areas. Debugging
invoked by defining REDEBUG rather than not defining NDEBUG.
New in alpha+3: full prototyping for internal routines, using a little
helper program, mkh, which extracts prototypes given in stylized comments.
More minor cleanup. Buglet fix: it's CHAR_BIT, not CHAR_BITS. Simple
pre-screening of input when a literal string is known to be part of the
RE; this does wonders for performance.
New in alpha+2: minor bits of cleanup. Notably, the number "32" for the
word width isn't hardwired into regexec.c any more, the public header
file prototypes the functions if __STDC__ is defined, and some small typos
in the manpages have been fixed.
New in alpha+1: improvements to the manual pages, and an important
extension, the REG_STARTEND option to regexec().

31
ext/ereg/regex/cclass.h Normal file
View file

@ -0,0 +1,31 @@
/* character-class table */
static struct cclass {
char *name;
char *chars;
char *multis;
} cclasses[] = {
{ "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
0123456789", "" },
{ "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"" },
{ "blank", " \t", "" },
{ "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
\25\26\27\30\31\32\33\34\35\36\37\177", "" },
{ "digit", "0123456789", "" },
{ "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
"" },
{ "lower", "abcdefghijklmnopqrstuvwxyz",
"" },
{ "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
"" },
{ "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
"" },
{ "space", "\t\n\v\f\r ", "" },
{ "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"" },
{ "xdigit", "0123456789ABCDEFabcdef",
"" },
{ NULL, 0, "" }
};

102
ext/ereg/regex/cname.h Normal file
View file

@ -0,0 +1,102 @@
/* character-name table */
static struct cname {
char *name;
char code;
} cnames[] = {
{ "NUL", '\0' },
{ "SOH", '\001' },
{ "STX", '\002' },
{ "ETX", '\003' },
{ "EOT", '\004' },
{ "ENQ", '\005' },
{ "ACK", '\006' },
{ "BEL", '\007' },
{ "alert", '\007' },
{ "BS", '\010' },
{ "backspace", '\b' },
{ "HT", '\011' },
{ "tab", '\t' },
{ "LF", '\012' },
{ "newline", '\n' },
{ "VT", '\013' },
{ "vertical-tab", '\v' },
{ "FF", '\014' },
{ "form-feed", '\f' },
{ "CR", '\015' },
{ "carriage-return", '\r' },
{ "SO", '\016' },
{ "SI", '\017' },
{ "DLE", '\020' },
{ "DC1", '\021' },
{ "DC2", '\022' },
{ "DC3", '\023' },
{ "DC4", '\024' },
{ "NAK", '\025' },
{ "SYN", '\026' },
{ "ETB", '\027' },
{ "CAN", '\030' },
{ "EM", '\031' },
{ "SUB", '\032' },
{ "ESC", '\033' },
{ "IS4", '\034' },
{ "FS", '\034' },
{ "IS3", '\035' },
{ "GS", '\035' },
{ "IS2", '\036' },
{ "RS", '\036' },
{ "IS1", '\037' },
{ "US", '\037' },
{ "space", ' ' },
{ "exclamation-mark", '!' },
{ "quotation-mark", '"' },
{ "number-sign", '#' },
{ "dollar-sign", '$' },
{ "percent-sign", '%' },
{ "ampersand", '&' },
{ "apostrophe", '\'' },
{ "left-parenthesis", '(' },
{ "right-parenthesis", ')' },
{ "asterisk", '*' },
{ "plus-sign", '+' },
{ "comma", ',' },
{ "hyphen", '-' },
{ "hyphen-minus", '-' },
{ "period", '.' },
{ "full-stop", '.' },
{ "slash", '/' },
{ "solidus", '/' },
{ "zero", '0' },
{ "one", '1' },
{ "two", '2' },
{ "three", '3' },
{ "four", '4' },
{ "five", '5' },
{ "six", '6' },
{ "seven", '7' },
{ "eight", '8' },
{ "nine", '9' },
{ "colon", ':' },
{ "semicolon", ';' },
{ "less-than-sign", '<' },
{ "equals-sign", '=' },
{ "greater-than-sign", '>' },
{ "question-mark", '?' },
{ "commercial-at", '@' },
{ "left-square-bracket", '[' },
{ "backslash", '\\' },
{ "reverse-solidus", '\\' },
{ "right-square-bracket", ']' },
{ "circumflex", '^' },
{ "circumflex-accent", '^' },
{ "underscore", '_' },
{ "low-line", '_' },
{ "grave-accent", '`' },
{ "left-brace", '{' },
{ "left-curly-bracket", '{' },
{ "vertical-line", '|' },
{ "right-brace", '}' },
{ "right-curly-bracket", '}' },
{ "tilde", '~' },
{ "DEL", '\177' },
{ NULL, 0 }
};

242
ext/ereg/regex/debug.c Normal file
View file

@ -0,0 +1,242 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <stdlib.h>
#include <sys/types.h>
#include <regex.h>
#include "utils.h"
#include "regex2.h"
#include "debug.ih"
/*
- regprint - print a regexp for debugging
== void regprint(regex_t *r, FILE *d);
*/
void
regprint(r, d)
regex_t *r;
FILE *d;
{
register struct re_guts *g = r->re_g;
register int i;
register int c;
register int last;
int nincat[NC];
fprintf(d, "%ld states, %d categories", (long)g->nstates,
g->ncategories);
fprintf(d, ", first %ld last %ld", (long)g->firststate,
(long)g->laststate);
if (g->iflags&USEBOL)
fprintf(d, ", USEBOL");
if (g->iflags&USEEOL)
fprintf(d, ", USEEOL");
if (g->iflags&BAD)
fprintf(d, ", BAD");
if (g->nsub > 0)
fprintf(d, ", nsub=%ld", (long)g->nsub);
if (g->must != NULL)
fprintf(d, ", must(%ld) `%*s'", (long)g->mlen, (int)g->mlen,
g->must);
if (g->backrefs)
fprintf(d, ", backrefs");
if (g->nplus > 0)
fprintf(d, ", nplus %ld", (long)g->nplus);
fprintf(d, "\n");
s_print(g, d);
for (i = 0; i < g->ncategories; i++) {
nincat[i] = 0;
for (c = CHAR_MIN; c <= CHAR_MAX; c++)
if (g->categories[c] == i)
nincat[i]++;
}
fprintf(d, "cc0#%d", nincat[0]);
for (i = 1; i < g->ncategories; i++)
if (nincat[i] == 1) {
for (c = CHAR_MIN; c <= CHAR_MAX; c++)
if (g->categories[c] == i)
break;
fprintf(d, ", %d=%s", i, regchar(c));
}
fprintf(d, "\n");
for (i = 1; i < g->ncategories; i++)
if (nincat[i] != 1) {
fprintf(d, "cc%d\t", i);
last = -1;
for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */
if (c <= CHAR_MAX && g->categories[c] == i) {
if (last < 0) {
fprintf(d, "%s", regchar(c));
last = c;
}
} else {
if (last >= 0) {
if (last != c-1)
fprintf(d, "-%s",
regchar(c-1));
last = -1;
}
}
fprintf(d, "\n");
}
}
/*
- s_print - print the strip for debugging
== static void s_print(register struct re_guts *g, FILE *d);
*/
static void
s_print(g, d)
register struct re_guts *g;
FILE *d;
{
register sop *s;
register cset *cs;
register int i;
register int done = 0;
register sop opnd;
register int col = 0;
register int last;
register sopno offset = 2;
# define GAP() { if (offset % 5 == 0) { \
if (col > 40) { \
fprintf(d, "\n\t"); \
col = 0; \
} else { \
fprintf(d, " "); \
col++; \
} \
} else \
col++; \
offset++; \
}
if (OP(g->strip[0]) != OEND)
fprintf(d, "missing initial OEND!\n");
for (s = &g->strip[1]; !done; s++) {
opnd = OPND(*s);
switch (OP(*s)) {
case OEND:
fprintf(d, "\n");
done = 1;
break;
case OCHAR:
if (strchr("\\|()^$.[+*?{}!<> ", (char)opnd) != NULL)
fprintf(d, "\\%c", (char)opnd);
else
fprintf(d, "%s", regchar((char)opnd));
break;
case OBOL:
fprintf(d, "^");
break;
case OEOL:
fprintf(d, "$");
break;
case OBOW:
fprintf(d, "\\{");
break;
case OEOW:
fprintf(d, "\\}");
break;
case OANY:
fprintf(d, ".");
break;
case OANYOF:
fprintf(d, "[(%ld)", (long)opnd);
cs = &g->sets[opnd];
last = -1;
for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */
if (CHIN(cs, i) && i < g->csetsize) {
if (last < 0) {
fprintf(d, "%s", regchar(i));
last = i;
}
} else {
if (last >= 0) {
if (last != i-1)
fprintf(d, "-%s",
regchar(i-1));
last = -1;
}
}
fprintf(d, "]");
break;
case OBACK_:
fprintf(d, "(\\<%ld>", (long)opnd);
break;
case O_BACK:
fprintf(d, "<%ld>\\)", (long)opnd);
break;
case OPLUS_:
fprintf(d, "(+");
if (OP(*(s+opnd)) != O_PLUS)
fprintf(d, "<%ld>", (long)opnd);
break;
case O_PLUS:
if (OP(*(s-opnd)) != OPLUS_)
fprintf(d, "<%ld>", (long)opnd);
fprintf(d, "+)");
break;
case OQUEST_:
fprintf(d, "(?");
if (OP(*(s+opnd)) != O_QUEST)
fprintf(d, "<%ld>", (long)opnd);
break;
case O_QUEST:
if (OP(*(s-opnd)) != OQUEST_)
fprintf(d, "<%ld>", (long)opnd);
fprintf(d, "?)");
break;
case OLPAREN:
fprintf(d, "((<%ld>", (long)opnd);
break;
case ORPAREN:
fprintf(d, "<%ld>))", (long)opnd);
break;
case OCH_:
fprintf(d, "<");
if (OP(*(s+opnd)) != OOR2)
fprintf(d, "<%ld>", (long)opnd);
break;
case OOR1:
if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_)
fprintf(d, "<%ld>", (long)opnd);
fprintf(d, "|");
break;
case OOR2:
fprintf(d, "|");
if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH)
fprintf(d, "<%ld>", (long)opnd);
break;
case O_CH:
if (OP(*(s-opnd)) != OOR1)
fprintf(d, "<%ld>", (long)opnd);
fprintf(d, ">");
break;
default:
fprintf(d, "!%ld(%ld)!", OP(*s), opnd);
break;
}
if (!done)
GAP();
}
}
/*
- regchar - make a character printable
== static char *regchar(int ch);
*/
static char * /* -> representation */
regchar(ch)
int ch;
{
static char buf[10];
if (isprint(ch) || ch == ' ')
sprintf(buf, "%c", ch);
else
sprintf(buf, "\\%o", ch);
return(buf);
}

1019
ext/ereg/regex/engine.c Normal file

File diff suppressed because it is too large Load diff

510
ext/ereg/regex/main.c Normal file
View file

@ -0,0 +1,510 @@
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <regex.h>
#include <assert.h>
#include <stdlib.h>
#include "main.ih"
char *progname;
int debug = 0;
int line = 0;
int status = 0;
int copts = REG_EXTENDED;
int eopts = 0;
regoff_t startoff = 0;
regoff_t endoff = 0;
extern int split();
extern void regprint();
/*
- main - do the simple case, hand off to regress() for regression
*/
int main(argc, argv)
int argc;
char *argv[];
{
regex_t re;
# define NS 10
regmatch_t subs[NS];
char erbuf[100];
int err;
size_t len;
int c;
int errflg = 0;
register int i;
extern int optind;
extern char *optarg;
progname = argv[0];
while ((c = getopt(argc, argv, "c:e:S:E:x")) != EOF)
switch (c) {
case 'c': /* compile options */
copts = options('c', optarg);
break;
case 'e': /* execute options */
eopts = options('e', optarg);
break;
case 'S': /* start offset */
startoff = (regoff_t)atoi(optarg);
break;
case 'E': /* end offset */
endoff = (regoff_t)atoi(optarg);
break;
case 'x': /* Debugging. */
debug++;
break;
case '?':
default:
errflg++;
break;
}
if (errflg) {
fprintf(stderr, "usage: %s ", progname);
fprintf(stderr, "[-c copt][-C][-d] [re]\n");
exit(2);
}
if (optind >= argc) {
regress(stdin);
exit(status);
}
err = regcomp(&re, argv[optind++], copts);
if (err) {
len = regerror(err, &re, erbuf, sizeof(erbuf));
fprintf(stderr, "error %s, %d/%d `%s'\n",
eprint(err), len, sizeof(erbuf), erbuf);
exit(status);
}
regprint(&re, stdout);
if (optind >= argc) {
regfree(&re);
exit(status);
}
if (eopts&REG_STARTEND) {
subs[0].rm_so = startoff;
subs[0].rm_eo = strlen(argv[optind]) - endoff;
}
err = regexec(&re, argv[optind], (size_t)NS, subs, eopts);
if (err) {
len = regerror(err, &re, erbuf, sizeof(erbuf));
fprintf(stderr, "error %s, %d/%d `%s'\n",
eprint(err), len, sizeof(erbuf), erbuf);
exit(status);
}
if (!(copts&REG_NOSUB)) {
len = (int)(subs[0].rm_eo - subs[0].rm_so);
if (subs[0].rm_so != -1) {
if (len != 0)
printf("match `%.*s'\n", (int)len,
argv[optind] + subs[0].rm_so);
else
printf("match `'@%.1s\n",
argv[optind] + subs[0].rm_so);
}
for (i = 1; i < NS; i++)
if (subs[i].rm_so != -1)
printf("(%d) `%.*s'\n", i,
(int)(subs[i].rm_eo - subs[i].rm_so),
argv[optind] + subs[i].rm_so);
}
exit(status);
}
/*
- regress - main loop of regression test
== void regress(FILE *in);
*/
void
regress(in)
FILE *in;
{
char inbuf[1000];
# define MAXF 10
char *f[MAXF];
int nf;
int i;
char erbuf[100];
size_t ne;
char *badpat = "invalid regular expression";
# define SHORT 10
char *bpname = "REG_BADPAT";
regex_t re;
while (fgets(inbuf, sizeof(inbuf), in) != NULL) {
line++;
if (inbuf[0] == '#' || inbuf[0] == '\n')
continue; /* NOTE CONTINUE */
inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */
if (debug)
fprintf(stdout, "%d:\n", line);
nf = split(inbuf, f, MAXF, "\t\t");
if (nf < 3) {
fprintf(stderr, "bad input, line %d\n", line);
exit(1);
}
for (i = 0; i < nf; i++)
if (strcmp(f[i], "\"\"") == 0)
f[i] = "";
if (nf <= 3)
f[3] = NULL;
if (nf <= 4)
f[4] = NULL;
try(f[0], f[1], f[2], f[3], f[4], options('c', f[1]));
if (opt('&', f[1])) /* try with either type of RE */
try(f[0], f[1], f[2], f[3], f[4],
options('c', f[1]) &~ REG_EXTENDED);
}
ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
if (strcmp(erbuf, badpat) != 0 || ne != strlen(badpat)+1) {
fprintf(stderr, "end: regerror() test gave `%s' not `%s'\n",
erbuf, badpat);
status = 1;
}
ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, (size_t)SHORT);
if (strncmp(erbuf, badpat, SHORT-1) != 0 || erbuf[SHORT-1] != '\0' ||
ne != strlen(badpat)+1) {
fprintf(stderr, "end: regerror() short test gave `%s' not `%.*s'\n",
erbuf, SHORT-1, badpat);
status = 1;
}
ne = regerror(REG_ITOA|REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
if (strcmp(erbuf, bpname) != 0 || ne != strlen(bpname)+1) {
fprintf(stderr, "end: regerror() ITOA test gave `%s' not `%s'\n",
erbuf, bpname);
status = 1;
}
re.re_endp = bpname;
ne = regerror(REG_ATOI, &re, erbuf, sizeof(erbuf));
if (atoi(erbuf) != (int)REG_BADPAT) {
fprintf(stderr, "end: regerror() ATOI test gave `%s' not `%ld'\n",
erbuf, (long)REG_BADPAT);
status = 1;
} else if (ne != strlen(erbuf)+1) {
fprintf(stderr, "end: regerror() ATOI test len(`%s') = %ld\n",
erbuf, (long)REG_BADPAT);
status = 1;
}
}
/*
- try - try it, and report on problems
== void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
*/
void
try(f0, f1, f2, f3, f4, opts)
char *f0;
char *f1;
char *f2;
char *f3;
char *f4;
int opts; /* may not match f1 */
{
regex_t re;
# define NSUBS 10
regmatch_t subs[NSUBS];
# define NSHOULD 15
char *should[NSHOULD];
int nshould;
char erbuf[100];
int err;
int len;
char *type = (opts & REG_EXTENDED) ? "ERE" : "BRE";
register int i;
char *grump;
char f0copy[1000];
char f2copy[1000];
strcpy(f0copy, f0);
re.re_endp = (opts&REG_PEND) ? f0copy + strlen(f0copy) : NULL;
fixstr(f0copy);
err = regcomp(&re, f0copy, opts);
if (err != 0 && (!opt('C', f1) || err != efind(f2))) {
/* unexpected error or wrong error */
len = regerror(err, &re, erbuf, sizeof(erbuf));
fprintf(stderr, "%d: %s error %s, %d/%d `%s'\n",
line, type, eprint(err), len,
sizeof(erbuf), erbuf);
status = 1;
} else if (err == 0 && opt('C', f1)) {
/* unexpected success */
fprintf(stderr, "%d: %s should have given REG_%s\n",
line, type, f2);
status = 1;
err = 1; /* so we won't try regexec */
}
if (err != 0) {
regfree(&re);
return;
}
strcpy(f2copy, f2);
fixstr(f2copy);
if (options('e', f1)&REG_STARTEND) {
if (strchr(f2, '(') == NULL || strchr(f2, ')') == NULL)
fprintf(stderr, "%d: bad STARTEND syntax\n", line);
subs[0].rm_so = strchr(f2, '(') - f2 + 1;
subs[0].rm_eo = strchr(f2, ')') - f2;
}
err = regexec(&re, f2copy, NSUBS, subs, options('e', f1));
if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) {
/* unexpected error or wrong error */
len = regerror(err, &re, erbuf, sizeof(erbuf));
fprintf(stderr, "%d: %s exec error %s, %d/%d `%s'\n",
line, type, eprint(err), len,
sizeof(erbuf), erbuf);
status = 1;
} else if (err != 0) {
/* nothing more to check */
} else if (f3 == NULL) {
/* unexpected success */
fprintf(stderr, "%d: %s exec should have failed\n",
line, type);
status = 1;
err = 1; /* just on principle */
} else if (opts&REG_NOSUB) {
/* nothing more to check */
} else if ((grump = check(f2, subs[0], f3)) != NULL) {
fprintf(stderr, "%d: %s %s\n", line, type, grump);
status = 1;
err = 1;
}
if (err != 0 || f4 == NULL) {
regfree(&re);
return;
}
for (i = 1; i < NSHOULD; i++)
should[i] = NULL;
nshould = split(f4, should+1, NSHOULD-1, ",");
if (nshould == 0) {
nshould = 1;
should[1] = "";
}
for (i = 1; i < NSUBS; i++) {
grump = check(f2, subs[i], should[i]);
if (grump != NULL) {
fprintf(stderr, "%d: %s $%d %s\n", line,
type, i, grump);
status = 1;
err = 1;
}
}
regfree(&re);
}
/*
- options - pick options out of a regression-test string
== int options(int type, char *s);
*/
int
options(type, s)
int type; /* 'c' compile, 'e' exec */
char *s;
{
register char *p;
register int o = (type == 'c') ? copts : eopts;
register char *legal = (type == 'c') ? "bisnmp" : "^$#tl";
for (p = s; *p != '\0'; p++)
if (strchr(legal, *p) != NULL)
switch (*p) {
case 'b':
o &= ~REG_EXTENDED;
break;
case 'i':
o |= REG_ICASE;
break;
case 's':
o |= REG_NOSUB;
break;
case 'n':
o |= REG_NEWLINE;
break;
case 'm':
o &= ~REG_EXTENDED;
o |= REG_NOSPEC;
break;
case 'p':
o |= REG_PEND;
break;
case '^':
o |= REG_NOTBOL;
break;
case '$':
o |= REG_NOTEOL;
break;
case '#':
o |= REG_STARTEND;
break;
case 't': /* trace */
o |= REG_TRACE;
break;
case 'l': /* force long representation */
o |= REG_LARGE;
break;
case 'r': /* force backref use */
o |= REG_BACKR;
break;
}
return(o);
}
/*
- opt - is a particular option in a regression string?
== int opt(int c, char *s);
*/
int /* predicate */
opt(c, s)
int c;
char *s;
{
return(strchr(s, c) != NULL);
}
/*
- fixstr - transform magic characters in strings
== void fixstr(register char *p);
*/
void
fixstr(p)
register char *p;
{
if (p == NULL)
return;
for (; *p != '\0'; p++)
if (*p == 'N')
*p = '\n';
else if (*p == 'T')
*p = '\t';
else if (*p == 'S')
*p = ' ';
else if (*p == 'Z')
*p = '\0';
}
/*
- check - check a substring match
== char *check(char *str, regmatch_t sub, char *should);
*/
char * /* NULL or complaint */
check(str, sub, should)
char *str;
regmatch_t sub;
char *should;
{
register int len;
register int shlen;
register char *p;
static char grump[500];
register char *at = NULL;
if (should != NULL && strcmp(should, "-") == 0)
should = NULL;
if (should != NULL && should[0] == '@') {
at = should + 1;
should = "";
}
/* check rm_so and rm_eo for consistency */
if (sub.rm_so > sub.rm_eo || (sub.rm_so == -1 && sub.rm_eo != -1) ||
(sub.rm_so != -1 && sub.rm_eo == -1) ||
(sub.rm_so != -1 && sub.rm_so < 0) ||
(sub.rm_eo != -1 && sub.rm_eo < 0) ) {
sprintf(grump, "start %ld end %ld", (long)sub.rm_so,
(long)sub.rm_eo);
return(grump);
}
/* check for no match */
if (sub.rm_so == -1 && should == NULL)
return(NULL);
if (sub.rm_so == -1)
return("did not match");
/* check for in range */
if (sub.rm_eo > strlen(str)) {
sprintf(grump, "start %ld end %ld, past end of string",
(long)sub.rm_so, (long)sub.rm_eo);
return(grump);
}
len = (int)(sub.rm_eo - sub.rm_so);
shlen = (int)strlen(should);
p = str + sub.rm_so;
/* check for not supposed to match */
if (should == NULL) {
sprintf(grump, "matched `%.*s'", len, p);
return(grump);
}
/* check for wrong match */
if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) {
sprintf(grump, "matched `%.*s' instead", len, p);
return(grump);
}
if (shlen > 0)
return(NULL);
/* check null match in right place */
if (at == NULL)
return(NULL);
shlen = strlen(at);
if (shlen == 0)
shlen = 1; /* force check for end-of-string */
if (strncmp(p, at, shlen) != 0) {
sprintf(grump, "matched null at `%.20s'", p);
return(grump);
}
return(NULL);
}
/*
- eprint - convert error number to name
== static char *eprint(int err);
*/
static char *
eprint(err)
int err;
{
static char epbuf[100];
size_t len;
len = regerror(REG_ITOA|err, (regex_t *)NULL, epbuf, sizeof(epbuf));
assert(len <= sizeof(epbuf));
return(epbuf);
}
/*
- efind - convert error name to number
== static int efind(char *name);
*/
static int
efind(name)
char *name;
{
static char efbuf[100];
regex_t re;
sprintf(efbuf, "REG_%s", name);
assert(strlen(efbuf) < sizeof(efbuf));
re.re_endp = efbuf;
(void) regerror(REG_ATOI, &re, efbuf, sizeof(efbuf));
return(atoi(efbuf));
}

76
ext/ereg/regex/mkh Normal file
View file

@ -0,0 +1,76 @@
#! /bin/sh
# mkh - pull headers out of C source
PATH=/bin:/usr/bin ; export PATH
# egrep pattern to pick out marked lines
egrep='^ =([ ]|$)'
# Sed program to process marked lines into lines for the header file.
# The markers have already been removed. Two things are done here: removal
# of backslashed newlines, and some fudging of comments. The first is done
# because -o needs to have prototypes on one line to strip them down.
# Getting comments into the output is tricky; we turn C++-style // comments
# into /* */ comments, after altering any existing */'s to avoid trouble.
peel=' /\\$/N
/\\\n[ ]*/s///g
/\/\//s;\*/;* /;g
/\/\//s;//\(.*\);/*\1 */;'
for a
do
case "$a" in
-o) # old (pre-function-prototype) compiler
# add code to comment out argument lists
peel="$peel
"'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1(/*\2*/);'
shift
;;
-b) # funny Berkeley __P macro
peel="$peel
"'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1 __P((\2));'
shift
;;
-s) # compiler doesn't like `static foo();'
# add code to get rid of the `static'
peel="$peel
"'/^static[ ][^\/]*[a-zA-Z0-9_)](.*)/s;static.;;'
shift
;;
-p) # private declarations
egrep='^ ==([ ]|$)'
shift
;;
-i) # wrap in #ifndef, argument is name
ifndef="$2"
shift ; shift
;;
*) break
;;
esac
done
if test " $ifndef" != " "
then
echo "#ifndef $ifndef"
echo "#define $ifndef /* never again */"
fi
echo "/* ========= begin header generated by $0 ========= */"
echo '#ifdef __cplusplus'
echo 'extern "C" {'
echo '#endif'
for f
do
echo
echo "/* === $f === */"
egrep "$egrep" $f | sed 's/^ ==*[ ]//;s/^ ==*$//' | sed "$peel"
echo
done
echo '#ifdef __cplusplus'
echo '}'
echo '#endif'
echo "/* ========= end header generated by $0 ========= */"
if test " $ifndef" != " "
then
echo "#endif"
fi
exit 0

1546
ext/ereg/regex/regcomp.c Normal file

File diff suppressed because it is too large Load diff

124
ext/ereg/regex/regerror.c Normal file
View file

@ -0,0 +1,124 @@
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <stdlib.h>
#include <regex.h>
#include "utils.h"
#include "regerror.ih"
/*
= #define REG_NOMATCH 1
= #define REG_BADPAT 2
= #define REG_ECOLLATE 3
= #define REG_ECTYPE 4
= #define REG_EESCAPE 5
= #define REG_ESUBREG 6
= #define REG_EBRACK 7
= #define REG_EPAREN 8
= #define REG_EBRACE 9
= #define REG_BADBR 10
= #define REG_ERANGE 11
= #define REG_ESPACE 12
= #define REG_BADRPT 13
= #define REG_EMPTY 14
= #define REG_ASSERT 15
= #define REG_INVARG 16
= #define REG_ATOI 255 // convert name to number (!)
= #define REG_ITOA 0400 // convert number to name (!)
*/
static struct rerr {
int code;
char *name;
char *explain;
} rerrs[] = {
{ REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match" },
{ REG_BADPAT, "REG_BADPAT", "invalid regular expression" },
{ REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element" },
{ REG_ECTYPE, "REG_ECTYPE", "invalid character class" },
{ REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)" },
{ REG_ESUBREG, "REG_ESUBREG", "invalid backreference number" },
{ REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced" },
{ REG_EPAREN, "REG_EPAREN", "parentheses not balanced" },
{ REG_EBRACE, "REG_EBRACE", "braces not balanced" },
{ REG_BADBR, "REG_BADBR", "invalid repetition count(s)" },
{ REG_ERANGE, "REG_ERANGE", "invalid character range" },
{ REG_ESPACE, "REG_ESPACE", "out of memory" },
{ REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid" },
{ REG_EMPTY, "REG_EMPTY", "empty (sub)expression" },
{ REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug" },
{ REG_INVARG, "REG_INVARG", "invalid argument to regex routine" },
{ 0, "", "*** unknown regexp error code ***" }
};
/*
- regerror - the interface to error numbers
= API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
*/
/* ARGSUSED */
API_EXPORT(size_t)
regerror(errcode, preg, errbuf, errbuf_size)
int errcode;
const regex_t *preg;
char *errbuf;
size_t errbuf_size;
{
register struct rerr *r;
register size_t len;
register int target = errcode &~ REG_ITOA;
register char *s;
char convbuf[50];
if (errcode == REG_ATOI)
s = regatoi(preg, convbuf);
else {
for (r = rerrs; r->code != 0; r++)
if (r->code == target)
break;
if (errcode&REG_ITOA) {
if (r->code != 0)
(void) strcpy(convbuf, r->name);
else
sprintf(convbuf, "REG_0x%x", target);
assert(strlen(convbuf) < sizeof(convbuf));
s = convbuf;
} else
s = r->explain;
}
len = strlen(s) + 1;
if (errbuf_size > 0) {
if (errbuf_size > len)
(void) strcpy(errbuf, s);
else {
(void) strncpy(errbuf, s, errbuf_size-1);
errbuf[errbuf_size-1] = '\0';
}
}
return(len);
}
/*
- regatoi - internal routine to implement REG_ATOI
== static char *regatoi(const regex_t *preg, char *localbuf);
*/
static char *
regatoi(preg, localbuf)
const regex_t *preg;
char *localbuf;
{
register struct rerr *r;
for (r = rerrs; r->code != 0; r++)
if (strcmp(r->name, preg->re_endp) == 0)
break;
if (r->code == 0)
return("0");
sprintf(localbuf, "%d", r->code);
return(localbuf);
}

502
ext/ereg/regex/regex.3 Normal file
View file

@ -0,0 +1,502 @@
.TH REGEX 3 "17 May 1993"
.BY "Henry Spencer"
.de ZR
.\" one other place knows this name: the SEE ALSO section
.IR regex (7) \\$1
..
.SH NAME
regcomp, regexec, regerror, regfree \- regular-expression library
.SH SYNOPSIS
.ft B
.\".na
#include <sys/types.h>
.br
#include <regex.h>
.HP 10
int regcomp(regex_t\ *preg, const\ char\ *pattern, int\ cflags);
.HP
int\ regexec(const\ regex_t\ *preg, const\ char\ *string,
size_t\ nmatch, regmatch_t\ pmatch[], int\ eflags);
.HP
size_t\ regerror(int\ errcode, const\ regex_t\ *preg,
char\ *errbuf, size_t\ errbuf_size);
.HP
void\ regfree(regex_t\ *preg);
.\".ad
.ft
.SH DESCRIPTION
These routines implement POSIX 1003.2 regular expressions (``RE''s);
see
.ZR .
.I Regcomp
compiles an RE written as a string into an internal form,
.I regexec
matches that internal form against a string and reports results,
.I regerror
transforms error codes from either into human-readable messages,
and
.I regfree
frees any dynamically-allocated storage used by the internal form
of an RE.
.PP
The header
.I <regex.h>
declares two structure types,
.I regex_t
and
.IR regmatch_t ,
the former for compiled internal forms and the latter for match reporting.
It also declares the four functions,
a type
.IR regoff_t ,
and a number of constants with names starting with ``REG_''.
.PP
.I Regcomp
compiles the regular expression contained in the
.I pattern
string,
subject to the flags in
.IR cflags ,
and places the results in the
.I regex_t
structure pointed to by
.IR preg .
.I Cflags
is the bitwise OR of zero or more of the following flags:
.IP REG_EXTENDED \w'REG_EXTENDED'u+2n
Compile modern (``extended'') REs,
rather than the obsolete (``basic'') REs that
are the default.
.IP REG_BASIC
This is a synonym for 0,
provided as a counterpart to REG_EXTENDED to improve readability.
.IP REG_NOSPEC
Compile with recognition of all special characters turned off.
All characters are thus considered ordinary,
so the ``RE'' is a literal string.
This is an extension,
compatible with but not specified by POSIX 1003.2,
and should be used with
caution in software intended to be portable to other systems.
REG_EXTENDED and REG_NOSPEC may not be used
in the same call to
.IR regcomp .
.IP REG_ICASE
Compile for matching that ignores upper/lower case distinctions.
See
.ZR .
.IP REG_NOSUB
Compile for matching that need only report success or failure,
not what was matched.
.IP REG_NEWLINE
Compile for newline-sensitive matching.
By default, newline is a completely ordinary character with no special
meaning in either REs or strings.
With this flag,
`[^' bracket expressions and `.' never match newline,
a `^' anchor matches the null string after any newline in the string
in addition to its normal function,
and the `$' anchor matches the null string before any newline in the
string in addition to its normal function.
.IP REG_PEND
The regular expression ends,
not at the first NUL,
but just before the character pointed to by the
.I re_endp
member of the structure pointed to by
.IR preg .
The
.I re_endp
member is of type
.IR const\ char\ * .
This flag permits inclusion of NULs in the RE;
they are considered ordinary characters.
This is an extension,
compatible with but not specified by POSIX 1003.2,
and should be used with
caution in software intended to be portable to other systems.
.PP
When successful,
.I regcomp
returns 0 and fills in the structure pointed to by
.IR preg .
One member of that structure
(other than
.IR re_endp )
is publicized:
.IR re_nsub ,
of type
.IR size_t ,
contains the number of parenthesized subexpressions within the RE
(except that the value of this member is undefined if the
REG_NOSUB flag was used).
If
.I regcomp
fails, it returns a non-zero error code;
see DIAGNOSTICS.
.PP
.I Regexec
matches the compiled RE pointed to by
.I preg
against the
.IR string ,
subject to the flags in
.IR eflags ,
and reports results using
.IR nmatch ,
.IR pmatch ,
and the returned value.
The RE must have been compiled by a previous invocation of
.IR regcomp .
The compiled form is not altered during execution of
.IR regexec ,
so a single compiled RE can be used simultaneously by multiple threads.
.PP
By default,
the NUL-terminated string pointed to by
.I string
is considered to be the text of an entire line, minus any terminating
newline.
The
.I eflags
argument is the bitwise OR of zero or more of the following flags:
.IP REG_NOTBOL \w'REG_STARTEND'u+2n
The first character of
the string
is not the beginning of a line, so the `^' anchor should not match before it.
This does not affect the behavior of newlines under REG_NEWLINE.
.IP REG_NOTEOL
The NUL terminating
the string
does not end a line, so the `$' anchor should not match before it.
This does not affect the behavior of newlines under REG_NEWLINE.
.IP REG_STARTEND
The string is considered to start at
\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_so\fR
and to have a terminating NUL located at
\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_eo\fR
(there need not actually be a NUL at that location),
regardless of the value of
.IR nmatch .
See below for the definition of
.IR pmatch
and
.IR nmatch .
This is an extension,
compatible with but not specified by POSIX 1003.2,
and should be used with
caution in software intended to be portable to other systems.
Note that a non-zero \fIrm_so\fR does not imply REG_NOTBOL;
REG_STARTEND affects only the location of the string,
not how it is matched.
.PP
See
.ZR
for a discussion of what is matched in situations where an RE or a
portion thereof could match any of several substrings of
.IR string .
.PP
Normally,
.I regexec
returns 0 for success and the non-zero code REG_NOMATCH for failure.
Other non-zero error codes may be returned in exceptional situations;
see DIAGNOSTICS.
.PP
If REG_NOSUB was specified in the compilation of the RE,
or if
.I nmatch
is 0,
.I regexec
ignores the
.I pmatch
argument (but see below for the case where REG_STARTEND is specified).
Otherwise,
.I pmatch
points to an array of
.I nmatch
structures of type
.IR regmatch_t .
Such a structure has at least the members
.I rm_so
and
.IR rm_eo ,
both of type
.I regoff_t
(a signed arithmetic type at least as large as an
.I off_t
and a
.IR ssize_t ),
containing respectively the offset of the first character of a substring
and the offset of the first character after the end of the substring.
Offsets are measured from the beginning of the
.I string
argument given to
.IR regexec .
An empty substring is denoted by equal offsets,
both indicating the character following the empty substring.
.PP
The 0th member of the
.I pmatch
array is filled in to indicate what substring of
.I string
was matched by the entire RE.
Remaining members report what substring was matched by parenthesized
subexpressions within the RE;
member
.I i
reports subexpression
.IR i ,
with subexpressions counted (starting at 1) by the order of their opening
parentheses in the RE, left to right.
Unused entries in the array\(emcorresponding either to subexpressions that
did not participate in the match at all, or to subexpressions that do not
exist in the RE (that is, \fIi\fR\ > \fIpreg\fR\->\fIre_nsub\fR)\(emhave both
.I rm_so
and
.I rm_eo
set to \-1.
If a subexpression participated in the match several times,
the reported substring is the last one it matched.
(Note, as an example in particular, that when the RE `(b*)+' matches `bbb',
the parenthesized subexpression matches each of the three `b's and then
an infinite number of empty strings following the last `b',
so the reported substring is one of the empties.)
.PP
If REG_STARTEND is specified,
.I pmatch
must point to at least one
.I regmatch_t
(even if
.I nmatch
is 0 or REG_NOSUB was specified),
to hold the input offsets for REG_STARTEND.
Use for output is still entirely controlled by
.IR nmatch ;
if
.I nmatch
is 0 or REG_NOSUB was specified,
the value of
.IR pmatch [0]
will not be changed by a successful
.IR regexec .
.PP
.I Regerror
maps a non-zero
.I errcode
from either
.I regcomp
or
.I regexec
to a human-readable, printable message.
If
.I preg
is non-NULL,
the error code should have arisen from use of
the
.I regex_t
pointed to by
.IR preg ,
and if the error code came from
.IR regcomp ,
it should have been the result from the most recent
.I regcomp
using that
.IR regex_t .
.RI ( Regerror
may be able to supply a more detailed message using information
from the
.IR regex_t .)
.I Regerror
places the NUL-terminated message into the buffer pointed to by
.IR errbuf ,
limiting the length (including the NUL) to at most
.I errbuf_size
bytes.
If the whole message won't fit,
as much of it as will fit before the terminating NUL is supplied.
In any case,
the returned value is the size of buffer needed to hold the whole
message (including terminating NUL).
If
.I errbuf_size
is 0,
.I errbuf
is ignored but the return value is still correct.
.PP
If the
.I errcode
given to
.I regerror
is first ORed with REG_ITOA,
the ``message'' that results is the printable name of the error code,
e.g. ``REG_NOMATCH'',
rather than an explanation thereof.
If
.I errcode
is REG_ATOI,
then
.I preg
shall be non-NULL and the
.I re_endp
member of the structure it points to
must point to the printable name of an error code;
in this case, the result in
.I errbuf
is the decimal digits of
the numeric value of the error code
(0 if the name is not recognized).
REG_ITOA and REG_ATOI are intended primarily as debugging facilities;
they are extensions,
compatible with but not specified by POSIX 1003.2,
and should be used with
caution in software intended to be portable to other systems.
Be warned also that they are considered experimental and changes are possible.
.PP
.I Regfree
frees any dynamically-allocated storage associated with the compiled RE
pointed to by
.IR preg .
The remaining
.I regex_t
is no longer a valid compiled RE
and the effect of supplying it to
.I regexec
or
.I regerror
is undefined.
.PP
None of these functions references global variables except for tables
of constants;
all are safe for use from multiple threads if the arguments are safe.
.SH IMPLEMENTATION CHOICES
There are a number of decisions that 1003.2 leaves up to the implementor,
either by explicitly saying ``undefined'' or by virtue of them being
forbidden by the RE grammar.
This implementation treats them as follows.
.PP
See
.ZR
for a discussion of the definition of case-independent matching.
.PP
There is no particular limit on the length of REs,
except insofar as memory is limited.
Memory usage is approximately linear in RE size, and largely insensitive
to RE complexity, except for bounded repetitions.
See BUGS for one short RE using them
that will run almost any system out of memory.
.PP
A backslashed character other than one specifically given a magic meaning
by 1003.2 (such magic meanings occur only in obsolete [``basic''] REs)
is taken as an ordinary character.
.PP
Any unmatched [ is a REG_EBRACK error.
.PP
Equivalence classes cannot begin or end bracket-expression ranges.
The endpoint of one range cannot begin another.
.PP
RE_DUP_MAX, the limit on repetition counts in bounded repetitions, is 255.
.PP
A repetition operator (?, *, +, or bounds) cannot follow another
repetition operator.
A repetition operator cannot begin an expression or subexpression
or follow `^' or `|'.
.PP
`|' cannot appear first or last in a (sub)expression or after another `|',
i.e. an operand of `|' cannot be an empty subexpression.
An empty parenthesized subexpression, `()', is legal and matches an
empty (sub)string.
An empty string is not a legal RE.
.PP
A `{' followed by a digit is considered the beginning of bounds for a
bounded repetition, which must then follow the syntax for bounds.
A `{' \fInot\fR followed by a digit is considered an ordinary character.
.PP
`^' and `$' beginning and ending subexpressions in obsolete (``basic'')
REs are anchors, not ordinary characters.
.SH SEE ALSO
grep(1), regex(7)
.PP
POSIX 1003.2, sections 2.8 (Regular Expression Notation)
and
B.5 (C Binding for Regular Expression Matching).
.SH DIAGNOSTICS
Non-zero error codes from
.I regcomp
and
.I regexec
include the following:
.PP
.nf
.ta \w'REG_ECOLLATE'u+3n
REG_NOMATCH regexec() failed to match
REG_BADPAT invalid regular expression
REG_ECOLLATE invalid collating element
REG_ECTYPE invalid character class
REG_EESCAPE \e applied to unescapable character
REG_ESUBREG invalid backreference number
REG_EBRACK brackets [ ] not balanced
REG_EPAREN parentheses ( ) not balanced
REG_EBRACE braces { } not balanced
REG_BADBR invalid repetition count(s) in { }
REG_ERANGE invalid character range in [ ]
REG_ESPACE ran out of memory
REG_BADRPT ?, *, or + operand invalid
REG_EMPTY empty (sub)expression
REG_ASSERT ``can't happen''\(emyou found a bug
REG_INVARG invalid argument, e.g. negative-length string
.fi
.SH HISTORY
Written by Henry Spencer at University of Toronto,
henry@zoo.toronto.edu.
.SH BUGS
This is an alpha release with known defects.
Please report problems.
.PP
There is one known functionality bug.
The implementation of internationalization is incomplete:
the locale is always assumed to be the default one of 1003.2,
and only the collating elements etc. of that locale are available.
.PP
The back-reference code is subtle and doubts linger about its correctness
in complex cases.
.PP
.I Regexec
performance is poor.
This will improve with later releases.
.I Nmatch
exceeding 0 is expensive;
.I nmatch
exceeding 1 is worse.
.I Regexec
is largely insensitive to RE complexity \fIexcept\fR that back
references are massively expensive.
RE length does matter; in particular, there is a strong speed bonus
for keeping RE length under about 30 characters,
with most special characters counting roughly double.
.PP
.I Regcomp
implements bounded repetitions by macro expansion,
which is costly in time and space if counts are large
or bounded repetitions are nested.
An RE like, say,
`((((a{1,100}){1,100}){1,100}){1,100}){1,100}'
will (eventually) run almost any existing machine out of swap space.
.PP
There are suspected problems with response to obscure error conditions.
Notably,
certain kinds of internal overflow,
produced only by truly enormous REs or by multiply nested bounded repetitions,
are probably not handled well.
.PP
Due to a mistake in 1003.2, things like `a)b' are legal REs because `)' is
a special character only in the presence of a previous unmatched `('.
This can't be fixed until the spec is fixed.
.PP
The standard's definition of back references is vague.
For example, does
`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?
Until the standard is clarified,
behavior in such cases should not be relied on.
.PP
The implementation of word-boundary matching is a bit of a kludge,
and bugs may lurk in combinations of word-boundary matching and anchoring.

233
ext/ereg/regex/regex.7 Normal file
View file

@ -0,0 +1,233 @@
.TH REGEX 7 "7 Feb 1994"
.BY "Henry Spencer"
.SH NAME
regex \- POSIX 1003.2 regular expressions
.SH DESCRIPTION
Regular expressions (``RE''s),
as defined in POSIX 1003.2, come in two forms:
modern REs (roughly those of
.IR egrep ;
1003.2 calls these ``extended'' REs)
and obsolete REs (roughly those of
.IR ed ;
1003.2 ``basic'' REs).
Obsolete REs mostly exist for backward compatibility in some old programs;
they will be discussed at the end.
1003.2 leaves some aspects of RE syntax and semantics open;
`\(dg' marks decisions on these aspects that
may not be fully portable to other 1003.2 implementations.
.PP
A (modern) RE is one\(dg or more non-empty\(dg \fIbranches\fR,
separated by `|'.
It matches anything that matches one of the branches.
.PP
A branch is one\(dg or more \fIpieces\fR, concatenated.
It matches a match for the first, followed by a match for the second, etc.
.PP
A piece is an \fIatom\fR possibly followed
by a single\(dg `*', `+', `?', or \fIbound\fR.
An atom followed by `*' matches a sequence of 0 or more matches of the atom.
An atom followed by `+' matches a sequence of 1 or more matches of the atom.
An atom followed by `?' matches a sequence of 0 or 1 matches of the atom.
.PP
A \fIbound\fR is `{' followed by an unsigned decimal integer,
possibly followed by `,'
possibly followed by another unsigned decimal integer,
always followed by `}'.
The integers must lie between 0 and RE_DUP_MAX (255\(dg) inclusive,
and if there are two of them, the first may not exceed the second.
An atom followed by a bound containing one integer \fIi\fR
and no comma matches
a sequence of exactly \fIi\fR matches of the atom.
An atom followed by a bound
containing one integer \fIi\fR and a comma matches
a sequence of \fIi\fR or more matches of the atom.
An atom followed by a bound
containing two integers \fIi\fR and \fIj\fR matches
a sequence of \fIi\fR through \fIj\fR (inclusive) matches of the atom.
.PP
An atom is a regular expression enclosed in `()' (matching a match for the
regular expression),
an empty set of `()' (matching the null string)\(dg,
a \fIbracket expression\fR (see below), `.'
(matching any single character), `^' (matching the null string at the
beginning of a line), `$' (matching the null string at the
end of a line), a `\e' followed by one of the characters
`^.[$()|*+?{\e'
(matching that character taken as an ordinary character),
a `\e' followed by any other character\(dg
(matching that character taken as an ordinary character,
as if the `\e' had not been present\(dg),
or a single character with no other significance (matching that character).
A `{' followed by a character other than a digit is an ordinary
character, not the beginning of a bound\(dg.
It is illegal to end an RE with `\e'.
.PP
A \fIbracket expression\fR is a list of characters enclosed in `[]'.
It normally matches any single character from the list (but see below).
If the list begins with `^',
it matches any single character
(but see below) \fInot\fR from the rest of the list.
If two characters in the list are separated by `\-', this is shorthand
for the full \fIrange\fR of characters between those two (inclusive) in the
collating sequence,
e.g. `[0-9]' in ASCII matches any decimal digit.
It is illegal\(dg for two ranges to share an
endpoint, e.g. `a-c-e'.
Ranges are very collating-sequence-dependent,
and portable programs should avoid relying on them.
.PP
To include a literal `]' in the list, make it the first character
(following a possible `^').
To include a literal `\-', make it the first or last character,
or the second endpoint of a range.
To use a literal `\-' as the first endpoint of a range,
enclose it in `[.' and `.]' to make it a collating element (see below).
With the exception of these and some combinations using `[' (see next
paragraphs), all other special characters, including `\e', lose their
special significance within a bracket expression.
.PP
Within a bracket expression, a collating element (a character,
a multi-character sequence that collates as if it were a single character,
or a collating-sequence name for either)
enclosed in `[.' and `.]' stands for the
sequence of characters of that collating element.
The sequence is a single element of the bracket expression's list.
A bracket expression containing a multi-character collating element
can thus match more than one character,
e.g. if the collating sequence includes a `ch' collating element,
then the RE `[[.ch.]]*c' matches the first five characters
of `chchcc'.
.PP
Within a bracket expression, a collating element enclosed in `[=' and
`=]' is an equivalence class, standing for the sequences of characters
of all collating elements equivalent to that one, including itself.
(If there are no other equivalent collating elements,
the treatment is as if the enclosing delimiters were `[.' and `.]'.)
For example, if o and \o'o^' are the members of an equivalence class,
then `[[=o=]]', `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous.
An equivalence class may not\(dg be an endpoint
of a range.
.PP
Within a bracket expression, the name of a \fIcharacter class\fR enclosed
in `[:' and `:]' stands for the list of all characters belonging to that
class.
Standard character class names are:
.PP
.RS
.nf
.ta 3c 6c 9c
alnum digit punct
alpha graph space
blank lower upper
cntrl print xdigit
.fi
.RE
.PP
These stand for the character classes defined in
.IR ctype (3).
A locale may provide others.
A character class may not be used as an endpoint of a range.
.PP
There are two special cases\(dg of bracket expressions:
the bracket expressions `[[:<:]]' and `[[:>:]]' match the null string at
the beginning and end of a word respectively.
A word is defined as a sequence of
word characters
which is neither preceded nor followed by
word characters.
A word character is an
.I alnum
character (as defined by
.IR ctype (3))
or an underscore.
This is an extension,
compatible with but not specified by POSIX 1003.2,
and should be used with
caution in software intended to be portable to other systems.
.PP
In the event that an RE could match more than one substring of a given
string,
the RE matches the one starting earliest in the string.
If the RE could match more than one substring starting at that point,
it matches the longest.
Subexpressions also match the longest possible substrings, subject to
the constraint that the whole match be as long as possible,
with subexpressions starting earlier in the RE taking priority over
ones starting later.
Note that higher-level subexpressions thus take priority over
their lower-level component subexpressions.
.PP
Match lengths are measured in characters, not collating elements.
A null string is considered longer than no match at all.
For example,
`bb*' matches the three middle characters of `abbbc',
`(wee|week)(knights|nights)' matches all ten characters of `weeknights',
when `(.*).*' is matched against `abc' the parenthesized subexpression
matches all three characters, and
when `(a*)*' is matched against `bc' both the whole RE and the parenthesized
subexpression match the null string.
.PP
If case-independent matching is specified,
the effect is much as if all case distinctions had vanished from the
alphabet.
When an alphabetic that exists in multiple cases appears as an
ordinary character outside a bracket expression, it is effectively
transformed into a bracket expression containing both cases,
e.g. `x' becomes `[xX]'.
When it appears inside a bracket expression, all case counterparts
of it are added to the bracket expression, so that (e.g.) `[x]'
becomes `[xX]' and `[^x]' becomes `[^xX]'.
.PP
No particular limit is imposed on the length of REs\(dg.
Programs intended to be portable should not employ REs longer
than 256 bytes,
as an implementation can refuse to accept such REs and remain
POSIX-compliant.
.PP
Obsolete (``basic'') regular expressions differ in several respects.
`|', `+', and `?' are ordinary characters and there is no equivalent
for their functionality.
The delimiters for bounds are `\e{' and `\e}',
with `{' and `}' by themselves ordinary characters.
The parentheses for nested subexpressions are `\e(' and `\e)',
with `(' and `)' by themselves ordinary characters.
`^' is an ordinary character except at the beginning of the
RE or\(dg the beginning of a parenthesized subexpression,
`$' is an ordinary character except at the end of the
RE or\(dg the end of a parenthesized subexpression,
and `*' is an ordinary character if it appears at the beginning of the
RE or the beginning of a parenthesized subexpression
(after a possible leading `^').
Finally, there is one new type of atom, a \fIback reference\fR:
`\e' followed by a non-zero decimal digit \fId\fR
matches the same sequence of characters
matched by the \fId\fRth parenthesized subexpression
(numbering subexpressions by the positions of their opening parentheses,
left to right),
so that (e.g.) `\e([bc]\e)\e1' matches `bb' or `cc' but not `bc'.
.SH SEE ALSO
regex(3)
.PP
POSIX 1003.2, section 2.8 (Regular Expression Notation).
.SH BUGS
Having two kinds of REs is a botch.
.PP
The current 1003.2 spec says that `)' is an ordinary character in
the absence of an unmatched `(';
this was an unintentional result of a wording error,
and change is likely.
Avoid relying on it.
.PP
Back references are a dreadful botch,
posing major problems for efficient implementations.
They are also somewhat vaguely defined
(does
`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?).
Avoid using them.
.PP
1003.2's specification of case-independent matching is vague.
The ``one case implies all cases'' definition given above
is current consensus among implementors as to the right interpretation.
.PP
The syntax for word boundaries is incredibly ugly.

106
ext/ereg/regex/regex.dsp Normal file
View file

@ -0,0 +1,106 @@
# Microsoft Developer Studio Project File - Name="regex" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=regex - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "regex.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "regex - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
!ELSEIF "$(CFG)" == "regex - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "regex - Win32 Release"
# Name "regex - Win32 Debug"
# Begin Source File
SOURCE=.\regcomp.c
# End Source File
# Begin Source File
SOURCE=.\regerror.c
# End Source File
# Begin Source File
SOURCE=.\regexec.c
# End Source File
# Begin Source File
SOURCE=.\regfree.c
# End Source File
# End Target
# End Project

29
ext/ereg/regex/regex.dsw Normal file
View file

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "regex"=.\regex.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

79
ext/ereg/regex/regex.h Normal file
View file

@ -0,0 +1,79 @@
#ifndef _REGEX_H_
#define _REGEX_H_ /* never again */
/* ========= begin header generated by ./mkh ========= */
#ifdef __cplusplus
extern "C" {
#endif
/* === regex2.h === */
#ifdef WIN32
#define API_EXPORT(type) __declspec(dllexport) type __stdcall
#else
#define API_EXPORT(type) type
#endif
typedef off_t regoff_t;
typedef struct {
int re_magic;
size_t re_nsub; /* number of parenthesized subexpressions */
const char *re_endp; /* end pointer for REG_PEND */
struct re_guts *re_g; /* none of your business :-) */
} regex_t;
typedef struct {
regoff_t rm_so; /* start of match */
regoff_t rm_eo; /* end of match */
} regmatch_t;
/* === regcomp.c === */
API_EXPORT(int) regcomp(regex_t *, const char *, int);
#define REG_BASIC 0000
#define REG_EXTENDED 0001
#define REG_ICASE 0002
#define REG_NOSUB 0004
#define REG_NEWLINE 0010
#define REG_NOSPEC 0020
#define REG_PEND 0040
#define REG_DUMP 0200
/* === regerror.c === */
#define REG_NOMATCH 1
#define REG_BADPAT 2
#define REG_ECOLLATE 3
#define REG_ECTYPE 4
#define REG_EESCAPE 5
#define REG_ESUBREG 6
#define REG_EBRACK 7
#define REG_EPAREN 8
#define REG_EBRACE 9
#define REG_BADBR 10
#define REG_ERANGE 11
#define REG_ESPACE 12
#define REG_BADRPT 13
#define REG_EMPTY 14
#define REG_ASSERT 15
#define REG_INVARG 16
#define REG_ATOI 255 /* convert name to number (!) */
#define REG_ITOA 0400 /* convert number to name (!) */
API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
/* === regexec.c === */
API_EXPORT(int) regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
#define REG_NOTBOL 00001
#define REG_NOTEOL 00002
#define REG_STARTEND 00004
#define REG_TRACE 00400 /* tracing of execution */
#define REG_LARGE 01000 /* force large representation */
#define REG_BACKR 02000 /* force use of backref code */
/* === regfree.c === */
API_EXPORT(void) regfree(regex_t *);
#ifdef __cplusplus
}
#endif
/* ========= end header generated by ./mkh ========= */
#endif

304
ext/ereg/regex/regex.mak Normal file
View file

@ -0,0 +1,304 @@
# Microsoft Developer Studio Generated NMAKE File, Based on regex.dsp
!IF "$(CFG)" == ""
CFG=regex - Win32 Release
!MESSAGE No configuration specified. Defaulting to regex - Win32 Release.
!ENDIF
!IF "$(CFG)" != "regex - Win32 Release" && "$(CFG)" != "regex - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
CPP=cl.exe
!IF "$(CFG)" == "regex - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\.\Release
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\regex.lib"
!ELSE
ALL : "$(OUTDIR)\regex.lib"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\regcomp.obj"
-@erase "$(INTDIR)\regerror.obj"
-@erase "$(INTDIR)\regexec.obj"
-@erase "$(INTDIR)\regfree.obj"
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(OUTDIR)\regex.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Release/
CPP_SBRS=.
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc"
BSC32_SBRS= \
LIB32=link.exe -lib
LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib"
LIB32_OBJS= \
"$(INTDIR)\regcomp.obj" \
"$(INTDIR)\regerror.obj" \
"$(INTDIR)\regexec.obj" \
"$(INTDIR)\regfree.obj"
"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<<
!ELSEIF "$(CFG)" == "regex - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\.\Debug
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc"
!ELSE
ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\regcomp.obj"
-@erase "$(INTDIR)\regcomp.sbr"
-@erase "$(INTDIR)\regerror.obj"
-@erase "$(INTDIR)\regerror.sbr"
-@erase "$(INTDIR)\regexec.obj"
-@erase "$(INTDIR)\regexec.sbr"
-@erase "$(INTDIR)\regfree.obj"
-@erase "$(INTDIR)\regfree.sbr"
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(OUTDIR)\regex.bsc"
-@erase "$(OUTDIR)\regex.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /MDd /W3 /GX /Z7 /Od /I "." /D "WIN32" /D "_DEBUG" /D\
"_WINDOWS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\"\
/Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Debug/
CPP_SBRS=.\Debug/
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc"
BSC32_SBRS= \
"$(INTDIR)\regcomp.sbr" \
"$(INTDIR)\regerror.sbr" \
"$(INTDIR)\regexec.sbr" \
"$(INTDIR)\regfree.sbr"
"$(OUTDIR)\regex.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
$(BSC32) @<<
$(BSC32_FLAGS) $(BSC32_SBRS)
<<
LIB32=link.exe -lib
LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib"
LIB32_OBJS= \
"$(INTDIR)\regcomp.obj" \
"$(INTDIR)\regerror.obj" \
"$(INTDIR)\regexec.obj" \
"$(INTDIR)\regfree.obj"
"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<<
!ENDIF
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
!IF "$(CFG)" == "regex - Win32 Release" || "$(CFG)" == "regex - Win32 Debug"
SOURCE=.\regcomp.c
!IF "$(CFG)" == "regex - Win32 Release"
DEP_CPP_REGCO=\
".\cclass.h"\
".\cname.h"\
".\regcomp.ih"\
".\regex.h"\
".\regex2.h"\
".\utils.h"\
"$(INTDIR)\regcomp.obj" : $(SOURCE) $(DEP_CPP_REGCO) "$(INTDIR)"
!ELSEIF "$(CFG)" == "regex - Win32 Debug"
DEP_CPP_REGCO=\
".\cclass.h"\
".\cname.h"\
".\regcomp.ih"\
".\regex.h"\
".\regex2.h"\
".\utils.h"\
{$(INCLUDE)}"sys\types.h"\
"$(INTDIR)\regcomp.obj" "$(INTDIR)\regcomp.sbr" : $(SOURCE) $(DEP_CPP_REGCO)\
"$(INTDIR)"
!ENDIF
SOURCE=.\regerror.c
!IF "$(CFG)" == "regex - Win32 Release"
DEP_CPP_REGER=\
".\regerror.ih"\
".\regex.h"\
".\utils.h"\
"$(INTDIR)\regerror.obj" : $(SOURCE) $(DEP_CPP_REGER) "$(INTDIR)"
!ELSEIF "$(CFG)" == "regex - Win32 Debug"
DEP_CPP_REGER=\
".\regerror.ih"\
".\regex.h"\
".\utils.h"\
{$(INCLUDE)}"sys\types.h"\
"$(INTDIR)\regerror.obj" "$(INTDIR)\regerror.sbr" : $(SOURCE) $(DEP_CPP_REGER)\
"$(INTDIR)"
!ENDIF
SOURCE=.\regexec.c
!IF "$(CFG)" == "regex - Win32 Release"
DEP_CPP_REGEX=\
".\engine.c"\
".\engine.ih"\
".\regex.h"\
".\regex2.h"\
".\utils.h"\
"$(INTDIR)\regexec.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"
!ELSEIF "$(CFG)" == "regex - Win32 Debug"
DEP_CPP_REGEX=\
".\engine.c"\
".\engine.ih"\
".\regex.h"\
".\regex2.h"\
".\utils.h"\
{$(INCLUDE)}"sys\types.h"\
"$(INTDIR)\regexec.obj" "$(INTDIR)\regexec.sbr" : $(SOURCE) $(DEP_CPP_REGEX)\
"$(INTDIR)"
!ENDIF
SOURCE=.\regfree.c
!IF "$(CFG)" == "regex - Win32 Release"
DEP_CPP_REGFR=\
".\regex.h"\
".\regex2.h"\
".\utils.h"\
"$(INTDIR)\regfree.obj" : $(SOURCE) $(DEP_CPP_REGFR) "$(INTDIR)"
!ELSEIF "$(CFG)" == "regex - Win32 Debug"
DEP_CPP_REGFR=\
".\regex.h"\
".\regex2.h"\
".\utils.h"\
{$(INCLUDE)}"sys\types.h"\
"$(INTDIR)\regfree.obj" "$(INTDIR)\regfree.sbr" : $(SOURCE) $(DEP_CPP_REGFR)\
"$(INTDIR)"
!ENDIF
SOURCE=.\engine.c
!ENDIF

138
ext/ereg/regex/regex2.h Normal file
View file

@ -0,0 +1,138 @@
/*
* First, the stuff that ends up in the outside-world include file
= #ifdef WIN32
= #define API_EXPORT(type) __declspec(dllexport) type __stdcall
= #else
= #define API_EXPORT(type) type
= #endif
=
= typedef off_t regoff_t;
= typedef struct {
= int re_magic;
= size_t re_nsub; // number of parenthesized subexpressions
= const char *re_endp; // end pointer for REG_PEND
= struct re_guts *re_g; // none of your business :-)
= } regex_t;
= typedef struct {
= regoff_t rm_so; // start of match
= regoff_t rm_eo; // end of match
= } regmatch_t;
*/
/*
* internals of regex_t
*/
#define MAGIC1 ((('r'^0200)<<8) | 'e')
/*
* The internal representation is a *strip*, a sequence of
* operators ending with an endmarker. (Some terminology etc. is a
* historical relic of earlier versions which used multiple strips.)
* Certain oddities in the representation are there to permit running
* the machinery backwards; in particular, any deviation from sequential
* flow must be marked at both its source and its destination. Some
* fine points:
*
* - OPLUS_ and O_PLUS are *inside* the loop they create.
* - OQUEST_ and O_QUEST are *outside* the bypass they create.
* - OCH_ and O_CH are *outside* the multi-way branch they create, while
* OOR1 and OOR2 are respectively the end and the beginning of one of
* the branches. Note that there is an implicit OOR2 following OCH_
* and an implicit OOR1 preceding O_CH.
*
* In state representations, an operator's bit is on to signify a state
* immediately *preceding* "execution" of that operator.
*/
typedef unsigned long sop; /* strip operator */
typedef long sopno;
#define OPRMASK 0xf8000000
#define OPDMASK 0x07ffffff
#define OPSHIFT ((unsigned)27)
#define OP(n) ((n)&OPRMASK)
#define OPND(n) ((n)&OPDMASK)
#define SOP(op, opnd) ((op)|(opnd))
/* operators meaning operand */
/* (back, fwd are offsets) */
#define OEND (1<<OPSHIFT) /* endmarker - */
#define OCHAR (2<<OPSHIFT) /* character unsigned char */
#define OBOL (3<<OPSHIFT) /* left anchor - */
#define OEOL (4<<OPSHIFT) /* right anchor - */
#define OANY (5<<OPSHIFT) /* . - */
#define OANYOF (6<<OPSHIFT) /* [...] set number */
#define OBACK_ (7<<OPSHIFT) /* begin \d paren number */
#define O_BACK (8<<OPSHIFT) /* end \d paren number */
#define OPLUS_ (9<<OPSHIFT) /* + prefix fwd to suffix */
#define O_PLUS (10<<OPSHIFT) /* + suffix back to prefix */
#define OQUEST_ (11<<OPSHIFT) /* ? prefix fwd to suffix */
#define O_QUEST (12<<OPSHIFT) /* ? suffix back to prefix */
#define OLPAREN (13<<OPSHIFT) /* ( fwd to ) */
#define ORPAREN (14<<OPSHIFT) /* ) back to ( */
#define OCH_ (15<<OPSHIFT) /* begin choice fwd to OOR2 */
#define OOR1 (16u<<OPSHIFT) /* | pt. 1 back to OOR1 or OCH_ */
#define OOR2 (17u<<OPSHIFT) /* | pt. 2 fwd to OOR2 or O_CH */
#define O_CH (18u<<OPSHIFT) /* end choice back to OOR1 */
#define OBOW (19u<<OPSHIFT) /* begin word - */
#define OEOW (20u<<OPSHIFT) /* end word - */
/*
* Structure for [] character-set representation. Character sets are
* done as bit vectors, grouped 8 to a byte vector for compactness.
* The individual set therefore has both a pointer to the byte vector
* and a mask to pick out the relevant bit of each byte. A hash code
* simplifies testing whether two sets could be identical.
*
* This will get trickier for multicharacter collating elements. As
* preliminary hooks for dealing with such things, we also carry along
* a string of multi-character elements, and decide the size of the
* vectors at run time.
*/
typedef struct {
uch *ptr; /* -> uch [csetsize] */
uch mask; /* bit within array */
uch hash; /* hash code */
size_t smultis;
char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
} cset;
/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c))
#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c))
#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */
/* stuff for character categories */
typedef unsigned char cat_t;
/*
* main compiled-expression structure
*/
struct re_guts {
int magic;
# define MAGIC2 ((('R'^0200)<<8)|'E')
sop *strip; /* malloced area for strip */
int csetsize; /* number of bits in a cset vector */
int ncsets; /* number of csets in use */
cset *sets; /* -> cset [ncsets] */
uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */
int cflags; /* copy of regcomp() cflags argument */
sopno nstates; /* = number of sops */
sopno firststate; /* the initial OEND (normally 0) */
sopno laststate; /* the final OEND */
int iflags; /* internal flags */
# define USEBOL 01 /* used ^ */
# define USEEOL 02 /* used $ */
# define BAD 04 /* something wrong */
int nbol; /* number of ^ used */
int neol; /* number of $ used */
int ncategories; /* how many character categories */
cat_t *categories; /* ->catspace[-CHAR_MIN] */
char *must; /* match must contain this string */
int mlen; /* length of must */
size_t nsub; /* copy of re_nsub */
int backrefs; /* does it use back references? */
sopno nplus; /* how deep does it nest +s? */
/* catspace must be last */
cat_t catspace[1]; /* actually [NC] */
};
/* misc utilities */
#define OUT (CHAR_MAX+1) /* a non-character value */
#define ISWORD(c) (isalnum(c) || (c) == '_')

140
ext/ereg/regex/regexec.c Normal file
View file

@ -0,0 +1,140 @@
/*
* the outer shell of regexec()
*
* This file includes engine.c *twice*, after muchos fiddling with the
* macros that code uses. This lets the same code operate on two different
* representations for state sets.
*/
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include <regex.h>
#include "utils.h"
#include "regex2.h"
#ifndef NDEBUG
static int nope = 0; /* for use in asserts; shuts lint up */
#endif
/* macros for manipulating states, small version */
#define states long
#define states1 states /* for later use in regexec() decision */
#define CLEAR(v) ((v) = 0)
#define SET0(v, n) ((v) &= ~(1 << (n)))
#define SET1(v, n) ((v) |= 1 << (n))
#define ISSET(v, n) ((v) & (1 << (n)))
#define ASSIGN(d, s) ((d) = (s))
#define EQ(a, b) ((a) == (b))
#define STATEVARS int dummy /* dummy version */
#define STATESETUP(m, n) /* nothing */
#define STATETEARDOWN(m) /* nothing */
#define SETUP(v) ((v) = 0)
#define onestate int
#define INIT(o, n) ((o) = (unsigned)1 << (n))
#define INC(o) ((o) <<= 1)
#define ISSTATEIN(v, o) ((v) & (o))
/* some abbreviations; note that some of these know variable names! */
/* do "if I'm here, I can also be there" etc without branches */
#define FWD(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) << (n))
#define BACK(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) >> (n))
#define ISSETBACK(v, n) ((v) & ((unsigned)here >> (n)))
/* function names */
#define SNAMES /* engine.c looks after details */
#include "engine.c"
/* now undo things */
#undef states
#undef CLEAR
#undef SET0
#undef SET1
#undef ISSET
#undef ASSIGN
#undef EQ
#undef STATEVARS
#undef STATESETUP
#undef STATETEARDOWN
#undef SETUP
#undef onestate
#undef INIT
#undef INC
#undef ISSTATEIN
#undef FWD
#undef BACK
#undef ISSETBACK
#undef SNAMES
/* macros for manipulating states, large version */
#define states char *
#define CLEAR(v) memset(v, 0, m->g->nstates)
#define SET0(v, n) ((v)[n] = 0)
#define SET1(v, n) ((v)[n] = 1)
#define ISSET(v, n) ((v)[n])
#define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
#define STATEVARS int vn; char *space
#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
if ((m)->space == NULL) return(REG_ESPACE); \
(m)->vn = 0; }
#define STATETEARDOWN(m) { free((m)->space); }
#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
#define onestate int
#define INIT(o, n) ((o) = (n))
#define INC(o) ((o)++)
#define ISSTATEIN(v, o) ((v)[o])
/* some abbreviations; note that some of these know variable names! */
/* do "if I'm here, I can also be there" etc without branches */
#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here])
#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here])
#define ISSETBACK(v, n) ((v)[here - (n)])
/* function names */
#define LNAMES /* flag */
#include "engine.c"
/*
- regexec - interface for matching
= API_EXPORT(int) regexec(const regex_t *, const char *, size_t, \
= regmatch_t [], int);
= #define REG_NOTBOL 00001
= #define REG_NOTEOL 00002
= #define REG_STARTEND 00004
= #define REG_TRACE 00400 // tracing of execution
= #define REG_LARGE 01000 // force large representation
= #define REG_BACKR 02000 // force use of backref code
*
* We put this here so we can exploit knowledge of the state representation
* when choosing which matcher to call. Also, by this point the matchers
* have been prototyped.
*/
API_EXPORT(int) /* 0 success, REG_NOMATCH failure */
regexec(preg, string, nmatch, pmatch, eflags)
const regex_t *preg;
const char *string;
size_t nmatch;
regmatch_t pmatch[];
int eflags;
{
register struct re_guts *g = preg->re_g;
#ifdef REDEBUG
# define GOODFLAGS(f) (f)
#else
# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
#endif
if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
return(REG_BADPAT);
assert(!(g->iflags&BAD));
if (g->iflags&BAD) /* backstop for no-debug case */
return(REG_BADPAT);
eflags = GOODFLAGS(eflags);
if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
else
return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
}

37
ext/ereg/regex/regfree.c Normal file
View file

@ -0,0 +1,37 @@
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <regex.h>
#include "utils.h"
#include "regex2.h"
/*
- regfree - free everything
= API_EXPORT(void) regfree(regex_t *);
*/
API_EXPORT(void)
regfree(preg)
regex_t *preg;
{
register struct re_guts *g;
if (preg->re_magic != MAGIC1) /* oops */
return; /* nice to complain, but hard */
g = preg->re_g;
if (g == NULL || g->magic != MAGIC2) /* oops again */
return;
preg->re_magic = 0; /* mark it invalid */
g->magic = 0; /* mark it invalid */
if (g->strip != NULL)
free((char *)g->strip);
if (g->sets != NULL)
free((char *)g->sets);
if (g->setbits != NULL)
free((char *)g->setbits);
if (g->must != NULL)
free(g->must);
free((char *)g);
}

316
ext/ereg/regex/split.c Normal file
View file

@ -0,0 +1,316 @@
#include <stdio.h>
#include <string.h>
/*
- split - divide a string into fields, like awk split()
= int split(char *string, char *fields[], int nfields, char *sep);
*/
int /* number of fields, including overflow */
split(string, fields, nfields, sep)
char *string;
char *fields[]; /* list is not NULL-terminated */
int nfields; /* number of entries available in fields[] */
char *sep; /* "" white, "c" single char, "ab" [ab]+ */
{
register char *p = string;
register char c; /* latest character */
register char sepc = sep[0];
register char sepc2;
register int fn;
register char **fp = fields;
register char *sepp;
register int trimtrail;
/* white space */
if (sepc == '\0') {
while ((c = *p++) == ' ' || c == '\t')
continue;
p--;
trimtrail = 1;
sep = " \t"; /* note, code below knows this is 2 long */
sepc = ' ';
} else
trimtrail = 0;
sepc2 = sep[1]; /* now we can safely pick this up */
/* catch empties */
if (*p == '\0')
return(0);
/* single separator */
if (sepc2 == '\0') {
fn = nfields;
for (;;) {
*fp++ = p;
fn--;
if (fn == 0)
break;
while ((c = *p++) != sepc)
if (c == '\0')
return(nfields - fn);
*(p-1) = '\0';
}
/* we have overflowed the fields vector -- just count them */
fn = nfields;
for (;;) {
while ((c = *p++) != sepc)
if (c == '\0')
return(fn);
fn++;
}
/* not reached */
}
/* two separators */
if (sep[2] == '\0') {
fn = nfields;
for (;;) {
*fp++ = p;
fn--;
while ((c = *p++) != sepc && c != sepc2)
if (c == '\0') {
if (trimtrail && **(fp-1) == '\0')
fn++;
return(nfields - fn);
}
if (fn == 0)
break;
*(p-1) = '\0';
while ((c = *p++) == sepc || c == sepc2)
continue;
p--;
}
/* we have overflowed the fields vector -- just count them */
fn = nfields;
while (c != '\0') {
while ((c = *p++) == sepc || c == sepc2)
continue;
p--;
fn++;
while ((c = *p++) != '\0' && c != sepc && c != sepc2)
continue;
}
/* might have to trim trailing white space */
if (trimtrail) {
p--;
while ((c = *--p) == sepc || c == sepc2)
continue;
p++;
if (*p != '\0') {
if (fn == nfields+1)
*p = '\0';
fn--;
}
}
return(fn);
}
/* n separators */
fn = 0;
for (;;) {
if (fn < nfields)
*fp++ = p;
fn++;
for (;;) {
c = *p++;
if (c == '\0')
return(fn);
sepp = sep;
while ((sepc = *sepp++) != '\0' && sepc != c)
continue;
if (sepc != '\0') /* it was a separator */
break;
}
if (fn < nfields)
*(p-1) = '\0';
for (;;) {
c = *p++;
sepp = sep;
while ((sepc = *sepp++) != '\0' && sepc != c)
continue;
if (sepc == '\0') /* it wasn't a separator */
break;
}
p--;
}
/* not reached */
}
#ifdef TEST_SPLIT
/*
* test program
* pgm runs regression
* pgm sep splits stdin lines by sep
* pgm str sep splits str by sep
* pgm str sep n splits str by sep n times
*/
int
main(argc, argv)
int argc;
char *argv[];
{
char buf[512];
register int n;
# define MNF 10
char *fields[MNF];
if (argc > 4)
for (n = atoi(argv[3]); n > 0; n--) {
(void) strcpy(buf, argv[1]);
}
else if (argc > 3)
for (n = atoi(argv[3]); n > 0; n--) {
(void) strcpy(buf, argv[1]);
(void) split(buf, fields, MNF, argv[2]);
}
else if (argc > 2)
dosplit(argv[1], argv[2]);
else if (argc > 1)
while (fgets(buf, sizeof(buf), stdin) != NULL) {
buf[strlen(buf)-1] = '\0'; /* stomp newline */
dosplit(buf, argv[1]);
}
else
regress();
exit(0);
}
dosplit(string, seps)
char *string;
char *seps;
{
# define NF 5
char *fields[NF];
register int nf;
nf = split(string, fields, NF, seps);
print(nf, NF, fields);
}
print(nf, nfp, fields)
int nf;
int nfp;
char *fields[];
{
register int fn;
register int bound;
bound = (nf > nfp) ? nfp : nf;
printf("%d:\t", nf);
for (fn = 0; fn < bound; fn++)
printf("\"%s\"%s", fields[fn], (fn+1 < nf) ? ", " : "\n");
}
#define RNF 5 /* some table entries know this */
struct {
char *str;
char *seps;
int nf;
char *fi[RNF];
} tests[] = {
"", " ", 0, { "" },
" ", " ", 2, { "", "" },
"x", " ", 1, { "x" },
"xy", " ", 1, { "xy" },
"x y", " ", 2, { "x", "y" },
"abc def g ", " ", 5, { "abc", "def", "", "g", "" },
" a bcd", " ", 4, { "", "", "a", "bcd" },
"a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
" a b c d ", " ", 6, { "", "a", "b", "c", "d " },
"", " _", 0, { "" },
" ", " _", 2, { "", "" },
"x", " _", 1, { "x" },
"x y", " _", 2, { "x", "y" },
"ab _ cd", " _", 2, { "ab", "cd" },
" a_b c ", " _", 5, { "", "a", "b", "c", "" },
"a b c_d e f", " _", 6, { "a", "b", "c", "d", "e f" },
" a b c d ", " _", 6, { "", "a", "b", "c", "d " },
"", " _~", 0, { "" },
" ", " _~", 2, { "", "" },
"x", " _~", 1, { "x" },
"x y", " _~", 2, { "x", "y" },
"ab _~ cd", " _~", 2, { "ab", "cd" },
" a_b c~", " _~", 5, { "", "a", "b", "c", "" },
"a b_c d~e f", " _~", 6, { "a", "b", "c", "d", "e f" },
"~a b c d ", " _~", 6, { "", "a", "b", "c", "d " },
"", " _~-", 0, { "" },
" ", " _~-", 2, { "", "" },
"x", " _~-", 1, { "x" },
"x y", " _~-", 2, { "x", "y" },
"ab _~- cd", " _~-", 2, { "ab", "cd" },
" a_b c~", " _~-", 5, { "", "a", "b", "c", "" },
"a b_c-d~e f", " _~-", 6, { "a", "b", "c", "d", "e f" },
"~a-b c d ", " _~-", 6, { "", "a", "b", "c", "d " },
"", " ", 0, { "" },
" ", " ", 2, { "", "" },
"x", " ", 1, { "x" },
"xy", " ", 1, { "xy" },
"x y", " ", 2, { "x", "y" },
"abc def g ", " ", 4, { "abc", "def", "g", "" },
" a bcd", " ", 3, { "", "a", "bcd" },
"a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
" a b c d ", " ", 6, { "", "a", "b", "c", "d " },
"", "", 0, { "" },
" ", "", 0, { "" },
"x", "", 1, { "x" },
"xy", "", 1, { "xy" },
"x y", "", 2, { "x", "y" },
"abc def g ", "", 3, { "abc", "def", "g" },
"\t a bcd", "", 2, { "a", "bcd" },
" a \tb\t c ", "", 3, { "a", "b", "c" },
"a b c d e ", "", 5, { "a", "b", "c", "d", "e" },
"a b\tc d e f", "", 6, { "a", "b", "c", "d", "e f" },
" a b c d e f ", "", 6, { "a", "b", "c", "d", "e f " },
NULL, NULL, 0, { NULL },
};
regress()
{
char buf[512];
register int n;
char *fields[RNF+1];
register int nf;
register int i;
register int printit;
register char *f;
for (n = 0; tests[n].str != NULL; n++) {
(void) strcpy(buf, tests[n].str);
fields[RNF] = NULL;
nf = split(buf, fields, RNF, tests[n].seps);
printit = 0;
if (nf != tests[n].nf) {
printf("split `%s' by `%s' gave %d fields, not %d\n",
tests[n].str, tests[n].seps, nf, tests[n].nf);
printit = 1;
} else if (fields[RNF] != NULL) {
printf("split() went beyond array end\n");
printit = 1;
} else {
for (i = 0; i < nf && i < RNF; i++) {
f = fields[i];
if (f == NULL)
f = "(NULL)";
if (strcmp(f, tests[n].fi[i]) != 0) {
printf("split `%s' by `%s', field %d is `%s', not `%s'\n",
tests[n].str, tests[n].seps,
i, fields[i], tests[n].fi[i]);
printit = 1;
}
}
}
if (printit)
print(nf, RNF, fields);
}
}
#endif

475
ext/ereg/regex/tests Normal file
View file

@ -0,0 +1,475 @@
# regular expression test set
# Lines are at least three fields, separated by one or more tabs. "" stands
# for an empty field. First field is an RE. Second field is flags. If
# C flag given, regcomp() is expected to fail, and the third field is the
# error name (minus the leading REG_).
#
# Otherwise it is expected to succeed, and the third field is the string to
# try matching it against. If there is no fourth field, the match is
# expected to fail. If there is a fourth field, it is the substring that
# the RE is expected to match. If there is a fifth field, it is a comma-
# separated list of what the subexpressions should match, with - indicating
# no match for that one. In both the fourth and fifth fields, a (sub)field
# starting with @ indicates that the (sub)expression is expected to match
# a null string followed by the stuff after the @; this provides a way to
# test where null strings match. The character `N' in REs and strings
# is newline, `S' is space, `T' is tab, `Z' is NUL.
#
# The full list of flags:
# - placeholder, does nothing
# b RE is a BRE, not an ERE
# & try it as both an ERE and a BRE
# C regcomp() error expected, third field is error name
# i REG_ICASE
# m ("mundane") REG_NOSPEC
# s REG_NOSUB (not really testable)
# n REG_NEWLINE
# ^ REG_NOTBOL
# $ REG_NOTEOL
# # REG_STARTEND (see below)
# p REG_PEND
#
# For REG_STARTEND, the start/end offsets are those of the substring
# enclosed in ().
# basics
a & a a
abc & abc abc
abc|de - abc abc
a|b|c - abc a
# parentheses and perversions thereof
a(b)c - abc abc
a\(b\)c b abc abc
a( C EPAREN
a( b a( a(
a\( - a( a(
a\( bC EPAREN
a\(b bC EPAREN
a(b C EPAREN
a(b b a(b a(b
# gag me with a right parenthesis -- 1003.2 goofed here (my fault, partly)
a) - a) a)
) - ) )
# end gagging (in a just world, those *should* give EPAREN)
a) b a) a)
a\) bC EPAREN
\) bC EPAREN
a()b - ab ab
a\(\)b b ab ab
# anchoring and REG_NEWLINE
^abc$ & abc abc
a^b - a^b
a^b b a^b a^b
a$b - a$b
a$b b a$b a$b
^ & abc @abc
$ & abc @
^$ & "" @
$^ - "" @
\($\)\(^\) b "" @
# stop retching, those are legitimate (although disgusting)
^^ - "" @
$$ - "" @
b$ & abNc
b$ &n abNc b
^b$ & aNbNc
^b$ &n aNbNc b
^$ &n aNNb @Nb
^$ n abc
^$ n abcN @
$^ n aNNb @Nb
\($\)\(^\) bn aNNb @Nb
^^ n^ aNNb @Nb
$$ n aNNb @NN
^a ^ a
a$ $ a
^a ^n aNb
^b ^n aNb b
a$ $n bNa
b$ $n bNa b
a*(^b$)c* - b b
a*\(^b$\)c* b b b
# certain syntax errors and non-errors
| C EMPTY
| b | |
* C BADRPT
* b * *
+ C BADRPT
? C BADRPT
"" &C EMPTY
() - abc @abc
\(\) b abc @abc
a||b C EMPTY
|ab C EMPTY
ab| C EMPTY
(|a)b C EMPTY
(a|)b C EMPTY
(*a) C BADRPT
(+a) C BADRPT
(?a) C BADRPT
({1}a) C BADRPT
\(\{1\}a\) bC BADRPT
(a|*b) C BADRPT
(a|+b) C BADRPT
(a|?b) C BADRPT
(a|{1}b) C BADRPT
^* C BADRPT
^* b * *
^+ C BADRPT
^? C BADRPT
^{1} C BADRPT
^\{1\} bC BADRPT
# metacharacters, backslashes
a.c & abc abc
a[bc]d & abd abd
a\*c & a*c a*c
a\\b & a\b a\b
a\\\*b & a\*b a\*b
a\bc & abc abc
a\ &C EESCAPE
a\\bc & a\bc a\bc
\{ bC BADRPT
a\[b & a[b a[b
a[b &C EBRACK
# trailing $ is a peculiar special case for the BRE code
a$ & a a
a$ & a$
a\$ & a
a\$ & a$ a$
a\\$ & a
a\\$ & a$
a\\$ & a\$
a\\$ & a\ a\
# back references, ugh
a\(b\)\2c bC ESUBREG
a\(b\1\)c bC ESUBREG
a\(b*\)c\1d b abbcbbd abbcbbd bb
a\(b*\)c\1d b abbcbd
a\(b*\)c\1d b abbcbbbd
^\(.\)\1 b abc
a\([bc]\)\1d b abcdabbd abbd b
a\(\([bc]\)\2\)*d b abbccd abbccd
a\(\([bc]\)\2\)*d b abbcbd
# actually, this next one probably ought to fail, but the spec is unclear
a\(\(b\)*\2\)*d b abbbd abbbd
# here is a case that no NFA implementation does right
\(ab*\)[ab]*\1 b ababaaa ababaaa a
# check out normal matching in the presence of back refs
\(a\)\1bcd b aabcd aabcd
\(a\)\1bc*d b aabcd aabcd
\(a\)\1bc*d b aabd aabd
\(a\)\1bc*d b aabcccd aabcccd
\(a\)\1bc*[ce]d b aabcccd aabcccd
^\(a\)\1b\(c\)*cd$ b aabcccd aabcccd
# ordinary repetitions
ab*c & abc abc
ab+c - abc abc
ab?c - abc abc
a\(*\)b b a*b a*b
a\(**\)b b ab ab
a\(***\)b bC BADRPT
*a b *a *a
**a b a a
***a bC BADRPT
# the dreaded bounded repetitions
{ & { {
{abc & {abc {abc
{1 C BADRPT
{1} C BADRPT
a{b & a{b a{b
a{1}b - ab ab
a\{1\}b b ab ab
a{1,}b - ab ab
a\{1,\}b b ab ab
a{1,2}b - aab aab
a\{1,2\}b b aab aab
a{1 C EBRACE
a\{1 bC EBRACE
a{1a C EBRACE
a\{1a bC EBRACE
a{1a} C BADBR
a\{1a\} bC BADBR
a{,2} - a{,2} a{,2}
a\{,2\} bC BADBR
a{,} - a{,} a{,}
a\{,\} bC BADBR
a{1,x} C BADBR
a\{1,x\} bC BADBR
a{1,x C EBRACE
a\{1,x bC EBRACE
a{300} C BADBR
a\{300\} bC BADBR
a{1,0} C BADBR
a\{1,0\} bC BADBR
ab{0,0}c - abcac ac
ab\{0,0\}c b abcac ac
ab{0,1}c - abcac abc
ab\{0,1\}c b abcac abc
ab{0,3}c - abbcac abbc
ab\{0,3\}c b abbcac abbc
ab{1,1}c - acabc abc
ab\{1,1\}c b acabc abc
ab{1,3}c - acabc abc
ab\{1,3\}c b acabc abc
ab{2,2}c - abcabbc abbc
ab\{2,2\}c b abcabbc abbc
ab{2,4}c - abcabbc abbc
ab\{2,4\}c b abcabbc abbc
((a{1,10}){1,10}){1,10} - a a a,a
# multiple repetitions
a** &C BADRPT
a++ C BADRPT
a?? C BADRPT
a*+ C BADRPT
a*? C BADRPT
a+* C BADRPT
a+? C BADRPT
a?* C BADRPT
a?+ C BADRPT
a{1}{1} C BADRPT
a*{1} C BADRPT
a+{1} C BADRPT
a?{1} C BADRPT
a{1}* C BADRPT
a{1}+ C BADRPT
a{1}? C BADRPT
a*{b} - a{b} a{b}
a\{1\}\{1\} bC BADRPT
a*\{1\} bC BADRPT
a\{1\}* bC BADRPT
# brackets, and numerous perversions thereof
a[b]c & abc abc
a[ab]c & abc abc
a[^ab]c & adc adc
a[]b]c & a]c a]c
a[[b]c & a[c a[c
a[-b]c & a-c a-c
a[^]b]c & adc adc
a[^-b]c & adc adc
a[b-]c & a-c a-c
a[b &C EBRACK
a[] &C EBRACK
a[1-3]c & a2c a2c
a[3-1]c &C ERANGE
a[1-3-5]c &C ERANGE
a[[.-.]--]c & a-c a-c
a[1- &C ERANGE
a[[. &C EBRACK
a[[.x &C EBRACK
a[[.x. &C EBRACK
a[[.x.] &C EBRACK
a[[.x.]] & ax ax
a[[.x,.]] &C ECOLLATE
a[[.one.]]b & a1b a1b
a[[.notdef.]]b &C ECOLLATE
a[[.].]]b & a]b a]b
a[[:alpha:]]c & abc abc
a[[:notdef:]]c &C ECTYPE
a[[: &C EBRACK
a[[:alpha &C EBRACK
a[[:alpha:] &C EBRACK
a[[:alpha,:] &C ECTYPE
a[[:]:]]b &C ECTYPE
a[[:-:]]b &C ECTYPE
a[[:alph:]] &C ECTYPE
a[[:alphabet:]] &C ECTYPE
[[:alnum:]]+ - -%@a0X- a0X
[[:alpha:]]+ - -%@aX0- aX
[[:blank:]]+ - aSSTb SST
[[:cntrl:]]+ - aNTb NT
[[:digit:]]+ - a019b 019
[[:graph:]]+ - Sa%bS a%b
[[:lower:]]+ - AabC ab
[[:print:]]+ - NaSbN aSb
[[:punct:]]+ - S%-&T %-&
[[:space:]]+ - aSNTb SNT
[[:upper:]]+ - aBCd BC
[[:xdigit:]]+ - p0f3Cq 0f3C
a[[=b=]]c & abc abc
a[[= &C EBRACK
a[[=b &C EBRACK
a[[=b= &C EBRACK
a[[=b=] &C EBRACK
a[[=b,=]] &C ECOLLATE
a[[=one=]]b & a1b a1b
# complexities
a(((b)))c - abc abc
a(b|(c))d - abd abd
a(b*|c)d - abbd abbd
# just gotta have one DFA-buster, of course
a[ab]{20} - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
# and an inline expansion in case somebody gets tricky
a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
# and in case somebody just slips in an NFA...
a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) - aaaaabaaaabaaaabaaaabweeknights aaaaabaaaabaaaabaaaabweeknights
# fish for anomalies as the number of states passes 32
12345678901234567890123456789 - a12345678901234567890123456789b 12345678901234567890123456789
123456789012345678901234567890 - a123456789012345678901234567890b 123456789012345678901234567890
1234567890123456789012345678901 - a1234567890123456789012345678901b 1234567890123456789012345678901
12345678901234567890123456789012 - a12345678901234567890123456789012b 12345678901234567890123456789012
123456789012345678901234567890123 - a123456789012345678901234567890123b 123456789012345678901234567890123
# and one really big one, beyond any plausible word width
1234567890123456789012345678901234567890123456789012345678901234567890 - a1234567890123456789012345678901234567890123456789012345678901234567890b 1234567890123456789012345678901234567890123456789012345678901234567890
# fish for problems as brackets go past 8
[ab][cd][ef][gh][ij][kl][mn] - xacegikmoq acegikm
[ab][cd][ef][gh][ij][kl][mn][op] - xacegikmoq acegikmo
[ab][cd][ef][gh][ij][kl][mn][op][qr] - xacegikmoqy acegikmoq
[ab][cd][ef][gh][ij][kl][mn][op][q] - xacegikmoqy acegikmoq
# subtleties of matching
abc & xabcy abc
a\(b\)?c\1d b acd
aBc i Abc Abc
a[Bc]*d i abBCcd abBCcd
0[[:upper:]]1 &i 0a1 0a1
0[[:lower:]]1 &i 0A1 0A1
a[^b]c &i abc
a[^b]c &i aBc
a[^b]c &i adc adc
[a]b[c] - abc abc
[a]b[a] - aba aba
[abc]b[abc] - abc abc
[abc]b[abd] - abd abd
a(b?c)+d - accd accd
(wee|week)(knights|night) - weeknights weeknights
(we|wee|week|frob)(knights|night|day) - weeknights weeknights
a[bc]d - xyzaaabcaababdacd abd
a[ab]c - aaabc abc
abc s abc abc
a* & b @b
# Let's have some fun -- try to match a C comment.
# first the obvious, which looks okay at first glance...
/\*.*\*/ - /*x*/ /*x*/
# but...
/\*.*\*/ - /*x*/y/*z*/ /*x*/y/*z*/
# okay, we must not match */ inside; try to do that...
/\*([^*]|\*[^/])*\*/ - /*x*/ /*x*/
/\*([^*]|\*[^/])*\*/ - /*x*/y/*z*/ /*x*/
# but...
/\*([^*]|\*[^/])*\*/ - /*x**/y/*z*/ /*x**/y/*z*/
# and a still fancier version, which does it right (I think)...
/\*([^*]|\*+[^*/])*\*+/ - /*x*/ /*x*/
/\*([^*]|\*+[^*/])*\*+/ - /*x*/y/*z*/ /*x*/
/\*([^*]|\*+[^*/])*\*+/ - /*x**/y/*z*/ /*x**/
/\*([^*]|\*+[^*/])*\*+/ - /*x****/y/*z*/ /*x****/
/\*([^*]|\*+[^*/])*\*+/ - /*x**x*/y/*z*/ /*x**x*/
/\*([^*]|\*+[^*/])*\*+/ - /*x***x/y/*z*/ /*x***x/y/*z*/
# subexpressions
a(b)(c)d - abcd abcd b,c
a(((b)))c - abc abc b,b,b
a(b|(c))d - abd abd b,-
a(b*|c|e)d - abbd abbd bb
a(b*|c|e)d - acd acd c
a(b*|c|e)d - ad ad @d
a(b?)c - abc abc b
a(b?)c - ac ac @c
a(b+)c - abc abc b
a(b+)c - abbbc abbbc bbb
a(b*)c - ac ac @c
(a|ab)(bc([de]+)f|cde) - abcdef abcdef a,bcdef,de
# the regression tester only asks for 9 subexpressions
a(b)(c)(d)(e)(f)(g)(h)(i)(j)k - abcdefghijk abcdefghijk b,c,d,e,f,g,h,i,j
a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l - abcdefghijkl abcdefghijkl b,c,d,e,f,g,h,i,j,k
a([bc]?)c - abc abc b
a([bc]?)c - ac ac @c
a([bc]+)c - abc abc b
a([bc]+)c - abcc abcc bc
a([bc]+)bc - abcbc abcbc bc
a(bb+|b)b - abb abb b
a(bbb+|bb+|b)b - abb abb b
a(bbb+|bb+|b)b - abbb abbb bb
a(bbb+|bb+|b)bb - abbb abbb b
(.*).* - abcdef abcdef abcdef
(a*)* - bc @b @b
# do we get the right subexpression when it is used more than once?
a(b|c)*d - ad ad -
a(b|c)*d - abcd abcd c
a(b|c)+d - abd abd b
a(b|c)+d - abcd abcd c
a(b|c?)+d - ad ad @d
a(b|c?)+d - abcd abcd @d
a(b|c){0,0}d - ad ad -
a(b|c){0,1}d - ad ad -
a(b|c){0,1}d - abd abd b
a(b|c){0,2}d - ad ad -
a(b|c){0,2}d - abcd abcd c
a(b|c){0,}d - ad ad -
a(b|c){0,}d - abcd abcd c
a(b|c){1,1}d - abd abd b
a(b|c){1,1}d - acd acd c
a(b|c){1,2}d - abd abd b
a(b|c){1,2}d - abcd abcd c
a(b|c){1,}d - abd abd b
a(b|c){1,}d - abcd abcd c
a(b|c){2,2}d - acbd acbd b
a(b|c){2,2}d - abcd abcd c
a(b|c){2,4}d - abcd abcd c
a(b|c){2,4}d - abcbd abcbd b
a(b|c){2,4}d - abcbcd abcbcd c
a(b|c){2,}d - abcd abcd c
a(b|c){2,}d - abcbd abcbd b
a(b+|((c)*))+d - abd abd @d,@d,-
a(b+|((c)*))+d - abcd abcd @d,@d,-
# check out the STARTEND option
[abc] &# a(b)c b
[abc] &# a(d)c
[abc] &# a(bc)d b
[abc] &# a(dc)d c
. &# a()c
b.*c &# b(bc)c bc
b.* &# b(bc)c bc
.*c &# b(bc)c bc
# plain strings, with the NOSPEC flag
abc m abc abc
abc m xabcy abc
abc m xyz
a*b m aba*b a*b
a*b m ab
"" mC EMPTY
# cases involving NULs
aZb & a a
aZb &p a
aZb &p# (aZb) aZb
aZ*b &p# (ab) ab
a.b &# (aZb) aZb
a.* &# (aZb)c aZb
# word boundaries (ick)
[[:<:]]a & a a
[[:<:]]a & ba
[[:<:]]a & -a a
a[[:>:]] & a a
a[[:>:]] & ab
a[[:>:]] & a- a
[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc abc
[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc-q abc
[[:<:]]a.c[[:>:]] & axc-dayc-dazce-abc axc
[[:<:]]b.c[[:>:]] & a_bxc-byc_d-bzc-q bzc
[[:<:]].x..[[:>:]] & y_xa_-_xb_y-_xc_-axdc _xc_
[[:<:]]a_b[[:>:]] & x_a_b
# past problems, and suspected problems
(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A]) - A1 A1
abcdefghijklmnop i abcdefghijklmnop abcdefghijklmnop
abcdefghijklmnopqrstuv i abcdefghijklmnopqrstuv abcdefghijklmnopqrstuv
(ALAK)|(ALT[AB])|(CC[123]1)|(CM[123]1)|(GAMC)|(LC[23][EO ])|(SEM[1234])|(SL[ES][12])|(SLWW)|(SLF )|(SLDT)|(VWH[12])|(WH[34][EW])|(WP1[ESN]) - CC11 CC11
CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a - CC11 CC11
Char \([a-z0-9_]*\)\[.* b Char xyz[k Char xyz[k xyz
a?b - ab ab
-\{0,1\}[0-9]*$ b -5 -5

22
ext/ereg/regex/utils.h Normal file
View file

@ -0,0 +1,22 @@
/* utility definitions */
#ifndef _POSIX2_RE_DUP_MAX
#define _POSIX2_RE_DUP_MAX 255
#endif
#define DUPMAX _POSIX2_RE_DUP_MAX /* xxx is this right? */
#define INFINITY (DUPMAX + 1)
#define NC (CHAR_MAX - CHAR_MIN + 1)
typedef unsigned char uch;
/* switch off assertions (if not already off) if no REDEBUG */
#ifndef REDEBUG
#ifndef NDEBUG
#define NDEBUG /* no assertions please */
#endif
#endif
#include <assert.h>
/* for old systems with bcopy() but no memmove() */
#ifdef USEBCOPY
#define memmove(d, s, c) bcopy(s, d, c)
#endif

228
ext/snmp/winsnmp.c Normal file
View file

@ -0,0 +1,228 @@
/*
Created from the snmputil sample in the Microsoft SDK for NT
*/
#include "php.h"
#if COMPILE_DL
#include "../phpdl.h"
#include "functions/dl.h"
#endif
#include "php3_snmp.h"
#include <sys/types.h>
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#if HAVE_SNMP
#include <snmp.h>
#include <mgmtapi.h>
function_entry snmp_functions[] = {
{"snmpget", php3_snmpget, NULL},
{"snmpwalk", php3_snmpwalk, NULL},
{NULL,NULL,NULL}
};
php3_module_entry snmp_module_entry = {
"SNMP",snmp_functions,NULL,NULL,NULL,NULL,NULL,0,0,0,NULL
};
#if COMPILE_DL
DLEXPORT php3_module_entry *get_module() { return &snmp_module_entry; }
#endif
#define GET 1
#define WALK 2
#define GETNEXT 3
#define TIMEOUT 6000 /* milliseconds */
#define RETRIES 3
void _php3_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) {
pval *a1, *a2, *a3;
INT operation;
LPSTR agent;
LPSTR community;
RFC1157VarBindList variableBindings;
LPSNMP_MGR_SESSION session;
INT timeout = TIMEOUT;
INT retries = RETRIES;
BYTE requestType;
AsnInteger errorStatus;
AsnInteger errorIndex;
AsnObjectIdentifier oid;
char *chkPtr = NULL;
if (getParameters(ht, 3, &a1, &a2, &a3) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string(a1);
convert_to_string(a2);
convert_to_string(a3);
agent=a1->value.str.val;
community=a2->value.str.val;
operation=st;
SnmpMgrStrToOid(a3->value.str.val, &oid);
/*
I've limited this to only one oid, but we can create a
list of oid's here, and expand the function to take multiple
oid's
*/
variableBindings.list->name = oid;
variableBindings.list->value.asnType = ASN_NULL;
variableBindings.len = 1;
/* Establish a SNMP session to communicate with the remote agent. The
community, communications timeout, and communications retry count
for the session are also required.
*/
if ((session = SnmpMgrOpen(agent, community, timeout, retries)) == NULL){
php3_error(E_WARNING,"error on SnmpMgrOpen %d\n", GetLastError());
}
/* Determine and perform the requested operation.*/
if (operation == GET || operation == GETNEXT){
/* Get and GetNext are relatively simple operations to perform.
Simply initiate the request and process the result and/or
possible error conditions. */
if (operation == GET){
requestType = ASN_RFC1157_GETREQUEST;
} else {
requestType = ASN_RFC1157_GETNEXTREQUEST;
}
/* Request that the API carry out the desired operation.*/
if (!SnmpMgrRequest(session, requestType, &variableBindings,
&errorStatus, &errorIndex)){
/* The API is indicating an error. */
php3_error(E_WARNING,"error on SnmpMgrRequest %d\n", GetLastError());
} else {
/* The API succeeded, errors may be indicated from the remote
agent. */
if (errorStatus > 0){
php3_error(E_WARNING,"Error: errorStatus=%d, errorIndex=%d\n",
errorStatus, errorIndex);
} else {
/* Display the resulting variable bindings.*/
UINT i;
char *string = NULL;
for(i=0; i < variableBindings.len; i++)
{
SnmpMgrOidToStr(&variableBindings.list[i].name, &string);
php3_printf("Variable = %s\n", string);
if (string) SNMP_free(string);
php3_printf("Value = ");
SnmpUtilPrintAsnAny(&variableBindings.list[i].value);
php3_printf("\n");
} /* end for() */
}
}
/* Free the variable bindings that have been allocated.*/
SnmpUtilVarBindListFree(&variableBindings);
}
else if (operation == WALK)
{
/* Walk is a common term used to indicate that all MIB variables
under a given OID are to be traversed and displayed. This is
a more complex operation requiring tests and looping in addition
to the steps for get/getnext above. */
AsnObjectIdentifier root;
AsnObjectIdentifier tempOid;
SnmpUtilOidCpy(&root, &variableBindings.list[0].name);
requestType = ASN_RFC1157_GETNEXTREQUEST;
while(1)
{
if (!SnmpMgrRequest(session, requestType, &variableBindings,
&errorStatus, &errorIndex)){
/* The API is indicating an error.*/
php3_error(E_WARNING,"error on SnmpMgrRequest %d\n", GetLastError());
break;
}
else
{
/* The API succeeded, errors may be indicated from the remote
agent.
Test for end of subtree or end of MIB. */
if (errorStatus == SNMP_ERRORSTATUS_NOSUCHNAME ||
SnmpUtilOidNCmp(&variableBindings.list[0].name,
&root, root.idLength))
{
PUTS("End of MIB subtree.\n\n");
break;
}
/* Test for general error conditions or sucesss. */
if (errorStatus > 0){
php3_error(E_ERROR,"Error: errorStatus=%d, errorIndex=%d \n",
errorStatus, errorIndex);
break;
}
else
{
/* Display resulting variable binding for this iteration. */
char *string = NULL;
SnmpMgrOidToStr(&variableBindings.list[0].name, &string);
php3_printf("Variable = %s\n", string);
if (string) SNMP_free(string);
php3_printf("Value = ");
SnmpUtilPrintAsnAny(&variableBindings.list[0].value);
php3_printf("\n");
}
} /* end if () */
/* Prepare for the next iteration. Make sure returned oid is
preserved and the returned value is freed.
*/
SnmpUtilOidCpy(&tempOid, &variableBindings.list[0].name);
SnmpUtilVarBindFree(&variableBindings.list[0]);
SnmpUtilOidCpy(&variableBindings.list[0].name, &tempOid);
variableBindings.list[0].value.asnType = ASN_NULL;
SnmpUtilOidFree(&tempOid);
} /* end while() */
/* Free the variable bindings that have been allocated.*/
SnmpUtilVarBindListFree(&variableBindings);
SnmpUtilOidFree(&root);
} // end if (operation)
/* Close SNMP session with the remote agent.*/
if (!SnmpMgrClose(session)){
php3_error(E_WARNING,"error on SnmpMgrClose %d\n", GetLastError());
}
}
DLEXPORT void php3_snmpget(INTERNAL_FUNCTION_PARAMETERS) {
_php3_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
}
DLEXPORT void php3_snmpwalk(INTERNAL_FUNCTION_PARAMETERS) {
_php3_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,2);
}
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/

194
filepro.mak Normal file
View file

@ -0,0 +1,194 @@
# Microsoft Developer Studio Generated NMAKE File, Based on filepro.dsp
!IF "$(CFG)" == ""
CFG=filepro - Win32 Debug
!MESSAGE No configuration specified. Defaulting to filepro - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "filepro - Win32 Release" && "$(CFG)" != "filepro - 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 "filepro.mak" CFG="filepro - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "filepro - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "filepro - 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)" == "filepro - Win32 Release"
OUTDIR=.\module_release
INTDIR=.\module_release
# Begin Custom Macros
OutDir=.\module_release
# End Custom Macros
ALL : "$(OUTDIR)\php3_filepro.dll"
CLEAN :
-@erase "$(INTDIR)\filepro.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\php3_filepro.dll"
-@erase "$(OUTDIR)\php3_filepro.exp"
-@erase "$(OUTDIR)\php3_filepro.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_FILEPRO=1 /D "NDEBUG" /D "THREAD_SAFE" /D "MSVC5" /D "COMPILE_DL" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\filepro.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)\filepro.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.0 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_filepro.pdb" /machine:I386 /out:"$(OUTDIR)\php3_filepro.dll" /implib:"$(OUTDIR)\php3_filepro.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
LINK32_OBJS= \
"$(INTDIR)\filepro.obj"
"$(OUTDIR)\php3_filepro.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "filepro - Win32 Debug"
OUTDIR=.\module_debug
INTDIR=.\module_debug
# Begin Custom Macros
OutDir=.\module_debug
# End Custom Macros
ALL : "$(OUTDIR)\php3_filepro.dll"
CLEAN :
-@erase "$(INTDIR)\filepro.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\php3_filepro.dll"
-@erase "$(OUTDIR)\php3_filepro.exp"
-@erase "$(OUTDIR)\php3_filepro.ilk"
-@erase "$(OUTDIR)\php3_filepro.lib"
-@erase "$(OUTDIR)\php3_filepro.pdb"
"$(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 HAVE_FILEPRO=1 /D "DEBUG" /D "_DEBUG" /D "THREAD_SAFE" /D "MSVC5" /D "COMPILE_DL" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\filepro.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)\filepro.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.0 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_filepro.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_filepro.dll" /implib:"$(OUTDIR)\php3_filepro.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
LINK32_OBJS= \
"$(INTDIR)\filepro.obj"
"$(OUTDIR)\php3_filepro.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("filepro.dep")
!INCLUDE "filepro.dep"
!ELSE
!MESSAGE Warning: cannot find "filepro.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "filepro - Win32 Release" || "$(CFG)" == "filepro - Win32 Debug"
SOURCE=.\functions\filepro.c
"$(INTDIR)\filepro.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF

9
foo Normal file
View file

@ -0,0 +1,9 @@
*** Testing assignments and variable aliasing: ***<br>
<?php
/* This test tests assignments to variables using other variables as variable-names */
$a = "b";
print "hey";
$$a = "test";
$$$a = "blah";
print "hey";
?>

3
foo2 Normal file
View file

@ -0,0 +1,3 @@
<?
print $a->b(12,13)."\n";

43
foo3 Normal file
View file

@ -0,0 +1,43 @@
<?
class foo {
function foo() {
print "foo()\n";
}
function bar(&$blah, $foobar=7) {
$foobar += 19;
}
function hello_world() {
return "Hello, World!";
}
function print_string($str) {
print "$str\n";
return 666;
}
var $foo;
var $bar="this is a test...";
};
class bar {
function foo($a,$b) {
$a *= 3;
return $a+$b;
}
function bar(&$blah, $foobar=7) {
$foobar += 19;
}
var $foo;
var $bar="this is a test...";
};
$b = new foo;
$a = $b;
print $a->print_string($a->hello_world())."\n";
print $b->print_string($b->hello_world())."\n";
$a->foo = 5;
print $a->foo;
print $a->foo();

41
foo4 Normal file
View file

@ -0,0 +1,41 @@
<?
class foo {
function foo($a,$b) {
$a *= 3;
return $a+$b;
}
function bar(&$blah, $foobar=7) {
$foobar += 19;
}
function hello_world() {
return "Hello, World!";
}
function print_string($str) {
print "$str\n";
return 666;
}
var $foo;
var $bar="this is a test...";
};
class bar {
function foo($a,$b) {
$a *= 3;
return $a+$b;
}
function bar(&$blah, $foobar=7) {
$foobar += 19;
}
var $foo;
var $bar="this is a test...";
};
$b = new foo;
$a = &$b;
$b->asd = 5;
print $b->asd;

7
footer Normal file
View file

@ -0,0 +1,7 @@
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/

214
gd.mak Normal file
View file

@ -0,0 +1,214 @@
# Microsoft Developer Studio Generated NMAKE File, Based on gd.dsp
!IF "$(CFG)" == ""
CFG=gd - Win32 Debug
!MESSAGE No configuration specified. Defaulting to gd - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "gd - Win32 Release" && "$(CFG)" != "gd - 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 "gd.mak" CFG="gd - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "gd - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "gd - 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)" == "gd - Win32 Release"
OUTDIR=.\module_Release
INTDIR=.\module_Release
# Begin Custom Macros
OutDir=.\module_Release
# End Custom Macros
ALL : "$(OUTDIR)\php3_gd.dll"
CLEAN :
-@erase "$(INTDIR)\gd.obj"
-@erase "$(INTDIR)\gdcache.obj"
-@erase "$(INTDIR)\gdttf.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\php3_gd.dll"
-@erase "$(OUTDIR)\php3_gd.exp"
-@erase "$(OUTDIR)\php3_gd.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBTTF=1 /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\gd.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)\gd.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=freetype.lib php.lib libgd.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_gd.pdb" /machine:I386 /out:"$(OUTDIR)\php3_gd.dll" /implib:"$(OUTDIR)\php3_gd.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
LINK32_OBJS= \
"$(INTDIR)\gd.obj" \
"$(INTDIR)\gdcache.obj" \
"$(INTDIR)\gdttf.obj"
"$(OUTDIR)\php3_gd.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "gd - Win32 Debug"
OUTDIR=.\module_Debug
INTDIR=.\module_Debug
# Begin Custom Macros
OutDir=.\module_Debug
# End Custom Macros
ALL : "$(OUTDIR)\php3_gd.dll"
CLEAN :
-@erase "$(INTDIR)\gd.obj"
-@erase "$(INTDIR)\gdcache.obj"
-@erase "$(INTDIR)\gdttf.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\php3_gd.dll"
-@erase "$(OUTDIR)\php3_gd.exp"
-@erase "$(OUTDIR)\php3_gd.ilk"
-@erase "$(OUTDIR)\php3_gd.lib"
-@erase "$(OUTDIR)\php3_gd.pdb"
"$(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 HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBTTF=1 /D "DEBUG" /D "_DEBUG" /D "HAVE_GDTTF" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\gd.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)\gd.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=freetype.lib php.lib libgd.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_gd.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_gd.dll" /implib:"$(OUTDIR)\php3_gd.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
LINK32_OBJS= \
"$(INTDIR)\gd.obj" \
"$(INTDIR)\gdcache.obj" \
"$(INTDIR)\gdttf.obj"
"$(OUTDIR)\php3_gd.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("gd.dep")
!INCLUDE "gd.dep"
!ELSE
!MESSAGE Warning: cannot find "gd.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "gd - Win32 Release" || "$(CFG)" == "gd - Win32 Debug"
SOURCE=.\functions\gd.c
"$(INTDIR)\gd.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\functions\gdcache.c
"$(INTDIR)\gdcache.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\functions\gdttf.c
"$(INTDIR)\gdttf.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF

171
getopt.c Normal file
View file

@ -0,0 +1,171 @@
/* Borrowed from Apache NT Port */
#if !APACHE
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include "getopt.h"
#define OPTERRCOLON (1)
#define OPTERRNF (2)
#define OPTERRARG (3)
char *optarg;
int optind = 1;
int opterr = 1;
int optopt;
static int
optiserr(int argc, char * const *argv, int oint, const char *optstr,
int optchr, int err)
{
if (opterr)
{
fprintf(stderr, "Error in argument %d, char %d: ", oint, optchr+1);
switch(err)
{
case OPTERRCOLON:
fprintf(stderr, ": in flags\n");
break;
case OPTERRNF:
fprintf(stderr, "option not found %c\n", argv[oint][optchr]);
break;
case OPTERRARG:
fprintf(stderr, "no argument for option %c\n", argv[oint][optchr]);
break;
default:
fprintf(stderr, "unknown\n");
break;
}
}
optopt = argv[oint][optchr];
return('?');
}
int
getopt(int argc, char* const *argv, const char *optstr)
{
static int optchr = 0;
static int dash = 0; /* have already seen the - */
char *cp;
if (optind >= argc)
return(EOF);
if (!dash && (argv[optind][0] != '-'))
return(EOF);
if (!dash && (argv[optind][0] == '-') && !argv[optind][1])
{
/*
* use to specify stdin. Need to let pgm process this and
* the following args
*/
return(EOF);
}
if ((argv[optind][0] == '-') && (argv[optind][1] == '-'))
{
/* -- indicates end of args */
optind++;
return(EOF);
}
if (!dash)
{
assert((argv[optind][0] == '-') && argv[optind][1]);
dash = 1;
optchr = 1;
}
/* Check if the guy tries to do a -: kind of flag */
assert(dash);
if (argv[optind][optchr] == ':')
{
dash = 0;
optind++;
return(optiserr(argc, argv, optind-1, optstr, optchr, OPTERRCOLON));
}
if (!(cp = strchr(optstr, argv[optind][optchr])))
{
int errind = optind;
int errchr = optchr;
if (!argv[optind][optchr+1])
{
dash = 0;
optind++;
}
else
optchr++;
return(optiserr(argc, argv, errind, optstr, errchr, OPTERRNF));
}
if (cp[1] == ':')
{
dash = 0;
optind++;
if (optind == argc)
return(optiserr(argc, argv, optind-1, optstr, optchr, OPTERRARG));
optarg = argv[optind++];
return(*cp);
}
else
{
if (!argv[optind][optchr+1])
{
dash = 0;
optind++;
}
else
optchr++;
return(*cp);
}
assert(0);
return(0);
}
#endif /* !APACHE */
#ifdef TESTGETOPT
int
main (int argc, char **argv)
{
int c;
extern char *optarg;
extern int optind;
int aflg = 0;
int bflg = 0;
int errflg = 0;
char *ofile = NULL;
while ((c = getopt(argc, argv, "abo:")) != EOF)
switch (c) {
case 'a':
if (bflg)
errflg++;
else
aflg++;
break;
case 'b':
if (aflg)
errflg++;
else
bflg++;
break;
case 'o':
ofile = optarg;
(void)printf("ofile = %s\n", ofile);
break;
case '?':
errflg++;
}
if (errflg) {
(void)fprintf(stderr,
"usage: cmd [-a|-b] [-o <filename>] files...\n");
exit (2);
}
for ( ; optind < argc; optind++)
(void)printf("%s\n", argv[optind]);
return 0;
}
#endif /* TESTGETOPT */

9
getopt.h Normal file
View file

@ -0,0 +1,9 @@
/* Borrowed from Apache NT Port */
#include "php.h"
extern char *optarg;
extern int optind;
extern int opterr;
extern int optopt;
extern int getopt(int argc, char* const *argv, const char *optstr);

29
header Normal file
View file

@ -0,0 +1,29 @@
/*
+----------------------------------------------------------------------+
| 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: |
| |
+----------------------------------------------------------------------+
*/

214
hyperwave.mak Normal file
View file

@ -0,0 +1,214 @@
# Microsoft Developer Studio Generated NMAKE File, Based on hyperwave.dsp
!IF "$(CFG)" == ""
CFG=hyperwave - Win32 Debug
!MESSAGE No configuration specified. Defaulting to hyperwave - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "hyperwave - Win32 Release" && "$(CFG)" != "hyperwave - 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 "hyperwave.mak" CFG="hyperwave - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "hyperwave - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "hyperwave - 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)" == "hyperwave - Win32 Release"
OUTDIR=.\module_Release
INTDIR=.\module_Release
# Begin Custom Macros
OutDir=.\module_Release
# End Custom Macros
ALL : "$(OUTDIR)\php3_hyperwave.dll"
CLEAN :
-@erase "$(INTDIR)\dlist.obj"
-@erase "$(INTDIR)\hg_comm.obj"
-@erase "$(INTDIR)\hw.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\php3_hyperwave.dll"
-@erase "$(OUTDIR)\php3_hyperwave.exp"
-@erase "$(OUTDIR)\php3_hyperwave.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D "HYPERWAVE" /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\hyperwave.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)\hyperwave.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=php.lib wsock32.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_hyperwave.pdb" /machine:I386 /out:"$(OUTDIR)\php3_hyperwave.dll" /implib:"$(OUTDIR)\php3_hyperwave.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
LINK32_OBJS= \
"$(INTDIR)\dlist.obj" \
"$(INTDIR)\hg_comm.obj" \
"$(INTDIR)\hw.obj"
"$(OUTDIR)\php3_hyperwave.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "hyperwave - Win32 Debug"
OUTDIR=.\module_Debug
INTDIR=.\module_Debug
# Begin Custom Macros
OutDir=.\module_Debug
# End Custom Macros
ALL : "$(OUTDIR)\php3_hyperwave.dll"
CLEAN :
-@erase "$(INTDIR)\dlist.obj"
-@erase "$(INTDIR)\hg_comm.obj"
-@erase "$(INTDIR)\hw.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\php3_hyperwave.dll"
-@erase "$(OUTDIR)\php3_hyperwave.exp"
-@erase "$(OUTDIR)\php3_hyperwave.ilk"
-@erase "$(OUTDIR)\php3_hyperwave.lib"
-@erase "$(OUTDIR)\php3_hyperwave.pdb"
"$(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 "HYPERWAVE" /D "DEBUG" /D "_DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\hyperwave.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)\hyperwave.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=php.lib wsock32.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_hyperwave.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_hyperwave.dll" /implib:"$(OUTDIR)\php3_hyperwave.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
LINK32_OBJS= \
"$(INTDIR)\dlist.obj" \
"$(INTDIR)\hg_comm.obj" \
"$(INTDIR)\hw.obj"
"$(OUTDIR)\php3_hyperwave.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("hyperwave.dep")
!INCLUDE "hyperwave.dep"
!ELSE
!MESSAGE Warning: cannot find "hyperwave.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "hyperwave - Win32 Release" || "$(CFG)" == "hyperwave - Win32 Debug"
SOURCE=.\functions\dlist.c
"$(INTDIR)\dlist.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\functions\hg_comm.c
"$(INTDIR)\hg_comm.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\functions\hw.c
"$(INTDIR)\hw.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF

194
imap4.mak Normal file
View file

@ -0,0 +1,194 @@
# Microsoft Developer Studio Generated NMAKE File, Based on imap4.dsp
!IF "$(CFG)" == ""
CFG=imap4 - Win32 Debug
!MESSAGE No configuration specified. Defaulting to imap4 - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "imap4 - Win32 Release" && "$(CFG)" != "imap4 - 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 "imap4.mak" CFG="imap4 - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "imap4 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "imap4 - 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)" == "imap4 - Win32 Release"
OUTDIR=.\module_release
INTDIR=.\module_release
# Begin Custom Macros
OutDir=.\module_release
# End Custom Macros
ALL : "$(OUTDIR)\php3_imap4r2.dll"
CLEAN :
-@erase "$(INTDIR)\imap.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\php3_imap4r2.dll"
-@erase "$(OUTDIR)\php3_imap4r2.exp"
-@erase "$(OUTDIR)\php3_imap4r2.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_IMAP=1 /D "NDEBUG" /D "MSVC5" /D "THREAD_SAFE" /D "COMPILE_DL" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\imap4.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)\imap4.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=cclient.lib php.lib wsock32.lib winmm.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_imap4r2.pdb" /machine:I386 /out:"$(OUTDIR)\php3_imap4r2.dll" /implib:"$(OUTDIR)\php3_imap4r2.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
LINK32_OBJS= \
"$(INTDIR)\imap.obj"
"$(OUTDIR)\php3_imap4r2.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "imap4 - Win32 Debug"
OUTDIR=.\module_Debug
INTDIR=.\module_Debug
# Begin Custom Macros
OutDir=.\module_Debug
# End Custom Macros
ALL : "$(OUTDIR)\php3_imap4r1.dll"
CLEAN :
-@erase "$(INTDIR)\imap.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\php3_imap4r1.dll"
-@erase "$(OUTDIR)\php3_imap4r1.exp"
-@erase "$(OUTDIR)\php3_imap4r1.ilk"
-@erase "$(OUTDIR)\php3_imap4r1.lib"
-@erase "$(OUTDIR)\php3_imap4r1.pdb"
"$(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 HAVE_IMAP=1 /D "DEBUG" /D "_DEBUG" /D "MSVC5" /D "THREAD_SAFE" /D "COMPILE_DL" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\imap4.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)\imap4.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=cclient.lib php.lib wsock32.lib winmm.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_imap4r1.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_imap4r1.dll" /implib:"$(OUTDIR)\php3_imap4r1.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
LINK32_OBJS= \
"$(INTDIR)\imap.obj"
"$(OUTDIR)\php3_imap4r1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("imap4.dep")
!INCLUDE "imap4.dep"
!ELSE
!MESSAGE Warning: cannot find "imap4.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "imap4 - Win32 Release" || "$(CFG)" == "imap4 - Win32 Debug"
SOURCE=.\functions\imap.c
"$(INTDIR)\imap.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF

238
install-sh Normal file
View file

@ -0,0 +1,238 @@
#! /bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
tranformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

171
internal_functions.c Normal file
View file

@ -0,0 +1,171 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php.h"
#include "modules.h"
#include "internal_functions_registry.h"
#include "zend_compile.h"
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include "functions/php3_ifx.h"
#include "functions/php3_ldap.h"
#include "functions/php3_mysql.h"
#include "functions/php3_bcmath.h"
#include "functions/php3_msql.h"
#include "functions/basic_functions.h"
#include "functions/phpmath.h"
#include "functions/php3_string.h"
#include "functions/php3_oci8.h"
#include "functions/oracle.h"
#include "functions/base64.h"
#include "functions/php3_dir.h"
#include "functions/dns.h"
#include "functions/php3_pgsql.h"
#include "functions/php3_velocis.h"
#include "functions/php3_sybase.h"
#include "functions/php3_sybase-ct.h"
#include "functions/reg.h"
#include "functions/php3_mail.h"
#include "functions/imap.h"
#include "functions/md5.h"
#include "functions/php3_gd.h"
#include "functions/html.h"
#include "functions/dl.h"
#include "functions/head.h"
#include "functions/post.h"
#include "functions/exec.h"
#include "functions/php3_solid.h"
#include "functions/adabasd.h"
#include "functions/file.h"
#include "functions/dbase.h"
#include "functions/hw.h"
#include "functions/filepro.h"
#include "functions/db.h"
#include "functions/php3_syslog.h"
#include "functions/php3_filestat.h"
#include "functions/php3_browscap.h"
#include "functions/pack.h"
#include "functions/php3_unified_odbc.h"
#include "dl/snmp/php3_snmp.h"
#include "functions/php3_zlib.h"
#include "functions/php3_COM.h"
#include "functions/php3_interbase.h"
#include "functions/php3_xml.h"
#include "functions/php3_pdf.h"
#include "functions/php3_fdf.h"
#include "functions/php3_sysvsem.h"
#include "functions/php3_sysvshm.h"
#include "functions/php3_dav.h"
extern php3_ini_structure php3_ini;
extern php3_ini_structure php3_ini_master;
unsigned char first_arg_force_ref[] = { 1, BYREF_FORCE };
unsigned char first_arg_allow_ref[] = { 1, BYREF_ALLOW };
unsigned char second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
unsigned char second_arg_allow_ref[] = { 2, BYREF_NONE, BYREF_ALLOW };
zend_module_entry *php3_builtin_modules[] =
{
basic_functions_module_ptr,
dl_module_ptr,
php3_dir_module_ptr,
php3_filestat_module_ptr,
php3_file_module_ptr,
php3_header_module_ptr,
mail_module_ptr,
syslog_module_ptr,
mysql_module_ptr,
msql_module_ptr,
pgsql_module_ptr,
ifx_module_ptr,
ldap_module_ptr,
velocis_module_ptr,
filepro_module_ptr,
sybase_module_ptr,
sybct_module_ptr,
uodbc_module_ptr,
dbase_module_ptr,
hw_module_ptr,
regexp_module_ptr,
solid_module_ptr,
adabas_module_ptr,
gd_module_ptr,
oci8_module_ptr,
oracle_module_ptr,
apache_module_ptr,
crypt_module_ptr,
dbm_module_ptr,
bcmath_module_ptr,
browscap_module_ptr,
snmp_module_ptr,
pack_module_ptr,
php3_zlib_module_ptr,
COM_module_ptr,
php3_imap_module_ptr,
php3_ibase_module_ptr,
xml_module_ptr,
pdf_module_ptr,
fdf_module_ptr,
sysvsem_module_ptr,
sysvshm_module_ptr,
phpdav_module_ptr,
};
int module_startup_modules(void)
{
zend_module_entry **ptr = php3_builtin_modules, **end = ptr+(sizeof(php3_builtin_modules)/sizeof(zend_module_entry *));
while (ptr < end) {
if (*ptr) {
if (zend_startup_module(*ptr)==FAILURE) {
return FAILURE;
}
}
ptr++;
}
return SUCCESS;
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/

194
ldap.mak Normal file
View file

@ -0,0 +1,194 @@
# Microsoft Developer Studio Generated NMAKE File, Based on ldap.dsp
!IF "$(CFG)" == ""
CFG=ldap - Win32 Debug
!MESSAGE No configuration specified. Defaulting to ldap - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "ldap - Win32 Release" && "$(CFG)" != "ldap - 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 "ldap.mak" CFG="ldap - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ldap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "ldap - 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)" == "ldap - Win32 Release"
OUTDIR=.\module_Release
INTDIR=.\module_Release
# Begin Custom Macros
OutDir=.\module_Release
# End Custom Macros
ALL : "$(OUTDIR)\php3_ldap.dll"
CLEAN :
-@erase "$(INTDIR)\ldap.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\php3_ldap.dll"
-@erase "$(OUTDIR)\php3_ldap.exp"
-@erase "$(OUTDIR)\php3_ldap.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_LDAP=1 /D HAVE_NSLDAP=1 /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\ldap.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)\ldap.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=php.lib nsldap32v30.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_ldap.pdb" /machine:I386 /out:"$(OUTDIR)\php3_ldap.dll" /implib:"$(OUTDIR)\php3_ldap.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
LINK32_OBJS= \
"$(INTDIR)\ldap.obj"
"$(OUTDIR)\php3_ldap.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "ldap - Win32 Debug"
OUTDIR=.\module_Debug
INTDIR=.\module_Debug
# Begin Custom Macros
OutDir=.\module_Debug
# End Custom Macros
ALL : "$(OUTDIR)\php3_ldap.dll"
CLEAN :
-@erase "$(INTDIR)\ldap.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\php3_ldap.dll"
-@erase "$(OUTDIR)\php3_ldap.exp"
-@erase "$(OUTDIR)\php3_ldap.ilk"
-@erase "$(OUTDIR)\php3_ldap.lib"
-@erase "$(OUTDIR)\php3_ldap.pdb"
"$(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 HAVE_LDAP=1 /D HAVE_NSLDAP=1 /D "_DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\ldap.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)\ldap.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=php.lib nsldap32v30.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_ldap.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_ldap.dll" /implib:"$(OUTDIR)\php3_ldap.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
LINK32_OBJS= \
"$(INTDIR)\ldap.obj"
"$(OUTDIR)\php3_ldap.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("ldap.dep")
!INCLUDE "ldap.dep"
!ELSE
!MESSAGE Warning: cannot find "ldap.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "ldap - Win32 Release" || "$(CFG)" == "ldap - Win32 Debug"
SOURCE=.\functions\ldap.c
"$(INTDIR)\ldap.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF

7
libphp3.module.in Normal file
View file

@ -0,0 +1,7 @@
Name: php3_module
ConfigStart
RULE_WANTHSREGEX=@HSREGEX@
LIBS="@PHP_LIBS@ @DBM_LIB@ @ORACLE_LFLAGS@ @ORACLE_LIBS@ @IODBC_LFLAGS@ @IODBC_LIBS@ @SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@ @MYSQL_LFLAGS@ @MYSQL_LIBS@ @MSQL_LFLAGS@ @MSQL_LIBS@ @ADA_LFLAGS@ @ADA_LIBS@ @SOLID_LIBS@ @PGSQL_LFLAGS@ @PGSQL_LIBS@ @LDAP_LFLAGS@ @LDAP_LIBS@ @VELOCIS_LIBS@ @GD_LIBS@ @ZLIB_LIBS@ @CODBC_LFLAGS@ @CODBC_LIBS@ @IMAP_LIBS@ @IFX_LFLAGS@ @IFX_LIBS@ @SNMP_LFLAGS@ @SNMP_LIBS@ @IBASE_LFLAGS@ @IBASE_LIBS@ @PDFLIB_LIBS@ @XML_LIBS@ @LIBS@ @RDYNAMIC_LFLAGS@ $LIBS"
RULE_HIDE=yes
ConfigEnd

1064
ltconfig Normal file

File diff suppressed because it is too large Load diff

1813
ltmain.sh Normal file

File diff suppressed because it is too large Load diff

72
main.h Normal file
View file

@ -0,0 +1,72 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef _MAIN_H
#define _MAIN_H
#include "zend_globals.h"
#define INIT_ENVIRONMENT 0x80
#define INIT_REQUEST_INFO 0x400
#define INIT_FUNCTIONS 0x800
#define INIT_SCANNER 0x1000
#define INIT_CONFIG 0x10000
#define INIT_VARIABLE_UNASSIGN_STACK 0x20000
#define INIT_WINSOCK 0x100000
#define INIT_CLASS_TABLE 0x400000
int php3_request_startup(CLS_D ELS_DC);
extern void php3_request_shutdown(void *dummy INLINE_TLS);
extern void php3_request_shutdown_for_exec(void *dummy);
extern int php3_module_startup(CLS_D ELS_DC);
extern void php3_module_shutdown(INLINE_TLS_VOID);
extern void php3_module_shutdown_for_exec(void);
#ifndef THREAD_SAFE
extern unsigned char header_is_being_sent;
extern int initialized;
#endif
extern void php3_call_shutdown_functions(void);
/* configuration module */
extern int php3_init_config(void);
extern int php3_shutdown_config(void);
/* environment module */
extern int php3_init_environ(void);
extern int php3_shutdown_environ(void);
#endif

505
main/alloca.c Normal file
View file

@ -0,0 +1,505 @@
/* alloca.c -- allocate automatically reclaimed memory
(Mostly) portable public-domain implementation -- D A Gwyn
This implementation of the PWB library alloca function,
which is used to allocate space off the run-time stack so
that it is automatically reclaimed upon procedure exit,
was inspired by discussions with J. Q. Johnson of Cornell.
J.Otto Tennant <jot@cray.com> contributed the Cray support.
There are some preprocessor constants that can
be defined when compiling for your specific system, for
improved efficiency; however, the defaults should be okay.
The general concept of this implementation is to keep
track of all alloca-allocated blocks, and reclaim any
that are found to be deeper in the stack than the current
invocation. This heuristic does not reclaim storage as
soon as it becomes invalid, but it will do so eventually.
As a special case, alloca(0) reclaims storage without
allocating any. It is a good idea to use alloca(0) in
your main control loop, etc. to force garbage collection. */
#include <config.h>
#if !HAVE_ALLOCA
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef emacs
#include "blockinput.h"
#endif
/* If compiling with GCC 2, this file's not needed. */
#if !defined (__GNUC__) || __GNUC__ < 2
/* If someone has defined alloca as a macro,
there must be some other way alloca is supposed to work. */
#ifndef alloca
#ifdef emacs
#ifdef static
/* actually, only want this if static is defined as ""
-- this is for usg, in which emacs must undefine static
in order to make unexec workable
*/
#ifndef STACK_DIRECTION
you
lose
-- must know STACK_DIRECTION at compile-time
#endif /* STACK_DIRECTION undefined */
#endif /* static */
#endif /* emacs */
/* If your stack is a linked list of frames, you have to
provide an "address metric" ADDRESS_FUNCTION macro. */
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
long i00afunc ();
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
#else
#define ADDRESS_FUNCTION(arg) &(arg)
#endif
#if __STDC__
typedef void *pointer;
#else
typedef char *pointer;
#endif
#ifndef NULL
#define NULL 0
#endif
/* Different portions of Emacs need to call different versions of
malloc. The Emacs executable needs alloca to call xmalloc, because
ordinary malloc isn't protected from input signals. On the other
hand, the utilities in lib-src need alloca to call malloc; some of
them are very simple, and don't have an xmalloc routine.
Non-Emacs programs expect this to call use xmalloc.
Callers below should use malloc. */
#ifndef emacs
#define malloc xmalloc
#endif
extern pointer malloc ();
/* Define STACK_DIRECTION if you know the direction of stack
growth for your system; otherwise it will be automatically
deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#ifndef STACK_DIRECTION
#define STACK_DIRECTION 0 /* Direction unknown. */
#endif
#if STACK_DIRECTION != 0
#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
#else /* STACK_DIRECTION == 0; need run-time code. */
static int stack_dir; /* 1 or -1 once known. */
#define STACK_DIR stack_dir
static void
find_stack_direction ()
{
static char *addr = NULL; /* Address of first `dummy', once known. */
auto char dummy; /* To get stack address. */
if (addr == NULL)
{ /* Initial entry. */
addr = ADDRESS_FUNCTION (dummy);
find_stack_direction (); /* Recurse once. */
}
else
{
/* Second entry. */
if (ADDRESS_FUNCTION (dummy) > addr)
stack_dir = 1; /* Stack grew upward. */
else
stack_dir = -1; /* Stack grew downward. */
}
}
#endif /* STACK_DIRECTION == 0 */
/* An "alloca header" is used to:
(a) chain together all alloca'ed blocks;
(b) keep track of stack depth.
It is very important that sizeof(header) agree with malloc
alignment chunk size. The following default should work okay. */
#ifndef ALIGN_SIZE
#define ALIGN_SIZE sizeof(double)
#endif
typedef union hdr
{
char align[ALIGN_SIZE]; /* To force sizeof(header). */
struct
{
union hdr *next; /* For chaining headers. */
char *deep; /* For stack depth measure. */
} h;
} header;
static header *last_alloca_header = NULL; /* -> last alloca header. */
/* Return a pointer to at least SIZE bytes of storage,
which will be automatically reclaimed upon exit from
the procedure that called alloca. Originally, this space
was supposed to be taken from the current stack frame of the
caller, but that method cannot be made to work for some
implementations of C, for example under Gould's UTX/32. */
pointer
alloca (size)
unsigned size;
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);
#if STACK_DIRECTION == 0
if (STACK_DIR == 0) /* Unknown growth direction. */
find_stack_direction ();
#endif
/* Reclaim garbage, defined as all alloca'd storage that
was allocated from deeper in the stack than currently. */
{
register header *hp; /* Traverses linked list. */
#ifdef emacs
BLOCK_INPUT;
#endif
for (hp = last_alloca_header; hp != NULL;)
if ((STACK_DIR > 0 && hp->h.deep > depth)
|| (STACK_DIR < 0 && hp->h.deep < depth))
{
register header *np = hp->h.next;
free ((pointer) hp); /* Collect garbage. */
hp = np; /* -> next header. */
}
else
break; /* Rest are not deeper. */
last_alloca_header = hp; /* -> last valid storage. */
#ifdef emacs
UNBLOCK_INPUT;
#endif
}
if (size == 0)
return NULL; /* No allocation required. */
/* Allocate combined header + user data storage. */
{
register pointer new = malloc (sizeof (header) + size);
/* Address of header. */
if (new == 0)
abort();
((header *) new)->h.next = last_alloca_header;
((header *) new)->h.deep = depth;
last_alloca_header = (header *) new;
/* User storage begins just after header. */
return (pointer) ((char *) new + sizeof (header));
}
}
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
#ifdef DEBUG_I00AFUNC
#include <stdio.h>
#endif
#ifndef CRAY_STACK
#define CRAY_STACK
#ifndef CRAY2
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
struct stack_control_header
{
long shgrow:32; /* Number of times stack has grown. */
long shaseg:32; /* Size of increments to stack. */
long shhwm:32; /* High water mark of stack. */
long shsize:32; /* Current size of stack (all segments). */
};
/* The stack segment linkage control information occurs at
the high-address end of a stack segment. (The stack
grows from low addresses to high addresses.) The initial
part of the stack segment linkage control information is
0200 (octal) words. This provides for register storage
for the routine which overflows the stack. */
struct stack_segment_linkage
{
long ss[0200]; /* 0200 overflow words. */
long sssize:32; /* Number of words in this segment. */
long ssbase:32; /* Offset to stack base. */
long:32;
long sspseg:32; /* Offset to linkage control of previous
segment of stack. */
long:32;
long sstcpt:32; /* Pointer to task common address block. */
long sscsnm; /* Private control structure number for
microtasking. */
long ssusr1; /* Reserved for user. */
long ssusr2; /* Reserved for user. */
long sstpid; /* Process ID for pid based multi-tasking. */
long ssgvup; /* Pointer to multitasking thread giveup. */
long sscray[7]; /* Reserved for Cray Research. */
long ssa0;
long ssa1;
long ssa2;
long ssa3;
long ssa4;
long ssa5;
long ssa6;
long ssa7;
long sss0;
long sss1;
long sss2;
long sss3;
long sss4;
long sss5;
long sss6;
long sss7;
};
#else /* CRAY2 */
/* The following structure defines the vector of words
returned by the STKSTAT library routine. */
struct stk_stat
{
long now; /* Current total stack size. */
long maxc; /* Amount of contiguous space which would
be required to satisfy the maximum
stack demand to date. */
long high_water; /* Stack high-water mark. */
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
long hits; /* Number of internal buffer hits. */
long extends; /* Number of block extensions. */
long stko_mallocs; /* Block allocations by $STKOFEN. */
long underflows; /* Number of stack underflow calls ($STKRETN). */
long stko_free; /* Number of deallocations by $STKRETN. */
long stkm_free; /* Number of deallocations by $STKMRET. */
long segments; /* Current number of stack segments. */
long maxs; /* Maximum number of stack segments so far. */
long pad_size; /* Stack pad size. */
long current_address; /* Current stack segment address. */
long current_size; /* Current stack segment size. This
number is actually corrupted by STKSTAT to
include the fifteen word trailer area. */
long initial_address; /* Address of initial segment. */
long initial_size; /* Size of initial segment. */
};
/* The following structure describes the data structure which trails
any stack segment. I think that the description in 'asdef' is
out of date. I only describe the parts that I am sure about. */
struct stk_trailer
{
long this_address; /* Address of this block. */
long this_size; /* Size of this block (does not include
this trailer). */
long unknown2;
long unknown3;
long link; /* Address of trailer block of previous
segment. */
long unknown5;
long unknown6;
long unknown7;
long unknown8;
long unknown9;
long unknown10;
long unknown11;
long unknown12;
long unknown13;
long unknown14;
};
#endif /* CRAY2 */
#endif /* not CRAY_STACK */
#ifdef CRAY2
/* Determine a "stack measure" for an arbitrary ADDRESS.
I doubt that "lint" will like this much. */
static long
i00afunc (long *address)
{
struct stk_stat status;
struct stk_trailer *trailer;
long *block, size;
long result = 0;
/* We want to iterate through all of the segments. The first
step is to get the stack status structure. We could do this
more quickly and more directly, perhaps, by referencing the
$LM00 common block, but I know that this works. */
STKSTAT (&status);
/* Set up the iteration. */
trailer = (struct stk_trailer *) (status.current_address
+ status.current_size
- 15);
/* There must be at least one stack segment. Therefore it is
a fatal error if "trailer" is null. */
if (trailer == 0)
abort ();
/* Discard segments that do not contain our argument address. */
while (trailer != 0)
{
block = (long *) trailer->this_address;
size = trailer->this_size;
if (block == 0 || size == 0)
abort ();
trailer = (struct stk_trailer *) trailer->link;
if ((block <= address) && (address < (block + size)))
break;
}
/* Set the result to the offset in this segment and add the sizes
of all predecessor segments. */
result = address - block;
if (trailer == 0)
{
return result;
}
do
{
if (trailer->this_size <= 0)
abort ();
result += trailer->this_size;
trailer = (struct stk_trailer *) trailer->link;
}
while (trailer != 0);
/* We are done. Note that if you present a bogus address (one
not in any segment), you will get a different number back, formed
from subtracting the address of the first block. This is probably
not what you want. */
return (result);
}
#else /* not CRAY2 */
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
Determine the number of the cell within the stack,
given the address of the cell. The purpose of this
routine is to linearize, in some sense, stack addresses
for alloca. */
static long
i00afunc (long address)
{
long stkl = 0;
long size, pseg, this_segment, stack;
long result = 0;
struct stack_segment_linkage *ssptr;
/* Register B67 contains the address of the end of the
current stack segment. If you (as a subprogram) store
your registers on the stack and find that you are past
the contents of B67, you have overflowed the segment.
B67 also points to the stack segment linkage control
area, which is what we are really interested in. */
stkl = CRAY_STACKSEG_END ();
ssptr = (struct stack_segment_linkage *) stkl;
/* If one subtracts 'size' from the end of the segment,
one has the address of the first word of the segment.
If this is not the first segment, 'pseg' will be
nonzero. */
pseg = ssptr->sspseg;
size = ssptr->sssize;
this_segment = stkl - size;
/* It is possible that calling this routine itself caused
a stack overflow. Discard stack segments which do not
contain the target address. */
while (!(this_segment <= address && address <= stkl))
{
#ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
#endif
if (pseg == 0)
break;
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
this_segment = stkl - size;
}
result = address - this_segment;
/* If you subtract pseg from the current end of the stack,
you get the address of the previous stack segment's end.
This seems a little convoluted to me, but I'll bet you save
a cycle somewhere. */
while (pseg != 0)
{
#ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o\n", pseg, size);
#endif
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
result += size;
}
return (result);
}
#endif /* not CRAY2 */
#endif /* CRAY */
#endif /* no alloca */
#endif /* not GCC version 2 */
#endif /* HAVE_ALLOCA */

294
main/config.w32.h Normal file
View file

@ -0,0 +1,294 @@
/* config.w32.h. Configure file for win32 platforms */
/* tested only with MS Visual C++ V5 */
/* if you have resolv.lib and lib44bsd95.lib you can compile the extra
dns functions located in dns.c. Set this to 1. add resolv.lib and
lib33bsd95.lib to the project settings, and add the path to the
bind include directory to the preprocessor settings. These libs
are availabe in the ntbind distribution */
#define HAVE_BINDLIB 1
/* set to enable bcmath */
#define WITH_BCMATH 1
/* should be added to runtime config*/
#define PHP3_URL_FOPEN 1
/* ----------------------------------------------------------------
The following are defaults for run-time configuration
---------------------------------------------------------------*/
#define PHP_SAFE_MODE 0
#define MAGIC_QUOTES 0
/* This is the default configuration file to read */
#define CONFIGURATION_FILE_PATH "php3.ini"
#define USE_CONFIG_FILE 1
/* Undefine if you want stricter XML/SGML compliance by default */
/* this disables "<?expression?>" and "<?=expression?>" */
#define DEFAULT_SHORT_OPEN_TAG 1
#define PHP_TRACK_VARS 1
/* ----------------------------------------------------------------
The following defines are for those modules which require
external libraries to compile. These will be removed from
here in a future beta, as these modules will be moved out to dll's
---------------------------------------------------------------*/
#if !defined(COMPILE_DL)
#define HAVE_SNMP 0
#define HAVE_MYSQL 0
# define HAVE_ERRMSG_H 0 /*needed for mysql 3.21.17 and up*/
#define HAVE_LDAP 0
#define DBASE 0
#define NDBM 0
#define GDBM 0
#define BSD2 0
#define HAVE_CRYPT 0
#define HAVE_ORACLE 0
#define HAVE_ADABAS 0
#define HAVE_SOLID 0
#define HAVE_MSQL 0
#define HAVE_PGSQL 0
#define HAVE_SYBASE 0
#define HAVE_LIBGD 0
#define HAVE_FILEPRO 0
#define HAVE_ZLIB 0
#endif
/* ----------------------------------------------------------------
The following may or may not be (or need to be) ported to the
windows environment.
---------------------------------------------------------------*/
/* Define if you have the link function. */
#define HAVE_LINK 0
/* Define if you have the lockf function. */
/* #undef HAVE_LOCKF */
/* Define if you have the lrand48 function. */
/* #undef HAVE_LRAND48 */
/* Define if you have the srand48 function. */
/* #undef HAVE_SRAND48 */
/* Define if you have the symlink function. */
#define HAVE_SYMLINK 0
/* Define if you have the usleep function. */
#define HAVE_USLEEP 1
#define NEED_ISBLANK 1
/* ----------------------------------------------------------------
The following may be changed and played with right now, but
will move to the "don't touch" list below eventualy.
---------------------------------------------------------------*/
/*#define APACHE 0 defined in preprocessor section*/
/* ----------------------------------------------------------------
The following should never need to be played with
Functions defined to 0 or remarked out are either already
handled by the standard VC libraries, or are no longer needed, or
simply will/can not be ported.
DONT TOUCH!!!!! Unless you realy know what your messing with!
---------------------------------------------------------------*/
#define DISCARD_PATH 1
#define HAVE_SETITIMER 0
#define HAVE_IODBC 0 /*getting rid of old odbc*/
#define HAVE_UODBC 0
#define HAVE_LIBDL 1
#define HAVE_SENDMAIL 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_PUTENV 1
#define HAVE_LIMITS_H 1
#define HAVE_TZSET 1
/* Define if you have the flock function. */
#define HAVE_FLOCK 1
/* Define if using alloca.c. */
/* #undef C_ALLOCA */
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
/* #undef CRAY_STACKSEG_END */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef gid_t */
/* Define if you have alloca, as a function or macro. */
#define HAVE_ALLOCA 1
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
/* #undef HAVE_ALLOCA_H */
/* Define if you have <sys/time.h> */
#define HAVE_SYS_TIME_H 0
/* Define if you have <signal.h> */
#define HAVE_SIGNAL_H 1
/* Define if you don't have vprintf but do have _doprnt. */
/* #undef HAVE_DOPRNT */
/* Define if your struct stat has st_blksize. */
#define HAVE_ST_BLKSIZE 0
/* Define if your struct stat has st_blocks. */
#define HAVE_ST_BLOCKS 0
/* Define if your struct stat has st_rdev. */
#define HAVE_ST_RDEV 1
/* Define if utime(file, NULL) sets file's timestamp to the present. */
#define HAVE_UTIME_NULL 1
/* Define if you have the vprintf function. */
#define HAVE_VPRINTF 1
/* Define to `unsigned' if <sys/types.h> doesn't define. */
/* #undef size_t */
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
/* #undef STACK_DIRECTION */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if your <sys/time.h> declares struct tm. */
/* #undef TM_IN_SYS_TIME */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef uid_t */
/* Define both of these if you want the bundled REGEX library */
#define REGEX 1
#define HSREGEX 1
/* Define if you have the gcvt function. */
#define HAVE_GCVT 1
/* Define if you have the getlogin function. */
#define HAVE_GETLOGIN 1
/* Define if you have the gettimeofday function. */
#define HAVE_GETTIMEOFDAY 1
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY 1
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE 1
/* Define if you have the putenv function. */
#define HAVE_PUTENV 1
/* Define if you have the regcomp function. */
#define HAVE_REGCOMP 1
/* Define if you have the setlocale function. */
#define HAVE_SETLOCALE 1
/* Define if you have the setvbuf function. */
#ifndef HAVE_BINDLIB
#define HAVE_SETVBUF 1
#endif
/* Define if you have the snprintf function. */
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
/* Define if you have the strcasecmp function. */
#define HAVE_STRCASECMP 1
/* Define if you have the strdup function. */
#define HAVE_STRDUP 1
/* Define if you have the strerror function. */
#define HAVE_STRERROR 1
/* Define if you have the strstr function. */
#define HAVE_STRSTR 1
/* Define if you have the tempnam function. */
#define HAVE_TEMPNAM 1
/* Define if you have the utime function. */
#define HAVE_UTIME 1
/* Define if you have the <crypt.h> header file. */
/* #undef HAVE_CRYPT_H */
/* Define if you have the <dirent.h> header file. */
#define HAVE_DIRENT_H 0
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <grp.h> header file. */
#define HAVE_GRP_H 0
/* Define if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define if you have the <ndir.h> header file. */
/* #undef HAVE_NDIR_H */
/* Define if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
/* Define if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define if you have the <sys/dir.h> header file. */
/* #undef HAVE_SYS_DIR_H */
/* Define if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1
/* Define if you have the <sys/ndir.h> header file. */
/* #undef HAVE_SYS_NDIR_H */
/* Define if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 0
/* Define if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 0
/* Define if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H 1
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 0
/* Define if you have the crypt library (-lcrypt). */
/* #undef HAVE_LIBCRYPT 0 */
/* Define if you have the dl library (-ldl). */
#define HAVE_LIBDL 1
/* Define if you have the m library (-lm). */
#define HAVE_LIBM 1
/* Define if you have the nsl library (-lnsl). */
/* #undef HAVE_LIBNSL */
/* Define if you have the socket library (-lsocket). */
/* #undef HAVE_LIBSOCKET */
/* Define if you have the cuserid function. */
#define HAVE_CUSERID 0
/* Define if you have the rint function. */
#undef HAVE_RINT
#define HAVE_STRFTIME 1

415
main/configuration-parser.y Normal file
View file

@ -0,0 +1,415 @@
%{
/*
+----------------------------------------------------------------------+
| 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: Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#define DEBUG_CFG_PARSER 1
#include "php.h"
#include "functions/dl.h"
#include "functions/file.h"
#include "functions/php3_browscap.h"
#include "zend_extensions.h"
#if WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winbase.h>
#include "win32/wfile.h"
#endif
#undef YYSTYPE
#define YYSTYPE pval
#define PARSING_MODE_CFG 0
#define PARSING_MODE_BROWSCAP 1
static HashTable configuration_hash;
#ifndef THREAD_SAFE
extern HashTable browser_hash;
extern char *php3_ini_path;
#endif
static HashTable *active__php3_hash_table;
static pval *current_section;
static char *currently_parsed_filename;
static int parsing_mode;
pval yylval;
extern int cfglex(pval *cfglval);
extern FILE *cfgin;
extern int cfglineno;
extern void init_cfg_scanner(void);
pval *cfg_get_entry(char *name, uint name_length)
{
pval *tmp;
if (_php3_hash_find(&configuration_hash, name, name_length, (void **) &tmp)==SUCCESS) {
return tmp;
} else {
return NULL;
}
}
PHPAPI int cfg_get_long(char *varname,long *result)
{
pval *tmp,var;
if (_php3_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) {
*result=(long)NULL;
return FAILURE;
}
var = *tmp;
pval_copy_constructor(&var);
convert_to_long(&var);
*result = var.value.lval;
return SUCCESS;
}
PHPAPI int cfg_get_double(char *varname,double *result)
{
pval *tmp,var;
if (_php3_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) {
*result=(double)0;
return FAILURE;
}
var = *tmp;
pval_copy_constructor(&var);
convert_to_double(&var);
*result = var.value.dval;
return SUCCESS;
}
PHPAPI int cfg_get_string(char *varname, char **result)
{
pval *tmp;
if (_php3_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) {
*result=NULL;
return FAILURE;
}
*result = tmp->value.str.val;
return SUCCESS;
}
static void yyerror(char *str)
{
fprintf(stderr,"PHP: Error parsing %s on line %d\n",currently_parsed_filename,cfglineno);
}
static void pvalue_config_destructor(pval *pvalue)
{
if (pvalue->type == IS_STRING && pvalue->value.str.val != empty_string) {
free(pvalue->value.str.val);
}
}
static void pvalue_browscap_destructor(pval *pvalue)
{
if (pvalue->type == IS_OBJECT || pvalue->type == IS_ARRAY) {
_php3_hash_destroy(pvalue->value.ht);
free(pvalue->value.ht);
}
}
int php3_init_config(void)
{
TLS_VARS;
if (_php3_hash_init(&configuration_hash, 0, NULL, (void (*)(void *))pvalue_config_destructor, 1)==FAILURE) {
return FAILURE;
}
#if USE_CONFIG_FILE
{
char *env_location,*default_location,*php_ini_path;
int safe_mode_state = php3_ini.safe_mode;
char *opened_path;
int free_default_location=0;
env_location = getenv("PHPRC");
if (!env_location) {
env_location="";
}
#if WIN32|WINNT
{
if (GLOBAL(php3_ini_path)) {
default_location = GLOBAL(php3_ini_path);
} else {
default_location = (char *) malloc(512);
if (!GetWindowsDirectory(default_location,255)) {
default_location[0]=0;
}
free_default_location=1;
}
}
#else
if (!GLOBAL(php3_ini_path)) {
default_location = CONFIGURATION_FILE_PATH;
} else {
default_location = GLOBAL(php3_ini_path);
}
#endif
/* build a path */
php_ini_path = (char *) malloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
if (!GLOBAL(php3_ini_path)) {
#if WIN32|WINNT
sprintf(php_ini_path,".;%s;%s",env_location,default_location);
#else
sprintf(php_ini_path,".:%s:%s",env_location,default_location);
#endif
} else {
/* if path was set via -c flag, only look there */
strcpy(php_ini_path,default_location);
}
php3_ini.safe_mode = 0;
cfgin = php3_fopen_with_path("php3.ini","r",php_ini_path,&opened_path);
free(php_ini_path);
if (free_default_location) {
free(default_location);
}
php3_ini.safe_mode = safe_mode_state;
if (!cfgin) {
# if WIN32|WINNT
return FAILURE;
# else
return SUCCESS; /* having no configuration file is ok */
# endif
}
if (opened_path) {
pval tmp;
tmp.value.str.val = opened_path;
tmp.value.str.len = strlen(opened_path);
tmp.type = IS_STRING;
_php3_hash_update(&configuration_hash,"cfg_file_path",sizeof("cfg_file_path"),(void *) &tmp,sizeof(pval),NULL);
#if 0
php3_printf("INI file opened at '%s'\n",opened_path);
#endif
}
init_cfg_scanner();
active__php3_hash_table = &configuration_hash;
parsing_mode = PARSING_MODE_CFG;
currently_parsed_filename = "php3.ini";
yyparse();
fclose(cfgin);
}
#endif
return SUCCESS;
}
int php3_minit_browscap(INIT_FUNC_ARGS)
{
TLS_VARS;
if (php3_ini.browscap) {
if (_php3_hash_init(&GLOBAL(browser_hash), 0, NULL, (void (*)(void *))pvalue_browscap_destructor, 1)==FAILURE) {
return FAILURE;
}
cfgin = fopen(php3_ini.browscap,"r");
if (!cfgin) {
php3_error(E_WARNING,"Cannot open '%s' for reading",php3_ini.browscap);
return FAILURE;
}
init_cfg_scanner();
active__php3_hash_table = &GLOBAL(browser_hash);
parsing_mode = PARSING_MODE_BROWSCAP;
currently_parsed_filename = php3_ini.browscap;
yyparse();
fclose(cfgin);
}
return SUCCESS;
}
int php3_shutdown_config(void)
{
_php3_hash_destroy(&configuration_hash);
return SUCCESS;
}
int php3_mshutdown_browscap(void)
{
TLS_VARS;
if (php3_ini.browscap) {
_php3_hash_destroy(&GLOBAL(browser_hash));
}
return SUCCESS;
}
static void convert_browscap_pattern(pval *pattern)
{
register int i,j;
char *t;
for (i=0; i<pattern->value.str.len; i++) {
if (pattern->value.str.val[i]=='*' || pattern->value.str.val[i]=='?') {
break;
}
}
if (i==pattern->value.str.len) { /* no wildcards */
return;
}
t = (char *) malloc(pattern->value.str.len*2);
for (i=0,j=0; i<pattern->value.str.len; i++,j++) {
switch (pattern->value.str.val[i]) {
case '?':
t[j] = '.';
break;
case '*':
t[j++] = '.';
t[j] = '*';
break;
case '.':
t[j++] = '\\';
t[j] = '.';
break;
default:
t[j] = pattern->value.str.val[i];
break;
}
}
t[j]=0;
free(pattern->value.str.val);
pattern->value.str.val = t;
pattern->value.str.len = j;
return;
}
%}
%pure_parser
%token TC_STRING
%token TC_ENCAPSULATED_STRING
%token SECTION
%token CFG_TRUE
%token CFG_FALSE
%token EXTENSION
%token T_ZEND_EXTENSION
%%
statement_list:
statement_list statement
| /* empty */
;
statement:
string '=' string_or_value {
#if 0
printf("'%s' = '%s'\n",$1.value.str.val,$3.value.str.val);
#endif
$3.type = IS_STRING;
if (parsing_mode==PARSING_MODE_CFG) {
_php3_hash_update(active__php3_hash_table, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(pval), NULL);
} else if (parsing_mode==PARSING_MODE_BROWSCAP) {
php3_str_tolower($1.value.str.val,$1.value.str.len);
_php3_hash_update(current_section->value.ht, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(pval), NULL);
}
free($1.value.str.val);
}
| string { free($1.value.str.val); }
| EXTENSION '=' string {
pval dummy;
#if 0
printf("Loading '%s'\n",$3.value.str.val);
#endif
php3_dl(&$3,MODULE_PERSISTENT,&dummy);
}
| T_ZEND_EXTENSION '=' string { zend_load_extension($3.value.str.val); free($3.value.str.val); }
| SECTION {
if (parsing_mode==PARSING_MODE_BROWSCAP) {
pval tmp;
/*printf("'%s' (%d)\n",$1.value.str.val,$1.value.str.len+1);*/
tmp.value.ht = (HashTable *) malloc(sizeof(HashTable));
_php3_hash_init(tmp.value.ht, 0, NULL, (void (*)(void *))pvalue_config_destructor, 1);
tmp.type = IS_OBJECT;
_php3_hash_update(active__php3_hash_table, $1.value.str.val, $1.value.str.len+1, (void *) &tmp, sizeof(pval), (void **) &current_section);
tmp.value.str.val = php3_strndup($1.value.str.val,$1.value.str.len);
tmp.value.str.len = $1.value.str.len;
tmp.type = IS_STRING;
convert_browscap_pattern(&tmp);
_php3_hash_update(current_section->value.ht,"browser_name_pattern",sizeof("browser_name_pattern"),(void *) &tmp, sizeof(pval), NULL);
}
free($1.value.str.val);
}
| '\n'
;
string:
TC_STRING { $$ = $1; }
| TC_ENCAPSULATED_STRING { $$ = $1; }
;
string_or_value:
string { $$ = $1; }
| CFG_TRUE { $$ = $1; }
| CFG_FALSE { $$ = $1; }
| '\n' { $$.value.str.val = strdup(""); $$.value.str.len=0; $$.type = IS_STRING; }
;
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/

View file

@ -0,0 +1,170 @@
%{
/*
+----------------------------------------------------------------------+
| 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 the GNU General Public License as published by |
| the Free Software Foundation; either version 2 of the License, or |
| (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
+----------------------------------------------------------------------+
| Authors: Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
#include "php.h"
#include "configuration-parser.h"
#undef YYSTYPE
#define YYSTYPE pval
#define YY_DECL cfglex(pval *cfglval)
void init_cfg_scanner()
{
cfglineno=1;
}
%}
%option noyywrap
%option yylineno
%%
<INITIAL>"extension" {
#if 0
printf("found extension\n");
#endif
return EXTENSION;
}
<INITIAL>"zend_extension" {
return T_ZEND_EXTENSION;
}
<INITIAL>[ ]*("true"|"on"|"yes")[ ]* {
cfglval->value.str.val = php3_strndup("1",1);
cfglval->value.str.len = 1;
cfglval->type = IS_STRING;
return CFG_TRUE;
}
<INITIAL>[ ]*("false"|"off"|"no")[ ]* {
cfglval->value.str.val = php3_strndup("",0);
cfglval->value.str.len = 0;
cfglval->type = IS_STRING;
return CFG_FALSE;
}
<INITIAL>[[][^[]+[\]]([\n]?|"\r\n"?) {
/* SECTION */
/* eat trailng ] */
while (yyleng>0 && (yytext[yyleng-1]=='\n' || yytext[yyleng-1]=='\r' || yytext[yyleng-1]==']')) {
yyleng--;
yytext[yyleng]=0;
}
/* eat leading [ */
yytext++;
yyleng--;
cfglval->value.str.val = php3_strndup(yytext,yyleng);
cfglval->value.str.len = yyleng;
cfglval->type = IS_STRING;
return SECTION;
}
<INITIAL>["][^\n\r"]*["] {
/* ENCAPSULATED TC_STRING */
register int i;
/* eat trailing " */
yytext[yyleng-1]=0;
/* eat leading " */
yytext++;
cfglval->value.str.val = php3_strndup(yytext,yyleng);
cfglval->value.str.len = yyleng;
cfglval->type = IS_STRING;
return TC_ENCAPSULATED_STRING;
}
<INITIAL>[^=\n\r\t;"]+ {
/* STRING */
register int i;
/* eat trailing whitespace */
for (i=yyleng-1; i>=0; i--) {
if (yytext[i]==' ' || yytext[i]=='\t') {
yytext[i]=0;
yyleng--;
} else {
break;
}
}
/* eat leading whitespace */
while (yytext[0]) {
if (yytext[0]==' ' || yytext[0]=='\t') {
yytext++;
yyleng--;
} else {
break;
}
}
if (yyleng!=0) {
cfglval->value.str.val = php3_strndup(yytext,yyleng);
cfglval->value.str.len = yyleng;
cfglval->type = IS_STRING;
return TC_STRING;
} else {
/* whitespace */
}
}
<INITIAL>[=\n] {
return yytext[0];
}
<INITIAL>"\r\n" {
return '\n';
}
<INITIAL>[;][^\r\n]*[\r\n]? {
/* comment */
return '\n';
}
<INITIAL>[ \t] {
/* eat whitespace */
}
<INITIAL>. {
#if DEBUG
php3_error(E_NOTICE,"Unexpected character on line %d: '%s' (ASCII %d)\n",yylineno,yytext,yytext[0]);
#endif
}

1000
main/fopen_wrappers.c Normal file

File diff suppressed because it is too large Load diff

90
main/fopen_wrappers.h Normal file
View file

@ -0,0 +1,90 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef _FOPEN_WRAPPERS_H
#define _FOPEN_WRAPPERS_H
#define IGNORE_PATH 0
#define USE_PATH 1
#define IGNORE_URL 2
/* There's no USE_URL. */
#if WIN32|WINNT
# define IGNORE_URL_WIN 2
#else
# define IGNORE_URL_WIN 0
#endif
#define ENFORCE_SAFE_MODE 4
#if WIN32|WINNT
# define SOCK_ERR INVALID_SOCKET
# define SOCK_CONN_ERR SOCKET_ERROR
# define SOCK_RECV_ERR SOCKET_ERROR
# define SOCK_FCLOSE(s) closesocket(s)
#else
# define SOCK_ERR -1
# define SOCK_CONN_ERR -1
# define SOCK_RECV_ERR -1
# define SOCK_FCLOSE(s) close(s)
#endif
#define SOCK_WRITE(d,s) send(s,d,strlen(d),0)
#define SOCK_WRITEL(d,l,s) send(s,d,l,0)
#define SOCK_FGETC(c,s) recv(s,c,1,0)
#define SOCK_FGETS(b,l,s) _php3_sock_fgets((b),(l),(s))
/* values for issock */
#define IS_NOT_SOCKET 0
#define IS_SOCKET 1
#define BAD_URL 2
#ifndef THREAD_SAFE
extern int wsa_fp; /* a list for open sockets */
#endif
extern PHPAPI FILE *php3_fopen_wrapper(char *filename, char *mode, int options, int *issock, int *socketd);
extern FILE *php3_fopen_for_parser(void);
extern PHPAPI int _php3_check_open_basedir(char *path);
extern PHPAPI FILE *php3_fopen_with_path(char *filename, char *mode, char *path, char **opened_path);
extern PHPAPI int php3_isurl(char *path);
extern PHPAPI char *php3_strip_url_passwd(char *path);
extern PHPAPI int php3_write(void *buf, int size);
extern PHPAPI char *expand_filepath(char *filepath);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/

View file

@ -0,0 +1,57 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef _INTERNAL_FUNCTIONS_REGISTRY_H
#define _INTERNAL_FUNCTIONS_REGISTRY_H
extern int php3_init_mime(INIT_FUNC_ARGS);
#if APACHE
extern php3_module_entry apache_module_entry;
#define apache_module_ptr &apache_module_entry
extern void php3_virtual(INTERNAL_FUNCTION_PARAMETERS);
#else
#define apache_module_ptr NULL
#endif
/* environment functions */
extern int php3_init_environment(void);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/

805
main/logos.h Normal file
View file

@ -0,0 +1,805 @@
unsigned char zendtech_logo[] = {
71, 73, 70, 56, 57, 97, 100, 0, 89, 0,
247, 255, 0, 255, 255, 255, 8, 8, 8, 16,
16, 16, 33, 33, 33, 49, 49, 49, 57, 57,
57, 66, 66, 66, 74, 74, 74, 82, 82, 82,
90, 90, 90, 99, 99, 99, 115, 115, 115, 123,
123, 123, 140, 140, 140, 148, 148, 148, 156, 156,
156, 165, 165, 165, 173, 173, 173, 181, 181, 181,
189, 189, 189, 206, 206, 206, 222, 222, 222, 239,
239, 239, 148, 156, 156, 239, 247, 255, 0, 8,
16, 189, 198, 214, 123, 132, 148, 231, 239, 255,
99, 107, 123, 16, 33, 66, 0, 8, 24, 181,
189, 206, 140, 148, 165, 115, 123, 140, 222, 231,
255, 24, 41, 90, 181, 189, 214, 165, 173, 198,
140, 148, 173, 82, 99, 156, 24, 41, 99, 0,
8, 33, 189, 198, 231, 156, 165, 198, 123, 132,
165, 165, 181, 239, 90, 107, 173, 74, 90, 148,
24, 33, 66, 49, 74, 165, 214, 222, 255, 189,
198, 239, 140, 148, 181, 123, 132, 173, 99, 107,
140, 90, 99, 140, 49, 57, 90, 57, 74, 148,
49, 66, 140, 16, 24, 57, 8, 16, 49, 206,
214, 255, 165, 173, 214, 140, 156, 231, 140, 156,
239, 107, 123, 198, 115, 132, 214, 123, 140, 231,
99, 115, 198, 90, 107, 189, 41, 49, 90, 82,
99, 189, 66, 82, 156, 33, 41, 82, 90, 115,
239, 82, 107, 231, 57, 74, 165, 74, 99, 214,
49, 66, 148, 49, 66, 156, 57, 82, 206, 33,
49, 123, 57, 82, 214, 16, 24, 66, 24, 41,
123, 189, 198, 247, 181, 189, 239, 189, 198, 255,
132, 140, 189, 107, 115, 165, 140, 156, 247, 74,
82, 132, 132, 148, 239, 123, 140, 239, 115, 132,
231, 57, 66, 115, 99, 115, 206, 107, 123, 222,
57, 66, 123, 49, 57, 107, 90, 107, 206, 90,
107, 214, 82, 99, 198, 66, 82, 181, 57, 74,
181, 49, 66, 165, 24, 33, 82, 66, 90, 231,
49, 66, 173, 41, 57, 148, 24, 33, 90, 41,
57, 156, 33, 49, 140, 33, 49, 148, 8, 16,
66, 181, 189, 247, 173, 181, 239, 156, 165, 231,
132, 140, 198, 107, 115, 173, 74, 82, 140, 66,
74, 132, 107, 123, 231, 99, 115, 231, 82, 99,
214, 74, 90, 198, 82, 99, 222, 74, 90, 206,
66, 82, 189, 33, 41, 99, 66, 82, 198, 57,
74, 189, 57, 74, 198, 49, 66, 181, 49, 66,
189, 41, 57, 165, 24, 33, 99, 16, 24, 82,
8, 16, 74, 173, 181, 247, 165, 173, 239, 165,
173, 247, 140, 148, 214, 156, 165, 239, 148, 156,
239, 132, 140, 214, 156, 165, 255, 115, 123, 189,
123, 132, 206, 132, 140, 222, 115, 123, 198, 123,
132, 214, 99, 107, 173, 123, 132, 222, 99, 107,
189, 90, 99, 173, 74, 82, 148, 82, 90, 165,
90, 99, 181, 74, 82, 156, 82, 90, 173, 90,
99, 189, 41, 49, 115, 74, 90, 231, 41, 49,
132, 33, 41, 107, 66, 82, 222, 33, 41, 123,
24, 33, 107, 24, 33, 123, 16, 24, 90, 148,
156, 255, 140, 148, 255, 115, 123, 222, 123, 132,
239, 107, 115, 214, 123, 132, 247, 99, 107, 206,
107, 115, 222, 115, 123, 239, 99, 107, 222, 82,
90, 189, 74, 82, 173, 49, 57, 148, 247, 247,
255, 198, 198, 206, 214, 214, 222, 222, 222, 231,
165, 165, 173, 156, 156, 165, 115, 115, 123, 239,
239, 255, 107, 107, 115, 214, 214, 231, 198, 198,
214, 231, 231, 255, 222, 222, 247, 140, 140, 156,
66, 66, 74, 123, 123, 140, 222, 222, 255, 206,
206, 239, 132, 132, 156, 41, 41, 49, 165, 165,
198, 123, 123, 148, 156, 156, 189, 74, 74, 90,
198, 198, 255, 132, 132, 173, 24, 24, 33, 156,
156, 214, 41, 41, 57, 148, 148, 206, 165, 165,
231, 99, 99, 140, 156, 156, 222, 173, 173, 247,
74, 74, 107, 165, 165, 239, 165, 165, 247, 82,
82, 123, 132, 132, 198, 140, 140, 214, 123, 123,
189, 74, 74, 115, 90, 90, 140, 99, 99, 156,
66, 66, 107, 90, 90, 148, 74, 74, 123, 99,
99, 165, 49, 49, 82, 123, 123, 206, 66, 66,
115, 82, 82, 148, 8, 8, 16, 41, 41, 82,
24, 24, 49, 41, 41, 90, 33, 33, 74, 24,
24, 57, 41, 41, 99, 24, 24, 66, 8, 8,
24, 16, 16, 49, 24, 24, 74, 8, 8, 41,
16, 16, 90, 8, 8, 49, 8, 8, 57, 0,
0, 8, 0, 0, 16, 0, 0, 24, 0, 0,
0, 44, 0, 0, 0, 0, 100, 0, 89, 0,
0, 8, 255, 0, 255, 9, 28, 72, 176, 160,
193, 131, 8, 19, 42, 92, 200, 176, 161, 195,
135, 16, 35, 74, 156, 72, 177, 162, 197, 139,
24, 51, 106, 220, 200, 177, 34, 0, 3, 14,
1, 76, 96, 104, 0, 64, 199, 147, 9, 63,
58, 124, 48, 114, 97, 73, 148, 48, 11, 126,
36, 32, 0, 193, 2, 5, 2, 6, 10, 88,
176, 0, 228, 130, 145, 11, 6, 8, 28, 176,
64, 160, 0, 5, 11, 26, 152, 28, 202, 51,
231, 63, 162, 65, 99, 90, 252, 56, 193, 130,
72, 11, 20, 4, 18, 176, 80, 97, 2, 0,
164, 35, 85, 254, 123, 57, 160, 66, 87, 0,
75, 21, 0, 160, 96, 246, 159, 90, 182, 22,
64, 74, 157, 248, 81, 0, 0, 4, 79, 239,
254, 155, 16, 97, 232, 191, 159, 255, 196, 190,
140, 48, 33, 192, 63, 4, 38, 5, 88, 40,
250, 116, 175, 5, 2, 135, 231, 82, 84, 41,
118, 66, 81, 177, 2, 1, 11, 54, 185, 249,
31, 5, 145, 19, 20, 12, 124, 240, 85, 242,
100, 144, 149, 139, 90, 16, 61, 16, 112, 5,
198, 47, 87, 11, 124, 73, 186, 65, 79, 130,
106, 27, 152, 150, 72, 89, 174, 229, 191, 185,
20, 24, 104, 64, 0, 240, 130, 224, 6, 34,
124, 93, 96, 33, 88, 114, 11, 2, 41, 80,
64, 128, 64, 183, 205, 228, 0, 32, 239, 126,
216, 91, 224, 239, 191, 86, 39, 48, 255, 99,
208, 146, 185, 72, 158, 224, 69, 50, 51, 170,
60, 23, 131, 127, 4, 118, 1, 168, 128, 119,
187, 253, 251, 248, 243, 235, 223, 207, 191, 191,
255, 255, 0, 6, 40, 96, 63, 213, 240, 115,
145, 129, 4, 241, 51, 13, 74, 253, 32, 216,
16, 63, 14, 58, 84, 141, 10, 7, 22, 100,
79, 63, 21, 69, 88, 80, 63, 24, 62, 216,
96, 68, 238, 188, 115, 160, 131, 246, 188, 163,
33, 68, 39, 14, 244, 193, 7, 13, 113, 152,
226, 66, 241, 196, 112, 224, 135, 242, 20, 104,
17, 132, 8, 181, 163, 194, 139, 3, 245, 179,
227, 68, 42, 120, 211, 97, 69, 25, 244, 67,
79, 14, 25, 189, 200, 143, 10, 63, 34, 228,
227, 144, 17, 241, 35, 14, 61, 23, 113, 88,
142, 61, 73, 190, 216, 142, 62, 248, 188, 168,
66, 151, 21, 197, 67, 78, 61, 22, 249, 232,
13, 150, 25, 65, 89, 144, 10, 115, 52, 57,
16, 132, 248, 184, 41, 81, 61, 230, 228, 161,
130, 139, 16, 230, 169, 231, 158, 255, 24, 200,
79, 61, 243, 96, 67, 97, 150, 8, 169, 176,
200, 62, 245, 248, 217, 103, 63, 248, 240, 32,
103, 65, 245, 212, 163, 102, 130, 60, 88, 99,
14, 15, 246, 168, 16, 233, 166, 156, 110, 218,
78, 6, 1, 64, 216, 143, 34, 90, 80, 169,
17, 63, 44, 26, 196, 15, 62, 139, 220, 131,
79, 61, 160, 102, 255, 144, 1, 62, 84, 232,
51, 41, 65, 211, 84, 147, 78, 58, 242, 216,
67, 38, 65, 25, 168, 192, 5, 29, 225, 128,
113, 15, 166, 61, 216, 147, 236, 178, 246, 224,
51, 205, 171, 155, 226, 147, 137, 20, 237, 112,
228, 207, 137, 25, 244, 240, 198, 42, 84, 196,
217, 78, 61, 172, 46, 242, 168, 170, 237, 216,
147, 206, 54, 56, 228, 208, 32, 132, 58, 210,
195, 137, 15, 118, 36, 49, 138, 32, 130, 144,
64, 175, 189, 248, 174, 225, 65, 175, 248, 220,
67, 73, 39, 84, 140, 91, 145, 63, 80, 178,
107, 79, 34, 169, 188, 113, 143, 61, 211, 240,
176, 198, 27, 60, 180, 195, 163, 65, 253, 196,
131, 205, 58, 93, 214, 35, 128, 61, 246, 72,
193, 13, 49, 218, 184, 114, 6, 18, 162, 216,
34, 10, 18, 36, 219, 114, 139, 14, 163, 144,
176, 134, 30, 146, 100, 98, 143, 62, 60, 224,
115, 235, 68, 58, 38, 24, 128, 10, 84, 164,
18, 71, 41, 166, 172, 17, 195, 27, 166, 40,
130, 79, 181, 40, 226, 115, 14, 30, 74, 240,
192, 131, 7, 247, 140, 226, 202, 12, 192, 248,
64, 135, 54, 142, 96, 157, 181, 35, 142, 108,
65, 11, 26, 59, 20, 65, 71, 38, 84, 76,
243, 229, 28, 54, 107, 216, 79, 6, 56, 254,
179, 46, 63, 161, 30, 196, 104, 135, 16, 214,
51, 205, 61, 166, 184, 1, 135, 27, 82, 228,
255, 109, 10, 15, 245, 72, 156, 96, 159, 252,
220, 156, 193, 59, 225, 100, 131, 199, 14, 163,
204, 147, 135, 24, 88, 0, 3, 0, 48, 148,
87, 78, 57, 49, 201, 48, 242, 5, 16, 51,
8, 1, 113, 15, 84, 220, 163, 200, 34, 84,
208, 83, 243, 59, 242, 184, 83, 141, 175, 211,
212, 195, 240, 7, 223, 178, 77, 120, 130, 92,
54, 216, 78, 59, 141, 146, 32, 5, 20, 129,
220, 2, 67, 18, 80, 36, 210, 171, 10, 237,
96, 168, 103, 63, 245, 124, 224, 207, 65, 133,
199, 144, 137, 21, 117, 200, 114, 11, 51, 211,
76, 51, 192, 245, 214, 91, 63, 128, 246, 218,
19, 160, 65, 39, 166, 140, 162, 199, 38, 234,
108, 130, 71, 39, 122, 144, 81, 78, 57, 188,
178, 93, 252, 7, 76, 70, 250, 237, 237, 112,
227, 200, 79, 6, 251, 116, 27, 105, 163, 107,
228, 205, 137, 6, 219, 35, 128, 39, 76, 145,
130, 53, 232, 239, 3, 28, 202, 192, 7, 234,
161, 169, 91, 213, 141, 30, 66, 176, 66, 52,
28, 177, 160, 135, 48, 160, 24, 67, 176, 4,
35, 184, 81, 9, 81, 220, 34, 14, 138, 192,
84, 156, 52, 181, 41, 38, 113, 172, 7, 248,
200, 20, 9, 111, 23, 170, 12, 180, 163, 7,
171, 184, 7, 21, 158, 182, 134, 81, 72, 1,
23, 66, 168, 128, 97, 4, 240, 2, 55, 196,
1, 21, 137, 184, 135, 62, 255, 152, 244, 165,
34, 126, 136, 121, 224, 122, 195, 45, 26, 49,
2, 161, 56, 100, 0, 22, 72, 134, 15, 28,
1, 10, 83, 164, 34, 21, 170, 72, 196, 27,
132, 230, 180, 119, 96, 138, 99, 60, 160, 7,
21, 160, 118, 15, 15, 196, 32, 6, 12, 51,
155, 252, 84, 192, 131, 85, 92, 49, 17, 225,
43, 197, 19, 160, 160, 142, 93, 24, 102, 0,
70, 104, 3, 28, 80, 145, 138, 85, 204, 129,
7, 251, 168, 25, 62, 94, 197, 163, 251, 169,
64, 30, 130, 104, 2, 17, 156, 152, 0, 158,
56, 210, 145, 134, 17, 136, 114, 124, 0, 139,
29, 188, 129, 4, 166, 64, 197, 207, 80, 97,
10, 83, 144, 192, 101, 107, 88, 195, 61, 214,
96, 175, 78, 154, 178, 94, 36, 40, 35, 166,
158, 101, 143, 123, 164, 2, 21, 168, 40, 133,
27, 220, 0, 5, 25, 164, 161, 18, 118, 252,
199, 52, 96, 97, 8, 55, 88, 113, 21, 171,
56, 84, 156, 234, 225, 143, 15, 76, 44, 0,
2, 112, 152, 20, 96, 81, 65, 249, 228, 34,
23, 0, 120, 38, 0, 32, 48, 144, 3, 0,
192, 7, 102, 40, 5, 189, 4, 33, 133, 56,
192, 1, 17, 106, 128, 3, 20, 112, 81, 138,
82, 72, 225, 156, 82, 144, 165, 222, 160, 32,
78, 55, 236, 64, 10, 100, 32, 129, 18, 202,
24, 3, 87, 74, 65, 111, 112, 128, 131, 26,
154, 144, 255, 6, 66, 12, 33, 151, 187, 236,
165, 41, 182, 149, 143, 90, 217, 172, 31, 197,
155, 88, 6, 236, 38, 136, 80, 68, 131, 0,
200, 164, 192, 12, 176, 48, 131, 103, 206, 128,
23, 21, 12, 0, 5, 136, 177, 7, 40, 140,
162, 147, 233, 196, 133, 26, 12, 17, 8, 63,
248, 1, 9, 104, 104, 67, 19, 100, 208, 4,
53, 168, 161, 13, 134, 32, 68, 26, 10, 225,
135, 51, 248, 225, 22, 79, 120, 167, 32, 142,
64, 47, 41, 124, 243, 165, 105, 176, 197, 25,
206, 0, 8, 87, 240, 226, 142, 102, 104, 67,
223, 222, 160, 8, 69, 204, 97, 136, 176, 114,
81, 66, 234, 198, 131, 29, 208, 129, 24, 194,
40, 6, 47, 136, 65, 135, 73, 208, 33, 23,
85, 11, 198, 64, 130, 145, 139, 45, 4, 130,
113, 113, 116, 131, 26, 208, 48, 132, 103, 44,
67, 4, 200, 56, 193, 35, 202, 80, 136, 186,
150, 33, 27, 102, 136, 130, 24, 168, 113, 2,
100, 48, 96, 3, 53, 160, 68, 18, 204, 41,
75, 40, 192, 52, 13, 97, 248, 65, 13, 54,
32, 130, 13, 60, 3, 160, 97, 104, 67, 41,
18, 182, 138, 16, 14, 115, 109, 71, 204, 81,
61, 214, 0, 142, 25, 116, 161, 12, 70, 128,
133, 23, 104, 209, 10, 170, 97, 65, 2, 8,
98, 134, 5, 162, 209, 135, 39, 124, 212, 134,
180, 52, 66, 13, 228, 50, 16, 102, 255, 108,
0, 8, 78, 168, 197, 51, 8, 96, 130, 107,
44, 160, 130, 2, 9, 192, 49, 178, 112, 11,
195, 246, 147, 166, 118, 240, 133, 118, 106, 123,
71, 88, 168, 65, 155, 149, 117, 234, 16, 139,
23, 128, 204, 82, 236, 3, 246, 24, 131, 21,
232, 96, 139, 29, 236, 0, 10, 126, 136, 133,
15, 146, 225, 8, 31, 28, 99, 32, 19, 224,
64, 23, 208, 80, 10, 50, 152, 98, 12, 223,
45, 66, 8, 34, 105, 144, 4, 92, 225, 7,
66, 97, 198, 1, 16, 34, 128, 26, 32, 161,
16, 81, 136, 2, 32, 174, 160, 155, 132, 76,
35, 169, 165, 40, 96, 101, 247, 49, 68, 14,
73, 21, 137, 248, 136, 7, 58, 172, 160, 13,
89, 128, 2, 13, 178, 216, 194, 12, 24, 209,
10, 31, 80, 83, 32, 9, 0, 64, 52, 190,
182, 131, 82, 236, 64, 13, 103, 0, 66, 4,
232, 27, 128, 237, 13, 68, 1, 86, 208, 5,
125, 7, 114, 61, 130, 12, 32, 27, 83, 152,
130, 19, 234, 240, 0, 130, 8, 96, 0, 78,
25, 74, 100, 129, 198, 212, 16, 78, 23, 161,
214, 77, 208, 172, 238, 145, 135, 107, 88, 193,
10, 140, 136, 70, 52, 236, 0, 139, 87, 204,
192, 2, 78, 20, 64, 5, 114, 129, 133, 86,
236, 193, 21, 234, 232, 130, 38, 92, 113, 141,
245, 252, 67, 0, 200, 208, 0, 13, 86, 208,
11, 2, 32, 192, 255, 10, 123, 8, 194, 138,
171, 105, 2, 26, 208, 64, 23, 9, 24, 8,
50, 152, 112, 10, 34, 236, 194, 41, 211, 184,
64, 9, 104, 32, 140, 7, 84, 112, 0, 102,
144, 65, 41, 180, 152, 15, 69, 48, 88, 5,
4, 91, 23, 66, 234, 198, 198, 121, 116, 226,
18, 151, 224, 196, 14, 112, 49, 11, 14, 228,
130, 49, 255, 96, 64, 52, 71, 48, 131, 25,
112, 195, 15, 104, 72, 67, 25, 140, 49, 144,
94, 52, 130, 207, 164, 32, 194, 10, 174, 192,
7, 54, 176, 1, 18, 239, 129, 15, 13, 246,
64, 10, 82, 236, 193, 7, 251, 253, 71, 1,
136, 240, 7, 43, 176, 70, 0, 205, 224, 245,
31, 246, 96, 133, 150, 76, 35, 12, 207, 21,
68, 83, 29, 125, 100, 23, 78, 12, 110, 200,
115, 157, 195, 74, 129, 137, 17, 0, 3, 4,
145, 100, 6, 90, 38, 23, 141, 47, 4, 162,
13, 104, 8, 131, 11, 130, 205, 0, 31, 16,
97, 15, 180, 248, 2, 19, 230, 125, 138, 83,
176, 129, 15, 33, 16, 200, 1, 188, 80, 239,
63, 244, 89, 23, 193, 125, 4, 31, 114, 249,
143, 101, 212, 186, 222, 125, 62, 234, 83, 204,
240, 220, 129, 86, 182, 91, 196, 115, 240, 131,
248, 81, 46, 18, 132, 194, 10, 82, 180, 194,
114, 35, 240, 76, 98, 56, 162, 15, 132, 32,
68, 33, 196, 224, 139, 6, 56, 37, 24, 13,
255, 72, 121, 3, 30, 96, 7, 132, 179, 225,
20, 124, 96, 245, 63, 246, 253, 114, 54, 144,
130, 9, 62, 112, 98, 22, 188, 208, 139, 161,
16, 161, 222, 53, 255, 130, 14, 117, 57, 228,
84, 172, 161, 169, 12, 198, 71, 145, 18, 202,
16, 138, 83, 161, 201, 62, 176, 194, 22, 88,
177, 129, 106, 230, 34, 25, 93, 254, 131, 31,
106, 177, 7, 38, 124, 161, 0, 9, 17, 192,
53, 236, 253, 242, 83, 44, 161, 192, 7, 248,
249, 41, 122, 77, 10, 26, 200, 197, 6, 65,
64, 59, 31, 236, 141, 112, 90, 228, 18, 209,
138, 30, 104, 163, 121, 112, 100, 73, 43, 36,
3, 96, 72, 28, 29, 24, 17, 4, 90, 208,
226, 26, 78, 9, 64, 5, 50, 199, 10, 86,
48, 130, 106, 30, 247, 194, 121, 17, 50, 13,
23, 184, 252, 222, 50, 167, 57, 41, 16, 78,
135, 96, 219, 32, 18, 185, 70, 192, 18, 232,
254, 114, 63, 27, 230, 217, 106, 144, 130, 180,
145, 222, 119, 217, 49, 143, 31, 246, 96, 199,
35, 40, 65, 137, 34, 200, 162, 12, 181, 216,
66, 158, 5, 34, 106, 96, 204, 96, 4, 28,
240, 1, 22, 124, 112, 245, 45, 32, 0, 184,
2, 168, 222, 52, 4, 64, 128, 107, 216, 156,
15, 243, 166, 5, 218, 189, 176, 249, 178, 51,
162, 62, 54, 232, 130, 3, 4, 82, 0, 126,
147, 254, 11, 194, 64, 106, 255, 234, 11, 56,
58, 20, 74, 74, 84, 147, 238, 71, 14, 178,
16, 142, 28, 204, 99, 12, 158, 16, 133, 25,
104, 209, 140, 72, 66, 17, 154, 0, 24, 1,
29, 176, 48, 140, 8, 72, 128, 23, 91, 160,
9, 117, 160, 29, 15, 160, 12, 64, 0, 4,
144, 208, 8, 163, 69, 11, 124, 134, 121, 250,
166, 118, 64, 119, 5, 193, 214, 2, 180, 32,
1, 193, 245, 3, 76, 80, 115, 167, 32, 116,
167, 87, 4, 174, 165, 48, 164, 19, 39, 198,
164, 39, 228, 162, 2, 227, 64, 13, 57, 224,
14, 122, 240, 9, 178, 80, 11, 75, 160, 13,
96, 39, 73, 248, 71, 12, 62, 64, 12, 0,
176, 123, 190, 208, 5, 164, 64, 11, 98, 5,
31, 197, 96, 5, 221, 208, 5, 65, 208, 13,
219, 149, 129, 48, 151, 121, 94, 80, 115, 47,
199, 8, 158, 199, 4, 202, 96, 102, 9, 0,
9, 181, 240, 114, 76, 224, 2, 10, 55, 0,
159, 224, 6, 130, 32, 67, 250, 131, 80, 215,
230, 35, 226, 112, 13, 223, 64, 9, 224, 0,
9, 221, 208, 13, 88, 208, 99, 32, 54, 110,
104, 129, 127, 187, 7, 1, 142, 208, 10, 93,
0, 2, 3, 129, 0, 188, 0, 101, 116, 80,
12, 14, 0, 1, 87, 192, 103, 124, 80, 117,
51, 7, 129, 246, 38, 129, 2, 33, 13, 167,
16, 4, 106, 24, 106, 202, 224, 2, 117, 80,
12, 205, 255, 33, 16, 211, 240, 2, 163, 32,
52, 205, 130, 64, 109, 163, 16, 112, 35, 44,
223, 112, 5, 86, 48, 3, 201, 144, 12, 24,
53, 16, 5, 128, 0, 7, 80, 138, 166, 120,
0, 21, 4, 1, 192, 144, 12, 51, 224, 3,
61, 168, 75, 10, 208, 0, 12, 0, 118, 1,
32, 1, 117, 112, 132, 15, 120, 10, 83, 192,
121, 193, 102, 136, 127, 224, 118, 3, 65, 0,
191, 208, 0, 193, 224, 68, 240, 129, 6, 163,
128, 70, 71, 115, 137, 77, 23, 0, 174, 163,
4, 59, 0, 10, 162, 0, 4, 160, 214, 16,
16, 128, 5, 93, 80, 11, 78, 96, 9, 49,
120, 16, 211, 80, 2, 167, 80, 11, 50, 119,
12, 152, 16, 114, 128, 144, 99, 117, 208, 139,
186, 200, 7, 37, 96, 140, 6, 49, 0, 153,
224, 81, 30, 208, 58, 72, 131, 34, 127, 162,
2, 246, 176, 6, 58, 208, 23, 16, 225, 11,
145, 208, 4, 80, 160, 3, 183, 20, 108, 5,
193, 12, 210, 96, 6, 83, 96, 6, 128, 104,
0, 151, 32, 3, 50, 32, 114, 81, 112, 5,
114, 209, 2, 128, 16, 96, 179, 96, 2, 203,
69, 16, 4, 240, 2, 134, 128, 8, 166, 32,
15, 42, 224, 122, 81, 162, 35, 242, 16, 10,
117, 176, 12, 8, 0, 13, 9, 176, 146, 10,
208, 146, 46, 249, 146, 9, 128, 0, 32, 48,
3, 101, 80, 78, 181, 84, 6, 90, 255, 128,
0, 4, 112, 61, 7, 112, 3, 151, 16, 8,
33, 231, 7, 210, 144, 146, 29, 128, 2, 38,
6, 5, 49, 37, 9, 34, 0, 13, 208, 128,
7, 105, 208, 6, 253, 4, 8, 143, 224, 12,
7, 192, 12, 3, 192, 12, 208, 128, 3, 73,
128, 11, 179, 148, 2, 173, 19, 55, 18, 65,
113, 242, 224, 9, 116, 16, 6, 58, 112, 11,
180, 64, 7, 35, 128, 1, 207, 212, 150, 109,
137, 22, 209, 96, 6, 182, 208, 8, 209, 240,
9, 166, 112, 67, 109, 112, 8, 128, 112, 6,
160, 181, 50, 79, 240, 151, 80, 16, 144, 58,
224, 93, 238, 53, 10, 178, 244, 82, 252, 164,
3, 57, 245, 4, 180, 4, 83, 131, 192, 151,
70, 240, 9, 80, 80, 78, 157, 196, 71, 136,
194, 140, 14, 241, 39, 107, 144, 9, 87, 208,
9, 107, 32, 8, 183, 176, 5, 62, 0, 12,
207, 132, 1, 164, 201, 150, 164, 201, 1, 51,
48, 9, 77, 96, 10, 165, 32, 4, 117, 224,
9, 130, 48, 10, 110, 128, 8, 109, 0, 5,
238, 116, 78, 163, 176, 155, 232, 52, 47, 245,
114, 4, 152, 148, 78, 178, 100, 78, 157, 180,
155, 178, 36, 78, 112, 176, 3, 124, 67, 6,
59, 245, 73, 169, 16, 68, 74, 23, 37, 244,
48, 6, 90, 240, 8, 157, 64, 15, 201, 66,
2, 103, 112, 85, 190, 231, 3, 222, 249, 157,
222, 25, 13, 218, 255, 48, 4, 82, 112, 15,
245, 228, 9, 215, 224, 9, 120, 243, 51, 125,
243, 73, 74, 16, 74, 164, 244, 73, 162, 116,
70, 80, 243, 48, 86, 84, 47, 243, 116, 15,
247, 240, 6, 41, 144, 73, 196, 233, 50, 49,
32, 15, 78, 195, 3, 247, 208, 42, 109, 114,
51, 7, 81, 15, 229, 128, 13, 227, 48, 14,
244, 16, 42, 118, 243, 6, 155, 16, 13, 196,
32, 158, 221, 192, 13, 23, 154, 161, 24, 74,
4, 160, 160, 4, 12, 195, 70, 99, 112, 7,
107, 192, 3, 175, 148, 8, 66, 99, 58, 60,
32, 15, 30, 64, 15, 244, 96, 158, 95, 100,
15, 60, 64, 5, 15, 179, 69, 50, 52, 160,
30, 176, 6, 8, 243, 156, 66, 211, 43, 207,
162, 2, 211, 224, 15, 95, 178, 15, 251, 112,
39, 13, 161, 2, 41, 8, 43, 130, 115, 63,
248, 64, 2, 234, 160, 12, 86, 192, 13, 143,
96, 9, 146, 32, 9, 82, 90, 165, 149, 224,
9, 243, 224, 40, 129, 243, 45, 100, 128, 7,
84, 64, 5, 90, 68, 5, 28, 211, 44, 201,
18, 163, 51, 212, 3, 40, 4, 163, 60, 176,
8, 138, 16, 67, 98, 170, 44, 49, 170, 8,
111, 144, 8, 90, 116, 15, 40, 52, 13, 176,
35, 49, 16, 178, 80, 201,
98, 76, 11, 161, 2, 213, 240, 43, 5, 177,
51, 243, 144, 13, 86, 144, 13, 148, 128, 2,
232, 128, 14, 228, 255, 192, 168, 139, 74, 14,
230, 64, 6, 32, 217, 14, 161, 82, 56, 246,
128, 7, 236, 64, 5, 139, 192, 45, 40, 244,
37, 104, 186, 15, 115, 64, 5, 251, 128, 166,
248, 208, 3, 250, 160, 169, 77, 181, 8, 115,
128, 66, 61, 144, 63, 138, 144, 15, 192, 20,
67, 153, 98, 109, 151, 200, 40, 251, 144, 54,
9, 81, 15, 38, 50, 105, 245, 64, 14, 87,
32, 13, 99, 176, 14, 240, 224, 14, 238, 48,
172, 71, 0, 15, 71, 112, 4, 238, 16, 3,
132, 228, 32, 171, 98, 14, 163, 208, 84, 1,
211, 41, 131, 52, 66, 33, 25, 41, 95, 130,
15, 250, 208, 169, 216, 170, 173, 249, 179, 8,
170, 186, 140, 39, 66, 113, 217, 234, 167, 20,
179, 171, 147, 22, 15, 89, 224, 13, 241, 144,
41, 190, 66, 68, 154, 2, 175, 231, 183, 33,
107, 192, 14, 111, 208, 64, 123, 82, 56, 46,
84, 169, 121, 130, 80, 46, 244, 54, 9, 148,
173, 154, 130, 153, 9, 18, 176, 137, 82, 16,
237, 48, 13, 19, 211, 171, 229, 176, 35, 148,
154, 39, 161, 18, 177, 1, 80, 169, 114, 163,
15, 100, 48, 6, 96, 130, 34, 125, 162, 42,
133, 163, 167, 153, 201, 15, 4, 179, 33, 12,
225, 14, 216, 160, 176, 151, 168, 40, 19, 35,
16, 252, 160, 15, 251, 32, 15, 233, 128, 38,
73, 50, 59, 40, 34, 146, 15, 34, 14, 234,
255, 146, 178, 11, 177, 36, 105, 243, 14, 130,
58, 34, 56, 203, 60, 8, 42, 55, 222, 144,
3, 130, 179, 177, 19, 193, 40, 137, 162, 32,
63, 155, 179, 36, 24, 150, 75, 219, 39, 233,
64, 0, 73, 123, 35, 11, 132, 32, 7, 251,
32, 70, 155, 32, 77, 235, 180, 26, 43, 32,
94, 251, 181, 96, 27, 182, 98, 59, 182, 100,
11, 182, 108, 56, 110, 180, 133, 16, 34, 49,
25, 45, 193, 16, 128, 97, 31, 0, 208, 19,
113, 91, 18, 105, 123, 16, 44, 65, 17, 119,
219, 16, 3, 144, 145, 166, 97, 0, 57, 161,
18, 126, 251, 20, 77, 113, 102, 60, 225, 19,
20, 192, 19, 218, 65, 19, 54, 129, 19, 58,
81, 184, 153, 49, 18, 59, 113, 27, 141, 187,
0, 144, 113, 19, 52, 54, 184, 130, 27, 21,
39, 129, 25, 111, 97, 22, 91, 113, 22, 72,
49, 31, 94, 81, 20, 85, 113, 21, 89, 1,
31, 92, 225, 21, 61, 246, 19, 159, 171, 186,
90, 193, 21, 159, 161, 0, 93, 33, 16, 157,
91, 1, 110, 177, 22, 21, 16, 23, 155, 43,
23, 1, 240, 105, 67, 193, 23, 126, 177, 0,
167, 139, 24, 52, 161, 23, 3, 160, 23, 192,
11, 31, 31, 177, 0, 18, 144, 188, 4, 160,
18, 201, 219, 0, 150, 49, 18, 189, 203, 24,
66, 81, 21, 144, 81, 31, 29, 33, 22, 242,
49, 1, 161, 17, 24, 105, 182, 251, 182, 123,
113, 25, 190, 65, 190, 232, 197, 19, 94, 65,
91, 191, 33, 22, 63, 1, 24, 159, 225, 189,
172, 241, 15, 164, 17, 191, 219, 43, 23, 14,
0, 0, 12, 112, 27, 178, 209, 26, 109, 187,
190, 229, 251, 15, 251, 251, 15, 175, 241, 19,
1, 252, 26, 0, 204, 26, 237, 59, 18, 181,
33, 185, 180, 11, 0, 5, 86, 191, 3, 65,
1, 187, 64, 29, 182, 129, 28, 196, 33, 190,
254, 235, 29, 69, 113, 28, 194, 17, 1, 22,
176, 19, 150, 129, 28, 30, 156, 19, 28, 140,
0, 20, 48, 189, 209, 49, 29, 213, 113, 24,
61, 161, 28, 124, 155, 17, 152, 33, 0, 202,
97, 1, 186, 97, 30, 19, 80, 28, 253, 107,
190, 227, 155, 25, 225, 81, 185, 64, 209, 195,
173, 97, 21, 93, 241, 182, 50, 12, 0, 52,
12, 31, 242, 65, 31, 101, 123, 17, 15, 144,
136, 75, 28, 19, 118, 81, 183, 79, 140, 18,
238, 56, 197, 86, 124, 197, 49, 17, 16, 0,
59 };
unsigned char php4_logo[] = {
71, 73, 70, 56, 57, 97, 100, 0, 56, 0,
247, 255, 0, 255, 255, 255, 8, 8, 8, 16,
16, 16, 24, 24, 24, 33, 33, 33, 41, 41,
41, 49, 49, 49, 57, 57, 57, 66, 66, 66,
74, 74, 74, 82, 82, 82, 90, 90, 90, 99,
99, 99, 115, 115, 115, 123, 123, 123, 132, 132,
132, 140, 140, 140, 148, 148, 148, 156, 156, 156,
165, 165, 165, 173, 173, 173, 181, 181, 181, 189,
189, 189, 198, 198, 198, 206, 206, 206, 214, 214,
214, 222, 222, 222, 231, 231, 231, 239, 239, 239,
247, 247, 247, 115, 115, 90, 156, 156, 115, 140,
140, 99, 132, 132, 90, 165, 165, 107, 214, 214,
115, 156, 156, 82, 181, 181, 90, 189, 189, 90,
198, 198, 90, 222, 222, 99, 214, 214, 90, 222,
222, 90, 206, 206, 82, 41, 41, 16, 231, 231,
90, 107, 107, 41, 214, 214, 82, 173, 173, 66,
239, 239, 90, 222, 222, 82, 66, 66, 24, 156,
156, 57, 231, 231, 82, 239, 239, 82, 99, 99,
33, 198, 198, 66, 148, 148, 49, 132, 132, 41,
82, 82, 24, 16, 16, 0, 214, 222, 107, 181,
189, 82, 206, 214, 90, 189, 198, 107, 173, 181,
90, 165, 173, 99, 148, 156, 82, 148, 156, 99,
173, 181, 132, 140, 148, 99, 148, 156, 115, 156,
165, 115, 99, 107, 90, 148, 156, 140, 132, 140,
132, 115, 123, 115, 247, 255, 255, 198, 206, 206,
140, 148, 148, 156, 165, 165, 115, 123, 123, 239,
255, 255, 123, 132, 132, 66, 74, 74, 231, 247,
255, 189, 198, 206, 222, 239, 255, 90, 99, 107,
231, 239, 247, 239, 247, 255, 198, 206, 214, 165,
173, 181, 99, 107, 115, 214, 222, 231, 148, 156,
165, 115, 123, 132, 82, 90, 99, 132, 148, 173,
222, 231, 247, 189, 198, 214, 156, 165, 181, 57,
66, 82, 24, 33, 49, 198, 206, 222, 165, 173,
189, 206, 222, 255, 181, 198, 231, 148, 165, 198,
66, 74, 90, 90, 107, 140, 74, 90, 123, 33,
41, 57, 49, 66, 99, 214, 222, 239, 206, 214,
231, 181, 189, 206, 140, 148, 165, 115, 123, 140,
107, 115, 132, 82, 90, 107, 74, 82, 99, 49,
57, 74, 181, 198, 239, 156, 173, 214, 107, 123,
165, 99, 115, 156, 90, 107, 148, 82, 99, 140,
66, 82, 123, 57, 74, 115, 222, 231, 255, 189,
198, 222, 156, 165, 189, 123, 132, 156, 156, 173,
222, 148, 165, 214, 123, 140, 189, 115, 132, 181,
90, 107, 156, 24, 33, 57, 214, 222, 247, 198,
206, 231, 181, 189, 214, 173, 181, 206, 148, 156,
181, 132, 140, 165, 107, 115, 140, 82, 90, 115,
66, 74, 99, 148, 165, 222, 107, 123, 173, 41,
49, 74, 90, 107, 165, 82, 99, 156, 66, 82,
132, 156, 165, 198, 123, 132, 165, 90, 99, 132,
107, 123, 181, 57, 66, 99, 99, 115, 173, 82,
99, 165, 206, 214, 247, 181, 189, 222, 173, 181,
214, 165, 173, 206, 148, 156, 189, 132, 140, 173,
156, 165, 206, 123, 132, 173, 74, 82, 115, 66,
74, 107, 49, 57, 90, 57, 66, 107, 41, 49,
82, 148, 156, 198, 140, 148, 189, 132, 140, 181,
115, 123, 165, 107, 115, 156, 99, 107, 148, 82,
90, 132, 74, 82, 123, 66, 74, 115, 49, 57,
99, 189, 198, 255, 156, 165, 214, 148, 156, 206,
140, 148, 198, 132, 140, 189, 123, 132, 181, 123,
132, 189, 99, 107, 156, 90, 99, 148, 82, 90,
140, 90, 99, 156, 66, 74, 123, 57, 66, 115,
165, 173, 231, 140, 148, 206, 107, 115, 173, 99,
107, 165, 82, 90, 148, 74, 82, 140, 99, 107,
173, 82, 90, 156, 231, 231, 239, 239, 239, 247,
247, 247, 255, 198, 198, 206, 206, 206, 214, 181,
181, 189, 165, 165, 173, 173, 173, 181, 189, 189,
198, 140, 140, 148, 115, 115, 123, 231, 231, 247,
239, 239, 255, 107, 107, 115, 123, 123, 132, 206,
206, 222, 214, 214, 231, 222, 222, 239, 99, 99,
107, 198, 198, 214, 90, 90, 99, 74, 74, 82,
156, 156, 173, 140, 140, 156, 148, 148, 165, 132,
132, 148, 198, 198, 222, 206, 206, 231, 165, 165,
189, 173, 173, 198, 107, 107, 123, 148, 148, 173,
181, 181, 214, 90, 90, 107, 41, 41, 49, 82,
82, 99, 123, 123, 148, 74, 74, 90, 99, 99,
123, 90, 90, 115, 57, 57, 74, 74, 74, 99,
66, 66, 90, 24, 24, 33, 57, 57, 82, 49,
49, 74, 41, 41, 66, 41, 41, 74, 0, 0,
0, 44, 0, 0, 0, 0, 100, 0, 56, 0,
0, 8, 255, 0, 1, 8, 28, 72, 176, 160,
193, 131, 8, 19, 42, 92, 200, 176, 161, 195,
135, 16, 35, 74, 156, 72, 177, 162, 197, 139,
24, 51, 58, 108, 210, 1, 218, 51, 112, 224,
188, 120, 1, 247, 12, 90, 135, 104, 26, 7,
62, 131, 36, 171, 15, 177, 63, 179, 78, 101,
72, 249, 16, 218, 55, 50, 144, 78, 201, 154,
21, 76, 216, 178, 101, 128, 134, 13, 3, 42,
116, 217, 31, 90, 157, 98, 173, 163, 227, 13,
26, 69, 104, 166, 50, 45, 219, 132, 139, 213,
170, 77, 203, 152, 117, 242, 66, 243, 96, 7,
47, 143, 78, 93, 10, 246, 243, 103, 209, 160,
203, 134, 50, 27, 198, 172, 237, 48, 91, 204,
54, 109, 178, 37, 215, 86, 45, 84, 236, 154,
58, 212, 230, 107, 217, 170, 16, 62, 84, 180,
80, 97, 194, 200, 155, 183, 105, 58, 116, 237,
48, 199, 84, 172, 100, 139, 22, 17, 243, 169,
73, 152, 166, 203, 139, 52, 101, 218, 204, 185,
51, 49, 81, 146, 53, 153, 141, 43, 119, 19,
32, 90, 145, 200, 56, 69, 8, 46, 81, 160,
16, 47, 108, 196, 176, 225, 226, 159, 11, 27,
45, 140, 12, 219, 116, 78, 113, 198, 111, 166,
126, 133, 82, 22, 76, 50, 49, 77, 196, 58,
111, 110, 166, 188, 57, 103, 230, 202, 125, 238,
222, 20, 40, 144, 173, 78, 86, 124, 15, 132,
246, 107, 19, 137, 217, 49, 98, 232, 255, 248,
247, 111, 134, 108, 27, 66, 134, 221, 130, 194,
193, 34, 52, 66, 189, 20, 125, 234, 19, 57,
185, 243, 251, 248, 243, 111, 246, 25, 247, 86,
177, 97, 238, 112, 37, 80, 41, 203, 120, 32,
219, 108, 48, 144, 87, 94, 120, 179, 17, 177,
12, 37, 21, 104, 7, 209, 24, 164, 240, 146,
136, 34, 202, 216, 167, 95, 38, 208, 233, 215,
33, 135, 249, 17, 179, 12, 93, 129, 220, 98,
136, 55, 207, 92, 130, 135, 12, 224, 213, 16,
192, 63, 44, 148, 103, 195, 129, 49, 120, 178,
9, 24, 51, 65, 164, 205, 26, 136, 32, 131,
161, 134, 27, 118, 6, 139, 2, 3, 232, 67,
64, 60, 236, 4, 249, 161, 114, 196, 236, 86,
76, 49, 181, 108, 50, 196, 129, 54, 204, 0,
35, 13, 11, 130, 135, 222, 50, 120, 80, 32,
161, 66, 209, 140, 178, 199, 49, 192, 40, 163,
89, 144, 206, 65, 34, 128, 130, 5, 160, 129,
230, 114, 207, 61, 183, 200, 84, 184, 188, 242,
3, 120, 227, 253, 131, 67, 130, 51, 104, 25,
67, 10, 203, 220, 2, 65, 142, 11, 105, 163,
134, 46, 136, 132, 114, 230, 155, 205, 89, 163,
224, 63, 12, 148, 194, 104, 126, 205, 16, 211,
202, 61, 224, 97, 249, 207, 13, 48, 140, 199,
2, 12, 224, 197, 208, 130, 27, 183, 60, 96,
193, 66, 77, 12, 114, 197, 26, 159, 44, 58,
105, 103, 205, 68, 255, 240, 40, 4, 176, 188,
154, 95, 43, 84, 156, 199, 195, 163, 143, 234,
48, 155, 108, 119, 148, 234, 101, 66, 219, 104,
161, 69, 42, 153, 184, 106, 235, 102, 192, 52,
240, 104, 5, 138, 44, 219, 92, 165, 185, 80,
193, 96, 14, 51, 100, 59, 67, 140, 60, 204,
128, 67, 120, 178, 77, 114, 139, 3, 19, 124,
57, 80, 52, 77, 104, 17, 139, 51, 210, 54,
7, 75, 2, 10, 6, 240, 77, 187, 206, 185,
178, 15, 139, 52, 202, 198, 39, 131, 178, 181,
224, 215, 20, 229, 30, 180, 77, 19, 224, 40,
162, 44, 103, 176, 160, 51, 14, 60, 11, 55,
204, 112, 56, 237, 204, 115, 137, 114, 116, 16,
16, 47, 55, 14, 135, 115, 135, 33, 191, 116,
166, 10, 195, 32, 59, 60, 78, 23, 118, 160,
2, 204, 102, 197, 188, 18, 4, 149, 224, 242,
121, 94, 120, 64, 104, 130, 135, 3, 195, 22,
52, 176, 54, 201, 28, 204, 217, 55, 6, 240,
234, 243, 63, 5, 116, 243, 9, 103, 236, 252,
236, 179, 1, 230, 68, 155, 137, 57, 70, 63,
26, 128, 2, 235, 92, 178, 76, 43, 73, 132,
122, 30, 14, 255, 236, 224, 167, 18, 204, 96,
97, 234, 151, 77, 100, 161, 69, 34, 236, 222,
215, 140, 23, 3, 52, 205, 43, 3, 209, 54,
51, 129, 218, 188, 158, 211, 76, 51, 15, 192,
173, 224, 0, 212, 92, 130, 75, 43, 37, 188,
255, 124, 32, 14, 44, 130, 215, 131, 50, 172,
56, 48, 168, 65, 114, 84, 1, 75, 217, 247,
41, 114, 1, 175, 1, 68, 254, 162, 207, 216,
100, 162, 136, 3, 118, 43, 152, 0, 27, 153,
112, 227, 180, 228, 63, 19, 176, 197, 50, 160,
176, 114, 39, 203, 252, 138, 42, 198, 38, 225,
144, 219, 30, 65, 218, 32, 202, 248, 125, 177,
200, 170, 32, 3, 27, 104, 160, 251, 5, 14,
172, 169, 32, 1, 191, 244, 2, 175, 130, 17,
96, 96, 60, 6, 20, 244, 204, 38, 33, 191,
32, 16, 47, 6, 186, 107, 144, 1, 5, 10,
240, 250, 64, 42, 182, 184, 130, 199, 9, 86,
255, 26, 195, 8, 178, 12, 19, 134, 225, 24,
24, 68, 202, 33, 202, 108, 152, 138, 231, 10,
98, 99, 138, 41, 169, 64, 66, 72, 52, 22,
240, 234, 14, 36, 22, 147, 23, 192, 52, 165,
244, 95, 202, 55, 212, 120, 84, 1, 8, 1,
139, 180, 145, 167, 0, 80, 121, 159, 41, 210,
1, 141, 225, 145, 71, 1, 233, 200, 196, 38,
92, 129, 11, 35, 164, 192, 79, 40, 40, 66,
31, 54, 145, 7, 7, 60, 128, 2, 175, 27,
72, 22, 144, 1, 12, 157, 41, 231, 17, 206,
83, 80, 57, 148, 163, 8, 104, 40, 143, 60,
231, 32, 195, 228, 254, 65, 0, 72, 40, 135,
11, 143, 66, 0, 33, 202, 240, 168, 5, 68,
176, 51, 138, 192, 198, 163, 255, 14, 32, 135,
205, 12, 227, 73, 111, 136, 194, 17, 144, 240,
129, 37, 252, 97, 25, 184, 24, 135, 3, 200,
181, 1, 131, 60, 2, 50, 65, 242, 134, 1,
255, 33, 128, 66, 52, 39, 29, 41, 36, 79,
53, 174, 241, 40, 5, 68, 165, 51, 66, 84,
208, 2, 222, 145, 70, 242, 60, 64, 82, 202,
65, 199, 16, 193, 193, 25, 209, 200, 165, 45,
204, 192, 69, 37, 194, 145, 13, 195, 81, 160,
138, 6, 137, 5, 49, 128, 100, 54, 105, 204,
208, 0, 181, 82, 78, 58, 10, 240, 168, 107,
80, 224, 81, 14, 136, 69, 103, 146, 225, 44,
5, 61, 192, 20, 236, 35, 15, 5, 122, 209,
28, 48, 60, 42, 1, 116, 132, 83, 38, 6,
41, 154, 86, 180, 225, 1, 75, 152, 0, 6,
66, 88, 144, 62, 44, 195, 132, 157, 249, 69,
5, 122, 216, 49, 88, 25, 50, 94, 207, 168,
155, 130, 38, 160, 180, 205, 248, 98, 1, 143,
154, 64, 42, 28, 24, 128, 12, 244, 114, 57,
12, 120, 20, 3, 230, 128, 159, 69, 180, 162,
21, 52, 3, 36, 66, 254, 48, 140, 32, 193,
66, 2, 143, 234, 70, 40, 88, 8, 133, 28,
70, 3, 152, 10, 186, 192, 135, 56, 113, 128,
71, 89, 193, 20, 249, 251, 199, 0, 188, 144,
190, 88, 190, 240, 31, 17, 32, 4, 136, 148,
195, 28, 80, 240, 195, 1, 21, 88, 136, 48,
152, 65, 255, 72, 231, 148, 162, 146, 228, 137,
64, 115, 30, 241, 206, 39, 64, 131, 145, 228,
25, 128, 55, 148, 3, 137, 45, 234, 195, 27,
133, 152, 33, 2, 212, 209, 28, 73, 60, 74,
0, 27, 72, 100, 156, 56, 147, 11, 76, 144,
203, 92, 4, 9, 134, 45, 52, 177, 164, 230,
168, 131, 152, 133, 248, 16, 44, 0, 170, 78,
47, 100, 64, 162, 242, 236, 76, 0, 53, 247,
8, 166, 41, 40, 9, 112, 220, 140, 50, 58,
145, 206, 127, 52, 0, 26, 219, 188, 15, 49,
246, 177, 143, 143, 42, 164, 19, 88, 241, 144,
23, 210, 73, 128, 50, 92, 66, 21, 168, 168,
3, 54, 170, 247, 168, 8, 188, 195, 81, 10,
106, 128, 70, 57, 212, 205, 172, 150, 34, 10,
143, 226, 70, 212, 84, 209, 9, 67, 180, 99,
139, 255, 48, 0, 7, 182, 58, 79, 14, 45,
3, 19, 249, 160, 25, 72, 7, 194, 142, 91,
48, 67, 63, 138, 200, 0, 228, 64, 231, 51,
7, 160, 33, 17, 186, 36, 143, 4, 124, 209,
153, 68, 176, 116, 2, 165, 160, 170, 254, 36,
55, 195, 187, 101, 192, 77, 249, 41, 6, 28,
224, 129, 207, 185, 10, 228, 25, 212, 209, 15,
44, 222, 150, 185, 127, 60, 0, 28, 161, 128,
5, 56, 201, 115, 141, 100, 116, 134, 19, 14,
252, 135, 52, 74, 129, 80, 187, 25, 0, 3,
114, 40, 169, 114, 90, 1, 135, 108, 255, 60,
224, 2, 12, 145, 196, 127, 242, 83, 10, 204,
217, 13, 1, 21, 248, 198, 54, 209, 25, 175,
133, 118, 70, 77, 10, 18, 128, 23, 216, 209,
88, 163, 9, 192, 1, 28, 240, 130, 105, 241,
211, 12, 201, 154, 225, 1, 17, 208, 0, 67,
192, 225, 31, 98, 64, 231, 187, 155, 73, 135,
98, 255, 161, 128, 5, 152, 119, 1, 12, 104,
128, 4, 50, 208, 129, 82, 64, 71, 28, 220,
56, 111, 3, 126, 200, 25, 113, 48, 224, 188,
15, 248, 70, 57, 30, 53, 128, 243, 154, 151,
27, 15, 168, 0, 7, 160, 1, 9, 217, 62,
103, 25, 175, 128, 67, 23, 228, 218, 144, 117,
8, 162, 24, 248, 1, 71, 107, 7, 0, 142,
111, 88, 248, 27, 115, 112, 196, 35, 96, 49,
221, 205, 152, 226, 194, 22, 230, 100, 103, 254,
119, 225, 57, 112, 194, 166, 228, 113, 64, 22,
64, 60, 7, 52, 108, 184, 195, 249, 113, 197,
25, 232, 65, 62, 135, 116, 192, 19, 174, 216,
132, 115, 20, 161, 129, 25, 30, 64, 146, 244,
114, 78, 40, 124, 75, 158, 9, 176, 245, 77,
213, 133, 195, 61, 31, 16, 48, 135, 124, 227,
13, 172, 168, 166, 114, 98, 49, 75, 53, 30,
19, 86, 237, 250, 197, 104, 85, 123, 101, 52,
85, 183, 31, 112, 104, 64, 55, 178, 27, 17,
47, 172, 34, 199, 162, 228, 3, 4, 30, 213,
0, 24, 7, 25, 255, 97, 47, 92, 167, 129,
241, 147, 62, 92, 192, 1, 14, 220, 48, 28,
110, 37, 226, 13, 86, 128, 162, 24, 26, 74,
199, 150, 43, 247, 230, 230, 68, 84, 65, 7,
152, 23, 163, 154, 161, 9, 87, 192, 161, 31,
220, 232, 198, 215, 40, 146, 129, 55, 128, 194,
24, 203, 216, 204, 51, 20, 64, 128, 78, 23,
160, 12, 115, 110, 23, 23, 10, 208, 105, 2,
56, 128, 12, 139, 102, 6, 109, 249, 145, 231,
0, 179, 82, 34, 29, 176, 67, 43, 114, 81,
12, 77, 168, 35, 11, 208, 200, 117, 22, 52,
10, 222, 121, 246, 250, 215, 162, 100, 14, 33,
160, 129, 107, 104, 104, 67, 146, 192, 246, 117,
51, 156, 225, 138, 126, 48, 130, 30, 81, 48,
156, 5, 44, 11, 17, 40, 176, 162, 21, 160,
216, 68, 63, 11, 29, 100, 70, 7, 98, 31,
140, 232, 71, 235, 176, 123, 1, 106, 71, 100,
26, 245, 120, 102, 142, 53, 19, 106, 110, 123,
136, 67, 196, 216, 4, 109, 225, 208, 134, 62,
50, 153, 80, 41, 225, 64, 53, 236, 241, 204,
63, 223, 181, 173, 238, 86, 146, 84, 4, 241,
10, 48, 183, 161, 213, 16, 168, 128, 52, 23,
163, 1, 9, 240, 251, 21, 173, 200, 113, 166,
231, 230, 235, 96, 91, 188, 226, 24, 7, 239,
220, 152, 227, 140, 98, 180, 2, 204, 244, 110,
192, 3, 252, 200, 222, 174, 24, 164, 3, 26,
255, 152, 64, 61, 42, 241, 10, 136, 187, 162,
24, 153, 6, 81, 187, 23, 13, 34, 209, 20,
3, 20, 152, 184, 51, 38, 228, 97, 219, 110,
64, 128, 2, 37, 55, 57, 66, 58, 48, 189,
110, 192, 3, 20, 251, 120, 197, 62, 114, 97,
140, 77, 48, 195, 25, 246, 217, 184, 204, 51,
46, 115, 138, 39, 75, 19, 204, 40, 134, 43,
90, 129, 137, 126, 244, 131, 31, 248, 88, 176,
7, 35, 0, 116, 115, 11, 29, 0, 40, 183,
128, 4, 186, 97, 143, 74, 236, 3, 19, 152,
80, 122, 196, 113, 81, 12, 167, 47, 195, 25,
151, 113, 206, 101, 68, 19, 151, 98, 24, 3,
20, 92, 247, 186, 215, 205, 16, 134, 86, 27,
78, 2, 22, 208, 128, 217, 207, 78, 16, 14,
100, 192, 2, 19, 128, 64, 54, 236, 145, 135,
124, 188, 2, 19, 254, 128, 187, 210, 33, 142,
109, 80, 120, 222, 243, 185, 120, 102, 203, 187,
46, 248, 126, 232, 161, 13, 120, 88, 240, 3,
86, 255, 4, 196, 103, 128, 3, 139, 103, 252,
65, 56, 176, 1, 12, 84, 96, 2, 79, 120,
64, 59, 186, 128, 7, 121, 84, 62, 31, 68,
125, 5, 63, 50, 159, 121, 126, 232, 97, 31,
102, 48, 3, 61, 242, 16, 6, 44, 112, 35,
27, 146, 94, 125, 4, 36, 80, 1, 232, 117,
32, 246, 178, 95, 72, 7, 56, 160, 1, 12,
88, 128, 2, 19, 136, 0, 83, 4, 32, 176,
132, 213, 143, 252, 252, 30, 76, 255, 3, 166,
176, 250, 241, 71, 96, 2, 20, 176, 0, 244,
96, 159, 125, 198, 111, 63, 119, 211, 184, 128,
5, 42, 64, 129, 254, 79, 224, 255, 0, 72,
1, 21, 80, 1, 22, 112, 1, 208, 179, 1,
244, 87, 127, 10, 232, 21, 215, 7, 123, 28,
0, 123, 215, 119, 125, 11, 56, 129, 20, 88,
129, 22, 120, 129, 24, 152, 129, 14, 17, 16,
0, 59 };

2222
main/main.c Normal file

File diff suppressed because it is too large Load diff

485
main/php.h Normal file
View file

@ -0,0 +1,485 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef _PHP_H
#define _PHP_H
#define YYDEBUG 0
#define CGI_BINARY (!APACHE && !USE_SAPI && !FHTTPD)
#include "php_version.h"
#include "zend.h"
#include "zend_API.h"
extern unsigned char first_arg_force_ref[];
extern unsigned char first_arg_allow_ref[];
extern unsigned char second_arg_force_ref[];
extern unsigned char second_arg_allow_ref[];
/* somebody stealing BOOL from windows. pick something else!
#ifndef BOOL
#define BOOL MYBOOL
#endif
*/
#if MSVC5
#include "config.w32.h"
#include "win95nt.h"
# if defined(COMPILE_DL)
# define PHPAPI __declspec(dllimport)
# else
# define PHPAPI __declspec(dllexport)
# endif
#else
# include "config.h"
# define PHPAPI
# define THREAD_LS
#endif
/* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
#undef DEBUG
#define DEBUG ZEND_DEBUG
#if DEBUG || !(defined(__GNUC__)||defined(WIN32))
#ifdef inline
#undef inline
#endif
#define inline
#endif
#if HAVE_UNIX_H
#include <unix.h>
#endif
#if HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "request_info.h"
#if HAVE_LIBDL
# if MSVC5
# include <windows.h>
# define dlclose FreeLibrary
# define dlopen(a,b) LoadLibrary(a)
# define dlsym GetProcAddress
# else
#if HAVE_DLFCN_H && !(defined(_AIX) && APACHE)
# include <dlfcn.h>
#endif
# endif
#endif
/*Thread Safety*/
#if THREAD_SAFE
#define GLOBAL(a) php3_globals->a
#define STATIC GLOBAL
#define TLS_VARS \
php3_globals_struct *php3_globals; \
php3_globals = TlsGetValue(TlsIndex);
#define CREATE_MUTEX(a,b) a = CreateMutex (NULL, FALSE, b);
#define SET_MUTEX(a) WaitForSingleObject( a, INFINITE );
#define FREE_MUTEX(a) ReleaseMutex(a);
/*redirect variables to the flex structure*/
#if !defined(YY_BUFFER_NEW) && !defined(COMPILE_DL)
#include "FlexSafe.h"
#endif
#define INLINE_TLS ,struct php3_global_struct *php3_globals
#define INLINE_TLS_VOID struct php3_global_struct *php3_globals
#define _INLINE_TLS ,php3_globals
#define _INLINE_TLS_VOID php3_globals
#else
#define GLOBAL(a) a
#define STATIC GLOBAL
#define TLS_VARS
#define CREATE_MUTEX(a,b)
#define SET_MUTEX(a)
#define FREE_MUTEX(a)
/* needed in control structures */
#define INLINE_TLS
#define INLINE_TLS_VOID void
#define _INLINE_TLS
#define _INLINE_TLS_VOID
#endif
/*
* Then the ODBC support can use both iodbc and Solid,
* uncomment this.
* #define HAVE_ODBC (HAVE_IODBC|HAVE_SOLID)
*/
#include <stdlib.h>
#include <ctype.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_STDARG_H
#include <stdarg.h>
#else
# if HAVE_SYS_VARARGS_H
# include <sys/varargs.h>
# endif
#endif
#include "zend_hash.h"
#include "php3_compat.h"
#include "zend_alloc.h"
#include "zend_stack.h"
typedef zval pval;
#define pval_copy_constructor zval_copy_ctor
#define pval_destructor zval_dtor
#if REGEX
#include "regex/regex.h"
#define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */
#define _RX_H 1 /* Try defining these for Linux to */
#define __REGEXP_LIBRARY_H__ 1 /* avoid Apache including regex.h */
#define _H_REGEX 1 /* This one is for AIX */
#else
#include <regex.h>
#endif
#if STDC_HEADERS
# include <string.h>
#else
# ifndef HAVE_MEMCPY
# define memcpy(d, s, n) bcopy((s), (d), (n))
# define memmove(d, s, n) bcopy ((s), (d), (n))
# endif
#endif
#include "safe_mode.h"
#ifndef HAVE_STRERROR
extern char *strerror(int);
#endif
#include "fopen-wrappers.h"
#include "mod_php3.h" /* the php3_ini structure comes from here */
#if APACHE /* apache httpd */
# if HAVE_AP_CONFIG_H
#include "ap_config.h"
# endif
# if HAVE_OLD_COMPAT_H
#include "compat.h"
# endif
# if HAVE_AP_COMPAT_H
#include "ap_compat.h"
# endif
#include "httpd.h"
#include "http_main.h"
#include "http_core.h"
#include "http_request.h"
#include "http_protocol.h"
#include "http_config.h"
#include "http_log.h"
#define BLOCK_INTERRUPTIONS block_alarms
#define UNBLOCK_INTERRUPTIONS unblock_alarms
# ifndef THREAD_SAFE
extern request_rec *php3_rqst;
# endif
#endif
#if HAVE_PWD_H
# if MSVC5
#include "win32/pwd.h"
#include "win32/param.h"
# else
#include <pwd.h>
#include <sys/param.h>
# endif
#endif
#if CGI_BINARY /* CGI version */
#define BLOCK_INTERRUPTIONS NULL
#define UNBLOCK_INTERRUPTIONS NULL
#endif
#if HAVE_LIMITS_H
#include <limits.h>
#endif
#ifndef LONG_MAX
#define LONG_MAX 2147483647L
#endif
#ifndef LONG_MIN
#define LONG_MIN (- LONG_MAX - 1)
#endif
#if FHTTPD /* fhttpd */
#define BLOCK_INTERRUPTIONS NULL
#define UNBLOCK_INTERRUPTIONS NULL
#endif
#if (!HAVE_SNPRINTF)
#define snprintf ap_snprintf
#define vsnprintf ap_vsnprintf
extern int ap_snprintf(char *, size_t, const char *, ...);
extern int ap_vsnprintf(char *, size_t, const char *, va_list);
#endif
#define EXEC_INPUT_BUF 4096
#if FHTTPD
#include <servproc.h>
#ifndef IDLE_TIMEOUT
#define IDLE_TIMEOUT 120
#endif
#ifndef SIGACTARGS
#define SIGACTARGS int n
#endif
extern struct http_server *server;
extern struct request *req;
extern struct httpresponse *response;
extern int global_alarmflag;
extern int idle_timeout;
extern int exit_status;
extern int headermade;
extern char **currentheader;
extern char *headerfirstline;
extern int headerlines;
void alarmhandler(SIGACTARGS);
void setalarm(int t);
int checkinput(int h);
extern PHPAPI void php3_fhttpd_free_header(void);
extern PHPAPI void php3_fhttpd_puts_header(char *s);
extern PHPAPI void php3_fhttpd_puts(char *s);
extern PHPAPI void php3_fhttpd_putc(char c);
extern PHPAPI int php3_fhttpd_write(char *a,int n);
# if !defined(COMPILE_DL)
# define PUTS(s) php3_fhttpd_puts(s)
# define PUTC(c) php3_fhttpd_putc(c)
# define PHPWRITE(a,n) php3_fhttpd_write((a),(n))
# endif
#endif
#define DONT_FREE 0
#define DO_FREE 1
#define PHP3_MIME_TYPE "application/x-httpd-php3"
/* macros */
#undef MIN
#undef MAX
#undef COPY_STRING
#define DO_OR_DIE(retvalue) if (retvalue==FAILURE) { return FAILURE; }
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define STR_FREE(ptr) if (ptr && ptr!=empty_string && ptr!=undefined_variable_string) { efree(ptr); }
#define COPY_STRING(yy) (yy).value.str.val = (char *) estrndup((yy).value.str.val,(yy).value.str.len)
#ifndef MAXPATHLEN
#define MAXPATHLEN 256 /* Should be safe for any weird systems that do not define it */
#endif
#define PHP_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
#define PHP_FUNCTION(name) PHP_NAMED_FUNCTION(php3_##name)
#define PHP_NAMED_FE(php_name, name, arg_types) { #php_name, name, arg_types },
#define PHP_FE(name, arg_types) PHP_NAMED_FE(name, php3_##name, arg_types)
/* global variables */
#ifndef THREAD_SAFE
extern pval *data;
#if (!PHP_ISAPI)
extern char **environ;
#endif
#endif
extern PHPAPI int le_index_ptr; /* list entry type for index pointers */
extern void phperror(char *error);
extern PHPAPI void php3_error(int type, const char *format,...);
extern PHPAPI int php3_printf(const char *format,...);
extern void php3_log_err(char *log_message);
extern int Debug(char *format,...);
extern int cfgparse(void);
extern void html_putc(char c);
#define zenderror phperror
#define zendlex phplex
#define phpparse zendparse
#define phprestart zendrestart
#define phpin zendin
/* functions */
#ifndef THREAD_SAFE
extern int end_current_file_execution(int *retval);
#endif
extern int _php3_hash_environment(void);
extern int module_startup_modules(void);
/* needed for modules only */
extern PHPAPI int php3i_get_le_fp(void);
/*from basic functions*/
extern PHPAPI int _php3_error_log(int opt_err,char *message,char *opt,char *headers);
PHPAPI int cfg_get_long(char *varname, long *result);
PHPAPI int cfg_get_double(char *varname, double *result);
PHPAPI int cfg_get_string(char *varname, char **result);
extern PHPAPI php3_ini_structure php3_ini;
/* Output support */
#include "output.h"
#define PHPWRITE(str, str_len) zend_body_write((str), (str_len))
#define PUTS(str) zend_body_write((str), strlen((str)))
#define PUTC(c) zend_body_write(&(c), 1), (c)
#define PHPWRITE_H(str, str_len) zend_header_write((str), (str_len))
#define PUTS_H(str) zend_header_write((str), strlen((str)))
#define PUTC_H(c) zend_header_write(&(c), 1), (c)
#include "zend_operators.h"
#include "zend_variables.h"
#include "zend_constants.h"
#define RETVAL_LONG(l) { return_value->type = IS_LONG; \
return_value->value.lval = l; }
#define RETVAL_DOUBLE(d) { return_value->type = IS_DOUBLE; \
return_value->value.dval = d; }
#define RETVAL_STRING(s,duplicate) { char *__s=(s); \
return_value->value.str.len = strlen(__s); \
return_value->value.str.val = (duplicate?estrndup(__s,return_value->value.str.len):__s); \
return_value->type = IS_STRING; }
#define RETVAL_STRINGL(s,l,duplicate) { char *__s=(s); int __l=l; \
return_value->value.str.len = __l; \
return_value->value.str.val = (duplicate?estrndup(__s,__l):__s); \
return_value->type = IS_STRING; }
#define RETVAL_FALSE {var_reset(return_value);}
#define RETVAL_TRUE RETVAL_LONG(1L)
#define RETURN_LONG(l) { return_value->type = IS_LONG; \
return_value->value.lval = l; \
return; }
#define RETURN_DOUBLE(d) { return_value->type = IS_DOUBLE; \
return_value->value.dval = d; \
return; }
#define RETURN_STRING(s,duplicate) { char *__s=(s); \
return_value->value.str.len = strlen(__s); \
return_value->value.str.val = (duplicate?estrndup(__s,return_value->value.str.len):__s); \
return_value->type = IS_STRING; \
return; }
#define RETURN_STRINGL(s,l,duplicate) { char *__s=(s); int __l=l; \
return_value->value.str.len = __l; \
return_value->value.str.val = (duplicate?estrndup(__s,__l):__s); \
return_value->type = IS_STRING; \
return; }
/*#define RETURN_NEG RETURN_LONG(-1L) */
#define RETURN_ZERO RETURN_LONG(0L)
#define RETURN_FALSE {var_reset(return_value); return;}
#define RETURN_TRUE RETURN_LONG(1L)
#define SET_VAR_STRING(n,v) { \
{ \
pval var; \
char *str=v; /* prevent 'v' from being evaluated more than once */ \
var.value.str.val = (str); \
var.value.str.len = strlen((str)); \
var.type = IS_STRING; \
_php3_hash_update(&EG(symbol_table), (n), strlen((n))+1, &var, sizeof(pval),NULL); \
} \
}
#define SET_VAR_STRINGL(n,v,l) { \
{ \
pval var; \
char *name=(n); \
var.value.str.val = (v); \
var.value.str.len = (l); \
var.type = IS_STRING; \
_php3_hash_update(&EG(symbol_table), name, strlen(name)+1, &var, sizeof(pval),NULL); \
} \
}
#define SET_VAR_LONG(n,v) { \
{ \
pval var; \
var.value.lval = (v); \
var.type = IS_LONG; \
_php3_hash_update(&EG(symbol_table), (n), strlen((n))+1, &var, sizeof(pval),NULL); \
} \
}
#define SET_VAR_DOUBLE(n,v) { \
{ \
pval var; \
var.value.dval = (v); \
var.type = IS_DOUBLE; \
_php3_hash_update(&EG(symbol_table)), (n), strlen((n))+1, &var, sizeof(pval),NULL); \
} \
}
#ifndef THREAD_SAFE
extern int yylineno;
#endif
extern void phprestart(FILE *input_file);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/

80
main/php3_compat.h Normal file
View file

@ -0,0 +1,80 @@
#ifndef _PHP3_COMPAT_H
#define _PHP3_COMPAT_H
#define _php3_hash_init zend_hash_init
#define _php3_hash_destroy zend_hash_destroy
#define _php3_hash_clean zend_hash_clean
#define _php3_hash_add_or_update zend_hash_add_or_update
#define _php3_hash_add zend_hash_add
#define _php3_hash_update zend_hash_update
#define _php3_hash_update_ptr zend_hash_update_ptr
#define _php3_hash_quick_add_or_update zend_hash_quick_add_or_update
#define _php3_hash_quick_add zend_hash_quick_add
#define _php3_hash_quick_update zend_hash_quick_update
#define _php3_hash_index_update_or_next_insert zend_hash_index_update_or_next_insert
#define _php3_hash_index_update zend_hash_index_update
#define _php3_hash_next_index_insert zend_hash_next_index_insert
#define _php3_hash_pointer_update zend_hash_pointer_update
#define _php3_hash_pointer_index_update_or_next_insert zend_hash_pointer_index_update_or_next_insert
#define _php3_hash_pointer_index_update zend_hash_pointer_index_update
#define _php3_hash_next_index_pointer_update zend_hash_next_index_pointer_update
#define _php3_hash_del_key_or_index zend_hash_del_key_or_index
#define _php3_hash_del zend_hash_del
#define _php3_hash_index_del zend_hash_index_del
#define _php3_hash_find zend_hash_find
#define _php3_hash_quick_find zend_hash_quick_find
#define _php3_hash_index_find zend_hash_index_find
#define _php3_hash_exists zend_hash_exists
#define _php3_hash_index_exists zend_hash_index_exists
#define _php3_hash_is_pointer zend_hash_is_pointer
#define _php3_hash_index_is_pointer zend_hash_index_is_pointer
#define _php3_hash_next_free_element zend_hash_next_free_element
#define _php3_hash_move_forward zend_hash_move_forward
#define _php3_hash_move_backwards zend_hash_move_backwards
#define _php3_hash_get_current_key zend_hash_get_current_key
#define _php3_hash_get_current_data zend_hash_get_current_data
#define _php3_hash_internal_pointer_reset zend_hash_internal_pointer_reset
#define _php3_hash_internal_pointer_end zend_hash_internal_pointer_end
#define _php3_hash_copy zend_hash_copy
#define _php3_hash_merge zend_hash_merge
#define _php3_hash_sort zend_hash_sort
#define _php3_hash_minmax zend_hash_minmax
#define _php3_hash_num_elements zend_hash_num_elements
#define _php3_hash_apply zend_hash_apply
#define _php3_hash_apply_with_argument zend_hash_apply_with_argument
#define php3_module_entry zend_module_entry
#define php3_strndup zend_strndup
#define php3_str_tolower zend_str_tolower
#define php3_binary_strcmp zend_binary_strcmp
#define php3_list_insert zend_list_insert
#define php3_list_find zend_list_find
#define php3_list_delete zend_list_delete
#define php3_plist_insert zend_plist_insert
#define php3_plist_find zend_plist_find
#define php3_plist_delete zend_plist_delete
#define zend_print_pval zend_print_zval
#define zend_print_pval_r zend_print_zval_r
#endif /* _PHP3_COMPAT_H */

148
main/php_ini.c Normal file
View file

@ -0,0 +1,148 @@
#include <stdlib.h>
#include "php.h"
#include "php_ini.h"
#include "zend_alloc.h"
static HashTable known_directives;
/*
* hash_apply functions
*/
static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number)
{
if (ini_entry->module_number == *module_number) {
return 1;
} else {
return 0;
}
}
static int zend_restore_ini_entry(zend_ini_entry *ini_entry)
{
if (ini_entry->modified) {
efree(ini_entry->value);
ini_entry->value = ini_entry->orig_value;
ini_entry->value_length = ini_entry->orig_value_length;
ini_entry->modified = 0;
}
return 0;
}
/*
* Startup / shutdown
*/
int zend_ini_mstartup()
{
if (_php3_hash_init(&known_directives, 100, NULL, NULL, 1)==FAILURE) {
return FAILURE;
}
return SUCCESS;
}
int zend_ini_mshutdown()
{
_php3_hash_destroy(&known_directives);
return SUCCESS;
}
int zend_ini_rshutdown()
{
_php3_hash_apply(&known_directives, (int (*)(void *)) zend_restore_ini_entry);
return SUCCESS;
}
/*
* Registration / unregistration
*/
int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number)
{
zend_ini_entry *p = ini_entry;
zend_ini_entry *hashed_ini_entry;
pval *default_value;
while (p->name) {
p->module_number = module_number;
if (_php3_hash_add(&known_directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
zend_unregister_ini_entries(module_number);
return FAILURE;
}
if ((default_value=cfg_get_entry(p->name, p->name_length))) {
hashed_ini_entry->value = default_value->value.str.val;
hashed_ini_entry->value_length = default_value->value.str.len;
}
hashed_ini_entry->modified = 0;
p++;
}
return SUCCESS;
}
void zend_unregister_ini_entries(int module_number)
{
_php3_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) zend_remove_ini_entries, (void *) &module_number);
}
int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type)
{
zend_ini_entry *ini_entry;
if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) {
return FAILURE;
}
if (!(ini_entry->modifyable & modify_type)) {
return FAILURE;
}
ini_entry->value = estrndup(new_value, new_value_length);
ini_entry->value_length = new_value_length;
ini_entry->modified = 1;
return SUCCESS;
}
/*
* Data retrieval
*/
long zend_ini_long(char *name, uint name_length)
{
zend_ini_entry *ini_entry;
if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
return (long) atoi(ini_entry->value);
}
return 0;
}
double zend_ini_double(char *name, uint name_length)
{
zend_ini_entry *ini_entry;
if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
return (double) strtod(ini_entry->value, NULL);
}
return 0.0;
}
char *zend_ini_string(char *name, uint name_length)
{
zend_ini_entry *ini_entry;
if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
return ini_entry->value;
}
return "";
}

48
main/php_ini.h Normal file
View file

@ -0,0 +1,48 @@
#ifndef _ZEND_INI_H
#define _ZEND_INI_H
#define ZEND_INI_USER (1<<0)
#define ZEND_INI_PERDIR (1<<1)
#define ZEND_INI_SYSTEM (1<<2)
#define ZEND_INI_ALL (ZEND_INI_USER|ZEND_INI_PERDIR|ZEND_INI_SYSTEM)
typedef struct {
int module_number;
int modifyable;
char *name;
uint name_length;
char *value;
uint value_length;
char *orig_value;
uint orig_value_length;
int modified;
} zend_ini_entry;
int zend_ini_mstartup();
int zend_ini_mshutdown();
int zend_ini_rshutdown();
int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number);
void zend_unregister_ini_entries(int module_number);
int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type);
long zend_ini_long(char *name, uint name_length);
double zend_ini_double(char *name, uint name_length);
char *zend_ini_string(char *name, uint name_length);
#define ZEND_INI_BEGIN() static zend_ini_entry ini_entries[] = {
#define ZEND_INI_ENTRY(name, default_value, modifyable) { 0, modifyable, name, sizeof(name), default_value, sizeof(default_value)-1, NULL, 0, 0 },
#define ZEND_INI_END() { 0, 0, NULL, 0, NULL, 0, NULL, 0, 0 } };
#define INI_INT(name) zend_ini_long((name), sizeof(name))
#define INI_FLT(name) zend_ini_double((name), sizeof(name))
#define INI_STR(name) zend_ini_string((name), sizeof(name))
pval *cfg_get_entry(char *name, uint name_length);
#endif /* _ZEND_INI_H */

1
main/php_version.h Normal file
View file

@ -0,0 +1 @@
#define PHP_VERSION "4.0pa1"

156
main/safe_mode.c Normal file
View file

@ -0,0 +1,156 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
#include "php.h"
#include <stdio.h>
#include <stdlib.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/stat.h>
#include "functions/pageinfo.h"
#include "safe_mode.h"
/*
* _php3_checkuid
*
* This function has four modes:
*
* 0 - return invalid (0) if file does not exist
* 1 - return valid (1) if file does not exist
* 2 - if file does not exist, check directory
* 3 - only check directory (needed for mkdir)
*/
PHPAPI int _php3_checkuid(const char *fn, int mode) {
struct stat sb;
int ret;
long uid=0L, duid=0L;
char *s;
if (!fn) return(0); /* path must be provided */
/*
* If given filepath is a URL, allow - safe mode stuff
* related to URL's is checked in individual functions
*/
if (!strncasecmp(fn,"http://",7) || !strncasecmp(fn,"ftp://",6)) {
return(1);
}
if (mode<3) {
ret = stat(fn,&sb);
if (ret<0 && mode < 2) {
php3_error(E_WARNING,"Unable to access %s",fn);
return(mode);
}
if (ret>-1) {
uid=sb.st_uid;
if (uid==_php3_getuid()) return(1);
}
}
s = strrchr(fn,'/');
/* This loop gets rid of trailing slashes which could otherwise be
* used to confuse the function.
*/
while(s && *(s+1)=='\0' && s>fn) {
s='\0';
s = strrchr(fn,'/');
}
if (s) {
*s='\0';
ret = stat(fn,&sb);
*s='/';
if (ret<0) {
php3_error(E_WARNING, "Unable to access %s",fn);
return(0);
}
duid = sb.st_uid;
} else {
s = emalloc(MAXPATHLEN+1);
if (!getcwd(s,MAXPATHLEN)) {
php3_error(E_WARNING, "Unable to access current working directory");
return(0);
}
ret = stat(s,&sb);
efree(s);
if (ret<0) {
php3_error(E_WARNING, "Unable to access %s",s);
return(0);
}
duid = sb.st_uid;
}
if (duid == (uid=_php3_getuid())) return(1);
else {
php3_error(E_WARNING, "SAFE MODE Restriction in effect. The script whose uid is %ld is not allowed to access %s owned by uid %ld",uid,fn,duid);
return(0);
}
}
PHPAPI char *_php3_get_current_user()
{
#if CGI_BINARY || USE_SAPI || FHTTPD
struct stat statbuf;
#endif
struct passwd *pwd;
int uid;
TLS_VARS;
if (GLOBAL(request_info).current_user) {
return GLOBAL(request_info).current_user;
}
/* FIXME: I need to have this somehow handled if
USE_SAPI is defined, because cgi will also be
interfaced in USE_SAPI */
#if CGI_BINARY || USE_SAPI || FHTTPD
if (!GLOBAL(request_info).filename || (stat(GLOBAL(request_info).filename,&statbuf)==-1)) {
return empty_string;
}
uid = statbuf.st_uid;
#endif
#if APACHE
uid = GLOBAL(php3_rqst)->finfo.st_uid;
#endif
if ((pwd=getpwuid(uid))==NULL) {
return empty_string;
}
GLOBAL(request_info).current_user_length = strlen(pwd->pw_name);
GLOBAL(request_info).current_user = estrndup(pwd->pw_name,GLOBAL(request_info).current_user_length);
return GLOBAL(request_info).current_user;
}

7
main/safe_mode.h Normal file
View file

@ -0,0 +1,7 @@
#ifndef _SAFE_MODE_H_
#define _SAFE_MODE_H_
extern PHPAPI int _php3_checkuid(const char *filename, int mode);
extern PHPAPI char *_php3_get_current_user(void);
#endif

935
main/snprintf.c Normal file
View file

@ -0,0 +1,935 @@
/* ====================================================================
* Copyright (c) 1995-1998 The Apache Group. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* 4. The names "Apache Server" and "Apache Group" must not be used to
* endorse or promote products derived from this software without
* prior written permission.
*
* 5. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Group and was originally based
* on public domain software written at the National Center for
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
* For more information on the Apache Group and the Apache HTTP server
* project, please see <http://www.apache.org/>.
*
* This code is based on, and used with the permission of, the
* SIO stdio-replacement strx_* functions by Panos Tsirigotis
* <panos@alumni.cs.colorado.edu> for xinetd.
*/
#include "config.h"
#if !defined(APACHE) || (!APACHE)
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "php.h"
#ifdef HAVE_GCVT
#define ap_ecvt ecvt
#define ap_fcvt fcvt
#define ap_gcvt gcvt
#else
/*
* cvt.c - IEEE floating point formatting routines for FreeBSD
* from GNU libc-4.6.27
*/
/*
* ap_ecvt converts to decimal
* the number of digits is specified by ndigit
* decpt is set to the position of the decimal point
* sign is set to 0 for positive, 1 for negative
*/
#define NDIG 80
static char *
ap_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag)
{
register int r2;
double fi, fj;
register char *p, *p1;
static char buf[NDIG];
if (ndigits >= NDIG - 1)
ndigits = NDIG - 2;
r2 = 0;
*sign = 0;
p = &buf[0];
if (arg < 0) {
*sign = 1;
arg = -arg;
}
arg = modf(arg, &fi);
p1 = &buf[NDIG];
/*
* Do integer part
*/
if (fi != 0) {
p1 = &buf[NDIG];
while (fi != 0) {
fj = modf(fi / 10, &fi);
*--p1 = (int) ((fj + .03) * 10) + '0';
r2++;
}
while (p1 < &buf[NDIG])
*p++ = *p1++;
} else if (arg > 0) {
while ((fj = arg * 10) < 1) {
arg = fj;
r2--;
}
}
p1 = &buf[ndigits];
if (eflag == 0)
p1 += r2;
*decpt = r2;
if (p1 < &buf[0]) {
buf[0] = '\0';
return (buf);
}
while (p <= p1 && p < &buf[NDIG]) {
arg *= 10;
arg = modf(arg, &fj);
*p++ = (int) fj + '0';
}
if (p1 >= &buf[NDIG]) {
buf[NDIG - 1] = '\0';
return (buf);
}
p = p1;
*p1 += 5;
while (*p1 > '9') {
*p1 = '0';
if (p1 > buf)
++ * --p1;
else {
*p1 = '1';
(*decpt)++;
if (eflag == 0) {
if (p > buf)
*p = '0';
p++;
}
}
}
*p = '\0';
return (buf);
}
static char *
ap_ecvt(double arg, int ndigits, int *decpt, int *sign)
{
return (ap_cvt(arg, ndigits, decpt, sign, 1));
}
static char *
ap_fcvt(double arg, int ndigits, int *decpt, int *sign)
{
return (ap_cvt(arg, ndigits, decpt, sign, 0));
}
/*
* ap_gcvt - Floating output conversion to
* minimal length string
*/
static char *
ap_gcvt(double number, int ndigit, char *buf)
{
int sign, decpt;
register char *p1, *p2;
register i;
p1 = ap_ecvt(number, ndigit, &decpt, &sign);
p2 = buf;
if (sign)
*p2++ = '-';
for (i = ndigit - 1; i > 0 && p1[i] == '0'; i--)
ndigit--;
if ((decpt >= 0 && decpt - ndigit > 4)
|| (decpt < 0 && decpt < -3)) { /* use E-style */
decpt--;
*p2++ = *p1++;
*p2++ = '.';
for (i = 1; i < ndigit; i++)
*p2++ = *p1++;
*p2++ = 'e';
if (decpt < 0) {
decpt = -decpt;
*p2++ = '-';
} else
*p2++ = '+';
if (decpt / 100 > 0)
*p2++ = decpt / 100 + '0';
if (decpt / 10 > 0)
*p2++ = (decpt % 100) / 10 + '0';
*p2++ = decpt % 10 + '0';
} else {
if (decpt <= 0) {
if (*p1 != '0')
*p2++ = '.';
while (decpt < 0) {
decpt++;
*p2++ = '0';
}
}
for (i = 1; i <= ndigit; i++) {
*p2++ = *p1++;
if (i == decpt)
*p2++ = '.';
}
if (ndigit < decpt) {
while (ndigit++ < decpt)
*p2++ = '0';
*p2++ = '.';
}
}
if (p2[-1] == '.')
p2--;
*p2 = '\0';
return (buf);
}
#endif /* HAVE_CVT */
typedef enum {
NO = 0, YES = 1
} boolean_e;
#define FALSE 0
#define TRUE 1
#define NUL '\0'
#define INT_NULL ((int *)0)
#define WIDE_INT long
typedef WIDE_INT wide_int;
typedef unsigned WIDE_INT u_wide_int;
typedef int bool_int;
#define S_NULL "(null)"
#define S_NULL_LEN 6
#define FLOAT_DIGITS 6
#define EXPONENT_LENGTH 10
/*
* NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions
*
* XXX: this is a magic number; do not decrease it
*/
#define NUM_BUF_SIZE 512
/*
* Descriptor for buffer area
*/
struct buf_area {
char *buf_end;
char *nextb; /* pointer to next byte to read/write */
};
typedef struct buf_area buffy;
/*
* The INS_CHAR macro inserts a character in the buffer and writes
* the buffer back to disk if necessary
* It uses the char pointers sp and bep:
* sp points to the next available character in the buffer
* bep points to the end-of-buffer+1
* While using this macro, note that the nextb pointer is NOT updated.
*
* NOTE: Evaluation of the c argument should not have any side-effects
*/
#define INS_CHAR( c, sp, bep, cc ) \
{ \
if ( sp < bep ) \
{ \
*sp++ = c ; \
cc++ ; \
} \
}
#define NUM( c ) ( c - '0' )
#define STR_TO_DEC( str, num ) \
num = NUM( *str++ ) ; \
while ( isdigit((int)*str ) ) \
{ \
num *= 10 ; \
num += NUM( *str++ ) ; \
}
/*
* This macro does zero padding so that the precision
* requirement is satisfied. The padding is done by
* adding '0's to the left of the string that is going
* to be printed.
*/
#define FIX_PRECISION( adjust, precision, s, s_len ) \
if ( adjust ) \
while ( s_len < precision ) \
{ \
*--s = '0' ; \
s_len++ ; \
}
/*
* Macro that does padding. The padding is done by printing
* the character ch.
*/
#define PAD( width, len, ch ) do \
{ \
INS_CHAR( ch, sp, bep, cc ) ; \
width-- ; \
} \
while ( width > len )
/*
* Prefix the character ch to the string str
* Increase length
* Set the has_prefix flag
*/
#define PREFIX( str, length, ch ) *--str = ch ; length++ ; has_prefix = YES
/*
* Convert num to its decimal format.
* Return value:
* - a pointer to a string containing the number (no sign)
* - len contains the length of the string
* - is_negative is set to TRUE or FALSE depending on the sign
* of the number (always set to FALSE if is_unsigned is TRUE)
*
* The caller provides a buffer for the string: that is the buf_end argument
* which is a pointer to the END of the buffer + 1 (i.e. if the buffer
* is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
*/
static char *
conv_10(register wide_int num, register bool_int is_unsigned,
register bool_int * is_negative, char *buf_end, register int *len)
{
register char *p = buf_end;
register u_wide_int magnitude;
if (is_unsigned) {
magnitude = (u_wide_int) num;
*is_negative = FALSE;
} else {
*is_negative = (num < 0);
/*
* On a 2's complement machine, negating the most negative integer
* results in a number that cannot be represented as a signed integer.
* Here is what we do to obtain the number's magnitude:
* a. add 1 to the number
* b. negate it (becomes positive)
* c. convert it to unsigned
* d. add 1
*/
if (*is_negative) {
wide_int t = num + 1;
magnitude = ((u_wide_int) - t) + 1;
} else
magnitude = (u_wide_int) num;
}
/*
* We use a do-while loop so that we write at least 1 digit
*/
do {
register u_wide_int new_magnitude = magnitude / 10;
*--p = magnitude - new_magnitude * 10 + '0';
magnitude = new_magnitude;
}
while (magnitude);
*len = buf_end - p;
return (p);
}
/*
* Convert a floating point number to a string formats 'f', 'e' or 'E'.
* The result is placed in buf, and len denotes the length of the string
* The sign is returned in the is_negative argument (and is not placed
* in buf).
*/
static char *
conv_fp(register char format, register double num,
boolean_e add_dp, int precision, bool_int * is_negative, char *buf, int *len)
{
register char *s = buf;
register char *p;
int decimal_point;
if (format == 'f')
p = ap_fcvt(num, precision, &decimal_point, is_negative);
else /* either e or E format */
p = ap_ecvt(num, precision + 1, &decimal_point, is_negative);
/*
* Check for Infinity and NaN
*/
if (isalpha((int)*p)) {
*len = strlen(strcpy(buf, p));
*is_negative = FALSE;
return (buf);
}
if (format == 'f') {
if (decimal_point <= 0) {
*s++ = '0';
if (precision > 0) {
*s++ = '.';
while (decimal_point++ < 0)
*s++ = '0';
} else if (add_dp) {
*s++ = '.';
}
} else {
while (decimal_point-- > 0) {
*s++ = *p++;
}
if (precision > 0 || add_dp) {
*s++ = '.';
}
}
} else {
*s++ = *p++;
if (precision > 0 || add_dp)
*s++ = '.';
}
/*
* copy the rest of p, the NUL is NOT copied
*/
while (*p)
*s++ = *p++;
if (format != 'f') {
char temp[EXPONENT_LENGTH]; /* for exponent conversion */
int t_len;
bool_int exponent_is_negative;
*s++ = format; /* either e or E */
decimal_point--;
if (decimal_point != 0) {
p = conv_10((wide_int) decimal_point, FALSE, &exponent_is_negative,
&temp[EXPONENT_LENGTH], &t_len);
*s++ = exponent_is_negative ? '-' : '+';
/*
* Make sure the exponent has at least 2 digits
*/
if (t_len == 1)
*s++ = '0';
while (t_len--)
*s++ = *p++;
} else {
*s++ = '+';
*s++ = '0';
*s++ = '0';
}
}
*len = s - buf;
return (buf);
}
/*
* Convert num to a base X number where X is a power of 2. nbits determines X.
* For example, if nbits is 3, we do base 8 conversion
* Return value:
* a pointer to a string containing the number
*
* The caller provides a buffer for the string: that is the buf_end argument
* which is a pointer to the END of the buffer + 1 (i.e. if the buffer
* is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
*/
static char *
conv_p2(register u_wide_int num, register int nbits,
char format, char *buf_end, register int *len)
{
register int mask = (1 << nbits) - 1;
register char *p = buf_end;
static char low_digits[] = "0123456789abcdef";
static char upper_digits[] = "0123456789ABCDEF";
register char *digits = (format == 'X') ? upper_digits : low_digits;
do {
*--p = digits[num & mask];
num >>= nbits;
}
while (num);
*len = buf_end - p;
return (p);
}
/*
* Do format conversion placing the output in buffer
*/
static int format_converter(register buffy * odp, const char *fmt,
va_list ap)
{
register char *sp;
register char *bep;
register int cc = 0;
register int i;
register char *s = NULL;
char *q;
int s_len;
register int min_width = 0;
int precision = 0;
enum {
LEFT, RIGHT
} adjust;
char pad_char;
char prefix_char;
double fp_num;
wide_int i_num = (wide_int) 0;
u_wide_int ui_num;
char num_buf[NUM_BUF_SIZE];
char char_buf[2]; /* for printing %% and %<unknown> */
/*
* Flag variables
*/
boolean_e is_long;
boolean_e alternate_form;
boolean_e print_sign;
boolean_e print_blank;
boolean_e adjust_precision;
boolean_e adjust_width;
bool_int is_negative;
sp = odp->nextb;
bep = odp->buf_end;
while (*fmt) {
if (*fmt != '%') {
INS_CHAR(*fmt, sp, bep, cc);
} else {
/*
* Default variable settings
*/
adjust = RIGHT;
alternate_form = print_sign = print_blank = NO;
pad_char = ' ';
prefix_char = NUL;
fmt++;
/*
* Try to avoid checking for flags, width or precision
*/
if (isascii((int)*fmt) && !islower((int)*fmt)) {
/*
* Recognize flags: -, #, BLANK, +
*/
for (;; fmt++) {
if (*fmt == '-')
adjust = LEFT;
else if (*fmt == '+')
print_sign = YES;
else if (*fmt == '#')
alternate_form = YES;
else if (*fmt == ' ')
print_blank = YES;
else if (*fmt == '0')
pad_char = '0';
else
break;
}
/*
* Check if a width was specified
*/
if (isdigit((int)*fmt)) {
STR_TO_DEC(fmt, min_width);
adjust_width = YES;
} else if (*fmt == '*') {
min_width = va_arg(ap, int);
fmt++;
adjust_width = YES;
if (min_width < 0) {
adjust = LEFT;
min_width = -min_width;
}
} else
adjust_width = NO;
/*
* Check if a precision was specified
*
* XXX: an unreasonable amount of precision may be specified
* resulting in overflow of num_buf. Currently we
* ignore this possibility.
*/
if (*fmt == '.') {
adjust_precision = YES;
fmt++;
if (isdigit((int)*fmt)) {
STR_TO_DEC(fmt, precision);
} else if (*fmt == '*') {
precision = va_arg(ap, int);
fmt++;
if (precision < 0)
precision = 0;
} else
precision = 0;
} else
adjust_precision = NO;
} else
adjust_precision = adjust_width = NO;
/*
* Modifier check
*/
if (*fmt == 'l') {
is_long = YES;
fmt++;
} else
is_long = NO;
/*
* Argument extraction and printing.
* First we determine the argument type.
* Then, we convert the argument to a string.
* On exit from the switch, s points to the string that
* must be printed, s_len has the length of the string
* The precision requirements, if any, are reflected in s_len.
*
* NOTE: pad_char may be set to '0' because of the 0 flag.
* It is reset to ' ' by non-numeric formats
*/
switch (*fmt) {
case 'u':
if (is_long)
i_num = va_arg(ap, u_wide_int);
else
i_num = (wide_int) va_arg(ap, unsigned int);
/*
* The rest also applies to other integer formats, so fall
* into that case.
*/
case 'd':
case 'i':
/*
* Get the arg if we haven't already.
*/
if ((*fmt) != 'u') {
if (is_long)
i_num = va_arg(ap, wide_int);
else
i_num = (wide_int) va_arg(ap, int);
};
s = conv_10(i_num, (*fmt) == 'u', &is_negative,
&num_buf[NUM_BUF_SIZE], &s_len);
FIX_PRECISION(adjust_precision, precision, s, s_len);
if (*fmt != 'u') {
if (is_negative)
prefix_char = '-';
else if (print_sign)
prefix_char = '+';
else if (print_blank)
prefix_char = ' ';
}
break;
case 'o':
if (is_long)
ui_num = va_arg(ap, u_wide_int);
else
ui_num = (u_wide_int) va_arg(ap, unsigned int);
s = conv_p2(ui_num, 3, *fmt,
&num_buf[NUM_BUF_SIZE], &s_len);
FIX_PRECISION(adjust_precision, precision, s, s_len);
if (alternate_form && *s != '0') {
*--s = '0';
s_len++;
}
break;
case 'x':
case 'X':
if (is_long)
ui_num = (u_wide_int) va_arg(ap, u_wide_int);
else
ui_num = (u_wide_int) va_arg(ap, unsigned int);
s = conv_p2(ui_num, 4, *fmt,
&num_buf[NUM_BUF_SIZE], &s_len);
FIX_PRECISION(adjust_precision, precision, s, s_len);
if (alternate_form && i_num != 0) {
*--s = *fmt; /* 'x' or 'X' */
*--s = '0';
s_len += 2;
}
break;
case 's':
s = va_arg(ap, char *);
if (s != NULL) {
s_len = strlen(s);
if (adjust_precision && precision < s_len)
s_len = precision;
} else {
s = S_NULL;
s_len = S_NULL_LEN;
}
pad_char = ' ';
break;
case 'f':
case 'e':
case 'E':
fp_num = va_arg(ap, double);
s = conv_fp(*fmt, fp_num, alternate_form,
(adjust_precision == NO) ? FLOAT_DIGITS : precision,
&is_negative, &num_buf[1], &s_len);
if (is_negative)
prefix_char = '-';
else if (print_sign)
prefix_char = '+';
else if (print_blank)
prefix_char = ' ';
break;
case 'g':
case 'G':
if (adjust_precision == NO)
precision = FLOAT_DIGITS;
else if (precision == 0)
precision = 1;
/*
* * We use &num_buf[ 1 ], so that we have room for the sign
*/
s = ap_gcvt(va_arg(ap, double), precision, &num_buf[1]);
if (*s == '-')
prefix_char = *s++;
else if (print_sign)
prefix_char = '+';
else if (print_blank)
prefix_char = ' ';
s_len = strlen(s);
if (alternate_form && (q = strchr(s, '.')) == NULL)
s[s_len++] = '.';
if (*fmt == 'G' && (q = strchr(s, 'e')) != NULL)
*q = 'E';
break;
case 'c':
char_buf[0] = (char) (va_arg(ap, int));
s = &char_buf[0];
s_len = 1;
pad_char = ' ';
break;
case '%':
char_buf[0] = '%';
s = &char_buf[0];
s_len = 1;
pad_char = ' ';
break;
case 'n':
*(va_arg(ap, int *)) = cc;
break;
/*
* Always extract the argument as a "char *" pointer. We
* should be using "void *" but there are still machines
* that don't understand it.
* If the pointer size is equal to the size of an unsigned
* integer we convert the pointer to a hex number, otherwise
* we print "%p" to indicate that we don't handle "%p".
*/
case 'p':
ui_num = (u_wide_int) va_arg(ap, char *);
if (sizeof(char *) <= sizeof(u_wide_int))
s = conv_p2(ui_num, 4, 'x',
&num_buf[NUM_BUF_SIZE], &s_len);
else {
s = "%p";
s_len = 2;
}
pad_char = ' ';
break;
case NUL:
/*
* The last character of the format string was %.
* We ignore it.
*/
continue;
/*
* The default case is for unrecognized %'s.
* We print %<char> to help the user identify what
* option is not understood.
* This is also useful in case the user wants to pass
* the output of format_converter to another function
* that understands some other %<char> (like syslog).
* Note that we can't point s inside fmt because the
* unknown <char> could be preceded by width etc.
*/
default:
char_buf[0] = '%';
char_buf[1] = *fmt;
s = char_buf;
s_len = 2;
pad_char = ' ';
break;
}
if (prefix_char != NUL) {
*--s = prefix_char;
s_len++;
}
if (adjust_width && adjust == RIGHT && min_width > s_len) {
if (pad_char == '0' && prefix_char != NUL) {
INS_CHAR(*s, sp, bep, cc)
s++;
s_len--;
min_width--;
}
PAD(min_width, s_len, pad_char);
}
/*
* Print the string s.
*/
for (i = s_len; i != 0; i--) {
INS_CHAR(*s, sp, bep, cc);
s++;
}
if (adjust_width && adjust == LEFT && min_width > s_len)
PAD(min_width, s_len, pad_char);
}
fmt++;
}
odp->nextb = sp;
return (cc);
}
/*
* This is the general purpose conversion function.
*/
static void strx_printv(int *ccp, char *buf, size_t len, const char *format,
va_list ap)
{
buffy od;
int cc;
/*
* First initialize the descriptor
* Notice that if no length is given, we initialize buf_end to the
* highest possible address.
*/
od.buf_end = len ? &buf[len] : (char *) ~0;
od.nextb = buf;
/*
* Do the conversion
*/
cc = format_converter(&od, format, ap);
if (len == 0 || od.nextb <= od.buf_end)
*(od.nextb) = '\0';
if (ccp)
*ccp = cc;
}
int ap_snprintf(char *buf, size_t len, const char *format,...)
{
int cc;
va_list ap;
va_start(ap, format);
strx_printv(&cc, buf, (len - 1), format, ap);
va_end(ap);
return (cc);
}
int ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap)
{
int cc;
strx_printv(&cc, buf, (len - 1), format, ap);
return (cc);
}
#endif /* HAVE_SNPRINTF */
#endif /* APACHE */

56
main/snprintf.h Normal file
View file

@ -0,0 +1,56 @@
/*
+----------------------------------------------------------------------+
| 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> |
+----------------------------------------------------------------------+
*/
#ifndef _PHP3_SNPRINTF_H
#define _PHP3_SNPRINTF_H
#ifndef HAVE_SNPRINTF
extern int ap_snprintf(char *, size_t, const char *, ...);
#define snprintf ap_snprintf
#endif
#ifndef HAVE_VSNPRINTF
extern int ap_vsnprintf(char *, size_t, const char *, va_list ap);
#define vsnprintf ap_vsnprintf
#endif
#if BROKEN_SPRINTF
int _php3_sprintf (char* s, const char* format, ...);
#else
#define _php3_sprintf sprintf
#endif
#endif /* _PHP3_SNPRINTF_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/

74
main/win95nt.h Normal file
View file

@ -0,0 +1,74 @@
/* Defines and types for Windows 95/NT */
#define WIN32_LEAN_AND_MEAN
#include <io.h>
#include <malloc.h>
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>
typedef int uid_t;
typedef int gid_t;
typedef int mode_t;
typedef char * caddr_t;
#define lstat(x, y) stat(x, y)
#define _IFIFO 0010000 /* fifo */
#define _IFBLK 0060000 /* block special */
#define _IFLNK 0120000 /* symbolic link */
#define S_IFIFO _IFIFO
#define S_IFBLK _IFBLK
#define S_IFLNK _IFLNK
#define pclose _pclose
#define popen _popen
#define chdir(path) SetCurrentDirectory(path)
#define mkdir(a,b) _mkdir(a)
#define rmdir _rmdir
#define getpid _getpid
#if !(APACHE)
#define sleep(t) Sleep(t*1000)
#endif
#define getcwd _getcwd
#define snprintf _snprintf
#define off_t _off_t
#define vsnprintf _vsnprintf
typedef unsigned int uint;
typedef unsigned long ulong;
#if !NSAPI
#define strcasecmp(s1, s2) stricmp(s1, s2)
#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
typedef long pid_t;
#endif
/* missing in vc5 math.h */
#define M_PI 3.14159265358979323846
#define M_TWOPI (M_PI * 2.0)
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.78539816339744830962
#if !DEBUG
#ifdef inline
#undef inline
#endif
#define inline __inline
#endif
/* General Windows stuff */
#define WINDOWS 1
/* Prevent use of VC5 OpenFile function */
#define NOOPENFILE
/* sendmail is built-in */
#ifdef PHP_PROG_SENDMAIL
#undef PHP_PROG_SENDMAIL
#define PHP_PROG_SENDMAIL "Built in mailer"
#endif
#define CONVERT_TO_WIN_FS(Filename) \
{ \
char *stemp; \
if (Filename) \
for (stemp = Filename; *stemp; stemp++) \
if ( *stemp == '/') \
*stemp = '\\'; \
}

13
makeall.bat Executable file
View file

@ -0,0 +1,13 @@
NMAKE /f "php3.mak" CFG="php3 - Win32 %1"
NMAKE /f "calendar.mak" CFG="calendar - Win32 %1"
NMAKE /f "dbase.mak" CFG="dbase - Win32 %1"
NMAKE /f "dbm.mak" CFG="dbm - Win32 %1"
NMAKE /f "filepro.mak" CFG="filepro - Win32 %1"
NMAKE /f "gd.mak" CFG="gd - Win32 %1"
NMAKE /f "imap4.mak" CFG="imap4 - Win32 %1"
NMAKE /f "hyperwave.mak" CFG="hyperwave - Win32 %1"
NMAKE /f "ldap.mak" CFG="ldap - Win32 %1"
NMAKE /f "msql.mak" CFG="msql - Win32 %1"
NMAKE /f "mysql.mak" CFG="mysql - Win32 %1"
NMAKE /f "zlib.mak" CFG="zlib - Win32 %1"
NMAKE /f "snmp.mak" CFG="snmp - Win32 %1"

126
makedist Executable file
View file

@ -0,0 +1,126 @@
#!/bin/sh
#
# Distribution generator for CVS based packages.
# To work, this script needs a consistent tagging of all releases.
# Each release of a package should have a tag of the form
#
# <package>_<version>
#
# where <package> is the package name and the CVS module
# and <version> s the version number with underscores instead of dots.
#
# For example: cvs tag php_3_0a1
#
# The distribution ends up in a .tar.gz file that contains the distribution
# in a directory called <package>-<version>. The distribution contains all
# directories from the CVS module except the one called "nodist", but only
# the files INSTALL, README and config* are included.
#
# Since you can no longer set the CVS password via an env variable, you
# need to have previously done a cvs login for the server and user id
# this script uses so it will have an entry in your ~/.cvspasswd file.
#
# Usage: makedist <package> <version>
#
# Written by Stig Bakken <ssb@guardian.no> 1997-05-28.
#
# $Id$
#
CVSROOT=:pserver:cvsread@cvs.php.net:/repository
export CVSROOT
if echo '\c' | grep -s c >/dev/null 2>&1
then
ECHO_N="echo -n"
ECHO_C=""
else
ECHO_N="echo"
ECHO_C='\c'
fi
if test "$#" != "2"; then
echo "Usage: makedist <package> <version>" >&2
exit 1
fi
PKG=$1 ; shift
VER=$1 ; shift
OLDPWD=`pwd`
# the destination .tar.gz file
ARCHIVE=$OLDPWD/$PKG-$VER.tar.gz
# temporary directory used to check out files from CVS
TMPDIR=$OLDPWD/cvstmp-$PKG-$VER
# version part of the CVS release tag
CVSVER=`echo $VER | sed -e 's/\./_/g'`
# CVS release tag
CVSTAG=${PKG}_$CVSVER
# should become "php3"
CVSMOD=`cat CVS/Repository | sed -e 's!^/[^/]*/!!'`
if test ! -d $TMPDIR; then
mkdir -p $TMPDIR || exit 2
fi
cd $TMPDIR || exit 3
$ECHO_N "makedist: exporting tag '$CVSTAG' from '$CVSMOD'...$ECHO_C"
cvs -Q export -r $CVSTAG $CVSMOD || exit 4
echo ""
cd $CVSMOD || exit 5
INC=""
# remove CVS stuff...
find . \( \( -name CVS -type d \) -o -name .cvsignore \) -exec rm -rf {} \;
for file in *; do
case $file in
$PKG-$VER|web_update);; # ignore these
*) INC="$INC $file";; # include the rest
esac
done
# generate some files so people don't need bison, flex and autoconf
# to install
set -x
autoconf
bison -p php -v -d language-parser.y
flex -Pphp -olanguage-scanner.c -i language-scanner.lex
bison -p cfg -v -d configuration-parser.y
flex -Pcfg -oconfiguration-scanner.c -i configuration-scanner.lex
cd convertor
flex -i -Pphp -olanguage-scanner.c language-scanner.lex
bison -p php -v -d language-parser.y
cd ..
#perl -i -p -e 's/\r\n/\n/' *.dsw *.dsp
set +x
INC="$INC \
configuration-scanner.c \
configuration-parser.tab.c configuration-parser.tab.h \
language-scanner.c \
language-parser.tab.c language-parser.tab.h \
configure"
mkdir $PKG-$VER || exit 6
mv $INC $PKG-$VER || exit 7
$ECHO_N "makedist: making gzipped tar archive...$ECHO_C"
tar czf $ARCHIVE $PKG-$VER || exit 8
echo ""
$ECHO_N "makedist: cleaning up...$ECHO_C"
cd $OLDPWD
rm -rf $TMPDIR || exit 9
echo ""
exit 0

4
makeparser.bat Executable file
View file

@ -0,0 +1,4 @@
d:\mingw32\bin\bison -p php -v -d language-parser.y
flex -Pphp -olanguage-scanner.c -i language-scanner.lex
d:\mingw32\bin\bison -p cfg -v -d configuration-parser.y
flex -Pcfg -oconfiguration-scanner.c -i configuration-scanner.lex

643
mod_php3.c Normal file
View file

@ -0,0 +1,643 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
| (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef THREAD_SAFE
#include "tls.h"
#include "php.h"
#else
#include "httpd.h"
#include "http_config.h"
#if MODULE_MAGIC_NUMBER > 19980712
#include "ap_compat.h"
#else
#if MODULE_MAGIC_NUMBER > 19980324
#include "compat.h"
#endif
#endif
#include "http_core.h"
#include "http_main.h"
#include "http_protocol.h"
#include "http_request.h"
#include "http_log.h"
#endif
#include "util_script.h"
#include "php_version.h"
#include "mod_php3.h"
#if HAVE_MOD_DAV
# include "mod_dav.h"
#endif
/* ### these should be defined in mod_php3.h or somewhere else */
#define USE_PATH 1
#define IGNORE_URL 2
module MODULE_VAR_EXPORT php3_module;
#ifndef THREAD_SAFE
int saved_umask;
#else
#define GLOBAL(a) php3_globals->a
#define STATIC GLOBAL
#define TLS_VARS \
php3_globals_struct *php3_globals; \
php3_globals = TlsGetValue(TlsIndex);
#endif
#ifndef TLS_VARS
#define TLS_VARS
#endif
#ifndef GLOBAL
#define GLOBAL(x) x
#endif
#if WIN32|WINNT
/* popenf isn't working on Windows, use open instead*/
# ifdef popenf
# undef popenf
# endif
# define popenf(p,n,f,m) open((n),(f),(m))
# ifdef pclosef
# undef pclosef
# endif
# define pclosef(p,f) close(f)
#else
# define php3i_popenf(p,n,f,m) popenf((p),(n),(f),(m))
#endif
extern php3_ini_structure php3_ini; /* active config */
extern php3_ini_structure php3_ini_master; /* master copy of config */
int apache_php3_module_main(request_rec * r, int fd, int display_source_mode);
extern int php3_module_startup();
extern void php3_module_shutdown();
extern void php3_module_shutdown_for_exec();
extern int tls_create(void);
extern int tls_destroy(void);
extern int tls_startup(void);
extern int tls_shutdown(void);
#if WIN32|WINNT
/*
we will want to change this to the apache api
process and thread entry and exit functions
*/
BOOL WINAPI DllMain(HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved)
{
switch( ul_reason_for_call ) {
case DLL_PROCESS_ATTACH:
/*
I should be loading ini vars here
and doing whatever true global inits
need to be done
*/
if (!tls_startup())
return 0;
if (!tls_create())
return 0;
break;
case DLL_THREAD_ATTACH:
if (!tls_create())
return 0;
/* if (php3_module_startup()==FAILURE) {
return FAILURE;
}
*/ break;
case DLL_THREAD_DETACH:
if (!tls_destroy())
return 0;
/* if (initialized) {
php3_module_shutdown();
return SUCCESS;
} else {
return FAILURE;
}
*/ break;
case DLL_PROCESS_DETACH:
/*
close down anything down in process_attach
*/
if (!tls_destroy())
return 0;
if (!tls_shutdown())
return 0;
break;
}
return 1;
}
#endif
void php3_save_umask()
{
TLS_VARS;
GLOBAL(saved_umask) = umask(077);
umask(GLOBAL(saved_umask));
}
void php3_restore_umask()
{
TLS_VARS;
umask(GLOBAL(saved_umask));
}
int send_php3(request_rec *r, int display_source_mode, char *filename)
{
int fd, retval;
php3_ini_structure *conf;
/* We don't accept OPTIONS requests, but take everything else */
if (r->method_number == M_OPTIONS) {
r->allowed |= (1 << METHODS) - 1;
return DECLINED;
}
/* Make sure file exists */
if (filename == NULL && r->finfo.st_mode == 0) {
return NOT_FOUND;
}
/* grab configuration settings */
conf = (php3_ini_structure *) get_module_config(r->per_dir_config,
&php3_module);
/* copy to active configuration */
memcpy(&php3_ini,conf,sizeof(php3_ini_structure));
/* If PHP parser engine has been turned off with a "php3_engine off"
* directive, then decline to handle this request
*/
if (!conf->engine) {
r->content_type = "text/html";
r->allowed |= (1 << METHODS) - 1;
return DECLINED;
}
if (filename == NULL) {
filename = r->filename;
}
/* Open the file */
if ((fd = popenf(r->pool, filename, O_RDONLY, 0)) == -1) {
log_reason("file permissions deny server access", filename, r);
return FORBIDDEN;
}
/* Apache 1.2 has a more complex mechanism for reading POST data */
#if MODULE_MAGIC_NUMBER > 19961007
if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR)))
return retval;
#endif
if (conf->last_modified) {
#if MODULE_MAGIC_NUMBER < 19970912
if ((retval = set_last_modified(r, r->finfo.st_mtime))) {
return retval;
}
#else
update_mtime (r, r->finfo.st_mtime);
set_last_modified(r);
set_etag(r);
#endif
}
/* Assume output will be HTML. Individual scripts may change this
further down the line */
r->content_type = "text/html";
/* Init timeout */
hard_timeout("send", r);
php3_save_umask();
chdir_file(filename);
add_common_vars(r);
add_cgi_vars(r);
apache_php3_module_main(r, fd, display_source_mode);
/* Done, restore umask, turn off timeout, close file and return */
php3_restore_umask();
kill_timeout(r);
pclosef(r->pool, fd);
return OK;
}
int send_parsed_php3(request_rec * r)
{
return send_php3(r, 0, NULL);
}
int send_parsed_php3_source(request_rec * r)
{
return send_php3(r, 0, NULL);
}
/*
* Create the per-directory config structure with defaults from php3_ini_master
*/
static void *php3_create_dir(pool * p, char *dummy)
{
php3_ini_structure *new;
php3_module_startup(); /* php3_ini_master is set up here */
new = (php3_ini_structure *) palloc(p, sizeof(php3_ini_structure));
memcpy(new,&php3_ini_master,sizeof(php3_ini_structure));
return new;
}
/*
* Merge in per-directory .conf directives
*/
static void *php3_merge_dir(pool *p, void *basev, void *addv)
{
php3_ini_structure *new = (php3_ini_structure *) palloc(p, sizeof(php3_ini_structure));
php3_ini_structure *base = (php3_ini_structure *) basev;
php3_ini_structure *add = (php3_ini_structure *) addv;
php3_ini_structure orig = php3_ini_master;
/* Start with the base config */
memcpy(new,base,sizeof(php3_ini_structure));
/* Now, add any fields that have changed in *add compared to the master config */
if (add->smtp != orig.smtp) new->smtp = add->smtp;
if (add->sendmail_path != orig.sendmail_path) new->sendmail_path = add->sendmail_path;
if (add->sendmail_from != orig.sendmail_from) new->sendmail_from = add->sendmail_from;
if (add->errors != orig.errors) new->errors = add->errors;
if (add->magic_quotes_gpc != orig.magic_quotes_gpc) new->magic_quotes_gpc = add->magic_quotes_gpc;
if (add->magic_quotes_runtime != orig.magic_quotes_runtime) new->magic_quotes_runtime = add->magic_quotes_runtime;
if (add->magic_quotes_sybase != orig.magic_quotes_sybase) new->magic_quotes_sybase = add->magic_quotes_sybase;
if (add->track_errors != orig.track_errors) new->track_errors = add->track_errors;
if (add->display_errors != orig.display_errors) new->display_errors = add->display_errors;
if (add->log_errors != orig.log_errors) new->log_errors = add->log_errors;
if (add->doc_root != orig.doc_root) new->doc_root = add->doc_root;
if (add->user_dir != orig.user_dir) new->user_dir = add->user_dir;
if (add->safe_mode != orig.safe_mode) new->safe_mode = add->safe_mode;
if (add->track_vars != orig.track_vars) new->track_vars = add->track_vars;
if (add->safe_mode_exec_dir != orig.safe_mode_exec_dir) new->safe_mode_exec_dir = add->safe_mode_exec_dir;
if (add->cgi_ext != orig.cgi_ext) new->cgi_ext = add->cgi_ext;
if (add->isapi_ext != orig.isapi_ext) new->isapi_ext = add->isapi_ext;
if (add->nsapi_ext != orig.nsapi_ext) new->nsapi_ext = add->nsapi_ext;
if (add->include_path != orig.include_path) new->include_path = add->include_path;
if (add->auto_prepend_file != orig.auto_prepend_file) new->auto_prepend_file = add->auto_prepend_file;
if (add->auto_append_file != orig.auto_append_file) new->auto_append_file = add->auto_append_file;
if (add->upload_tmp_dir != orig.upload_tmp_dir) new->upload_tmp_dir = add->upload_tmp_dir;
if (add->upload_max_filesize != orig.upload_max_filesize) new->upload_max_filesize = add->upload_max_filesize;
if (add->extension_dir != orig.extension_dir) new->extension_dir = add->extension_dir;
if (add->short_open_tag != orig.short_open_tag) new->short_open_tag = add->short_open_tag;
if (add->debugger_host != orig.debugger_host) new->debugger_host = add->debugger_host;
if (add->debugger_port != orig.debugger_port) new->debugger_port = add->debugger_port;
if (add->error_log != orig.error_log) new->error_log = add->error_log;
/* skip the highlight stuff */
if (add->sql_safe_mode != orig.sql_safe_mode) new->sql_safe_mode = add->sql_safe_mode;
if (add->xbithack != orig.xbithack) new->xbithack = add->xbithack;
if (add->engine != orig.engine) new->engine = add->engine;
if (add->last_modified != orig.last_modified) new->last_modified = add->last_modified;
if (add->max_execution_time != orig.max_execution_time) new->max_execution_time = add->max_execution_time;
if (add->memory_limit != orig.memory_limit) new->memory_limit = add->memory_limit;
if (add->browscap != orig.browscap) new->browscap = add->browscap;
if (add->arg_separator != orig.arg_separator) new->arg_separator = add->arg_separator;
if (add->gpc_order != orig.gpc_order) new->gpc_order = add->gpc_order;
if (add->error_prepend_string != orig.error_prepend_string) new->error_prepend_string = add->error_prepend_string;
if (add->error_append_string != orig.error_append_string) new->error_append_string = add->error_append_string;
if (add->open_basedir != orig.open_basedir) new->open_basedir = add->open_basedir;
if (add->enable_dl != orig.enable_dl) new->enable_dl = add->enable_dl;
if (add->asp_tags != orig.asp_tags) new->asp_tags = add->asp_tags;
if (add->dav_script != orig.dav_script) new->dav_script = add->dav_script;
return new;
}
#if MODULE_MAGIC_NUMBER > 19961007
const char *php3flaghandler(cmd_parms * cmd, php3_ini_structure * conf, int val)
{
#else
char *php3flaghandler(cmd_parms * cmd, php3_ini_structure * conf, int val)
{
#endif
int c = (int) cmd->info;
switch (c) {
case 0:
conf->track_errors = val;
break;
case 1:
conf->magic_quotes_gpc = val;
break;
case 2:
conf->magic_quotes_runtime = val;
break;
case 3:
conf->short_open_tag = val;
break;
case 4:
conf->safe_mode = val;
break;
case 5:
conf->track_vars = val;
break;
case 6:
conf->sql_safe_mode = val;
break;
case 7:
conf->engine = val;
break;
case 8:
conf->xbithack = val;
break;
case 9:
conf->last_modified = val;
break;
case 10:
conf->log_errors = val;
break;
case 11:
conf->display_errors = val;
break;
case 12:
conf->magic_quotes_sybase = val;
break;
case 13:
conf->enable_dl = val;
break;
case 14:
conf->asp_tags = val;
break;
}
return NULL;
}
#if MODULE_MAGIC_NUMBER > 19961007
const char *php3take1handler(cmd_parms * cmd, php3_ini_structure * conf, char *arg)
{
#else
char *php3take1handler(cmd_parms * cmd, php3_ini_structure * conf, char *arg)
{
#endif
int c = (int) cmd->info;
switch (c) {
case 0:
conf->errors = atoi(arg);
break;
case 1:
conf->doc_root = pstrdup(cmd->pool, arg);
break;
case 2:
conf->user_dir = pstrdup(cmd->pool, arg);
break;
case 3:
conf->safe_mode_exec_dir = pstrdup(cmd->pool, arg);
break;
case 4:
conf->include_path = pstrdup(cmd->pool, arg);
break;
case 5:
if (strncasecmp(arg, "none", 4)) {
conf->auto_prepend_file = pstrdup(cmd->pool, arg);
} else {
conf->auto_prepend_file = "";
}
break;
case 6:
if (strncasecmp(arg, "none", 4)) {
conf->auto_append_file = pstrdup(cmd->pool, arg);
} else {
conf->auto_append_file = "";
}
break;
case 7:
conf->upload_tmp_dir = pstrdup(cmd->pool, arg);
break;
case 8:
conf->extension_dir = pstrdup(cmd->pool, arg);
break;
case 9:
conf->error_log = pstrdup(cmd->pool, arg);
break;
case 10:
conf->arg_separator = pstrdup(cmd->pool, arg);
break;
case 11:
conf->max_execution_time = atoi(arg);
break;
case 12:
conf->memory_limit = atoi(arg);
break;
case 13:
conf->sendmail_path = pstrdup(cmd->pool, arg);
break;
case 14:
conf->browscap = pstrdup(cmd->pool, arg);
break;
case 15:
conf->gpc_order = pstrdup(cmd->pool, arg);
break;
case 16:
conf->error_prepend_string = pstrdup(cmd->pool, arg);
break;
case 17:
conf->error_append_string = pstrdup(cmd->pool, arg);
break;
case 18:
conf->open_basedir = pstrdup(cmd->pool, arg);
break;
case 19:
conf->upload_max_filesize = atol(arg);
break;
case 20:
conf->dav_script = pstrdup(cmd->pool, arg);
break;
}
return NULL;
}
int php3_xbithack_handler(request_rec * r)
{
php3_ini_structure *conf;
conf = (php3_ini_structure *) get_module_config(r->per_dir_config, &php3_module);
if (!(r->finfo.st_mode & S_IXUSR)) {
r->allowed |= (1 << METHODS) - 1;
return DECLINED;
}
if (conf->xbithack == 0) {
r->allowed |= (1 << METHODS) - 1;
return DECLINED;
}
return send_parsed_php3(r);
}
void php3_init_handler(server_rec *s, pool *p)
{
register_cleanup(p, NULL, php3_module_shutdown, php3_module_shutdown_for_exec);
#if MODULE_MAGIC_NUMBER >= 19980527
ap_add_version_component("PHP/" PHP_VERSION);
#endif
}
#if HAVE_MOD_DAV
extern int phpdav_mkcol_test_handler(request_rec *r);
extern int phpdav_mkcol_create_handler(request_rec *r);
/* conf is being read twice (both here and in send_php3()) */
int send_parsed_php3_dav_script(request_rec *r)
{
php3_ini_structure *conf;
conf = (php3_ini_structure *) get_module_config(r->per_dir_config,
&php3_module);
return send_php3(r, 0, 0, conf->dav_script);
}
static int php3_type_checker(request_rec *r)
{
php3_ini_structure *conf;
conf = (php3_ini_structure *)get_module_config(r->per_dir_config,
&php3_module);
/* If DAV support is enabled, use mod_dav's type checker. */
if (conf->dav_script) {
dav_api_set_request_handler(r, send_parsed_php3_dav_script);
dav_api_set_mkcol_handlers(r, phpdav_mkcol_test_handler,
phpdav_mkcol_create_handler);
/* leave the rest of the request to mod_dav */
return dav_api_type_checker(r);
}
return DECLINED;
}
#else /* HAVE_MOD_DAV */
# define php3_type_checker NULL
#endif /* HAVE_MOD_DAV */
handler_rec php3_handlers[] =
{
{"application/x-httpd-php3", send_parsed_php3},
{"application/x-httpd-php3-source", send_parsed_php3_source},
{"text/html", php3_xbithack_handler},
{NULL}
};
command_rec php3_commands[] =
{
{"php3_error_reporting", php3take1handler, (void *)0, OR_OPTIONS, TAKE1, "error reporting level"},
{"php3_doc_root", php3take1handler, (void *)1, ACCESS_CONF|RSRC_CONF, TAKE1, "directory"}, /* not used yet */
{"php3_user_dir", php3take1handler, (void *)2, ACCESS_CONF|RSRC_CONF, TAKE1, "user directory"}, /* not used yet */
{"php3_safe_mode_exec_dir", php3take1handler, (void *)3, ACCESS_CONF|RSRC_CONF, TAKE1, "safe mode executable dir"},
{"php3_include_path", php3take1handler, (void *)4, OR_OPTIONS, TAKE1, "colon-separated path"},
{"php3_auto_prepend_file", php3take1handler, (void *)5, OR_OPTIONS, TAKE1, "file name"},
{"php3_auto_append_file", php3take1handler, (void *)6, OR_OPTIONS, TAKE1, "file name"},
{"php3_upload_tmp_dir", php3take1handler, (void *)7, ACCESS_CONF|RSRC_CONF, TAKE1, "directory"},
{"php3_extension_dir", php3take1handler, (void *)8, ACCESS_CONF|RSRC_CONF, TAKE1, "directory"},
{"php3_error_log", php3take1handler, (void *)9, OR_OPTIONS, TAKE1, "error log file"},
{"php3_arg_separator", php3take1handler, (void *)10, OR_OPTIONS, TAKE1, "GET method arg separator"},
{"php3_max_execution_time", php3take1handler, (void *)11, OR_OPTIONS, TAKE1, "Max script run time in seconds"},
{"php3_memory_limit", php3take1handler, (void *)12, OR_OPTIONS, TAKE1, "Max memory in bytes a script may use"},
{"php3_sendmail_path", php3take1handler, (void *)13, OR_OPTIONS, TAKE1, "Full path to sendmail binary"},
{"php3_browscap", php3take1handler, (void *)14, OR_OPTIONS, TAKE1, "Full path to browscap file"},
{"php3_gpc_order", php3take1handler, (void *)15, OR_OPTIONS, TAKE1, "Set GET-COOKIE-POST order [default is GPC]"},
{"php3_error_prepend_string", php3take1handler, (void *)16, OR_OPTIONS, TAKE1, "String to add before an error message from PHP"},
{"php3_error_append_string", php3take1handler, (void *)17, OR_OPTIONS, TAKE1, "String to add after an error message from PHP"},
{"php3_open_basedir", php3take1handler, (void *)18, OR_OPTIONS|RSRC_CONF, TAKE1, "Limit opening of files to this directory"},
{"php3_upload_max_filesize", php3take1handler, (void *)19, OR_OPTIONS|RSRC_CONF, TAKE1, "Limit uploaded files to this many bytes"},
#if HAVE_MOD_DAV
{"php3_dav_script", php3take1handler, (void *)20, OR_OPTIONS|RSRC_CONF, TAKE1,
"Lets PHP handle DAV requests by parsing this script."},
#endif
{"php3_track_errors", php3flaghandler, (void *)0, OR_OPTIONS, FLAG, "on|off"},
{"php3_magic_quotes_gpc", php3flaghandler, (void *)1, OR_OPTIONS, FLAG, "on|off"},
{"php3_magic_quotes_runtime", php3flaghandler, (void *)2, OR_OPTIONS, FLAG, "on|off"},
{"php3_short_open_tag", php3flaghandler, (void *)3, OR_OPTIONS, FLAG, "on|off"},
{"php3_safe_mode", php3flaghandler, (void *)4, ACCESS_CONF|RSRC_CONF, FLAG, "on|off"},
{"php3_track_vars", php3flaghandler, (void *)5, OR_OPTIONS, FLAG, "on|off"},
{"php3_sql_safe_mode", php3flaghandler, (void *)6, ACCESS_CONF|RSRC_CONF, FLAG, "on|off"},
{"php3_engine", php3flaghandler, (void *)7, RSRC_CONF|ACCESS_CONF, FLAG, "on|off"},
{"php3_xbithack", php3flaghandler, (void *)8, OR_OPTIONS, FLAG, "on|off"},
{"php3_last_modified", php3flaghandler, (void *)9, OR_OPTIONS, FLAG, "on|off"},
{"php3_log_errors", php3flaghandler, (void *)10, OR_OPTIONS, FLAG, "on|off"},
{"php3_display_errors", php3flaghandler, (void *)11, OR_OPTIONS, FLAG, "on|off"},
{"php3_magic_quotes_sybase", php3flaghandler, (void *)12, OR_OPTIONS, FLAG, "on|off"},
{"php3_enable_dl", php3flaghandler, (void *)13, RSRC_CONF|ACCESS_CONF, FLAG, "on|off"},
{"php3_asp_tags", php3flaghandler, (void *)14, OR_OPTIONS, FLAG, "on|off"},
{NULL}
};
module MODULE_VAR_EXPORT php3_module =
{
STANDARD_MODULE_STUFF,
php3_init_handler, /* initializer */
php3_create_dir, /* per-directory config creator */
php3_merge_dir, /* dir merger */
NULL, /* per-server config creator */
NULL, /* merge server config */
php3_commands, /* command table */
php3_handlers, /* handlers */
NULL, /* filename translation */
NULL, /* check_user_id */
NULL, /* check auth */
NULL, /* check access */
php3_type_checker, /* type_checker */
NULL, /* fixups */
NULL /* logger */
#if MODULE_MAGIC_NUMBER >= 19970103
,NULL /* header parser */
#endif
#if MODULE_MAGIC_NUMBER >= 19970719
,NULL /* child_init */
#endif
#if MODULE_MAGIC_NUMBER >= 19970728
,NULL /* child_exit */
#endif
#if MODULE_MAGIC_NUMBER >= 19970902
,NULL /* post read-request */
#endif
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/

Some files were not shown because too many files have changed in this diff Show more