Updated version of RISCOS support. SF patch 411213 by Dietmar Schwertberger
diff --git a/Modules/main.c b/Modules/main.c
index b4566c9..0183647 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -26,10 +26,18 @@
static char **orig_argv;
static int orig_argc;
-/* For my_readline when running under RISCOS */
-#ifdef RISCOS
+/* command line options */
+#define BASE_OPTS "c:diOStuUvxXhVW:"
+
+#ifndef RISCOS
+#define PROGRAM_OPTS BASE_OPTS
+#else /*RISCOS*/
+/* extra option saying that we are running under a special task window
+ frontend; especially my_readline will behave different */
+#define PROGRAM_OPTS BASE_OPTS "w"
+/* corresponding flag */
extern int Py_RISCOSWimpFlag;
-#endif
+#endif /*RISCOS*/
/* Short usage message (with %s for argv0) */
static char *usage_line =
@@ -115,11 +123,7 @@
PySys_ResetWarnOptions();
-#ifdef RISCOS
- while ((c = getopt(argc, argv, "c:diOStuUvwxXhV")) != EOF) {
-#else
- while ((c = _PyOS_GetOpt(argc, argv, "c:diOStuUvxXhVW:")) != EOF) {
-#endif
+ while ((c = _PyOS_GetOpt(argc, argv, PROGRAM_OPTS)) != EOF) {
if (c == 'c') {
/* -c is the last option; following arguments
that look like options are left for the
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index cfce06b..0c5c257 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -756,9 +756,7 @@
#if defined(__WATCOMC__) && !defined(__QNX__)
/* XXX Can't interrupt this sleep */
Py_BEGIN_ALLOW_THREADS
-#ifndef RISCOS
delay((int)(secs * 1000 + 0.5)); /* delay() uses milliseconds */
-#endif
Py_END_ALLOW_THREADS
#else /* !__WATCOMC__ || __QNX__ */
#ifdef MSDOS
@@ -831,10 +829,20 @@
Py_END_ALLOW_THREADS
}
#else /* !__BEOS__ */
+#ifdef RISCOS
+ if (secs <= 0.0)
+ return 0;
+ Py_BEGIN_ALLOW_THREADS
+ /* This sleep *CAN BE* interrupted. */
+ if ( sleep(secs) )
+ return -1;
+ Py_END_ALLOW_THREADS
+#else /* !RISCOS */
/* XXX Can't interrupt this sleep */
Py_BEGIN_ALLOW_THREADS
sleep((int)secs);
Py_END_ALLOW_THREADS
+#endif /* !RISCOS */
#endif /* !__BEOS__ */
#endif /* !PYOS_OS2 */
#endif /* !MS_WIN32 */