X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fopenpty.c;h=c396a962cd6176ac095f39953d72f1355c5ec154;hb=bbfcd2f1a92c9bdbb8d7d7d0a8a8c6665c316747;hp=c6e75c6241243c118f68860a6bc53850e53df41d;hpb=3e8ea588ade116ed7c16d356a76dfcd0611b93cf;p=gnulib.git diff --git a/lib/openpty.c b/lib/openpty.c index c6e75c624..c396a962c 100644 --- a/lib/openpty.c +++ b/lib/openpty.c @@ -1,5 +1,5 @@ /* Open a pseudo-terminal. - Copyright (C) 2010-2011 Free Software Foundation, Inc. + Copyright (C) 2010-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,9 +32,25 @@ rpl_openpty (int *amaster, int *aslave, char *name, (struct winsize *) winp); } -#else /* AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, mingw */ +#elif (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ /* mingw */ + +# include + +int +openpty (int *amaster _GL_UNUSED, int *aslave _GL_UNUSED, + char *name _GL_UNUSED, + struct termios const *termp _GL_UNUSED, + struct winsize const *winp _GL_UNUSED) +{ + /* Mingw lacks pseudo-terminals altogether. */ + errno = ENOSYS; + return -1; +} + +#else /* AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10 */ # include +# include # include # include # include @@ -59,45 +75,11 @@ openpty (int *amaster, int *aslave, char *name, # else /* AIX 5.1, HP-UX 11, Solaris 10, mingw */ -# if HAVE_POSIX_OPENPT /* Solaris 10 */ - + /* This call uses the 'posix_openpt' module. */ master = posix_openpt (O_RDWR | O_NOCTTY); if (master < 0) return -1; -# else /* AIX 5.1, HP-UX 11, Solaris 9, mingw */ - -# ifdef _AIX /* AIX */ - - master = open ("/dev/ptc", O_RDWR | O_NOCTTY); - if (master < 0) - return -1; - -# else /* HP-UX 11, Solaris 9, mingw */ - - /* HP-UX, Solaris have /dev/ptmx. - HP-UX also has /dev/ptym/clone, but this should not be needed. - Linux also has /dev/ptmx, but Linux already has openpty(). - MacOS X also has /dev/ptmx, but MacOS X already has openpty(). - OSF/1 also has /dev/ptmx and /dev/ptmx_bsd, but OSF/1 already has - openpty(). */ - master = open ("/dev/ptmx", O_RDWR | O_NOCTTY); - if (master < 0) - return -1; - -# endif - -# endif - - /* If all this does not work, we could try to open, one by one: - - On MacOS X: /dev/pty[p-w][0-9a-f] - - On *BSD: /dev/pty[p-sP-S][0-9a-v] - - On Minix: /dev/pty[p-q][0-9a-f] - - On AIX: /dev/ptyp[0-9a-f] - - On HP-UX: /dev/pty[p-r][0-9a-f] - - On OSF/1: /dev/pty[p-q][0-9a-f] - - On Solaris: /dev/pty[p-r][0-9a-f] - */ # endif /* This call does not require a dependency to the 'grantpt' module,