diff mbox series

libtracefs: Add script to find functions not listed in main man page

Message ID 20220222131816.0bfdb33e@gandalf.local.home (mailing list archive)
State Accepted
Commit a3452f8aa211a50d0fb1a324803b1e480ecbc364
Headers show
Series libtracefs: Add script to find functions not listed in main man page | expand

Commit Message

Steven Rostedt Feb. 22, 2022, 6:18 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

This checks all the man pages for any function that is not in the main man
page of libtracefs.txt.

The current run when this script was created produced:

$ ./check-manpages.sh Documentation/

Missing functions from libtracefs.txt that are in libtracefs-dynevents.txt
   tracefs_dynevent_get
   tracefs_dynevent_get_event

Missing functions from libtracefs.txt that are in libtracefs-events-tep.txt
   tracefs_load_cmdlines

Missing functions from libtracefs.txt that are in libtracefs-events.txt
   tracefs_event_enable
   tracefs_event_disable

Missing functions from libtracefs.txt that are in libtracefs-instances-affinity.txt
   tracefs_set_affinity_raw
   tracefs_get_affinity_raw

Missing functions from libtracefs.txt that are in libtracefs-instances-file-manip.txt
   tracefs_instance_file_append
   tracefs_instance_file_clear

Missing functions from libtracefs.txt that are in libtracefs-instances-manage.txt
   tracefs_instance_alloc

Missing functions from libtracefs.txt that are in libtracefs-instances-utils.txt
   tracefs_instance_get_trace_dir

Missing functions from libtracefs.txt that are in libtracefs-options.txt
   tracefs_options

Missing functions from libtracefs.txt that are in libtracefs-stream.txt
   tracefs_trace_pipe_stream
   tracefs_trace_pipe_print
   tracefs_trace_pipe_stop

Missing functions from libtracefs.txt that are in libtracefs-synth-info.txt
   tracefs_synth_get_event

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

Patch

diff --git a/check-manpages.sh b/check-manpages.sh
new file mode 100755
index 000000000000..a52281198f6e
--- /dev/null
+++ b/check-manpages.sh
@@ -0,0 +1,32 @@ 
+#!/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=libtracefs
+MAIN_FILE=${MAIN}.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
+		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