<refsynopsisdiv>
<cmdsynopsis>
<command>pango-querymodules</command>
-<arg choice="opt" rep="repeat">module</arg>
+<arg choice="opt" rep="repeat">OPTION</arg>
+<arg choice="opt" rep="repeat">MODULE</arg>
</cmdsynopsis>
</refsynopsisdiv>
modules for Pango and writes it to <filename>stdout</filename>.
</para>
<para>
-If called without arguments, it looks for modules in the Pango module path.
+If called without MODULE arguments, it looks for modules in the Pango
+module path, which is specified by the key <literal>Pango/ModulesPath</literal>
+in the Pango configuration database.
</para>
<para>
-If called with arguments, it looks for the specified modules. The arguments
-may be absolute or relative paths.
+If called with MODULE arguments, it looks for the specified modules. The
+arguments may be absolute or relative paths.
</para>
<para>
At runtime, Pango looks for the loadable module information (i.e. the output
</para>
</refsect1>
+<refsect1><title>Options</title>
+<variablelist>
+
+<varlistentry>
+<term><option>-?</option>, <option>--help</option></term>
+<listitem><para>Prints a short help text and exits.</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><option>--version</option></term>
+<listitem><para>Prints version information.</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><option>--system</option></term>
+<listitem><para>Do not load user-specific configuration.</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><option>--update-cache</option></term>
+<listitem><para>Update the Pango module cache file directly,
+instead of writing the information to <filename>stdout</filename>.</para></listitem>
+</varlistentry>
+
+</variablelist>
+
+</refsect1>
+
<refsect1 id="Environment"><title>Environment</title>
-<para>
-The Pango module path is specified by the key
-<literal>Pango/ModulesPath</literal> in the Pango config database, which is
-read from
- <filename><replaceable>sysconfdir</replaceable>/pango/pangorc</filename>,
- <filename>~/.config/pango/pangorc</filename> and the file specified in
- the environment variable <envar>PANGO_RC_FILE</envar>.
-</para>
+<variablelist>
+
+<varlistentry>
+<term><envar>PANGO_RC_FILE</envar></term>
+<listitem><para>Specifies an additional rc file for the Pango configuration
+database, in addition to the system-wide and per-user files.</para></listitem>
+</varlistentry>
+
+</variablelist>
+
+</refsect1>
+
+<refsect1><title>Files</title>
+
+<variablelist>
+
+<varlistentry>
+<term><filename><replaceable>sysconfdir</replaceable>/pango/pangorc</filename></term>
+<listitem><para>System-wide Pango configuration file.</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><filename><envar>$XDG_CONFIG_HOME</envar>/pango/pangorc</filename></term>
+<listitem><para>User-specific Pango configuration file.</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><filename><replaceable>libdir</replaceable>/pango/1.8.0/modules.cache</filename></term>
+<listitem><para>Location of the module cache file read by Pango.</para></listitem>
+</varlistentry>
+
+</variablelist>
+
</refsect1>
<refsect1 id="Bugs"><title>Bugs</title>
}
static void
-query_module (const char *dir, const char *name)
+query_module (const char *dir, const char *name, GString *contents)
{
void (*list) (PangoEngineInfo **engines, gint *n_engines);
void (*init) (GTypeModule *module);
quoted_path = g_strdup (path);
}
- g_printf ("%s%s%s %s %s %s", quote, quoted_path, quote,
- engines[i].id, engines[i].engine_type, engines[i].render_type);
+ g_string_append_printf (contents,
+ "%s%s%s %s %s %s",
+ quote, quoted_path, quote,
+ engines[i].id, engines[i].engine_type,
+ engines[i].render_type);
g_free (quoted_path);
for (j=0; j < engines[i].n_scripts; j++)
{
- g_printf (" %s:%s",
- string_from_script (engines[i].scripts[j].script),
- engines[i].scripts[j].langs);
+ g_string_append_printf (contents,
+ " %s:%s",
+ string_from_script (engines[i].scripts[j].script),
+ engines[i].scripts[j].langs);
}
- g_printf ("\n");
+ g_string_append_c (contents, '\n');
}
}
else
char *path;
GOptionContext *context;
GError *parse_error = NULL;
+ gboolean update_cache = FALSE;
+ GString *contents;
GOptionEntry entries[] =
{
{"version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, &show_version,
"Show version numbers", NULL},
{"system", 0, 0, G_OPTION_ARG_NONE, &system_mode,
"Do not load configuration from home directory", NULL},
+ {"update-cache", 0, 0, G_OPTION_ARG_NONE, &update_cache,
+ "Update the default cache file", NULL},
{NULL}
};
g_type_init ();
- g_printf ("# Pango Modules file\n"
- "# Automatically generated file, do not edit\n"
- "#\n");
+ contents = g_string_new ("");
+ g_string_append (contents,
+ "# Pango Modules file\n"
+ "# Automatically generated file, do not edit\n"
+ "#\n");
if (argc == 1) /* No arguments given */
{
"modules",
NULL);
- g_printf ("# ModulesPath = %s\n#\n", path);
+ g_string_append_printf (contents, "# ModulesPath = %s\n#\n", path);
dirs = pango_split_file_list (path);
{
int len = strlen (dent);
if (len > SOEXT_LEN && strcmp (dent + len - SOEXT_LEN, SOEXT) == 0)
- query_module (dirs[i], dent);
+ query_module (dirs[i], dent, contents);
}
g_dir_close (dir);
cwd = g_get_current_dir ();
for (i=1; i<argc; i++)
- query_module (cwd, argv[i]);
+ query_module (cwd, argv[i], contents);
g_free (cwd);
}
+ if (update_cache)
+ {
+ gchar *cache_file;
+ GError *err;
+
+ cache_file = g_build_filename (pango_get_lib_subdirectory (),
+ MODULE_VERSION,
+ "modules.cache",
+ NULL);
+ err = NULL;
+ if (!g_file_set_contents (cache_file, contents->str, -1, &err))
+ {
+ g_fprintf (stderr, "%s\n", err->message);
+ exit(1);
+ }
+ g_free (cache_file);
+ }
+ else
+ g_print ("%s\n", contents->str);
+
return 0;
}