2022-10-20 15:21:20 +02:00
|
|
|
#!/bin/sh
|
|
|
|
if [ $# != 0 ]; then
|
|
|
|
echo 'dotoolc writes its stdin to the pipe being read by dotoold.
|
|
|
|
dotoolc will exit immediately if the pipe is not being read.
|
|
|
|
The path of the pipe is $DOTOOL_PIPE else /tmp/dotool_pipe.
|
|
|
|
' > /dev/stderr
|
|
|
|
[ "$1" = -h ] || [ "$1" = --help ]; exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
fifo_being_read(){
|
|
|
|
[ -p "$1" ] && /bin/echo 1<>"$1" >"$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
p="${DOTOOL_PIPE:-/tmp/dotool_pipe}"
|
|
|
|
|
|
|
|
if [ -p "$p" ] && ! [ -w "$p" ]; then
|
|
|
|
echo 'dotoolc: the pipe does not grant write permission'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if ! fifo_being_read "$p"; then
|
|
|
|
echo 'dotoolc: dotoold is not connected' > /dev/stderr
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-10-22 19:38:19 +02:00
|
|
|
exec cat > "$p"
|