From pa.dec.com!decwrl!uunet!sparky!kent Sun Aug 18 09:20:43 PDT 1991
Article: 2643 of comp.sources.misc
Newsgroups: comp.sources.misc
Path: pa.dec.com!decwrl!uunet!sparky!kent
From: Warren Tucker <wht@n4hgf.Mt-Park.GA.US>
Subject:  v22i022:  ecu - ECU async comm package rev 3.10, Patch02
Message-ID: <1991Aug16.022424.15036@sparky.IMD.Sterling.COM>
X-Md4-Signature: cbc65ba3430c0cb2c940896fad780b0e
Sender: kent@sparky.IMD.Sterling.COM (Kent Landfield)
Organization: Sterling Software, IMD
Date: Fri, 16 Aug 1991 02:24:24 GMT
Approved: kent@sparky.imd.sterling.com
Lines: 1411

Submitted-by: Warren Tucker <wht@n4hgf.Mt-Park.GA.US>
Posting-number: Volume 22, Issue 22
Archive-name: ecu/patch02
Environment: SCO, XENIX, ISC
Patch-To: ecu: Volume 21, Issue 53-89

This is patch 2 to ecu 3.10, issues v21i053 through v21i089.

The majority of this patch deals with the way SCO and ISC misimplement the
nap() system call.  See README.p2 for details.

A lingering problem with the interactive command history handler is also
fixed (pressing erroneous function keys caused the display to become
garbaged).

Patch 1 is a prerequisite and this patch checks to see if it has been applied.

To apply the patch, unshar this file and do
   patch < PATCH02.02

You do not need to rerun Config.
do
   make ecu
   su root
   make iecu

#!/bin/sh
# This is a shell archive (shar 3.46)
# made 08/13/1991 20:34 UTC by wht@n4hgf
# Source directory /u1/src/ecu
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   2203 -rw-r--r-- README.P2
#  29065 -rw-r--r-- PATCH2.01
#
# ============= README.P2 ==============
if test -f 'README.P2' -a X"$1" != X"-c"; then
	echo 'x - skipping README.P2 (File already exists)'
else
echo 'x - extracting README.P2 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'README.P2' &&
XREADME.P2           ECU 3.10 Patch 2        Tue Aug 13 16:29:11 EDT 1991
X
XThis describes patch 2 to ECU 3.10, bringing the program to
Xversion 3.12. 
X
XThe majority of this patch deals with the way SCO and ISC misimplement
Xthe nap() system call.  A lingering problem with the interactive
Xcommand history handler is also fixed (pressing erroneous function keys
Xcaused the display to become garbaged).
X
XISC and SCO UNIX nap() misbehave.  This kludge doesn't return the
Xproper value (the actual time slept), but at least it does not make
Xa mockery of the manual page.  It says:
X
X     NAP(S)		       UNIX System V			NAP(S)
X
X     Name
X	  nap -	suspends execution for a short interval
X
X     Syntax
X	  long nap(period)
X	  long period;
X
X     Description
X	  The current process is suspended from	execution for at least
X	  the number of	milliseconds specified by period, or until a
X	  signal is received.
X
X     Return Value
X	  On successful	completion, a long integer indicating the
X	  number of milliseconds actually slept	is returned. If	the
X	  process received a signal while napping, the return value
X	  will be -1, and errno	will be	set to EINTR.
X
X     See Also
X	  sleep(S)
X
X     Notes
X	  This function	is driven by the system	clock, which in	most
X	  cases	has a granularity of tens of milliseconds.  This
X	  function must	be linked with the linker option -lx.
X
XIt appears nap() under UNIX 3.2.x has departed virtually entirely from
Xthe manual page.  I'm beginning to look rather silly in several
Xmilleus since I keep telling people SCO UNIX is a viable upgrade from
XXENIX.  But process control people need some kind of timing capability
Xless than one second and we can't do it with nap or select.
X
Xnap(msec) is supposed to nap *at least* msec milliseconds.  However,
Xif msec is specified less than 1000/HZ + 1, it will not nap at all.
XThis was true for 3.2.0 and 3.2.1.
X
XIt is supposed to return the number of milliseconds it actually
Xslept.  Instead, it appears to "save up" the values and return them in
Xlots of 1000. This behavior is true for 3.2.2.
X
XAs it is nap() is nearly useless.  I believe select() suffers
Xfrom the same deficiency (< 1000 msec timeout becomes 1000 msec) but
XI haven't "proven" it yet.
SHAR_EOF
chmod 0644 README.P2 ||
echo 'restore of README.P2 failed'
Wc_c="`wc -c < 'README.P2'`"
test 2206 -eq "$Wc_c" ||
	echo 'README.P2: original size 2206, current size' "$Wc_c"
fi
# ============= PATCH2.01 ==============
if test -f 'PATCH2.01' -a X"$1" != X"-c"; then
	echo 'x - skipping PATCH2.01 (File already exists)'
