2 # $Heimdal: rxtelnet.in 13457 2004-03-07 17:22:06Z lha $
5 usage
="Usage: $0 [-l username] [-k] [-fF] [-t args_to_telnet] [-x args_to_xterm] [-K args_to_kx] [-w term_emulator] [-b telnet_binary] [-n] [-v] [-h | --help] [--version] host [port]"
12 -l) telnet_args
="${telnet_args} -l $2 "; kx_args="${kx_args} -l $2"; title="${2}@"; shift 2;;
13 -t) telnet_args
="${telnet_args} $2 "; shift 2;;
14 -x) xterm_args
="${xterm_args} $2 "; shift 2;;
15 -f) telnet_args
="${telnet_args} -f"; shift;;
16 -F) telnet_args
="${telnet_args} -F"; shift;;
17 -k) kx_args
="${kx_args} -k"; shift;;
18 -K) kx_args
="${kx_args} $2 "; shift 2;;
19 -n) term
=none
; shift;;
20 -w) term
=$2; shift 2;;
21 -b) binary
=$2; shift 2;;
22 --version) echo "$0: %PACKAGE% %VERSION%"; exit 0;;
23 -h) echo $usage; exit 0;;
24 --help) echo $usage; exit 0;;
25 -v) set -x; verb
=1; shift;;
26 -*) echo "$0: Bad option $1"; echo $usage; exit 1;;
30 if test $# -lt 1; then
36 title
="${title}${host}"
38 pdc_trams
=`dirname $0`
39 PATH
=$pdc_trams:$bindir:$PATH
41 set -- `kx $kx_args $host`
42 if test $# -ne 3; then
43 echo "Warning: Cound not setup X forwarding"
48 screen
=`echo $DISPLAY | sed -ne 's/[^:]*:[0-9]*\(\.[0-9]*\)/\1/p'`
57 if test -z "$term"; then
58 for j
in xterm dtterm aixterm dxterm hpterm
; do
61 if test -x $i/$j; then
67 test "$verb" && echo "Telnet command used is `type $binary`."
68 if test -n "$term" -a "$term" != "none"; then
69 ($term -title $title -n $title $xterm_args -e env DISPLAY
=$disp XAUTHORITY
=$auth $binary -D $telnet_args $host $port; test x
"$pid" != xNO
&& kill -USR2 $pid) &
71 env DISPLAY
=$disp XAUTHORITY
=$auth $binary -D $telnet_args $host $port
72 test x
"$pid" != xNO
&& kill -USR2 $pid