Removed the link to the Online Shop since it's neither finished nor
[infodrom.org/infocon.infodrom.org] / bin / wmldepend.sh
1 #!/bin/sh
2
3 INCPATH=.
4 FILES=''
5
6 expandfile() {
7         for i in $INCPATH
8         do
9                 if [ -f $i/$1 ] 
10                 then
11                         echo $i/$1
12                         exit 0
13                 fi
14         done
15         echo "Fehler: Includedatei $1 existiert nicht" > /dev/stderr
16         exit 1
17 }
18
19 findincludes() {
20         for i in $*
21         do
22                 for j in `sed -n 's/^#[Ii][Nn][Cc][Ll][Uu][Dd][Ee] *[<"]\([^>"]*\).*/\1/p' $i`
23                 do
24                         echo ' \'
25                         foo=`expandfile $j`
26                         echo -n ' '$foo
27                         findincludes $foo
28                 done
29         done
30 }
31
32 while [ "x$1" != "x" ]
33 do
34         case "$1" in
35                 -I*)
36                         INCPATH=$INCPATH' '${1##-I}
37                         #INCPATH=$INCPATH' '$(1)
38                         ;;
39                 *)
40                         FILES=$FILES' '$1
41                         ;;
42         esac
43         shift
44 done
45
46 export INCPATH
47 export FILES
48
49 for i in $FILES
50 do
51         echo -n `echo $i | sed 's/.wml/.html/'`: $i
52         findincludes $i
53         echo
54 done