1
0
mirror of git://git.suckless.org/sbase synced 2024-12-22 23:13:44 +00:00
sbase/rm.c
sin 2366164de7 No need for semicolon after ARGEND
This is also the style used in Plan 9.
2015-11-01 10:18:55 +00:00

41 lines
646 B
C

/* See LICENSE file for copyright and license details. */
#include "fs.h"
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s [-f] [-Rr] file ...\n", argv0);
}
int
main(int argc, char *argv[])
{
struct recursor r = { .fn = rm, .hist = NULL, .depth = 0, .maxdepth = 1,
.follow = 'P', .flags = 0 };
ARGBEGIN {
case 'f':
r.flags |= SILENT;
break;
case 'R':
case 'r':
r.maxdepth = 0;
break;
default:
usage();
} ARGEND
if (!argc) {
if (!(r.flags & SILENT))
usage();
else
return 0;
}
for (; *argv; argc--, argv++)
recurse(*argv, NULL, &r);
return rm_status || recurse_status;
}