Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] Complete help message adding option before desc
Date: Tue, 21 Dec 2021 11:38:14 +0100	[thread overview]
Message-ID: <YcGuliqt4hj/M0pX@yuki> (raw)
In-Reply-To: <20211221091302.26904-1-andrea.cervesato@suse.com>

Hi!
>  static void print_help(void)
>  {
>  	unsigned int i;
> +	char msg[1024];
>  
>  	/* see doc/user-guide.txt, which lists also shell API variables */
>  	fprintf(stderr, "Environment Variables\n");
> @@ -498,8 +499,13 @@ static void print_help(void)
>  	if (!tst_test->options)
>  		return;
>  
> -	for (i = 0; tst_test->options[i].optstr; i++)
> -		fprintf(stderr, "%s\n", tst_test->options[i].help);
> +	for (i = 0; tst_test->options[i].optstr; i++) {
> +		snprintf(msg, 1024, "-%c\t %s",
> +			tst_test->options[i].optstr[0],
> +			tst_test->options[i].help);
> +
> +		fprintf(stderr, "%s\n", msg);
> +	}
>  }

I got rid of the useless temporary buffer here and pushed, thanks.

This is actually a step into a right direction and it also makes the
generated documentation a bit better too. Ideally the tst_test structure
could be also improved to include the default value for the option
too...

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2021-12-21 10:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21  9:13 [LTP] [PATCH v1] Complete help message adding option before desc Andrea Cervesato via ltp
2021-12-21 10:38 ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YcGuliqt4hj/M0pX@yuki \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox