tools/hexnet: Work on argument parser to finish suppurt for client mode
parent
310011a6da
commit
9639ef065f
|
@ -33,6 +33,7 @@ int main(int argc, char* argv[]){
|
||||||
bool tcp = true;
|
bool tcp = true;
|
||||||
bool udp = true;
|
bool udp = true;
|
||||||
bool server = false;
|
bool server = false;
|
||||||
|
std::string host = "";
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
if (argc<2) {
|
if (argc<2) {
|
||||||
usage;
|
usage;
|
||||||
|
@ -73,11 +74,13 @@ int main(int argc, char* argv[]){
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
if (!server && i==argc-2) {
|
if (!server && i==argc-2) {
|
||||||
//TODO: check if valid host
|
host = argument;
|
||||||
std::cerr << "Host argument parsing is not yet implemented." << std::endl;
|
|
||||||
return EXIT_UNIMPLEMENTED;
|
|
||||||
}
|
}
|
||||||
if (i==argc-1) {
|
if (i==argc-1) {
|
||||||
|
if (!server && host=="") {
|
||||||
|
std::cerr << "Not running in listen mode and no host specified." << std::endl;
|
||||||
|
return EXIT_USAGE;
|
||||||
|
}
|
||||||
if (argument.substr(0, 2)=="0b" || argument.substr(0, 2)=="0B") {
|
if (argument.substr(0, 2)=="0b" || argument.substr(0, 2)=="0B") {
|
||||||
// check for 16 bit binary number
|
// check for 16 bit binary number
|
||||||
for (char const &digit : argument.substr(2,argument.length())) {
|
for (char const &digit : argument.substr(2,argument.length())) {
|
||||||
|
@ -136,5 +139,10 @@ int main(int argc, char* argv[]){
|
||||||
}
|
}
|
||||||
// Argument parsing end ############################################
|
// Argument parsing end ############################################
|
||||||
|
|
||||||
//TODO: implement the actual tool
|
if (!server) {
|
||||||
|
//TODO: verify that host is possibly a valid host (or usage error)
|
||||||
|
//TODO: look up host if necessary, determine IPv4 or IPv6 mode if necessary
|
||||||
|
std::cerr << "Client mode not implemented" << std::endl;
|
||||||
|
return EXIT_UNIMPLEMENTED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue