CVS update: php3/functions
| From: | kk | Date: | Wed, 09 Jun 1999 11:20:40 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-6763@lists.php.net to get a copy of this message | ||
Date: Wednesday June 9, 1999 @ 7:20
Author: kk
Update of /repository/php3/functions
In directory php:/tmp/cvs-serv890/functions
Modified Files:
datetime.c file.c
Log Message:
- Fix bug 1517.
- Add optional delimiter character to fgetcsv() as third parameter.
- Change documentation to reflect that.
Index: php3/functions/datetime.c
diff -u php3/functions/datetime.c:1.59 php3/functions/datetime.c:1.60
--- php3/functions/datetime.c:1.59 Tue Jun 8 10:12:37 1999
+++ php3/functions/datetime.c Wed Jun 9 07:20:39 1999
@@ -30,7 +30,7 @@
*/
-/* $Id: datetime.c,v 1.59 1999/06/08 14:12:37 cmv Exp $ */
+/* $Id: datetime.c,v 1.60 1999/06/09 11:20:39 kk Exp $ */
#ifdef THREAD_SAFE
@@ -67,6 +67,7 @@
#ifndef HAVE_TM_ZONE
#ifndef _TIMEZONE
extern time_t timezone;
+extern char *tzname[2];
#endif
#endif
@@ -487,7 +488,11 @@
strcat(return_value->value.str.val, tmp_buff);
break;
case 'T': /* timezone name */
+#if HAVE_TM_ZONE
strcat(return_value->value.str.val, ta->tm_zone);
+#else
+ strcat(return_value->value.str.val, tzname[0]);
+#endif
break;
default:
length = strlen(return_value->value.str.val);
Index: php3/functions/file.c
diff -u php3/functions/file.c:1.215 php3/functions/file.c:1.216
--- php3/functions/file.c:1.215 Tue Jun 8 11:02:41 1999
+++ php3/functions/file.c Wed Jun 9 07:20:39 1999
@@ -26,7 +26,7 @@
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.215 1999/06/08 15:02:41 sas Exp $ */
+/* $Id: file.c,v 1.216 1999/06/09 11:20:39 kk Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
@@ -1454,11 +1454,11 @@
get line from file pointer and parse for CSV fields */
void php3_fgetcsv(INTERNAL_FUNCTION_PARAMETERS) {
char *temp, *tptr, *bptr;
- char delimiter = ','; /* allow this to be set as parameter if required in future
version? */
+ char delimiter = ','; /* allow this to be set as parameter */
/* first section exactly as php3_fgetss */
- pval *fd, *bytes;
+ pval *fd, *bytes, *p_delim;
FILE *fp;
int id, len, type;
char *buf;
@@ -1466,8 +1466,29 @@
int *sock,socketd=0;
TLS_VARS;
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &fd, &bytes) == FAILURE) {
- WRONG_PARAM_COUNT;
+ switch(ARG_COUNT(ht)) {
+ case 2:
+ if (getParameters(ht, 2, &fd, &bytes) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ break;
+
+ case 3:
+ if (getParameters(ht, 3, &fd, &bytes, &p_delim) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_string(p_delim);
+ /* Make sure that there is at least one character in string */
+ if (p_delim->value.str.len < 1) {
+ WRONG_PARAM_COUNT;
+ }
+ /* use first character from string */
+ delimiter = p_delim->value.str.val[0];
+ break;
+
+ default:
+ WRONG_PARAM_COUNT;
+ break;
}
convert_to_long(fd);