-
Notifications
You must be signed in to change notification settings - Fork 0
/
tfs_rm.c
47 lines (39 loc) · 780 Bytes
/
tfs_rm.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "tfs.h"
int main(int argc, char *argv[]) {
error er;
int succes;
if (argc < 2) {
er.val = 1;
er.message = "error with arguments";
testerror(er);
}
int i;
int modeRECURSIVE = 0;
int modeVERBOSE = 0;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-r") == 0) {
if (modeRECURSIVE) {
er.val = 1;
er.message = "only 1 mode -m !!";
testerror(er);
}
modeRECURSIVE = 1;
} else if (strcmp(argv[i], "-v") == 0) {
if (modeVERBOSE) {
er.val = 1;
er.message = "only 1 mode -p !!";
testerror(er);
}
modeVERBOSE = 1;
} else {
succes = tfs_rmdir(argv[i]);
if (succes == 0) {
//TODO put the printf in comment
printf("succes !!\n");
} else if (succes == -1) {
return -1;
}
}
}
return 0;
}