diff options
author | Paul Smith <psmith@gnu.org> | 2005-08-08 05:08:00 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2005-08-08 05:08:00 +0000 |
commit | b237dff7753f444c4e0e8ea6bb1929243e45b310 (patch) | |
tree | 8ccb5752696b899aee3a1b7cce24936d698a835c /w32 | |
parent | a53903e4c32f47ce3e20edd9114f4fabd028d13c (diff) | |
download | gunmake-b237dff7753f444c4e0e8ea6bb1929243e45b310.tar.gz |
- Fixed a bug reported by Michael Matz regarding handling of parallel
jobs after a failed job.
- Enhancements to WINDOWS32 code from Eli Zaretskii.
- Add Microsoft Project files from J. Grant.
Diffstat (limited to 'w32')
-rw-r--r-- | w32/pathstuff.c | 4 | ||||
-rw-r--r-- | w32/subproc/build.bat | 7 | ||||
-rw-r--r-- | w32/subproc/sub_proc.c | 26 |
3 files changed, 29 insertions, 8 deletions
diff --git a/w32/pathstuff.c b/w32/pathstuff.c index d8f3845..2ccb26d 100644 --- a/w32/pathstuff.c +++ b/w32/pathstuff.c @@ -86,9 +86,9 @@ w32ify(char *filename, int resolve) char * getcwd_fs(char* buf, int len) { - char *p; + char *p = getcwd(buf, len); - if (p = getcwd(buf, len)) { + if (p) { char *q = w32ify(buf, 0); strncpy(buf, q, len); } diff --git a/w32/subproc/build.bat b/w32/subproc/build.bat index b68fc31..b057b3c 100644 --- a/w32/subproc/build.bat +++ b/w32/subproc/build.bat @@ -1,3 +1,4 @@ +@if "%1" == "gcc" GoTo GCCBuild
if not exist .\WinDebug\nul mkdir .\WinDebug
cl.exe /nologo /MT /W4 /GX /Z7 /YX /Od /I .. /I . /I ../include /D WIN32 /D WINDOWS32 /D _DEBUG /D _WINDOWS /FR.\WinDebug/ /Fp.\WinDebug/subproc.pch /Fo.\WinDebug/ /c misc.c
cl.exe /nologo /MT /W4 /GX /Z7 /YX /Od /I .. /I . /I ../include /I ../.. /D WIN32 /D WINDOWS32 /D _DEBUG /D _WINDOWS /FR.\WinDebug/ /Fp.\WinDebug/subproc.pch /Fo.\WinDebug/ /c sub_proc.c
@@ -8,3 +9,9 @@ cl.exe /nologo /MT /W4 /GX /YX /O2 /I ../include /D WIN32 /D WINDOWS32 /D NDEBUG cl.exe /nologo /MT /W4 /GX /YX /O2 /I ../include /I ../.. /D WIN32 /D WINDOWS32 /D NDEBUG /D _WINDOWS /FR.\WinRel/ /Fp.\WinRel/subproc.pch /Fo.\WinRel/ /c sub_proc.c
cl.exe /nologo /MT /W4 /GX /YX /O2 /I ../include /D WIN32 /D WINDOWS32 /D NDEBUG /D _WINDOWS /FR.\WinRel/ /Fp.\WinRel/subproc.pch /Fo.\WinRel/ /c w32err.c
lib.exe /NOLOGO /OUT:.\WinRel\subproc.lib .\WinRel/misc.obj .\WinRel/sub_proc.obj .\WinRel/w32err.obj
+GoTo BuildEnd
+:GCCBuild
+gcc -mthreads -Wall -gstabs+ -ggdb3 -O2 -I.. -I. -I../include -I../.. -DWINDOWS32 -c misc.c -o ../../w32_misc.o
+gcc -mthreads -Wall -gstabs+ -ggdb3 -O2 -I.. -I. -I../include -I../.. -DWINDOWS32 -c sub_proc.c -o ../../sub_proc.o
+gcc -mthreads -Wall -gstabs+ -ggdb3 -O2 -I.. -I. -I../include -I../.. -DWINDOWS32 -c w32err.c -o ../../w32err.o
+:BuildEnd
diff --git a/w32/subproc/sub_proc.c b/w32/subproc/sub_proc.c index 6e36e37..ae1a354 100644 --- a/w32/subproc/sub_proc.c +++ b/w32/subproc/sub_proc.c @@ -1,6 +1,7 @@ #include <stdlib.h> #include <stdio.h> #include <process.h> /* for msvc _beginthreadex, _endthreadex */ +#include <signal.h> #include <windows.h> #include "sub_proc.h" @@ -522,7 +523,8 @@ process_begin( pproc->last_err = GetLastError(); pproc->lerrno = E_FORK; - fprintf(stderr, "process_begin: CreateProcess(%s, %s, ...) failed.\n", exec_path, command_line); + fprintf(stderr, "process_begin: CreateProcess(%s, %s, ...) failed.\n", + exec_path ? exec_path : "NULL", command_line); if (envblk) free(envblk); free( command_line ); return(-1); @@ -762,7 +764,13 @@ process_pipe_io( } else if (ready_hand == childhand) { - GetExitCodeResult = GetExitCodeProcess(childhand, (DWORD*)&pproc->exit_code); + DWORD ierr; + GetExitCodeResult = GetExitCodeProcess(childhand, &ierr); + if (ierr == CONTROL_C_EXIT) { + pproc->signal = SIGINT; + } else { + pproc->exit_code = ierr; + } if (GetExitCodeResult == FALSE) { pproc->last_err = GetLastError(); pproc->lerrno = E_SCALL; @@ -811,6 +819,7 @@ process_file_io( HANDLE childhand; DWORD wait_return; BOOL GetExitCodeResult; + DWORD ierr; if (proc == NULL) pproc = process_wait_for_any_private(); @@ -854,7 +863,12 @@ process_file_io( goto done2; } - GetExitCodeResult = GetExitCodeProcess(childhand, (DWORD*)&pproc->exit_code); + GetExitCodeResult = GetExitCodeProcess(childhand, &ierr); + if (ierr == CONTROL_C_EXIT) { + pproc->signal = SIGINT; + } else { + pproc->exit_code = ierr; + } if (GetExitCodeResult == FALSE) { pproc->last_err = GetLastError(); pproc->lerrno = E_SCALL; @@ -1163,7 +1177,7 @@ process_easy( TRUE, DUPLICATE_SAME_ACCESS) == FALSE) { fprintf(stderr, - "process_easy: DuplicateHandle(In) failed (e=%d)\n", + "process_easy: DuplicateHandle(In) failed (e=%ld)\n", GetLastError()); return INVALID_HANDLE_VALUE; } @@ -1175,7 +1189,7 @@ process_easy( TRUE, DUPLICATE_SAME_ACCESS) == FALSE) { fprintf(stderr, - "process_easy: DuplicateHandle(Out) failed (e=%d)\n", + "process_easy: DuplicateHandle(Out) failed (e=%ld)\n", GetLastError()); return INVALID_HANDLE_VALUE; } @@ -1187,7 +1201,7 @@ process_easy( TRUE, DUPLICATE_SAME_ACCESS) == FALSE) { fprintf(stderr, - "process_easy: DuplicateHandle(Err) failed (e=%d)\n", + "process_easy: DuplicateHandle(Err) failed (e=%ld)\n", GetLastError()); return INVALID_HANDLE_VALUE; } |