diff mbox series

libtracefs: Add check for duplicate functions in man pages

Message ID 20230104123100.63349d71@gandalf.local.home (mailing list archive)
State Accepted
Commit 36a24e3869cd5ac2fc607977082696e3d4685531
Headers show
Series libtracefs: Add check for duplicate functions in man pages | expand

Commit Message

Steven Rostedt Jan. 4, 2023, 5:31 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

Update the check-manpages.sh script to make sure that there are no
functions that are described in more than one man page.

Link: https://lore.kernel.org/linux-trace-devel/20230104172655.145516-2-rostedt@goodmis.org/

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 check-manpages.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/check-manpages.sh b/check-manpages.sh
index d3ec6af65c50..776365c53403 100755
--- a/check-manpages.sh
+++ b/check-manpages.sh
@@ -15,12 +15,19 @@  cd $1
 MAIN=libtracefs
 MAIN_FILE=${MAIN}.txt
 
+PROCESSED=""
+
 # Ignore man pages that do not contain functions
 IGNORE="libtracefs-options.txt"
 
 for man in ${MAIN}-*.txt; do
 
-	sed -ne '/^NAME/,/^SYNOP/{/^[a-z]/{s/, *$//;s/,/\n/g;s/ //g;s/-.*$/-/;/-/{s/-//p;q};p}}' $man | while read a; 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