* 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>
|
2012-08-10 Corinna Vinschen <vinschen@redhat.com>
|
||||||
|
|
||||||
* libc/stdlib/btowc.c (btowc): Cast to avoid compiler warning.
|
* libc/stdlib/btowc.c (btowc): Cast to avoid compiler warning.
|
||||||
|
|
|
@ -60,27 +60,38 @@ _DEFUN(__sflags, (ptr, mode, optr),
|
||||||
ptr->_errno = EINVAL;
|
ptr->_errno = EINVAL;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
if (mode[1] && (mode[1] == '+' || mode[2] == '+'))
|
while (*++mode)
|
||||||
{
|
{
|
||||||
|
switch (*mode)
|
||||||
|
{
|
||||||
|
case '+':
|
||||||
ret = (ret & ~(__SRD | __SWR)) | __SRW;
|
ret = (ret & ~(__SRD | __SWR)) | __SRW;
|
||||||
m = O_RDWR;
|
m = (m & ~O_ACCMODE) | O_RDWR;
|
||||||
}
|
break;
|
||||||
if (mode[1] && (mode[1] == 'b' || mode[2] == 'b'))
|
case 'b':
|
||||||
{
|
|
||||||
#ifdef O_BINARY
|
|
||||||
m |= O_BINARY;
|
m |= O_BINARY;
|
||||||
#endif
|
break;
|
||||||
}
|
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
else if (mode[1] && (mode[1] == 't' || mode[2] == 't'))
|
case 't':
|
||||||
#else
|
m |= O_TEXT;
|
||||||
else
|
break;
|
||||||
#endif
|
#endif
|
||||||
{
|
#if defined (O_CLOEXEC) && defined (_GLIBC_EXTENSION)
|
||||||
#ifdef O_TEXT
|
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;
|
m |= O_TEXT;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
*optr = m | o;
|
*optr = m | o;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue