1
0
mirror of git://git.suckless.org/sbase synced 2024-12-26 00:42:35 +00:00
sbase/rm.c

43 lines
547 B
C
Raw Normal View History

2011-05-24 00:52:28 +00:00
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
2012-01-30 22:41:33 +00:00
#include <sys/stat.h>
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)
{
eprintf("usage: %s [-fRr] 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':
rm_fflag = 1;
2013-06-14 18:20:47 +00:00
break;
case 'R':
2013-06-14 18:20:47 +00:00
case 'r':
rm_rflag = 1;
2013-06-14 18:20:47 +00:00
break;
default:
usage();
} ARGEND;
if (argc < 1) {
if (!rm_fflag)
usage();
else
2014-10-02 22:46:04 +00:00
return 0;
}
for (; argc > 0; argc--, argv++)
2013-06-14 18:20:47 +00:00
rm(argv[0]);
2011-05-24 00:52:28 +00:00
2014-10-02 22:46:04 +00:00
return 0;
2011-05-24 00:52:28 +00:00
}