diff options
| author | Franklin Wei <git@fwei.tk> | 2015-05-22 16:51:01 -0400 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2015-05-22 16:51:01 -0400 |
| commit | 5f5e9ba46eea80c589b6675bf6d4f11f74af7d77 (patch) | |
| tree | d2cfbf2c05caa458ac00cfc8d91df9f8e080f1ec /src/util.c | |
| parent | 5cc60817ff7f496dec9820e089ab25a115021513 (diff) | |
| download | market-sim-5f5e9ba46eea80c589b6675bf6d4f11f74af7d77.zip market-sim-5f5e9ba46eea80c589b6675bf6d4f11f74af7d77.tar.gz market-sim-5f5e9ba46eea80c589b6675bf6d4f11f74af7d77.tar.bz2 market-sim-5f5e9ba46eea80c589b6675bf6d4f11f74af7d77.tar.xz | |
some stuff, breaks save compatability
Diffstat (limited to 'src/util.c')
| -rw-r--r-- | src/util.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -114,8 +114,7 @@ static void detect_endianness(void) endianness = LITTLE; else { - printf("FATAL: failed to detect system endianness!\n"); - exit(EXIT_FAILURE); + fail("failed to detect system endianness"); } } @@ -322,3 +321,16 @@ uint parse_args(struct player_t *player, int argc, char *argv[]) return ret; } + +void fail(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + char buf[256]; + vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + + fprintf(stderr, "FATAL: %s\n", buf); + + exit(EXIT_FAILURE); +} |