From: paolo Date: Mon, 18 Nov 2002 20:03:52 +0000 (+0000) Subject: 2002-11-18 Paolo Carlini X-Git-Tag: upstream/4.9.2~83367 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dac41ecbcb2da21b4aef72df6b8d07435711cc7e;p=platform%2Fupstream%2Flinaro-gcc.git 2002-11-18 Paolo Carlini PR libstdc++/6745 (continued) * include/bits/streambuf.tcc (__copy_streambufs): Deal with interactive input by using isatty as in the fix for libstdc++/8399. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59229 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 302f582..7934d74 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2002-11-18 Paolo Carlini + + PR libstdc++/6745 (continued) + * include/bits/streambuf.tcc (__copy_streambufs): + Deal with interactive input by using isatty as in the + fix for libstdc++/8399. + 2002-11-17 Jakub Jelinek * config/linker-map.gnu: Export _S_construct even if size_t is diff --git a/libstdc++-v3/include/bits/streambuf.tcc b/libstdc++-v3/include/bits/streambuf.tcc index c8084ee..cdaab2e 100644 --- a/libstdc++-v3/include/bits/streambuf.tcc +++ b/libstdc++-v3/include/bits/streambuf.tcc @@ -37,6 +37,10 @@ #pragma GCC system_header +#ifdef _GLIBCPP_HAVE_UNISTD_H +#include +#endif + namespace std { template @@ -219,8 +223,14 @@ namespace std } else { - _CharT __buf[256]; - streamsize __charsread = __sbin->sgetn(__buf, sizeof(__buf)); +#ifdef _GLIBCPP_HAVE_ISATTY + size_t __size = isatty(0) ? 1 : static_cast(BUFSIZ); +#else + size_t __size = 1; +#endif + _CharT* __buf = + static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __size)); + streamsize __charsread = __sbin->sgetn(__buf, __size); __xtrct = __sbout->sputn(__buf, __charsread); __ret += __xtrct; if (__xtrct != __charsread)