Google
 

Trailing-Edge - PDP-10 Archives - QT020_T20_4.1_6.1_SWSKIT_851021 - swskit-tools/dmptty.c
There are no other files named dmptty.c in the archive.
/*
 * dmptty.c -- TOPS-20 program to dump monitor tty database for a line.
 *
 *   * NOTE *  Fairly heavy version dependencies.
 *
 * Items dumped include static data, and the dynamic data block
 *
 * DMPTTY is a product of the TOPS-20 Monitor Support unit of
 * Software Services, primarily for inclusion on the TOPS-20 Monitor
 * SWSKIT.  The purpose of DMPTTY is to provide detailed internal
 * information on the state of a terminal line for debugging purposes.
 *
 * Related files:
 *	DMPTTY.C	This file
 *	DMPTTY.HLP	Help file for DMPTTY
 *	DMPTTY.EXE	Executable image
 *	SNOOP.C		Monitor-examining support routines
 *	HELPER.C,CTYPE.C,PRINTF.C	Support routines
 *
 * Greg Zima, 1985.
 */

#include stdio.h

#define OURNAME "DMPTTY"
#define USAGE "Usage:  dmptty [/h][/l] linenumber"
#define LOGFILE "DMPTTY.LST"

int	ojfn;			/* output file designator */

int	lineno;			/* line number to examine */

int	monver;			/* monitor version number */

int	ttstat,			/* the various terminal data base words */
	ttspwd,			/* terminal speed word */
	ttcsad,			/* bits + special scheduler routine */
	ttcstm,			/* time to call routine in ttcsad */
	ttactl,			/* pointer to dynamic data block */
	ttddln,			/* length of dynamic data block */
	dynblk[50],		/* buffer for tty dynamic data block */
	ttsiz,			/* I/O buffer size variable */
	inbuf[50],		/* buffer to hold input buffer */
	outbuf[50];		/* buffer to hold output buffer */

#include helper.c

main(argc,argv)
	int argc;
	char *argv[];
{
	int i;

/* Parse the input commands */

	lineno=-1;		/* no line specified yet */
	ojfn=0;			/* no file specified yet */

	if (argc < 2) badcommand();
	for (i=1; i<argc; ++i) {
		if (argv[i][0] == '/') {
			switch (argv[i][1]) {
			case 'h':
			case 'H':
				helper(OURNAME); exit();

			case 'l':
			case 'L':
				if ((ojfn=fopen(LOGFILE,"w")) == NULL) {
					fputs("\n? Can't open log file",stderr);
					abort(ERRCODE);
					}
				break;
			default:
				badcommand();
			}
			}
		else if (lineno == -1) {	/* terminal line number */
			lineno=atooct(argv[i]);
			}
		}
	if (ojfn == 0) ojfn=stdout;		/* default to the terminal */

/* do the work */

	dmptty();
	fclose(ojfn);
	return;
}

/*
 * badcommand -- print usage text and exit
 */
badcommand()
{
	fputs(USAGE,stderr); abort(ERRCODE);
}

/*
 * dmptty -- dump out information of the selected line number (lineno)
 *		to standard output.
 */
dmptty()
{
	if ((lineno < 0) || (lineno > snoopsymbol("NLINES"))) {
		fputs("\n?Invalid line number",stderr);
		abort(ERRCODE);
		}

	monver=(examine(".JBVER",0)>>18)&07777;	/* major+minor version # */

/* display results */

	if (ojfn != stdout)
		printf("[Writing to %s]\n",LOGFILE);

	fprintf(ojfn,"\nData for terminal line %o:\n",lineno);
	do_stat();		/* handle TTSTAT */

	ttspwd=examine("TTSPWD",lineno);
	fprintf(ojfn,"\nTTSPWD:	%12o\tTerminal input,,output speed",
		ttspwd);
	fprintf(ojfn,"\n\tTTISP %5d.\tInput speed",(ttspwd>>18)&0777777);
	fprintf(ojfn,"\n\tTTOSP %5d.\tOutput speed",(ttspwd&0777777));

	do_csxx();		/* handle TTCSAD and TTCSTM */

	do_actl();		/* handle TTACTL and dynamic data block */

	do_bufs();		/* handle input and output buffers */
}

