Re: [HACKERS] use of pager on Windows psql

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] use of pager on Windows psql
Date: 2008-05-18 06:53:33
Message-ID: 482FD26D.5030603@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bruce Momjian wrote:
> Andrew Dunstan wrote:
>
>>> Not sure why ware are not. Should we enabled that code on Win32 and see
>>> how it works? Can you test it? Was it some MinGW limitation? I do see
>>> isatty() being used on lots of platforms.
>>>
>>> This is kind of odd. Ah, I bet it came from libpq's PQprint(), which I
>>> think we had working on Win32 long before we had psql working and
>>> perhaps I copied it from there. I don't see the Win32 checks around
>>> isatty() anywhere else.
>>>
>>>
>>>
>>>> In fact, it looks to me like it would be much more sensible to #include
>>>> "settings.h" and then simply test pset.notty for all platforms.
>>>>
>>>>
>>> Yes, we could do that but does the isatty() value ever change while psql
>>> is running? When you do '\g filename' does stdout then have isatty as
>>> false?
>>>
>>>
>> Good point. I think the best thing would just be to remove the #ifndef
>> WIN32 / #endif lines
>>
>
> OK, patch applied to remove the Win32 test in both places.
>
>
>

This broke the buildfarm and finally explains the following kluge which
has been puzzling me for four years:

/*
* for some reason MinGW (and MSVC) outputs an extra newline, so
this
* suppresses it
*/
#ifndef WIN32
fputc('\n', fout);
#endif

I have removed the kluge (and yes, I tested it).

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2008-05-18 07:18:13 Re: New DTrace probes proposal
Previous Message Marko Kreen 2008-05-18 05:44:29 Re: [rfc,patch] PL/Proxy in core

Browse pgsql-patches by date

  From Date Subject
Next Message Tatsuo Ishii 2008-05-18 11:51:29 WITH RECURSIVE patch V0.1
Previous Message Euler Taveira de Oliveira 2008-05-18 05:13:48 Re: lc_time and localized dates