Mercurial > hg > batmud > maputils
changeset 1484:2350cd3a6feb
Update to match the changes in th_args API.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 22 Nov 2014 23:45:41 +0200 |
parents | 8546c2af9626 |
children | 04f210c8ed91 |
files | colormap.c combine.c diffmap.c map2ppm.c mapstats.c mkcitymap.c mkloc.c mkspecial.c patchmap.c |
diffstat | 9 files changed, 51 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/colormap.c Thu Oct 30 18:14:56 2014 +0200 +++ b/colormap.c Sat Nov 22 23:45:41 2014 +0200 @@ -45,7 +45,7 @@ /* Arguments */ -optarg_t optList[] = +static const th_optarg_t optList[] = { { 0, '?', "help", "Show this help", OPT_NONE }, { 1, 'v', "verbose", "Be more verbose", OPT_NONE }, @@ -63,7 +63,7 @@ { 14,'u', "urchin-file", "Specify urchin file", OPT_ARGREQ }, }; -const int optListN = sizeof(optList) / sizeof(optList[0]); +static const int optListN = sizeof(optList) / sizeof(optList[0]); /* @@ -531,7 +531,7 @@ th_print_banner(stdout, th_prog_name, "[options] <input mapfile>"); - th_args_help(stdout, optList, optListN); + th_args_help(stdout, optList, optListN, 0); fprintf(stdout, "\nAvailable OUTPUT formats:\n"); for (i = 0; i < noutputFormats; i++) @@ -667,7 +667,7 @@ /* Parse arguments */ if (!th_args_process(argc, argv, optList, optListN, - argHandleOpt, argHandleFile, TRUE)) + argHandleOpt, argHandleFile, OPTH_BAILOUT)) exit(1); if (srcFilename == NULL)
--- a/combine.c Thu Oct 30 18:14:56 2014 +0200 +++ b/combine.c Sat Nov 22 23:45:41 2014 +0200 @@ -33,7 +33,8 @@ /* Arguments */ -optarg_t optList[] = { +static const th_optarg_t optList[] = +{ { 0, '?', "help", "Show this help", OPT_NONE }, { 1, 'o', "output", "Specify output file", OPT_ARGREQ }, { 2, 'v', "verbose", "Be more verbose", OPT_NONE }, @@ -44,7 +45,7 @@ { 7, 'h', "height", "Minimum height", OPT_ARGREQ }, }; -const int optListN = (sizeof(optList) / sizeof(optarg_t)); +const int optListN = sizeof(optList) / sizeof(optList[0]); void argShowHelp() @@ -52,7 +53,7 @@ th_print_banner(stdout, th_prog_name, "[options] <mapfile1:x-offset:y-offset> [<mapfile2:x:y> ...]"); - th_args_help(stdout, optList, optListN); + th_args_help(stdout, optList, optListN, 0); } @@ -234,7 +235,7 @@ /* Parse arguments */ if (!th_args_process(argc, argv, optList, optListN, - argHandleOpt, argHandleFile, TRUE)) + argHandleOpt, argHandleFile, OPTH_BAILOUT)) exit(1); if (nsrcFiles < 1)
--- a/diffmap.c Thu Oct 30 18:14:56 2014 +0200 +++ b/diffmap.c Sat Nov 22 23:45:41 2014 +0200 @@ -21,7 +21,8 @@ /* Arguments */ -optarg_t optList[] = { +static const th_optarg_t optList[] = +{ { 0, '?', "help", "Show this help", OPT_NONE }, { 1, 'v', "verbose", "Be more verbose", OPT_NONE }, { 2, 'q', "quiet", "Be quiet", OPT_NONE }, @@ -32,7 +33,7 @@ { 7, 'a', "always", "Always output diff file even when no changes", OPT_NONE }, }; -const int optListN = (sizeof(optList) / sizeof(optarg_t)); +static const int optListN = sizeof(optList) / sizeof(optList[0]); void argShowHelp(void) @@ -40,7 +41,7 @@ th_print_banner(stdout, th_prog_name, "[options] <mapfile #1> <mapfile #2>"); - th_args_help(stdout, optList, optListN); + th_args_help(stdout, optList, optListN, 0); }
--- a/map2ppm.c Thu Oct 30 18:14:56 2014 +0200 +++ b/map2ppm.c Sat Nov 22 23:45:41 2014 +0200 @@ -26,7 +26,8 @@ /* Arguments */ -optarg_t optList[] = { +static const th_optarg_t optList[] = +{ { 0, '?', "help", "Show this help", OPT_NONE }, { 1, 'v', "verbose", "Be more verbose", OPT_NONE }, { 2, 'q', "quiet", "Be quiet", OPT_NONE }, @@ -42,7 +43,7 @@ #endif }; -const int optListN = (sizeof(optList) / sizeof(optarg_t)); +static const int optListN = sizeof(optList) / sizeof(optList[0]); void argShowHelp(void) @@ -50,7 +51,7 @@ th_print_banner(stdout, th_prog_name, "[options] <input mapfile>"); - th_args_help(stdout, optList, optListN); + th_args_help(stdout, optList, optListN, 0); } @@ -355,7 +356,7 @@ /* Parse arguments */ if (!th_args_process(argc, argv, optList, optListN, - argHandleOpt, argHandleFile, TRUE)) + argHandleOpt, argHandleFile, OPTH_BAILOUT)) exit(1); if (srcFilename == NULL)
--- a/mapstats.c Thu Oct 30 18:14:56 2014 +0200 +++ b/mapstats.c Sat Nov 22 23:45:41 2014 +0200 @@ -11,7 +11,8 @@ typedef int (*compareFunc)(const void *, const void *); -enum { +enum +{ SORT_NONE, SORT_NAME, SORT_SYMBOL, @@ -27,7 +28,8 @@ optCityFormat = FALSE; -typedef struct { +typedef struct +{ ulint_t n; int piece; } MapPieceStat; @@ -35,7 +37,8 @@ /* Arguments */ -optarg_t optList[] = { +static const th_optarg_t optList[] = +{ { 0, '?', "help", "Show this help", OPT_NONE }, { 1, 'v', "verbose", "Be more verbose", OPT_NONE }, { 2, 'q', "quiet", "Be quiet", OPT_NONE }, @@ -46,7 +49,7 @@ { 7, 'c', "city-format","Input is a city map", OPT_NONE }, }; -const int optListN = (sizeof(optList) / sizeof(optarg_t)); +static const int optListN = sizeof(optList) / sizeof(optList[0]); void argShowHelp(void) @@ -54,7 +57,7 @@ th_print_banner(stdout, th_prog_name, "[options] <input mapfile>"); - th_args_help(stdout, optList, optListN); + th_args_help(stdout, optList, optListN, 0); } @@ -208,7 +211,7 @@ /* Parse arguments */ if (!th_args_process(argc, argv, optList, optListN, - argHandleOpt, argHandleFile, TRUE)) + argHandleOpt, argHandleFile, OPTH_BAILOUT)) exit(1); if (srcFilename == NULL)
--- a/mkcitymap.c Thu Oct 30 18:14:56 2014 +0200 +++ b/mkcitymap.c Sat Nov 22 23:45:41 2014 +0200 @@ -20,7 +20,8 @@ /* Arguments */ -optarg_t optList[] = { +static const th_optarg_t optList[] = +{ { 0, '?', "help", "Show this help", OPT_NONE }, { 1, 'v', "verbose", "Be more verbose", OPT_NONE }, { 2, 'o', "output", "Output filename", OPT_ARGREQ }, @@ -37,7 +38,7 @@ th_print_banner(stdout, th_prog_name, "[options] <mapfile> <locfile>"); - th_args_help(stdout, optList, optListN); + th_args_help(stdout, optList, optListN, 0); } @@ -408,7 +409,7 @@ /* Parse arguments */ if (!th_args_process(argc, argv, optList, optListN, - argHandleOpt, argHandleFile, TRUE)) + argHandleOpt, argHandleFile, OPTH_BAILOUT)) exit(1); if (optMapFilename == NULL || optLocFilename == NULL)
--- a/mkloc.c Thu Oct 30 18:14:56 2014 +0200 +++ b/mkloc.c Sat Nov 22 23:45:41 2014 +0200 @@ -9,7 +9,8 @@ #include "th_args.h" #include "th_string.h" -enum { +enum +{ OUTFMT_MAP = 0, OUTFMT_LOCFILE, OUTFMT_SCRIPT, @@ -17,14 +18,16 @@ OUTFMT_GMAPS }; -enum { +enum +{ GMAPS_XML = 0, GMAPS_JSON, GMAPS_LAST }; /* These must be in lower case */ -const char *gmapsModes[GMAPS_LAST] = { +const char *gmapsModes[GMAPS_LAST] = +{ "xml", "json", }; @@ -51,7 +54,8 @@ /* Arguments */ -optarg_t optList[] = { +static const th_optarg_t optList[] = +{ { 0, '?', "help", "Show this help", OPT_NONE }, { 2, 'v', "verbose", "Be more verbose", OPT_NONE }, { 3, 'q', "quiet", "Be quiet", OPT_NONE }, @@ -75,7 +79,7 @@ { 19,'X', "loc-markers","Location markers ('" LOC_MARKERS "')", OPT_ARGREQ }, }; -const int optListN = sizeof(optList) / sizeof(optList[0]); +static const int optListN = sizeof(optList) / sizeof(optList[0]); void argShowHelp() @@ -83,7 +87,7 @@ th_print_banner(stdout, th_prog_name, "[options]"); - th_args_help(stdout, optList, optListN); + th_args_help(stdout, optList, optListN, 0); } @@ -1040,7 +1044,7 @@ /* Parse arguments */ if (!th_args_process(argc, argv, optList, optListN, - argHandleOpt, NULL, FALSE)) + argHandleOpt, NULL, OPTH_BAILOUT)) exit(1); /* Check the mode and arguments */
--- a/mkspecial.c Thu Oct 30 18:14:56 2014 +0200 +++ b/mkspecial.c Sat Nov 22 23:45:41 2014 +0200 @@ -35,7 +35,7 @@ /* Arguments */ -optarg_t optList[] = { +static const th_optarg_t optList[] = { { 0, '?', "help", "Show this help", 0 }, { 1, 'o', "output", "Specify output file", 1 }, { 2, 'v', "verbose", "Be more verbose", 0 }, @@ -54,7 +54,7 @@ { 20,'C', "center-char","Center character symbol (for -a)", 1 }, }; -const int optListN = (sizeof(optList) / sizeof(optarg_t)); +static const int optListN = sizeof(optList) / sizeof(optList[0]); void argShowHelp() @@ -62,7 +62,7 @@ th_print_banner(stdout, th_prog_name, "[options] <inputfile> [inputfile#2..]"); - th_args_help(stdout, optList, optListN); + th_args_help(stdout, optList, optListN, 0); } @@ -403,7 +403,7 @@ /* Parse arguments */ if (!th_args_process(argc, argv, optList, optListN, - argHandleOpt, argHandleFile, TRUE)) + argHandleOpt, argHandleFile, OPTH_BAILOUT)) exit(1); if (nsrcFiles < 1)
--- a/patchmap.c Thu Oct 30 18:14:56 2014 +0200 +++ b/patchmap.c Sat Nov 22 23:45:41 2014 +0200 @@ -16,7 +16,8 @@ /* Arguments */ -optarg_t optList[] = { +static const th_optarg_t optList[] = +{ { 0, '?', "help", "Show this help", OPT_NONE }, { 1, 'v', "verbose", "Be more verbose", OPT_NONE }, { 2, 'q', "quiet", "Be quiet", OPT_NONE }, @@ -24,7 +25,7 @@ { 4, 'o', "output", "Output filename", OPT_ARGREQ }, }; -const int optListN = (sizeof(optList) / sizeof(optarg_t)); +static const int optListN = sizeof(optList) / sizeof(optList[0]); void argShowHelp(void) @@ -32,7 +33,7 @@ th_print_banner(stdout, th_prog_name, "[options] <mapfile> <patchfile>"); - th_args_help(stdout, optList, optListN); + th_args_help(stdout, optList, optListN, 0); } @@ -101,7 +102,7 @@ /* Parse arguments */ if (!th_args_process(argc, argv, optList, optListN, - argHandleOpt, argHandleFile, TRUE)) + argHandleOpt, argHandleFile, OPTH_BAILOUT)) exit(1); if (mapFilename == NULL || patchFilename == NULL)