-static FcBool
-FcCacheGlobalFileReadAndPrint (FcFontSet * set, FcStrSet *dirs, char *cache_file)
-{
- char name_buf[8192];
- 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)
- goto bail;
-
- current_arch_machine_name = FcCacheMachineSignature();
- fd = open(cache_file, O_RDONLY);
- if (fd == -1)
- goto bail;
-
- current_arch_start = FcCacheSkipToArch(fd, current_arch_machine_name);
- if (current_arch_start < 0)
- goto bail1;
-
- lseek (fd, current_arch_start, SEEK_SET);
- if (FcCacheReadString (fd, candidate_arch_machine_name,
- sizeof (candidate_arch_machine_name)) == 0)
- goto bail1;
-
- while (1)
- {
- char * dir;
- FcCacheReadString (fd, name_buf, sizeof (name_buf));
- if (!strlen(name_buf))
- break;
- printf ("fc-cat: printing global cache contents for dir %s\n",
- name_buf);
-
- 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;
-
- strcpy (dir, name_buf);
- strcat (dir, "/");
-
- FcCachePrintSet (set, dirs, dir);
- free (dir);
-
- FcFontSetDestroy (set);
- set = FcFontSetCreate();
- }
-
- bail1:
- close (fd);
- bail:
- return FcFalse;
-}
-