[comp.sources.misc] v09i058: siotools patch 2

allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (12/08/89)

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

I appreciate the mail I've recceived on uusnap and siomon...  and the
bug report and suggestions.  I've gotten 1 clue about hacking this to
work with ISC i386: The "standard" async port tty structure array is
named 'asy_tty' and the count of items in the array is in 'num_asy'.
Whereas SCO maintains one array of tty structures for all tty devices,
whether single 0x3f8/0x2f8 standard ports or multi-port expansion
boards, this seems not to be the case with ISC.  More than one kmem
read will be necessary to read asy_tty and ???_tty [ ...  and ??2_tty
...  ] into an aggregate array.  Another mechanism will be needed to
map array indices to /dev/ttynames.  I would appreciate hearing of any
work you might do.
-----------------------------------------------------------------------
Warren Tucker,  Mountain Park, Georgia       ...!gatech!kd4nc!n4hgf!wht 

--------------- cut here --------------
:
# This is a shell archive (shar 3.04)
# made 12/07/1989 08:32 UTC by gatech!kd4nc!n4hgf!wht
# Source directory /u4/src/uusnap/x
#
# siotools v09i044/v09i45 Patch 2
# uusnap bug fix and changes described in the enclosed file
# Just unshar in the siotools source directory and type 'sh PATCH.2'
#
echo "x - extracting PATCH.2 (Text)"
sed 's/^X//' << 'SHAR_EOF' > PATCH.2 &&
X:
X#----------------------------------------------------------------------
X# siotools v09i044/v09i45 Patch 2    -- affects uusnap only
X# 1. Fix race condition with status update vs. tty->no-tty transition
X# 2. Increase number of displayable connections
X# 3. document ESC as quit key
X#----------------------------------------------------------------------
X#+:EDITS:
X#:12-07-1989-03:26-wht-creation
X
Xsed -e 's/^P//' << DIFF_EOF | patch
XP*** uusnap161.c
XP--- uusnap.c
XP**************
XP*** 1,5
XP! /* CHK=0x5B7C */
XP! char *revision = "1.61";
XP  /*+-------------------------------------------------------------------------
XP  	uusnap.c - display UUCP communications status for HDB systems
XP      ...gatech!kd4nc!n4hgf!wht
XP--- 1,5 -----
XP! /* CHK=0xD9CC */
XP! char *revision = "1.62";
XP  /*+-------------------------------------------------------------------------
XP  	uusnap.c - display UUCP communications status for HDB systems
XP      ...gatech!kd4nc!n4hgf!wht
XP**************
XP*** 32,37
XP  
XP  --------------------------------------------------------------------------*/
XP  /*+:EDITS:*/
XP  /*:12-04-1989-16:45-wht-add detail in full */
XP  /*:12-01-1989-16:53-wht-XENIX 286 work: no beep()! */
XP  /*:11-30-1989-17:48-wht-complete rewrite to add detail status */
XP--- 32,38 -----
XP  
XP  --------------------------------------------------------------------------*/
XP  /*+:EDITS:*/
XP+ /*:12-07-1989-03:10-wht-make changes per email suggestions */
XP  /*:12-04-1989-16:45-wht-add detail in full */
XP  /*:12-01-1989-16:53-wht-XENIX 286 work: no beep()! */
XP  /*:11-30-1989-17:48-wht-complete rewrite to add detail status */
XP**************
XP*** 92,98
XP  char *LOCKDIR = "/usr/spool/uucp/LCK..";
XP  char *WORKDIR = "/usr/spool/uucp/";
XP  char *SPOOLDIR = "/usr/spool/uucp";
XP- char *LOGFILE = "/tmp/uuexp.log";
XP  
XP  #define MAX_SYSTEMS (LINES - FIRSTSYS_Y - 6)
XP  #define WAITSECS_ACTIVE 1 /* sleep secs between samples when talking */
XP--- 93,98 -----
XP  char *LOCKDIR = "/usr/spool/uucp/LCK..";
XP  char *WORKDIR = "/usr/spool/uucp/";
XP  char *SPOOLDIR = "/usr/spool/uucp";
XP  
XP  #define MAX_SYSTEMS (LINES - FIRSTSYS_Y - 4)
XP  #define WAITSECS_ACTIVE 1 /* sleep secs between samples when talking */
XP**************
XP*** 94,100
XP  char *SPOOLDIR = "/usr/spool/uucp";
XP  char *LOGFILE = "/tmp/uuexp.log";
XP  
XP! #define MAX_SYSTEMS (LINES - FIRSTSYS_Y - 6)
XP  #define WAITSECS_ACTIVE 1 /* sleep secs between samples when talking */
XP  #define WAITSECS_IDLE   7 /* sleep secs between samples when not talking */
XP  
XP--- 94,100 -----
XP  char *WORKDIR = "/usr/spool/uucp/";
XP  char *SPOOLDIR = "/usr/spool/uucp";
XP  
XP! #define MAX_SYSTEMS (LINES - FIRSTSYS_Y - 4)
XP  #define WAITSECS_ACTIVE 1 /* sleep secs between samples when talking */
XP  #define WAITSECS_IDLE   7 /* sleep secs between samples when not talking */
XP  
XP**************
XP*** 354,360
XP  	if(stdscr)
XP  	{
XP  		standend();
XP! 		move(LINES - 4,0);
XP  		clrtobot();
XP  		refresh();
XP  		echo();
XP--- 354,360 -----
XP  	if(stdscr)
XP  	{
XP  		standend();
XP! 		move(LINES - 2,0);
XP  		clrtobot();
XP  		refresh();
XP  		echo();
XP**************
XP*** 408,414
XP  cmd_line(text)
XP  char *text;
XP  {
XP! 	move(LINES - 4,0);
XP  	clrtoeol();
XP  
XP  	if(!text)
XP--- 408,414 -----
XP  cmd_line(text)
XP  char *text;
XP  {
XP! 	move(LINES - 2,0);
XP  	clrtoeol();
XP  
XP  	if(!text)
XP**************
XP*** 413,419
XP  
XP  	if(!text)
XP  		addstr(
XP! 		"type 'q' to quit, 'd' for detail, SPACE to update immediately");
XP  	else
XP  		addstr(text);
XP  
XP--- 413,419 -----
XP  
XP  	if(!text)
XP  		addstr(
XP! 		"type ESC/'q' to quit, 'd' for detail, SPACE to update immediately");
XP  	else
XP  		addstr(text);
XP  
XP**************
XP*** 607,613
XP  {
XP  register int x;
XP  register int y;
XP! register unsigned int itmp;
XP  char s8[8];
XP  
XP  	getyx(stdscr,y,x);
XP--- 607,613 -----
XP  {
XP  register int x;
XP  register int y;
XP! register unsigned itmp;
XP  char s8[8];
XP  
XP  	clrtoeol();
XP**************
XP*** 610,615
XP  register unsigned int itmp;
XP  char s8[8];
XP  
XP  	getyx(stdscr,y,x);
XP  	move(y,TX + x);
XP  	addch((sionum < 8) ? '1' : '2');
XP--- 610,616 -----
XP  register unsigned itmp;
XP  char s8[8];
XP  
XP+ 	clrtoeol();
XP  	getyx(stdscr,y,x);
XP  	move(y,TX + x);
XP  	addch((sionum < 8) ? '1' : '2');
XP**************
XP*** 682,687
XP  int y,x;
XP  int sysdetail;
XP  int ttnum;
XP  char *sysname;
XP  char *cptr;
XP  
XP--- 683,689 -----
XP  int y,x;
XP  int sysdetail;
XP  int ttnum;
XP+ int have_tty = 0;
XP  char *sysname;
XP  char *cptr;
XP  
XP**************
XP*** 689,694
XP  	"tty  raw  can   out   speed  state iflag  oflag  cflag  lflag  pgrp";
XP  static char *hyphens =
XP  	"---  ---  ---  -----  -----  ----- ------ ------ ------ ------ -----";
XP  
XP  
XP  	cmd_line("display detail on system #: __");
XP--- 691,702 -----
XP  	"tty  raw  can   out   speed  state iflag  oflag  cflag  lflag  pgrp";
XP  static char *hyphens =
XP  	"---  ---  ---  -----  -----  ----- ------ ------ ------ ------ -----";
XP+ static char *press_any_key =
XP+ 	"press any key to return to main display  ";
XP+ static char *state1 =
XP+ 	"State: W waiting for open to complete  O open  C carrier on";
XP+ static char *state2 =
XP+ 	"       S stopped by XOFF  D delay timeout in progress ";
XP  
XP  	cmd_line("display detail on system #: __");
XP  	getyx(stdscr,y,x);
XP**************
XP*** 690,696
XP  static char *hyphens =
XP  	"---  ---  ---  -----  -----  ----- ------ ------ ------ ------ -----";
XP  
XP- 
XP  	cmd_line("display detail on system #: __");
XP  	getyx(stdscr,y,x);
XP  	move(y,x - 2);
XP--- 698,703 -----
XP  static char *state2 =
XP  	"       S stopped by XOFF  D delay timeout in progress ";
XP  
XP  	cmd_line("display detail on system #: __");
XP  	getyx(stdscr,y,x);
XP  	move(y,x - 2);
XP**************
XP*** 708,714
XP  		return;
XP  	}
XP  
XP- 	cmd_line("press any key to return to main display  ");
XP  	sysname = sysnames + (sysdetail << 4);
XP  	y = FIRSTSYS_Y;
XP  	move(y,0);
XP--- 715,720 -----
XP  		return;
XP  	}
XP  
XP  	sysname = sysnames + (sysdetail << 4);
XP  	y = FIRSTSYS_Y;
XP  	move(y,0);
XP**************
XP*** 713,718
XP  	y = FIRSTSYS_Y;
XP  	move(y,0);
XP  	clrtobot();
XP  
XP  	move(y+4,0);
XP  	addstr(header);
XP--- 719,725 -----
XP  	y = FIRSTSYS_Y;
XP  	move(y,0);
XP  	clrtobot();
XP+ 	cmd_line(press_any_key);
XP  
XP  	while(1)
XP  	{
XP**************
XP*** 714,731
XP  	move(y,0);
XP  	clrtobot();
XP  
XP- 	move(y+4,0);
XP- 	addstr(header);
XP- 	move(y+5,0);
XP- 	addstr(hyphens);
XP- 	move(y+8,0);
XP- 	addstr(
XP- "State: W waiting for open to complete  O open  C carrier on");
XP- 	move(y+9,0);
XP- 	addstr(
XP- "       S stopped by XOFF  D delay timeout in progress ");
XP- 
XP- 
XP  	while(1)
XP  	{
XP  		display_tod();	/* display time and get 'secs_now' */
XP--- 721,726 -----
XP  	clrtobot();
XP  	cmd_line(press_any_key);
XP  
XP  	while(1)
XP  	{
XP  		display_tod();	/* display time and get 'secs_now' */
XP**************
XP*** 736,741
XP  			printw("cannot get status for %s",sysname);
XP  			standend();
XP  			clrtobot();
XP  			goto DETAIL_SLEEP;
XP  		}
XP  
XP--- 731,737 -----
XP  			printw("cannot get status for %s",sysname);
XP  			standend();
XP  			clrtobot();
XP+ 			cmd_line(press_any_key);
XP  			goto DETAIL_SLEEP;
XP  		}
XP  
XP**************
XP*** 742,748
XP  							/* 00000 */
XP  							/* 01234 */
XP  							/* ttyxx */
XP! 		move(y+6,0);
XP  		if(locked_tty[0] && ((locked_tty[3] == '1') || (locked_tty[3] == '2')))
XP  		{
XP  			ttnum = ((locked_tty[3] - '1') * 8) + ((locked_tty[4] & 7) - 1);
XP--- 738,744 -----
XP  							/* 00000 */
XP  							/* 01234 */
XP  							/* ttyxx */
XP! 		move(y+5,0);
XP  		if(locked_tty[0] && ((locked_tty[3] == '1') || (locked_tty[3] == '2')))
XP  		{
XP  			ttnum = ((locked_tty[3] - '1') * 8) + ((locked_tty[4] & 7) - 1);
XP**************
XP*** 752,758
XP  				addstr(cptr);
XP  				addstr(": ");
XP  				addstr(locked_tty);
XP- 				cmd_line("press any key to return to main display  ");
XP  				standend();
XP  				refresh();
XP  				getch();
XP--- 748,753 -----
XP  				addstr(cptr);
XP  				addstr(": ");
XP  				addstr(locked_tty);
XP  				standend();
XP  				refresh();
XP  				getch();
XP**************
XP*** 758,764
XP  				getch();
XP  				goto DETAIL_EXIT;
XP  			}
XP! 			clrtoeol();
XP  			display_tty(ttnum,&sio[0]);
XP  			wintty_template(stdscr,y+11,0,1);
XP  			wintty(stdscr,y+11,0,&sio[0]);
XP--- 753,771 -----
XP  				getch();
XP  				goto DETAIL_EXIT;
XP  			}
XP! 			if(!have_tty)
XP! 			{
XP! 				move(y+3,0);
XP! 				addstr(header);
XP! 				move(y+4,0);
XP! 				addstr(hyphens);
XP! 				move(y+7,0);
XP! 				addstr(state1);
XP! 				move(y+8,0);
XP! 				addstr(state2);
XP! 			}
XP! 			have_tty = 1;
XP! 			move(y+5,0);
XP  			display_tty(ttnum,&sio[0]);
XP  			wintty_template(stdscr,y+10,0,1);
XP  			wintty(stdscr,y+10,0,&sio[0]);
XP**************
XP*** 760,768
XP  			}
XP  			clrtoeol();
XP  			display_tty(ttnum,&sio[0]);
XP! 			wintty_template(stdscr,y+11,0,1);
XP! 			wintty(stdscr,y+11,0,&sio[0]);
XP! 			move(y+11,0);
XP  		}
XP  		else
XP  		{
XP--- 767,775 -----
XP  			have_tty = 1;
XP  			move(y+5,0);
XP  			display_tty(ttnum,&sio[0]);
XP! 			wintty_template(stdscr,y+10,0,1);
XP! 			wintty(stdscr,y+10,0,&sio[0]);
XP! 			move(y+10,0);
XP  		}
XP  		else
XP  		{
XP**************
XP*** 766,771
XP  		}
XP  		else
XP  		{
XP  			printw(" no tty or non-async connection");
XP  			clrtoeol();
XP  			wintty_template(stdscr,y+11,0,0);
XP--- 773,781 -----
XP  		}
XP  		else
XP  		{
XP+ 			move(y+3,0);
XP+ 			clrtobot();
XP+ 			move(y+5,0);
XP  			printw(" no tty or non-async connection");
XP  			cmd_line(press_any_key);
XP  			have_tty = 0;
XP**************
XP*** 767,774
XP  		else
XP  		{
XP  			printw(" no tty or non-async connection");
XP! 			clrtoeol();
XP! 			wintty_template(stdscr,y+11,0,0);
XP  		}
XP  
XP  DETAIL_SLEEP:
XP--- 777,786 -----
XP  			clrtobot();
XP  			move(y+5,0);
XP  			printw(" no tty or non-async connection");
XP! 			cmd_line(press_any_key);
XP! 			have_tty = 0;
XP! 			wintty_template(stdscr,y+10,0,0);
XP! 			move(LINES - 2,0);
XP  		}
XP  
XP  DETAIL_SLEEP:
XP**************
XP*** 886,892
XP  			bye(255);
XP  		}
XP  		display_delta_y = systems = 0;
XP- 		move(LINES - 4,0);
XP  		move(FIRSTSYS_Y,0);
XP  		while(dp = dir_read(stat_dp))
XP  		{
XP--- 898,903 -----
XP  			bye(255);
XP  		}
XP  		display_delta_y = systems = 0;
XP  		move(FIRSTSYS_Y,0);
XP  		while(dp = dir_read(stat_dp))
XP  		{
XP**************
XP*** 903,916
XP  			display_status(systems,sysname,display_delta_y + FIRSTSYS_Y,linebuf);
XP  			display_delta_y++;
XP  		}
XP- 		move(display_delta_y + FIRSTSYS_Y,0);
XP- 		clrtoeol();
XP- 		display_delta_y++;
XP- 		move(display_delta_y + FIRSTSYS_Y,0);
XP- 		addstr("UUCP connections active: ");
XP- 		utoda(s32,2,systems);
XP- 		addstr(s32);
XP- 		display_delta_y++;
XP  		while(display_delta_y < MAX_SYSTEMS)
XP  		{
XP  			move(display_delta_y++ + FIRSTSYS_Y,0);
XP--- 914,919 -----
XP  			display_status(systems,sysname,display_delta_y + FIRSTSYS_Y,linebuf);
XP  			display_delta_y++;
XP  		}
XP  		while(display_delta_y < MAX_SYSTEMS)
XP  		{
XP  			move(display_delta_y++ + FIRSTSYS_Y,0);
XP**************
XP*** 918,924
XP  		}
XP  
XP  		dir_close(stat_dp);
XP! 		move(LINES - 4,0);
XP  		refresh();
XP  
XP  #if defined(M_UNIX)
XP--- 921,927 -----
XP  		}
XP  
XP  		dir_close(stat_dp);
XP! 		move(LINES - 2,0);
XP  		refresh();
XP  
XP  #if defined(M_UNIX)
XDIFF_EOF
Xexit 0
SHAR_EOF
chmod 0755 PATCH.2 || echo "restore of PATCH.2 fails"
exit 0