-
Notifications
You must be signed in to change notification settings - Fork 0
/
tfs_mkdir.c
52 lines (45 loc) · 899 Bytes
/
tfs_mkdir.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
48
49
50
51
52
#include "tfs.h"
/**
* STDOUT -> succes and the path of folder create
*/
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;
mode_t mode = NULL;
int modeSEE = 0;
int modeVERBOSE = 0;
int numberOfFolder = 0;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-m") == 0) {
if (modeSEE) {
er.val = 1;
er.message = "only 1 mode -m !!";
testerror(er);
}
//mode = argv[i + 1];
modeSEE = 1;
} else if (strcmp(argv[i], "-p") == 0) {
if (modeVERBOSE) {
er.val = 1;
er.message = "only 1 mode -p !!";
testerror(er);
}
modeVERBOSE = 1;
} else {
numberOfFolder++;
succes = tfs_mkdir(argv[i], mode);
if (succes == 0) {
fprintf(stdout,"succes -> %s\n",argv[i]);
} else if (succes == -1) {
return -1;
}
}
}
return 0;
}