]> git.wh0rd.org - fontconfig.git/blobdiff - fc-lang/fc-lang.c
Add instructions for doing a release
[fontconfig.git] / fc-lang / fc-lang.c
index 7e76c4742267dcc05b25e9e987fd95a6307a38da..31d708bc6b933c40909077d886c121c87a7f1d10 100644 (file)
@@ -75,6 +75,26 @@ get_line (FILE *f, char *line, int *lineno)
     return line;
 }
 
+char   *dir = 0;
+
+static 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);
@@ -164,8 +184,8 @@ get_lang (char *name)
 
     while ((c = *name++))
     {
-       if (isupper (c))
-           c = tolower (c);
+       if (isupper ((int) (unsigned char) c))
+           c = tolower ((int) (unsigned char) c);
        if (c == '_')
            c = '-';
        if (c == ' ')
@@ -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]);