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

@@ -31,6 +31,10 @@ prefix pregaps to track
.B \--split-gaps .B \--split-gaps
split at beginning and end of pregaps split at beginning and end of pregaps
. .
.TP
.B \--version
print version information
.
.SH NOTES .SH NOTES
The breakpoints are in a format usable by shnsplit (part of the shntool package). The breakpoints are in a format usable by shnsplit (part of the shntool package).
.PP .PP

View File

@@ -23,6 +23,10 @@ set format of input file
.B \-o, \--output-format cue|toc .B \-o, \--output-format cue|toc
set format of output file set format of output file
. .
.TP
.B \--version
print version information
.
.SH NOTES .SH NOTES
If infile or outfile is not specified, stdin and stdout are used, respectively. If a filename is specified and the format is not specified, the format will be set based on a ".cue" or ".toc" suffix. If the output file format is not specified, and it cannot be determined from the suffix, it will be set to the opposite of the input format. If infile or outfile is not specified, stdin and stdout are used, respectively. If a filename is specified and the format is not specified, the format will be set based on a ".cue" or ".toc" suffix. If the output file format is not specified, and it cannot be determined from the suffix, it will be set to the opposite of the input format.
. .

View File

@@ -31,6 +31,10 @@ set disc template (see TEMPLATE EXPANSION)
.B \-t, \--track-template <template> .B \-t, \--track-template <template>
set track template (see TEMPLATE EXPANSION) set track template (see TEMPLATE EXPANSION)
. .
.TP
.B \--version
print version information
.
.SH TEMPLATE EXPANSION .SH TEMPLATE EXPANSION
All characters in the template are reproduced in the output except for conversions, which begin with `%'. All characters in the template are reproduced in the output except for conversions, which begin with `%'.
.PP .PP

View File

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

View File

@@ -11,6 +11,12 @@
#include <getopt.h> #include <getopt.h>
#include "cuefile.h" #include "cuefile.h"
#if HAVE_CONFIG_H
#include "config.h"
#else
#define PACKAGE_STRING "cuebreakpoints"
#endif
char *progname; char *progname;
void usage (int status) void usage (int status)
@@ -23,6 +29,7 @@ OPTIONS\n\
-h, --help print usage\n\ -h, --help print usage\n\
-i, --input-format cue|toc set format of input file\n\ -i, --input-format cue|toc set format of input file\n\
-o, --output-format cue|toc set format of output file\n\ -o, --output-format cue|toc set format of output file\n\
-V, --version print version information\n\
", stdout); ", stdout);
} else { } else {
fprintf(stderr, "run `%s --help' for usage\n", progname); fprintf(stderr, "run `%s --help' for usage\n", progname);
@@ -31,6 +38,13 @@ OPTIONS\n\
exit (status); exit (status);
} }
void version ()
{
printf("%s\n", PACKAGE_STRING);
exit(0);
}
int convert (char *iname, int iformat, char *oname, int oformat) int convert (char *iname, int iformat, char *oname, int oformat)
{ {
Cd *cd = NULL; Cd *cd = NULL;
@@ -72,12 +86,13 @@ int main (int argc, char **argv)
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{"input-format", required_argument, NULL, 'i'}, {"input-format", required_argument, NULL, 'i'},
{"output-format", required_argument, NULL, 'o'}, {"output-format", required_argument, NULL, 'o'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
progname = *argv; progname = *argv;
while (-1 != (c = getopt_long(argc, argv, "hi:o:", longopts, NULL))) { while (-1 != (c = getopt_long(argc, argv, "hi:o:V", longopts, NULL))) {
switch (c) { switch (c) {
case 'h': case 'h':
usage(0); usage(0);
@@ -102,6 +117,9 @@ int main (int argc, char **argv)
usage(1); usage(1);
} }
break; break;
case 'V':
version();
break;
default: default:
usage(1); usage(1);
break; break;

View File

@@ -12,6 +12,12 @@
#include <ctype.h> /* isdigit() */ #include <ctype.h> /* isdigit() */
#include "cuefile.h" #include "cuefile.h"
#if HAVE_CONFIG_H
#include "config.h"
#else
#define PACKAGE_STRING "cuebreakpoints"
#endif
/* default templates */ /* default templates */
#define D_TEMPLATE "\ #define D_TEMPLATE "\
@@ -67,6 +73,7 @@ OPTIONS\n\
-n, --track-number <number> only print track information for single track\n\ -n, --track-number <number> only print track information for single track\n\
-d, --disc-template <template> set disc template (see TEMPLATE EXPANSION)\n\ -d, --disc-template <template> set disc template (see TEMPLATE EXPANSION)\n\
-t, --track-template <template> set track template (see TEMPLATE EXPANSION)\n\ -t, --track-template <template> set track template (see TEMPLATE EXPANSION)\n\
-V, --version print version information\n\
\n\ \n\
Template Expansion\n\ Template Expansion\n\
Disc:\n\ Disc:\n\
@@ -103,6 +110,13 @@ Any other %<character> is expanded to that character. For example, to get a\n\
exit (status); exit (status);
} }
void version ()
{
printf("%s\n", PACKAGE_STRING);
exit(0);
}
void disc_field (char *conv, int length, Cd *cd, Value *value) void disc_field (char *conv, int length, Cd *cd, Value *value)
{ {
char *c; /* pointer to conversion character */ char *c; /* pointer to conversion character */
@@ -435,12 +449,13 @@ int main (int argc, char **argv)
{"track-number", required_argument, NULL, 'n'}, {"track-number", required_argument, NULL, 'n'},
{"disc-template", required_argument, NULL, 'd'}, {"disc-template", required_argument, NULL, 'd'},
{"track-template", required_argument, NULL, 't'}, {"track-template", required_argument, NULL, 't'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
progname = *argv; progname = *argv;
while (-1 != (c = getopt_long(argc, argv, "hi:n:d:t:", longopts, NULL))) { while (-1 != (c = getopt_long(argc, argv, "hi:n:d:t:V", longopts, NULL))) {
switch (c) { switch (c) {
case 'h': case 'h':
usage(0); usage(0);
@@ -464,6 +479,9 @@ int main (int argc, char **argv)
case 't': case 't':
t_template = optarg; t_template = optarg;
break; break;
case 'V':
version();
break;
default: default:
usage(1); usage(1);
break; break;