dcerpc-nt: add UNION_ALIGN_TO... helpers
[wireshark-sm.git] / tools / check_help_urls.py
blobc9ad6f3f7ccff2edf20a9b8e370b03657dd5eac2
1 #!/usr/bin/env python3
2 # Wireshark - Network traffic analyzer
3 # By Gerald Combs <gerald@wireshark.org>
4 # Copyright 1998 Gerald Combs
6 # SPDX-License-Identifier: GPL-2.0-or-later
8 '''
9 Go through all user guide help URLs listed in the program
10 and confirm these are present in the User's Guide source files.
11 '''
13 from re import search
14 from glob import glob
15 from sys import exit
17 found = {}
19 with open("ui/help_url.c") as f:
20 for line in f:
21 if url := search(r"user_guide_url\(\"(.*).html\"\);", line):
22 chapter = url.group(1)
23 found[chapter] = False
25 adoc_files = glob("doc/wsug_src/*.adoc")
27 for adoc_file in adoc_files:
28 with open(adoc_file) as f:
29 for line in f:
30 # Fail on legacy block anchor syntax (double square brackets)
31 if tag := search(r"^\[\#(.*)]", line):
32 chapter = tag.group(1)
33 if chapter in found:
34 found[chapter] = True
36 missing = False
38 for chapter in found:
39 if not found[chapter]:
40 if not missing:
41 print("The following chapters are missing in the User's Guide:")
42 missing = True
43 print(chapter)
45 if missing:
46 exit(-1)