add version command line argument to zma

This commit is contained in:
Isaac Connor 2015-01-06 20:52:18 -05:00
parent 6f42f1c6d8
commit 85e51528a6
1 changed files with 6 additions and 1 deletions

View File

@ -31,6 +31,7 @@ void Usage()
fprintf( stderr, "Options:\n" );
fprintf( stderr, " -m, --monitor <monitor_id> : Specify which monitor to use\n" );
fprintf( stderr, " -h, --help : This screen\n" );
fprintf( stderr, " -v, --version : Report the installed version of ZoneMinder\n" );
exit( 0 );
}
@ -45,6 +46,7 @@ int main( int argc, char *argv[] )
static struct option long_options[] = {
{"monitor", 1, 0, 'm'},
{"help", 0, 0, 'h'},
{"version", 0, 0, 'v'},
{0, 0, 0, 0}
};
@ -52,7 +54,7 @@ int main( int argc, char *argv[] )
{
int option_index = 0;
int c = getopt_long (argc, argv, "m:h", long_options, &option_index);
int c = getopt_long (argc, argv, "m:h:v", long_options, &option_index);
if (c == -1)
{
break;
@ -67,6 +69,9 @@ int main( int argc, char *argv[] )
case '?':
Usage();
break;
case 'v':
cout << ZM_VERSION << "\n";
exit(0);
default:
//fprintf( stderr, "?? getopt returned character code 0%o ??\n", c );
break;