Initial import

This commit is contained in:
Glenn Y. Rolland 2009-09-03 21:18:43 +02:00
commit 028176c149
2 changed files with 51 additions and 0 deletions

9
src/Makefile Normal file
View file

@ -0,0 +1,9 @@
IGMPPROG=igmpgen
CFLAGS=-Wall
all:
gcc $(CFLAGS) $(IGMPPROG).c -o $(IGMPPROG)
clean:
rm -f $(IGMPPROG)

42
src/igmpgen.c Normal file
View file

@ -0,0 +1,42 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
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;
}