projects
/
pforth
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix build of posix io on sun.
[pforth]
/
csrc
/
posix
/
pf_io_posix.c
diff --git
a/csrc/posix/pf_io_posix.c
b/csrc/posix/pf_io_posix.c
index
211c516
..
b456788
100644
(file)
--- a/
csrc/posix/pf_io_posix.c
+++ b/
csrc/posix/pf_io_posix.c
@@
-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