Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit64e7c8a

Browse files
committed
Use DEVTTY as 'con' on Win32 as a replacement for /dev/tty.
1 parent26d6054 commit64e7c8a

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

‎src/bin/psql/command.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.162 2006/03/03 23:49:12 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.163 2006/03/04 04:30:40 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"command.h"
@@ -753,11 +753,7 @@ exec_command(const char *cmd,
753753

754754
expand_tilde(&fname);
755755
/* This scrolls off the screen when using /dev/tty */
756-
#ifndefWIN32
757-
success=saveHistory(fname ?fname :"/dev/tty");
758-
#else
759-
success=saveHistory(fname ?fname :stderr);
760-
#endif
756+
success=saveHistory(fname ?fname :DEVTTY);
761757
if (success&& !quiet&&fname)
762758
printf(gettext("Wrote history to file \"%s/%s\".\n"),
763759
pset.dirname ?pset.dirname :".",fname);

‎src/include/port.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.87 2005/12/06 18:35:10 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.88 2006/03/04 04:30:40 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -84,8 +84,11 @@ extern int find_other_exec(const char *argv0, const char *target,
8484

8585
#if defined(WIN32)&& !defined(__CYGWIN__)
8686
#defineDEVNULL "nul"
87+
/* "con" does not work from the MinGW 1.0.10 console. */
88+
#defineDEVTTY"con"
8789
#else
8890
#defineDEVNULL "/dev/null"
91+
#defineDEVTTY "/dev/tty"
8992
#endif
9093

9194
/*

‎src/port/sprompt.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/sprompt.c,v 1.13 2006/03/03 23:49:12 momjian Exp $
11+
* $PostgreSQL: pgsql/src/port/sprompt.c,v 1.14 2006/03/04 04:30:41 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -40,8 +40,8 @@ simple_prompt(const char *prompt, int maxlen, bool echo)
4040
{
4141
intlength;
4242
char*destination;
43-
FILE*termin=NULL,
44-
*termout=NULL;
43+
FILE*termin,
44+
*termout;
4545

4646
#ifdefHAVE_TERMIOS_H
4747
structtermiost_orig,
@@ -63,14 +63,8 @@ simple_prompt(const char *prompt, int maxlen, bool echo)
6363
* Do not try to collapse these into one "w+" mode file. Doesn't work on
6464
* some platforms (eg, HPUX 10.20).
6565
*/
66-
#ifndefWIN32
67-
/*
68-
*Some win32 platforms actually have a /dev/tty file, but it isn't
69-
*a device file, and it doesn't work as expected, so we avoid trying.
70-
*/
71-
termin=fopen("/dev/tty","r");
72-
termout=fopen("/dev/tty","w");
73-
#endif
66+
termin=fopen(DEVTTY,"r");
67+
termout=fopen(DEVTTY,"w");
7468
if (!termin|| !termout)
7569
{
7670
if (termin)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp