aboutsummaryrefslogtreecommitdiffstats
path: root/ponymix.cc
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-03-14 19:56:18 -0400
committerDave Reisner <dreisner@archlinux.org>2013-04-10 10:12:43 -0400
commit30cd5880addf928908817f5e433ea993c83db912 (patch)
tree5587789d55132e41ee71f841b7cc8df824e41ad2 /ponymix.cc
parent230a127bc8fdf638a0ecccecf43cfed425f30468 (diff)
downloadmirror-ponymix-30cd5880addf928908817f5e433ea993c83db912.tar.gz
mirror-ponymix-30cd5880addf928908817f5e433ea993c83db912.tar.bz2
mirror-ponymix-30cd5880addf928908817f5e433ea993c83db912.zip
add version function, wire it up from the makefile
Diffstat (limited to 'ponymix.cc')
-rw-r--r--ponymix.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/ponymix.cc b/ponymix.cc
index a378ed0..d20aeb5 100644
--- a/ponymix.cc
+++ b/ponymix.cc
@@ -473,10 +473,16 @@ static const std::pair<const string, const Command>& string_to_command(
return *match;
}
+static void version() {
+ fputs("ponymix v" PONYMIX_VERSION "\n", stdout);
+ exit(EXIT_SUCCESS);
+}
+
static void usage() {
printf("usage: %s [options] <command>...\n", program_invocation_short_name);
fputs("\nOptions:\n"
- " -h, --help display this help and exit\n\n"
+ " -h, --help display this help and exit\n"
+ " -V, --version display program version and exit\n\n"
" -c, --card CARD target card (index or name)\n"
" -d, --device DEVICE target device (index or name)\n"
@@ -559,6 +565,7 @@ bool parse_options(int argc, char** argv) {
{ "help", no_argument, 0, 'h' },
{ "notify", no_argument, 0, 'N' },
{ "type", required_argument, 0, 't' },
+ { "version", no_argument, 0, 'V' },
{ "sink", no_argument, 0, 0x100 },
{ "output", no_argument, 0, 0x101 },
{ "source", no_argument, 0, 0x102 },
@@ -569,7 +576,7 @@ bool parse_options(int argc, char** argv) {
};
for (;;) {
- int opt = getopt_long(argc, argv, "c:d:hNt:", opts, nullptr);
+ int opt = getopt_long(argc, argv, "c:d:hNt:V", opts, nullptr);
if (opt == -1)
break;
@@ -590,6 +597,9 @@ bool parse_options(int argc, char** argv) {
opt_devtype = string_to_devtype_or_die(optarg);
opt_listrestrict = true;
break;
+ case 'V':
+ version();
+ break;
case 0x100:
case 0x101:
opt_devtype = DEVTYPE_SINK;