<A NAME="general_options"><FONT SIZE="+1"><B>General Options</B></FONT></A>
</TD>
</TR>
+ <TR>
+ <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+ <TT>-v</TT>, <TT>--version</TT>
+ </TD>
+ <TD>
+ Show the <B><TT>flac</TT></B> version number.
+ </TD>
+ </TR>
<TR>
<TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
<TT>-h</TT>, <TT>--help</TT>
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "FLAC" "1" "13 August 2002" "" ""
+.TH "FLAC" "1" "19 August 2002" "" ""
.SH NAME
flac \- Free Lossless Audio Codec
.SH SYNOPSIS
description, see the HTML documentation.
.SS "GENERIC OPTIONS"
.TP
+\fB-v, --version \fR
+Show the flac version number
+.TP
\fB-h, --help \fR
Show basic usage and a list of all options
.TP
<!ENTITY dhfirstname "<firstname>Matt</firstname>">
<!ENTITY dhsurname "<surname>Zimmerman</surname>">
<!-- Please adjust the date whenever revising the manpage. -->
- <!ENTITY dhdate "<date>August 13, 2002</date>">
+ <!ENTITY dhdate "<date>August 19, 2002</date>">
<!-- SECTION should be 1-8, maybe w/ subsection other parameters are
allowed: see man(7), man(1). -->
<!ENTITY dhsection "<manvolnum>1</manvolnum>">
<title>Generic Options</title>
<variablelist>
+ <varlistentry>
+ <term><option>-v</option>, <option>--version</option>
+ </term>
+ <listitem>
+ <para>Show the flac version number</para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>-h</option>, <option>--help</option>
</term>
static int usage_error(const char *message, ...);
static void short_usage();
+static void show_version();
static void show_help();
static void show_explain();
static void format_mistake(const char *infilename, const char *wrong, const char *right);
* general options
*/
{ "help", 0, 0, 'h' },
+ { "explain", 0, 0, 'H' },
+ { "version", 0, 0, 'v' },
{ "decode", 0, 0, 'd' },
{ "analyze", 0, 0, 'a' },
{ "test", 0, 0, 't' },
static struct {
FLAC__bool show_help;
FLAC__bool show_explain;
+ FLAC__bool show_version;
FLAC__bool mode_decode;
FLAC__bool verify;
FLAC__bool verbose;
{
int retval = 0;
- if(option_values.show_explain) {
+ if(option_values.show_version) {
+ show_version();
+ return 0;
+ }
+ else if(option_values.show_explain) {
show_explain();
return 0;
}
int option_index = 1;
FLAC__bool had_error = false;
/*@@@ E and R: are deprecated */
- const char *short_opts = "0123456789ab:cdeFhHl:mMo:pP:q:r:sS:tV";
+ const char *short_opts = "0123456789ab:cdeFhHl:mMo:pP:q:r:sS:tvV";
while ((short_option = FLAC__share__getopt_long(argc, argv, short_opts, long_options_, &option_index)) != -1) {
switch (short_option) {
case 'H':
option_values.show_explain = true;
break;
+ case 'v':
+ option_values.show_version = true;
+ break;
case 'd':
option_values.mode_decode = true;
break;
return 1;
}
+void show_version()
+{
+ printf("flac %s\n", FLAC__VERSION_STRING);
+}
+
static void usage_header()
{
printf("===============================================================================\n");
usage_header();
usage_summary();
printf("generic options:\n");
+ printf(" -v, --version Show the flac version number\n");
printf(" -h, --help Show this screen\n");
printf(" -H, --explain Show detailed explanation of usage and options\n");
printf(" -d, --decode Decode (the default behavior is to encode)\n");
printf("files using -fr.\n");
printf("\n");
printf("generic options:\n");
+ printf(" -v, --version Show the flac version number\n");
printf(" -h, --help Show basic usage a list of all options\n");
printf(" -H, --explain Show this screen\n");
printf(" -d, --decode Decode (the default behavior is to encode)\n");
{ "add-padding", 1, 0, 0 },
/* major operations */
{ "help", 0, 0, 0 },
+ { "version", 0, 0, 0 },
{ "list", 0, 0, 0 },
{ "append", 0, 0, 0 },
{ "remove", 0, 0, 0 },
FLAC__bool utf8_convert;
FLAC__bool use_padding;
FLAC__bool show_long_help;
+ FLAC__bool show_version;
FLAC__bool application_data_format_is_hexdump;
struct {
Operation *operations;
static Operation *append_major_operation(CommandLineOptions *options, OperationType type);
static Operation *append_shorthand_operation(CommandLineOptions *options, OperationType type);
static Argument *append_argument(CommandLineOptions *options, ArgumentType type);
+static void show_version();
static int short_usage(const char *message, ...);
static int long_usage(const char *message, ...);
static char *local_strdup(const char *source);
options->utf8_convert = true;
options->use_padding = true;
options->show_long_help = false;
+ options->show_version = false;
options->application_data_format_is_hexdump = false;
options->ops.operations = 0;
if(options->prefix_with_filename == 2)
options->prefix_with_filename = (argc - FLAC__share__optind > 1);
- if(FLAC__share__optind >= argc && !options->show_long_help) {
+ if(FLAC__share__optind >= argc && !options->show_long_help && !options->show_version) {
fprintf(stderr,"ERROR: you must specify at least one FLAC file;\n");
fprintf(stderr," metaflac cannot be used as a pipe\n");
had_error = true;
else if(0 == strcmp(opt, "help")) {
options->show_long_help = true;
}
+ else if(0 == strcmp(opt, "version")) {
+ options->show_version = true;
+ }
else if(0 == strcmp(opt, "list")) {
(void) append_major_operation(options, OP__LIST);
}
return options->args.arguments + (options->args.num_arguments - 1);
}
+void show_version()
+{
+ printf("metaflac %s\n", FLAC__VERSION_STRING);
+}
+
static void usage_header(FILE *out)
{
fprintf(out, "==============================================================================\n");
fprintf(out, " the extra 4 bytes is for the metadata block header.\n");
fprintf(out, "\n");
fprintf(out, "Major operations:\n");
+ fprintf(out, "--version\n");
+ fprintf(out, " Show the metaflac version number.\n");
fprintf(out, "--list\n");
fprintf(out, " List the contents of one or more metadata blocks to stdout. By default,\n");
fprintf(out, " all metadata blocks are listed in text format. Use the following options\n");
if(options->show_long_help) {
long_usage(0);
}
+ if(options->show_version) {
+ show_version();
+ }
else if(options->args.checks.num_major_ops > 0) {
FLAC__ASSERT(options->args.checks.num_shorthand_ops == 0);
FLAC__ASSERT(options->args.checks.num_major_ops == 1);