#include "ro_file.h"
#include "kernel.h"
#include <string.h>

int Dir_ReadEntry(const char* dirname, int entry, ro_file_info* ro)
{
	_kernel_swi_regs regs;
	const _kernel_oserror* e;

	regs.r[0] = 10;
	regs.r[1] = (int) dirname;
	regs.r[2] = (int) ro;
	regs.r[3] = 1;
	regs.r[4] = entry;
	regs.r[5] = 256;
	regs.r[6] = 0;
	if ((e = _kernel_swi(0x02000c, &regs, &regs)) != NULL)
	{
		ro->name[0] = 0;
		return -1;
	}
	if (regs.r[3] == 0)
		ro->name[0] = 0;

	return regs.r[4];
}
