summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/win32lib.c
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2012-04-30 08:55:01 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2012-04-30 08:55:01 +0000
commit4d73948fd74889607cad8febb6738520dc7a3643 (patch)
tree0d2a022fd5b6385f244194cd0a6c10c84103cb76 /Build/source/texk/kpathsea/win32lib.c
parent6bd71f27b23982f4b367d58f9ea9f07ef3a59afa (diff)
fix a w32 bug
git-svn-id: svn://tug.org/texlive/trunk@26160 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea/win32lib.c')
-rw-r--r--Build/source/texk/kpathsea/win32lib.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/Build/source/texk/kpathsea/win32lib.c b/Build/source/texk/kpathsea/win32lib.c
index 4aafe218afe..270cce659cc 100644
--- a/Build/source/texk/kpathsea/win32lib.c
+++ b/Build/source/texk/kpathsea/win32lib.c
@@ -1069,6 +1069,15 @@ build_cmdline(char ***cmd, char *input, char *output)
}
/* 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 __cdecl win32_system(const char *cmd)
{
@@ -1076,21 +1085,25 @@ int __cdecl win32_system(const char *cmd)
char *q;
char *av[4];
int len, ret;
+ int spacep = 0;
- if(_osver & 0x8000)
- av[0] = xstrdup("command.com");
- else
- av[0] = xstrdup("cmd.exe");
+ av[0] = xstrdup("cmd.exe");
av[1] = xstrdup("/c");
- len = strlen(cmd) + 1;
+ len = strlen(cmd) + 3;
+ spacep = is_include_space(cmd);
av[2] = malloc(len);
- for(p = cmd, q = av[2]; *p; p++, q++) {
+ q = av[2];
+ if(spacep)
+ *q++ = '"';
+ for(p = cmd; *p; p++, q++) {
if(*p == '\'')
*q = '"';
else
*q = *p;
}
+ if(spacep)
+ *q++ = '"';
*q = '\0';
av[3] = NULL;
ret = spawnvp(_P_WAIT, av[0], av);