1@echo off
2rem ***************************************************************************
3rem *                                  _   _ ____  _
4rem *  Project                     ___| | | |  _ \| |
5rem *                             / __| | | | |_) | |
6rem *                            | (__| |_| |  _ <| |___
7rem *                             \___|\___/|_| \_\_____|
8rem *
9rem * Copyright (C) 2014 - 2015, Steve Holme, <steve_holme@hotmail.com>.
10rem *
11rem * This software is licensed as described in the file COPYING, which
12rem * you should have received as part of this distribution. The terms
13rem * are also available at http://curl.haxx.se/docs/copyright.html.
14rem *
15rem * You may opt to use, copy, modify, merge, publish, distribute and/or sell
16rem * copies of the Software, and permit persons to whom the Software is
17rem * furnished to do so, under the terms of the COPYING file.
18rem *
19rem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20rem * KIND, either express or implied.
21rem *
22rem ***************************************************************************
23
24:begin
25  rem Check we are running on a Windows NT derived OS
26  if not "%OS%" == "Windows_NT" goto nodos
27  setlocal
28
29  rem Display the help
30  if /i "%~1" == "-?" goto syntax
31  if /i "%~1" == "-h" goto syntax
32  if /i "%~1" == "-help" goto syntax
33
34:prerequisites
35  rem Check we have Perl installed
36  echo %PATH% | findstr /I /C:"\Perl" 1>nul
37  if errorlevel 1 (
38    if not exist "%SystemDrive%\Perl" (
39      if not exist "%SystemDrive%\Perl64" goto noperl
40    )
41  )
42
43:configure
44  if "%1" == "" set SRC_DIR=..
45  if not "%1" == "" set SRC_DIR=%~1%
46  if not exist "%SRC_DIR%" goto nosrc
47
48:start
49  for /f "delims=" %%i in ('dir "%SRC_DIR%\src\*.c.*" /b') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\src" -Wtool_hugehelp.c "%%i"
50  for /f "delims=" %%i in ('dir "%SRC_DIR%\src\*.h.*" /b') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\src" "%%i"
51  for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\*.c.*" /b') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib" "%%i"
52  for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\*.h.*" /b') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib" -Wcurl_config.h.cmake "%%i"
53  for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\vtls\*.c.*" /b') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib\vtls" "%%i"
54  for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\vtls\*.h.*" /b') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib\vtls" "%%i"
55  goto success
56
57:syntax
58  rem Display the help
59  echo.
60  echo Usage: checksrc [directory]
61  echo.
62  echo directory - Specifies the curl source directory
63  goto success
64
65:nodos
66  echo.
67  echo Error: Only a Windows NT based Operating System is supported
68  goto error
69
70:noperl
71  echo.
72  echo Error: Perl is not installed
73  goto error
74
75:nosrc
76  echo.
77  echo Error: "%SRC_DIR%" does not exist
78  goto error
79
80:error
81  if "%OS%" == "Windows_NT" endlocal
82  exit /B 1
83
84:success
85  endlocal
86  exit /B 0
87