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 udp = true;
|
||||
bool server = false;
|
||||
std::string host = "";
|
||||
uint16_t port;
|
||||
if (argc<2) {
|
||||
usage;
|
||||
|
@ -73,11 +74,13 @@ int main(int argc, char* argv[]){
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
if (!server && i==argc-2) {
|
||||
//TODO: check if valid host
|
||||
std::cerr << "Host argument parsing is not yet implemented." << std::endl;
|
||||
return EXIT_UNIMPLEMENTED;
|
||||
host = argument;
|
||||
}
|
||||
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") {
|
||||
// check for 16 bit binary number
|
||||
for (char const &digit : argument.substr(2,argument.length())) {
|
||||
|
@ -136,5 +139,10 @@ int main(int argc, char* argv[]){
|
|||
}
|
||||
// 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