On Wed, Mar 14, 2007 at 11:10:18AM -0700, Josh Triplett wrote:
> Package: devscripts
> Version: 2.9.27
> Severity: wishlist
> 
> Please include Branden's missing_manpage_finder script, from his Write the
> Fine Manual presentation.  I have attached an updated version that Branden
> mailed me; it includes GPL headers.
> 
> You may want to rename the script to something like manpage-alert, for
> consistency with rc-alert and wnpp-alert.  All of these follow a similar
> theme: what issues in Debian affect my system?
> 
> - Josh Triplett

Nice idea, but it doesn't work as is.  The two major problems are:

(1) man -w /usr/bin/bashbug outputs /usr/bin/bashbug, whereas man -w
    bashbug shows that bashbug is missing a manpage

(2) It doesn't exclude /usr/bin/X11, which is a symlink to /usr/bin.

Attached is a better version which fixes these problems, displays the
missing manual pages and doesn't keep telling the user to look at 'man
7 undocumented'.

   Julian
#!/bin/sh

# $Id: missing_manpage_finder 71 2007-03-14 17:27:36Z branden $

# Copyright 2005 Branden Robinson
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

if [ $# -lt 1 ]; then
    set -- /bin /sbin /usr/bin /usr/sbin /usr/games
fi

NUM_EXECUTABLES=0
NUM_MANPAGES_FOUND=0
NUM_MANPAGES_MISSING=0

(
    for DIR in "$@"; do
        for F in "$DIR"/*; do
            if [ "$F" = "/usr/bin/X11" ]; then continue; fi
            NUM_EXECUTABLES=$(( $NUM_EXECUTABLES + 1 ))
            if man -w -S 1:8:6 $(basename $F) 2>&1 >/dev/null; then
                NUM_MANPAGES_FOUND=$(( $NUM_MANPAGES_FOUND + 1 ))
            else
                NUM_MANPAGES_MISSING=$(( $NUM_MANPAGES_MISSING + 1 ))
            fi
        done
    done

    printf "Of %d commands, found manpages for %d (%d missing).\n" \
        $NUM_EXECUTABLES \
        $NUM_MANPAGES_FOUND \
        $NUM_MANPAGES_MISSING
) | grep -v "'man 7 undocumented'"

# vim:set ai et sw=4 ts=4 tw=80:

Reply via email to