changeset 757:2d45b0478d45 feature-world

s4-funcs.sh stay callable from command line
author HIROSE Yuuji <yuuji@gentei.org>
date Sat, 06 Jun 2020 16:32:45 +0900
parents a4523e15dfd6
children 369602864de8
files s4-funcs.sh
diffstat 1 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/s4-funcs.sh	Sat Jun 06 11:43:42 2020 +0900
+++ b/s4-funcs.sh	Sat Jun 06 16:32:45 2020 +0900
@@ -2,25 +2,25 @@
 # Here's global variable table.  Do not use this names.
 # $HGid$
 
+test -n "$HTTP_HOST" && isCGI=true
+if $isCGI; then
+  case "$0" in
+    *-world-*)
+      S4WORLD=${0#*world-}
+      S4WORLD=${S4WORLD%.*}
+      echo S4WORLD=$S4WORLD >&2
+      worldconf=s4-config-${S4WORLD}.sh
+      ;;
+  esac
 
-case "$0" in
-  *-world-*)
-    S4WORLD=${0#*world-}
-    S4WORLD=${S4WORLD%.*}
-    echo S4WORLD=$S4WORLD >&2
-    worldconf=s4-config-${S4WORLD}.sh
-    ;;
-esac
-
-echo worldconf=$worldconf >&2
-[ -f s4-config.sh ] && . ./s4-config.sh
-[ -n "$worldconf" -a -e "$worldconf" ] && . ./$worldconf
-echo DB=$DB >&2
-
+  echo worldconf=$worldconf >&2
+  [ -f s4-config.sh ] && . ./s4-config.sh
+  [ -n "$worldconf" -a -e "$worldconf" ] && . ./$worldconf
+  echo DB=$DB >&2
+fi
 myname=`basename ${SCRIPT_NAME:-$0}`
 mydir=`dirname ${SCRIPT_FILENAME:-$0}`
 myargs="$@"
-test -n "$HTTP_HOST" && isCGI=true
 PATH=/usr/local/sqlite3/bin:/usr/local/vim7/bin:/usr/iekei/ImageMagick/bin:/usr/local/ImageMagick/bin:$PATH
 tmpdir=${TMPDIR:-tmp}
 dbdir=${DBDIR:-db}

yatex.org