cvs-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cvs-cvs] ccvs ChangeLog config.h.in configure configure.... [cvs1-11-x-


From: Mark D. Baushke
Subject: [Cvs-cvs] ccvs ChangeLog config.h.in configure configure.... [cvs1-11-x-branch]
Date: Wed, 07 May 2008 15:34:27 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Branch:         cvs1-11-x-branch
Changes by:     Mark D. Baushke <mdb>   08/05/07 15:34:20

Modified files:
        .              : ChangeLog config.h.in configure configure.in 
                         cvsnt.dep cvsnt.dsp cvsnt.mak 
        diff           : ChangeLog diff.c diff3.c libdiff.mak system.h 
                         util.c 
        lib            : ChangeLog ftruncate.c libcvs.mak mkdir.c 
                         regex.c rename.c system.h 
        src            : ChangeLog buffer.c client.c create_adm.c 
                         cvsrc.c edit.c entries.c error.c fileattr.c 
                         filesubr.c hardlink.c history.c ignore.c 
                         import.c lock.c login.c logmsg.c mkmodules.c 
                         myndbm.c parseinfo.c patch.c rcs.c repos.c 
                         run.c server.c subr.c update.c vers_ts.c 
                         wrapper.c 
        windows-NT     : ChangeLog JmgStat.c JmgStat.h Makefile.am 
                         Makefile.in config.h config.h.in filesubr.c 
                         ndir.c pwd.c rcmd.c run.c woe32.c 
        windows-NT/SCC : SCC.mak 
        zlib           : ChangeLog libz.mak minigzip.c 

Log message:
        * configure.in: Add AC_CHECK_HEADERS for process.h and sys/utime.h
        which are needed for Windows-NT builds.
        * configure, config.h.in: Regenerated.
        
        [bug #22781]
        * cvsnt.dep, cvsnt.dsp, cvsnt.mak: remove references to jmgStat.[ch]
        * cvsnt.mak: convert to work with MSVC 2005 express and MSVC 8
        
        * diff/system.h (CVS_STAT, CVS_FSTAT): Add default values.
        
        [bug #22781]
        * diff/diff.c, diff/diff3.c: convert all stat and fstat calls to call 
         CVS_STAT and CVS_FSTAT
        * diff/system.h, diff/util.c: remove declaration conflicts with system 
headers
        * diff/libdiff.mak: Change CFLAGS to work with MSVC 2005 express
        
        [bug #22781]
        * lib/ftruncate.c, lib/mkdir.c, lib/rename.c: change stat and fstat 
calls
         to call CVS_STAT and CVS_FSTAT
        * lib/regex.c: substitute errorCode for reserved word errcode
        * lib/system.h: get symbols from system header files rather 
        than using conflicting substitute declarations.
        Don't assume that time_t is long. 
        Define CVS_FSTAT as fstat and CVS_UTIME as utime for 
        non-Windows platforms.
        * lib/libcvs.mak: Change CFLAGS to work with MSVC 2005 express
        
        * src/client.c (read_counted_file): Set errno = 0 before CVS_FOPEN
        because Standard C doesn't require errno be set on error.
        (set_sticky, send_repository): Ditto.
        * src/create_adm.c (Create_Admin): Ditto.
        * src/edit.c (ncheck_fileproc, cvs_notify_check): Ditto.
        * src/entries.c (write_entries, Register, Subdirs_Known, base_walk):
        Ditto.
        * src/ignore.c (ign_add_file): Ditto.
        * src/import.c (add_rcs_file): Ditto.
        * src/lock.c (Reader_Lock, write_lock): Ditto.
        * src/login.c (password_entry_operation): Ditto.
        * src/logmsg.c (do_editor, rcsinfo_proc): Ditto.
        * src/myndbm.c (mydbm_open, mydbm_close): Ditto.
        * src/parseinfo.c (Parse_Info, parse_config): Ditto.
        * src/rcs.c (RCS_parse, RCS_parsercsfile, RCS_checkout)
        (RCS_cmp_file, rcsbuf_cache_open):  Ditto.
        * src/repos.c (Name_Repository): 
        * src/server.c (create_adm_p, dirswitch, serve_static_directory)
        (serve_sticky, server_write_entries, server_updated)
        (template_proc): Ditto. 
        * src/subr.c (file_has_markers): Ditto.
        * src/update.c (patch_file): Ditto.
        * src/wrapper.c (wrap_add_file): Ditto.
        
        * src/rcs.c (rcsbuf_cache_open): Pass errno to error() calls from
        CVS_FOPEN and fseek on failure.
        
        [bug #22781]
        * src/buffer.c, src/client.c, src/filesubr.c, src/hardlink.c,
        src/history.c, src/patch.c, rcs.c, run.c, server.c, update.c, vers_ts.c:
        Change stat, fstat and utime calls to call CVS_STAT
        CVS_FSTAT and CVS_UTIME.
        * src/client.c, src/vers_ts.c: add conditionally compiled debug printfs.
        * src/cvsrc.c, src/error.c: remove declaration conflicts with system 
headers.
        * src/login.c: add missing declaration of getpass.
        * src/subr.c: don't assume time_t is long.
        
        [bug #22781]
        * windows-NT/JmgStat.c, windows-NT/JmgStat.h: remove. 
        * windows-NT/config.h: Add macros CVS_FSTAT & CVS_UTIME, declare
        wnt_fstat and wnt_utime, include sys/utime.h, remove declarations that 
        conflict with windows header files.
        * windows-NT/filesubr.c: convert all fstat and utime calls to use the 
new 
        CVS_FSTAT and CVS_UTIME macros.  Reimplement check_statbuf to 
        use GetFileTime to get accurate file timestamps, and new function
        UTCFileTimeToUnixTime to accurtately convert them.
        Implement wnt_utime and wnt_fstat.
        * windows-NT/ndir.c, windows-NT/pwd.c: Add missing declaratiosn of 
xmalloc.
        * windows-NT/rcmd.c: substitute errorCode for reserved word errcode.
        * windows-NT/run.c: correct function signature of piped_child.
        * windows-NT/Makefile.am Makefile.in: remove references to jmgStat.[ch]
        
        [bug #22781]
        * zlib/libz.mak: Change CFLAGS to work with MSVC 2005 express
        * zlib/minigzip.c: change fstat call to CVS_FSTAT call

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/ChangeLog?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.692.2.264&r2=1.692.2.265
http://cvs.savannah.gnu.org/viewcvs/ccvs/config.h.in?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.71.4.14&r2=1.71.4.15
http://cvs.savannah.gnu.org/viewcvs/ccvs/configure?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.174.2.85&r2=1.174.2.86
http://cvs.savannah.gnu.org/viewcvs/ccvs/configure.in?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.176.2.76&r2=1.176.2.77
http://cvs.savannah.gnu.org/viewcvs/ccvs/cvsnt.dep?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.12.2.4&r2=1.12.2.5
http://cvs.savannah.gnu.org/viewcvs/ccvs/cvsnt.dsp?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.7.6.3&r2=1.7.6.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/cvsnt.mak?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.45.4.6&r2=1.45.4.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/diff/ChangeLog?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.61.4.13&r2=1.61.4.14
http://cvs.savannah.gnu.org/viewcvs/ccvs/diff/diff.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.13.4.1&r2=1.13.4.2
http://cvs.savannah.gnu.org/viewcvs/ccvs/diff/diff3.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.14.6.1&r2=1.14.6.2
http://cvs.savannah.gnu.org/viewcvs/ccvs/diff/libdiff.mak?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.14.2.2&r2=1.14.2.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/diff/system.h?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.8.4.1&r2=1.8.4.2
http://cvs.savannah.gnu.org/viewcvs/ccvs/diff/util.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.12.6.1&r2=1.12.6.2
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/ChangeLog?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.169.2.38&r2=1.169.2.39
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/ftruncate.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.1.1.1&r2=1.1.1.1.16.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/libcvs.mak?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.5.2.2&r2=1.5.2.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mkdir.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.3.8.1&r2=1.3.8.2
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/regex.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.12.4.3&r2=1.12.4.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/rename.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.6&r2=1.6.6.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/system.h?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.43.4.12&r2=1.43.4.13
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/ChangeLog?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.2336.2.505&r2=1.2336.2.506
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/buffer.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.21.4.15&r2=1.21.4.16
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/client.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.318.4.48&r2=1.318.4.49
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/create_adm.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.37.4.2&r2=1.37.4.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/cvsrc.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.22.4.3&r2=1.22.4.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/edit.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.57.4.9&r2=1.57.4.10
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/entries.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.46.6.6&r2=1.46.6.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/error.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.26.6.1&r2=1.26.6.2
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/fileattr.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.19.6.3&r2=1.19.6.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/filesubr.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.59.4.21&r2=1.59.4.22
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/hardlink.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.6.6.2&r2=1.6.6.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/history.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.58.4.16&r2=1.58.4.17
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/ignore.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.39.4.9&r2=1.39.4.10
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/import.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.133.4.20&r2=1.133.4.21
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/lock.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.59.4.21&r2=1.59.4.22
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/login.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.70.4.10&r2=1.70.4.11
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/logmsg.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.62.4.12&r2=1.62.4.13
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/mkmodules.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.66.6.15&r2=1.66.6.16
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/myndbm.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.24.2.2&r2=1.24.2.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/parseinfo.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.37.4.10&r2=1.37.4.11
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/patch.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.80.4.15&r2=1.80.4.16
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/rcs.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.262.4.64&r2=1.262.4.65
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/repos.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.24.6.3&r2=1.24.6.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/run.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.33.6.7&r2=1.33.6.8
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/server.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.284.2.56&r2=1.284.2.57
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/subr.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.72.4.32&r2=1.72.4.33
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/update.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.202.4.33&r2=1.202.4.34
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/vers_ts.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.43.4.12&r2=1.43.4.13
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/wrapper.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.31.4.5&r2=1.31.4.6
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/ChangeLog?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.158.2.45&r2=1.158.2.46
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/JmgStat.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&rev=1.1.2.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/JmgStat.h?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&rev=1.1.2.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/Makefile.am?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.2.4.9&r2=1.2.4.10
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/Makefile.in?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.29.4.22&r2=1.29.4.23
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/config.h?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.46.2.42&r2=1.46.2.43
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/config.h.in?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.1.2.5&r2=1.1.2.6
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/filesubr.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.37.4.7&r2=1.37.4.8
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/ndir.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.6&r2=1.6.4.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/pwd.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.6&r2=1.6.4.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/rcmd.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.10&r2=1.10.8.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/run.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.16.8.6&r2=1.16.8.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/woe32.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.1.2.3&r2=1.1.2.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/SCC/SCC.mak?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.1&r2=1.1.8.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/zlib/ChangeLog?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.19.6.3&r2=1.19.6.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/zlib/libz.mak?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.3.2.2&r2=1.3.2.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/zlib/minigzip.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.1.1.4&r2=1.1.1.4.6.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/ChangeLog,v
retrieving revision 1.692.2.264
retrieving revision 1.692.2.265
diff -u -b -r1.692.2.264 -r1.692.2.265
--- ChangeLog   10 Mar 2008 18:35:44 -0000      1.692.2.264
+++ ChangeLog   7 May 2008 15:34:04 -0000       1.692.2.265
@@ -1,3 +1,14 @@
+2008-05-07  Mark D. Baushke  <address@hidden>
+
+       * configure.in: Add AC_CHECK_HEADERS for process.h and sys/utime.h
+       which are needed for Windows-NT builds.
+       * configure, config.h.in: Regenerated.
+       
+       [bug #22781]
+       * cvsnt.dep, cvsnt.dsp, cvsnt.mak: remove references to jmgStat.[ch]
+       * cvsnt.mak: convert to work with MSVC 2005 express and MSVC 8.
+       (Patch submitted by Nelson B. Bolyard <address@hidden>.)
+       
 2008-03-10  Mark D. Baushke  <address@hidden>
 
        * NEWS: Note new IgnoreUnknownConfigKeys CVSROOT/config option.

Index: config.h.in
===================================================================
RCS file: /cvsroot/cvs/ccvs/config.h.in,v
retrieving revision 1.71.4.14
retrieving revision 1.71.4.15
diff -u -b -r1.71.4.14 -r1.71.4.15
--- config.h.in 28 Jan 2008 01:22:45 -0000      1.71.4.14
+++ config.h.in 7 May 2008 15:34:05 -0000       1.71.4.15
@@ -121,6 +121,9 @@
 /* Define to 1 if you have the `getpagesize' function. */
 #undef HAVE_GETPAGESIZE
 
+/* Define to 1 if you have the `getpid' function. */
+#undef HAVE_GETPID
+
 /* Define if you have the getspnam function. */
 #undef HAVE_GETSPNAM
 
@@ -211,6 +214,9 @@
 /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
 #undef HAVE_NDIR_H
 
+/* Define to 1 if you have the <process.h> header file. */
+#undef HAVE_PROCESS_H
+
 /* Define to 1 if you have the `putenv' function. */
 #undef HAVE_PUTENV
 
@@ -321,6 +327,9 @@
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the <sys/utime.h> header file. */
+#undef HAVE_SYS_UTIME_H
+
 /* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
 #undef HAVE_SYS_WAIT_H
 

Index: configure
===================================================================
RCS file: /cvsroot/cvs/ccvs/configure,v
retrieving revision 1.174.2.85
retrieving revision 1.174.2.86
diff -u -b -r1.174.2.85 -r1.174.2.86
--- configure   7 May 2008 14:35:07 -0000       1.174.2.85
+++ configure   7 May 2008 15:34:05 -0000       1.174.2.86
@@ -5642,6 +5642,8 @@
 
 
 
+
+
 for ac_header in \
        errno.h \
        direct.h \
@@ -5651,6 +5653,7 @@
        limits.h \
        memory.h \
        ndbm.h \
+       process.h \
        string.h \
        syslog.h \
        sys/bsdtypes.h \
@@ -5660,6 +5663,7 @@
        sys/select.h \
        sys/time.h \
        sys/timeb.h \
+       sys/utime.h \
        unistd.h \
        utime.h\
 
@@ -8086,6 +8090,7 @@
 
 
 
+
 for ac_func in \
        fchdir \
        fchmod \
@@ -8095,6 +8100,7 @@
        getgroups \
        getopt \
        getpagesize \
+       getpid \
        gettimeofday \
        initgroups \
        login \

Index: configure.in
===================================================================
RCS file: /cvsroot/cvs/ccvs/configure.in,v
retrieving revision 1.176.2.76
retrieving revision 1.176.2.77
diff -u -b -r1.176.2.76 -r1.176.2.77
--- configure.in        7 May 2008 14:35:12 -0000       1.176.2.76
+++ configure.in        7 May 2008 15:34:09 -0000       1.176.2.77
@@ -148,6 +148,7 @@
        limits.h \
        memory.h \
        ndbm.h \
+       process.h \
        string.h \
        syslog.h \
        sys/bsdtypes.h \
@@ -157,6 +158,7 @@
        sys/select.h \
        sys/time.h \
        sys/timeb.h \
+       sys/utime.h \
        unistd.h \
        utime.h\
 )
@@ -216,6 +218,7 @@
        getgroups \
        getopt \
        getpagesize \
+       getpid \
        gettimeofday \
        initgroups \
        login \

Index: cvsnt.dep
===================================================================
RCS file: /cvsroot/cvs/ccvs/cvsnt.dep,v
retrieving revision 1.12.2.4
retrieving revision 1.12.2.5
diff -u -b -r1.12.2.4 -r1.12.2.5
--- cvsnt.dep   6 Nov 2004 02:54:35 -0000       1.12.2.4
+++ cvsnt.dep   7 May 2008 15:34:10 -0000       1.12.2.5
@@ -394,7 +394,6 @@
        ".\src\stack.h"\
        ".\src\update.h"\
        ".\windows-NT\config.h"\
-       ".\windows-NT\JmgStat.h"\
        ".\windows-NT\ndir.h"\
        ".\windows-NT\pwd.h"\
        
@@ -508,10 +507,6 @@
        ".\windows-NT\pwd.h"\
        
 
-".\windows-NT\JmgStat.c" : \
-       ".\windows-NT\JmgStat.h"\
-       
-
 .\src\lock.c : \
        ".\lib\getopt.h"\
        ".\lib\regex.h"\

Index: cvsnt.dsp
===================================================================
RCS file: /cvsroot/cvs/ccvs/cvsnt.dsp,v
retrieving revision 1.7.6.3
retrieving revision 1.7.6.4
diff -u -b -r1.7.6.3 -r1.7.6.4
--- cvsnt.dsp   8 Sep 2004 16:36:01 -0000       1.7.6.3
+++ cvsnt.dsp   7 May 2008 15:34:10 -0000       1.7.6.4
@@ -180,10 +180,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=".\windows-NT\JmgStat.c"
-# End Source File
-# Begin Source File
-
 SOURCE=.\src\lock.c
 # End Source File
 # Begin Source File
@@ -420,10 +416,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=".\windows-NT\JmgStat.h"
-# End Source File
-# Begin Source File
-
 SOURCE=.\lib\md5.h
 # End Source File
 # Begin Source File

Index: cvsnt.mak
===================================================================
RCS file: /cvsroot/cvs/ccvs/cvsnt.mak,v
retrieving revision 1.45.4.6
retrieving revision 1.45.4.7
diff -u -b -r1.45.4.6 -r1.45.4.7
--- cvsnt.mak   6 Nov 2004 02:54:35 -0000       1.45.4.6
+++ cvsnt.mak   7 May 2008 15:34:10 -0000       1.45.4.7
@@ -77,7 +77,6 @@
        address@hidden "$(INTDIR)\history.obj"
        address@hidden "$(INTDIR)\ignore.obj"
        address@hidden "$(INTDIR)\import.obj"
-       address@hidden "$(INTDIR)\JmgStat.obj"
        address@hidden "$(INTDIR)\lock.obj"
        address@hidden "$(INTDIR)\log.obj"
        address@hidden "$(INTDIR)\login.obj"
@@ -123,7 +122,7 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-CPP_PROJ=/nologo /ML /W3 /GX /Ob1 /I ".\windows-NT" /I ".\lib" /I ".\src" /I 
".\zlib" /I ".\diff" /I ".\WinDebug" /D "NDEBUG" /D "WANT_WIN_COMPILER_VERSION" 
/D "_CONSOLE" /D "HAVE_CONFIG_H" /D "WIN32" /Fp"$(INTDIR)\cvsnt.pch" /YX 
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+CPP_PROJ=/nologo /MD /W3  /Ob1 /I ".\windows-NT" /I ".\lib" /I ".\src" /I 
".\zlib" /I ".\diff" /I ".\WinDebug" /D "NDEBUG" /D "WANT_WIN_COMPILER_VERSION" 
/D "_CONSOLE" /D "HAVE_CONFIG_H" /D "WIN32" /Fp"$(INTDIR)\cvsnt.pch"  
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
 BSC32=bscmake.exe
 BSC32_FLAGS=/nologo /o"$(OUTDIR)\cvsnt.bsc" 
 BSC32_SBRS= \
@@ -154,7 +153,6 @@
        "$(INTDIR)\history.obj" \
        "$(INTDIR)\ignore.obj" \
        "$(INTDIR)\import.obj" \
-       "$(INTDIR)\JmgStat.obj" \
        "$(INTDIR)\lock.obj" \
        "$(INTDIR)\log.obj" \
        "$(INTDIR)\login.obj" \
@@ -199,9 +197,14 @@
        ".\lib\WinRel\libcvs.lib"
 
 "$(OUTDIR)\cvs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
-    $(LINK32) @<<
+    @type <<
+  $(LINK32) $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+    @$(LINK32) @<<
   $(LINK32_FLAGS) $(LINK32_OBJS)
 <<
+    mt.exe -NOLOGO -MANIFEST $(OUTDIR)/cvs.exe.manifest 
"-OUTPUTRESOURCE:$(OUTDIR)/cvs.exe;1"
+    rm -f $(OUTDIR)/cvs.exe.manifest
 
 !ELSEIF  "$(CFG)" == "cvsnt - Win32 Debug"
 
@@ -249,7 +252,6 @@
        address@hidden "$(INTDIR)\history.obj"
        address@hidden "$(INTDIR)\ignore.obj"
        address@hidden "$(INTDIR)\import.obj"
-       address@hidden "$(INTDIR)\JmgStat.obj"
        address@hidden "$(INTDIR)\lock.obj"
        address@hidden "$(INTDIR)\log.obj"
        address@hidden "$(INTDIR)\login.obj"
@@ -298,13 +300,27 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Ob1 /I ".\windows-NT" /I ".\lib" /I 
".\src" /I ".\zlib" /I ".\diff" /D "_DEBUG" /D "_CONSOLE" /D "HAVE_CONFIG_H" /D 
"WIN32" /D "WANT_WIN_COMPILER_VERSION" /Fp"$(INTDIR)\cvsnt.pch" /YX 
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+CPP_PROJ=/nologo /MD /W3 /Gm  /Zi /Ob1 /I ".\windows-NT" /I ".\lib" /I ".\src" 
/I ".\zlib" /I ".\diff" /D "_DEBUG" /D "_CONSOLE" /D "HAVE_CONFIG_H" /D "WIN32" 
/D "WANT_WIN_COMPILER_VERSION" /Fp"$(INTDIR)\cvsnt.pch"  /Fo"$(INTDIR)\\" 
/Fd"$(INTDIR)\\" /FD /c 
 BSC32=bscmake.exe
 BSC32_FLAGS=/nologo /o"$(OUTDIR)\cvsnt.bsc" 
 BSC32_SBRS= \
        
 LINK32=link.exe
-LINK32_FLAGS=diff\WinDebug\libdiff.lib lib\WinDebug\libcvs.lib 
zlib\WinDebug\libz.lib wsock32.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib 
uuid.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\cvs.pdb" 
/debug /machine:I386 /out:"$(OUTDIR)\cvs.exe" 
+LINK32_LIBS= \
+       wsock32.lib \
+       kernel32.lib \
+       user32.lib \
+       gdi32.lib \
+       winspool.lib \
+       comdlg32.lib \
+       advapi32.lib \
+       shell32.lib \
+       ole32.lib \
+       oleaut32.lib \
+       uuid.lib \
+       $(NULL)
+#LINK32_FLAGS=/nologo /subsystem:console /incremental:yes 
/pdb:"$(OUTDIR)\cvs.pdb" /debug /machine:I386 /out:"$(OUTDIR)\cvs.exe" 
/NODEFAULTLIB:LIBCMT
+LINK32_FLAGS=/nologo /subsystem:console /incremental:yes 
/pdb:"$(OUTDIR)\cvs.pdb" /debug /machine:I386  /NODEFAULTLIB:LIBCMT
 LINK32_OBJS= \
        "$(INTDIR)\add.obj" \
        "$(INTDIR)\admin.obj" \
@@ -329,7 +345,6 @@
        "$(INTDIR)\history.obj" \
        "$(INTDIR)\ignore.obj" \
        "$(INTDIR)\import.obj" \
-       "$(INTDIR)\JmgStat.obj" \
        "$(INTDIR)\lock.obj" \
        "$(INTDIR)\log.obj" \
        "$(INTDIR)\login.obj" \
@@ -369,19 +384,31 @@
        "$(INTDIR)\woe32.obj" \
        "$(INTDIR)\wrapper.obj" \
        "$(INTDIR)\zlib.obj" \
-       ".\diff\WinDebug\libdiff.lib" \
-       ".\zlib\WinDebug\libz.lib" \
-       ".\lib\WinDebug\libcvs.lib"
+       diff\WinDebug\libdiff.lib \
+       lib\WinDebug\libcvs.lib \
+       zlib\WinDebug\libz.lib \
+       $(NULL)
+
+
+
 
 "$(OUTDIR)\cvs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
-    $(LINK32) @<<
-  $(LINK32_FLAGS) $(LINK32_OBJS)
+    @type <<
+  cl -Fe$(OUTDIR)\cvs.exe $(LINK32_OBJS) $(LINK32_LIBS) -link $(LINK32_FLAGS)
+<<
+    @cl @<<
+  -Fe$(OUTDIR)\cvs.exe $(LINK32_OBJS) $(LINK32_LIBS) -link $(LINK32_FLAGS)
 <<
+    mt.exe -NOLOGO -MANIFEST $(OUTDIR)/cvs.exe.manifest 
"-OUTPUTRESOURCE:$(OUTDIR)/cvs.exe;1"
+    rm -f $(OUTDIR)/cvs.exe.manifest
 
 !ENDIF 
 
 .c{$(INTDIR)}.obj::
-   $(CPP) @<<
+   @type @<<
+   $(CPP) $(CPP_PROJ) $< 
+<<
+   @$(CPP) @<<
    $(CPP_PROJ) $< 
 <<
 
@@ -559,12 +586,6 @@
        $(CPP) $(CPP_PROJ) $(SOURCE)
 
 
-SOURCE=".\windows-NT\JmgStat.c"
-
-"$(INTDIR)\JmgStat.obj" : $(SOURCE) "$(INTDIR)"
-       $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
 SOURCE=.\src\lock.c
 
 "$(INTDIR)\lock.obj" : $(SOURCE) "$(INTDIR)"

Index: diff/ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/diff/ChangeLog,v
retrieving revision 1.61.4.13
retrieving revision 1.61.4.14
diff -u -b -r1.61.4.13 -r1.61.4.14
--- diff/ChangeLog      5 Sep 2005 01:31:57 -0000       1.61.4.13
+++ diff/ChangeLog      7 May 2008 15:34:10 -0000       1.61.4.14
@@ -1,3 +1,14 @@
+2008-05-07  Mark D. Baushke  <address@hidden>
+
+       * system.h (CVS_STAT, CVS_FSTAT): Add default values.
+
+       [bug #22781]
+       * diff.c, diff3.c: convert all stat and fstat calls to call 
+       CVS_STAT and CVS_FSTAT.
+       * system.h, util.c: remove declaration conflicts with system headers.
+       * libdiff.mak: Change CFLAGS to work with MSVC 2005 express.
+       (Patch from Nelson B Bolyard <address@hidden>.)
+       
 2005-09-04  Derek Price  <address@hidden>
 
        * Makefile.am (EXTRA_DIST): Add .cvsignore.

Index: diff/diff.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/diff/diff.c,v
retrieving revision 1.13.4.1
retrieving revision 1.13.4.2
diff -u -b -r1.13.4.1 -r1.13.4.2
--- diff/diff.c 20 Mar 2004 18:15:38 -0000      1.13.4.1
+++ diff/diff.c 7 May 2008 15:34:11 -0000       1.13.4.2
@@ -158,7 +158,7 @@
   f.desc = (strcmp (optarg, "-") == 0
            ? STDIN_FILENO
            : open (optarg, O_RDONLY, 0));
-  if (f.desc < 0 || fstat (f.desc, &f.stat) != 0)
+  if (f.desc < 0 || CVS_FSTAT (f.desc, &f.stat) != 0)
     return -1;
 
   sip (&f, 1);
@@ -996,7 +996,7 @@
          else if (strcmp (inf[i].name, "-") == 0)
            {
              inf[i].desc = STDIN_FILENO;
-             stat_result = fstat (STDIN_FILENO, &inf[i].stat);
+             stat_result = CVS_FSTAT (STDIN_FILENO, &inf[i].stat);
              if (stat_result == 0 && S_ISREG (inf[i].stat.st_mode))
                {
                  off_t pos = lseek (STDIN_FILENO, (off_t) 0, SEEK_CUR);
@@ -1014,7 +1014,7 @@
                }
            }
          else
-           stat_result = stat (inf[i].name, &inf[i].stat);
+           stat_result = CVS_STAT (inf[i].name, &inf[i].stat);
 
          if (stat_result != 0)
            {
@@ -1049,7 +1049,7 @@
       if (strcmp (fnm, "-") == 0)
        fatal ("can't compare - to a directory");
 
-      if (stat (filename, &inf[dir_arg].stat) != 0)
+      if (CVS_STAT (filename, &inf[dir_arg].stat) != 0)
        {
          perror_with_name (filename);
          failed = 1;

Index: diff/diff3.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/diff/diff3.c,v
retrieving revision 1.14.6.1
retrieving revision 1.14.6.2
diff -u -b -r1.14.6.1 -r1.14.6.2
--- diff/diff3.c        13 Jun 2003 14:51:24 -0000      1.14.6.1
+++ diff/diff3.c        7 May 2008 15:34:11 -0000       1.14.6.2
@@ -415,7 +415,7 @@
   for (i = 0; i < 3; i++)
     if (strcmp (file[i], "-") != 0)
       {
-       if (stat (file[i], &statb) < 0)
+       if (CVS_STAT (file[i], &statb) < 0)
          {
            perror_with_name (file[i]);
            return 2;
@@ -1070,7 +1070,9 @@
  * Routines to input and parse two way diffs.
  */
 
+#if !(HAVE_STDLIB_H || defined(STDC_HEADERS))
 extern char **environ;
+#endif
 
 static struct diff_block *
 process_diff (filea, fileb, last_block, diff_contents)
@@ -1330,7 +1332,7 @@
     diff3_fatal ("could not open temporary diff file");
 
   current_chunk_size = 8 * 1024;
-  if (fstat (fd, &pipestat) == 0)
+  if (CVS_FSTAT (fd, &pipestat) == 0)
     current_chunk_size = max (current_chunk_size, STAT_BLOCKSIZE (pipestat));
 
   diff_result = xmalloc (current_chunk_size);

Index: diff/libdiff.mak
===================================================================
RCS file: /cvsroot/cvs/ccvs/diff/libdiff.mak,v
retrieving revision 1.14.2.2
retrieving revision 1.14.2.3
diff -u -b -r1.14.2.2 -r1.14.2.3
--- diff/libdiff.mak    15 May 2004 17:24:27 -0000      1.14.2.2
+++ diff/libdiff.mak    7 May 2008 15:34:11 -0000       1.14.2.3
@@ -70,7 +70,7 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\windows-NT" /I "..\lib" /D "_WINDOWS" 
/D "HAVE_TIME_H" /D "CLOSEDIR_VOID" /D "NDEBUG" /D "WIN32" /D 
"WANT_WIN_COMPILER_VERSION" /Fp"$(INTDIR)\libdiff.pch" /YX /Fo"$(INTDIR)\\" 
/Fd"$(INTDIR)\\" /FD /c 
+CPP_PROJ=/nologo /MD /W3  /O2 /I "..\windows-NT" /I "..\lib" /D "_WINDOWS" /D 
"HAVE_TIME_H" /D "CLOSEDIR_VOID" /D "NDEBUG" /D "WIN32" /D 
"WANT_WIN_COMPILER_VERSION" /Fp"$(INTDIR)\libdiff.pch"  /Fo"$(INTDIR)\\" 
/Fd"$(INTDIR)\\" /FD /c 
 BSC32=bscmake.exe
 BSC32_FLAGS=/nologo /o"$(OUTDIR)\libdiff.bsc" 
 BSC32_SBRS= \
@@ -94,7 +94,10 @@
        "..\lib\WinRel\libcvs.lib"
 
 "$(OUTDIR)\libdiff.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
-    $(LIB32) @<<
+    @type <<
+    $(LIB32) $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+    @$(LIB32) @<<
   $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
 <<
 
@@ -140,7 +143,7 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-CPP_PROJ=/nologo /MLd /W3 /GX /Z7 /Od /I "..\windows-NT" /I "..\lib" /D 
"_DEBUG" /D "_WINDOWS" /D "WIN32" /D "HAVE_TIME_H" /D "CLOSEDIR_VOID" 
/Fp"$(INTDIR)\libdiff.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+CPP_PROJ=/nologo /MD /W3  /Z7 /Od /I "..\windows-NT" /I "..\lib" /D "_DEBUG" 
/D "_WINDOWS" /D "WIN32" /D "HAVE_TIME_H" /D "CLOSEDIR_VOID" 
/Fp"$(INTDIR)\libdiff.pch"  /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
 BSC32=bscmake.exe
 BSC32_FLAGS=/nologo /o"$(OUTDIR)\libdiff.bsc" 
 BSC32_SBRS= \
@@ -164,14 +167,20 @@
        "..\lib\WinDebug\libcvs.lib"
 
 "$(OUTDIR)\libdiff.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
-    $(LIB32) @<<
+    @type <<
+    $(LIB32) $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+    @$(LIB32) @<<
   $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
 <<
 
 !ENDIF 
 
 .c{$(INTDIR)}.obj::
-   $(CPP) @<<
+   @type <<
+   $(CPP) $(CPP_PROJ) $< 
+<<
+   @$(CPP) @<<
    $(CPP_PROJ) $< 
 <<
 

Index: diff/system.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/diff/system.h,v
retrieving revision 1.8.4.1
retrieving revision 1.8.4.2
diff -u -b -r1.8.4.1 -r1.8.4.2
--- diff/system.h       9 May 2003 22:19:54 -0000       1.8.4.1
+++ diff/system.h       7 May 2008 15:34:11 -0000       1.8.4.2
@@ -175,10 +175,10 @@
 #else
 VOID *malloc ();
 VOID *realloc ();
-#endif
 #ifndef getenv
 char *getenv ();
 #endif
+#endif
 
 #if HAVE_LIMITS_H
 #include <limits.h>
@@ -302,3 +302,9 @@
 #ifndef CVS_CLOSEDIR
 #define CVS_CLOSEDIR closedir
 #endif
+#ifndef CVS_STAT
+#define CVS_STAT stat
+#endif
+#ifndef CVS_FSTAT
+#define CVS_FSTAT fstat
+#endif

Index: diff/util.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/diff/util.c,v
retrieving revision 1.12.6.1
retrieving revision 1.12.6.2
diff -u -b -r1.12.6.1 -r1.12.6.2
--- diff/util.c 17 Feb 2003 19:59:47 -0000      1.12.6.1
+++ diff/util.c 7 May 2008 15:34:11 -0000       1.12.6.2
@@ -23,10 +23,6 @@
 #include <varargs.h>
 #endif
 
-#ifndef strerror
-extern char *strerror ();
-#endif
-
 /* Queue up one-line messages to be printed at the end,
    when -l is specified.  Each message is recorded with a `struct msg'.  */
 

Index: lib/ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/ChangeLog,v
retrieving revision 1.169.2.38
retrieving revision 1.169.2.39
diff -u -b -r1.169.2.38 -r1.169.2.39
--- lib/ChangeLog       23 Jun 2006 19:40:44 -0000      1.169.2.38
+++ lib/ChangeLog       7 May 2008 15:34:11 -0000       1.169.2.39
@@ -1,3 +1,16 @@
+2008-05-07  Mark D. Baushke  <address@hidden>
+
+       [bug #22781]
+       * ftruncate.c, mkdir.c, rename.c: change stat and fstat calls
+       to call CVS_STAT and CVS_FSTAT.
+       * regex.c: substitute errorCode for reserved word errcode
+       * system.h: get symbols from system header files rather 
+       than using conflicting substitute declarations.
+       Don't assume that time_t is long. 
+       Define CVS_FSTAT as fstat and CVS_UTIME as utime for 
+       non-Windows platforms.
+       * libcvs.mak: Change CFLAGS to work with MSVC 2005 express.
+
 2006-06-23  Larry Jones  <address@hidden>
 
        * xsize.h: Avoid SGI problem with <stdint.h> being unusable in C89

Index: lib/ftruncate.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/ftruncate.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.16.1
diff -u -b -r1.1.1.1 -r1.1.1.1.16.1
--- lib/ftruncate.c     3 Dec 1994 06:09:32 -0000       1.1.1.1
+++ lib/ftruncate.c     7 May 2008 15:34:12 -0000       1.1.1.1.16.1
@@ -33,7 +33,7 @@
   struct flock fl;
   struct stat filebuf;
 
-  if (fstat (fd, &filebuf) < 0)
+  if (CVS_FSTAT (fd, &filebuf) < 0)
     return -1;
 
   if (filebuf.st_size < length)

Index: lib/libcvs.mak
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/libcvs.mak,v
retrieving revision 1.5.2.2
retrieving revision 1.5.2.3
diff -u -b -r1.5.2.2 -r1.5.2.3
--- lib/libcvs.mak      15 May 2004 17:25:14 -0000      1.5.2.2
+++ lib/libcvs.mak      7 May 2008 15:34:12 -0000       1.5.2.3
@@ -62,7 +62,7 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\windows-NT" /I "." /D "WIN32" /D 
"NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)\libcvs.pch" /YX 
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+CPP_PROJ=/nologo /MD /W3  /O2 /I "..\windows-NT" /I "." /D "WIN32" /D "NDEBUG" 
/D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)\libcvs.pch"  
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
 BSC32=bscmake.exe
 BSC32_FLAGS=/nologo /o"$(OUTDIR)\libcvs.bsc" 
 BSC32_SBRS= \
@@ -87,7 +87,10 @@
        "$(INTDIR)\yesno.obj"
 
 "$(OUTDIR)\libcvs.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
-    $(LIB32) @<<
+    @type <<
+    $(LIB32) $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+    @$(LIB32) @<<
   $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
 <<
 
@@ -125,7 +128,7 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-CPP_PROJ=/nologo /MLd /W3 /Gm /GX /ZI /Od /I "..\windows-NT" /I "." /D "WIN32" 
/D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)\libcvs.pch" 
/YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c 
+CPP_PROJ=/nologo /MD /W3 /Gm  /ZI /Od /I "..\windows-NT" /I "." /D "WIN32" /D 
"_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)\libcvs.pch"  
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD  /c 
 BSC32=bscmake.exe
 BSC32_FLAGS=/nologo /o"$(OUTDIR)\libcvs.bsc" 
 BSC32_SBRS= \
@@ -150,14 +153,20 @@
        "$(INTDIR)\yesno.obj"
 
 "$(OUTDIR)\libcvs.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
-    $(LIB32) @<<
+    @type <<
+    $(LIB32) $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+    @$(LIB32) @<<
   $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
 <<
 
 !ENDIF 
 
 .c{$(INTDIR)}.obj::
-   $(CPP) @<<
+   @type <<
+   $(CPP) $(CPP_PROJ) $< 
+<<
+   @$(CPP) @<<
    $(CPP_PROJ) $< 
 <<
 

Index: lib/mkdir.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/mkdir.c,v
retrieving revision 1.3.8.1
retrieving revision 1.3.8.2
diff -u -b -r1.3.8.1 -r1.3.8.2
--- lib/mkdir.c 20 Mar 2004 18:15:49 -0000      1.3.8.1
+++ lib/mkdir.c 7 May 2008 15:34:12 -0000       1.3.8.2
@@ -43,7 +43,7 @@
   int cpid, status;
   struct stat statbuf;
 
-  if (stat (dpath, &statbuf) == 0)
+  if (CVS_STAT (dpath, &statbuf) == 0)
     {
       errno = EEXIST;          /* stat worked, so it already exists. */
       return -1;
@@ -92,7 +92,7 @@
   int cpid, status;
   struct stat statbuf;
 
-  if (stat (dpath, &statbuf) != 0)
+  if (CVS_STAT (dpath, &statbuf) != 0)
     return -1;                 /* stat set errno. */
 
   if ((statbuf.st_mode & S_IFMT) != S_IFDIR)

Index: lib/regex.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/regex.c,v
retrieving revision 1.12.4.3
retrieving revision 1.12.4.4
diff -u -b -r1.12.4.3 -r1.12.4.4
--- lib/regex.c 5 Oct 2004 16:29:22 -0000       1.12.4.3
+++ lib/regex.c 7 May 2008 15:34:12 -0000       1.12.4.4
@@ -6313,8 +6313,8 @@
    from either regcomp or regexec.   We don't use PREG here.  */
 
 size_t
-regerror (errcode, preg, errbuf, errbuf_size)
-    int errcode;
+regerror (errorCode, preg, errbuf, errbuf_size)
+    int errorCode;
     const regex_t *preg;
     char *errbuf;
     size_t errbuf_size;
@@ -6322,15 +6322,15 @@
   const char *msg;
   size_t msg_size;
 
-  if (errcode < 0
-      || errcode >= (sizeof (re_error_msgid) / sizeof (re_error_msgid[0])))
+  if (errorCode < 0
+      || errorCode >= (sizeof (re_error_msgid) / sizeof (re_error_msgid[0])))
     /* Only error codes returned by the rest of the code should be passed
        to this routine.  If we are given anything else, or if other regex
        code generates an invalid error code, then the program has a bug.
        Dump core so we can fix it.  */
     abort ();
 
-  msg = gettext (re_error_msgid[errcode]);
+  msg = gettext (re_error_msgid[errorCode]);
 
   msg_size = strlen (msg) + 1; /* Includes the null.  */
 

Index: lib/rename.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/rename.c,v
retrieving revision 1.6
retrieving revision 1.6.6.1
diff -u -b -r1.6 -r1.6.6.1
--- lib/rename.c        10 Jan 2001 19:00:16 -0000      1.6
+++ lib/rename.c        7 May 2008 15:34:12 -0000       1.6.6.1
@@ -33,7 +33,7 @@
   struct stat from_stats;
   int pid, status;
 
-  if (stat (from, &from_stats) == 0)
+  if (CVS_STAT (from, &from_stats) == 0)
     {
       /* We don't check existence_error because the systems which need it
         have rename().  */

Index: lib/system.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/system.h,v
retrieving revision 1.43.4.12
retrieving revision 1.43.4.13
diff -u -b -r1.43.4.12 -r1.43.4.13
--- lib/system.h        15 Nov 2005 00:10:51 -0000      1.43.4.12
+++ lib/system.h        7 May 2008 15:34:12 -0000       1.43.4.13
@@ -157,9 +157,13 @@
 #include <unistd.h>
 #include <limits.h>
 #else
+#ifndef HAVE_IO_H
 off_t lseek ();
+#endif
+#ifndef HAVE_DIRECT_H
 char *getcwd ();
 #endif
+#endif
 
 #include "xtime.h"
 
@@ -251,8 +255,8 @@
 #    ifndef ALTOS
 struct utimbuf
 {
-  long actime;
-  long modtime;
+  time_t actime;
+  time_t modtime;
 };
 #    endif
 int utime ();
@@ -288,7 +292,7 @@
 #endif
 
 
-#ifdef STDC_HEADERS
+#if HAVE_STDLIB_H || defined(STDC_HEADERS)
 # include <stdlib.h>
 #else
 char *getenv ();
@@ -448,10 +452,18 @@
 # define CVS_LSTAT lstat
 #endif
 
+#ifndef CVS_FSTAT
+# define CVS_FSTAT fstat
+#endif
+
 #ifndef CVS_UNLINK
 # define CVS_UNLINK unlink
 #endif
 
+#ifndef CVS_UTIME
+# define CVS_UTIME utime
+#endif
+
 /* Wildcard matcher.  Should be case-insensitive if the system is.  */
 #ifndef CVS_FNMATCH
 # define CVS_FNMATCH fnmatch

Index: src/ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/ChangeLog,v
retrieving revision 1.2336.2.505
retrieving revision 1.2336.2.506
diff -u -b -r1.2336.2.505 -r1.2336.2.506
--- src/ChangeLog       24 Mar 2008 08:57:08 -0000      1.2336.2.505
+++ src/ChangeLog       7 May 2008 15:34:12 -0000       1.2336.2.506
@@ -1,3 +1,43 @@
+2008-05-07  Mark D. Baushke  <address@hidden>
+
+       * client.c (read_counted_file): Set errno = 0 before CVS_FOPEN
+       because Standard C doesn't require errno be set on error.
+       (set_sticky, send_repository): Ditto.
+       * create_adm.c (Create_Admin): Ditto.
+       * edit.c (ncheck_fileproc, cvs_notify_check): Ditto.
+       * entries.c (write_entries, Register, Subdirs_Known, base_walk):
+       Ditto.
+       * ignore.c (ign_add_file): Ditto.
+       * import.c (add_rcs_file): Ditto.
+       * lock.c (Reader_Lock, write_lock): Ditto.
+       * login.c (password_entry_operation): Ditto.
+       * logmsg.c (do_editor, rcsinfo_proc): Ditto.
+       * myndbm.c (mydbm_open, mydbm_close): Ditto.
+       * parseinfo.c (Parse_Info, parse_config): Ditto.
+       * rcs.c (RCS_parse, RCS_parsercsfile, RCS_checkout)
+       (RCS_cmp_file, rcsbuf_cache_open):  Ditto.
+       * repos.c (Name_Repository): 
+       * server.c (create_adm_p, dirswitch, serve_static_directory)
+       (serve_sticky, server_write_entries, server_updated)
+       (template_proc): Ditto. 
+       * subr.c (file_has_markers): Ditto.
+       * update.c (patch_file): Ditto.
+       * wrapper.c (wrap_add_file): Ditto.
+
+       * rcs.c (rcsbuf_cache_open): Pass errno to error() calls from
+       CVS_FOPEN and fseek on failure.
+
+       [bug #22781]
+       * buffer.c, client.c, filesubr.c, hardlink.c, history.c, patch.c, 
+       rcs.c, run.c, server.c, update.c, vers_ts.c:
+       Change stat, fstat and utime calls to call CVS_STAT CVS_FSTAT and
+       CVS_UTIME.
+       * client.c, vers_ts.c: add conditionally compiled debug printfs.
+       * cvsrc.c, error.c: remove declaration conflicts with system headers.
+       * login.c: add missing declaration of getpass.
+       * subr.c: don't assume time_t is long.
+       (Patch from Nelson B Bolyard <address@hidden>.)
+
 2008-03-23  Mark D. Baushke  <address@hidden>
 
        [bug #22710]

Index: src/buffer.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/buffer.c,v
retrieving revision 1.21.4.15
retrieving revision 1.21.4.16
diff -u -b -r1.21.4.15 -r1.21.4.16
--- src/buffer.c        4 May 2006 09:53:09 -0000       1.21.4.15
+++ src/buffer.c        7 May 2008 15:34:13 -0000       1.21.4.16
@@ -1429,7 +1429,7 @@
      * fstat() will return -1 on the server if the client has gone
      * away.
      */
-    if (fstat(fileno(bc->fp), &s) == -1) statted = 0;
+    if (CVS_FSTAT(fileno(bc->fp), &s) == -1) statted = 0;
     else statted = 1;
     closefp = statted;
 

Index: src/client.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/client.c,v
retrieving revision 1.318.4.48
retrieving revision 1.318.4.49
diff -u -b -r1.318.4.48 -r1.318.4.49
--- src/client.c        28 Jan 2008 01:22:54 -0000      1.318.4.48
+++ src/client.c        7 May 2008 15:34:13 -0000       1.318.4.49
@@ -1545,6 +1545,7 @@
        is binary or not.  I haven't carefully looked into whether
        CVS/Template files should use local text file conventions or
        not.  */
+    errno = 0;  /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (filename, "wb");
     if (fp == NULL)
        error (1, errno, "cannot write %s", fullname);
@@ -1693,6 +1694,9 @@
        error (0, 0, "protocol error: cannot parse date %s", args);
     else
        stored_modtime_valid = 1;
+#ifdef DEBUG_TIMESTAMPS
+    printf("stored_modtime = %llu, 0x%llX\n", stored_modtime, stored_modtime);
+#endif
 }
 
 /*
@@ -2136,6 +2140,7 @@
             * here using text mode, so its lines will be terminated the same
             * way they were transmitted.
             */
+           errno = 0; /* Standard C doesn't require errno be set on error */
            e = CVS_FOPEN (filename, "r");
            if (e == NULL)
                error (1, errno, "could not open %s", short_pathname);
@@ -2217,7 +2222,7 @@
        }
 #endif  /* UTIME_EXPECTS_WRITABLE  */
 
-       if (utime (filename, &t) < 0)
+       if (CVS_UTIME (filename, &t) < 0)
            error (0, errno, "cannot set time on %s", filename);
 
 #ifdef UTIME_EXPECTS_WRITABLE
@@ -2513,6 +2518,7 @@
     read_line (&tagspec);
 
     /* FIXME-update-dir: error messages should include the directory.  */
+    errno = 0; /* Standard C doesn't require errno be set on error */
     f = CVS_FOPEN (CVSADM_TAG, "w+");
     if (f == NULL)
     {
@@ -2807,6 +2813,7 @@
        else
            sprintf (adm_name, "%s/%s", dir, CVSADM_TAG);
 
+       errno = 0; /* Standard C doesn't require errno be set on error */
        f = CVS_FOPEN (adm_name, "r");
        if (f == NULL)
        {
@@ -3865,7 +3872,7 @@
        int fd = fp ? fileno(fp) : -1;
        struct stat s;
 
-       if ((fd < 0) || (fstat (fd, &s) < 0) || !S_ISSOCK(s.st_mode))
+       if ((fd < 0) || (CVS_FSTAT (fd, &s) < 0) || !S_ISSOCK(s.st_mode))
        {
            error (1, 0, "gserver currently only enabled for socket 
connections");
        }

Index: src/create_adm.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/create_adm.c,v
retrieving revision 1.37.4.2
retrieving revision 1.37.4.3
diff -u -b -r1.37.4.2 -r1.37.4.3
--- src/create_adm.c    31 Jan 2005 22:15:11 -0000      1.37.4.2
+++ src/create_adm.c    7 May 2008 15:34:13 -0000       1.37.4.3
@@ -91,6 +91,7 @@
        (void) sprintf (tmp, "%s/%s", dir, CVSADM_REP);
     else
        (void) strcpy (tmp, CVSADM_REP);
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fout = CVS_FOPEN (tmp, "w+");
     if (fout == NULL)
     {
@@ -149,6 +150,7 @@
        (void) sprintf (tmp, "%s/%s", dir, CVSADM_ENT);
     else
        (void) strcpy (tmp, CVSADM_ENT);
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fout = CVS_FOPEN (tmp, "w+");
     if (fout == NULL)
     {

Index: src/cvsrc.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/cvsrc.c,v
retrieving revision 1.22.4.3
retrieving revision 1.22.4.4
diff -u -b -r1.22.4.3 -r1.22.4.4
--- src/cvsrc.c 31 Mar 2006 19:48:30 -0000      1.22.4.3
+++ src/cvsrc.c 7 May 2008 15:34:14 -0000       1.22.4.4
@@ -26,8 +26,6 @@
 
 #define        GROW    10
 
-extern char *strtok ();
-
 /* Read cvsrc, processing options matching CMDNAME ("cvs" for global
    options, and update *ARGC and *ARGV accordingly.  */
 

Index: src/edit.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/edit.c,v
retrieving revision 1.57.4.9
retrieving revision 1.57.4.10
diff -u -b -r1.57.4.9 -r1.57.4.10
--- src/edit.c  25 Jan 2008 00:11:29 -0000      1.57.4.9
+++ src/edit.c  7 May 2008 15:34:14 -0000       1.57.4.10
@@ -178,6 +178,7 @@
     /* We send notifications even if noexec.  I'm not sure which behavior
        is most sensible.  */
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (CVSADM_NOTIFY, "r");
     if (fp == NULL)
     {
@@ -899,6 +900,7 @@
            strcat (usersname, CVSROOTADM);
            strcat (usersname, "/");
            strcat (usersname, CVSROOTADM_USERS);
+           errno = 0; /* Standard C doesn't require errno be set on error */
            fp = CVS_FOPEN (usersname, "r");
            if (fp == NULL && !existence_error (errno))
                error (0, errno, "cannot read %s", usersname);
@@ -1008,6 +1010,7 @@
     /* We send notifications even if noexec.  I'm not sure which behavior
        is most sensible.  */
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (CVSADM_NOTIFY, "r");
     if (fp == NULL)
     {

Index: src/entries.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/entries.c,v
retrieving revision 1.46.6.6
retrieving revision 1.46.6.7
diff -u -b -r1.46.6.6 -r1.46.6.7
--- src/entries.c       12 May 2006 15:17:38 -0000      1.46.6.6
+++ src/entries.c       7 May 2008 15:34:14 -0000       1.46.6.7
@@ -122,6 +122,7 @@
 
     /* open the new one and walk the list writing entries */
     entfilename = CVSADM_ENTBAK;
+    errno = 0; /* Standard C doesn't require errno be set on error */
     entfile = CVS_FOPEN (entfilename, "w+");
     if (entfile == NULL)
     {
@@ -252,6 +253,7 @@
     if (!noexec)
     {
        entfilename = CVSADM_ENTLOG;
+       errno = 0; /* Standard C doesn't require errno be set on error */
        entfile = CVS_FOPEN (entfilename, "a");
 
        if (entfile == NULL)
@@ -502,6 +504,7 @@
 
     sawdir = 0;
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fpin = CVS_FOPEN (CVSADM_ENT, "r");
     if (fpin == NULL)
     {
@@ -817,6 +820,7 @@
        {
            /* Create Entries.Log so that Entries_Close will do something.  */
            entfilename = CVSADM_ENTLOG;
+           errno = 0; /* Standard C doesn't require errno be set on error */
            fp = CVS_FOPEN (entfilename, "a");
            if (fp == NULL)
            {
@@ -865,6 +869,7 @@
            sprintf (entfilename, "%s/%s", parent, CVSADM_ENTLOG);
        }
 
+       errno = 0; /* Standard C doesn't require errno be set on error */
        entfile = CVS_FOPEN (entfilename, "a");
        if (entfile == NULL)
        {
@@ -1048,6 +1053,7 @@
     strcat (baserev_fullname, CVSADM_BASEREV);
     strcat (baserevtmp_fullname, CVSADM_BASEREVTMP);
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (CVSADM_BASEREV, "r");
     if (fp == NULL)
     {
@@ -1062,6 +1068,7 @@
     {
        case BASE_REGISTER:
        case BASE_DEREGISTER:
+           errno = 0; /* Standard C doesn't require errno be set on error */
            newf = CVS_FOPEN (CVSADM_BASEREVTMP, "w");
            if (newf == NULL)
            {

Index: src/error.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/error.c,v
retrieving revision 1.26.6.1
retrieving revision 1.26.6.2
diff -u -b -r1.26.6.1 -r1.26.6.2
--- src/error.c 20 Mar 2004 22:25:49 -0000      1.26.6.1
+++ src/error.c 7 May 2008 15:34:14 -0000       1.26.6.2
@@ -57,10 +57,6 @@
 #endif /* __STDC__ */
 #endif /* STDC_HEADERS */
 
-#ifndef strerror
-extern char *strerror ();
-#endif
-
 void
 error_exit PROTO ((void))
 {

Index: src/fileattr.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/fileattr.c,v
retrieving revision 1.19.6.3
retrieving revision 1.19.6.4
diff -u -b -r1.19.6.3 -r1.19.6.4
--- src/fileattr.c      11 Mar 2005 16:52:29 -0000      1.19.6.3
+++ src/fileattr.c      7 May 2008 15:34:14 -0000       1.19.6.4
@@ -89,6 +89,7 @@
     strcat (fname, CVSREP_FILEATTR);
 
     attr_read_attempted = 1;
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (fname, FOPEN_BINARY_READ);
     if (fp == NULL)
     {
@@ -570,6 +571,7 @@
     }
 
     omask = umask (cvsumask);
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (fname, FOPEN_BINARY_WRITE);
     if (fp == NULL)
     {
@@ -596,6 +598,7 @@
            }
            free (repname);
 
+           errno = 0; /* Standard C doesn't require errno be set on error */
            fp = CVS_FOPEN (fname, FOPEN_BINARY_WRITE);
        }
        if (fp == NULL)

Index: src/filesubr.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/filesubr.c,v
retrieving revision 1.59.4.21
retrieving revision 1.59.4.22
diff -u -b -r1.59.4.21 -r1.59.4.22
--- src/filesubr.c      28 Jan 2008 01:22:54 -0000      1.59.4.21
+++ src/filesubr.c      7 May 2008 15:34:14 -0000       1.59.4.22
@@ -67,7 +67,7 @@
        /* Not a link or a device... probably a regular file. */
        if ((fdin = open (from, O_RDONLY)) < 0)
            error (1, errno, "cannot open %s for copying", from);
-       if (fstat (fdin, &sb) < 0)
+       if (CVS_FSTAT (fdin, &sb) < 0)
            error (1, errno, "cannot fstat %s", from);
        if ((fdout = creat (to, (int) sb.st_mode & 07777)) < 0)
            error (1, errno, "cannot create %s for copying", to);
@@ -111,7 +111,7 @@
     memset ((char *) &t, 0, sizeof (t));
     t.actime = sb.st_atime;
     t.modtime = sb.st_mtime;
-    (void) utime (to, &t);
+    (void) CVS_UTIME (to, &t);
 }
 
 /* FIXME-krp: these functions would benefit from caching the char * &

Index: src/hardlink.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/hardlink.c,v
retrieving revision 1.6.6.2
retrieving revision 1.6.6.3
diff -u -b -r1.6.6.2 -r1.6.6.3
--- src/hardlink.c      9 Mar 2005 19:47:15 -0000       1.6.6.2
+++ src/hardlink.c      7 May 2008 15:34:14 -0000       1.6.6.3
@@ -66,7 +66,7 @@
        inode, so it requires two bytes of text to represent
        each byte of the inode number. */
     inodestr = (char *) xmalloc (2*sizeof(ino_t) + 1);
-    if (stat (file, &sb) < 0)
+    if (CVS_STAT (file, &sb) < 0)
     {
        if (existence_error (errno))
        {
@@ -189,7 +189,7 @@
        linkage for a file would always fail. */
     (void) lookup_file_by_inode (path);
 
-    if (stat (path, &sb) < 0)
+    if (CVS_STAT (path, &sb) < 0)
        error (1, errno, "cannot stat %s", file);
     /* inodestr contains the hexadecimal representation of an
        inode, so it requires two bytes of text to represent

Index: src/history.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/history.c,v
retrieving revision 1.58.4.16
retrieving revision 1.58.4.17
diff -u -b -r1.58.4.16 -r1.58.4.17
--- src/history.c       19 Apr 2006 19:07:01 -0000      1.58.4.16
+++ src/history.c       7 May 2008 15:34:14 -0000       1.58.4.17
@@ -1115,7 +1115,7 @@
     if ((fd = CVS_OPEN (fname, O_RDONLY | OPEN_BINARY)) < 0)
        error (1, errno, "cannot open history file: %s", fname);
 
-    if (fstat (fd, &st_buf) < 0)
+    if (CVS_FSTAT (fd, &st_buf) < 0)
        error (1, errno, "can't stat history file");
 
     if (!(st_buf.st_size))

Index: src/ignore.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/ignore.c,v
retrieving revision 1.39.4.9
retrieving revision 1.39.4.10
diff -u -b -r1.39.4.9 -r1.39.4.10
--- src/ignore.c        2 Sep 2005 19:37:33 -0000       1.39.4.9
+++ src/ignore.c        7 May 2008 15:34:15 -0000       1.39.4.10
@@ -151,6 +151,7 @@
     }
 
     /* load the file */
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (file, "r");
     if (fp == NULL)
     {

Index: src/import.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/import.c,v
retrieving revision 1.133.4.20
retrieving revision 1.133.4.21
diff -u -b -r1.133.4.20 -r1.133.4.21
--- src/import.c        19 Dec 2007 20:44:16 -0000      1.133.4.20
+++ src/import.c        7 May 2008 15:34:15 -0000       1.133.4.21
@@ -1119,6 +1119,7 @@
     fpuser = NULL;
     if (!preserve_perms || file_type == S_IFREG)
     {
+       errno = 0; /* Standard C doesn't require errno be set on error */
        fpuser = CVS_FOPEN (userfile,
                            ((key_opt != NULL && strcmp (key_opt, "b") == 0)
                             ? "rb"
@@ -1135,6 +1136,7 @@
        }
     }
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fprcs = CVS_FOPEN (rcs, "w+b");
     if (fprcs == NULL)
     {

Index: src/lock.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/lock.c,v
retrieving revision 1.59.4.21
retrieving revision 1.59.4.22
diff -u -b -r1.59.4.21 -r1.59.4.22
--- src/lock.c  19 Dec 2007 20:44:16 -0000      1.59.4.21
+++ src/lock.c  7 May 2008 15:34:15 -0000       1.59.4.22
@@ -81,6 +81,9 @@
 # endif /* !defined HAVE_USLEEP && defined HAVE_SELECT */
 #endif /* !HAVE_NANOSLEEP */
 
+#ifdef HAVE_PROCESS_H
+# include <process.h>
+#endif
 
 struct lock {
     /* This is the directory in which we may have a lock named by the
@@ -461,6 +464,7 @@
 
     /* write a read-lock */
     tmp = lock_name (xrepository, readlock);
+    errno = 0; /* Standard C doesn't require errno be set on error */
     if ((fp = CVS_FOPEN (tmp, "w+")) == NULL || fclose (fp) == EOF)
     {
        error (0, errno, "cannot create read lock in repository `%s'",
@@ -619,6 +623,7 @@
 
        /* write the write-lock file */
        tmp = lock_name (lock->repository, writelock);
+       errno = 0; /* Standard C doesn't require errno be set on error */
        if ((fp = CVS_FOPEN (tmp, "w+")) == NULL || fclose (fp) == EOF)
        {
            int xerrno = errno;

Index: src/login.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/login.c,v
retrieving revision 1.70.4.10
retrieving revision 1.70.4.11
diff -u -b -r1.70.4.10 -r1.70.4.11
--- src/login.c 19 Dec 2007 20:44:16 -0000      1.70.4.10
+++ src/login.c 7 May 2008 15:34:15 -0000       1.70.4.11
@@ -14,6 +14,7 @@
 
 #include "cvs.h"
 #include "getline.h"
+extern char * getpass (const char *prompt);
 
 #ifdef AUTH_CLIENT_SUPPORT   /* This covers the rest of the file. */
 
@@ -310,6 +311,7 @@
      */
 
     passfile = construct_cvspass_filename ();
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (passfile, "r");
     if (fp == NULL)
     {
@@ -381,6 +383,7 @@
        FILE *tmp_fp;
 
        /* open the original file again */
+       errno = 0; /* Standard C doesn't require errno be set on error */
        fp = CVS_FOPEN (passfile, "r");
        if (fp == NULL)
            error (1, errno, "failed to open %s for reading", passfile);
@@ -455,6 +458,7 @@
     if (!noexec && operation == password_entry_add
            && (password == NULL || strcmp (password, newpassword)))
     {
+       errno = 0; /* Standard C doesn't require errno be set on error */
        if ((fp = CVS_FOPEN (passfile, "a")) == NULL)
            error (1, errno, "could not open %s for writing", passfile);
 

Index: src/logmsg.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/logmsg.c,v
retrieving revision 1.62.4.12
retrieving revision 1.62.4.13
diff -u -b -r1.62.4.12 -r1.62.4.13
--- src/logmsg.c        12 May 2006 15:17:38 -0000      1.62.4.12
+++ src/logmsg.c        7 May 2008 15:34:15 -0000       1.62.4.13
@@ -216,6 +216,7 @@
      */
     fname = cvs_temp_name ();
   again:
+    errno = 0; /* Standard C doesn't require errno be set on error */
     if ((fp = CVS_FOPEN (fname, "w+")) == NULL)
        error (1, 0, "cannot create temporary file %s", fname);
 
@@ -239,6 +240,7 @@
        size_t nwrite;
 
        /* Why "b"?  */
+       errno = 0; /* Standard C doesn't require errno be set on error */
        tfp = CVS_FOPEN (CVSADM_TEMPLATE, "rb");
        if (tfp == NULL)
        {
@@ -571,6 +573,7 @@
        free (last_template);
     last_template = xstrdup (template);
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     if ((tfp = CVS_FOPEN (template, "r")) != NULL)
     {
        char *line = NULL;

Index: src/mkmodules.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/mkmodules.c,v
retrieving revision 1.66.6.15
retrieving revision 1.66.6.16
diff -u -b -r1.66.6.15 -r1.66.6.16
--- src/mkmodules.c     11 Mar 2008 00:27:30 -0000      1.66.6.15
+++ src/mkmodules.c     7 May 2008 15:34:15 -0000       1.66.6.16
@@ -16,6 +16,10 @@
 #include "history.h"
 #include "savecwd.h"
 
+#ifdef HAVE_PROCESS_H
+# include <process.h>
+#endif
+
 #ifndef DBLKSIZ
 #define        DBLKSIZ 4096                    /* since GNU ndbm doesn't 
define it */
 #endif
@@ -468,6 +472,7 @@
        free (temp);
     }
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (CVSROOTADM_CHECKOUTLIST, "r");
     if (fp)
     {

Index: src/myndbm.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/myndbm.c,v
retrieving revision 1.24.2.2
retrieving revision 1.24.2.3
diff -u -b -r1.24.2.2 -r1.24.2.3
--- src/myndbm.c        31 Jan 2005 22:15:11 -0000      1.24.2.2
+++ src/myndbm.c        7 May 2008 15:34:15 -0000       1.24.2.3
@@ -42,6 +42,7 @@
     FILE *fp;
     DBM *db;
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (file, (flags & O_ACCMODE) != O_RDONLY ?
                                  FOPEN_BINARY_READWRITE : FOPEN_BINARY_READ);
     if (fp == NULL && !(existence_error (errno) && (flags & O_CREAT)))
@@ -83,6 +84,7 @@
     if (db->modified)
     {
        FILE *fp;
+       errno = 0; /* Standard C doesn't require errno be set on error */
        fp = CVS_FOPEN (db->name, FOPEN_BINARY_WRITE);
        if (fp == NULL)
            error (1, errno, "cannot write %s", db->name);

Index: src/parseinfo.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/parseinfo.c,v
retrieving revision 1.37.4.10
retrieving revision 1.37.4.11
diff -u -b -r1.37.4.10 -r1.37.4.11
--- src/parseinfo.c     11 Mar 2008 00:27:30 -0000      1.37.4.10
+++ src/parseinfo.c     7 May 2008 15:34:16 -0000       1.37.4.11
@@ -62,6 +62,7 @@
                        + 3);
     (void) sprintf (infopath, "%s/%s/%s", current_parsed_root->directory,
                    CVSROOTADM, infofile);
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp_info = CVS_FOPEN (infopath, "r");
     if (fp_info == NULL)
     {
@@ -269,6 +270,7 @@
     strcat (infopath, "/");
     strcat (infopath, CVSROOTADM_CONFIG);
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp_info = CVS_FOPEN (infopath, "r");
     if (fp_info == NULL)
     {

Index: src/patch.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/patch.c,v
retrieving revision 1.80.4.15
retrieving revision 1.80.4.16
diff -u -b -r1.80.4.15 -r1.80.4.16
--- src/patch.c 4 May 2006 09:53:09 -0000       1.80.4.15
+++ src/patch.c 7 May 2008 15:34:16 -0000       1.80.4.16
@@ -564,7 +564,7 @@
                                                    (char *) 0, 0)) != -1)
            /* I believe this timestamp only affects the dates in our diffs,
               and therefore should be on the server, not the client.  */
-           (void) utime (tmpfile1, &t);
+           (void) CVS_UTIME (tmpfile1, &t);
     }
     else if (toptwo_diffs)
     {
@@ -587,7 +587,7 @@
                                                    (char *)0, 0)) != -1)
            /* I believe this timestamp only affects the dates in our diffs,
               and therefore should be on the server, not the client.  */
-           (void)utime (tmpfile2, &t);
+           (void)CVS_UTIME (tmpfile2, &t);
     }
 
     if (unidiff) run_add_arg_p (&dargc, &darg_allocated, &dargv, "-u");

Index: src/rcs.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/rcs.c,v
retrieving revision 1.262.4.64
retrieving revision 1.262.4.65
diff -u -b -r1.262.4.64 -r1.262.4.65
--- src/rcs.c   19 Dec 2007 20:44:16 -0000      1.262.4.64
+++ src/rcs.c   7 May 2008 15:34:16 -0000       1.262.4.65
@@ -294,6 +294,7 @@
        in the cache.  */
     rcsbuf_cache_close ();
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     if ((rcsfile = locate_rcs (repos, file, &inattic)) == NULL)
     {
        /* Handle the error cases */
@@ -335,6 +336,7 @@
     rcsbuf_cache_close ();
 
     /* open the rcsfile */
+    errno = 0; /* Standard C doesn't require errno be set on error */
     if ((fp = CVS_FOPEN (rcsfile, FOPEN_BINARY_READ)) == NULL)
     {
        error (0, errno, "Couldn't open rcs file `%s'", rcsfile);
@@ -1053,7 +1055,7 @@
      * buffering and caching for us
      */
 
-    if ( fstat (fileno(fp), &fs) < 0 )
+    if ( CVS_FSTAT (fileno(fp), &fs) < 0 )
        error ( 1, errno, "Could not stat RCS archive %s for mapping", filename 
);
 
     if (pos)
@@ -2049,13 +2051,14 @@
        if (cached_rcs != NULL)
            rcsbuf_cache_close ();
 
+       errno = 0; /* Standard C doesn't require errno be set on error */
        *pfp = CVS_FOPEN (rcs->path, FOPEN_BINARY_READ);
        if (*pfp == NULL)
-           error (1, 0, "unable to reopen `%s'", rcs->path);
+           error (1, errno, "unable to reopen `%s'", rcs->path);
        if (pos != 0)
        {
            if (fseek (*pfp, pos, SEEK_SET) != 0)
-               error (1, 0, "cannot fseek RCS file %s", rcs->path);
+               error (1, errno, "cannot fseek RCS file %s", rcs->path);
        }
        rcsbuf_open (prcsbuf, *pfp, rcs->path, pos);
     }
@@ -4249,7 +4252,7 @@
 
        rcsbuf_valpolish (&rcsbuf, value, 0, &len);
 
-       if (fstat (fileno (fp), &sb) < 0)
+       if (CVS_FSTAT (fileno (fp), &sb) < 0)
            error (1, errno, "cannot fstat %s", rcs->path);
 
        rcsbuf_cache (rcs, &rcsbuf);
@@ -4269,13 +4272,13 @@
        {
            /* If RCS_deltas didn't close the file, we could use fstat
               here too.  Probably should change it thusly....  */
-           if (stat (rcs->path, &sb) < 0)
+           if (CVS_STAT (rcs->path, &sb) < 0)
                error (1, errno, "cannot stat %s", rcs->path);
            rcsbufp = NULL;
        }
        else
        {
-           if (fstat (fileno (fp), &sb) < 0)
+           if (CVS_FSTAT (fileno (fp), &sb) < 0)
                error (1, errno, "cannot fstat %s", rcs->path);
            rcsbufp = &rcsbuf;
        }
@@ -4554,6 +4557,8 @@
                if (islink (sout))
                    if (unlink_file (sout) < 0)
                        error (1, errno, "cannot remove %s", sout);
+               /* Standard C doesn't require errno be set on error */
+               errno = 0;
                ofp = CVS_FOPEN (sout, expand == KFLAG_B ? "wb" : "w");
                if (ofp == NULL)
                    error (1, errno, "cannot open %s", sout);
@@ -4567,6 +4572,7 @@
                if (unlink_file (workfile) < 0)
                    error (1, errno, "cannot remove %s", workfile);
 
+           errno = 0; /* Standard C doesn't require errno be set on error */
            ofp = CVS_FOPEN (workfile, expand == KFLAG_B ? "wb" : "w");
 
            /* If the open failed because the existing workfile was not
@@ -4575,6 +4581,8 @@
                && isfile (workfile) && !iswritable (workfile))
            {
                xchmod (workfile, 1);
+               /* Standard C doesn't require errno be set on error */
+               errno = 0;
                ofp = CVS_FOPEN (workfile, expand == KFLAG_B ? "wb" : "w");
            }
 
@@ -5083,7 +5091,7 @@
     if (flags & RCS_FLAGS_MODTIME)
     {
        struct stat ws;
-       if (stat (workfile, &ws) < 0)
+       if (CVS_STAT (workfile, &ws) < 0)
        {
            error (1, errno, "cannot stat %s", workfile);
        }
@@ -5740,6 +5748,7 @@
        else
            use_file1 = filename;
 
+       errno = 0; /* Standard C doesn't require errno be set on error */
         fp = CVS_FOPEN (use_file1, binary ? FOPEN_BINARY_READ : "r");
        if (fp == NULL)
            /* FIXME-update-dir: should include update_dir in message.  */
@@ -8671,7 +8680,7 @@
        file.  (Really, this is a lie -- if this is a new file,
        RCS_checkin uses the permissions from the working copy.  For
        actually creating the file, we use 0444 as a safe default mode.) */
-    if (stat (rcsfile, &rstat) < 0)
+    if (CVS_STAT (rcsfile, &rstat) < 0)
     {
        if (existence_error (errno))
            rstat.st_mode = S_IRUSR | S_IRGRP | S_IROTH;

Index: src/repos.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/repos.c,v
retrieving revision 1.24.6.3
retrieving revision 1.24.6.4
diff -u -b -r1.24.6.3 -r1.24.6.4
--- src/repos.c 31 Jan 2005 22:15:11 -0000      1.24.6.3
+++ src/repos.c 7 May 2008 15:34:16 -0000       1.24.6.4
@@ -53,6 +53,7 @@
      * The assumption here is that the repository is always contained in the
      * first line of the "Repository" file.
      */
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fpin = CVS_FOPEN (tmp, "r");
 
     if (fpin == NULL)

Index: src/run.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/run.c,v
retrieving revision 1.33.6.7
retrieving revision 1.33.6.8
diff -u -b -r1.33.6.7 -r1.33.6.8
--- src/run.c   29 Sep 2005 18:32:08 -0000      1.33.6.7
+++ src/run.c   7 May 2008 15:34:16 -0000       1.33.6.8
@@ -434,7 +434,7 @@
 
     /* Do nothing unless stderr is a file that is affected by
        nonblocking mode.  */
-    if (!(fstat (STDERR_FILENO, &sb) == 0
+    if (!(CVS_FSTAT (STDERR_FILENO, &sb) == 0
           && (S_ISFIFO (sb.st_mode) || S_ISSOCK (sb.st_mode)
               || S_ISCHR (sb.st_mode) || S_ISBLK (sb.st_mode))))
        return;

Index: src/server.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/server.c,v
retrieving revision 1.284.2.56
retrieving revision 1.284.2.57
diff -u -b -r1.284.2.56 -r1.284.2.57
--- src/server.c        19 Dec 2007 20:44:17 -0000      1.284.2.56
+++ src/server.c        7 May 2008 15:34:17 -0000       1.284.2.57
@@ -16,6 +16,10 @@
 #include "getline.h"
 #include "buffer.h"
 
+#ifdef HAVE_PROCESS_H
+# include <process.h>
+#endif
+
 int server_active = 0;
 
 #if defined(SERVER_SUPPORT) || defined(CLIENT_SUPPORT)
@@ -437,6 +441,7 @@
                (void) umask (omask);
            }
 
+           errno = 0; /* Standard C doesn't require errno be set on error */
            f = CVS_FOPEN (tmp, "w");
            if (f == NULL)
            {
@@ -466,6 +471,7 @@
        /* Create CVSADM_ENT.  We open in append mode because we
           don't want to clobber an existing Entries file.  */
        (void) sprintf (tmp, "%s/%s", dir_where_cvsadm_lives, CVSADM_ENT);
+       errno = 0; /* Standard C doesn't require errno be set on error */
        f = CVS_FOPEN (tmp, "a");
        if (f == NULL)
        {
@@ -1071,6 +1077,7 @@
        placeholder value to this file and we need to insert the
        correct value. */
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     f = CVS_FOPEN (CVSADM_REP, "w");
     if (f == NULL)
     {
@@ -1131,6 +1138,7 @@
     }
     /* We open in append mode because we don't want to clobber an
        existing Entries file.  */
+    errno = 0; /* Standard C doesn't require errno be set on error */
     f = CVS_FOPEN (CVSADM_ENT, "a");
     if (f == NULL)
     {
@@ -1207,6 +1215,7 @@
 
     if (error_pending ()) return;
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     f = CVS_FOPEN (CVSADM_ENTSTAT, "w+");
     if (f == NULL)
     {
@@ -1234,6 +1243,7 @@
 
     if (error_pending ()) return;
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     f = CVS_FOPEN (CVSADM_TAG, "w+");
     if (f == NULL)
     {
@@ -1587,7 +1597,7 @@
 
        memset (&t, 0, sizeof (t));
        t.modtime = t.actime = checkin_time;
-       if (utime (arg, &t) < 0)
+       if (CVS_UTIME (arg, &t) < 0)
        {
            int save_errno = errno;
            if (alloc_pending (80 + strlen (arg)))
@@ -1957,6 +1967,7 @@
           which explicitly lists more than one file in a particular
           directory, then we will wind up calling
           server_write_entries for each such file.  */
+       errno = 0; /* Standard C doesn't require errno be set on error */
        f = CVS_FOPEN (CVSADM_ENT, "a");
        if (f == NULL)
        {
@@ -4357,6 +4368,8 @@
            {
                long status;
 
+               /* Standard C doesn't require errno be set on error */
+               errno = 0;
                f = CVS_FOPEN (finfo->file, "rb");
                if (f == NULL)
                    error (1, errno, "reading %s", finfo->fullname);
@@ -4585,13 +4598,14 @@
     output_dir (data->update_dir, data->repository);
     buf_output0 (protocol, "\n");
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (template, "rb");
     if (fp == NULL)
     {
        error (0, errno, "Couldn't open rcsinfo template file %s", template);
        return 1;
     }
-    if (fstat (fileno (fp), &sb) < 0)
+    if (CVS_FSTAT (fileno (fp), &sb) < 0)
     {
        error (0, errno, "cannot stat rcsinfo template file %s", template);
        return 1;
@@ -5529,6 +5543,7 @@
     (void) sprintf (filename, "%s/%s/%s", repository,
                    CVSROOTADM, CVSROOTADM_PASSWD);
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (filename, "r");
     if (fp == NULL)
     {

Index: src/subr.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/subr.c,v
retrieving revision 1.72.4.32
retrieving revision 1.72.4.33
diff -u -b -r1.72.4.32 -r1.72.4.33
--- src/subr.c  22 Sep 2005 18:13:28 -0000      1.72.4.32
+++ src/subr.c  7 May 2008 15:34:17 -0000       1.72.4.33
@@ -664,6 +664,7 @@
     int result;
 
     result = 0;
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (finfo->file, "r");
     if (fp == NULL)
        error (1, errno, "cannot open %s", finfo->fullname);
@@ -922,7 +923,7 @@
        }
 #else
        /* default to 20 ms increments */
-       s = desttime - t;
+       s = (long)(desttime - t);
        us = 20000;
 #endif
 

Index: src/update.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/update.c,v
retrieving revision 1.202.4.33
retrieving revision 1.202.4.34
diff -u -b -r1.202.4.33 -r1.202.4.34
--- src/update.c        30 Jan 2008 22:23:33 -0000      1.202.4.33
+++ src/update.c        7 May 2008 15:34:17 -0000       1.202.4.34
@@ -1322,7 +1322,7 @@
                   That would also fix the kludge with noexec, above, which
                   is here only because noexec doesn't write srcfile->path
                   for us to stat.  */
-               if (stat (vers_ts->srcfile->path, &sb) < 0)
+               if (CVS_STAT (vers_ts->srcfile->path, &sb) < 0)
                {
 #if defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT)
                    buf_free (revbuf);
@@ -1638,6 +1638,7 @@
        has a trailing newline.  Because of this, we don't use rcsdiff,
        but just use diff.  */
 
+    errno = 0; /* Standard C doesn't require errno be set on error */
     e = CVS_FOPEN (file1, "w");
     if (e == NULL)
        error (1, errno, "cannot open %s", file1);
@@ -1662,6 +1663,7 @@
 
     if (! fail)
     {
+       errno = 0; /* Standard C doesn't require errno be set on error */
        e = CVS_FOPEN (file2, "w");
        if (e == NULL)
            error (1, errno, "cannot open %s", file2);
@@ -1749,6 +1751,7 @@
        unsigned int c;
 
        /* Check the diff output to make sure patch will be handle it.  */
+       errno = 0; /* Standard C doesn't require errno be set on error */
        e = CVS_FOPEN (finfo->file, "r");
        if (e == NULL)
            error (1, errno, "could not open diff output file %s",

Index: src/vers_ts.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/vers_ts.c,v
retrieving revision 1.43.4.12
retrieving revision 1.43.4.13
diff -u -b -r1.43.4.12 -r1.43.4.13
--- src/vers_ts.c       24 Mar 2008 08:57:09 -0000      1.43.4.12
+++ src/vers_ts.c       7 May 2008 15:34:17 -0000       1.43.4.13
@@ -239,7 +239,7 @@
                       set_time if noexec, but didn't used to).  I
                       think maybe now it doesn't (server_modtime does
                       not like those kinds of cases).  */
-                   (void) utime (finfo->file, &t);
+                   (void) CVS_UTIME (finfo->file, &t);
 
 #ifdef UTIME_EXPECTS_WRITABLE
                    if (change_it_back)
@@ -340,6 +340,10 @@
        /* Fix non-standard format.  */
        if (cp[8] == '0') cp[8] = ' ';
        (void) strcpy (vers_ts->ts_user, cp);
+#ifdef DEBUG_TIMESTAMPS
+       printf("sb.st_mtime = %llu, 0x%llX, %s\n", 
+               sb.st_mtime, sb.st_mtime, cp);
+#endif
     }
 }
 
@@ -392,6 +396,10 @@
        /* Fix non-standard format.  */
        if (cp[8] == '0') cp[8] = ' ';
        (void) strcpy (ts, cp);
+#ifdef DEBUG_TIMESTAMPS
+       printf("sb.st_mtime = %llu, 0x%llX, %s\n",
+               sb.st_mtime, sb.st_mtime, cp);
+#endif
     }
 
     return (ts);

Index: src/wrapper.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/wrapper.c,v
retrieving revision 1.31.4.5
retrieving revision 1.31.4.6
diff -u -b -r1.31.4.5 -r1.31.4.6
--- src/wrapper.c       2 Sep 2005 19:37:35 -0000       1.31.4.5
+++ src/wrapper.c       7 May 2008 15:34:17 -0000       1.31.4.6
@@ -276,6 +276,7 @@
     wrap_kill_temp ();
 
     /* Load the file.  */
+    errno = 0; /* Standard C doesn't require errno be set on error */
     fp = CVS_FOPEN (file, "r");
     if (fp == NULL)
     {

Index: windows-NT/ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/ChangeLog,v
retrieving revision 1.158.2.45
retrieving revision 1.158.2.46
diff -u -b -r1.158.2.45 -r1.158.2.46
--- windows-NT/ChangeLog        30 Mar 2008 16:06:23 -0000      1.158.2.45
+++ windows-NT/ChangeLog        7 May 2008 15:34:18 -0000       1.158.2.46
@@ -1,3 +1,21 @@
+2008-05-07  Mark D. Baushke  <address@hidden>
+
+       [bug #22781]
+       * JmgStat.c, JmgStat.h: remove. 
+       * config.h: Add macros CVS_FSTAT & CVS_UTIME, declare wnt_fstat 
+       and wnt_utime, include sys/utime.h, remove declarations that 
+       conflict with windows header files.
+       * filesubr.c: convert all fstat and utime calls to use the new 
+       CVS_FSTAT and CVS_UTIME macros.  Reimplement check_statbuf to 
+       use GetFileTime to get accurate file timestamps, and new function
+       UTCFileTimeToUnixTime to accurtately convert them.
+       Implement wnt_utime and wnt_fstat.
+       * ndir.c, pwd.c: Add missing declaratiosn of xmalloc.
+       * rcmd.c: substitute errorCode for reserved word errcode.
+       * run.c: correct function signature of piped_child.
+       * Makefile.am Makefile.in: remove references to jmgStat.[ch]
+       (Patch from Nelson B. Bolyard <address@hidden>.)
+       
 2008-03-30  Mark D. Baushke  <address@hidden>
 
        * JmgStat.c, JmgStat.h: Convert CRLF to LF on UNIX to get CRLF on

Index: windows-NT/JmgStat.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/JmgStat.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- windows-NT/JmgStat.c        30 Mar 2008 16:06:23 -0000      1.1.2.2
+++ windows-NT/JmgStat.c        7 May 2008 15:34:18 -0000       1.1.2.3
@@ -1,213 +0,0 @@
-//
-// Original Authors:  Jonathan M. Gilligan, Tony M. Hoyle
-//
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the 
-// Free Software Foundation; either version 2 of the License, or (at your
-// option) any later version.
-// 
-// This program is distributed in the hope that it will be useful, but 
-// WITHOUT ANY WARRANTY; without even the implied warranty of 
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-// General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc., 
-// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-// 
-// Modification History:
-// 18 May 2001, JMG -- First version
-
-#include <windows.h>
-#include <tchar.h>
-#include <time.h>
-
-#include "JmgStat.h"
-
-
-/* Tony Hoyle's function for testing whether a given volume uses UTC or 
- * local time to record file modification times
- * 
- * Reproduced here with permission of Tony Hoyle.
- * 
- * This code is copyright by Tony Hoyle and is licensed under the Gnu 
- * Public License. (See above)
- *
- * NTFS, HPFS, and OWFS store file times as UTC times.
- * FAT stores file times as local time.
- *
- * INPUTS:
- *      LPCSTR name: fully qualified path
- *
- * OUTPUTS:
- *      Return true if the file system on the volume in question 
- *      stores file times as UTC
- */
-BOOL IsUTCVolume ( LPCTSTR name )
-{
-    _TCHAR szDrive[_MAX_DRIVE + 1] = _T("");
-    _TCHAR szFs[32]=_T("");
-    _tsplitpath(name, szDrive, NULL, NULL, NULL);
-
-    _tcscat(szDrive, _T("\\"));
-    GetVolumeInformation( szDrive, NULL, 0, NULL, NULL, NULL, szFs, 32 );
-    return ! ( _tcsicmp( szFs, _T("NTFS") ) 
-               && _tcsicmp( szFs, _T("HPFS") ) 
-               && _tcsicmp( szFs, _T("OWFS") ) );
-}
-
-/* Convert a file time to a Unix time_t structure. This function is as 
- * complicated as it is because it needs to ask what time system the 
- * filetime describes.
- * 
- * INPUTS:
- *      const FILETIME * ft: A file time. It may be in UTC or in local 
- *                           time (see local_time, below, for details).
- *
- *      time_t * ut:         The destination for the converted time.
- *
- *      BOOL local_time:     TRUE if the time in *ft is in local time 
- *                           and I need to convert to a real UTC time.
- *
- * OUTPUTS:
- *      time_t * ut:         Store the result in *ut.
- */
-static BOOL FileTimeToUnixTime ( const FILETIME* ft, time_t* ut, BOOL 
local_time )
-{
-    BOOL success = FALSE;
-    if ( local_time ) 
-    {
-        struct tm atm;
-        SYSTEMTIME st;
-
-        success = FileTimeToSystemTime ( ft, &st );
-
-        /* Important: mktime looks at the tm_isdst field to determine
-         * whether to apply the DST correction. If this field is zero,
-         * then no DST is applied. If the field is one, then DST is
-         * applied. If the field is minus one, then DST is applied
-         * if the United States rule calls for it (DST starts at 
-         * 02:00 on the first Sunday in April and ends at 02:00 on
-         * the last Sunday in October.
-         *
-         * If you are concerned about time zones that follow different 
-         * rules, then you must either use GetTimeZoneInformation() to 
-         * get your system's TIME_ZONE_INFO and use the information
-         * therein to figure out whether the time in question was in 
-         * DST or not, or else use SystemTimeToTzSpecifiedLocalTime()
-         * to do the same.
-         *
-         * I haven't tried playing with SystemTimeToTzSpecifiedLocalTime()
-         * so I am nor sure how well it handles funky stuff.
-         */
-        atm.tm_sec = st.wSecond;
-        atm.tm_min = st.wMinute;
-        atm.tm_hour = st.wHour;
-        atm.tm_mday = st.wDay;
-        /* tm_mon is 0 based */
-        atm.tm_mon = st.wMonth - 1;
-        /* tm_year is 1900 based */
-        atm.tm_year = st.wYear>1900?st.wYear - 1900:st.wYear;     
-        atm.tm_isdst = -1;      /* see notes above */
-        *ut = mktime ( &atm );
-    }
-    else 
-    {
-
-       /* FILETIME = number of 100-nanosecond ticks since midnight 
-        * 1 Jan 1601 UTC. time_t = number of 1-second ticks since 
-        * midnight 1 Jan 1970 UTC. To translate, we subtract a
-        * FILETIME representation of midnight, 1 Jan 1970 from the
-        * time in question and divide by the number of 100-ns ticks
-        * in one second.
-        */
-
-        /* One second = 10,000,000 * 100 nsec */
-        const ULONGLONG second = 10000000L;
-
-        SYSTEMTIME base_st = 
-        {
-            1970,   /* wYear            */
-            1,      /* wMonth           */
-            0,      /* wDayOfWeek       */
-            1,      /* wDay             */
-            0,      /* wHour            */
-            0,      /* wMinute          */
-            0,      /* wSecond          */
-            0       /* wMilliseconds    */
-        };
-        
-        ULARGE_INTEGER itime;
-        FILETIME base_ft;
-
-        success = SystemTimeToFileTime ( &base_st, &base_ft );
-        if (success) 
-        {
-            itime.QuadPart = ((ULARGE_INTEGER *)ft)->QuadPart;
-
-            itime.QuadPart -= ((ULARGE_INTEGER *)&base_ft)->QuadPart;
-            itime.QuadPart /= second;
-
-            *ut = itime.LowPart;
-        }
-    }
-    if (!success)
-    {
-        *ut = -1;   /* error value used by mktime() */
-    }
-    return success;
-}
-
-/* Get file modification time using FileTimeToUnixTime()
- *
- * INPUTS:
- *      LPCTSTR name:   the file name
- */
-BOOL GetUTCFileModTime ( LPCTSTR name, time_t * utc_mod_time )
-{
-    WIN32_FIND_DATA find_buf;
-    FILETIME mod_time;
-    HANDLE find_handle;
-    BOOL success = FALSE;
-
-    * utc_mod_time = 0L;
-
-    find_handle = FindFirstFile ( name, &find_buf );
-    success = ( find_handle != INVALID_HANDLE_VALUE );
-    if (success)
-    {
-        /* Originally I thought that I needed to apply a correction 
-         * LocalTimeToFileTime() to files from FAT volumes, but the 
-         * FindFirstFile() system call thoughtfully applies this 
-         * correction itself.
-         *
-         * Thus, the file time returned is allegedly in UTC.
-         *
-         * However, the correction from local to UTC is applied 
-         * incorrectly (Thanks a lot, Microsoft!). As documented in the 
-         * Win32 API (see MSDN or the PSDK), DST is applied if and only 
-         * if the computer's system time is in DST at the time we call 
-         * FindFirstFile(), irrespective or whether DST applied at the 
-         * time the file was modified!
-         *
-         * Thus, we have to call FileTimeToLocalFileTime() to undo
-         * Windows's good intentions. We correctly translate the time
-         * In FileTimeToUnixTime().
-         *
-         */
-        if ( IsUTCVolume ( name ) ) 
-        {
-            mod_time = find_buf.ftLastWriteTime;
-            success = FileTimeToUnixTime ( &mod_time, utc_mod_time, FALSE );
-        }
-        else 
-        { 
-            // See notes above...
-            success = FileTimeToLocalFileTime ( &find_buf.ftLastWriteTime, 
&mod_time );
-            success = success && FileTimeToUnixTime ( &mod_time, utc_mod_time, 
TRUE );
-        }        
-    }
-    FindClose ( find_handle );
-    return success;
-}

Index: windows-NT/JmgStat.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/JmgStat.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- windows-NT/JmgStat.h        30 Mar 2008 16:06:23 -0000      1.1.2.2
+++ windows-NT/JmgStat.h        7 May 2008 15:34:18 -0000       1.1.2.3
@@ -1,4 +0,0 @@
-#ifndef JMGSTAT_H
-# define JMGSTAT_H
-BOOL GetUTCFileModTime ( LPCTSTR name, time_t * utc_mod_time );
-#endif /* !JMGSTAT_H */

Index: windows-NT/Makefile.am
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/Makefile.am,v
retrieving revision 1.2.4.9
retrieving revision 1.2.4.10
diff -u -b -r1.2.4.9 -r1.2.4.10
--- windows-NT/Makefile.am      20 Sep 2005 02:38:02 -0000      1.2.4.9
+++ windows-NT/Makefile.am      7 May 2008 15:34:18 -0000       1.2.4.10
@@ -22,8 +22,6 @@
 # GNU General Public License for more details.
 
 EXTRA_DIST = \
-       JmgStat.c \
-       JmgStat.h \
        stamp-ch \
        config.h \
        config.h.in \

Index: windows-NT/Makefile.in
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/Makefile.in,v
retrieving revision 1.29.4.22
retrieving revision 1.29.4.23
diff -u -b -r1.29.4.22 -r1.29.4.23
--- windows-NT/Makefile.in      28 Jan 2008 01:22:55 -0000      1.29.4.22
+++ windows-NT/Makefile.in      7 May 2008 15:34:18 -0000       1.29.4.23
@@ -181,8 +181,6 @@
 with_default_rsh = @with_default_rsh@
 with_default_ssh = @with_default_ssh@
 EXTRA_DIST = \
-       JmgStat.c \
-       JmgStat.h \
        stamp-ch \
        config.h \
        config.h.in \

Index: windows-NT/config.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/config.h,v
retrieving revision 1.46.2.42
retrieving revision 1.46.2.43
diff -u -b -r1.46.2.42 -r1.46.2.43
--- windows-NT/config.h 7 May 2008 14:35:13 -0000       1.46.2.42
+++ windows-NT/config.h 7 May 2008 15:34:18 -0000       1.46.2.43
@@ -202,6 +202,9 @@
    Unix I/O routines like open and creat and stuff.  */
 #define HAVE_IO_H 1
 
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
 /* Define if you have the <memory.h> header file.  */
 #define HAVE_MEMORY_H 1
 
@@ -229,11 +232,14 @@
 /* Define if you have the <sys/select.h> header file.  */
 #undef HAVE_SYS_SELECT_H
 
+/* Define if you have the <sys/timeb.h> header file.  */
+#define HAVE_SYS_TIMEB_H 1
+
 /* Define if you have the <sys/time.h> header file.  */
 #undef HAVE_SYS_TIME_H
 
-/* Define if you have the <sys/timeb.h> header file.  */
-#define HAVE_SYS_TIMEB_H 1
+/* Define if you have the <sys/utime.h> header file.  */
+#define HAVE_SYS_UTIME_H 1
 
 /* Define if you have the <unistd.h> header file.  */
 #undef HAVE_UNISTD_H
@@ -255,6 +261,8 @@
 /* This isn't ever used either.  */
 #undef HAVE_LIBSOCKET
 
+#define CVS_FSTAT wnt_fstat
+extern int wnt_fstat (int fd, struct stat *sb);
 /* Under Windows NT, mkdir only takes one argument.  */
 #define CVS_MKDIR wnt_mkdir
 extern int wnt_mkdir (const char *PATH, int MODE);
@@ -262,6 +270,8 @@
 extern int wnt_stat ();
 #define CVS_LSTAT wnt_lstat
 extern int wnt_lstat ();
+#define CVS_UTIME wnt_utime
+extern int wnt_utime();
 
 #define CVS_RENAME wnt_rename
 extern int wnt_rename (const char *, const char *);
@@ -270,8 +280,22 @@
    provide a stub.  */
 extern int readlink (char *path, char *buf, int buf_size);
 
-/* This is just a call to GetCurrentProcessID.  */
+/* Define to 1 if you have the <process.h> header file. */
+#define HAVE_PROCESS_H 1
+
+/* This is just a call to GetCurrentProcessID.
+   However, it is defined in <process.h> as
+   __declspec(dllimport) int __cdecl getpid(void);
+  On UNIX systems, expect a declaration in <unitstd.h>
+  for getpid().
+ */
+#ifdef HAVE_PROCESS_H
+# define HAVE_GETPID 1
+#endif
+
+#ifndef HAVE_GETPID
 extern pid_t getpid (void);
+#endif
 
 /* We definitely have prototypes.  */
 #define USE_PROTOTYPES 1
@@ -473,6 +497,12 @@
 
 /* Define as the maximum value of type 'size_t', if the system doesn't define
    it. */
-#define SIZE_MAX ((size_t) -1)
+/* Windows has a '#define SIZE_MAX UINT_MAX' in <limits.h> now. */
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
 
 /* End of #include "xsize.h" fix. */

Index: windows-NT/config.h.in
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/config.h.in,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -b -r1.1.2.5 -r1.1.2.6
--- windows-NT/config.h.in      28 Jan 2008 01:22:55 -0000      1.1.2.5
+++ windows-NT/config.h.in      7 May 2008 15:34:18 -0000       1.1.2.6
@@ -195,6 +195,9 @@
    Unix I/O routines like open and creat and stuff.  */
 #define HAVE_IO_H 1
 
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
 /* Define if you have the <memory.h> header file.  */
 #define HAVE_MEMORY_H 1
 
@@ -222,11 +225,14 @@
 /* Define if you have the <sys/select.h> header file.  */
 #undef HAVE_SYS_SELECT_H
 
+/* Define if you have the <sys/timeb.h> header file.  */
+#define HAVE_SYS_TIMEB_H 1
+
 /* Define if you have the <sys/time.h> header file.  */
 #undef HAVE_SYS_TIME_H
 
-/* Define if you have the <sys/timeb.h> header file.  */
-#define HAVE_SYS_TIMEB_H 1
+/* Define if you have the <sys/utime.h> header file.  */
+#define HAVE_SYS_UTIME_H 1
 
 /* Define if you have the <unistd.h> header file.  */
 #undef HAVE_UNISTD_H
@@ -248,6 +254,8 @@
 /* This isn't ever used either.  */
 #undef HAVE_LIBSOCKET
 
+#define CVS_FSTAT wnt_fstat
+extern int wnt_fstat (int fd, struct stat *sb);
 /* Under Windows NT, mkdir only takes one argument.  */
 #define CVS_MKDIR wnt_mkdir
 extern int wnt_mkdir (const char *PATH, int MODE);
@@ -255,6 +263,8 @@
 extern int wnt_stat ();
 #define CVS_LSTAT wnt_lstat
 extern int wnt_lstat ();
+#define CVS_UTIME wnt_utime
+extern int wnt_utime();
 
 #define CVS_RENAME wnt_rename
 extern int wnt_rename (const char *, const char *);
@@ -263,8 +273,22 @@
    provide a stub.  */
 extern int readlink (char *path, char *buf, int buf_size);
 
-/* This is just a call to GetCurrentProcessID.  */
+/* Define to 1 if you have the <process.h> header file. */
+#define HAVE_PROCESS_H 1
+
+/* This is just a call to GetCurrentProcessID.
+   However, it is defined in <process.h> as
+   __declspec(dllimport) int __cdecl getpid(void);
+  On UNIX systems, expect a declaration in <unitstd.h>
+  for getpid().
+ */
+#ifdef HAVE_PROCESS_H
+# define HAVE_GETPID 1
+#endif
+
+#ifndef HAVE_GETPID
 extern pid_t getpid (void);
+#endif
 
 /* We definitely have prototypes.  */
 #define USE_PROTOTYPES 1
@@ -466,6 +490,12 @@
 
 /* Define as the maximum value of type 'size_t', if the system doesn't define
    it. */
-#define SIZE_MAX ((size_t) -1)
+/* Windows has a '#define SIZE_MAX UINT_MAX' in <limits.h> now. */
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
 
 /* End of #include "xsize.h" fix. */

Index: windows-NT/filesubr.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/filesubr.c,v
retrieving revision 1.37.4.7
retrieving revision 1.37.4.8
diff -u -b -r1.37.4.7 -r1.37.4.8
--- windows-NT/filesubr.c       7 Sep 2004 19:12:24 -0000       1.37.4.7
+++ windows-NT/filesubr.c       7 May 2008 15:34:18 -0000       1.37.4.8
@@ -21,9 +21,6 @@
 #include <windows.h>
 
 #include "cvs.h"
-#include "JmgStat.h"
-
-
 
 static int deep_remove_dir PROTO((const char *path));
 
@@ -55,7 +52,7 @@
 
     if ((fdin = open (from, O_RDONLY | O_BINARY)) < 0)
        error (1, errno, "cannot open %s for copying", from);
-    if (fstat (fdin, &sb) < 0)
+    if (CVS_FSTAT (fdin, &sb) < 0)
        error (1, errno, "cannot fstat %s", from);
     if ((fdout = open (to, O_CREAT | O_TRUNC | O_RDWR | O_BINARY,
                       (int) sb.st_mode & 07777)) < 0)
@@ -99,7 +96,7 @@
     memset ((char *) &t, 0, sizeof (t));
     t.actime = sb.st_atime;
     t.modtime = sb.st_mtime;
-    (void) utime (to, &t);
+    (void) CVS_UTIME (to, &t);
 }
 
 /* FIXME-krp: these functions would benefit from caching the char * &
@@ -115,7 +112,7 @@
 {
     struct stat sb;
 
-    if (stat (file, &sb) < 0)
+    if (wnt_stat (file, &sb) < 0)
        return (0);
     return (S_ISDIR (sb.st_mode));
 }
@@ -130,7 +127,7 @@
 #ifdef S_ISLNK
     struct stat sb;
 
-    if (lstat (file, &sb) < 0)
+    if (wnt_lstat (file, &sb) < 0)
        return (0);
     return (S_ISLNK (sb.st_mode));
 #else
@@ -185,7 +182,7 @@
     int omask = 0;
     int uid;
     
-    if (stat(file, &sb) == -1)
+    if (wnt_stat(file, &sb) == -1)
        return 0;
     if (mode == F_OK)
        return 1;
@@ -253,7 +250,7 @@
 {
     struct stat sb;
 
-    if (stat (name, &sb) == 0 && (!S_ISDIR (sb.st_mode)))
+    if (wnt_stat (name, &sb) == 0 && (!S_ISDIR (sb.st_mode)))
            error (0, 0, "%s already exists but is not a directory", name);
     if (!noexec && mkdir (name) < 0)
        error (1, errno, "cannot make directory %s", name);
@@ -329,7 +326,7 @@
     struct stat sb;
     mode_t mode, oumask;
 
-    if (stat (fname, &sb) < 0)
+    if (wnt_stat (fname, &sb) < 0)
     {
        if (!noexec)
            error (0, errno, "cannot stat %s", fname);
@@ -613,9 +610,9 @@
        error (1, errno, "cannot open file %s for comparing", file1);
     if ((fd2 = open (file2, O_RDONLY | O_BINARY)) < 0)
        error (1, errno, "cannot open file %s for comparing", file2);
-    if (fstat (fd1, &sb1) < 0)
+    if (CVS_FSTAT (fd1, &sb1) < 0)
        error (1, errno, "cannot fstat %s", file1);
-    if (fstat (fd2, &sb2) < 0)
+    if (CVS_FSTAT (fd2, &sb2) < 0)
        error (1, errno, "cannot fstat %s", file2);
 
     /* A generic file compare routine might compare st_dev & st_ino here 
@@ -996,10 +993,54 @@
     *pargv = new_argv;
 }
 
-static void check_statbuf (const char *file, struct stat *sb)
-{
-    struct tm *newtime;
-    time_t long_time;
+/* FILETIME = number of 100-nanosecond ticks since midnight 1 Jan 1601 UTC. 
+ * time_t = number of 1-second ticks since midnight 1 Jan 1970 UTC. 
+ * To translate, we subtract a FILETIME representation of midnight, 
+ * 1 Jan 1970 from the FILETIME in question and divide by the number 
+ * of 100-ns ticks in one second.
+ */
+static BOOL UTCFileTimeToUnixTime(const FILETIME* ft, time_t* ut)
+{
+    /* One second = 10,000,000 * 100 nsec */
+    static const ULONGLONG tenmillion = 10000000ull;
+    static const ULONGLONG Jan1970    = 116444736000000000ull;
+
+    ULONGLONG itime;
+
+    *(FILETIME *)&itime = *ft;
+    if (itime < Jan1970) {
+       itime = (ULONGLONG)(-1LL);
+    } else {
+       itime -= Jan1970;
+       itime /= tenmillion;
+    }
+    *ut = itime;
+    return TRUE;
+}
+
+static void check_statbuf (const char *fileName, struct stat *sb)
+{
+    HANDLE     hFile;
+    FILETIME   ft1, ft2, ft3;
+
+    hFile = CreateFile(
+                fileName,
+                GENERIC_READ,
+                FILE_SHARE_READ,
+                NULL,        // hFile cannot be inherited
+                OPEN_EXISTING,
+                0,
+                NULL );      // no template file handle
+    if (hFile != INVALID_HANDLE_VALUE) {
+       BOOL success = GetFileTime(hFile, &ft1, &ft2, &ft3 );
+       (void) CloseHandle(hFile);
+       if (success) {
+           /* GetFileTime returns UTC times, even for FAT file systems. */
+           (void)UTCFileTimeToUnixTime(&ft1, &sb->st_ctime);
+           (void)UTCFileTimeToUnixTime(&ft2, &sb->st_atime);
+           (void)UTCFileTimeToUnixTime(&ft3, &sb->st_mtime);
+       }
+    }
 
     /* Win32 processes file times in a 64 bit format
        (see Win32 functions SetFileTime and GetFileTime).
@@ -1013,38 +1054,108 @@
        on Win32 via GetFileTime, but that would be a lot of
        hair and I'm not sure there is much payoff.  */
     if (sb->st_mtime == (time_t) -1)
-       error (1, 0, "invalid modification time for %s", file);
+       error (1, 0, "invalid modification time for %s", fileName);
     if (sb->st_ctime == (time_t) -1)
        /* I'm not sure what this means on windows.  It
           might be a creation time (unlike unix)....  */
-       error (1, 0, "invalid ctime for %s", file);
+       error (1, 0, "invalid ctime for %s", fileName);
     if (sb->st_atime == (time_t) -1)
-       error (1, 0, "invalid access time for %s", file);
-
-    if (!GetUTCFileModTime (file, &sb->st_mtime))
-       error (1, 0, "Failed to retrieve modification time for %s", file);
+       error (1, 0, "invalid access time for %s", fileName);
 }
 
 int
-wnt_stat (const char *file, struct stat *sb)
+wnt_stat (const char *fileName, struct stat *sb)
 {
     int retval;
 
-    retval = stat (file, sb);
+    retval = stat (fileName, sb);
     if (retval < 0)
        return retval;
-    check_statbuf (file, sb);
+    check_statbuf (fileName, sb);
     return retval;
 }
 
 int
-wnt_lstat (const char *file, struct stat *sb)
+wnt_lstat (const char *fileName, struct stat *sb)
 {
     int retval;
 
-    retval = lstat (file, sb);
+    retval = lstat (fileName, sb);
     if (retval < 0)
        return retval;
-    check_statbuf (file, sb);
+    check_statbuf (fileName, sb);
     return retval;
 }
+
+int 
+wnt_utime( const char *fileName, struct utimbuf *times )
+{
+    HANDLE   hFile;
+    BOOL     success = FALSE;
+    FILETIME ftac, ftmod;
+
+    if (!times) {
+       GetSystemTimeAsFileTime(&ftmod);
+       ftac = ftmod;
+    } else {
+       /* One second = 10,000,000 * 100 nsec */
+       static const ULONGLONG tenmillion = 10000000ull;
+       static const ULONGLONG Jan1970    = 116444736000000000ull;
+
+       ULONGLONG ulac, ulmod;
+       ulac  = (tenmillion * times->actime ) + Jan1970;
+       ulmod = (tenmillion * times->modtime) + Jan1970;
+
+       ftac  = *(FILETIME *)&ulac;
+       ftmod = *(FILETIME *)&ulmod;
+    }
+
+    hFile = CreateFile(
+                fileName,
+                FILE_WRITE_ATTRIBUTES,
+                0,           // hFile cannot be shared while doing this
+                NULL,        // hFile cannot be inherited
+                OPEN_EXISTING,
+                0,
+                NULL );      // no template file handle
+    if (hFile != INVALID_HANDLE_VALUE) {
+       success = SetFileTime(hFile, NULL, &ftac, &ftmod);
+       (void) CloseHandle(hFile);
+       if (!success) {
+           errno = EACCES;
+       }
+    } else {
+        errno = ENOENT;
+    }
+    return (success != FALSE) - 1;
+}
+
+
+int
+wnt_fstat (int fd, struct stat *sb)
+{
+    HANDLE hFile;
+    BOOL   success;
+    int    rv;
+    BY_HANDLE_FILE_INFORMATION hInfo;
+
+    rv = fstat(fd, sb);
+    if (rv != 0)
+       return rv;
+
+    /* below here, if fstat has succeeded, there's no need to report failure.*/
+    hFile = (HANDLE)_get_osfhandle(fd);
+    if (hFile == INVALID_HANDLE_VALUE) 
+       return rv;
+
+    success = GetFileInformationByHandle(hFile, &hInfo);
+    if (!success)
+       return rv;
+    /* don't have to close hFile */
+
+    /* Now, fix fstat's lies about timestamps */
+    (void)UTCFileTimeToUnixTime(&hInfo.ftLastAccessTime,  &sb->st_atime);
+    (void)UTCFileTimeToUnixTime(&hInfo.ftCreationTime,    &sb->st_ctime);
+    (void)UTCFileTimeToUnixTime(&hInfo.ftLastWriteTime,   &sb->st_mtime);
+    return 0;
+}

Index: windows-NT/ndir.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/Attic/ndir.c,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -u -b -r1.6 -r1.6.4.1
--- windows-NT/ndir.c   6 Dec 2002 20:09:24 -0000       1.6
+++ windows-NT/ndir.c   7 May 2008 15:34:19 -0000       1.6.4.1
@@ -27,6 +27,7 @@
 #include <dos.h>
 
 #include <ndir.h>
+extern void *xmalloc (size_t bytes);
 
 static void free_dircontents (struct _dircontents *);
 

Index: windows-NT/pwd.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/pwd.c,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -u -b -r1.6 -r1.6.4.1
--- windows-NT/pwd.c    6 Dec 2002 20:09:24 -0000       1.6
+++ windows-NT/pwd.c    7 May 2008 15:34:19 -0000       1.6.4.1
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <pwd.h>
+extern void *xmalloc (size_t bytes);
 
 char* win32getlogin();
 static char *lookup_env (char **);

Index: windows-NT/rcmd.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/rcmd.c,v
retrieving revision 1.10
retrieving revision 1.10.8.1
diff -u -b -r1.10 -r1.10.8.1
--- windows-NT/rcmd.c   9 Jul 1997 06:35:16 -0000       1.10
+++ windows-NT/rcmd.c   7 May 2008 15:34:19 -0000       1.10.8.1
@@ -96,7 +96,7 @@
          client_port >= IPPORT_RESERVED/2;
          client_port--)
     {
-       int result, errcode;
+       int result, errorCode;
        client_sai.sin_port = htons (client_port);
 
         if ((s = socket (PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
@@ -105,28 +105,28 @@
 
        result = bind (s, (struct sockaddr *) &client_sai,
                       sizeof (client_sai));
-       errcode = SOCK_ERRNO;
+       errorCode = SOCK_ERRNO;
        if (result == SOCKET_ERROR)
        {
            closesocket (s);
-           if (errcode == WSAEADDRINUSE)
+           if (errorCode == WSAEADDRINUSE)
                continue;
            else
                error (1, 0, "cannot bind to socket: %s",
-                      SOCK_STRERROR (errcode));
+                      SOCK_STRERROR (errorCode));
        }
 
        result = connect (s, (struct sockaddr *) server_sai,
                          sizeof (*server_sai));
-       errcode = SOCK_ERRNO;
+       errorCode = SOCK_ERRNO;
        if (result == SOCKET_ERROR)
        {
            closesocket (s);
-           if (errcode == WSAEADDRINUSE)
+           if (errorCode == WSAEADDRINUSE)
                continue;
            else
                error (1, 0, "cannot connect to socket: %s",
-                      SOCK_STRERROR (errcode));
+                      SOCK_STRERROR (errorCode));
        }
 
        return s;

Index: windows-NT/run.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/run.c,v
retrieving revision 1.16.8.6
retrieving revision 1.16.8.7
diff -u -b -r1.16.8.6 -r1.16.8.7
--- windows-NT/run.c    6 Jun 2005 21:33:24 -0000       1.16.8.6
+++ windows-NT/run.c    7 May 2008 15:34:19 -0000       1.16.8.7
@@ -25,7 +25,7 @@
 static void run_add_arg PROTO((const char *s));
 static void run_init_prog PROTO((void));
 
-extern char *strtok ();
+//extern char *strtok ();
 
 /*
  * To exec a program under CVS, first call run_setup() to setup any initial
@@ -620,7 +620,7 @@
    Return the handle of the child process (this is what
    _cwait and waitpid expect).  */
 int
-piped_child (const char **argv, int *to, int *from)
+piped_child (const char **argv, int *to, int *from, int fix_stderr)
 {
   int child;
   HANDLE pipein[2], pipeout[2];

Index: windows-NT/woe32.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/woe32.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -b -r1.1.2.3 -r1.1.2.4
--- windows-NT/woe32.c  12 Jul 2005 14:10:26 -0000      1.1.2.3
+++ windows-NT/woe32.c  7 May 2008 15:34:19 -0000       1.1.2.4
@@ -24,6 +24,10 @@
 #include <stdio.h>
 #include <conio.h>
 
+#ifdef HAVE_PROCESS_H
+# include <process.h>
+#endif
+
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
@@ -93,11 +97,13 @@
 }
 
 
+#ifndef HAVE_GETPID
 pid_t
-getpid ()
+getpid (void)
 {
     return (pid_t) GetCurrentProcessId();
 }
+#endif
 
 char *
 getpass (const char *prompt)

Index: windows-NT/SCC/SCC.mak
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/SCC/SCC.mak,v
retrieving revision 1.1
retrieving revision 1.1.8.1
diff -u -b -r1.1 -r1.1.8.1
--- windows-NT/SCC/SCC.mak      15 Feb 1997 20:11:42 -0000      1.1
+++ windows-NT/SCC/SCC.mak      7 May 2008 15:34:19 -0000       1.1.8.1
@@ -61,10 +61,10 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" 
/YX /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
-CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
- /Fp"$(INTDIR)/SCC.pch" /YX /Fo"$(INTDIR)/" /c 
+# ADD BASE CPP /nologo /MT /W3  /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"  /c
+# ADD CPP /nologo /MT /W3  /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"  /c
+CPP_PROJ=/nologo /MT /W3  /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
+ /Fp"$(INTDIR)/SCC.pch"  /Fo"$(INTDIR)/" /c 
 CPP_OBJS=.\Release/
 CPP_SBRS=
 # ADD BASE MTL /nologo /D "NDEBUG" /win32
@@ -124,10 +124,10 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D 
"_WINDOWS" /YX /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D 
"_WINDOWS" /YX /c
-CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
- /Fp"$(INTDIR)/SCC.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c 
+# ADD BASE CPP /nologo /MTd /W3 /Gm  /Zi /Od /D "WIN32" /D "_DEBUG" /D 
"_WINDOWS"  /c
+# ADD CPP /nologo /MTd /W3 /Gm  /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"  
/c
+CPP_PROJ=/nologo /MTd /W3 /Gm  /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
+ /Fp"$(INTDIR)/SCC.pch"  /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c 
 CPP_OBJS=.\Debug/
 CPP_SBRS=
 # ADD BASE MTL /nologo /D "_DEBUG" /win32

Index: zlib/ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/zlib/ChangeLog,v
retrieving revision 1.19.6.3
retrieving revision 1.19.6.4
diff -u -b -r1.19.6.3 -r1.19.6.4
--- zlib/ChangeLog      15 May 2004 17:26:08 -0000      1.19.6.3
+++ zlib/ChangeLog      7 May 2008 15:34:19 -0000       1.19.6.4
@@ -1,3 +1,10 @@
+2008-05-07  Mark D. Baushke  <address@hidden>
+
+       [bug #22781]
+       * libz.mak: Change CFLAGS to work with MSVC 2005 express
+       * minigzip.c: change fstat call to CVS_FSTAT call
+       (Patch from Nelson B Bolyard <address@hidden>.)
+
 2004-05-15  Derek Price  <address@hidden>
 
        * libz.dsp: Header file list updated.

Index: zlib/libz.mak
===================================================================
RCS file: /cvsroot/cvs/ccvs/zlib/libz.mak,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -u -b -r1.3.2.2 -r1.3.2.3
--- zlib/libz.mak       15 May 2004 17:26:08 -0000      1.3.2.2
+++ zlib/libz.mak       7 May 2008 15:34:20 -0000       1.3.2.3
@@ -60,7 +60,7 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" 
/Fp"$(INTDIR)\libz.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+CPP_PROJ=/nologo /MD /W3  /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" 
/Fp"$(INTDIR)\libz.pch"  /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
 BSC32=bscmake.exe
 BSC32_FLAGS=/nologo /o"$(OUTDIR)\libz.bsc" 
 BSC32_SBRS= \
@@ -84,7 +84,10 @@
        "$(INTDIR)\zutil.obj"
 
 "$(OUTDIR)\libz.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
-    $(LIB32) @<<
+    @type <<
+    $(LIB32) $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+    @$(LIB32) @<<
   $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
 <<
 
@@ -120,7 +123,7 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-CPP_PROJ=/nologo /MLd /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" 
/Fp"$(INTDIR)\libz.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+CPP_PROJ=/nologo /MD /W3  /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" 
/Fp"$(INTDIR)\libz.pch"  /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
 BSC32=bscmake.exe
 BSC32_FLAGS=/nologo /o"$(OUTDIR)\libz.bsc" 
 BSC32_SBRS= \
@@ -144,14 +147,20 @@
        "$(INTDIR)\zutil.obj"
 
 "$(OUTDIR)\libz.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
-    $(LIB32) @<<
+    @type <<
+    $(LIB32) $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+    @$(LIB32) @<<
   $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
 <<
 
 !ENDIF 
 
 .c{$(INTDIR)}.obj::
-   $(CPP) @<<
+   @type <<
+   $(CPP) $(CPP_PROJ) $< 
+<<
+   @$(CPP) @<<
    $(CPP_PROJ) $< 
 <<
 

Index: zlib/minigzip.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/zlib/minigzip.c,v
retrieving revision 1.1.1.4
retrieving revision 1.1.1.4.6.1
diff -u -b -r1.1.1.4 -r1.1.1.4.6.1
--- zlib/minigzip.c     11 Mar 2002 22:11:55 -0000      1.1.1.4
+++ zlib/minigzip.c     7 May 2008 15:34:20 -0000       1.1.1.4.6.1
@@ -142,7 +142,7 @@
     struct stat sb;
 
     /* Determine the size of the file, needed for mmap: */
-    if (fstat(ifd, &sb) < 0) return Z_ERRNO;
+    if (CVS_FSTAT(ifd, &sb) < 0) return Z_ERRNO;
     buf_len = sb.st_size;
     if (buf_len <= 0) return Z_ERRNO;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]