DEV: tcploop: make the current address the default address
It's difficult to refine bind/connect right now, let's make the address
optionall by turning it to the default one.
diff --git a/dev/tcploop/tcploop.c b/dev/tcploop/tcploop.c
index f13ceeb..1ac543b 100644
--- a/dev/tcploop/tcploop.c
+++ b/dev/tcploop/tcploop.c
@@ -732,7 +732,7 @@
int main(int argc, char **argv)
{
- struct sockaddr_storage ss;
+ struct sockaddr_storage default_addr;
struct err_msg err;
const char *arg0;
int loop_arg;
@@ -765,7 +765,7 @@
pid = getpid();
signal(SIGCHLD, sig_handler);
- if (addr_to_ss(argv[1], &ss, &err) < 0)
+ if (addr_to_ss(argv[1], &default_addr, &err) < 0)
die(1, "%s\n", err.msg);
gettimeofday(&start_time, NULL);
@@ -777,7 +777,7 @@
case 'L':
/* silently ignore existing connections */
if (sock == -1)
- sock = tcp_listen(&ss, argv[arg]);
+ sock = tcp_listen(&default_addr, argv[arg]);
if (sock < 0)
die(1, "Fatal: tcp_listen() failed.\n");
break;
@@ -785,7 +785,7 @@
case 'C':
/* silently ignore existing connections */
if (sock == -1)
- sock = tcp_connect(&ss, argv[arg]);
+ sock = tcp_connect(&default_addr, argv[arg]);
if (sock < 0)
die(1, "Fatal: tcp_connect() failed.\n");
dolog("connect\n");