minix/lib/stdio/remove.c

28 lines
383 B
C
Raw Normal View History

2005-04-21 16:53:53 +02:00
/*
* remove.c - remove a file
*/
/* $Header$ */
#include <stdio.h>
#include <errno.h>
2005-04-21 16:53:53 +02:00
int _rmdir(const char *path);
2005-04-21 16:53:53 +02:00
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;
2005-04-21 16:53:53 +02:00
}