2 REM gen-ntp_keyword.bat
3 REM helper to invoke keyword-gen and possibly update ntp_keyword.h
5 REM gen-ntp_keyword dir_containing_keyword-gen.exe
8 set HDR_FILE=..\..\..\..\ntpd\ntp_keyword.h
9 set UTD_FILE=..\..\..\..\ntpd\keyword-gen-utd
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
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
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
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
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
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
46 echo gen-ntp_keyword dir_containing_keyword-gen.exe
50 echo keyword-gen.exe not found at %1\keyword-gen.exe