]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - ports/winnt/vs2015/ntpd/gen-ntp_keyword.bat
Vendor import of ntp-4.2.8p8.
[FreeBSD/FreeBSD.git] / ports / winnt / vs2015 / ntpd / gen-ntp_keyword.bat
1 @echo off
2 REM gen-ntp_keyword.bat
3 REM helper to invoke keyword-gen and possibly update ntp_keyword.h
4 REM Usage:
5 REM   gen-ntp_keyword dir_containing_keyword-gen.exe
6 REM
7
8 set HDR_FILE=..\..\..\..\ntpd\ntp_keyword.h
9 set UTD_FILE=..\..\..\..\ntpd\keyword-gen-utd
10
11 if "{%1}" == "{}" goto Usage
12 if not exist "%1\keyword-gen.exe" goto ExeNotFound
13 "%1\keyword-gen.exe" ..\..\..\..\ntpd\ntp_parser.h > new_keyword.h
14
15 REM check if we must create both files from scratch
16 if not exist "%HDR_FILE%" goto createFiles
17 if not exist "%UTD_FILE%" goto createFiles
18
19 findstr /v diff_ignore_line new_keyword.h > new_keyword_cmp.h
20 findstr /v diff_ignore_line "%HDR_FILE%"  > ntp_keyword_cmp.h
21 set meat_changed=0
22 fc /L ntp_keyword_cmp.h new_keyword_cmp.h > NUL
23 if errorlevel 1 set meat_changed=1
24 del ntp_keyword_cmp.h new_keyword_cmp.h
25 if "0"=="%meat_changed%" goto SkipUpdate
26
27 :createFiles
28 copy /y /v new_keyword.h "%HDR_FILE%"  > NUL
29 findstr diff_ignore_line new_keyword.h > "%UTD_FILE%"
30 echo updated keyword-gen-utd and ntp_keyword.h
31 goto SkipSkipMsg
32
33 :skipUpdate
34 echo ntp_keyword.h is unchanged
35 REM 'touch' the files by replacing them with a concatenation of itself and NUL:
36 copy /b "%HDR_FILE%" + NUL "%HDR_FILE%" > NUL
37 copy /b "%UTD_FILE%" + NUL "%UTD_FILE%" > NUL
38
39 :SkipSkipMsg
40 set meat_changed=
41 del new_keyword.h
42 goto Exit
43
44 :Usage
45 echo Usage:
46 echo   gen-ntp_keyword dir_containing_keyword-gen.exe
47 goto Exit
48
49 :ExeNotFound
50 echo keyword-gen.exe not found at %1\keyword-gen.exe
51 goto Exit
52
53 :Exit