summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/lib/texmfmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/lib/texmfmp.c')
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c
index 70cb3960792..2d6c2154097 100644
--- a/Build/source/texk/web2c/lib/texmfmp.c
+++ b/Build/source/texk/web2c/lib/texmfmp.c
@@ -527,9 +527,7 @@ runsystem (const char *cmd)
/* Like runsystem(), the runpopen() function is called only when
shellenabledp == 1. Unlike runsystem(), here we write errors to
stderr, since we have nowhere better to use; and of course we return
- a file handle (or NULL) instead of a status indicator.
-
- Also, we append "b" to MODE on Windows. */
+ a file handle (or NULL) instead of a status indicator. */
static FILE *
runpopen (char *cmd, const char *mode)
@@ -1865,7 +1863,12 @@ open_in_or_pipe (FILE **f_ptr, int filefmt, const_string fopen_mode)
fname = xmalloc(strlen((const_string)(nameoffile+1))+1);
strcpy(fname,(const_string)(nameoffile+1));
recorder_record_input (fname + 1);
+#ifdef WIN32
+ /* Use binary mode on Windows. */
+ *f_ptr = runpopen(fname+1,"rb");
+#else
*f_ptr = runpopen(fname+1,"r");
+#endif
free(fname);
for (i=0; i<NUM_PIPES; i++) {
if (pipes[i]==NULL) {
@@ -1907,10 +1910,19 @@ open_out_or_pipe (FILE **f_ptr, const_string fopen_mode)
is better to be prepared */
if (STREQ((fname+strlen(fname)-4),".tex"))
*(fname+strlen(fname)-4) = 0;
+#ifdef WIN32
+ /* Use binary mode on Windows. */
+ *f_ptr = runpopen(fname+1,"wb");
+#else
*f_ptr = runpopen(fname+1,"w");
+#endif
*(fname+strlen(fname)) = '.';
} else {
+#ifdef WIN32
+ *f_ptr = runpopen(fname+1,"wb");
+#else
*f_ptr = runpopen(fname+1,"w");
+#endif
}
recorder_record_output (fname + 1);
free(fname);