summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-05 22:29:46 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-22 22:29:06 -0800
commit0d2f3192cc7dedee160702c5eaf4d2b03a21612b (patch)
treefa57675e6d769f46b96951734d588a3f26a20ac3
parent9729a3345940c400753a383f014300bf9878cb0f (diff)
Print which option was in error along with usage message
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
-rw-r--r--configure.ac2
-rw-r--r--fstobdf.c19
2 files changed, 11 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 1dbf55a..0ef434b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,7 +36,7 @@ XORG_DEFAULT_OPTIONS
AC_CONFIG_HEADERS([config.h])
# Checks for pkg-config packages
-PKG_CHECK_MODULES(FSTOBDF, [xproto >= 7.0.17 x11 libfs])
+PKG_CHECK_MODULES(FSTOBDF, [xproto >= 7.0.25 x11 libfs])
AC_CONFIG_FILES([
Makefile
diff --git a/fstobdf.c b/fstobdf.c
index db168c9..bcdffbc 100644
--- a/fstobdf.c
+++ b/fstobdf.c
@@ -49,16 +49,18 @@ in this Software without prior written authorization from The Open Group.
#include "fstobdf.h"
-static void _X_NORETURN
-usage(char *progName)
+static void _X_NORETURN _X_COLD
+usage(const char *progName, const char *msg)
{
+ if (msg)
+ fprintf(stderr, "%s: %s\n", progName, msg);
fprintf(stderr, "Usage: %s [-server <font server>] -fn <font name>\n",
progName);
exit(0);
}
-static void _X_NORETURN
-Fail(char *progName)
+static void _X_NORETURN _X_COLD
+Fail(const char *progName)
{
fprintf(stderr, "%s: unable to dump font\n", progName);
exit(1);
@@ -90,17 +92,17 @@ main(int argc, char *argv[])
if (argv[++i])
serverName = argv[i];
else
- usage(argv[0]);
+ usage(argv[0], "-server requires an argument");
} else if (!strncmp(argv[i], "-fn", 3)) {
if (argv[++i])
fontName = argv[i];
else
- usage(argv[0]);
+ usage(argv[0], "-fn requires an argument");
}
}
if (fontName == NULL)
- usage(argv[0]);
+ usage(argv[0], "No font name specified");
fontServer = FSOpenServer(serverName);
if (!fontServer) {
@@ -109,8 +111,7 @@ main(int argc, char *argv[])
fprintf(stderr, "%s: can't open font server \"%s\"\n",
argv[0], sn);
else
- fprintf(stderr, "%s: No font server specified.\n",
- argv[0]);
+ usage(argv[0], "No font server specified.");
exit(0);
}
bitmapFormat = 0;