From c5103c2256a011e3c75a496b344add108d67c867 Mon Sep 17 00:00:00 2001 From: akleine Date: Fri, 3 Jul 2026 11:42:14 +0200 Subject: [PATCH] fix: avoid crash in recent Termux versions (Linux kernel 6.x, 64 bit) also changed some macros for compiling using cc without any warning messages --- e3.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/e3.c b/e3.c index 31cf6a4..74d65b2 100644 --- a/e3.c +++ b/e3.c @@ -228,11 +228,11 @@ unsigned char text [max]; long stack[100]; -#define RETURN goto *(*esp--) +#define RETURN goto *(void*)*esp-- #define CALL(calladr,retadr) *++esp=(long)&&_loc##retadr; goto calladr; _loc##retadr: #define PUSH(arg) *++esp=arg -//#define POP(arg) (long*)arg=*esp-- -#define POP(arg) arg=(long *)(*esp--); +#define POPEBP(arg) arg=(unsigned char*)*esp-- +#define POP(arg) arg=(long)*esp--; int main(int argc,char**argv,char **envp) { @@ -369,7 +369,7 @@ Menu: CALL(MakeScanCode,12); if (eax>=27) goto EndeRet; // if no valid scancode CompJump2:ebx=(long)jarray[(int)ebx]; //------ - CALL(*ebx,13); // the general code jump dispatcher + CALL(*(void*)ebx,13); // the general code jump dispatcher //------ if (numeriere) { @@ -855,7 +855,7 @@ SB_ret: extra=1; lines = (eax-1)&0xFF; // without status line #if 1 // this is not portable: maybe 32bit Linux plus some Un*x systems ? - columns = eax >> 16; // columns > 255 are ignored... + columns = (eax >> 16)& 0xFF; // columns > 255 are ignored... #else columns = 80; #endif @@ -912,7 +912,7 @@ sl4: ++edi; CALL(sys_writeKP,93); // restore old cursor pos NoWrite:POP(edi); POP(esi); - POP(ebp); + POPEBP(ebp); POP(ebx); POP(edx); POP(ecx); @@ -1555,7 +1555,7 @@ RSL4: edi = (long)&(screenline[-2]); RSno_lineNr:CALL(StatusLineShow,156); // now write all at once POP(edi); POP(esi); - POP(ebp); + POPEBP(ebp); POP(ebx); POP(edx); POP(ecx); @@ -1585,7 +1585,7 @@ WriteMess9:PUSH(eax); CALL(StatusLineShow,158); POP(edi); POP(esi); - POP(ebp); + POPEBP(ebp); POP(ebx); POP(edx); POP(ecx); @@ -1782,7 +1782,7 @@ CloseFile:eax=close(ebx); RETURN; Fstat: eax=fstat(ebx,&fstatbuf); RETURN; -RenameFile:eax=rename((unsigned char*)ebx,(unsigned char*)ecx); +RenameFile:eax=rename((const char*)ebx,(const char*)ecx); RETURN; ChownFile:eax=fchown(ebx,ecx,edx); RETURN;