wok-next annotate dropbear/stuff/sshx @ rev 12948

libglade: update bdeps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed May 30 23:13:24 2012 +0200 (2012-05-30)
parents 32688e8c97a2
children caf768bb46f9
rev   line source
pascal@10917 1 #!/bin/sh
pascal@10917 2
pascal@10917 3 xdbclient()
pascal@10917 4 {
pascal@10917 5 read host type data
pascal@10919 6 svr=$(echo $DISPLAY | sed 's/.*:\([0-9]*\).*/\1/')
pascal@11598 7 scr=${DISPLAY/*./.}; [ "$scr" == "$DISPLAY" ] && scr=""
pascal@11597 8 n=$((10+($RANDOM % 90))); dpy=localhost:$n
pascal@11597 9 remote=""
pascal@11597 10 while true; do
pascal@11597 11 arg="$1"; shift
pascal@11597 12 remote="$remote $arg"
pascal@11597 13 case "$arg" in
pascal@11597 14 -[piIlLRWKBJ]) remote="$remote $1"; shift ;;
pascal@11597 15 -*) ;;
pascal@11597 16 *) break ;;
pascal@11597 17 esac
pascal@11597 18 done
pascal@11597 19 [ -n "$1" ] || set -- "$TERM || xterm"
pascal@11597 20 exec dbclient -f -R $((6000+$n)):localhost:$((6000+$svr)) $remote \
pascal@11598 21 "xauth add $dpy $type $data; export DISPLAY=$dpy$scr; $@ ; xauth remove $dpy" \
pascal@11598 22 < /dev/null > /dev/null
pascal@10917 23 }
pascal@10917 24
pascal@10919 25 case "$DISPLAY" in
pascal@11597 26 '') exec dbclient "$@" ;;
pascal@10919 27 *) xauth list $DISPLAY | xdbclient "$@" ;;
pascal@10917 28 esac