diff options
author | root <root@shack.(none)> | 2010-05-07 02:24:01 +0200 |
---|---|---|
committer | root <root@shack.(none)> | 2010-05-07 02:24:01 +0200 |
commit | b9a22654b96cf5a32f227ef6991ea81176cacb50 (patch) | |
tree | 0cfe03bd2ab9e5238e500a8c7422a86555156470 | |
parent | 81344217c8a54e46d7cfc38466303d046e08e77f (diff) |
noise: use folders for connected clients
Additionally export $NOISE_pid to modules.
-rwxr-xr-x | modules/wall | 5 | ||||
-rwxr-xr-x | noise | 11 |
2 files changed, 9 insertions, 7 deletions
diff --git a/modules/wall b/modules/wall index fa7618fe..7c32d01d 100755 --- a/modules/wall +++ b/modules/wall @@ -2,8 +2,7 @@ case "$1" in (--help) : ;; (?*) - for client in /tmp/noise-client-* ; do - #echo /msg "$*`printf '\a'`" >$client - echo /msg "$*" >$client + for linefeed in /tmp/noise/*/linefeed ; do + echo /msg "$*" >$linefeed done esac @@ -50,8 +50,10 @@ fail() { } cleanup() { - rm -f $linefeed $env kill $jobs + rm -f $linefeed $env + rmdir /tmp/noise/$$ 2>/dev/null + rmdir /tmp/noise 2>/dev/null } @@ -62,8 +64,9 @@ if test -d "$dirname/modules" ; then export NOISE_PATH="${NOISE_PATH+$NOISE_PATH:}$dirname/modules" export NOISE_PATH="${NOISE_PATH+$NOISE_PATH:}$HOME/noise/modules" fi -linefeed="/tmp/noise-client-$$" -env="/tmp/noise-client-$$-env" +mkdir -vp /tmp/noise/$$ +linefeed="/tmp/noise/$$/linefeed" +env="/tmp/noise/$$/environment" trap cleanup EXIT mkfifo $linefeed touch $env @@ -89,7 +92,7 @@ while echo -n "$noise_prompt" && eval "`readline`" ; do module="$dir/$command" if test -x "$module" ; then shift - eval 'NOISE="$0" NOISE_linefeed="$linefeed" "$module"' "$args" + eval 'NOISE="$0" NOISE_pid="$$" NOISE_linefeed="$linefeed" "$module"' "$args" continue 2 fi done |