From 86e1466388204c6e5c1d4c0ee7fc9d80aa1c7283 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Thu, 1 Nov 2012 20:08:43 -0300 Subject: [PATCH] tools/ant-gui/ant-gui.c: add option -F to set font path; add usage --- tools/ant-gui/ant-gui.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/ant-gui/ant-gui.c b/tools/ant-gui/ant-gui.c index 8da9725..0039401 100644 --- a/tools/ant-gui/ant-gui.c +++ b/tools/ant-gui/ant-gui.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "SDL.h" #include "SDL_gfxPrimitives.h" @@ -205,13 +206,32 @@ static void generate(uint8_t ***imgs, int *n, const char *path) } +static void usage(const char *name) +{ + fprintf(stderr, "usage: %s [-F font_dir ...] file ...\n", name); + exit(1); +} + + int main(int argc, char **argv) { uint8_t **imgs = NULL; int n = 0; - int i; + int i, c; - for (i = 1; i != argc; i++) + while ((c = getopt(argc, argv, "F:")) != EOF) + switch (c) { + case 'F': + add_font_dir(optarg); + break; + default: + usage(*argv); + } + + if (optind == argc) + usage(*argv); + + for (i = optind; i != argc; i++) generate(&imgs, &n, argv[i]); gui(imgs, n); exit(1);