diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2014-05-07 06:50:20 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2014-05-07 06:50:20 +0000 |
commit | 754853637a66a4036ab2e9d0e128cc886c8d3bdf (patch) | |
tree | 875dfc81b232c551bd6d20f13b1e2a243e3e0b75 /Build/source | |
parent | 5525a89682c6381ab18cd2bc019a8daa7c1a72f6 (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')
-rw-r--r-- | Build/source/texk/kpathsea/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32lib.c | 39 |
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; |