/*
 * do_stat -- routine to handle output for TTSTAT word
 */
do_stat()
{
	ttstat=examine("TTSTAT",lineno);
	fprintf(ojfn,"\nTTSTAT:	%12o	Terminal static data",
		ttstat);
	if ((ttstat&snoopsymbol("TT%FEM")) != 0)
		fprintf(ojfn,"\n\tTT%%FEM\t	Line is remote");
	if ((ttstat&snoopsymbol("TT%NTS")) != 0)
		fprintf(ojfn,"\n\tTT%%NTS\t	Don't send system messages");
	if ((ttstat&snoopsymbol("TT%FXO")) != 0)
		fprintf(ojfn,"\n\tTT%%FXO\t	Line needs XON");
	if ((ttstat&snoopsymbol("TT%CON")) != 0)
		fprintf(ojfn,"\n\tTT%%CON\t	Line has carrier on");
	if ((ttstat&snoopsymbol("TT%FSP")) != 0)
		fprintf(ojfn,"\n\tTT%%FSP\t	Line needs speed set");
	if ((ttstat&snoopsymbol("TT%FXF")) != 0)
		fprintf(ojfn,"\n\tTT%%FXF\t	Line needs XOFF");
	if ((ttstat&snoopsymbol("TT%IGI")) != 0)
		fprintf(ojfn,"\n\tTT%%IGI\t	Ignore input when inactive");
	if ((ttstat&snoopsymbol("TT%AUT")) != 0)
		fprintf(ojfn,"\n\tTT%%AUT\t	Line is autobaud");
	if ((ttstat&snoopsymbol("TT%XOC")) != 0)
		fprintf(ojfn,"\n\tTT%%XOC\t	Line needs XON/XOFF (KS)");
	if ((ttstat&snoopsymbol("TT%FPK")) != 0)
		fprintf(ojfn,"\n\tTT%%FPK\t	Line waiting for FE post (KL)");
	switch (monver) {		/*** version dependent stuff... ***/
	case 0401:
		if ((ttstat&snoopsymbol("TT%ABW")) != 0)
			fprintf(ojfn,"\n\tTT%%ABW\t	Line in autobaud wait");
		if ((ttstat&snoopsymbol("TT%CRW")) != 0)
			fprintf(ojfn,"\n\tTT%%CRW\t	Line in carrier wait");
		fprintf(ojfn,"\n\tTTXCN	%3d.	Count of XOFFs requested",
			valdefstr("TTXCN",ttstat));
		break;

	case 0501:
	case 0600:
	case 0601:
		if ((ttstat&snoopsymbol("TT%SHU")) != 0)
			fprintf(ojfn,"\n\tTT%%SHU\t	Line is shut off");
		if ((ttstat&snoopsymbol("TT%WSO")) != 0)
			fprintf(ojfn,"\n\tTT%%WSO\t	Line was shut off");
		if (monver == 0501) break;

		if ((ttstat&snoopsymbol("TT%NTM")) != 0)
			fprintf(ojfn,"\n\tTT%%NTM\t	Suppress misc TTMSGs");
		if ((ttstat&snoopsymbol("TT%NUM")) != 0)
			fprintf(ojfn,"\n\tTT%%NUM\t\tSuppress unprived TTMSGs");
		fprintf(ojfn,"\n\tTTNOI	%3d.	Count of noise characters",
			valdefstr("TTNOI",ttstat));
		break;

	default:
		}
	fprintf(ojfn,"\n	TTSTY	%3o	Line type",
		valdefstr("TTSTY",ttstat));
	fprintf(ojfn,"\n	TSFMC	%3d.	Max count for FE",
		valdefstr("TSFMC",ttstat));
	fprintf(ojfn,"\n	TTFBB	%3d.	Number of entries in TTBBUF",
		valdefstr("TTFBB",ttstat));
}

/*
 * do_csxx -- handle output for TTCSAD and TTCSTM
 */
