[net.sources] Twenex-Like ^T for Pyramid kernel

chris@umcp-cs.UUCP (Chris Torek) (06/19/85)

[There are also 4.1 and 4.2 Vax Unix changes, under separate cover.]

The following is a set of changes to Pyramid Unix to add a twenex-like
control-T ``usestat'' character.  Most of the code was written by
Rehmi Post (who also made up the diff listings).  The following
note (by me, Chris Torek) certainly applies to the Vax 4.2 code,
and probably to the other changes as well.

We originally turned this on via ``options USESTAT'' in the kernel
config files.  This is actually a bad idea, because then ``pstat
-t'' breaks.  I'd suggest that you put a

	#define USESTAT

in ioctl.h right before the first #ifdef USESTAT, instead.  However,
I will also note that since we haven't got things set up that way
right now, I don't know if that really works right.

Without further ado, the Pyramid changes:
--------

*** /tmp/,RCSt1003440	Sat Aug 11 17:41:52 1984
--- ioctl.h	Mon Aug  6 23:15:14 1984
***************
*** 33,38
  	char	t_werasc;	/* word erase */
  	char	t_lnextc;	/* literal next character */
  };
  
  struct itpjunk {
  	int status;

--- 40,51 -----
  	char	t_werasc;	/* word erase */
  	char	t_lnextc;	/* literal next character */
  };
