shithub: rgbds

Download patch

ref: 3ca58e13dcba212bcd024ab172b09bfa712854fb
parent: aaa4e174541bb34bea38c02cb39839f6ed4e16eb
author: ISSOtm <[email protected]>
date: Sun Mar 14 14:52:16 EDT 2021

Fix verbose messages claiming non-existent errors

They were confusing when trying to debug other things

--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -504,9 +504,15 @@
 	}
 	if (!state->isMmapped) {
 		/* Sometimes mmap() fails or isn't available, so have a fallback */
-		if (verbose)
-			printf("File %s opened as regular, errno reports \"%s\"\n",
-			       path, strerror(errno));
+		if (verbose) {
+			if (isStdin)
+				printf("Opening stdin\n");
+			else if (fileInfo.st_size == 0)
+				printf("File %s is empty\n", path);
+			else
+				printf("File %s opened as regular, errno reports \"%s\"\n",
+				       path, strerror(errno));
+		}
 		state->index = 0;
 		state->nbChars = 0;
 	}