summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/kpathsea/ChangeLog4
-rw-r--r--Build/source/texk/kpathsea/win32lib.c39
2 files changed, 32 insertions, 11 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 44e4dccad62..c087d6a1a50 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,7 @@
+2014-05-07 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * win32lib.c: Update win32_popen() (w32 only).
+
2014-05-05 Karl Berry <karl@tug.org>
* doc/kpathsea.texi,
diff --git a/Build/source/texk/kpathsea/win32lib.c b/Build/source/texk/kpathsea/win32lib.c
index f281d8b7793..9de8f6fa230 100644
--- a/Build/source/texk/kpathsea/win32lib.c
+++ b/Build/source/texk/kpathsea/win32lib.c
@@ -21,15 +21,42 @@
#include <kpathsea/variable.h>
#include <kpathsea/c-stat.h>
+static int is_include_space(const char *s)
+{
+ char *p;
+ p = strchr(s, ' ');
+ if(p) return 1;
+ p = strchr(s, '\t');
+ if(p) return 1;
+ return 0;
+}
+
FILE * win32_popen (const char *cmd, const char *fmode)
{
char mode[3];
+ char *p, *q;
+ const char *cmd2;
+ FILE *ret;
mode[0] = fmode[0];
mode[1] = 'b';
mode[2] = '\0';
- return _popen (cmd, mode);
+ if (is_include_space (cmd)) {
+ cmd2 = xmalloc (strlen (cmd) + 3);
+ q = (char *)cmd2;
+ p = (char *)cmd;
+ *q++= '\"';
+ while(*p)
+ *q++ = *p++;
+ *q++ = '\"';
+ *q = '\0';
+ ret = _popen (cmd2, mode);
+ free ((char *)cmd2);
+ return ret;
+ } else {
+ return _popen (cmd, mode);
+ }
}
int win32_pclose (FILE *f)
@@ -344,16 +371,6 @@ kpathsea_init_user_info (kpathsea kpse)
}
/* win32_system */
-static int is_include_space(const char *s)
-{
- char *p;
- p = strchr(s, ' ');
- if(p) return 1;
- p = strchr(s, '\t');
- if(p) return 1;
- return 0;
-}
-
int win32_system(const char *cmd)
{
const char *p;