43 lines
772 B
C
43 lines
772 B
C
|
#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;
|
||
|
}
|
||
|
|