do_csxx()
{
	ttcsad=examine("TTCSAD",lineno);
	fprintf(ojfn,"\nTTCSAD:	%12o	Scheduler routine to call, bits",
		ttcsad);
	if ((ttcsad&(1<<35)) != 0)
		fprintf(ojfn,"\n	0 TTTOBL	Turn on line");
	if ((ttcsad&(1<<34)) != 0)
		fprintf(ojfn,"\n	1 TTSN10	Send message action");
	if ((ttcsad&(1<<33)) != 0)
		fprintf(ojfn,"\n	2 TTCOF		Carrier off check");
	if ((ttcsad&(1<<32)) != 0)
		fprintf(ojfn,"\n	3 TTCON1	Carrier on (create job)");
	if (monver < 0601) {	/*** version dependency (6.1 loses DZHU2) ***/
		if ((ttcsad&(1<<31)) != 0)
			fprintf(ojfn,"\n\t4 DZHU2		Hang up line");
		if ((ttcsad&(1<<30)) != 0)
			fprintf(ojfn,"\n\t5 NTYCOF	Carrier off action");
		if ((ttcsad&(1<<29)) != 0)
			fprintf(ojfn,"\n\t6 CKSALL	Unhang stuck TTMSG");
		if ((ttcsad&(1<<28)) != 0)
			fprintf(ojfn,"\n\t7 CKNOIS	Noisy line check");
		}
	else	{
		if ((ttcsad&(1<<31)) != 0)
			fprintf(ojfn,"\n\t4 NTYCOF	Carrier off action");
		if ((ttcsad&(1<<30)) != 0)
			fprintf(ojfn,"\n\t5 CKSALL	Unhang stuck TTMSG");
		if ((ttcsad&(1<<29)) != 0)
			fprintf(ojfn,"\n\t6 CKNOIS	Noisy line check");
		}

	ttcstm=examine("TTCSTM",lineno);
	fprintf(ojfn,"\nTTCSTM:	%12o	Time to call TTCSAD routine",
		ttcstm);
}

/*
 * do_actl -- routine to handle output for TTACTL and dynamic data block
 */
