commit 028176c1496ed23261844ea2b5a5432ea4424b51 Author: Glenn Date: Thu Sep 3 21:18:43 2009 +0200 Initial import 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; +} +