aboutsummaryrefslogtreecommitdiff
path: root/mkfontscale/mkfontscale.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-11-25 12:10:25 +0100
committermarha <marha@users.sourceforge.net>2013-11-25 12:10:25 +0100
commit0f333fb1102f4886a8ce39f3c09b12e89e5a7f19 (patch)
tree8239768e506a03837019c4f02c8ab949c04a0818 /mkfontscale/mkfontscale.c
parent7dbaa1cffdf176f803f2c7069fb6810e16a86f72 (diff)
parenta473b885d641b9c1ea57f2ae53f9ba7f2958cce2 (diff)
downloadvcxsrv-0f333fb1102f4886a8ce39f3c09b12e89e5a7f19.tar.gz
vcxsrv-0f333fb1102f4886a8ce39f3c09b12e89e5a7f19.tar.bz2
vcxsrv-0f333fb1102f4886a8ce39f3c09b12e89e5a7f19.zip
Merge remote-tracking branch 'origin/released'
* origin/released: libX11 xserver mesa libXinerama libXmu mkfontscale git update 25 nov 2013 Conflicts: libXinerama/src/Xinerama.c
Diffstat (limited to 'mkfontscale/mkfontscale.c')
-rw-r--r--mkfontscale/mkfontscale.c50
1 files changed, 31 insertions, 19 deletions
diff --git a/mkfontscale/mkfontscale.c b/mkfontscale/mkfontscale.c
index e605cf9bd..b01d80a27 100644
--- a/mkfontscale/mkfontscale.c
+++ b/mkfontscale/mkfontscale.c
@@ -24,7 +24,11 @@
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
#include <string.h>
+#ifdef _MSC_VER
+#include <direct.h>
+#endif
#include <sys/types.h>
#include <sys/stat.h>
@@ -34,6 +38,7 @@
#include <ctype.h>
#include <X11/Xos.h>
+#include <X11/Xfuncproto.h>
#include <X11/fonts/fontenc.h>
#include <ft2build.h>
#include FT_FREETYPE_H
@@ -112,15 +117,24 @@ static ListPtr encodingsToDo;
static int reencodeLegacy;
static char *encodingPrefix;
static char *exclusionSuffix;
+static char *ProgramName;
static void
usage(void)
{
- fprintf(stderr,
+ fprintf(stderr, "Usage:\n"
"mkfontscale [ -b ] [ -s ] [ -o filename ] [-x suffix ]\n"
- " [ -a encoding ] [ -f fuzz ] [ -l ] "
+ " [ -a encoding ] [ -f fuzz ] [ -l ]\n"
" [ -e directory ] [ -p prefix ] [ -n ] [ -r ] \n"
- " [-u] [-U] [ directory ]...\n");
+ " [-u] [-U] [-v] [ directory ]...\n");
+ exit(1);
+}
+
+static void
+missing_arg (const char *option)
+{
+ fprintf(stderr, "%s: %s requires an argument\n", ProgramName, option);
+ usage();
}
int
@@ -131,6 +145,7 @@ main(int argc, char **argv)
int rc, ll = 0;
char prefix[NPREFIX];
+ ProgramName = argv[0];
encodingPrefix = NULL;
exclusionSuffix = NULL;
@@ -144,9 +159,9 @@ main(int argc, char **argv)
outfilename = NULL;
- encodings = makeList(encodings_array, countof(encodings_array), NULL, 0);
+ encodings = makeList((char **)encodings_array, countof(encodings_array), NULL, 0);
- extra_encodings = makeList(extra_encodings_array,
+ extra_encodings = makeList((char**)extra_encodings_array,
countof(extra_encodings_array),
NULL, 0);
doBitmaps = 0;
@@ -166,34 +181,31 @@ main(int argc, char **argv)
break;
} else if (strcmp(argv[argn], "-x") == 0) {
if(argn >= argc - 1) {
- usage();
- exit(1);
+ missing_arg("-x");
}
exclusionSuffix = argv[argn + 1];
argn += 2;
} else if(strcmp(argv[argn], "-a") == 0) {
if(argn >= argc - 1) {
- usage();
- exit(1);
+ missing_arg("-a");
}
makeList(&argv[argn + 1], 1, encodings, 0);
argn += 2;
} else if(strcmp(argv[argn], "-p") == 0) {
if(argn >= argc - 1) {
- usage();
- exit(1);
+ missing_arg("-p");
}
if(strlen(argv[argn + 1]) > NPREFIX - 1) {
+ fprintf(stderr, "%s: argument to -p cannot be longer than "
+ "%d characters\n", ProgramName, NPREFIX - 1);
usage();
- exit(1);
}
free(encodingPrefix);
encodingPrefix = dsprintf("%s", argv[argn + 1]);
argn += 2;
} else if(strcmp(argv[argn], "-e") == 0) {
if(argn >= argc - 1) {
- usage();
- exit(1);
+ missing_arg("-e");
}
rc = readEncodings(encodingsToDo, argv[argn + 1]);
if(rc < 0)
@@ -222,15 +234,13 @@ main(int argc, char **argv)
argn++;
} else if(strcmp(argv[argn], "-o") == 0) {
if(argn >= argc - 1) {
- usage();
- exit(1);
+ missing_arg("-o");
}
outfilename = argv[argn + 1];
argn += 2;
} else if(strcmp(argv[argn], "-f") == 0) {
if(argn >= argc - 1) {
- usage();
- exit(1);
+ missing_arg("-f");
}
bigEncodingFuzz = atof(argv[argn + 1]) / 100.0;
argn += 2;
@@ -238,9 +248,11 @@ main(int argc, char **argv)
argn++;
} else if (strcmp(argv[argn], "-n") == 0) {
argn++;
+ } else if (strcmp(argv[argn], "-v") == 0) {
+ printf("%s\n", PACKAGE_STRING);
+ exit(0);
} else {
usage();
- exit(1);
}
}