[comp.sources.x] v08i074: rterm, Part01/01

tale@turing.cs.rpi.edu (David C Lawrence) (08/17/90)

Submitted-by: tale@turing.cs.rpi.edu (David C Lawrence)
Posting-number: Volume 8, Issue 74
Archive-name: rterm/part01

rterm can be used to start up xterms for remote hosts with either
telnet, rlogin or rsh.  I wrote it originally because I didn't like
the long, ugly lines in my hosts menu which duplicated a lot of
information just to change one or two things.  A recent message in
comp.windows.x prompted me to write up a manual page, install it
for the rest of our users and offer it to anyone else out there who
wants it.

Dave
-- 
   (setq mail '("tale@cs.rpi.edu" "tale@ai.mit.edu" "tale@rpitsmts.bitnet"))

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 1)."
# Contents:  README Imakefile MANIFEST Makefile-dist RTerm.ad
#   patchlevel.h rterm rterm.1
# Wrapped by src@sirius.cs.rpi.edu on Fri Aug 17 05:34:41 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(3044 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XThis is xlogin version 1.0.  Giving a version number to a simple shell
Xscript seems pretty anal, but then this whole thing appears to be that
Xway.
X
Xxlogin can be used to start up xterms for remote hosts with either
Xtelnet, rlogin or rsh.  I wrote it originally because I didn't like
Xthe long, ugly lines in my hosts menu which duplicated a lot of
Xinformation just to change one or two things.  A recent message in
Xcomp.windows.x prompted me to write up a manual page, install it
Xfor the rest of our users and offer it to anyone else out there who
Xwants it.
X
XI thought about including an Imakefile but that would have been _very_
Xanal.  Just edit the script to change the method and xpath defaults if
Xyou want and then put it in your X bin with execute permission.  Then
Xput the manual page in your ManDir and annouce it.  Voila.
X
XPersonally, I have it installed with -rlogin as the default for two
Xreasons:  I don't like users .rhosting all of creation so rsh always
Xworks for them and most of them are on high-powered DEC 3100s and SS1s
Xso they don't need to encumber other machines with xterms.
X
XThis is covered by the GNU General Public License.  In yet another
Xattempt to avoid even more analness I didn't include yet another copy
Xof COPYING.
X
Xxlogin version 1.1		-- Wed Aug 15 02:21:51 1990
X
XOk, I changed my mind about some things before I was ready to ship it.
XNow it uses the RESOURCE_MANAGER.  Really.  Perhaps not in the
Xabsolutely most robust way it could but it seems pretty flexible; this
Xallows the advantage of having default options for each host, making
Xit easier to use from the shell because for the most part you would
Xnever need to type options.  This added an AppDefaults file which is
Xpretty minimal.
X
XHere's what you should do to install it:  check the two defaults in
XXLogin.ad and change them if need be.  Check the paths in Makefile
X[now reborn as Makefile-dist].  Then make.
X
Xrterm version 1.2              -- Wed Aug 15 14:47:06 1990
X
XWhat changed for this version, so soon after the other one?  I
Xdiscovered, just after I mailed it to Dan, that there is an
Xxlogin.shar.Z on expo.  I personally think, tempered of course with
Xego, that xlogin is a name more naturally suited to my application
Xthan to the function of the other one; nevertheless I don't want to be
Xa dick about it and confuse lots of people ("Um, which xview do you
Xmean?") so I've changed the name.  Hopefully this one isn't taken; I'm
Xsure someone will tell me if it is.  Yes, I know it doesn't well
Xparallel the rsh name, as indeed the xterm could be running locally.
XSo what?  shutdown allows -r which centers more around bringing the
Xsystem up than taking it down. :-)
X
XDan says I need an Imakefile and a patchlevel.h for posting so they're
Xthere now.   Feel free to mostly ignore them.  Makefile-dist is much
Xshorter than anything imake could come up with it, though you might
Xneed to make an edit or two to change the flags or paths.
X
X                                 ----
X
XComments, suggestions, whatever to David C Lawrence <tale@rpi.edu>.
END_OF_FILE
if test 3044 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Imakefile'\"
else
echo shar: Extracting \"'Imakefile'\" \(769 characters\)
sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
X/* Dan Heller says I need this; apparently my comment in README wasn't 
X * sufficient. :-)  Well, here 'tis.
X
X * (I agree, it does make sense as far as the right paths go.  It makes
X * an obese Makefile for the purposes, though.)
X
X * InstallScript _stinks_ for this, especially on systems that let
X * install crap out with an error when it can't install -s a non-object
X * executable (and hence make just stops executing things for that
X * target instance).  Something is wrong in the way it is set up -- I
X * personally think it should just use INSTBINFLAGS.
X */
X
Xinstall:: rterm RTerm.ad rterm.1
X	$(INSTALL) -c $(INSTBINFLAGS) rterm $(BINDIR)/rterm
X	$(INSTALL) -c $(INSTAPPFLAGS) RTerm.ad $(XAPPLOADDIR)/RTerm
X	$(INSTALL) -c $(INSTMANFLAGS) rterm.1 $(MANDIR)/rterm.1
END_OF_FILE
if test 769 -ne `wc -c <'Imakefile'`; then
    echo shar: \"'Imakefile'\" unpacked with wrong size!
