summaryrefslogtreecommitdiff
path: root/w32
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1997-08-27 20:30:54 +0000
committerPaul Smith <psmith@gnu.org>1997-08-27 20:30:54 +0000
commit8631838ac02b6c20d1628ebe026cfb7d5a1d7fe1 (patch)
treef27c2e1c6f3e1f7cc747cad0452734c4c917b208 /w32
parent78037718635d4055341217e9c4d0291b33604314 (diff)
downloadmake-8631838ac02b6c20d1628ebe026cfb7d5a1d7fe1.tar.gz
Updates for GNU make 3.75.92.
Diffstat (limited to 'w32')
-rw-r--r--w32/compat/dirent.c2
-rw-r--r--w32/include/sub_proc.h7
-rw-r--r--w32/subproc/NMakefile4
-rw-r--r--w32/subproc/build.bat12
-rw-r--r--w32/subproc/sub_proc.c65
5 files changed, 57 insertions, 33 deletions
diff --git a/w32/compat/dirent.c b/w32/compat/dirent.c
index 94168284..db871a90 100644
--- a/w32/compat/dirent.c
+++ b/w32/compat/dirent.c
@@ -90,7 +90,7 @@ closedir(DIR *pDir)
struct dirent *
readdir(DIR* pDir)
{
- WINDOWS32_FIND_DATA wfdFindData;
+ WIN32_FIND_DATA wfdFindData;
if (!pDir) {
errno = EINVAL;
diff --git a/w32/include/sub_proc.h b/w32/include/sub_proc.h
index 700b945c..d7478bb1 100644
--- a/w32/include/sub_proc.h
+++ b/w32/include/sub_proc.h
@@ -9,13 +9,6 @@
* $Source$
*
* $Revision$
- *
- * Description:
- *
- * (C) COPYRIGHT TIVOLI Systems, Inc. 1991-1994
- * Unpublished Work
- * All Rights Reserved
- * Licensed Material - Property of TIVOLI Systems, Inc.
*/
/* $Id$ */
diff --git a/w32/subproc/NMakefile b/w32/subproc/NMakefile
index 2843a828..ab11d964 100644
--- a/w32/subproc/NMakefile
+++ b/w32/subproc/NMakefile
@@ -1,7 +1,7 @@
# NOTE: If you have no `make' program at all to process this makefile, run
# `build.bat' instead.
#
-# Copyright (C) 1988, 89, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc
+# Copyright (C) 1988,89,91,92,93,94,95,96,97 Free Software Foundation, Inc
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify
@@ -27,7 +27,7 @@ CC = cl
OUTDIR=.
MAKEFILE=NMakefile
-CFLAGS_any = /nologo /MT /W3 /GX /Z7 /YX /D WINDOWS32 /D _WINDOWS -I. -I../include
+CFLAGS_any = /nologo /MT /W3 /GX /Z7 /YX /D WIN32 /D WINDOWS32 /D _WINDOWS -I. -I../include
CFLAGS_debug = $(CFLAGS_any) /Od /D _DEBUG /FR.\WinDebug\ /Fp.\WinDebug\subproc.pch /Fo.\WinDebug/
CFLAGS_release = $(CFLAGS_any) /O2 /FR.\WinRel\ /Fp.\WinRel\subproc.pch /Fo.\WinRel/
diff --git a/w32/subproc/build.bat b/w32/subproc/build.bat
index 3c53a435..955f6d5d 100644
--- a/w32/subproc/build.bat
+++ b/w32/subproc/build.bat
@@ -1,10 +1,10 @@
if not exist .\WinDebug\nul mkdir .\WinDebug
-cl.exe /nologo /MT /W3 /GX /Z7 /YX /Od /I .. /I . /I ../include /D WINDOWS32 /D _DEBUG /D _WINDOWS /FR.\WinDebug/ /Fp.\WinDebug/subproc.pch /Fo.\WinDebug/ /c misc.c
-cl.exe /nologo /MT /W3 /GX /Z7 /YX /Od /I .. /I . /I ../include /D WINDOWS32 /D _DEBUG /D _WINDOWS /FR.\WinDebug/ /Fp.\WinDebug/subproc.pch /Fo.\WinDebug/ /c sub_proc.c
-cl.exe /nologo /MT /W3 /GX /Z7 /YX /Od /I .. /I . /I ../include /D WINDOWS32 /D _DEBUG /D _WINDOWS /FR.\WinDebug/ /Fp.\WinDebug/subproc.pch /Fo.\WinDebug/ /c w32err.c
+cl.exe /nologo /MT /W3 /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 /W3 /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 sub_proc.c
+cl.exe /nologo /MT /W3 /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 w32err.c
lib.exe /NOLOGO /OUT:.\WinDebug\subproc.lib .\WinDebug/misc.obj .\WinDebug/sub_proc.obj .\WinDebug/w32err.obj
if not exist .\WinRel\nul mkdir .\WinRel
-cl.exe /nologo /MT /W3 /GX /YX /O2 /I ../include /D WINDOWS32 /D NDEBUG /D _WINDOWS /FR.\WinRel/ /Fp.\WinRel/subproc.pch /Fo.\WinRel/ /c misc.c
-cl.exe /nologo /MT /W3 /GX /YX /O2 /I ../include /D WINDOWS32 /D NDEBUG /D _WINDOWS /FR.\WinRel/ /Fp.\WinRel/subproc.pch /Fo.\WinRel/ /c sub_proc.c
-cl.exe /nologo /MT /W3 /GX /YX /O2 /I ../include /D WINDOWS32 /D NDEBUG /D _WINDOWS /FR.\WinRel/ /Fp.\WinRel/subproc.pch /Fo.\WinRel/ /c w32err.c
+cl.exe /nologo /MT /W3 /GX /YX /O2 /I ../include /D WIN32 /D WINDOWS32 /D NDEBUG /D _WINDOWS /FR.\WinRel/ /Fp.\WinRel/subproc.pch /Fo.\WinRel/ /c misc.c
+cl.exe /nologo /MT /W3 /GX /YX /O2 /I ../include /D WIN32 /D WINDOWS32 /D NDEBUG /D _WINDOWS /FR.\WinRel/ /Fp.\WinRel/subproc.pch /Fo.\WinRel/ /c sub_proc.c
+cl.exe /nologo /MT /W3 /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
diff --git a/w32/subproc/sub_proc.c b/w32/subproc/sub_proc.c
index 55aafec9..4166d340 100644
--- a/w32/subproc/sub_proc.c
+++ b/w32/subproc/sub_proc.c
@@ -319,14 +319,10 @@ find_file(char *exec_path, LPOFSTRUCT file_info)
char *fname;
char *ext;
- if ((exec_handle = (HANDLE)OpenFile(exec_path, file_info,
- OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) {
- return(exec_handle);
- }
-
fname = malloc(strlen(exec_path) + 5);
strcpy(fname, exec_path);
ext = fname + strlen(fname);
+
strcpy(ext, ".exe");
if ((exec_handle = (HANDLE)OpenFile(fname, file_info,
OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) {
@@ -334,6 +330,13 @@ find_file(char *exec_path, LPOFSTRUCT file_info)
return(exec_handle);
}
+ strcpy(ext, ".cmd");
+ if ((exec_handle = (HANDLE)OpenFile(fname, file_info,
+ OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) {
+ free(fname);
+ return(exec_handle);
+ }
+
strcpy(ext, ".bat");
if ((exec_handle = (HANDLE)OpenFile(fname, file_info,
OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) {
@@ -341,6 +344,13 @@ find_file(char *exec_path, LPOFSTRUCT file_info)
return(exec_handle);
}
+ /* should .com come before this case? */
+ if ((exec_handle = (HANDLE)OpenFile(exec_path, file_info,
+ OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) {
+ free(fname);
+ return(exec_handle);
+ }
+
strcpy(ext, ".com");
if ((exec_handle = (HANDLE)OpenFile(fname, file_info,
OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) {
@@ -489,14 +499,8 @@ process_begin(
startInfo.hStdOutput = (HANDLE)pproc->sv_stdout[1];
startInfo.hStdError = (HANDLE)pproc->sv_stderr[1];
- /*
- * See if we need to setuid to a different user.
- */
- if (as_user) {
- return -1;
- }
-
if (as_user) {
+ if (envblk) free(envblk);
return -1;
} else {
if (CreateProcess(
@@ -514,6 +518,7 @@ process_begin(
pproc->last_err = GetLastError();
pproc->lerrno = E_FORK;
fprintf(stderr, "process_begin: CreateProcess(%s, %s, ...) failed.\n", exec_path, command_line);
+ if (envblk) free(envblk);
free( command_line );
return(-1);
}
@@ -538,6 +543,7 @@ process_begin(
}
free( command_line );
+ if (envblk) free(envblk);
pproc->lerrno=0;
return 0;
}
@@ -1003,14 +1009,35 @@ make_command_line( char *shell_name, char *exec_path, char **argv)
char** nargv;
char* buf;
int i;
+ char** shargv = NULL;
+ char* p = NULL;
+ char* q = NULL;
+ int j = 0;
if (shell_name) {
+ /* handle things like: #!/bin/sh -x */
+
+ /* count tokens */
+ q = strdup(shell_name);
+ for (j = 0, p = q; (p = strtok(p, " \t")) != NULL; p = NULL, j++);
+ free(q);
+
+ /* copy tokens */
+ q = strdup(shell_name);
+ shargv = (char **) malloc((j+1) * sizeof (char *));
+ for (j = 0, p = q; (p = strtok(p, " \t")) != NULL; p = NULL, j++)
+ shargv[j] = strdup(p);
+ shargv[j] = NULL;
+ free(q);
+
+ /* create argv */
for (i = 0; argv[i]; i++);
- i += 2;
+ i += (j+1);
nargv = (char **) malloc(i * sizeof (char *));
- nargv[0] = shell_name;
- for (i = 1; argv[i-1]; i++)
- nargv[i] = argv[i-1];
+ for (i = 0; shargv[i] != NULL; i++)
+ nargv[i] = shargv[i];
+ for (j = 0; argv[j]; j++, i++)
+ nargv[i] = argv[j];
nargv[i] = NULL;
} else
nargv = argv;
@@ -1018,8 +1045,12 @@ make_command_line( char *shell_name, char *exec_path, char **argv)
/* create string suitable for CreateProcess() */
buf = fix_command_line(nargv);
- if (shell_name)
+ if (shell_name) {
+ for (j = 0; shargv[j]; j++)
+ free(shargv[j]);
+ free(shargv);
free(nargv);
+ }
return buf;
}