The fifth batch
[git.git] / Documentation / technical / api-index.sh
blob296488557434b7fff60ab25f4246a4dc270729c0
1 #!/bin/sh
3 if test $# -ne 2
4 then
5 echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
6 exit 1
7 fi
9 SOURCE_DIR="$1"
10 OUTPUT="$2"
13 cd "$SOURCE_DIR"
15 c=////////////////////////////////////////////////////////////////
16 skel=api-index-skel.txt
17 sed -e '/^\/\/ table of contents begin/q' "$skel"
18 echo "$c"
20 ls api-*.txt |
21 while read filename
23 case "$filename" in
24 api-index-skel.txt | api-index.txt) continue ;;
25 esac
26 title=$(sed -e 1q "$filename")
27 html=${filename%.txt}.html
28 echo "* link:$html[$title]"
29 done
30 echo "$c"
31 sed -n -e '/^\/\/ table of contents end/,$p' "$skel"
32 ) >"$OUTPUT"+
34 if test -f "$OUTPUT" && cmp "$OUTPUT" "$OUTPUT"+ >/dev/null
35 then
36 rm -f "$OUTPUT"+
37 else
38 mv "$OUTPUT"+ "$OUTPUT"