[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug#586358: grub-pc: Please handle DOS line endings in "cat"
From: |
Colin Watson |
Subject: |
Re: Bug#586358: grub-pc: Please handle DOS line endings in "cat" |
Date: |
Sun, 20 Jun 2010 23:19:37 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Fri, Jun 18, 2010 at 11:34:08AM -0700, Josh Triplett wrote:
> The "cat" command, if given a file with DOS line endings, will show the
> \r at the end of every line as a control character. For convenience,
> please consider adding support for this in "cat", ideally automatically.
Makes sense to me. grub-devel, how about this patch?
2010-06-20 Colin Watson <address@hidden>
* commands/cat.c (grub_cmd_cat): Print DOS "\r\n" line endings as
simple newlines.
=== modified file 'commands/cat.c'
--- commands/cat.c 2010-03-01 19:24:34 +0000
+++ commands/cat.c 2010-06-20 22:11:37 +0000
@@ -54,6 +54,11 @@ grub_cmd_cat (grub_command_t cmd __attri
if ((grub_isprint (c) || grub_isspace (c)) && c != '\r')
grub_putchar (c);
+ else if (c == '\r' && buf[i + 1] == '\n')
+ {
+ grub_putchar ('\n');
+ i++;
+ }
else
{
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
Thanks,
--
Colin Watson address@hidden
- Re: Bug#586358: grub-pc: Please handle DOS line endings in "cat",
Colin Watson <=