diff --git a/server/xrxs-srv.sh b/server/xrxs-srv.sh index aba2a13..152e73d 100755 --- a/server/xrxs-srv.sh +++ b/server/xrxs-srv.sh @@ -2,18 +2,25 @@ PORT=5460 -if [ -z "${DISPLAY}"]; then +if [ -z "${DISPLAY}" ]; then export DISPLAY=:0 fi +seat=$(echo ${DISPLAY} | awk -F. '{print $1}') + +debug="" + case $1 in start) - ./xrxs -s xrxs & sleep 1 - 9pserve -c unix!/tmp/ns.$(whoami).${DISPLAY}/xrxs tcp!0.0.0.0!${PORT} & + if [ "$2" = "-d" ]; then + debug="-d" + fi + ./xrxs -s xrxs ${debug} & sleep 1 + 9pserve -c unix!/tmp/ns.$(whoami).${seat}/xrxs tcp!0.0.0.0!${PORT} & ;; stop) killall xrxs - rm /tmp/ns.$(whoami).${DISPLAY}/xrxs + rm /tmp/ns.$(whoami).${seat}/xrxs ;; *) echo "$0 start|stop" diff --git a/server/xrxs.c b/server/xrxs.c index 558cfde..0f84c5e 100644 --- a/server/xrxs.c +++ b/server/xrxs.c @@ -17,7 +17,7 @@ #include "realm.h" #include "user.h" -int chatty9p = 1; +int chatty9p = 0; static Tree* tree; @@ -606,6 +606,12 @@ void threadmain(int argc, char* argv[]) { } } + for (i = 0; i < argc; i++) { + if (scmp(argv[i], "-d")) { + chatty9p = 1; + } + } + fs.foreground = 1; fs.tree = alloctree(nil, nil, DMDIR | 0777, fs_destroy_file); tree = fs.tree;