summaryrefslogtreecommitdiff
path: root/fc-match
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2017-09-15 01:11:34 -0400
committerBehdad Esfahbod <behdad@behdad.org>2017-09-20 13:13:35 -0700
commit2a41738fd7c88e2b6977673f91bdb8d1f7224cf1 (patch)
tree3ac91db133053744bbb7268a86f6cd635a76d49e /fc-match
parentdc8326d3f116bb2a1425aa68660a332e351b6cb4 (diff)
[fc-match/fc-list/fc-query/fc-scan] Add --brief that is like --verbose without charset
Diffstat (limited to 'fc-match')
-rw-r--r--fc-match/fc-match.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/fc-match/fc-match.c b/fc-match/fc-match.c
index f96c0094..88f4ac8d 100644
--- a/fc-match/fc-match.c
+++ b/fc-match/fc-match.c
@@ -52,6 +52,7 @@ static const struct option longopts[] = {
{"sort", 0, 0, 's'},
{"all", 0, 0, 'a'},
{"verbose", 0, 0, 'v'},
+ {"brief", 0, 0, 'b'},
{"format", 1, 0, 'f'},
{"version", 0, 0, 'V'},
{"help", 0, 0, 'h'},
@@ -69,7 +70,7 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
- fprintf (file, "usage: %s [-savVh] [-f FORMAT] [--sort] [--all] [--verbose] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n",
+ fprintf (file, "usage: %s [-savbVh] [-f FORMAT] [--sort] [--all] [--verbose] [--brief] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n",
program);
#else
fprintf (file, "usage: %s [-savVh] [-f FORMAT] [pattern] {element...}\n",
@@ -81,6 +82,7 @@ usage (char *program, int error)
fprintf (file, " -s, --sort display sorted list of matches\n");
fprintf (file, " -a, --all display unpruned sorted list of matches\n");
fprintf (file, " -v, --verbose display entire font pattern verbosely\n");
+ fprintf (file, " -b, --brief display entire font pattern briefly\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
@@ -88,6 +90,7 @@ usage (char *program, int error)
fprintf (file, " -s, (sort) display sorted list of matches\n");
fprintf (file, " -a (all) display unpruned sorted list of matches\n");
fprintf (file, " -v (verbose) display entire font pattern verbosely\n");
+ fprintf (file, " -b (brief) display entire font pattern briefly\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
@@ -99,6 +102,7 @@ int
main (int argc, char **argv)
{
int verbose = 0;
+ int brief = 0;
int sort = 0, all = 0;
const FcChar8 *format = NULL;
int i;
@@ -110,9 +114,9 @@ main (int argc, char **argv)
int c;
#if HAVE_GETOPT_LONG
- while ((c = getopt_long (argc, argv, "asvf:Vh", longopts, NULL)) != -1)
+ while ((c = getopt_long (argc, argv, "asvbf:Vh", longopts, NULL)) != -1)
#else
- while ((c = getopt (argc, argv, "asvf:Vh")) != -1)
+ while ((c = getopt (argc, argv, "asvbf:Vh")) != -1)
#endif
{
switch (c) {
@@ -125,6 +129,9 @@ main (int argc, char **argv)
case 'v':
verbose = 1;
break;
+ case 'b':
+ brief = 1;
+ break;
case 'f':
format = (FcChar8 *) strdup (optarg);
break;
@@ -218,8 +225,13 @@ main (int argc, char **argv)
font = FcPatternFilter (fs->fonts[j], os);
- if (verbose)
+ if (verbose || brief)
{
+ if (brief)
+ {
+ FcPatternDel (font, FC_CHARSET);
+ FcPatternDel (font, FC_LANG);
+ }
FcPatternPrint (font);
}
else