1#!/bin/bash 2# SPDX-License-Identifier: LGPL-2.1 3# Copyright (C) 2022, Google Inc, Steven Rostedt <[email protected]> 4# 5# This checks if any function is listed in a man page that is not listed 6# in the main man page. 7 8if [ $# -lt 1 ]; then 9 echo "usage: check-manpages man-page-path" 10 exit 1 11fi 12 13cd $1 14 15MAIN=libtracefs 16MAIN_FILE=${MAIN}.txt 17 18PROCESSED="" 19 20# Ignore man pages that do not contain functions 21IGNORE="libtracefs-options.txt" 22 23for man in ${MAIN}-*.txt; do 24 25 for a in `sed -ne '/^NAME/,/^SYNOP/{/^[a-z]/{s/, *$//;s/,/\n/g;s/ //g;s/-.*$/-/;/-/{s/-//p;q};p}}' $man`; do 26 if [ "${PROCESSED/:${a} /}" != "${PROCESSED}" ]; then 27 P="${PROCESSED/:${a} */}" 28 echo "Found ${a} in ${man} and in ${P/* /}" 29 fi 30 PROCESSED="${man}:${a} ${PROCESSED}" 31 if [ "${IGNORE/$man/}" != "${IGNORE}" ]; then 32 continue 33 fi 34 if ! grep -q '\*'${a}'\*' $MAIN_FILE; then 35 if [ "$last" == "" ]; then 36 echo 37 fi 38 if [ "$last" != "$man" ]; then 39 echo "Missing functions from $MAIN_FILE that are in $man" 40 last=$man 41 fi 42 echo " ${a}" 43 fi 44 done 45done 46 47DEPRECATED="*tracefs_event_append_filter* *tracefs_event_verify_filter*" 48 49sed -ne 's/^[a-z].*[ \*]\([a-z_][a-z_]*\)(.*/\1/p' -e 's/^\([a-z_][a-z_]*\)(.*/\1/p' ../include/tracefs.h | while read f; do 50 if ! grep -q '\*'${f}'\*' $MAIN_FILE; then 51 if [ "${DEPRECATED/\*$f\*/}" != "${DEPRECATED}" ]; then 52 continue; 53 fi 54 if [ "$last" == "" ]; then 55 echo 56 echo "Missing functions from $MAIN_FILE that are in tracefs.h" 57 last=$f 58 fi 59 echo " ${f}" 60 fi 61done 62