Make server ip a commandline option

This commit is contained in:
Stefan `Sec` Zehl 2012-05-31 17:24:07 +02:00
parent 603132ce04
commit d02520f6b1
1 changed files with 7 additions and 2 deletions

View File

@ -23,7 +23,7 @@
#define BUFSIZE 100 #define BUFSIZE 100
#define PORT 2342 #define PORT 2342
#define SRV_IP "127.0.0.1" char *SRV_IP="127.0.0.1";
#define TYPE_UDP #define TYPE_UDP
#undef TYPE_TCP #undef TYPE_TCP
@ -253,7 +253,7 @@ int main(int argc, char ** argv){
time(&ot); time(&ot);
/* The big getopt loop */ /* The big getopt loop */
while ((c = getopt(argc, argv, "d:")) != EOF) while ((c = getopt(argc, argv, "s:d:")) != EOF)
switch (c) switch (c)
{ {
case 'd': case 'd':
@ -261,6 +261,11 @@ int main(int argc, char ** argv){
strcpy(device,optarg); strcpy(device,optarg);
break; break;
case 's':
SRV_IP=(char *)malloc(strlen(optarg)+2);
strcpy(SRV_IP,optarg);
break;
default: default:
fprintf(stderr, "Usage: %s [options] \n\n\ fprintf(stderr, "Usage: %s [options] \n\n\
This program reads packets from an USB-Serial R0ket\n\ This program reads packets from an USB-Serial R0ket\n\