Author: peterw
Date: Wed Oct 24 11:04:52 2007
New Revision: 29843
URL:
http://svn.reactos.org/svn/reactos?rev=29843&view=rev
Log:
- Added a small utility (chknewer) to check if one file is newer than another.
- This removes the dependency on test from Config.cmd and Build.cmd.
- Some other miscellaneous cleanup.
Added:
trunk/tools/RosBE-Windows/Tools/chknewer.c (with props)
Modified:
trunk/tools/RosBE-Windows/Root/Build.cmd
trunk/tools/RosBE-Windows/Root/Config.cmd
trunk/tools/RosBE-Windows/Tools/buildtime.c
trunk/tools/RosBE-Windows/Tools/cpucount.c
trunk/tools/RosBE-Windows/Tools/echoh.c
trunk/tools/RosBE-Windows/Tools/flash.c
trunk/tools/RosBE-Windows/Tools/getdate.c
trunk/tools/RosBE-Windows/Tools/info.txt
trunk/tools/RosBE-Windows/Tools/makefile
Modified: trunk/tools/RosBE-Windows/Root/Build.cmd
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Root/Build.cmd…
==============================================================================
--- trunk/tools/RosBE-Windows/Root/Build.cmd (original)
+++ trunk/tools/RosBE-Windows/Root/Build.cmd Wed Oct 24 11:04:52 2007
@@ -17,7 +17,7 @@
:: abort the build and inform the user.
::
if exist "config.rbuild" (
- test "config.template.rbuild" -nt "config.rbuild"
+ chknewer "config.template.rbuild"
"%_ROSBE_BASEDIR%\config.rbuild"
if not errorlevel 1 (
echo.
echo *** config.template.rbuild is newer than config.rbuild ***
Modified: trunk/tools/RosBE-Windows/Root/Config.cmd
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Root/Config.cm…
==============================================================================
--- trunk/tools/RosBE-Windows/Root/Config.cmd (original)
+++ trunk/tools/RosBE-Windows/Root/Config.cmd Wed Oct 24 11:04:52 2007
@@ -85,7 +85,7 @@
:: inform the user and offer an update.
::
if exist "%_ROSBE_BASEDIR%\config.rbuild" (
- test "config.template.rbuild" -nt
"%_ROSBE_BASEDIR%\config.rbuild"
+ chknewer "config.template.rbuild"
"%_ROSBE_BASEDIR%\config.rbuild"
if not errorlevel 1 (
echo.
echo *** config.template.rbuild is newer than working config.rbuild ***
Modified: trunk/tools/RosBE-Windows/Tools/buildtime.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/buildtim…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/buildtime.c (original)
+++ trunk/tools/RosBE-Windows/Tools/buildtime.c Wed Oct 24 11:04:52 2007
@@ -1,13 +1,12 @@
/*
- * PROJECT: RosBE - ReactOS Build Environment for Windows
- * LICENSE: GPL - See COPYING in the top level directory
+ * PROJECT: RosBE - ReactOS Build Environment for Windows.
+ * LICENSE: GPL - See LICENSE.txt in the top level directory.
* FILE: Tools/buildtime.c
* PURPOSE: Buildtime Counter
* COPYRIGHT: Copyright 2007 KJK::Hyperion
* Copyright 2007 Peter Ward <dralnix(a)gmail.com>
*
*/
-
#include <windows.h>
#include <time.h>
Added: trunk/tools/RosBE-Windows/Tools/chknewer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/chknewer…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/chknewer.c (added)
+++ trunk/tools/RosBE-Windows/Tools/chknewer.c Wed Oct 24 11:04:52 2007
@@ -1,0 +1,106 @@
+/*
+ * PROJECT: RosBE - ReactOS Build Environment for Windows.
+ * LICENSE: GPL - See LICENSE.txt in the top level directory.
+ * FILE: Tools/chknewer.c
+ * PURPOSE: Check if a file is newer than another.
+ * COPYRIGHT: Copyright 2007 Peter Ward <dralnix(a)gmail.com>
+ *
+ */
+
+#include <time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+time_t
+StatFile(
+ char* FileName
+);
+
+int main(int argc, char* argv[])
+{
+ FILE *FILE1, *FILE2;
+ time_t file1time = 0, file2time = 0;
+
+ if (argc > 3)
+ {
+ printf("%s: Error too many parameters specified.\n", argv[0]);
+ return -1;
+ }
+ if ((argc == 1) ||
+ (!strncmp(argv[1], "/?", 2)) ||
+ (!strncmp(argv[1], "-h", 2)) ||
+ (!strncmp(argv[1], "--help", 6)))
+ {
+ printf("Usage: %s FILE1 FILE2\n", argv[0]);
+ printf("Checks if FILE1 is newer than FILE2 by checking\n");
+ printf("the last data modification time's. Returns 1 if\n");
+ printf("FILE1 is newer and 2 if FILE2 is.\n\n");
+ return 0;
+ }
+
+ FILE1 = fopen(argv[1], "r");
+ if (!FILE1)
+ {
+ printf("%s: Error file \"%s\" doesn't seem to exist.\n",
argv[0], argv[1]);
+ return -1;
+ }
+ else
+ {
+ if (fclose(FILE1))
+ {
+ printf("%s: Error closing file \"%s\"\n", argv[0],
argv[1]);
+ }
+ file1time = StatFile(argv[1]);
+ if (!file1time)
+ {
+ printf("%s: Error unable to aquire stats for file: %s\n", argv[0],
argv[1]);
+ return -1;
+ }
+ }
+
+ FILE2 = fopen(argv[2], "r");
+ if (!FILE2)
+ {
+ printf("%s: Error file \"%s\" doesn't seem to exist.\n",
argv[0], argv[2]);
+ return -1;
+ }
+ else
+ {
+ if (fclose(FILE2))
+ {
+ printf("%s: Error closing file \"%s\"\n", argv[0],
argv[2]);
+ }
+ file2time = StatFile(argv[2]);
+ if (!file2time)
+ {
+ printf("%s: Error unable to aquire stats for file: %s\n", argv[0],
argv[2]);
+ return -1;
+ }
+ }
+
+ if (file1time > file2time)
+ {
+ return 1;
+ }
+ else
+ {
+ return 2;
+ }
+}
+
+time_t StatFile(char* FileName)
+{
+ struct stat filestat;
+
+ if (!stat(FileName, &filestat))
+ {
+ return mktime(localtime(&filestat.st_mtime));
+ }
+ else
+ {
+ return 0;
+ }
+}
Propchange: trunk/tools/RosBE-Windows/Tools/chknewer.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/tools/RosBE-Windows/Tools/cpucount.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/cpucount…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/cpucount.c (original)
+++ trunk/tools/RosBE-Windows/Tools/cpucount.c Wed Oct 24 11:04:52 2007
@@ -1,13 +1,12 @@
/*
- * PROJECT: RosBE - ReactOS Build Environment for Windows
- * LICENSE: GPL - See COPYING in the top level directory
+ * PROJECT: RosBE - ReactOS Build Environment for Windows.
+ * LICENSE: GPL - See LICENSE.txt in the top level directory.
* FILE: Tools/cpucount.c
* PURPOSE: CPU Core Counter
* COPYRIGHT: Copyright 2007 Christoph von Wittich <Christoph_vW(a)reactos.org>
* Copyright 2007 Peter Ward <dralnix(a)gmail.com>
*
*/
-
#include <windows.h>
#include <stdio.h>
Modified: trunk/tools/RosBE-Windows/Tools/echoh.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/echoh.c?…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/echoh.c (original)
+++ trunk/tools/RosBE-Windows/Tools/echoh.c Wed Oct 24 11:04:52 2007
@@ -1,12 +1,11 @@
/*
- * PROJECT: RosBE - ReactOS Build Environment for Windows
- * LICENSE: GPL - See COPYING in the top level directory
+ * PROJECT: RosBE - ReactOS Build Environment for Windows.
+ * LICENSE: GPL - See LICENSE.txt in the top level directory.
* FILE: Tools/echoh.c
* PURPOSE: Converts a value to hex and displays it
* COPYRIGHT: Copyright 2007 Christoph von Wittich <Christoph_vW(a)reactos.org>
*
*/
-
#include <stdio.h>
#include <stdlib.h>
Modified: trunk/tools/RosBE-Windows/Tools/flash.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/flash.c?…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/flash.c (original)
+++ trunk/tools/RosBE-Windows/Tools/flash.c Wed Oct 24 11:04:52 2007
@@ -1,12 +1,11 @@
/*
- * PROJECT: RosBE - ReactOS Build Environment for Windows
- * LICENSE: GPL - See COPYING in the top level directory
+ * PROJECT: RosBE - ReactOS Build Environment for Windows.
+ * LICENSE: GPL - See LICENSE.txt in the top level directory.
* FILE: Tools/flash.c
* PURPOSE: Taskbar Flasher
* COPYRIGHT: Copyright 2007 Ged Murphy <gedmurphy(a)reactos.org>
*
*/
-
#include <windows.h>
Modified: trunk/tools/RosBE-Windows/Tools/getdate.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/getdate.…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/getdate.c (original)
+++ trunk/tools/RosBE-Windows/Tools/getdate.c Wed Oct 24 11:04:52 2007
@@ -1,6 +1,6 @@
/*
- * PROJECT: RosBE - ReactOS Build Environment for Windows
- * LICENSE: GPL - See COPYING in the top level directory
+ * PROJECT: RosBE - ReactOS Build Environment for Windows.
+ * LICENSE: GPL - See LICENSE.txt in the top level directory.
* FILE: Tools/getdate.c
* PURPOSE: Returns System Date
* COPYRIGHT: Copyright 2007 Peter Ward <dralnix(a)gmail.com>
Modified: trunk/tools/RosBE-Windows/Tools/info.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/info.txt…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/info.txt (original)
+++ trunk/tools/RosBE-Windows/Tools/info.txt Wed Oct 24 11:04:52 2007
@@ -1,6 +1,5 @@
Additional Tools needed:
tee:
http://gnuwin32.sourceforge.net/packages/coreutils.htm
-test:
http://gnuwin32.sourceforge.net/packages/coreutils.htm
cut:
http://www.ltr-data.se/files/cut.zip
sed:
http://gnuwin32.sourceforge.net/packages/sed.htm
grep:
http://gnuwin32.sourceforge.net/packages/grep.htm
Modified: trunk/tools/RosBE-Windows/Tools/makefile
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/makefile…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/makefile (original)
+++ trunk/tools/RosBE-Windows/Tools/makefile Wed Oct 24 11:04:52 2007
@@ -7,10 +7,13 @@
LFLAGS := -s
WINVER := 0x502
-all: buildtime cpucount echoh flash getdate
+all: buildtime chknewer cpucount echoh flash getdate
buildtime: buildtime.c
${CC} ${CFLAGS} buildtime buildtime.c
+
+chknewer: chknewer.c
+ ${CC} ${CFLAGS} chknewer chknewer.c
cpucount: cpucount.c
${CC} ${CFLAGS} cpucount cpucount.c
@@ -25,4 +28,4 @@
${CC} ${CFLAGS} getdate getdate.c
clean:
- del buildtime.exe cpucount.exe echoh.exe flash.exe getdate.exe
+ del /f buildtime.exe chknewer.exe cpucount.exe echoh.exe flash.exe getdate.exe