Files
heimdal/appl/kx/rxtelnet.in
Assar Westerlund acc9df43fc Add options: -l username, -t args_to_telnet, and -x args_to_xterm
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@975 ec53bebd-3082-4978-b11e-865c3cabbd6b
1996-11-16 16:30:12 +00:00

52 lines
1.0 KiB
Bash

#!/bin/sh
# $Id$
#
usage="Usage: $0 [-l username] [-t args_to_telnet] [-x args_to_xterm] host"
while true
do
case $1 in
-l) telnet_args="${telnet_args} -l $2 "; title="${2}@"; shift 2;;
-t) telnet_args="${telnet_args} $2 "; shift 2;;
-x) xterm_args="${xterm_args} $2 "; shift 2;;
-*) echo "$0: Bad option $1"; echo $usage; exit 1;;
*) break;;
esac
done
if test $# -lt 1; then
echo $usage
exit 1
fi
host=$1
title="${title}${host}"
shift
bindir=%bindir%
pdc_trams=`dirname $0`
PATH=$pdc_trams:$bindir:$PATH
export PATH
set -- `kx $host`
if test $# -ne 3; then
exit 1
fi
pid=$1
disp=$2
auth=$3
term=
oldifs=$IFS
IFS=:
set -- $PATH
IFS=$oldifs
for i in $*; do
test -n "$i" || i="."
for j in xterm aixterm dxterm hpterm; do
if test -x $i/$j; then
term=$j; break 2
fi
done
done
if test -n "$term"; then
($term -title $title -name $title $xterm_args -e env DISPLAY=$disp XAUTHORITY=$auth telnet -D $telnet_args $host; kill -USR2 $pid) &
else
env DISPLAY=$disp XAUTHORITY=$auth telnet -D $telnet_args $host
kill -USR2 $pid
fi