fix: improve display

This commit is contained in:
Glenn Y. Rolland 2023-12-25 23:58:13 +01:00
parent d78c23ebd4
commit 893fc0b6f8

View file

@ -66,7 +66,7 @@ int main(int argc, char **argv)
printf("IGMP packet generator\n\n");
printf("Parsing command line...\n");
/* Parsing command line */
while((c = getopt(argc, argv, "i:t:g:d:s:")) != EOF)
{
switch (c)
@ -325,10 +325,18 @@ int main(int argc, char **argv)
void usage(char *name)
{
struct igmp_extra *pkt_ptr;
fprintf(stderr, "usage: %s -i ethdevice -g group -t version.packettype [-s ip:port] [-d ip:port]\n", name);
fprintf(stderr, "Usage: %s [options]\n", name);
fprintf(stderr, "\nOptions:\n");
fprintf(stderr, " -i <interface> Specify the network interface (e.g., eth0)\n");
fprintf(stderr, " -t <type> Specify the IGMP packet type and version (e.g., 1.query)\n");
fprintf(stderr, " -g <group> Specify the IGMP group (e.g., 224.0.0.1)\n");
fprintf(stderr, " -s <source> Specify the source IP and port (e.g., 192.168.1.1:1234)\n");
fprintf(stderr, " -d <destination> Specify the destination IP and port (e.g., 224.0.0.2:5678)\n");
fprintf(stderr, " -n <number> Specify delay between packets in seconds (optional)\n");
fprintf(stderr, "\nAvailable IGMP packet types:\n");
pkt_ptr = g_igmp_pkts;
fprintf(stderr,"\nAvailable packet types:\n");
while(pkt_ptr->igmp_version || pkt_ptr->igmp_tag){
fprintf(stderr," - %d.%s\n", pkt_ptr->igmp_version, pkt_ptr->igmp_tag);
pkt_ptr++;