tools/hexnet: replace "server" with "listen" because that's what netcat calls it and the argument we use is -l like netcat's listen mode

BodgeMaster-unfinished
BodgeMaster 2022-07-13 20:30:27 +02:00
parent 9639ef065f
commit 5cb1a52ec4
1 changed files with 5 additions and 5 deletions

View File

@ -32,7 +32,7 @@ int main(int argc, char* argv[]){
bool ipv6 = true; bool ipv6 = true;
bool tcp = true; bool tcp = true;
bool udp = true; bool udp = true;
bool server = false; bool listen = false;
std::string host = ""; std::string host = "";
uint16_t port; uint16_t port;
if (argc<2) { if (argc<2) {
@ -62,7 +62,7 @@ int main(int argc, char* argv[]){
continue; continue;
} }
if (argument=="-l") { if (argument=="-l") {
server = true; listen = true;
continue; continue;
} }
if (argument=="-h") { if (argument=="-h") {
@ -73,11 +73,11 @@ int main(int argc, char* argv[]){
usage; usage;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
if (!server && i==argc-2) { if (!listen && i==argc-2) {
host = argument; host = argument;
} }
if (i==argc-1) { if (i==argc-1) {
if (!server && host=="") { if (!listen && host=="") {
std::cerr << "Not running in listen mode and no host specified." << std::endl; std::cerr << "Not running in listen mode and no host specified." << std::endl;
return EXIT_USAGE; return EXIT_USAGE;
} }
@ -139,7 +139,7 @@ int main(int argc, char* argv[]){
} }
// Argument parsing end ############################################ // Argument parsing end ############################################
if (!server) { if (!listen) {
//TODO: verify that host is possibly a valid host (or usage error) //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 //TODO: look up host if necessary, determine IPv4 or IPv6 mode if necessary
std::cerr << "Client mode not implemented" << std::endl; std::cerr << "Client mode not implemented" << std::endl;