[PATCH v2 1/2] gdbreplay: Use getopt_long to parse command line arguments

Tom Tromey tom@tromey.com
Thu Oct 17 20:09:20 GMT 2024


>>>>> "Alexandra" == Alexandra Hájková <ahajkova@redhat.com> writes:

Alexandra> +  if (optind + 2 != argc)
Alexandra>      {
Alexandra> -      gdbreplay_usage (stdout);
Alexandra> -      exit (0);
Alexandra> +      gdbreplay_usage (stderr);
Alexandra> +      exit (1);
Alexandra>      }
Alexandra> -
Alexandra>    if (argc < 3)
Alexandra>      {
Alexandra>        gdbreplay_usage (stderr);
Alexandra>        exit (1);
Alexandra>      }

It seems to me that this argc check and the 'optind + 2' check are
basically doing the same thing, and so probably the latter should be
removed.

Tom


More information about the Gdb-patches mailing list