Fix build of posix io on sun.
authorphil@softsynth.com <phil@softsynth.com@b0a0988d-7f52-0410-8c73-4f6cdee1a2cf>
Tue, 17 Mar 2009 22:40:47 +0000 (22:40 +0000)
committerphil@softsynth.com <phil@softsynth.com@b0a0988d-7f52-0410-8c73-4f6cdee1a2cf>
Tue, 17 Mar 2009 22:40:47 +0000 (22:40 +0000)
csrc/posix/pf_io_posix.c

index 211c516..b456788 100644 (file)
@@ -26,6 +26,7 @@
  */\r
 \r
 #include <unistd.h>\r
  */\r
 \r
 #include <unistd.h>\r
+#include <sys/time.h>\r
 #ifdef sun\r
 #include <sys/int_types.h> /* Needed on Solaris for uint32_t in termio.h */\r
 #endif\r
 #ifdef sun\r
 #include <sys/int_types.h> /* Needed on Solaris for uint32_t in termio.h */\r
 #endif\r
@@ -36,7 +37,9 @@ static struct termios save_termios;
 static int stdin_is_tty;\r
 \r
 /* poll() is broken in Mac OS X Tiger OS so use select() instead. */\r
 static int stdin_is_tty;\r
 \r
 /* poll() is broken in Mac OS X Tiger OS so use select() instead. */\r
+#ifndef PF_USE_SELECT\r
 #define PF_USE_SELECT  (1)\r
 #define PF_USE_SELECT  (1)\r
+#endif\r
 \r
 /* Default portable terminal I/O. */\r
 int  sdTerminalOut( char c )\r
 \r
 /* Default portable terminal I/O. */\r
 int  sdTerminalOut( char c )\r
@@ -68,6 +71,7 @@ int  sdTerminalFlush( void )
 int sdQueryTerminal( void )\r
 {\r
 #if PF_USE_SELECT\r
 int sdQueryTerminal( void )\r
 {\r
 #if PF_USE_SELECT\r
+       int select_retval;\r
        fd_set readfds;\r
        struct timeval tv;\r
        FD_ZERO(&readfds);\r
        fd_set readfds;\r
        struct timeval tv;\r
        FD_ZERO(&readfds);\r
@@ -75,7 +79,7 @@ int sdQueryTerminal( void )
        /* Set timeout to zero so that we just poll and return. */\r
        tv.tv_sec = 0;\r
        tv.tv_usec = 0;\r
        /* Set timeout to zero so that we just poll and return. */\r
        tv.tv_sec = 0;\r
        tv.tv_usec = 0;\r
-       int select_retval = select(STDIN_FILENO+1, &readfds, NULL, NULL, &tv);\r
+       select_retval = select(STDIN_FILENO+1, &readfds, NULL, NULL, &tv);\r
        if (select_retval < 0)\r
        {\r
                perror("sdTerminalInit: select");\r
        if (select_retval < 0)\r
        {\r
                perror("sdTerminalInit: select");\r
@@ -83,11 +87,12 @@ int sdQueryTerminal( void )
        return FD_ISSET(STDIN_FILENO,&readfds) ? FTRUE : FFALSE;\r
 \r
 #else\r
        return FD_ISSET(STDIN_FILENO,&readfds) ? FTRUE : FFALSE;\r
 \r
 #else\r
+       int result;\r
        struct pollfd  pfd = { 0 };\r
        sdTerminalFlush();\r
        pfd.fd = STDIN_FILENO;\r
        pfd.events = POLLIN;\r
        struct pollfd  pfd = { 0 };\r
        sdTerminalFlush();\r
        pfd.fd = STDIN_FILENO;\r
        pfd.events = POLLIN;\r
-       int result = poll( &pfd, 1, 0 );\r
+       result = poll( &pfd, 1, 0 );\r
     /* On a Mac it may set revents to POLLNVAL because poll() is broken on Tiger. */\r
        if( pfd.revents & POLLNVAL )\r
        {\r
     /* On a Mac it may set revents to POLLNVAL because poll() is broken on Tiger. */\r
        if( pfd.revents & POLLNVAL )\r
        {\r