do_actl()
{
	int i,temp;

	ttactl=examine("TTACTL",lineno);
	fprintf(ojfn,"\nTTACTL:	%12o	Terminal dynamic data pointer",
		ttactl);

	ttddln=snoopsymbol("TTDDLN");		/* dynblk length to get */
	if (ttactl <= 0) return;		/* go if no block */
	jpeek(ttactl,ttddln,dynblk);		/* read it */
	for (i=0; i < ttddln; ++i)		/* dump words in octal */
		fprintf(ojfn,"\n   %2o\t%12o",i,dynblk[i]);
	do_fl1();		/* handle TTFLG1 */
	do_dat1();		/* TTDAT1 */
	do_sal12();		/* TTSAL1 */
	fprintf(ojfn,"\nTTDEV	%12o	Device dependent word",
		dynblk[snoopsymbol("TTDEV")]);
	do_bfrc();		/* TTBFRC */
	fprintf(ojfn,"\nTTOCT	%12d.	Number of chars in output buffer",
		dynblk[snoopsymbol("TTOCT")]);
	fprintf(ojfn,"\nTTOOUT\t%12o	Pointer to remove output buffer char",
		dynblk[snoopsymbol("TTOOUT")]);
	fprintf(ojfn,"\nTTOIN	%12o	Pointer to enter output buffer char",
		dynblk[snoopsymbol("TTOIN")]);
	temp=dynblk[snoopsymbol("TTDAT2")];
	fprintf(ojfn,"\nTTDAT2	%12o	Data word 2",temp);
	fprintf(ojfn,"\n\tTTUPC	%3o	Unpause on page character",
		valdefstr("TTUPC",temp));
	fprintf(ojfn,"\n\tTYLCH	%3o	Last char removed from input buffer",
		valdefstr("TYLCH",temp));
	fprintf(ojfn,"\n\tTPWID	%3d.	Page width",
		valdefstr("TPWID",temp));
	if (monver > 0401) {		/*** version dependency ***/
		fprintf(ojfn,"\n\tTTPPC	%3o	Pause/unpause on page char",
			valdefstr("TTPPC",temp));
		}
	fprintf(ojfn,"\nTTICT	%12d.	Number of chars in input buffer",
		dynblk[snoopsymbol("TTICT")]);
	fprintf(ojfn,"\nTTIOUT\t%12o	Pointer to remove input buffer char",
		dynblk[snoopsymbol("TTIOUT")]);
	fprintf(ojfn,"\nTTIIN	%12o	Pointer to enter input buffer char",
		dynblk[snoopsymbol("TTIIN")]);
	fprintf(ojfn,"\nFCMOD1	%12o	CCOC word 1",
		dynblk[snoopsymbol("FCMOD1")]);
	fprintf(ojfn,"\nFCMOD2	%12o	CCOC word 2",
		dynblk[snoopsymbol("FCMOD2")]);
	fprintf(ojfn,"\nTTDPSI	%12o	Deferred interrupt code bits",
		dynblk[snoopsymbol("TTDPSI")]);
	fprintf(ojfn,"\nTTPSI	%12o	Terminal interrupt code bits",
		dynblk[snoopsymbol("TTPSI")]);
	fprintf(ojfn,"\nTTLINK	%12o	Terminal lines linked to",
		dynblk[snoopsymbol("TTLINK")]);
	temp=dynblk[snoopsymbol("TTLPOS")];
	fprintf(ojfn,"\nTTLPOS	%12o	Cursor position",temp);
	fprintf(ojfn,"\n\tTPGPS	%3d.	Current line within page",
		valdefstr("TPGPS",temp));
	fprintf(ojfn,"\n\tTLNPS	%3d.	Current character position in line",
		valdefstr("TLNPS",temp));
	do_fls();		/* handle TTFLGS word */
	temp=dynblk[snoopsymbol("TTFORK")];
	fprintf(ojfn,"\nTTFORK	%12o	Fork and job data",temp);
	fprintf(ojfn,"\n\tTCJOB	%3d.	Controlling job number",
		valdefstr("TCJOB",temp));
	fprintf(ojfn,"\n\tTWFRK %3o	Fork in input wait on line",
		valdefstr("TWFRK",temp));
	temp=dynblk[snoopsymbol("TTFRK1")];
	fprintf(ojfn,"\nTTFRK1	%12o	Fork and job data",temp);
	fprintf(ojfn,"\n\tTTPFK %3o	Top fork of SCTTY tree",
		valdefstr("TTPFK",temp));
	fprintf(ojfn,"\n\tTTPSFK%3o	PSI fork for non-ctl TTY PSIs",
		valdefstr("TTPSFK",temp));
	do_chr1234();		/* TTCHR1, TTCHR2, TTCHR3, TTCHR4 */
	temp=dynblk[snoopsymbol("TTFWTH")];
	fprintf(ojfn,"\nTTFWTH	%12o	Field wakeup variables",temp);
	fprintf(ojfn,"\n\tTTIPSI	%3d.	Input PSI level",
		valdefstr("TTIPSI",temp));
	fprintf(ojfn,"\n\tTTOPSI	%3d.	Output PSI level",
		valdefstr("TTOPSI",temp));
	fprintf(ojfn,"\n\tTTFCNT	%3d.	Byte count for wakeup",
		valdefstr("TTFCNT",temp));
	fprintf(ojfn,"\nTTLINE	%12d.	Line counter",
		dynblk[snoopsymbol("TTLINE")]);
	temp=dynblk[snoopsymbol("TTLMAX")];
	fprintf(ojfn,"\nTTLMAX	%12d.	Maximum of TTLINE",temp);
	if ((monver > 0401) && (monver < 0601)) { /*** version dependency ***/
		fprintf(ojfn,"\n\tTTULL%6o	Net user logical link",
			valdefstr("TTULL",temp));
		fprintf(ojfn,"\n\tTTUEC	%3o	Net user escape char",
			valdefstr("TTUEC",temp));
		}
	if (monver > 0401) {		/*** version dependency ***/
		temp=dynblk[snoopsymbol("TTSVPD")];
		fprintf(ojfn,"\nTTSVPD	%12o	Saved line speed",temp);
		fprintf(ojfn,"\n\tTTISV %5d.\tInput speed",(temp>>18)&0777777);
		fprintf(ojfn,"\n\tTTOSV %5d.\tOutput speed",(temp&0777777));
		}
	do_fl2();		/* handle TTFLG2 if appropriate */
	if (monver >= 0601) {	/*** version dependency ***/
		temp=dynblk[snoopsymbol("TTLNUW")];
		fprintf(ojfn,"\nTTLNUW	%12o	Net User word",temp);
		fprintf(ojfn,"\n\tTTULL  %o	Pointer to net user NRB",
			valdefstr("TTULL",temp));
		fprintf(ojfn,"\n\tTTUEC	%3o	Net user escape char",
			valdefstr("TTUEC",temp));
		}
}

