]> git.wh0rd.org - fontconfig.git/blobdiff - fc-list/fc-list.c
Add better error reporting when loading config file
[fontconfig.git] / fc-list / fc-list.c
index 67d712020320fd5c659829a6c0f0c7c33d59a020..14feab07c245c9ca45f0c0934d0bd78cc08ae507 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: $
+ * $XFree86: xc/lib/fontconfig/fc-list/fc-list.c,v 1.2 2002/02/15 06:01:26 keithp Exp $
  *
  * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
  *
 #include <fontconfig/fontconfig.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <stdlib.h>
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #else
+#ifdef linux
+#define HAVE_GETOPT_LONG 1
+#endif
 #define HAVE_GETOPT 1
 #endif
 
+#ifndef HAVE_GETOPT
+#define HAVE_GETOPT 0
+#endif
+#ifndef HAVE_GETOPT_LONG
+#define HAVE_GETOPT_LONG 0
+#endif
+
 #if HAVE_GETOPT_LONG
+#undef  _GNU_SOURCE
 #define _GNU_SOURCE
 #include <getopt.h>
 const struct option longopts[] = {
@@ -47,7 +59,7 @@ extern int optind, opterr, optopt;
 #endif
 #endif
 
-void usage (char *program)
+static void usage (char *program)
 {
     fprintf (stderr, "usage: %s [-vV?] [--verbose] [--version] [--help] [dirs]\n",
             program);
@@ -63,8 +75,6 @@ void usage (char *program)
 int
 main (int argc, char **argv)
 {
-    int                ret = 0;
-    FcFontSet  *set;
     int                verbose = 0;
     int                i;
     FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_LANG, 0);
@@ -102,7 +112,7 @@ main (int argc, char **argv)
        return 1;
     }
     if (argv[i])
-       pat = FcNameParse (argv[i]);
+       pat = FcNameParse ((FcChar8 *) argv[i]);
     else
        pat = FcPatternCreate ();