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.
This commit is contained in:
Oliver Schmidt 2016-10-15 15:27:42 +02:00
parent 957ac63a7c
commit c25e965b0c
3 changed files with 20 additions and 6 deletions

View file

@ -35,6 +35,10 @@
#include <stdio.h>
#include <string.h>
#ifdef __CC65__
#include <cc65.h>
#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);
}
#ifdef __CC65__
if(doesclrscrafterexit()) {
puts("Press <enter> to continue...");
getchar();
}
#endif /* __CC65__ */
process_exit(&wget_process);
LOADER_UNLOAD();
}

View file

@ -33,6 +33,7 @@
*/
#include <stdlib.h>
#include <cc65.h>
#include "sys/log.h"
@ -43,8 +44,10 @@ void
error_exit(void)
{
#if LOG_CONF_ENABLED
if(doesclrscrafterexit()) {
log_message("Press any key to continue ...", "");
ctk_arch_getkey();
}
#endif /* LOG_CONF_ENABLED */
exit(EXIT_FAILURE);
}

View file

@ -33,6 +33,7 @@
*/
#include <stdlib.h>
#include <cc65.h>
#include "sys/log.h"
@ -43,8 +44,10 @@ void
error_exit(void)
{
#if LOG_CONF_ENABLED
if(doesclrscrafterexit()) {
log_message("Press any key to continue ...", "");
ctk_arch_getkey();
}
#endif /* LOG_CONF_ENABLED */
exit(EXIT_FAILURE);
}