[comp.sources.amiga] v89i185: vt100 - terminal emulator v2.9, Part08/09

page%swap@Sun.COM (Bob Page) (10/20/89)

Submitted-by: acs@pccuts.pcc.amdahl.com (Tony Sumrall)
Posting-number: Volume 89, Issue 185
Archive-name: comm/vt100r29.8

# This is a shell archive.
# Remove anything above and including the cut line.
# Then run the rest of the file through 'sh'.
# Unpacked files will be owned by you and have default permissions.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: SHell ARchive
# Run the following text through 'sh' to create:
#	vt100.c
#	vt100.doc
# This is archive 8 of a 9-part kit.
# This archive created: Thu Oct 19 22:30:34 1989
echo "extracting vt100.c"
sed 's/^X//' << \SHAR_EOF > vt100.c
X/********************************************************************
X *  vt100 terminal emulator with xmodem transfer capability
X *		:ts=8
X *
X *	v2.9 ACS - Only strip parity if parity is enabled; handle external xfer
X *		   items in handle_menupick(); new p_interlace value (2).
X *	v2.8a 880331 ACS - Don't ReplyMsg too soon.
X *	v2.7 870825 ACS - Provide handling of the msgs from the
X *			  info/status window.
X *	v2.6 870227 DBW - bug fixes for all the stuff in v2.5
X *	v2.5 870214 DBW - more additions (see readme file)
X *	v2.4 861214 DBW - lots of fixes/additions (see readme file)
X *	v2.3 861101 DBW - minor bug fixes
X *	v2.2 861012 DBW - more of the same
X *	v2.1 860915 DBW - new features (see README)
X *	     860901 ACS - Added Parity and Word Length and support code
X *	     860823 DBW - Integrated and rewrote lots of code
X *	v2.0 860809 DBW - Major rewrite
X *	v1.1 860720 DBW	- Switches, 80 cols, colors, bug fixes
X *	v1.0 860712 DBW	- First version released
X *
X *  use <esc> to abort xmodem or kermit transfers
X *
X *  written by Michael Mounier
X *  new version by Dave Wecker
X *******************************************************************/
X
X/*  all includes defines and globals */
X#include "vt100.h"
X
XAPTR OrigWindowPtr;	/* Used by init.c when opening a new screen */
X
X/**************************************************************/
X/* here are all the global definitions that appear in vt100.h */
X/**************************************************************/
X
Xint	CmdFromRexx = 0;
X
X#if AREXX
Xstruct MsgPort *FromRexxPort = NULL;
Xchar	*HostName;
Xextern int	RexxReplies;
X#endif /* AREXX */
X
Xchar    *bufr;
Xint     fd, timeout = FALSE, ttime;
Xint	multi = FALSE, server;
X
Xlong    bytes_xferred;
Xchar	MyDir[60];
XBPTR	StartLock = 0;
Xstruct	IntuitionBase *IntuitionBase;
Xstruct	GfxBase *GfxBase;
Xstruct	Library *DiskfontBase;
X
X#if AREXX
Xstruct	RxsLib  *RexxSysBase;
X#endif	/* AREXX */
X
Xstruct	TextAttr myattr = {
X    (STRPTR)(&(myfontname[0])),
X    8,
X    0,
X    0};
Xstruct	TextFont *myfont = NULL;
Xstruct NewScreen NewScreen = {
X   0,0,640,200,1,		/* left, top, width, height, depth */
X   0,1,HIRES,			/* DetailPen, BlockPen, ViewModes */
X   CUSTOMSCREEN,&myattr,	/* Type, Font */
X   (UBYTE *)"VT100",		/* Title */
X   NULL,NULL };			/* Gadgets, Bitmap */
Xstruct NewWindow NewWindow = {
X   0,0,640,200,			/* left, top, width, height */
X   0,1,				/* detailpen, blockpen */
X   MENUPICK | CLOSEWINDOW | RAWKEY | ACTIVEWINDOW | INACTIVEWINDOW | MOUSEBUTTONS,
X   SMART_REFRESH | ACTIVATE | BORDERLESS | WINDOWCLOSE | WINDOWDEPTH | WINDOWDRAG,
X   NULL,NULL,			/* FirstGadget, CheckMark */
X   (UBYTE *)NULL,
X   NULL,			/* set screen after open screen */
X   NULL,			/* bitmap */
X   640, 200, 640, 200,		/* minw, minh, maxw, maxh */
X   CUSTOMSCREEN			/* Type */
X   };
X
X/*   LeftEdge, TopEdge, Width and Height are in CHARACTERS.  They are
X** converted to pixels in OpenReqWindow() in window.c based on the current
X** font's characteristics. */
Xstruct NewWindow NewReqWindow = {
X   0, 1, 54, 4,			/* left (set in window.c), top, width, height */
X   0, 1,			/* detailpen, blockpen */
X	/* IDCMP Flags... */
X   CLOSEWINDOW | ACTIVEWINDOW | REQCLEAR | REQSET | NEWSIZE,
X	/* Flags... */
X   SMART_REFRESH | NOCAREREFRESH | ACTIVATE | WINDOWSIZING | SIZEBRIGHT |
X   WINDOWCLOSE | WINDOWDEPTH | WINDOWDRAG,
X
X   NULL,			/* First gadget */
X   NULL,			/* CheckMark */
X   (UBYTE *)"VT100 Info & Xfer Status",	/* Title */
X   NULL,			/* set screen after open screen */
X   NULL,			/* bitmap */
X   ((5*8)+4+18), ((1*8)+11+2), 640, 200,	/* minw, minh, maxw, maxh */
X   CUSTOMSCREEN			/* Type */
X   };
Xstruct IntuiText MyTitle = {
X    0,1,JAM2,26,0,		/* front pen, back pen, mode, left, top */
X    &myattr,			/* font */
X    (UBYTE *)VERSION,		/* title */
X    NULL};			/* next text */
X
Xstruct Screen *myscreen = NULL;		/* ptr to applications screen */
Xstruct Window *mywindow = NULL;		/* ptr to applications window */
Xstruct Window *reqwindow = NULL;	/* ptr to requester's window */
Xstruct ViewPort *myviewport;
Xstruct RastPort *myrastport;
Xstruct IntuiMessage *NewMessage;	/* msg structure for GetMsg() */
Xstruct Preferences  *Prefs;		/* preferences from GetPrefs() */
X
X/**** String requester support ******/
X/*   The Top, Left, Width and Height are all in CHARACTERS.  This is converted
X** to pixels in OpenReqWindow() in window.c.  Things which contain strings of
X** known length are initialized from their string length */
X
Xchar    InpBuf[MAXGADSTR],UndoBuf[MAXGADSTR],Prompt[MAXGADSTR];
Xstruct IntuiText donetxt = {
X    1,0,JAM2,0,0,	/* front pen, back pen, mode, left, top */
X    &myattr,		/* font */
X    (UBYTE *)"DONE",	/* question to ask */
X    NULL};		/* next text */
Xstruct Gadget mydonegad = {
X    &mystrgad,36,0,0,1,	/* next,left,top,width,height */
X    GADGHCOMP|REQGADGET,	/* flags */
X    RELVERIFY|ENDGADGET,	/* activation */
X    BOOLGADGET,			/* gadget type */
X    NULL,NULL,&donetxt,		/* gad render, sel render, gad text */
X    0L,NULL,2,NULL};		/* mutual exclude, special, ID, user data */
Xstruct	StringInfo mystrinfo = {
X    (UBYTE *)InpBuf,
X    (UBYTE *)UndoBuf,
X    0,MAXGADSTR-1,0,0,0,0,	/* initial, max, disp, undo, #chrs, dsp chrs */
X    0,0,NULL,0L,NULL};	/* left,top,layer,longint,keymap */
Xstruct Gadget mystrgad = {
X    NULL,1,1,40,1,	/* next,left,top,width,height */
X    GADGHCOMP|REQGADGET,/* flags */
X    ENDGADGET,STRGADGET,/* activation, type */
X    NULL,NULL,NULL,	/* gad render, sel render, gad text */
X    0L,			/* mutual exclude */
X    (APTR)&mystrinfo,	/* special info */
X    1,NULL};		/* gadget ID, user data */
Xstruct IntuiText mystrtxt= {
X    0,1,JAM2,1,0,	/* front pen, back pen, mode, left, top */
X    &myattr,		/* font */
X    (UBYTE *)Prompt,	/* question to ask */
X    NULL};		/* next text */
Xstruct Requester myrequest = {
X    NULL,0,1,42,2,	/* older requester, left, top, width, height */
X    0,0,&mydonegad,	/* relleft reltop, gadgets */
X    NULL,		/* border */
X    &mystrtxt,		/* text */
X    NULL,1,NULL,	/* flags, back fill pen, layer */
X    {0,0,0,0,0,0,0,0,
X     0,0,0,0,0,0,0,0,
X     0,0,0,0,0,0,0,0,
X     0,0,0,0,0,0,0,0},	/* pad1 */
X    NULL,NULL,		/* image bit map, rquest window */
X    {0,0,0,0,0,0,0,0,0,
X     0,0,0,0,0,0,0,0,0,
X     0,0,0,0,0,0,0,0,0,
X     0,0,0,0,0,0,0,0,0} /* pad2 */
X    };
X
Xint numreqs = 0;		/* number of outstanding requestors */
Xint reqwinup = 0;		/* Requester window is NOT displayed */
Xextern int reqmaxx, reqmaxy, reqmaxlen;	/* Defined in window.c */
Xextern void ReqNewSize();	/* New req window size -- window.c */
Xextern void KillReq();		/* Kill requester window in window.c */	
X
Xstruct ExternalXfer *(ExtXfer[EXTMAX]);	/* Possible external protocol routines */
Xint NumExts = 0;			/* Number of ExtXfers */
X
X/***** menu structures *****/
Xstruct MenuItem FileItem[FILEMAX];
Xstruct IntuiText FileText[FILEMAX];
Xstruct MenuItem ModeItem[MODEMAX+EXTMAX];
Xstruct IntuiText ModeText[MODEMAX+EXTMAX];
Xstruct MenuItem CommItem[COMMAX];
Xstruct IntuiText CommText[COMMAX];
Xstruct MenuItem RSItem[RSMAX];
Xstruct IntuiText RSText[RSMAX];
Xstruct MenuItem ParItem[PARMAX];
Xstruct IntuiText ParText[PARMAX];
Xstruct MenuItem XFItem[XFMAX];
Xstruct IntuiText XFText[XFMAX];
Xstruct MenuItem ScriptItem[SCRIPTMAX];
Xstruct IntuiText ScriptText[SCRIPTMAX];
Xstruct MenuItem UtilItem[UTILMAX];
Xstruct IntuiText UtilText[UTILMAX];
Xstruct Menu menu[MAXMENU];
Xstruct IOExtSer *Read_Request;
Xchar *rs_in;
Xstruct IOExtSer *Write_Request;
Xchar rs_out[2];
Xstruct timerequest Timer;
Xstruct MsgPort *Timer_Port = NULL;
Xstruct timerequest Script_Timer;
Xstruct MsgPort *Script_Timer_Port = NULL;
Xstruct IOAudio Audio_Request;
Xstruct MsgPort *Audio_Port = NULL;
XUBYTE  *BeepWave;
XUBYTE  Audio_AllocMap[4] = { 1, 8, 2, 4 };
Xint x,y,curmode;
Xint Xsize	= 0;	/* From struct TextFont for user's font */
Xint MINX	= 0;
Xint MAXX	= 632;
Xint Ysize	= 0;	/* From struct TextFont for user's font */
Xint MINY	= 14;
Xint MAXY	= 198;
Xint BaseLine	= 0;	/* From struct TextFont for user's font */
Xint top		= 14;
Xint bot		= 198;
Xint savx	= 0;
Xint savy	= 14;
Xint savmode	= 0;
Xint nlmode	= 0;
Xint alt		= 0;
Xint savalt	= 0;
Xint a[2]	= { 0, 0 };
Xint sa[2]	= { 0, 0 };
Xint  inesc	= -1;
Xint  inctrl	= -1;
Xint  private	= 0;
Xint  badseq	= 0;
Xint  maxcol	= 79;
X
X/*************************** defaults *******************************/
Xchar	*p_font		= "topaz";	/* Default font. Name must be < 34 chars */
Xchar	*p_device	= SERIALNAME;	/* Default serial device name to use */
Xint	p_fontsize	= 8;	/* Default vertical font size		*/
Xint	p_baud		= 1200;	/* baud rate				*/
Xint	p_shared	= 1;	/* Open serial device in shared mode	*/
Xint	p_screen	= 0;	/* 0 = WORKBENCH, 1 = CUSTOM		*/
Xint	p_wbcolors	= 1;	/* 0 = Custom, 1 = Workbench colors	*/
Xint	p_interlace	= 2;	/* 0 = no interlace, 1 = interlace, 2 = ASIS */
Xint	p_depth		= 2;	/* number of bit planes (1 or 2)	*/
Xint	p_foreground	= 0x840;	/* default foreground RGB color */
Xint	p_background	= 0x000;	/* default background RGB color */
Xint	p_bold		= 0x000;	/* default BOLD       RGB color */
Xint	p_cursor	= 0x00d;	/* default Cursor	  RGB color */
Xint	p_mouse_up	= 0;	/* 1 = send mouse UP events		*/
Xint	p_mouse_down	= 0;	/* 1 = send mouse DOWN events		*/
Xint	p_lines		= 0;	/* 0 == use all available (MoreRows)	*/
Xint	p_mode		= 0;	/* 0 = image, 1 = CRLF (for kermit)	*/
Xint	p_unit		= 0;	/* unit of serial.device to open	*/
Xint	p_xproto	= 3;	/* 0=ASCII, 1=Xmodem, 2=XmodemCRC, 3 = Kermit */
Xint	p_buffer	= 512;	/* read buffer size (>= 512 bytes)	*/
Xint     p_parity	= 0;	/* 0=none,1=mark,2=space,3=even,4=odd	*/
Xlong	p_break		= 750000;	/* break time (in micro seconds)*/
Xint	p_volume	= 64;	/* beep volume (0 = DisplayBeep)	*/
Xint	p_wrap		= 1;	/* 0 = truncate, 1 = wrap long lines	*/
Xint	p_keyapp	= 0;	/* 0 = numeric, 1 = application keypad	*/
Xint	p_curapp	= 0;	/* 0 = cursor, 1 = application cursor	*/
Xint	p_echo		= 0;	/* 0 = full duplex, 1 = half duplex	*/
Xint	p_bs_del	= 0;	/* 0 = normal, 1 = swap bs and delete	*/
Xint	p_convert	= 0;	/* 1 = convert filenames to lower case	*/
Xint	p_autochop	= 1;	/* 1 = enable xmodem autochop		*/
Xint	p_kmaxpack	= 1000;	/* Max packet size for Kermit xfers	*/
X/*	Must be <= 1000.  <= 94 is standard, > 94 requires a kermit capable
X**	of long packet support. */
Xint	p_xbeep		= 1;	/* 1 = beep at end of xfer		*/
Xchar	p_keyscript	= 0x7E;	/* function key script introducer = ~	*/
Xchar	*p_f[11]	= {	/* function key defaults and mouse prefix */
X    "\033OP","\033OQ","\033OR","\033OS",
X    "f5","f6","f7","f8","f9","f10",
X    "\033M" /* Mouse prefix here */ };
X
Xchar	*p_F[10]     = {	    /* shifted function key defaults	*/
X    "F1","F2","F3","F4","F5",
X    "F6","F7","F8","F9","F10"};
X
Xchar myfontname[FONTNAMESIZE];
Xchar mysername[SERNAMESIZE];
X
X/* for script file */
Xextern char on_string[], wait_string[];
Xint script_on, script_wait;
Xint doing_init = 0;
X
X/******************************************************/
X/*                   Main Program                     */
X/*                                                    */
X/*      This is the main body of the program.         */
X/******************************************************/
X
Xchar lookahead[80];
XFILE *tranr = NULL;
XFILE *trans = NULL;
Xint capture,send;
Xchar XferredFileName[MAXGADSTR];/* Name of last transferred file	*/
Xchar ScriptFileName[MAXGADSTR];	/* Name of last script file		*/
Xchar DirName[MAXGADSTR];	/* Name of last directory		*/
Xstruct MsgPort *mySerPort;
X
X#if AREXX
Xint forwarding = 0;		/* Forwarding received data to AREXX	*/
Xchar *ForwardPortName;		/* Port name to which we forward data	*/
Xstruct RexxMsg *FwdMsg;		/* Message to send			*/
Xchar *extension = "vt100";	/* extension of VT100 AREXX macros	*/
X#endif /* AREXX */
X
Xvoid
Xmain(argc,argv)
Xint	argc;
Xchar	**argv;
X    {
X    ULONG class, waitmask, redo = 0;
X    unsigned int code, qual;
X    SHORT mouse_x, mouse_y, mouse_qual;
X    APTR iaddr;
X#if AREXX
X    struct RexxMsg *RexxMsg;
X    char	fwdchars[256];
X#endif /* AREXX */
X    int KeepGoing,i,la,dola,actual, len;
X    char c,*ptr;
X    char ascstr[100];	/* Area for string returned by toasc() */
X
X    XferredFileName[0] = ScriptFileName[0] = '\0';
X
X    ptr = InitDefaults(argc,argv);
X    InitDevs();
X    InitFileItems();
X    InitCommItems();
X    InitScriptItems();
X    InitUtilItems();
X    InitMenu();
X    SetMenuStrip(mywindow,&menu[0]);
X    PrintIText(mywindow->RPort,&MyTitle,0L,0L);
X
X    MyDir[0]  =	    '\0';
X    StartLock = ((struct Process *) FindTask(NULL))->pr_CurrentDir;
X    CurrentDir(DupLock(StartLock));
X    KeepGoing =	    TRUE;
X    capture   =	    FALSE;
X    send      =	    FALSE;
X    maxcol    =	    MAXX / Xsize;
X    la	      =	    0;
X    x	      =	    MINX ;
X    y	      =	    MINY;
X    curmode   =	    FS_NORMAL;
X    script_on =     FALSE;
X    script_wait=    TRUE;
X    on_string[0] = wait_string[0] = '\0';
X    SetAPen(mywindow->RPort,1L);
X    cursorflip();
X    cursorflip();
X    emit(12);
X    mySerPort = Read_Request->IOSer.io_Message.mn_ReplyPort;
X    SendIO((struct IORequest *)Read_Request);
X
X    /* see if we had a startup script */
X    if (ptr != NULL) script_start(ptr);
X
X    while( KeepGoing ) {
X	/* wait for window message or serial port message */
X	cursorflip();
X	waitmask = (1L << mySerPort->mp_SigBit) |
X		   (1L << mywindow->UserPort->mp_SigBit) |
X		   (1L << Script_Timer_Port->mp_SigBit);
X
X	if(reqwinup)
X	    waitmask |= (1L << reqwindow->UserPort->mp_SigBit);
X
X#if AREXX
X	if(FromRexxPort)
X	    waitmask |= (1L << FromRexxPort->mp_SigBit);
X#endif /* AREXX */
X
X	if (script_wait)	/* if script ready dont wait here */
X	    Wait(waitmask);
X	cursorflip();
X
X	/* do ascii file send */
X	if (send) {
X	    if ((c=getc(trans)) != EOF) {
X		if (c == '\n')
X		    c = '\r';
X		sendchar(c);
X	    } else {
X		    fclose(trans);
X		    InfoMsg1Line("File Sent");
X		    send=FALSE;
X	    }
X	}
X
X	/* see if there are any characters from the host */
X	if (CheckIO((struct IORequest *)Read_Request)) {
X	    register int fwdndx = 0;
X	    struct MsgPort *FwdPort;
X
X	    WaitIO((struct IORequest *)Read_Request);
X	    c = rs_in[0] & (p_parity ? 0x7F : 0xFF);
X#if AREXX
X	    fwdchars[fwdndx++] = c;
X#endif
X	    doremote(c);
X	    if (*on_string || *wait_string)
X		chk_script(c);
X	    if (capture && c != 10) {
X		if (c == 13) c = 10;
X		putc(c , tranr);
X	    }
X	    Read_Request->IOSer.io_Command = SDCMD_QUERY;
X	    DoIO((struct IORequest *)Read_Request);
X	    Read_Request->IOSer.io_Command = CMD_READ;
X	    actual = (int)Read_Request->IOSer.io_Actual;
X	    if (actual > 0) {
X		if (inesc   <  0 &&
X		    inctrl  <  0 &&
X		    a[alt]  == 0 &&
X		    capture == FALSE)
X		    	dola = 1;
X		else
X			dola = 0;
X		Read_Request->IOSer.io_Length =
X		Read_Request->IOSer.io_Actual;
X		DoIO((struct IORequest *)Read_Request);
X		Read_Request->IOSer.io_Length = 1;
X
X		for (i = 0; i < actual; i++) {
X		    c=rs_in[i] & (p_parity ? 0x7f : 0xff);
X#if AREXX
X		    if(fwdndx < 255)
X			fwdchars[fwdndx++] = c;
X#endif
X		    if (*on_string || *wait_string)
X			chk_script(c);
X
X		    if (dola == 1) {
X			if (c >= ' ' && c <= '~' && la < 80)
X			    lookahead[la++] = c;
X			else {
X			    if (la > 0) {
X				emitbatch(la,lookahead);
X				la = 0;
X			    }
X			    doremote(c);
X			    dola = 0;
X			}
X		    } else {
X			doremote(c);
X			if (inesc   <  0 &&
X			    inctrl  <  0 &&
X			    a[alt]  == 0 &&
X			    capture == FALSE)
X				dola = 1;
X			if (capture && c != 10) {
X			    if (c == 13) c = 10;
X			    putc(c , tranr);
X			}
X		    }
X		}
X
X		/* dump anything left in the lookahead buffer */
X		if (la > 0) {
X		    emitbatch(la,lookahead);
X		    la = 0;
X		}
X	    }
X#if AREXX
X	    if(forwarding && fwdndx) {
X		fwdchars[fwdndx] = '\0';
X		Forbid();
X		/*   Since forwarding is set we can assume that the AREXX
X		** library is available.  This is assured in cmd_fwd() in
X		** script.c
X		**/
X		if( ((FwdPort = FindPort(ForwardPortName)) != NULL)
X		 && (FwdMsg = CreateRexxMsg(FromRexxPort, extension, HostName))
X		 && (ARG0(FwdMsg) = (STRPTR)CreateArgstring(fwdchars, (LONG)fwdndx)) ) {
X		    ARG1(FwdMsg) = (STRPTR)1;
X		    FwdMsg->rm_Action = RXCOMM;
X		    PutMsg(FwdPort, (struct Message *)FwdMsg);
X		    RexxReplies++;
X		}
X		Permit();
X	    }
X#endif /* AREXX */
X	    SendIO((struct IORequest *)Read_Request);
X 	}
X
X	while((NewMessage =
X		(struct IntuiMessage *)GetMsg(mywindow->UserPort))
X			!= FALSE) {
X
X	    class = NewMessage->Class;
X	    code = NewMessage->Code;
X	    qual = NewMessage->Qualifier;
X	    mouse_x = NewMessage->MouseX;
X	    mouse_y = NewMessage->MouseY;
X	    if(class == RAWKEY)
X		iaddr = *((APTR *)NewMessage->IAddress);
X	    else
X		ReplyMsg((struct Message *)NewMessage);
X	    switch( class ) {
X	    case CLOSEWINDOW:
X		KeepGoing = FALSE;
X		break;
X
X	    case RAWKEY:
X		len = toasc(&(ascstr[0]), code,qual, 100, iaddr, 0);
X		ReplyMsg((struct Msg *)NewMessage);
X		if (p_echo) {
X		    ptr = &(ascstr[0]);
X		    for(i = 0; i < len; i++)
X			doremote(*(ptr++));
X		}
X		break;
X
X	    case NEWSIZE:
X		emit(12);
X		break;
X
X	    case MENUPICK:
X		while(code != MENUNULL) {
X		    struct MenuItem *Item =
X			ItemAddress(mywindow->MenuStrip, (long)code);
X		    unsigned int newcode =
X			(Item ? Item->NextSelect : code);
X
X		    redo |= handle_menupick(class,code);
X		    if(code == newcode)
X			code = MENUNULL;
X		    else
X			code = newcode;
X		}
X		if(redo & REDOFILE)
X		    redofile();
X		if(redo & REDOCOMM)
X		    redocomm();
X		if(redo & REDOUTIL)
X		    redoutil();
X		redo = 0;
X		break;
X
X	    case MOUSEBUTTONS:
X		if((p_mouse_down && (code == SELECTDOWN))
X		|| (p_mouse_up   && (code == SELECTUP)) ) {
X		    mouse_qual = 0;
X		    if (qual & IEQUALIFIER_CONTROL)
X			mouse_qual |= 1;
X		    if (qual & (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT))
X			mouse_qual |= 2;
X		    if (qual & (IEQUALIFIER_LALT | IEQUALIFIER_RALT))
X			mouse_qual |= 4;
X		    if (qual & (IEQUALIFIER_CAPSLOCK))
X			mouse_qual |= 8;
X		    mouse_qual |= (code == SELECTDOWN) ? 16 : 32;
X
X		    sendstring(p_f[10]);
X		    sendchar(mouse_qual + '@');
X		    sendchar(' ' + ((mouse_x - MINX) / 8),10);  /* column */
X		    sendchar(' ' + ((mouse_y - MINY + 6 ) / 8),10);/* row */
X		}
X		break;
X
X	    default:
X		PrintIText(mywindow->RPort,&MyTitle,0L,0L);
X		break;
X	    }   /* end of switch (class) */
X	}   /* end of while ( newmessage )*/
X
X	if (!script_wait ||
X	   (CheckIO((struct IORequest *)&Script_Timer) &&
X	    script_wait == WAIT_TIMER))
X		do_script_cmd(NEXTCOMMAND);
X
X	while( reqwinup && ((NewMessage = (struct IntuiMessage *)
X				  GetMsg(reqwindow->UserPort)) != FALSE)
X	     ) {
X	    class = NewMessage->Class;
X	    ReplyMsg((struct Msg *)NewMessage);
X	    switch( class ) {
X	    case REQCLEAR:
X		numreqs = 0;
X		break;
X
X	    case CLOSEWINDOW:
X		KillReq(); /* Kills requester window, set reqwinup = 0 */
X		break;
X
X	    case NEWSIZE:
X		ReqNewSize(reqwindow->Height, reqwindow->Width);
X		break;
X	    }   /* end of switch (class) */
X	} /* end while reqwinup */
X#if AREXX
X	while(FromRexxPort && (RexxMsg = (struct RexxMsg *)GetMsg(FromRexxPort)) != NULL) {
X	    processrexxmsg(RexxMsg);
X	}
X#endif /* AREXX */
X    }  /* end while ( keepgoing ) */
X
X    /*   It must be time to quit, so we have to clean
X    **   up and exit.
X    */
X
X    if(!CheckIO((struct IORequest *)Read_Request))
X	AbortIO((struct IORequest *)Read_Request);
X    Wait (1L <<mySerPort->mp_SigBit);
X    WaitIO((struct IORequest *)Read_Request);
X    cleanup("",0);
X
X} /* end of main */
X
X/* cleanup code */
Xvoid
Xcleanup(reason, fault)
Xchar *reason;
Xint fault;
X{
X    extern struct Device *ConsoleDevice;	/* In init.c */
X    extern struct IOStdReq ConReq;		/* In init.c */
X    int i;
X
X    switch(fault) {
X    case 0:		/* quitting close everything */
X	KillReq();	/* Kill the requester and its window */
X	ClearMenuStrip( mywindow );
X	CloseDevice((struct IORequest *)&Audio_Request);
X	UnLock(CurrentDir(StartLock));	/* back to original directory */
X
X    case 8:		/* error opening audio */
X	DeletePort(Audio_Port);
X	FreeMem(BeepWave,BEEPSIZE);
X	CloseDevice((struct IORequest *)&Timer);
X
X    case 7:		/* error opening timer */
X	DeletePort(Timer_Port);
X	CloseDevice((struct IORequest *)&Script_Timer);
X	DeletePort(Script_Timer_Port);
X
X/*	case 6: */	/* error opening write device is unused */
X	DeletePort(Write_Request->IOSer.io_Message.mn_ReplyPort);
X	FreeMem(Write_Request,(long)sizeof(*Write_Request));
X	CloseDevice((struct IORequest *)Read_Request);
X
X    case 5:		/* error opening read device */
X	DeletePort(Read_Request->IOSer.io_Message.mn_ReplyPort);
X	FreeMem(Read_Request,(long)sizeof(*Read_Request));
X
X    case 4:		/* error opening window */
X	if (ConsoleDevice != NULL)
X	    CloseDevice(&ConReq);
X	if (myfont   != NULL)
X	    CloseFont( myfont );
X	if (mywindow != NULL)
X	    CloseWindow( mywindow );
X	if (p_screen && myscreen) {
X	    struct Process *mproc;
X
X	    mproc = (struct Process *)FindTask(0L);
X	    mproc->pr_WindowPtr = OrigWindowPtr;
X	    CloseScreen( myscreen );
X	}
X	for(i = 0; i < NumExts; i++) {
X	    struct ExternalXfer *xfer = ExtXfer[i];
X
X	    FreeMem(xfer->dispname, (long)(strlen(xfer->dispname)+1));
X	    FreeMem(xfer->downname, (long)(strlen(xfer->downname)+1));
X	    FreeMem(xfer->send, (long)(strlen(xfer->send)+1));
X	    FreeMem(xfer->receive, (long)(strlen(xfer->receive)+1));
X	    FreeMem(xfer, (long)sizeof(struct ExternalXfer));
X	}	    
X
X    case 3:		/* error opening screen */
X    case 2:		/* error opening graphics library */
X	if(GfxBase)
X	    CloseLibrary((struct Library *)GfxBase);
X	if(DiskfontBase)
X	    CloseLibrary(DiskfontBase);
X    case 1:		/* error opening intuition */
X	if(IntuitionBase)
X	    CloseLibrary((struct Library *)IntuitionBase);
X    default:
X	if (*reason) puts (reason);
X    }
X
X#if AREXX
X    if(HostName)
X	FreeMem(HostName, (LONG)(strlen(HostName)+1));
X
X    if(FromRexxPort) {
X	RemPort(FromRexxPort);
X	FreePort(FromRexxPort);
X	FreeMem(FromRexxPort, (LONG)sizeof(struct MsgPort));
X    }
X    if(RexxSysBase)
X	CloseLibrary((struct Library *)RexxSysBase);
X#endif /* AREXX */
X    exit(fault);
X}
X
Xdo_capture(file)
Xchar *file;
X{
X    if (capture == TRUE) {
X	capture=FALSE;
X	fclose(tranr);
X	InfoMsg1Line("End File Capture");
X    } else {
X	if (file == NULL || *file == '\0') {
X	    req("Ascii Capture:",XferredFileName,1);
X	} else
X	    strcpy(XferredFileName, file);
X	if ((tranr=fopen(XferredFileName,"w")) == 0) {
X	    capture=FALSE;
X	    InfoMsg2Line("Error Opening File:", XferredFileName);
X	    return(FALSE);
X	}
X	capture=TRUE;
X    }
X    redofile();
X}
X
Xdo_send(file)
Xchar *file;
X{
X    if (send == TRUE) {
X	send=FALSE;
X	fclose(trans);
X	InfoMsg1Line("File Send Cancelled");
X    } else {
X	if (file == NULL || *file == '\0') {
X	    req("Ascii Send:", XferredFileName, 1);
X	} else
X	    strcpy(XferredFileName, file);
X	if ((trans=fopen(XferredFileName, "r")) == 0) {
X	    send=FALSE;
X	    InfoMsg2Line("Error Opening File:", XferredFileName);
X	    return(FALSE);
X	}
X	send=TRUE;
X    }
X}
X
Xvoid setparams()
X{
X    Read_Request->IOSer.io_Command =
X	Write_Request->IOSer.io_Command =
X	    SDCMD_SETPARAMS;
X    DoIO((struct IORequest *)Read_Request);
X    DoIO((struct IORequest *)Write_Request);
X    Read_Request->IOSer.io_Command = CMD_READ;
X    SendIO((struct IORequest *)Read_Request);
X    Write_Request->IOSer.io_Command = CMD_WRITE;
X}
X
Xvoid hangup ()
X    {
X    if(!CheckIO((struct IORequest *)Read_Request))
X	AbortIO((struct IORequest *)Read_Request);
X    Wait (1L <<mySerPort->mp_SigBit);
X    WaitIO((struct IORequest *)Read_Request);
X    CloseDevice((struct IORequest *)Read_Request);
X    Timer.tr_time.tv_secs=0L;
X    Timer.tr_time.tv_micro=750000L;
X    DoIO((struct IORequest *)&Timer.tr_node);
X    OpenDevice(mysername, (LONG)p_unit, (struct IORequest *)Read_Request, NULL);
X    setparams();
X}
X
Xvoid redocomm() {
X    ClearMenuStrip( mywindow );         /* Remove old menu */
X    InitCommItems();                    /* Re-do comm menu   */
X    SetMenuStrip(mywindow,&menu[0]);    /* Re-display the menu */
X}
X
Xvoid redofile() {
X    ClearMenuStrip( mywindow );         /* Remove old menu */
X    InitFileItems();                    /* Re-do file menu   */
X    SetMenuStrip(mywindow,&menu[0]);    /* Re-display the menu */
X}
X
Xvoid setserbaud(baud, redomenu)
Xint baud;
XLONG redomenu;
X{
X    if(!CheckIO((struct IORequest *)Read_Request))
X	AbortIO((struct IORequest *)Read_Request);
X    Wait (1L <<mySerPort->mp_SigBit);
X    WaitIO((struct IORequest *)Read_Request);
X    Write_Request->io_Baud = Read_Request->io_Baud = baud;
X    setparams();
X    p_baud = baud;
X    if (redomenu)
X	redocomm();
X}
X
Xvoid redoutil() {
X    ClearMenuStrip(mywindow);
X    InitUtilItems();
X    SetMenuStrip(mywindow,&menu[0]);
X}
X
XULONG handle_menupick(class, code)
XULONG class;
Xunsigned int code;
X{
X    unsigned int menunum, itemnum, subnum, i;
X    int nxfer;
X    unsigned long retval = 0;
X
X    if (code == MENUNULL)
X	return retval;
X
X    menunum = MENUNUM( code );
X    itemnum = ITEMNUM( code );
X    subnum  = SUBNUM( code );
X    switch( menunum ) {
X    case 0:
X	switch( itemnum ) {
X	case 0:	/* menunum case 0 itemnum case 0 -- Set xfer mode */
X	    switch( subnum ) {
X	    case 0:	/* Ascii */
X	    case 1:	/* Xmodem */
X	    case 2:	/* XmodemCRC */
X	    case 3:	/* Kermit */
X		i = subnum;
X		break;
X	    default:
X		nxfer = MODEMAX + NumExts - 1;
X		if(subnum > nxfer)
X		    i = MODEMAX-1;
X		else
X		    i = subnum;
X	    }
X	    p_xproto = i;
X	    retval |= REDOFILE;
X	    break;
X
X	case 1:	/* menunum case 0 itemnum case 1 -- Send a file */
X	    cmd_sendf(XferredFileName);
X	    break;
X
X	case 2:	/* menunum case 0 itemnum case 2 -- Receive a file */
X	    cmd_recf(XferredFileName);
X	    break;
X
X	case 3:	/* menunum case 0 itemnum case 3 -- Kermit GET */
X	    cmd_kg(XferredFileName);
X	    break;
X
X	case 4:	/* menunum case 0 itemnum case 4 -- Kermit BYE */
X	    saybye();
X	    break;
X	case 5: /* menunum case 0 itemnum case 5 -- ASCII capture */
X	    do_capture(XferredFileName);
X	    break;
X	} /* End of itemnum switch for menunum case 0 */
X	break;
X
X    case 1:		/* menunum case 1 - Comm Setup */
X	switch( itemnum ) {
X	case 0:	/* Baud */
X	    switch( subnum ) {
X	    case 0:
X		setserbaud(300, FALSE);
X		break;
X
X	    case 1:
X		setserbaud(1200, FALSE);
X		break;
X
X	    case 2:
X		setserbaud(2400, FALSE);
X		break;
X
X	    case 3:
X		setserbaud(4800, FALSE);
X		break;
X
X	    case 4:
X		setserbaud(9600, FALSE);
X		break;
X	    } /* End of subnum switch for itemnum 0 of menunum 1 */
X	    break;
X
X	case 1:    /* menunum case 1 itemnum 1 -- Set  Parity */
X	    p_parity = subnum;
X	    break;
X
X	case 2:    /* menunum case 1 itemnum 2 -- set transfer mode */
X	    switch(subnum) {
X	    case 0:
X	    case 1:
X		p_mode = subnum;
X		break;
X	    case 2:
X		if (p_convert)
X		    p_convert = 0;
X		else
X		    p_convert = 1;
X		break;
X	    case 3:
X		if(p_autochop)
X		    p_autochop = 0;
X		else
X		    p_autochop = 1;
X		break;
X	    }
X	    retval |= REDOCOMM;
X	    break;
X	case 3:   /* menunum case 1 itemnum 3 -- Shared */
X	    {
X		char onoff[4];
X
X		if(p_shared)
X		    strcpy(onoff, "off");
X		else
X		    strcpy(onoff, "on");
X		cmd_share(onoff);
X	    }
X	    break;
X	}
X	break;	/* End of menunum case 1 */
X
X    case 2:	/* menunum case 2 - Script */
X	switch( itemnum ) {
X	case 0:			/* Execute macro	*/
X	case 1:			/* Abort macro		*/
X	    if (!itemnum && !script_on) {
X		req("Script file name:", ScriptFileName, 1);
X		script_start(ScriptFileName);
X	    }
X	    if (itemnum && script_on)
X		exit_script();
X	    break;
X	case 2: {			/* AREXX macro		*/
X
X		req("AREXX macro and args:", ScriptFileName, 1);
X		cmd_rx(ScriptFileName);
X		break;
X	    }
X	}
X	break;
X
X    case 3:	/* menunum case 3 -- Utility */
X	switch( itemnum ) {
X	case 0:
X	    sendbreak();
X	    break;
X
X	case 1:	/* menunum case 3 itemnum case 1 -- Hang Up */
X	    hangup();
X	    break;
X
X	case 2:	/* menunum case 3 itemnum case 2 -- Cd */
X	    strcpy(DirName, MyDir);
X	    req("Directory:", DirName, 1);
X	    set_dir(DirName);
X	    break;
X
X	case 3:	/* menunum case 3 itemnum case 3 -- Clear Screen */
X	    top = MINY; bot = MAXY; savx = MINX; savy = MINY;
X	    curmode = FS_NORMAL; inesc = -1;
X	    a[0] = 0; a[1] = 0; sa[0] = 0; sa[1] = 0;
X	    retval |= REDOUTIL;
X	    emit(12);
X	    break;
X
X	case 4:	/* menunum case 3 itemnum case 4 -- Echo mode */
X	    if (p_echo)
X		p_echo = 0;
X	    else
X		p_echo = 1;
X	    retval |= REDOUTIL;
X	    break;
X
X	case 5:	/* menunum case 3 itemnum case 5 -- Wrap mode */
X	    if (p_wrap)
X		p_wrap = 0;
X	    else
X		p_wrap = 1;
X	    retval |= REDOUTIL;
X	    break;
X
X	case 6:	/* menunum case 3 itemnum case 6 -- NumKey */
X	    if (p_keyapp)
X		p_keyapp = 0;
X	    else
X		p_keyapp = 1;
X	    retval |= REDOUTIL;
X	    break;
X
X	case 7:	/* menunum case 3 itemnum case 7 -- App Cur */
X	    if (p_curapp)
X		p_curapp = 0;
X	    else
X		p_curapp = 1;
X	    retval |= REDOUTIL;
X	    break;
X
X	case 8:	/* menunum case 3 itemnum case 8 -- BS <-> DEL */
X	    swap_bs_del();
X	    retval |= REDOUTIL;
X	    break;
X
X	case 9:	/* menunum case 3 itemnum case 9 -- Xfer Beep */
X	    if(p_xbeep)
X		p_xbeep = 0;
X	    else
X		p_xbeep = 1;
X	    retval |= REDOUTIL;
X	    break;
X
X	case 10: /* menunum case 3 itemnum case 10 - Mouse Up */
X	    if(p_mouse_up)
X		p_mouse_up = 0;
X	    else
X		p_mouse_up = 1;
X	    retval |= REDOUTIL;
X	    break;
X
X	case 11: /* menunum case 3 itemnum case 11 - Mouse Down */
X	    if(p_mouse_down)
X		p_mouse_down = 0;
X	    else
X		p_mouse_down = 1;
X	    retval |= REDOUTIL;
X	    break;
X	}
X
X    break;
X    } /* end of switch ( menunum ) */
X    return retval;
X}
SHAR_EOF
echo "extracting vt100.doc"
sed 's/^X//' << \SHAR_EOF > vt100.doc
XThis is the documentation file for the VT100 terminal emulator originally
Xby Dave Wecker.  Versions 2.7-2.9 are by Tony Sumrall.  I can be reached
Xon USENET => acs@amdahl.com
X
XDave can be reached via:
X
X	Dave Wecker at	ENET:	COOKIE::WECKER
X			ARPA:	wecker%cookie.dec.com@decwrl.dec.com
X			USENET:	{decvax|decwrl}!cookie.dec.com!wecker
X			SNAIL:	Dave Wecker
X				115 Palm Springs Drive
X				Colorado Springs, CO  80908
X
XNote that Dave had NOTHING to do with this release.  Don't bother him with
Xproblem in my code.
X
X
XMANY pieces of code/suggestions have been sent in..
X
X	thanks to all!
X
XProgram startup:
X----------------
X	1> vt100 [-i | +i initfile] [ scriptfile ... ]
X
X                - -i option means don't look for an init file; +i means
X                  look for an init file of this name.  The search for the
X                  init file will be the current directory then S:.  Of
X                  course you can always override this by saying C:file if
X                  you like.  The format for the init file is described
X                  later in this document.
X
X		- The init file controls the setting of initial defaults
X		  and screen and macro definitions.
X
X		- If none of the files (listed above) are found, the
X		  built-in defaults (defined in VT100.C as variables,
X		  beginning with "p_") are used.
X
X		- All commands are either menu or script based. Scripts
X		  are described below.
X
XMenus (Commands in parenthesis are default keyboard bindings: Right-Amiga-chr):
X-----------------------------------------------------------------------
XFile				- file transfers
X	Protocol		- Sets the protocol to be used for send/rec.
X		ASCII		- use uncontrolled protocol
X		Xmodem	(A-X)	- use the ever-popular Xmodem Checksum
X		XmodemCRC	- use the in demand Xmodem CRC
X		Kermit	(A-K)	- my favorite protocol
X		.
X		.		- externally defined transfer programs
X		.
X	Send		(A-^)	- Send a file using the selected protocol
X	Receive		(A-V)	- Receive a file as above
X	Kermit Get	(A-G)	- Get files from a kermit server
X	Kermit Bye	(A-B)	- Finish with the kermit server.
X	Capture			- Log received text to a file.  Changes to
X				  Capturing when in progress
XComm Setup			- Setup communications
X	Baud Rate		- Set the terminal baud rate
X		300
X		1200	(A-L)
X		2400	(A-H)
X		4800
X		9600
X	Parity			- Type of parity
X		NONE	(A-X)
X		MARK
X		SPACE
X		EVEN	(A-E)
X		ODD	(A-O)
X	Xfer Mode
X		Image	(A-I)	- Send files verbatim (for UNIX hosts or
X				  binary files)
X		Text	(A-T)	- Send CR LF as line terminator and strip
X				  CR on received files (VMS text).
X		Convert		- Should KERMIT convert fnames to lower case
X		AutoChop	- Enable/disable AutoChop on XMODEM xfers
X	Shared			- Causes VT100 to use the serial port in shared
X				  mode (see description of the Shared script
X				  command).
X	AutoChop		- Does autochop of XMODEM received files.
XScript				- Script commands
X	Execute Macro	(A-M)	- Start up an asynchronous script file
X	Abort Execution	(A-A)	- Terminate a script file
X	AREXX Macro		- Send a command to AREXX for execution
XUtility			- Utility commands
X	Send Break	(A-.)	- send a break to the host
X	Hang Up			- close line (not implemented yet)
X	Change Dir	(A-D)	- change the local directory (for transfers)
X	Clear Scrn		- clear the screen (initial state)
X	Echo			- turn on/off half duplex mode
X	Wrap		(A-W)	- turn on/off long line wrapping mode
X	Num Key		(A-K)	- turn on/off numeric keypad mode
X	App Cur		(A-C)	- turn on/off application cursor mode
X	BS<->DEL		- swap backspace and delete keys
X	Mouse Up		- send mouse UP events
X	Mouse Dn		- send mouse DOWN events
X
XKeypad mapping (in application keypad mode):
X--------------------------------------------
X
X		AMIGA		VT100		comments
X		-------		-------		---------------------------
X		0-9	==	0-9
X		.	==	.
X		ENTER	==	ENTER		(basically, flip the bottom
X		-	==	,		 2 keys up to get a VT100)
X		HELP	==	-		(only free key around)
X		f1-f4	==	PF1-PF4		(or any rebinding you do)
X		arrows	==	arrows
X
XNote:	If you own an A500 or an A2000 and you use a "good" keymap the
X	top 4 keys of the keypad will function as the VT100 F1-F4.  This
X	that you can use the Amiga's F1-F4 for your own use and still have
X	the ability to generate the VT100 PF1-PF4.
X
X	Right AMIGA key in conjunction with a period (".") will send a
X	break to the host.
X
X	CTRL in conjunction with an at-sign ("@") a two ("2") or a
X	space (" ") will send a NULL to the host.
X
X	CTRL in conjunction with a six  ("6") will send a CTRL-^
X	CTRL in conjunction with a dash ("-") or question mark ("?")
X		will send a CTRL-_ to the host.
X
XMulti file Xfers:
X-----------------
XThe VT100 emulator supports multiple file transfers. This is
Xspecified by using a comma (",") between file names when using XMODEM
Xor KERMIT. (NOTE: host XMODEM's normally CANNOT support multiple file
Xtransfers).
X
XWhen specifying a file name to recieve by default the directory path is
Xstripped off of the filename when sent to the host but is kept for the
Xlocal file spec. eg:
X
X        receive file: ram:file.txt,df1:newfile.bin,$
X
Xwill ask the server for file.txt and put it in ram:, and get newfile.bin
Xand put it on df1: (see explanation of "$" below). If you do a single file
Xtransfer you will get another prompt for the remote name e.g.:
X
X        receive file: ram:file.txt
X        remote file name [file.txt]:  userdisk1:wantfile.txt
X
XThe same rules apply to sending multiple files therefore if you are doing
Xmulti file transfers make sure the host server is connected to the desired
Xdirectory.
X
XIn addition KERMIT supports wildcards:
X    * = any number of characters
X    ? = any single character
XExamples:
X	send:	*.c,*.h,*.doc
X	get:	*.c,*.h,$
X
XNote that in this release, wilcarded files may be sent to a KERMIT that is
X*not* in server mode (e.g. you can say "RECEIVE" to the host KERMIT and
Xsend *.c files successfully).
X
XKERMIT receive is now smart enough to use the host filename so no
Xfilename needs to be specified on the AMIGA's side (see the CONVERT option).
X
XIf your host is capable of sending or receiving long packets (packets in
Xexcess of 94 bytes) you may set p_kmaxpack to some number <= 1000.  The
Xscript command KMAXPACK can accomplish the same result.
X
XInitialization and Script file operation:
X-----------------------------------------
XAn initialization file (as described in the "Program Startup" section) may
Xcontain any of the commands shown below that have the word INIT in their
Xdescription below. Commands that are available from scripts have the word
XSCRIPT in the descriptions below. All commands may be abbreviated to 3
Xletters and are case insensitive.
X
XThe script file can be invoked by selecting 'execute file' from the script
Xmenu. At any time you can abort the script file by selecting 'Abort
XExecution'. You may also invoke a script from a function key if the first
Xcharacter of the function key definition is the KEYSCRIPT character (e.g.,
Xdefine F5 as "~df1:foo.script").
X
XDuring the time script file is running the terminal emulation is still
Xactive and you may type simulataneous to the script file. This may be
Xdesired if your script file is WAITing for a string or is DELAYing for a
Xperiod of time etc.
X
XAREXX support:
X--------------
XAREXX is supported in this release.  If an unknown command is entered and
XVT100 can successfully communicate with AREXX then VT100 will automatically
Xforward the unknown command to AREXX for execution -- AREXX will follow its
Xnormal search order.
X
XThe host name (address() in AREXX parlance) is composed of the characters
XVT100-, the name of the serial device used (i.e.  the value specified on the
XDEVICE command or the value of p_device) and the unit number (i.e. the value
Xspecified on the UNIT command or the value of p_unit).  For an unmodified
Xsystem using the serial device distributed with Workbench the hostname would
Xbe "VT100-serial.device-00".
X
XWhen you invoke an AREXX macro, AREXX will automatically search for a file
Xwhose name ends in .vt100.  For example, if you enter FOO and have an AREXX
Xmacro present named FOO.vt100, AREXX will execute it on VT100's (and your)
Xbehalf.
X
XIf for some reason a path to AREXX cannot be established on startup, VT100 will
XNOT attempt to send unknown commands to AREXX.  The user can force a retry by
Xusing the RX command or the RX menu item.
X
XAll AREXX macros run by VT100 run asynchronously with other work including
Xscripts and other AREXX macros.  Be aware of this -- you could surprise
Xyourself!
X
XThe is one special command, FORWARD, which can only be used by issuing it from
Xan AREXX macro.  This command allows an AREXX user to request that all data
Xreceived from the serial port be forwarded to a port for inspection.  Heavy use
Xof this facility will cause VT100 to slow down considerably!  Use it with
Xcaution!  This command does, however, provide some substantial benefits.  Most
Xnotable amongst those are the ability to effectively write a multi-way ON
Xcommand.  See the sample AREXX macros packaged with the distribution.
X
XScript commands will return a return code to the invoking AREXX script.  AREXX
Xautomatically places this value into the special variable RC.  The values
Xreturned are listed in vt100.h and are explained here:
XCMDOK	- Command executed OK
XCMDWARN	- Command issued a WARNING message but completed in some fashion
XCMDBS	- Command is invalid for current state (e.g. INIT only)
XCMDNF	- Command not found (i.e. invalid command)
XCMDFAIL	- Command failed completely.
X
XInitialization and Script file Commands:
X----------------------------------------
X#	Commented line					(INIT,SCRIPT)
X    Format:
X	# This line is a comment
X--------------------------------------------------------------------------
XAPPCUR	Set the application cursor mode			(INIT,SCRIPT)
X    Format:
X	APPCUR	ON/OFF or YES/NO
X--------------------------------------------------------------------------
XASCII_SEND Send an ascii file to the host.		(SCRIPT)
X    Format:
X	(same format as CAPTURE)
X--------------------------------------------------------------------------
XAUTOCHOP Enable/disable XMODEM auto-chop		(INIT, SCRIPT)
X    Format:
X	AUTOCHOP	ON/OFF or YES/NO
X--------------------------------------------------------------------------
XBACKGROUND Define a background color			(INIT)
X    Format:
X	BACKGROUND hex		three digit hex number
X    Example:
X	BACKGROUND F00		bright red background
X--------------------------------------------------------------------------
XBAUD	Set baud rate					(INIT,SCRIPT)
X    Format:
X	BAUD rate		Sets the baud rate for send/receive
X    Example:
X	BAUD 2400		Sets the baud rate at 2400 baud
X--------------------------------------------------------------------------
XBEEP	Beep at the console				(SCRIPT)
X    Format:
X	BEEP
X--------------------------------------------------------------------------
XBOLD	Define a color for bold				(INIT)
X    Format:
X	(same as BACKGROUND)
X--------------------------------------------------------------------------
XBREAK	Set the break time (for an SB command)		(INIT,SCRIPT)
X    Format:
X	BREAK value		Value is in micro-seconds
X    Example:
X	BREAK 750000
X--------------------------------------------------------------------------
XBUFFER	Set transmission buffer size			(INIT)
X    Format:
X	BUFFER n		Number of bytes to buffer
X    Example:
X	BUFFER 512
X--------------------------------------------------------------------------
XCAPTURE	To start/stop ascii file capture.		(SCRIPT)
X    Format:
X	CAPTURE	file		Start ascii capturing
X	CAPTURE			End ascii capturing
X--------------------------------------------------------------------------
XCD	To change the local directory			(SCRIPT)
X    Format:
X	CD	newdir		set a new directory for file transfers
X    Example:
X	CD	DF1:foo/bar	set the directory as specified
X--------------------------------------------------------------------------
XCONVERT	Tell KERMIT whether or not to convert filenames	(INIT,SCRIPT)
X    Format:
X	CONVERT	ON/OFF or YES/NO
X    Example:
X	CONVERT	ON		Filenames will be down cased
X--------------------------------------------------------------------------
XCURSOR	Define a color for the cursor			(INIT)
X    Format:
X	(same as BACKGROUND)
X--------------------------------------------------------------------------
XDELAY	Suspends script file for a specified time	(SCRIPT)
X    Format:
X	DELAY	n		Suspends execution for n seconds
X    Example:
X	DELAY	2		Suspends for 2 seconds
X--------------------------------------------------------------------------
XDEPTH	Define the depth of the window/screen		(INIT)
X    Format:
X	DEPTH n		Number of planes in window/screen
X    Example:
X	DEPTH 1		Minimum depth
X	DEPTH 2		Same as Workbench
X--------------------------------------------------------------------------
XDEVICE	Define name of serial device handler to use	(INIT)
X    Format:
X	DEVICE name	Sets name of serial device handler to name
X    Example:
X	DEVICE newser.device	Set name of serial device handler to
X				newser.device
X	DEVICE serial.device	Set name of serial device handler to the
X				"default" (i.e. the C-A supplied device)
X--------------------------------------------------------------------------
XDISPLAY	Display data on the screen			(SCRIPT)
X    Format:
X	DISPLAY string	Displays string on the screen as though received from
X			the serial port (including escape sequence handling)
X    Example:
X	DISPLAY ^M		Causes VT100 to act as though a carriage-return
X				were received over the serial port.
X	DISPLAY "^[[M"		Deletes the current line on the screen.
X	DISPLAY "Move^[[Aup one line"	Displays "Move" on the current line on
X				the screen then moves the cursor up one line
X				displays "up one line".
X--------------------------------------------------------------------------
XECHO	Turn on/off local echo				(INIT,SCRIPT)
X    Format:
X	ECHO	ON/OFF or YES/NO
X    Example:
X	ECHO	ON		Half duplex mode
X--------------------------------------------------------------------------
XEXIT	Ends execution of the current script file.	(INIT,SCRIPT)
X    Format:
X	EXIT			Exit the current script/init file
X	EXIT VT100		Exit vt100 program (from SCRIPT only)
X	EXIT newscript		Exit this file and start up newscript
X    Example:
X	EXIT DF1:FOO.BAR	Exit the current file and start FOO.BAR
X--------------------------------------------------------------------------
XEXTERNAL	Define external transfer program	(INIT,SCRIPT)
X    Format:
X	EXTERNAL "mode-name" "send-pgm" "receive-pgm"
X				Send-pgm and receive-pgm may contain the strings
X				@LOCAL and @REMOTE which will cause VT100 to put
X				up a requester asking for local and/or remote
X				filenames.  These will be substituted in place
X				of their respective parameters in the send-pgm
X				and/or receive-pgm prior to invoking it/them.
X				See also the description of the SHARE command.
X    Examples:
X	EXTERNAL "FOO" "foo baz" "baz foo"
X				Define external transfer program which will
X				be called FOO in the MODE menu.  Invoke foo
X				passing baz to SEND files, invoke baz passing
X				foo to RECEIVE files.
X	EXTERNAL "FOO" "foo @REMOTE baz" "baz @LOCAL @REMOTE foo"
X				As above but display a requester for the remote
X				filename (in the case of send) or both the
X				local and remote filenames (in the case of
X				receive).  The name(s) used to satisfy the
X				requester(s) will be replaced in the parameter
X				string to the appropriate program prior to
X				its invocation.
X	EXTERNAL FOO		Remove definition of transfer pgm FOO
X--------------------------------------------------------------------------
XF	Define a function key or the mouse prefix	(INIT,SCRIPT)
X    Format:
X	F n string		Define Function key n to be string
X	F M string		Define the mouse prefix (the prefix sent to
X				the host when a mouse button is used AND
X				events are selected via the MOUSE command
X    Example:	(see SEND for string format)
X	F 1 "dir^M"		Define F1 is the string dir<cr>
X	F 11 "help"		Define Shifted F1 as the string help
X	F 20 ^C			Define Shifted F10 as a control-C
X	F M "^[O"		Send ESC-O before mouse data
X--------------------------------------------------------------------------
XFONT Specify font to use				(INIT)
X    Format:
X	FONT font-name
X    Example:
X	FONT point-font
X--------------------------------------------------------------------------
XFONTSIZE Specify font size to use			(INIT)
X    Format:
X	FONTSIZE font-size
X    Example:
X	FONTSIZE 8
X--------------------------------------------------------------------------
XFOREGROUND Define a color for the foreground		(INIT)
X    Format:
X	(same as BACKGROUND)
X--------------------------------------------------------------------------
XFORWARD Forward received data to an AREXX port		(REXXONLY)
X    Format:
X	FORWARD portname
X    Example:
X	FORWARD REXX-VT100	Sends received data to a port named
X				REXX-VT100.  This command can (and probably
X				WILL) cause you to GURU if you remove the
X				port before you tell VT100 to quit
X				forwarding data.
X	FORWARD			Tells VT100 to quit forwarding data
X--------------------------------------------------------------------------
XGOTO	Jumps to a different part of the script file.	(SCRIPT,NONREXX)
X    Format:
X	GOTO label		Jumps to a line beginning with label:.
X				Jumps may be forward or backward.
X    Example:
X	FOO:			Sets up a label
X	...
X	GOTO FOO		Jumps to FOO
X--------------------------------------------------------------------------
XINTERLACE Turn on/off interlace				(INIT)
X    Format:
X	INTERLACE ON/OFF or YES/NO or ASIS
X    Example:
X	INTERLACE ON		Use interlacing
X	INTERLACE ASIS		Use interlace if WBSCREEN uses it
X--------------------------------------------------------------------------
XKB	Send a BYE packet to a host KERMIT server.	(SCRIPT)
X    Format:
X	KB			Shut down server.
X--------------------------------------------------------------------------
XKEYSCRIPT Define a new keyscript character		(INIT,SCRIPT)
X    Format:
X	KEYSCRIPT hex		New character in hex
X    Example:
X	KEYSCRIPT 7E		Use "~" as the new character
X--------------------------------------------------------------------------
XKG	Gets files from host.				(SCRIPT)
X    Format:
X	(same format as KS)	 Get from server
X--------------------------------------------------------------------------
XKMAXPACK Set maximum packet size for kermit transfers	(INIT,SCRIPT)
X    Format:
X	KMAXPACK n		Set maximum packet size to n
X    Example:
X	KMAXPACK 1000		Use long packets if possible.  Don't forget
X				to increase the send/receive timeout values
X				on your host!!!
X--------------------------------------------------------------------------
XKR	Receives a file from kermit host.		(SCRIPT)
X    Format:
X	(same format as KS)	 Not from a server
X--------------------------------------------------------------------------
XKS	Sends files via kermit to the host.		(SCRIPT)
X    Format:
X	KS file			Send one file
X	KS file1,file2,...	Send multiple files
X	KS file1,file2,...,$	Send multiple files and shut down server
X    Example:
X	KS foo.bar		sends foo.bar (note no quoting is used)
X	KS foo1,foo2,foo3	sends three files
X	KS foo1,foo2,foo3,$	sends three files and shuts down server
X--------------------------------------------------------------------------
XLINES	Define number of lines in the window		(INIT)
X    Format:
X	LINES n
X    Example:
X	LINES 24		Maximum for non-interlace
X	LINES 48		Maximum for interlaced
X	LINES 0			Determine the maximum number of lines
X				available and use it
X--------------------------------------------------------------------------
XMODE	Set a transfer mode for KERMIT to use		(INIT,SCRIPT)
X    Format:
X	MODE type		type of transfers to perform
X    Example:
X	MODE IMAGE		image mode transfers
X	MODE CRLF		<CR><LF> text transfers (VMS Kermit).
X--------------------------------------------------------------------------
XMOUSE	Enable reporting of mouse events to the host	(INIT,SCRIPT)
X    Format:
X	MOUSE BOTH/UP/DOWN/OFF
X    Example:
X	MOUSE OFF		Send no mouse events
X	MOUSE BOTH		Send both mouse up and down events
X--------------------------------------------------------------------------
XMSG	Cause VT100 to display a message		(SCRIPT)
X    Format:
X	MSG string	If string ends with a ^M then string will be displayed
X			and a subsequent MSG will overlay string.  If string
X			contains ^J then the text up to the ^J will be
X			displayed followed by a new-line followed by the
X			remainder of the text of string.
X    Example:	(see SEND for string format)
X	MSG "Show me this msg^J" Will display "Show me this msg" with a
X				following new-line in the VT100 Info window.
X				A subsequent MSG will overlay the text of this
X				message.
X
X	MSG "Show me^Mthis msg" Will display "Show me this msg" with a
X				new-line after the words "me" and "msg".
X
X				See the SEND command for a more complete
X				definition of string.
X--------------------------------------------------------------------------
XNUMKEY	Numeric keypad mode				(INIT,SCRIPT)
X    Format:
X	NUMKEY	ON/OFF or YES/NO
X    Example:
X	NUMKEY	ON		Keypad is pure numbers
X--------------------------------------------------------------------------
XON	Peforms a command every time string is received	(SCRIPT)
X    Format:
X	ON      "string"  cmd	Execute cmd when string is received.
X				Only one ON string may be installed at a
X				time.
X
X				If cmd is a GOTO and we were previously
X				WAITing for a string the WAIT is aborted
X				and execution resumes at the new label.
X
X				If cmd is not SEND and we were previously
X				DELAYing, then the DELAY is aborted and the
X				cmd is executed, followed by the next
X				command after the DELAY.
X
X				If cmd is a SEND and we were previously
X				DELAYing, then the DELAY is continued.
X
X				If cmd is NULL (i.e. ON "") then the
X				current ON command is aborted.
X    Example:
X	ON  "LOSS CARRIER" GOTO RESTART
X				If modem drops carrier, try to redial
X	ON  "--more--" SEND " "
X				Send a space every time --more-- is received
X--------------------------------------------------------------------------
XPARITY	Sets the parity					(INIT,SCRIPT)
X    Format:
X	PARITY	type		Set the parity type
X				Note that all received characters that are
X				destined for the screen are subject to
X				having their parity bits removed or left
X				alone depending on the PARITY setting.
X				Versions prior to 2.9 did not do this.  I
X				corrected this bug but you should be aware
X				that old scripts that depended on this
X				incorrect behaviour will probably break.
X				If, for example, you are connected to a
X				host which uses MARK parity but you
X				PARITY NONE you will most likely never
X				match an ON string.
X    Example:
X	PARITY	NONE		no parity
X	PARITY	MARK		mark parity
X	PARITY	SPACE		space parity
X	PARITY	ODD		odd parity
X	PARITY	EVEN		even parity
X--------------------------------------------------------------------------
XRECF	Receive a file using the protocol specified in XPROTO	(SCRIPT)
X    Format:
X	RECF file-spec
X    Example:
X	XPROTO XMODEMCRC	Select XMODEM CRC protocol
X	RECF Foo		Receive Foo using XMODEM CRC
X--------------------------------------------------------------------------
XRX	Send a command to AREXX for processing		(INIT,SCRIPT)
X    Format:
X	RX	command args	Send command and args to AREXX
X    Example:
X	RX TRACE NOTHING	Cause AREXX to execute TRACE.VT100 passing
X				one parameter ("NOTHING").
X
X				Note that it is normally unneccessary to use
X				this command in other cases since VT100 will
X				automatically route unknown commands to AREXX
X				for processing.  However, if VT100 cannot
X				communicate with AREXX at startup it will NOT
X				automatically send cmds to AREXX and this
X				command must be used.  In the normal case,
X				though, this command will be used as the cmd
X				option in an ON command.  Also note that AREXX
X				macros are run asynchronously...you may get
X				results that you don't expect so think about it
X				if you want to try to run two or more AREXX
X				macros sequentially.
X
X				See the section, above, on AREXX.
X
X    Example:
X	ON "gin:" rx login acs	When "gin:" is received invoke the AREXX
X				script login.vt100 passing 1 parameter:
X				acs.
X--------------------------------------------------------------------------
XSB	Sends a break character to the host		(SCRIPT)
X    Format:			Note that any pending character to send
X	SB				is aborted by this call
X--------------------------------------------------------------------------
XSCREEN	Define the screen type				(INIT)
X    Format:
X	SCREEN type		type of screen to use
X    Example:
X	SCREEN WORKBENCH	use the workbench screen
X	SCREEN CUSTOM		use a custom screen
X--------------------------------------------------------------------------
XSEND	Sends a string or character to the host.	(SCRIPT)
X    Format:
X	SEND    "string"	Sends a string to the host. Beginning and
X				ending double quotes (") are required. A
X				carat (^) may be used to send control chars.
X				Two carats transmits a carat character.  Two
X				imbedded double quotes will send a one double
X				quote.
X        SEND    chr		Sends a single character.
X        SEND    ^chr		Sends a single control character. The chr
X				is NOT case sensitve
X    Example:
X	SEND	"mail"		Send the string mail
X	SEND    "dir^M"		Send the string dir followed by a <CR>
X	SEND	a		Send the letter a
X	SEND	^C		Send a control C
X	SEND	"abc^^def"	Send the string abc^def
X	SEND	^^		Send a control-uparrow
X	SEND	"		Send the '"' character
X--------------------------------------------------------------------------
XSENDF Send a file using the protocol specified in XPROTO	(SCRIPT)
X    Format:
X	SENDF file-spec
X    Example:
X	XPROTO XMODEMCRC	Select XMODEM CRC protocol
X	SENDF Foo		Send Foo using XMODEM CRC
X--------------------------------------------------------------------------
XSHARE Use the serial port in shared or exclusive mode		(INIT,SCRIPT)
X    Format:
X	SHARE ON/OFF or YES/NO	If ON or YES other programs that open the
X				serial port in shared mode may be used
X				(possibly via the EXTERNAL command.  If OFF
X				or NO is specified then no other program may
X				use the serial port while VT100 has it open.
X				VT100 will close the serial port if SHARE
X				OFF is specified and an EXTERNAL protocol
X				routine is invoked and then re-open it once
X				the protocol module is done.
X    Example:
X	SHARE ON		Open the serial port in shared mode
X	SHARE NO		Open the serial port in exclusive mode
X--------------------------------------------------------------------------
XSHORTCUT set a new shortcut command key          (INIT)
X    Format:
X	SHORTCUT cmd key        Sets key "key" to be the shortcut key for
X                                script command "cmd".  A null key will
X                                cause no shortcut to be available for this
X                                command (menu-option).  Cmd may be one of
X                                the following:
X			  >> File items:   <<
X    SE	- Send file using XPROTO	RE	- Receive file using XPROTO
X    KG	- kermit get file		KB	- kermit bye (for server)
X    CAP	- ascii capture on/off
X			  >> Mode (XPROTO) items: <<
X    ASC - ASCII "protocol"		XM	- XMODEM protocol
X    XMC	- XMODEM CRC protocol		KE	- Kermit protocol
X			  >> Comm items:   <<
X    300     - Set Baud 300             1200	- Set Baud 1200
X    2400    - Set Baud 2400            4800	- Set Baud 4800
X    9600    - Set Baud 9600            NONE	- Set Parity none
X    MARK    - Set Parity mark          SPACE	- Set Parity space
X    EVEN    - Set Parity even          ODD	- Set Parity odd
X    IMAGE   - KERMIT transfer mode     TEXT	- KERMIT transfer mode
X    CONVERT - KERMIT transfer mode     AUTOCHOP	- Enable/disable XMODEM
X						  auto-chop feature
X			  >> Script items: <<
X    EXECUTE - execute macro		ABORT	- abort macro
X    RX      - send AREXX command
X			  >> Util items:   <<
X    SB      - send break		HANG	- hang up
X    CD      - change directory		CLEAR	- clear screen
X    ECH     - turn echo on or off	WRAP	- turn wrap on or off
X    NUMKEY  - turn numeric kpad on/off	APP	- turn app. cursor on/off
X    CON     - convert bs to del		SWAP	- Swap BS and DEL
X    MOUSEUP - send mouse UP events	MOUSEDN	- send mouse DOWN events
X
X    Example:
X	SHORTCUT ASC Q          set Right-Amiga-Q to be the shortcut for
X                                ASCII_SEND.
X	SHORTCUT XS             removes the shortcut key for sending via
X                                XMODEM protocol
X--------------------------------------------------------------------------
XSWAP	Swap the meanings of backspace and delete keys	(INIT,SCRIPT)
X    Format:
X	SWAP ON/OFF or YES/NO
X    Example:
X	SWAP NO		Use standard definitions
X--------------------------------------------------------------------------
XUNIT	Set unit of serial device to use		(INIT)
X    Format:
X	UNIT n
X    Example:
X	UNIT 1		Open unit 1 of the serial device.  Generally the
X			user will want to specify unit 0.  When multi-port
X			serial cards become available specify as necessary.
X			See also DEVICE.
X--------------------------------------------------------------------------
XVOLUME	Set the BELL volume				(INIT)
X    Format:
X	VOLUME n
X    Example:
X	VOLUME 0		Use a visual bell
X	VOLUME 64		Use a loud audible bell
X--------------------------------------------------------------------------
XWAIT	Suspends until a certain string is received.	(SCRIPT,NONREXX)
X    Format:
X	WAIT	"string"	Same rules for string as SEND
X	WAIT			Enter an endless wait. Usually used after
X				some "ON" commands have been set up. Can
X				still be aborted via the script menu.
X    Example:
X	WAIT    "User:"		Waits for the string User:
X--------------------------------------------------------------------------
XWBCOLORS Force usage of workbench colors		(INIT)
X    Format:
X	WBCOLORS ON/OFF or YES/NO
X    Example:
X	WBCOLORS YES		Workbebch colors will be used for all
X--------------------------------------------------------------------------
XWRAP	Set long line wrapping				(INIT,SCRIPT)
X    Format:
X	WRAP	ON/OFF or YES/NO
X    Example:
X	WRAP	ON		Long lines will wrap
X--------------------------------------------------------------------------
XXBEEP	Beep at end of xfer				(INIT,SCRIPT)
X    Format:
X	XBEEP	ON/OFF or YES/NO
X    Example:
X	XBEEP	ON		Beep when xfers are finished
X--------------------------------------------------------------------------
XXPROTO	Set default transfer protocol			(INIT,SCRIPT)
X    Format:
X	XPROTO	XMODEM/XMODEMCRC/KERMIT/an external protocol
X    Example:
X	XPROTO	KERMIT		Sets transfer protocol to Kermit
X--------------------------------------------------------------------------
XXR	Receives a file via XMODEM.			(SCRIPT)
X    Format:
X	(same format as KS)
X--------------------------------------------------------------------------
XXS	Sends a file via XMODEM.			(SCRIPT)
X    Format:
X	(same format as KS)
X--------------------------------------------------------------------------
X
X
X----------------------------
XInitialization file example:
X----------------------------
X
X#####################################################################
X#
X#	VT100 sample initialization file
X#	v2.9 ?????? ACS
X#
X# Hash mark at the beginning of a line denotes a comment.
X# White space (space(s) or tab(s)) delimit fields.
X# Case ignored except for function key bindings.
X#
X# All items in this file overide variables of the same name in VT100.C
X# (all variables in vt100.c have a "p_" prepended to them)
X#
X#####################################################################
X#
XAPPCUR		ON		# Application keypad mode is being used
XAUTOCHOP	ON		# Allow XMODEM to strip NULL or ^Z from EOF
XBACKGROUND	000		# Colors are in hex RGB from 000 to FFF
XBAUD		2400		# Anything after required fields is ignored
XBOLD		a00		# Color for bold highlighting (in custom)
XBREAK		750000		# Break time in micro-seconds
XBUFFER		512		# 512 <= Input buffer size <= 2048
XCONVERT		ON		# KERMIT should downcase host names
XCURSOR		00a		# Color for cursor (in custom screen)
XDEPTH		1		# number of bit planes to use (1 or 2)
XECHO		OFF		# Full duplex mode in use
XFONT		MyFont		# Use my own special 8-point font
XFOREGROUND	950		# Colors are only used on the custom screen
XINTERLACE	ON		# ON for CUSTOM or interlaced workbench
XKEYSCRIPT	7E		# Hex value for script introducer
XLINES		0		# normal <= 24 interlaced <= 48 or 0
XMODE		CRLF		# IMAGE or CRLF (for KERMIT transfers)
XNUMKEY		ON		# The keypad should be numeric
XPARITY		NONE		# NONE (= 8 bit), MARK, SPACE, ODD or EVEN
XSCREEN		CUSTOM		# may be CUSTOM or WORKBENCH
XSWAP		OFF		# Don't Swap the Back-space and Delete keys
XVOLUME		64		# Beep Volume (0 = Visual Beep)
XWBCOLORS	YES		# ignore custom colors and use defaults
XWRAP		OFF		# Auto wrap ON or OFF
XXBEEP		ON		# Beep when xfer is done
XXPROTO		XMODEMCRC	# Send/Receive will use Xmodem CRC.
X#   Remove the shortcut key for the CD command.  No comment on next line
X# as it will be taken as the shortcut key.
XSHORTCUT        CD
X#
X# Function bindings (strings to type when any of F1 - F10 are pressed)
X#	f <num>		= function key
X#	f <num>+10	= shifted function key
X#
X# The string specified must be the same format as the SEND command:
X#	^	= control next character
X#	^^	= up arrow
X#
X# Sample control characters:
X#	^[	= escape	^M	= carriage return
X#	^J	= line feed	^L	= form feed
X#
X# If the first character of the string is a script introducer
X# (KEYSCRIPT) then the string is interpreted as a script filename
X# to be executed when the key is pressed.
X#
X# Examples of bindings:
X#
Xf 1	"^[OP"			# f1-f4 = PF1 - PF4 on a VT100
Xf 2	"^[OQ"
Xf 3	"^[OR"
Xf 4	"^[OS"
X#
X# f5,6,7 = scripts to execute (assuming that KEYSCRIPT = '~' = 0x7E)
X#
Xf 5	"~df1:vt100_source/dialwork.script"
Xf 6	"~df1:vt100_source/sendvt100.script"
Xf 7	"~df1:vt100_source/getpics.script"
X#
Xf 8	"MAIL^M"		# Reads my mail (note embedded <CR>)
Xf 9	"NOTE^M"		# Reads conferences
Xf 11    "ATdt415-595-2479^M"    # dials the FAUG BBS
X#
X# all done with init, now execute script as startup sequence
X#
Xexit df1:vt100_source/dialwork.script
X
X--------------------
XScript file example:
X--------------------
X
X###################################################################
X# Script to dial work (dialwork.script)
X#	v2.6	870222	DBW
X###################################################################
X#
X# Make sure that we have all the parameters we want
X#
X	DELAY	2
X	BAUD	2400
X	PARITY	NONE
X	MODE	CRLF
X	BREAK	750000
X	SB
X#
X# First get the modem's attention:
X#
XStart:
X	DELAY 1
X	ON "Ready" GOTO Dial
X	SEND ^B
X	DELAY 2
X	GOTO Start
X#
X# Now dial the 2400 baud line to work:
X#
XDial:
X	ON "Attached" GOTO Login
X	SEND "$2400!"
X	DELAY 30
X	GOTO Start
X#
X# We got attached, so keep hitting return until the Gandalf terminal
X# handler wakes up:
X#
XLogin:
X	ON "enter" GOTO Gandalf
X	DELAY 1
X	SEND ^M
X	GOTO Login
X#
X# Now connect from the Gandalf to the terminal server (ts2):
X# (when it asks for a password I need to type the password 
X# manually here)
X#
XGandalf:
X	DELAY 2
X	SEND "ts2^M"
X	WAIT "class start"
X#
X# Keep sending <CR>'s until the LAT prompts for a username:
X#
XWaitLat:
X	DELAY 2
X	ON "username>" GOTO Lat
X	SEND ^M
X	GOTO WaitLat
X#
X# Tell the LAT that it's me, and connect to the "cookie cluster"
X# (my host systems). Tell the cluster my user name.
X# (when it asks for a password I need to type the password
X# manually here)
X#
XLat:
X	SEND "wecker^M"
X	DELAY 1
X	SEND "connect cookie^M"
X	WAIT "Username:"
X	SEND "WECKER^M"
X	WAIT "at home"
X	SEND "^M^Mn^M"
X#
X# Got through all the LOGIN garbage, so let's do some work.
X#
X	WAIT "$ "
X#
X# All done so stop:
X#
X	EXIT
SHAR_EOF
echo "End of archive 8 (of 9)"
# if you want to concatenate archives, remove anything after this line
exit