/*
 * do_fl1 -- handle output for TTFLG1, called from do_actl
 */
do_fl1()
{
	int temp;

	temp=dynblk[snoopsymbol("TTFLG1")];
	fprintf(ojfn,"\nTTFLG1	%12o	Flag word 1",temp);
	if ((temp&snoopsymbol("TT%SAL")) != 0)
		fprintf(ojfn,"\n\tTT%%SAL	\tSendall being done");
	if ((temp&snoopsymbol("TT%SHT")) != 0)
		fprintf(ojfn,"\n\tTT%%SHT	\tShort block");
	if ((temp&snoopsymbol("TT%MES")) != 0)
		fprintf(ojfn,"\n\tTT%%MES	\tSystem message block");
	if ((temp&snoopsymbol("TT%OTP")) != 0)
		fprintf(ojfn,"\n\tTT%%OTP	\tOutput is enroute");
	if ((temp&snoopsymbol("TT%FWK")) != 0)
		fprintf(ojfn,"\n\tTT%%FWK	\tForced wakeup");
	if ((temp&snoopsymbol("TT%SFG")) != 0)
		fprintf(ojfn,"\n\tTT%%SFG	\tStopped on end-of-page");
	if ((temp&snoopsymbol("TT%RFG")) != 0)
		fprintf(ojfn,"\n\tTT%%RFG	\tRepeat last char (BKJFN)");
	if ((temp&snoopsymbol("TT%WFG")) != 0)
		fprintf(ojfn,"\n\tTT%%WFG	\tBlocked on input");
	if ((temp&snoopsymbol("TT%PRM")) != 0)
		fprintf(ojfn,"\n\tTT%%PRM	\tPermanent block");
	if ((temp&snoopsymbol("TT%BAC")) != 0)
		fprintf(ojfn,"\n\tTT%%BAC	\tBecoming active");
	if ((temp&snoopsymbol("TT%NXO")) != 0)
		fprintf(ojfn,"\n\tTT%%NXO	\tPause on end-of-page mode");
	if ((temp&snoopsymbol("TT%BKO")) != 0)
		fprintf(ojfn,"\n\tTT%%BKO\t\tFork blocked for output event");
	if (monver > 0401) {		/*** version dependencies ***/
		if ((temp&snoopsymbol("TT%NUS")) != 0)
			fprintf(ojfn,"\n\tTT%%NUS	\tNet user state");
		if ((temp&snoopsymbol("TT%DD1")) != 0)
			fprintf(ojfn,"\n\tTT%%DD1\t\tDevice dependent bit");
		if ((temp&snoopsymbol("TT%NPM")) != 0)
			fprintf(ojfn,"\n\tTT%%NPM\t\tMCB NVT old page mode");
		if ((temp&snoopsymbol("TT%RXF")) != 0)
			fprintf(ojfn,"\n\tTT%%RXF\t\tHave received XOFF");
		if ((temp&snoopsymbol("TT%FLO")) != 0)
			fprintf(ojfn,
				"\n\tTT%%FLO\t\ttFlushing output at TTSND");
		if ((temp&snoopsymbol("TT%HPO")) != 0)
			fprintf(ojfn,
				"\n\tTT%%HPO\t\ttHigh priority output queued");
		if ((temp&snoopsymbol("TT%DAL")) != 0)
			fprintf(ojfn,
				"\n\tTT%%DAL\t\tDeallocate of block requested");
		if ((temp&snoopsymbol("TT%XFF")) != 0)
			fprintf(ojfn,
				"\n\tTT%%XFF\t\tForce XON/XOFF status to FE");
		}
	if (monver >= 0601) {		/*** more version dependencies ***/
		if ((temp&snoopsymbol("TT%SEC")) != 0)
			fprintf(ojfn,
				"\n\tTT%%SEC	\tServer should echo (CTERM)");
		if ((temp&snoopsymbol("TT%WKC")) != 0)
			fprintf(ojfn,
				"\n\tTT%%WKC	\tWakeup set has changed");
		if ((temp&snoopsymbol("TT%SPG")) != 0)
			fprintf(ojfn,
				"\n\tTT%%SPG	\tPage stop on in server");
		}
	fprintf(ojfn,"\n\tTT%%LCK	%3d.	Count of locks on this block",
		valdefstr("TTLCK",temp));
}

