feat: prepare group argument handling

This commit is contained in:
Glenn Y. Rolland 2009-09-09 20:59:17 +02:00
parent 8487dc951d
commit 850c278317

View file

@ -21,14 +21,13 @@ struct igmp_extra {
{ 2, "query", 0x11, 1, "224.0.0.1", 0 },
{ 2, "report", 0x16, 1, "224.0.0.2", 1 },
{ 2, "leave", 0x17, 1, "224.0.0.2", 0 },
/* Note: end of list (please keep) */
{ 0, 0, 0, 0 },
};
void usage(char *name)
{
fprintf(stderr, "usage: %s -i ethdevice -t packet.version\n", name);
fprintf(stderr, "usage: %s -i ethdevice -g group -t packet.version\n", name);
}
int main(int argc, char **argv)
@ -52,7 +51,7 @@ int main(int argc, char **argv)
printf("IGMP packet generator\n\n");
printf("Parsing command line...\n");
while((c = getopt(argc, argv, "i:t:")) != EOF)
while((c = getopt(argc, argv, "i:t:g:")) != EOF)
{
switch (c)
{
@ -82,6 +81,13 @@ int main(int argc, char **argv)
usage(argv[0]);
exit(1);
}
break;
case 'g':
// Group argument handling logic
printf(" Group = [%s]\n", optarg);
igmp_group_str = optarg;
break;
break;
default:
usage(argv[0]);