1#! /bin/sh
2#
3# $Id: Xindex,v 10.25 2008/01/08 20:58:22 bostic Exp $
4
5test -d $BDB_SRC -a -d $TARGET || {
6	echo "Xindex: \$BDB_SRC or \$TARGET not set"
7	exit 1
8}
9
10# Build the HTML from the index.
11# $1 API Name
12# $2 API Directory name
13build()
14{
15	echo '<html>'
16	echo '<head>'
17	echo "<title>Berkeley DB: $1 API Index</title>"
18	echo '<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">'
19	echo '<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">'
20	echo '</head>'
21	echo '<body bgcolor=white>'
22	echo "<h1 align=center>$1 API Index</h1>"
23	echo "<center>"
24	echo "<table cellspacing=0 cellpadding=0>"
25
26	# The reference guide is done using the C_API, so we have to
27	# copy references from it for the C++ API.
28	(cat $BDB_SRC/docs_src/support/static.src $TARGET/$2/pindex.src;
29	    egrep '^__APIREL__/ref/|^__APIREL__/ref_xml/' \
30	    $TARGET/api_c/pindex.src) |
31	sort -u |
32	sort -f -t@ +1 |
33	sed -f $BDB_SRC/docs_src/support/html.sed |
34	sed -e 's/__APIREL__/../' \
35	    -e 's/\([^ ]\)@/\1 @/' \
36	    -e 's/^\([^ ]*\) \([^@]*\)@\([^ ]*\)\(.*\)/<tr><td align=right>\2<\/td><td>\&nbsp;<a href="\1">\3<\/a>\4<\/td><\/tr>/'
37
38	echo "</table>"
39	echo "</center>"
40	echo "<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>"
41	echo "</body>"
42	echo "</html>"
43}
44
45[ -f $TARGET/api_c/pindex.src ] &&
46    build C api_c > $TARGET/api_c/c_pindex.html
47
48[ -f $TARGET/api_cxx/pindex.src ] &&
49    build C++ api_cxx > $TARGET/api_cxx/cxx_pindex.html
50
51[ -f $TARGET/api_tcl/pindex.src ] &&
52    build Tcl api_tcl > $TARGET/api_tcl/tcl_pindex.html
53exit 0
54