+ #ifdef USESTAT
+ struct auxchars {
+ 	short	t_usemap;	/* usestat info bitmap */
+ 	char	t_usest;	/* usestat character */
+ };
+ #endif
  
  struct itpjunk {
  	int status;
***************
*** 203,208
  #define TIOCLOOP	_IO(p, 102)	/* XXX set itp port to loopback */
  #define	TIOCGLOOP	_IO(p, 103)	/* XXX get loopback state */
  #define TIOCLOG		_IO(p, 127)
  
  /* ITP specific flow control ioctls -- These are extremely machine dependent!!!
   *

--- 216,239 -----
  #define TIOCLOOP	_IO(p, 102)	/* XXX set itp port to loopback */
  #define	TIOCGLOOP	_IO(p, 103)	/* XXX get loopback state */
  #define TIOCLOG		_IO(p, 127)
+ 
+ #ifdef USESTAT
+ #define TIOCSAUXC	_IOW(t, 59, struct auxchars)/* set extra tty chars */
+ #define TIOCGAUXC	_IOR(t, 58, struct auxchars)/* get extra tty chars */
+ #define 	Ust_load1	0x0001	/* one-minute load average */
+ #define 	Ust_load5	0x0002	/* five-minute load average */
+ #define 	Ust_load15	0x0004	/* fifteen-minute load average */
+ #define 	Ust_uptime	0x0008	/* time since last boot */
+ #define 	Ust_pgrp	0x0010	/* pgroup leader */
+ #define 	Ust_childs	0x0020	/* and N children */
+ #define 	Ust_pcpu	0x0040	/* %cpu they're getting */
+ #define 	Ust_incore	0x0080	/* size and rss of them */
+ #define 	Ust_flags	0x0100	/* OR of all their flags */
+ #define 	Ust_state	0x0200	/* rough state (in i/o wait, etc) */
+ #define 	Ust_rawcpu	0x0400	/* raw or cooked cpu %'age */
+ 
+ #endif USESTAT
+ 
  
  /* ITP specific flow control ioctls -- These are extremely machine dependent!!!
   *
*** /tmp/,RCSt1003440	Sat Aug 11 17:41:58 1984
--- tty.h	Sun Aug  5 19:44:54 1984
***************
*** 80,85
  	char	t_col;			/* tty */
  	unsigned short	t_ispeed, t_ospeed;	/* device */
  	char	t_rocount, t_rocol;	/* tty */
  	struct	ttychars t_chars;	/* tty */
  /* be careful of tchars & co. */
  #define	t_erase		t_chars.tc_erase

--- 90,98 -----
  	char	t_col;			/* tty */
  	unsigned short	t_ispeed, t_ospeed;	/* device */
  	char	t_rocount, t_rocol;	/* tty */
+ #ifdef USESTAT
+ 	short	t_mflags;		/* some of both */
+ #endif
  	struct	ttychars t_chars;	/* tty */
  /* be careful of tchars & co. */
  #define	t_erase		t_chars.tc_erase
***************
*** 96,101
  #define	t_flushc	t_chars.tc_flushc
  #define	t_werasc	t_chars.tc_werasc
  #define	t_lnextc	t_chars.tc_lnextc
  	char	t_min;	/* minimum characters for btl modes */
  	char	t_time;	/* number of ticks (?) before wakeup for btl modes */
  	int	itp_inputflags;

--- 109,118 -----
  #define	t_flushc	t_chars.tc_flushc
  #define	t_werasc	t_chars.tc_werasc
  #define	t_lnextc	t_chars.tc_lnextc
+ #ifdef USESTAT
+ #define t_usemap	t_chars.tc_usemap
+ #define t_usest		t_chars.tc_usest
+ #endif
  	char	t_min;	/* minimum characters for btl modes */
  	char	t_time;	/* number of ticks (?) before wakeup for btl modes */
  	int	itp_inputflags;
***************
*** 169,171
  #define	TAB		4
  #define	VTAB		5
  #define	RETURN		6

--- 186,192 -----
  #define	TAB		4
  #define	VTAB		5
  #define	RETURN		6
+ 
+ #ifdef USESTAT		/* t_mflags bits */
+ #define Ust_Timing	0x0001	/* We're timing out, ignore ^T's */
+ #endif
*** /tmp/,RCSt1003440	Sat Aug 11 17:42:01 1984
--- ttychars.h	Sun Aug  5 19:44:54 1984
***************
*** 4,9
   * User visible structures and constants
   * related to terminal handling.
   */
  #ifndef _TTYCHARS_
  #define	_TTYCHARS_
  struct ttychars {

--- 10,16 -----
   * Added stuff for USESTAT (^T).
   * 
   */
+ 
  #ifndef _TTYCHARS_
  #define	_TTYCHARS_
  struct ttychars {
***************
*** 21,26
  	char	tc_flushc;	/* flush output (toggles) */
  	char	tc_werasc;	/* word erase */
  	char	tc_lnextc;	/* literal next character */
  };
  
  #define	CTRL(c)	('c'&037)

--- 28,37 -----
  	char	tc_flushc;	/* flush output (toggles) */
  	char	tc_werasc;	/* word erase */
  	char	tc_lnextc;	/* literal next character */
+ #ifdef USESTAT
+ 	short	tc_usemap;	/* usestat info bitmap */
+ 	char	tc_usest;	/* usestat character */
+ #endif
  };
  
  #define	CTRL(c)	('c'&037)
***************
*** 41,44
  #define	CFLUSH	CTRL(o)
  #define	CWERASE	CTRL(w)
  #define	CLNEXT	CTRL(v)
  #endif

--- 52,59 -----
  #define	CFLUSH	CTRL(o)
  #define	CWERASE	CTRL(w)
  #define	CLNEXT	CTRL(v)
+ #ifdef USESTAT
+ #define CUSEST	CTRL(t)
+ #define CUSEMAP	(~(Ust_uptime|Ust_flags|Ust_childs))
+ #endif USESTAT
  #endif
3c3
< static char *RcsId = "@(#)$Header: /g/src/.ucbsrc/osx/sys/RCS/tty.c,v 1.1 84/08/05 19:45:44 root Exp $";
---
> static char *RcsId = "@(#)$Header: /g/src/.ucbsrc/osx/sys/RCS/tty.c,v 1.3 84/08/11 01:09:14 root Exp $";
6,7c6,7
<  * Revision 1.1  84/08/05  19:45:44  root
<  * Initial revision
---
>  * Revision 1.3  84/08/11  01:09:14  root
>  * Moved usestat out of NTTYDISC and fixed 'nty'* to 'tty'*.
8a9,11
>  * Revision 1.2  84/08/05  19:48:39  rehmi
>  * Lots of new cruft for usestat (^T).
>  * 
206a210,212
> #ifdef USESTAT
> 	, CUSEMAP,CUSEST
> #endif
376a383,385
> #ifdef USESTAT
> 	case TIOCSAUXC:
> #endif
565a575,589
> #ifdef USESTAT
> 	
> 	/*
> 	 * Set/get local aux chars
> 	 */
> 	case TIOCGAUXC:
> 		bcopy((caddr_t)&tp->t_usemap, data, sizeof (struct auxchars));
> 		break;
> 		
> 	case TIOCSAUXC:
> 		bcopy(data, (caddr_t)&tp->t_usemap, sizeof (struct auxchars));
> 		break;
> 
> #endif
> 
1177a1202,1208
> #ifdef USESTAT
> 		if (c == tp->t_usest) {
> 			ttystatout(tp);
> 			goto endcase;
> 		}
> #endif
> 
2162a2194,2410
> 
> #ifdef USESTAT
> /*
>  * print out primitive system stats (for now) rehmi 18 Apr 83
>  * Last modification rehmi & chris 10 Jun 83
>  * Added clearer stats and a few other fixes rehmi 2 Jul 83
>  * Shortened message and kludged tty wait check rehmi 16 Nov 83
>  * Fixed problem with "k of" in previous version. chris 19 Nov 83
>  * Fixed problem with zombie memory measurements. james 20 Nov 83
>  * Added priorities on states, 1 second timeouts. rehmi 30 Apr 84
>  * Converted from 4.1 to osx. rehmi@maryland 5 Aug 84
>  */
> 
> /* States of a process. */
> 
> char *states[] = {
> 	"losing", "waiting", "swapped", "running",
> 	"idling", "zombied", "stopped", "kbd wait"
> };
> 
> /* which states are most important to know (least best) */
> char st_pri[] = {
> 	7, 3, 4, 1,
> 	2, 6, 5, 0
> };
> 
> ttystatout(tp)
> register struct tty *tp;
> {
> 	register struct proc *p;
> 	register int x, f = 0, cf = 0;
> 	int size = 0, rss = 0, ptime = 0, state = 0, pflg = 0;
> 	float pcpu = 0.0;
> 	static double magic = 4294967296.0;
> 	extern double avenrun[];
> 	struct proc *this;
> 	char *s;
> 	int ttystatgo();
> 
> 	/*
> 	 * Macro to use &s[l] if nothing else has been printed
> 	 */
> #define comma(s,l)	(s + (cf++ ? 0 : l))
> 
> 	/*
> 	 * Should we break to next line?
> 	 */
> #define newp		if (tp->t_col > 64) {ttyoutput('\n', tp); cf=0;} else
> 
> 	/*
> 	 * If waiting on hoggage, discard
> 	 * If timing out, discard
> 	 */
> 	if (tp->t_state & TS_ASLEEP || tp->t_mflags & Ust_Timing)
> 		return;
> 
> 	/* 
> 	 * set up the timeout
> 	 */
> 	tp->t_mflags |= Ust_Timing;	/* disable ^T */
> 	timeout(ttystatgo, tp, hz);	/* wait a second before re_enabling */
> 	
> 	/*
> 	 * Print uptime
> 	 */
> 	if (tp->t_usemap&Ust_uptime) {
> 		x = (int) (time.tv_sec - boottime.tv_sec);
> 		if (x < 0)
> 			x = 0;
> 		ttyout("up ", tp);
> 		if (x/86400 > 0) {		/* days */
> 			ttyoutint(x/86400, 10, 1, tp);
> 			ttyout("d ", tp);
> 			x %= 86400;
> 		}
> 		if (x/3600 > 0) {		/* hours */
> 			ttyoutint(x/3600, 10, 1, tp);
> 			ttyout("h ", tp);
> 			x %= 3600;
> 		}
> 		ttyoutint(x/60, 10, 2, tp);	/* minutes */
> 		ttyout("m", tp);
> 		cf++;
> 	}
> 	newp;
> 
> #define	ttyoutfloat(f)	(ttyoutint((f)/100, 10, 1, tp),	\
> 			 ttyoutput('.', tp),		\
> 			 ttyoutint((f)%100, 10, 2, tp))
> 
> 	/*
> 	 * Print load average
> 	 */
> 	if (tp->t_usemap&(Ust_load1|Ust_load5|Ust_load15)) {
> 		ttyout(comma(", load", 2), tp);
> 		if (tp->t_usemap&Ust_load1) {
> 			ttyoutput(' ', tp);
> 			x = avenrun[0]*100.0 + 0.5;
> 			if (x < 0)
> 				x = 0;
> 			ttyoutfloat(x);
> 		}
> 		if (tp->t_usemap&Ust_load5) {
> 			ttyoutput(' ', tp);
> 			x = avenrun[1]*100.0 + 0.5;
> 			if (x < 0)
> 				x = 0;
> 			ttyoutfloat(x);
> 		}
> 		if (tp->t_usemap&Ust_load15) {
> 			ttyoutput(' ', tp);
> 			x = avenrun[2]*100.0 + 0.5;
> 			if (x < 0)
> 				x = 0;
> 			ttyoutfloat(x);
> 		}
> 		newp;
> 	}
> 
> 	for (p = proc; p < procNPROC; p++) {
> 		if (p->p_pgrp == tp->t_pgrp) {
> 			if (tp->t_pgrp == p->p_pid)
> 				this = p;
> 			if (st_pri[p->p_stat] < st_pri[state])
> 				state = p->p_stat;
> 			if(p->p_stat==SSLEEP &&
> 			   p->p_wchan==(caddr_t)&tp->t_rawq)
> 				state=7;
> 			if (p->p_stat != SZOMB) {
> 				pcpu  = pcpu + (float)p->p_pctcpu;
> 				size += p->p_tsize + p->p_dsize
> 					+ p->p_ussize + p->p_cssize;
> 				rss  += p->p_rssize;
> 				pflg |= p->p_flag;
> 				ptime += p->p_time;
> 			}
> 			f++;
> 		}
> 	}
> 	if (f) {
> 		/*
> 		 * Print pid, %cpu, size, rss
> 		 */
> 		if (tp->t_usemap&Ust_pgrp) {
> 			ttyout(comma(", pid ", 2), tp);
> 			ttyoutint(tp->t_pgrp, 10, 1, tp);
> 		}
> 		newp;
> 		if (tp->t_usemap&Ust_childs) {
> 			ttyout(comma(" children ", 1), tp);
> 			ttyoutint(f, 10, 1, tp);
> 		}
> 		newp;
> 		if (tp->t_usemap&Ust_pcpu) {
> 			ttyout(comma(", %cpu ", 2), tp);
> 			if (tp->t_usemap&Ust_rawcpu)
> 				x = pcpu*10000.0 + 0.5;
> 			else
> 				x =	10000.0*pcpu  /
> 				(1.0 - ( (1<<(ptime>>2)) / magic) );
> 			/* sick!!!!!!!!!!!!! */
> 			ttyoutfloat(x);
> 		}
> 		newp;
>     		if (tp->t_usemap&Ust_incore) {
>     			ttyout(comma(", ", 2), tp);
> 			ttyoutint(rss>>1, 10, 1, tp);
> 			ttyout("k of ", tp);
> 			ttyoutint(size>>1, 10, 1, tp);
> 			ttyoutput('k', tp);
> 		}
> 		newp;
> 		if (tp->t_usemap&Ust_flags) {
> 			ttyout(comma(", flags ", 2), tp);
> 			ttyoutint(pflg, 16, 1, tp);
> 		}
> 		newp;
> 		if (tp->t_usemap&Ust_state) {
> 			ttyout(comma(", ", 2), tp);
> 			ttyout(states[state], tp);
> 			cf++;
> 		}
> 		if (cf)
> 			ttyoutput('\n', tp);
> 	}
> 	else
> 		ttyout(comma("; no process\n", 2), tp);
> 
> 	/*
> 	 * Reset "t_rocount" so pending input will
> 	 * be retyped if backspacing follows.
> 	 */
> 
> 	tp->t_rocount = 0;
> }
> 
> ttystatgo(tp)
> register struct tty *tp;
> {
> 	tp->t_mflags &= ~Ust_Timing;
> }
> 
> ttyoutint(n, base, min, tp)
> register int n, base, min;
> register struct tty *tp;
> {
> 	char info[16];
> 	register char *p = info;
> 
> 	while (--min >= 0 || n) {
> 		*p++ = "0123456789abcdef"[n%base];
> 		n /= base;
> 	}
> 	while (p > info)
> 		ttyoutput(*--p, tp);
> }
> #endif USESTAT
*** sys/stty.c	Tue Aug  7 19:09:23 1984
--- /usr/src/bin/stty.c	Fri Aug 31 18:10:13 1984
***************
*** 1,5
  #ifndef lint
