x
[heimdal.git] / appl / kx / rxterm.in
blobd0a409031bbdee9a54d0b526f6ef355d60c4831c
1 #!/bin/sh
2 # $Id$
4 usage="Usage: $0 [-l username] [-k] [-f] [-r rsh_args] [-x xterm_args] [-K kx_args] [-w term_emulator] [-b rsh_binary][-v] [-h | --help] [--version] host"
5 binary=rsh
6 term=xterm
7 while true
8 do
9 case $1 in
10 -l) rsh_args="${rsh_args} -l $2 "; kx_args="${kx_args} -l $2"; title="${2}@"; shift 2;;
11 -r) rsh_args="${rsh_args} $2 "; shift 2;;
12 -x) xterm_args="${xterm_args} $2 "; shift 2;;
13 -f) rsh_args="${rsh_args} -f"; shift;;
14 -k) kx_args="${kx_args} -k"; shift;;
15 -K) kx_args="${kx_args} $2 "; shift 2;;
16 -w) term=$2; shift 2;;
17 -b) binary=$2; shift 2;;
18 --version) echo "$0: %PACKAGE% %VERSION%"; exit 0;;
19 -h) echo $usage; exit 0;;
20 --help) echo $usage; exit 0;;
21 -v) set -x; shift;;
22 -*) echo "$0: Bad option $1"; echo $usage; exit 1;;
23 *) break;;
24 esac
25 done
26 if test $# -lt 1; then
27 echo "Usage: $0 host [arguments to $term]"
28 exit 1
30 host=$1
31 title="${title}${host}"
32 bindir=%bindir%
33 pdc_trams=`dirname $0`
34 PATH=$pdc_trams:$bindir:$PATH
35 export PATH
36 set -- `kx $kx_args $host`
37 if test $# -ne 3; then
38 exit 1
40 screen=`echo $DISPLAY | sed -ne 's/[^:]*:[0-9]*\(\.[0-9]*\)/\1/p'`
41 pid=$1
42 disp=${2}${screen}
43 auth=$3
44 kill -USR1 $pid
45 $binary -n $rsh_args $host "/bin/sh -c 'DISPLAY=$disp XAUTHORITY=$auth $term -T $title -n $title $xterm_args </dev/null >/dev/null 2>/dev/null &'"