[comp.sources.misc] v11i028: siotools v09i044/045 patch 7

wht%n4hgf@gatech.edu (Warren Tucker) (03/16/90)

Posting-number: Volume 11, Issue 28
Submitted-by: wht%n4hgf@gatech.edu (Warren Tucker)
Archive-name: siotools.p7

Fixes more problems with some curses versions not restoring console tty
upon exit.  This version has been tested successully on XENIX 2.2.1,
2.3.1 and 2.3.2 and on SCO UNIX 3.2.0, all of which _appear_ to have
subtle libtcap.a (M_TERMCAP) curses libraries differences. I think I
now code to correctly handle going in and out of raw mode for all the
variations.

Unshar, type 'PATCH.7', make, check the Makefile LBIN definition, su
root and make install.

#!/bin/sh
# This is siotools.p7, a shell archive (shar 3.04)
# made 03/12/1990 21:51 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.7
#
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.7 (Text)"
sed 's/^X//' << 'SHAR_EOF' > PATCH.7 &&
X:
X#-----------------------------------------------------------------------
X# siotools v09i044/v09i45 Patch 7
X# Fix more problems with some curses versions not restoring console tty
X# upon exit.  This version has been tested successully on XENIX 2.2.1,
X# 2.3.1 and 2.3.2 and on SCO UNIX 3.2.0, all of which _appear_ to have
X# subtle libtcap.a (M_TERMCAP) curses libraries differences. I think I
X# now code to correctly handle going in and out of raw mode for all the
X# variations.
X#
X# comp.source.misc references:
X# v09i044: siotools part 1/2
X# v09i045: siotools part 2/2
X# v09i056: siotools patch 1
X# v09i058: siotools patch 2
X# v09i086: siotools patch 3
X# v10i049: siotools patch 4
X# v10i070: siotools patch 5
X# v10i076: siotools patch 6
X#-----------------------------------------------------------------------
X
Xsed -e 's/^P//' << DIFF_EOF | patch
XP*** ../rel/siomon.c	Mon Mar 12 16:30:39 1990
XP--- siomon.c	Fri Feb 23 17:11:11 1990
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--- 1,5 -----
XP  /* CHK=0x75B9 */
XP! char *revision = "1.37";
XP  /*+-------------------------------------------------------------------------
XP  	siomon.c -- watch XENIX/UNIX serial I/O
XP  	...!gatech!kd4nc!n4hgf!wht
XP***************
XP*** 33,39
XP  22        S stopped by XOFF  D delay timeout in progress
XP  23 Commands: + inc delay  - dec delay  ^L refresh  q quit  d detail
XP  
XP! Under XENIX, termio.h is included twice (once by curses.h/tcap.h andf
XP  again by sys/tty.h.  You need to bracket the termio.h under XENIX with
XP    #if !defined(TERMIO_HACK) || (defined(TERMIO_HACK) && !defined(IOCTYPE))
XP    ...
XP
XP--- 33,39 -----
XP  22        S stopped by XOFF  D delay timeout in progress
XP  23 Commands: + inc delay  - dec delay  ^L refresh  q quit  d detail
XP  
XP! Under XENIX, termio.h is included twice (once by curses.h/tcap.h and
XP  again by sys/tty.h.  You need to bracket the termio.h under XENIX with
XP    #if !defined(TERMIO_HACK) || (defined(TERMIO_HACK) && !defined(IOCTYPE))
XP    ...
XP***************
XP*** 56,61
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
XP--- 56,62 -----
XP    bug hopefully now retired, even if it crockish.
XP  --------------------------------------------------------------------------*/
XP  /*+:EDITS:*/
XP+ /*:02-23-1990-17:10-wht-more keyboard problems with UNIX: try typeahead(-1) */
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***************
XP*** 444,449
XP  		fputs("curses init failed ... check terminal type\n",stderr);
XP  		exit(1);
XP  	}
XP  	crmode();
XP  	noecho();
XP  	main_template();
XP
XP--- 445,453 -----
XP  		fputs("curses init failed ... check terminal type\n",stderr);
XP  		exit(1);
XP  	}
XP+ #if defined(M_TERMINFO)
XP+ 	typeahead(-1);
XP+ #endif
XP  	crmode();
XP  	noecho();
XP  	main_template();
XP*** ../rel/uusnap.c	Mon Mar 12 16:30:40 1990
XP--- uusnap.c	Fri Feb 23 17:14:13 1990
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--- 1,5 -----
XP  /* CHK=0xBF8D */
XP! char *revision = "1.75";
XP  /*+-------------------------------------------------------------------------
XP  	uusnap.c - display UUCP communications status for HDB systems
XP      ...gatech!kd4nc!n4hgf!wht
XP***************
XP*** 26,32
XP  	spooldirname(fname)
XP  	statdirname(fname)
XP  
XP! Under XENIX, termio.h is included twice (once by curses.h/tcap.h andf
XP  again by sys/tty.h.  You need to bracket the termio.h under XENIX with
XP    #if !defined(TERMIO_HACK) || (defined(TERMIO_HACK) && !defined(IOCTYPE))
XP    ...
XP
XP--- 26,32 -----
XP  	spooldirname(fname)
XP  	statdirname(fname)
XP  
XP! Under XENIX, termio.h is included twice (once by curses.h/tcap.h and
XP  again by sys/tty.h.  You need to bracket the termio.h under XENIX with
XP    #if !defined(TERMIO_HACK) || (defined(TERMIO_HACK) && !defined(IOCTYPE))
XP    ...
XP***************
XP*** 48,53
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
XP--- 48,54 -----
XP   bug hopefully now retired, even if it crockish.
XP  --------------------------------------------------------------------------*/
XP  /*+:EDITS:*/
XP+ /*:02-23-1990-17:10-wht-more keyboard problems with UNIX: try typeahead(-1) */
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***************
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--- 756,762 -----
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*** 888,893
XP  		fprintf(stderr,"curses init failed... check terminal type\n");
XP  		exit(0);
XP  	}
XP  	noecho();
XP  	crmode();
XP  
XP
XP--- 888,896 -----
XP  		fprintf(stderr,"curses init failed... check terminal type\n");
XP  		exit(0);
XP  	}
XP+ #if defined(M_TERMINFO)
XP+ 	typeahead(-1);
XP+ #endif
XP  	noecho();
XP  	crmode();
XP  
XDIFF_EOF
Xecho patch 7 applied
Xexit 0
SHAR_EOF
chmod 0744 PATCH.7 || echo "restore of PATCH.7 fails"
if [ $TOUCH = can ]
then
    touch -m 0312165090 PATCH.7
fi
exit 0