1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-12 02:37:31 +03:00

Open files in binary mode on Win32 so control-z isn't seen as EOF.

This commit is contained in:
Bruce Momjian
2004-07-11 00:54:55 +00:00
parent e5ca4bde79
commit 330c6c42be
4 changed files with 20 additions and 8 deletions

View File

@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.35 2004/04/19 17:42:58 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.36 2004/07/11 00:54:55 momjian Exp $
*/
#ifndef COMMON_H
#define COMMON_H
@@ -62,4 +62,16 @@ extern char parse_char(char **buf);
extern char *expand_tilde(char **filename);
/*
* WIN32 treats Control-Z as EOF in files opened in text mode.
* Therefore, we open files in binary mode on Win32 so we can read
* literal control-Z. The other affect is that we see CRLF, but
* that is OK because we can already handle those cleanly.
*/
#ifndef WIN32
#define R_TEXTFILE "r"
#else
#define R_TEXTFILE "rb"
#endif
#endif /* COMMON_H */