commit 9f7bb31
Devine Lu Linvega
·
2025-05-03 23:18:11 +0000 UTC
parent 4c0da27
Inlined console_arguments
2 files changed,
+16,
-23
M
makefile
M
makefile
+6,
-7
1@@ -10,17 +10,15 @@ all: bin/uxncli bin/uxn11
2 run: all bin/mouse.rom
3 @ bin/uxn11 bin/mouse.rom
4
5-debug: bin/uxncli-debug bin/uxn11-debug bin/opctest.rom bin/console.rom
6- @ bin/uxncli-debug bin/opctest.rom
7- @ bin/uxncli-debug bin/console.rom "foo bar" baz
8- @ bin/uxn11-debug bin/mouse.rom
9-
10-test: all bin/uxncli-debug bin/uxn11-debug bin/opctest.rom bin/screen.rom
11+cli: bin/uxncli-debug bin/opctest.rom bin/console.rom
12 bin/uxncli-debug
13 bin/uxncli-debug -v
14+ bin/uxncli-debug bin/opctest.rom
15+ @ bin/uxncli-debug bin/console.rom "foo bar" baz
16+
17+gui: all bin/uxn11-debug bin/screen.rom
18 bin/uxn11-debug
19 bin/uxn11-debug -v
20- bin/uxncli-debug bin/opctest.rom
21 bin/uxn11-debug bin/screen.rom
22
23 format:
24@@ -33,6 +31,7 @@ grab:
25 archive:
26 @ cp src/uxncli.c ../oscean/etc/uxncli11.c.txt
27 @ cp src/uxn11.c ../oscean/etc/uxn11.c.txt
28+ @ cp doc/man/uxntal.7 ../oscean/etc/uxntal.7.txt
29
30 clean:
31 @ rm -fr bin
+10,
-16
1@@ -230,8 +230,6 @@ system_deo(Uint8 port)
2 #define CONSOLE_EOA 0x3
3 #define CONSOLE_END 0x4
4
5-static int console_vector;
6-
7 #undef _POSIX_C_SOURCE
8 #define _POSIX_C_SOURCE 200112L
9
10@@ -249,6 +247,8 @@ static int console_vector;
11 #include <util.h>
12 #endif
13
14+static int console_vector;
15+
16 /* subprocess support */
17 static char *fork_args[4] = {"/bin/sh", "-c", "", NULL};
18 static int child_mode;
19@@ -412,17 +412,6 @@ console_input(int c, int type)
20 return type != 4;
21 }
22
23-static void
24-console_arguments(int i, int argc, char **argv)
25-{
26- for(; i < argc; i++) {
27- char *p = argv[i];
28- while(*p)
29- console_input(*p++, CONSOLE_ARG);
30- console_input('\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
31- }
32-}
33-
34 static Uint8
35 console_dei(Uint8 addr)
36 {
37@@ -761,14 +750,19 @@ main(int argc, char **argv)
38 {
39 int i = 1;
40 if(argc == 2 && argv[1][0] == '-' && argv[1][1] == 'v')
41- return !fprintf(stdout, "Uxn11 - Varvara Emulator(cli), 20 Mar 2025.\n");
42+ return !fprintf(stdout, "Uxn11 - Varvara Emulator(cli), 3 May 2025.\n");
43 else if(argc == 1)
44 return !fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]);
45 else if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++], argc > 2))
46 return !fprintf(stdout, "Could not load %s.\n", argv[i - 1]);
47 if(console_vector) {
48- console_arguments(i, argc, argv);
49- while(!uxn.dev[0x0f] && console_input(fgetc(stdin), 0x1));
50+ for(; i < argc; i++) {
51+ char *p = argv[i];
52+ while(*p)
53+ console_input(*p++, CONSOLE_ARG);
54+ console_input('\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
55+ }
56+ while(!uxn.dev[0x0f] && console_input(fgetc(stdin), 1));
57 }
58 return uxn.dev[0x0f] & 0x7f;
59 }