From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0661CC11F64 for ; Thu, 1 Jul 2021 06:17:58 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8125361424 for ; Thu, 1 Jul 2021 06:17:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8125361424 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2DA3683292; Thu, 1 Jul 2021 08:16:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rWckWO28"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EDC0E83289; Thu, 1 Jul 2021 08:16:36 +0200 (CEST) Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E6B7E83224 for ; Thu, 1 Jul 2021 08:16:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qt1-x82e.google.com with SMTP id r20so3381582qtp.3 for ; Wed, 30 Jun 2021 23:16:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M4Rh55YANvuXtSpYG6Jp5ee+K65tP18NTj2LTjrYNTY=; b=rWckWO281aphHwTsaiqNikXtQYMf93sFxUDHM2vYgbEVXz/v4L6S1jBuA9kVIM5Hov PnF0wv7Iegjllkq+CNachevStzPmHSae3D/rr0kYgC5nr5aiIBpor0kI7XlCax8iWfxU vvzPyj5gRFX5v9IOFIoKxLP/lIFEbFYGLUvjFxOLO4onfw0AcPaWhU4/BbfV4OsorUqy zUmdUwvg7UeSvcgQKuw/j8KiEbGUeIM6+Y6vaufK0qAWb/STgBRdP1sSlPIdlYK5yCkw yfr0tVtUKewM+ZIseLBDWiCjmXgp6T7ldRqK0JGwUyY4lZJWs3pi3BZn0jibpX0eje1g RNww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M4Rh55YANvuXtSpYG6Jp5ee+K65tP18NTj2LTjrYNTY=; b=jQ71SdFQNu57e0uFEzSOYm3xaR0CVKUlUSGp8/2lrbPm9ck4TF7NNPxX8hGtj4dG5p vgABOTMtSWMkReNOhofAH7RDvmnw/810HrhJuFH4Qkpbob/nFbSoIPazO35eG1XOiZLu oN5vOIv8i7qk4SMI6IseuHAeIR93Qhu0oKtDsci84mHhyHsbECKHECJWCAT7qVbf7PZW rNw9Xt2ZTq0QTk91ZXFJKfZNP5VQDGOU9qM8vESdhu6RGMALISA9pgIOyNr3ehym4L30 BqmJE+ktxbuILaFsLoG5KQGyI0Jt05YnalNjr3ZW9oBx8l8amw6BxcOm1sjAtkLolF+o qZGg== X-Gm-Message-State: AOAM532Sksn3FX08bunDzpEDvLiYybIPmMBuDsYX2xJnYqaTlZCN3LLJ 9PauzNHPl54bEk7K0izr/l1+81Hu3OE= X-Google-Smtp-Source: ABdhPJy9EmWN2vQTEZogfBBE2eaJFLlwDJhWA4YOI34QvWE//lvsPP9ExqkP/nL4VQpzFCFiUQdghw== X-Received: by 2002:a05:622a:409:: with SMTP id n9mr35900430qtx.261.1625120180640; Wed, 30 Jun 2021 23:16:20 -0700 (PDT) Received: from godwin.fios-router.home (pool-74-96-87-9.washdc.fios.verizon.net. [74.96.87.9]) by smtp.gmail.com with ESMTPSA id g21sm1684673qts.90.2021.06.30.23.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 23:16:20 -0700 (PDT) From: Sean Anderson To: u-boot@lists.denx.de, Tom Rini Cc: =?UTF-8?q?Marek=20Beh=C3=BAn?= , Wolfgang Denk , Simon Glass , Roland Gaudig , Heinrich Schuchardt , Kostas Michalopoulos , Sean Anderson Subject: [RFC PATCH 08/28] cli: lil: Handle commands with dots Date: Thu, 1 Jul 2021 02:15:51 -0400 Message-Id: <20210701061611.957918-9-seanga2@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210701061611.957918-1-seanga2@gmail.com> References: <20210701061611.957918-1-seanga2@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Some commands (such as md, mw, etc) use dot suffixes as options to the command. Therefore, we must ignore anything after a dot when finding commands. Signed-off-by: Sean Anderson --- common/cli_lil.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/cli_lil.c b/common/cli_lil.c index 539a4a3238..dd020e8452 100644 --- a/common/cli_lil.c +++ b/common/cli_lil.c @@ -579,7 +579,17 @@ static struct lil_var *lil_find_var(struct lil *lil, struct lil_env *env, static struct lil_func *lil_find_cmd(struct lil *lil, const char *name) { - return hm_get(&lil->cmdmap, name); + struct lil_func *r; + char *dot = strchr(name, '.'); + + /* Some U-Boot commands have dots in their names */ + if (dot) + *dot = '\0'; + r = hm_get(&lil->cmdmap, name); + + if (dot) + *dot = '.'; + return r; } static struct lil_func *add_func(struct lil *lil, const char *name) -- 2.32.0