shithub: rgbds

Download patch

ref: f3b475453f8f2be775734de8eb9b1ff43f78e2a3
parent: 0c71f5a4e91b92718f1c3bd94c43d7760ac89fd6
author: Antonio Niño Díaz <[email protected]>
date: Mon Aug 21 19:35:56 EDT 2017

Replace fprintf by errx for consistency

Signed-off-by: Antonio Niño Díaz <[email protected]>

--- a/src/link/main.c
+++ b/src/link/main.c
@@ -77,8 +77,7 @@
 				errx(1, "Invalid argument for option 'p'");
 			}
 			if (fillchar < 0 || fillchar > 0xFF) {
-				fprintf(stderr, "Argument for option 'p' must be between 0 and 0xFF");
-				exit(1);
+				errx(1, "Argument for option 'p' must be between 0 and 0xFF");
 			}
 			break;
 		case 's':
--- a/src/link/output.c
+++ b/src/link/output.c
@@ -111,18 +111,15 @@
 		if (tzOverlayname) {
 			f_overlay = fopen(tzOverlayname, "rb");
 			if (!f_overlay) {
-				fprintf(stderr, "Failed to open overlay file %s\n", tzOverlayname);
-				exit(1);
+				errx(1, "Failed to open overlay file %s\n", tzOverlayname);
 			}
 			fseek(f_overlay, 0, SEEK_END);
 			if (ftell(f_overlay) % 0x4000 != 0) {
-				fprintf(stderr, "Overlay file must be aligned to 0x4000 bytes\n");
-				exit(1);
+				errx(1, "Overlay file must be aligned to 0x4000 bytes\n");
 			}
 			MaxOverlayBank = (ftell(f_overlay) / 0x4000) - 1;
 			if (MaxOverlayBank < 1) {
-				fprintf(stderr, "Overlay file be at least 0x8000 bytes\n");
-				exit(1);
+				errx(1, "Overlay file must be at least 0x8000 bytes\n");
 			}
 			if (MaxOverlayBank > MaxBankUsed) {
 				MaxBankUsed = MaxOverlayBank;