diff options
author | Takuji Tanaka <KXD02663@nifty.ne.jp> | 2014-01-13 07:44:13 +0000 |
---|---|---|
committer | Takuji Tanaka <KXD02663@nifty.ne.jp> | 2014-01-13 07:44:13 +0000 |
commit | 671c56f896d842f33df4fb1d4289ccd9652c8544 (patch) | |
tree | b82a65a73aa0ddad362b7a1a8f0fff2c5cbd6f85 /Build/source/texk/kpathsea/knj.c | |
parent | f8c54bdc25d73289044df7559ede61c3a19c7b97 (diff) |
kpathsea [WIN32]: add a new function for _wpopen()
git-svn-id: svn://tug.org/texlive/trunk@32647 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea/knj.c')
-rw-r--r-- | Build/source/texk/kpathsea/knj.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Build/source/texk/kpathsea/knj.c b/Build/source/texk/kpathsea/knj.c index b6112ed6258..2f38500f005 100644 --- a/Build/source/texk/kpathsea/knj.c +++ b/Build/source/texk/kpathsea/knj.c @@ -163,6 +163,40 @@ fsyscp_fopen (const char *filename, const char *mode) return f; } +/* + popen by file system codepage +*/ +FILE * +fsyscp_popen (const char *command, const char *mode) +{ + FILE *f; + wchar_t *commandw, modew[4]; + int i; +#if defined (KPSE_COMPAT_API) + kpathsea kpse; +#endif + assert(command && mode); + + 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) + if (f != NULL) { + kpse = kpse_def; + if (KPATHSEA_DEBUG_P (KPSE_DEBUG_FOPEN)) { + DEBUGF_START (); + fprintf (stderr, "fsyscp_popen(%s [", command); + WriteConsoleW( GetStdHandle( STD_ERROR_HANDLE ), commandw, wcslen( commandw ), NULL, NULL ); + fprintf (stderr, "], %s) => 0x%lx\n", mode, (unsigned long) f); + DEBUGF_END (); + } + } +#endif + free(commandw); + + return f; +} + void get_command_line_args_utf8 (const_string enc, int *p_ac, char ***p_av) { |