Re: [PATCH v1] tools/rtla: Generate optstring from long options

From: Wander Lairson Costa

Date: Thu Jan 15 2026 - 13:06:26 EST


On Thu, Jan 08, 2026 at 11:49:55AM +0200, Costa Shulyupin wrote:
> getopt_long() processes short and long options independently.
> RTLA, like the majority of applications, uses both short and long
> variants for each logical option.
>
> Since the val member of struct option holds the letter of the short
> variant, the string of short options can be reconstructed from the
> array of long options.
>
> Add getopt_auto() to generate optstring from an array of long options,
> eliminating the need to maintain separate short option strings.
>
> Signed-off-by: Costa Shulyupin <costa.shul@xxxxxxxxxx>
...

That's very clever.

Reviewed-by: Wander Lairson Costa <wander@xxxxxxxxxx>