summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/win32lib.c
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2014-05-07 06:50:20 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2014-05-07 06:50:20 +0000
commit754853637a66a4036ab2e9d0e128cc886c8d3bdf (patch)
tree875dfc81b232c551bd6d20f13b1e2a243e3e0b75 /Build/source/texk/kpathsea/win32lib.c
parent5525a89682c6381ab18cd2bc019a8daa7c1a72f6 (diff)
update win32lib.c (w32 only)
git-svn-id: svn://tug.org/texlive/trunk@33896 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea/win32lib.c')
-rw-r--r--Build/source/texk/kpathsea/win32lib.c39
1 files changed, 28 insertions, 11 deletions
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;