initial commit
authorpaul <paul@plutz.net>
Sun, 28 Jul 2013 16:31:17 +0000 (16:31 +0000)
committerpaul <paul@plutz.net>
Sun, 28 Jul 2013 16:31:17 +0000 (16:31 +0000)
svn path=/trunk/; revision=1

index.cgi [new file with mode: 0755]

diff --git a/index.cgi b/index.cgi
new file mode 100755 (executable)
index 0000000..919cf24
--- /dev/null
+++ b/index.cgi
@@ -0,0 +1,21 @@
+#!/bin/zsh
+
+call=$0
+real=$call
+
+die() {
+  echo "$*" >/dev/stderr
+  exit 1
+}
+
+while [ -L "$real" ]; do
+  real="$(stat -c %N "$real" |sed -r "s:..*. -> .(.*).$:\1:")"
+done
+
+_EXEC="$(dirname "$real")"  #execution directory
+_STOR="$(dirname "$call")"  #storage directory
+
+[ -w "$_EXEC" ] && [ -d "$_EXEC" ] || die "storage directory must be writable"
+
+echo ex: $_EXEC
+echo st: $_STOR