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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 064CEC433EF for ; Fri, 31 Dec 2021 16:17:11 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 082DD83720; Fri, 31 Dec 2021 17:15:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="HL6+pUnn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 39B5183615; Fri, 31 Dec 2021 17:15:13 +0100 (CET) Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (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 9A17883662 for ; Fri, 31 Dec 2021 17:14:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=francis.laniel@amarulasolutions.com Received: by mail-wr1-x42e.google.com with SMTP id s1so56680505wra.6 for ; Fri, 31 Dec 2021 08:14:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nePcJwf6RzM77nP10eoAAwD5GbbCqhDQTeefuilA0CY=; b=HL6+pUnnVwOsn8mnghnMvr950cpw3y//FV1H1vZpkOENXN/1AAY6ZbU5sZfz7uEUhG A+VyvdxIM6IinN8aW9HU23wGryiH/3brCcIXBeTZUcSJ3hih9c2HHUErsxYlDJpsX7sP ELIw0LdZX/5jDjOrtU8ppyFPUeWhSooFFXzJU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nePcJwf6RzM77nP10eoAAwD5GbbCqhDQTeefuilA0CY=; b=0yhcb+1dHfuI6DUZakNprZvGWAQGNQSugDQEmjRcDMd8vQJ11g7MIpZjdQPdMKsV3m 3IvyaxgqwZ+lPnRaGgNl6qqJ5LJOBnz02zwjJnajr8Z2Z4UTb19VVQ5GURPB5Cz1bFfA U5wjh+nLGljrOL1UuLrUcujqUCGdzN9tjFnGkUbqlykJiFrYMGgZhnTx1jaMZYu3blfe Taw83SqifyZvOoMIpzuaKqjb1XqEvc0IF5pNkSrkVc/ftYJEefgZRXPmPh38KhbygJBr w/+589gD6xJcrWMEtwu0vdiAGkSgumZLhhLeDt6ZQzrP8HtXNVbOLrsVaNerCzIc1J6K 6R/w== X-Gm-Message-State: AOAM53213Pk5W52I3Usnkl8KrZM0iFruquf1pOEi5mWmOPueOBRL2Igp Qah+xffrJJbY47ovWnmwMJN/Z79xtKUfxQ== X-Google-Smtp-Source: ABdhPJzZgKEqxZnnn48R8ZT3F6qDq4Y5Fv2nVPRSfJ1wWUfctI9j21RffAfE3nZmh5prDAAJ5bHWjw== X-Received: by 2002:a5d:5608:: with SMTP id l8mr19066117wrv.587.1640967250262; Fri, 31 Dec 2021 08:14:10 -0800 (PST) Received: from pwmachine.home ([2a01:cb14:983:1f00:eef7:8bf8:8ee0:cb1a]) by smtp.gmail.com with ESMTPSA id f6sm31855522wmq.6.2021.12.31.08.14.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Dec 2021 08:14:09 -0800 (PST) From: Francis Laniel To: u-boot@lists.denx.de Cc: Marek Behun , Michael Nazzareno Trimarchi , Simon Glass , Wolfgang Denk , Harald Seiler , Francis Laniel Subject: [RFC PATCH v1 11/21] cli: Enables using hush 2021 parser as command line parser. Date: Fri, 31 Dec 2021 17:13:17 +0100 Message-Id: <20211231161327.24918-12-francis.laniel@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211231161327.24918-1-francis.laniel@amarulasolutions.com> References: <20211231161327.24918-1-francis.laniel@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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 If one defines HUSH_2021_PARSER, cli_loop() will jump on hush 2021 parser code. Signed-off-by: Francis Laniel --- common/cli.c | 14 +++++++++++--- include/cli_hush.h | 8 ++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/common/cli.c b/common/cli.c index d86046a728..090677f7a0 100644 --- a/common/cli.c +++ b/common/cli.c @@ -40,12 +40,15 @@ int run_command(const char *cmd, int flag) return 1; return 0; -#else +#elif CONFIG_IS_ENABLED(HUSH_OLD_PARSER) int hush_flags = FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP; if (flag & CMD_FLAG_ENV) hush_flags |= FLAG_CONT_ON_NEWLINE; return parse_string_outer(cmd, hush_flags); +#else /* HUSH_2021_PARSER */ + /* Not yet implemented. */ + return 0; #endif } @@ -104,7 +107,7 @@ int run_command_list(const char *cmd, int len, int flag) memcpy(buff, cmd, len); buff[len] = '\0'; } -#ifdef CONFIG_HUSH_PARSER +#if CONFIG_IS_ENABLED(HUSH_OLD_PARSER) rcode = parse_string_outer(buff, FLAG_PARSE_SEMICOLON); #else /* @@ -225,7 +228,12 @@ err: void cli_loop(void) { bootstage_mark(BOOTSTAGE_ID_ENTER_CLI_LOOP); -#ifdef CONFIG_HUSH_PARSER +#if CONFIG_IS_ENABLED(HUSH_2021_PARSER) + parse_and_run_file(); + printf("Problem\n"); + /* This point is never reached */ + for (;;); +#elif CONFIG_IS_ENABLED(CONFIG_HUSH_OLD_PARSER) parse_file_outer(); /* This point is never reached */ for (;;); diff --git a/include/cli_hush.h b/include/cli_hush.h index 2bd35670c7..f6c04929b9 100644 --- a/include/cli_hush.h +++ b/include/cli_hush.h @@ -14,9 +14,17 @@ extern int u_boot_hush_start(void); extern int parse_string_outer(const char *, int); +#if CONFIG_IS_ENABLED(HUSH_OLD_PARSER) extern int parse_file_outer(void); +#elif CONFIG_IS_ENABLED(HUSH_2021_PARSER) +extern void parse_and_run_file(void); +#endif +#if CONFIG_IS_ENABLED(HUSH_OLD_PARSER) int set_local_var(const char *s, int flg_export); +#elif CONFIG_IS_ENABLED(HUSH_2021_PARSER) +int set_local_var(char *s, int flg_export); +#endif void unset_local_var(const char *name); char *get_local_var(const char *s); -- 2.25.1