commit 8cf9d55

Devine Lu Linvega  ·  2023-02-13 17:34:30 +0000 UTC
parent 2039e0f
(uxncli)Use System/halt as exit code
1 files changed,  +5, -5
+5, -5
 1@@ -23,7 +23,7 @@ static int
 2 emu_error(char *msg, const char *err)
 3 {
 4 	fprintf(stderr, "Error %s: %s\n", msg, err);
 5-	return 0;
 6+	return 1;
 7 }
 8 
 9 static int
10@@ -37,8 +37,8 @@ console_input(Uxn *u, char c)
11 static void
12 console_deo(Uint8 *d, Uint8 port)
13 {
14-	FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr :
15-													0;
16+	FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr
17+												  : 0;
18 	if(fd) {
19 		fputc(d[port], fd);
20 		fflush(fd);
21@@ -85,7 +85,7 @@ main(int argc, char **argv)
22 	if(!system_load(&u, argv[1]))
23 		return emu_error("Load", "Failed");
24 	if(!uxn_eval(&u, PAGE_PROGRAM))
25-		return emu_error("Init", "Failed");
26+		return u.dev[0x0f] & 0x7f;
27 	for(i = 2; i < argc; i++) {
28 		char *p = argv[i];
29 		while(*p) console_input(&u, *p++);
30@@ -96,5 +96,5 @@ main(int argc, char **argv)
31 		if(c != EOF)
32 			console_input(&u, (Uint8)c);
33 	}
34-	return 0;
35+	return u.dev[0x0f] & 0x7f;
36 }