# HG changeset patch # User Pascal Bellard # Date 1326490226 -3600 # Node ID 32688e8c97a25ac44d49ef026ade20566155ec1a # Parent 5ee7ba5d5f577b66e7b33a3dd5fc2a37a406aba6 dropbear/sshx: allow arguments diff -r 5ee7ba5d5f57 -r 32688e8c97a2 dropbear/stuff/sshx --- a/dropbear/stuff/sshx Fri Jan 13 12:27:55 2012 +0100 +++ b/dropbear/stuff/sshx Fri Jan 13 22:30:26 2012 +0100 @@ -4,13 +4,24 @@ { read host type data svr=$(echo $DISPLAY | sed 's/.*:\([0-9]*\).*/\1/') - n=$((10+$svr)); dpy=localhost:$n - dbclient -f -R $((6000+$n)):localhost:$((6000+$svr)) "$@" \ - "xauth add $dpy $type $data; export DISPLAY=$dpy; $TERM || xterm" \ + n=$((10+($RANDOM % 90))); dpy=localhost:$n + remote="" + while true; do + arg="$1"; shift + remote="$remote $arg" + case "$arg" in + -[piIlLRWKBJ]) remote="$remote $1"; shift ;; + -*) ;; + *) break ;; + esac + done + [ -n "$1" ] || set -- "$TERM || xterm" + exec dbclient -f -R $((6000+$n)):localhost:$((6000+$svr)) $remote \ + "xauth add $dpy $type $data; export DISPLAY=$dpy; $@" \ < /dev/null > /dev/null 2>&1 } case "$DISPLAY" in -'') dbclient "$@" ;; +'') exec dbclient "$@" ;; *) xauth list $DISPLAY | xdbclient "$@" ;; esac