From 7a16fdbd27903c5b91dcab88868a04555d269a4a Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Wed, 8 Jan 2003 00:44:58 +0000 Subject: MFH --- sapi/cli/php_cli.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sapi/cli/php_cli.c') diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 7fae3020b1..20a2b6bb36 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -697,6 +697,13 @@ int main(int argc, char *argv[]) while (c != 10 && c != 13) { c = fgetc(file_handle.handle.fp); /* skip to end of line */ } + /* handle situations where line is terminated by \r\n */ + if (c == 13) { + if (fgetc(file_handle.handle.fp) != 10) { + long pos = ftell(file_handle.handle.fp); + fseek(file_handle.handle.fp, pos - 1, SEEK_SET); + } + } CG(zend_lineno) = -2; } else { rewind(file_handle.handle.fp); -- cgit v1.2.1