summaryrefslogtreecommitdiff
path: root/imake-1.0.1/mkhtmlindex.sh
blob: ab1c894ea031ff9867d0cbf9a3dc2e178a0ce304 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/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 <dawes@xfree86.org>
#

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 <<EOF > $file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>X.Org Manual pages: Section $s</TITLE>
</HEAD>
<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">

<H1>X.Org Manual pages: Section $s</H1>
<P>
<UL>
EOF
		for i in $list; do
			title="`sed -e '/^[^0-9A-Za-z]/d' -e '/^$/' -e '/^Name/d' -e q $i`"
			name="`echo \"$title\" | sed -e 's/ - .*//'`"
			desc="`echo \"$title\" | sed -e 's/[^-]* - //' -e 's/<P>//'`"
			echo "<LI><A href=\"$i\">$name</A> - $desc</LI>" >> $file
		done
		cat <<EOF >> $file
</UL>
<P>
</BODY>
</HTML>
EOF
	fi
done

exit 0