/*
 * do_dat1 -- handle output for TTDAT1, called from do_actl
 */
do_dat1()
{
	int temp;

	temp=dynblk[snoopsymbol("TTDAT1")];
	fprintf(ojfn,"\nTTDAT1	%12o	Data word 1",temp);
	if (monver > 0401) {		/*** version dependency ***/
		fprintf(ojfn,"\n\tTYLMD	%3o	Data mode for last input",
			valdefstr("TYLMD",temp));
		}
	fprintf(ojfn,"\n	TTOCN	%3d.	Count of extra buffers",
		valdefstr("TTOCN",temp));
	fprintf(ojfn,"\n	TTOMX	%3d.	Extra buffers in use",
		valdefstr("TTOMX",temp));
	fprintf(ojfn,"\n	TTTYP	%3o	Terminal type",
		valdefstr("TTTYP",temp));
	fprintf(ojfn,"\n	TINTL%6o	Internal line number",
		valdefstr("TINTL",temp));

}

/*
 * do_sal12 -- handle output for TTSAL1 and TTSAL2, called from do_actl
 */
do_sal12()
{
	int temp;

	temp=dynblk[snoopsymbol("TTSAL1")];
	fprintf(ojfn,"\nTTSAL1	%12o	Sendall word 1",temp);
	fprintf(ojfn,"\n	TLTYP%6o	Line type (same as TTSTY)",
		valdefstr("TLTYP",temp));
	if (monver > 0401) {		/*** version dependency ***/
		fprintf(ojfn,"\n	TSALT	%3d.	Sendall timeout count",
			valdefstr("TSALT",temp));
		}
	fprintf(ojfn,"\n	TSALC  %4d.	Sendall character count",
		valdefstr("TSALC",temp));
	fprintf(ojfn,"\nTTSAL2	%12o	Sendall byte pointer",
		dynblk[snoopsymbol("TTSAL2")]);
}

/*
 * do_bfrc -- handle output for TTBFRC, called from do_actl
 */
do_bfrc()
{
	int temp;

	temp=dynblk[snoopsymbol("TTBFRC")];
	fprintf(ojfn,"\nTTBFRC	%12o	Buffer counts",temp);
	fprintf(ojfn,"\n\tTOWRN	%3d.	Count in output buffer for wakeup",
		valdefstr("TOWRN",temp));
	fprintf(ojfn,"\n	TTNIN	%3d.	Number of input buffers",
		valdefstr("TTNIN",temp));
	fprintf(ojfn,"\n	TTNOU	%3d.	Number of output buffers",
		valdefstr("TTNOU",temp));
	fprintf(ojfn,"\n	TIMAX  %4d.	Max bytes in input buffer",
		valdefstr("TIMAX",temp));
	fprintf(ojfn,"\n	TOMAX  %4d.	Max bytes in output buffer",
		valdefstr("TOMAX",temp));

}

/*
 * do_chr1234 -- handle output for TTCHR1,2,3,4,  called from do_actl
 */
