From 4cdf8c7c36c56bda0518a49bc594b653665f1883 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 24 Sep 2002 02:46:38 +0000 Subject: [PATCH] Fix EOL markers for file() so that Mac EOL work correctly. --- ext/standard/file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/standard/file.c b/ext/standard/file.c index 12d15a3b45..c19a0977bd 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -468,6 +468,7 @@ PHP_FUNCTION(file) char *slashed, *target_buf; register int i = 0; int target_len, len; + char eol_marker = '\n'; zend_bool use_include_path = 0; zend_bool reached_eof = 0; php_stream *stream; @@ -507,9 +508,14 @@ PHP_FUNCTION(file) reached_eof = 1; } } + + /* mini-hack because I don't feel like re-writing this whole function */ + if (stream->flags & PHP_STREAM_FLAG_EOL_MAC) + eol_marker = '\r'; + if (!reached_eof) { target_len += strlen(target_buf+target_len); - if (target_buf[target_len-1] != '\n') { + if (target_buf[target_len-1] != eol_marker) { continue; } } -- 2.40.0