File tree 4 files changed +20
-8
lines changed 4 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 3
3
*
4
4
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
5
5
*
6
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.117 2004/06/18 06:14:04 tgl Exp $
6
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.118 2004/07/11 00:54:55 momjian Exp $
7
7
*/
8
8
#include "postgres_fe.h"
9
9
#include "command.h"
@@ -1197,7 +1197,7 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
1197
1197
if (!error )
1198
1198
{
1199
1199
#endif
1200
- stream = fopen (fname , "r" );
1200
+ stream = fopen (fname , R_TEXTFILE );
1201
1201
if (!stream )
1202
1202
{
1203
1203
psql_error ("%s: %s\n" , fname , strerror (errno ));
@@ -1262,7 +1262,7 @@ process_file(char *filename)
1262
1262
if (!filename )
1263
1263
return false;
1264
1264
1265
- fd = fopen (filename , "r" );
1265
+ fd = fopen (filename , R_TEXTFILE );
1266
1266
1267
1267
if (!fd )
1268
1268
{
Original file line number Diff line number Diff line change 3
3
*
4
4
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
5
5
*
6
- * $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.35 2004/04/19 17:42:58 momjian Exp $
6
+ * $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.36 2004/07/11 00:54:55 momjian Exp $
7
7
*/
8
8
#ifndef COMMON_H
9
9
#define COMMON_H
@@ -62,4 +62,16 @@ extern char parse_char(char **buf);
62
62
63
63
extern char * expand_tilde (char * * filename );
64
64
65
+ /*
66
+ * WIN32 treats Control-Z as EOF in files opened in text mode.
67
+ * Therefore, we open files in binary mode on Win32 so we can read
68
+ * literal control-Z. The other affect is that we see CRLF, but
69
+ * that is OK because we can already handle those cleanly.
70
+ */
71
+ #ifndef WIN32
72
+ #define R_TEXTFILE "r"
73
+ #else
74
+ #define R_TEXTFILE "rb"
75
+ #endif
76
+
65
77
#endif /* COMMON_H */
Original file line number Diff line number Diff line change 3
3
*
4
4
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
5
5
*
6
- * $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.47 2004/05/07 00:24:58 tgl Exp $
6
+ * $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.48 2004/07/11 00:54:55 momjian Exp $
7
7
*/
8
8
#include "postgres_fe.h"
9
9
#include "copy.h"
@@ -516,7 +516,7 @@ do_copy(const char *args)
516
516
if (options -> from )
517
517
{
518
518
if (options -> file )
519
- copystream = fopen (options -> file , "r" );
519
+ copystream = fopen (options -> file , R_TEXTFILE );
520
520
else if (!options -> psql_inout )
521
521
copystream = pset .cur_cmd_source ;
522
522
else
Original file line number Diff line number Diff line change 31
31
* Portions Copyright (c) 1994, Regents of the University of California
32
32
*
33
33
* IDENTIFICATION
34
- * $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.3 2004/05/07 00:24:58 tgl Exp $
34
+ * $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.4 2004/07/11 00:54:55 momjian Exp $
35
35
*
36
36
*-------------------------------------------------------------------------
37
37
*/
@@ -1284,7 +1284,7 @@ psql_scan_slash_option(PsqlScanState state,
1284
1284
char buf[512 ];
1285
1285
size_t result;
1286
1286
1287
- fd = popen (cmd, " r " );
1287
+ fd = popen (cmd, R_TEXTFILE );
1288
1288
if (!fd)
1289
1289
{
1290
1290
psql_error (" %s: %s\n " , cmd, strerror (errno));
You can’t perform that action at this time.
0 commit comments