summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-05-21 16:16:52 -0600
committerTavian Barnes <tavianator@gmail.com>2010-05-21 16:16:52 -0600
commit07fbc325118eb3192ea3b34bbdb6c855c20ee1c7 (patch)
tree2027fc0e57c24050d5ebc7026838bb7b3f21a99c
parentbbfe952f6c8f16bc8c8a266f7c2a6520ad8d6ebc (diff)
downloaddimension-07fbc325118eb3192ea3b34bbdb6c855c20ee1c7.tar.xz
Add std-options check to 'make installcheck'.
-rw-r--r--configure.ac2
-rw-r--r--dimension/main.c16
2 files changed, 16 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 29dcfd2..ced49a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@ dnl Initialization
AC_PREREQ(2.65)
AC_INIT(Dimension, 0.0.0, tavianator@gmail.com, dimension,
[http://dmnsn.googlecode.com])
-AM_INIT_AUTOMAKE([parallel-tests color-tests])
+AM_INIT_AUTOMAKE([parallel-tests color-tests std-options])
AM_SILENT_RULES([yes])
dnl Use C99 mode with GNU extensions
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);
+}