*** /dev/null Fri Feb 16 03:00:55 1990 --- contrib/clients/xplaces/CHANGES.Pat03 Fri Feb 16 03:09:56 1990 *************** *** 0 **** --- 1,11 ---- + - Uses XGetWMSizeHints instead of XGetNormalHints so that it can + use PBaseSize in compliance with ICCCM. Now gets R4 xterm size + right (used to be off by 1) Thanks to Casey Leedom + for this one. + + - xplaces doesn't whine about toplevel windows without WM_COMMAND now. + + - rcmd much improved -- runs much faster on machines without builtin + test in the shell, can take multiple commands for a single machine + from stdin (rsh is too slow for csh users to afford one per remote + command) diff -c -r orig/xplaces/patchlevel.h contrib/clients/xplaces/patchlevel.h *** orig/xplaces/patchlevel.h Thu Oct 19 07:08:10 1989 --- contrib/clients/xplaces/patchlevel.h Fri Feb 16 03:01:22 1990 *************** *** 1 **** ! #define PATCHLEVEL 2 --- 1 ---- ! #define PATCHLEVEL 3 diff -c -r orig/xplaces/rcmd contrib/clients/xplaces/rcmd *** orig/xplaces/rcmd Thu Oct 19 07:08:11 1989 --- contrib/clients/xplaces/rcmd Fri Feb 16 02:57:35 1990 *************** *** 1,40 **** #! /bin/sh ! # This command runs a command remotely in the background, by pointing # stdout and stderr at /dev/null. (Should we point stdin at /dev/null too?) # By running this through the Bourne shell at the other end, and ! # we get rid of the rsh and rshd which otherwise hand around at either ! # end. Hacked from a posting by clyde@emx.utexas.edu to list.xpert ! user= ! HOST=${HOST-`hostname`} ! if test $# -lt 2 ; then ! echo Usage: $0 remotehost remotecommand exit 1 ! else host=$1 shift ! if test "$1" = "-l" ; then shift ! user=$1 shift ! fi ! fi ! xhostname=`expr "$DISPLAY" : "\([^:]*\).*"` ! xscreen=`expr "$DISPLAY" : "[^:]*\(.*\)"` ! if test x$xscreen = x; then ! xscreen=":0.0" ! fi ! if test x$xhostname = x -o x$xhostname = x"unix"; then ! DISPLAY=$HOST$xscreen ! fi ( ! if test x$xhostname = x -o x$xhostname = x"unix" -o x$xhostname = x$HOST; then ! xhost +$host ! fi ! if test x$user = x; then ! echo "TERM=$TERM;export TERM;DISPLAY=$DISPLAY;export DISPLAY;($*)" '\ ! > /dev/null 2>&1 &' | rsh $host /bin/sh & ! else ! echo "TERM=$TERM;export TERM;DISPLAY=$DISPLAY;export DISPLAY;($*)" '\ ! > /dev/null 2>&1 &' | rsh $host -l $user /bin/sh & ! fi ! ) & --- 1,59 ---- #! /bin/sh ! # This command runs command(s) remotely in the background, by pointing # stdout and stderr at /dev/null. (Should we point stdin at /dev/null too?) # By running this through the Bourne shell at the other end, and ! # we get rid of the rsh and rshd which otherwise hang around at either ! # end. Ideas from from a posting by clyde@emx.utexas.edu to list.xpert, ! # and Stephen Bellantoni ! # Mark Moraes, University of Toronto ! rshargs="/bin/sh" ! case $# in ! 0) ! echo Usage: $0 remotehost [-l remoteuser] [command] >&2 exit 1 ! ;; ! *) host=$1 shift ! case "$1" in ! -l) shift ! rshargs="-l $1 /bin/sh" shift ! ;; ! esac ! ;; ! esac ! localhost=y ! case "$DISPLAY" in ! '') ! # Assume unix:0.0 ! DISPLAY=${HOST-`hostname`}:0.0 ! ;; ! :*|unix:*) ! DISPLAY=${HOST-`hostname`}`expr "$DISPLAY" : "[^:]*\(.*\)"` ! ;; ! *) ! localhost=n ! ;; ! esac ! # If we are on the local host, do an xhost -- the xhost won't work ! # if DISPLAY isn't unix:0.0, even if we are on the local host. ! case $localhost in ! y) xhost +$host ;; ! esac ( ! # Set remote terminal type, remote display, and close stdin, stdout and ! # stderr at the remote end so the rsh doesn't stay around. This also ! # means that no error feedback is possible, which is a real pain. ! # common problems -- DISPLAY being wrong or the remote host not ! # being authorized to connect to the X server. ! echo "TERM=$TERM;export TERM;DISPLAY=$DISPLAY;export DISPLAY;" \ ! ${CONSOLETYPE:+"CONSOLETYPE=$CONSOLETYPE; export CONSOLETYPE;"} \ ! "exec > /dev/null 2>&1 <&1; ("; ! case "$@" in ! '') while read line; do echo "$line"; done;; ! *) echo "$@";; ! esac ! echo ") &" ! ) | rsh $host $rshargs diff -c -r orig/xplaces/rcmd.man contrib/clients/xplaces/rcmd.man *** orig/xplaces/rcmd.man Thu Oct 19 07:08:12 1989 --- contrib/clients/xplaces/rcmd.man Fri Feb 16 02:57:35 1990 *************** *** 1,9 **** .TH RCMD X .SH NAME ! rcmd - run a remote command in the background, without stdout and stderr. .SH SYNOPSIS .B rcmd ! remotehost [ -l user ] command .SH DESCRIPTION .I Rcmd runs the given --- 1,9 ---- .TH RCMD X .SH NAME ! rcmd - run a remote command in the background, without stdin, stdout, stderr. .SH SYNOPSIS .B rcmd ! remotehost [ -l user ] [ command ] .SH DESCRIPTION .I Rcmd runs the given *************** *** 12,26 **** .I remotehost via .I rsh ! but by redirecting stdout and stderr to /dev/null, and running command ! in the background, it results in the rsh exiting and closing the ! connection, leaving the command as a daemon on the remote machine. ! This is useful only for commands that have no use for stdout and ! stderr like most X Windows applications. .PP It passes the TERM environment variable to the remote shell. It also passes the DISPLAY environment variable, unless DISPLAY is not defined ! or is unix:N, in which case it passes `hostname`:N. .PP If .I rcmd --- 12,27 ---- .I remotehost via .I rsh ! but by redirecting stdin, stdout and stderr to /dev/null, and feeding ! the given command to the Bourne shell (/bin/sh) in the background, it ! results in the rsh exiting and closing the connection, leaving the ! command as a daemon on the remote machine. This is useful only for ! commands that have no use for stdin, stdout and stderr like most ! applications for the X Window system. .PP It passes the TERM environment variable to the remote shell. It also passes the DISPLAY environment variable, unless DISPLAY is not defined ! or is :N or unix:N, in which case it passes `hostname`:N. .PP If .I rcmd *************** *** 27,38 **** is run from the same machine as the one on which the X server is running, then it will run an .I xhost ! to add the remotehost to the access list. .RI ( xhost may not be run from remotehosts, so you'll have to do it yourself if you run .I rcmd on a remotehost, for another remotehost) .SH OPTIONS .TP .BR \-l " user" --- 28,64 ---- is run from the same machine as the one on which the X server is running, then it will run an .I xhost ! command to add the remotehost to the access list. .RI ( xhost may not be run from remotehosts, so you'll have to do it yourself if you run .I rcmd on a remotehost, for another remotehost) + .PP + If + .I command + is not provided as an argument, + .I rcmd + reads the standard input and feeds it to the remote shell. + So something like + .nf + rcmd remotehost << EOF + xterm -ls & + xclock & + xpostit & + EOF + .fi + will start a remote xterm, xclock and xpostit in the background on the + remotehost. This is much faster than using a separate rcmd or rsh for + each command. But an ampersand (&) must be put after each command or + the xclock will only start after the xterm finishes, which is probably + not what is intended. + .PP + Of course, these commands could be stored in a shell script at the + remote end, and run with + .nf + rcmd remotehost shellscriptname + .fi .SH OPTIONS .TP .BR \-l " user" *************** *** 39,45 **** Runs the remote shell as .I user on the remote host rather than as yourself. ! .SH EXAMPLE .nf rcmd godzilla.eecg /local/bin/X11/xterm -geometry 80x50+3-3 -ls rcmd church.csri -l xwindows /local/bin/X11/xpic --- 65,71 ---- Runs the remote shell as .I user on the remote host rather than as yourself. ! .SH EXAMPLES .nf rcmd godzilla.eecg /local/bin/X11/xterm -geometry 80x50+3-3 -ls rcmd church.csri -l xwindows /local/bin/X11/xpic *************** *** 65,67 **** --- 91,95 ---- .PP All bugs associated with .I rsh + Users with a C-shell or derivative as their login shell will + find rsh takes very long -- this is a feature of C-shell startup. diff -c -r orig/xplaces/xplaces.c contrib/clients/xplaces/xplaces.c *** orig/xplaces/xplaces.c Thu Nov 23 23:27:29 1989 --- contrib/clients/xplaces/xplaces.c Fri Feb 16 03:04:19 1990 *************** *** 378,383 **** --- 378,384 ---- Window root_win, parent_win, *child_list, junk; XWindowAttributes win_info; XSizeHints hints; + long supplied; XID *state; XTextProperty tp; char **argv; *************** *** 469,474 **** --- 470,476 ---- else wm_client_machine = (char *) text_prop.value; + #ifdef DEBUG (void) fprintf(stderr, "%s: Top level window 0x%lx has no WM_COMMAND string\n", progname, w); *************** *** 475,513 **** (void) fprintf(stderr, "\t\t(name \"%s\", class \"%s\", client machine \"%s\")\n", wm_name, wm_class, wm_client_machine); return 0; } ! /* Ok. We have a WM_COMMAND. Let's get the size hints */ ! /* !! Should use XGetWMNormalHints? */ ! if (!XGetNormalHints(d, w, &hints)) { (void) fprintf(stderr, ! "XGetNormalHints on Window 0x%lx failed.\n", w); hints.flags = 0; /* can't give up now...*/ } - /* if no increment then assume 1 */ - if (!(hints.flags & PResizeInc)) - hints.width_inc = hints.height_inc = 1; - /* if no position then assume +0+0 */ if (!(hints.flags & (USPosition || PPosition))) hints.x = hints.y = 0; - /* if no min width or height then assume 0 */ - if (!(hints.flags & PMinSize)) - hints.min_width = hints.min_height = 0; - /* * terminal windows sizes are in characters so this will compute the * geometry correctly. Use the win_info stuff, not the hints, since * almost no window manager or client updates the hints. Grump. */ ! if (hints.width_inc > 1 && hints.height_inc > 1) { ! geom.width = (win_info.width - hints.min_width) / ! hints.width_inc; ! geom.height = (win_info.height - hints.min_height) / ! hints.height_inc; } else { geom.width = win_info.width; geom.height = win_info.height; --- 477,513 ---- (void) fprintf(stderr, "\t\t(name \"%s\", class \"%s\", client machine \"%s\")\n", wm_name, wm_class, wm_client_machine); + #endif return 0; } ! if (!XGetWMSizeHints(d, w, &hints, &supplied, XA_WM_NORMAL_HINTS)) { (void) fprintf(stderr, ! "XGetWMSizeHints on Window 0x%lx failed.\n", w); hints.flags = 0; /* can't give up now...*/ } /* if no position then assume +0+0 */ if (!(hints.flags & (USPosition || PPosition))) hints.x = hints.y = 0; /* * terminal windows sizes are in characters so this will compute the * geometry correctly. Use the win_info stuff, not the hints, since * almost no window manager or client updates the hints. Grump. */ ! if (hints.flags & (PMinSize|PBaseSize) && hints.flags & PResizeInc) { ! if (hints.flags & PBaseSize) { ! geom.width = (win_info.width - hints.base_width) / ! hints.width_inc; ! geom.height = (win_info.height - hints.base_height) / ! hints.height_inc; ! } else { ! geom.width = (win_info.width - hints.min_width) / ! hints.width_inc; ! geom.height = (win_info.height - hints.min_height) / ! hints.height_inc; ! } } else { geom.width = win_info.width; geom.height = win_info.height;