Index: update-mime-database.c =================================================================== RCS file: /cvs/mime/shared-mime-info/update-mime-database.c,v retrieving revision 1.39 diff -u -p -r1.39 update-mime-database.c --- update-mime-database.c 19 Dec 2005 16:37:47 -0000 1.39 +++ update-mime-database.c 16 Jul 2006 15:05:40 -0000 @@ -106,7 +106,7 @@ static Magic *magic_new(xmlNode *node, T static void usage(const char *name) { - fprintf(stderr, _("Usage: %s [-hv] MIME-DIR\n"), name); + fprintf(stderr, _("Usage: %s [-hvV] MIME-DIR\n"), name); } static void free_type(gpointer data) @@ -2540,7 +2540,8 @@ write_strings (FILE *cache, } static gboolean -write_cache (FILE *cache) +write_cache (FILE *cache, + gboolean verbose) { guint strings_offset; guint alias_offset; @@ -2569,8 +2570,9 @@ write_cache (FILE *cache) g_printerr ("Failed to write strings\n"); return FALSE; } - g_print ("Wrote %d strings at %x - %x\n", - g_hash_table_size (strings), strings_offset, offset); + if (verbose) + g_print ("Wrote %d strings at %x - %x\n", + g_hash_table_size (strings), strings_offset, offset); alias_offset = offset; if (!write_alias_cache (cache, strings, &offset)) @@ -2578,7 +2580,8 @@ write_cache (FILE *cache) g_printerr ("Failed to write alias list\n"); return FALSE; } - g_print ("Wrote aliases at %x - %x\n", alias_offset, offset); + if (verbose) + g_print ("Wrote aliases at %x - %x\n", alias_offset, offset); parent_offset = offset; if (!write_parent_cache (cache, strings, &offset)) @@ -2586,7 +2589,8 @@ write_cache (FILE *cache) g_printerr ("Failed to write parent list\n"); return FALSE; } - g_print ("Wrote parents at %x - %x\n", parent_offset, offset); + if (verbose) + g_print ("Wrote parents at %x - %x\n", parent_offset, offset); literal_offset = offset; if (!write_literal_cache (cache, strings, &offset)) @@ -2594,7 +2598,8 @@ write_cache (FILE *cache) g_printerr ("Failed to write literal list\n"); return FALSE; } - g_print ("Wrote literal globs at %x - %x\n", literal_offset, offset); + if (verbose) + g_print ("Wrote literal globs at %x - %x\n", literal_offset, offset); suffix_offset = offset; if (!write_suffix_cache (cache, strings, &offset)) @@ -2602,7 +2607,8 @@ write_cache (FILE *cache) g_printerr ("Failed to write suffix list\n"); return FALSE; } - g_print ("Wrote suffix globs at %x - %x\n", suffix_offset, offset); + if (verbose) + g_print ("Wrote suffix globs at %x - %x\n", suffix_offset, offset); glob_offset = offset; if (!write_glob_cache (cache, strings, &offset)) @@ -2610,7 +2616,8 @@ write_cache (FILE *cache) g_printerr ("Failed to write glob list\n"); return FALSE; } - g_print ("Wrote full globs at %x - %x\n", glob_offset, offset); + if (verbose) + g_print ("Wrote full globs at %x - %x\n", glob_offset, offset); magic_offset = offset; if (!write_magic_cache (cache, strings, &offset)) @@ -2618,7 +2625,8 @@ write_cache (FILE *cache) g_printerr ("Failed to write magic list\n"); return FALSE; } - g_print ("Wrote magic at %x - %x\n", magic_offset, offset); + if (verbose) + g_print ("Wrote magic at %x - %x\n", magic_offset, offset); namespace_offset = offset; if (!write_namespace_cache (cache, strings, &offset)) @@ -2626,7 +2634,8 @@ write_cache (FILE *cache) g_printerr ("Failed to write namespace list\n"); return FALSE; } - g_print ("Wrote namespace list at %x - %x\n", namespace_offset, offset); + if (verbose) + g_print ("Wrote namespace list at %x - %x\n", namespace_offset, offset); rewind (cache); offset = 0; @@ -2650,9 +2659,10 @@ int main(int argc, char **argv) { char *mime_dir = NULL; char *package_dir = NULL; + gboolean verbose = TRUE; int opt; - while ((opt = getopt(argc, argv, "hv")) != -1) + while ((opt = getopt(argc, argv, "hvq")) != -1) { switch (opt) { @@ -2667,6 +2677,9 @@ int main(int argc, char **argv) "update-mime-database (" PACKAGE ") " VERSION "\n" COPYING); return EXIT_SUCCESS; + case 'q': + verbose = FALSE; + break; default: abort(); } @@ -2701,7 +2714,8 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - g_print("***\n* Updating MIME database in %s...\n", mime_dir); + if (verbose) + g_print("***\n* Updating MIME database in %s...\n", mime_dir); if (access(package_dir, F_OK)) { @@ -2830,7 +2844,7 @@ int main(int argc, char **argv) g_error("Failed to open '%s' for writing\n", path); - write_cache(stream); + write_cache(stream, verbose); atomic_update(path); g_free(path); @@ -2845,7 +2859,8 @@ int main(int argc, char **argv) g_hash_table_destroy(subclass_hash); g_hash_table_destroy(alias_hash); - g_print("***\n"); + if (verbose) + g_print("***\n"); check_in_path_xdg_data(mime_dir);