#! /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 shell archive."
# Contents:  xon.man xon.cpp Imakefile
# Wrapped by dgreen@hilo on Sun Feb 11 16:42:57 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'xon.man' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xon.man'\"
else
echo shar: Extracting \"'xon.man'\" \(2544 characters\)
sed "s/^X//" >'xon.man' <<'END_OF_FILE'
X.TH XON 1 "Release 4" "X Version 11"
X.SH NAME
Xxon \- start remote X clients with minimum overhead
X.SH SYNOPSIS
X.B xon 
X[-l userid] [-debug] host cmd [arg ...]
X.SH DESCRIPTION
X.I xon
Xsets up permissions and starts an X11 client on a remote machine 
Xwith minimal overhead.  It is a frontend for the remote shell facility 
X(remsh or rsh).  It minimizes the number of open
Xptys on the remote and local machine, and thus improves performance.
XThe usual \fIrsh\fR/\fIremsh\fR and \fIxhost\fR access controls apply.
X.PP
X.I Xon 
Xruns \fIxhost\fR to permit opening an X session from the remote
Xhost.  It propagates the \fBDISPLAY\fR variable from the local environment 
Xto the remote session.  It closes the local standard input, output, and stderr
Xstreams so that the session is not associated with an unnecessary pty.
X.PP
XIf the base name in the remote command is "xterm", \fIxon\fR will insert
Xthe \fIxterm\fR option \fB-name xterm-\fIhost\fR.  This allows X11 resource
Xfiles to specify different xterm colors and features depending on the target 
Xhost.
X.SH "OPTIONS"
X.TP 8
X.B \-l userid
XAttempt to login with the userid \fBuserid\fR.
X.PP
X.TP 8
X.B \-debug
XDo not close the input and output files, and
Xdisplay executed \fIsh\fR statements.
X.SH "SEE ALSO"
XX(1), xhost(1), rsh(1) or remsh(1)
X.SH ENVIRONMENT
X.TP 10
X.B DISPLAY
XCopied to the remote session's environment.  It must be set.
XIf \fBDISPLAY\fR is set to "unix:n.n" or ":n.n"
Xthen \fBDISPLAY\fR is changed to "hostname:n.n".
X.PP
X.TP 10
X.B HOSTNAME
XUsed when appropriate to modify the \fBDISPLAY\fR variable
Xbefore passing it on to the remote host.
XIf \fBHOSTNAME\fR is not set,
Xthe \fIhostname\fR command is run to supply the appropriate value.
X.PP
X.TP 10
X.B SHELL
XUsed to determine whether to redirect stderr with ">&" (for \fItcsh\fR,
X\fIcsh\fR) or
X"2>&1" (for \fIbash\fR, \fIsh\fR, \fIksh\fR).  If \fBSHELL\fR is unassigned,
X\fBxon\fR assumes \fBcsh\fR is your default shell.
X.br
X.SH BUGS
XCare must be taken with quoting shell arguments for the remote session,
Xsince some layers of quoting are already present.  For best results, use '
Xinstead of ".
X.PP
XIf you use \fIcsh\fR on one machine and some other shell on another machine,
X\fIxon\fR may not properly redirect input and/or may abort.  There may be no
Xway to fix this, except to write a program.
X.SH AUTHORS
XOriginally suggested by Chris Torek (chris@mimsy.umd.edu).  
XSuccessive implementations by Marion Hakanson (hakanson@cse.ogc.edu), 
XJim Dempsey (jjd@bbn.com), Stephen Gildea (gildea@bbn.com), Dan Greening
X(dgreen@cs.ucla.edu).
END_OF_FILE
if test 2544 -ne `wc -c <'xon.man'`; then
    echo shar: \"'xon.man'\" unpacked with wrong size!
