diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2021-09-21 17:37:43 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2021-09-21 17:37:43 -0400 |
commit | be7a5e09b5e54676a9c239682707331be1229828 (patch) | |
tree | 879d9bde5445a2842d7d38538b3d181d70b701f1 /tools/pokemon_animation_graphics.c | |
parent | 2691c9f5c8f866a2af802a119a565c743c05fceb (diff) |
Factor out usage_exit into into tools/common.h
Diffstat (limited to 'tools/pokemon_animation_graphics.c')
-rw-r--r-- | tools/pokemon_animation_graphics.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/tools/pokemon_animation_graphics.c b/tools/pokemon_animation_graphics.c index 27573a516..c8c126475 100644 --- a/tools/pokemon_animation_graphics.c +++ b/tools/pokemon_animation_graphics.c @@ -1,3 +1,6 @@ +#define PROGRAM_NAME "pokemon_animation_graphics" +#define USAGE_OPTS "[-h|--help] [-o|--output front.animated.2bpp] [-t|--tilemap front.animated.tilemap] [--girafarig] front.2bpp front.dimensions" + #include "common.h" struct Options { @@ -6,10 +9,6 @@ struct Options { bool girafarig; }; -void usage() { - fputs("Usage: pokemon_animation_graphics [-h|--help] [-o|--output front.animated.2bpp] [-t|--tilemap front.animated.tilemap] [--girafarig] front.2bpp front.dimensions\n", stderr); -} - void parse_args(int argc, char *argv[], struct Options *options) { struct option long_options[] = { {"output", required_argument, 0, 'o'}, @@ -30,12 +29,10 @@ void parse_args(int argc, char *argv[], struct Options *options) { options->girafarig = true; break; case 'h': - usage(); - exit(0); + usage_exit(0); break; default: - usage(); - exit(1); + usage_exit(1); } } } @@ -154,8 +151,7 @@ int main(int argc, char *argv[]) { argc -= optind; argv += optind; if (argc < 2) { - usage(); - exit(1); + usage_exit(1); } int width; |