diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2017-09-15 01:11:34 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2017-09-20 13:13:35 -0700 |
commit | 2a41738fd7c88e2b6977673f91bdb8d1f7224cf1 (patch) | |
tree | 3ac91db133053744bbb7268a86f6cd635a76d49e /fc-query | |
parent | dc8326d3f116bb2a1425aa68660a332e351b6cb4 (diff) |
[fc-match/fc-list/fc-query/fc-scan] Add --brief that is like --verbose without charset
Diffstat (limited to 'fc-query')
-rw-r--r-- | fc-query/fc-query.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/fc-query/fc-query.c b/fc-query/fc-query.c index 9c9900b4..8a96da0b 100644 --- a/fc-query/fc-query.c +++ b/fc-query/fc-query.c @@ -53,6 +53,7 @@ #include <getopt.h> static const struct option longopts[] = { {"index", 1, 0, 'i'}, + {"brief", 0, 0, 'b'}, {"format", 1, 0, 'f'}, {"version", 0, 0, 'V'}, {"help", 0, 0, 'h'}, @@ -70,21 +71,23 @@ usage (char *program, int error) { FILE *file = error ? stderr : stdout; #if HAVE_GETOPT_LONG - fprintf (file, "usage: %s [-Vh] [-i index] [-f FORMAT] [--index index] [--format FORMAT] [--version] [--help] font-file...\n", + fprintf (file, "usage: %s [-bVh] [-i index] [-f FORMAT] [--index index] [--brief] [--format FORMAT] [--version] [--help] font-file...\n", program); #else - fprintf (file, "usage: %s [-Vh] [-i index] [-f FORMAT] font-file...\n", + fprintf (file, "usage: %s [-bVh] [-i index] [-f FORMAT] font-file...\n", program); #endif fprintf (file, "Query font files and print resulting pattern(s)\n"); fprintf (file, "\n"); #if HAVE_GETOPT_LONG fprintf (file, " -i, --index INDEX display the INDEX face of each font file only\n"); + fprintf (file, " -b, --brief display 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"); #else fprintf (file, " -i INDEX (index) display the INDEX face of each font file only\n"); + fprintf (file, " -b (brief) display 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"); @@ -96,6 +99,7 @@ int main (int argc, char **argv) { unsigned int id = (unsigned int) -1; + int brief = 0; FcFontSet *fs; FcChar8 *format = NULL; int err = 0; @@ -104,15 +108,18 @@ main (int argc, char **argv) int c; #if HAVE_GETOPT_LONG - while ((c = getopt_long (argc, argv, "i:f:Vh", longopts, NULL)) != -1) + while ((c = getopt_long (argc, argv, "i:bf:Vh", longopts, NULL)) != -1) #else - while ((c = getopt (argc, argv, "i:f:Vh")) != -1) + while ((c = getopt (argc, argv, "i:bf:Vh")) != -1) #endif { switch (c) { case 'i': id = (unsigned int) strtol (optarg, NULL, 0); /* strtol() To handle -1. */ break; + case 'b': + brief = 1; + break; case 'f': format = (FcChar8 *) strdup (optarg); break; @@ -149,6 +156,12 @@ main (int argc, char **argv) { FcPattern *pat = fs->fonts[i]; + if (brief) + { + FcPatternDel (pat, FC_CHARSET); + FcPatternDel (pat, FC_LANG); + } + if (format) { FcChar8 *s; |