On Sat, Jan 25, 2003 at 10:56:37AM +0200, Ville Herva wrote:
> On Fri, Jan 24, 2003 at 05:09:43PM -0600, you [Dave Dykstra] wrote:
> >
> > I think I'll go ahead and put in your patch with the modification of using
> > O_TEXT_STR as you suggest.  
> 
> Thanks.
> 
> > I think the risk is low.  
> 
> I think so, too.
> 
> > I had been concerned that perhaps older CPPs might not be able to handle
> > that syntax, but I see other places in the rsync code that are depending
> > on it so I think it's OK.
> 
> I think it is standard C, but OTOH looking at for example
> http://www.chris-lott.org/resources/cstyle/portableC.pdf
> reminds that not all ancient C preprocessors are compliant. But, with such
> ancient beast, I think a lot of other things would break, too.


fopen() spec per SUSv3 (IEEE Std 1003.1-2001) which supercedes POSIX:

        The mode argument points to a string. If the string
        is one of the following, the file shall be opened in the
        indicated mode. Otherwise, the behavior is undefined.

        r or rb
                Open file for reading.
        w or wb
                Truncate to zero length or create file for writing.
        a or ab
                Append; open or create file for writing at end-of-file.
        r+ or rb+ or r+b
                Open file for update (reading and writing).
        w+ or wb+ or w+b
                Truncate to zero length or create file for update.
        a+ or ab+ or a+b
                Append; open or create file for update, writing at
                end-of-file.

        The character 'b' shall have no effect, but is allowed
        for ISO C standard conformance. Opening a file with read
        mode (r as the first character in the mode argument) shall
        fail if the file does not exist or cannot be read.

Annotations therewith indicate that this is aligned with the
ISO C standard and any conflict is unintentional and defers
to the ISO C standard.

What i don't see here is any mention of the "t" option.  "b"
is explicitly permissable which would imply "t" is otherwise
assumed.  Curiously, the spec does not permit fopen to fail
if the mode argument contains unrecognized characters.  The
only failures permitted related to mode have to do with
access privileges.

SUSv3 does not show the availability of a O_BINARY or O_TEXT
mode for open() which makes sense.  Text/binary handling is
not the responsibility of the OS and open() is a system call.
I think you will need the macros for the open() calls.



-- 
________________________________________________________________
        J.W. Schultz            Pegasystems Technologies
        email address:          [EMAIL PROTECTED]

                Remember Cernan and Schmitt
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html

Reply via email to