Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
98e9775a
Commit
98e9775a
authored
Jul 11, 2004
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use standard macro for psql binary file open. Add comment explaining
control-z requirement.
parent
c8c40bbc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
21 deletions
+16
-21
src/bin/psql/command.c
src/bin/psql/command.c
+3
-3
src/bin/psql/common.h
src/bin/psql/common.h
+1
-13
src/bin/psql/copy.c
src/bin/psql/copy.c
+2
-2
src/bin/psql/psqlscan.l
src/bin/psql/psqlscan.l
+2
-2
src/include/c.h
src/include/c.h
+8
-1
No files found.
src/bin/psql/command.c
View file @
98e9775a
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.11
8 2004/07/11 00:54:5
5 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.11
9 2004/07/11 13:29:1
5 momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
...
...
@@ -1197,7 +1197,7 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
if
(
!
error
)
{
#endif
stream
=
fopen
(
fname
,
R_TEXTFILE
);
stream
=
fopen
(
fname
,
PG_BINARY_R
);
if
(
!
stream
)
{
psql_error
(
"%s: %s
\n
"
,
fname
,
strerror
(
errno
));
...
...
@@ -1262,7 +1262,7 @@ process_file(char *filename)
if
(
!
filename
)
return
false
;
fd
=
fopen
(
filename
,
R_TEXTFILE
);
fd
=
fopen
(
filename
,
PG_BINARY_R
);
if
(
!
fd
)
{
...
...
src/bin/psql/common.h
View file @
98e9775a
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.3
6 2004/07/11 00:54:5
5 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.3
7 2004/07/11 13:29:1
5 momjian Exp $
*/
#ifndef COMMON_H
#define COMMON_H
...
...
@@ -62,16 +62,4 @@ 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 */
src/bin/psql/copy.c
View file @
98e9775a
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.4
8 2004/07/11 00:54:5
5 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.4
9 2004/07/11 13:29:1
5 momjian Exp $
*/
#include "postgres_fe.h"
#include "copy.h"
...
...
@@ -516,7 +516,7 @@ do_copy(const char *args)
if
(
options
->
from
)
{
if
(
options
->
file
)
copystream
=
fopen
(
options
->
file
,
R_TEXTFILE
);
copystream
=
fopen
(
options
->
file
,
PG_BINARY_R
);
else
if
(
!
options
->
psql_inout
)
copystream
=
pset
.
cur_cmd_source
;
else
...
...
src/bin/psql/psqlscan.l
View file @
98e9775a
...
...
@@ -31,7 +31,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.
4 2004/07/11 00:54:5
5 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.
5 2004/07/11 13:29:1
5 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1284,7 +1284,7 @@ psql_scan_slash_option(PsqlScanState state,
char buf[512];
size_t result;
fd = popen(cmd,
R_TEXTFILE
);
fd = popen(cmd,
PG_BINARY_R
);
if (!fd)
{
psql_error("%s: %s\n", cmd, strerror(errno));
...
...
src/include/c.h
View file @
98e9775a
...
...
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/c.h,v 1.16
5 2004/05/21 05:08:03 tgl
Exp $
* $PostgreSQL: pgsql/src/include/c.h,v 1.16
6 2004/07/11 13:29:16 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -671,6 +671,13 @@ typedef NameData *Name;
* ----------------------------------------------------------------
*/
/*
* NOTE: this is also used for opening text files.
* 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.
*/
#if defined(__CYGWIN__) || defined(WIN32)
#define PG_BINARY O_BINARY
#define PG_BINARY_R "rb"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment