From d02520f6b1542ba67a4da89f5a53a6443559c459 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Thu, 31 May 2012 17:24:07 +0200 Subject: [PATCH] Make server ip a commandline option --- tools/reader/obreader.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/reader/obreader.c b/tools/reader/obreader.c index 3c27997..9c46630 100644 --- a/tools/reader/obreader.c +++ b/tools/reader/obreader.c @@ -23,7 +23,7 @@ #define BUFSIZE 100 #define PORT 2342 -#define SRV_IP "127.0.0.1" +char *SRV_IP="127.0.0.1"; #define TYPE_UDP #undef TYPE_TCP @@ -253,7 +253,7 @@ int main(int argc, char ** argv){ time(&ot); /* The big getopt loop */ - while ((c = getopt(argc, argv, "d:")) != EOF) + while ((c = getopt(argc, argv, "s:d:")) != EOF) switch (c) { case 'd': @@ -261,6 +261,11 @@ int main(int argc, char ** argv){ strcpy(device,optarg); break; + case 's': + SRV_IP=(char *)malloc(strlen(optarg)+2); + strcpy(SRV_IP,optarg); + break; + default: fprintf(stderr, "Usage: %s [options] \n\n\ This program reads packets from an USB-Serial R0ket\n\