| xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 1 | @echo off
 | 
 | 2 | rem ***************************************************************************
 | 
 | 3 | rem *                                  _   _ ____  _
 | 
 | 4 | rem *  Project                     ___| | | |  _ \| |
 | 
 | 5 | rem *                             / __| | | | |_) | |
 | 
 | 6 | rem *                            | (__| |_| |  _ <| |___
 | 
 | 7 | rem *                             \___|\___/|_| \_\_____|
 | 
 | 8 | rem *
 | 
 | 9 | rem * Copyright (C) 2014 - 2022, Steve Holme, <steve_holme@hotmail.com>.
 | 
 | 10 | rem *
 | 
 | 11 | rem * This software is licensed as described in the file COPYING, which
 | 
 | 12 | rem * you should have received as part of this distribution. The terms
 | 
 | 13 | rem * are also available at https://curl.se/docs/copyright.html.
 | 
 | 14 | rem *
 | 
 | 15 | rem * You may opt to use, copy, modify, merge, publish, distribute and/or sell
 | 
 | 16 | rem * copies of the Software, and permit persons to whom the Software is
 | 
 | 17 | rem * furnished to do so, under the terms of the COPYING file.
 | 
 | 18 | rem *
 | 
 | 19 | rem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 | 
 | 20 | rem * KIND, either express or implied.
 | 
 | 21 | rem * 
 | 
 | 22 | rem * SPDX-License-Identifier: curl
 | 
 | 23 | rem *
 | 
 | 24 | rem ***************************************************************************
 | 
 | 25 | 
 | 
 | 26 | :begin
 | 
 | 27 |   rem Check we are running on a Windows NT derived OS
 | 
 | 28 |   if not "%OS%" == "Windows_NT" goto nodos
 | 
 | 29 | 
 | 
 | 30 |   rem Set our variables
 | 
 | 31 |   setlocal ENABLEEXTENSIONS
 | 
 | 32 |   set VERSION=ALL
 | 
 | 33 |   set MODE=GENERATE
 | 
 | 34 | 
 | 
 | 35 |   rem Check we are not running on a network drive
 | 
 | 36 |   if "%~d0."=="\\." goto nonetdrv
 | 
 | 37 | 
 | 
 | 38 |   rem Switch to this batch file's directory
 | 
 | 39 |   cd /d "%~0\.." 1>NUL 2>&1
 | 
 | 40 | 
 | 
 | 41 |   rem Check we are running from a curl git repository
 | 
 | 42 |   if not exist ..\GIT-INFO goto norepo
 | 
 | 43 | 
 | 
 | 44 | :parseArgs
 | 
 | 45 |   if "%~1" == "" goto start
 | 
 | 46 | 
 | 
 | 47 |   if /i "%~1" == "pre" (
 | 
 | 48 |     set VERSION=PRE
 | 
 | 49 |   ) else if /i "%~1" == "vc10" (
 | 
 | 50 |     set VERSION=VC10
 | 
 | 51 |   ) else if /i "%~1" == "vc11" (
 | 
 | 52 |     set VERSION=VC11
 | 
 | 53 |   ) else if /i "%~1" == "vc12" (
 | 
 | 54 |     set VERSION=VC12
 | 
 | 55 |   ) else if /i "%~1" == "vc14" (
 | 
 | 56 |     set VERSION=VC14
 | 
 | 57 |   ) else if /i "%~1" == "vc14.10" (
 | 
 | 58 |     set VERSION=VC14.10
 | 
 | 59 |   ) else if /i "%~1" == "vc14.30" (
 | 
 | 60 |     set VERSION=VC14.30
 | 
 | 61 |   ) else if /i "%~1" == "-clean" (
 | 
 | 62 |     set MODE=CLEAN
 | 
 | 63 |   ) else if /i "%~1" == "-?" (
 | 
 | 64 |     goto syntax
 | 
 | 65 |   ) else if /i "%~1" == "-h" (
 | 
 | 66 |     goto syntax
 | 
 | 67 |   ) else if /i "%~1" == "-help" (
 | 
 | 68 |     goto syntax
 | 
 | 69 |   ) else (
 | 
 | 70 |     goto unknown
 | 
 | 71 |   )
 | 
 | 72 | 
 | 
 | 73 |   shift & goto parseArgs
 | 
 | 74 | 
 | 
 | 75 | :start
 | 
 | 76 |   if exist ..\buildconf.bat (
 | 
 | 77 |     if "%MODE%" == "GENERATE" (
 | 
 | 78 |       call ..\buildconf
 | 
 | 79 |     ) else if "%VERSION%" == "PRE" (
 | 
 | 80 |       call ..\buildconf -clean
 | 
 | 81 |     ) else if "%VERSION%" == "ALL" (
 | 
 | 82 |       call ..\buildconf -clean
 | 
 | 83 |     )
 | 
 | 84 |   )
 | 
 | 85 |   if "%VERSION%" == "PRE" goto success
 | 
 | 86 |   if "%VERSION%" == "VC10" goto vc10
 | 
 | 87 |   if "%VERSION%" == "VC11" goto vc11
 | 
 | 88 |   if "%VERSION%" == "VC12" goto vc12
 | 
 | 89 |   if "%VERSION%" == "VC14" goto vc14
 | 
 | 90 |   if "%VERSION%" == "VC14.10" goto vc14.10
 | 
 | 91 |   if "%VERSION%" == "VC14.30" goto vc14.30
 | 
 | 92 | 
 | 
 | 93 | :vc10
 | 
 | 94 |   echo.
 | 
 | 95 | 
 | 
 | 96 |   if "%MODE%" == "GENERATE" (
 | 
 | 97 |     echo Generating VC10 project files
 | 
 | 98 |     call :generate vcxproj Windows\VC10\src\curl.tmpl Windows\VC10\src\curl.vcxproj
 | 
 | 99 |     call :generate vcxproj Windows\VC10\lib\libcurl.tmpl Windows\VC10\lib\libcurl.vcxproj
 | 
 | 100 |   ) else (
 | 
 | 101 |     echo Removing VC10 project files
 | 
 | 102 |     call :clean Windows\VC10\src\curl.vcxproj
 | 
 | 103 |     call :clean Windows\VC10\lib\libcurl.vcxproj
 | 
 | 104 |   )
 | 
 | 105 | 
 | 
 | 106 |   if not "%VERSION%" == "ALL" goto success
 | 
 | 107 | 
 | 
 | 108 | :vc11
 | 
 | 109 |   echo.
 | 
 | 110 | 
 | 
 | 111 |   if "%MODE%" == "GENERATE" (
 | 
 | 112 |     echo Generating VC11 project files
 | 
 | 113 |     call :generate vcxproj Windows\VC11\src\curl.tmpl Windows\VC11\src\curl.vcxproj
 | 
 | 114 |     call :generate vcxproj Windows\VC11\lib\libcurl.tmpl Windows\VC11\lib\libcurl.vcxproj
 | 
 | 115 |   ) else (
 | 
 | 116 |     echo Removing VC11 project files
 | 
 | 117 |     call :clean Windows\VC11\src\curl.vcxproj
 | 
 | 118 |     call :clean Windows\VC11\lib\libcurl.vcxproj
 | 
 | 119 |   )
 | 
 | 120 | 
 | 
 | 121 |   if not "%VERSION%" == "ALL" goto success
 | 
 | 122 | 
 | 
 | 123 | :vc12
 | 
 | 124 |   echo.
 | 
 | 125 | 
 | 
 | 126 |   if "%MODE%" == "GENERATE" (
 | 
 | 127 |     echo Generating VC12 project files
 | 
 | 128 |     call :generate vcxproj Windows\VC12\src\curl.tmpl Windows\VC12\src\curl.vcxproj
 | 
 | 129 |     call :generate vcxproj Windows\VC12\lib\libcurl.tmpl Windows\VC12\lib\libcurl.vcxproj
 | 
 | 130 |   ) else (
 | 
 | 131 |     echo Removing VC12 project files
 | 
 | 132 |     call :clean Windows\VC12\src\curl.vcxproj
 | 
 | 133 |     call :clean Windows\VC12\lib\libcurl.vcxproj
 | 
 | 134 |   )
 | 
 | 135 | 
 | 
 | 136 |   if not "%VERSION%" == "ALL" goto success
 | 
 | 137 | 
 | 
 | 138 | :vc14
 | 
 | 139 |   echo.
 | 
 | 140 | 
 | 
 | 141 |   if "%MODE%" == "GENERATE" (
 | 
 | 142 |     echo Generating VC14 project files
 | 
 | 143 |     call :generate vcxproj Windows\VC14\src\curl.tmpl Windows\VC14\src\curl.vcxproj
 | 
 | 144 |     call :generate vcxproj Windows\VC14\lib\libcurl.tmpl Windows\VC14\lib\libcurl.vcxproj
 | 
 | 145 |   ) else (
 | 
 | 146 |     echo Removing VC14 project files
 | 
 | 147 |     call :clean Windows\VC14\src\curl.vcxproj
 | 
 | 148 |     call :clean Windows\VC14\lib\libcurl.vcxproj
 | 
 | 149 |   )
 | 
 | 150 | 
 | 
 | 151 |   if not "%VERSION%" == "ALL" goto success
 | 
 | 152 | 
 | 
 | 153 | :vc14.10
 | 
 | 154 |   echo.
 | 
 | 155 | 
 | 
 | 156 |   if "%MODE%" == "GENERATE" (
 | 
 | 157 |     echo Generating VC14.10 project files
 | 
 | 158 |     call :generate vcxproj Windows\VC14.10\src\curl.tmpl Windows\VC14.10\src\curl.vcxproj
 | 
 | 159 |     call :generate vcxproj Windows\VC14.10\lib\libcurl.tmpl Windows\VC14.10\lib\libcurl.vcxproj
 | 
 | 160 |   ) else (
 | 
 | 161 |     echo Removing VC14.10 project files
 | 
 | 162 |     call :clean Windows\VC14.10\src\curl.vcxproj
 | 
 | 163 |     call :clean Windows\VC14.10\lib\libcurl.vcxproj
 | 
 | 164 |   )
 | 
 | 165 | 
 | 
 | 166 |   if not "%VERSION%" == "ALL" goto success
 | 
 | 167 | 
 | 
 | 168 | :vc14.30
 | 
 | 169 |   echo.
 | 
 | 170 | 
 | 
 | 171 |   if "%MODE%" == "GENERATE" (
 | 
 | 172 |     echo Generating VC14.30 project files
 | 
 | 173 |     call :generate vcxproj Windows\VC14.30\src\curl.tmpl Windows\VC14.30\src\curl.vcxproj
 | 
 | 174 |     call :generate vcxproj Windows\VC14.30\lib\libcurl.tmpl Windows\VC14.30\lib\libcurl.vcxproj
 | 
 | 175 |   ) else (
 | 
 | 176 |     echo Removing VC14.30 project files
 | 
 | 177 |     call :clean Windows\VC14.30\src\curl.vcxproj
 | 
 | 178 |     call :clean Windows\VC14.30\lib\libcurl.vcxproj
 | 
 | 179 |   )
 | 
 | 180 | 
 | 
 | 181 |   goto success
 | 
 | 182 | 
 | 
 | 183 | rem Main generate function.
 | 
 | 184 | rem
 | 
 | 185 | rem %1 - Project Type (vcxproj for VC10, VC11, VC12, VC14, VC14.10 and VC14.30)
 | 
 | 186 | rem %2 - Input template file
 | 
 | 187 | rem %3 - Output project file
 | 
 | 188 | rem
 | 
 | 189 | :generate
 | 
 | 190 |   if not exist %2 (
 | 
 | 191 |     echo.
 | 
 | 192 |     echo Error: Cannot open %2
 | 
 | 193 |     exit /B
 | 
 | 194 |   )
 | 
 | 195 | 
 | 
 | 196 |   if exist %3 (
 | 
 | 197 |     del %3
 | 
 | 198 |   )
 | 
 | 199 | 
 | 
 | 200 |   echo * %CD%\%3
 | 
 | 201 |   for /f "usebackq delims=" %%i in (`"findstr /n ^^ %2"`) do (
 | 
 | 202 |     set "var=%%i"
 | 
 | 203 |     setlocal enabledelayedexpansion
 | 
 | 204 |     set "var=!var:*:=!"
 | 
 | 205 | 
 | 
 | 206 |     if "!var!" == "CURL_SRC_C_FILES" (
 | 
 | 207 |       for /f "delims=" %%c in ('dir /b ..\src\*.c') do call :element %1 src "%%c" %3
 | 
 | 208 |     ) else if "!var!" == "CURL_SRC_H_FILES" (
 | 
 | 209 |       for /f "delims=" %%h in ('dir /b ..\src\*.h') do call :element %1 src "%%h" %3
 | 
 | 210 |     ) else if "!var!" == "CURL_SRC_RC_FILES" (
 | 
 | 211 |       for /f "delims=" %%r in ('dir /b ..\src\*.rc') do call :element %1 src "%%r" %3
 | 
 | 212 |     ) else if "!var!" == "CURL_SRC_X_C_FILES" (
 | 
 | 213 |       call :element %1 lib "strtoofft.c" %3
 | 
 | 214 |       call :element %1 lib "timediff.c" %3
 | 
 | 215 |       call :element %1 lib "nonblock.c" %3
 | 
 | 216 |       call :element %1 lib "warnless.c" %3
 | 
 | 217 |       call :element %1 lib "curl_multibyte.c" %3
 | 
 | 218 |       call :element %1 lib "version_win32.c" %3
 | 
 | 219 |       call :element %1 lib "dynbuf.c" %3
 | 
 | 220 |     ) else if "!var!" == "CURL_SRC_X_H_FILES" (
 | 
 | 221 |       call :element %1 lib "config-win32.h" %3
 | 
 | 222 |       call :element %1 lib "curl_setup.h" %3
 | 
 | 223 |       call :element %1 lib "strtoofft.h" %3
 | 
 | 224 |       call :element %1 lib "timediff.h" %3
 | 
 | 225 |       call :element %1 lib "nonblock.h" %3
 | 
 | 226 |       call :element %1 lib "warnless.h" %3
 | 
 | 227 |       call :element %1 lib "curl_ctype.h" %3
 | 
 | 228 |       call :element %1 lib "curl_multibyte.h" %3
 | 
 | 229 |       call :element %1 lib "version_win32.h" %3
 | 
 | 230 |       call :element %1 lib "dynbuf.h" %3
 | 
 | 231 |     ) else if "!var!" == "CURL_LIB_C_FILES" (
 | 
 | 232 |       for /f "delims=" %%c in ('dir /b ..\lib\*.c') do call :element %1 lib "%%c" %3
 | 
 | 233 |     ) else if "!var!" == "CURL_LIB_H_FILES" (
 | 
 | 234 |       for /f "delims=" %%h in ('dir /b ..\include\curl\*.h') do call :element %1 include\curl "%%h" %3
 | 
 | 235 |       for /f "delims=" %%h in ('dir /b ..\lib\*.h') do call :element %1 lib "%%h" %3
 | 
 | 236 |     ) else if "!var!" == "CURL_LIB_RC_FILES" (
 | 
 | 237 |       for /f "delims=" %%r in ('dir /b ..\lib\*.rc') do call :element %1 lib "%%r" %3
 | 
 | 238 |     ) else if "!var!" == "CURL_LIB_VAUTH_C_FILES" (
 | 
 | 239 |       for /f "delims=" %%c in ('dir /b ..\lib\vauth\*.c') do call :element %1 lib\vauth "%%c" %3
 | 
 | 240 |     ) else if "!var!" == "CURL_LIB_VAUTH_H_FILES" (
 | 
 | 241 |       for /f "delims=" %%h in ('dir /b ..\lib\vauth\*.h') do call :element %1 lib\vauth "%%h" %3
 | 
 | 242 |     ) else if "!var!" == "CURL_LIB_VQUIC_C_FILES" (
 | 
 | 243 |       for /f "delims=" %%c in ('dir /b ..\lib\vquic\*.c') do call :element %1 lib\vquic "%%c" %3
 | 
 | 244 |     ) else if "!var!" == "CURL_LIB_VQUIC_H_FILES" (
 | 
 | 245 |       for /f "delims=" %%h in ('dir /b ..\lib\vquic\*.h') do call :element %1 lib\vquic "%%h" %3
 | 
 | 246 |     ) else if "!var!" == "CURL_LIB_VSSH_C_FILES" (
 | 
 | 247 |       for /f "delims=" %%c in ('dir /b ..\lib\vssh\*.c') do call :element %1 lib\vssh "%%c" %3
 | 
 | 248 |     ) else if "!var!" == "CURL_LIB_VSSH_H_FILES" (
 | 
 | 249 |       for /f "delims=" %%h in ('dir /b ..\lib\vssh\*.h') do call :element %1 lib\vssh "%%h" %3
 | 
 | 250 |     ) else if "!var!" == "CURL_LIB_VTLS_C_FILES" (
 | 
 | 251 |       for /f "delims=" %%c in ('dir /b ..\lib\vtls\*.c') do call :element %1 lib\vtls "%%c" %3
 | 
 | 252 |     ) else if "!var!" == "CURL_LIB_VTLS_H_FILES" (
 | 
 | 253 |       for /f "delims=" %%h in ('dir /b ..\lib\vtls\*.h') do call :element %1 lib\vtls "%%h" %3
 | 
 | 254 |     ) else (
 | 
 | 255 |       echo.!var!>> %3
 | 
 | 256 |     )
 | 
 | 257 | 
 | 
 | 258 |     endlocal
 | 
 | 259 |   )
 | 
 | 260 |   exit /B
 | 
 | 261 | 
 | 
 | 262 | rem Generates a single file xml element.
 | 
 | 263 | rem
 | 
 | 264 | rem %1 - Project Type (vcxproj for VC10, VC11, VC12, VC14, VC14.10 and VC14.30)
 | 
 | 265 | rem %2 - Directory (src, lib, lib\vauth, lib\vquic, lib\vssh, lib\vtls)
 | 
 | 266 | rem %3 - Source filename
 | 
 | 267 | rem %4 - Output project file
 | 
 | 268 | rem
 | 
 | 269 | :element
 | 
 | 270 |   set "SPACES=    "
 | 
 | 271 |   if "%2" == "lib\vauth" (
 | 
 | 272 |     set "TABS=				"
 | 
 | 273 |   ) else if "%2" == "lib\vquic" (
 | 
 | 274 |     set "TABS=				"
 | 
 | 275 |   ) else if "%2" == "lib\vssh" (
 | 
 | 276 |     set "TABS=				"
 | 
 | 277 |   ) else if "%2" == "lib\vtls" (
 | 
 | 278 |     set "TABS=				"
 | 
 | 279 |   ) else (
 | 
 | 280 |     set "TABS=			"
 | 
 | 281 |   )
 | 
 | 282 | 
 | 
 | 283 |   call :extension %3 ext
 | 
 | 284 | 
 | 
 | 285 |   if "%1" == "dsp" (
 | 
 | 286 |     echo # Begin Source File>> %4
 | 
 | 287 |     echo.>> %4
 | 
 | 288 |     echo SOURCE=..\..\..\..\%2\%~3>> %4
 | 
 | 289 |     echo # End Source File>> %4
 | 
 | 290 |   ) else if "%1" == "vcproj1" (
 | 
 | 291 |     echo %TABS%^<File>> %4
 | 
 | 292 |     echo %TABS%	RelativePath="..\..\..\..\%2\%~3"^>>> %4
 | 
 | 293 |     echo %TABS%^</File^>>> %4
 | 
 | 294 |   ) else if "%1" == "vcproj2" (
 | 
 | 295 |     echo %TABS%^<File>> %4
 | 
 | 296 |     echo %TABS%	RelativePath="..\..\..\..\%2\%~3">> %4
 | 
 | 297 |     echo %TABS%^>>> %4
 | 
 | 298 |     echo %TABS%^</File^>>> %4
 | 
 | 299 |   ) else if "%1" == "vcxproj" (
 | 
 | 300 |     if "%ext%" == "c" (
 | 
 | 301 |       echo %SPACES%^<ClCompile Include=^"..\..\..\..\%2\%~3^" /^>>> %4
 | 
 | 302 |     ) else if "%ext%" == "h" (
 | 
 | 303 |       echo %SPACES%^<ClInclude Include=^"..\..\..\..\%2\%~3^" /^>>> %4
 | 
 | 304 |     ) else if "%ext%" == "rc" (
 | 
 | 305 |       echo %SPACES%^<ResourceCompile Include=^"..\..\..\..\%2\%~3^" /^>>> %4
 | 
 | 306 |     )
 | 
 | 307 |   )
 | 
 | 308 | 
 | 
 | 309 |   exit /B
 | 
 | 310 | 
 | 
 | 311 | rem Returns the extension for a given filename.
 | 
 | 312 | rem
 | 
 | 313 | rem %1 - The filename
 | 
 | 314 | rem %2 - The return value
 | 
 | 315 | rem
 | 
 | 316 | :extension
 | 
 | 317 |   set fname=%~1
 | 
 | 318 |   set ename=
 | 
 | 319 | :loop1
 | 
 | 320 |   if "%fname%"=="" (
 | 
 | 321 |     set %2=
 | 
 | 322 |     exit /B
 | 
 | 323 |   )
 | 
 | 324 | 
 | 
 | 325 |   if not "%fname:~-1%"=="." (
 | 
 | 326 |     set ename=%fname:~-1%%ename%
 | 
 | 327 |     set fname=%fname:~0,-1%
 | 
 | 328 |     goto loop1
 | 
 | 329 |   )
 | 
 | 330 | 
 | 
 | 331 |   set %2=%ename%
 | 
 | 332 |   exit /B
 | 
 | 333 | 
 | 
 | 334 | rem Removes the given project file.
 | 
 | 335 | rem
 | 
 | 336 | rem %1 - The filename
 | 
 | 337 | rem
 | 
 | 338 | :clean
 | 
 | 339 |   echo * %CD%\%1
 | 
 | 340 | 
 | 
 | 341 |   if exist %1 (
 | 
 | 342 |     del %1
 | 
 | 343 |   )
 | 
 | 344 | 
 | 
 | 345 |   exit /B
 | 
 | 346 | 
 | 
 | 347 | :syntax
 | 
 | 348 |   rem Display the help
 | 
 | 349 |   echo.
 | 
 | 350 |   echo Usage: generate [what] [-clean]
 | 
 | 351 |   echo.
 | 
 | 352 |   echo What to generate:
 | 
 | 353 |   echo.
 | 
 | 354 |   echo pre       - Prerequisites only
 | 
 | 355 |   echo vc10      - Use Visual Studio 2010
 | 
 | 356 |   echo vc11      - Use Visual Studio 2012
 | 
 | 357 |   echo vc12      - Use Visual Studio 2013
 | 
 | 358 |   echo vc14      - Use Visual Studio 2015
 | 
 | 359 |   echo vc14.10   - Use Visual Studio 2017
 | 
 | 360 |   echo vc14.30   - Use Visual Studio 2022
 | 
 | 361 |   echo.
 | 
 | 362 |   echo -clean    - Removes the project files
 | 
 | 363 |   goto error
 | 
 | 364 | 
 | 
 | 365 | :unknown
 | 
 | 366 |   echo.
 | 
 | 367 |   echo Error: Unknown argument '%1'
 | 
 | 368 |   goto error
 | 
 | 369 | 
 | 
 | 370 | :nodos
 | 
 | 371 |   echo.
 | 
 | 372 |   echo Error: Only a Windows NT based Operating System is supported
 | 
 | 373 |   goto error
 | 
 | 374 | 
 | 
 | 375 | :nonetdrv
 | 
 | 376 |   echo.
 | 
 | 377 |   echo Error: This batch file cannot run from a network drive
 | 
 | 378 |   goto error
 | 
 | 379 | 
 | 
 | 380 | :norepo
 | 
 | 381 |   echo.
 | 
 | 382 |   echo Error: This batch file should only be used from a curl git repository
 | 
 | 383 |   goto error
 | 
 | 384 | 
 | 
 | 385 | :seterr
 | 
 | 386 |   rem Set the caller's errorlevel.
 | 
 | 387 |   rem %1[opt]: Errorlevel as integer.
 | 
 | 388 |   rem If %1 is empty the errorlevel will be set to 0.
 | 
 | 389 |   rem If %1 is not empty and not an integer the errorlevel will be set to 1.
 | 
 | 390 |   setlocal
 | 
 | 391 |   set EXITCODE=%~1
 | 
 | 392 |   if not defined EXITCODE set EXITCODE=0
 | 
 | 393 |   echo %EXITCODE%|findstr /r "[^0-9\-]" 1>NUL 2>&1
 | 
 | 394 |   if %ERRORLEVEL% EQU 0 set EXITCODE=1
 | 
 | 395 |   exit /b %EXITCODE%
 | 
 | 396 | 
 | 
 | 397 | :error
 | 
 | 398 |   if "%OS%" == "Windows_NT" endlocal
 | 
 | 399 |   exit /B 1
 | 
 | 400 | 
 | 
 | 401 | :success
 | 
 | 402 |   endlocal
 | 
 | 403 |   exit /B 0
 |