grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] print CR as hex in cat command


From: Christian Franke
Subject: [PATCH] print CR as hex in cat command
Date: Fri, 08 Feb 2008 23:55:48 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071128 SeaMonkey/1.1.7

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  <address@hidden>

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


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 via email to

[Prev in Thread] Current Thread [Next in Thread]