From aac838b32b9a31ad04489094ac552712a1139ae7 Mon Sep 17 00:00:00 2001 From: bulk88 Date: Tue, 10 Mar 2015 02:45:10 -0400 Subject: [PATCH 01/15] silence CC warnings on >= VC 2005 unix/dcache: - make extern.h be first for Win32 warnings disable unix/runargv.c: - extern.h includes signal.h, specifying signal.h before extern.h causes the Win32 specific defines which disable warnings to be skipped, the reason for signal.h before extern.h is before git history and is therefore unknown win95/switchar.c: - all 3 includes are in extern.h --- extern.h | 13 +++++++++++++ unix/dcache.c | 2 +- unix/runargv.c | 2 -- win95/switchar.c | 4 +--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/extern.h b/extern.h index ff0f6af..1e0b2ce 100644 --- a/extern.h +++ b/extern.h @@ -30,6 +30,19 @@ /* For MSVC++ needs to include windows.h first to avoid problems with * type redefinitions. Include it also for MinGW for consistency. */ #if defined(__MINGW32__) || defined(_MSC_VER) +/* silence warnings about using null term strings in >= VC 2005 +sysintf.c(918) : warning C4996: 'strcat' was declared deprecated + Message: 'This function or variable may be unsafe. Consider using strcat +_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online hel +p for details.' */ +#define _CRT_SECURE_NO_DEPRECATE +/* silence warnings about using POSIX name funcs in >= VC 2005 +sysintf.c(1132) : warning C4996: 'unlink' was declared deprecated + C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\stdio.h(290) : see + declaration of 'unlink' + Message: 'The POSIX name for this item is deprecated. Instead, use the I +SO C++ conformant name: _unlink. See online help for details.' */ +#define _CRT_NONSTDC_NO_DEPRECATE #define WIN32_LEAN_AND_MEAN #include #endif diff --git a/unix/dcache.c b/unix/dcache.c index c538567..518d4e8 100644 --- a/unix/dcache.c +++ b/unix/dcache.c @@ -35,11 +35,11 @@ #undef __WIN32__ #endif +#include "extern.h" #ifdef __APPLE__ #include #endif #include -#include "extern.h" #include diff --git a/unix/runargv.c b/unix/runargv.c index b181ae1..c83dbc1 100644 --- a/unix/runargv.c +++ b/unix/runargv.c @@ -106,8 +106,6 @@ _finished_child(pid, status) [unix/runargv] handles the finished child. If with runargv(). */ -#include - #include "extern.h" #ifdef HAVE_WAIT_H diff --git a/win95/switchar.c b/win95/switchar.c index 6daae26..bc63f0e 100644 --- a/win95/switchar.c +++ b/win95/switchar.c @@ -23,9 +23,7 @@ -- Use cvs log to obtain detailed change logs. */ -#include -#include -#include "stdmacs.h" +#include "extern.h" getswitchar()/* =============== From 7bafaff456feeb8de0aa9c98aaa9784b8cbf2b1e Mon Sep 17 00:00:00 2001 From: bulk88 Date: Tue, 10 Mar 2015 04:38:27 -0400 Subject: [PATCH 02/15] disable stdio locking for Win32, dmake is single threaded In MS and Mingw's headers, there is no define from fputc to _fputc_nolock. This has to be done manually. mingw 4.6.3 has _fputc_nolock in its headers so use it. --- extern.h | 4 ++++ win95/microsft/sysintf.h | 4 ++++ winnt/microsft/sysintf.h | 4 ++++ winnt/mingw/sysintf.h | 2 ++ winnt/msvc6/sysintf.h | 4 ++++ 5 files changed, 18 insertions(+) diff --git a/extern.h b/extern.h index 1e0b2ce..8fa21e5 100644 --- a/extern.h +++ b/extern.h @@ -43,6 +43,10 @@ sysintf.c(1132) : warning C4996: 'unlink' was declared deprecated Message: 'The POSIX name for this item is deprecated. Instead, use the I SO C++ conformant name: _unlink. See online help for details.' */ #define _CRT_NONSTDC_NO_DEPRECATE +/* get back some of the perf loss caused by >= VC 2005 dropping single threaded + static link CRT, this macro disables multithreading locks on some stdio + functions */ +#define _CRT_DISABLE_PERFCRIT_LOCKS #define WIN32_LEAN_AND_MEAN #include #endif diff --git a/win95/microsft/sysintf.h b/win95/microsft/sysintf.h index f12cc25..0299732 100644 --- a/win95/microsft/sysintf.h +++ b/win95/microsft/sysintf.h @@ -61,3 +61,7 @@ extern char * getcwd(); #undef _POSIX_PATH_MAX #endif #define _POSIX_PATH_MAX _MAX_PATH + +#if _MSC_VER >= 1400 +# define fputc(_c,_stream) _fputc_nolock(_c,_stream) +#endif diff --git a/winnt/microsft/sysintf.h b/winnt/microsft/sysintf.h index 07e9d7f..2f5a5a5 100644 --- a/winnt/microsft/sysintf.h +++ b/winnt/microsft/sysintf.h @@ -47,3 +47,7 @@ extern char * getcwd(); #undef _POSIX_PATH_MAX #endif #define _POSIX_PATH_MAX _MAX_PATH + +#if _MSC_VER >= 1400 +# define fputc(_c,_stream) _fputc_nolock(_c,_stream) +#endif diff --git a/winnt/mingw/sysintf.h b/winnt/mingw/sysintf.h index bbb6ef0..4ee4f10 100644 --- a/winnt/mingw/sysintf.h +++ b/winnt/mingw/sysintf.h @@ -52,3 +52,5 @@ extern char * getcwd(); #undef _POSIX_PATH_MAX #endif #define _POSIX_PATH_MAX _MAX_PATH + +#define fputc(_c,_stream) _fputc_nolock(_c,_stream) diff --git a/winnt/msvc6/sysintf.h b/winnt/msvc6/sysintf.h index a41fa6f..b5225a4 100644 --- a/winnt/msvc6/sysintf.h +++ b/winnt/msvc6/sysintf.h @@ -52,3 +52,7 @@ extern char * getcwd(); #undef _POSIX_PATH_MAX #endif #define _POSIX_PATH_MAX _MAX_PATH + +#if _MSC_VER >= 1400 +# define fputc(_c,_stream) _fputc_nolock(_c,_stream) +#endif From f74e6d3805aab338edf922247760d82d040d728c Mon Sep 17 00:00:00 2001 From: bulk88 Date: Tue, 10 Mar 2015 15:47:47 -0400 Subject: [PATCH 03/15] VC6 improvements VC6 doesn't understand ULL suffix (only UI64), >= VC 2003 understand ULL, to make things simple, just drop the suffix. This was a syntax error on VC6. Previously a VC6 build was built with -Od, this is inefficient, and not needed since the vast majority of dmake users will never C debug it. make mk.bat similar to mk70.bat. I dont think anyone wants the COFF and CV symbol formats, they bloat dmake.exe by 10s of KBs. My VC 2003 C debugger understood the VC 6 PDB without a problem but not the legacy symbol formats. 64 bit seems to work, no fixes or anything special needs to be done, just use the right vcvars*.bat file to select the right cl.exe --- extern.h | 2 +- make.bat | 10 +++-- win95/microsft/vpp40/mk.bat | 84 +++++++++++++++++++++-------------- win95/microsft/vpp40/mk70.bat | 3 +- 4 files changed, 60 insertions(+), 39 deletions(-) diff --git a/extern.h b/extern.h index 8fa21e5..abe3e23 100644 --- a/extern.h +++ b/extern.h @@ -186,7 +186,7 @@ char *cygdospath(char *src, int winpath); #endif #ifdef _WIN32 -# define FileTimeTo_time_t(ft) ((time_t)((*((unsigned __int64 *)ft) - 116444736000000000ULL)/10000000ULL)) +# define FileTimeTo_time_t(ft) ((time_t)((*((unsigned __int64 *)ft) - 116444736000000000)/10000000)) #endif /* Get the working directory fall back code */ diff --git a/make.bat b/make.bat index 1bcc125..ba6c082 100755 --- a/make.bat +++ b/make.bat @@ -41,10 +41,12 @@ echo msc60 - Microsoft C 6.0 compile. echo msc60swp - Microsoft C 6.0, MASM 5.1 compile of swapping dmake. echo win95-bcc50 - Borland C++ 5.0 32-bit compile of dmake. -echo win95-vpp40 - Microsoft VC++ 4.0 32-bit compile of dmake. -echo win95-vpp70 - MS VC++ ^>= 2003 optimized -echo win95-vpp70 rel - MS VC++ ^>= 2003 optimized -echo win95-vpp70 dbg - MS VC++ ^>= 2003 unoptimized for debugging +echo win95-vpp40 - Microsoft VC++ 4.0-6.0 optimized +echo win95-vpp40 rel - Microsoft VC++ 4.0-6.0 optimized +echo win95-vpp40 dbg - Microsoft VC++ 4.0-6.0 unoptimized for debugging +echo win95-vpp70 - MS VC++ ^>= 2003 32 or 64 bit optimized +echo win95-vpp70 rel - MS VC++ ^>= 2003 32 or 64 bit optimized +echo win95-vpp70 dbg - MS VC++ ^>= 2003 32 or 64 bit unoptimized 4 debugging goto end rem This is the script that makes dmake using Microsoft C 5.1 diff --git a/win95/microsft/vpp40/mk.bat b/win95/microsft/vpp40/mk.bat index c00777c..3cec0a3 100755 --- a/win95/microsft/vpp40/mk.bat +++ b/win95/microsft/vpp40/mk.bat @@ -1,42 +1,60 @@ -if not "%1" == "" goto link +if not defined cc set "cc=cl" +if not defined ld set "ld=link" + +if "%1" == "" goto optimized +if "%1" == "rel" goto optimized + +set "c_opt=-Od -Gy -GF" +set "ld_opt=" +goto build + +:optimized +set "c_opt=-O2" +set "ld_opt=" + +:build if exist objects rd /S /Q objects if exist config.h del config.h if exist dmake.exe del dmake.exe +if exist dmake.pdb del dmake.pdb md objects -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\infer.obj infer.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\make.obj make.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\stat.obj stat.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\expand.obj expand.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\dmstring.obj dmstring.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\hash.obj hash.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\dag.obj dag.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\dcache.obj unix\dcache.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\dmake.obj dmake.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\path.obj path.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\imacs.obj imacs.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\sysintf.obj sysintf.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\parse.obj parse.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\getinp.obj getinp.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\quit.obj quit.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\state.obj state.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\dmdump.obj dmdump.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\macparse.obj macparse.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\rulparse.obj rulparse.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\percent.obj percent.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\function.obj function.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\switchar.obj win95\switchar.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\dstrlwr.obj msdos\dstrlwr.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\arlib.obj msdos\arlib.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\dirbrk.obj msdos\dirbrk.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\infer.obj infer.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\make.obj make.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\stat.obj stat.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\expand.obj expand.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\dmstring.obj dmstring.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\hash.obj hash.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\dag.obj dag.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\dcache.obj unix\dcache.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\dmake.obj dmake.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\path.obj path.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\imacs.obj imacs.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\sysintf.obj sysintf.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\parse.obj parse.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\getinp.obj getinp.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\quit.obj quit.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\state.obj state.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\dmdump.obj dmdump.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\macparse.obj macparse.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\rulparse.obj rulparse.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\percent.obj percent.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\function.obj function.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\switchar.obj win95\switchar.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\dstrlwr.obj msdos\dstrlwr.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\arlib.obj msdos\arlib.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\dirbrk.obj msdos\dirbrk.c rem Not needed for MSVC 6 and up. Lesser versions not supported -rem cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\tempnam.obj tempnam.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\ruletab.obj win95\microsft\ruletab.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\runargv.obj unix\runargv.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\rmprq.obj unix\rmprq.c -cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo -Od -GF -Ge -Foobjects\allochnd.obj win95\microsft\allochnd.cpp +rem %cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\tempnam.obj tempnam.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\ruletab.obj win95\microsft\ruletab.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\runargv.obj unix\runargv.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\rmprq.obj unix\rmprq.c +%cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\allochnd.obj win95\microsft\allochnd.cpp :link rem link /nologo /out:dmake.exe @fix95nt\win95\microsft\vpp40\obj.rsp -if "%c_flg%" == "" link /out:dmake.exe @.\win95\microsft\vpp40\obj.rsp -if not "%c_flg%" == "" link /DEBUG:notmapped,full /DEBUGTYPE:cv /PDB:NONE /out:dmake.exe @.\win95\microsft\vpp40\obj.rsp +%ld% /out:dmake.exe -debug -opt:icf,ref %ld_opt% @.\win95\microsft\vpp40\obj.rsp copy win95\microsft\vpp40\template.mk startup\config.mk + +rem clean up our env vars so they dont leak to cmd shell +set "c_opt=" +set "ld_opt=" diff --git a/win95/microsft/vpp40/mk70.bat b/win95/microsft/vpp40/mk70.bat index 2cb01b4..f3c587b 100644 --- a/win95/microsft/vpp40/mk70.bat +++ b/win95/microsft/vpp40/mk70.bat @@ -16,6 +16,7 @@ set "ld_opt=-ltcg" if exist objects rd /S /Q objects if exist config.h del config.h if exist dmake.exe del dmake.exe +if exist dmake.pdb del dmake.pdb md objects %cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\infer.obj infer.c %cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\make.obj make.c @@ -43,7 +44,7 @@ md objects %cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\arlib.obj msdos\arlib.c %cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\dirbrk.obj msdos\dirbrk.c rem Not needed for MSVC 6 and up. Lesser versions not supported -rem cl -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\tempnam.obj tempnam.c +rem %cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\tempnam.obj tempnam.c %cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\ruletab.obj win95\microsft\ruletab.c %cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\runargv.obj unix\runargv.c %cc% -c %c_flg% -I. -Iwin95 -Iwin95\microsft -Iwin95\microsft\vpp40 /nologo %c_opt% -Zi -Foobjects\rmprq.obj unix\rmprq.c From 235668ef7a5856eb5347283b0b0a33fc2412b535 Mon Sep 17 00:00:00 2001 From: bulk88 Date: Tue, 10 Mar 2015 23:31:57 -0400 Subject: [PATCH 04/15] eliminate chdir from CacheStat on Win32 the Win32 implementation of readdir (FindNextFile) gives the mtime unlike on unix, so no need to chdir, so a relative stat() call later works, since no stat call is done. This saves 2 chdirs per directory enumerated and cached and there are about 3-5 dirs for a Perl ExtUtils::MakeMaker build and 5-8 dirs for Perl core build enumerated.On VC 2003, each chdir is 22us wall time with children according to my C profiler. On VC >= 2005 chdir is more expensive since a number of locks are acquired since MS dropped the single threaded static libc. The vast majority of chdirs come from finished_child, not CacheStat, for example, in parallel building perl interp, for me 317 calls chdirs dropped to 302 after this patch. --- unix/dcache.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/unix/dcache.c b/unix/dcache.c index 518d4e8..10989b4 100644 --- a/unix/dcache.c +++ b/unix/dcache.c @@ -156,8 +156,15 @@ int force; * the same directory. This would only happen if different targets * using different upper/lower case spellings for the same directory * and is *never* a good idea. */ +#ifndef _WIN32 if (Set_dir(udir) == 0) { if((dirp=opendir(".")) != NIL(DIR)) { +#else +/* stat (or any other IO call) isn't called below on Win32 + so no need to change cwd */ + if (1) { + if((dirp=opendir(udir)) != NIL(DIR)) { +#endif while((direntp=readdir(dirp)) != NULL) { TALLOC(ep,1,Entry); ep->name = DmStrDup(direntp->d_name); /* basename only */ @@ -181,7 +188,9 @@ int force; } closedir(dirp); } +#ifndef _WIN32 Set_dir(Pwd); +#endif } } From 92f9e178560c060faffa177b56b677f47e6acc47 Mon Sep 17 00:00:00 2001 From: bulk88 Date: Wed, 11 Mar 2015 02:58:42 -0400 Subject: [PATCH 05/15] cleanup string related code In Def_recipe dont assign NULL to a calloc-ed struct and don't check for rcp being NULL, as it was already checked for NULL in Add_recipe_to_list which is the only caller of Def_recipe. In Add_recipe_to_list, remove the NULL check, all callers of Add_recipe_to_list will never pass a NULL, the callers are Parse and Parse_rule_def. In DmStrDup, don't compute strlen twice, once explicitly, the other time inside strcpy. Anyways, memcpy is more deterministic to the CPU as to end of the copying loop, than strcpy. In Parse_macro, reduce the liveness of var cp, the newly created var sp will replace var cp's C stack or non-vol reg slot instead of both sp and cp being saved around the DmStrDup call. --- dag.c | 4 ++-- dmstring.c | 7 ++++--- macparse.c | 2 +- rulparse.c | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dag.c b/dag.c index 0dab95e..688161c 100644 --- a/dag.c +++ b/dag.c @@ -643,16 +643,16 @@ int no_check; DB_PRINT( "rul", ("Defining recipe %s", rcp) ); if( !white_too ) rcp = DmStrSpn( rcp, " \t" ); - if( (rcp == NIL(char)) || (*rcp == 0 && !white_too) ) + if( *rcp == 0 && !white_too ) DB_RETURN( sp ); /* return last recipe when new recipe not added */ rp = no_check ? rcp : DmStrSpn( rcp, " \t@-+%" ); TALLOC(nsp, 1, STRING); nsp->st_string = DmStrDup( rp ); + /*nsp->st_next = NIL(STRING); already null*/ if( sp != NIL(STRING) ) sp->st_next = nsp; - nsp->st_next = NIL(STRING); if( !no_check ) nsp->st_attr |= Rcp_attribute( rcp ); diff --git a/dmstring.c b/dmstring.c index 077f0cf..63f01bd 100644 --- a/dmstring.c +++ b/dmstring.c @@ -138,11 +138,12 @@ DmStrDup( str )/* char *str; { char *t; + size_t len; if( str == NIL(char) ) return( NIL(char) ); - - if( (t = MALLOC( strlen( str )+1, char )) == NIL(char) ) No_ram(); - strcpy( t, str ); + len = strlen( str )+1; + if( (t = MALLOC( len, char )) == NIL(char) ) No_ram(); + t = memcpy( t, str, len ); return( t ); } diff --git a/macparse.c b/macparse.c index f9595dd..5b2e370 100644 --- a/macparse.c +++ b/macparse.c @@ -151,9 +151,9 @@ int flag; cp = lp->cl_prq; } TALLOC(sp,1,STRING); - sp->st_string = DmStrDup(tok2); sp->st_next = cp->ce_cond; cp->ce_cond = sp; + sp->st_string = DmStrDup(tok2); tok1 = NIL(char); } diff --git a/rulparse.c b/rulparse.c index 7ac1239..9b14aba 100644 --- a/rulparse.c +++ b/rulparse.c @@ -413,7 +413,7 @@ int no_check; { DB_ENTER( "Add_recipe_to_list" ); - if( rule != NIL( char ) && (*rule != '\0' || white_too) ) { + if( *rule != '\0' || white_too ) { DB_PRINT( "par", ("Adding recipe [%s]", rule) ); _sv_crule = Def_recipe( rule, _sv_crule, white_too, no_check ); From c7edc16fa8f7e2a51a2bf3cc0575bab0beb2d85f Mon Sep 17 00:00:00 2001 From: bulk88 Date: Wed, 11 Mar 2015 05:16:22 -0400 Subject: [PATCH 06/15] DmStrPbrk: strcspn is better approx than strpbrk Previously, if none of the chars are found, another loop (strlen()) through the string must be done. With strcspn, another loop isn't done, just 1 add instruction. --- dmstring.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dmstring.c b/dmstring.c index 63f01bd..31f53a0 100644 --- a/dmstring.c +++ b/dmstring.c @@ -212,10 +212,7 @@ char *searchchars; if( s1 == NIL(char) || searchchars == NIL(char) ) return( "" ); - t = strpbrk(s1, searchchars); - if( !t ) - t = s1+strlen(s1); - return( t ); + return( s1+strcspn(s1, searchchars) ); } From 772f99bb0861501e2dec4978bdcf9960311db726 Mon Sep 17 00:00:00 2001 From: bulk88 Date: Wed, 11 Mar 2015 06:07:56 -0400 Subject: [PATCH 07/15] DmStrSpn: use strspn instead of self rolling outselves see explanation in commit "use strpbrk instead of textbook inefficient roll your own version" --- dmstring.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dmstring.c b/dmstring.c index 31f53a0..fced305 100644 --- a/dmstring.c +++ b/dmstring.c @@ -232,8 +232,7 @@ char *s2; if( s1 == NIL(char) || s2 == NIL(char) ) return( "" ); - for( t=s1; *t && (strchr( s2, *t ) != NIL(char)); t++ ); - return( t ); + return( s1 + strspn(s1, s2) ); } From b01c3fadfaddd04525072c03be34bb9c2927045d Mon Sep 17 00:00:00 2001 From: bulk88 Date: Wed, 11 Mar 2015 07:35:31 -0400 Subject: [PATCH 08/15] use DeleteFile instead of unlink on Win32, errno not needed Remove_file and the "!" operator are always inlined into the caller into a test asm op then conditional jump on VC 2003 -O2. --- sysintf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sysintf.c b/sysintf.c index ea9b632..7e6940f 100644 --- a/sysintf.c +++ b/sysintf.c @@ -1129,7 +1129,12 @@ char *name; if( (buf.st_mode & S_IFMT) == S_IFDIR ) return 1; #endif +#ifdef _WIN32 +/* we dont need errno set, no callers check errno */ + return !DeleteFile(name); +#else return(unlink(name)); +#endif } From 9ac59e5330a5c77e56b3dea3f6341c1575819ecb Mon Sep 17 00:00:00 2001 From: bulk88 Date: Wed, 11 Mar 2015 09:50:41 -0400 Subject: [PATCH 09/15] dont call fflush for each line written when generating a tmp file fclose contains a fflush or equivelent call per posix/C. Calling fflush after every line will mean <=80 byte writes to the disk/FS driver/kernel. Calling fflush after every write of a line console is understandable, for a disk it isn't. By removing/merging the fflush with fclose, in most cases the entire temp file will be buffered in stdio in user mode and sent to the kernel only when the file is closed. Move the error check to fclose. On VS >= 2005, this also means that the MT lock will be aquired once for the fclose, not once (or more) for fflush then again for fclose. My test workload for dmake (a perl build) makes 3 temp files per "dmake all". The number of fflush calls was reduced from 140 to 137 with this patch. The number of WriteFile calls stayed the same at 145, probably since the temp files are 1 line long. The majority of fflush calls are writing to console in my workload. --- function.c | 4 ++-- mac/public.h | 4 ++-- make.c | 22 ++++++++-------------- msdos/borland/bcc30/public.h | 4 ++-- msdos/borland/bcc40/public.h | 4 ++-- msdos/borland/bcc45/public.h | 4 ++-- msdos/borland/bcc50/public.h | 4 ++-- msdos/borland/tcc20/public.h | 4 ++-- msdos/microsft/msc51/public.h | 4 ++-- msdos/microsft/msc60/public.h | 4 ++-- msdos/zortech/public.h | 4 ++-- os2/ibm/icc/public.h | 4 ++-- os2/ibm/icc3/public.h | 4 ++-- qssl/public.h | 4 ++-- sysintf.c | 6 ++++-- tos/public.h | 4 ++-- unix/386ix/public.h | 4 ++-- unix/bsd43/public.h | 4 ++-- unix/bsd43/uw/public.h | 4 ++-- unix/bsd43/vf/public.h | 4 ++-- unix/bsdarm32/public.h | 4 ++-- unix/coherent/ver40/public.h | 4 ++-- unix/coherent/ver42/public.h | 4 ++-- unix/cygwin/public.h | 4 ++-- unix/linux/gnu/public.h | 4 ++-- unix/macosx/gnu/public.h | 4 ++-- unix/os2/public.h | 4 ++-- unix/solaris/gnu/public.h | 4 ++-- unix/solaris/public.h | 4 ++-- unix/sysvr1/public.h | 4 ++-- unix/sysvr3/gnu/public.h | 4 ++-- unix/sysvr3/public.h | 4 ++-- unix/sysvr3/pwd/public.h | 4 ++-- unix/sysvr4/public.h | 4 ++-- unix/xenix/public.h | 4 ++-- unix/xenix/pwd/public.h | 4 ++-- win95/borland/bcc50/public.h | 4 ++-- win95/microsft/vpp40/public.h | 4 ++-- winnt/borland/bcc50/public.h | 4 ++-- winnt/microsft/vpp40/public.h | 4 ++-- winnt/mingw/public.h | 4 ++-- winnt/msvc6/public.h | 4 ++-- 42 files changed, 92 insertions(+), 96 deletions(-) diff --git a/function.c b/function.c index e4022f4..2d0f695 100644 --- a/function.c +++ b/function.c @@ -392,8 +392,8 @@ char *data; data = Expand(data); - Append_line( data, TRUE, tmpfile, name, FALSE, FALSE ); - Close_temp( Current_target, tmpfile ); + Append_line( data, TRUE, tmpfile, FALSE, FALSE ); + Close_temp( Current_target, tmpfile, name ); FREE(data); return( text ); diff --git a/mac/public.h b/mac/public.h index dd7b657..798973e 100644 --- a/mac/public.h +++ b/mac/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/make.c b/make.c index 0dff356..af2142c 100644 --- a/make.c +++ b/make.c @@ -54,7 +54,7 @@ typedef struct { static void _drop_mac ANSI((HASHPTR)); static void _set_recipe ANSI((char*, int)); static void _set_tmd ANSI(()); -static void _append_file ANSI((STRINGPTR, FILE*, char*, int)); +static void _append_file ANSI((STRINGPTR, FILE*, int)); static LINKPTR _dup_prq ANSI((LINKPTR)); static LINKPTR _expand_dynamic_prq ANSI(( LINKPTR, LINKPTR, char * )); static char* _prefix ANSI((char *, char *)); @@ -1316,7 +1316,7 @@ CELLPTR cp; /* Emit group prolog */ if( attr & A_PROLOG ) - _append_file( _recipes[RP_GPPROLOG], tmpfile, cp->CE_NAME, trace ); + _append_file( _recipes[RP_GPPROLOG], tmpfile, trace ); } if( !useshell ) @@ -1420,7 +1420,7 @@ CELLPTR cp; if( group ) /* Append_line() calls Print_cmnd(). */ - Append_line( cmnd, TRUE, tmpfile, cp->CE_NAME, trace, 0 ); + Append_line( cmnd, TRUE, tmpfile, trace, 0 ); else { /* Don't print empty recipe lines. .ROOT and .TARGETS * deliberately might have empty "" recipes and we don't want @@ -1440,14 +1440,14 @@ CELLPTR cp; * execute the command */ if( group && !(cp->ce_attr & A_ERROR) ) { if( attr & A_EPILOG ) /* emit epilog */ - _append_file( _recipes[RP_GPEPILOG], tmpfile, cp->CE_NAME, trace ); + _append_file( _recipes[RP_GPEPILOG], tmpfile, trace ); if( trace ) fputs("]\n", stdout); do_it = !Trace; if( do_it ) { - Close_temp( cp, tmpfile ); + Close_temp( cp, tmpfile, cp->CE_NAME ); #if defined(UNIX) chmod(groupfile,0700); @@ -1656,11 +1656,10 @@ int ind; PUBLIC void -Append_line( cmnd, newline, tmpfile, name, printit, map ) +Append_line( cmnd, newline, tmpfile, printit, map ) char *cmnd; int newline; FILE *tmpfile; -char *name; int printit; int map; { @@ -1670,25 +1669,20 @@ int map; fputs(cmnd, tmpfile); if( newline ) fputc('\n', tmpfile); - fflush(tmpfile); - - if( ferror(tmpfile) ) - Fatal("Write error on temporary file, while processing `%s'", name); } static void -_append_file( rp, tmpfile, name, printit ) +_append_file( rp, tmpfile, printit ) register STRINGPTR rp; FILE *tmpfile; -char *name; int printit; { char *cmnd; while( rp != NIL(STRING) ) { - Append_line(cmnd = Expand(rp->st_string), TRUE, tmpfile, name, printit,0); + Append_line(cmnd = Expand(rp->st_string), TRUE, tmpfile, printit,0); FREE(cmnd); rp = rp->st_next; } diff --git a/msdos/borland/bcc30/public.h b/msdos/borland/bcc30/public.h index 8b50fb5..ab68a5d 100644 --- a/msdos/borland/bcc30/public.h +++ b/msdos/borland/bcc30/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/msdos/borland/bcc40/public.h b/msdos/borland/bcc40/public.h index 7ee9ec8..61bf85d 100644 --- a/msdos/borland/bcc40/public.h +++ b/msdos/borland/bcc40/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/msdos/borland/bcc45/public.h b/msdos/borland/bcc45/public.h index 0df1c77..ddc878b 100644 --- a/msdos/borland/bcc45/public.h +++ b/msdos/borland/bcc45/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/msdos/borland/bcc50/public.h b/msdos/borland/bcc50/public.h index 04aca67..3b9ba49 100644 --- a/msdos/borland/bcc50/public.h +++ b/msdos/borland/bcc50/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/msdos/borland/tcc20/public.h b/msdos/borland/tcc20/public.h index 6325d85..d1bd020 100644 --- a/msdos/borland/tcc20/public.h +++ b/msdos/borland/tcc20/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/msdos/microsft/msc51/public.h b/msdos/microsft/msc51/public.h index 9cfc3ee..7504a97 100644 --- a/msdos/microsft/msc51/public.h +++ b/msdos/microsft/msc51/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/msdos/microsft/msc60/public.h b/msdos/microsft/msc60/public.h index a396fe6..f170308 100644 --- a/msdos/microsft/msc60/public.h +++ b/msdos/microsft/msc60/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/msdos/zortech/public.h b/msdos/zortech/public.h index 85486c4..60e3d99 100644 --- a/msdos/zortech/public.h +++ b/msdos/zortech/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/os2/ibm/icc/public.h b/os2/ibm/icc/public.h index a2dbda2..1253c40 100644 --- a/os2/ibm/icc/public.h +++ b/os2/ibm/icc/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/os2/ibm/icc3/public.h b/os2/ibm/icc3/public.h index 94a3c11..c5b0e2f 100644 --- a/os2/ibm/icc3/public.h +++ b/os2/ibm/icc3/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/qssl/public.h b/qssl/public.h index 01b1861..9f57b19 100644 --- a/qssl/public.h +++ b/qssl/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/sysintf.c b/sysintf.c index 7e6940f..60dc4b0 100644 --- a/sysintf.c +++ b/sysintf.c @@ -840,9 +840,10 @@ char *fname; ** Close a previously used temporary file. */ PUBLIC void -Close_temp(cp, file) +Close_temp(cp, file, name) CELLPTR cp; FILE *file; +char *name; { FILELISTPTR fl; if( cp == NIL(CELL) ) cp = Root; @@ -850,7 +851,8 @@ FILE *file; for( fl=cp->ce_files; fl && fl->fl_file != file; fl=fl->fl_next ); if( fl ) { fl->fl_file = NIL(FILE); - fclose(file); + if( fclose(file) == EOF ) + Fatal("Close or Write error on temporary file, while processing `%s'", name); } } diff --git a/tos/public.h b/tos/public.h index e869b30..d7a4218 100644 --- a/tos/public.h +++ b/tos/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/386ix/public.h b/unix/386ix/public.h index 18ab3f4..f2b0f5d 100644 --- a/unix/386ix/public.h +++ b/unix/386ix/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/bsd43/public.h b/unix/bsd43/public.h index ce667ee..32a2ed3 100644 --- a/unix/bsd43/public.h +++ b/unix/bsd43/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/bsd43/uw/public.h b/unix/bsd43/uw/public.h index 4a69d31..8547509 100644 --- a/unix/bsd43/uw/public.h +++ b/unix/bsd43/uw/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/bsd43/vf/public.h b/unix/bsd43/vf/public.h index 5507dde..b94b9d2 100644 --- a/unix/bsd43/vf/public.h +++ b/unix/bsd43/vf/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/bsdarm32/public.h b/unix/bsdarm32/public.h index 3f43cee..2520a38 100644 --- a/unix/bsdarm32/public.h +++ b/unix/bsdarm32/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/coherent/ver40/public.h b/unix/coherent/ver40/public.h index 313f413..e91d63d 100644 --- a/unix/coherent/ver40/public.h +++ b/unix/coherent/ver40/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/coherent/ver42/public.h b/unix/coherent/ver42/public.h index ac2889d..ba9312e 100644 --- a/unix/coherent/ver42/public.h +++ b/unix/coherent/ver42/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/cygwin/public.h b/unix/cygwin/public.h index ac96a0e..32556bd 100644 --- a/unix/cygwin/public.h +++ b/unix/cygwin/public.h @@ -60,7 +60,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -129,7 +129,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/linux/gnu/public.h b/unix/linux/gnu/public.h index ac96a0e..32556bd 100644 --- a/unix/linux/gnu/public.h +++ b/unix/linux/gnu/public.h @@ -60,7 +60,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -129,7 +129,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/macosx/gnu/public.h b/unix/macosx/gnu/public.h index 41a7f13..fa7e4fb 100644 --- a/unix/macosx/gnu/public.h +++ b/unix/macosx/gnu/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/os2/public.h b/unix/os2/public.h index ac96a0e..32556bd 100644 --- a/unix/os2/public.h +++ b/unix/os2/public.h @@ -60,7 +60,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -129,7 +129,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/solaris/gnu/public.h b/unix/solaris/gnu/public.h index d14adc3..355c9a5 100644 --- a/unix/solaris/gnu/public.h +++ b/unix/solaris/gnu/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/solaris/public.h b/unix/solaris/public.h index 2ed32a9..0931288 100644 --- a/unix/solaris/public.h +++ b/unix/solaris/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -127,7 +127,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/sysvr1/public.h b/unix/sysvr1/public.h index 83d62e6..b88437c 100644 --- a/unix/sysvr1/public.h +++ b/unix/sysvr1/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/sysvr3/gnu/public.h b/unix/sysvr3/gnu/public.h index 7516976..5bfc13a 100644 --- a/unix/sysvr3/gnu/public.h +++ b/unix/sysvr3/gnu/public.h @@ -57,7 +57,7 @@ int Make_targets ANSI(()); int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -126,7 +126,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/sysvr3/public.h b/unix/sysvr3/public.h index 857ade8..ecf4b8b 100644 --- a/unix/sysvr3/public.h +++ b/unix/sysvr3/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/sysvr3/pwd/public.h b/unix/sysvr3/pwd/public.h index c4ce082..7b7d78e 100644 --- a/unix/sysvr3/pwd/public.h +++ b/unix/sysvr3/pwd/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/sysvr4/public.h b/unix/sysvr4/public.h index fa6f36c..5efa9d1 100644 --- a/unix/sysvr4/public.h +++ b/unix/sysvr4/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/xenix/public.h b/unix/xenix/public.h index 8378340..bca620b 100644 --- a/unix/xenix/public.h +++ b/unix/xenix/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/unix/xenix/pwd/public.h b/unix/xenix/pwd/public.h index 34c43d4..15ba736 100644 --- a/unix/xenix/pwd/public.h +++ b/unix/xenix/pwd/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/win95/borland/bcc50/public.h b/win95/borland/bcc50/public.h index 86ccf42..a5a0357 100644 --- a/win95/borland/bcc50/public.h +++ b/win95/borland/bcc50/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/win95/microsft/vpp40/public.h b/win95/microsft/vpp40/public.h index dea051d..cbdf666 100644 --- a/win95/microsft/vpp40/public.h +++ b/win95/microsft/vpp40/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -127,7 +127,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/winnt/borland/bcc50/public.h b/winnt/borland/bcc50/public.h index 9ea12ef..d414df5 100644 --- a/winnt/borland/bcc50/public.h +++ b/winnt/borland/bcc50/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -128,7 +128,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/winnt/microsft/vpp40/public.h b/winnt/microsft/vpp40/public.h index ad8e5e0..d71aa61 100644 --- a/winnt/microsft/vpp40/public.h +++ b/winnt/microsft/vpp40/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -127,7 +127,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/winnt/mingw/public.h b/winnt/mingw/public.h index ce7cd6b..e6712e3 100644 --- a/winnt/mingw/public.h +++ b/winnt/mingw/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -127,7 +127,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); diff --git a/winnt/msvc6/public.h b/winnt/msvc6/public.h index 2f1a793..50f5750 100644 --- a/winnt/msvc6/public.h +++ b/winnt/msvc6/public.h @@ -59,7 +59,7 @@ int Exec_commands ANSI((CELLPTR)); void Print_cmnd ANSI((char *, int, int)); int Push_dir ANSI((char *, char *, int)); void Pop_dir ANSI((int)); -void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Append_line ANSI((char *, int, FILE *, int, int)); void Stat_target ANSI((CELLPTR, int, int)); char *Expand ANSI((char *)); char *Apply_edit ANSI((char *, char *, char *, int, int)); @@ -127,7 +127,7 @@ FILE* Get_temp ANSI((char **, char *)); FILE *Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); -void Close_temp ANSI((CELLPTR, FILE *)); +void Close_temp ANSI((CELLPTR, FILE *, char *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); From 903fbc19c55ac208ce89363c1f188c88c8d58a4e Mon Sep 17 00:00:00 2001 From: bulk88 Date: Tue, 17 Mar 2015 17:11:27 -0400 Subject: [PATCH 10/15] add VC version to -V I didn't realize dmstr2 existed when I created STRINGIFY and DM_StGiFy, so remove my API names in favor dmake's older (and more authoritative) names. --- configure.ac | 2 +- dmake.h | 5 +++++ imacs.c | 4 +--- win95/microsft/config.h | 2 +- win95/microsft/ruletab.c | 5 ----- winnt/microsft/config.h | 2 +- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index b3a854b..5c9eb6b 100755 --- a/configure.ac +++ b/configure.ac @@ -85,7 +85,7 @@ case "$_os" in "MSVC6") OS_VERSION=msvc6 OS_TYPE=winnt - BUILDINFO="Windows / MS Visual C++" + BUILDINFO="Windows / MS Visual C++" dmstr2\(_MSC_FULL_VER\) CASE_INSENSITIVE_FS=true ;; "Darwin") diff --git a/dmake.h b/dmake.h index 8d70a1b..25782fa 100644 --- a/dmake.h +++ b/dmake.h @@ -228,5 +228,10 @@ #define STOBOOL(A) (A && ((*A | 0x20) == 'y')) #define BTOBOOL(A) (A) +/* To stringify the result of the expansion of a macro argument + * use two levels of macros. */ +#define dmstr2(s) dmstr1(s) +#define dmstr1(s) #s + #endif diff --git a/imacs.c b/imacs.c index 1b0e3a5..e8d9dd7 100644 --- a/imacs.c +++ b/imacs.c @@ -28,9 +28,7 @@ #include "extern.h" -#define DM_StGiFy(a) #a -#define STRINGIFY(a) DM_StGiFy(a) -#define SET_INT_VAR_FROM_INT(name, val, flag, var) _set_int_var_from_int_and_str(name, val, STRINGIFY(val), flag, var) +#define SET_INT_VAR_FROM_INT(name, val, flag, var) _set_int_var_from_int_and_str(name, val, dmstr2(val), flag, var) static void _set_int_var ANSI((char *, char *, int, int *)); static void _set_int_var_from_int_and_str ANSI((char *, int, char *, int, int *)); diff --git a/win95/microsft/config.h b/win95/microsft/config.h index 2b67f1c..2b2cae9 100644 --- a/win95/microsft/config.h +++ b/win95/microsft/config.h @@ -37,7 +37,7 @@ /* Name and version number of this package */ #define PACKAGE "dmake" #define VERSION "4.13" -#define BUILDINFO "Windows / MS Visual C++" +#define BUILDINFO "Windows / MS Visual C++ " dmstr2(_MSC_FULL_VER) #if defined (_MSC_VER) # if _MSC_VER < 500 diff --git a/win95/microsft/ruletab.c b/win95/microsft/ruletab.c index aa35282..fdfe36d 100644 --- a/win95/microsft/ruletab.c +++ b/win95/microsft/ruletab.c @@ -35,11 +35,6 @@ #define MAXIMUM_WAIT_OBJECTS 1 #endif -/* To stringify the result of the expansion of a macro argument - * use two levels of macros. */ -#define dmstr2(s) dmstr1(s) -#define dmstr1(s) #s - static char *_rules[] = { "MAXLINELENGTH := 32766", "MAXPROCESSLIMIT := " dmstr2(MAXIMUM_WAIT_OBJECTS) , diff --git a/winnt/microsft/config.h b/winnt/microsft/config.h index 23fd1da..0b8ec0e 100644 --- a/winnt/microsft/config.h +++ b/winnt/microsft/config.h @@ -28,7 +28,7 @@ /* Name and version number of this package */ #define PACKAGE "dmake" #define VERSION "4.12" -#define BUILDINFO "Windows / MS Visual C++" +#define BUILDINFO "Windows / MS Visual C++" dmstr2(_MSC_FULL_VER) #if defined (_MSC_VER) # if _MSC_VER < 500 From ee342a36fa80cdf419d5c8dc1bca1d893fe93e9d Mon Sep 17 00:00:00 2001 From: bulk88 Date: Tue, 17 Mar 2015 15:33:01 -0400 Subject: [PATCH 11/15] update install/build instructions commit "Stop tracking autoconf-generated files." discontinued distributing configure --- readme/read1st.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/readme/read1st.txt b/readme/read1st.txt index 34b5424..3295c71 100644 --- a/readme/read1st.txt +++ b/readme/read1st.txt @@ -29,13 +29,18 @@ Building Dmake With autotools -------------- Building dmake on systems that are supported by the autotools build system -only requires the usual "./configure && make && make install" command. -The configure command will notify you when your platform is not supported. +only requires the usual "./autogen.sh && ./configure && make && make install" +command. The configure command will notify you when your platform is not +supported. With Microsoft C++ compiler --------------------------- -For MS Visual C++ 6 and up run "make.bat win95-vpp40" in a command shell. -This should create a dmake.exe in the top-level directory. +For MS Visual C++ 4 through 6 run "make.bat win95-vpp40" in a command shell. +For MS Visual C++ 2003 and up run "make.bat win95-vpp70" in a command shell. +Both 32 bit and 64 bit builds are supported. The bitness of the dmake build is +determined by the bitness of cl.exe which was found in PATH. Use "vcvars32" or +"vcvarsall x64" to pick the correct Visual C++ compiler. A dmake.exe will be +created in the top-level directory. It is possible to rename this to, say, dmake0.exe, delete the objects/ sub-directory and then simply run "dmake0.exe" to build a new dmake.exe. From 255d27de8b480fe4a14ba08b180506273199aa86 Mon Sep 17 00:00:00 2001 From: bulk88 Date: Tue, 17 Mar 2015 15:56:35 -0400 Subject: [PATCH 12/15] update winnt/microsft/config.h to be more like win95/microsft/config.h the winnt bat file builds are generally broken, but sychronize them to avoid more rotting --- winnt/microsft/config.h | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/winnt/microsft/config.h b/winnt/microsft/config.h index 0b8ec0e..8ae09e6 100644 --- a/winnt/microsft/config.h +++ b/winnt/microsft/config.h @@ -25,10 +25,19 @@ -- Use cvs log to obtain detailed change logs. */ +/* Attention! In the UNIX like builds with the ./configure ; make + procedure a config.h is generated. The autogenerated config.h + must not be there to compile dmake with MSC and the + "dmake\make.bat win95-vpp40" command. This file sets (among other + things) the needed HAS_... and HAVE_... macros. + + Don't forget to update the PACKAGE and VERSION macros! +*/ + /* Name and version number of this package */ #define PACKAGE "dmake" -#define VERSION "4.12" -#define BUILDINFO "Windows / MS Visual C++" dmstr2(_MSC_FULL_VER) +#define VERSION "4.13" +#define BUILDINFO "Windows / MS Visual C++ " dmstr2(_MSC_FULL_VER) #if defined (_MSC_VER) # if _MSC_VER < 500 @@ -73,6 +82,30 @@ # define CONST #endif +/* Assume case insensitive file system. */ +#define CASE_INSENSITIVE_FS 1 + +/* MSC has sys/types.h and sys/stat.h (this is tested only with MSVC++ 6.0) */ +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_STAT_H 1 + +/* These functions are available! (this is tested only with MSVC++ 6.0) */ +#define HAVE_GETCWD 1 +#define HAVE_UTIME_NULL 1 +#define HAVE_TZSET 1 +#define HAVE_STRLWR 1 + +#define HAVE_ERRNO_H 1 +#define HAVE_STRERROR 1 +#define HAVE_TEMPNAM 1 +#define HAVE_FCNTL_H 1 +#define HAVE_SETVBUF 1 + +/* These defines are needed for itypes.h! (this is tested only with MSVC++ 6.0) */ +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define SIZEOF_SHORT 2 + #ifndef MSDOS # define MSDOS 1 #endif From f6abcc2f1424b47be569940142e0b110b5c0e613 Mon Sep 17 00:00:00 2001 From: bulk88 Date: Wed, 18 Mar 2015 00:39:57 -0400 Subject: [PATCH 13/15] update canned microsft/config.h from autoconf generated config.h done with cygwin autoconf, no gcc installed, vcvars32.bat env vars set from VC 6, macros that were undefed were not included in this commit, also autoconf undefed HAVE_UTIME_NULL, so leave the former hand set HAVE_UTIME_NULL on. --- win95/microsft/config.h | 92 +++++++++++++++++++++++++++++++++++------ winnt/microsft/config.h | 92 +++++++++++++++++++++++++++++++++++------ 2 files changed, 158 insertions(+), 26 deletions(-) diff --git a/win95/microsft/config.h b/win95/microsft/config.h index 2b2cae9..48cfd67 100644 --- a/win95/microsft/config.h +++ b/win95/microsft/config.h @@ -34,11 +34,6 @@ Don't forget to update the PACKAGE and VERSION macros! */ -/* Name and version number of this package */ -#define PACKAGE "dmake" -#define VERSION "4.13" -#define BUILDINFO "Windows / MS Visual C++ " dmstr2(_MSC_FULL_VER) - #if defined (_MSC_VER) # if _MSC_VER < 500 Force a compile-time blowup. @@ -83,34 +78,105 @@ # define CONST #endif +/* Build info string */ +#define BUILDINFO "Windows / MS Visual C++ " dmstr2(_MSC_FULL_VER) + /* Assume case insensitive file system. */ #define CASE_INSENSITIVE_FS 1 -/* MSC has sys/types.h and sys/stat.h (this is tested only with MSVC++ 6.0) */ -#define HAVE_SYS_TYPES_H 1 -#define HAVE_SYS_STAT_H 1 /* These functions are available! (this is tested only with MSVC++ 6.0) */ -#define HAVE_GETCWD 1 #define HAVE_UTIME_NULL 1 -#define HAVE_TZSET 1 -#define HAVE_STRLWR 1 +/* Define to 1 if you have the header file. */ #define HAVE_ERRNO_H 1 -#define HAVE_STRERROR 1 -#define HAVE_TEMPNAM 1 + +/* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `setvbuf' function. */ #define HAVE_SETVBUF 1 /* These defines are needed for itypes.h! (this is tested only with MSVC++ 6.0) */ +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlwr' function. */ +#define HAVE_STRLWR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the `tempnam' function. */ +#define HAVE_TEMPNAM 1 + +/* Define to 1 if you have the `tzset' function. */ +#define HAVE_TZSET 1 + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Name of package */ +#define PACKAGE "dmake" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "dmake" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "dmake 4.13" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "dmake" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "4.13" + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG 4 + +/* The size of `short', as computed by sizeof. */ #define SIZEOF_SHORT 2 +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + #ifndef MSDOS # define MSDOS 1 #endif +/* Version number of package */ +#define VERSION "4.13" + /* a small problem with pointer to voids on some unix machines needs this */ #define DMPVOID void * diff --git a/winnt/microsft/config.h b/winnt/microsft/config.h index 8ae09e6..c2d4dd5 100644 --- a/winnt/microsft/config.h +++ b/winnt/microsft/config.h @@ -34,11 +34,6 @@ Don't forget to update the PACKAGE and VERSION macros! */ -/* Name and version number of this package */ -#define PACKAGE "dmake" -#define VERSION "4.13" -#define BUILDINFO "Windows / MS Visual C++ " dmstr2(_MSC_FULL_VER) - #if defined (_MSC_VER) # if _MSC_VER < 500 Force a compile-time blowup. @@ -82,34 +77,105 @@ # define CONST #endif +/* Build info string */ +#define BUILDINFO "Windows / MS Visual C++ " dmstr2(_MSC_FULL_VER) + /* Assume case insensitive file system. */ #define CASE_INSENSITIVE_FS 1 -/* MSC has sys/types.h and sys/stat.h (this is tested only with MSVC++ 6.0) */ -#define HAVE_SYS_TYPES_H 1 -#define HAVE_SYS_STAT_H 1 /* These functions are available! (this is tested only with MSVC++ 6.0) */ -#define HAVE_GETCWD 1 #define HAVE_UTIME_NULL 1 -#define HAVE_TZSET 1 -#define HAVE_STRLWR 1 +/* Define to 1 if you have the header file. */ #define HAVE_ERRNO_H 1 -#define HAVE_STRERROR 1 -#define HAVE_TEMPNAM 1 + +/* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `setvbuf' function. */ #define HAVE_SETVBUF 1 /* These defines are needed for itypes.h! (this is tested only with MSVC++ 6.0) */ +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlwr' function. */ +#define HAVE_STRLWR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the `tempnam' function. */ +#define HAVE_TEMPNAM 1 + +/* Define to 1 if you have the `tzset' function. */ +#define HAVE_TZSET 1 + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Name of package */ +#define PACKAGE "dmake" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "dmake" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "dmake 4.13" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "dmake" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "4.13" + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG 4 + +/* The size of `short', as computed by sizeof. */ #define SIZEOF_SHORT 2 +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + #ifndef MSDOS # define MSDOS 1 #endif +/* Version number of package */ +#define VERSION "4.13" + /* a small problem with pointer to voids on some unix machines needs this */ #define DMPVOID void * From 59f060008081ae5de92bf66d6b5f35f2f8bd4e5e Mon Sep 17 00:00:00 2001 From: bulk88 Date: Wed, 18 Mar 2015 00:49:36 -0400 Subject: [PATCH 14/15] kmx's fix for configure The error I (bulk88) saw was checking the operating system... configure: error: MINGW32_NT-5.1 operating syst em is not suitable to build dmake! *returned to prompt* --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5c9eb6b..d7e87d0 100755 --- a/configure.ac +++ b/configure.ac @@ -76,7 +76,7 @@ case "$_os" in OS_VERSION=cygwin CASE_INSENSITIVE_FS=true ;; - "MINGW") + MINGW*) OS_VERSION=mingw OS_TYPE=winnt BUILDINFO="Windows / MinGW" From 7408cb04fb793775e71fec36c208534bbb68c134 Mon Sep 17 00:00:00 2001 From: bulk88 Date: Fri, 15 May 2015 13:16:59 -0400 Subject: [PATCH 15/15] fix bug, temp file not flushed before used by recipie process In commit "dont call fflush for each line written when generating a tmp file" I stopped flushing the fd of a temp file after every line, but that introduced a new bug, since Close_temp was not always closing a fd (IDK if that is intentional or not) even though it looked like it did. Change Close_temp to fflush the fd if it wasn't fclose-d. The bug presented itself as a temp file being empty when GCC read it, but examining the temp showed it was filled correctly because it was filled as dmake was exiting after processing the GCC non-zero exit. --- function.c | 6 ++++++ sysintf.c | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/function.c b/function.c index 2d0f695..da49832 100644 --- a/function.c +++ b/function.c @@ -392,6 +392,12 @@ char *data; data = Expand(data); + /* Expand's decendents can change Current_target, example + "$(mktmp $(HEADER) $(shell @type text_file_on_disk) $(FOOTER))" will do it. + Is that a bug? Should Current_target be saved to a C auto? IDK. See also a + comment by the original author in Exec_commands(). "type" is a + Win32 command. ~bulk88 + */ Append_line( data, TRUE, tmpfile, FALSE, FALSE ); Close_temp( Current_target, tmpfile, name ); FREE(data); diff --git a/sysintf.c b/sysintf.c index 60dc4b0..5a74f08 100644 --- a/sysintf.c +++ b/sysintf.c @@ -846,14 +846,19 @@ FILE *file; char *name; { FILELISTPTR fl; + int status; if( cp == NIL(CELL) ) cp = Root; for( fl=cp->ce_files; fl && fl->fl_file != file; fl=fl->fl_next ); if( fl ) { fl->fl_file = NIL(FILE); - if( fclose(file) == EOF ) - Fatal("Close or Write error on temporary file, while processing `%s'", name); + status = fclose(file); + } else { /* if it isn't supposed to be closed, atleast it has to be flushed */ + status = fflush(file); } + if( status == EOF ) + Fatal("Close or Write error on temporary file, while processing `%s'", name); + return; }