From 817145bcdcf08cd95fb62ed1da07504e54991f6e Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 1 Jul 2012 21:03:51 -0300 Subject: [PATCH] tools/ant-txt/ant-txt.c: new option -F to add font directories --- tools/ant-txt/ant-txt.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tools/ant-txt/ant-txt.c b/tools/ant-txt/ant-txt.c index 9c03c4d..bdd95f0 100644 --- a/tools/ant-txt/ant-txt.c +++ b/tools/ant-txt/ant-txt.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -23,14 +24,30 @@ #define H 16 +static void usage(const char *name) +{ + fprintf(stderr, "usage: %s [-F font_dir ...] [text]\n", name); + exit(1); +} + + int main(int argc, char **argv) { struct edit *edits = NULL, **last = &edits; uint8_t *canvas; const char *err; int i, x, y; + int 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); + } + for (i = optind; i != argc; i++) { while (*last) last = &(*last)->next; if (edits) {