All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin Watson <cjwatson@ubuntu.com>
To: grub-devel@gnu.org
Cc: 586358-forwarded@bugs.debian.org, Josh Triplett <josh@joshtriplett.org>
Subject: Re: Bug#586358: grub-pc: Please handle DOS line endings in "cat"
Date: Sun, 20 Jun 2010 23:19:37 +0100	[thread overview]
Message-ID: <20100620221937.GS12396@riva.ucam.org> (raw)
In-Reply-To: <20100618183408.12015.77315.reportbug@feather>

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  <cjwatson@ubuntu.com>

	* 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                                       [cjwatson@ubuntu.com]


       reply	other threads:[~2010-06-20 22:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20100618183408.12015.77315.reportbug@feather>
2010-06-20 22:19 ` Colin Watson [this message]
2010-06-21 19:29   ` Bug#586358: grub-pc: Please handle DOS line endings in "cat" Josh Triplett
2010-06-25 18:51   ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-06-28  0:02     ` Colin Watson
2010-06-28  7:53       ` Colin Watson

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=20100620221937.GS12396@riva.ucam.org \
    --to=cjwatson@ubuntu.com \
    --cc=586358-forwarded@bugs.debian.org \
    --cc=grub-devel@gnu.org \
    --cc=josh@joshtriplett.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.