summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-08 23:28:16 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-22 22:30:48 -0800
commit26c89de6cdf0a5b7122a630a5df37fd67a4163e2 (patch)
tree7e4f55cb32028d5923ed0c29c890d37836ad19af
parent43ab9b11699acadbf09b8ed050a7a2f7e630dce4 (diff)
Make usage() always exit(1)
Avoid duplicating exit(1) calls after every single call to usage() Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
-rw-r--r--configure.ac2
-rw-r--r--mkfontscale.c12
2 files changed, 4 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 971ae5c..cc13259 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,7 +54,7 @@ fi
# Checks for pkg-config packages
PKG_CHECK_MODULES(MKFONTSCALE, fontenc freetype2)
-PKG_CHECK_MODULES(X11, xproto)
+PKG_CHECK_MODULES(X11, [xproto >= 7.0.25])
dnl Allow checking code with lint, sparse, etc.
XORG_WITH_LINT
diff --git a/mkfontscale.c b/mkfontscale.c
index d73df8c..d27bb8d 100644
--- a/mkfontscale.c
+++ b/mkfontscale.c
@@ -34,6 +34,7 @@
#include <ctype.h>
#include <X11/Xos.h>
+#include <X11/Xfuncproto.h>
#include <X11/fonts/fontenc.h>
#include <ft2build.h>
#include FT_FREETYPE_H
@@ -113,7 +114,7 @@ static int reencodeLegacy;
static char *encodingPrefix;
static char *exclusionSuffix;
-static void
+static void _X_NORETURN _X_COLD
usage(void)
{
fprintf(stderr,
@@ -121,6 +122,7 @@ usage(void)
" [ -a encoding ] [ -f fuzz ] [ -l ]\n"
" [ -e directory ] [ -p prefix ] [ -n ] [ -r ] \n"
" [-u] [-U] [-v] [ directory ]...\n");
+ exit(1);
}
int
@@ -167,25 +169,21 @@ main(int argc, char **argv)
} else if (strcmp(argv[argn], "-x") == 0) {
if(argn >= argc - 1) {
usage();
- exit(1);
}
exclusionSuffix = argv[argn + 1];
argn += 2;
} else if(strcmp(argv[argn], "-a") == 0) {
if(argn >= argc - 1) {
usage();
- exit(1);
}
makeList(&argv[argn + 1], 1, encodings, 0);
argn += 2;
} else if(strcmp(argv[argn], "-p") == 0) {
if(argn >= argc - 1) {
usage();
- exit(1);
}
if(strlen(argv[argn + 1]) > NPREFIX - 1) {
usage();
- exit(1);
}
free(encodingPrefix);
encodingPrefix = dsprintf("%s", argv[argn + 1]);
@@ -193,7 +191,6 @@ main(int argc, char **argv)
} else if(strcmp(argv[argn], "-e") == 0) {
if(argn >= argc - 1) {
usage();
- exit(1);
}
rc = readEncodings(encodingsToDo, argv[argn + 1]);
if(rc < 0)
@@ -223,14 +220,12 @@ main(int argc, char **argv)
} else if(strcmp(argv[argn], "-o") == 0) {
if(argn >= argc - 1) {
usage();
- exit(1);
}
outfilename = argv[argn + 1];
argn += 2;
} else if(strcmp(argv[argn], "-f") == 0) {
if(argn >= argc - 1) {
usage();
- exit(1);
}
bigEncodingFuzz = atof(argv[argn + 1]) / 100.0;
argn += 2;
@@ -243,7 +238,6 @@ main(int argc, char **argv)
exit(0);
} else {
usage();
- exit(1);
}
}