--- a/atc/include.h +++ b/atc/include.h @@ -69,3 +69,12 @@ #include "struct.h" #include "extern.h" #include "tunable.h" + +#ifdef __EMSCRIPTEN__ +/* + * fredygames.com: there are no signals and no tty in the browser. Keys come from the page and the update timer + * (setitimer/alarm) is run by atc_getchar() while it waits for a key (atc.web.c). + */ +extern int atc_getchar(void); +#define getchar() atc_getchar() +#endif --- a/atc/input.c +++ b/atc/input.c @@ -58,7 +58,11 @@ #define RETTOKEN '\n' #define REDRAWTOKEN '\014' /* CTRL(L) */ +#ifdef __EMSCRIPTEN__ +#define SHELLTOKEN 0x7fff /* fredygames.com: no shell escape (no fork) */ +#else #define SHELLTOKEN '!' +#endif #define HELPTOKEN '?' #define ALPHATOKEN 256 #define NUMTOKEN 257 --- a/atc/main.c +++ b/atc/main.c @@ -154,6 +154,10 @@ tcgetattr(fileno(stdin), &tty_start); tty_new = tty_start; +#ifdef __EMSCRIPTEN__ + tty_new.c_cc[VERASE] = 8; /* fredygames.com: Backspace is ^H, ^U kills the line */ + tty_new.c_cc[VKILL] = 21; +#endif tty_new.c_lflag &= ~(ICANON|ECHO); tty_new.c_iflag |= ICRNL; tty_new.c_cc[VMIN] = 1;