From c25e965b0cd507b7f2ed702fd419587e78f780f3 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sat, 15 Oct 2016 15:27:42 +0200 Subject: [PATCH] Avoid unnecessary key presses. The recently added doesclrscrafterexit() allows cc65 programs to determine if the screen will be cleared after exit(). If that isn't the case then there's no need to ask the user to press a key in order to allow him to read the final program output. --- examples/wget/wget.c | 12 ++++++++++-- platform/apple2enh/lib/error.c | 7 +++++-- platform/atarixl/lib/error.c | 7 +++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/examples/wget/wget.c b/examples/wget/wget.c index bdba5b25d..bf1daf141 100644 --- a/examples/wget/wget.c +++ b/examples/wget/wget.c @@ -35,6 +35,10 @@ #include #include +#ifdef __CC65__ +#include +#endif /* __CC65__ */ + #include "contiki-net.h" #include "webclient.h" #include "cfs/cfs.h" @@ -146,8 +150,12 @@ app_quit(void) if(file != -1) { cfs_close(file); } - puts("Press to continue..."); - getchar(); +#ifdef __CC65__ + if(doesclrscrafterexit()) { + puts("Press to continue..."); + getchar(); + } +#endif /* __CC65__ */ process_exit(&wget_process); LOADER_UNLOAD(); } diff --git a/platform/apple2enh/lib/error.c b/platform/apple2enh/lib/error.c index b030d5877..39f3b0d7b 100644 --- a/platform/apple2enh/lib/error.c +++ b/platform/apple2enh/lib/error.c @@ -33,6 +33,7 @@ */ #include +#include #include "sys/log.h" @@ -43,8 +44,10 @@ void error_exit(void) { #if LOG_CONF_ENABLED - log_message("Press any key to continue ...", ""); - ctk_arch_getkey(); + if(doesclrscrafterexit()) { + log_message("Press any key to continue ...", ""); + ctk_arch_getkey(); + } #endif /* LOG_CONF_ENABLED */ exit(EXIT_FAILURE); } diff --git a/platform/atarixl/lib/error.c b/platform/atarixl/lib/error.c index b030d5877..39f3b0d7b 100644 --- a/platform/atarixl/lib/error.c +++ b/platform/atarixl/lib/error.c @@ -33,6 +33,7 @@ */ #include +#include #include "sys/log.h" @@ -43,8 +44,10 @@ void error_exit(void) { #if LOG_CONF_ENABLED - log_message("Press any key to continue ...", ""); - ctk_arch_getkey(); + if(doesclrscrafterexit()) { + log_message("Press any key to continue ...", ""); + ctk_arch_getkey(); + } #endif /* LOG_CONF_ENABLED */ exit(EXIT_FAILURE); }