#!/bin/sh
#
# $XFree86: xc/config/util/mkhtmlindex.sh,v 1.3 2000/08/26 04:30:49 dawes Exp $
#
# Copyright © 2000 by Precision Insight, Inc.
#
# Generate index files for the HTML man pages
#
# Author: David Dawes
#
VOLLIST="1 2 3 4 5 6 7 8 9 o l n p"
INDEX="manindex"
if [ $# != 1 ]; then
echo Usage: $0 htmlmandir
exit 1
fi
if [ ! -d $1 ]; then
echo $1 is not a directory
exit 1
fi
cd $1
for s in $VOLLIST; do
list="`ls *.$s.html 2> /dev/null`" || : # ignore failed glob expansion
if [ X"$list" != X ]; then
file=$INDEX$s.html
rm -f $file
cat < $file
XFree86[tm] Manual pages: Section $s
XFree86[tm] Manual pages: Section $s
EOF
for i in $list; do
title="`egrep '^[0-9A-Za-z]' $i | egrep -v '^Name' | head -1`"
name="`echo $title | sed -e 's/ - .*//'`"
desc="`echo $title | sed -e 's/[^-]* - //' -e 's///'`"
echo "
- $name - $desc
" >> $file
done
cat <> $file
EOF
fi
done
exit 0