/*
 *	File:					libc.
 *	Description:	Linkable library that calls functions in the commandTable.
 *
 *	(C) 1994,1995, Ketil Hunn
 *
 */

#include <libraries/easyrexx.h>

extern struct Library *EasyRexxBase;

LONG HandleARexxFuncs(struct ARexxContext *context)
{
	LONG	result;

	if(context)
		if(GetARexxMsg(context))
		{
			register ULONG i=0L;

			while(context->table[i].command!=NULL)
			{
				if(context->table[i].id==context->id)
				{
					int (*func)(struct ARexxContext *context);

					if(func=(void *)(context->table[i].userdata))
						result=func(context);
					break;
				}
				else
					++i;
			}
			ReplyARexxMsg(context,
										ER_Return, result,
										TAG_DONE);
		}
	return result;
}
