wok view dropbear/stuff/sshx @ rev 11597

dropbear/sshx: allow arguments
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jan 13 22:30:26 2012 +0100 (2012-01-13)
parents 3b8e288fd269
children bdff68e2cdc7
line source
1 #!/bin/sh
3 xdbclient()
4 {
5 read host type data
6 svr=$(echo $DISPLAY | sed 's/.*:\([0-9]*\).*/\1/')
7 n=$((10+($RANDOM % 90))); dpy=localhost:$n
8 remote=""
9 while true; do
10 arg="$1"; shift
11 remote="$remote $arg"
12 case "$arg" in
13 -[piIlLRWKBJ]) remote="$remote $1"; shift ;;
14 -*) ;;
15 *) break ;;
16 esac
17 done
18 [ -n "$1" ] || set -- "$TERM || xterm"
19 exec dbclient -f -R $((6000+$n)):localhost:$((6000+$svr)) $remote \
20 "xauth add $dpy $type $data; export DISPLAY=$dpy; $@" \
21 < /dev/null > /dev/null 2>&1
22 }
24 case "$DISPLAY" in
25 '') exec dbclient "$@" ;;
26 *) xauth list $DISPLAY | xdbclient "$@" ;;
27 esac