sbase/libutil/rm.c

24 lines
431 B
C
Raw Normal View History

2012-01-30 17:41:33 -05:00
/* See LICENSE file for copyright and license details. */
#include <errno.h>
2012-01-30 17:41:33 -05:00
#include <stdio.h>
2012-01-30 17:41:33 -05:00
#include "../fs.h"
#include "../util.h"
int rm_fflag = 0;
int rm_rflag = 0;
int rm_status = 0;
2012-01-30 17:41:33 -05:00
void
rm(const char *path, void *data, struct recursor *r)
2012-01-30 17:41:33 -05:00
{
if (rm_rflag)
recurse(path, NULL, r);
if (remove(path) < 0) {
if (!rm_fflag)
weprintf("remove %s:", path);
if (!(rm_fflag && errno == ENOENT))
rm_status = 1;
}
2012-01-30 17:41:33 -05:00
}