#include <9pm/windows.h>
#include <9pm/u.h>
#include <9pm/libc.h>
#include "syscall.h"

int
stat(char *path, uchar *buf, int nbuf)
{
	char *a;
	Syscallmem *c;

	c = _getsyscallmem();
	strcpy((char*)(&c[1]), path);
	a = (char*)(&c[1])+strlen(path)+1;
	c->arg[0] = 0;
	c->arg[1] = a - (char*)(&c[1]);
	c->arg[2] = nbuf;
	c->nr = Sstat;
	if(_dosyscall(c) < 0)
		return -1;
	memmove(buf, a, c->ret);
	return c->ret;
}


syntax highlighted by Code2HTML, v. 0.9.1