[fc-match/fc-list/fc-query/fc-scan] Add --brief that is like --verbose without charset
This commit is contained in:
parent
dc8326d3f1
commit
2a41738fd7
|
@ -49,6 +49,7 @@
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
const struct option longopts[] = {
|
const struct option longopts[] = {
|
||||||
{"verbose", 0, 0, 'v'},
|
{"verbose", 0, 0, 'v'},
|
||||||
|
{"brief", 0, 0, 'b'},
|
||||||
{"format", 1, 0, 'f'},
|
{"format", 1, 0, 'f'},
|
||||||
{"quiet", 0, 0, 'q'},
|
{"quiet", 0, 0, 'q'},
|
||||||
{"version", 0, 0, 'V'},
|
{"version", 0, 0, 'V'},
|
||||||
|
@ -67,22 +68,24 @@ usage (char *program, int error)
|
||||||
{
|
{
|
||||||
FILE *file = error ? stderr : stdout;
|
FILE *file = error ? stderr : stdout;
|
||||||
#if HAVE_GETOPT_LONG
|
#if HAVE_GETOPT_LONG
|
||||||
fprintf (file, "usage: %s [-vqVh] [-f FORMAT] [--verbose] [--format=FORMAT] [--quiet] [--version] [--help] [pattern] {element ...} \n",
|
fprintf (file, "usage: %s [-vbqVh] [-f FORMAT] [--verbose] [--brief] [--format=FORMAT] [--quiet] [--version] [--help] [pattern] {element ...} \n",
|
||||||
program);
|
program);
|
||||||
#else
|
#else
|
||||||
fprintf (file, "usage: %s [-vqVh] [-f FORMAT] [pattern] {element ...} \n",
|
fprintf (file, "usage: %s [-vbqVh] [-f FORMAT] [pattern] {element ...} \n",
|
||||||
program);
|
program);
|
||||||
#endif
|
#endif
|
||||||
fprintf (file, "List fonts matching [pattern]\n");
|
fprintf (file, "List fonts matching [pattern]\n");
|
||||||
fprintf (file, "\n");
|
fprintf (file, "\n");
|
||||||
#if HAVE_GETOPT_LONG
|
#if HAVE_GETOPT_LONG
|
||||||
fprintf (file, " -v, --verbose display entire font pattern verbosely\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, " -f, --format=FORMAT use the given output format\n");
|
||||||
fprintf (file, " -q, --quiet suppress all normal output, exit 1 if no fonts matched\n");
|
fprintf (file, " -q, --quiet suppress all normal output, exit 1 if no fonts matched\n");
|
||||||
fprintf (file, " -V, --version display font config version and exit\n");
|
fprintf (file, " -V, --version display font config version and exit\n");
|
||||||
fprintf (file, " -h, --help display this help and exit\n");
|
fprintf (file, " -h, --help display this help and exit\n");
|
||||||
#else
|
#else
|
||||||
fprintf (file, " -v (verbose) display entire font pattern verbosely\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, " -f FORMAT (format) use the given output format\n");
|
||||||
fprintf (file, " -q, (quiet) suppress all normal output, exit 1 if no fonts matched\n");
|
fprintf (file, " -q, (quiet) suppress all normal output, exit 1 if no fonts matched\n");
|
||||||
fprintf (file, " -V (version) display font config version and exit\n");
|
fprintf (file, " -V (version) display font config version and exit\n");
|
||||||
|
@ -95,6 +98,7 @@ int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
|
int brief = 0;
|
||||||
int quiet = 0;
|
int quiet = 0;
|
||||||
const FcChar8 *format = NULL;
|
const FcChar8 *format = NULL;
|
||||||
int nfont = 0;
|
int nfont = 0;
|
||||||
|
@ -106,15 +110,18 @@ main (int argc, char **argv)
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
#if HAVE_GETOPT_LONG
|
#if HAVE_GETOPT_LONG
|
||||||
while ((c = getopt_long (argc, argv, "vf:qVh", longopts, NULL)) != -1)
|
while ((c = getopt_long (argc, argv, "vbf:qVh", longopts, NULL)) != -1)
|
||||||
#else
|
#else
|
||||||
while ((c = getopt (argc, argv, "vf:qVh")) != -1)
|
while ((c = getopt (argc, argv, "vbf:qVh")) != -1)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = 1;
|
verbose = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'b':
|
||||||
|
brief = 1;
|
||||||
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
format = (FcChar8 *) strdup (optarg);
|
format = (FcChar8 *) strdup (optarg);
|
||||||
break;
|
break;
|
||||||
|
@ -155,7 +162,7 @@ main (int argc, char **argv)
|
||||||
pat = FcPatternCreate ();
|
pat = FcPatternCreate ();
|
||||||
if (quiet && !os)
|
if (quiet && !os)
|
||||||
os = FcObjectSetCreate ();
|
os = FcObjectSetCreate ();
|
||||||
if (!verbose && !format && !os)
|
if (!verbose && !brief && !format && !os)
|
||||||
os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, FC_FILE, (char *) 0);
|
os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, FC_FILE, (char *) 0);
|
||||||
if (!format)
|
if (!format)
|
||||||
format = (const FcChar8 *) "%{=fclist}\n";
|
format = (const FcChar8 *) "%{=fclist}\n";
|
||||||
|
@ -171,8 +178,13 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
for (j = 0; j < fs->nfont; j++)
|
for (j = 0; j < fs->nfont; j++)
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose || brief)
|
||||||
{
|
{
|
||||||
|
if (brief)
|
||||||
|
{
|
||||||
|
FcPatternDel (fs->fonts[j], FC_CHARSET);
|
||||||
|
FcPatternDel (fs->fonts[j], FC_LANG);
|
||||||
|
}
|
||||||
FcPatternPrint (fs->fonts[j]);
|
FcPatternPrint (fs->fonts[j]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -52,6 +52,7 @@ static const struct option longopts[] = {
|
||||||
{"sort", 0, 0, 's'},
|
{"sort", 0, 0, 's'},
|
||||||
{"all", 0, 0, 'a'},
|
{"all", 0, 0, 'a'},
|
||||||
{"verbose", 0, 0, 'v'},
|
{"verbose", 0, 0, 'v'},
|
||||||
|
{"brief", 0, 0, 'b'},
|
||||||
{"format", 1, 0, 'f'},
|
{"format", 1, 0, 'f'},
|
||||||
{"version", 0, 0, 'V'},
|
{"version", 0, 0, 'V'},
|
||||||
{"help", 0, 0, 'h'},
|
{"help", 0, 0, 'h'},
|
||||||
|
@ -69,7 +70,7 @@ usage (char *program, int error)
|
||||||
{
|
{
|
||||||
FILE *file = error ? stderr : stdout;
|
FILE *file = error ? stderr : stdout;
|
||||||
#if HAVE_GETOPT_LONG
|
#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);
|
program);
|
||||||
#else
|
#else
|
||||||
fprintf (file, "usage: %s [-savVh] [-f FORMAT] [pattern] {element...}\n",
|
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, " -s, --sort display sorted list of matches\n");
|
||||||
fprintf (file, " -a, --all display unpruned 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, " -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, " -f, --format=FORMAT use the given output format\n");
|
||||||
fprintf (file, " -V, --version display font config version and exit\n");
|
fprintf (file, " -V, --version display font config version and exit\n");
|
||||||
fprintf (file, " -h, --help display this help 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, " -s, (sort) display sorted list of matches\n");
|
||||||
fprintf (file, " -a (all) display unpruned 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, " -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, " -f FORMAT (format) use the given output format\n");
|
||||||
fprintf (file, " -V (version) display font config version and exit\n");
|
fprintf (file, " -V (version) display font config version and exit\n");
|
||||||
fprintf (file, " -h (help) display this help and exit\n");
|
fprintf (file, " -h (help) display this help and exit\n");
|
||||||
|
@ -99,6 +102,7 @@ int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
|
int brief = 0;
|
||||||
int sort = 0, all = 0;
|
int sort = 0, all = 0;
|
||||||
const FcChar8 *format = NULL;
|
const FcChar8 *format = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
@ -110,9 +114,9 @@ main (int argc, char **argv)
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
#if HAVE_GETOPT_LONG
|
#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
|
#else
|
||||||
while ((c = getopt (argc, argv, "asvf:Vh")) != -1)
|
while ((c = getopt (argc, argv, "asvbf:Vh")) != -1)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
@ -125,6 +129,9 @@ main (int argc, char **argv)
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = 1;
|
verbose = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'b':
|
||||||
|
brief = 1;
|
||||||
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
format = (FcChar8 *) strdup (optarg);
|
format = (FcChar8 *) strdup (optarg);
|
||||||
break;
|
break;
|
||||||
|
@ -218,8 +225,13 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
font = FcPatternFilter (fs->fonts[j], os);
|
font = FcPatternFilter (fs->fonts[j], os);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose || brief)
|
||||||
{
|
{
|
||||||
|
if (brief)
|
||||||
|
{
|
||||||
|
FcPatternDel (font, FC_CHARSET);
|
||||||
|
FcPatternDel (font, FC_LANG);
|
||||||
|
}
|
||||||
FcPatternPrint (font);
|
FcPatternPrint (font);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
static const struct option longopts[] = {
|
static const struct option longopts[] = {
|
||||||
{"index", 1, 0, 'i'},
|
{"index", 1, 0, 'i'},
|
||||||
|
{"brief", 0, 0, 'b'},
|
||||||
{"format", 1, 0, 'f'},
|
{"format", 1, 0, 'f'},
|
||||||
{"version", 0, 0, 'V'},
|
{"version", 0, 0, 'V'},
|
||||||
{"help", 0, 0, 'h'},
|
{"help", 0, 0, 'h'},
|
||||||
|
@ -70,21 +71,23 @@ usage (char *program, int error)
|
||||||
{
|
{
|
||||||
FILE *file = error ? stderr : stdout;
|
FILE *file = error ? stderr : stdout;
|
||||||
#if HAVE_GETOPT_LONG
|
#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);
|
program);
|
||||||
#else
|
#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);
|
program);
|
||||||
#endif
|
#endif
|
||||||
fprintf (file, "Query font files and print resulting pattern(s)\n");
|
fprintf (file, "Query font files and print resulting pattern(s)\n");
|
||||||
fprintf (file, "\n");
|
fprintf (file, "\n");
|
||||||
#if HAVE_GETOPT_LONG
|
#if HAVE_GETOPT_LONG
|
||||||
fprintf (file, " -i, --index INDEX display the INDEX face of each font file only\n");
|
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, " -f, --format=FORMAT use the given output format\n");
|
||||||
fprintf (file, " -V, --version display font config version and exit\n");
|
fprintf (file, " -V, --version display font config version and exit\n");
|
||||||
fprintf (file, " -h, --help display this help and exit\n");
|
fprintf (file, " -h, --help display this help and exit\n");
|
||||||
#else
|
#else
|
||||||
fprintf (file, " -i INDEX (index) display the INDEX face of each font file only\n");
|
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, " -f FORMAT (format) use the given output format\n");
|
||||||
fprintf (file, " -V (version) display font config version and exit\n");
|
fprintf (file, " -V (version) display font config version and exit\n");
|
||||||
fprintf (file, " -h (help) display this help and exit\n");
|
fprintf (file, " -h (help) display this help and exit\n");
|
||||||
|
@ -96,6 +99,7 @@ int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
unsigned int id = (unsigned int) -1;
|
unsigned int id = (unsigned int) -1;
|
||||||
|
int brief = 0;
|
||||||
FcFontSet *fs;
|
FcFontSet *fs;
|
||||||
FcChar8 *format = NULL;
|
FcChar8 *format = NULL;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
@ -104,15 +108,18 @@ main (int argc, char **argv)
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
#if HAVE_GETOPT_LONG
|
#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
|
#else
|
||||||
while ((c = getopt (argc, argv, "i:f:Vh")) != -1)
|
while ((c = getopt (argc, argv, "i:bf:Vh")) != -1)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'i':
|
case 'i':
|
||||||
id = (unsigned int) strtol (optarg, NULL, 0); /* strtol() To handle -1. */
|
id = (unsigned int) strtol (optarg, NULL, 0); /* strtol() To handle -1. */
|
||||||
break;
|
break;
|
||||||
|
case 'b':
|
||||||
|
brief = 1;
|
||||||
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
format = (FcChar8 *) strdup (optarg);
|
format = (FcChar8 *) strdup (optarg);
|
||||||
break;
|
break;
|
||||||
|
@ -149,6 +156,12 @@ main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
FcPattern *pat = fs->fonts[i];
|
FcPattern *pat = fs->fonts[i];
|
||||||
|
|
||||||
|
if (brief)
|
||||||
|
{
|
||||||
|
FcPatternDel (pat, FC_CHARSET);
|
||||||
|
FcPatternDel (pat, FC_LANG);
|
||||||
|
}
|
||||||
|
|
||||||
if (format)
|
if (format)
|
||||||
{
|
{
|
||||||
FcChar8 *s;
|
FcChar8 *s;
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
static const struct option longopts[] = {
|
static const struct option longopts[] = {
|
||||||
|
{"brief", 0, 0, 'b'},
|
||||||
{"format", 1, 0, 'f'},
|
{"format", 1, 0, 'f'},
|
||||||
{"version", 0, 0, 'V'},
|
{"version", 0, 0, 'V'},
|
||||||
{"help", 0, 0, 'h'},
|
{"help", 0, 0, 'h'},
|
||||||
|
@ -69,19 +70,21 @@ usage (char *program, int error)
|
||||||
{
|
{
|
||||||
FILE *file = error ? stderr : stdout;
|
FILE *file = error ? stderr : stdout;
|
||||||
#if HAVE_GETOPT_LONG
|
#if HAVE_GETOPT_LONG
|
||||||
fprintf (file, "usage: %s [-Vh] [-f FORMAT] [--format FORMAT] [--version] [--help] font-file...\n",
|
fprintf (file, "usage: %s [-bVh] [-f FORMAT] [--brief] [--format FORMAT] [--version] [--help] font-file...\n",
|
||||||
program);
|
program);
|
||||||
#else
|
#else
|
||||||
fprintf (file, "usage: %s [-Vh] [-f FORMAT] font-file...\n",
|
fprintf (file, "usage: %s [-bVh] [-f FORMAT] font-file...\n",
|
||||||
program);
|
program);
|
||||||
#endif
|
#endif
|
||||||
fprintf (file, "Scan font files and directories, and print resulting pattern(s)\n");
|
fprintf (file, "Scan font files and directories, and print resulting pattern(s)\n");
|
||||||
fprintf (file, "\n");
|
fprintf (file, "\n");
|
||||||
#if HAVE_GETOPT_LONG
|
#if HAVE_GETOPT_LONG
|
||||||
|
fprintf (file, " -b, --brief display font pattern briefly\n");
|
||||||
fprintf (file, " -f, --format=FORMAT use the given output format\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, " -V, --version display font config version and exit\n");
|
||||||
fprintf (file, " -h, --help display this help and exit\n");
|
fprintf (file, " -h, --help display this help and exit\n");
|
||||||
#else
|
#else
|
||||||
|
fprintf (file, " -b (brief) display font pattern briefly\n");
|
||||||
fprintf (file, " -f FORMAT (format) use the given output format\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, " -V (version) display font config version and exit\n");
|
||||||
fprintf (file, " -h (help) display this help and exit\n");
|
fprintf (file, " -h (help) display this help and exit\n");
|
||||||
|
@ -92,6 +95,7 @@ usage (char *program, int error)
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
int brief = 0;
|
||||||
FcChar8 *format = NULL;
|
FcChar8 *format = NULL;
|
||||||
int i;
|
int i;
|
||||||
FcFontSet *fs;
|
FcFontSet *fs;
|
||||||
|
@ -105,6 +109,9 @@ main (int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case 'b':
|
||||||
|
brief = 1;
|
||||||
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
format = (FcChar8 *) strdup (optarg);
|
format = (FcChar8 *) strdup (optarg);
|
||||||
break;
|
break;
|
||||||
|
@ -152,6 +159,12 @@ main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
FcPattern *pat = fs->fonts[i];
|
FcPattern *pat = fs->fonts[i];
|
||||||
|
|
||||||
|
if (brief)
|
||||||
|
{
|
||||||
|
FcPatternDel (pat, FC_CHARSET);
|
||||||
|
FcPatternDel (pat, FC_LANG);
|
||||||
|
}
|
||||||
|
|
||||||
if (format)
|
if (format)
|
||||||
{
|
{
|
||||||
FcChar8 *s;
|
FcChar8 *s;
|
||||||
|
|
Loading…
Reference in New Issue