Repository navigation
Expand file tree
/
Copy patharguments.cpp
More file actions
101 lines (64 loc) · 2.34 KB
/
Copy patharguments.cpp
File metadata and controls
101 lines (64 loc) · 2.34 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <string>
#include <iostream>
int check_if_client(int argc,char ** argv){
//returns 1 if client and 0 if server
for (int index=1; index<argc;index++){
if (std::string(argv[index]) == "-s"){
return 0;
}
}
return 1;
}
std::string check_file_name(int argc,char** argv){
std:: string temp = std::string(argv[1]);
return temp;
}
int check_if_help(int argc,char** argv){
for (int i =0;i<argc;i++){
if(std::string(argv[i]) == "-h"){
std::cout << "this is FGsend[dev version 0.1 beta], a free and open source\nfile transfer program.\nUSAGE:\nFGsend -s FILENAME.FILE PASSWORD \n for sending a file\nFGsend FILENAME.FILE XX.XX.XX.XX PASSWORD\n for receiving a file" << std::endl;//FIXME: add better handling for this
return 1;
}
}
return 0;
}
std::string server_get_filename(int argc,char** argv){
//FIXME: this expects that the user knows what he is doing
// which is a bad idea/practice
//example:
// FGsend -s FILENAME.FILE PASSWORD
//index: 0 1 2 3
return std::string(argv[2]);
}
std::string server_get_pass(int argc,char** argv){
//FIXME: this expects that the user knows what he is doing
// which is a bad idea/practice
//example:
// FGsend -s FILENAME.FILE PASSWORD
//index: 0 1 2 3
return std::string(argv[3]);
}
std::string client_get_filename(int argc,char** argv){
//FIXME: this expects that the user knows what he is doing
// which is a bad idea/practice
//example:
// FGsend FILENAME.FILE XX.XX.XX.XX PASSWORD
//index: 0 1 2 3
return std::string(argv[1]);
}
std::string client_get_ip(int argc,char** argv){
//FIXME: this expects that the user knows what he is doing
// which is a bad idea/practice
//example:
// FGsend FILENAME.FILE XX.XX.XX.XX PASSWORD
//index: 0 1 2 3
return std::string(argv[2]);
}
std::string client_get_pass(int argc,char** argv){
//FIXME: this expects that the user knows what he is doing
// which is a bad idea/practice
//example:
// FGsend FILENAME.FILE XX.XX.XX.XX PASSWORD
//index: 0 1 2 3
return std::string(argv[3]);
}