mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v3 1/2] commands: test: simplify argv handling
Date: Fri, 28 Jul 2023 08:41:00 +0200	[thread overview]
Message-ID: <20230728064100.GH18491@pengutronix.de> (raw)
In-Reply-To: <20230704121626.835344-1-m.felsch@pengutronix.de>

On Tue, Jul 04, 2023 at 02:16:25PM +0200, Marco Felsch wrote:
> Decrement argc first before check the closing ']' to avoid the
> *argv[argc - 1]. No functional change.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> v3:
> - no changes
> v2:
> - no changes
> 
>  commands/test.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/commands/test.c b/commands/test.c
> index c845cec017..c1b84c42ef 100644
> --- a/commands/test.c
> +++ b/commands/test.c
> @@ -75,11 +75,11 @@ static int do_test(int argc, char *argv[])
>  	struct stat statbuf;
>  
>  	if (*argv[0] == '[') {
> -		if (*argv[argc - 1] != ']') {
> +		argc--;
> +		if (*argv[argc] != ']') {
>  			printf("[: missing `]'\n");
>  			return 1;
>  		}
> -		argc--;
>  	}
>  
>  	/* args? */
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      parent reply	other threads:[~2023-07-28  6:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-04 12:16 Marco Felsch
2023-07-04 12:16 ` [PATCH v3 2/2] commands: test: add based support for bash-test style Marco Felsch
2023-07-28  6:41 ` Sascha Hauer [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=20230728064100.GH18491@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.felsch@pengutronix.de \
    /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