fi
# end of 'Imakefile'
fi
if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(466 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
X   File Name		Archive #	Description
X-----------------------------------------------------------
X README                     1	Introduction
X Imakefile                  1	Baggage
X MANIFEST                   1	This shipping list
X Makefile-dist              1	Simple installation
X RTerm.ad                   1	Short app-defaults file
X patchlevel.h               1	Baggage
X rterm                      1	Bourne shell script
X rterm.1                    1	nroff manual page
END_OF_FILE
if test 466 -ne `wc -c <'MANIFEST'`; then
    echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'Makefile-dist' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile-dist'\"
else
echo shar: Extracting \"'Makefile-dist'\" \(219 characters\)
sed "s/^X//" >'Makefile-dist' <<'END_OF_FILE'
X# Change the paths if need be and let 'er rip.
X
Xinstall:
X	install -c -m 0755 rterm /usr/bin/X11/rterm
X	install -c -m 0444 RTerm.ad /usr/lib/X11/app-defaults/RTerm
X	install -c -m 0444 rterm.1 /usr/local/man/man1/rterm.1
END_OF_FILE
if test 219 -ne `wc -c <'Makefile-dist'`; then
    echo shar: \"'Makefile-dist'\" unpacked with wrong size!
fi
# end of 'Makefile-dist'
fi
if test -f 'RTerm.ad' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'RTerm.ad'\"
else
echo shar: Extracting \"'RTerm.ad'\" \(47 characters\)
sed "s/^X//" >'RTerm.ad' <<'END_OF_FILE'
XRTerm*method: rlogin
XRTerm*xpath: /usr/bin/X11
END_OF_FILE
if test 47 -ne `wc -c <'RTerm.ad'`; then
    echo shar: \"'RTerm.ad'\" unpacked with wrong size!
fi
# end of 'RTerm.ad'
fi
if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patchlevel.h'\"
else
echo shar: Extracting \"'patchlevel.h'\" \(186 characters\)
sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
X/* Ho ho!  The presence of this file is mandated by Dan Heller for
X * comp.sources.x.   Fair enough.  Kind of odd for a shell script, though.
X */
X
X#define VERSION 1
X#define PATCHLEVEL 2
END_OF_FILE
if test 186 -ne `wc -c <'patchlevel.h'`; then
    echo shar: \"'patchlevel.h'\" unpacked with wrong size!
fi
# end of 'patchlevel.h'
fi
if test -f 'rterm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rterm'\"
else
echo shar: Extracting \"'rterm'\" \(7917 characters\)
sed "s/^X//" >'rterm' <<'END_OF_FILE'
X#! /bin/sh -f
X# xlogin -- start sessions with hosts -- Sun Mar  4 05:38:44 1990 - tale
X# 
X# This programme is free software; you can redistribute it and/or modify
X# it under the terms of the GNU General Public License version 1 as
X# published by the Free Software Foundation.  A copy of the GNU GPL can
X# be obtained from the FSF at 675 Massachusetts Ave, Cambridge MA 02139.
X#
X# modified to use RESOURCE_MANAGER on 13 Aug 90.
X# renamed to rterm on 15 Aug 90.
X#
X# telnet connexions are purposefully neither xhosted nor have the
X# $DISPLAY hack.  If you want it xhosted too use -xhost.
X#
X# /bin/csh is used on the remote end so rsh will exit; I am not a
X# Unix wizard to know why this must be so.  (I prefer the Bourne
X# shell, personally.)  It doesn't work on all systems, either.
X#
X# getting quoting right was such a hairy beast because of translations
X# that values went through, especially into variables.  It also could 
X# easily bump up against the nine positional parameter limit when
X# trying to keep track of resource that way, the only way I could see
X# to easily preserve args since keyword variables couldn't do it right.
X# That's when I gave up and punted it to a temp file.
X# It's still pretty damned hard to get a quote into the label now with rsh; 
X# impossible I think.
X#
X# Shell utilities used:  echo, test, sed, rm, cat, expr.
X# X programmes used:  appres, xhost, xterm.
X# Network programmes used:  rsh, rlogin, telnet.
X#
X# Author: tale@turing.cs.rpi.edu (David C Lawrence)
X
XPATH=/bin:/usr/bin:/usr/ucb:/usr/bin/X11
Xexport PATH
X
Xargs=/tmp/rterm$$args
Xsubshellhack=/tmp/rterm$$
Xcleanup="rm -f $args $subshellhack"
Xtrap "$cleanup" 0 1 2 3 15
X
X# I am using "class" incongruously here with the rest of X.  I don't much care.
Xclass=RTerm
X
Xprogname=`expr $0 : '.*/\(.*\)' \| $0`
Xversion="$progname version 1.2"
Xusage="Usage: $progname host [-rlogin | -telnet | -rsh] [-label NAME] [-login NAME] \
X             [-xpath PATH] [-xhost HOST] [-h = -help] [-v = -version]"
X
X# I use cases; one less process to fork if test isn't a builtin.
X# This thing already has enough processes associated with it.
Xcase $# in 
X  0) echo "$usage" 1>&2 ; exit 1;;
Xesac
X
Xshorthost () { expr $1 : '\([^.]*\)'; }
X
X# This is a bit convoluted.  shorthost is done on $1 even if it is
X# -help or -version because the default method and xpath are needed
X# from appres for usage
X
X# make default login and label
Xhostname="$1" ; shift
Xlh=`shorthost $hostname`                        # hostname local
Xdh=`echo $hostname | sed s'/\\./_/g'`           # hostname with domain
Xlabel=$lh
X: > $args
X
X# get resource defaults
XOIFS="$IFS"
XIFS=":$IFS"
Xappres $class | while read resource value; do
X  case $resource in
X    $class[.*]$lh[.*]method|$class[.*]$dh[.*]method)echo 'method="'$value'"' ;;
X    $class[.*]$lh[.*]label |$class[.*]$dh[.*]label) echo  'label="'$value'"' ;;
X    $class[.*]$lh[.*]xpath |$class[.*]$dh[.*]xpath) echo  'xpath="'$value'"' ;;
X    $class[.*]$lh[.*]login |$class[.*]$dh[.*]login) echo  'login="'$value'"' ;;
X    $class\*method)                      echo 'method="${method:-'$value'}"' ;;
X    $class\*xpath)                         echo 'xpath="${xpath:-'$value'}"' ;;
X    $class\*label)                         echo 'label="${label:-'$value'}"' ;;
X    $class\*login)                         echo 'login="${login:-'$value'}"' ;;
X    $class[.*]$lh[.*]xhost|$class[.*]$dh[.*]xhost|$class\*xhost)
X                                           echo xhosts=\"$xhosts $value\"    ;;
X    # args we don't know about are handed as resources to xterm
X    # note that this fails when trying to do something like set an arg
X    # for a particular host which contradicts a general one which
X    # comes later.  A consequence of having : in IFS makes :s in $value
X    # get blown away.  Bummer.
X    $class[.*]$lh[.*]*)
X      string="`echo $resource\: $value | sed s/$class.$lh/XTerm/`"
X      echo -n "-xrm \\\"$string\\\" " >> $args ;;
X    $class[.*]$dh[.*]*)
X      string="`echo $resource\: $value | sed s/$class.$dh/XTerm/`"
X      echo -n "-xrm \\\"$string\\\" " >> $args ;;
X    $class\**)
X      string="`echo $resource\: $value | sed s/$class/XTerm/`"
X      echo -n "-xrm \\\"$string\\\" " >> $args ;;
X  esac
Xdone > $subshellhack   # Sigh.  Subshells.
XIFS="$OIFS"
X
X. $subshellhack
X
X# provide some reasonable defaults even in lieu of any in resources
X# i hate when other programmes like XCalc don't do this.
Xmethod="${method:-rlogin}"
Xxpath="${xpath:-/usr/bin/X11}"
X
Xcase "$hostname" in
X  -h | -help)
X    cat <<EOT
X$usage
X
X-rlogin:  xhost remote host, run xterm locally and rlogin to remote host.
X-rsh:     xhost remote host, rsh to remote host and run xterm there.
X-telnet:  run xterm locally and telnet to remote host.
XDefault connexion method:  $method
X
X-label:   string for icon and title bar; defaults to first part of remote host.
X-login:   login name on remote host for rsh and rlogin; defaults to local name.
X-xpath:   Directory of xterm on remote host for rsh; default: $xpath.
X-xhost:   Additional name to xhost; usually an alias for the remote machine.
X
XThe following will also be recognised if the first argument.
X-h or -help:    Print this message.
X-v or -version: Print version.  This is $version.
X
XRemaining arguments are passed to xterm.
XEOT
X    exit 1 ;;
X  -v | -version)
X    echo $version
X    exit 1 ;;
Xesac
X
X# Make sure display is set to this machine; this sort of cheats
X# because it only considers the local names, which might be in
X# different domains.  Fails when $DISPLAY and hostname both indicate
X# different names for the same machine.
Xlocalhost=`hostname`
Xlocalhostshort=`shorthost $localhost`
X
Xif test `expr $DISPLAY : unix: \| $DISPLAY : localhost: \| \
X        $DISPLAY : ${localhostshort}: \| $DISPLAY : ${localhost}:` -ne 0; then
X  # seemingly on the server; do xhost
X  xhost=xhost
X  # put hostname in DISPLAY; potentially loses if localhost = localhostshort
X  DISPLAY=${localhost}:`expr $DISPLAY : '.*:\(.*\)'`
X else
X  xhost=echo
Xfi
X
Xwhile :; do
X  case $# in
X    0) break ;; # ta ta.  All arguments are gone.
X  esac
X
X  # obviously, the last arg for mutually exclusive args is the victor.
X  case "$1" in
X    -rlogin)	method=rlogin                ;;
X    -telnet)	method=telnet                ;;
X    -rsh)	method=rsh                   ;;
X    -label)	shift; label="$1"            ;;
X    -login)	shift; login="-l $1"         ;;
X    -xpath)     shift; xpath=$1              ;;
X    -xhost)     shift; xhosts="$xhosts $1"   ;;
X    # pass the rest as arguments to xterm
X    *) echo -n "\\\"$1\\\" " >> $args
X  esac
X  shift
Xdone
X
Xcase $method in
X  rsh)
X    # This is wickedly ugly to the point of perversity.  I ended up using
X    # another temp file because on machines where the login shell was csh
X    # there seemed to be no way to pass down quoted strings to the csh -c
X    # argument.  (It worked fine on machines where bash is my login shell.)
X    # This is done to limit only " from the list of printable characters which
X    # could effectively be used in a label.  Creative quoting is still
X    # necessary.
X    $xhost $xhosts $hostname > /dev/null
X    command="\"$xpath/xterm -n \\\"$label\\\" -T \\\"$label\\\" \
X      -display $DISPLAY -ls `cat $args` \& \""
X    $cleanup
X    exec rsh $hostname ${login:+"-l $login"} -n \
X      echo \"$command\" \> '/tmp/rterm$$' \; \
X      /bin/csh -cf "\"\`cat /tmp/rterm\$\$\` ; \
X         rm /tmp/rterm\$\$ \" < /dev/null >& /dev/null" ;;
X  rlogin)
X    $xhost $xhosts $hostname > /dev/null
X    command="xterm -n \"$label\" -T \"$label\" `eval echo \`cat $args\`` -e 
X             sh -c 'export TERM; 
X             TERM=xterm@$DISPLAY exec rlogin $hostname ${login:+-l $login}'" 
X    eval exec $command & ;;
X  telnet)
X    $xhost $xhosts > /dev/null
X    command="xterm -n \"$label\" -T \"$label\" `eval echo \`cat $args\`` -e
X             telnet $hostname"
X    eval exec $command & ;;
X  *)
X    echo $progname: bogus method: $method 1>&2 ; exit 1 ;;
Xesac
X
Xexit 0
END_OF_FILE
if test 7917 -ne `wc -c <'rterm'`; then
    echo shar: \"'rterm'\" unpacked with wrong size!
