Initial files no-vendor
authorJoey Schulze <joey@infodrom.org>
Thu, 30 Aug 2001 13:57:06 +0000 (13:57 +0000)
committerJoey Schulze <joey@infodrom.org>
Thu, 30 Aug 2001 13:57:06 +0000 (13:57 +0000)
bin/fixsuffix [new file with mode: 0755]
bin/wmldepend.sh [new file with mode: 0755]

diff --git a/bin/fixsuffix b/bin/fixsuffix
new file mode 100755 (executable)
index 0000000..e639d8b
--- /dev/null
@@ -0,0 +1,24 @@
+#! /bin/bash
+
+# Fixes file suffix
+#
+# .html -> .shtml
+#   Require "<!--#include"
+#
+# .html -> .php3
+#   Require "<?"
+
+for f in $*
+do
+    if grep -q '<!--[ ]*#include' $f
+    then
+       base=${f%.html}
+       mv -f $f $base.shtml
+    else
+        if grep -q '<?' $f
+       then
+           base=${f%.html}
+           mv -f $f $base.php3
+       fi
+    fi
+done
diff --git a/bin/wmldepend.sh b/bin/wmldepend.sh
new file mode 100755 (executable)
index 0000000..606e6c0
--- /dev/null
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+INCPATH=.
+FILES=''
+
+expandfile() {
+       for i in $INCPATH
+       do
+               if [ -f $i/$1 ] 
+               then
+                       echo $i/$1
+                       exit 0
+               fi
+       done
+       echo "Error: Include file \`$1' does not exist" > /dev/stderr
+#      echo "Fehler: Includedatei $1 existiert nicht" > /dev/stderr
+       exit 1
+}
+
+findincludes() {
+       for i in $*
+       do
+               for j in `sed -n 's/^#[Ii][Nn][Cc][Ll][Uu][Dd][Ee] *[<"]\([^>"]*\).*/\1/p' $i` \
+                        `sed -n 's/^#[Rr][Ee][Aa][Dd] *[<"]\([^>"]*\).*/\1/p' $i`
+               do
+                       echo ' \'
+                       foo=`expandfile $j`
+                       echo -n ' '$foo
+                       findincludes $foo
+               done
+       done
+}
+
+while [ "x$1" != "x" ]
+do
+       case "$1" in
+               -I*)
+                       INCPATH=$INCPATH' '${1##-I}
+                       #INCPATH=$INCPATH' '$(1)
+                       ;;
+               *)
+                       FILES=$FILES' '$1
+                       ;;
+       esac
+       shift
+done
+
+addmenu() {
+       root_prefix=`perl -MCwd -e '$_ = cwd;s/^.*src\/?//;@f=split /\//;$n=$#f+1;print "../"x $n;'`
+       menu_prefix=${root_prefix##../}
+
+       if [ -f ${menu_prefix}menu.def ]
+       then
+               echo ' \'
+               echo -n ' '${menu_prefix}menu.def
+       fi
+}
+
+export INCPATH
+export FILES
+
+for i in $FILES
+do
+       echo -n `echo $i | sed 's/.wml/.html/'`: $i
+       findincludes $i
+       addmenu
+       echo
+done