#!/bin/sh - # xt - convenience front-end for X11R5/X11R6/color xterm logins # Steve Kinzler, kinzler@cs.indiana.edu, Jan 94/Jan 02 # http://www.cs.indiana.edu/~kinzler/home.html#x11 doit='eval exec' cmd=${RSHCMD-rsh} remote=; title=; host=; args=; args2= while : do case $# in 0) break;; *) case "$1" in -h) cat << EOF 1>&2 usage: $0 [ -nodo ] [ -R ] [ -N title ] [ -rsh | -ssh | -telnet | -std ] [ xterm options ] [ host [ arguments ] ] -nodo no execute, just print the command that would execute -R run the xterm on the remote host (default local) -N title and iconname the xterm window with the given title -rsh use rsh to login to the remote host (default $cmd) -ssh use ssh to login to the remote host -telnet use telnet to login to the remote host -std equivalent to "-telnet -name xterm-std -N ''" The default host is the local host. A host beginning with a : is taken to be a command which outputs the hostname. Any final arguments are passed to the remote login program. Unless a -N option with a non-null title or a -name xterm option is given, the xterm window is titled and iconnamed with the hostname. Use -N DEFAULT to use xterm's default title and iconname. Use -N with a null title to explicitly use the hostname as the title and iconname. EOF exit 1;; -nodo) doit=echo;; -R) remote=t;; -N) shift; title="$1";; -rsh) cmd=rsh;; -ssh) cmd=ssh;; -telnet) cmd=telnet;; -std) cmd=telnet; title= args="$args -name xterm-std";; -*) case "$host" in '') args="$args '$1'" case "$1" in -name) title=DEFAULT shift; args="$args '$1'";; -b|-b[dgw]|-c[cr]|-display|-f[bgn]|-geometry) shift; args="$args '$1'";; -lf|-m[cs]|-n|-nb|-T|-t[mn]|-title|-sl|-w|-xrm) shift; args="$args '$1'";; -hc) shift; args="$args '$1'";; esac;; *) args2="$args2 '$1'";; esac;; *) case "$host" in '') host="$1";; *) args2="$args2 '$1'";; esac;; esac shift;; esac done case "$host" in :*) host=`echo "$host" | sed s/://` host=`eval "$host" | sed 1q`;; esac case "$host" in '') host=${HOST-${HOSTNAME-`(hostname) 2> /dev/null`}} case "$host" in '') host=`uname -n`;; esac host=`echo "$host" | sed 's/\..*//'` login=-ls;; *) case "$cmd" in rsh) if test -f /usr/bin/remsh; then cmd=/usr/bin/remsh elif test -f /usr/bin/rcmd; then cmd=/usr/bin/rcmd fi;; esac login="-ut -e $cmd '$host' $args2";; esac case "$title" in DEFAULT) case "$remote" in '') $doit xterm $args $login &;; *) $doit xrsh "'$host'" xterm $args -ls;; esac;; *) case "$title" in '') title="$host";; esac case "$remote" in '') $doit xterm -n "'$title'" -title "'$title'" $args $login &;; *) $doit xrsh "'$host'" \ xterm -n "'$title'" -title "'$title'" $args -ls;; esac;; esac