Add a --version option to cec-follower to retrieve the version of
cec-follower.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
Changes in v3:
- embed PACKAGE_VERSION instead of string concatenation
---
utils/cec-follower/cec-follower.cpp | 11 +++++++++++
1 file changed, 11 insertions(+)
@@ -46,6 +46,7 @@ enum Option {
OptShowState = 's',
OptWallClock = 'w',
OptServiceByDigID = 128,
+ OptVersion,
OptLast = 256
};
@@ -70,10 +71,16 @@ static struct option long_options[] = {
{ "wall-clock", no_argument, 0, OptWallClock },
{ "service-by-dig-id", no_argument, 0, OptServiceByDigID },
{ "ignore", required_argument, 0, OptIgnore },
+ { "version", no_argument, 0, OptVersion },
{ 0, 0, 0, 0 }
};
+static void version()
+{
+ printf("cec-follower %s\n", PACKAGE_VERSION);
+}
+
static void usage()
{
printf("Usage:\n"
@@ -93,6 +100,7 @@ static void usage()
" Ignore messages from logical address <la> and opcode\n"
" <opcode>. 'all' can be used for <la> or <opcode> to match\n"
" all logical addresses or opcodes.\n"
+ " --version Show version information\n"
);
}
@@ -427,6 +435,9 @@ int main(int argc, char **argv)
show_msgs = true;
show_state = true;
break;
+ case OptVersion:
+ version();
+ std::exit(EXIT_SUCCESS);
case ':':
fprintf(stderr, "Option '%s' requires a value\n",
argv[optind]);