wmbattery: Add -v option to display version number.

Also, in order to facilitate this, keep track of version number in configure.ac.
It was previously only mentioned in ChangeLog.
This commit is contained in:
Doug Torrance 2014-10-05 10:30:04 -05:00 committed by Carlos R. Mafra
parent 8b8f2745fb
commit a750a6b25f
2 changed files with 7 additions and 2 deletions

View file

@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(wmbattery.c)
AC_INIT(wmbattery.c, 2.44)
AC_CONFIG_HEADER(config.h)
AC_CONFIG_AUX_DIR(autoconf)

View file

@ -314,7 +314,7 @@ char *parse_commandline(int argc, char *argv[])
char *s;
while (c != -1) {
c = getopt(argc, argv, "hd:g:if:b:w:c:l:es:a:x:");
c = getopt(argc, argv, "hd:g:if:b:w:c:l:es:a:x:v");
switch (c) {
case 'h':
printf("Usage: wmbattery [options]\n");
@ -330,6 +330,7 @@ char *parse_commandline(int argc, char *argv[])
printf("\t-s granularity\tignore fluctuations less than granularity%% (implies -e)\n");
printf("\t-a file\t\twhen critical send file to /dev/audio\n");
printf("\t-x command\twhen critical execute this command\n");
printf("\t-v\t\tdisplay version number\n");
exit(0);
break;
case 'd':
@ -374,6 +375,10 @@ char *parse_commandline(int argc, char *argv[])
case 'x':
crit_command = strdup(optarg);
break;
case 'v':
printf("wmbattery "PACKAGE_VERSION"\n");
exit(0);
break;
}
}