Merge pull request #171 from t8m/master
[openssl-web.git] / bin / mk-mancross
1 #! /bin/sh
2
3 releases="$*"
4
5 log () {
6     echo >&2 "$@"
7 }
8
9 debug=:
10 if [ "$DEBUG" != "" ]; then
11     debug=log
12 fi
13
14 for r in $releases; do
15     echo >&2 -n "$r : "
16     for s in 1 3 5 7; do
17         echo >&2 -n $s
18         for f in docs/man$r/man$s/*.html; do
19             $debug -n '.'
20             # Check that it's a rendered manpage
21             if grep -F '<!-- OSSL: description:' $f > /dev/null; then
22                 existsin=''
23                 b=`basename $f .html`
24                 for x in $releases; do
25                     if [ "$x" = "$r" ]; then
26                         continue
27                     fi
28                     if [ -f "docs/man$x/man$s/$b.html" ]; then
29                         existsin="$existsin $x"
30                     fi
31                 done
32                 (
33                     if [ "$existsin" != "" ]; then
34                         cat <<EOF
35   <section>
36     <h1>This manpage</h1>
37     <ul>
38 EOF
39                         for x in $existsin; do
40                             cat <<EOF
41       <li><a href="/docs/man$x/man$s/$b.html">$x version</a></li>
42 EOF
43                         done
44                         cat <<EOF
45     </ul>
46   </section>
47 EOF
48                     fi
49                 ) > docs/man$r/man$s/$b.cross
50             fi
51         done
52     done
53     echo >&2
54 done