]> git.wh0rd.org - fontconfig.git/blobdiff - fc-cat/fc-cat.c
Update fc-cat to handle subdir lists in global cache file.
[fontconfig.git] / fc-cat / fc-cat.c
index 14e5c164f8eb0ec86ce8fd74c48925ef63fc2981..a203d7496f2097bbb91f75841c7a135a459e0f68 100644 (file)
@@ -174,6 +174,7 @@ FcCacheGlobalFileReadAndPrint (FcFontSet * set, FcStrSet *dirs, char *cache_file
     int fd;
     char * current_arch_machine_name;
     char candidate_arch_machine_name[9+MACHINE_SIGNATURE_SIZE];
+    char               subdirName[FC_MAX_FILE_LEN + 1 + 12 + 1];
     off_t current_arch_start = 0;
 
     if (!cache_file)
@@ -202,10 +203,23 @@ FcCacheGlobalFileReadAndPrint (FcFontSet * set, FcStrSet *dirs, char *cache_file
        printf ("fc-cat: printing global cache contents for dir %s\n", 
                name_buf);
 
-       if (!FcDirCacheConsume (fd, name_buf, set))
+       do
+       {
+           if (!FcCacheReadString (fd, subdirName, 
+                                   sizeof (subdirName)) ||
+               !strlen (subdirName))
+               break;
+           /* then don't do anything with subdirName. */
+       } while (1);
+
+       if (!FcDirCacheConsume (fd, name_buf, set, 0))
+           goto bail1;
+
+       dir = malloc (strlen (name_buf) + 2);
+       if (!dir)
            goto bail1;
 
-       dir = strdup(name_buf);
+       strcpy (dir, name_buf);
        strcat (dir, "/");
 
        FcCachePrintSet (set, dirs, dir);
@@ -261,7 +275,7 @@ FcCacheFileRead (FcFontSet * set, FcStrSet *dirs, char *cache_file)
     if (ls)
        *ls = 0;
 
-    if (!FcDirCacheConsume (fd, dir, set))
+    if (!FcDirCacheConsume (fd, dir, set, 0))
        goto bail2;
     free (dir);