summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2014-08-22 23:06:19 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2014-08-22 23:06:19 +0000
commit19529e7439380421643c036390a04eabac269caf (patch)
tree38a9897ff5f7c570e2014d704a73c6e130c375e2 /Build
parent687a76129428e7a0b4c4a63e4eed417cd011380a (diff)
Update fsyscp_popen (Windows only)
git-svn-id: svn://tug.org/texlive/trunk@35017 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog4
-rw-r--r--Build/source/texk/kpathsea/knj.c39
2 files changed, 31 insertions, 12 deletions
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 <kakuto@fuk.kindai.ac.jp>
+
+ * knj.c: Update fsyscp_popen().
+
2014-08-22 TANAKA Takuji <KXD02663@nifty.ne.jp>
* 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
*/