From 19529e7439380421643c036390a04eabac269caf Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Fri, 22 Aug 2014 23:06:19 +0000 Subject: Update fsyscp_popen (Windows only) git-svn-id: svn://tug.org/texlive/trunk@35017 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 4 ++++ Build/source/texk/kpathsea/knj.c | 39 +++++++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 12 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 36e2f76d574..c3b9d7fa1f9 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,7 @@ +2014-08-22 Akira Kakuto + + * knj.c: Update fsyscp_popen(). + 2014-08-22 TANAKA Takuji * knj.[ch], c-std.h, config.h: Add a new function win32_vfprintf() diff --git a/Build/source/texk/kpathsea/knj.c b/Build/source/texk/kpathsea/knj.c index 7270d9f5788..5ae0ae2ea87 100644 --- a/Build/source/texk/kpathsea/knj.c +++ b/Build/source/texk/kpathsea/knj.c @@ -175,6 +175,17 @@ fsyscp_fopen (const char *filename, const char *mode) /* popen by file system codepage */ +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 * fsyscp_popen (const char *command, const char *mode) { @@ -186,7 +197,22 @@ fsyscp_popen (const char *command, const char *mode) #endif assert(command && mode); - commandw = get_wstring_from_fsyscp(command, commandw=NULL); + if (is_include_space (command)) { + const char *p; + char *command2, *q; + command2 = xmalloc (strlen (command) + 3); + p = command; + q = command2; + *q++ = '\"'; + while (*p) + *q++ = *p++; + *q++ = '\"'; + *q = '\0'; + commandw = get_wstring_from_fsyscp(command2, commandw=NULL); + free (command2); + } else { + commandw = get_wstring_from_fsyscp(command, commandw=NULL); + } for(i=0; (modew[i]=(wchar_t)mode[i]); i++) {} /* mode[i] must be ASCII */ f = _wpopen(commandw, modew); #if defined (KPSE_COMPAT_API) @@ -294,17 +320,6 @@ fsyscp_spawnvp (int mode, const char *command, const char* const *argv) return ret; } -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; -} - /* system by file system codepage */ -- cgit v1.2.3