From decwrl!ucbvax!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!allbery Sat Mar  3 18:24:47 PST 1990
Article 1347 of comp.sources.misc:
Path: decwrl!ucbvax!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!allbery
From: wht%n4hgf@gatech.edu (Warren Tucker)
Newsgroups: comp.sources.misc
Subject: v10i076: siotools v09i044/45 patch 6
Message-ID: <79685@uunet.UU.NET>
Date: 21 Feb 90 02:11:56 GMT
Sender: allbery@uunet.UU.NET
Lines: 454
Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)

Posting-number: Volume 10, Issue 76
Submitted-by: wht%n4hgf@gatech.edu (Warren Tucker)
Archive-name: siotools/patch06

This is siotools v09i044/v09i45 Patch 6.  This program has been very
popular and I appreciate the help from m2xenix!news, stratton@hpda.hp.com
and xroads!jerry for help getting the various SCO development systems to
produce working code.

On Feb 16, 23:36, Randy Bush (mpxenix!news) wrote:
@ I applied patch 5, ran uusnap, and after exiting with 'q', if I typed a
@ line to csh and hit return, the cursor went back to the beginning of
@ the prompt line and nothing happened (csh did not get command).
@ I may learn more later,
@ randy

On Feb 17, 14:36, Randy Bush (mpxenix!news) wrote:
@ So I went back a rev, and still got the same result.
@ It seems to be suddenly leaving my terminal in a pretty raw mode, <backspace>
@ generates ^H, <return> generates ^M as opposed to <end-of-line>, but ^J works
@ for eol.  Hmmm.
@ randy

I seem to have invoked curses revision rot somehow.  I put out the patch
to fix a problem reported with XENIX development system 2.3.2.  I had no
problems with the old code on my SCO UNIX system or on a 386 with XENIX
development system 2.3.1.  Now, 2.3.2 handles it properly and you have
trouble.  Hmmmm is right.  Net, please forgive me for this crock I
am about to perpetrate, but I believe it will Fix this problem once
and for all.  If I was doing something wrong, please TELL me.

#!/bin/sh
# This is siotools.p6, a shell archive (shar 3.04)
# made 02/18/1990 08:50 UTC by gatech!kd4nc!n4hgf!wht (wht%n4hgf@gatech.edu)
# Source directory /u4/src/siotools/rel
#
# existing files WILL be overwritten
#
# This shar contains:
#    PATCH.6
#
touch 2>&1 | fgrep '[-amc]' > /tmp/s3_touch$$
if [ -s /tmp/s3_touch$$ ]
then
	TOUCH=can
else
	TOUCH=cannot
