add version command line argument to zmf

pull/664/head
Isaac Connor 2015-01-06 20:54:49 -05:00
parent 85e51528a6
commit 258c97f75f
1 changed files with 6 additions and 1 deletions

View File

@ -99,6 +99,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 );
}
@ -113,6 +114,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}
};
@ -120,7 +122,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;
@ -135,6 +137,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;