diff options
author | Alejandro Colomar <alx@kernel.org> | 2024-11-02 23:35:06 +0100 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2024-11-03 06:10:06 +0100 |
commit | a82b8b28c9035c8a889a7de2d5cbbb9d2d1f8674 (patch) | |
tree | 5f2a537b2ec9cda38b21a8a0df5d15a19b034232 /scripts | |
parent | 2b65f4d22952eb32b347d5155735a696f9654e58 (diff) | |
download | man-pages-a82b8b28c9035c8a889a7de2d5cbbb9d2d1f8674.tar.gz |
scripts/bash_aliases: man_lsfunc(), man_lsvar(): Use mansect(1)
Remove the man_section() function, and call the mansect(1) program
instead.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/bash_aliases | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/scripts/bash_aliases b/scripts/bash_aliases index e461707c8c..25425c3890 100644 --- a/scripts/bash_aliases +++ b/scripts/bash_aliases @@ -38,39 +38,6 @@ sed_rm_ccomments() ######################################################################## # Linux man-pages -# man_section() prints specific manual page sections (DESCRIPTION, SYNOPSIS, -# ...) of all manual pages in a directory (or in a single manual page file). -# Usage example: .../man-pages$ man_section man2 SYNOPSIS 'SEE ALSO'; - -man_section() -{ - if [ $# -lt 2 ]; then - >&2 echo "Usage: ${FUNCNAME[0]} <dir> <section>..."; - return $EX_USAGE; - fi - - local page="$1"; - shift; - local sect="$*"; - - find "$page" -type f \ - |xargs wc -l \ - |grep -v -e '\b1 ' -e '\btotal\b' \ - |awk '{ print $2 }' \ - |sort \ - |while read -r manpage; do - (sed -n '/^\.TH/,/^\.SH/{/^\.SH/!p}' <"$manpage"; - for s in $sect; do - <"$manpage" \ - sed -n \ - -e "/^\.SH $s/p" \ - -e "/^\.SH $s/,/^\.SH/{/^\.SH/!p}"; - done;) \ - |mandoc -Tutf8 2>/dev/null \ - |col -pbx; - done; -} - # man_lsfunc() prints the name of all C functions declared in the SYNOPSIS # of all manual pages in a directory (or in a single manual page file). # Each name is printed in a separate line @@ -83,9 +50,9 @@ man_lsfunc() return $EX_USAGE; fi - for arg in "$@"; do - man_section "$arg" 'SYNOPSIS'; - done \ + mansect 'SYNOPSIS' "$@" \ + |mandoc -Tutf8 2>/dev/null \ + |col -pbx \ |sed_rm_ccomments \ |pcregrep -Mn '(?s)^ [\w ]+ \**\w+\([\w\s(,)[\]*]*?(...)?\s*\); *$' \ |grep '^[0-9]' \ @@ -106,9 +73,9 @@ man_lsvar() return $EX_USAGE; fi - for arg in "$@"; do - man_section "$arg" 'SYNOPSIS'; - done \ + mansect 'SYNOPSIS' "$@" \ + |mandoc -Tutf8 2>/dev/null \ + |col -pbx \ |sed_rm_ccomments \ |pcregrep -Mv '(?s)^ [\w ]+ \**\w+\([\w\s(,)[\]*]+?(...)?\s*\); *$' \ |pcregrep -Mn \ |