U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <rv@rasmusvillemoes.dk>
To: "Simon Glass" <sjg@chromium.org>
Cc: <u-boot@lists.denx.de>,  "Tom Rini" <trini@konsulko.com>,
	 "Casey Connolly" <casey.connolly@linaro.org>
Subject: Re: [PATCH 8/8] cmd: config: allow simple filtering of output
Date: Wed, 08 Jul 2026 20:59:48 +0200	[thread overview]
Message-ID: <8733xtux23.fsf@rasmusvillemoes.dk> (raw)
In-Reply-To: <CAFLszTgNgDUY-sKspO9O5JaSg7ERv7g-qO-UV8apunFs4w6ZWA@mail.gmail.com> (Simon Glass's message of "Thu, 02 Jul 2026 09:30:24 +0100")

On Thu, Jul 02 2026, "Simon Glass" <sjg@chromium.org> wrote:

> Hi Rasmus,
>
> On 2026-07-01T17:15:27, Rasmus Villemoes <rv@rasmusvillemoes.dk> wrote:
>> cmd: config: allow simple filtering of output
>>
>> When doing development, it can be quite useful to enable
>> CONFIG_CMD_CONFIG, so that one can always check whether a config knob
>> one has just enabled has actually made it to target.
>>
>> Because sometimes, one doesn't flash the right binary, or maybe one
>> has just done CONFIG_FOO=y in some config fragment, but that had no
>> effect because one would also have to do CONFIG_BAR=y.
>>
>> However, 2400+ lines of text are rather hard to read through. One
>> probably uses a terminal emulator with capturing enabled, but
>> searching back through the capture file is a little tedious, and one
>> easily ends up finding something that doesn't pertain to the most
>> recent 'config' command invocation.
>>
>> So make it possible to limit the output to those lines containing a
>> given string. Like the search functionality in menuconfig, make it
>> case insensitive, because it is much more convenient to type "config
>> pinctrl" than "config PINCTRL".
>> [...]
>>
>> cmd/config.c | 25 ++++++++++++++++++++++---
>>  1 file changed, 22 insertions(+), 3 deletions(-)
>
>> diff --git a/cmd/config.c b/cmd/config.c
>> @@ -29,7 +29,23 @@ static int do_config(struct cmd_tbl *cmdtp, int flag, int argc,
>> +             while (b < e) {
>> +                     n = strchrnul(b, '\n');
>> +                     *n = '\0';
>> +
>> +                     if (strcasestr(b, s)) {
>> +                             puts(b);
>> +                             puts('\n');
>> +                     }
>> +                     b = n + 1;
>> +             }
>
> The two puts() could be a single printf("%s\n", b). 

Well, originally I just had the first puts(), then I found out that our
puts() is not standards-compliant (which would automatically add that
newline). I think I prefer keeping these as-is, to avoid a pathological
case of some .config line exceeding CONFIG_SYS_PBSIZE and then be
truncated (that could happen with some of the config options that are
potentially long lists of strings, OF_LIST, DEVICE_TREE_INCLUDES, the like).

> Also please add an explicit #include <linux/string.h> now that we rely
> on strchrnul() and strcasestr() here.

Ack.

> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> In addition to Tom's comment, how about a simple sandbox test?

Ack.

Rasmus

      reply	other threads:[~2026-07-08 18:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 17:15 [PATCH 0/8] some string cleanup, and a tweak of the "config" command Rasmus Villemoes
2026-07-01 17:15 ` [PATCH 1/8] sh: clean up asm/string.h Rasmus Villemoes
2026-07-02  8:29   ` Simon Glass
2026-07-01 17:15 ` [PATCH 2/8] string: correct prototype of strchrnul() Rasmus Villemoes
2026-07-02  8:30   ` Simon Glass
2026-07-01 17:15 ` [PATCH 3/8] string: correct documentation for strstr and strnstr Rasmus Villemoes
2026-07-02  8:30   ` Simon Glass
2026-07-01 17:15 ` [PATCH 4/8] string: remove unused strswab() function Rasmus Villemoes
2026-07-02  8:30   ` Simon Glass
2026-07-01 17:15 ` [PATCH 5/8] string: remove more pointless __HAVE_ARCH_STR* Rasmus Villemoes
2026-07-02  8:30   ` Simon Glass
2026-07-01 17:15 ` [PATCH 6/8] string: add strcasestr() Rasmus Villemoes
2026-07-02  8:30   ` Simon Glass
2026-07-08 18:40     ` Rasmus Villemoes
2026-07-08 19:09       ` Tom Rini
2026-07-01 17:15 ` [PATCH 7/8] test: string: add test of new strcasestr() function Rasmus Villemoes
2026-07-02  8:30   ` Simon Glass
2026-07-01 17:15 ` [PATCH 8/8] cmd: config: allow simple filtering of output Rasmus Villemoes
2026-07-01 18:15   ` Tom Rini
2026-07-02  8:30   ` Simon Glass
2026-07-08 18:59     ` Rasmus Villemoes [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=8733xtux23.fsf@rasmusvillemoes.dk \
    --to=rv@rasmusvillemoes.dk \
    --cc=casey.connolly@linaro.org \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.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