sbase/rm.c

30 lines
497 B
C
Raw Normal View History

2011-05-23 20:52:28 -04:00
/* See LICENSE file for copyright and license details. */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
2012-01-30 17:41:33 -05:00
#include <sys/stat.h>
#include "fs.h"
2011-05-23 20:52:28 -04: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 17:41:33 -05:00
rm_fflag = true;
2011-05-23 20:52:28 -04:00
break;
case 'r':
2012-01-30 17:41:33 -05:00
rm_rflag = true;
2011-05-23 20:52:28 -04:00
break;
default:
exit(EXIT_FAILURE);
}
2012-05-25 16:55:31 -04:00
for(; optind < argc; optind++)
rm(argv[optind]);
2011-05-23 20:52:28 -04:00
return EXIT_SUCCESS;
}