From 07fbc325118eb3192ea3b34bbdb6c855c20ee1c7 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 21 May 2010 16:16:52 -0600 Subject: Add std-options check to 'make installcheck'. --- dimension/main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'dimension') diff --git a/dimension/main.c b/dimension/main.c index ae6c54b..708184d 100644 --- a/dimension/main.c +++ b/dimension/main.c @@ -36,6 +36,7 @@ static dmnsn_quality quality = DMNSN_RENDER_FULL; static int tokenize = 0, parse = 0; static void print_usage(FILE *file, const char *arg0); +static void print_version(FILE *file); int main(int argc, char **argv) { @@ -45,13 +46,15 @@ main(int argc, char **argv) { /* Long-only option codes */ enum { - DMNSN_OPT_THREADS = 256, + DMNSN_OPT_VERSION = 256, + DMNSN_OPT_THREADS, DMNSN_OPT_QUALITY, DMNSN_OPT_RESILIENCE }; static struct option long_options[] = { { "help", no_argument, NULL, '?' }, + { "version", no_argument, NULL, DMNSN_OPT_VERSION }, { "output", required_argument, NULL, 'o' }, { "width", required_argument, NULL, 'w' }, { "height", required_argument, NULL, 'h' }, @@ -79,6 +82,9 @@ main(int argc, char **argv) { case '?': print_usage(stdout, argv[0]); return EXIT_SUCCESS; + case DMNSN_OPT_VERSION: + print_version(stdout); + return EXIT_SUCCESS; case 'o': if (output) { @@ -328,6 +334,7 @@ print_usage(FILE *file, const char *arg0) "Usage: %s [OPTIONS...] INPUT_FILE\n\n" " Main options:\n" " -?, --help show this help\n" + " --version show the version of %s\n" " -o, --output=FILE output to FILE\n\n" " Output options:\n" " -w, --width=WIDTH set canvas width to WIDTH (default 640)\n" @@ -348,7 +355,14 @@ print_usage(FILE *file, const char *arg0) "Copyright (C) 2009-2010 Tavian Barnes, <%s>\n" "Licensed under the GNU General Public License\n", arg0, + PACKAGE_NAME, PACKAGE_STRING, PACKAGE_URL, PACKAGE_BUGREPORT); } + +static void +print_version(FILE *file) +{ + fprintf(file, "%s\n", PACKAGE_STRING); +} -- cgit v1.2.3