minix/lib/stdio/remove.c
2009-07-12 14:44:37 +00:00

27 lines
383 B
C
Executable file

/*
* remove.c - remove a file
*/
/* $Header$ */
#include <stdio.h>
#include <errno.h>
int _rmdir(const char *path);
int _unlink(const char *path);
int
remove(const char *filename) {
int saved_errno, retval;
saved_errno = errno;
retval = _rmdir(filename);
if (retval == -1 && errno == ENOTDIR) {
errno = saved_errno;
retval = _unlink(filename);
}
return retval;
}