summaryrefslogtreecommitdiff
path: root/tools/gfx.c
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2021-09-21 17:37:43 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2021-09-21 17:37:43 -0400
commitbe7a5e09b5e54676a9c239682707331be1229828 (patch)
tree879d9bde5445a2842d7d38538b3d181d70b701f1 /tools/gfx.c
parent2691c9f5c8f866a2af802a119a565c743c05fceb (diff)
Factor out usage_exit into into tools/common.h
Diffstat (limited to 'tools/gfx.c')
-rw-r--r--tools/gfx.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/tools/gfx.c b/tools/gfx.c
index b086238a9..2928637c0 100644
--- a/tools/gfx.c
+++ b/tools/gfx.c
@@ -1,8 +1,7 @@
-#include "common.h"
+#define PROGRAM_NAME "gfx"
+#define USAGE_OPTS "[-h|--help] [--trim-whitespace] [--remove-whitespace] [--interleave] [--remove-duplicates [--keep-whitespace]] [--remove-xflip] [--remove-yflip] [--preserve indexes] [-d|--depth depth] [-p|--png filename.png] [-o|--out outfile] infile"
-void usage(void) {
- fprintf(stderr, "Usage: gfx [-h|--help] [--trim-whitespace] [--remove-whitespace] [--interleave] [--remove-duplicates [--keep-whitespace]] [--remove-xflip] [--remove-yflip] [--preserve indexes] [-d|--depth depth] [-p|--png filename.png] [-o|--out outfile] infile\n");
-}
+#include "common.h"
struct Options {
bool trim_whitespace;
@@ -76,12 +75,10 @@ void parse_args(int argc, char *argv[]) {
options.outfile = optarg;
break;
case 'h':
- usage();
- exit(0);
+ usage_exit(0);
break;
default:
- usage();
- exit(1);
+ usage_exit(1);
}
}
}
@@ -128,7 +125,7 @@ void trim_whitespace(struct Graphic *graphic) {
}
}
-int get_tile_size() {
+int get_tile_size(void) {
return options.depth * (options.interleave ? 16 : 8);
}
@@ -270,8 +267,7 @@ int main(int argc, char *argv[]) {
argc -= optind;
argv += optind;
if (argc < 1) {
- usage();
- exit(1);
+ usage_exit(1);
}
struct Graphic graphic;