fi
rm -f /tmp/s3_touch$$
echo "x - extracting PATCH.6 (Text)"
sed 's/^X//' << 'SHAR_EOF' > PATCH.6 &&
X:
X#-----------------------------------------------------------------------
X# siotools v09i044/v09i45 Patch 6
X# fix problems with some curses versions not restoring console tty
X# upon exit.
X#-----------------------------------------------------------------------
X
Xsed -e 's/^P//' << DIFF_EOF | patch
XP*** rel/siomon.c	Tue Feb 13 14:39:50 1990
XP--- siomon.c	Sun Feb 18 03:44:02 1990
XP***************
XP*** 1,5
XP  /* CHK=0x75B9 */
XP! char *revision = "1.35";
XP  /*+-------------------------------------------------------------------------
XP  	siomon.c -- watch XENIX/UNIX serial I/O
XP  	...!gatech!kd4nc!n4hgf!wht
XP
XP--- 1,5 -----
XP  /* CHK=0x75B9 */
XP! char *revision = "1.36";
XP  /*+-------------------------------------------------------------------------
XP  	siomon.c -- watch XENIX/UNIX serial I/O
XP  	...!gatech!kd4nc!n4hgf!wht
XP***************
XP*** 47,52
XP  	leave()
XP  	main(argc,argv,envp)
XP  	main_template()
XP  
XP    Kudos to pyrnj.pyramid.com!romain (Romain Kang) for many suggestions
XP    regarding screen and CPU efficiency in the original itpmon.c for Pyramid
XP
XP--- 47,54 -----
XP  	leave()
XP  	main(argc,argv,envp)
XP  	main_template()
XP+ 	my_savetty()
XP+ 	my_resetty()
XP  
XP    Kudos to pyrnj.pyramid.com!romain (Romain Kang) for many suggestions
XP    regarding screen and CPU efficiency in the original itpmon.c for Pyramid
XP***************
XP*** 50,55
XP  
XP    Kudos to pyrnj.pyramid.com!romain (Romain Kang) for many suggestions
XP    regarding screen and CPU efficiency in the original itpmon.c for Pyramid
XP  --------------------------------------------------------------------------*/
XP  /*+:EDITS:*/
XP  /*:12-28-1989-13:35-wht-change rev - B600 added to wintty */
XP
XP--- 52,59 -----
XP  
XP    Kudos to pyrnj.pyramid.com!romain (Romain Kang) for many suggestions
XP    regarding screen and CPU efficiency in the original itpmon.c for Pyramid
XP+   Thanks to mpxenix!news (Randy Bush) for tireless help with a curses
XP+   bug hopefully now retired, even if it crockish.
XP  --------------------------------------------------------------------------*/
XP  /*+:EDITS:*/
XP  /*:02-18-1990-03:29-wht-bug in curses tty mode handling - force a fix */
XP***************
XP*** 52,57
XP    regarding screen and CPU efficiency in the original itpmon.c for Pyramid
XP  --------------------------------------------------------------------------*/
XP  /*+:EDITS:*/
XP  /*:12-28-1989-13:35-wht-change rev - B600 added to wintty */
XP  /*:12-21-1989-15:20-wht-version number chg - CTSFLOW/RTSFLOW */
XP  /*:12-04-1989-16:45-wht-add more to detail */
XP
XP--- 56,62 -----
XP    bug hopefully now retired, even if it crockish.
XP  --------------------------------------------------------------------------*/
XP  /*+:EDITS:*/
XP+ /*:02-18-1990-03:29-wht-bug in curses tty mode handling - force a fix */
XP  /*:12-28-1989-13:35-wht-change rev - B600 added to wintty */
XP  /*:12-21-1989-15:20-wht-version number chg - CTSFLOW/RTSFLOW */
XP  /*:12-04-1989-16:45-wht-add more to detail */
XP***************
XP*** 98,103
XP  struct utsname me;
XP  
XP  /*+-------------------------------------------------------------------------
XP  	leave() - terminate curses, reset terminal and exit
XP  --------------------------------------------------------------------------*/
XP  void
XP
XP--- 103,121 -----
XP  struct utsname me;
XP  
XP  /*+-------------------------------------------------------------------------
XP+ 	workaround curses tty handling difficulties among different revs
XP+ --------------------------------------------------------------------------*/
XP+ struct termio my_termio_crock;
XP+ void my_savetty()	/* used in lieu of savetty() */
XP+ {
XP+ 	ioctl(0,TCGETA,&my_termio_crock);
XP+ }
XP+ void my_resetty()	/* used in lieu of resetty() and endwin() */
XP+ {
XP+ 	ioctl(0,TCSETA,&my_termio_crock);
XP+ }
XP+ 
XP+ /*+-------------------------------------------------------------------------
XP  	leave() - terminate curses, reset terminal and exit
XP  --------------------------------------------------------------------------*/
XP  void
XP***************
XP*** 103,109
XP  void
XP  leave()
XP  {
XP! 	if(!stdscr)
XP  	{
XP  		resetty();
XP  		exit(0);
XP
XP--- 121,127 -----
XP  void
XP  leave()
XP  {
XP! 	if(stdscr)
XP  	{
XP  		move(LINES - 1,0);
XP  		refresh();
XP***************
XP*** 105,111
XP  {
XP  	if(!stdscr)
XP  	{
XP! 		resetty();
XP  		exit(0);
XP  	}
XP  	move(LINES - 1,0);
XP
XP--- 123,131 -----
XP  {
XP  	if(stdscr)
XP  	{
XP! 		move(LINES - 1,0);
XP! 		refresh();
XP! 		my_resetty();
XP  		exit(0);
XP  	}
XP  }	/* end of leave */
XP***************
XP*** 108,117
XP  		resetty();
XP  		exit(0);
XP  	}
XP- 	move(LINES - 1,0);
XP- 	refresh();
XP- 	endwin();
XP- 	exit(0);
XP  }	/* end of leave */
XP  
XP  /*+-------------------------------------------------------------------------
XP
XP--- 128,133 -----
XP  		my_resetty();
XP  		exit(0);
XP  	}
XP  }	/* end of leave */
XP  
XP  /*+-------------------------------------------------------------------------
XP***************
XP*** 422,432
XP  	uname(&me);
XP  
XP  	setbuf(stdout,_sobuf);
XP! 	initscr();
XP! 	savetty();
XP! 	crmode();
XP! 	noecho();
XP! 	if(!stdscr)
XP  	{
XP  		fprintf(stderr,"curses init failed\n");
XP  		resetty();
XP
XP--- 438,445 -----
XP  	uname(&me);
XP  
XP  	setbuf(stdout,_sobuf);
XP! 	my_savetty();
XP! 	if(!initscr())
XP  	{
XP  		fputs("curses init failed ... check terminal type\n",stderr);
XP  		exit(1);
XP***************
XP*** 428,435
XP  	noecho();
XP  	if(!stdscr)
XP  	{
XP! 		fprintf(stderr,"curses init failed\n");
XP! 		resetty();
XP  		exit(1);
XP  	}
XP  	main_template();
XP
XP--- 441,447 -----
XP  	my_savetty();
XP  	if(!initscr())
XP  	{
XP! 		fputs("curses init failed ... check terminal type\n",stderr);
XP  		exit(1);
XP  	}
XP  	crmode();
XP***************
XP*** 432,437
XP  		resetty();
XP  		exit(1);
XP  	}
XP  	main_template();
XP  
XP  	move(4,0);
XP
XP--- 444,451 -----
XP  		fputs("curses init failed ... check terminal type\n",stderr);
XP  		exit(1);
XP  	}
XP+ 	crmode();
XP+ 	noecho();
XP  	main_template();
XP  
XP  	move(4,0);
XP*** rel/uusnap.c	Tue Feb 13 14:39:51 1990
XP--- uusnap.c	Sun Feb 18 03:40:26 1990
XP***************
XP*** 1,5
XP  /* CHK=0xBF8D */
XP! char *revision = "1.73";
XP  /*+-------------------------------------------------------------------------
XP  	uusnap.c - display UUCP communications status for HDB systems
XP      ...gatech!kd4nc!n4hgf!wht
XP
XP--- 1,5 -----
XP  /* CHK=0xBF8D */
XP! char *revision = "1.74";
XP  /*+-------------------------------------------------------------------------
XP  	uusnap.c - display UUCP communications status for HDB systems
XP      ...gatech!kd4nc!n4hgf!wht
XP***************
XP*** 21,26
XP  	get_status_info(system_name,buf,bufsize)
XP  	lockpid_to_tty(lockpid)
XP  	main(argc,argv)
XP  	spooldirname(fname)
XP  	statdirname(fname)
XP  
XP
XP--- 21,28 -----
XP  	get_status_info(system_name,buf,bufsize)
XP  	lockpid_to_tty(lockpid)
XP  	main(argc,argv)
XP+ 	my_savetty()
XP+ 	my_resetty()
XP  	spooldirname(fname)
XP  	statdirname(fname)
XP  
XP***************
XP*** 40,45
XP   2 n4vu                      19:07 19:07       successful
XP   3 tridom                 1  19:17 19:17       TALKING (tty2e)
XP   4 ki4xo                     01/25 01/25       successful
XP  --------------------------------------------------------------------------*/
XP  /*+:EDITS:*/
XP  /*:02-07-1990-16:34-wht-use crmode and nocrmode rather than raw and noraw */
XP
XP--- 42,51 -----
XP   2 n4vu                      19:07 19:07       successful
XP   3 tridom                 1  19:17 19:17       TALKING (tty2e)
XP   4 ki4xo                     01/25 01/25       successful
XP+ 
XP+ 
XP+  Thanks to mpxenix!news (Randy Bush) for tireless help with a curses
XP+  bug hopefully now retired, even if it crockish.
XP  --------------------------------------------------------------------------*/
XP  /*+:EDITS:*/
XP  /*:02-18-1990-03:29-wht-bug in curses tty mode handling - force a fix */
XP***************
XP*** 42,47
XP   4 ki4xo                     01/25 01/25       successful
XP  --------------------------------------------------------------------------*/
XP  /*+:EDITS:*/
XP  /*:02-07-1990-16:34-wht-use crmode and nocrmode rather than raw and noraw */
XP  /*:01-27-1990-19:11-wht-show input and output queues + cosmetics */
XP  /*:12-28-1989-13:35-wht-change rev - B600 added to wintty */
XP
XP--- 48,54 -----
XP   bug hopefully now retired, even if it crockish.
XP  --------------------------------------------------------------------------*/
XP  /*+:EDITS:*/
XP+ /*:02-18-1990-03:29-wht-bug in curses tty mode handling - force a fix */
XP  /*:02-07-1990-16:34-wht-use crmode and nocrmode rather than raw and noraw */
XP  /*:01-27-1990-19:11-wht-show input and output queues + cosmetics */
XP  /*:12-28-1989-13:35-wht-change rev - B600 added to wintty */
XP***************
XP*** 186,191
XP  #endif
XP  
XP  /*+-------------------------------------------------------------------------
XP  	dir_open(dirname)
XP  --------------------------------------------------------------------------*/
XP  DDIR *
XP
XP--- 193,211 -----
XP  #endif
XP  
XP  /*+-------------------------------------------------------------------------
XP+ 	workaround curses tty handling difficulties among different revs
XP+ --------------------------------------------------------------------------*/
XP+ struct termio my_termio_crock;
XP+ void my_savetty()	/* used in lieu of savetty() */
XP+ {
XP+ 	ioctl(0,TCGETA,&my_termio_crock);
XP+ }
XP+ void my_resetty()	/* used in lieu of resetty() and endwin() */
XP+ {
XP+ 	ioctl(0,TCSETA,&my_termio_crock);
XP+ }
XP+ 
XP+ /*+-------------------------------------------------------------------------
XP  	dir_open(dirname)
XP  --------------------------------------------------------------------------*/
XP  DDIR *
XP***************
XP*** 376,382
XP  		nocrmode();
XP  		move(LINES - 1,0);
XP  		refresh();
XP! 		endwin();
XP  	}
XP  	exit(0);
XP  }	/* end of bye */
XP
XP--- 396,402 -----
XP  		nocrmode();
XP  		move(LINES - 1,0);
XP  		refresh();
XP! 		my_resetty();
XP  	}
XP  	exit(0);
XP  }	/* end of bye */
XP***************
XP*** 735,741
XP  	getyx(stdscr,y,x);
XP  	move(y,x - 2);
XP  	refresh();
XP! 	resetty();
XP  	x = scanw("%d",&sysdetail);
XP  	crmode();
XP  	noecho();
XP
XP--- 755,762 -----
XP  	getyx(stdscr,y,x);
XP  	move(y,x - 2);
XP  	refresh();
XP! 	nocrmode();
XP! 	echo();
XP  	x = scanw("%d",&sysdetail);
XP  	crmode();
XP  	noecho();
XP***************
XP*** 861,866
XP  
XP  	setbuf(stdout,_sobuf);
XP  
XP  	if(!initscr())
XP  	{
XP  		fprintf(stderr,"curses init failed... check terminal type\n");
XP
XP--- 882,888 -----
XP  
XP  	setbuf(stdout,_sobuf);
XP  
XP+ 	my_savetty();
XP  	if(!initscr())
XP  	{
XP  		fprintf(stderr,"curses init failed... check terminal type\n");
XP***************
XP*** 866,872
XP  		fprintf(stderr,"curses init failed... check terminal type\n");
XP  		exit(0);
XP  	}
XP- 	savetty();
XP  	noecho();
XP  	crmode();
XP  
XP
XP--- 888,893 -----
XP  		fprintf(stderr,"curses init failed... check terminal type\n");
XP  		exit(0);
XP  	}
XP  	noecho();
XP  	crmode();
XP  
XDIFF_EOF
SHAR_EOF
chmod 0755 PATCH.6 || echo "restore of PATCH.6 fails"
if [ $TOUCH = can ]
then
    touch -m 0218034890 PATCH.6
fi
exit 0


