Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1opaZi-0002dO-T6 for mharc-grub-devel@gnu.org; Mon, 31 Oct 2022 15:36:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opaZh-0002cB-Sc for grub-devel@gnu.org; Mon, 31 Oct 2022 15:35:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opaZg-0002NI-F4 for grub-devel@gnu.org; Mon, 31 Oct 2022 15:35:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667244954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sNnMJWv4s9ky6fLo2BmLv9zRplGiYZF/iD9RcwazN10=; b=HOibWw2xdtPRhhquTF/kj9vRN8bi4l8sxMIP3n56t4rUXu6rqiv2fUFo2PNgPbH0txQnLa 7r9Hcv4ag6HJ+rKrY1DWQXrpV8C4g/RkGlJNWKAAyMcVf6ANMlmnkKNEODftS5yJQ9B6Pk ot4WWqKmtlR0bmYkOf9rNOIYYlSAPPw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-272-wkEIYLHkOaWuKpR-CTmT3g-1; Mon, 31 Oct 2022 15:35:52 -0400 X-MC-Unique: wkEIYLHkOaWuKpR-CTmT3g-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 65BE41C07585; Mon, 31 Oct 2022 19:35:52 +0000 (UTC) Received: from eesha.redhat.com (unknown [10.22.35.111]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27443477F5C; Mon, 31 Oct 2022 19:35:52 +0000 (UTC) From: Robbie Harwood To: grub-devel@gnu.org Cc: Robbie Harwood , dkiper@net-space.pl, javierm@redhat.com, phcoder@gmail.com, mchang@suse.com Subject: [PATCH v2 1/1] normal: Add paging instructions to interactive prompt Date: Mon, 31 Oct 2022 15:35:49 -0400 Message-Id: <20221031193549.92061-2-rharwood@redhat.com> In-Reply-To: <20221031193549.92061-1-rharwood@redhat.com> References: <20221031193549.92061-1-rharwood@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Received-SPF: pass client-ip=170.10.133.124; envelope-from=rharwood@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.048, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2022 19:35:58 -0000 Conditionally add instructions for enabling paging to the prompt of interactive shells. This is not an ideal solution, as ineractive users must always run a command in order to get the behavior they want, but it avoids problematic interactions between prompting and sourcing files. Signed-off-by: Robbie Harwood --- grub-core/normal/main.c | 4 +++- grub-core/normal/term.c | 6 ++++++ include/grub/normal.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c index cb0e8e7fd2..d9d7c4ad28 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -411,9 +411,11 @@ grub_normal_read_line_real (char **line, int cont, int nested) if (cont) /* TRANSLATORS: it's command line prompt. */ prompt = _(">"); - else + else if (grub_get_more()) /* TRANSLATORS: it's command line prompt. */ prompt = _("grub>"); + else + prompt = _("(enable paging with `set pager=1`) grub>"); if (!prompt) return grub_errno; diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c index c073eb4898..eec439d9b5 100644 --- a/grub-core/normal/term.c +++ b/grub-core/normal/term.c @@ -128,6 +128,12 @@ grub_set_more (int onoff) grub_normal_reset_more (); } +int +grub_get_more (void) +{ + return grub_more; +} + enum { GRUB_CP437_UPDOWNARROW = 0x12, diff --git a/include/grub/normal.h b/include/grub/normal.h index 218cbabcca..556fd0fada 100644 --- a/include/grub/normal.h +++ b/include/grub/normal.h @@ -133,6 +133,7 @@ void read_crypto_list (const char *prefix); void read_terminal_list (const char *prefix); void grub_set_more (int onoff); +int grub_get_more (void); void grub_normal_reset_more (void); -- 2.35.1