#endif /* STACKCHECK */
+#ifdef USE_UNIX98PTYS
+# define _XOPEN_SOURCE 500
+#endif
+#define _BSD_SOURCE 1
+#include <unistd.h>
+extern void usleep_watchdevice(unsigned long usecs);
+#define usleep(usecs) usleep_watchdevice((usecs))
+#define sleep(secs) usleep((secs)*1000000)
+
+
#endif /* __CONFIG_H__ */
target.tv_sec +=usecs/1000000 + (target.tv_usec/1000000);
target.tv_usec%=1000000;
+ target.tv_usec+=1000000;
+ target.tv_sec --;
+
for (;;)
FD_ZERO(&readfds);
if (device_portfd>=0)
if (target.tv_sec < timeout.tv_sec)
return;
timeout.tv_sec =target.tv_sec - timeout.tv_sec;
- if (target.tv_usec < timeout.tv_usec) {
- target.tv_usec+=1000000;
- if (target.tv_sec <= 0)
- return;
- target.tv_sec--;
- }
timeout.tv_usec=target.tv_usec - timeout.tv_usec;
+ if (timeout.tv_usec>=1000000) {
+ timeout.tv_usec-=1000000;
+ if (!timeout.tv_sec)
+ return;
+ timeout.tv_sec--;
+ }
err=select((device_portfd<0 ? 0 : device_portfd+1),&readfds,NULL,NULL,&timeout);
if ( err > 0 ) {
extern pid_t getpid(void);
extern int execv(const char *path, char *const argv[]);
-extern void usleep_watchdevice(unsigned long usecs);
-#define usleep(usecs) usleep_watchdevice((usecs))
-#define sleep(secs) usleep((secs)*1000000)
-
-
#endif /* UCCOMPAT */