[comp.sources.x] v09i030: Xmon - X Protocol Monitor, Patch1, Part01/01

gregm@otc.otca.oz.au (Greg McFarlane) (09/12/90)

Submitted-by: Greg McFarlane <gregm@otc.otca.oz.au>
Posting-number: Volume 9, Issue 30
Archive-name: xmon/patch1
Patch-To: xmon: Volume 9, Issue 15-19

xmon patch 1

This patch fixes the following problems:

1. Long lines in the Imakefile were folded by the news software.
2. It should now compile on SYSV. You'll need to use -DSYSV.
3. It should now compile on machines that allow more than 128 open files.

---- Cut Here and unpack ----
#!/bin/sh
# This is xmon, a shell archive (shar 3.32)
# made 09/10/1990 07:43 UTC by gregm@otc.otca.oz.au
# Source directory /u/projects/multi/xmux/xscope.based
#
# existing files will NOT be overwritten
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   4505 -rw-rw-r-- xmon.patch1
#
if touch 2>&1 | fgrep 'amc' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= xmon.patch1 ==============
if test X"$1" != X"-c" -a -f 'xmon.patch1'; then
	echo "File already exists: skipping 'xmon.patch1'"
else
echo "x - extracting xmon.patch1 (Text)"
sed 's/^X//' << 'SHAR_EOF' > xmon.patch1 &&
Xxmon patch 1
X
XThis patch fixes the following problems:
X
X1. Long lines in the Imakefile were folded by the news software.
X2. It should now compile on SYSV. You'll need to use -DSYSV.
X3. It should now compile on machines that allow more than 128 open files.
X
XIt makes patches to the following files:
Xpatchlevel.h
XImakefile
Xmain.c
Xselect_args.h
X
Xdiff -r -c patchlevel.h.old patchlevel.h
X*** patchlevel.h.old	Mon Sep 10 14:22:02 1990
X--- patchlevel.h	Mon Sep 10 15:33:48 1990
X***************
X*** 1 ****
X! #define PATCHLEVEL 0
X--- 1 ----
X! #define PATCHLEVEL 1
Xdiff -r -c Imakefile.old Imakefile
X*** Imakefile.old	Mon Sep 10 14:20:22 1990
X--- Imakefile	Mon Sep 10 14:33:37 1990
X***************
X*** 15,24 ****
X  ComplexProgramTarget_1(xmond, $(LOCAL_LIBRARIES), )
X  ComplexProgramTarget_2(xmonui, $(LOCAL_LIBRARIES), )
X  
X! SHARFILES = README xmon.man Imakefile Makefile $(SRCS1) $(SRCS2)
X  $(INCLUDE_FILES)
X  
X  shar:
X! 	shar -n xmon -s "gregm@otc.otca.oz.au" -a -o xmon.shar -l 75 -x -c
X  $(SHARFILES)
X  
X--- 15,24 ----
X  ComplexProgramTarget_1(xmond, $(LOCAL_LIBRARIES), )
X  ComplexProgramTarget_2(xmonui, $(LOCAL_LIBRARIES), )
X  
X! SHARFILES = README xmon.man Imakefile Makefile $(SRCS1) $(SRCS2) \
X  $(INCLUDE_FILES)
X  
X  shar:
X! 	shar -n xmon -s "gregm@otc.otca.oz.au" -a -o xmon.shar -l 75 -x -c \
X  $(SHARFILES)
X  
Xdiff -r -c main.c.old main.c
X*** main.c.old	Mon Sep 10 14:21:24 1990
X--- main.c	Mon Sep 10 15:30:57 1990
X***************
X*** 11,16 ****
X--- 11,19 ----
X  #include <sys/uio.h>           /* for struct iovec, used by socket.h */
X  #include <sys/socket.h>        /* for AF_INET, SOCK_STREAM, ... */
X  #include <sys/ioctl.h>         /* for FIONCLEX, FIONBIO, ... */
X+ #ifdef SYSV
X+ #include <sys/fcntl.h>
X+ #endif
X  #include <netinet/in.h>        /* struct sockaddr_in */
X  #include <netdb.h>             /* struct servent * and struct hostent * */
X  #include <errno.h>             /* for EINTR, EADDRINUSE, ... */
X***************
X*** 27,33 ****
X  #define NUM_REQUESTS			/* 128 */ 256
X  #define NUM_EVENTS				/* 40 */ 256
X  
X- 
X  /* function prototypes: */
X  /* main.c: */
X  static void ScanArgs P((int argc , char **argv ));
X--- 30,35 ----
X***************
X*** 57,62 ****
X--- 59,68 ----
X  static void SignalTSTP P((void ));
X  static void SignalCONT P((void ));
X  
X+ #if (mskcnt>4)
X+ static Bool ANYSET P((long *src));
X+ #endif
X+ 
X  /* end function prototypes */
X  
X  Global Bool    ignore_bytes;
X***************
X*** 304,310 ****
X--- 310,320 ----
X  		};
X  
X  	/* a few more parameter settings */
X+ #ifdef SYSV
X+ 	fcntl(ConnectionSocket, F_SETFD, FD_CLOEXEC);
X+ #else
X  	ioctl(ConnectionSocket, FIOCLEX, 0);
X+ #endif
X  	ioctl(ConnectionSocket, FIONBIO, &ON);
X  
X  	debug(4,(stderr, "Listening on FD %d\n", ConnectionSocket));
X***************
X*** 919,925 ****
X--- 929,939 ----
X  			panic("Can't connect to Client");
X  		}
X  
X+ #ifdef SYSV
X+ 	fcntl(ClientFD, F_SETFD, FD_CLOEXEC);
X+ #else
X  	ioctl(ClientFD, FIOCLEX, 0);
X+ #endif
X  	ioctl(ClientFD, FIONBIO, &ON);
X  	return(ClientFD);
X  }
X***************
X*** 1064,1066 ****
X--- 1078,1094 ----
X  	fprintf(stderr, "%s\n", s);
X  	exit(1);
X  }
X+ 
X+ #if (mskcnt>4)
X+ static Bool
X+ ANYSET(src)
X+ long src[];
X+ {
X+ 	int cri;
X+ 
X+ 	for (cri = 0; cri < mskcnt; cri++)
X+ 		if (src[cri])
X+ 			return 1;
X+ 	return 0;
X+ }
X+ #endif
Xdiff -r -c select_args.h.old select_args.h
X*** select_args.h.old	Mon Sep 10 14:21:49 1990
X--- select_args.h	Mon Sep 10 14:42:11 1990
X***************
X*** 96,111 ****
X  #define MASKANDSETBITS(dst, b1, b2)  \
X  		      { int cri;			\
X  			for (cri=0; cri<mskcnt; cri++)	\
X! 		          dst[cri] = (b1[cri] & b2[cri]) }
X  #define ORBITS(dst, b1, b2)  \
X  		      { int cri;			\
X  		      for (cri=0; cri<mskcnt; cri++)	\
X! 		          dst[cri] = (b1[cri] | b2[cri]) }
X  #define UNSETBITS(dst, b1) \
X  		      { int cri;			\
X  		      for (cri=0; cri<mskcnt; cri++)	\
X  		          dst[cri] &= ~b1[cri];  }
X! #define ANYSET(src) panic("ANYSET not implemented")
X  #endif
X  
X  #endif /* SELECT_H */
X--- 96,111 ----
X  #define MASKANDSETBITS(dst, b1, b2)  \
X  		      { int cri;			\
X  			for (cri=0; cri<mskcnt; cri++)	\
X! 		          dst[cri] = (b1[cri] & b2[cri]); }
X  #define ORBITS(dst, b1, b2)  \
X  		      { int cri;			\
X  		      for (cri=0; cri<mskcnt; cri++)	\
X! 		          dst[cri] = (b1[cri] | b2[cri]); }
X  #define UNSETBITS(dst, b1) \
X  		      { int cri;			\
X  		      for (cri=0; cri<mskcnt; cri++)	\
X  		          dst[cri] &= ~b1[cri];  }
X! /* ANYSET is a function defined in main.c */
X  #endif
X  
X  #endif /* SELECT_H */
SHAR_EOF
$TOUCH -am 0910173890 xmon.patch1 &&
chmod 0664 xmon.patch1 ||
echo "restore of xmon.patch1 failed"
set `wc -c xmon.patch1`;Wc_c=$1
if test "$Wc_c" != "4505"; then
	echo original size 4505, current size $Wc_c
fi
fi
exit 0

                    Greg McFarlane
                    |||| OTC ||

                ACSnet:  gregm@otc.otca.oz.au
                  UUCP:  {uunet,mcvax}!otc.otca.oz.au!gregm
                 Snail:  GPO Box 7000, Sydney 2001, Australia
                 Phone:  +61 2 287 4104    Fax: +61 2 287 4990

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