summaryrefslogtreecommitdiffstats
path: root/tools/checklibdocs.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:10:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:10:49 +0000
commitcfe5e3905201349e9cf3f95d52ff4bd100bde37d (patch)
treed0baf160cbee3195249d095f85e52d20c21acf02 /tools/checklibdocs.sh
parentInitial commit. (diff)
downloadutil-linux-cfe5e3905201349e9cf3f95d52ff4bd100bde37d.tar.xz
util-linux-cfe5e3905201349e9cf3f95d52ff4bd100bde37d.zip
Adding upstream version 2.39.3.upstream/2.39.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/checklibdocs.sh')
-rwxr-xr-xtools/checklibdocs.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/checklibdocs.sh b/tools/checklibdocs.sh
new file mode 100755
index 0000000..094d2cb
--- /dev/null
+++ b/tools/checklibdocs.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+FILE_API_SYMBOLS="$1"
+FILE_API_DOCS="$2"
+
+if [ ! -f "$FILE_API_SYMBOLS" ]; then
+ echo "File $FILE_API_SYMBOLS is missing."
+ exit 1
+fi
+
+if [ ! -f "$FILE_API_DOCS" ]; then
+ echo "File $FILE_API_DOCS is missing."
+ exit 1
+fi
+
+fail_ct=0
+api_symbols=$(awk '/^([[:space:]]+)([[:alnum:]_]+);/ { gsub(";",""); print $1; }' "$FILE_API_SYMBOLS" | sort)
+doc_symbols=$(awk '/^([[:space:]])*$/ {next}; !/<.*>/ { print $1 }' "$FILE_API_DOCS" | sort)
+
+echo -n "Checking $FILE_API_SYMBOLS documentation ... "
+
+for sym in $api_symbols; do
+ case "$doc_symbols" in
+ *"$sym"*)
+ #echo -ne "\n '$sym'"
+ ;;
+ *)
+ echo -ne "\n '$sym' undocumented"
+ fail_ct=$(($fail_ct + 1))
+ ;;
+ esac
+done
+
+if [ $fail_ct -ne 0 ]; then
+ echo
+ echo "$fail_ct symbols is missing in ${FILE_API_DOCS}."
+ echo
+ exit 1
+else
+ echo "OK"
+fi
+
+exit 0