From c85ebb0c1ea11cbdba96c2097c1d1d09dfb8aff5 Mon Sep 17 00:00:00 2001 From: Ruslan Kuchumov Date: Fri, 25 Jul 2014 18:17:46 +0000 Subject: [PATCH] usage & no debug --- src/networking.c | 7 ++++--- src/params.c | 42 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/networking.c b/src/networking.c index 6bd913c8..28a51372 100644 --- a/src/networking.c +++ b/src/networking.c @@ -15,7 +15,7 @@ #include -#define DEBUG_OUT 1 +#define DEBUG_OUT 0 /* Protocol constants: */ #define INT_LEN 10 @@ -148,7 +148,7 @@ void net_send_cc(const char *data, size_t len) return; } - nanosleep((struct timespec[]){{0, 100000000}}, NULL); + /* nanosleep((struct timespec[]){{0, 100000000}}, NULL); */ return; } @@ -441,7 +441,8 @@ int start_srv(const char *port, const char *pwd) if (write_byte(sockfd, OK) != 1) goto close_conn; - continue; + break; + close_conn: mprint("Connection closed\n"); close(sockfd); diff --git a/src/params.c b/src/params.c index e930eb3b..72faaf93 100644 --- a/src/params.c +++ b/src/params.c @@ -374,6 +374,12 @@ void usage (void) mprint (" port) instead of reading a file. Host can be a\n"); mprint (" hostname or IPv4 address. If host is not specified\n"); mprint (" then listens on the local host.\n\n"); + mprint (" -sendto host[:port]: Sends data in BIN format to the server according\n"); + mprint (" to the CCExtractor's protocol over TCP. For IPv6\n"); + mprint (" use [addres]:port\n"); + mprint (" -tcp port: Reads the input data in BIN format according to CCExtractor's\n"); + mprint (" protocol, listening specified port on the local host\n"); + mprint (" -tcppassword password: Sets server password for new connections to tcp server\n"); mprint ("Options that affect what will be processed:\n"); mprint (" -1, -2, -12: Output Field 1 data, Field 2 data, or both\n"); mprint (" (DEFAULT is -1)\n"); @@ -1571,17 +1577,37 @@ void parse_parameters (int argc, char *argv[]) if (strcmp (argv[i],"-sendto")==0 && i