-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
38 lines (31 loc) · 899 Bytes
/
main.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
#include <stdio.h>
#include <string.h>
#include "dircheck.h"
/* We are taking first argument as initial path name. */
int main(int argc, char *argv[])
{
if ((strcmp(argv[1],"-s") == 0) || (strcmp(argv[1],"--save") == 0)){
if(argc != 4){
fprintf(stderr,"Wrong parameters\n");
return 1;
}
if(generate_xml(argv[2],argv[3]) != 0){
fprintf(stderr,"Error couldn't create xml file\n");
return 1;
}
return 0;
}
if ((strcmp(argv[1],"-c") == 0) || (strcmp(argv[1],"--check") == 0)){
if(argc != 3) {
fprintf(stderr,"Wrong parameters\n");
return 1;
}
if(read_xml(argv[2]) != 0) {
fprintf(stderr,"Error couldn't read xml file\n");
return 1;
}
return 0;
}
fprintf(stderr,"Wrong parameters\n");
return 1;
}