summaryrefslogtreecommitdiff
path: root/Build/source/texk/seetexk/dvitodvi.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/seetexk/dvitodvi.c')
-rw-r--r--Build/source/texk/seetexk/dvitodvi.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/Build/source/texk/seetexk/dvitodvi.c b/Build/source/texk/seetexk/dvitodvi.c
index 91c94d75b58..c643ac95178 100644
--- a/Build/source/texk/seetexk/dvitodvi.c
+++ b/Build/source/texk/seetexk/dvitodvi.c
@@ -35,6 +35,9 @@
#include <kpathsea/config.h>
#include <kpathsea/c-fopen.h>
#include <kpathsea/getopt.h>
+#if defined(WIN32)
+#include <kpathsea/variable.h>
+#endif
#else
#define FOPEN_RBIN_MODE "rb"
#define FOPEN_WBIN_MODE "wb"
@@ -52,11 +55,16 @@ extern int optind;
#include "search.h"
#include <stdio.h>
#include <ctype.h>
+#include "seek.h"
+
+#if defined(WIN32) && defined(KPATHSEA)
+#undef fopen
+#define fopen fsyscp_fopen
+#endif
#define white(x) ((x) == ' ' || (x) == '\t' || (x) == ',')
#define MAXDVIPAGES 1000 /* max (absolute) pages in DVI file */
-#include "seek.h"
char *ProgName;
@@ -621,6 +629,17 @@ main(int argc, char **argv)
register char *s;
char *outname = NULL;
char *specstring = NULL;
+#if defined(WIN32) && defined(KPATHSEA)
+ int ac;
+ char **av, *enc;
+
+ kpse_set_program_name(argv[0], "dvitodvi");
+ enc = kpse_var_value("command_line_encoding");
+ if (get_command_line_args_utf8(enc, &ac, &av)) {
+ argc = ac;
+ argv = av;
+ }
+#endif
Width = 0;
Height = 0;