[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with -i ignore-file option in version 6.9 ptx in cygwin envi
From: |
Jim Meyering |
Subject: |
Re: Problem with -i ignore-file option in version 6.9 ptx in cygwin environment |
Date: |
Thu, 06 Sep 2007 08:57:00 +0200 |
Graig <address@hidden> wrote:
> I've found that the only way that ptx will correctly use the contents of the
> ignore-file is if that file is formatted in the Unix style with just an octal
> 012 (LF) between lines. If it is formated in the DOS style with octal 015
> (CR) and 012 (LF) between lines, the results are as though the ignore-file
> wasn't specified at all.
>
> Attached is a small zip file that demonstrates the problem. The contents are:
> SplForPtx.txt - sample input for the ptx command
> ptx_ignore.w.txt - an ignore-file formatted in dos mode
> ptx_ignore.u.txt - an ignore-file formatted in unix mode
> MakeSplPtx.bat - a script that will create output using the two different
> ignore files
> ShopTips.w.ptx - output when using the dos formatted ignore-file
> ShopTips.u.ptx - output when using the unix formatted ignore-file
Thanks for reporting that.
This is due to the silly binary/text distinction that developers
everywhere have come to love.
In this case, maybe we can make it easier for the folks using Cygwin.
A lot of the coreutils already do this by calling e.g., fopen with "rb".
But ptx uses open, so here's a proposed patch:
diff --git a/src/ptx.c b/src/ptx.c
index 67b70c6..a5cea72 100644
--- a/src/ptx.c
+++ b/src/ptx.c
@@ -523,7 +523,7 @@ swallow_file_in_memory (const char *file_name, BLOCK *block)
if (using_stdin)
file_handle = STDIN_FILENO;
else
- if ((file_handle = open (file_name, O_RDONLY)) < 0)
+ if ((file_handle = open (file_name, O_RDONLY | O_TEXT)) < 0)
error (EXIT_FAILURE, errno, "%s", file_name);
/* If the file is a plain, regular file, allocate the memory buffer all at
Does that solve your problem?
Adding O_TEXT is a no-op on Unix systems.
- Text tools, line endings, and O_TEXT, (continued)
- Text tools, line endings, and O_TEXT, John Cowan, 2007/09/06
- Re: Text tools, line endings, and O_TEXT, Eric Blake, 2007/09/06
- Re: Text tools, line endings, and O_TEXT, Micah Cowan, 2007/09/06
- Re: Text tools, line endings, and O_TEXT, Eric Blake, 2007/09/06
- Re: Text tools, line endings, and O_TEXT, John Cowan, 2007/09/06
- Re: Text tools, line endings, and O_TEXT, Eric Blake, 2007/09/06
- Re: Text tools, line endings, and O_TEXT, John Cowan, 2007/09/06
- Re: Text tools, line endings, and O_TEXT, Micah Cowan, 2007/09/06
- Re: Text tools, line endings, and O_TEXT, John Cowan, 2007/09/06
- Re: Text tools, line endings, and O_TEXT, Bob Proulx, 2007/09/06
Re: Problem with -i ignore-file option in version 6.9 ptx in cygwin environment,
Jim Meyering <=