do_chr1234()
{
	fprintf(ojfn,"\nTTCHR1	%12o	Wake up char mask 1",
		dynblk[snoopsymbol("TTCHR1")]);
	fprintf(ojfn,"\nTTCHR2	%12o	Wake up char mask 2",
		dynblk[snoopsymbol("TTCHR2")]);
	fprintf(ojfn,"\nTTCHR3	%12o	Wake up char mask 3",
		dynblk[snoopsymbol("TTCHR3")]);
	fprintf(ojfn,"\nTTCHR4	%12o	Wake up char mask 4",
		dynblk[snoopsymbol("TTCHR4")]);
}

/*
 * do_fls -- handle output for TTFLGS, called from do_actl
 */
do_fls()
{
	int temp;

	temp=dynblk[snoopsymbol("TTFLGS")];
	fprintf(ojfn,"\nTTFLGS	%12o	Terminal flags/jfn mode word",temp);
	if ((ttstat&snoopsymbol("TT%OSP")) != 0)
		fprintf(ojfn,"\n	TT%%OSP		Output suppress on");
	if ((ttstat&snoopsymbol("TT%MFF")) != 0)
		fprintf(ojfn,"\n	TT%%MFF		Mechanical form feed");
	if ((ttstat&snoopsymbol("TT%TAB")) != 0)
		fprintf(ojfn,"\n	TT%%TAB		Mechanical tabs");
	if ((ttstat&snoopsymbol("TT%LCA")) != 0)
		fprintf(ojfn,"\n	TT%%LCA		Lower case ability");
	fprintf(ojfn,"\n	TPLEN	%3d.	Page length",
		valdefstr("TPLEN",temp));
	fprintf(ojfn,"\n	TT%%WAK	 %2o	Wakeup field",
		valdefstr("TT%WAK",temp));
	if ((ttstat&snoopsymbol("TT%WK0")) != 0)
		fprintf(ojfn,"\n	TT%%WK0		Wakeup class 0");
	if ((ttstat&snoopsymbol("TT%IGN")) != 0)
		fprintf(ojfn,"\n	TT%%IGN	\tIgnore other TT%WAK bits");
	if ((ttstat&snoopsymbol("TT%WKF")) != 0)
		fprintf(ojfn,"\n	TT%%WKF	\tWakeup on formatting chars");
	if ((ttstat&snoopsymbol("TT%WKN")) != 0)
		fprintf(ojfn,"\n	TT%%WKN	\tWakeup on non-formatting");
	if ((ttstat&snoopsymbol("TT%WKP")) != 0)
		fprintf(ojfn,"\n	TT%%WKP	\tWakeup on punctuation");
	if ((ttstat&snoopsymbol("TT%WKA")) != 0)
		fprintf(ojfn,"\n	TT%%WKA	\tWakeup on alphanumerics");
	if ((ttstat&snoopsymbol("TT%ECO")) != 0)
		fprintf(ojfn,"\n	TT%%ECO		Echos on");
	if ((ttstat&snoopsymbol("TT%ECM")) != 0)
		fprintf(ojfn,"\n	TT%%ECM		Echo mode");
	if ((ttstat&snoopsymbol("TT%ALK")) != 0)
		fprintf(ojfn,"\n	TT%%ALK		Accept links");
	if ((ttstat&snoopsymbol("TT%AAD")) != 0)
		fprintf(ojfn,"\n	TT%%AAD		Accept advice");
	fprintf(ojfn,"\n	TT%%DAM	%3o	Data mode",
		valdefstr("TT%DAM",temp));
	if ((ttstat&snoopsymbol("TT%UOC")) != 0)
		fprintf(ojfn,"\n	TT%%UOC	\tUpper case output flagging");
	if ((ttstat&snoopsymbol("TT%LIC")) != 0)
		fprintf(ojfn,"\n	TT%%LIC	\tLower case input raising");
	fprintf(ojfn,"\n	TT%%DUM	%3o	Duplex mode",
		valdefstr("TT%DUM",temp));
	if ((ttstat&snoopsymbol("TT%PGM")) != 0)
		fprintf(ojfn,"\n	TT%%PGM	\tPause on command enabled");
	if ((ttstat&snoopsymbol("TT%CAR")) != 0)
		fprintf(ojfn,"\n	TT%%CAR	\tDataset carrier on");
}

