diff --git a/build_w32.bat b/build_w32.bat
index 16aa9a44..9fbfb4bb 100755
--- a/build_w32.bat
+++ b/build_w32.bat
@@ -154,9 +154,11 @@ exit 1
:FoundMSVC
set OUTDIR=.\WinRel
+set LNKOUT=./WinRel
set "OPTS=/O2 /D NDEBUG"
set LINKOPTS=
if "%DEBUG%" == "Y" set OUTDIR=.\WinDebug
+if "%DEBUG%" == "Y" set LNKOUT=./WinDebug
if "%DEBUG%" == "Y" set "OPTS=/Zi /Od /D _DEBUG"
if "%DEBUG%" == "Y" set LINKOPTS=/DEBUG
if "%MAINT%" == "Y" set "OPTS=%OPTS% /D MAKE_MAINTAINER_MODE"
@@ -168,9 +170,11 @@ goto Build
:FindGcc
set OUTDIR=.\GccRel
+set LNKOUT=./GccRel
set OPTS=-O2
if "%DEBUG%" == "Y" set OPTS=-O0
if "%DEBUG%" == "Y" set OUTDIR=.\GccDebug
+if "%DEBUG%" == "Y" set LNKOUT=./GccDebug
if "%MAINT%" == "Y" set "OPTS=%OPTS% -DMAKE_MAINTAINER_MODE"
:: Show the compiler version that we found
echo.
@@ -204,43 +208,43 @@ copy lib\fnmatch.in.h %OUTDIR%\lib\fnmatch.h
if exist %OUTDIR%\link.sc del %OUTDIR%\link.sc
-call :Compile src\ar
-call :Compile src\arscan
-call :Compile src\commands
-call :Compile src\default
-call :Compile src\dir
-call :Compile src\expand
-call :Compile src\file
-call :Compile src\function
-call :Compile src\getopt
-call :Compile src\getopt1
-call :Compile src\guile GUILE
-call :Compile src\hash
-call :Compile src\implicit
-call :Compile src\job
-call :Compile src\load
-call :Compile src\loadapi
-call :Compile src\main GUILE
-call :Compile src\misc
-call :Compile src\output
-call :Compile src\read
-call :Compile src\remake
-call :Compile src\remote-stub
-call :Compile src\rule
-call :Compile src\signame
-call :Compile src\strcache
-call :Compile src\variable
-call :Compile src\version
-call :Compile src\vpath
-call :Compile src\w32\pathstuff
-call :Compile src\w32\w32os
-call :Compile src\w32\compat\posixfcn
-call :Compile src\w32\subproc\misc
-call :Compile src\w32\subproc\sub_proc
-call :Compile src\w32\subproc\w32err
-call :Compile lib\fnmatch
-call :Compile lib\glob
-call :Compile lib\getloadavg
+call :Compile src/ar
+call :Compile src/arscan
+call :Compile src/commands
+call :Compile src/default
+call :Compile src/dir
+call :Compile src/expand
+call :Compile src/file
+call :Compile src/function
+call :Compile src/getopt
+call :Compile src/getopt1
+call :Compile src/guile GUILE
+call :Compile src/hash
+call :Compile src/implicit
+call :Compile src/job
+call :Compile src/load
+call :Compile src/loadapi
+call :Compile src/main GUILE
+call :Compile src/misc
+call :Compile src/output
+call :Compile src/read
+call :Compile src/remake
+call :Compile src/remote-stub
+call :Compile src/rule
+call :Compile src/signame
+call :Compile src/strcache
+call :Compile src/variable
+call :Compile src/version
+call :Compile src/vpath
+call :Compile src/w32/pathstuff
+call :Compile src/w32/w32os
+call :Compile src/w32/compat/posixfcn
+call :Compile src/w32/subproc/misc
+call :Compile src/w32/subproc/sub_proc
+call :Compile src/w32/subproc/w32err
+call :Compile lib/fnmatch
+call :Compile lib/glob
+call :Compile lib/getloadavg
if not "%COMPILER%" == "gcc" call :Compile src\w32\compat\dirent
@@ -262,7 +266,7 @@ goto :EOF
::
:Compile
-echo %OUTDIR%\%1.%O% >>%OUTDIR%\link.sc
+echo %LNKOUT%/%1.%O% >>%OUTDIR%\link.sc
set EXTRAS=
if "%2" == "GUILE" set "EXTRAS=%GUILECFLAGS%"
if exist "%OUTDIR%\%1.%O%" del "%OUTDIR%\%1.%O%"
@@ -277,7 +281,7 @@ goto CompileDone
:GccCompile
:: GCC Compile
echo on
-%COMPILER% -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -DWINDOWS32 -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%\%1.%O% -c %1.c
+%COMPILER% -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -DWINDOWS32 -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c
@echo off
:CompileDone
@@ -285,13 +289,14 @@ if not exist "%OUTDIR%\%1.%O%" exit 1
goto :EOF
:Link
-echo Linking %OUTDIR%/%MAKE%.exe
+echo.
+echo Linking %LNKOUT%/%MAKE%.exe
if "%COMPILER%" == "gcc" goto GccLink
:: MSVC Link
echo %GUILELIBS% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib >>%OUTDIR%\link.sc
echo on
-link.exe /NOLOGO /SUBSYSTEM:console /PDB:%OUTDIR%\%MAKE%.pdb %LINKOPTS% /OUT:%OUTDIR%\%MAKE%.exe @%OUTDIR%\link.sc
+link.exe /NOLOGO /SUBSYSTEM:console /PDB:%LNKOUT%\%MAKE%.pdb %LINKOPTS% /OUT:%LNKOUT%\%MAKE%.exe @%LNKOUT%\link.sc
@echo off
goto :EOF
@@ -299,7 +304,7 @@ goto :EOF
:: GCC Link
echo on
echo %GUILELIBS% -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 >>%OUTDIR%\link.sc
-%COMPILER% -mthreads -gdwarf-2 -g3 %OPTS% -o %OUTDIR%\%MAKE%.exe @%OUTDIR%\link.sc -Wl,--out-implib=%OUTDIR%\libgnumake-1.dll.a
+%COMPILER% -mthreads -gdwarf-2 -g3 %OPTS% -o %LNKOUT%/%MAKE%.exe @%LNKOUT%/link.sc -Wl,--out-implib=%LNKOUT%/libgnumake-1.dll.a
@echo off
goto :EOF
@@ -390,6 +395,7 @@ set NOGUILE=
set O=
set OPTS=
set OUTDIR=
+set LNKOUT=
set PKGMSC=
set VSVARS=
goto :EOF
diff --git a/src/arscan.c b/src/arscan.c
index f9019464..fb626412 100644
--- a/src/arscan.c
+++ b/src/arscan.c
@@ -909,7 +909,7 @@ ar_member_touch (const char *arname, const char *memname)
for (ui = 0; ui < sizeof ar_hdr.ar_date; ui++)
ar_hdr.ar_date[ui] = ' ';
sprintf (TOCHAR (ar_hdr.ar_date), "%lu", (long unsigned) statbuf.st_mtime);
- ar_hdr.ar_date[strlen (ar_hdr.ar_date)] = ' ';
+ ar_hdr.ar_date[strlen ((char *) ar_hdr.ar_date)] = ' ';
#else
ar_hdr.ar_date = statbuf.st_mtime;
#endif
diff --git a/src/config.h.W32.template b/src/config.h.W32.template
index b6463b20..d69e6b73 100644
--- a/src/config.h.W32.template
+++ b/src/config.h.W32.template
@@ -298,6 +298,11 @@ this program. If not, see . */
#define HAVE_TTYNAME 1
char *ttyname (int);
+/* Define to 1 if you have the `umask' function. */
+#ifdef __MINGW32__
+# define HAVE_UMASK 1
+#endif
+
/* Define to 1 if 'n_un.n_name' is a member of 'struct nlist'. */
/* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */
@@ -470,6 +475,11 @@ char *ttyname (int);
/* Define to empty if 'const' does not conform to ANSI C. */
/* #undef const */
+#ifdef __MINGW32__
+# undef __USE_MINGW_ANSI_STDIO
+# define __USE_MINGW_ANSI_STDIO 1
+#endif
+
#include
/* Define to 'int' if doesn't define. */
diff --git a/src/job.c b/src/job.c
index e0b21c13..f4f2113f 100644
--- a/src/job.c
+++ b/src/job.c
@@ -724,7 +724,9 @@ reap_children (int block, int err)
else if (pid < 0)
{
/* A remote status command failed miserably. Punt. */
+#if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32)
remote_status_lose:
+#endif
pfatal_with_name ("remote_status");
}
else
diff --git a/src/makeint.h b/src/makeint.h
index 3b0f1f19..d13c3135 100644
--- a/src/makeint.h
+++ b/src/makeint.h
@@ -292,12 +292,8 @@ char *strerror (int errnum);
char *strsignal (int signum);
#endif
-#if defined(HAVE_UMASK)
-# define UMASK(_m) umask (_m)
-# define MODE_T mode_t
-#else
-# define UMASK(_m) 0
-# define MODE_T int
+#if !defined(HAVE_UMASK)
+extern mode_t umask (mode_t);
#endif
/* ISDIGIT offers the following features:
diff --git a/src/misc.c b/src/misc.c
index a0f88980..567c86f9 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -437,6 +437,14 @@ char *mktemp (char *template);
# endif
#endif
+#ifndef HAVE_UMASK
+mode_t
+umask (mode_t mask)
+{
+ return 0;
+}
+#endif
+
FILE *
get_tmpfile (char **name, const char *template)
{
@@ -446,7 +454,7 @@ get_tmpfile (char **name, const char *template)
#endif
/* Preserve the current umask, and set a restrictive one for temp files. */
- MODE_T mask = UMASK (0077);
+ mode_t mask = umask (0077);
#if defined(HAVE_MKSTEMP) || defined(HAVE_MKTEMP)
# define TEMPLATE_LEN strlen (template)
@@ -482,7 +490,7 @@ get_tmpfile (char **name, const char *template)
# endif
#endif
- UMASK (mask);
+ umask (mask);
return file;
}
diff --git a/src/output.c b/src/output.c
index 6178c724..ccb44143 100644
--- a/src/output.c
+++ b/src/output.c
@@ -281,7 +281,7 @@ release_semaphore (void *sem)
int
output_tmpfd (void)
{
- MODE_T mask = UMASK (0077);
+ mode_t mask = umask (0077);
int fd = -1;
FILE *tfile = tmpfile ();
@@ -297,7 +297,7 @@ output_tmpfd (void)
set_append_mode (fd);
- UMASK (mask);
+ umask (mask);
return fd;
}
diff --git a/src/w32/subproc/sub_proc.c b/src/w32/subproc/sub_proc.c
index 58064650..f502cda2 100644
--- a/src/w32/subproc/sub_proc.c
+++ b/src/w32/subproc/sub_proc.c
@@ -108,7 +108,7 @@ DWORD process_wait_for_multiple_objects(
continue;
break;
case WAIT_FAILED:
- fprintf(stderr,"WaitForMultipleOjbects failed waiting with error %d\n", GetLastError());
+ fprintf(stderr,"WaitForMultipleOjbects failed waiting with error %lu\n", GetLastError());
break;
default:
if (retVal >= WAIT_ABANDONED_0) {