From 028176c1496ed23261844ea2b5a5432ea4424b51 Mon Sep 17 00:00:00 2001 From: Glenn Date: Thu, 3 Sep 2009 21:18:43 +0200 Subject: [PATCH] Initial import --- src/Makefile | 9 +++++++++ src/igmpgen.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/Makefile create mode 100644 src/igmpgen.c diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..e5f79b4 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,9 @@ +IGMPPROG=igmpgen +CFLAGS=-Wall + +all: + gcc $(CFLAGS) $(IGMPPROG).c -o $(IGMPPROG) + +clean: + rm -f $(IGMPPROG) + diff --git a/src/igmpgen.c b/src/igmpgen.c new file mode 100644 index 0000000..ac4d189 --- /dev/null +++ b/src/igmpgen.c @@ -0,0 +1,42 @@ +#include +#include +#include + +void usage(char *name) +{ + fprintf(stderr, "usage: %s -i ethdevice\n", name); +} + +int main(int argc, char **argv) +{ + /* misc */ + int c; + char *device = NULL; + + printf("IGMP packet generator\n\n"); + + printf("Parsing command line...\n"); + while((c = getopt(argc, argv, "i:")) != EOF) + { + switch (c) + { + case 'i': + printf(" Net interface = [%s]\n", optarg); + device = optarg; + break; + + default: + usage(argv[0]); + exit(1); + } + } + if (!device) + { + usage(argv[0]); + exit(EXIT_FAILURE); + } + printf("done\n"); + + return 0; +} +