[ros-diffs] [hyperion] 25654: Fixed buildtime, re-enabled in build scripts

hyperion at svn.reactos.org hyperion at svn.reactos.org
Sun Jan 28 02:00:24 CET 2007


Author: hyperion
Date: Sun Jan 28 04:00:24 2007
New Revision: 25654

URL: http://svn.reactos.org/svn/reactos?rev=25654&view=rev
Log:
Fixed buildtime, re-enabled in build scripts

Modified:
    trunk/tools/RosBE/Build-Multi.cmd
    trunk/tools/RosBE/Build.cmd
    trunk/tools/RosBE/Tools/buildtime.c

Modified: trunk/tools/RosBE/Build-Multi.cmd
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/Build-Multi.cmd?rev=25654&r1=25653&r2=25654&view=diff
==============================================================================
--- trunk/tools/RosBE/Build-Multi.cmd (original)
+++ trunk/tools/RosBE/Build-Multi.cmd Sun Jan 28 04:00:24 2007
@@ -46,7 +46,7 @@
 :: Now use mingw32-make to build ReactOS, passing along options, if any.
 ::
 if "%1" == "" (
-    "%_MINGWMAKE%" -j %CPUCOUNT% 2>&1 | "%ROSBEBASEDIR%\Tools\tee.exe" "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
+    "%ROSBEBASEDIR%\Tools\buildtime.exe" "%_MINGWMAKE%" -j %CPUCOUNT% 2>&1 | "%ROSBEBASEDIR%\Tools\tee.exe" "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
 ) else (
-    "%_MINGWMAKE%" -j %CPUCOUNT% %* 2>&1 | "%ROSBEBASEDIR%\Tools\tee.exe" "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
+    "%ROSBEBASEDIR%\Tools\buildtime.exe" "%_MINGWMAKE%" -j %CPUCOUNT% %* 2>&1 | "%ROSBEBASEDIR%\Tools\tee.exe" "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
 )

Modified: trunk/tools/RosBE/Build.cmd
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/Build.cmd?rev=25654&r1=25653&r2=25654&view=diff
==============================================================================
--- trunk/tools/RosBE/Build.cmd (original)
+++ trunk/tools/RosBE/Build.cmd Sun Jan 28 04:00:24 2007
@@ -30,7 +30,7 @@
 :: Now use mingw32-make to build ReactOS, passing along options, if any.
 ::
 if "%1" == "" (
-    "%_MINGWMAKE%" 2>&1 | "%ROSBEBASEDIR%\Tools\tee.exe" "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
+    "%ROSBEBASEDIR%\Tools\buildtime.exe" "%_MINGWMAKE%" 2>&1 | "%ROSBEBASEDIR%\Tools\tee.exe" "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
 ) else (
-    "%_MINGWMAKE%" %* 2>&1 | "%ROSBEBASEDIR%\Tools\tee.exe" "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
+    "%ROSBEBASEDIR%\Tools\buildtime.exe" "%_MINGWMAKE%" %* 2>&1 | "%ROSBEBASEDIR%\Tools\tee.exe" "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
 )

Modified: trunk/tools/RosBE/Tools/buildtime.c
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/Tools/buildtime.c?rev=25654&r1=25653&r2=25654&view=diff
==============================================================================
--- trunk/tools/RosBE/Tools/buildtime.c (original)
+++ trunk/tools/RosBE/Tools/buildtime.c Sun Jan 28 04:00:24 2007
@@ -3,37 +3,78 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
+#include <wctype.h>
+#include <tchar.h>
 
-int main(int argc, char* argv[])
+static LPTSTR SkipSelfArgument(LPTSTR lpszCommandLine)
+{
+	LPTSTR p = lpszCommandLine;
+	int quote = 0;
+
+	// Skip leading whitespace
+	while(*p != 0 && _istspace(*p))
+		++ p;
+
+	if(*p == 0)
+		return p;
+
+	// Skip argument 0
+	// BUGBUG: the assumption is that argument 0 never contains escaped quotes
+	do
+	{
+		if(*p == TEXT('\"'))
+		{
+			quote = !quote;
+			++ p;
+			continue;
+		}
+
+		++ p;
+	}
+	while(*p != 0 && (quote || !_istspace(*p)));
+
+	// Skip trailing whitespace
+	while(*p != 0 && _istspace(*p))
+		++ p;
+
+	return p;
+}
+
+int main()
 {
     LPTSTR CommandLine, FullCommandLine, CommandLineBuffer;
     time_t StartTime, FinishTime;
-    float TotalTime;
+    double TotalTime;
     int Hour, Minute, Second;
-
-    //
-    // If nothing is on the command-line exit
-    //
-    if (argc == 1)
-    {
-        printf("Required parameter not specified. Exiting.\n");
-        return 1;
-    }
+	int ret;
 
     //
     // Get the command line to pass on.
     //
     FullCommandLine = GetCommandLine();
-    CommandLine = &FullCommandLine[strlen(argv[0]) + 1];
-    CommandLineBuffer = (LPTSTR) malloc((strlen(CommandLine) + 3));
+    CommandLine = SkipSelfArgument(FullCommandLine);
+
+    //
+    // If nothing is on the command-line exit
+    //
+    if (CommandLine[0] == 0)
+    {
+		fprintf(stderr, "buildtime: required parameter not specified\n");
+        return 1;
+    }
+
+    CommandLineBuffer = malloc((strlen(CommandLine) + 2 + 1));
     if (!CommandLineBuffer)
     {
-        printf("Unable to allocate memory. Exiting.\n");
+		fprintf(stderr, "buildtime: unable to allocate memory\n");
         return 1;
     }
-    strcpy(CommandLineBuffer, "\"");
+
+	CommandLineBuffer[0] = 0;
+    //strcat(CommandLineBuffer, "\"");
     strcat(CommandLineBuffer, CommandLine);
-    strcat(CommandLineBuffer, "\"");
+    //strcat(CommandLineBuffer, "\"");
 
     //
     // Grab the starting timestamp.
@@ -43,7 +84,7 @@
     //
     // Run the program (Status is 1 on failure).
     //
-    system(CommandLineBuffer);
+    ret = system(CommandLineBuffer);
 
     //
     // Grab the finishing timestamp.
@@ -73,5 +114,5 @@
     //
     free(CommandLineBuffer);
 
-    return 0;
+    return ret;
 }




More information about the Ros-diffs mailing list