wok-6.x view dropbear/stuff/sshx @ rev 11598

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