Added version command line option.

This commit is contained in:
Svend Sorensen
2005-03-24 18:39:26 +00:00
parent 6005651eec
commit 0e53f7ef35
6 changed files with 69 additions and 3 deletions

View File

@@ -12,6 +12,12 @@
#include "cuefile.h"
#include "time.h"
#if HAVE_CONFIG_H
#include "config.h"
#else
#define PACKAGE_STRING "cuebreakpoints"
#endif
char *progname;
/* pregap correction modes
@@ -33,6 +39,7 @@ OPTIONS\n\
--append-gaps append pregaps to previous track (default)\n\
--prepend-gaps prefix pregaps to track\n\
--split-gaps split at beginning and end of pregaps\n\
-V, --version print version information\n\
", stdout);
} else {
fprintf(stderr, "run `%s --help' for usage\n", progname);
@@ -41,6 +48,13 @@ OPTIONS\n\
exit (status);
}
void version ()
{
printf("%s\n", PACKAGE_STRING);
exit(0);
}
void print_m_ss_ff (long frame)
{
int m, s, f;
@@ -119,12 +133,13 @@ int main (int argc, char **argv)
{"append-gaps", no_argument, NULL, 'a'},
{"prepend-gaps", no_argument, NULL, 'p'},
{"split-gaps", no_argument, NULL, 's'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0}
};
progname = *argv;
while (-1 != (c = getopt_long(argc, argv, "hi:", longopts, NULL))) {
while (-1 != (c = getopt_long(argc, argv, "hi:V", longopts, NULL))) {
switch (c) {
case 'h':
usage(0);
@@ -148,6 +163,9 @@ int main (int argc, char **argv)
case 's':
gaps = SPLIT;
break;
case 'V':
version();
break;
default:
usage(1);
break;