summaryrefslogtreecommitdiff
path: root/Build/source/texk/ttfdump/src/ttfdump.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/ttfdump/src/ttfdump.c')
-rw-r--r--Build/source/texk/ttfdump/src/ttfdump.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/Build/source/texk/ttfdump/src/ttfdump.c b/Build/source/texk/ttfdump/src/ttfdump.c
index 0726b3b0e5f..aa1a9ce4b3f 100644
--- a/Build/source/texk/ttfdump/src/ttfdump.c
+++ b/Build/source/texk/ttfdump/src/ttfdump.c
@@ -1,7 +1,16 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#ifdef WIN32
+
+#if defined(KPATHSEA)
+/* including <kpathsea/kpathsea.h> would yield conflicting typedefs */
+#include <kpathsea/lib.h>
+#include <kpathsea/tex-file.h>
+#include <kpathsea/c-fopen.h>
+#include <kpathsea/progname.h>
+#include <kpathsea/c-unistd.h>
+#include <kpathsea/getopt.h>
+#elif defined(WIN32)
#include <getopt.h>
#else
#include <unistd.h>
@@ -74,6 +83,10 @@ main(int argc, char *argv[])
/* print all glyphs by default */
int glyphnum = ALL_GLYF, collection = 0;
+#ifdef KPATHSEA
+ kpse_set_program_name(argv[0], "ttfdump");
+#endif
+
if (argc < 2)
{
usage();
@@ -129,9 +142,12 @@ main(int argc, char *argv[])
}
if (!strcmp(dumpname, "-"))
{
+#ifdef WIN32
+ _setmode(fileno(stdout), _O_BINARY);
+#endif
dp_file = stdout;
}
- else if ((dp_file = fopen(dumpname, "wt")) == NULL)
+ else if ((dp_file = fopen(dumpname, "wb")) == NULL)
{
fprintf(stderr, "Can't open dumping file\n");
exit(EXIT_FAILURE);