Files
sbase/libutil/rm.c
T

24 lines
431 B
C
Raw Normal View History

2012-01-30 22:41:33 +00:00
/* See LICENSE file for copyright and license details. */
#include <errno.h>
2012-01-30 22:41:33 +00:00
#include <stdio.h>
2013-03-05 21:46:48 +01:00
2012-01-30 22:41:33 +00:00
#include "../fs.h"
#include "../util.h"
2014-11-13 21:24:47 +01:00
int rm_fflag = 0;
int rm_rflag = 0;
2015-01-30 12:45:54 +01:00
int rm_status = 0;
2012-01-30 22:41:33 +00:00
void
2015-03-13 00:25:32 +01:00
rm(const char *path, void *data, struct recursor *r)
2012-01-30 22:41:33 +00:00
{
if (rm_rflag)
2015-03-13 00:25:32 +01:00
recurse(path, NULL, r);
2015-01-30 12:45:54 +01:00
if (remove(path) < 0) {
if (!rm_fflag)
weprintf("remove %s:", path);
if (!(rm_fflag && errno == ENOENT))
rm_status = 1;
2015-01-30 12:45:54 +01:00
}
2012-01-30 22:41:33 +00:00
}