]> git.wh0rd.org - fontconfig.git/blobdiff - fc-lang/fc-lang.c
Attempts to fix 'make distcheck' work. Things are progressing pretty well,
[fontconfig.git] / fc-lang / fc-lang.c
index ef259bc54684b66754fe88f27859dba16fe86d82..edfad3bfe2fd859ba80ec7e16b7c72ec5e5d1cb7 100644 (file)
@@ -75,6 +75,26 @@ get_line (FILE *f, char *line, int *lineno)
     return line;
 }
 
+char   *dir = 0;
+
+FILE *
+scanopen (char *file)
+{
+    FILE    *f;
+
+    f = fopen (file, "r");
+    if (!f && dir)
+    {
+       char    path[1024];
+       
+       strcpy (path, dir);
+       strcat (path, "/");
+       strcat (path, file);
+       f = fopen (path, "r");
+    }
+    return f;
+}
+
 /*
  * build a single charset from a source file
  *
@@ -103,7 +123,7 @@ scan (FILE *f, char *file)
            end = strlen (file);
            if (file[end-1] == '\n')
                file[end-1] = '\0';
-           f = fopen (file, "r");
+           f = scanopen (file);
            if (!f)
                fatal (file, 0, "can't open");
            c = scan (f, file);
@@ -213,6 +233,11 @@ main (int argc, char **argv)
     
     while (*++argv)
     {
+       if (!strcmp (*argv, "-d"))
+       {
+           dir = *++argv;
+           continue;
+       }
        if (i == MAX_LANG)
            fatal (*argv, 0, "Too many languages");
        files[i++] = *argv;
@@ -222,7 +247,7 @@ main (int argc, char **argv)
     i = 0;
     while (files[i])
     {
-       f = fopen (files[i], "r");
+       f = scanopen (files[i]);
        if (!f)
            fatal (files[i], 0, strerror (errno));
        sets[i] = scan (f, files[i]);