summaryrefslogtreecommitdiffstats
path: root/check-manpages.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 07:25:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 07:25:46 +0000
commit5277429a362a9cf4ce649557bf4c8fe0e20c05c0 (patch)
tree52cc97728c6fbb7393984dc3db05c5836107fe44 /check-manpages.sh
parentInitial commit. (diff)
downloadlibtraceevent-5277429a362a9cf4ce649557bf4c8fe0e20c05c0.tar.xz
libtraceevent-5277429a362a9cf4ce649557bf4c8fe0e20c05c0.zip
Adding upstream version 1:1.7.1.upstream/1%1.7.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'check-manpages.sh')
-rwxr-xr-xcheck-manpages.sh78
1 files changed, 78 insertions, 0 deletions
diff --git a/check-manpages.sh b/check-manpages.sh
new file mode 100755
index 0000000..4e9850f
--- /dev/null
+++ b/check-manpages.sh
@@ -0,0 +1,78 @@
+#!/bin/bash
+# SPDX-License-Identifier: LGPL-2.1
+# Copyright (C) 2022, Google Inc, Steven Rostedt <rostedt@goodmis.org>
+#
+# This checks if any function is listed in a man page that is not listed
+# in the main man page.
+
+if [ $# -lt 1 ]; then
+ echo "usage: check-manpages man-page-path"
+ exit 1
+fi
+
+cd $1
+
+MAIN=libtraceevent
+MAIN_FILE=${MAIN}.txt
+
+PROCESSED=""
+
+# Ignore man pages that do not contain functions
+IGNORE=""
+
+for man in ${MAIN}-*.txt; do
+
+ for a in `sed -ne '/^NAME/,/^SYNOP/{/^[a-z]/{s/, *$//;s/,/\n/g;s/ //g;s/-.*$/-/;/-/{s/-//p;q};p}}' $man`; do
+ if [ "${PROCESSED/:${a} /}" != "${PROCESSED}" ]; then
+ P="${PROCESSED/:${a} */}"
+ echo "Found ${a} in ${man} and in ${P/* /}"
+ fi
+ PROCESSED="${man}:${a} ${PROCESSED}"
+ if [ "${IGNORE/$man/}" != "${IGNORE}" ]; then
+ continue
+ fi
+ if ! grep -q '\*'${a}'\*' $MAIN_FILE; then
+ if [ "$last" == "" ]; then
+ echo
+ fi
+ if [ "$last" != "$man" ]; then
+ echo "Missing functions from $MAIN_FILE that are in $man"
+ last=$man
+ fi
+ echo " ${a}"
+ fi
+ done
+done
+
+DEPRECATED="*tep_print_field*"
+
+# Should not be used by applications, only internal use by trace-cmd
+IGNORE="*kbuffer_set_old_format* *kbuffer_raw_get* *kbuffer_ptr_delta* *kbuffer_translate_data*"
+
+HEADER=event-parse.h
+
+sed -ne 's/^[a-z].*[ \*]\([a-z_][a-z_]*\)(.*/\1/p' -e 's/^\([a-z_][a-z_]*\)(.*/\1/p' ../include/traceevent/{event-parse,trace-seq,kbuffer}.h | while read f; do
+ if ! grep -q '\*'${f}'\*' $MAIN_FILE; then
+ if [ "${DEPRECATED/\*$f\*/}" != "${DEPRECATED}" ]; then
+ continue;
+ fi
+ if [ "${IGNORE/\*$f\*/}" != "${IGNORE}" ]; then
+ continue;
+ fi
+ for head in event-parse.h trace-seq.h kbuffer.h; do
+ if grep -q $f ../include/traceevent/$head; then
+ if [ "$HEADER" != "$head" ]; then
+ last=""
+ HEADER=$head
+ break
+ fi
+ fi
+ done
+ if [ "$last" == "" ]; then
+ echo
+ echo "Missing functions from $MAIN_FILE that are in $HEADER"
+ last=$f
+ fi
+ echo " ${f}"
+ fi
+done