]> git.sur5r.net Git - cc65/commitdiff
clock-test.c: do doesclrscrafterexit() handling the canonical way.
authorChristian Groessler <chris@groessler.org>
Tue, 25 Sep 2018 12:35:52 +0000 (14:35 +0200)
committerOliver Schmidt <ol.sc@web.de>
Tue, 25 Sep 2018 19:11:05 +0000 (21:11 +0200)
testcode/lib/clock-test.c

index 0267668aa439bb9ed8d3dc1185838b5dfa100bec..9d420a5b0884248b2b4850180917b4ed74713a40 100644 (file)
 #ifdef __CC65__
 #include <conio.h>
 #include <cc65.h>
-
-static void exitfn(void)
-{
-    if (doesclrscrafterexit()) cgetc();
-}
 #endif /* #ifdef __CC65__ */
 
 static void print_time(void)
@@ -42,7 +37,9 @@ int main(int argc, char **argv)
     static struct timespec new_time;
 
 #ifdef __CC65__
-    atexit(exitfn);
+    /* if DOS will automatically clear the screen after the program exits, wait for a keypress... */
+    if (doesclrscrafterexit())
+        atexit((void (*)(void))cgetc);
 #endif
 
     if (argc <= 1) {