diff options
author | Ben Summers <ben@fluffy.co.uk> | 2006-02-13 13:30:21 +0000 |
---|---|---|
committer | Ben Summers <ben@fluffy.co.uk> | 2006-02-13 13:30:21 +0000 |
commit | 830aa82e44381c85d8486e46de7ae0e26830457e (patch) | |
tree | f29edb3c3013990a3ae758e1ccfdb56a2d20923f /lib/common/FdGetLine.cpp | |
parent | 2edd0a00e3244cc4dbc369d81ed1748768a06fb8 (diff) |
Merge chris/win32/vc2005-compile-fixes @ r455, add infrastructure/msvc to distribution
Diffstat (limited to 'lib/common/FdGetLine.cpp')
-rw-r--r-- | lib/common/FdGetLine.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/common/FdGetLine.cpp b/lib/common/FdGetLine.cpp index dee02604..9b53288b 100644 --- a/lib/common/FdGetLine.cpp +++ b/lib/common/FdGetLine.cpp @@ -10,7 +10,10 @@ #include "Box.h" #include <sys/types.h> -#include <unistd.h> + +#ifdef HAVE_UNISTD_H + #include <unistd.h> +#endif #include "FdGetLine.h" #include "CommonException.h" @@ -117,7 +120,21 @@ std::string FdGetLine::GetLine(bool Preprocess) // Read more in? if(!foundLineEnd && mBufferBegin >= mBytesInBuffer && !mPendingEOF) { +#ifdef WIN32 + int bytes; + + if (mFileHandle == _fileno(stdin)) + { + bytes = console_read(mBuffer, sizeof(mBuffer)); + } + else + { + bytes = ::read(mFileHandle, mBuffer, + sizeof(mBuffer)); + } +#else // !WIN32 int bytes = ::read(mFileHandle, mBuffer, sizeof(mBuffer)); +#endif // WIN32 // Error? if(bytes == -1) |