Mercurial > repos > blastem
diff config.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 | 1b2f8280ba81 |
children | 0b692b5d154b |
line wrap: on
line diff
--- a/config.c Sat Jul 25 18:19:00 2015 -0700 +++ b/config.c Sat Jul 25 18:22:07 2015 -0700 @@ -53,8 +53,7 @@ if (started) { return head; } - fprintf(stderr, "unexpected } on line %d\n", *line); - exit(1); + fatal_error("unexpected } on line %d\n", *line); } char * end = curline + len - 1; @@ -133,7 +132,8 @@ return ret; } no_config: - fputs("Failed to find a config file in ~/.config/blastem/blastem.cfg or in the blastem executable directory\n", stderr); - exit(1); + fatal_error("Failed to find a config file in ~/.config/blastem/blastem.cfg or in the blastem executable directory\n"); + //this will never get reached, but the compiler doesn't know that. Let's make it happy + return NULL; }