[fc-query] Remove --ignore-blanks / -b

Blanks are the new black, err, dead!
This commit is contained in:
Behdad Esfahbod 2017-09-15 01:20:56 -04:00
parent 2db7ca7d58
commit dc8326d3f1
1 changed files with 5 additions and 15 deletions

View File

@ -52,7 +52,6 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#include <getopt.h> #include <getopt.h>
static const struct option longopts[] = { static const struct option longopts[] = {
{"ignore-blanks", 0, 0, 'b'},
{"index", 1, 0, 'i'}, {"index", 1, 0, 'i'},
{"format", 1, 0, 'f'}, {"format", 1, 0, 'f'},
{"version", 0, 0, 'V'}, {"version", 0, 0, 'V'},
@ -71,22 +70,20 @@ 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 [-Vbh] [-i index] [-f FORMAT] [--ignore-blanks] [--index index] [--format FORMAT] [--version] [--help] font-file...\n", fprintf (file, "usage: %s [-Vh] [-i index] [-f FORMAT] [--index index] [--format FORMAT] [--version] [--help] font-file...\n",
program); program);
#else #else
fprintf (file, "usage: %s [-Vbh] [-i index] [-f FORMAT] font-file...\n", fprintf (file, "usage: %s [-Vh] [-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, " -b, --ignore-blanks ignore blanks to compute langauges\n");
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, " -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 (ignore-blanks) ignore blanks to compute languages\n");
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, " -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");
@ -99,25 +96,20 @@ int
main (int argc, char **argv) main (int argc, char **argv)
{ {
unsigned int id = (unsigned int) -1; unsigned int id = (unsigned int) -1;
int ignore_blanks = 0;
FcFontSet *fs; FcFontSet *fs;
FcChar8 *format = NULL; FcChar8 *format = NULL;
FcBlanks *blanks = NULL;
int err = 0; int err = 0;
int i; int i;
#if HAVE_GETOPT_LONG || HAVE_GETOPT #if HAVE_GETOPT_LONG || HAVE_GETOPT
int c; int c;
#if HAVE_GETOPT_LONG #if HAVE_GETOPT_LONG
while ((c = getopt_long (argc, argv, "bi:f:Vh", longopts, NULL)) != -1) while ((c = getopt_long (argc, argv, "i:f:Vh", longopts, NULL)) != -1)
#else #else
while ((c = getopt (argc, argv, "bi:f:Vh")) != -1) while ((c = getopt (argc, argv, "i:f:Vh")) != -1)
#endif #endif
{ {
switch (c) { switch (c) {
case 'b':
ignore_blanks = 1;
break;
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;
@ -143,12 +135,10 @@ main (int argc, char **argv)
usage (argv[0], 1); usage (argv[0], 1);
fs = FcFontSetCreate (); fs = FcFontSetCreate ();
if (!ignore_blanks)
blanks = FcConfigGetBlanks (NULL);
for (; i < argc; i++) for (; i < argc; i++)
{ {
if (!FcFreeTypeQueryAll ((FcChar8*) argv[i], id, blanks, NULL, fs)) if (!FcFreeTypeQueryAll ((FcChar8*) argv[i], id, NULL, NULL, fs))
{ {
fprintf (stderr, "Can't query face %u of font file %s\n", id, argv[i]); fprintf (stderr, "Can't query face %u of font file %s\n", id, argv[i]);
err = 1; err = 1;