/* Auto: make
 */

#include "Snap.h"

#include "proto/MinRexx.h"

#include "minrexx.h"

IMPORT struct SnapRsrc *SnapRsrc;

VOID rexxprepend(), rexxappend();
int disp( register struct RexxMsg *msg, register struct rexxCommandList *dat, char *p);

struct rexxCommandList rcl[] =
{
	{"prepend", (APTR) & rexxprepend},
	{"append", (APTR) & rexxappend},
	{NULL, NULL}
};

char result[17];

int disp( register struct RexxMsg *msg, register struct rexxCommandList *dat, char *p)
{
	result[0] = '\0';
	((int (*)())(dat->userdata)) (msg, p);
	replyRexxCmd(msg, 0L, 0L, &result[0]);
	return 1;
}

VOID pend( char *addr, char *p)
{
	strcpy(&result[0], addr);
	if (*p)
	{
		strncpy(addr, p + 1, 16);
	}
}

VOID rexxprepend( struct RexxMsg *msg, char *p)
{
	pend(&SnapRsrc->Prepend[0], p);
}

VOID rexxappend( struct RexxMsg *msg, char *p)
{
	pend(&SnapRsrc->Append[0], p);
}
