add version command line argument to zmc

pull/664/head
Isaac Connor 2015-01-06 20:49:33 -05:00
parent e9fc7cf33a
commit 6f42f1c6d8
1 changed files with 6 additions and 1 deletions

View File

@ -45,6 +45,7 @@ void Usage()
fprintf( stderr, " -f, --file <file_path> : For local images, jpg file to access.\n" ); fprintf( stderr, " -f, --file <file_path> : For local images, jpg file to access.\n" );
fprintf( stderr, " -m, --monitor <monitor_id> : For sources associated with a single monitor\n" ); fprintf( stderr, " -m, --monitor <monitor_id> : For sources associated with a single monitor\n" );
fprintf( stderr, " -h, --help : This screen\n" ); fprintf( stderr, " -h, --help : This screen\n" );
fprintf( stderr, " -v, --version : Report the installed version of ZoneMinder\n" );
exit( 0 ); exit( 0 );
} }
@ -71,6 +72,7 @@ int main( int argc, char *argv[] )
{"file", 1, 0, 'f'}, {"file", 1, 0, 'f'},
{"monitor", 1, 0, 'm'}, {"monitor", 1, 0, 'm'},
{"help", 0, 0, 'h'}, {"help", 0, 0, 'h'},
{"version", 0, 0, 'v'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
@ -78,7 +80,7 @@ int main( int argc, char *argv[] )
{ {
int option_index = 0; int option_index = 0;
int c = getopt_long (argc, argv, "d:H:P:p:f:m:h", long_options, &option_index); int c = getopt_long (argc, argv, "d:H:P:p:f:m:h:v", long_options, &option_index);
if (c == -1) if (c == -1)
{ {
break; break;
@ -108,6 +110,9 @@ int main( int argc, char *argv[] )
case '?': case '?':
Usage(); Usage();
break; break;
case 'v':
cout << ZM_VERSION << "\n";
exit(0);
default: default:
//fprintf( stderr, "?? getopt returned character code 0%o ??\n", c ); //fprintf( stderr, "?? getopt returned character code 0%o ??\n", c );
break; break;