All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] print CR as hex in cat command
@ 2008-02-08 22:55 Christian Franke
  2008-02-09 11:01 ` Robert Millan
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Franke @ 2008-02-08 22:55 UTC (permalink / raw)
  To: grub-devel

[-- 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
 	    {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-09 11:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-08 22:55 [PATCH] print CR as hex in cat command Christian Franke
2008-02-09 11:01 ` Robert Millan

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.