All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Franke <Christian.Franke@t-online.de>
To: grub-devel@gnu.org
Subject: [PATCH] print CR as hex in cat command
Date: Fri, 08 Feb 2008 23:55:48 +0100	[thread overview]
Message-ID: <47ACDDF4.5040307@t-online.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]

Here a small patch for a minor issue:
cat command does not work well for files including '\r' because the 
previous line may be overwritten.
In grub-emu, files with cr/lf line endings are invisible due to ncurses 
behavior.

Christian

2008-02-08  Christian Franke  <franke@computer.org>

	* commands/cat.c (grub_cmd_cat): Print '\r' as hex to
	avoid overwriting previous output.
	* kern/rescue.c (grub_rescue_cmd_cat): Likewise.



[-- Attachment #2: grub2-cat-cr.patch --]
[-- Type: text/x-patch, Size: 855 bytes --]

diff -rup grub2.orig/commands/cat.c grub2/commands/cat.c
--- grub2.orig/commands/cat.c	2007-07-22 01:32:19.000000000 +0200
+++ grub2/commands/cat.c	2007-11-02 21:24:33.375000000 +0100
@@ -50,7 +50,7 @@ grub_cmd_cat (struct grub_arg_list *stat
 	{
 	  unsigned char c = buf[i];
 	  
-	  if (grub_isprint (c) || grub_isspace (c))
+	  if ((grub_isprint (c) || grub_isspace (c)) && c != '\r')
 	    grub_putchar (c);
 	  else
 	    {
diff -rup grub2.orig/kern/rescue.c grub2/kern/rescue.c
--- grub2.orig/kern/rescue.c	2008-02-03 20:29:52.968750000 +0100
+++ grub2/kern/rescue.c	2008-02-08 23:30:37.656250000 +0100
@@ -151,7 +151,7 @@ grub_rescue_cmd_cat (int argc, char *arg
 	{
 	  unsigned char c = buf[i];
 
-	  if (grub_isprint (c) || grub_isspace (c))
+	  if ((grub_isprint (c) || grub_isspace (c)) && c != '\r')
 	    grub_putchar (c);
 	  else
 	    {

             reply	other threads:[~2008-02-08 22:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-08 22:55 Christian Franke [this message]
2008-02-09 11:01 ` [PATCH] print CR as hex in cat command Robert Millan

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=47ACDDF4.5040307@t-online.de \
    --to=christian.franke@t-online.de \
    --cc=grub-devel@gnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.