From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1RNmnF-00039a-7Q for mharc-grub-devel@gnu.org; Tue, 08 Nov 2011 09:36:53 -0500 Received: from eggs.gnu.org ([140.186.70.92]:49116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNmn9-000390-Cq for grub-devel@gnu.org; Tue, 08 Nov 2011 09:36:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RNmn3-0006Uf-BH for grub-devel@gnu.org; Tue, 08 Nov 2011 09:36:47 -0500 Received: from mail-ey0-f169.google.com ([209.85.215.169]:61329) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNmn3-0006UX-1g for grub-devel@gnu.org; Tue, 08 Nov 2011 09:36:41 -0500 Received: by eye4 with SMTP id 4so470173eye.0 for ; Tue, 08 Nov 2011 06:36:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; bh=ukSG+GCi8NA0cMMn8izvoqU/4CQsAn15CCrOlJyTWug=; b=YYVZxoVd+Rh8BXgxCyae7JJET5SpYOqtd9CjPMcow5jCGoNZc+OyESAW79U/wj53AC 6LRGx6QHhAlqwjSE++VRKCLs1vuKtLq5mdEEbky4QzfobMB7Olp61LdhomhmdqsZGwtm EOIThYQ0+w+UTlO1GNh0bWdo3+3+rcQis96Og= Received: by 10.213.14.135 with SMTP id g7mr2768843eba.6.1320762999689; Tue, 08 Nov 2011 06:36:39 -0800 (PST) Received: from debian.x201.phnet (public-docking-hg-7-066.ethz.ch. [82.130.114.66]) by mx.google.com with ESMTPS id 49sm4818815eec.1.2011.11.08.06.36.25 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Nov 2011 06:36:38 -0800 (PST) Message-ID: <4EB93E68.1080000@gmail.com> Date: Tue, 08 Nov 2011 15:36:24 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20111010 Iceowl/1.0b2 Icedove/3.1.15 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Re: [PATCH] Reset grub_errno after embedding test on non-fatal failures References: <4E80E041.5050503@dell.com> <4E80E16E.8070607@gmail.com> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig3CB0112879D71C285272BCBF" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.215.169 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2011 14:36:51 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3CB0112879D71C285272BCBF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 27.09.2011 21:38, Seth Goldberg wrote: > Hi, > > I finally got fed up with having no 'c' to continue when pager was > set to 1. This may be a bit hackish, so I'm bracing for the flame ;), > but it's here if it'll help someone else. It's a good idea but I feel like the point where we restore original setting is badly chosen. Consider: for x in *; do echo $x; done You probably want to skip until the end of the script. I think it's reasonable to restore the setting when user interaction is required. This will have a neat effect of constraining the changes to term subsystem. Since grub_getkey/grub_checkkey are in core changes to them should be minimalised. They could just keep a counter how many times they were called. > > > -------------- > --- grub-core/normal/term.c 2011-04-10 11:56:23 +0000 > +++ grub-core/normal/term.c 2011-09-27 19:33:34 +0000 > @@ -40,7 +40,7 @@ > static struct term_state *term_states =3D NULL; > > /* If the more pager is active. */ > -static int grub_more; > +int grub_more, real_grub_more; > > static void > putcode_real (grub_uint32_t code, struct grub_term_output *term); > @@ -60,11 +60,11 @@ > grub_uint16_t *pos; > grub_term_output_t term; > grub_uint32_t *unicode_str, *unicode_last_position; > + const char *PROMPT_STRING =3D "--MORE-- ('c' to disable paging for > the remainder of this command)"; > > pos =3D grub_term_save_pos (); > > - grub_utf8_to_ucs4_alloc ("--MORE--", &unicode_str, > - &unicode_last_position); > + grub_utf8_to_ucs4_alloc (PROMPT_STRING, &unicode_str, > &unicode_last_position); > > if (!unicode_str) > { > @@ -87,7 +87,7 @@ > /* Remove the message. */ > grub_term_restore_pos (pos); > FOR_ACTIVE_TERM_OUTPUTS(term) > - grub_print_spaces (term, 8); > + grub_print_spaces (term, grub_strlen(PROMPT_STRING)); > grub_term_restore_pos (pos); > grub_free (pos); > > @@ -99,6 +99,11 @@ > for (state =3D term_states; state; state =3D state->next) > state->num_lines--; > } > + else if (key =3D=3D 'c' || key =3D=3D 'C') > + { > + grub_more =3D 0; > + grub_normal_reset_more (); > + } > else > grub_normal_reset_more (); > } > @@ -107,9 +112,10 @@ > grub_set_more (int onoff) > { > if (onoff =3D=3D 1) > - grub_more++; > - else > - grub_more--; > + real_grub_more++; > + else if (real_grub_more > 0) > + real_grub_more--; > + grub_more =3D real_grub_more; > grub_normal_reset_more (); > } > > > =3D=3D=3D modified file 'grub-core/script/execute.c' > --- grub-core/script/execute.c 2010-12-02 09:31:06 +0000 > +++ grub-core/script/execute.c 2011-09-27 19:25:12 +0000 > @@ -445,11 +445,13 @@ > { > int ret; > char errnobuf[ERRNO_DIGITS_MAX + 1]; > + extern int grub_more, real_grub_more; > > if (cmd =3D=3D 0) > return 0; > > ret =3D cmd->exec (cmd); > + grub_more =3D real_grub_more; > > grub_snprintf (errnobuf, sizeof (errnobuf), "%d", ret); > grub_env_set ("?", errnobuf); > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel > --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------enig3CB0112879D71C285272BCBF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAk65PmgACgkQNak7dOguQgkyjQEAuLlY+51CBTt8ED8Rw9ngc6Jj gvXpR2e74DkB1TDyJvgA+wbwRxy3cISmKH0C6D+WHjRPL6d9A9jcCdCEcZbByz1N =kaHE -----END PGP SIGNATURE----- --------------enig3CB0112879D71C285272BCBF--