diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fontconfig/fc-cache/fc-cache.1 | 9 | ||||
-rw-r--r-- | lib/fontconfig/fc-cache/fc-cache.c | 27 | ||||
-rw-r--r-- | lib/fontconfig/fc-cache/fc-cache.sgml | 10 |
3 files changed, 39 insertions, 7 deletions
diff --git a/lib/fontconfig/fc-cache/fc-cache.1 b/lib/fontconfig/fc-cache/fc-cache.1 index 30cb5308a..c07cee2eb 100644 --- a/lib/fontconfig/fc-cache/fc-cache.1 +++ b/lib/fontconfig/fc-cache/fc-cache.1 @@ -1,4 +1,4 @@ -...\" $Header: /cvs/OpenBSD/xenocara/lib/fontconfig/fc-cache/fc-cache.1,v 1.1 2007/05/05 10:32:29 matthieu Exp $ +...\" $Header: /cvs/OpenBSD/xenocara/lib/fontconfig/fc-cache/fc-cache.1,v 1.2 2007/10/27 20:00:20 matthieu Exp $ ...\" ...\" transcript compatibility for postscript use. ...\" @@ -56,7 +56,7 @@ fc-cache \(em build font information cache files .SH "SYNOPSIS" .PP -\fBfc-cache\fR [\fB-fsvV?\fP] [\fB\-\-force\fP] [\fB\-\-system-only\fP] [\fB\-\-verbose\fP] [\fB\-\-version\fP] [\fB\-\-help\fP] [\fB\fIdirs\fR\fP] +\fBfc-cache\fR [\fB-cfsvV?\fP] [\fB\-\-chroot root\fP] [\fB\-\-force\fP] [\fB\-\-system-only\fP] [\fB\-\-verbose\fP] [\fB\-\-version\fP] [\fB\-\-help\fP] [\fB\fIdirs\fR\fP] .SH "DESCRIPTION" .PP \fBfc-cache\fR scans the font directories on @@ -82,6 +82,9 @@ architecture\&. This program follows the usual GNU command line syntax, with long options starting with two dashes (`\-\&')\&. A summary of options is included below\&. +.IP "\fB-c root\fP \fB\-\-chroot root\fP " 10 +Change root directory into root +before starting\&. .IP "\fB-f\fP \fB\-\-force\fP " 10 Force re-generation of apparently up-to-date cache files, overriding the timestamp checking\&. @@ -111,4 +114,4 @@ The fontconfig user\&'s guide, in HTML format: .PP This manual page was written by Keith Packard keithp@keithp\&.com and Josselin Mouette joss@debian\&.org\&. -...\" created by instant / docbook-to-man, Sat 05 May 2007, 11:42 +...\" created by instant / docbook-to-man, Tue 16 Oct 2007, 23:05 diff --git a/lib/fontconfig/fc-cache/fc-cache.c b/lib/fontconfig/fc-cache/fc-cache.c index bda8b1468..078910513 100644 --- a/lib/fontconfig/fc-cache/fc-cache.c +++ b/lib/fontconfig/fc-cache/fc-cache.c @@ -22,6 +22,8 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "../fc-arch/fcarch.h" + #ifdef HAVE_CONFIG_H #include <config.h> #else @@ -40,6 +42,7 @@ #include <errno.h> #include <fcntl.h> #include <dirent.h> +#include <string.h> #if defined (_WIN32) #define STRICT @@ -64,6 +67,7 @@ #define _GNU_SOURCE #include <getopt.h> const struct option longopts[] = { + {"chroot", 0, 0, 'c'}, {"force", 0, 0, 'f'}, {"really-force", 0, 0, 'r'}, {"system-only", 0, 0, 's'}, @@ -296,6 +300,12 @@ cleanCacheDirectory (FcConfig *config, FcChar8 *dir, FcBool verbose) if (ent->d_name[0] == '.') continue; + /* skip cache files for different architectures and */ + /* files which are not cache files at all */ + if (strlen(ent->d_name) != 32 + strlen ("-" FC_ARCHITECTURE FC_CACHE_SUFFIX) || + strcmp(ent->d_name + 32, "-" FC_ARCHITECTURE FC_CACHE_SUFFIX)) + continue; + file_name = FcStrPlus (dir_base, (FcChar8 *) ent->d_name); if (!file_name) { @@ -377,16 +387,20 @@ main (int argc, char **argv) FcConfig *config; int i; int ret; + char *destdir = NULL; #if HAVE_GETOPT_LONG || HAVE_GETOPT int c; #if HAVE_GETOPT_LONG - while ((c = getopt_long (argc, argv, "frsVv?", longopts, NULL)) != -1) + while ((c = getopt_long (argc, argv, "c:frsVv?", longopts, NULL)) != -1) #else - while ((c = getopt (argc, argv, "frsVv?")) != -1) + while ((c = getopt (argc, argv, "c:frsVv?")) != -1) #endif { switch (c) { + case 'c': + destdir = optarg; + break; case 'r': really_force = FcTrue; /* fall through */ @@ -411,7 +425,14 @@ main (int argc, char **argv) #else i = 1; #endif - + if (destdir) { + if (chroot(destdir) == -1) { + fprintf(stderr, "%s: Can't chroot to %s: %s\n", argv[0], destdir, + strerror(errno)); + return 1; + } + systemOnly = FcTrue; + } if (systemOnly) FcConfigEnableHome (FcFalse); config = FcInitLoadConfig (); diff --git a/lib/fontconfig/fc-cache/fc-cache.sgml b/lib/fontconfig/fc-cache/fc-cache.sgml index 8fc743554..fc9e211ee 100644 --- a/lib/fontconfig/fc-cache/fc-cache.sgml +++ b/lib/fontconfig/fc-cache/fc-cache.sgml @@ -63,7 +63,8 @@ manpage.1: manpage.sgml <cmdsynopsis> <command>&dhpackage;</command> - <arg><option>-fsvV?</option></arg> + <arg><option>-cfsvV?</option></arg> + <arg><option>--chroot <replacable>root</replacable></option></arg> <arg><option>--force</option></arg> <arg><option>--system-only</option></arg> <arg><option>--verbose</option></arg> @@ -105,6 +106,13 @@ manpage.1: manpage.sgml <variablelist> <varlistentry> + <term><option>-c <replacable>root</replacable></option> + <option>--chroot <replacable>root</replacable></option> + </term> + <listitem> + <para>Change root directory into <replacable>root</replacable> + before starting.</para> + </listitem> <term><option>-f</option> <option>--force</option> </term> |