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.
This commit is contained in:
Max Kellermann 2009-02-28 15:29:51 +01:00
parent 1bb0124b77
commit 5ea8a0df3f
3 changed files with 12 additions and 29 deletions

View File

@ -47,13 +47,9 @@ static void version(void)
"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"
"\n"
"Supported formats:\n");
"Supported decoders:\n");
decoder_plugin_init_all();
decoder_plugin_print_all_suffixes(stdout);
puts("\n"
"Supported decoders:\n");
decoder_plugin_print_all_decoders(stdout);
puts("\n"

View File

@ -154,36 +154,25 @@ decoder_plugin_from_name(const char *name)
return NULL;
}
void decoder_plugin_print_all_suffixes(FILE * fp)
{
const char *const*suffixes;
for (unsigned i = 0; i < num_decoder_plugins; ++i) {
const struct decoder_plugin *plugin = decoder_plugins[i];
if (!decoder_plugins_enabled[i])
continue;
suffixes = plugin->suffixes;
while (suffixes && *suffixes) {
fprintf(fp, "%s ", *suffixes);
suffixes++;
}
}
fprintf(fp, "\n");
fflush(fp);
}
void decoder_plugin_print_all_decoders(FILE * fp)
{
for (unsigned i = 0; i < num_decoder_plugins; ++i) {
const struct decoder_plugin *plugin = decoder_plugins[i];
const char *const*suffixes;
if (!decoder_plugins_enabled[i])
continue;
fprintf(fp, "%s ", plugin->name);
fprintf(fp, "[%s]", plugin->name);
for (suffixes = plugin->suffixes;
suffixes != NULL && *suffixes != NULL;
++suffixes) {
fprintf(fp, " %s", *suffixes);
}
fprintf(fp, "\n");
}
fprintf(fp, "\n");
fflush(fp);
}
/**

View File

@ -34,8 +34,6 @@ decoder_plugin_from_mime_type(const char *mimeType, unsigned int next);
const struct decoder_plugin *
decoder_plugin_from_name(const char *name);
void decoder_plugin_print_all_suffixes(FILE * fp);
void decoder_plugin_print_all_decoders(FILE * fp);
/* this is where we "load" all the "plugins" ;-) */