summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-03-01 14:35:34 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-03-01 14:35:34 +0000
commitd14a599c4c5df86c60ebb1ac9000416c1177f4cd (patch)
tree8c9fe97251b24afb4662edeb51bc76c97d552ef6
parent573fe9ca631fee2865f58133c28c7522d80d721b (diff)
Remove win32_system() for __MINGW__
originally introduced to work around bugs in system() from Win9x git-svn-id: svn://tug.org/texlive/trunk@21567 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/kpathsea/ChangeLog5
-rw-r--r--Build/source/texk/kpathsea/mingw32.c149
-rw-r--r--Build/source/texk/kpathsea/mingw32.h1
-rw-r--r--Build/source/texk/web2c/lib/ChangeLog5
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c6
5 files changed, 10 insertions, 156 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 92cbec41afd..2f1626d804e 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,5 +1,10 @@
2011-03-01 Peter Breitenlohner <peb@mppmu.mpg.de>
+ * mingw32.[ch]: Drop win32_system(); this was a workaround for a
+ bug in system() under Win9x.
+
+2011-03-01 Peter Breitenlohner <peb@mppmu.mpg.de>
+
* man/{kpsewhich,mktexlsr,mktexmf,mktexpk,mktextfm}.man: Drop
useless '.rb' macros.
* man/{kpseaccess,kpsereadlink,kpsestat}.man: The same.
diff --git a/Build/source/texk/kpathsea/mingw32.c b/Build/source/texk/kpathsea/mingw32.c
index d2c5838e510..01d3eda5e1f 100644
--- a/Build/source/texk/kpathsea/mingw32.c
+++ b/Build/source/texk/kpathsea/mingw32.c
@@ -859,153 +859,4 @@ build_cmdline(char ***cmd, char *input, char *output)
return line;
}
-/*
- It has been proven that system() fails to retrieve exit codes
- under Win9x. This is a workaround for this bug.
-*/
-
-int
-win32_system(const char *cmd, int async)
-{
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
- DWORD ret = 0;
- HANDLE hIn, hOut;
- SECURITY_ATTRIBUTES sa = { sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };
- int i;
-
- char *app_name, *new_cmd;
- char *red_input, *red_output, ***cmd_pipe;
-
- /* Reset errno ??? */
- errno = 0;
- hIn = INVALID_HANDLE_VALUE; /* compiler warning */
- hOut = INVALID_HANDLE_VALUE; /* compiler warning */
-
- /* Admittedly, the command interpreter will allways be found. */
- if (! cmd) {
- errno = 0;
-#ifdef _TRACE
- fprintf(stderr, "system: (null) command.\n");
-#endif
- return 1;
- }
-
- if (look_for_cmd(cmd, &app_name) == FALSE) {
- /* Failed to find the command or malformed cmd */
- errno = ENOEXEC;
-#ifdef _TRACE
- fprintf(stderr, "system: failed to find command.\n");
-#endif
- return -1;
- }
-
- new_cmd = xstrdup(cmd);
- cmd_pipe = parse_cmdline(new_cmd, &red_input, &red_output);
-
- for (i = 0; cmd_pipe[i]; i++) {
-
- /* free the cmd and build the current one */
- if (new_cmd) free(new_cmd);
-
- new_cmd = build_cmdline(&cmd_pipe[i], NULL, NULL);
-
- /* First time, use red_input if available */
- if (i == 0) {
- if (red_input) {
- hIn = CreateFile(red_input,
- GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &sa,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- if (hIn == INVALID_HANDLE_VALUE) {
-#ifdef _TRACE
- fprintf(stderr, "system: failed to open hIn (%s) with error %d.\n", red_input, GetLastError());
-#endif
- errno = EIO;
- return -1;
- }
- }
- else {
- hIn = GetStdHandle(STD_INPUT_HANDLE);
- }
- }
- /* Last time, use red_output if available */
- if (cmd_pipe[i+1] == NULL) {
- if (red_output) {
- hOut = CreateFile(red_output,
- GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &sa,
- OPEN_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- if (hOut == INVALID_HANDLE_VALUE) {
-#ifdef _TRACE
- fprintf(stderr, "system: failed to open hOut (%s) with error %d.\n", red_output, GetLastError());
-#endif
- errno = EIO;
- return -1;
- }
- }
- else {
- hOut = GetStdHandle(STD_OUTPUT_HANDLE);
- }
- }
-
- ZeroMemory( &si, sizeof(STARTUPINFO) );
- si.cb = sizeof(STARTUPINFO);
- si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
- si.wShowWindow = SW_SHOW;
- si.hStdInput = hIn;
- si.hStdOutput = hOut;
- si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
-
-#ifdef _TRACE
- fprintf(stderr, "Executing: %s\n", new_cmd);
-#endif
- if (CreateProcess(app_name,
- new_cmd,
- NULL,
- NULL,
- TRUE,
- 0,
- NULL,
- NULL,
- &si,
- &pi) == 0) {
- fprintf(stderr, "win32_system(%s) call failed (Error %d).\n", cmd, (int)GetLastError());
- return -1;
- }
-
- /* Only the process handle is needed */
- CloseHandle(pi.hThread);
-
- if (async == 0) {
- if (WaitForSingleObject(pi.hProcess, INFINITE) == WAIT_OBJECT_0) {
- if (GetExitCodeProcess(pi.hProcess, &ret) == 0) {
- fprintf(stderr, "Failed to retrieve exit code: %s (Error %d)\n", cmd, (int)GetLastError());
- ret = -1;
- }
- }
- else {
- fprintf(stderr, "Failed to wait for process termination: %s (Error %d)\n", cmd, (int)GetLastError());
- ret = -1;
- }
- }
-
- CloseHandle(pi.hProcess);
-
- if (red_input) CloseHandle(hIn);
- if (red_output) CloseHandle(hOut);
- }
-
- if (new_cmd) free(new_cmd);
- if (app_name) free(app_name);
-
- return ret;
-}
-
#endif /* __MINGW32__ */
diff --git a/Build/source/texk/kpathsea/mingw32.h b/Build/source/texk/kpathsea/mingw32.h
index 938c519ee0f..7bc15cc9c56 100644
--- a/Build/source/texk/kpathsea/mingw32.h
+++ b/Build/source/texk/kpathsea/mingw32.h
@@ -51,7 +51,6 @@ extern char *quote_args(char **);
#endif /* MAKE_KPSE_DLL */
extern KPSEDLL BOOL win32_get_long_filename (char *, char *, int);
-extern KPSEDLL int win32_system(const char *, int);
extern KPSEDLL void dostounix_filename (char *p);
#endif
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog
index ab7256a8aa4..ac160630070 100644
--- a/Build/source/texk/web2c/lib/ChangeLog
+++ b/Build/source/texk/web2c/lib/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-10 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (calledit): [__MINGW32__] Drop win32_system() and
+ use system() as for all other systems.
+
2010-06-10 Peter Breitenlohner <peb@mppmu.mpg.de>
Reorganize web2c headers.
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c
index 7bdcb17b9b8..78e5934aa79 100644
--- a/Build/source/texk/web2c/lib/texmfmp.c
+++ b/Build/source/texk/web2c/lib/texmfmp.c
@@ -2058,13 +2058,7 @@ calledit (packedASCIIcode *filename,
*temp = 0;
/* Execute the command. */
-#ifdef __MINGW32__
- /* Win32 reimplementation of the system() command
- provides opportunity to call it asynchronously */
- if (win32_system(command, true) != 0 )
-#else
if (system (command) != 0)
-#endif
fprintf (stderr, "! Trouble executing `%s'.\n", command);
/* Quit, since we found an error. */