Commit 5ea8a0df authored by Max Kellermann's avatar Max Kellermann

decoder_list: print decoder list with suffixes

Print the list of suffixes supported by each decoder, instead of prining a list of all suffixes of all decoders with duplicates.
parent 1bb0124b
...@@ -47,13 +47,9 @@ static void version(void) ...@@ -47,13 +47,9 @@ static void version(void)
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" "warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
"\n" "\n"
"Supported formats:\n"); "Supported decoders:\n");
decoder_plugin_init_all(); decoder_plugin_init_all();
decoder_plugin_print_all_suffixes(stdout);
puts("\n"
"Supported decoders:\n");
decoder_plugin_print_all_decoders(stdout); decoder_plugin_print_all_decoders(stdout);
puts("\n" puts("\n"
......
...@@ -154,36 +154,25 @@ decoder_plugin_from_name(const char *name) ...@@ -154,36 +154,25 @@ decoder_plugin_from_name(const char *name)
return NULL; return NULL;
} }
void decoder_plugin_print_all_suffixes(FILE * fp) void decoder_plugin_print_all_decoders(FILE * fp)
{ {
const char *const*suffixes;
for (unsigned i = 0; i < num_decoder_plugins; ++i) { for (unsigned i = 0; i < num_decoder_plugins; ++i) {
const struct decoder_plugin *plugin = decoder_plugins[i]; const struct decoder_plugin *plugin = decoder_plugins[i];
const char *const*suffixes;
if (!decoder_plugins_enabled[i]) if (!decoder_plugins_enabled[i])
continue; continue;
suffixes = plugin->suffixes; fprintf(fp, "[%s]", plugin->name);
while (suffixes && *suffixes) {
fprintf(fp, "%s ", *suffixes);
suffixes++;
}
}
fprintf(fp, "\n");
fflush(fp);
}
void decoder_plugin_print_all_decoders(FILE * fp) for (suffixes = plugin->suffixes;
{ suffixes != NULL && *suffixes != NULL;
for (unsigned i = 0; i < num_decoder_plugins; ++i) { ++suffixes) {
const struct decoder_plugin *plugin = decoder_plugins[i]; fprintf(fp, " %s", *suffixes);
if (!decoder_plugins_enabled[i]) }
continue;
fprintf(fp, "%s ", plugin->name); fprintf(fp, "\n");
} }
fprintf(fp, "\n");
fflush(fp);
} }
/** /**
......
...@@ -34,8 +34,6 @@ decoder_plugin_from_mime_type(const char *mimeType, unsigned int next); ...@@ -34,8 +34,6 @@ decoder_plugin_from_mime_type(const char *mimeType, unsigned int next);
const struct decoder_plugin * const struct decoder_plugin *
decoder_plugin_from_name(const char *name); decoder_plugin_from_name(const char *name);
void decoder_plugin_print_all_suffixes(FILE * fp);
void decoder_plugin_print_all_decoders(FILE * fp); void decoder_plugin_print_all_decoders(FILE * fp);
/* this is where we "load" all the "plugins" ;-) */ /* this is where we "load" all the "plugins" ;-) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment