-# $0 [prog] ([port])
-# You can use the evironment variable $QUERY_STRING for the query
-
-[ "$ADDR" = "" ] && ADDR=127.0.0.1
-[ "$LOG" = "" ] && LOG=/tmp/gopher.service.err
-[ "$PIDF" = "" ] && PIDF="`mktemp`"
-[ "$TIMEOUT" = "" ] && TIMEOUT=10
-[ "$MAXCON" = "" ] && MAXCON=1024
-
-prog="$1"
-port="$2"
-defn="$3"
-[ "$port" = "" ] && port=70
-
-if [ "$prog" = "" ]; then
- rm "$PIDF"
- echo "Syntax: $0 [prog] ([port]) (default non-7)" >&2
- echo ' You can use the evironment variable $QUERY_STRING for the query' >&2
- echo ' The default port is 70' >&2
- echo ' A default message for non-service (7) request can be given' >&2
- echo ' A filename will be displayed, you can delete it to stop the service' >&2
- echo ' (you still have to make a last connection on $port)' >&2
- exit 1
+# Defaults:
+[ "$PORT" = "" ] && PORT=70
+if [ "$MODE" = "" ]; then
+ # "" or dir-like selector? -> 1 ; if not -> 0
+ echo "$SELECTOR" | grep "/$" >/dev/null && MODE=1 || MODE=0
+ [ "$SELECTOR" = "" ] && MODE=1