sbase/rm.c

30 lines
497 B
C
Raw Normal View History

2011-05-24 00:52:28 +00:00
/* See LICENSE file for copyright and license details. */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
2012-01-30 22:41:33 +00:00
#include <sys/stat.h>
#include "fs.h"
2011-05-24 00:52:28 +00:00
#include "util.h"
int
main(int argc, char *argv[])
{
char c;
while((c = getopt(argc, argv, "fr")) != -1)
switch(c) {
case 'f':
2012-01-30 22:41:33 +00:00
rm_fflag = true;
2011-05-24 00:52:28 +00:00
break;
case 'r':
2012-01-30 22:41:33 +00:00
rm_rflag = true;
2011-05-24 00:52:28 +00:00
break;
default:
exit(EXIT_FAILURE);
}
2012-05-25 20:55:31 +00:00
for(; optind < argc; optind++)
rm(argv[optind]);
2011-05-24 00:52:28 +00:00
return EXIT_SUCCESS;
}