smtp: use the upload buffer size for scratch buffer malloc
[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 - 2016, 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.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
28   rem Set our variables
29   setlocal
30   set CHECK_LIB=TRUE
31   set CHECK_SRC=TRUE
32   set CHECK_TESTS=TRUE
33   set CHECK_EXAMPLES=TRUE
34
35 :parseArgs
36   if "%~1" == "" goto prerequisites
37
38   if /i "%~1" == "-?" (
39     goto syntax
40   ) else if /i "%~1" == "-h" (
41     goto syntax
42   ) else if /i "%~1" == "-help" (
43     goto syntax
44   ) else if /i "%~1" == "lib" (
45     set CHECK_LIB=TRUE
46     set CHECK_SRC=FALSE
47     set CHECK_TESTS=FALSE
48     set CHECK_EXAMPLES=FALSE
49   ) else if /i "%~1" == "src" (
50     set CHECK_LIB=FALSE
51     set CHECK_SRC=TRUE
52     set CHECK_TESTS=FALSE
53     set CHECK_EXAMPLES=FALSE
54   ) else if /i "%~1" == "tests" (
55     set CHECK_LIB=FALSE
56     set CHECK_SRC=FALSE
57     set CHECK_TESTS=TRUE
58     set CHECK_EXAMPLES=FALSE
59   ) else if /i "%~1" == "examples" (
60     set CHECK_LIB=FALSE
61     set CHECK_SRC=FALSE
62     set CHECK_TESTS=FALSE
63     set CHECK_EXAMPLES=TRUE
64   ) else (
65     if not defined SRC_DIR (
66       set SRC_DIR=%~1%
67     ) else (
68       goto unknown
69     )
70   )
71
72   shift & goto parseArgs
73
74 :prerequisites
75   rem Check we have Perl in our path
76   echo %PATH% | findstr /I /C:"\Perl" 1>nul
77   if errorlevel 1 (
78     rem It isn't so check we have it installed and set the path if it is
79     if exist "%SystemDrive%\Perl" (
80       set "PATH=%SystemDrive%\Perl\bin;%PATH%"
81     ) else (
82       if exist "%SystemDrive%\Perl64" (
83         set "PATH=%SystemDrive%\Perl64\bin;%PATH%"
84       ) else (
85         goto noperl
86       )
87     )
88   )
89
90 :configure
91   if "%SRC_DIR%" == "" set SRC_DIR=..
92   if not exist "%SRC_DIR%" goto nosrc
93
94 :start
95   if "%CHECK_SRC%" == "TRUE" (
96     rem Check the src directory
97     if exist %SRC_DIR%\src (
98       for /f "delims=" %%i in ('dir "%SRC_DIR%\src\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\src" -Wtool_hugehelp.c "%%i"
99       for /f "delims=" %%i in ('dir "%SRC_DIR%\src\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\src" "%%i"
100     )
101   )
102
103   if "%CHECK_LIB%" == "TRUE" (
104     rem Check the lib directory
105     if exist %SRC_DIR%\lib (
106       for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib" "%%i"
107       for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib" -Wcurl_config.h.cmake -Wcurl_config.h.in -Wcurl_config.h "%%i"
108     )
109
110     rem Check the lib\vauth directory
111     if exist %SRC_DIR%\lib\vauth (
112       for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\vauth\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib\vauth" "%%i"
113       for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\vauth\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib\vauth" "%%i"
114     )
115
116     rem Check the lib\vtls directory
117     if exist %SRC_DIR%\lib\vtls (
118       for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\vtls\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib\vtls" "%%i"
119       for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\vtls\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib\vtls" "%%i"
120     )
121   )
122
123   if "%CHECK_TESTS%" == "TRUE" (
124     rem Check the tests\libtest directory
125     if exist %SRC_DIR%\tests\libtest (
126       for /f "delims=" %%i in ('dir "%SRC_DIR%\tests\libtest\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\tests\libtest" "%%i"
127       for /f "delims=" %%i in ('dir "%SRC_DIR%\tests\libtest\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\tests\libtest" "%%i"
128     )
129
130     rem Check the tests\unit directory
131     if exist %SRC_DIR%\tests\unit (
132       for /f "delims=" %%i in ('dir "%SRC_DIR%\tests\unit\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\tests\unit" "%%i"
133       for /f "delims=" %%i in ('dir "%SRC_DIR%\tests\unit\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\tests\unit" "%%i"
134     )
135
136     rem Check the tests\server directory
137     if exist %SRC_DIR%\tests\server (
138       for /f "delims=" %%i in ('dir "%SRC_DIR%\tests\server\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\tests\server" "%%i"
139       for /f "delims=" %%i in ('dir "%SRC_DIR%\tests\server\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\tests\server" "%%i"
140     )
141   )
142
143   if "%CHECK_EXAMPLES%" == "TRUE" (
144     rem Check the docs\examples directory
145     if exist %SRC_DIR%\docs\examples (
146       for /f "delims=" %%i in ('dir "%SRC_DIR%\docs\examples\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\docs\examples" "%%i"
147     )
148   )
149
150   goto success
151
152 :syntax
153   rem Display the help
154   echo.
155   echo Usage: checksrc [what] [directory]
156   echo.
157   echo What to scan:
158   echo.
159   echo lib       - Scan the libcurl source
160   echo src       - Scan the command-line tool source
161   echo tests     - Scan the library tests and unit tests
162   echo examples  - Scan the examples
163   echo.
164   echo directory - Specifies the curl source directory
165   goto success
166
167 :unknown
168   echo.
169   echo Error: Unknown argument '%1'
170   goto error
171
172 :nodos
173   echo.
174   echo Error: Only a Windows NT based Operating System is supported
175   goto error
176
177 :noperl
178   echo.
179   echo Error: Perl is not installed
180   goto error
181
182 :nosrc
183   echo.
184   echo Error: "%SRC_DIR%" does not exist
185   goto error
186
187 :error
188   if "%OS%" == "Windows_NT" endlocal
189   exit /B 1
190
191 :success
192   endlocal
193   exit /B 0