Author: peterw Date: Wed Oct 31 18:15:29 2007 New Revision: 30015
URL: http://svn.reactos.org/svn/reactos?rev=30015&view=rev Log: - Make options.exe use APPDATA. - Move the functionality of scut.cmd into a .c file (and use APPDATA for srclist.txt). - Give rosbe-gcc-env.cmd the ability to initialize a GCC without the rest of the scripts. - Changed the options.exe icon to one that fits better with an "options" tool. - options.exe will live in the Tools directory now. - Move Root\srclist.txt to Tools\srclist.txt. - Other miscellaneous cleanup.
Added: trunk/tools/RosBE-Windows/Tools/config/options.ico (with props) trunk/tools/RosBE-Windows/Tools/scut.c (with props) trunk/tools/RosBE-Windows/Tools/srclist.txt - copied, changed from r29979, trunk/tools/RosBE-Windows/Root/srclist.txt Removed: trunk/tools/RosBE-Windows/Root/srclist.txt trunk/tools/RosBE-Windows/Tools/config/reactos.ico Modified: trunk/tools/RosBE-Windows/Root/Build.cmd trunk/tools/RosBE-Windows/Root/Help.cmd trunk/tools/RosBE-Windows/Root/RosBE.cmd trunk/tools/RosBE-Windows/Root/options.cmd trunk/tools/RosBE-Windows/Root/rosbe-gcc-env.cmd trunk/tools/RosBE-Windows/Root/sSVN.cmd trunk/tools/RosBE-Windows/Root/scut.cmd trunk/tools/RosBE-Windows/Tools/chknewer.c trunk/tools/RosBE-Windows/Tools/chkslash.c trunk/tools/RosBE-Windows/Tools/config/options.c trunk/tools/RosBE-Windows/Tools/config/options.rc trunk/tools/RosBE-Windows/Tools/makefile trunk/tools/RosBE-Windows/Tools/tee.c
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 31 18:15:29 2007 @@ -24,7 +24,7 @@ echo *** aborting build. Please check for changes and *** echo *** update your config.rbuild. *** echo. - goto :EOB + goto :EOC ) )
@@ -54,7 +54,7 @@ if defined _ROSBE_OBJPATH ( if not exist "%_ROSBE_OBJPATH%." ( echo ERROR: The path specified doesn't seem to exist. - goto :EOB + goto :EOC ) else ( set ROS_INTERMEDIATE=%_ROSBE_OBJPATH% ) @@ -62,7 +62,7 @@ if defined _ROSBE_OUTPATH ( if not exist "%_ROSBE_OUTPATH%." ( echo ERROR: The path specified doesn't seem to exist. - goto :EOB + goto :EOC ) else ( set ROS_OUTPUT=%_ROSBE_OUTPATH% set ROS_TEMPORARY=%_ROSBE_OUTPATH% @@ -116,15 +116,15 @@ "%_ROSBE_MINGWMAKE%" %* ) ) -goto :EOB +goto :EOC
:BUILDMULTI :: :: Get the number of CPUs in the system so we know how many jobs to execute. :: To modify the number used alter the options used with cpucount: :: No Option - Number of CPUs. -:: -x1 - Number of CPUs, Plus 1. -:: -x2 - Number of CPUs, Doubled. +:: -x1 - Number of CPUs, plus 1. +:: -x2 - Number of CPUs, doubled. :: set CPUCOUNT= for /f "usebackq" %%i in (`cpucount -x1`) do set CPUCOUNT=%%i @@ -143,7 +143,7 @@ ) )
-:EOB +:EOC :: :: Highlight the fact that building has ended. ::
Modified: trunk/tools/RosBE-Windows/Root/Help.cmd URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Root/Help.cmd?r... ============================================================================== --- trunk/tools/RosBE-Windows/Root/Help.cmd (original) +++ trunk/tools/RosBE-Windows/Root/Help.cmd Wed Oct 31 18:15:29 2007 @@ -51,19 +51,18 @@ )
if exist "%_ROSBE_BASEDIR%\scut.cmd" ( - echo scut [OPTIONS] - List, Define, Edit, Remove, Switch and Default to - echo Shortcutted Source-Directories. + echo scut [OPTIONS] - List, add, edit, remove, switch and default to + echo shortcutted ReactOS source directories. )
if exist "%_ROSBE_BASEDIR%\sSVN.cmd" ( - echo ssvn [OPTIONS] - Create, Update or Clean-up your ReactOS Source - echo Tree or show the Revision Number of the Offline - echo Tree and Online HEAD Revision. + echo ssvn [OPTIONS] - Create, update or clean-up your ReactOS source + echo tree or show the revision number of the local + echo and online trees. )
if exist "%_ROSBE_BASEDIR%\options.cmd" ( - echo options - Starts options.exe and restarts RosBE to make - echo the changes effective at the end. + echo options - Starts the RosBE configurator. )
echo. @@ -121,12 +120,12 @@ if exist "%_ROSBE_BASEDIR%\Config.cmd" ( if /i "%1" == "config" ( echo Usage: config [OPTIONS] - echo Creates a Configuration File, which tells RosBE how to build the Tree. + echo Creates a configuration file, which tells RosBE how to build the tree. echo. - echo delete - Deletes the created configuration File and so sets back + echo delete - Deletes the created configuration file and so sets back echo to default settings. - echo update - Deletes the old created configuration File and updats - echo with a new, default one. + echo update - Deletes the old created configuration file and updates + echo it with a new, default one. goto :EOC ) ) @@ -154,45 +153,28 @@ ) if exist "%_ROSBE_BASEDIR%\scut.cmd" ( if /i "%1" == "scut" ( - echo Usage: scut [OPTIONS] - echo Defines, Edits, Removes, Switches and Defaults to Shortcutted Source - echo Directories. scut started without a parameter or with the name of a - echo Shortcut as parameter sets this Shortcut active. - echo. - echo list - Lists all Shortcuts. - echo Optional: "path" as second parameter lists the Paths, too. - echo add - Adds a Shortcut. - echo Optional: "Shortcut" "Directory" as second and third parameter - echo rem - Removes a shortcut. - echo Optional: "Shortcut" as second parameter - echo edit - Edits a shortcut. - echo Optional: "Shortcut" "Directory" as second and third parameter - echo def - Chooses Default Shortcut which is enabled on - echo every start of RosBE. "Default" is the Source - echo Directory as you know it from previous Versions + "%_ROSBE_BASEDIR%\Tools\scut.exe" --help goto :EOC ) ) if exist "%_ROSBE_BASEDIR%\sSVN.cmd" ( if /i "%1" == "ssvn" ( echo Usage: ssvn [OPTIONS] - echo Creates, Updates or cleans up your ReactOS Source Tree or shows the - echo Revision Number of the Offline Tree and Online HEAD Revision. + echo Creates, updates or cleans up your ReactOS source tree or shows the + echo revision number of the local and online trees. echo. - echo update - Updates to HEAD Revision or to a specific one when + echo update - Updates to HEAD revision or to a specific one when echo second parameter specifies one. - echo create - Creates a new ReactOS Source Tree. - echo cleanup - Cleans up and fixes errors in the Source Tree. - echo status - Shows Actual offline Revision Number and online HEAD - echo Revision Number. + echo create - Creates a new ReactOS source tree. + echo cleanup - Cleans up and fixes errors in the source tree. + echo status - Show the current local and online revision numbers. goto :EOC ) ) if exist "%_ROSBE_BASEDIR%\options.cmd" ( if /i "%1" == "options" ( echo Usage: options - echo Starts RosBE Configurator and restarts RosBE afterwards to make the - echo changes effective at the end. + echo Starts the RosBE configurator. goto :EOC ) )
Modified: trunk/tools/RosBE-Windows/Root/RosBE.cmd URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Root/RosBE.cmd?... ============================================================================== --- trunk/tools/RosBE-Windows/Root/RosBE.cmd (original) +++ trunk/tools/RosBE-Windows/Root/RosBE.cmd Wed Oct 31 18:15:29 2007 @@ -34,8 +34,8 @@ :: Check if the user has used the options utility and :: if so, load their options. :: -if exist "%_ROSBE_BASEDIR%\rosbe-options.cmd" ( - call "%_ROSBE_BASEDIR%\rosbe-options.cmd" +if exist "%APPDATA%\RosBE\rosbe-options.cmd" ( + call "%APPDATA%\RosBE\rosbe-options.cmd" )
title ReactOS Build Environment %_ROSBE_VERSION% @@ -52,7 +52,7 @@ if not "%1" == "" ( cls echo Unknown parameter specified. Exiting. - goto :ExitRosBE + goto :EOC )
cls @@ -61,12 +61,11 @@ :EndCommandParse
:: -:: Load the Base Directory from the Shortcut-txt and set it as new -:: Source Directory and add PATH for Tools Folder. +:: Load the base directory from srclist.txt and set it as the +:: new source directory. :: if exist "%_ROSBE_BASEDIR%\scut.cmd" ( - echo. - call "%_ROSBE_BASEDIR%\scut.cmd" run + call "%_ROSBE_BASEDIR%\scut.cmd" )
:: @@ -83,14 +82,17 @@ call :LOADDOSKEYMACROS
:: -:: Look if the Source Folder is empty. If so, ask for using "ssvn create". +:: Look if the ReactOS source directory is empty. If so, +:: inform the user and mention 'ssvn create' (only if ssvn is installed). :: -dir /b "%_ROSBE_ROSSOURCEDIR%" 2>nul | findstr "." >nul -if errorlevel 1 ( - echo No ReactOS Source detected. Please use "ssvn create" to download it. +if exist "%_ROSBE_BASEDIR%\sSVN.cmd" ( + dir /b "%_ROSBE_ROSSOURCEDIR%" 2>nul | findstr "." >nul + if errorlevel 1 ( + echo No ReactOS source detected. Please use "ssvn create" to download it. + ) )
-goto :ExitRosBE +goto :EOC
:: :: Display the banner and set up the environment for the GCC 4.x.x build @@ -127,4 +129,4 @@ if not exist "%_ROSBE_BASEDIR%\options.cmd" ( doskey OPTIONS= ) goto :EOF
-:ExitRosBE +:EOC
Modified: trunk/tools/RosBE-Windows/Root/options.cmd URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Root/options.cm... ============================================================================== --- trunk/tools/RosBE-Windows/Root/options.cmd (original) +++ trunk/tools/RosBE-Windows/Root/options.cmd Wed Oct 31 18:15:29 2007 @@ -13,12 +13,10 @@ :: :: Run options.exe :: -if exist "%_ROSBE_BASEDIR%\options.exe" ( - pushd %_ROSBE_BASEDIR% - call options.exe - popd - if exist "%_ROSBE_BASEDIR%\rosbe-options.cmd" ( - call "%_ROSBE_BASEDIR%\rosbe-options.cmd" +if exist "%_ROSBE_BASEDIR%\Tools\options.exe" ( + call "%_ROSBE_BASEDIR%\Tools\options.exe" + if exist "%APPDATA%\RosBE\rosbe-options.cmd" ( + call "%APPDATA%\RosBE\rosbe-options.cmd" ) ) else ( echo ERROR: options.exe was not found.
Modified: trunk/tools/RosBE-Windows/Root/rosbe-gcc-env.cmd URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Root/rosbe-gcc-... ============================================================================== --- trunk/tools/RosBE-Windows/Root/rosbe-gcc-env.cmd (original) +++ trunk/tools/RosBE-Windows/Root/rosbe-gcc-env.cmd Wed Oct 31 18:15:29 2007 @@ -8,6 +8,18 @@ :: :: @echo off + +:: +:: Check if we are running within the RosBE, and if not +:: initialize GCC for the current directory. +:: +if not defined _ROSBE_MINGWPATH ( + if /i "%1" == "oldmode" ( + set _ROSBE_OLDMODE="" + ) + set _ROSBE_MINGWPATH=%CD% + set _ROSBE_ORIGINALPATH=%PATH% +)
:: :: Set up the GCC 4.x.x build environment.
Modified: trunk/tools/RosBE-Windows/Root/sSVN.cmd URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Root/sSVN.cmd?r... ============================================================================== --- trunk/tools/RosBE-Windows/Root/sSVN.cmd (original) +++ trunk/tools/RosBE-Windows/Root/sSVN.cmd Wed Oct 31 18:15:29 2007 @@ -9,11 +9,11 @@ @echo off
:: -:: Receive the first Parameter and decide what to do. +:: Receive the first parameter and decide what to do. :: if "%1" == "" ( echo No parameter specified. Try 'help [COMMAND]'. - goto :ExitSVN + goto :EOC ) :: :: These two are directly parsed to svn. @@ -25,65 +25,65 @@ ) else ( svn update ) -goto :ExitSVN +goto :EOC ) if /i "%1" == "cleanup" ( title Cleaning... svn cleanup - goto :ExitSVN + goto :EOC ) :: -:: Check if the Folder is empty. If not, output an error. +:: Check if the folder is empty. If not, output an error. ::
if /i "%1" == "create" ( title Creating... if exist ".svn." ( - echo ERROR: Folder already cotains a Reposority. Exiting - goto :ExitSVN + echo ERROR: Folder already cotains a reposority. + goto :EOC ) - dir /b 2>nul|findstr "." >nul + dir /b 2>nul | findstr "." >nul if errorlevel 1 ( svn checkout svn://svn.reactos.org/reactos/trunk/reactos . ) else ( echo ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED ) - goto :ExitSVN + goto :EOC ) :: -:: Output the rev of your and the Online Tree and tell the User if -:: its Up to Date or not. +:: Output the revision of the local and online trees and tell the user if +:: its up to date or not. :: if /i "%1" == "status" ( title Status for /f "usebackq tokens=2" %%i in (`"svn info | find "Revision:""`) do set OFFSVN=%%i for /f "usebackq tokens=2" %%j in (`"svn info svn://svn.reactos.org/reactos/trunk/reactos | find "Revision:""`) do set ONSVN=%%j call :UP - goto :ExitSVN + goto :EOC )
if not "%1" == "" ( - echo Unknown parameter specified. Try 'help [COMMAND]'. - goto :ExitSVN + echo Unknown parameter specified. Try 'help ssvn'. + goto :EOC )
:UP -echo Recent Offline Revision: %OFFSVN% +echo Local Revision: %OFFSVN% echo Online HEAD Revision: %ONSVN% echo. if %OFFSVN% lss %ONSVN% ( - echo Your Tree is not Up to date. Do you want to update it? + echo Your tree is not up to date. Do you want to update it? goto :UP2 ) if %OFFSVN% equ %ONSVN% ( - echo Your Tree is Up to date. - goto :ExitSVN + echo Your tree is up to date. + goto :EOC )
:UP2 -set /p XY="(yes), (no)" +set /p XY="Please enter 'yes' or 'no': " if /i "%XY%"=="yes" %_ROSBE_BASEDIR%\ssvn update -if /i "%XY%"=="no" goto :ExitSVN +if /i "%XY%"=="no" goto :EOC
-:ExitSVN +:EOC title ReactOS Build Environment %_ROSBE_VERSION%
Modified: trunk/tools/RosBE-Windows/Root/scut.cmd URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Root/scut.cmd?r... ============================================================================== --- trunk/tools/RosBE-Windows/Root/scut.cmd (original) +++ trunk/tools/RosBE-Windows/Root/scut.cmd Wed Oct 31 18:15:29 2007 @@ -1,240 +1,47 @@ :: -:: PROJECT: RosBE - ReactOS Build Environment for Windows +:: PROJECT: RosBE - ReactOS Build Environment for Windows. :: LICENSE: GPL - See LICENSE.txt in the top level directory. :: FILE: Root/scut.cmd -:: PURPOSE: Shortcut Creator, Remover and Switcher. +:: PURPOSE: Manages named shortcuts to ReactOS source directories. :: COPYRIGHT: Copyright 2007 Daniel Reimer reimer.daniel@freenet.de -:: +:: Peter Ward dralnix@gmail.com :: @echo off
-title Choose your Source Folder... - -:: -:: Receive the first Parameter and decide what to do. -:: -if /i "%1"=="" ( - goto :DEF -) -if /i "%1"=="add" ( - goto :ADD -) -if /i "%1"=="rem" ( - goto :REM -) -if /i "%1"=="edit" ( - goto :EDIT -) -if /i "%1"=="def" ( - goto :DEF2 -) -if /i "%1"=="list" ( - if /i "%2"=="" ( - echo Shortcuts: - for /f "usebackq tokens=1-2 delims=, skip=1" %%i in (`type "%_ROSBE_BASEDIR%\srclist.txt"`) do echo %%i - ) - if /i "%2"=="path" ( - echo Shortcuts, Paths: - for /f "usebackq tokens=1-2 delims=, skip=1" %%i in (`type "%_ROSBE_BASEDIR%\srclist.txt"`) do echo %%i, %%j - ) - goto :END -) -if /i "%1"=="run" ( - for /f "usebackq tokens=1-2 delims=," %%i in (`type "%_ROSBE_BASEDIR%\srclist.txt"`) do ( - if %%i == Base ( - echo Active Shortcut: %%j - :: - : Set new source directory, if needed. - :: - if not "%%j" == "Default" ( - call "%_ROSBE_BASEDIR%\scut.cmd" %%j - ) +if /i "%1" == "" ( + for /f "usebackq tokens=*" %%i in (`"%_ROSBE_BASEDIR%\Tools\scut.exe"`) do ( + if /i not "%%i" == "Default" ( + cd /d %%i + set _ROSBE_ROSSOURCEDIR=%%i ) ) - goto :END -) else ( - set XY=%1 - goto :RUN + goto :EOC ) -goto :END - -:: -:: Load Shortcut from txt and set it active. -:: -:DEF -set /p XY="Choose your Shortcut: " - -:RUN -if /i "%XY%" == "" ( - echo ERROR: You must enter a valid Shortcut. - goto :END +if /i "%1" == "add" ( + call "%_ROSBE_BASEDIR%\Tools\scut.exe" %* + goto :EOC ) -for /f "usebackq tokens=1-2 delims=, skip=1" %%i in (`type "%_ROSBE_BASEDIR%\srclist.txt"`) do ( - if %%i == %XY% ( - cd /d %%j - goto :END +if /i "%1" == "rem" ( + call "%_ROSBE_BASEDIR%\Tools\scut.exe" %* + goto :EOC +) +if /i "%1" == "edit" ( + call "%_ROSBE_BASEDIR%\Tools\scut.exe" %* + goto :EOC +) +if /i "%1" == "def" ( + call "%_ROSBE_BASEDIR%\Tools\scut.exe" %* + goto :EOC +) +if not "%1" == "" ( + for /f "usebackq tokens=*" %%i in (`""%_ROSBE_BASEDIR%\Tools Test\scut.exe" %*"`) do ( + if /i not "%%i" == "Default" ( + cd /d %%i + set _ROSBE_ROSSOURCEDIR=%%i + ) ) -) -echo ERROR: The Shortcut %XY% does not exist. -goto :END - -:: -:: Add new Shortcut to txt. -:: -:ADD -if not "%2" == "" ( - if not "%3" == "" ( - set CUT=%2 - set DIR=%3 - goto :ADD23 - ) else ( - set CUT=%2 - goto :ADD2 - ) -) else ( - goto :ADD1 + goto :EOC )
-:ADD1 -set /p CUT="Choose your Shortcut: " -if /i "%CUT%" == "" ( - echo ERROR: You must enter a valid Shortcut. - goto :END -) - -:ADD2 -set /p DIR="Choose your Source Folder: " - -:ADD23 -if not exist "%DIR%." ( - echo ERROR: The path specified doesn't seem to exist. - goto :END -) -if /i "%DIR%" == "" ( - echo ERROR: You must enter a valid directory. - goto :END -) -for /f "usebackq tokens=1-2 delims=, skip=1" %%i in (`type "%_ROSBE_BASEDIR%\srclist.txt"`) do ( - if %%i == %CUT% ( - echo A Shortcut with the name %CUT% does already exist. Editing the existing one. - call "%_ROSBE_BASEDIR%\scut.cmd" edit %CUT% %DIR% - goto :END - ) -) -echo %CUT%,%DIR%>> "%_ROSBE_BASEDIR%\srclist.txt" -echo Shortcut %CUT% successfully added. -goto :END - -:: -:: Remove Shortcut from txt. -:: -:REM -if not "%2" == "" ( - set CUTREM=%2 - goto :REM1 -) -set /p CUTREM="Choose your Shortcut: " -if /i "%CUTREM%" == "" ( - echo ERROR: You must enter a valid Shortcut. - goto :END -) - -:REM1 -set _ROSBE_REM=0 -for /f "usebackq tokens=1-2 delims=," %%i in (`type "%_ROSBE_BASEDIR%\srclist.txt"`) do ( - if not %%i == %CUTREM% ( - echo %%i,%%j>> "%_ROSBE_BASEDIR%\srclist2.txt" - ) else ( - set _ROSBE_REM=1 - ) -) -del "%_ROSBE_BASEDIR%\srclist.txt" -ren "%_ROSBE_BASEDIR%\srclist2.txt" srclist.txt -if %_ROSBE_REM% == 0 ( - echo ERROR: The Shortcut %CUTREM% does not exist. -) else ( - echo Shortcut %CUTREM% successfully deleted. -) -goto :END - - -:: -:: Set Default Shortcut. -:: -:DEF2 -if not "%2" == "" ( - set DIR=%2 - goto :DEF1 -) -set /p DIR="Choose your new Default Shortcut: " -if /i "%DIR%" == "" ( - echo ERROR: You must enter a valid Shortcut. - goto :END -) - -:DEF1 -call "%_ROSBE_BASEDIR%\scut.cmd" edit Base %DIR% - -:: -:: Edit a existing Shortcut. -:: -:EDIT -if not "%2" == "" ( - if not "%3" == "" ( - set CUT=%2 - set DIR=%3 - goto :EDIT23 - ) else ( - set CUT=%2 - goto :EDIT2 - ) -) else ( - goto :EDIT1 -) - -:EDIT1 -set /p CUT="Choose your Shortcut: " -if /i "%CUT%" == "" ( - echo ERROR: You must enter a valid Shortcut. - goto :END -) - -:EDIT2 -set /p DIR="Choose your Source Folder: " - -:EDIT23 -if not exist "%DIR%." ( - echo ERROR: The path specified doesn't seem to exist. - goto :END -) -if /i "%DIR%" == "" ( - echo ERROR: You must enter a valid directory. - goto :END -) -set _ROSBE_EDIT=0 -for /f "usebackq tokens=1-2 delims=," %%i in (`type "%_ROSBE_BASEDIR%\srclist.txt"`) do ( - if %%i == %CUT% ( - set _ROSBE_EDIT=1 - if exist "%_ROSBE_BASEDIR%\temporaryfile.tmp" ( - echo %%i,%DIR%>> "%_ROSBE_BASEDIR%\temporaryfile.tmp" - ) else ( - echo %%i,%DIR%> "%_ROSBE_BASEDIR%\temporaryfile.tmp" - ) - ) else ( - if exist "%_ROSBE_BASEDIR%\temporaryfile.tmp" ( - echo %%i,%%j>> "%_ROSBE_BASEDIR%\temporaryfile.tmp" - ) else ( - echo %%i,%%j> "%_ROSBE_BASEDIR%\temporaryfile.tmp" - ) - ) -) -del "%_ROSBE_BASEDIR%\srclist.txt" -ren "%_ROSBE_BASEDIR%\temporaryfile.tmp" srclist.txt -if %_ROSBE_EDIT% == 0 ( - echo ERROR: The Shortcut %CUT% does not exist. -) else ( - echo Shortcut %CUT% successfully edited. -) - -:END +:EOC title ReactOS Build Environment %_ROSBE_VERSION%
Removed: trunk/tools/RosBE-Windows/Root/srclist.txt URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Root/srclist.tx... ============================================================================== --- trunk/tools/RosBE-Windows/Root/srclist.txt (original) +++ trunk/tools/RosBE-Windows/Root/srclist.txt (removed) @@ -1,2 +1,0 @@ -Base,Default -Default,C:\RosBE\Source
Modified: 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 (original) +++ trunk/tools/RosBE-Windows/Tools/chknewer.c Wed Oct 31 18:15:29 2007 @@ -30,8 +30,8 @@ } if ((argc == 1) || (!strncmp(argv[1], "/?", 2)) || - (!strncmp(argv[1], "-h", 2)) || - (!strncmp(argv[1], "--help", 6))) + (!_strnicmp(_strlwr(argv[1]), "-h", 2)) || + (!_strnicmp(_strlwr(argv[1]), "--help", 6))) { printf("Usage: %s FILE1 FILE2\n", argv[0]); printf("Checks if FILE1 is newer than FILE2 by checking\n");
Modified: trunk/tools/RosBE-Windows/Tools/chkslash.c URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/chkslash.... ============================================================================== --- trunk/tools/RosBE-Windows/Tools/chkslash.c (original) +++ trunk/tools/RosBE-Windows/Tools/chkslash.c Wed Oct 31 18:15:29 2007 @@ -22,8 +22,8 @@ } if ((argc == 1) || (!strncmp(argv[1], "/?", 2)) || - (!strncmp(argv[1], "-h", 2)) || - (!strncmp(argv[1], "--help", 6))) + (!_strnicmp(argv[1], "-h", 2)) || + (!_strnicmp(argv[1], "--help", 6))) { printf("Usage: %s STRING\n", argv[0]); printf("Checks if STRING has a backslash or not. Returns\n");
Modified: trunk/tools/RosBE-Windows/Tools/config/options.c URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/config/op... ============================================================================== --- trunk/tools/RosBE-Windows/Tools/config/options.c (original) +++ trunk/tools/RosBE-Windows/Tools/config/options.c Wed Oct 31 18:15:29 2007 @@ -48,7 +48,7 @@ { int foreground, background; BOOL showtime, writelog, useccache, strip, otherobj, otherout; - WCHAR logdir[MAX_PATH], objdir[MAX_PATH], outdir[MAX_PATH], mingwpath[MAX_PATH], checkmgw[MAX_PATH], checklog[MAX_PATH]; + WCHAR logdir[MAX_PATH], objdir[MAX_PATH], outdir[MAX_PATH], mingwpath[MAX_PATH], checkmgw[MAX_PATH], checklog[MAX_PATH], optionsfile[MAX_PATH]; WCHAR msgerror[256]; HANDLE hFile; FILE *pFile; @@ -96,7 +96,9 @@ } CloseHandle(hFile);
- pFile = fopen("rosbe-options.cmd", "w"); + wcscpy(optionsfile, _wgetenv(L"APPDATA")); + wcscat(optionsfile, L"\RosBE\rosbe-options.cmd"); + pFile = _wfopen(optionsfile, L"w"); if (pFile) { fprintf(pFile, "::\n");
Added: trunk/tools/RosBE-Windows/Tools/config/options.ico URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/config/op... ============================================================================== Binary file - no diff available.
Propchange: trunk/tools/RosBE-Windows/Tools/config/options.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
Modified: trunk/tools/RosBE-Windows/Tools/config/options.rc URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/config/op... ============================================================================== --- trunk/tools/RosBE-Windows/Tools/config/options.rc (original) +++ trunk/tools/RosBE-Windows/Tools/config/options.rc Wed Oct 31 18:15:29 2007 @@ -1,7 +1,7 @@ #include <windows.h> #include "resources.h"
-ID_OPTICON ICON "reactos.ico" +ID_OPTICON ICON "options.ico"
1 24 "options.exe.Manifest"
Removed: trunk/tools/RosBE-Windows/Tools/config/reactos.ico URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/config/re... ============================================================================== Binary file - no diff available.
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 31 18:15:29 2007 @@ -7,7 +7,7 @@ LFLAGS := -s WINVER := 0x502
-all: buildtime chknewer chkslash cpucount echoh flash getdate tee +all: buildtime chknewer chkslash cpucount echoh flash getdate scut tee
buildtime: buildtime.c ${CC} ${CFLAGS} buildtime buildtime.c @@ -30,8 +30,11 @@ getdate: getdate.c ${CC} ${CFLAGS} getdate getdate.c
+scut: scut.c + ${CC} ${CFLAGS} scut scut.c + tee: tee.c ${CC} ${CFLAGS} tee tee.c
clean: - del /f buildtime.exe chknewer.exe chkslash.exe cpucount.exe echoh.exe flash.exe getdate.exe tee.exe + del /f buildtime.exe chknewer.exe chkslash.exe cpucount.exe echoh.exe flash.exe getdate.exe scut.exe tee.exe
Added: trunk/tools/RosBE-Windows/Tools/scut.c URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/scut.c?re... ============================================================================== --- trunk/tools/RosBE-Windows/Tools/scut.c (added) +++ trunk/tools/RosBE-Windows/Tools/scut.c Wed Oct 31 18:15:29 2007 @@ -1,0 +1,540 @@ +/* + * PROJECT: RosBE - ReactOS Build Environment for Windows. + * LICENSE: GPL - See LICENSE.txt in the top level directory. + * FILE: Tools/scut.c + * PURPOSE: Manages named shortcuts to ReactOS source directories. + * COPYRIGHT: Copyright 2007 Peter Ward dralnix@gmail.com + * Daniel Reimer reimer.daniel@freenet.de + * + */ + +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +typedef struct _SHORTCUT +{ + char* name; + char* path; + struct _SHORTCUT *next; +} SHORTCUT, *PSHORTCUT; + +#define LINE_MAX 1024 +char* programname; +char shortcutfile[260]; + +PSHORTCUT addshortcut(PSHORTCUT ptr, char* name, char* path); +int checkname(PSHORTCUT head, char* name); +int checkpath(char* path); // Alters path by fully expanding it. +void defaultshortcut(char* name); +PSHORTCUT deleteshortcut(PSHORTCUT ptr, PSHORTCUT *head); +void editshortcut(PSHORTCUT ptr, char* name, char* path); +void freeshortcuts(PSHORTCUT ptr); +PSHORTCUT previousshortcut(PSHORTCUT current, PSHORTCUT head); +PSHORTCUT readshortcuts(void); +int writeshortcuts(PSHORTCUT head); + +int main(int argc, char* argv[]) +{ + PSHORTCUT shortcuts = NULL, current = NULL; + char name[260], path[260]; + int removed = 0; + programname = argv[0]; + + strcpy(shortcutfile, getenv("APPDATA")); + strcat(shortcutfile, "\RosBE\srclist.txt"); + + if (argc > 4) + { + fprintf(stderr, "%s: Error too many parameters specified.\n", programname); + return -1; + } + if (argc == 1) + { + defaultshortcut(NULL); + } + else if ((!strncmp(argv[1], "/?", 2)) || + (!_strnicmp(argv[1], "-h", 2)) || + (!_strnicmp(argv[1], "--help", 6))) + { + printf("Usage: %s [OPTIONS] [SHORTCUT] [PATH]\n", programname); + printf("Manages named shortcuts to ReactOS source directories. scut started\n"); + printf("with the name of a shortcut sets this shortcut active.\n\n"); + printf("The following details the options:\n\n"); + printf(" list - Lists all shortcuts and their paths.\n"); + printf(" add - Adds a shortcut.\n"); + printf(" (Optional: SHORTCUT PATH as the second and third parameters)\n"); + printf(" rem - Removes a shortcut.\n"); + printf(" (Optional: SHORTCUT as the second parameter)\n"); + printf(" edit - Edits a shortcut.\n"); + printf(" (Optional: SHORTCUT PATH as the second and third parameters)\n"); + printf(" def - Sets the default shortcut which is enabled on\n"); + printf(" every start of RosBE. 'Default' is the source\n"); + printf(" directory as you know it from previous versions.\n\n"); + return 0; + } + else if (!_strnicmp(argv[1], "list", 4)) + { + shortcuts = readshortcuts(); + current = shortcuts; + + printf("All available shortcuts:\n\n"); + while(current) + { + printf("Shortcut Name: %s\n", current->name); + printf(" -> Path: %s\n", current->path); + current = current->next; + } + freeshortcuts(shortcuts); + } + else if (!_strnicmp(argv[1], "add", 3)) + { + shortcuts = readshortcuts(); + current = shortcuts; + + if (argc >= 3) + { + strcpy(name, argv[2]); + } + else + { + do + { + printf("Please enter a name for the shortcut: "); + fflush(stdin); + fgets(name, 260, stdin); + } while(strlen(name) == 1); + strcpy(name, strtok(name, "\n")); + } + if (!checkname(shortcuts, name)) + { + fprintf(stderr, "%s: Shortcut '%s' already exists.\n", programname, name); + } + else + { + if (argc == 4) + { + strcpy(path, argv[3]); + } + else + { + do + { + printf("Please enter the path for the shortcut: "); + fflush(stdin); + fgets(path, 260, stdin); + } while(strlen(path) == 1); + strcpy(path, strtok(path, "\n")); + } + if (!checkpath(path)) + { + fprintf(stderr, "%s: Directory '%s' doesn't exist.\n", programname, path); + } + else + { + shortcuts = addshortcut(shortcuts, name, path); + writeshortcuts(shortcuts); + } + } + freeshortcuts(shortcuts); + } + else if (!_strnicmp(argv[1], "rem", 3)) + { + shortcuts = readshortcuts(); + current = shortcuts; + + if (argc >= 3) + { + strcpy(name, argv[2]); + } + else + { + do + { + printf("Please enter the name of the shortcut to remove: "); + fflush(stdin); + fgets(name, 260, stdin); + } while(strlen(name) == 1); + strcpy(name, strtok(name, "\n")); + } + if (!_stricmp(name, "Default")) + { + fprintf(stderr, "%s: Unable to remove default shortcut.\n", programname); + } + else + { + while(current) + { + if (!_stricmp(current->name, name)) + { + current = deleteshortcut(current, &shortcuts); + removed = 1; + break; + } + current = current->next; + } + if (removed) + { + writeshortcuts(shortcuts); + printf("Removed shortcut: %s\n", name); + } + else + { + printf("Unable to find shortcut: %s\n", name); + } + } + freeshortcuts(shortcuts); + } + else if (!_strnicmp(argv[1], "edit", 4)) + { + shortcuts = readshortcuts(); + current = shortcuts; + + if (argc >= 3) + { + strcpy(name, argv[2]); + } + else + { + do + { + printf("Please enter the name of the shortcut to edit: "); + fflush(stdin); + fgets(name, 260, stdin); + } while(strlen(name) == 1); + strcpy(name, strtok(name, "\n")); + } + if (!_stricmp(name, "Default") || checkname(shortcuts, name)) + { + fprintf(stderr, "%s: Shortcut '%s' doesn't exist.\n", programname, name); + } + else + { + while(current) + { + if (!_stricmp(current->name, name)) + { + if (argc == 4) + { + strcpy(path, argv[3]); + } + else + { + do + { + printf("Please enter a new path for the shortcut: "); + fflush(stdin); + fgets(path, 260, stdin); + } while(strlen(path) == 1); + strcpy(path, strtok(path, "\n")); + } + if (!checkpath(path)) + { + fprintf(stderr, "%s: Directory '%s' doesn't exist.\n", programname, path); + break; + } + else + { + editshortcut(current, name, path); + writeshortcuts(shortcuts); + printf("Edited shortcut: %s\n", name); + break; + } + } + current = current->next; + } + } + freeshortcuts(shortcuts); + } + else if (!_strnicmp(argv[1], "def", 3)) + { + shortcuts = readshortcuts(); + current = shortcuts; + + if (argc >= 3) + { + strcpy(name, argv[2]); + } + else + { + do + { + printf("Please enter the the name of the shortcut to set as default: "); + fflush(stdin); + fgets(name, 260, stdin); + } while(strlen(name) == 1); + strcpy(name, strtok(name, "\n")); + } + if (!_stricmp(name, "Default") || checkname(shortcuts, name)) + { + fprintf(stderr, "%s: Shortcut '%s' doesn't exist.\n", programname, name); + freeshortcuts(shortcuts); + } + else + { + freeshortcuts(shortcuts); + defaultshortcut(name); + } + } + else + { + shortcuts = readshortcuts(); + current = shortcuts; + + strcpy(name, argv[1]); + if (!_stricmp(name, "Default") || checkname(shortcuts, name)) + { + fprintf(stderr, "%s: Shortcut '%s' doesn't exist.\n", programname, name); + } + else + { + while(current) + { + if (!_stricmp(current->name, name)) + { + printf("%s", current->path); + break; + } + current = current->next; + } + } + freeshortcuts(shortcuts); + } + + return 0; +} + +PSHORTCUT addshortcut(PSHORTCUT ptr, char* name, char* path) +{ + if (!ptr) + { + ptr = (PSHORTCUT)malloc(sizeof(SHORTCUT)); + ptr->name = (char*)malloc(strlen(name) + 1); + strcpy(ptr->name, name); + ptr->path = (char*)malloc(strlen(path) + 1); + strcpy(ptr->path, path); + ptr->next = NULL; + } + else + { + ptr->next = addshortcut(ptr->next, name, path); + } + + return ptr; +} + +int checkname(PSHORTCUT head, char* name) +{ + PSHORTCUT current = head; + + while(current) + { + if (!_stricmp(current->name, name)) + { + return 0; + } + current = current->next; + } + + return 1; +} + +int checkpath(char* path) +{ + char currentdir[260]; + getcwd(currentdir, 260); + if (!chdir(path)) + { + getcwd(path, 260); + chdir(currentdir); + return 1; + } + + return 0; +} + +void defaultshortcut(char* name) +{ + PSHORTCUT shortcuts = NULL, current = NULL; + char path[260]; + + shortcuts = readshortcuts(); + current = shortcuts; + + if (!name) + { + while(current) + { + if (!_stricmp(current->name, "Default")) + { + printf("%s", current->path); + break; + } + current = current->next; + } + } + else + { + while(current) + { + if (!_stricmp(current->name, name)) + { + strcpy(path, current->path); + current = shortcuts; + while(current) + { + if (!_stricmp(current->name, "Default")) + { + editshortcut(current, "Default", path); + writeshortcuts(shortcuts); + printf("Default shortcut set to: %s\n", path); + break; + } + current = current->next; + } + break; + } + current = current->next; + } + } + + freeshortcuts(shortcuts); +} + +PSHORTCUT deleteshortcut(PSHORTCUT current, PSHORTCUT *head) +{ + PSHORTCUT temp = NULL; + PSHORTCUT previous = NULL; + + if (current) + { + temp = current; + if (current != *head) + { + previous = previousshortcut(current, *head); + current = current->next; + previous->next = current; + } + else + { + *head = current->next; + } + if (temp->name) free(temp->name); + if (temp->path) free(temp->path); + free(temp); + } + + return current; +} + +void editshortcut(PSHORTCUT current, char* name, char* path) +{ + if (current) + { + if (name) + { + current->name = (char*)realloc(current->name, strlen(name) + 1); + strcpy(current->name, name); + } + if (path) + { + current->path = (char*)realloc(current->path, strlen(path) + 1); + strcpy(current->path, path); + } + } +} + +void freeshortcuts(PSHORTCUT head) +{ + PSHORTCUT temp = NULL; + + while (head) + { + temp = head; + head = head->next; + if (temp->name) free(temp->name); + if (temp->path) free(temp->path); + free(temp); + } +} + +PSHORTCUT previousshortcut(PSHORTCUT current, PSHORTCUT head) +{ + PSHORTCUT temp = head; + + if(current == head) + { + return head; + } + + while(temp->next != current) + { + temp = temp->next; + } + + return temp; +} + +PSHORTCUT readshortcuts(void) +{ + FILE *FILE; + PSHORTCUT head = NULL; + char strbuff[LINE_MAX]; + char *name = NULL, *path = NULL; + + FILE = fopen(shortcutfile, "r"); + if (!FILE) + { + fprintf(stderr, "%s: Error file doesn't seem to exist.\n", programname); + return NULL; + } + else + { + while(!feof(FILE)) + { + fgets(strbuff, LINE_MAX, FILE); + name = strtok(strbuff, ","); + path = strtok(NULL, "\n"); + if (name && path) + { + head = addshortcut(head, name, path); + } + } + if (fclose(FILE)) + { + fprintf(stderr, "%s: Error closing file.\n", programname); + freeshortcuts(head); + return NULL; + } + } + + return head; +} + +int writeshortcuts(PSHORTCUT head) +{ + FILE *FILE; + + FILE = fopen(shortcutfile, "w"); + if (!FILE) + { + fprintf(stderr, "%s: Error file doesn't seem to exist.\n", programname); + return -1; + } + else + { + while(head) + { + fprintf(FILE, "%s,%s\n", head->name, head->path); + head = head->next; + } + if (fclose(FILE)) + { + fprintf(stderr, "%s: Error closing file.\n", programname); + return -1; + } + } + + return 0; +}
Propchange: trunk/tools/RosBE-Windows/Tools/scut.c ------------------------------------------------------------------------------ svn:eol-style = native
Copied: trunk/tools/RosBE-Windows/Tools/srclist.txt (from r29979, trunk/tools/RosBE-Windows/Root/srclist.txt) URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/srclist.t... ============================================================================== --- trunk/tools/RosBE-Windows/Root/srclist.txt (original) +++ trunk/tools/RosBE-Windows/Tools/srclist.txt Wed Oct 31 18:15:29 2007 @@ -1,2 +1,1 @@ -Base,Default -Default,C:\RosBE\Source +Default,Default
Modified: trunk/tools/RosBE-Windows/Tools/tee.c URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/tee.c?rev... ============================================================================== --- trunk/tools/RosBE-Windows/Tools/tee.c (original) +++ trunk/tools/RosBE-Windows/Tools/tee.c Wed Oct 31 18:15:29 2007 @@ -22,8 +22,8 @@ } if ((argc == 1) || (!strncmp(argv[1], "/?", 2)) || - (!strncmp(argv[1], "-h", 2)) || - (!strncmp(argv[1], "--help", 6))) + (!_strnicmp(argv[1], "-h", 2)) || + (!_strnicmp(argv[1], "--help", 6))) { printf("Usage: %s FILE\n", argv[0]); printf("Takes standard input and sends it to standard output\n");