Hi,

While following suggestions from Arthur Zakirov on a patch for
pg_basebackup I found that we are using isatty() in multiple places, but
we don't distinguish the WIN32 code which should use _isatty() as per [1].

It's true that isatty() is still supported by Visual C (else we'd fail
to compile) but per the documentation it could get removed at any moment.

Instead of just using #ifdef in my patch, I thought we could have a
cleaner patch which would cover all calls for isatty().

Attached is a patch for src/include/ports/win32.h

[1]: https://msdn.microsoft.com/en-us/library/ms235388.aspx

P.D.: Which would be the correct usage, per-standards: with or without
the _ prefix?

-- 
Martín Marqués                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
diff --git a/src/include/port/win32.h b/src/include/port/win32.h
new file mode 100644
index 611e04f..829624c
*** a/src/include/port/win32.h
--- b/src/include/port/win32.h
***************
*** 59,61 ****
--- 59,70 ----
  #else
  #define PGDLLEXPORT
  #endif
+ 
+ /*
+  * define isatty() to be _isatty() on WIN32 platforms
+  *  https://msdn.microsoft.com/en-us/library/ms235388.aspx
+  */
+ 
+ #ifdef WIN32
+ #define  isatty(fd)  _isatty(fd)
+ #endif

Reply via email to