CVS update: php31/ext/standard
| From: | shane | Date: | Fri, 14 Aug 1998 04:32:06 +0000 |
| Subject: | CVS update: php31/ext/standard | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-207@lists.php.net to get a copy of this message | ||
Date: Friday August 14, 1998 @ 0:32
Author: shane
Update of /repository/php31/ext/standard
In directory asf:/tmp/cvs-serv18009/ext/standard
Modified Files:
dl.c file.c filestat.c string.c
Log Message:
3.0->3.1 patches
Index: php31/ext/standard/dl.c
diff -c php31/ext/standard/dl.c:2.0 php31/ext/standard/dl.c:2.1
*** php31/ext/standard/dl.c:2.0 Fri Jul 3 09:14:20 1998
--- php31/ext/standard/dl.c Fri Aug 14 00:32:02 1998
***************
*** 89,95 ****
convert_to_string(file);
! if (GLOBAL(php3_ini)->safe_mode) {
php3_error(E_ERROR, "Dynamically loaded extensions aren't allowed when running in SAFE
MODE.");
} else {
php3_dl(file->value.str.val,MODULE_TEMPORARY,return_value);
--- 89,97 ----
convert_to_string(file);
! if (!GLOBAL(php3_ini)->enable_dl) {
! php3_error(E_ERROR, "Dynamically loaded extentions aren't enabled.");
! } else if (GLOBAL(php3_ini)->safe_mode) {
php3_error(E_ERROR, "Dynamically loaded extensions aren't allowed when running in SAFE
MODE.");
} else {
php3_dl(file->value.str.val,MODULE_TEMPORARY,return_value);
Index: php31/ext/standard/file.c
diff -c php31/ext/standard/file.c:2.0 php31/ext/standard/file.c:2.1
*** php31/ext/standard/file.c:2.0 Fri Jul 3 09:14:22 1998
--- php31/ext/standard/file.c Fri Aug 14 00:32:05 1998
***************
*** 26,32 ****
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
! /* $Id: file.c,v 2.0 1998/07/03 13:14:22 rasmus Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
--- 26,32 ----
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
! /* $Id: file.c,v 2.1 1998/08/14 04:32:05 shane Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
***************
*** 81,86 ****
--- 81,176 ----
int wsa_fp; /*to handle reading and writing to windows sockets*/
static int pclose_ret;
#endif
+
+ #if !HAVE_TEMPNAM
+ /*
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+ #include <unistd.h>
+
+ #ifndef MAXPATHLEN
+ # ifdef PATH_MAX
+ # define MAXPATHLEN PATH_MAX
+ # else
+ # define MAXPATHLEN 255
+ # endif
+ #endif
+
+ char *
+ tempnam(const char *dir, const char *pfx)
+ {
+ int save_errno;
+ char *f, *name;
+ static char path_tmp[] = "/tmp";
+
+ if (!(name = emalloc(MAXPATHLEN))) {
+ return(NULL);
+ }
+
+ if (!pfx) {
+ pfx = "tmp.";
+ }
+
+ if (f = getenv("TMPDIR")) {
+ (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
+ *(f + strlen(f) - 1) == '/'? "":
"/", pfx);
+ if (f = mktemp(name))
+ return(f);
+ }
+
+ if (f = (char *)dir) {
+ (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
+ *(f + strlen(f) - 1) == '/'? "":
"/", pfx);
+ if (f = mktemp(name))
+ return(f);
+ }
+
+ f = P_tmpdir;
+ (void)snprintf(name, MAXPATHLEN, "%s%sXXXXXX", f, pfx);
+ if (f = mktemp(name))
+ return(f);
+
+ f = path_tmp;
+ (void)snprintf(name, MAXPATHLEN, "%s%sXXXXXX", f, pfx);
+ if (f = mktemp(name))
+ return(f);
+
+ save_errno = errno;
+ efree(name);
+ errno = save_errno;
+ return(NULL);
+ }
+ #endif
function_entry php3_file_functions[] = {
{"pclose", php3_pclose, NULL},
Index: php31/ext/standard/filestat.c
diff -c php31/ext/standard/filestat.c:2.2 php31/ext/standard/filestat.c:2.3
*** php31/ext/standard/filestat.c:2.2 Tue Aug 11 11:08:11 1998
--- php31/ext/standard/filestat.c Fri Aug 14 00:32:05 1998
***************
*** 27,39 ****
+----------------------------------------------------------------------+
*/
! /* $Id: filestat.c,v 2.2 1998/08/11 15:08:11 rasmus Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
#include "php.h"
#include "internal_functions.h"
#include "safe_mode.h"
#include <stdlib.h>
#include <sys/stat.h>
--- 27,40 ----
+----------------------------------------------------------------------+
*/
! /* $Id: filestat.c,v 2.3 1998/08/14 04:32:05 shane Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
#include "php.h"
#include "internal_functions.h"
#include "safe_mode.h"
+ #include "fopen-wrappers.h"
#include <stdlib.h>
#include <sys/stat.h>
***************
*** 147,152 ****
--- 148,155 ----
RETURN_FALSE;
}
/* #endif */
+ /* Check the basedir */
+ if (_php3_check_fopen_basedir(filename->value.str.val)) RETURN_FALSE;
ret = chown(filename->value.str.val, -1, gid);
if (ret == -1) {
***************
*** 189,194 ****
--- 192,200 ----
RETURN_FALSE;
}
+ /* Check the basedir */
+ if (_php3_check_fopen_basedir(filename->value.str.val)) RETURN_FALSE;
+
ret = chown(filename->value.str.val, uid, -1);
if (ret == -1) {
php3_error(E_WARNING, "chown failed: %s", strerror(errno));
***************
*** 217,222 ****
--- 223,231 ----
RETURN_FALSE;
}
+ /* Check the basedir */
+ if (_php3_check_fopen_basedir(filename->value.str.val)) RETURN_FALSE;
+
ret = chmod(filename->value.str.val, mode->value.lval);
if (ret == -1) {
php3_error(E_WARNING, "chmod failed: %s", strerror(errno));
***************
*** 265,270 ****
--- 274,282 ----
RETURN_FALSE;
}
+ /* Check the basedir */
+ if (_php3_check_fopen_basedir(filename->value.str.val)) RETURN_FALSE;
+
/* create the file if it doesn't exist already */
ret = stat(filename->value.str.val, &sb);
if (ret == -1) {
***************
*** 429,434 ****
--- 441,452 ----
RETURN_LONG((long)GLOBAL(sb).st_ctime);
break;
case 8: /* filetype */
+ {
+ struct stat lsb;
+ lstat(GLOBAL(CurrentStatFile),&lsb);
+ if ((lsb.st_mode&S_IFMT) == S_IFLNK) {
+ RETURN_STRING("link",1);
+ }
switch(GLOBAL(sb).st_mode&S_IFMT) {
case S_IFIFO:
RETURN_STRING("fifo",1);
***************
*** 443,459 ****
RETURN_STRING("block",1);
break;
case S_IFREG:
! lstat(GLOBAL(CurrentStatFile),&GLOBAL(sb));
! if ((GLOBAL(sb).st_mode&S_IFMT) == S_IFLNK) {
! RETURN_STRING("link",1);
! } else {
! RETURN_STRING("file",1);
! }
break;
default:
php3_error(E_WARNING,"Unknown file type (%d)",GLOBAL(sb).st_mode&S_IFMT);
RETURN_STRING("unknown",1);
break;
}
break;
case 9: /*is writable*/
--- 461,473 ----
RETURN_STRING("block",1);
break;
case S_IFREG:
! RETURN_STRING("file",1);
break;
default:
php3_error(E_WARNING,"Unknown file type (%d)",GLOBAL(sb).st_mode&S_IFMT);
RETURN_STRING("unknown",1);
break;
+ }
}
break;
case 9: /*is writable*/
Index: php31/ext/standard/string.c
diff -c php31/ext/standard/string.c:2.0 php31/ext/standard/string.c:2.1
*** php31/ext/standard/string.c:2.0 Fri Jul 3 09:14:38 1998
--- php31/ext/standard/string.c Fri Aug 14 00:32:06 1998
***************
*** 30,36 ****
*/
! /* $Id: string.c,v 2.0 1998/07/03 13:14:38 rasmus Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
--- 30,36 ----
*/
! /* $Id: string.c,v 2.1 1998/08/14 04:32:06 shane Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
***************
*** 69,74 ****
--- 69,111 ----
RETURN_LONG(php3_binary_strcmp(s1,s2));
}
+
+ void php3_strcasecmp(INTERNAL_FUNCTION_PARAMETERS)
+ {
+ pval *s1,*s2;
+
+ if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &s1, &s2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_string(s1);
+ convert_to_string(s2);
+ RETURN_LONG(strcasecmp(s1->value.str.val,s2->value.str.val));
+ }
+
+ void php3_strspn(INTERNAL_FUNCTION_PARAMETERS)
+ {
+ pval *s1,*s2;
+
+ if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &s1, &s2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_string(s1);
+ convert_to_string(s2);
+ RETURN_LONG(strspn(s1->value.str.val,s2->value.str.val));
+ }
+
+ void php3_strcspn(INTERNAL_FUNCTION_PARAMETERS)
+ {
+ pval *s1,*s2;
+
+ if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &s1, &s2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_string(s1);
+ convert_to_string(s2);
+ RETURN_LONG(strcspn(s1->value.str.val,s2->value.str.val));
+ }
+
void php3_chop(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
***************
*** 670,676 ****
void php3_ucfirst(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
--- 707,712 ----
***************
*** 684,689 ****
--- 720,749 ----
RETVAL_STRING(arg->value.str.val,1);
}
+ void php3_ucwords(INTERNAL_FUNCTION_PARAMETERS)
+ {
+ pval *arg;
+ char *r;
+
+ if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_string(arg);
+
+ if (!*arg->value.str.val) {
+ RETURN_FALSE;
+ }
+ *arg->value.str.val = toupper(*arg->value.str.val);
+ r=arg->value.str.val;
+ while((r=strstr(r," "))){
+ if(*(r+1)){
+ r++;
+ *r=toupper(*r);
+ }
+ }
+ RETVAL_STRING(arg->value.str.val,1);
+ }
+
void php3_strtr(INTERNAL_FUNCTION_PARAMETERS)
{ /* strtr(STRING,FROM,TO) */
***************
*** 771,784 ****
}
s = string;
t = string;
! while (l > 0 && *t != '\0') {
if (*t == escape_char) {
t++; /* skip the slash */
if (len != NULL)
(*len)--;
l--;
! if (l > 0 && *t != '\0') {
! *s++ = *t++; /* preserve the next character */
l--;
}
} else {
--- 831,849 ----
}
s = string;
t = string;
! while (l > 0) {
if (*t == escape_char) {
t++; /* skip the slash */
if (len != NULL)
(*len)--;
l--;
! if (l > 0) {
! if(*t=='0') {
! *s++='\0';
! t++;
! } else {
! *s++ = *t++; /* preserve the next character */
! }
l--;
}
} else {
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net