From ce9c63b32b9e31b3902de2987c81732540b89a1e Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 6 Feb 2006 16:41:49 +0000 Subject: Updates to Windows stuff from Markus Mauhart. --- ChangeLog | 13 +++++++++++- README.W32.template | 6 ++---- README.cvs | 22 ++++++-------------- config.h.W32.template | 6 +++--- job.c | 11 +++++----- w32/subproc/sub_proc.c | 54 ++++++++++++++++++++++++-------------------------- 6 files changed, 55 insertions(+), 57 deletions(-) diff --git a/ChangeLog b/ChangeLog index 80cb5cd..c1e05de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,17 @@ -W, don't overwrite it with the real mtime. Fixes Savannah bug #15341. + Updates from Markus Mauhart : + + * w32/subproc/sub_proc.c (process_begin): Remove no-op tests. + (process_signal, process_last_err, process_exit_code): Manage + invalid handle values. + (process_{outbuf,errbuf,outcnt,errcnt,pipes}): Unused and don't + manage invalid handles; remove them. + * job.c (start_job_command) [WINDOWS32]: Jump out on error. + * config.h.W32.template [WINDOWS32]: Set flags for Windows builds. + * README.cvs: Updates for building from CVS. + 2006-02-05 Paul D. Smith * file.c (enter_file): Keep track of the last double_colon entry, @@ -34,7 +45,7 @@ * README.cvs: Applied patch #4786 from Markus Mauhart . * make_msvc_net2003.vcproj [WINDOWS32]: New version from - Markus Mauhart . + J. Grant . * main.c: Update the copyright year in the version output. * prepare_w32.bat: Remove this file from the distribution. diff --git a/README.W32.template b/README.W32.template index 437ebcb..0cf2e40 100644 --- a/README.W32.template +++ b/README.W32.template @@ -13,12 +13,10 @@ people. It was originally made by Rob Tulloh. Do this first, regardless of the build method you choose: --------------------------------------------------------- - 0. If your sources come from CVS, read the Windows-specific section of - README.cvs. - 1. At the Windows command prompt run: - if not exist config.h copy config.h.W32 config.h + if not exist NMakefile copy NMakefile.template NMakefile + if not exist config.h copy config.h.W32 config.h Then edit config.h to your liking (especially the few shell-related defines near the end, or HAVE_CASE_INSENSITIVE_FS which corresponds diff --git a/README.cvs b/README.cvs index fe6c1ac..f351d17 100644 --- a/README.cvs +++ b/README.cvs @@ -96,23 +96,13 @@ That's it, you're done! Windows builds from CVS ----------------------- -IF you have managed to successfully perform the 1st two or three steps of -the general build procedure as explained above: +If you have a UNIX emulation like CYGWIN you can opt to run the general +build procedure above; it will work. Be sure to read +README.W32.template for information on options you might want to use +when running ./configure. - $ autoreconf [-i] -s - $ ./configure - [$ make update] - -THEN proceed with file README.W32. - -ELSE ignore the general build procedure, instead execute the following -command lines at a Windows command prompt: - - if not exist README.W32 copy README.W32.template README.W32 - if not exist config.h.W32 copy config.h.W32.template config.h.W32 - if not exist NMakefile copy NMakefile.template NMakefile - -Now proceed with file README.W32. +If you can't or don't want to do that, then rename the file +README.W32.template to README.W32 and follow those instructions. Appendix A - For The Brave diff --git a/config.h.W32.template b/config.h.W32.template index e0b4f6f..ce894ed 100644 --- a/config.h.W32.template +++ b/config.h.W32.template @@ -198,13 +198,13 @@ /*#define HAVE_STDINT_H 1*/ /* Define to 1 if you have the header file. */ -/* #define HAVE_STDLIB_H 1*/ +#define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strcasecmp' function. */ /* #undef HAVE_STRCASECMP */ /* Define to 1 if you have the `strchr' function. */ -/* #define HAVE_STRCHR 1 */ +#define HAVE_STRCHR 1 /* Define to 1 if you have the `strcoll' function and it is properly defined. */ @@ -308,7 +308,7 @@ #define PACKAGE "%PACKAGE%" /* Define to 1 if the C compiler supports function prototypes. */ -/*#define PROTOTYPES 1*/ +#define PROTOTYPES 1 /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void diff --git a/job.c b/job.c index 9fbe84e..1c75420 100644 --- a/job.c +++ b/job.c @@ -1382,11 +1382,12 @@ start_job_command (struct child *child) int i; unblock_sigs(); fprintf(stderr, - _("process_easy() failed to launch process (e=%ld)\n"), - process_last_err(hPID)); - for (i = 0; argv[i]; i++) - fprintf(stderr, "%s ", argv[i]); - fprintf(stderr, _("\nCounted %d args in failed launch\n"), i); + _("process_easy() failed to launch process (e=%ld)\n"), + process_last_err(hPID)); + for (i = 0; argv[i]; i++) + fprintf(stderr, "%s ", argv[i]); + fprintf(stderr, _("\nCounted %d args in failed launch\n"), i); + goto error; } } #endif /* WINDOWS32 */ diff --git a/w32/subproc/sub_proc.c b/w32/subproc/sub_proc.c index 6af33bc..a432c86 100644 --- a/w32/subproc/sub_proc.c +++ b/w32/subproc/sub_proc.c @@ -172,55 +172,59 @@ process_wait_for_any(void) } } -long -process_errno(HANDLE proc) -{ - return (((sub_process *)proc)->lerrno); -} - long process_signal(HANDLE proc) { - return (((sub_process *)proc)->signal); + if (proc == INVALID_HANDLE_VALUE) return 0; + return (((sub_process *)proc)->signal); } - long +long process_last_err(HANDLE proc) { + if (proc == INVALID_HANDLE_VALUE) return ERROR_INVALID_HANDLE; return (((sub_process *)proc)->last_err); } - long +long process_exit_code(HANDLE proc) { + if (proc == INVALID_HANDLE_VALUE) return EXIT_FAILURE; return (((sub_process *)proc)->exit_code); } - char * +/* +2006-02: +All the following functions are currently unused. +All of them would crash gmake if called with argument INVALID_HANDLE_VALUE. +Hence whoever wants to use one of this functions must invent and implement +a reasonable error handling for this function. + +char * process_outbuf(HANDLE proc) { return (((sub_process *)proc)->outp); } - char * +char * process_errbuf(HANDLE proc) { return (((sub_process *)proc)->errp); } - int +int process_outcnt(HANDLE proc) { return (((sub_process *)proc)->outcnt); } - int +int process_errcnt(HANDLE proc) { return (((sub_process *)proc)->errcnt); } - void +void process_pipes(HANDLE proc, int pipes[3]) { pipes[0] = ((sub_process *)proc)->sv_stdin[0]; @@ -228,7 +232,7 @@ process_pipes(HANDLE proc, int pipes[3]) pipes[2] = ((sub_process *)proc)->sv_stderr[0]; return; } - +*/ HANDLE process_init() @@ -379,7 +383,7 @@ find_file(char *exec_path, LPOFSTRUCT file_info) /* * Description: Create the child process to be helped * - * Returns: + * Returns: success <=> 0 * * Notes/Dependencies: */ @@ -546,18 +550,12 @@ process_begin( CloseHandle(procInfo.hThread); /* Close the halves of the pipes we don't need */ - if (pproc->sv_stdin) { - CloseHandle((HANDLE)pproc->sv_stdin[1]); - pproc->sv_stdin[1] = 0; - } - if (pproc->sv_stdout) { - CloseHandle((HANDLE)pproc->sv_stdout[1]); - pproc->sv_stdout[1] = 0; - } - if (pproc->sv_stderr) { - CloseHandle((HANDLE)pproc->sv_stderr[1]); - pproc->sv_stderr[1] = 0; - } + CloseHandle((HANDLE)pproc->sv_stdin[1]); + CloseHandle((HANDLE)pproc->sv_stdout[1]); + CloseHandle((HANDLE)pproc->sv_stderr[1]); + pproc->sv_stdin[1] = 0; + pproc->sv_stdout[1] = 0; + pproc->sv_stderr[1] = 0; free( command_line ); if (envblk) free(envblk); -- cgit v1.2.3