From 893fc0b6f8c90ef04b075353f9f266dc21f2d88e Mon Sep 17 00:00:00 2001 From: Glenn Date: Mon, 25 Dec 2023 23:58:13 +0100 Subject: [PATCH] fix: improve display --- src/igmpgen.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/igmpgen.c b/src/igmpgen.c index 09aab41..c700aa9 100644 --- a/src/igmpgen.c +++ b/src/igmpgen.c @@ -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 Specify the network interface (e.g., eth0)\n"); + fprintf(stderr, " -t Specify the IGMP packet type and version (e.g., 1.query)\n"); + fprintf(stderr, " -g Specify the IGMP group (e.g., 224.0.0.1)\n"); + fprintf(stderr, " -s Specify the source IP and port (e.g., 192.168.1.1:1234)\n"); + fprintf(stderr, " -d Specify the destination IP and port (e.g., 224.0.0.2:5678)\n"); + fprintf(stderr, " -n 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++;