2 * fontconfig/fc-conflist/fc-conflist.c
4 * Copyright © 2003 Keith Packard
5 * Copyright © 2014 Red Hat, Inc.
6 * Red Hat Author(s): Akira TAGOH
8 * Permission to use, copy, modify, distribute, and sell this software and its
9 * documentation for any purpose is hereby granted without fee, provided that
10 * the above copyright notice appear in all copies and that both that
11 * copyright notice and this permission notice appear in supporting
12 * documentation, and that the name of the author(s) not be used in
13 * advertising or publicity pertaining to distribution of the software without
14 * specific, written prior permission. The authors make no
15 * representations about the suitability of this software for any purpose. It
16 * is provided "as is" without express or implied warranty.
18 * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
19 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
20 * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
21 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
22 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
23 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
24 * PERFORMANCE OF THIS SOFTWARE.
31 #define HAVE_GETOPT_LONG 1
36 #include <fontconfig/fontconfig.h>
45 #define _(x) (dgettext(GETTEXT_PACKAGE, x))
47 #define dgettext(d, s) (s)
54 #ifndef HAVE_GETOPT_LONG
55 #define HAVE_GETOPT_LONG 0
62 static const struct option longopts[] = {
63 {"version", 0, 0, 'V'},
70 extern int optind, opterr, optopt;
75 usage (char *program, int error)
77 FILE *file = error ? stderr : stdout;
79 fprintf (file, _("usage: %s [-Vh] [--version] [--help]\n"),
82 fprintf (file, _("usage: %s [-Vh]\n"),
85 fprintf (file, _("Show the ruleset files information on the system\n"));
88 fprintf (file, _(" -V, --version display font config version and exit\n"));
89 fprintf (file, _(" -h, --help display this help and exit\n"));
91 fprintf (file, _(" -V (version) display font config version and exit\n"));
92 fprintf (file, _(" -h (help) display this help and exit\n"));
98 main (int argc, char **argv)
101 FcConfigFileInfoIter iter;
103 #if HAVE_GETOPT_LONG || HAVE_GETOPT
106 setlocale (LC_ALL, "");
108 while ((c = getopt_long (argc, argv, "Vh", longopts, NULL)) != -1)
110 while ((c = getopt (argc, argv, "Vh")) != -1)
115 fprintf (stderr, "fontconfig version %d.%d.%d\n",
116 FC_MAJOR, FC_MINOR, FC_REVISION);
126 config = FcConfigGetCurrent ();
127 FcConfigFileInfoIterInit (config, &iter);
130 FcChar8 *name, *desc;
133 if (FcConfigFileInfoIterGet (config, &iter, &name, &desc, &enabled))
135 printf ("%c %s: %s\n", enabled ? '+' : '-', name, desc);
139 } while (FcConfigFileInfoIterNext (config, &iter));