mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-30 02:50:25 +08:00
* libc/stdio/flags.c (__sflags): Rewrite recognition of extended mode flags to
just loop over more allowed flags. Support glibc 'e' flag on systems defining _GLIBC_EXTENSION. Support C11 'x' flag.
This commit is contained in:
parent
0b1545eb3a
commit
03f6bb2863
@ -1,3 +1,9 @@
|
||||
2012-08-21 Christopher Faylor <me.cygwin2012@cgf.cx>
|
||||
|
||||
* libc/stdio/flags.c (__sflags): Rewrite recognition of extended mode
|
||||
flags to just loop over more allowed flags. Support glibc 'e' flag on
|
||||
systems defining _GLIBC_EXTENSION. Support C11 'x' flag.
|
||||
|
||||
2012-08-10 Corinna Vinschen <vinschen@redhat.com>
|
||||
|
||||
* libc/stdlib/btowc.c (btowc): Cast to avoid compiler warning.
|
||||
|
@ -60,27 +60,38 @@ _DEFUN(__sflags, (ptr, mode, optr),
|
||||
ptr->_errno = EINVAL;
|
||||
return (0);
|
||||
}
|
||||
if (mode[1] && (mode[1] == '+' || mode[2] == '+'))
|
||||
while (*++mode)
|
||||
{
|
||||
ret = (ret & ~(__SRD | __SWR)) | __SRW;
|
||||
m = O_RDWR;
|
||||
}
|
||||
if (mode[1] && (mode[1] == 'b' || mode[2] == 'b'))
|
||||
{
|
||||
#ifdef O_BINARY
|
||||
m |= O_BINARY;
|
||||
#endif
|
||||
}
|
||||
switch (*mode)
|
||||
{
|
||||
case '+':
|
||||
ret = (ret & ~(__SRD | __SWR)) | __SRW;
|
||||
m = (m & ~O_ACCMODE) | O_RDWR;
|
||||
break;
|
||||
case 'b':
|
||||
m |= O_BINARY;
|
||||
break;
|
||||
#ifdef __CYGWIN__
|
||||
else if (mode[1] && (mode[1] == 't' || mode[2] == 't'))
|
||||
#else
|
||||
else
|
||||
case 't':
|
||||
m |= O_TEXT;
|
||||
break;
|
||||
#endif
|
||||
{
|
||||
#ifdef O_TEXT
|
||||
m |= O_TEXT;
|
||||
#if defined (O_CLOEXEC) && defined (_GLIBC_EXTENSION)
|
||||
case 'e':
|
||||
m |= O_CLOEXEC;
|
||||
break;
|
||||
#endif
|
||||
case 'x':
|
||||
m |= O_EXCL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if defined (O_TEXT) && !defined (__CYGWIN__)
|
||||
if (!(m | O_BINARY))
|
||||
m |= O_TEXT;
|
||||
#endif
|
||||
*optr = m | o;
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user