fi
chmod +x 'rterm'
# end of 'rterm'
fi
if test -f 'rterm.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rterm.1'\"
else
echo shar: Extracting \"'rterm.1'\" \(11578 characters\)
sed "s/^X//" >'rterm.1' <<'END_OF_FILE'
X.TH RTERM 1 "version 1.2" "X11R4"
X.de EX
X.ne 5
X.if n .sp 1
X.nf
X..
X.de EE
X.fi
X.if n .sp 1
X.if t .sp .5
X..
X.SH NAME
XRTerm - start X sessions to other hosts
X.SH SYNOPSIS
X.ta 8n
X\fBrterm\fP \fIhost\fP [-rlogin | -telnet | -rsh] [-label \fIname\fP]
X.br
X[-login \fIname\fP] [-xpath \fIpath\fP] [-xhost \fIhost\fP] [-h = -help]
X.br
X[-v = -version]
X.SH DESCRIPTION
XThe
X.I rterm
Xprogramme is used to connect to other hosts for
X.BR xterm(1)
Xsessions.  It
Xallows for three different types of connexions and handles automatic
Xxhosting and labelling of windows.  A minimum number of processes are
Xkept hanging around.
X.SH OPTIONS
XThe following options are recognised by
X.I rterm
Xwhen either are the first argument; it ignores remaining arguments and exits
Ximmediately.
X.TP 8
X.B \-v or \-version
XPrint the current version.
X.TP 8
X.B \-h or \-help
XPrint a summary of the options and defaults.
X.LP
XThese options follow the host argument to
X.I rterm.
X.TP 8
X.B \-rlogin
XUse
X.BR rlogin(1)
Xto contact the remote host from a local
X.I xterm.
XThe host will be added to your access control list by
X.I xhost
Xif
X.I rterm
Xis run on the server machine.
XYour
X.B DISPLAY
Xenvironment variable is piggy-backed to the remote host on the
X.B TERM
Xenvironment variable.  See
X.B EXAMPLES
Xbelow for how you can interpret it.
X.TP 8
X.B \-rsh
XUse 
X.BR rsh(1)
Xto establish the connexion to the remote host on which
X.I xterm
Xis run.  The remote machine is added as with
X.B \-rlogin.
X.TP 8
X.B \-telnet
XUse
X.BR telnet(1)
Xto contact the remote host from a local
X.I xterm.
XThe remote machine is not automatically added to your access control list.
X.LP
XA default connexion method is provided; which one is left to your local
Xadministrator's discretion.  The above methods are of course mutually
Xexclusive. 
X.TP 8
X.B \-label \fIname\fP
XMake \fIname\fP the label for the title bar and icon of 
X.I xterm.
XIt defaults to the local name of the remote host.
X.TP 8
X.B \-login \fIname\fP
XUse \fIname\fP as the login name for the remote machine with
X.I rsh
Xor
X.I rlogin.
XBy default your login name on the local host is used.
X.TP 8
X.B \-xpath \fIpath\fP
XThe directory in which
X.I xterm
Xresides on the remote machine, for use with
X.I rsh.
XThis typically defaults to \fI/usr/bin/X11\fP.
X.TP 8
X.B \-xhost \fIhost\fP
XAdd \fIhost\fP to the access control list if running
X.I rterm
Xon the server.  This is especially useful if the remote machine enjoys
Xa bit of schizophrenia and frequently goes by two names.
X.LP
XRemaining arguments are passed to
X.I xterm.
X.SH RESOURCES
XSomewhat laughably, the
X.I rterm
Xshell script supports the RESOURCE_MANAGER (see 
X.BR xrdb(1))
Xfor setting of options; this makes it possible to invoke the programme
Xonly with the name of the host and have the correct defaults used.
XResources can be specified on a per host basis by inserting the target
Xhost name between RTerm and the final resource name; a * wildcard
Xbetween RTerm and final resource name means to use the resource on
Xall RTerm sessions.
X.LP
XAny resources which
X.I rterm
Xdoesn't recognise as particular to it will be passed as an XTerm
Xresource, sans the RTerm prefix and any hostname descriptor.  For
Xthose resources which control the behaviour of
X.I rterm
X(as opposed to those which it sends to
X.I xterm)
Xa resource specified for a particular host will override any default;
Xfor those that become XTerm resources the order in which they are
Xreceived from the RESOURCE_MANAGER will determine whether a host
Xresource will override a default; this only happens, however, when the
Xseparator following RTerm is a *.  If you always use . to precede
XHOST qualifiers then the problem will be avoided.  In all cases,
Xcommand line arguments override values retrieved from the RESOURCE_MANAGER.
X.LP
XWhen specifying the HOST portion of a resource either the local name
Xor its fully specified domain name, with dots replaced by underbars,
Xwill be recognised, with some limitations, see
X.B BUGS
Xbelow.
X.IP \fBRTerm[.HOST]*method\fP
XThe connexion method to use, one of \fIrsh\fP, \fIrlogin\fP, or
X\fItelnet\fP.
X.IP \fBRTerm[.HOST]*xpath\fP
XThe directory in which
X.I xterm
Xis on the other machine when using \fIrsh\fP.
X.IP \fBRTerm[.HOST]*label\fP
XThe label to use for the window.  Labels which have spaces do not need
Xto be surrounded by quotes as they would if provided on the command line,
Xbut other contortions of backslash quoting may be necessary to get
Xspecial shell characters into the label.
X.IP \fBRTerm[.HOST]*login\fP
XThe login name to use on the remote host when using \fIrsh\fP or
X\fIrlogin\fP.
X.IP \fBRTerm[.HOST]*xhost\fP
XAdditional hosts to add to the access control list if
X.I rterm
Xis run from the server machine.  Multiple hosts can appear on a single
Xresource line.
X.SH EXAMPLES
XA sample menu from \fI.twmrc\fP:
X.EX 0
Xmenu "Hosts" {
X  "Hosts"       f.title
X  "home"       !"rterm home &"
X  # This is also a fileserver known frequently as housework.
X  "workhorse"  !"rterm workhorse -xhost housework &"
X  # This machine is so secure I can't have a .rhosts and we don't
X  # have Kerberos.  This nice guy lets me use his account though.
X  "secure"     !"rterm secure.secret.gov -rlogin -login bushg &"
X  # These guys didn't put xterm in /usr/bin/X11.
X  "sleepy"     !"rterm sleepy.othersite.edu -xpath /usr/local/X11 &"
X  # This isn't really a Unix box at all.  I like this window big.
X  "bop"        !"rterm bop -telnet -g 80x60 &"
X  # Don't forget to quote args that should have spaces retained.
X  # Trailing args override previous ones.  This has an icon of
X  # "Jabberwocky" but a title bar of "Lewis Carroll."
X  "wabe"       !"rterm wabe -label Jabberwocky -T 'Lewis Carroll' &"
X}
X.EE
XThis line starts a telnet to woof in a grey-on-maroon 80x35 xterm that
Xhas the label "Bow Wow":
X.EX 0
Xexample$ rterm woof
X.EE
XWhy?  This is presumably in the RESOURCE_MANAGER:
X.EX 0
X        RTerm.woof.method:             telnet
X        RTerm.woof.label:              Bow Wow
X        RTerm.woof.VT100.geometry:     80x35
X        RTerm.woof*background:         maroon
X        RTerm.woof*foreground:         grey
X.EE
XThis line will make the label of an \fIrsh\fP session include a single quote:
X.EX 0
Xexample$ rterm fip -rsh -label "Jim\\\\\\'s Machine"
X.EE
XWhen using \fIrlogin\fP or \fItelnet\fP, however, none of the
Xbackslashes are necessary.
X.LP
XThe
X.B \-rlogin
Xoption sets the environment variable
X.B TERM
Xto a form which looks like
X.B TERM@DISPLAY
Xbefore making the connexion.  This can be interpreted during the login
Xprocedure at the remote host to correctly seperate the
X.B TERM
Xand
X.B DISPLAY
Xvariables.  The following in \fI.profile\fP or the equivalent will do
Xit for people using a Bourne-syntax shell:
X.EX 0
X    if [ `expr $TERM : '.*@'` -ne 0 ]; then
X      export DISPLAY=`expr $TERM : '.*@\\(.*\\)'`
X      TERM=`expr $TERM : '\\([^@]*\\)'`
X      noglob= eval `tset -s $TERM`
X    fi
X.EE
XYou might need to double the \\ before the parentheses if you are a 
X.BR bash(1)
Xuser.
X.LP
XC-Shell users could put this in \fI.login\fP:
X.EX 0
X    if ( `expr $TERM : '.*@'` != 0) then
X      setenv DISPLAY `expr $TERM : '.*@\\(.*\\)'`
X      setenv TERM `expr $TERM : '\\([^@]*\\)'`
X      set noglob; eval `tset -s $TERM`; unset noglob
X    endif
X.EE
X.SH ENVIRONMENT
X.TP 8
X.B DISPLAY
Xto get the default host and display number if not the local host.
X.B 
X.SH FILES
X\fI/tmp\fP files are used on the local host and on the remote host
Xwhen using \fIrsh\fP.
X.SH SEE ALSO
X.BR xterm(1),
X.BR xhost(1),
X.BR rsh(1),
X.BR rlogin(1),
X.BR telnet(1),
Xand the
X.BR xon
Xscript by Jim Dempsey <jjd@bbn.com> for using
X.B rsh
Xto run any type of process on a remote host.
X.SH BUGS
XUnder at least one system type, Sequent Dynix, the
X.B TERM piggy-backing
Xdone by
X.B \-rlogin
Xdoesn't work very well because something intercepts
X.B TERM
Xand moans that it is an unknown terminal type
Xlong before any user login file processing.
X.LP
XIn order to facilitate getting the
X.B rsh
Xprocess to vanish the standard file descriptors are directed to
X\fI/dev/null\fP.  This causes any errors from the remote shell or
X.B xterm
Xto be lost.
X.LP
XMultiple machine names for the server could potentially make
X.I rterm
Xthink it isn't running on the server when it is; this can be prevented
Xby making sure that
X.B DISPLAY
Xmatches either unix, localhost or whatever
X.BR hostname(1)
Xreturns.
X.LP
XIf 
X.BR hostname(1)
Xdoesn't include the domain name of your server machine you will
Xprobably have problems with
X.B DISPLAY
Xwhen trying to connect with machines outside your domain.  This can be
Xcircumvented by including 
X.B \-display \fIdisplay\fP
Xwhen using
X.B \-rsh
Xor by setting
X.B DISPLAY
Xto include your fully-qualified domain name for the
X.I rterm
Xprocess.
X.LP
XIf you specify the HOST part of a resource with the fully-qualified
Xdomain name but invoke
X.I rterm
Xwith only the local part then the resource will not be used.
X.LP
XIf you specify a fully-qualified domain name for a host on the command
Xline and have resources which match its local name, they will be used
Xregardless of whether that resource local name was really intended for
Xthat particular host.  (Example: contacting turing.mit.edu when you
Xhave RTerm.turing.* resources intended for turing.cs.rpi.edu.)  This
Xmight be considered more a bug in the user than in the programme ("Do
XWhat I Mean") but it is admittedly inconvenient.
X.LP
XAny colons in a resource value will be blown away.
X.LP
XQuoting special shell characters for things like labels is
Xinconsistent when using \fIrsh\fP rather than \fIrlogin\fP or
X\fItelnet\fP.  Generally three levels of quoting (ie, a set of quotes
Xand three backslashes) are required with \fIrsh\fP when only a set of
Xquotes would be otherwise required to protect the special characters.
XIt is seemingly impossible to get a double quote into a label when
Xusing \fIrsh\fP.
X.LP
XMany Americans don't like the way I spell.
X.LP
XDespite this lengthy section, it works quite well.  Really!  For my
Xpurposes, at any rate.
X.SH DIAGNOSTICS
X.I rterm
Xdoesn't have much to say since it figures any arguments it doesn't
Xrecognise are meant for xterm.  It will print a usage message if no
Xarguments are given and it doesn't redirect the stderr of xhost.
XSee
X.B BUGS
Xabove for the problem with rsh and the error of xterm.  Some
Xdiagnostics, like one indicating a bad hostname,  generated by other
Xprogrammes, might not be seen because the window will disappear before
Xthe error message can be read in it.
X.TP 4
X"Permission denied."
XThis is really from rsh; you don't have
Xpermission to execute a programme on the remote host without password
Xauthorisation.  See 
X.BR hosts.equiv(5)
Xfor more information.
X.SH TODO
XThese things might be implemented if anyone expresses a desire for
Xthem; send mail to the author.
X.IP \-
Xa way to turn off the DISPLAY piggy-backing on TERM.
X.IP \-
Xan RTerm.HOST.alias resource which could point to  the real name
Xof a machine; resources should then be able to be read using  either
Xthe original HOST or the aliased name.  This would allow things like
X"rterm news" to be equivalent to "rterm server -l usenet" or simply
X"rterm machine" to be equivalent to "rterm machine.not-in-my.domain".
X.SH COPYRIGHT
XThis programme is free software; you can redistribute it and/or modify
Xit under the terms of the GNU General Public License version 1 as
Xpublished by the Free Software Foundation.  A copy of the GNU GPL can
Xbe obtained from the FSF at 675 Massachusetts Ave, Cambridge MA 02139.
X.SH AUTHOR
XDavid C Lawrence <tale@turing.cs.rpi.edu>
X.LP
XThanks to Brett Hogden <hogden@rpi.edu> and Keith Rosenblatt
X<rosenblk@rpi.edu> for their extensive alpha testing, which I
Xdidn't even know about until tonight.
END_OF_FILE
if test 11578 -ne `wc -c <'rterm.1'`; then
    echo shar: \"'rterm.1'\" unpacked with wrong size!
fi
# end of 'rterm.1'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have the archive.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0

dan
----------------------------------------------------
O'Reilly && Associates   argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.