summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@shack.(none)>2010-05-07 02:24:01 +0200
committerroot <root@shack.(none)>2010-05-07 02:24:01 +0200
commitb9a22654b96cf5a32f227ef6991ea81176cacb50 (patch)
tree0cfe03bd2ab9e5238e500a8c7422a86555156470
parent81344217c8a54e46d7cfc38466303d046e08e77f (diff)
noise: use folders for connected clients
Additionally export $NOISE_pid to modules.
-rwxr-xr-xmodules/wall5
-rwxr-xr-xnoise11
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
diff --git a/noise b/noise
index 0e60bbf2..2b63acbe 100755
--- a/noise
+++ b/noise
@@ -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