-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cc
More file actions
40 lines (33 loc) · 839 Bytes
/
main.cc
File metadata and controls
40 lines (33 loc) · 839 Bytes
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
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "parse.h"
#include "help.h"
#define ARGNUM 4
int main(int argc, char** argv){
//Defining functionality of the programm according command line
options choices;
char* archive;
Queue<file_argument> filelist(QUEUE_SIZE);
if(parse(argc,argv,&choices,&archive,&filelist) < 0){
printhelp();
return -2;
}
//Option j can be called only along -c or -a
if(choices.j){
if(!choices.c && !choices.a){
perror("Flag -j can only be used along with flag -c or -a\n");
return -3;
}
}
//Test case for the functionality of argument line
printf("Archive file :%s\n",archive);
file_argument temp_file;
while(!filelist.is_empty()){
temp_file = filelist.get_front();
printf("File: %s\n",temp_file.filename);
filelist.Pop();
}
return 0;
}