commit ddd3a46156ebc9fc757d4dbe62871f49760017be
parent b66d3f26123e6512bf4d1f1ea3310c2af2a5a1a2
Author: neauoire <aliceffekt@gmail.com>
Date: Tue, 15 Aug 2023 18:47:34 -0700
Standardized main() in uxncli and uxnemu
Diffstat:
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/uxncli.c b/src/uxncli.c
@@ -41,7 +41,17 @@ emu_deo(Uxn *u, Uint8 addr)
}
}
-int
+static void
+emu_run(Uxn *u)
+{
+ while(!u->dev[0x0f]) {
+ int c = fgetc(stdin);
+ if(c == EOF) break;
+ console_input(u, (Uint8)c, CONSOLE_STD);
+ }
+}
+
+static int
emu_end(Uxn *u)
{
free(u->ram);
@@ -70,11 +80,7 @@ main(int argc, char **argv)
u.dev[0x17] = argc - i;
if(uxn_eval(&u, PAGE_PROGRAM)) {
console_listen(&u, i, argc, argv);
- while(!u.dev[0x0f]) {
- int c = fgetc(stdin);
- if(c == EOF) break;
- console_input(&u, (Uint8)c, CONSOLE_STD);
- }
+ emu_run(&u);
}
return emu_end(&u);
}
diff --git a/src/uxnemu.c b/src/uxnemu.c
@@ -517,7 +517,7 @@ emu_run(Uxn *u, char *rom)
}
}
-int
+static int
emu_end(Uxn *u)
{
#ifdef _WIN32