Add -r --really-force option which blows away cache files and then
regenerates them.
This commit is contained in:
parent
719f4b841f
commit
d2c0102944
|
@ -1,3 +1,9 @@
|
||||||
|
2006-02-16 Patrick Lam <plam@mit.edu>
|
||||||
|
* fc-cache/fc-cache.c (usage, scanDirs, main):
|
||||||
|
|
||||||
|
Add -r --really-force option which blows away cache files and then
|
||||||
|
regenerates them.
|
||||||
|
|
||||||
2006-02-16 Patrick Lam <plam@mit.edu>
|
2006-02-16 Patrick Lam <plam@mit.edu>
|
||||||
* src/fccache.c (FcDirCacheUnlink, FcCacheCopyOld, FcDirCacheWrite):
|
* src/fccache.c (FcDirCacheUnlink, FcCacheCopyOld, FcDirCacheWrite):
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
const struct option longopts[] = {
|
const struct option longopts[] = {
|
||||||
{"force", 0, 0, 'f'},
|
{"force", 0, 0, 'f'},
|
||||||
|
{"really-force", 0, 0, 'r'},
|
||||||
{"system-only", 0, 0, 's'},
|
{"system-only", 0, 0, 's'},
|
||||||
{"version", 0, 0, 'V'},
|
{"version", 0, 0, 'V'},
|
||||||
{"verbose", 0, 0, 'v'},
|
{"verbose", 0, 0, 'v'},
|
||||||
|
@ -68,10 +69,10 @@ static void
|
||||||
usage (char *program)
|
usage (char *program)
|
||||||
{
|
{
|
||||||
#if HAVE_GETOPT_LONG
|
#if HAVE_GETOPT_LONG
|
||||||
fprintf (stderr, "usage: %s [-fsvV?] [--force] [--system-only] [--verbose] [--version] [--help] [dirs]\n",
|
fprintf (stderr, "usage: %s [-frsvV?] [--force|--really-force] [--system-only] [--verbose] [--version] [--help] [dirs]\n",
|
||||||
program);
|
program);
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, "usage: %s [-fsvV?] [dirs]\n",
|
fprintf (stderr, "usage: %s [-frsvV?] [dirs]\n",
|
||||||
program);
|
program);
|
||||||
#endif
|
#endif
|
||||||
fprintf (stderr, "Build font information caches in [dirs]\n"
|
fprintf (stderr, "Build font information caches in [dirs]\n"
|
||||||
|
@ -79,12 +80,14 @@ usage (char *program)
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
#if HAVE_GETOPT_LONG
|
#if HAVE_GETOPT_LONG
|
||||||
fprintf (stderr, " -f, --force scan directories with apparently valid caches\n");
|
fprintf (stderr, " -f, --force scan directories with apparently valid caches\n");
|
||||||
|
fprintf (stderr, " -r, --really-force erase all existing caches, then rescan\n");
|
||||||
fprintf (stderr, " -s, --system-only scan system-wide directories only\n");
|
fprintf (stderr, " -s, --system-only scan system-wide directories only\n");
|
||||||
fprintf (stderr, " -v, --verbose display status information while busy\n");
|
fprintf (stderr, " -v, --verbose display status information while busy\n");
|
||||||
fprintf (stderr, " -V, --version display font config version and exit\n");
|
fprintf (stderr, " -V, --version display font config version and exit\n");
|
||||||
fprintf (stderr, " -?, --help display this help and exit\n");
|
fprintf (stderr, " -?, --help display this help and exit\n");
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, " -f (force) scan directories with apparently valid caches\n");
|
fprintf (stderr, " -f (force) scan directories with apparently valid caches\n");
|
||||||
|
fprintf (stderr, " -r, (really force) erase all existing caches, then rescan\n");
|
||||||
fprintf (stderr, " -s (system) scan system-wide directories only\n");
|
fprintf (stderr, " -s (system) scan system-wide directories only\n");
|
||||||
fprintf (stderr, " -v (verbose) display status information while busy\n");
|
fprintf (stderr, " -v (verbose) display status information while busy\n");
|
||||||
fprintf (stderr, " -V (version) display font config version and exit\n");
|
fprintf (stderr, " -V (version) display font config version and exit\n");
|
||||||
|
@ -111,7 +114,7 @@ nsubdirs (FcStrSet *set)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool verbose)
|
scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool really_force, FcBool verbose)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const FcChar8 *dir;
|
const FcChar8 *dir;
|
||||||
|
@ -207,6 +210,10 @@ scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool
|
||||||
FcStrSetDestroy (subdirs);
|
FcStrSetDestroy (subdirs);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (really_force)
|
||||||
|
FcDirCacheUnlink (dir, config);
|
||||||
|
|
||||||
if (!FcDirScanConfig (set, subdirs, 0, FcConfigGetBlanks (config), dir, force, config))
|
if (!FcDirScanConfig (set, subdirs, 0, FcConfigGetBlanks (config), dir, force, config))
|
||||||
{
|
{
|
||||||
fprintf (stderr, "\"%s\": error scanning\n", dir);
|
fprintf (stderr, "\"%s\": error scanning\n", dir);
|
||||||
|
@ -249,7 +256,7 @@ scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
FcStrSetAdd (processed_dirs, dir);
|
FcStrSetAdd (processed_dirs, dir);
|
||||||
ret += scanDirs (sublist, config, program, force, verbose);
|
ret += scanDirs (sublist, config, program, force, really_force, verbose);
|
||||||
}
|
}
|
||||||
FcStrListDone (list);
|
FcStrListDone (list);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -262,6 +269,7 @@ main (int argc, char **argv)
|
||||||
FcStrList *list;
|
FcStrList *list;
|
||||||
FcBool verbose = FcFalse;
|
FcBool verbose = FcFalse;
|
||||||
FcBool force = FcFalse;
|
FcBool force = FcFalse;
|
||||||
|
FcBool really_force = FcFalse;
|
||||||
FcBool systemOnly = FcFalse;
|
FcBool systemOnly = FcFalse;
|
||||||
FcConfig *config;
|
FcConfig *config;
|
||||||
int i;
|
int i;
|
||||||
|
@ -270,12 +278,15 @@ main (int argc, char **argv)
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
#if HAVE_GETOPT_LONG
|
#if HAVE_GETOPT_LONG
|
||||||
while ((c = getopt_long (argc, argv, "fsVv?", longopts, NULL)) != -1)
|
while ((c = getopt_long (argc, argv, "frsVv?", longopts, NULL)) != -1)
|
||||||
#else
|
#else
|
||||||
while ((c = getopt (argc, argv, "fsVv?")) != -1)
|
while ((c = getopt (argc, argv, "frsVv?")) != -1)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case 'r':
|
||||||
|
really_force = FcTrue;
|
||||||
|
/* fall through */
|
||||||
case 'f':
|
case 'f':
|
||||||
force = FcTrue;
|
force = FcTrue;
|
||||||
break;
|
break;
|
||||||
|
@ -337,7 +348,7 @@ main (int argc, char **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = scanDirs (list, config, argv[0], force, verbose);
|
ret = scanDirs (list, config, argv[0], force, really_force, verbose);
|
||||||
|
|
||||||
FcStrSetDestroy (processed_dirs);
|
FcStrSetDestroy (processed_dirs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue