#include <config.h>
-#include <config.h>
-
#include "lyxsocket.h"
-
-#if !(defined(HAVE_READ) && defined(HAVE_WRITE) && defined(HAVE_CLOSE))
-// We provide stub classes to disables the sockets.
-
-LyXServerSocket::LyXServerSocket(LyXFunc *, std::string const &)
-{}
-
-
-LyXServerSocket::~LyXServerSocket()
-{}
-
-
-std::string const & LyXServerSocket::address() const
-{
- return address_;
-}
-
-
-void LyXServerSocket::serverCallback()
-{}
-
-
-void LyXServerSocket::dataCallback(int)
-{}
-
-
-void LyXServerSocket::writeln(std::string const &)
-{}
-
-
-LyXDataSocket::LyXDataSocket(int)
-{}
-
-
-LyXDataSocket::~LyXDataSocket()
-{}
-
-
-bool LyXDataSocket::connected() const
-{
- return false;
-}
-
-
-bool LyXDataSocket::readln(std::string &)
-{
- return false;
-}
-
-
-void LyXDataSocket::writeln(std::string const &)
-{}
-
-#else // defined(HAVE_READ) && defined(HAVE_WRITE) && defined(HAVE_CLOSE)
-
-
#include "debug.h"
#include "funcrequest.h"
#include "LyXAction.h"
#include <cerrno>
+#if defined (_WIN32)
+# include <io.h>
+#endif
+
using boost::shared_ptr;
using std::auto_ptr;
string const linen(line + '\n');
int const size = linen.size();
int const written = ::write(fd_, linen.c_str(), size);
- if (written < size) { // Allways mean end of connection.
+ if (written < size) { // Always mean end of connection.
if ((written == -1) && (errno == EPIPE)) {
// The program will also receive a SIGPIPE
// that must be caught
bool LyXDataSocket::readln(string & line)
{
int const charbuf_size = 100;
- char charbuf[charbuf_size]; // buffer for the ::read() system call
+ char charbuf[charbuf_size]; // buffer for the ::read() system call
int count;
// read and store characters in buffer
string const linen(line + '\n');
int const size = linen.size();
int const written = ::write(fd_, linen.c_str(), size);
- if (written < size) { // Allways mean end of connection.
+ if (written < size) { // Always mean end of connection.
if ((written == -1) && (errno == EPIPE)) {
// The program will also receive a SIGPIPE
// that must be catched
connected_ = false;
}
}
-
-#endif // defined(HAVE_READ) && defined(HAVE_WRITE) && defined(HAVE_CLOSE)