2011-05-24 00:52:28 +00:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
2012-01-30 22:41:33 +00:00
|
|
|
#include "fs.h"
|
2011-05-24 00:52:28 +00:00
|
|
|
#include "util.h"
|
|
|
|
|
2013-06-14 18:20:47 +00:00
|
|
|
static void
|
|
|
|
usage(void)
|
|
|
|
{
|
2015-02-19 14:54:12 +00:00
|
|
|
eprintf("usage: %s [-f] [-Rr] file ...\n", argv0);
|
2013-06-14 18:20:47 +00:00
|
|
|
}
|
|
|
|
|
2011-05-24 00:52:28 +00:00
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
2013-06-14 18:20:47 +00:00
|
|
|
ARGBEGIN {
|
|
|
|
case 'f':
|
2014-11-13 20:24:47 +00:00
|
|
|
rm_fflag = 1;
|
2013-06-14 18:20:47 +00:00
|
|
|
break;
|
2013-12-12 13:15:07 +00:00
|
|
|
case 'R':
|
2013-06-14 18:20:47 +00:00
|
|
|
case 'r':
|
2014-11-13 20:24:47 +00:00
|
|
|
rm_rflag = 1;
|
2013-06-14 18:20:47 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
usage();
|
|
|
|
} ARGEND;
|
2013-08-31 22:04:49 +00:00
|
|
|
|
2015-02-28 20:30:20 +00:00
|
|
|
if (!argc) {
|
2014-11-13 20:24:47 +00:00
|
|
|
if (!rm_fflag)
|
2014-07-04 13:50:20 +00:00
|
|
|
usage();
|
|
|
|
else
|
2014-10-02 22:46:04 +00:00
|
|
|
return 0;
|
2014-07-04 13:50:20 +00:00
|
|
|
}
|
2013-08-31 22:04:49 +00:00
|
|
|
|
2015-03-02 13:19:26 +00:00
|
|
|
for (; *argv; argc--, argv++)
|
2015-03-11 22:21:52 +00:00
|
|
|
rm(*argv, 0, NULL);
|
2011-05-24 00:52:28 +00:00
|
|
|
|
2015-01-30 11:45:54 +00:00
|
|
|
return rm_status;
|
2011-05-24 00:52:28 +00:00
|
|
|
}
|