#include <9pm/u.h>
#include <9pm/libc.h>
#include <9pm/fcall.h>
#include <9pm/ns.h>

int
remove(char *file)
{
	char *path;
	volatile long m;
	Mnt *mnt;

	if((path = nsassign(file, &mnt, nil)) == nil)
		return -1;
	m = -1;
	checkerrstack();
	if(!waserror()){
		(*mnt->dev->_remove)(mnt, path);
		m = 0;
		poperror();
	}
	mntclose(mnt);
	free(path);
	checkerrstack();
	return m;
}


syntax highlighted by Code2HTML, v. 0.9.1