disallow multiple input FLAC files when --import-tags-from=- is used (SF#1082577...
authorJosh Coalson <jcoalson@users.sourceforce.net>
Tue, 14 Nov 2006 05:02:35 +0000 (05:02 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Tue, 14 Nov 2006 05:02:35 +0000 (05:02 +0000)
doc/html/documentation.html
man/metaflac.sgml
src/metaflac/options.c

index f2d60a6..99952ab 100644 (file)
                                        <span class="argument">--import-tags-from=FILE</span>
                                </td>
                                <td>
-                                       Import tags from a file.  Use <span class="argument">-</span> for stdin.  Each line should be of the form <span class="argument">NAME=VALUE</span>.  Multi-line comments are currently not supported.  Specify <span class="argument">--remove-all-tags</span> and/or <a href="#metaflac_options_no_utf8_convert"><span class="argument">--no-utf8-convert</span></a> before <span class="argument">--import-tags-from</span> if necessary.
+                                       Import tags from a file.  Use <span class="argument">-</span> for stdin.  Each line should be of the form <span class="argument">NAME=VALUE</span>.  Multi-line comments are currently not supported.  Specify <span class="argument">--remove-all-tags</span> and/or <a href="#metaflac_options_no_utf8_convert"><span class="argument">--no-utf8-convert</span></a> before <span class="argument">--import-tags-from</span> if necessary.  If <span class="argument">FILE</span> is <span class="argument">-</span> (stdin), only one FLAC file may be specified.
                                </td>
                        </tr>
                        <tr>
index 3a80a37..90697a9 100644 (file)
@@ -265,7 +265,8 @@ manpage.1: manpage.sgml
            Import tags from a file.  Use '-' for stdin.  Each
            line should be of the form NAME=VALUE.  Multi-line comments
            are currently not supported.  Specify --remove-all-tags and/or
-           --no-utf8-convert before --import-tags-from if necessary.
+           --no-utf8-convert before --import-tags-from if necessary.  If
+           FILE is '-' (stdin), only one FLAC file may be specified.
          </para>
         </listitem>
       </varlistentry>
index be9d77c..6e3acd5 100644 (file)
@@ -202,16 +202,27 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options)
                }
        }
 
-       /* check for only one FLAC file used with --import-cuesheet-from/--export-cuesheet-to */
-       if(
-               (
-                       0 != find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM) ||
-                       0 != find_shorthand_operation(options, OP__EXPORT_CUESHEET_TO) ||
-                       0 != find_shorthand_operation(options, OP__EXPORT_PICTURE_TO)
-               ) && options->num_files > 1
-       ) {
-               fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-cuesheet-from', '--export-cuesheet-to' or '--export-picture-to'\n");
-               had_error = true;
+       /* check for only one FLAC file used with certain options */
+       if(options->num_files > 1) {
+               if(0 != find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM)) {
+                       fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-cuesheet-from'\n");
+                       had_error = true;
+               }
+               if(0 != find_shorthand_operation(options, OP__EXPORT_CUESHEET_TO)) {
+                       fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-cuesheet-to'\n");
+                       had_error = true;
+               }
+               if(0 != find_shorthand_operation(options, OP__EXPORT_PICTURE_TO)) {
+                       fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-picture-to'\n");
+                       had_error = true;
+               }
+               if(
+                       0 != find_shorthand_operation(options, OP__IMPORT_VC_FROM) &&
+                       0 == strcmp(find_shorthand_operation(options, OP__IMPORT_VC_FROM)->argument.filename.value, "-")
+               ) {
+                       fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-tags-from=-'\n");
+                       had_error = true;
+               }
        }
 
        if(options->args.checks.has_block_type && options->args.checks.has_except_block_type) {