[alt.sources] ecu - SCO XENIX V/{2,3}86 Extended CU part 18/47

wht@tridom.uucp (Warren Tucker) (10/10/89)

---- Cut Here and unpack ----
#!/bin/sh
# this is part 18 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file pcmdtty.c continued
#
CurArch=18
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file pcmdtty.c"
sed 's/^X//' << 'SHAR_EOF' >> pcmdtty.c
X	else if(switches[1] == 'r')
X		normal = 0;		/* reverse */
X	else
X	{
X		pputs("unrecognized switch\n");
X		return(eFATAL_ALREADY);
X	}
X
X	if((erc = get_alpha_zstr(param,s32,sizeof(s32))) ||
X			((foreground = color_name_to_num(s32))) < 0)
X		goto ERROR;
X
X	if(erc = get_alpha_zstr(param,s32,sizeof(s32)))
X	{
X		if(!end_of_cmd(param))
X			goto ERROR;
X		background = 0;
X	}
X	else if((background = color_name_to_num(s32)) < 0)
X		goto ERROR;
X
X	if(normal)
X	{
X		current_colors &= 0xFFFF0000;
X		current_colors |= (foreground << 8) | background;
X		if(proctrace > 1)
X		{
X			pprintf("normal %ld,%ld current=0x%08lx\n",
X				foreground,background,current_colors);
X		}
X	}
X	else
X	{
X		current_colors &= 0x0000FFFF;
X		current_colors |= (foreground << 24) | (background << 16);
X		if(proctrace > 1)
X		{
X			pprintf("reverse %ld,%ld current=0x%08lx\n",
X				foreground,background,current_colors);
X		}
X	}
X
X	setcolor(current_colors);
X	return(0);
X
XERROR:
X	if(erc)
X		return(erc);
X	pputs("invalid color\n");
X	return(eFATAL_ALREADY);
X
X}	/* end of cmd_color */
X
X/*+-------------------------------------------------------------------------
X	ifunc_colors(pvalue)
X--------------------------------------------------------------------------*/
Xint
Xifunc_colors(pvalue)
Xulong *pvalue;
X{
X	*pvalue = current_colors;
X	return(0);
X}	/* end of ifunc_colors */
X
X/*+-------------------------------------------------------------------------
X	cmd_icolor(param)
X--------------------------------------------------------------------------*/
Xcmd_icolor(param)
XESD *param;
X{
Xint erc;
Xulong new_colors;
X
X	if(erc = gint(param,&new_colors))
X		return(erc);
X
X	setcolor(new_colors);
X	return(0);
X}	/* end of cmd_icolor */
X
X/*+-------------------------------------------------------------------------
X	cmd_cls(param)
X--------------------------------------------------------------------------*/
Xint
Xcmd_cls(param)
XESD *param;
X{
X	clear_screen();
X	return(0);
X}	/* end of cmd_cls */
X
X/*+-------------------------------------------------------------------------
X	cmd_cursor(param)
X--------------------------------------------------------------------------*/
Xint
Xcmd_cursor(param)
XESD *param;
X{
Xint erc;
Xlong row;
Xlong col = 0;
X
X	if(erc = gint(param,&row))
X		return(erc);
X	if(gint(param,&col))
X	{
X		/* if something there non-integer */
X		if(!end_of_cmd(param))
X			return(eSyntaxError);
X	}
X	curmove((int)row,(int)col);
X	return(0);
X}	/* end of cmd_cursor */
X
X/*+-------------------------------------------------------------------------
X	cmd_scrdump(param)
X--------------------------------------------------------------------------*/
Xint
Xcmd_scrdump(param)
XESD *param;
X{
Xint erc;
XESD *tesd;
XFILE *fp;
X
X	if((tesd = make_esd(256)) == (ESD *)0)
X		return(eNoMemory);
X
X	if(erc = gstr(param,tesd))
X	{
X		if(!end_of_cmd(param))
X		{
X			erc = eSyntaxError;
X			goto RETURN;
X		}
X	}
X
X	if(tesd->cb)
X	{
X		if((fp = fopen(tesd->pb,"a")) == NULL)
X		{
X			pperror(tesd->pb);
X			erc = eFATAL_ALREADY;
X			goto RETURN;
X		}
X		fclose(fp);
X	}
X
X	screen_dump((tesd->cb) ? tesd->pb : (char *)0);
X
XRETURN:
X	free_esd(tesd);
X	return(erc);
X}	/* end of cmd_scrdump */
X
X/*+-------------------------------------------------------------------------
X	cmd_vidnorm(param)
X--------------------------------------------------------------------------*/
Xint
Xcmd_vidnorm(param)
XESD *param;
X{
X	stand_end();
X	return(0);
X}	/* end of cmd_vidnorm */
X
X/*+-------------------------------------------------------------------------
X	cmd_vidrev(param)
X--------------------------------------------------------------------------*/
Xint
Xcmd_vidrev(param)
XESD *param;
X{
X	stand_out();
X	return(0);
X}	/* end of cmd_vidrev */
X
X/*+-------------------------------------------------------------------------
X	cmd_fkey(param)
X--------------------------------------------------------------------------*/
Xcmd_fkey(param)
XESD *param;
X{
Xint erc;
XESD *tesd;
XFILE *fp;
X
X	if((tesd = make_esd(64)) == (ESD *)0)
X		return(eNoMemory);
X
X	if(erc = gstr(param,tesd))
X		goto RETURN;
X
X	switch(keyset_read(tesd->pb))
X	{
X		case  0:
X			if(proctrace)
X				keyset_display();
X			break;
X		case -1:
X			pprintf("cannot find ~/.ecu/keys\n");
X			erc = eFATAL_ALREADY;
X			break;
X		case -2:
X			pprintf("'%s' not found in ~/.ecu/keys\n",tesd->pb);
X			erc = eFATAL_ALREADY;
X			break;
X	}
X
XRETURN:
X	free_esd(tesd);
X	return(erc);
X}	/* end of cmd_fkey */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of pcmdtty.c */
SHAR_EOF
echo "File pcmdtty.c is complete"
chmod 0644 pcmdtty.c || echo "restore of pcmdtty.c fails"
echo "x - extracting pcmdwhile.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > pcmdwhile.c &&
X/* CHK=0x1016 */
X/*+-------------------------------------------------------------------------
X	pcmdwhile.c - ecu procedure if commands
X	Copyright 1989 Warren H. Tucker, III. All Rights Reserved
X
X    WHILEI $i0 rel-op $i1 cmd
X    WHILES $s0 rel-op $s1 cmd
X
X    where rel-op is "=", "==", "!=", "<>", ">", "<", ">=", "=<"
X
X  Defined functions:
X	cmd_whilei(param)
X	cmd_whiles(param)
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-03-1989-22:57-wht------------- ecu 2.00 ---------------- */
X/*:06-24-1989-16:53-wht-flush edits --- ecu 1.95 */
X
X#include <ctype.h>
X#include "ecu.h"
X#include "ecuerror.h"
X#include "esd.h"
X#include "var.h"
X#include "proc.h"
X#include "relop.h"
X
Xextern PCB *pcb_stack[];
Xextern int proc_level;
X
X/*+-------------------------------------------------------------------------
X    cmd_whilei(param)
X--------------------------------------------------------------------------*/
Xint
Xcmd_whilei(param)
XESD *param;
X{
Xregister erc;
Xint relop;
Xlong int1;
Xlong int2;
Xint truth;
Xchar do_str[10];
XPCB *pcb;
XLCB *condition_lcb;
Xint condition_index = param->index;
X
X	if(!proc_level)
X		return(eNotExecutingProc);
X
X	pcb = pcb_stack[proc_level - 1];
X	condition_lcb = pcb->current;
X
XREPEAT_WHILE:
X
X	if(erc = gint(param,&int1))
X		return(erc);
X	if(erc = get_relop(param,&relop))
X		return(erc);
X	if(erc = gint(param,&int2))
X		return(erc);
X
X	truth = test_truth_int(int1,relop,int2);
X
X/* if end of command, execute frame */
X	if(end_of_cmd(param))
X	{
X		if(erc = execute_frame(truth))
X		{
X			if(erc == eContinueCommand)
X				goto CONTINUE;
X			if(erc == eBreakCommand)
X				erc = 0;
X			return(erc);
X		}
X	}
X	else if(truth)
X	{
X		if(erc = execute_esd(param))
X			return(erc);
X	}
X
X/* repeat if indicated */
XCONTINUE:
X	if(truth)
X	{
X		pcb->current = condition_lcb;
X		param->index = param->old_index = condition_index;
X		goto REPEAT_WHILE;
X	}
X
X	return(0);
X}   /* end of cmd_whilei */
X
X/*+-------------------------------------------------------------------------
X    cmd_whiles(param)
X--------------------------------------------------------------------------*/
Xint
Xcmd_whiles(param)
XESD *param;
X{
Xregister erc;
Xregister truth = 0;
XESD str1,str2;
Xchar str1_str[256];
Xchar str2_str[256];
Xint relop;
Xint strcmp_result;
XPCB *pcb;
XLCB *condition_lcb;
Xint condition_index = param->index;
X
X	if(!proc_level)
X		return(eNotExecutingProc);
X
X	pcb = pcb_stack[proc_level - 1];
X	condition_lcb = pcb->current;
X
X	str1.pb = str1_str;
X	str1.maxcb = sizeof(str1_str) - 1;
X	str1.cb = 0;
X	str1.index = 0;
X
X	str2.pb = str2_str;
X	str2.maxcb = sizeof(str2_str) - 1;
X	str2.cb = 0;
X	str2.index = 0;
X
XREPEAT_WHILE:
X
X	if(erc = gstr(param,&str1))
X		return(erc);
X	if(erc = get_relop(param,&relop))
X		return(erc);
X	if(erc = gstr(param,&str2))
X		return(erc);
X
X	strcmp_result = strcmp(str1.pb,str2.pb);
X	switch(relop)
X	{
X	case OP_EQ:
X		truth = (strcmp_result == 0);
X		break;
X	case OP_NE:
X		truth = (strcmp_result != 0);
X		break;
X	case OP_GT:
X		truth = (strcmp_result > 0);
X		break;
X	case OP_LT:
X		truth = (strcmp_result < 0);
X		break;
X	case OP_GE:
X		truth = (strcmp_result >= 0);
X		break;
X	case OP_LE:
X		truth = (strcmp_result <= 0);
X		break;
X	default:
X		return(eInvalidStrOp);
X	}
X
X/* if end of command, execute frame */
X	if(end_of_cmd(param))
X	{
X		if(erc = execute_frame(truth))
X		{
X			if(erc == eContinueCommand)
X				goto CONTINUE;
X			if(erc == eBreakCommand)
X				erc = 0;
X			return(erc);
X		}
X	}
X	else if(truth)
X	{
X		if(erc = execute_esd(param))
X			return(erc);
X	}
X
X/* repeat if indicated */
XCONTINUE:
X	if(truth)
X	{
X		pcb->current = condition_lcb;
X		param->index = param->old_index = condition_index;
X		goto REPEAT_WHILE;
X	}
X
X	return(0);
X}   /* end of cmd_whiles */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of pcmdwhile.c */
SHAR_EOF
chmod 0644 pcmdwhile.c || echo "restore of pcmdwhile.c fails"
echo "x - extracting pcmdxfer.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > pcmdxfer.c &&
X/* CHK=0x1E8E */
X/*+-------------------------------------------------------------------------
X	pcmdxfer.c - ecu xfer-related procedure commands
X	Copyright 1989 Warren H. Tucker, III. All Rights Reserved
X
X  Defined functions:
X	_make_bottom_label(param,default_flag,sending_flag)
X	_rx_error()
X	_send_common(execcmd)
X	cmd_rk(param)
X	cmd_rs(param)
X	cmd_rx(param)
X	cmd_ry(param)
X	cmd_rz(param)
X	cmd_sk(param)
X	cmd_ss(param)
X	cmd_sx(param)
X	cmd_sy(param)
X	cmd_sz(param)
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-03-1989-22:57-wht------------- ecu 2.00 ---------------- */
X/*:06-24-1989-16:53-wht-flush edits --- ecu 1.95 */
X
X#include "ecu.h"
X#include "ecukey.h"
X#include "ecuerror.h"
X#include "esd.h"
X#include "var.h"
X#include "proc.h"
X
Xchar *strchr();
X
Xextern int proctrace;
Xextern int last_child_wait_status;
Xextern char curr_dir[];
Xextern proc_level;
Xextern PCB *pcb_stack[];
X
Xstatic char bottom_label[80];
X
X/*+-------------------------------------------------------------------------
X	_make_bottom_label(param,default_flag)
X--------------------------------------------------------------------------*/
X_make_bottom_label(param,default_flag,sending_flag)
XESD *param;
Xint default_flag;
Xint sending_flag;
X{
Xregister erc;
XESD *label = (ESD *)0;
X
X	if(default_flag)
X	{
X		sprintf(bottom_label,(sending_flag)
X				? "-C \"'Connected to %s'\" "
X				: "-C 'Connected to %s' ",
X			(Llogical[0]) ? Llogical : "?");
X		return(0);
X	}
X	if((label = make_esd(64)) == (ESD *)0)
X		return(eNoMemory);
X	if(erc = gstr(param,label))
X	{
X		free_esd(label);
X		return(erc);
X	}
X	strcpy(bottom_label,(sending_flag) ? "-C \"'" : "-C '");
X	strcat(bottom_label,label->pb);
X	strcat(bottom_label,(sending_flag) ? "'\"" : "'");
X	free_esd(label);
X	return(0);
X
X}	/* end of _make_bottom_label */
X
X/*+-------------------------------------------------------------------------
X	_send_common(execcmd)
Xfor "ecu knowledgeable" protocols only
X--------------------------------------------------------------------------*/
Xint
X_send_common(execcmd)
Xchar *execcmd;
X{
Xint erc = 0;
X
X	file_xfer_start();
X	if(find_shell_chars(execcmd))
X	{
X	char *expcmd;
X
X		if(expand_cmd_with_wildlist(execcmd,&expcmd))
X		{
X			pputs("No files match wildcard list\n");
X			iv[0] = -1;
X			return(0);
X		}
X		else
X		{
X			if(exec_cmd(expcmd))
X				erc = eFATAL_ALREADY;
X			free(expcmd);
X		}
X	}
X	else
X	{
X		if(exec_cmd(execcmd))
X			erc = eFATAL_ALREADY;
X	}
X	lreset_ksr();
X	file_xfer_done_bell();
X	if(erc)
X		return(erc);
X	erc = report_send_status();
X	if(!erc)
X		iv[0] = 0;
X	if(erc == eProcAttn_Interrupt)
X	{
X		erc = 0;
X		iv[0] = 0x100L;
X	}
X	return(erc);
X		
X
X}	/* end of _send_common */
X
X/*+-------------------------------------------------------------------------
X	cmd_sx(param)
X
Xsx [-ak[l]] [<label-str>] <filelist-str>
X--------------------------------------------------------------------------*/
Xint
Xcmd_sx(param)
XESD *param;
X{
Xint erc;
Xregister itmp;
Xchar execcmd[384];
Xchar switches[8];
XESD *pathlist;
X
X	get_switches(param,switches,sizeof(switches));
X
X	if(erc = _make_bottom_label(param,strchr(switches,'l') == (char *)0,1))
X		return(erc);
X
X	sprintf(execcmd,"ecusz -X -. %d ",Liofd);
X	strcat(execcmd,bottom_label);
X	if(strchr(switches,'a'))
X		strcat(execcmd,"-a ");
X	else
X		strcat(execcmd,"-b ");
X	if(strchr(switches,'k'))
X		strcat(execcmd,"-k");
X
X	if((pathlist = make_esd(256)) == (ESD *)0)
X		return(eNoMemory);
X
X	if(erc = gstr(param,pathlist))
X	{
X		free_esd(pathlist);
X		return(erc);
X	}
X
X	strcat(execcmd,pathlist->pb);
X	free_esd(pathlist);
X	return(_send_common(execcmd));
X
X}	/* end of cmd_sx */
X
X/*+-------------------------------------------------------------------------
X	cmd_sy(param)
X
Xsy [-a[l]] [<label-str>] <filelist-str>
X--------------------------------------------------------------------------*/
Xint
Xcmd_sy(param)
XESD *param;
X{
Xint erc;
Xregister itmp;
Xchar execcmd[384];
Xchar switches[8];
XESD *pathlist;
X
X	get_switches(param,switches,sizeof(switches));
X
X	if(erc = _make_bottom_label(param,strchr(switches,'l') == (char *)0,1))
X		return(erc);
X
X	sprintf(execcmd,"ecusz -Y -. %d -k ",Liofd);
X	strcat(execcmd,bottom_label);
X	if(strchr(switches,'a'))
X		strcat(execcmd,"-a ");
X	else
X		strcat(execcmd,"-b ");
X
X	if((pathlist = make_esd(256)) == (ESD *)0)
X		return(eNoMemory);
X
X	if(erc = gstr(param,pathlist))
X	{
X		free_esd(pathlist);
X		return(erc);
X	}
X
X	strcat(execcmd,pathlist->pb);
X	free_esd(pathlist);
X	return(_send_common(execcmd));
X
X}	/* end of cmd_sy */
X
X/*+-------------------------------------------------------------------------
X	cmd_sz(param)
X
Xsz [-anf[l]] [<label-str>] <filelist-str>
X-a ascii, else binary
X-n send only newer, else all files
X-f full, else simple pathnames
X-l non-default bottom line label on transfer string
X$i0 set to:
X	0:       file transfer completely successful
X	-1 program did not run
X--------------------------------------------------------------------------*/
Xint
Xcmd_sz(param)
XESD *param;
X{
Xint erc;
Xregister itmp;
Xchar execcmd[384];
Xchar switches[8];
XESD *pathlist;
X
X	get_switches(param,switches,sizeof(switches));
X
X	if(erc = _make_bottom_label(param,strchr(switches,'l') == (char *)0,1))
X		return(erc);
X
X	sprintf(execcmd,"ecusz -Z -. %d -y ",Liofd);
X	strcat(execcmd,bottom_label);
X	if(strchr(switches,'a'))
X		strcat(execcmd,"-a ");
X	else
X		strcat(execcmd,"-b ");
X	if(strchr(switches,'n'))
X		strcat(execcmd,"-n ");	/* overrides -y choice earlier */
X	if(strchr(switches,'f'))
X		strcat(execcmd,"-f ");
X
X	if((pathlist = make_esd(256)) == (ESD *)0)
X		return(eNoMemory);
X
X	if(erc = gstr(param,pathlist))
X	{
X		free_esd(pathlist);
X		return(erc);
X	}
X
X	strcat(execcmd,pathlist->pb);
X	free_esd(pathlist);
X	return(_send_common(execcmd));
X
X}	/* end of cmd_sz */
X
X/*+-------------------------------------------------------------------------
X	cmd_sk(param)
X
Xsk [-a] <str>
X--------------------------------------------------------------------------*/
Xint
Xcmd_sk(param)
XESD *param;
X{
Xint erc;
Xregister itmp;
Xchar execcmd[384];
XESD *pathlist;
Xchar switches[8];
X
X	get_switches(param,switches,sizeof(switches));
X
X	sprintf(execcmd,"ckermit -l %d -b %u -p %c%s%s -s ",
X		Liofd,Lbaud,
X		(Lparity) ? Lparity : 'n',
X		(strchr(switches,'a')) ? "" : " -i",
X		(1 /* overwrite*/ ) ? "" : " -w");
X
X	if(strchr(switches,'b'))
X		strcat(execcmd,"-a ");
X	else
X		strcat(execcmd,"-b ");
X	if(strchr(switches,'n'))
X		strcat(execcmd,"-n ");	/* overrides -y choice earlier */
X	if(strchr(switches,'f'))
X		strcat(execcmd,"-f ");
X
X	if((pathlist = make_esd(256)) == (ESD *)0)
X		return(eNoMemory);
X
X	if(erc = gstr(param,pathlist))
X	{
X		free_esd(pathlist);
X		return(erc);
X	}
X
X	file_xfer_start();
X	strcat(execcmd,pathlist->pb);
X	free_esd(pathlist);
X	if(exec_cmd(execcmd))
X		erc = eFATAL_ALREADY;
X	file_xfer_done_bell();
X	lreset_ksr();
X	return(erc);
X}	/* end of cmd_sk */
X
X/*+-------------------------------------------------------------------------
X	cmd_ss(param)
X--------------------------------------------------------------------------*/
Xint
Xcmd_ss(param)
XESD *param;
X{
Xint erc;
Xregister itmp;
Xchar execcmd[384];
XESD *pathlist;
X
X	sprintf(execcmd,"ecusea -. %d -/ %s -s ",Liofd,curr_dir);
X	if((pathlist = make_esd(256)) == (ESD *)0)
X		return(eNoMemory);
X
X	if(erc = gstr(param,pathlist))
X	{
X		free_esd(pathlist);
X		return(erc);
X	}
X
X	strcat(execcmd,pathlist->pb);
X	free_esd(pathlist);
X	return(_send_common(execcmd));
X
X}	/* end of cmd_ss */
X
X/*+-------------------------------------------------------------------------
X	_rx_error()
X--------------------------------------------------------------------------*/
X_rx_error()
X{
Xextern int last_child_wait_status;
X
X	iv[0] = (last_child_wait_status & 0xFF)
X			? 0x100L : (long)last_child_wait_status >> 8;
X	if(proctrace)
X		pprintf("$i00 = %ld, (%s)\n",iv[0],
X			(iv[0] == 0x100L) ? "interrupted" : "program exit status");
X	file_xfer_done_bell();
X}	/* end of _rx_error */
X
X/*+-------------------------------------------------------------------------
X	cmd_rx(param)
X
Xrx [-b] <str>
X--------------------------------------------------------------------------*/
Xint
Xcmd_rx(param)
XESD *param;
X{
Xint erc = 0;
Xchar execcmd[512];
Xchar switches[8];
XESD *tesd = make_esd(256);
X
X	if(!tesd)
X		return(eNoMemory);
X
X	get_switches(param,switches,sizeof(switches));
X
X	if(erc = gstr(param,tesd))
X	{
X		free_esd(tesd);
X		return(erc);
X	}
X
X	last_child_wait_status = 0;
X	if(erc = _make_bottom_label(param,strchr(switches,'l') == (char *)0,0))
X		return(erc);
X
X	sprintf(execcmd,"ecurz -X -. %d -c ",Liofd);
X	strcat(execcmd,bottom_label);
X	if(!strchr(switches,'b'))
X		strcat(execcmd,"-b ");
X	else
X		strcat(execcmd,"-a ");
X	strcat(execcmd,tesd->pb);
X	free_esd(tesd);
X	file_xfer_start();
X	if(exec_cmd(execcmd))
X		erc = eFATAL_ALREADY;
X	else
X		_rx_error();
X	return(erc);
X}	/* end of cmd_rx */
X
X/*+-------------------------------------------------------------------------
X	cmd_ry(param)
X
Xry
X--------------------------------------------------------------------------*/
Xint
Xcmd_ry(param)
XESD *param;
X{
Xint erc = 0;
Xchar execcmd[512];
Xchar switches[8];
X
X	get_switches(param,switches,sizeof(switches));
X
X	if(erc = _make_bottom_label(param,strchr(switches,'l') == (char *)0,0))
X		return(erc);
X
X	last_child_wait_status = 0;
X	sprintf(execcmd,"ecurz -Y -. %d -y ",Liofd);
X	strcat(execcmd,bottom_label);
X	file_xfer_start();
X	if(exec_cmd(execcmd))
X		erc = eFATAL_ALREADY;
X	else
X		_rx_error();
X	return(erc);
X}	/* end of cmd_ry */
X
X/*+-------------------------------------------------------------------------
X	cmd_rz(param)
X--------------------------------------------------------------------------*/
Xint
Xcmd_rz(param)
XESD *param;
X{
Xint erc = 0;
Xchar execcmd[512];
Xchar switches[8];
X
X	get_switches(param,switches,sizeof(switches));
X
X	if(erc = _make_bottom_label(param,strchr(switches,'l') == (char *)0,0))
X		return(erc);
X
X	last_child_wait_status = 0;
X	sprintf(execcmd,"ecurz -Z -. %d ",Liofd);
X	strcat(execcmd,bottom_label);
X	file_xfer_start();
X	if(exec_cmd(execcmd))
X		erc = eFATAL_ALREADY;
X	else
X		_rx_error();
X	return(erc);
X}	/* end of cmd_rz */
X
X/*+-------------------------------------------------------------------------
X	cmd_rk(param)
X
Xrk [-a]
X--------------------------------------------------------------------------*/
Xint
Xcmd_rk(param)
XESD *param;
X{
Xint erc = 0;
Xchar execcmd[300];
Xchar switches[8];
X
X	get_switches(param,switches,sizeof(switches));
X
X	last_child_wait_status = 0;
X	sprintf(execcmd,"ckermit -r -e 512 -l %d -b %d -p %c",
X		Liofd,Lbaud,(Lparity) ? Lparity : 'n');
X	if(strchr(switches,'a'))
X		strcat(execcmd,"-i ");
X	file_xfer_start();
X	if(exec_cmd(execcmd))
X		erc = eFATAL_ALREADY;
X	file_xfer_done_bell();
X	return(erc);
X}	/* end of cmd_rk */
X
X/*+-------------------------------------------------------------------------
X	cmd_rs(param)
X
Xrs
X--------------------------------------------------------------------------*/
Xint
Xcmd_rs(param)
XESD *param;
X{
Xint erc = 0;
Xchar execcmd[128];
X
X	file_xfer_start();
X	sprintf(execcmd,"ecusea -r -. %d -/ %s",Liofd,curr_dir);
X	if(exec_cmd(execcmd))
X		erc = eFATAL_ALREADY;
X	file_xfer_done_bell();
X	return(erc);
X}	/* end of cmd_rs */
X
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of pcmdxfer.c */
SHAR_EOF
chmod 0644 pcmdxfer.c || echo "restore of pcmdxfer.c fails"
echo "x - extracting poutput.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > poutput.c &&
X/* CHK=0xB4C9 */
X/*+-------------------------------------------------------------------------
X	poutput.c - ecu procedure output routines
X	Copyright 1989 Warren H. Tucker, III. All Rights Reserved
X
X  Defined functions:
X	cmd_plog(param)
X	pperror(str)
X	pputc(ch)
X	pputs(str)
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-03-1989-22:57-wht------------- ecu 2.00 ---------------- */
X/*:06-24-1989-16:53-wht-flush edits --- ecu 1.95 */
X
X#include "ecu.h"
X#include "ecukey.h"
X#include "ecuerror.h"
X#include "esd.h"
X
Xextern int proctrace;
X
XFILE *plog_fp = (FILE *)0;
XESD *plog_name = (ESD *)0;
X
X/*+-------------------------------------------------------------------------
X	plogs(str)
X--------------------------------------------------------------------------*/
Xvoid
Xplogs(str)
Xchar *str;
X{
X	if(plog_fp)
X		fputs(str,plog_fp);
X}	/* end of plogs */
X
X/*+-------------------------------------------------------------------------
X	plogc(ch)
X--------------------------------------------------------------------------*/
Xvoid
Xplogc(ch)
Xchar ch;
X{
X	if(plog_fp)
X		fputc(ch,plog_fp);
X}	/* end of plogc */
X
X/*+-------------------------------------------------------------------------
X	pputc(ch) - put procedure output character to stderr and log
X--------------------------------------------------------------------------*/
Xpputc(ch)
Xchar ch;
X{
X	if(ch == NL)
X		fputc(CR,se);
X	fputc(ch,se);
X	if(plog_fp && (ch != CR))
X		fputc(ch,plog_fp);
X}	/* end of pputc */
X
X/*+-------------------------------------------------------------------------
X	pputs(str) - put procedure output string to stderr and log
X--------------------------------------------------------------------------*/
Xvoid
Xpputs(str)
Xregister char *str;
X{
X	while(*str)
X	{
X		if(*str == NL)
X			fputc(CR,se);
X		fputc(*str,se);
X		if(plog_fp && (*str != CR))
X			fputc(*str,plog_fp);
X		str++;
X	}
X}	/* end of pputs */
X
X/*+-------------------------------------------------------------------------
X	pflush()
X--------------------------------------------------------------------------*/
Xvoid
Xpflush()
X{
X	if(plog_fp)
X		fflush(plog_fp);
X}	/* end of pflush */
X
X/*+-------------------------------------------------------------------------
X	pperror(str)
X--------------------------------------------------------------------------*/
Xvoid
Xpperror(str)
Xchar *str;
X{
Xextern char *sys_errlist[];
Xextern int sys_nerr;
Xextern int errno;
Xint save_errno = errno;
X
X	if(str && *str)
X	{
X		pputs(str);
X		pputs(": ");
X	}
X	if(save_errno <= sys_nerr)
X		pputs(sys_errlist[save_errno]);
X	else
X		pprintf("error %d",save_errno);
X	pputs("\n");
X}	/* end of pperror */
X
X/*+-------------------------------------------------------------------------
X	plog_control(fname)
X fname == 0, close
X fname == 1, plog_name already plugged
X--------------------------------------------------------------------------*/
Xint
Xplog_control(fname)
Xchar *fname;
X{
X	if(!fname)	/* close */
X	{
X		if(plog_fp)
X			fclose(plog_fp);
X		plog_fp = (FILE *)0;
X		return(0);
X	}
X
X	if(plog_fp)
X		plog_control((char *)0);
X
X	if(fname != (char *)1)
X	{
X		strcpy(plog_name->pb,fname);
X		plog_name->cb = strlen(fname);
X	}
X
X	if((plog_fp = fopen(plog_name->pb,"a")) == NULL)
X	{
X		pperror(plog_name->pb);
X		return(eFATAL_ALREADY);
X	}
X	return(0);
X}	/* end of plog_control */
X
X/*+-------------------------------------------------------------------------
X	cmd_plog(param)
X
Xplog $s0     log to file
Xplog off     stop logging
Xplog         show status
X--------------------------------------------------------------------------*/
Xint
Xcmd_plog(param)
XESD *param;
X{
Xint erc;
Xint show_status = 1;
Xchar off_str[8];
X
X	if(!skip_cmd_break(param))	/* if arguments */
X	{
X		if(!get_alpha_zstr(param,off_str,sizeof(off_str)))
X		{
X			if(strcmp(off_str,"off"))
X				return(eBadParameter);
X			erc = plog_control((char *)0);
X		}
X		else
X		{
X			if(erc = gstr(param,plog_name))
X				return(erc);
X			erc = plog_control((char *)1);
X		}
X	}
X	return(erc);
X
X}	/* end of cmd_plog */
X
X/*+-------------------------------------------------------------------------
X	poutput_init()
X--------------------------------------------------------------------------*/
Xvoid
Xpoutput_init()
X{
X	if((plog_name = make_esd(256)) == (ESD *)0)
X	{
X		ff(se,"Out of memory\r\n");
X		hangup(1);
X	}
X}	/* end of poutput_init */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of poutput.c */
SHAR_EOF
chmod 0644 poutput.c || echo "restore of poutput.c fails"
echo "x - extracting pprintf.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > pprintf.c &&
X/* CHK=0xD7C5 */
X/*+-------------------------------------------------------------------------
X	pprintf.c
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-03-1989-22:57-wht------------- ecu 2.00 ---------------- */
X/*:06-24-1989-16:53-wht-flush edits --- ecu 1.95 */
X
X/* based on Portable vsprintf  by Robert A. Larson <blarson@skat.usc.edu> */
X
X/* Copyright 1989 Robert A. Larson.
X * Distribution in any form is allowed as long as the author
X * retains credit, changes are noted by their author and the
X * copyright message remains intact.  This program comes as-is
X * with no warentee of fitness for any purpouse.
X *
X * Thanks to Doug Gwen, Chris Torek, and others who helped clarify
X * the ansi printf specs.
X *
X * Please send any bug fixes and improvments to blarson@skat.usc.edu .
X * The use of goto is NOT a bug.
X */
X
X#if !defined(BUILDING_LINT_ARGS)
X
X#include <stdio.h>
X#include <varargs.h>
X
X#if defined(M_I386)
X#define LONGINT
X#endif
X
X/* This must be a typedef not a #define! */
X#define NOVOID
X#ifdef NOVOID
Xtypedef char *pointer;
X#else
Xtypedef void *pointer;
X#endif
X
Xtypedef int *intp;
X
X/*+-------------------------------------------------------------------------
X	pprintf(format,va_alist)
X--------------------------------------------------------------------------*/
Xvoid
Xpprintf(format,va_alist)
Xregister char *format;
Xva_dcl
X{
Xva_list args;
Xregister char c;
Xregister char *tp;
Xchar tempfmt[64];
X#ifndef LONGINT
Xint longflag;
X#endif
Xchar accum_string[256];
Xregister char *dp = accum_string;
X
X	va_start(args);
X
X	tempfmt[0] = '%';
X	while(c = *format++)
X	{
X		if(c=='%')
X		{
X			tp = &tempfmt[1];
X#ifndef LONGINT
X			longflag = 0;
X#endif
Xcontinue_format:
X			switch(c = *format++)
X			{
X			case 's':
X				*tp++ = c;
X				*tp = '\0';
X				dp += sprintf(dp,tempfmt,va_arg(args,char *));
X				break;
X			case 'u':
X			case 'x':
X			case 'o':
X			case 'X':
X#ifdef UNSIGNEDSPECIAL
X				*tp++ = c;
X				*tp = '\0';
X#ifndef LONGINT
X				if(longflag)
X					dp += sprintf(dp,tempfmt,va_arg(args,unsigned long));
X				else
X#endif
X					dp += sprintf(dp,tempfmt,va_arg(args,unsigned));
X				break;
X#endif
X			case 'd':
X			case 'c':
X			case 'i':
X				*tp++ = c;
X				*tp = '\0';
X#ifndef LONGINT
X				if(longflag)
X					dp += sprintf(dp,tempfmt,va_arg(args,long));
X				else
X#endif
X					dp += sprintf(dp,tempfmt,va_arg(args,int));
X				break;
X			case 'f':
X			case 'e':
X			case 'E':
X			case 'g':
X			case 'G':
X				*tp++ = c;
X				*tp = '\0';
X				dp += sprintf(dp,tempfmt,va_arg(args,double));
X				break;
X			case 'p':
X#if defined(M_I386)
X				dp += sprintf(dp,"0x%08lx",va_arg(args,pointer));
X#else
X#if defined(M_I286)
X				tp = va_arg(args,pointer);
X#if defined(M_SDATA)
X				dp += sprintf(dp,"0x%04x",tp);
X#else
X				dp += sprintf(dp,"%04x:%04x",(int)tp,(int)((long)tp >> 16));
X#endif /* M_SDATA */
X#else
X>>>>>>>>>>>> model problem
X#endif /* M_I286 */
X#endif /* M_I386 */
X				break;
X			case '-':
X			case '+':
X			case '0':
X			case '1':
X			case '2':
X			case '3':
X			case '4':
X			case '5':
X			case '6':
X			case '7':
X			case '8':
X			case '9':
X			case '.':
X			case ' ':
X			case '#':
X			case 'h':
X				*tp++ = c;
X				goto continue_format;
X			case 'l':
X#ifndef LONGINT
X				longflag = 1;
X				*tp++ = c;
X#endif
X				goto continue_format;
X			case '*':
X				tp += sprintf(tp,"%d",va_arg(args,int));
X				goto continue_format;
X			case '%':
X			default:
X				*dp++ = c;
X				break;
X			}
X		}
X		else *dp++ = c;
X	}
X	*dp = '\0';
X	va_end(args);
X	pputs(accum_string);
X}	/* end of pprintf */
X#endif /* !defined(BUILDING_LINT_ARGS) */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of pprintf.c */
SHAR_EOF
chmod 0644 pprintf.c || echo "restore of pprintf.c fails"
echo "x - extracting proc.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > proc.c &&
X/* CHK=0x9905 */
X/*+-------------------------------------------------------------------------
X	proc.c
X	Copyright 1989 Warren H. Tucker, III. All Rights Reserved
X
X  Defined functions:
X	_get_goto_label(param)
SHAR_EOF
echo "End of part 18"
echo "File proc.c is continued in part 19"
echo "19" > s2_seq_.tmp
exit 0
-- 
-------------------------------------------------------------------
Warren Tucker, Tridom Corporation       ...!gatech!emory!tridom!wht 
Ker-au'-lo-phon.  An 8-foot partial flue-stop, having metal pipes
surmounted by adjustable rings, and with a hole bored near the top
of each pipe, producing a soft and "reedy" tone.