Mercurial > repos > blastem
comparison 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 |
comparison
equal
deleted
inserted
replaced
791:60686f8d5e48 | 792:724bbec47f86 |
---|---|
59 int headless = 0; | 59 int headless = 0; |
60 | 60 |
61 int main(int argc, char ** argv) | 61 int main(int argc, char ** argv) |
62 { | 62 { |
63 if (argc < 2) { | 63 if (argc < 2) { |
64 fprintf(stderr, "Usage: stateview FILENAME\n"); | 64 fatal_error("Usage: stateview FILENAME\n"); |
65 exit(1); | |
66 } | 65 } |
67 FILE * state_file = fopen(argv[1], "rb"); | 66 FILE * state_file = fopen(argv[1], "rb"); |
68 if (!state_file) { | 67 if (!state_file) { |
69 fprintf(stderr, "Failed to open %s\n", argv[1]); | 68 fatal_error("Failed to open %s\n", argv[1]); |
70 exit(1); | |
71 } | 69 } |
72 config = load_config(argv[0]); | 70 config = load_config(argv[0]); |
73 int width = -1; | 71 int width = -1; |
74 int height = -1; | 72 int height = -1; |
75 if (argc > 2) { | 73 if (argc > 2) { |