/*
 * do_fl2 -- handle output for TTFLG2, called from do_actl
 */
do_fl2()
{
	int temp;

	if (monver > 0501) {	/*** version dependency ***/
		temp=dynblk[snoopsymbol("TTFLG2")];
		fprintf(ojfn,"\nTTFLG2	%12o	Flag word 2",temp);
		fprintf(ojfn,"\n	TTFLA	%3o	First char seen flag",
			valdefstr("TTFLA",temp));
		fprintf(ojfn,"\n	TTETP	%3o	Type",
			valdefstr("TTETP",temp));
		fprintf(ojfn,"\n	TTCH1	%3o	First character",
			valdefstr("TTCH1",temp));
		fprintf(ojfn,"\n	TTCH2	%3o	Second character",
			valdefstr("TTCH2",temp));
		}
}

/*
 * do_bufs -- routine to display the input and output buffers, if any
 *		note - if line is running, this program is probably
 *			too slow to get the buffer while still in use.
 *
 */
do_bufs()
{
	int ptr,i;
	char txt[5];

	ttsiz=snoopsymbol("TTSIZ");		/* fetch size variable */
	if ((ptr=dynblk[snoopsymbol("TTIOUT")]) != 0) {	/* input buffer */
		ptr = ((ptr&~(ttsiz-1))&077777777) + 2;	/* start */
		jpeek(ptr,ttsiz-1,inbuf);		/* peek the buffer */
		fprintf(ojfn,"\nInput buffer at %o:",ptr);
		for (i=0; i<ttsiz-1; ++i) {		/* dump buffer */
			fprintf(ojfn,"\n\t%12o\t%s",
			inbuf[i],c9txt(inbuf[i],txt));
			}
		}
	if ((ptr=dynblk[snoopsymbol("TTOOUT")]) != 0) {	/* output buffer */
		ptr = ((ptr&~(ttsiz-1))&077777777) + 2;	/* start */
		jpeek(ptr,ttsiz-1,outbuf);		/* peek the buffer */
		fprintf(ojfn,"\nOutput buffer at %o:",ptr);
		for (i=0; i<ttsiz-1; ++i) {		/* dump buffer */
			fprintf(ojfn,"\n\t%12o\t%s",
			outbuf[i],c9txt(outbuf[i],txt));
			}
		}
}

/*
 * c9txt -- routine to convert a word of nine-bit bytes into a string.
 *		Normal graphic are de-parity-ed, and other characters
 *		are represented by ".".  Return pointer to string.
 */
c9txt(wd,str)
	int wd;
	char *str;
{
	int i;
	char *ptr;

	for (ptr=str , i=0; i<4; ++i) {		/* convert each character */
		*str=(wd>>(27-9*i))&0777;
		if ((*str < 0400) && ((*str&0177) >= 040))
			*str &=0177;
		else
			*str='.';
		++str;
		}
	*str=EOS;
	return ptr;				/* return original pointer */
}

/*
 * strcat -- append src string to dst string
 */
strcat(dst,src)
	char *dst,*src;
{
	char *olddst;

	olddst=dst; while (*dst) ++dst;
	while (*dst++ = *src++) ;
	return olddst;
}

/*
 * strlen -- Return the length of string (number of non-null chars)
 */
strlen(s)
	char *s;
{
	char *p;

	p=s; while (*p) ++p;
	return (p-s);
}

/*
 * atooct -- routine to convert a string to an octal value and return it
 */
atooct(str)
	char *str;
{
	int val;

	val=0;
	while ((*str >= '0') && (*str <= '7')) {/* test for octal */
		val=(val<<3) + *str-'0';	/* combine all digits */
		++str;				/* ignoring any overflow */
		}
	return val;
}

#include snoop.c
#include ctype.c
#include printf.c

/* End of DMPTTY.C */