More php3_ annihilation

This commit is contained in:
Zeev Suraski 1999-12-18 04:01:20 +00:00
parent 8a581c3536
commit 3ee4e65c95
46 changed files with 302 additions and 361 deletions

View file

@ -136,9 +136,9 @@ static PHP_MINFO_FUNCTION(regex)
#define NS 10 #define NS 10
/* /*
* _php3_reg_eprint - convert error number to name * php_reg_eprint - convert error number to name
*/ */
static void _php3_reg_eprint(int err, regex_t *re) { static void php_reg_eprint(int err, regex_t *re) {
char *buf = NULL, *message = NULL; char *buf = NULL, *message = NULL;
size_t len; size_t len;
size_t buf_len; size_t buf_len;
@ -175,7 +175,7 @@ static void _php3_reg_eprint(int err, regex_t *re) {
STR_FREE(message); STR_FREE(message);
} }
static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
{ {
pval **regex, /* Regular expression */ pval **regex, /* Regular expression */
**findin, /* String to apply expression to */ **findin, /* String to apply expression to */
@ -227,7 +227,7 @@ static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
} }
if (err) { if (err) {
_php3_reg_eprint(err, &re); php_reg_eprint(err, &re);
RETURN_FALSE; RETURN_FALSE;
} }
@ -238,7 +238,7 @@ static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
/* actually execute the regular expression */ /* actually execute the regular expression */
err = regexec(&re, string, (size_t) NS, subs, 0); err = regexec(&re, string, (size_t) NS, subs, 0);
if (err && err != REG_NOMATCH) { if (err && err != REG_NOMATCH) {
_php3_reg_eprint(err, &re); php_reg_eprint(err, &re);
regfree(&re); regfree(&re);
RETURN_FALSE; RETURN_FALSE;
} }
@ -250,7 +250,7 @@ static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
buf = emalloc(string_len); buf = emalloc(string_len);
if (!buf) { if (!buf) {
php_error(E_WARNING, "Unable to allocate memory in _php3_ereg"); php_error(E_WARNING, "Unable to allocate memory in php_ereg");
RETURN_FALSE; RETURN_FALSE;
} }
@ -284,7 +284,7 @@ static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
Regular expression match */ Regular expression match */
PHP_FUNCTION(ereg) PHP_FUNCTION(ereg)
{ {
_php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); php_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
} }
/* }}} */ /* }}} */
@ -292,12 +292,12 @@ PHP_FUNCTION(ereg)
Case-insensitive regular expression match */ Case-insensitive regular expression match */
PHP_FUNCTION(eregi) PHP_FUNCTION(eregi)
{ {
_php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); php_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
} }
/* }}} */ /* }}} */
/* this is the meat and potatoes of regex replacement! */ /* this is the meat and potatoes of regex replacement! */
char *_php3_regreplace(const char *pattern, const char *replace, const char *string, int icase, int extended) char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended)
{ {
regex_t re; regex_t re;
regmatch_t subs[NS]; regmatch_t subs[NS];
@ -318,7 +318,7 @@ char *_php3_regreplace(const char *pattern, const char *replace, const char *str
copts |= REG_EXTENDED; copts |= REG_EXTENDED;
err = regcomp(&re, pattern, copts); err = regcomp(&re, pattern, copts);
if (err) { if (err) {
_php3_reg_eprint(err, &re); php_reg_eprint(err, &re);
return ((char *) -1); return ((char *) -1);
} }
@ -327,7 +327,7 @@ char *_php3_regreplace(const char *pattern, const char *replace, const char *str
buf_len = 2 * string_len + 1; buf_len = 2 * string_len + 1;
buf = emalloc(buf_len * sizeof(char)); buf = emalloc(buf_len * sizeof(char));
if (!buf) { if (!buf) {
php_error(E_WARNING, "Unable to allocate memory in _php3_regreplace"); php_error(E_WARNING, "Unable to allocate memory in php_reg_replace");
regfree(&re); regfree(&re);
return ((char *) -1); return ((char *) -1);
} }
@ -339,7 +339,7 @@ char *_php3_regreplace(const char *pattern, const char *replace, const char *str
err = regexec(&re, &string[pos], (size_t) NS, subs, (pos ? REG_NOTBOL : 0)); err = regexec(&re, &string[pos], (size_t) NS, subs, (pos ? REG_NOTBOL : 0));
if (err && err != REG_NOMATCH) { if (err && err != REG_NOMATCH) {
_php3_reg_eprint(err, &re); php_reg_eprint(err, &re);
regfree(&re); regfree(&re);
return ((char *) -1); return ((char *) -1);
} }
@ -435,7 +435,7 @@ char *_php3_regreplace(const char *pattern, const char *replace, const char *str
return (buf); return (buf);
} }
static void _php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS, int icase) static void php_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
{ {
pval **arg_pattern, pval **arg_pattern,
**arg_replace, **arg_replace,
@ -480,7 +480,7 @@ static void _php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS, int icase)
string = empty_string; string = empty_string;
/* do the actual work */ /* do the actual work */
ret = _php3_regreplace(pattern, replace, string, icase, 1); ret = php_reg_replace(pattern, replace, string, icase, 1);
if (ret == (char *) -1) { if (ret == (char *) -1) {
RETVAL_FALSE; RETVAL_FALSE;
} else { } else {
@ -496,7 +496,7 @@ static void _php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS, int icase)
Replace regular expression */ Replace regular expression */
PHP_FUNCTION(ereg_replace) PHP_FUNCTION(ereg_replace)
{ {
_php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
} }
/* }}} */ /* }}} */
@ -504,7 +504,7 @@ PHP_FUNCTION(ereg_replace)
Case insensitive replace regular expression */ Case insensitive replace regular expression */
PHP_FUNCTION(eregi_replace) PHP_FUNCTION(eregi_replace)
{ {
_php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
} }
/* }}} */ /* }}} */

View file

@ -36,7 +36,7 @@
extern zend_module_entry regexp_module_entry; extern zend_module_entry regexp_module_entry;
#define regexp_module_ptr &regexp_module_entry #define regexp_module_ptr &regexp_module_entry
char *_php3_regreplace(const char *pattern, const char *replace, const char *string, int icase, int extended); char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended);
PHP_FUNCTION(ereg); PHP_FUNCTION(ereg);
PHP_FUNCTION(eregi); PHP_FUNCTION(eregi);

View file

@ -547,7 +547,7 @@ static void _php_session_send_cookie(PSLS_D)
len = strlen(PS(session_name)) + strlen(PS(id)) + sizeof(COOKIE_FMT); len = strlen(PS(session_name)) + strlen(PS(id)) + sizeof(COOKIE_FMT);
if (PS(cookie_lifetime) > 0) { if (PS(cookie_lifetime) > 0) {
date_fmt = php3_std_date(time(NULL) + PS(cookie_lifetime)); date_fmt = php_std_date(time(NULL) + PS(cookie_lifetime));
len += sizeof(COOKIE_EXPIRES) + strlen(date_fmt); len += sizeof(COOKIE_EXPIRES) + strlen(date_fmt);
} }

View file

@ -79,7 +79,6 @@ function_entry basic_functions[] = {
PHP_FE(doubleval, NULL) PHP_FE(doubleval, NULL)
PHP_FE(strval, NULL) PHP_FE(strval, NULL)
PHP_FE(bin2hex, NULL) PHP_FE(bin2hex, NULL)
PHP_FE(toggle_short_open_tag, NULL)
PHP_FE(sleep, NULL) PHP_FE(sleep, NULL)
PHP_FE(usleep, NULL) PHP_FE(usleep, NULL)
@ -202,9 +201,6 @@ function_entry basic_functions[] = {
PHP_FE(getmypid, NULL) PHP_FE(getmypid, NULL)
PHP_FE(getmyinode, NULL) PHP_FE(getmyinode, NULL)
PHP_FE(getlastmod, NULL) PHP_FE(getlastmod, NULL)
/*getmyiid is here for forward compatibility with 3.1
See pageinfo.c in 3.1 for more information*/
/* {"getmyiid", php3_getmypid, NULL}, */
PHP_FE(base64_decode, NULL) PHP_FE(base64_decode, NULL)
PHP_FE(base64_encode, NULL) PHP_FE(base64_encode, NULL)
@ -328,7 +324,7 @@ zend_module_entry basic_functions_module = {
#if defined(HAVE_PUTENV) #if defined(HAVE_PUTENV)
static int _php3_putenv_destructor(putenv_entry *pe) static int php_putenv_destructor(putenv_entry *pe)
{ {
if (pe->previous_value) { if (pe->previous_value) {
putenv(pe->previous_value); putenv(pe->previous_value);
@ -407,7 +403,7 @@ PHP_RINIT_FUNCTION(basic)
BG(page_inode) = -1; BG(page_inode) = -1;
BG(page_mtime) = -1; BG(page_mtime) = -1;
#ifdef HAVE_PUTENV #ifdef HAVE_PUTENV
if (zend_hash_init(&BG(putenv_ht), 1, NULL, (int (*)(void *)) _php3_putenv_destructor, 0) == FAILURE) { if (zend_hash_init(&BG(putenv_ht), 1, NULL, (int (*)(void *)) php_putenv_destructor, 0) == FAILURE) {
return FAILURE; return FAILURE;
} }
#endif #endif
@ -540,25 +536,6 @@ PHP_FUNCTION(putenv)
#endif #endif
PHP_FUNCTION(toggle_short_open_tag)
{
/* has to be implemented within Zend */
#if 0
pval **value;
int ret;
ret = php3_ini.short_open_tag;
if (ARG_COUNT(ht)!=1 || getParametersEx(1,&value) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(value);
php3_ini.short_open_tag = (*value)->value.lval;
RETURN_LONG(ret);
#endif
}
/******************* /*******************
* Basic Functions * * Basic Functions *
*******************/ *******************/
@ -616,11 +593,7 @@ PHP_FUNCTION(strval)
convert_to_string(return_value); convert_to_string(return_value);
} }
#ifdef __cplusplus
void php3_flush(HashTable *)
#else
PHP_FUNCTION(flush) PHP_FUNCTION(flush)
#endif
{ {
#if APACHE #if APACHE
SLS_FETCH(); SLS_FETCH();
@ -937,7 +910,7 @@ PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers){
case 1: /*send an email*/ case 1: /*send an email*/
{ {
#if HAVE_SENDMAIL #if HAVE_SENDMAIL
if (!_php3_mail(opt,"PHP error_log message",message,headers)){ if (!php_mail(opt,"PHP error_log message",message,headers)){
return FAILURE; return FAILURE;
} }
#else #else

View file

@ -110,7 +110,7 @@ PHP_MINIT_FUNCTION(crypt)
static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
static void php3i_to64(char *s, long v, int n) { static void php_to64(char *s, long v, int n) {
while (--n >= 0) { while (--n >= 0) {
*s++ = itoa64[v&0x3f]; *s++ = itoa64[v&0x3f];
v >>= 6; v >>= 6;
@ -159,13 +159,13 @@ PHP_FUNCTION(crypt)
#endif #endif
#if PHP3_STD_DES_CRYPT #if PHP3_STD_DES_CRYPT
php3i_to64(&salt[0], PHP3_CRYPT_RAND, 2); php_to64(&salt[0], PHP3_CRYPT_RAND, 2);
salt[2] = '\0'; salt[2] = '\0';
#else #else
#if PHP3_MD5_CRYPT #if PHP3_MD5_CRYPT
strcpy(salt, "$1$"); strcpy(salt, "$1$");
php3i_to64(&salt[3], PHP3_CRYPT_RAND, 4); php_to64(&salt[3], PHP3_CRYPT_RAND, 4);
php3i_to64(&salt[7], PHP3_CRYPT_RAND, 4); php_to64(&salt[7], PHP3_CRYPT_RAND, 4);
strcpy(&salt[11], "$"); strcpy(&salt[11], "$");
#endif #endif
#endif #endif

View file

@ -202,7 +202,7 @@ _cyr_mac = {
* d - x-cp866 * d - x-cp866
* m - x-mac-cyrillic * m - x-mac-cyrillic
*****************************************************************************/ *****************************************************************************/
static char * _php3_convert_cyr_string(unsigned char *str, char from, char to) static char * php_convert_cyr_string(unsigned char *str, char from, char to)
{ {
const unsigned char *from_table, *to_table; const unsigned char *from_table, *to_table;
unsigned char tmp; unsigned char tmp;
@ -284,7 +284,7 @@ PHP_FUNCTION(convert_cyr_string)
str = (unsigned char*) str_arg->value.str.val; str = (unsigned char*) str_arg->value.str.val;
_php3_convert_cyr_string(str, fr_cs->value.str.val[0], to_cs->value.str.val[0]); php_convert_cyr_string(str, fr_cs->value.str.val[0], to_cs->value.str.val[0]);
RETVAL_STRING((char *)str, 1) RETVAL_STRING((char *)str, 1)
} }
/* }}} */ /* }}} */

View file

@ -74,7 +74,7 @@ PHP_FUNCTION(time)
return_value->type = IS_LONG; return_value->type = IS_LONG;
} }
void _php3_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm) void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
{ {
pval *arguments[7]; pval *arguments[7];
struct tm *ta, tmbuf; struct tm *ta, tmbuf;
@ -174,16 +174,16 @@ void _php3_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
PHP_FUNCTION(mktime) PHP_FUNCTION(mktime)
{ {
_php3_mktime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); php_mktime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
} }
PHP_FUNCTION(gmmktime) PHP_FUNCTION(gmmktime)
{ {
_php3_mktime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); php_mktime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
} }
static void static void
_php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm) php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
{ {
pval *format, *timestamp; pval *format, *timestamp;
time_t the_time; time_t the_time;
@ -430,12 +430,12 @@ _php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
PHP_FUNCTION(date) PHP_FUNCTION(date)
{ {
_php3_date(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); php_date(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
} }
PHP_FUNCTION(gmdate) PHP_FUNCTION(gmdate)
{ {
_php3_date(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); php_date(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
} }
PHP_FUNCTION(getdate) PHP_FUNCTION(getdate)
@ -476,7 +476,7 @@ PHP_FUNCTION(getdate)
} }
/* Return date string in standard format for http headers */ /* Return date string in standard format for http headers */
char *php3_std_date(time_t t) char *php_std_date(time_t t)
{ {
struct tm *tm1, tmbuf; struct tm *tm1, tmbuf;
char *str; char *str;

View file

@ -46,7 +46,7 @@ PHP_FUNCTION(strftime);
#endif #endif
PHP_FUNCTION(strtotime); PHP_FUNCTION(strtotime);
extern char *php3_std_date(time_t t); extern char *php_std_date(time_t t);
void _php3_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm); void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm);
#endif /* _DATETIME_H */ #endif /* _DATETIME_H */

View file

@ -102,7 +102,7 @@ static zend_function_entry php_dir_class_functions[] = {
}; };
zend_module_entry php3_dir_module_entry = { zend_module_entry php_dir_module_entry = {
"PHP_dir", php_dir_functions, PHP_MINIT(dir), NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES "PHP_dir", php_dir_functions, PHP_MINIT(dir), NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
}; };

View file

@ -48,8 +48,8 @@
#include "dns.h" #include "dns.h"
char *_php3_gethostbyaddr(char *ip); char *php_gethostbyaddr(char *ip);
char *_php3_gethostbyname(char *name); char *php_gethostbyname(char *name);
/* {{{ proto string gethostbyaddr(string ip_address) /* {{{ proto string gethostbyaddr(string ip_address)
Get the Internet host name corresponding to a given IP address */ Get the Internet host name corresponding to a given IP address */
@ -62,14 +62,14 @@ PHP_FUNCTION(gethostbyaddr)
} }
convert_to_string_ex(arg); convert_to_string_ex(arg);
return_value->value.str.val = _php3_gethostbyaddr((*arg)->value.str.val); return_value->value.str.val = php_gethostbyaddr((*arg)->value.str.val);
return_value->value.str.len = strlen(return_value->value.str.val); return_value->value.str.len = strlen(return_value->value.str.val);
return_value->type = IS_STRING; return_value->type = IS_STRING;
} }
/* }}} */ /* }}} */
char *_php3_gethostbyaddr(char *ip) char *php_gethostbyaddr(char *ip)
{ {
unsigned long addr; unsigned long addr;
struct hostent *hp; struct hostent *hp;
@ -101,7 +101,7 @@ PHP_FUNCTION(gethostbyname)
} }
convert_to_string_ex(arg); convert_to_string_ex(arg);
return_value->value.str.val = _php3_gethostbyname((*arg)->value.str.val); return_value->value.str.val = php_gethostbyname((*arg)->value.str.val);
return_value->value.str.len = strlen(return_value->value.str.val); return_value->value.str.len = strlen(return_value->value.str.val);
return_value->type = IS_STRING; return_value->type = IS_STRING;
} }
@ -142,7 +142,7 @@ PHP_FUNCTION(gethostbynamel)
} }
/* }}} */ /* }}} */
char *_php3_gethostbyname(char *name) char *php_gethostbyname(char *name)
{ {
struct hostent *hp; struct hostent *hp;
struct in_addr in; struct in_addr in;

View file

@ -83,7 +83,7 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value)
*c = ' '; *c = ' ';
strncat(d, c, overflow_limit); strncat(d, c, overflow_limit);
} }
tmp = _php3_escapeshellcmd(d); tmp = php_escape_shell_cmd(d);
efree(d); efree(d);
d = tmp; d = tmp;
#if WIN32|WINNT #if WIN32|WINNT
@ -306,7 +306,7 @@ PHP_FUNCTION(passthru)
} }
/* }}} */ /* }}} */
static int php3_ind(char *s, char c) static int php_get_index(char *s, char c)
{ {
register int x; register int x;
@ -325,7 +325,7 @@ static int php3_ind(char *s, char c)
*NOT* safe for binary strings *NOT* safe for binary strings
*/ */
char * _php3_escapeshellcmd(char *str) { char * php_escape_shell_cmd(char *str) {
register int x, y, l; register int x, y, l;
char *cmd; char *cmd;
@ -333,7 +333,7 @@ char * _php3_escapeshellcmd(char *str) {
cmd = emalloc(2 * l + 1); cmd = emalloc(2 * l + 1);
strcpy(cmd, str); strcpy(cmd, str);
for (x = 0; cmd[x]; x++) { for (x = 0; cmd[x]; x++) {
if (php3_ind("&;`'\"|*?~<>^()[]{}$\\\x0A\xFF", cmd[x]) != -1) { if (php_get_index("&;`'\"|*?~<>^()[]{}$\\\x0A\xFF", cmd[x]) != -1) {
for (y = l + 1; y > x; y--) for (y = l + 1; y > x; y--)
cmd[y] = cmd[y - 1]; cmd[y] = cmd[y - 1];
l++; /* length has been increased */ l++; /* length has been increased */
@ -357,7 +357,7 @@ PHP_FUNCTION(escapeshellcmd)
convert_to_string(arg1); convert_to_string(arg1);
if (arg1->value.str.len) { if (arg1->value.str.len) {
cmd = _php3_escapeshellcmd(arg1->value.str.val); cmd = php_escape_shell_cmd(arg1->value.str.val);
RETVAL_STRING(cmd, 1); RETVAL_STRING(cmd, 1);
efree(cmd); efree(cmd);
} }

View file

@ -39,5 +39,5 @@ PHP_FUNCTION(escapeshellcmd);
PHP_FUNCTION(passthru); PHP_FUNCTION(passthru);
PHP_FUNCTION(shell_exec); PHP_FUNCTION(shell_exec);
char *_php3_escapeshellcmd(char *); char *php_escape_shell_cmd(char *);
#endif /* _EXEC_H */ #endif /* _EXEC_H */

View file

@ -19,7 +19,7 @@
/* $Id$ */ /* $Id$ */
/* Synced with php3 revision 1.218 1999-06-16 [ssb] */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
/* {{{ includes */ /* {{{ includes */
@ -657,7 +657,7 @@ PHP_FUNCTION(fopen)
/* /*
* We need a better way of returning error messages from * We need a better way of returning error messages from
* php3_fopen__wrapper(). * php_fopen_wrapper().
*/ */
fp = php_fopen_wrapper((*arg1)->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL); fp = php_fopen_wrapper((*arg1)->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
if (!fp && !socketd) { if (!fp && !socketd) {
@ -813,7 +813,7 @@ PHP_FUNCTION(feof)
/* {{{ proto int set_socket_blocking(int socket descriptor, int mode) /* {{{ proto int set_socket_blocking(int socket descriptor, int mode)
Set blocking/non-blocking mode on a socket */ Set blocking/non-blocking mode on a socket */
PHPAPI int _php3_set_sock_blocking(int socketd, int block) PHPAPI int php_set_sock_blocking(int socketd, int block)
{ {
int ret = SUCCESS; int ret = SUCCESS;
int flags; int flags;
@ -862,7 +862,7 @@ PHP_FUNCTION(set_socket_blocking)
socketd = *(int*)what; socketd = *(int*)what;
if (_php3_set_sock_blocking(socketd, block) == FAILURE) if (php_set_sock_blocking(socketd, block) == FAILURE)
RETURN_FALSE; RETURN_FALSE;
php_sockset_blocking(socketd, block == 0 ? 0 : 1); php_sockset_blocking(socketd, block == 0 ? 0 : 1);
@ -1548,7 +1548,7 @@ PHP_FUNCTION(fgetcsv) {
char *temp, *tptr, *bptr; char *temp, *tptr, *bptr;
char delimiter = ','; /* allow this to be set as parameter */ char delimiter = ','; /* allow this to be set as parameter */
/* first section exactly as php3_fgetss */ /* first section exactly as php_fgetss */
pval **fd, **bytes, **p_delim; pval **fd, **bytes, **p_delim;
int len, type; int len, type;

View file

@ -29,7 +29,7 @@
/* $Id$ */ /* $Id$ */
/* Synced with php3 revision 1.30 1999-06-16 [ssb] */ /* Synced with php 3.0 revision 1.30 1999-06-16 [ssb] */
#ifndef _FILE_H #ifndef _FILE_H
#define _FILE_H #define _FILE_H
@ -72,7 +72,7 @@ PHP_FUNCTION(fd_set);
PHP_FUNCTION(fd_isset); PHP_FUNCTION(fd_isset);
PHP_FUNCTION(select); PHP_FUNCTION(select);
PHPAPI int _php3_set_sock_blocking(int socketd, int block); PHPAPI int php_set_sock_blocking(int socketd, int block);
PHPAPI int php_file_le_fopen(void); PHPAPI int php_file_le_fopen(void);
PHPAPI int php_file_le_socket(void); PHPAPI int php_file_le_socket(void);
PHPAPI int php_file_le_uploads(void); PHPAPI int php_file_le_uploads(void);

View file

@ -396,7 +396,7 @@ PHP_FUNCTION(clearstatcache)
} }
static void _php3_stat(const char *filename, int type, pval *return_value) static void php_stat(const char *filename, int type, pval *return_value)
{ {
struct stat *stat_sb; struct stat *stat_sb;
BLS_FETCH(); BLS_FETCH();
@ -539,7 +539,7 @@ void name(INTERNAL_FUNCTION_PARAMETERS) { \
WRONG_PARAM_COUNT; \ WRONG_PARAM_COUNT; \
} \ } \
convert_to_string(filename); \ convert_to_string(filename); \
_php3_stat(filename->value.str.val, funcnum, return_value); \ php_stat(filename->value.str.val, funcnum, return_value); \
} }
FileFunction(PHP_FN(fileperms),0) FileFunction(PHP_FN(fileperms),0)
@ -561,7 +561,7 @@ FileFunction(PHP_FN(file_exists),15)
FileFunction(PHP_FN(lstat),16) FileFunction(PHP_FN(lstat),16)
FileFunction(PHP_FN(stat),17) FileFunction(PHP_FN(stat),17)
function_entry php3_filestat_functions[] = { function_entry php_filestat_functions[] = {
PHP_FE(fileatime, NULL) PHP_FE(fileatime, NULL)
PHP_FE(filectime, NULL) PHP_FE(filectime, NULL)
PHP_FE(filegroup, NULL) PHP_FE(filegroup, NULL)
@ -591,8 +591,8 @@ function_entry php3_filestat_functions[] = {
}; };
zend_module_entry php3_filestat_module_entry = { zend_module_entry php_filestat_module_entry = {
"PHP_filestat", php3_filestat_functions, NULL, NULL, PHP_RINIT(filestat), "PHP_filestat", php_filestat_functions, NULL, NULL, PHP_RINIT(filestat),
PHP_RSHUTDOWN(filestat), NULL, STANDARD_MODULE_PROPERTIES PHP_RSHUTDOWN(filestat), NULL, STANDARD_MODULE_PROPERTIES
}; };

View file

@ -53,13 +53,12 @@ static char HEXCHARS[] = "0123456789ABCDEF";
*/ */
/* /*
* _php3_cvt converts to decimal * php_convert_to_decimal converts to decimal
* the number of digits is specified by ndigit * the number of digits is specified by ndigit
* decpt is set to the position of the decimal point * decpt is set to the position of the decimal point
* sign is set to 0 for positive, 1 for negative * sign is set to 0 for positive, 1 for negative
*/ */
static char * static char *php_convert_to_decimal(double arg, int ndigits, int *decpt, int *sign, int eflag)
_php3_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag)
{ {
register int r2; register int r2;
double fi, fj; double fi, fj;
@ -246,7 +245,7 @@ php_sprintf_appenddouble(char **buffer, int *pos,
} else if (precision > MAX_FLOAT_PRECISION) { } else if (precision > MAX_FLOAT_PRECISION) {
precision = MAX_FLOAT_PRECISION; precision = MAX_FLOAT_PRECISION;
} }
cvt = _php3_cvt(number, precision, &decpt, &sign, (fmt == 'e')); cvt = php_convert_to_decimal(number, precision, &decpt, &sign, (fmt == 'e'));
if (sign) { if (sign) {
numbuf[i++] = '-'; numbuf[i++] = '-';

View file

@ -20,8 +20,8 @@
/* $Id$ */ /* $Id$ */
/* Synced with php3 revision 1.121 1999-06-18 [ssb] */ /* Synced with php 3.0 revision 1.121 1999-06-18 [ssb] */
/* Synced with php3 revision 1.133 1999-07-21 [sas] */ /* Synced with php 3.0 revision 1.133 1999-07-21 [sas] */
#include "php.h" #include "php.h"
#include "php_globals.h" #include "php_globals.h"
@ -95,21 +95,21 @@ function_entry fsock_functions[] = {
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };
struct php3i_sockbuf { struct php_sockbuf {
int socket; int socket;
unsigned char *readbuf; unsigned char *readbuf;
size_t readbuflen; size_t readbuflen;
size_t readpos; size_t readpos;
size_t writepos; size_t writepos;
struct php3i_sockbuf *next; struct php_sockbuf *next;
struct php3i_sockbuf *prev; struct php_sockbuf *prev;
char eof; char eof;
char persistent; char persistent;
char is_blocked; char is_blocked;
size_t chunk_size; size_t chunk_size;
}; };
typedef struct php3i_sockbuf php3i_sockbuf; typedef struct php_sockbuf php_sockbuf;
zend_module_entry fsock_module_entry = { zend_module_entry fsock_module_entry = {
"Socket functions", "Socket functions",
@ -144,9 +144,9 @@ int lookup_hostname(const char *addr, struct in_addr *in)
return 0; return 0;
} }
/* }}} */ /* }}} */
/* {{{ _php3_is_persistent_sock */ /* {{{ php_is_persistent_sock */
int _php3_is_persistent_sock(int sock) int php_is_persistent_sock(int sock)
{ {
char *key; char *key;
FLS_FETCH(); FLS_FETCH();
@ -228,14 +228,14 @@ PHPAPI int connect_nonb(int sockfd,
#endif #endif
} }
/* }}} */ /* }}} */
/* {{{ _php3_fsockopen() */ /* {{{ php_fsockopen() */
/* /*
This function takes an optional third argument which should be This function takes an optional third argument which should be
passed by reference. The error code from the connect call is written passed by reference. The error code from the connect call is written
to this variable. to this variable.
*/ */
static void _php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) { static void php_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) {
pval *args[5]; pval *args[5];
int *sock=emalloc(sizeof(int)); int *sock=emalloc(sizeof(int));
int *sockp; int *sockp;
@ -373,14 +373,14 @@ static void _php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) {
Open Internet or Unix domain socket connection */ Open Internet or Unix domain socket connection */
PHP_FUNCTION(fsockopen) PHP_FUNCTION(fsockopen)
{ {
_php3_fsockopen(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); php_fsockopen(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
} }
/* }}} */ /* }}} */
/* {{{ proto int pfsockopen(string hostname, int port [, int errno [, string errstr [, double timeout]]]) /* {{{ proto int pfsockopen(string hostname, int port [, int errno [, string errstr [, double timeout]]])
Open persistent Internet or Unix domain socket connection */ Open persistent Internet or Unix domain socket connection */
PHP_FUNCTION(pfsockopen) PHP_FUNCTION(pfsockopen)
{ {
_php3_fsockopen(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); php_fsockopen(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
} }
/* }}} */ /* }}} */
@ -395,7 +395,7 @@ PHP_FUNCTION(pfsockopen)
static void php_cleanup_sockbuf(int persistent FLS_DC) static void php_cleanup_sockbuf(int persistent FLS_DC)
{ {
php3i_sockbuf *now, *next; php_sockbuf *now, *next;
for(now = FG(phpsockbuf); now; now = next) { for(now = FG(phpsockbuf); now; now = next) {
next = now->next; next = now->next;
@ -409,14 +409,14 @@ static void php_cleanup_sockbuf(int persistent FLS_DC)
#define READPTR(sock) ((sock)->readbuf + (sock)->readpos) #define READPTR(sock) ((sock)->readbuf + (sock)->readpos)
#define WRITEPTR(sock) ((sock)->readbuf + (sock)->writepos) #define WRITEPTR(sock) ((sock)->readbuf + (sock)->writepos)
#define SOCK_FIND(sock,socket) \ #define SOCK_FIND(sock,socket) \
php3i_sockbuf *sock; \ php_sockbuf *sock; \
FLS_FETCH(); \ FLS_FETCH(); \
sock = php_sockfind(socket FLS_CC); \ sock = php_sockfind(socket FLS_CC); \
if(!sock) sock = php_sockcreate(socket FLS_CC) if(!sock) sock = php_sockcreate(socket FLS_CC)
static php3i_sockbuf *php_sockfind(int socket FLS_DC) static php_sockbuf *php_sockfind(int socket FLS_DC)
{ {
php3i_sockbuf *buf = NULL, *tmp; php_sockbuf *buf = NULL, *tmp;
for(tmp = FG(phpsockbuf); tmp; tmp = tmp->next) for(tmp = FG(phpsockbuf); tmp; tmp = tmp->next)
if(tmp->socket == socket) { if(tmp->socket == socket) {
@ -427,10 +427,10 @@ static php3i_sockbuf *php_sockfind(int socket FLS_DC)
return buf; return buf;
} }
static php3i_sockbuf *php_sockcreate(int socket FLS_DC) static php_sockbuf *php_sockcreate(int socket FLS_DC)
{ {
php3i_sockbuf *sock; php_sockbuf *sock;
int persistent = _php3_is_persistent_sock(socket); int persistent = php_is_persistent_sock(socket);
sock = pecalloc(sizeof(*sock), 1, persistent); sock = pecalloc(sizeof(*sock), 1, persistent);
sock->socket = socket; sock->socket = socket;
@ -460,7 +460,7 @@ size_t php_sock_set_def_chunk_size(size_t size)
int php_sockdestroy(int socket) int php_sockdestroy(int socket)
{ {
int ret = 0; int ret = 0;
php3i_sockbuf *sock; php_sockbuf *sock;
FLS_FETCH(); FLS_FETCH();
sock = php_sockfind(socket FLS_CC); sock = php_sockfind(socket FLS_CC);
@ -487,7 +487,7 @@ int php_sockdestroy(int socket)
int php_sock_close(int socket) int php_sock_close(int socket)
{ {
int ret = 0; int ret = 0;
php3i_sockbuf *sock; php_sockbuf *sock;
FLS_FETCH(); FLS_FETCH();
sock = php_sockfind(socket FLS_CC); sock = php_sockfind(socket FLS_CC);
@ -505,7 +505,7 @@ int php_sock_close(int socket)
#define MAX_CHUNKS_PER_READ 10 #define MAX_CHUNKS_PER_READ 10
static void php_sockwait_for_data(php3i_sockbuf *sock) static void php_sockwait_for_data(php_sockbuf *sock)
{ {
fd_set fdr, tfdr; fd_set fdr, tfdr;
@ -519,7 +519,7 @@ static void php_sockwait_for_data(php3i_sockbuf *sock)
} }
} }
static size_t php_sockread_internal(php3i_sockbuf *sock) static size_t php_sockread_internal(php_sockbuf *sock)
{ {
char buf[CHUNK_SIZE]; char buf[CHUNK_SIZE];
int nr_bytes; int nr_bytes;
@ -555,14 +555,14 @@ static size_t php_sockread_internal(php3i_sockbuf *sock)
return nr_read; return nr_read;
} }
static void php_sockread_total(php3i_sockbuf *sock, size_t maxread) static void php_sockread_total(php_sockbuf *sock, size_t maxread)
{ {
while(!sock->eof && TOREAD(sock) < maxread) { while(!sock->eof && TOREAD(sock) < maxread) {
php_sockread_internal(sock); php_sockread_internal(sock);
} }
} }
static size_t php_sockread(php3i_sockbuf *sock) static size_t php_sockread(php_sockbuf *sock)
{ {
size_t nr_bytes; size_t nr_bytes;
size_t nr_read = 0; size_t nr_read = 0;
@ -711,7 +711,6 @@ int php_msock_destroy(int *data)
return 1; return 1;
} }
/* }}} */ /* }}} */
/* {{{ php3_minit_fsock */
static void fsock_globals_ctor(FLS_D) static void fsock_globals_ctor(FLS_D)
{ {
@ -737,8 +736,6 @@ PHP_MINIT_FUNCTION(fsock)
#endif #endif
return SUCCESS; return SUCCESS;
} }
/* }}} */
/* {{{ php3_mshutdown_fsock */
PHP_MSHUTDOWN_FUNCTION(fsock) PHP_MSHUTDOWN_FUNCTION(fsock)
{ {
@ -747,8 +744,6 @@ PHP_MSHUTDOWN_FUNCTION(fsock)
#endif #endif
return SUCCESS; return SUCCESS;
} }
/* }}} */
/* {{{ php3_rshutdown_fsock() */
PHP_RSHUTDOWN_FUNCTION(fsock) PHP_RSHUTDOWN_FUNCTION(fsock)
{ {
@ -758,10 +753,6 @@ PHP_RSHUTDOWN_FUNCTION(fsock)
return SUCCESS; return SUCCESS;
} }
/* }}} */
/* }}} */
/* /*
* Local variables: * Local variables:
* tab-width: 4 * tab-width: 4

View file

@ -29,7 +29,7 @@
*/ */
/* $Id$ */ /* $Id$ */
/* Synced with php3 revision 1.24 1999-06-18 [ssb] */ /* Synced with php 3.0 revision 1.24 1999-06-18 [ssb] */
#ifndef _FSOCK_H #ifndef _FSOCK_H
#define _FSOCK_H #define _FSOCK_H
@ -65,7 +65,7 @@ char *php_sock_fgets(char *buf, size_t maxlen, int socket);
size_t php_sock_fread(char *buf, size_t maxlen, int socket); size_t php_sock_fread(char *buf, size_t maxlen, int socket);
int php_sock_feof(int socket); int php_sock_feof(int socket);
int php_sock_fgetc(int socket); int php_sock_fgetc(int socket);
int _php3_is_persistent_sock(int); int php_is_persistent_sock(int);
int php_sockset_blocking(int socket, int mode); int php_sockset_blocking(int socket, int mode);
int php_sockdestroy(int socket); int php_sockdestroy(int socket);
int php_sock_close(int socket); int php_sock_close(int socket);
@ -81,7 +81,7 @@ PHP_RSHUTDOWN_FUNCTION(fsock);
typedef struct { typedef struct {
HashTable ht_fsock_keys; HashTable ht_fsock_keys;
HashTable ht_fsock_socks; HashTable ht_fsock_socks;
struct php3i_sockbuf *phpsockbuf; struct php_sockbuf *phpsockbuf;
size_t def_chunk_size; size_t def_chunk_size;
} php_fsock_globals; } php_fsock_globals;

View file

@ -35,7 +35,7 @@
been defined with C compiler flags. been defined with C compiler flags.
*/ */
#ifndef PROTOTYPES #ifndef PROTOTYPES
#define PROTOTYPES 1 /* php3 has prototypes everywhere */ #define PROTOTYPES 1 /* PHP has prototypes everywhere */
#endif #endif
/* _POINTER defines a generic pointer type */ /* _POINTER defines a generic pointer type */

View file

@ -37,21 +37,21 @@
/* need to figure out some nice way to get rid of these */ /* need to figure out some nice way to get rid of these */
#ifndef THREAD_SAFE #ifndef THREAD_SAFE
static int php3_HeaderPrinted = 0; static int php_header_printed = 0;
static int php3_PrintHeader = 1; static int php_print_header = 1;
static CookieList *top = NULL; static CookieList *top = NULL;
static char *cont_type = NULL; static char *cont_type = NULL;
static int header_called = 0; static int header_called = 0;
#endif #endif
void php3_PushCookieList(char *, char *, time_t, char *, char *, int); void php_push_cookie_list(char *, char *, time_t, char *, char *, int);
CookieList *php3_PopCookieList(void); CookieList *php_pop_cookie_list(void);
PHP_RINIT_FUNCTION(head) PHP_RINIT_FUNCTION(head)
{ {
php3_HeaderPrinted = 0; php_header_printed = 0;
if (header_called == 0) if (header_called == 0)
php3_PrintHeader = 1; php_print_header = 1;
top = NULL; top = NULL;
cont_type = NULL; cont_type = NULL;
@ -75,7 +75,7 @@ void php4i_add_header_information(char *header_information, uint header_length)
req = ((request_rec *) SG(server_context)); req = ((request_rec *) SG(server_context));
#endif #endif
if (php3_HeaderPrinted == 1) { if (php_header_printed == 1) {
#if DEBUG #if DEBUG
php_error(E_WARNING, "Cannot add more header information - the header was already sent " php_error(E_WARNING, "Cannot add more header information - the header was already sent "
"(header information may be added only before any output is generated from the script - " "(header information may be added only before any output is generated from the script - "
@ -106,13 +106,13 @@ void php4i_add_header_information(char *header_information, uint header_length)
if (PG(safe_mode) && (!strcasecmp(header_information, "WWW-authenticate"))) { if (PG(safe_mode) && (!strcasecmp(header_information, "WWW-authenticate"))) {
myuid = php_getuid(); myuid = php_getuid();
sprintf(temp2, "realm=\"%ld ", myuid); /* SAFE */ sprintf(temp2, "realm=\"%ld ", myuid); /* SAFE */
temp = _php3_regreplace("realm=\"", temp2, rr, 1, 0); temp = php_reg_replace("realm=\"", temp2, rr, 1, 0);
if (!strcmp(temp, rr)) { if (!strcmp(temp, rr)) {
sprintf(temp2, "realm=%ld", myuid); /* SAFE */ sprintf(temp2, "realm=%ld", myuid); /* SAFE */
temp = _php3_regreplace("realm=", temp2, rr, 1, 0); temp = php_reg_replace("realm=", temp2, rr, 1, 0);
if (!strcmp(temp, rr)) { if (!strcmp(temp, rr)) {
sprintf(temp2, " realm=%ld", myuid); /* SAFE */ sprintf(temp2, " realm=%ld", myuid); /* SAFE */
temp = _php3_regreplace("$", temp2, rr, 0, 0); temp = php_reg_replace("$", temp2, rr, 0, 0);
} }
} }
table_set(req->headers_out, header_information, temp); table_set(req->headers_out, header_information, temp);
@ -123,7 +123,7 @@ void php4i_add_header_information(char *header_information, uint header_length)
req->status = REDIRECT; req->status = REDIRECT;
} }
*r = ':'; *r = ':';
php3_HeaderPrinted = 2; php_header_printed = 2;
} }
if (!strncasecmp(header_information, "http/", 5)) { if (!strncasecmp(header_information, "http/", 5)) {
if (strlen(header_information) > 9) { if (strlen(header_information) > 9) {
@ -160,9 +160,6 @@ void php4i_add_header_information(char *header_information, uint header_length)
sapi_rqst->header(sapi_rqst->scid,tempstr); sapi_rqst->header(sapi_rqst->scid,tempstr);
efree(tempstr); efree(tempstr);
} }
#elif FHTTPD
php3_fhttpd_puts_header(header_information);
php3_fhttpd_puts_header("\r\n");
#else #else
PUTS_H(header_information); PUTS_H(header_information);
PUTS_H("\015\012"); PUTS_H("\015\012");
@ -176,9 +173,6 @@ void php4i_add_header_information(char *header_information, uint header_length)
sapi_rqst->header(sapi_rqst->scid,tempstr); sapi_rqst->header(sapi_rqst->scid,tempstr);
efree(tempstr); efree(tempstr);
} }
#elif FHTTPD
php3_fhttpd_puts_header(header_information);
php3_fhttpd_puts_header("\r\n");
#else #else
PUTS_H(header_information); PUTS_H(header_information);
PUTS_H("\015\012"); PUTS_H("\015\012");
@ -248,13 +242,13 @@ PHPAPI int php_header(void)
PG(header_is_being_sent) = 0; PG(header_is_being_sent) = 0;
return 1; return 1;
} }
if ((php3_PrintHeader && !php3_HeaderPrinted) || (php3_PrintHeader && php3_HeaderPrinted == 2)) { if ((php_print_header && !php_header_printed) || (php_print_header && php_header_printed == 2)) {
cookie = php3_PopCookieList(); cookie = php_pop_cookie_list();
while (cookie) { while (cookie) {
if (cookie->name) if (cookie->name)
len += strlen(cookie->name); len += strlen(cookie->name);
if (cookie->value) { if (cookie->value) {
cookievalue = _php3_urlencode(cookie->value, strlen (cookie->value)); cookievalue = php_url_encode(cookie->value, strlen (cookie->value));
len += strlen(cookievalue); len += strlen(cookievalue);
} }
if (cookie->path) if (cookie->path)
@ -271,7 +265,7 @@ PHPAPI int php_header(void)
sprintf(tempstr, "%s=deleted", cookie->name); sprintf(tempstr, "%s=deleted", cookie->name);
t = time(NULL) - 31536001; t = time(NULL) - 31536001;
strcat(tempstr, "; expires="); strcat(tempstr, "; expires=");
dt = php3_std_date(t); dt = php_std_date(t);
strcat(tempstr, dt); strcat(tempstr, dt);
efree(dt); efree(dt);
} else { } else {
@ -285,7 +279,7 @@ PHPAPI int php_header(void)
cookievalue=NULL; cookievalue=NULL;
if (cookie->expires > 0) { if (cookie->expires > 0) {
strcat(tempstr, "; expires="); strcat(tempstr, "; expires=");
dt = php3_std_date(cookie->expires); dt = php_std_date(cookie->expires);
strcat(tempstr, dt); strcat(tempstr, dt);
efree(dt); efree(dt);
} }
@ -312,10 +306,10 @@ PHPAPI int php_header(void)
if (cookie->value) efree(cookie->value); if (cookie->value) efree(cookie->value);
if (cookievalue) efree(cookievalue); if (cookievalue) efree(cookievalue);
efree(cookie); efree(cookie);
cookie = php3_PopCookieList(); cookie = php_pop_cookie_list();
efree(tempstr); efree(tempstr);
} }
php3_HeaderPrinted = 1; php_header_printed = 1;
header_called = 1; header_called = 1;
send_http_header(((request_rec *) SG(server_context))); send_http_header(((request_rec *) SG(server_context)));
if (((request_rec *) SG(server_context))->header_only) { if (((request_rec *) SG(server_context))->header_only) {
@ -325,12 +319,10 @@ PHPAPI int php_header(void)
} }
} }
#else #else
if (php3_PrintHeader && !php3_HeaderPrinted) { if (php_print_header && !php_header_printed) {
if (!cont_type) { if (!cont_type) {
#if USE_SAPI #if USE_SAPI
sapi_rqst->header(sapi_rqst->scid,"Content-type: text/html\015\012\015\012"); sapi_rqst->header(sapi_rqst->scid,"Content-type: text/html\015\012\015\012");
#elif FHTTPD
php3_fhttpd_puts_header("Content-type: text/html\r\n");
#else #else
PUTS_H("Content-type: text/html\015\012\015\012"); PUTS_H("Content-type: text/html\015\012\015\012");
#endif #endif
@ -343,17 +335,6 @@ PHPAPI int php_header(void)
sprintf(tempstr,"Content-type: %s\015\012\015\012",cont_type); sprintf(tempstr,"Content-type: %s\015\012\015\012",cont_type);
sapi_rqst->header(sapi_rqst->scid,tempstr); sapi_rqst->header(sapi_rqst->scid,tempstr);
efree(tempstr); efree(tempstr);
#elif FHTTPD
tempstr = emalloc(strlen(cont_type)
+ sizeof("Content-type:") + 2);
if(tempstr) {
strcpy(tempstr, "Content-type:");
strcpy(tempstr + sizeof("Content-type:") - 1,
cont_type);
strcat(tempstr, "\r\n");
php3_fhttpd_puts_header(tempstr);
efree(tempstr);
}
#else #else
PUTS_H("Content-type:"); PUTS_H("Content-type:");
PUTS_H(cont_type); PUTS_H(cont_type);
@ -371,7 +352,7 @@ PHPAPI int php_header(void)
#else #else
fflush(stdout); fflush(stdout);
#endif #endif
php3_HeaderPrinted = 1; php_header_printed = 1;
header_called = 1; header_called = 1;
} }
#endif #endif
@ -393,7 +374,7 @@ PHPAPI int php_header()
void php3_PushCookieList(char *name, char *value, time_t expires, char *path, char *domain, int secure) void php_push_cookie_list(char *name, char *value, time_t expires, char *path, char *domain, int secure)
{ {
CookieList *new; CookieList *new;
@ -408,7 +389,7 @@ void php3_PushCookieList(char *name, char *value, time_t expires, char *path, ch
top = new; top = new;
} }
CookieList *php3_PopCookieList(void) CookieList *php_pop_cookie_list(void)
{ {
CookieList *ret; CookieList *ret;
@ -418,7 +399,7 @@ CookieList *php3_PopCookieList(void)
return (ret); return (ret);
} }
/* php3_setcookie(name,value,expires,path,domain,secure) */ /* php_set_cookie(name,value,expires,path,domain,secure) */
PHP_FUNCTION(setcookie) PHP_FUNCTION(setcookie)
{ {
char *cookie; char *cookie;
@ -435,8 +416,8 @@ PHP_FUNCTION(setcookie)
if (arg_count < 1 || arg_count > 6 || getParametersArray(ht, arg_count, arg) == FAILURE) { if (arg_count < 1 || arg_count > 6 || getParametersArray(ht, arg_count, arg) == FAILURE) {
WRONG_PARAM_COUNT; WRONG_PARAM_COUNT;
} }
if (php3_HeaderPrinted == 1) { if (php_header_printed == 1) {
php_error(E_WARNING, "Oops, php3_SetCookie called after header has been sent\n"); php_error(E_WARNING, "Oops, php_set_cookie called after header has been sent\n");
return; return;
} }
switch (arg_count) { switch (arg_count) {
@ -466,7 +447,7 @@ PHP_FUNCTION(setcookie)
break; break;
} }
#if 0 #if 0
php3_PushCookieList(name, value, expires, path, domain, secure); php_push_cookie_list(name, value, expires, path, domain, secure);
#else #else
if (name) { if (name) {
len += strlen(name); len += strlen(name);
@ -490,12 +471,12 @@ PHP_FUNCTION(setcookie)
sprintf(cookie, "Set-Cookie: %s=deleted", name); sprintf(cookie, "Set-Cookie: %s=deleted", name);
strcat(cookie, "; expires="); strcat(cookie, "; expires=");
t = time(NULL) - 31536001; t = time(NULL) - 31536001;
dt = php3_std_date(t); dt = php_std_date(t);
strcat(cookie, dt); strcat(cookie, dt);
efree(dt); efree(dt);
} else { } else {
/* FIXME: XXX: this is not binary data safe */ /* FIXME: XXX: this is not binary data safe */
r = _php3_urlencode(value, strlen (value)); r = php_url_encode(value, strlen (value));
sprintf(cookie, "Set-Cookie: %s=%s", name, value ? r : ""); sprintf(cookie, "Set-Cookie: %s=%s", name, value ? r : "");
if (r) efree(r); if (r) efree(r);
if (value) efree(value); if (value) efree(value);
@ -504,7 +485,7 @@ PHP_FUNCTION(setcookie)
name=NULL; name=NULL;
if (expires > 0) { if (expires > 0) {
strcat(cookie, "; expires="); strcat(cookie, "; expires=");
dt = php3_std_date(expires); dt = php_std_date(expires);
strcat(cookie, dt); strcat(cookie, dt);
efree(dt); efree(dt);
} }
@ -550,7 +531,7 @@ PHP_FUNCTION(setcookie)
int php_headers_unsent(void) int php_headers_unsent(void)
{ {
if (php3_HeaderPrinted!=1 || !php3_PrintHeader) { if (php_header_printed!=1 || !php_print_header) {
return 1; return 1;
} else { } else {
return 0; return 0;

View file

@ -43,7 +43,7 @@ static char EntTable[][7] =
"uuml","yacute","thorn","yuml" "uuml","yacute","thorn","yuml"
}; };
static void _php3_htmlentities(INTERNAL_FUNCTION_PARAMETERS, int all) static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
{ {
pval **arg; pval **arg;
int i, len, maxlen; int i, len, maxlen;
@ -109,7 +109,7 @@ void register_html_constants(INIT_FUNC_ARGS)
Convert special characters to HTML entities */ Convert special characters to HTML entities */
PHP_FUNCTION(htmlspecialchars) PHP_FUNCTION(htmlspecialchars)
{ {
_php3_htmlentities(INTERNAL_FUNCTION_PARAM_PASSTHRU,0); php_html_entities(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
} }
/* }}} */ /* }}} */
@ -117,7 +117,7 @@ PHP_FUNCTION(htmlspecialchars)
Convert all applicable characters to HTML entities */ Convert all applicable characters to HTML entities */
PHP_FUNCTION(htmlentities) PHP_FUNCTION(htmlentities)
{ {
_php3_htmlentities(INTERNAL_FUNCTION_PARAM_PASSTHRU,1); php_html_entities(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
} }
/* }}} */ /* }}} */

View file

@ -48,11 +48,11 @@
#include "php_image.h" #include "php_image.h"
/* file type markers */ /* file type markers */
const char php3_sig_gif[3] = const char php_sig_gif[3] =
{'G', 'I', 'F'}; {'G', 'I', 'F'};
const char php3_sig_jpg[3] = const char php_sig_jpg[3] =
{(char) 0xff, (char) 0xd8, (char) 0xff}; {(char) 0xff, (char) 0xd8, (char) 0xff};
const char php3_sig_png[8] = const char php_sig_png[8] =
{(char) 0x89, (char) 0x50, (char) 0x4e, {(char) 0x89, (char) 0x50, (char) 0x4e,
(char) 0x47, (char) 0x0d, (char) 0x0a, (char) 0x47, (char) 0x0d, (char) 0x0a,
(char) 0x1a, (char) 0x0a}; (char) 0x1a, (char) 0x0a};
@ -67,7 +67,7 @@ struct gfxinfo {
}; };
/* routine to handle GIF files. If only everything were that easy... ;} */ /* routine to handle GIF files. If only everything were that easy... ;} */
static struct gfxinfo *php3_handle_gif (FILE *fp) static struct gfxinfo *php_handle_gif (FILE *fp)
{ {
struct gfxinfo *result = NULL; struct gfxinfo *result = NULL;
unsigned char a[2]; unsigned char a[2];
@ -81,7 +81,7 @@ static struct gfxinfo *php3_handle_gif (FILE *fp)
return result; return result;
} }
static unsigned long php3_read4(FILE *fp) static unsigned long php_read4(FILE *fp)
{ {
unsigned char a[ 4 ]; unsigned char a[ 4 ];
@ -93,15 +93,15 @@ static unsigned long php3_read4(FILE *fp)
} }
/* routine to handle PNG files. - even easier */ /* routine to handle PNG files. - even easier */
static struct gfxinfo *php3_handle_png(FILE *fp) static struct gfxinfo *php_handle_png(FILE *fp)
{ {
struct gfxinfo *result = NULL; struct gfxinfo *result = NULL;
unsigned long in_width, in_height; unsigned long in_width, in_height;
result = (struct gfxinfo *) ecalloc(1,sizeof(struct gfxinfo)); result = (struct gfxinfo *) ecalloc(1,sizeof(struct gfxinfo));
fseek(fp, 16L, SEEK_SET); fseek(fp, 16L, SEEK_SET);
in_width = php3_read4(fp); in_width = php_read4(fp);
in_height = php3_read4(fp); in_height = php_read4(fp);
result->width = (unsigned int) in_width; result->width = (unsigned int) in_width;
result->height = (unsigned int) in_height; result->height = (unsigned int) in_height;
return result; return result;
@ -143,7 +143,7 @@ static struct gfxinfo *php3_handle_png(FILE *fp)
#define M_APP14 0xee #define M_APP14 0xee
#define M_APP15 0xef #define M_APP15 0xef
static unsigned short php3_read2(FILE *fp) static unsigned short php_read2(FILE *fp)
{ {
unsigned char a[ 2 ]; unsigned char a[ 2 ];
@ -153,7 +153,7 @@ static unsigned short php3_read2(FILE *fp)
return (((unsigned short) a[ 0 ]) << 8) + ((unsigned short) a[ 1 ]); return (((unsigned short) a[ 0 ]) << 8) + ((unsigned short) a[ 1 ]);
} }
static unsigned int php3_next_marker(FILE *fp) static unsigned int php_next_marker(FILE *fp)
/* get next marker byte from file */ /* get next marker byte from file */
{ {
int c; int c;
@ -176,23 +176,23 @@ static unsigned int php3_next_marker(FILE *fp)
return (unsigned int) c; return (unsigned int) c;
} }
static void php3_skip_variable(FILE *fp) static void php_skip_variable(FILE *fp)
/* skip over a variable-length block; assumes proper length marker */ /* skip over a variable-length block; assumes proper length marker */
{ {
unsigned short length; unsigned short length;
length = php3_read2(fp); length = php_read2(fp);
length -= 2; /* length includes itself */ length -= 2; /* length includes itself */
fseek(fp, (long) length, SEEK_CUR); /* skip the header */ fseek(fp, (long) length, SEEK_CUR); /* skip the header */
} }
static void php3_read_APP(FILE *fp,unsigned int marker,pval *info) static void php_read_APP(FILE *fp,unsigned int marker,pval *info)
{ {
unsigned short length; unsigned short length;
unsigned char *buffer; unsigned char *buffer;
unsigned char markername[ 16 ]; unsigned char markername[ 16 ];
length = php3_read2(fp); length = php_read2(fp);
length -= 2; /* length includes itself */ length -= 2; /* length includes itself */
buffer = emalloc(length); buffer = emalloc(length);
@ -208,7 +208,7 @@ static void php3_read_APP(FILE *fp,unsigned int marker,pval *info)
efree(buffer); efree(buffer);
} }
static struct gfxinfo *php3_handle_jpeg(FILE *fp,pval *info) static struct gfxinfo *php_handle_jpeg(FILE *fp,pval *info)
/* main loop to parse JPEG structure */ /* main loop to parse JPEG structure */
{ {
struct gfxinfo *result = NULL; struct gfxinfo *result = NULL;
@ -223,7 +223,7 @@ static struct gfxinfo *php3_handle_jpeg(FILE *fp,pval *info)
return NULL; return NULL;
for (;;) { for (;;) {
marker = php3_next_marker(fp); marker = php_next_marker(fp);
switch (marker) { switch (marker) {
case M_SOF0: case M_SOF0:
case M_SOF1: case M_SOF1:
@ -245,14 +245,14 @@ static struct gfxinfo *php3_handle_jpeg(FILE *fp,pval *info)
fseek(fp, 2, SEEK_CUR); fseek(fp, 2, SEEK_CUR);
result->bits = fgetc(fp); result->bits = fgetc(fp);
result->height = php3_read2(fp); result->height = php_read2(fp);
result->width = php3_read2(fp); result->width = php_read2(fp);
result->channels = fgetc(fp); result->channels = fgetc(fp);
if (! info) /* if we don't want an extanded info -> return */ if (! info) /* if we don't want an extanded info -> return */
return result; return result;
} else { } else {
php3_skip_variable(fp); php_skip_variable(fp);
} }
break; break;
@ -273,9 +273,9 @@ static struct gfxinfo *php3_handle_jpeg(FILE *fp,pval *info)
case M_APP14: case M_APP14:
case M_APP15: case M_APP15:
if (info) { if (info) {
php3_read_APP(fp,marker,info); /* read all the app markes... */ php_read_APP(fp,marker,info); /* read all the app markes... */
} else { } else {
php3_skip_variable(fp); php_skip_variable(fp);
} }
break; break;
@ -285,7 +285,7 @@ static struct gfxinfo *php3_handle_jpeg(FILE *fp,pval *info)
break; break;
default: default:
php3_skip_variable(fp); /* anything else isn't interesting */ php_skip_variable(fp); /* anything else isn't interesting */
break; break;
} }
} }
@ -343,21 +343,21 @@ PHP_FUNCTION(getimagesize)
return; return;
} }
fread(filetype,sizeof(filetype),1,fp); fread(filetype,sizeof(filetype),1,fp);
if (!memcmp(filetype, php3_sig_gif, 3)) { if (!memcmp(filetype, php_sig_gif, 3)) {
result = php3_handle_gif (fp); result = php_handle_gif (fp);
itype = 1; itype = 1;
} else if (!memcmp(filetype, php3_sig_jpg, 3)) { } else if (!memcmp(filetype, php_sig_jpg, 3)) {
if (info) { if (info) {
result = php3_handle_jpeg(fp,*info); result = php_handle_jpeg(fp,*info);
} else { } else {
result = php3_handle_jpeg(fp,NULL); result = php_handle_jpeg(fp,NULL);
} }
itype = 2; itype = 2;
} else if (!memcmp(filetype, php3_sig_png, 3)) { } else if (!memcmp(filetype, php_sig_png, 3)) {
fseek(fp, 0L, SEEK_SET); fseek(fp, 0L, SEEK_SET);
fread(pngtype, sizeof(pngtype), 1, fp); fread(pngtype, sizeof(pngtype), 1, fp);
if (!memcmp(pngtype, php3_sig_png, 8)) { if (!memcmp(pngtype, php_sig_png, 8)) {
result = php3_handle_png(fp); result = php_handle_png(fp);
itype = 3; itype = 3;
} else { } else {
php_error(E_WARNING, "PNG file corrupted by ASCII conversion"); php_error(E_WARNING, "PNG file corrupted by ASCII conversion");

View file

@ -56,10 +56,10 @@ static int _display_module_info(zend_module_entry *module, void *arg)
PHPAPI void php_print_info(int flag) PHPAPI void php_print_info(int flag)
{ {
char **env,*tmp1,*tmp2; char **env,*tmp1,*tmp2;
char *php3_uname; char *php_uname;
int expose_php = INI_INT("expose_php"); int expose_php = INI_INT("expose_php");
#if WIN32|WINNT #if WIN32|WINNT
char php3_windows_uname[256]; char php_windows_uname[256];
DWORD dwBuild=0; DWORD dwBuild=0;
DWORD dwVersion = GetVersion(); DWORD dwVersion = GetVersion();
DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
@ -74,13 +74,13 @@ PHPAPI void php_print_info(int flag)
// Get build numbers for Windows NT or Win95 // Get build numbers for Windows NT or Win95
if (dwVersion < 0x80000000){ if (dwVersion < 0x80000000){
dwBuild = (DWORD)(HIWORD(dwVersion)); dwBuild = (DWORD)(HIWORD(dwVersion));
snprintf(php3_windows_uname,255,"%s %d.%d build %d","Windows NT",dwWindowsMajorVersion,dwWindowsMinorVersion,dwBuild); snprintf(php_windows_uname,255,"%s %d.%d build %d","Windows NT",dwWindowsMajorVersion,dwWindowsMinorVersion,dwBuild);
} else { } else {
snprintf(php3_windows_uname,255,"%s %d.%d","Windows 95/98",dwWindowsMajorVersion,dwWindowsMinorVersion); snprintf(php_windows_uname,255,"%s %d.%d","Windows 95/98",dwWindowsMajorVersion,dwWindowsMinorVersion);
} }
php3_uname = php3_windows_uname; php_uname = php_windows_uname;
#else #else
php3_uname=PHP_UNAME; php_uname=PHP_UNAME;
#endif #endif
@ -94,7 +94,7 @@ PHPAPI void php_print_info(int flag)
} }
PUTS("?=PHPE9568F34-D428-11d2-A769-00AA001ACF42\" border=\"0\" align=\"right\"></a>\n"); PUTS("?=PHPE9568F34-D428-11d2-A769-00AA001ACF42\" border=\"0\" align=\"right\"></a>\n");
} }
php_printf("System: %s<br>Build Date: %s\n<br>", php3_uname, __DATE__); php_printf("System: %s<br>Build Date: %s\n<br>", php_uname, __DATE__);
#ifdef CONFIGURE_COMMAND #ifdef CONFIGURE_COMMAND
php_printf("Configure command: %s<br>\n", CONFIGURE_COMMAND); php_printf("Configure command: %s<br>\n", CONFIGURE_COMMAND);
#endif #endif

View file

@ -73,7 +73,7 @@
#define M_APP14 0xee #define M_APP14 0xee
#define M_APP15 0xef #define M_APP15 0xef
static int php3_iptc_put1(FILE *fp,int spool,unsigned char c,unsigned char **spoolbuf) static int php_iptc_put1(FILE *fp,int spool,unsigned char c,unsigned char **spoolbuf)
{ {
if (spool > 0) if (spool > 0)
PUTC(c); PUTC(c);
@ -83,7 +83,7 @@ static int php3_iptc_put1(FILE *fp,int spool,unsigned char c,unsigned char **spo
return c; return c;
} }
static int php3_iptc_get1(FILE *fp,int spool,unsigned char **spoolbuf) static int php_iptc_get1(FILE *fp,int spool,unsigned char **spoolbuf)
{ {
int c; int c;
char cc; char cc;
@ -102,57 +102,57 @@ static int php3_iptc_get1(FILE *fp,int spool,unsigned char **spoolbuf)
return c; return c;
} }
static int php3_iptc_read_remaining(FILE *fp,int spool,unsigned char **spoolbuf) static int php_iptc_read_remaining(FILE *fp,int spool,unsigned char **spoolbuf)
{ {
int c; int c;
while ((c = php3_iptc_get1(fp,spool,spoolbuf)) != EOF) continue; while ((c = php_iptc_get1(fp,spool,spoolbuf)) != EOF) continue;
return M_EOI; return M_EOI;
} }
static int php3_iptc_skip_variable(FILE *fp,int spool,unsigned char **spoolbuf) static int php_iptc_skip_variable(FILE *fp,int spool,unsigned char **spoolbuf)
{ {
unsigned int length; unsigned int length;
int c1,c2; int c1,c2;
if ((c1 = php3_iptc_get1(fp,spool,spoolbuf)) == EOF) return M_EOI; if ((c1 = php_iptc_get1(fp,spool,spoolbuf)) == EOF) return M_EOI;
if ((c2 = php3_iptc_get1(fp,spool,spoolbuf)) == EOF) return M_EOI; if ((c2 = php_iptc_get1(fp,spool,spoolbuf)) == EOF) return M_EOI;
length = (((unsigned char) c1) << 8) + ((unsigned char) c2); length = (((unsigned char) c1) << 8) + ((unsigned char) c2);
length -= 2; length -= 2;
while (length--) while (length--)
if (php3_iptc_get1(fp,spool,spoolbuf) == EOF) return M_EOI; if (php_iptc_get1(fp,spool,spoolbuf) == EOF) return M_EOI;
return 0; return 0;
} }
static int php3_iptc_nextmarker(FILE *fp,int spool,unsigned char **spoolbuf) static int php_iptc_next_marker(FILE *fp,int spool,unsigned char **spoolbuf)
{ {
int c; int c;
/* skip unimportant stuff */ /* skip unimportant stuff */
c = php3_iptc_get1(fp,spool,spoolbuf); c = php_iptc_get1(fp,spool,spoolbuf);
if (c == EOF) return M_EOI; if (c == EOF) return M_EOI;
while (c != 0xff) { while (c != 0xff) {
if ((c = php3_iptc_get1(fp,spool,spoolbuf)) == EOF) if ((c = php_iptc_get1(fp,spool,spoolbuf)) == EOF)
return M_EOI; /* we hit EOF */ return M_EOI; /* we hit EOF */
} }
/* get marker byte, swallowing possible padding */ /* get marker byte, swallowing possible padding */
do { do {
c = php3_iptc_get1(fp,0,0); c = php_iptc_get1(fp,0,0);
if (c == EOF) if (c == EOF)
return M_EOI; /* we hit EOF */ return M_EOI; /* we hit EOF */
else else
if (c == 0xff) if (c == 0xff)
php3_iptc_put1(fp,spool,(unsigned char)c,spoolbuf); php_iptc_put1(fp,spool,(unsigned char)c,spoolbuf);
} while (c == 0xff); } while (c == 0xff);
return (unsigned int) c; return (unsigned int) c;
@ -226,36 +226,36 @@ PHP_FUNCTION(iptcembed)
} }
} }
if (php3_iptc_get1(fp,spool,poi?&poi:0) != 0xFF) { if (php_iptc_get1(fp,spool,poi?&poi:0) != 0xFF) {
fclose(fp); fclose(fp);
RETURN_FALSE; RETURN_FALSE;
} }
if (php3_iptc_get1(fp,spool,poi?&poi:0) != 0xD8) { if (php_iptc_get1(fp,spool,poi?&poi:0) != 0xD8) {
fclose(fp); fclose(fp);
RETURN_FALSE; RETURN_FALSE;
} }
while (!done) { while (!done) {
marker = php3_iptc_nextmarker(fp,spool,poi?&poi:0); marker = php_iptc_next_marker(fp,spool,poi?&poi:0);
if (marker == M_EOI) { /* EOF */ if (marker == M_EOI) { /* EOF */
break; break;
} else if (marker != M_APP13) { } else if (marker != M_APP13) {
php3_iptc_put1(fp,spool,(unsigned char)marker,poi?&poi:0); php_iptc_put1(fp,spool,(unsigned char)marker,poi?&poi:0);
} }
switch (marker) { switch (marker) {
case M_APP13: case M_APP13:
/* we are going to write a new APP13 marker, so don't output the old one */ /* we are going to write a new APP13 marker, so don't output the old one */
php3_iptc_skip_variable(fp,0,0); php_iptc_skip_variable(fp,0,0);
php3_iptc_read_remaining(fp,spool,poi?&poi:0); php_iptc_read_remaining(fp,spool,poi?&poi:0);
done = 1; done = 1;
break; break;
case M_APP0: case M_APP0:
/* APP0 is in each and every JPEG, so when we hit APP0 we insert our new APP13! */ /* APP0 is in each and every JPEG, so when we hit APP0 we insert our new APP13! */
php3_iptc_skip_variable(fp,spool,poi?&poi:0); php_iptc_skip_variable(fp,spool,poi?&poi:0);
if (len & 1) len++; /* make the length even */ if (len & 1) len++; /* make the length even */
@ -263,23 +263,23 @@ PHP_FUNCTION(iptcembed)
psheader[ 3 ] = (len+28)&0xff; psheader[ 3 ] = (len+28)&0xff;
for (inx = 0; inx < 28; inx++) for (inx = 0; inx < 28; inx++)
php3_iptc_put1(fp,spool,psheader[inx],poi?&poi:0); php_iptc_put1(fp,spool,psheader[inx],poi?&poi:0);
php3_iptc_put1(fp,spool,(unsigned char)(len>>8),poi?&poi:0); php_iptc_put1(fp,spool,(unsigned char)(len>>8),poi?&poi:0);
php3_iptc_put1(fp,spool,(unsigned char)(len&0xff),poi?&poi:0); php_iptc_put1(fp,spool,(unsigned char)(len&0xff),poi?&poi:0);
for (inx = 0; inx < len; inx++) for (inx = 0; inx < len; inx++)
php3_iptc_put1(fp,spool,(*iptcdata)->value.str.val[inx],poi?&poi:0); php_iptc_put1(fp,spool,(*iptcdata)->value.str.val[inx],poi?&poi:0);
break; break;
case M_SOS: case M_SOS:
/* we hit data, no more marker-inserting can be done! */ /* we hit data, no more marker-inserting can be done! */
php3_iptc_read_remaining(fp,spool,poi?&poi:0); php_iptc_read_remaining(fp,spool,poi?&poi:0);
done = 1; done = 1;
break; break;
default: default:
php3_iptc_skip_variable(fp,spool,poi?&poi:0); php_iptc_skip_variable(fp,spool,poi?&poi:0);
break; break;
} }
} }

View file

@ -98,7 +98,7 @@ PHP_FUNCTION(mail)
headers = (*argv[3])->value.str.val; headers = (*argv[3])->value.str.val;
} }
if (_php3_mail(to, subject, message, headers)){ if (php_mail(to, subject, message, headers)){
RETURN_TRUE; RETURN_TRUE;
} else { } else {
RETURN_FALSE; RETURN_FALSE;
@ -106,7 +106,7 @@ PHP_FUNCTION(mail)
} }
/* }}} */ /* }}} */
int _php3_mail(char *to, char *subject, char *message, char *headers) int php_mail(char *to, char *subject, char *message, char *headers)
{ {
#if MSVC5 #if MSVC5
int tsm_err; int tsm_err;

View file

@ -80,7 +80,7 @@ static int big_endian_long_map[4];
static int little_endian_long_map[4]; static int little_endian_long_map[4];
static void _php3_pack(pval *val, int size, int *map, char *output) static void php_pack(pval *val, int size, int *map, char *output)
{ {
int i; int i;
char *v; char *v;
@ -344,7 +344,7 @@ PHP_FUNCTION(pack)
case 'c': case 'C': { case 'c': case 'C': {
while (arg-- > 0) { while (arg-- > 0) {
_php3_pack(argv[currentarg++], 1, byte_map, &output[outputpos]); php_pack(argv[currentarg++], 1, byte_map, &output[outputpos]);
outputpos++; outputpos++;
} }
break; break;
@ -360,7 +360,7 @@ PHP_FUNCTION(pack)
} }
while (arg-- > 0) { while (arg-- > 0) {
_php3_pack(argv[currentarg++], 2, map, &output[outputpos]); php_pack(argv[currentarg++], 2, map, &output[outputpos]);
outputpos += 2; outputpos += 2;
} }
break; break;
@ -368,7 +368,7 @@ PHP_FUNCTION(pack)
case 'i': case 'I': { case 'i': case 'I': {
while (arg-- > 0) { while (arg-- > 0) {
_php3_pack(argv[currentarg++], sizeof(int), int_map, &output[outputpos]); php_pack(argv[currentarg++], sizeof(int), int_map, &output[outputpos]);
outputpos += sizeof(int); outputpos += sizeof(int);
} }
break; break;
@ -384,7 +384,7 @@ PHP_FUNCTION(pack)
} }
while (arg-- > 0) { while (arg-- > 0) {
_php3_pack(argv[currentarg++], 4, map, &output[outputpos]); php_pack(argv[currentarg++], 4, map, &output[outputpos]);
outputpos += 4; outputpos += 4;
} }
break; break;
@ -451,7 +451,7 @@ PHP_FUNCTION(pack)
/* }}} */ /* }}} */
static long _php3_unpack(char *data, int size, int issigned, int *map) static long php_unpack(char *data, int size, int issigned, int *map)
{ {
long result; long result;
char *cresult = (char *)&result; char *cresult = (char *)&result;
@ -678,7 +678,7 @@ PHP_FUNCTION(unpack)
case 'c': case 'C': { case 'c': case 'C': {
int issigned = (type == 'c') ? (input[inputpos] & 0x80) : 0; int issigned = (type == 'c') ? (input[inputpos] & 0x80) : 0;
long v = _php3_unpack(&input[inputpos], 1, issigned, byte_map); long v = php_unpack(&input[inputpos], 1, issigned, byte_map);
add_assoc_long(return_value, n, v); add_assoc_long(return_value, n, v);
break; break;
} }
@ -696,7 +696,7 @@ PHP_FUNCTION(unpack)
map = little_endian_short_map; map = little_endian_short_map;
} }
v = _php3_unpack(&input[inputpos], 2, issigned, map); v = php_unpack(&input[inputpos], 2, issigned, map);
add_assoc_long(return_value, n, v); add_assoc_long(return_value, n, v);
break; break;
} }
@ -709,7 +709,7 @@ PHP_FUNCTION(unpack)
issigned = input[inputpos + (machine_little_endian ? (sizeof(int) - 1) : 0)] & 0x80; issigned = input[inputpos + (machine_little_endian ? (sizeof(int) - 1) : 0)] & 0x80;
} }
v = _php3_unpack(&input[inputpos], sizeof(int), issigned, int_map); v = php_unpack(&input[inputpos], sizeof(int), issigned, int_map);
add_assoc_long(return_value, n, v); add_assoc_long(return_value, n, v);
break; break;
} }
@ -727,7 +727,7 @@ PHP_FUNCTION(unpack)
map = little_endian_long_map; map = little_endian_long_map;
} }
v = _php3_unpack(&input[inputpos], 4, issigned, map); v = php_unpack(&input[inputpos], 4, issigned, map);
add_assoc_long(return_value, n, v); add_assoc_long(return_value, n, v);
break; break;
} }

View file

@ -40,7 +40,7 @@
#include "ext/standard/basic_functions.h" #include "ext/standard/basic_functions.h"
static void _php3_statpage(void) static void php_statpage(void)
{ {
#if !APACHE #if !APACHE
char *path; char *path;
@ -85,7 +85,7 @@ long php_getuid(void)
{ {
BLS_FETCH(); BLS_FETCH();
_php3_statpage(); php_statpage();
return (BG(page_uid)); return (BG(page_uid));
} }
@ -125,7 +125,7 @@ PHP_FUNCTION(getmyinode)
{ {
BLS_FETCH(); BLS_FETCH();
_php3_statpage(); php_statpage();
if (BG(page_inode) < 0) { if (BG(page_inode) < 0) {
RETURN_FALSE; RETURN_FALSE;
} else { } else {
@ -140,7 +140,7 @@ PHP_FUNCTION(getlastmod)
{ {
BLS_FETCH(); BLS_FETCH();
_php3_statpage(); php_statpage();
if (BG(page_mtime) < 0) { if (BG(page_mtime) < 0) {
RETURN_FALSE; RETURN_FALSE;
} else { } else {

View file

@ -21,8 +21,8 @@
#ifndef _PHP_DIR_H #ifndef _PHP_DIR_H
#define _PHP_DIR_H #define _PHP_DIR_H
extern zend_module_entry php3_dir_module_entry; extern zend_module_entry php_dir_module_entry;
#define php3_dir_module_ptr &php3_dir_module_entry #define php_dir_module_ptr &php_dir_module_entry
/* directory functions */ /* directory functions */
extern PHP_MINIT_FUNCTION(dir); extern PHP_MINIT_FUNCTION(dir);
@ -34,6 +34,6 @@ PHP_FUNCTION(rewinddir);
PHP_FUNCTION(readdir); PHP_FUNCTION(readdir);
PHP_FUNCTION(getdir); PHP_FUNCTION(getdir);
#define phpext_dir_ptr php3_dir_module_ptr #define phpext_dir_ptr php_dir_module_ptr
#endif /* _PHP_DIR_H */ #endif /* _PHP_DIR_H */

View file

@ -61,9 +61,9 @@ PHP_FUNCTION(chmod);
PHP_FUNCTION(touch); PHP_FUNCTION(touch);
PHP_FUNCTION(clearstatcache); PHP_FUNCTION(clearstatcache);
extern zend_module_entry php3_filestat_module_entry; extern zend_module_entry php_filestat_module_entry;
#define php3_filestat_module_ptr &php3_filestat_module_entry #define php_filestat_module_ptr &php_filestat_module_entry
#define phpext_filestat_ptr php3_filestat_module_ptr #define phpext_filestat_ptr php_filestat_module_ptr
#endif /* _FILESTAT_H */ #endif /* _FILESTAT_H */

View file

@ -38,7 +38,7 @@ extern zend_module_entry mail_module_entry;
PHP_FUNCTION(mail); PHP_FUNCTION(mail);
PHP_MINFO_FUNCTION(mail); PHP_MINFO_FUNCTION(mail);
extern int _php3_mail(char *to, char *subject, char *message, char *headers); extern int php_mail(char *to, char *subject, char *message, char *headers);
#else #else
#define mail_module_ptr NULL #define mail_module_ptr NULL

View file

@ -31,7 +31,7 @@
/* $Id$ */ /* $Id$ */
/* Synced with php3 revision 1.43 1999-06-16 [ssb] */ /* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */
#ifndef _PHPSTRING_H #ifndef _PHPSTRING_H
#define _PHPSTRING_H #define _PHPSTRING_H

View file

@ -49,7 +49,7 @@ void php_parse_gpc_data(char *val, char *var, pval *track_vars_array ELS_DC PLS_
var_type = php_check_ident_type(var); var_type = php_check_ident_type(var);
if (var_type == GPC_INDEXED_ARRAY) { if (var_type == GPC_INDEXED_ARRAY) {
ind = php3_get_ident_index(var); ind = php_get_ident_index(var);
if (PG(magic_quotes_gpc)) { if (PG(magic_quotes_gpc)) {
array_index = php_addslashes(ind, 0, NULL, 1); array_index = php_addslashes(ind, 0, NULL, 1);
} else { } else {
@ -121,7 +121,7 @@ void php_parse_gpc_data(char *val, char *var, pval *track_vars_array ELS_DC PLS_
/* Insert it */ /* Insert it */
if (array_index) { if (array_index) {
/* indexed array */ /* indexed array */
if (php3_check_type(array_index) == IS_LONG) { if (php_check_type(array_index) == IS_LONG) {
/* numeric index */ /* numeric index */
zend_hash_index_update(gpc_element->value.ht, atol(array_index), &array_element, sizeof(pval *), NULL); /* s[array_index]=tmp */ zend_hash_index_update(gpc_element->value.ht, atol(array_index), &array_element, sizeof(pval *), NULL); /* s[array_index]=tmp */
} else { } else {
@ -391,8 +391,8 @@ void php_treat_data(int arg, char *str ELS_DC PLS_DC SLS_DC)
if (val) { /* have a value */ if (val) { /* have a value */
*val++ = '\0'; *val++ = '\0';
/* FIXME: XXX: not binary safe, discards returned length */ /* FIXME: XXX: not binary safe, discards returned length */
_php3_urldecode(var, strlen(var)); php_url_decode(var, strlen(var));
_php3_urldecode(val, strlen(val)); php_url_decode(val, strlen(val));
php_parse_gpc_data2(val,var,array_ptr ELS_CC PLS_CC); php_parse_gpc_data2(val,var,array_ptr ELS_CC PLS_CC);
} }
if (arg == PARSE_COOKIE) { if (arg == PARSE_COOKIE) {

View file

@ -34,7 +34,7 @@
/* /*
* Converting HEX char to INT value * Converting HEX char to INT value
*/ */
static char _php3_hex2int(int c) static char php_hex2int(int c)
{ {
if ( isdigit(c) ) if ( isdigit(c) )
{ {
@ -78,8 +78,8 @@ PHP_FUNCTION(quoted_printable_decode)
( isdigit((int)str[i+2]) || (str[i+2]<='F' && str[i+2]>='A')) ( isdigit((int)str[i+2]) || (str[i+2]<='F' && str[i+2]>='A'))
) )
{ {
str[j++] = (_php3_hex2int((int)str[i+1]) << 4 ) str[j++] = (php_hex2int((int)str[i+1]) << 4 )
+ _php3_hex2int((int)str[i+2]); + php_hex2int((int)str[i+2]);
i += 3; i += 3;
} }
else if ( str[i] == 13 ) else if ( str[i] == 13 )

View file

@ -317,7 +317,7 @@ PHP_FUNCTION(mt_rand)
return_value->type = IS_LONG; return_value->type = IS_LONG;
/* /*
* Melo: hmms.. randomMT() returns 32 random bits... * Melo: hmms.. randomMT() returns 32 random bits...
* Yet, the previous php3_rand only returns 31 at most. * Yet, the previous php_rand only returns 31 at most.
* So I put a right shift to loose the lsb. It *seems* * So I put a right shift to loose the lsb. It *seems*
* better than clearing the msb. * better than clearing the msb.
* Update: * Update:
@ -349,7 +349,7 @@ PHP_FUNCTION(mt_getrandmax)
return_value->type = IS_LONG; return_value->type = IS_LONG;
/* /*
* Melo: it could be 2^^32 but we only use 2^^31 to maintain * Melo: it could be 2^^32 but we only use 2^^31 to maintain
* compatibility with the previous php3_rand * compatibility with the previous php_rand
*/ */
return_value->value.lval = 2147483647; /* 2^^31 */ return_value->value.lval = 2147483647; /* 2^^31 */
} }

View file

@ -136,9 +136,9 @@ static PHP_MINFO_FUNCTION(regex)
#define NS 10 #define NS 10
/* /*
* _php3_reg_eprint - convert error number to name * php_reg_eprint - convert error number to name
*/ */
static void _php3_reg_eprint(int err, regex_t *re) { static void php_reg_eprint(int err, regex_t *re) {
char *buf = NULL, *message = NULL; char *buf = NULL, *message = NULL;
size_t len; size_t len;
size_t buf_len; size_t buf_len;
@ -175,7 +175,7 @@ static void _php3_reg_eprint(int err, regex_t *re) {
STR_FREE(message); STR_FREE(message);
} }
static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
{ {
pval **regex, /* Regular expression */ pval **regex, /* Regular expression */
**findin, /* String to apply expression to */ **findin, /* String to apply expression to */
@ -227,7 +227,7 @@ static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
} }
if (err) { if (err) {
_php3_reg_eprint(err, &re); php_reg_eprint(err, &re);
RETURN_FALSE; RETURN_FALSE;
} }
@ -238,7 +238,7 @@ static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
/* actually execute the regular expression */ /* actually execute the regular expression */
err = regexec(&re, string, (size_t) NS, subs, 0); err = regexec(&re, string, (size_t) NS, subs, 0);
if (err && err != REG_NOMATCH) { if (err && err != REG_NOMATCH) {
_php3_reg_eprint(err, &re); php_reg_eprint(err, &re);
regfree(&re); regfree(&re);
RETURN_FALSE; RETURN_FALSE;
} }
@ -250,7 +250,7 @@ static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
buf = emalloc(string_len); buf = emalloc(string_len);
if (!buf) { if (!buf) {
php_error(E_WARNING, "Unable to allocate memory in _php3_ereg"); php_error(E_WARNING, "Unable to allocate memory in php_ereg");
RETURN_FALSE; RETURN_FALSE;
} }
@ -284,7 +284,7 @@ static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
Regular expression match */ Regular expression match */
PHP_FUNCTION(ereg) PHP_FUNCTION(ereg)
{ {
_php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); php_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
} }
/* }}} */ /* }}} */
@ -292,12 +292,12 @@ PHP_FUNCTION(ereg)
Case-insensitive regular expression match */ Case-insensitive regular expression match */
PHP_FUNCTION(eregi) PHP_FUNCTION(eregi)
{ {
_php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); php_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
} }
/* }}} */ /* }}} */
/* this is the meat and potatoes of regex replacement! */ /* this is the meat and potatoes of regex replacement! */
char *_php3_regreplace(const char *pattern, const char *replace, const char *string, int icase, int extended) char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended)
{ {
regex_t re; regex_t re;
regmatch_t subs[NS]; regmatch_t subs[NS];
@ -318,7 +318,7 @@ char *_php3_regreplace(const char *pattern, const char *replace, const char *str
copts |= REG_EXTENDED; copts |= REG_EXTENDED;
err = regcomp(&re, pattern, copts); err = regcomp(&re, pattern, copts);
if (err) { if (err) {
_php3_reg_eprint(err, &re); php_reg_eprint(err, &re);
return ((char *) -1); return ((char *) -1);
} }
@ -327,7 +327,7 @@ char *_php3_regreplace(const char *pattern, const char *replace, const char *str
buf_len = 2 * string_len + 1; buf_len = 2 * string_len + 1;
buf = emalloc(buf_len * sizeof(char)); buf = emalloc(buf_len * sizeof(char));
if (!buf) { if (!buf) {
php_error(E_WARNING, "Unable to allocate memory in _php3_regreplace"); php_error(E_WARNING, "Unable to allocate memory in php_reg_replace");
regfree(&re); regfree(&re);
return ((char *) -1); return ((char *) -1);
} }
@ -339,7 +339,7 @@ char *_php3_regreplace(const char *pattern, const char *replace, const char *str
err = regexec(&re, &string[pos], (size_t) NS, subs, (pos ? REG_NOTBOL : 0)); err = regexec(&re, &string[pos], (size_t) NS, subs, (pos ? REG_NOTBOL : 0));
if (err && err != REG_NOMATCH) { if (err && err != REG_NOMATCH) {
_php3_reg_eprint(err, &re); php_reg_eprint(err, &re);
regfree(&re); regfree(&re);
return ((char *) -1); return ((char *) -1);
} }
@ -435,7 +435,7 @@ char *_php3_regreplace(const char *pattern, const char *replace, const char *str
return (buf); return (buf);
} }
static void _php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS, int icase) static void php_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
{ {
pval **arg_pattern, pval **arg_pattern,
**arg_replace, **arg_replace,
@ -480,7 +480,7 @@ static void _php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS, int icase)
string = empty_string; string = empty_string;
/* do the actual work */ /* do the actual work */
ret = _php3_regreplace(pattern, replace, string, icase, 1); ret = php_reg_replace(pattern, replace, string, icase, 1);
if (ret == (char *) -1) { if (ret == (char *) -1) {
RETVAL_FALSE; RETVAL_FALSE;
} else { } else {
@ -496,7 +496,7 @@ static void _php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS, int icase)
Replace regular expression */ Replace regular expression */
PHP_FUNCTION(ereg_replace) PHP_FUNCTION(ereg_replace)
{ {
_php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
} }
/* }}} */ /* }}} */
@ -504,7 +504,7 @@ PHP_FUNCTION(ereg_replace)
Case insensitive replace regular expression */ Case insensitive replace regular expression */
PHP_FUNCTION(eregi_replace) PHP_FUNCTION(eregi_replace)
{ {
_php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
} }
/* }}} */ /* }}} */

View file

@ -36,7 +36,7 @@
extern zend_module_entry regexp_module_entry; extern zend_module_entry regexp_module_entry;
#define regexp_module_ptr &regexp_module_entry #define regexp_module_ptr &regexp_module_entry
char *_php3_regreplace(const char *pattern, const char *replace, const char *string, int icase, int extended); char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended);
PHP_FUNCTION(ereg); PHP_FUNCTION(ereg);
PHP_FUNCTION(eregi); PHP_FUNCTION(eregi);

View file

@ -20,7 +20,7 @@
/* $Id$ */ /* $Id$ */
/* Synced with php3 revision 1.193 1999-06-16 [ssb] */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
#include <stdio.h> #include <stdio.h>
#include "php.h" #include "php.h"

View file

@ -24,7 +24,7 @@
* *
* Note that leading zeroes automatically force a STRING type * Note that leading zeroes automatically force a STRING type
*/ */
int php3_check_type(char *str) int php_check_type(char *str)
{ {
char *s; char *s;
int type = IS_LONG; int type = IS_LONG;
@ -51,7 +51,7 @@ int php3_check_type(char *str)
return (IS_STRING); return (IS_STRING);
return (type); return (type);
} /* php3_check_type */ } /* php_check_type */
/* /*
* 0 - simple variable * 0 - simple variable
@ -74,7 +74,7 @@ int php_check_ident_type(char *str)
return (GPC_INDEXED_ARRAY); return (GPC_INDEXED_ARRAY);
} }
char *php3_get_ident_index(char *str) char *php_get_ident_index(char *str)
{ {
char *temp; char *temp;
char *s, *t; char *s, *t;

View file

@ -29,9 +29,9 @@
#ifndef _TYPE_H #ifndef _TYPE_H
#define _TYPE_H #define _TYPE_H
extern int php3_check_type(char *str); extern int php_check_type(char *str);
extern int php_check_ident_type(char *str); extern int php_check_ident_type(char *str);
extern char *php3_get_ident_index(char *str); extern char *php_get_ident_index(char *str);
#define GPC_REGULAR 0x1 #define GPC_REGULAR 0x1
#define GPC_INDEXED_ARRAY 0x2 #define GPC_INDEXED_ARRAY 0x2

View file

@ -195,7 +195,7 @@ PHP_FUNCTION(parse_url)
} }
/* }}} */ /* }}} */
static int php3_htoi(char *s) static int php_htoi(char *s)
{ {
int value; int value;
int c; int c;
@ -228,7 +228,7 @@ static int php3_htoi(char *s)
static unsigned char hexchars[] = "0123456789ABCDEF"; static unsigned char hexchars[] = "0123456789ABCDEF";
char *_php3_urlencode(char *s, int len) char *php_url_encode(char *s, int len)
{ {
register int x, y; register int x, y;
unsigned char *str; unsigned char *str;
@ -275,7 +275,7 @@ PHP_FUNCTION(urlencode)
var_reset(return_value); var_reset(return_value);
return; return;
} }
str = _php3_urlencode((*arg)->value.str.val, (*arg)->value.str.len); str = php_url_encode((*arg)->value.str.val, (*arg)->value.str.len);
RETVAL_STRING(str, 1); RETVAL_STRING(str, 1);
efree(str); efree(str);
} }
@ -301,12 +301,12 @@ PHP_FUNCTION(urldecode)
*return_value = **arg; *return_value = **arg;
zval_copy_ctor(return_value); zval_copy_ctor(return_value);
len = _php3_urldecode(return_value->value.str.val, return_value->value.str.len); len = php_url_decode(return_value->value.str.val, return_value->value.str.len);
return_value->value.str.len = len; return_value->value.str.len = len;
} }
/* }}} */ /* }}} */
int _php3_urldecode(char *str, int len) int php_url_decode(char *str, int len)
{ {
char *dest = str; char *dest = str;
char *data = str; char *data = str;
@ -316,9 +316,9 @@ int _php3_urldecode(char *str, int len)
*dest = ' '; *dest = ' ';
else if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) { else if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) {
#ifndef CHARSET_EBCDIC #ifndef CHARSET_EBCDIC
*dest = (char) php3_htoi(data + 1); *dest = (char) php_htoi(data + 1);
#else #else
*dest = os_toebcdic[(char) php3_htoi(data + 1)]; *dest = os_toebcdic[(char) php_htoi(data + 1)];
#endif #endif
data += 2; data += 2;
len -= 2; len -= 2;
@ -331,7 +331,7 @@ int _php3_urldecode(char *str, int len)
return dest - str; return dest - str;
} }
char *_php3_rawurlencode(char *s, int len) char *php_raw_url_encode(char *s, int len)
{ {
register int x, y; register int x, y;
unsigned char *str; unsigned char *str;
@ -374,7 +374,7 @@ PHP_FUNCTION(rawurlencode)
if (!(*arg)->value.str.len) { if (!(*arg)->value.str.len) {
RETURN_FALSE; RETURN_FALSE;
} }
str = _php3_rawurlencode((*arg)->value.str.val, (*arg)->value.str.len); str = php_raw_url_encode((*arg)->value.str.val, (*arg)->value.str.len);
RETVAL_STRING(str, 1); RETVAL_STRING(str, 1);
efree(str); efree(str);
} }
@ -409,9 +409,9 @@ int php_raw_url_decode(char *str, int len)
while (len--) { while (len--) {
if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) { if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) {
#ifndef CHARSET_EBCDIC #ifndef CHARSET_EBCDIC
*dest = (char) php3_htoi(data + 1); *dest = (char) php_htoi(data + 1);
#else #else
*dest = os_toebcdic[(char) php3_htoi(data + 1)]; *dest = os_toebcdic[(char) php_htoi(data + 1)];
#endif #endif
data += 2; data += 2;
len -= 2; len -= 2;

View file

@ -41,10 +41,10 @@ typedef struct url {
void free_url(url *); void free_url(url *);
extern url *url_parse(char *); extern url *url_parse(char *);
extern int _php3_urldecode(char *, int); /* return value: length of decoded string */ extern int php_url_decode(char *, int); /* return value: length of decoded string */
extern char *_php3_urlencode(char *, int); extern char *php_url_encode(char *, int);
extern int php_raw_url_decode(char *, int); /* return value: length of decoded string */ extern int php_raw_url_decode(char *, int); /* return value: length of decoded string */
extern char *_php3_rawurlencode(char *, int); extern char *php_raw_url_encode(char *, int);
PHP_FUNCTION(parse_url); PHP_FUNCTION(parse_url);
PHP_FUNCTION(urlencode); PHP_FUNCTION(urlencode);

View file

@ -409,7 +409,7 @@ int php_var_unserialize(pval **rval, const char **p, const char *max)
} }
efree(class_name); efree(class_name);
} else { /* old php3 data 'o' */ } else { /* old php 3.0 data 'o' */
ce = &zend_standard_class_def; ce = &zend_standard_class_def;
} }

View file

@ -43,11 +43,7 @@
extern zend_module_entry sysvsem_module_entry; extern zend_module_entry sysvsem_module_entry;
#define sysvsem_module_ptr &sysvsem_module_entry #define sysvsem_module_ptr &sysvsem_module_entry
extern int php3_minit_sysvsem(INIT_FUNC_ARGS); PHP_MINIT_FUNCTION(sysvsem);
extern int php3_rinit_sysvsem(INIT_FUNC_ARGS);
extern int php3_mshutdown_sysvsem(SHUTDOWN_FUNC_ARGS);
extern int php3_rshutdown_sysvsem(SHUTDOWN_FUNC_ARGS);
void php3_info_sysvsem(void);
PHP_FUNCTION(sysvsem_get); PHP_FUNCTION(sysvsem_get);
PHP_FUNCTION(sysvsem_acquire); PHP_FUNCTION(sysvsem_acquire);
PHP_FUNCTION(sysvsem_release); PHP_FUNCTION(sysvsem_release);
@ -63,7 +59,7 @@ typedef struct {
int count; /* Acquire count for auto-release. */ int count; /* Acquire count for auto-release. */
} sysvsem_sem; } sysvsem_sem;
extern sysvsem_module php3_sysvsem_module; extern sysvsem_module php_sysvsem_module;
#else #else

View file

@ -50,14 +50,14 @@ union semun {
#endif #endif
function_entry sysvsem_functions[] = { function_entry sysvsem_functions[] = {
{"sem_get", php3_sysvsem_get, NULL}, PHP_FE(sem_get, NULL)
{"sem_acquire", php3_sysvsem_acquire, NULL}, PHP_FE(sem_acquire, NULL)
{"sem_release", php3_sysvsem_release, NULL}, PHP_FE(sem_release, NULL)
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };
zend_module_entry sysvsem_module_entry = { zend_module_entry sysvsem_module_entry = {
"System V semaphores", sysvsem_functions, php3_minit_sysvsem, NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES "System V semaphores", sysvsem_functions, PHP_MINIT(sysvsem), NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
}; };
#if COMPILE_DL #if COMPILE_DL
@ -65,7 +65,7 @@ zend_module_entry *get_module() { return &sysvsem_module_entry; }
#endif #endif
THREAD_LS sysvsem_module php3_sysvsem_module; THREAD_LS sysvsem_module php_sysvsem_module;
/* Semaphore functions using System V semaphores. Each semaphore /* Semaphore functions using System V semaphores. Each semaphore
* actually consists of three semaphores allocated as a unit under the * actually consists of three semaphores allocated as a unit under the
@ -77,7 +77,7 @@ THREAD_LS sysvsem_module php3_sysvsem_module;
* SYSVSEM_SEM to max_acquire. This allows max_acquire to be set and * SYSVSEM_SEM to max_acquire. This allows max_acquire to be set and
* track the PHP code without having a global init routine or external * track the PHP code without having a global init routine or external
* semaphore init code. Except see the bug regarding a race condition * semaphore init code. Except see the bug regarding a race condition
* php3_sysvsem_get(). Semaphore 2 (SYSVSEM_SETVAL) serializes the * php_sysvsem_get(). Semaphore 2 (SYSVSEM_SETVAL) serializes the
* calls to GETVAL SYSVSEM_USAGE and SETVAL SYSVSEM_SEM. It can be * calls to GETVAL SYSVSEM_USAGE and SETVAL SYSVSEM_SEM. It can be
* acquired only when it is zero. * acquired only when it is zero.
*/ */
@ -114,9 +114,9 @@ static void release_sysvsem_sem(sysvsem_sem *sem_ptr)
} }
int php3_minit_sysvsem(INIT_FUNC_ARGS) PHP_MINIT_FUNCTION(sysvsem)
{ {
php3_sysvsem_module.le_sem = register_list_destructors(release_sysvsem_sem, NULL); php_sysvsem_module.le_sem = register_list_destructors(release_sysvsem_sem, NULL);
return SUCCESS; return SUCCESS;
} }
@ -129,7 +129,7 @@ int php3_minit_sysvsem(INIT_FUNC_ARGS)
/* {{{ proto int sem_get(int key [, int max_acquire [, int perm]]) /* {{{ proto int sem_get(int key [, int max_acquire [, int perm]])
Return an id for the semaphore with the given key, and allow max_acquire (default 1) processes to acquire it simultaneously. */ Return an id for the semaphore with the given key, and allow max_acquire (default 1) processes to acquire it simultaneously. */
PHP_FUNCTION(sysvsem_get) PHP_FUNCTION(sem_get)
{ {
pval **arg_key, **arg_max_acquire, **arg_perm; pval **arg_key, **arg_max_acquire, **arg_perm;
int key, max_acquire, perm; int key, max_acquire, perm;
@ -272,14 +272,15 @@ PHP_FUNCTION(sysvsem_get)
sem_ptr->semid = semid; sem_ptr->semid = semid;
sem_ptr->count = 0; sem_ptr->count = 0;
return_value->value.lval = zend_list_insert(sem_ptr, php3_sysvsem_module.le_sem); return_value->value.lval = zend_list_insert(sem_ptr, php_sysvsem_module.le_sem);
return_value->type = IS_LONG; return_value->type = IS_LONG;
sem_ptr->id = (int)return_value->value.lval; sem_ptr->id = (int)return_value->value.lval;
} }
/* }}} */ /* }}} */
static void _php3_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire)
static void php_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire)
{ {
pval **arg_id; pval **arg_id;
int id, type; int id, type;
@ -300,7 +301,7 @@ static void _php3_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire)
} }
sem_ptr = (sysvsem_sem *) zend_list_find(id, &type); sem_ptr = (sysvsem_sem *) zend_list_find(id, &type);
if (type!=php3_sysvsem_module.le_sem) { if (type!=php_sysvsem_module.le_sem) {
php_error(E_WARNING, "%d is not a SysV semaphore index", id); php_error(E_WARNING, "%d is not a SysV semaphore index", id);
RETURN_FALSE; RETURN_FALSE;
} }
@ -329,17 +330,17 @@ static void _php3_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire)
/* {{{ proto int sem_acquire(int id) /* {{{ proto int sem_acquire(int id)
Acquires the semaphore with the given id, blocking if necessary. */ Acquires the semaphore with the given id, blocking if necessary. */
PHP_FUNCTION(sysvsem_acquire) PHP_FUNCTION(sem_acquire)
{ {
_php3_sysvsem_semop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); php_sysvsem_semop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
} }
/* }}} */ /* }}} */
/* {{{ proto int sem_release(int id) /* {{{ proto int sem_release(int id)
Releases the semaphore with the given id. */ Releases the semaphore with the given id. */
PHP_FUNCTION(sysvsem_release) PHP_FUNCTION(sem_release)
{ {
_php3_sysvsem_semop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); php_sysvsem_semop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
} }
/* }}} */ /* }}} */

View file

@ -86,11 +86,11 @@ PHP_FUNCTION(shm_remove);
PHP_FUNCTION(shm_put_var); PHP_FUNCTION(shm_put_var);
PHP_FUNCTION(shm_get_var); PHP_FUNCTION(shm_get_var);
PHP_FUNCTION(shm_remove_var); PHP_FUNCTION(shm_remove_var);
extern int php3int_put_shmdata(sysvshm_chunk_head *ptr,long key,char *data, long len); extern int php_put_shm_data(sysvshm_chunk_head *ptr,long key,char *data, long len);
extern long php3int_check_shmdata(sysvshm_chunk_head *ptr, long key); extern long php_check_shm_data(sysvshm_chunk_head *ptr, long key);
extern int php3int_remove_shmdata(sysvshm_chunk_head *ptr, long shm_varpos); extern int php_remove_shm_data(sysvshm_chunk_head *ptr, long shm_varpos);
extern sysvshm_module php3_sysvshm_module; extern sysvshm_module php_sysvshm;
#else #else

View file

@ -55,9 +55,9 @@ zend_module_entry *get_module() { return &sysvshm_module_entry; }
#endif #endif
THREAD_LS sysvshm_module php3_sysvshm_module; THREAD_LS sysvshm_module php_sysvshm;
static void php3i_release_sysvshm(sysvshm_shm *shm_ptr) static void php_release_sysvshm(sysvshm_shm *shm_ptr)
{ {
shmdt((void*)shm_ptr->ptr); shmdt((void*)shm_ptr->ptr);
efree(shm_ptr); efree(shm_ptr);
@ -65,10 +65,10 @@ static void php3i_release_sysvshm(sysvshm_shm *shm_ptr)
PHP_MINIT_FUNCTION(sysvshm) PHP_MINIT_FUNCTION(sysvshm)
{ {
php3_sysvshm_module.le_shm = register_list_destructors(php3i_release_sysvshm, NULL); php_sysvshm.le_shm = register_list_destructors(php_release_sysvshm, NULL);
if (cfg_get_long("sysvshm.init_mem", if (cfg_get_long("sysvshm.init_mem",
&php3_sysvshm_module.init_mem)==FAILURE) { &php_sysvshm.init_mem)==FAILURE) {
php3_sysvshm_module.init_mem=10000; php_sysvshm.init_mem=10000;
} }
return SUCCESS; return SUCCESS;
} }
@ -88,7 +88,7 @@ PHP_FUNCTION(shm_attach)
int ac = ARG_COUNT(ht); int ac = ARG_COUNT(ht);
shm_flag = 0666; shm_flag = 0666;
shm_size = php3_sysvshm_module.init_mem; shm_size = php_sysvshm.init_mem;
if(ac < 1 || ac > 3 || getParametersEx(ac, &arg_key, &arg_size, &arg_flag) == FAILURE) { if(ac < 1 || ac > 3 || getParametersEx(ac, &arg_key, &arg_size, &arg_flag) == FAILURE) {
WRONG_PARAM_COUNT; WRONG_PARAM_COUNT;
@ -142,7 +142,7 @@ PHP_FUNCTION(shm_attach)
shm_list_ptr->key = shm_key; shm_list_ptr->key = shm_key;
shm_list_ptr->id = shm_id; shm_list_ptr->id = shm_id;
shm_list_ptr->ptr = chunk_ptr; shm_list_ptr->ptr = chunk_ptr;
list_id = zend_list_insert(shm_list_ptr, php3_sysvshm_module.le_shm); list_id = zend_list_insert(shm_list_ptr, php_sysvshm.le_shm);
RETURN_LONG(list_id); RETURN_LONG(list_id);
} }
/* }}} */ /* }}} */
@ -221,7 +221,7 @@ PHP_FUNCTION(shm_put_var)
key = (*arg_key)->value.lval; key = (*arg_key)->value.lval;
shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type); shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type);
if (type!=php3_sysvshm_module.le_shm) { if (type!=php_sysvshm.le_shm) {
php_error(E_WARNING, "%d is not a SysV shared memory index", id); php_error(E_WARNING, "%d is not a SysV shared memory index", id);
RETURN_FALSE; RETURN_FALSE;
} }
@ -233,7 +233,7 @@ PHP_FUNCTION(shm_put_var)
shm_var.value.str.val=0; shm_var.value.str.val=0;
php_var_serialize(&shm_var,arg_var); php_var_serialize(&shm_var,arg_var);
/* insert serialized variable into shared memory */ /* insert serialized variable into shared memory */
ret=php3int_put_shmdata(shm_list_ptr->ptr,key,shm_var.value.str.val,shm_var.value.str.len); ret=php_put_shm_data(shm_list_ptr->ptr,key,shm_var.value.str.val,shm_var.value.str.len);
/* free string */ /* free string */
efree(shm_var.value.str.val); efree(shm_var.value.str.val);
@ -271,14 +271,14 @@ PHP_FUNCTION(shm_get_var)
key = (*arg_key)->value.lval; key = (*arg_key)->value.lval;
shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type); shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type);
if (type!=php3_sysvshm_module.le_shm) { if (type!=php_sysvshm.le_shm) {
php_error(E_WARNING, "%d is not a SysV shared memory index", id); php_error(E_WARNING, "%d is not a SysV shared memory index", id);
RETURN_FALSE; RETURN_FALSE;
} }
/* setup string-variable and serialize */ /* setup string-variable and serialize */
/* get serialized variable from shared memory */ /* get serialized variable from shared memory */
shm_varpos=php3int_check_shmdata((shm_list_ptr->ptr),key); shm_varpos=php_check_shm_data((shm_list_ptr->ptr),key);
if(shm_varpos<0) { if(shm_varpos<0) {
php_error(E_WARNING, "variable key %d doesn't exist", key); php_error(E_WARNING, "variable key %d doesn't exist", key);
@ -314,18 +314,18 @@ PHP_FUNCTION(shm_remove_var)
key = (*arg_key)->value.lval; key = (*arg_key)->value.lval;
shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type); shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type);
if (type!=php3_sysvshm_module.le_shm) { if (type!=php_sysvshm.le_shm) {
php_error(E_WARNING, "%d is not a SysV shared memory index", id); php_error(E_WARNING, "%d is not a SysV shared memory index", id);
RETURN_FALSE; RETURN_FALSE;
} }
shm_varpos=php3int_check_shmdata((shm_list_ptr->ptr),key); shm_varpos=php_check_shm_data((shm_list_ptr->ptr),key);
if(shm_varpos<0) { if(shm_varpos<0) {
php_error(E_WARNING, "variable key %d doesn't exist", key); php_error(E_WARNING, "variable key %d doesn't exist", key);
RETURN_FALSE; RETURN_FALSE;
} }
php3int_remove_shmdata((shm_list_ptr->ptr),shm_varpos); php_remove_shm_data((shm_list_ptr->ptr),shm_varpos);
RETURN_TRUE; RETURN_TRUE;
} }
/* }}} */ /* }}} */
@ -337,7 +337,7 @@ PHP_FUNCTION(shm_remove_var)
/* inserts an ascii-string into shared memory */ /* inserts an ascii-string into shared memory */
int php3int_put_shmdata(sysvshm_chunk_head *ptr,long key,char *data, long len) { int php_put_shm_data(sysvshm_chunk_head *ptr,long key,char *data, long len) {
sysvshm_chunk* shm_var; sysvshm_chunk* shm_var;
long total_size; long total_size;
long shm_varpos; long shm_varpos;
@ -348,8 +348,8 @@ int php3int_put_shmdata(sysvshm_chunk_head *ptr,long key,char *data, long len) {
return -1; /* not enough memeory */ return -1; /* not enough memeory */
} }
if((shm_varpos=php3int_check_shmdata(ptr,key))>0) { if((shm_varpos=php_check_shm_data(ptr,key))>0) {
php3int_remove_shmdata(ptr, shm_varpos); php_remove_shm_data(ptr, shm_varpos);
} }
shm_var=(sysvshm_chunk*)((char *)ptr+ptr->end); shm_var=(sysvshm_chunk*)((char *)ptr+ptr->end);
shm_var->key=key; shm_var->key=key;
@ -362,7 +362,7 @@ int php3int_put_shmdata(sysvshm_chunk_head *ptr,long key,char *data, long len) {
} }
long php3int_check_shmdata(sysvshm_chunk_head *ptr, long key) { long php_check_shm_data(sysvshm_chunk_head *ptr, long key) {
long pos; long pos;
sysvshm_chunk *shm_var; sysvshm_chunk *shm_var;
@ -382,7 +382,7 @@ long php3int_check_shmdata(sysvshm_chunk_head *ptr, long key) {
} }
int php3int_remove_shmdata(sysvshm_chunk_head *ptr, long shm_varpos) { int php_remove_shm_data(sysvshm_chunk_head *ptr, long shm_varpos) {
sysvshm_chunk *chunk_ptr, *next_chunk_ptr; sysvshm_chunk *chunk_ptr, *next_chunk_ptr;
long memcpy_len; long memcpy_len;