>
> 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?
>
>   
Unconditionaly stripping \r is a bad idea because sometimes cat in grub
is used to determine why the system fails to boot. And if by a stupid
action fstab becomes DOS-formated 'cat /etc/fstab' will fail to show
this important point. But it's ok to add an option for cat'ing DOS
files. In this case we probably need to mark unix newlines somehow to
detect a reverse problem
> 2010-06-20  Colin Watson  <[email protected]>
>
>       * 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,
>
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to