openpty: provide a stub on mingw
authorEric Blake <eblake@redhat.com>
Wed, 9 Nov 2011 18:47:22 +0000 (11:47 -0700)
committerEric Blake <eblake@redhat.com>
Wed, 9 Nov 2011 18:47:22 +0000 (11:47 -0700)
commit822c53fb8aac23cad1ee4918a85e3843f0621eaa
treec207aa0c8bce196aa75d77fa0fa5e6a265fa7979
parent7a95153e34b888730afdce3467653f70c4c724e1
openpty: provide a stub on mingw

On mingw, the compiler complained that 'struct termios' and
'struct winsize' were declared in the function prototype, then
failed to compile due to missing TCSAFLUSH.  Since we can't
emulate ptys on mingw, it's better to just make this module
be a stub that compiles but gracefully fails.

This patch assumes that the only portable way to use openpty()
is with the fourth and fifth arguments being NULL ('struct termios'
cannot be portably initialized in a standard-compliant manner
except by open(O_TTY_INIT)/tcgetattr(), and 'struct winsize' is
not standardized); for now, applications that want to alter termios
settings still have the burden of conditional compilation to avoid
the missing tcgetattr() on mingw.

* lib/pty.in.h (includes): Provide forward declarations.
* lib/openpty.c (openpty) [mingw]: Provide ENOSYS stub.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
lib/openpty.c
lib/pty.in.h