fi
# end of 'xon.man'
fi
if test -f 'xon.cpp' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xon.cpp'\"
else
echo shar: Extracting \"'xon.cpp'\" \(2959 characters\)
sed "s/^X//" >'xon.cpp' <<'END_OF_FILE'
X/**/#! /bin/sh
X/**/#
X/**/# xon: start an X11 client on another host
X/**/#
X/**/# Runs the given command on another host with $DISPLAY set in the environment.
X/**/#    Does an xhost to allow access to the other host.
X/**/#    Xon is very careful not to leave any extra processes waiting
X/**/#       around on either machine for the client to exit.  In order
X/**/#       to achieve this, csh is used on the remote host and all inputs
X/**/#       and outputs are redirected to /dev/null.
X/**/#    The -debug switch allows you to see errors, but doesn't worry about
X/**/#       leaving extra processes around.
X/**/#    If the given command starts with "xterm", it adds the arguments
X/**/#        "-name xterm-$hostname"
X/**/#        where $hostname is the name of the remote host.  This allows
X/**/#        you to customize your server's xrdb database to set attributes,
X/**/#        such as the window color, based on the name of remote host.
X/**/#
X/**/# Written by Jim Dempsey <jjd@bbn.com> with help from Stephen Gildea
X/**/#   <gildea@bbn.com> based on an idea by Dave Mankins <dm@think.com>.
X/**/#   Originally written around 1987.
X/**/#   Last modification Feb 4 1990 by dgreen@cs.ucla.edu
X
X/**/# Process xon options.
X
Xrshopts=""
Xwhile 
X  found=f
X  case $1 in
X    -debug )
X      debug=t; set -xv; found=t
X      ;;
X    -l )
X      shift; rshopts="-l $1 $rshopts"; found=t
X      ;;
X    esac
X  [ $found = t ]
X  do shift; done
X
Xcase $# in
X    0|1) echo "usage: $0 [-debug] [-l logname] host cmd [args]" 1>&2; exit 1;;
Xesac
X
Xhost="$1"; shift
Xif [ ${HOSTNAME:-notset} = notset ] ; then HOSTNAME=`hostname` ; fi
X
Xcommand=$1; shift
Xif [ `basename $command` = "xterm" ]; then
X    command="$command -name xterm-$host"
Xfi
Xif [ $# -ge 1 ]; then
X    command="$command $@"
Xfi
X
X/**/# If run on the same host as server, modify $DISPLAY for the remote host.
Xcase X$DISPLAY in
X  Xunix:* | X:* )
X    DISPLAY="`echo $DISPLAY | sed \"s/^[^:]*:/${HOSTNAME}:/\"`"
X    export DISPLAY
X    ;;
X  esac
X
X/**/# If run on the same host as server, allow remote host access X server.
Xif [ $HOSTNAME != $host ]; then
X    if [ "$debug" ]; then
X        xhost +$host
X    else
X        xhost +$host > /dev/null 2>&1
X    fi
Xfi
X
Xif type remsh | fgrep 'not found' > /dev/null 
X  then rshell=rsh 
X  else rshell=remsh 
X  fi
X
X/**/# Do the real work using rsh.
Xif [ "$debug" ]; then
X    echo "$0: Going to execute \"$command\" on $host."
X    $rshell $host $rshopts -n /bin/csh -cf "\"setenv DISPLAY $DISPLAY; setenv TERM xterm; $command\""
Xelse
X    case ${SHELL:-/bin/csh} in
X      *csh )
X         exec $rshell $host $rshopts -n \
X	      exec /bin/csh -cf "\"setenv DISPLAY $DISPLAY; setenv TERM xterm;\
X	                           exec $command\" < /dev/null >& /dev/null"
X	 ;;
X      * )
X         exec $rshell $host $rshopts -n \
X	      exec /bin/csh -cf "\"setenv DISPLAY $DISPLAY; setenv TERM xterm;\
X	                           exec $command\" < /dev/null > /dev/null 2>&1"
X	 ;;
X      esac
Xfi
X
Xexit 0
END_OF_FILE
if test 2959 -ne `wc -c <'xon.cpp'`; then
    echo shar: \"'xon.cpp'\" unpacked with wrong size!
fi
chmod +x 'xon.cpp'
# end of 'xon.cpp'
fi
if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Imakefile'\"
else
echo shar: Extracting \"'Imakefile'\" \(171 characters\)
sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
XPROGRAMS = xon
X
X#ifdef BandAidCompiler
X#include BandAidCompiler
X#endif
X
XCppScriptTarget(xon,xon.cpp,/**/,/**/)
XInstallProgram(xon,$(BINDIR))
XInstallManPage(xon,$(MANDIR))
END_OF_FILE
if test 171 -ne `wc -c <'Imakefile'`; then
    echo shar: \"'Imakefile'\" unpacked with wrong size!
fi
# end of 'Imakefile'
fi
echo shar: End of shell archive.
exit 0
