diff stateview.c @ 792:724bbec47f86

Use a new fatal_error function instead of calling fprintf and exit for fatal errors. This new function more gracefully handles the case in which BlastEm was not started from a terminal or disconnected from ther terminal (Windows).
author Michael Pavone <pavone@retrodev.com>
date Sat, 25 Jul 2015 18:22:07 -0700
parents e64975fc5f98
children 9aff36a172b2
line wrap: on
line diff
--- a/stateview.c	Sat Jul 25 18:19:00 2015 -0700
+++ b/stateview.c	Sat Jul 25 18:22:07 2015 -0700
@@ -61,13 +61,11 @@
 int main(int argc, char ** argv)
 {
 	if (argc < 2) {
-		fprintf(stderr, "Usage: stateview FILENAME\n");
-		exit(1);
+		fatal_error("Usage: stateview FILENAME\n");
 	}
 	FILE * state_file = fopen(argv[1], "rb");
 	if (!state_file) {
-		fprintf(stderr, "Failed to open %s\n", argv[1]);
-		exit(1);
+		fatal_error("Failed to open %s\n", argv[1]);
 	}
 	config = load_config(argv[0]);
 	int width = -1;