else
echo 'x - extracting PATCH2.01 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'PATCH2.01' &&
X:
X#-------------------------------------------------------
X# PATCH2.01
X# UNIX & ISC nap bug fix
X# created by gendiff x1.03 on 13 Aug 1991 20:04 UTC
X#-------------------------------------------------------
X*** /u1/src/ecu311/patchlevel.h	Tue Aug  6 15:05:00 1991
X--- patchlevel.h	Tue Aug 13 16:07:17 1991
XPrereq: 11
X***************
X*** 1,1
X! #define PATCHLEVEL 11
X
X--- 1,1 -----
X! #define PATCHLEVEL 12
X*** /u1/src/ecu311/ecu.c	Tue Aug 13 15:53:05 1991
X--- ecu.c	Tue Aug 13 13:50:42 1991
X***************
X*** 186,192
X  		hz = atoi(getenv("HZ"));
X  	else
X  		hz = HZ;
X! 	hzmsec = (ulong)(1000 / hz) + 1;
X  
X  /*
X   * if we are root (or setuid to root as we should be on 286 versions),
X
X--- 186,192 -----
X  		hz = atoi(getenv("HZ"));
X  	else
X  		hz = HZ;
X! 	hzmsec = (ulong)(1000 / hz) + 2;
X  
X  /*
X   * if we are root (or setuid to root as we should be on 286 versions),
X***************
X*** 324,330
X  */
X  		ff(se,
X  	"No problem, but just to warn you, the keyboard has parity enabled\r\n");
X! 		nap(500L);
X  	}
X  
X  /* check out line */
X
X--- 324,330 -----
X  */
X  		ff(se,
X  	"No problem, but just to warn you, the keyboard has parity enabled\r\n");
X! 		Nap(500L);
X  	}
X  
X  /* check out line */
X***************
X*** 343,349
X  				tcap_stand_end();
X  				ff(se,"\r\n");
X  				strcpy(shm->Lline,default_tty);
X! 				nap(1000L);
X  			}
X  		}
X  	}
X
X--- 343,349 -----
X  				tcap_stand_end();
X  				ff(se,"\r\n");
X  				strcpy(shm->Lline,default_tty);
X! 				Nap(1000L);
X  			}
X  		}
X  	}
X*** /u1/src/ecu311/ecu.h	Tue Aug 13 15:53:05 1991
X--- ecu.h	Tue Aug 13 13:58:20 1991
X***************
X*** 3,8
X  	wht@n4hgf.Mt-Park.GA.US
X  ------------------------------------------------------------------------*/
X  /*+:EDITS:*/
X  /*:08-09-1991-11:07-wht@n4hgf-configurable lock directory */
X  /*:07-25-1991-12:55-wht@n4hgf-ECU release 3.10 */
X  /*:01-25-1991-06:08-wht@n4hgf-mulltiple #define of ECULIBDIR */
X
X--- 3,9 -----
X  	wht@n4hgf.Mt-Park.GA.US
X  ------------------------------------------------------------------------*/
X  /*+:EDITS:*/
X+ /*:08-13-1991-13:53-wht@n4hgf-UNIX and ISC nap() broken; XENIX still wins */
X  /*:08-09-1991-11:07-wht@n4hgf-configurable lock directory */
X  /*:07-25-1991-12:55-wht@n4hgf-ECU release 3.10 */
X  /*:01-25-1991-06:08-wht@n4hgf-mulltiple #define of ECULIBDIR */
X***************
X*** 88,93
X  #if defined(MALLOC_3X)
X  #include <malloc.h>
X  #endif
X  
X  /*
X   * prototyes or external declarations
X
X--- 89,96 -----
X  #if defined(MALLOC_3X)
X  #include <malloc.h>
X  #endif
X+ 
X+ long Nap();
X  
X  /*
X   * prototyes or external declarations
X*** /u1/src/ecu311/ecuDCE.c	Thu Jul 25 12:55:00 1991
X--- ecuDCE.c	Tue Aug 13 13:50:42 1991
X***************
X*** 43,49
X  #include "relop.h"
X  
X  long time();
X! long nap();
X  
X  char *make_char_graphic();
X  void DCE_hangup();
X
X--- 43,49 -----
X  #include "relop.h"
X  
X  long time();
X! long Nap();
X  
X  char *make_char_graphic();
X  void DCE_hangup();
X***************
X*** 345,351
X  	DCE_read_modem_init();
X  
X  	lputs_paced(0,"\b\b\b\b\b\b\b\b\b\r");
X! 	(void)nap(200L);
X  	lflush(0);
X  
X  	while(!shm->Lmodem_already_init)
X
X--- 345,351 -----
X  	DCE_read_modem_init();
X  
X  	lputs_paced(0,"\b\b\b\b\b\b\b\b\b\r");
X! 	(void)Nap(200L);
X  	lflush(0);
X  
X  	while(!shm->Lmodem_already_init)
X***************
X*** 361,367
X  		{
X  			ltoggle_dtr();
X  			lputs_paced(0,"AT\r");
X! 			(void)nap(400L);
X  			lputs_paced(0,"ATQ0V1E1\r");
X  			(void)nap(400L);
X  		}
X
X--- 361,367 -----
X  		{
X  			ltoggle_dtr();
X  			lputs_paced(0,"AT\r");
X! 			(void)Nap(400L);
X  			lputs_paced(0,"ATQ0V1E1\r");
X  			(void)Nap(400L);
X  		}
X***************
X*** 363,369
X  			lputs_paced(0,"AT\r");
X  			(void)nap(400L);
X  			lputs_paced(0,"ATQ0V1E1\r");
X! 			(void)nap(400L);
X  		}
X  
X  		lflush(0);
X
X--- 363,369 -----
X  			lputs_paced(0,"AT\r");
X  			(void)Nap(400L);
X  			lputs_paced(0,"ATQ0V1E1\r");
X! 			(void)Nap(400L);
X  		}
X  
X  		lflush(0);
X***************
X*** 374,380
X  		{
X  			lputc_paced(0,*cmd++);
X  			if(++itmp < 2)
X! 				(void)nap(40L);
X  			if((itmp = lgetc_timeout(500L)) < 0)
X  			{
X  				if(sigint)
X
X--- 374,380 -----
X  		{
X  			lputc_paced(0,*cmd++);
X  			if(++itmp < 2)
X! 				(void)Nap(40L);
X  			if((itmp = lgetc_timeout(500L)) < 0)
X  			{
X  				if(sigint)
X***************
X*** 438,444
X  register itmp;
X  
X  	DCE_modem_init();
X! 	(void)nap(600L);
X  
X  	lflush(0);
X  #ifdef NEUROTIC
X
X--- 438,444 -----
X  register itmp;
X  
X  	DCE_modem_init();
X! 	(void)Nap(600L);
X  
X  	lflush(0);
X  #ifdef NEUROTIC
X***************
X*** 446,452
X  	{
X  		lputc_paced(20,*cmd++);
X  		if(++char_count < 2)
X! 			(void)nap(40L);
X  		if((itmp = lgetc_timeout(500L)) < 0)
X  			return(-1);
X  		pputc(itmp);
X
X--- 446,452 -----
X  	{
X  		lputc_paced(20,*cmd++);
X  		if(++char_count < 2)
X! 			(void)Nap(40L);
X  		if((itmp = lgetc_timeout(500L)) < 0)
X  			return(-1);
X  		pputc(itmp);
X***************
X*** 624,630
X  			setcolor(colors_error);
X  			pprintf("%s\n",result);
X  			lputc(0);				/* make modem go on hook */
X! 			(void)nap(40L);
X  			lputc(0);
X  			sigint = 0;
X  			(void)DCE_get_result(2000L);	/* wait for NO CARRIER */
X
X--- 624,630 -----
X  			setcolor(colors_error);
X  			pprintf("%s\n",result);
X  			lputc(0);				/* make modem go on hook */
X! 			(void)Nap(40L);
X  			lputc(0);
X  			sigint = 0;
X  			(void)DCE_get_result(2000L);	/* wait for NO CARRIER */
X***************
X*** 849,855
X  			delay,(kbdintr == DEL) ?"DEL":make_char_graphic(kbdintr,0));
X  		while(nap_msec > 0)
X  		{
X! 			nap_msec -= nap(100L);
X  			while(rdchk(0))
X  			{
X  				ans = to_lower(ttygetc(1));
X
X--- 849,855 -----
X  			delay,(kbdintr == DEL) ?"DEL":make_char_graphic(kbdintr,0));
X  		while(nap_msec > 0)
X  		{
X! 			nap_msec -= Nap(100L);
X  			while(rdchk(0))
X  			{
X  				ans = to_lower(ttygetc(1));
X***************
X*** 1014,1020
X  {
X  	if(!Lmodem_autoans[0])
X  		return;
X! 	(void)nap(200L);
X  	lputs_paced(20,"AT\r");
X  	(void)nap(100L);
X  	lputs_paced(20,Lmodem_autoans); /* quiet modem */
X
X--- 1014,1020 -----
X  {
X  	if(!Lmodem_autoans[0])
X  		return;
X! 	(void)Nap(200L);
X  	lputs_paced(20,"AT\r");
X  	(void)Nap(100L);
X  	lputs_paced(20,Lmodem_autoans); /* quiet modem */
X***************
X*** 1016,1022
X  		return;
X  	(void)nap(200L);
X  	lputs_paced(20,"AT\r");
X! 	(void)nap(100L);
X  	lputs_paced(20,Lmodem_autoans); /* quiet modem */
X  	lputs_paced(20,"\r");
X  	(void)nap(200L);
X
X--- 1016,1022 -----
X  		return;
X  	(void)Nap(200L);
X  	lputs_paced(20,"AT\r");
X! 	(void)Nap(100L);
X  	lputs_paced(20,Lmodem_autoans); /* quiet modem */
X  	lputs_paced(20,"\r");
X  	(void)Nap(200L);
X***************
X*** 1019,1025
X  	(void)nap(100L);
X  	lputs_paced(20,Lmodem_autoans); /* quiet modem */
X  	lputs_paced(20,"\r");
X! 	(void)nap(200L);
X  	lputs_paced(20,Lmodem_autoans); /* quiet modem */
X  	lputs_paced(20,"\r");
X  	(void)nap(200L);
X
X--- 1019,1025 -----
X  	(void)Nap(100L);
X  	lputs_paced(20,Lmodem_autoans); /* quiet modem */
X  	lputs_paced(20,"\r");
X! 	(void)Nap(200L);
X  	lputs_paced(20,Lmodem_autoans); /* quiet modem */
X  	lputs_paced(20,"\r");
X  	(void)Nap(200L);
X***************
X*** 1022,1028
X  	(void)nap(200L);
X  	lputs_paced(20,Lmodem_autoans); /* quiet modem */
X  	lputs_paced(20,"\r");
X! 	(void)nap(200L);
X  	lflush(0);
X  }	/* end of DCE_autoanswer */
X  
X
X--- 1022,1028 -----
X  	(void)Nap(200L);
X  	lputs_paced(20,Lmodem_autoans); /* quiet modem */
X  	lputs_paced(20,"\r");
X! 	(void)Nap(200L);
X  	lflush(0);
X  }	/* end of DCE_autoanswer */
X  
X*** /u1/src/ecu311/ecufinsert.c	Thu Jul 25 12:55:00 1991
X--- ecufinsert.c	Tue Aug 13 13:50:42 1991
X***************
X*** 220,226
X  			while(*cptr)
X  			{
X  				lputc(*cptr++);
X! 				nap(20L);
X  				while(rdchk(shm->Liofd))
X  				{
X  					rchar = lgetc_xmtr();
X
X--- 220,226 -----
X  			while(*cptr)
X  			{
X  				lputc(*cptr++);
X! 				Nap(20L);
X  				while(rdchk(shm->Liofd))
X  				{
X  					rchar = lgetc_xmtr();
X***************
X*** 233,239
X  		if(xmit_cr)
X  		{
X  			if(xmit_mode == 'p')
X! 				nap(20L);
X  			lputc('\r');
X  			xmit_len++;
X  		}
X
X--- 233,239 -----
X  		if(xmit_cr)
X  		{
X  			if(xmit_mode == 'p')
X! 				Nap(20L);
X  			lputc('\r');
X  			xmit_len++;
X  		}
X*** /u1/src/ecu311/ecufork.c	Thu Jul 25 12:55:00 1991
X--- ecufork.c	Tue Aug 13 13:50:43 1991
X***************
X*** 38,44
X  		if((pid = fork()) >= 0)
X  			return(pid);
X  		if(count)
X! 			nap(40L);
X  	}
X  	return(-1);
X  }	/* end of smart_fork */
X
X--- 38,44 -----
X  		if((pid = fork()) >= 0)
X  			return(pid);
X  		if(count)
X! 			Nap(40L);
X  	}
X  	return(-1);
X  }	/* end of smart_fork */
X*** /u1/src/ecu311/ecuicmhist.c	Tue Aug 13 15:53:09 1991
X--- ecuicmhist.c	Tue Aug 13 15:25:25 1991
X***************
X*** 106,117
X  register ICMDH *icmdh = icmdh_tail;
X  uchar delim;
X  
X- 	if((func != XFcurup) && (func != XFhome))
X- 	{
X- 		ring_bell();
X- 		return(1);
X- 	}
X- 
X  	if(!icmdh)
X  	{
X  		ff(se,"no interactive commands saved\r\n");
X
X--- 106,111 -----
X  register ICMDH *icmdh = icmdh_tail;
X  uchar delim;
X  
X  	if(!icmdh)
X  	{
X  		ff(se,"  no interactive commands saved\r\n");
X***************
X*** 114,120
X  
X  	if(!icmdh)
X  	{
X! 		ff(se,"no interactive commands saved\r\n");
X  		return(1);
X  	}
X  	while(1)
X
X--- 108,114 -----
X  
X  	if(!icmdh)
X  	{
X! 		ff(se,"  no interactive commands saved\r\n");
X  		return(1);
X  	}
X  	while(1)
X*** /u1/src/ecu311/eculine.c	Tue Aug 13 15:53:10 1991
X--- eculine.c	Tue Aug 13 13:50:44 1991
X***************
X*** 192,198
X  int delim_len;
X  long quantum;
X  long ltmp;
X! long nap();
X  
X  	delim_len = (lrwt->delim) ? strlen(lrwt->delim) : 0;
X  
X
X--- 192,198 -----
X  int delim_len;
X  long quantum;
X  long ltmp;
X! long Nap();
X  
X  	delim_len = (lrwt->delim) ? strlen(lrwt->delim) : 0;
X  
X***************
X*** 239,245
X  	*cptr = 0;					/* init result string */
X  	while(timeout_counter--)
X  	{
X! 		nap(quantum);
X  
X  		if(check_sigint && sigint)
X  			goto INTERRUPTED;
X
X--- 239,245 -----
X  	*cptr = 0;					/* init result string */
X  	while(timeout_counter--)
X  	{
X! 		Nap(quantum);
X  
X  		if(check_sigint && sigint)
X  			goto INTERRUPTED;
X***************
X*** 410,416
X  {
X  uchar rtn_char;
X  #if defined(NO_SELECT)
X! long nap();
X  long timeout;
X  
X  AGAIN:
X
X--- 410,416 -----
X  {
X  uchar rtn_char;
X  #if defined(NO_SELECT)
X! long Nap();
X  long timeout;
X  
X  AGAIN:
X***************
X*** 419,425
X  	{
X  		if(sigint)
X  			return(-1);
X! 		if((timeout -= nap(hzmsec)) <= 0)
X  			return(-1);
X  	}
X  
X
X--- 419,425 -----
X  	{
X  		if(sigint)
X  			return(-1);
X! 		if((timeout -= Nap(hzmsec)) <= 0)
X  			return(-1);
X  	}
X  
X***************
X*** 595,601
X  {
X  
X  	lputc(lchar);	
X! 	nap((long)(pace_msec ? pace_msec : LPUTS_NAP_COUNT));
X  
X  }	/* end of lputc_paced */
X  
X
X--- 595,601 -----
X  {
X  
X  	lputc(lchar);	
X! 	Nap((long)(pace_msec ? pace_msec : LPUTS_NAP_COUNT));
X  
X  }	/* end of lputc_paced */
X  
X***************
X*** 937,943
X  	b0t.c_cflag &= ~CBAUD;
X  
X  	ioctl(shm->Liofd,TCSETA,(char *)&b0t);		/* drop DTR */
X! 	nap(1000L);
X  	ioctl(shm->Liofd,TCSETA,(char *)&Ltermio);	/* raise DTR */
X  	nap(300L);
X  
X
X--- 937,943 -----
X  	b0t.c_cflag &= ~CBAUD;
X  
X  	ioctl(shm->Liofd,TCSETA,(char *)&b0t);		/* drop DTR */
X! 	Nap(1000L);
X  	ioctl(shm->Liofd,TCSETA,(char *)&Ltermio);	/* raise DTR */
X  	Nap(300L);
X  
X***************
X*** 939,945
X  	ioctl(shm->Liofd,TCSETA,(char *)&b0t);		/* drop DTR */
X  	nap(1000L);
X  	ioctl(shm->Liofd,TCSETA,(char *)&Ltermio);	/* raise DTR */
X! 	nap(300L);
X  
X  }	/* end of ltoggle_dtr */
X  
X
X--- 939,945 -----
X  	ioctl(shm->Liofd,TCSETA,(char *)&b0t);		/* drop DTR */
X  	Nap(1000L);
X  	ioctl(shm->Liofd,TCSETA,(char *)&Ltermio);	/* raise DTR */
X! 	Nap(300L);
X  
X  }	/* end of ltoggle_dtr */
X  
X*** /u1/src/ecu311/ecuphone.c	Tue Aug 13 15:53:12 1991
X--- ecuphone.c	Tue Aug 13 13:50:44 1991
X***************
X*** 491,497
X  				{
X  					dirw_bot_msg("created new (empty) directory file");
X  					ring_bell();
X! 					nap(1000L);
X  				}
X  				goto TRY_OPEN;
X  			}
X
X--- 491,497 -----
X  				{
X  					dirw_bot_msg("created new (empty) directory file");
X  					ring_bell();
X! 					Nap(1000L);
X  				}
X  				goto TRY_OPEN;
X  			}
X***************
X*** 1700,1706
X  				close(itmp);
X  				dirw_bot_msg("created new (empty) directory file");
X  				ring_bell();
X! 				nap(1000L);
X  				goto READ_LIST;
X  			}
X  			if(errno == ENOENT)
X
X--- 1700,1706 -----
X  				close(itmp);
X  				dirw_bot_msg("created new (empty) directory file");
X  				ring_bell();
X! 				Nap(1000L);
X  				goto READ_LIST;
X  			}
X  			if(errno == ENOENT)
X***************
X*** 1836,1842
X  						(kbdintr == DEL) ?"DEL":make_char_graphic(kbdintr,0));
X  					while(nap_decisec--)
X  					{
X! 						nap(100L);
X  						if(rdchk(0))
X  						{
X  							ans = to_lower(ttygetc(1));
X
X--- 1836,1842 -----
X  						(kbdintr == DEL) ?"DEL":make_char_graphic(kbdintr,0));
X  					while(nap_decisec--)
X  					{
X! 						Nap(100L);
X  						if(rdchk(0))
X  						{
X  							ans = to_lower(ttygetc(1));
X*** /u1/src/ecu311/ecuphrase.c	Thu Jul 25 12:56:00 1991
X--- ecuphrase.c	Tue Aug 13 13:50:45 1991
X***************
X*** 196,202
X  									cptr++;
X  								if(!itmp)
X  									itmp = 1;
X! 								nap((long)itmp * 100L);
X  								break;
X  							case 'a':
X  								itmp = atoi(cptr);
X
X--- 196,202 -----
X  									cptr++;
X  								if(!itmp)
X  									itmp = 1;
X! 								Nap((long)itmp * 100L);
X  								break;
X  							case 'a':
X  								itmp = atoi(cptr);
X*** /u1/src/ecu311/ecuscrdump.c	Thu Jul 25 12:56:00 1991
X--- ecuscrdump.c	Tue Aug 13 13:50:45 1991
X***************
X*** 85,91
X  		xbell(XBELL_DONE,1);
X  #else
X  		ring_bell();
X! 		nap(50L);
X  		ring_bell();
X  #endif
X  		return;
X
X--- 85,91 -----
X  		xbell(XBELL_DONE,1);
X  #else
X  		ring_bell();
X! 		Nap(50L);
X  		ring_bell();
X  #endif
X  		return;
X***************
X*** 104,110
X  		{
X  			if(!rdchk(0))
X  			{
X! 				nap(hzmsec * 3);
X  				if(!rdchk(0))
X  					break;
X  			}
X
X--- 104,110 -----
X  		{
X  			if(!rdchk(0))
X  			{
X! 				Nap(hzmsec * 3);
X  				if(!rdchk(0))
X  					break;
X  			}
X*** /u1/src/ecu311/ecusetup.c	Tue Aug 13 15:53:14 1991
X--- ecusetup.c	Tue Aug 13 13:50:45 1991
X***************
X*** 387,393
X  		setw_err_msg(cptr);
X  		if(!retries--)
X  			break;
X! 		nap(1000L);
X  		setw_err_msg("");
X  	}
X  	setup_open_status();
X
X--- 387,393 -----
X  		setw_err_msg(cptr);
X  		if(!retries--)
X  			break;
X! 		Nap(1000L);
X  		setw_err_msg("");
X  	}
X  	setup_open_status();
X*** /u1/src/ecu311/ecusighdl.c	Thu Jul 25 12:56:00 1991
X--- ecusighdl.c	Tue Aug 13 13:50:46 1991
X***************
X*** 153,159
X  				if(kill(rcvr_pid,0) && (errno == ESRCH))
X  					break;
X  				errno = 0;
X! 				nap(40L);
X  				wait_count--;
X  			}
X  			if(!wait_count)
X
X--- 153,159 -----
X  				if(kill(rcvr_pid,0) && (errno == ESRCH))
X  					break;
X  				errno = 0;
X! 				Nap(40L);
X  				wait_count--;
X  			}
X  			if(!wait_count)
X***************
X*** 161,167
X  				while(!kill(rcvr_pid,SIGKILL))
X  				{
X  					wait((int *)0);
X! 					nap(40L);
X  				}
X  			}
X  			rcvr_pid = -1;
X
X--- 161,167 -----
X  				while(!kill(rcvr_pid,SIGKILL))
X  				{
X  					wait((int *)0);
X! 					Nap(40L);
X  				}
X  			}
X  			rcvr_pid = -1;
X*** /u1/src/ecu311/ecutty.c	Thu Jul 25 12:57:00 1991
X--- ecutty.c	Tue Aug 13 14:55:55 1991
X***************
X*** 797,802
X  	{
X  		itmp = 0;
X  		timeout_remaining = tty_escape_timeout;
X  		while((!isalpha(ctmp)) && (itmp < sizeof(tgc_accum) - 1) &&
X  			(timeout_remaining > 0))
X  		{
X
X--- 797,806 -----
X  	{
X  		itmp = 0;
X  		timeout_remaining = tty_escape_timeout;
X+ #if defined(NAP_DEBUG)
X+ 		ff(se,"timeout_remaining = %ld hzmsec=%ld\r\n",
X+ 			timeout_remaining,hzmsec);
X+ #endif
X  		while((!isalpha(ctmp)) && (itmp < sizeof(tgc_accum) - 1) &&
X  			(timeout_remaining > 0))
X  		{
X***************
X*** 800,806
X  		while((!isalpha(ctmp)) && (itmp < sizeof(tgc_accum) - 1) &&
X  			(timeout_remaining > 0))
X  		{
X! 			timeout_remaining -= nap(hzmsec);
X  			if(!rdchk(TTYIN))
X  				continue;
X  			read(TTYIN,(char *)&ctmp,1);
X
X--- 804,813 -----
X  		while((!isalpha(ctmp)) && (itmp < sizeof(tgc_accum) - 1) &&
X  			(timeout_remaining > 0))
X  		{
X! 			timeout_remaining -= Nap(hzmsec);
X! #if defined(NAP_DEBUG)
X! 			ff(se,"timeout_remaining = %ld\r\n",timeout_remaining);
X! #endif
X  			if(!rdchk(TTYIN))
X  				continue;
X  			read(TTYIN,(char *)&ctmp,1);
X***************
X*** 849,854
X  		tgc_accum[0] = ctmp;
X  		tgc_accum[itmp = 1] = 0;
X  		timeout_remaining = tty_escape_timeout;
X  		while(((ctmp = map_nonansi_key(tgc_accum,itmp)) >= XF_no_way) &&
X  			(timeout_remaining > 0))
X  		{
X
X--- 856,865 -----
X  		tgc_accum[0] = ctmp;
X  		tgc_accum[itmp = 1] = 0;
X  		timeout_remaining = tty_escape_timeout;
X+ #if defined(NAP_DEBUG)
X+ 		ff(se,"timeout_remaining = %ld hzmsec=%ld\r\n",
X+ 			timeout_remaining,hzmsec);
X+ #endif
X  		while(((ctmp = map_nonansi_key(tgc_accum,itmp)) >= XF_no_way) &&
X  			(timeout_remaining > 0))
X  		{
X***************
X*** 852,858
X  		while(((ctmp = map_nonansi_key(tgc_accum,itmp)) >= XF_no_way) &&
X  			(timeout_remaining > 0))
X  		{
X! 			timeout_remaining -= nap(hzmsec);
X  			if(!rdchk(TTYIN))
X  				continue;
X  			read(TTYIN,(char *)&ctmp,1);
X
X--- 863,872 -----
X  		while(((ctmp = map_nonansi_key(tgc_accum,itmp)) >= XF_no_way) &&
X  			(timeout_remaining > 0))
X  		{
X! 			timeout_remaining -= Nap(hzmsec);
X! #if defined(NAP_DEBUG)
X! 			ff(se,"timeout_remaining = %ld\r\n",timeout_remaining);
X! #endif
X  			if(!rdchk(TTYIN))
X  				continue;
X  			read(TTYIN,(char *)&ctmp,1);
X*** /u1/src/ecu311/ecuutil.c	Tue Aug 13 15:53:15 1991
X--- ecuutil.c	Tue Aug 13 15:04:29 1991
X***************
X*** 3,8
X  	wht@n4hgf.Mt-Park.GA.US
X  
X    Defined functions:
X  	arg_token(parsestr,termchars)
X  	ascii_name_to_hex(str3char)
X  	ascii_to_hex(ascii)
X
X--- 3,9 -----
X  	wht@n4hgf.Mt-Park.GA.US
X  
X    Defined functions:
X+ 	Nap(msec)
X  	arg_token(parsestr,termchars)
X  	ascii_name_to_hex(str3char)
X  	ascii_to_hex(ascii)
X***************
X*** 8,13
X  	ascii_to_hex(ascii)
X  	build_arg_array(cmd,arg,arg_max_quan,narg_rtn)
X  	build_str_array(str,arg,str_max_quan,nstr_rtn)
X  	disp_line_termio(fd,text)
X  	disp_stat(st)
X  	disp_termio(ttt,text)
X
X--- 9,16 -----
X  	ascii_to_hex(ascii)
X  	build_arg_array(cmd,arg,arg_max_quan,narg_rtn)
X  	build_str_array(str,arg,str_max_quan,nstr_rtn)
X+ 	cfree(p,num,size)
X+ 	defeat_optimize_to_work_around_bug(would_be_optimized)
X  	disp_line_termio(fd,text)
X  	disp_stat(st)
X  	disp_termio(ttt,text)
X***************
X*** 11,17
X  	disp_line_termio(fd,text)
X  	disp_stat(st)
X  	disp_termio(ttt,text)
X! 	errno_text(errno)
X  	find_shell_chars(command)
X  	get_curr_dir(cdir,cdir_max)
X  	get_home_dir(home_dir)
X
X--- 14,20 -----
X  	disp_line_termio(fd,text)
X  	disp_stat(st)
X  	disp_termio(ttt,text)
X! 	errno_text(err_no)
X  	find_shell_chars(command)
X  	get_curr_dir(cdir,cdir_max)
X  	get_home_dir(home_dir)
X***************
X*** 17,23
X  	get_home_dir(home_dir)
X  	hex_to_ascii_name(char_val)
X  	make_char_graphic(ch,incl_3char)
X- 	make_dirs(pathname)
X  	make_ecu_subdir()
X  	mem_cpy(dest,src,len);
X  	mkdir(dpath,dmode)
X
X--- 20,25 -----
X  	get_home_dir(home_dir)
X  	hex_to_ascii_name(char_val)
X  	make_char_graphic(ch,incl_3char)
X  	make_ecu_subdir()
X  	mem_cpy(dest,src,len)
X  	mode_map(mode,mode_str)
X***************
X*** 19,26
X  	make_char_graphic(ch,incl_3char)
X  	make_dirs(pathname)
X  	make_ecu_subdir()
X! 	mem_cpy(dest,src,len);
X! 	mkdir(dpath,dmode)
X  	mode_map(mode,mode_str)
X  	pad_zstr_to_len(zstr,len)
X  	perror_errmsg(str)
X
X--- 21,27 -----
X  	hex_to_ascii_name(char_val)
X  	make_char_graphic(ch,incl_3char)
X  	make_ecu_subdir()
X! 	mem_cpy(dest,src,len)
X  	mode_map(mode,mode_str)
X  	pad_zstr_to_len(zstr,len)
X  	perror_errmsg(str)
X***************
X*** 27,32
X  	print_cwd(curdir,buf_size)
X  	skip_ld_break(zstr)
X  	str_token(parsestr,termchars)
X  	yes_or_no(strarg)
X  
X  ------------------------------------------------------------------------*/
X
X--- 28,34 -----
X  	print_cwd(curdir,buf_size)
X  	skip_ld_break(zstr)
X  	str_token(parsestr,termchars)
X+ 	strip_trail_break(zstr)
X  	yes_or_no(strarg)
X  
X  ------------------------------------------------------------------------*/
X***************
X*** 31,36
X  
X  ------------------------------------------------------------------------*/
X  /*+:EDITS:*/
X  /*:07-25-1991-12:57-wht@n4hgf-ECU release 3.10 */
X  /*:04-16-1991-15:45-wht@n4hgf-gcc cannot use memmove */
X  /*:03-18-1991-22:31-wht@n4hgf-ISC 2.2 has mkdir() */
X
X--- 33,39 -----
X  
X  ------------------------------------------------------------------------*/
X  /*+:EDITS:*/
X+ /*:08-13-1991-13:53-wht@n4hgf-UNIX and ISC nap() broken; XENIX still wins */
X  /*:07-25-1991-12:57-wht@n4hgf-ECU release 3.10 */
X  /*:04-16-1991-15:45-wht@n4hgf-gcc cannot use memmove */
X  /*:03-18-1991-22:31-wht@n4hgf-ISC 2.2 has mkdir() */
X***************
X*** 980,984
X  }	/* end of defeat_optimize_to_work_around_bug */
X  
X  #endif /* __GNUC__ */
X  /* end of ecuutil.c */
X  /* vi: set tabstop=4 shiftwidth=4: */
X
X--- 983,1056 -----
X  }	/* end of defeat_optimize_to_work_around_bug */
X  
X  #endif /* __GNUC__ */
X+ 
X+ /*+-------------------------------------------------------------------------
X+ 	Nap(msec) - wrapper for nap()
X+ 
X+ ISC and SCO UNIX nap() misbehave.  This kludge doesn't return the
X+ proper value (the actual time slept), but at least it does not make
X+ a mockery of the manual page.  It says:
X+ 
X+      NAP(S)		       UNIX System V			NAP(S)
X+ 
X+      Name
X+ 	  nap -	suspends execution for a short interval
X+ 
X+      Syntax
X+ 	  long nap(period)
X+ 	  long period;
X+ 
X+      Description
X+ 	  The current process is suspended from	execution for at least
X+ 	  the number of	milliseconds specified by period, or until a
X+ 	  signal is received.
X+ 
X+      Return Value
X+ 	  On successful	completion, a long integer indicating the
X+ 	  number of milliseconds actually slept	is returned. If	the
X+ 	  process received a signal while napping, the return value
X+ 	  will be -1, and errno	will be	set to EINTR.
X+ 
X+      See Also
X+ 	  sleep(S)
X+ 
X+      Notes
X+ 	  This function	is driven by the system	clock, which in	most
X+ 	  cases	has a granularity of tens of milliseconds.  This
X+ 	  function must	be linked with the linker option -lx.
X+ 
X+ It appears nap() under UNIX 3.2.x has departed virtually entirely from
X+ the manual page.  I'm beginning to look rather silly in several
X+ milleus since I keep telling people SCO UNIX is a viable upgrade from
X+ XENIX.  But process control people need some kind of timing capability
X+ less than one second and we can't do it with nap or select.
X+ 
X+ nap(msec) is supposed to nap *at least* msec milliseconds.  However,
X+ if msec is specified less than 1000/HZ + 1, it will not nap at all.
X+ This was true for 3.2.0 and 3.2.1.
X+ 
X+ It is supposed to return the number of milliseconds it actually
X+ slept.  Instead, it appears to "save up" the values and return them in
X+ lots of 1000. This behavior is true for 3.2.2.
X+ 
X+ As it is nap() is nearly useless.  I believe select() suffers
X+ from the same deficiency (< 1000 msec timeout becomes 1000 msec) but
X+ I haven't "proven" it yet.
X+ --------------------------------------------------------------------------*/
X+ long
X+ Nap(msec)
X+ long msec;
X+ {
X+ #if defined(M_XENIX) || defined(WORKING_UNIX_NAP)
X+ 	return(nap(msec));
X+ #else
X+ 	if(msec < hzmsec)
X+ 		msec = hzmsec;
X+ 	if(nap(msec) < 0)
X+ 		return(-1);
X+ 	return(msec);
X+ #endif
X+ }	/* end of Nap */
X+ 
X  /* end of ecuutil.c */
X  /* vi: set tabstop=4 shiftwidth=4: */
X*** /u1/src/ecu311/ecuxenix.c	Thu Jul 25 12:57:00 1991
X--- ecuxenix.c	Tue Aug 13 15:28:52 1991
X***************
X*** 20,25
X    This module is a grab bag for historical reasons.  Needs reorg.
X  ------------------------------------------------------------------*/
X  /*+:EDITS:*/
X  /*:07-25-1991-12:57-wht@n4hgf-ECU release 3.10 */
X  /*:07-17-1991-07:04-wht@n4hgf-avoid SCO UNIX nap bug */
X  /*:07-14-1991-18:18-wht@n4hgf-new ttygets functions */
X
X--- 20,26 -----
X    This module is a grab bag for historical reasons.  Needs reorg.
X  ------------------------------------------------------------------*/
X  /*+:EDITS:*/
X+ /*:08-13-1991-15:28-wht@n4hgf-more problems with history manager */
X  /*:07-25-1991-12:57-wht@n4hgf-ECU release 3.10 */
X  /*:07-17-1991-07:04-wht@n4hgf-avoid SCO UNIX nap bug */
X  /*:07-14-1991-18:18-wht@n4hgf-new ttygets functions */
X***************
X*** 163,169
X  			switch(delim)
X  			{
X  				case XFhome:
X- 				case XFend:
X  				case XFpgup:
X  				case XFpgdn:
X  				case XFcurup:
X
X--- 164,169 -----
X  			switch(delim)
X  			{
X  				case XFhome:
X  				case XFpgup:
X  				case XFcurup:
X  					if(icmd_history_manager(delim,icmd_buf,sizeof(icmd_buf)))
X***************
X*** 165,171
X  				case XFhome:
X  				case XFend:
X  				case XFpgup:
X- 				case XFpgdn:
X  				case XFcurup:
X  				case XFcurdn:
X  					if(icmd_history_manager(delim,icmd_buf,sizeof(icmd_buf)))
X
X--- 165,170 -----
X  			{
X  				case XFhome:
X  				case XFpgup:
X  				case XFcurup:
X  					if(icmd_history_manager(delim,icmd_buf,sizeof(icmd_buf)))
X  					{
X***************
X*** 167,173
X  				case XFpgup:
X  				case XFpgdn:
X  				case XFcurup:
X- 				case XFcurdn:
X  					if(icmd_history_manager(delim,icmd_buf,sizeof(icmd_buf)))
X  					{
X  						ring_bell();
X
X--- 166,171 -----
X  				case XFhome:
X  				case XFpgup:
X  				case XFcurup:
X  					if(icmd_history_manager(delim,icmd_buf,sizeof(icmd_buf)))
X  					{
X  						ring_bell();
X***************
X*** 174,179
X  						ttygets_flags |= 4;
X  						goto GET_ICMD;
X  					}
X  				case ESC:
X  				case NL:
X  					break;
X
X--- 172,178 -----
X  						ttygets_flags |= 4;
X  						goto GET_ICMD;
X  					}
X+ 					break;
X  				case ESC:
X  				case NL:
X  					break;
X***************
X*** 179,184
X  					break;
X  				default:
X  					ring_bell();
X  					ttygets_flags |= 4;
X  					goto GET_ICMD;
X  			}
X
X--- 178,186 -----
X  					break;
X  				default:
X  					ring_bell();
X+ 					itmp = strlen((char *)icmd_buf);
X+ 					while(itmp--)
X+ 						ff(se,"\b \b");
X  					ttygets_flags |= 4;
X  					goto GET_ICMD;
X  			}
X***************
X*** 265,271
X  		while(count--)
X  		{
X  			write(fd,&bellch,1);	
X! 			nap((long)nap_msec);
X  		}
X  	}
X  }	/* end of send_bell_fd */
X
X--- 267,273 -----
X  		while(count--)
X  		{
X  			write(fd,&bellch,1);	
X! 			Nap((long)nap_msec);
X  		}
X  	}
X  }	/* end of send_bell_fd */
X*** /u1/src/ecu311/ecuxfer.c	Thu Jul 25 12:57:00 1991
X--- ecuxfer.c	Tue Aug 13 13:50:47 1991
X***************
X*** 988,994
X  	}
X  	lreset_ksr();
X  	file_xfer_done_bell();
X! 	nap(20L);
X  	start_rcvr_process(1);
X  }	/* end of receive_files_from_remote */
X  /* end of ecuxfer.c */
X
X--- 988,994 -----
X  	}
X  	lreset_ksr();
X  	file_xfer_done_bell();
X! 	Nap(20L);
X  	start_rcvr_process(1);
X  }	/* end of receive_files_from_remote */
X  /* end of ecuxfer.c */
X*** /u1/src/ecu311/expresp.c	Tue Aug 13 15:53:17 1991
X--- expresp.c	Tue Aug 13 13:50:48 1991
X***************
X*** 247,253
X  			{
X  				case 'p':  /* pause (approximately 1/4-1/2 second delay) */
X  					ldraino(0);	/* wait for output to drain */
X! 					nap(400L);
X  					break;
X  				case 'm':  /* nap a while (non-standard) */
X  					ltmp = atol(str + 1);
X
X--- 247,253 -----
X  			{
X  				case 'p':  /* pause (approximately 1/4-1/2 second delay) */
X  					ldraino(0);	/* wait for output to drain */
X! 					Nap(400L);
X  					break;
X  				case 'm':  /* nap a while (non-standard) */
X  					ltmp = atol(str + 1);
X***************
X*** 253,259
X  					ltmp = atol(str + 1);
X  					str += strspn(str + 1,"0123456789");
X  					ldraino(0);	/* wait for output to drain */
X! 					nap((ltmp < hzmsec) ? hzmsec : ltmp);
X  					break;
X  				case 'd':  /* delay (2 seconds) */
X  					ldraino(0);	/* wait for output to drain */
X
X--- 253,259 -----
X  					ltmp = atol(str + 1);
X  					str += strspn(str + 1,"0123456789");
X  					ldraino(0);	/* wait for output to drain */
X! 					Nap((ltmp < hzmsec) ? hzmsec : ltmp);
X  					break;
X  				case 'd':  /* delay (2 seconds) */
X  					ldraino(0);	/* wait for output to drain */
X***************
X*** 257,263
X  					break;
X  				case 'd':  /* delay (2 seconds) */
X  					ldraino(0);	/* wait for output to drain */
X! 					nap(2000L);
X  					break;
X  				case 'D':  /* phone number/token */
X  					if(expresp_echo_check)
X
X--- 257,263 -----
X  					break;
X  				case 'd':  /* delay (2 seconds) */
X  					ldraino(0);	/* wait for output to drain */
X! 					Nap(2000L);
X  					break;
X  				case 'D':  /* phone number/token */
X  					if(expresp_echo_check)
X***************
X*** 302,308
X  		if(expresp_echo_check)
X  		{
X  			ldraino(1);		/* wait for output to drain, then flush input */
X! 			nap(40L);		/* fake it */
X  		}
X  		str++;
X  	}
X
X--- 302,308 -----
X  		if(expresp_echo_check)
X  		{
X  			ldraino(1);		/* wait for output to drain, then flush input */
X! 			Nap(40L);		/* fake it */
X  		}
X  		str++;
X  	}
X*** /u1/src/ecu311/pcmd.c	Tue Aug 13 15:53:26 1991
X--- pcmd.c	Tue Aug 13 13:50:49 1991
X***************
X*** 692,698
X  			interval = hzmsec;		/* SCO nap bug */
X  		if(proctrace && (interval > 100))	/* short naps hurt by pprintf */
X  			pprintf("nap %ld msec\n",interval);
X! 		if(nap(interval) == -1)		/* EINTR is the only error returned ... */
X  		{							/* but check anyway */
X  			if(errno == EINTR)
X  				erc = eCONINT;
X
X--- 692,698 -----
X  			interval = hzmsec;		/* SCO nap bug */
X  		if(proctrace && (interval > 100))	/* short naps hurt by pprintf */
X  			pprintf("nap %ld msec\n",interval);
X! 		if(Nap(interval) == -1)		/* EINTR is the only error returned ... */
X  		{							/* but check anyway */
X  			if(errno == EINTR)
X  				erc = eCONINT;
SHAR_EOF
chmod 0644 PATCH2.01 ||
echo 'restore of PATCH2.01 failed'
Wc_c="`wc -c < 'PATCH2.01'`"
test 29065 -eq "$Wc_c" ||
	echo 'PATCH2.01: original size 29065, current size' "$Wc_c"
fi
exit 0

----------------------------------------------------------------------------
Warren Tucker, TuckerWare, Mountain Park, GA         wht@n4hgf.Mt-Park.GA.US
"The computer can't tell you the emotional story.  It can give you the exact
mathematical design, but what's missing is the eyebrows." -- Frank Zappa

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.


