summaryrefslogtreecommitdiff
path: root/ext/standard/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/file.c')
-rw-r--r--ext/standard/file.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 744fa21d1c..0bbb23f48c 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -1976,17 +1976,14 @@ PHP_FUNCTION(fputcsv)
Get line from file pointer and parse for CSV fields */
PHP_FUNCTION(fgetcsv)
{
- char *temp, *tptr, *bptr, *line_end, *limit;
char delimiter = ','; /* allow this to be set as parameter */
char enclosure = '"'; /* allow this to be set as parameter */
- const char escape_char = '\\';
/* first section exactly as php_fgetss */
long len = 0;
- size_t buf_len, temp_len, line_end_len;
+ size_t buf_len;
char *buf;
php_stream *stream;
- int inc_len;
{
zval *fd, **len_zv = NULL;
@@ -2048,6 +2045,23 @@ PHP_FUNCTION(fgetcsv)
RETURN_FALSE;
}
}
+
+ php_fgetcsv(stream, delimiter, enclosure, buf_len, buf, return_value TSRMLS_CC);
+}
+/* }}} */
+
+
+PHPAPI void php_fgetcsv(php_stream *stream, /* {{{ */
+ char delimiter, char enclosure,
+ size_t buf_len, char *buf,
+ zval *return_value TSRMLS_DC)
+{
+ char *temp, *tptr, *bptr, *line_end, *limit;
+ const char escape_char = '\\';
+
+ size_t temp_len, line_end_len;
+ int inc_len;
+
/* initialize internal state */
php_mblen(NULL, 0);