! static char *sccsid ="@(#)stty.c	4.15 (Maryland) 8/8/84";
  #endif
  /*
   * set teletype modes

--- 1,5 -----
  #ifndef lint
! static char *sccsid ="@(#)stty.c	4.14 (Berkeley) 7/6/83";
  #endif
  /*
   * set teletype modes
***************
*** 8,16
  #include <stdio.h>
  #include <sgtty.h>
  
- #define	pcol(x,y)	pcoln(x,y,7)
- #define	pco2(x,y)	pcoln(x,y,6)
- 
  struct
  {
  	char	*string;

--- 8,13 -----
  #include <stdio.h>
  #include <sgtty.h>
  
  struct
  {
  	char	*string;
***************
*** 33,40
  	"9600",	B9600,
  	"exta",	EXTA,
  	"19200", EXTA,
- 	"19.2k", EXTA,
- 	"19.2", EXTA,
  	"extb",	EXTB,
  	"38400", EXTB,
  	"38.4k", EXTB,

--- 30,35 -----
  	"9600",	B9600,
  	"exta",	EXTA,
  	"19200", EXTA,
  	"extb",	EXTB,
  	"38400", EXTB,
  	0,
***************
*** 37,44
  	"19.2", EXTA,
  	"extb",	EXTB,
  	"38400", EXTB,
- 	"38.4k", EXTB,
- 	"38.4", EXTB,
  	0,
  };
  struct

--- 32,37 -----
  	"19200", EXTA,
  	"extb",	EXTB,
  	"38400", EXTB,
  	0,
  };
  struct
***************
*** 131,178
  	0,
  };
  
- #ifdef	USESTAT
- struct Ust_option {
- 	char	*uo_name;
- 	short	uo_set, uo_clear;
- } Ust_options[] = {
- 	"load1",	Ust_load1,	0,
- 	"-load1",	0,		Ust_load1,
- 	"load5",	Ust_load5,	0,
- 	"-load5",	0,		Ust_load5,
- 	"load15",	Ust_load15,	0,
- 	"-load15",	0,		Ust_load15,
- 	"load",		Ust_load1|Ust_load5|Ust_load15, 0,
- 	"-load",	0,		Ust_load1|Ust_load5|Ust_load15,
- 	"uptime",	Ust_uptime,	0,
- 	"-uptime",	0,		Ust_uptime,
- 	"pid",		Ust_pgrp,	0,
- 	"-pid",		0,		Ust_pgrp,
- 	"children",	Ust_childs,	0,
- 	"-children",	0,		Ust_childs,
- 	"cpu",		Ust_pcpu,	0,
- 	"-cpu",		0,		Ust_pcpu,
- 	"size",		Ust_incore,	0,
- 	"-size",	0,		Ust_incore,
- 	"flags",	Ust_flags,	0,
- 	"-flags",	0,		Ust_flags,
- 	"state",	Ust_state,	0,
- 	"-state",	0,		Ust_state,
- 	"rawcpu",	Ust_rawcpu,	0,
- 	"-rawcpu",	0,		Ust_rawcpu,
- 	"cookedcpu",	0,		Ust_rawcpu,
- 	"stdusest",	Ust_load1|Ust_load5|Ust_load15|Ust_pgrp|
- 			Ust_pcpu|Ust_incore|Ust_state|Ust_rawcpu,
- 					Ust_uptime|Ust_childs|Ust_flags,
- 	"-usest",	0,		0,
- 	"-stdusest",	Ust_load1|Ust_load15|Ust_uptime|
- 			Ust_pcpu|Ust_incore|Ust_state,
- 					Ust_childs|Ust_pgrp|Ust_flags|
- 					Ust_rawcpu|Ust_load5,
- 	0,		0,		0
- };
- #endif	USESTAT
- 
  struct tchars tc;
  struct ltchars ltc;
  struct sgttyb mode;

--- 124,129 -----
  	0,
  };
  
  struct tchars tc;
  struct ltchars ltc;
  struct sgttyb mode;
***************
*** 176,184
  struct tchars tc;
  struct ltchars ltc;
  struct sgttyb mode;
- #ifdef	USESTAT
- struct auxchars auxil;
- #endif	USESTAT
  int	lmode;
  int	oldisc, ldisc;
  

--- 127,132 -----
  struct tchars tc;
  struct ltchars ltc;
  struct sgttyb mode;
  int	lmode;
  int	oldisc, ldisc;
  
***************
*** 182,188
  int	lmode;
  int	oldisc, ldisc;
  
- 
  struct	special {
  	char	*name;
  	char	*cp;

--- 130,135 -----
  int	lmode;
  int	oldisc, ldisc;
  
  struct	special {
  	char	*name;
  	char	*cp;
***************
*** 202,210
  	"flush",	&ltc.t_flushc,		CFLUSH,
  	"werase",	&ltc.t_werasc,		CWERASE,
  	"lnext",	&ltc.t_lnextc,		CLNEXT,
- #ifdef	USESTAT
- 	"usest",	&auxil.t_usest,		CUSEST,
- #endif	USESTAT
  	0
  };
  char	*arg;

--- 149,154 -----
  	"flush",	&ltc.t_flushc,		CFLUSH,
  	"werase",	&ltc.t_werasc,		CWERASE,
  	"lnext",	&ltc.t_lnextc,		CLNEXT,
  	0
  };
  char	*arg;
***************
*** 214,220
  main(iargc, iargv)
  char	**iargv;
  {
! 	register int i;
  	register struct special *sp;
  	char obuf[BUFSIZ];
  

--- 158,164 -----
  main(iargc, iargv)
  char	**iargv;
  {
! 	int i;
  	register struct special *sp;
  	char obuf[BUFSIZ];
  
***************
*** 227,235
  	ioctl(1, TIOCGETC, &tc);
  	ioctl(1, TIOCLGET, &lmode);
  	ioctl(1, TIOCGLTC, &ltc);
- #ifdef	USESTAT
- 	ioctl(1, TIOCGAUXC, &auxil);
- #endif	USESTAT
  	if(argc == 1) {
  		prmodes(0);
  		exit(0);

--- 171,176 -----
  	ioctl(1, TIOCGETC, &tc);
  	ioctl(1, TIOCLGET, &lmode);
  	ioctl(1, TIOCGLTC, &ltc);
  	if(argc == 1) {
  		prmodes(0);
  		exit(0);
***************
*** 321,328
  		}
  		for(i=0; speeds[i].string; i++)
  			if(eq(speeds[i].string)) {
! 				mode.sg_ispeed =
! 				mode.sg_ospeed = speeds[i].speed;
  				goto cont;
  			}
  		if (eq("speed")) {

--- 262,268 -----
  		}
  		for(i=0; speeds[i].string; i++)
  			if(eq(speeds[i].string)) {
! 				mode.sg_ispeed = mode.sg_ospeed = speeds[i].speed;
  				goto cont;
  			}
  		if (eq("speed")) {
***************
*** 341,347
  				mode.sg_flags |= modes[i].set;
  				lmode &= ~modes[i].lreset;
  				lmode |= modes[i].lset;
- 				goto cont;
  			}
  #ifdef	USESTAT
  		for(i=0; Ust_options[i].uo_name; i++)

--- 281,286 -----
  				mode.sg_flags |= modes[i].set;
  				lmode &= ~modes[i].lreset;
  				lmode |= modes[i].lset;
  			}
  		if(arg)
  			fprintf(stderr,"unknown mode: %s\n", arg);
***************
*** 343,356
  				lmode |= modes[i].lset;
  				goto cont;
  			}
- #ifdef	USESTAT
- 		for(i=0; Ust_options[i].uo_name; i++)
- 			if(eq(Ust_options[i].uo_name)) {
- 				auxil.t_usemap |= Ust_options[i].uo_set;
- 				auxil.t_usemap &= ~Ust_options[i].uo_clear;
- 				continue;
- 			}
- #endif	USESTAT
  		if(arg)
  			fprintf(stderr,"unknown mode: %s\n", arg);
  cont:		;

--- 282,287 -----
  				lmode &= ~modes[i].lreset;
  				lmode |= modes[i].lset;
  			}
  		if(arg)
  			fprintf(stderr,"unknown mode: %s\n", arg);
  cont:
***************
*** 353,359
  #endif	USESTAT
  		if(arg)
  			fprintf(stderr,"unknown mode: %s\n", arg);
! cont:		;
  	}
  done:
  	ioctl(1, TIOCSETN, &mode);

--- 284,291 -----
  			}
  		if(arg)
  			fprintf(stderr,"unknown mode: %s\n", arg);
! cont:
! 		;
  	}
  done:
  	ioctl(1, TIOCSETN, &mode);
***************
*** 360,368
  	ioctl(1, TIOCSETC, &tc);
  	ioctl(1, TIOCSLTC, &ltc);
  	ioctl(1, TIOCLSET, &lmode);
! #ifdef	USESTAT
! 	ioctl(1, TIOCSAUXC, &auxil);
! #endif	USESTAT
  }
  
  eq(string)

--- 292,298 -----
  	ioctl(1, TIOCSETC, &tc);
  	ioctl(1, TIOCSLTC, &ltc);
  	ioctl(1, TIOCLSET, &lmode);
! 	exit(0);
  }
  
  eq(string)
***************
*** 366,372
  }
  
  eq(string)
! register char *string;
  {
  	register int i;
  

--- 296,302 -----
  }
  
  eq(string)
! char *string;
  {
  	int i;
  
***************
*** 368,374
  eq(string)
  register char *string;
  {
! 	register int i;
  
  	if(!arg)
  		return(0);

--- 298,304 -----
  eq(string)
  char *string;
  {
! 	int i;
  
  	if(!arg)
  		return(0);
***************
*** 437,443
  		int newcrt = (lmode&(LCTLECH|LCRTBS)) == (LCTLECH|LCRTBS) &&
  		    (lmode&(LCRTERA|LCRTKIL)) ==
  		      ((mode.sg_ospeed > B300) ? LCRTERA|LCRTKIL : 0);
! 		 int nothing = 1;
  		if (newcrt) {
  			if (all==2)
  				fprintf(stderr, "crt: (crtbs crterase crtkill ctlecho) ");

--- 367,373 -----
  		int newcrt = (lmode&(LCTLECH|LCRTBS)) == (LCTLECH|LCRTBS) &&
  		    (lmode&(LCRTERA|LCRTKIL)) ==
  		      ((mode.sg_ospeed > B300) ? LCRTERA|LCRTKIL : 0);
! 		int nothing = 1;
  		if (newcrt) {
  			if (all==2)
  				fprintf(stderr, "crt: (crtbs crterase crtkill ctlecho) ");
***************
*** 463,469
  		lpit(LLITOUT, "-litout ");
  		lpit(LNOHANG, "-nohang ");
  		if (any) {
! 			fprintf(stderr, "\n");
  			any = 0;
  			nothing = 0;
  		}

--- 393,399 -----
  		lpit(LLITOUT, "-litout ");
  		lpit(LNOHANG, "-nohang ");
  		if (any) {
! 			fprintf(stderr,"\n");
  			any = 0;
  			nothing = 0;
  		}
***************
*** 494,500
  			break;
  
  		case NTTYDISC:
- #ifdef	USESTAT
  			fprintf(stderr,"\
  erase kill  weras rprnt flush lnext susp  intr  quit  stop  eof   usest\n");
  			pco2(mode.sg_erase, -1);

--- 424,429 -----
  			break;
  
  		case NTTYDISC:
  			fprintf(stderr,"\
  erase  kill   werase rprnt  flush  lnext  susp   intr   quit   stop   eof\
  \n"); 
***************
*** 496,517
  		case NTTYDISC:
  #ifdef	USESTAT
  			fprintf(stderr,"\
! erase kill  weras rprnt flush lnext susp  intr  quit  stop  eof   usest\n");
! 			pco2(mode.sg_erase, -1);
! 			pco2(mode.sg_kill, -1);
! 			pco2(ltc.t_werasc, -1);
! 			pco2(ltc.t_rprntc, -1);
! 			pco2(ltc.t_flushc, -1);
! 			pco2(ltc.t_lnextc, -1);
! 			pco2(ltc.t_suspc, ltc.t_dsuspc);
! 			pco2(tc.t_intrc, -1);
! 			pco2(tc.t_quitc, -1);
! 			pco2(tc.t_stopc, tc.t_startc);
! 			pco2(tc.t_eofc, tc.t_brkc);
! 			pco2(auxil.t_usest, -1);
! #else	USESTAT
! 			fprintf(stderr,"\
! erase  kill   werase rprnt  flush  lnext  susp   intr   quit   stop   eof\n");
  			pcol(mode.sg_erase, -1);
  			pcol(mode.sg_kill, -1);
  			pcol(ltc.t_werasc, -1);

--- 425,432 -----
  
  		case NTTYDISC:
  			fprintf(stderr,"\
! erase  kill   werase rprnt  flush  lnext  susp   intr   quit   stop   eof\
! \n"); 
  			pcol(mode.sg_erase, -1);
  			pcol(mode.sg_kill, -1);
  			pcol(ltc.t_werasc, -1);
***************
*** 523,529
  			pcol(tc.t_quitc, -1);
  			pcol(tc.t_stopc, tc.t_startc);
  			pcol(tc.t_eofc, tc.t_brkc);
- #endif	USESTAT
  			fprintf(stderr,"\n");
  			break;
  		}

--- 438,443 -----
  			pcol(tc.t_quitc, -1);
  			pcol(tc.t_stopc, tc.t_startc);
  			pcol(tc.t_eofc, tc.t_brkc);
  			fprintf(stderr,"\n");
  			break;
  		}
***************
*** 542,569
  		if (!first)
  			fprintf(stderr, "\n");
  	}
- #ifdef	USESTAT
- #define	map(str,bit) fprintf(stderr, str + ((auxil.t_usemap&bit) != 0))
- #define	Ust_load3	(Ust_load1|Ust_load5|Ust_load15)
- 	if (all == 2 && ldisc == NTTYDISC) {
- 		if ((auxil.t_usemap&Ust_load3)==Ust_load3)
- 			fprintf (stderr, "load (load1 load5 load15) ");
- 		else {
- 			map("-load1 ", Ust_load1);
- 			map("-load5 ", Ust_load5);
- 			map("-load15 ", Ust_load15);
- 		}
- 		map("-uptime ", Ust_uptime);
- 		map("-pid ", Ust_pgrp);
- 		map("-children ", Ust_childs);
- 		map("-cpu ", Ust_pcpu);
- 		map("-size ", Ust_incore);
- 		map("-flags ", Ust_flags);
- 		map("-state ", Ust_state);
- 		map("-rawcpu ", Ust_rawcpu);
- 		putc ('\n', stderr);
- 	}
- #endif	USESTAT
  }
  
  pcoln(ch1, ch2, n)

--- 456,461 -----
  		if (!first)
  			fprintf(stderr, "\n");
  	}
  }
  
  pcol(ch1, ch2)
***************
*** 566,573
  #endif	USESTAT
  }
  
! pcoln(ch1, ch2, n)
! 	int ch1, ch2, n;
  {
  	int nout = 0;
  

--- 458,465 -----
  	}
  }
  
! pcol(ch1, ch2)
! 	int ch1, ch2;
  {
  	int nout = 0;
  
***************
*** 599,605
  			nout++;
  		}
  	}
! 	while (nout < n) {
  		fprintf(stderr, " ");
  		nout++;
  	}

--- 491,497 -----
  			nout++;
  		}
  	}
! 	while (nout < 7) {
  		fprintf(stderr, " ");
  		nout++;
  	}
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland