summaryrefslogtreecommitdiff
path: root/fc-cat
diff options
context:
space:
mode:
authorPatrick Lam <plam@MIT.EDU>2005-11-01 05:26:27 +0000
committerPatrick Lam <plam@MIT.EDU>2005-11-01 05:26:27 +0000
commite77c17184a6172d6368dd3193c791c4027065bbd (patch)
treec65be8e0335b94d5d14b016a991f547eac3a8767 /fc-cat
parentbe99726f672cef086b4256ad34163f6f9ed9d4a5 (diff)
Reinstate basename patch, but keep a hash table linking FcPatterns to their
fully-qualified font names for clients' benefit. Clients only pay for the font names once they request the FC_FILE property from an FcPattern, but the font name is malloc'd at that point (i.e. not mmapped: that's impossible, since it may vary between machines.) Clients do have to pay for a copy of the path name per cache file. Note that FcPatternGetString now does some rewriting if you ask for an FC_FILE, appending the pathname as appropriate.
Diffstat (limited to 'fc-cat')
-rw-r--r--fc-cat/fc-cat.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c
index 109a058..a392327 100644
--- a/fc-cat/fc-cat.c
+++ b/fc-cat/fc-cat.c
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <libgen.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
@@ -165,7 +166,7 @@ usage (char *program)
/* read serialized state from the cache file */
static FcBool
-FcCacheFileRead (FcFontSet * set, FcStrSet *dirs, char *cache_file)
+FcCacheFileRead (FcFontSet * set, FcStrSet *dirs, char * dir, char *cache_file)
{
int fd;
char * current_arch_machine_name;
@@ -193,7 +194,7 @@ FcCacheFileRead (FcFontSet * set, FcStrSet *dirs, char *cache_file)
while (strlen(FcCacheReadString (fd, subdirName, sizeof (subdirName))) > 0)
FcStrSetAdd (dirs, (FcChar8 *)subdirName);
- if (!FcDirCacheConsume (fd, set))
+ if (!FcDirCacheConsume (fd, dir, set))
goto bail1;
close(fd);
@@ -326,7 +327,7 @@ main (int argc, char **argv)
i = 1;
#endif
- if (FcCacheFileRead (fs, dirs, argv[i]))
+ if (FcCacheFileRead (fs, dirs, dirname (argv[i]), argv[i]))
FcCachePrintSet (fs, dirs, argv[i]);
FcStrSetDestroy (dirs);