Re: Fix for /dev/tty on Win32

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Fix for /dev/tty on Win32
Дата
Msg-id 200603050531.k255Vsh00727@candle.pha.pa.us
обсуждение исходный текст
Ответ на Fix for /dev/tty on Win32  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-patches
Bruce Momjian wrote:
> I found a better solution to the /dev/tty on Win32.  I used 'con' which
> works fine on Win32 except using the Msys 1.0.10 console, but it is
> probably the best solution.  Can someone test if newer Msys consoles
> work with this?
>
> Added DEVTTY macro for simplicity.
>
> Applied to 8.0.X, 8.1.X, and HEAD.

I am attaching a new applied patch that reverts "msys" so it doesn't use
'con'.  This means we now actually prompt from the terminal on Win32
(except for msys consoles).

--
  Bruce Momjian   http://candle.pha.pa.us
  SRA OSS, Inc.   http://www.sraoss.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/include/port.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/port.h,v
retrieving revision 1.88
diff -c -c -r1.88 port.h
*** src/include/port.h    4 Mar 2006 04:30:40 -0000    1.88
--- src/include/port.h    5 Mar 2006 05:29:09 -0000
***************
*** 84,90 ****

  #if defined(WIN32) && !defined(__CYGWIN__)
  #define DEVNULL "nul"
! /* "con" does not work from the MinGW 1.0.10 console. */
  #define DEVTTY    "con"
  #else
  #define DEVNULL "/dev/null"
--- 84,90 ----

  #if defined(WIN32) && !defined(__CYGWIN__)
  #define DEVNULL "nul"
! /* "con" does not work from the Msys 1.0.10 console (part of MinGW). */
  #define DEVTTY    "con"
  #else
  #define DEVNULL "/dev/null"
Index: src/port/sprompt.c
===================================================================
RCS file: /cvsroot/pgsql/src/port/sprompt.c,v
retrieving revision 1.14
diff -c -c -r1.14 sprompt.c
*** src/port/sprompt.c    4 Mar 2006 04:30:41 -0000    1.14
--- src/port/sprompt.c    5 Mar 2006 05:29:10 -0000
***************
*** 65,71 ****
       */
      termin = fopen(DEVTTY, "r");
      termout = fopen(DEVTTY, "w");
!     if (!termin || !termout)
      {
          if (termin)
              fclose(termin);
--- 65,76 ----
       */
      termin = fopen(DEVTTY, "r");
      termout = fopen(DEVTTY, "w");
!     if (!termin || !termout
! #ifdef WIN32
!         /* See DEVTTY comment for msys */
!         || (getenv("OSTYPE") && strcmp(getenv("OSTYPE"), "msys") == 0)
! #endif
!         )
      {
          if (termin)
              fclose(termin);

В списке pgsql-patches по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: TODO-Item: include for guc
Следующее
От: "Pavel Stehule"
Дата:
Сообщение: Re: INS/UPD/DEL RETURNING for 8.2