Merge branch 'jk/common-main'
[git] / Documentation / technical / api-index.sh
1 #!/bin/sh
2
3 (
4         c=////////////////////////////////////////////////////////////////
5         skel=api-index-skel.txt
6         sed -e '/^\/\/ table of contents begin/q' "$skel"
7         echo "$c"
8
9         ls api-*.txt |
10         while read filename
11         do
12                 case "$filename" in
13                 api-index-skel.txt | api-index.txt) continue ;;
14                 esac
15                 title=$(sed -e 1q "$filename")
16                 html=${filename%.txt}.html
17                 echo "* link:$html[$title]"
18         done
19         echo "$c"
20         sed -n -e '/^\/\/ table of contents end/,$p' "$skel"
21 ) >api-index.txt+
22
23 if test -f api-index.txt && cmp api-index.txt api-index.txt+ >/dev/null
24 then
25         rm -f api-index.txt+
26 else
27         mv api-index.txt+ api-index.txt
28 fi