Imported Upstream version 7.40.0
[platform/upstream/curl.git] / projects / checksrc.bat
1 @echo off
2 rem ***************************************************************************
3 rem *                                  _   _ ____  _
4 rem *  Project                     ___| | | |  _ \| |
5 rem *                             / __| | | | |_) | |
6 rem *                            | (__| |_| |  _ <| |___
7 rem *                             \___|\___/|_| \_\_____|
8 rem *
9 rem * Copyright (C) 2014, 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 http://curl.haxx.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 ***************************************************************************
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   if not exist "C:\Perl" (
37     if not exist "C:\Perl64" goto noperl
38   )
39
40 :configure
41   if "%1" == "" set SRC_DIR=..
42   if not "%1" == "" set SRC_DIR=%~1%
43   if not exist "%SRC_DIR%" goto nosrc
44
45 :start
46   for /f "delims=" %%i in ('dir %SRC_DIR%\src\*.c.* /b') do @perl %SRC_DIR%\lib\checksrc.pl -D%SRC_DIR%\src "%%i"
47   for /f "delims=" %%i in ('dir %SRC_DIR%\src\*.h.* /b') do @perl %SRC_DIR%\lib\checksrc.pl -D%SRC_DIR%\src "%%i"
48   for /f "delims=" %%i in ('dir %SRC_DIR%\lib\*.c.* /b') do @perl %SRC_DIR%\lib\checksrc.pl -D%SRC_DIR%\lib "%%i"
49   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"
50   goto success
51
52 :syntax
53   rem Display the help
54   echo.
55   echo Usage: checksrc [directory]
56   echo.
57   echo directory - Specifies the curl source directory
58   goto success
59
60 :nodos
61   echo.
62   echo Error: Only a Windows NT based Operating System is supported
63   goto error
64
65 :noperl
66   echo.
67   echo Error: Perl is not installed
68   goto error
69
70 :nosrc
71   echo.
72   echo Error: "%SRC_DIR%" does not exist
73   goto error
74
75 :error
76   if "%OS%" == "Windows_NT" endlocal
77   exit /B 1
78
79 :success
80   endlocal
81   exit /B 0