From ff76fef936eb0d5e2912819be21a7a415b761127 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Tue, 10 Dec 2013 16:32:40 -0800 Subject: Add --version --- src/caskbench.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/caskbench.cpp') diff --git a/src/caskbench.cpp b/src/caskbench.cpp index 4f6b1bf..3809839 100644 --- a/src/caskbench.cpp +++ b/src/caskbench.cpp @@ -23,9 +23,10 @@ typedef struct _caskbench_options { int dry_run; int iterations; int list_surfaces; - int size; char* output_file; char* surface_type; + int size; + int version; } caskbench_options_t; typedef struct _caskbench_perf_test { @@ -144,6 +145,14 @@ _status_to_string(int result) } } +static void +print_version() +{ + printf("%s version %s\n", + PACKAGE_NAME, + PACKAGE_VERSION); +} + static void print_surfaces_available() { @@ -174,11 +183,14 @@ process_options(caskbench_options_t *opt, int argc, char *argv[]) {"output-file", 'o', POPT_ARG_STRING, &opt->output_file, 0, "Filename to write JSON output to", NULL}, + {"surface-type", 't', POPT_ARG_STRING, &opt->surface_type, 0, + "Type of graphics surface to use (see --list-surfaces for available surfaces)", + NULL}, {"test-size", 's', POPT_ARG_INT, &opt->size, 0, "Controls the complexity of the tests, such as number of drawn elements", NULL}, - {"surface-type", 't', POPT_ARG_STRING, &opt->surface_type, 0, - "Type of graphics surface to use (see --list-surfaces for available surfaces)", + {"version", 'V', POPT_ARG_NONE, &opt->version, 0, + "Display the program version", NULL}, POPT_AUTOHELP {NULL} @@ -252,6 +264,10 @@ main (int argc, char *argv[]) process_options(&opt, argc, argv); + if (opt.version) { + print_version(); + exit(0); + } if (opt.list_surfaces) { print_surfaces_available(); exit(0); -- cgit v1.3.1-4-g156e