#include <boost/bind.hpp>
#include <cerrno>
-#include <sys/stat.h>
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
#include <fcntl.h>
#ifdef __EMX__
-#include <cstdlib>
-#include <io.h>
-#define OS2EMX_PLAIN_CHAR
-#define INCL_DOSNMPIPES
-#define INCL_DOSERRORS
-#include <os2.h>
-#include "support/os2_errortable.h"
+# include <cstdlib>
+# include <io.h>
+# define OS2EMX_PLAIN_CHAR
+# define INCL_DOSNMPIPES
+# define INCL_DOSERRORS
+# include <os2.h>
+# include "support/os2_errortable.h"
#endif
using lyx::support::compare;
using std::string;
-// provide an empty mkfifo() if we do not have one. This disables the
-// lyxserver.
-#ifndef HAVE_MKFIFO
-int mkfifo(char const * __path, mode_t __mode) {
- return 0;
+#if !defined (HAVE_MKFIFO)
+// We provide a stub class that disables the lyxserver.
+
+void LyXComm::openConnection()
+{}
+
+
+void LyXComm::closeConnection()
+{}
+
+
+int LyXComm::startPipe(string const & filename, bool write)
+{
+ return -1;
}
-#endif
+
+
+void LyXComm::endPipe(int & fd, string const & filename, bool write)
+{}
+
+
+void LyXComm::emergencyCleanup()
+{}
+
+void LyXComm::read_ready()
+{}
+
+
+void LyXComm::send(string const & msg)
+{}
+
+
+#else // defined (HAVE_MKFIFO)
void LyXComm::openConnection()
int LyXComm::startPipe(string const & filename, bool write)
{
- int fd;
-
#ifdef __EMX__
HPIPE os2fd;
APIRET rc;
};
// Imported handles can be used both with OS/2 APIs and emx
// library functions.
- fd = _imphandle(os2fd);
+ int const fd = _imphandle(os2fd);
#else
if (::access(filename.c_str(), F_OK) == 0) {
lyxerr << "LyXComm: Pipe " << filename << " already exists.\n"
<< strerror(errno) << endl;
return -1;
};
- fd = ::open(filename.c_str(), write ? (O_RDWR) : (O_RDONLY|O_NONBLOCK));
+ int const fd = ::open(filename.c_str(),
+ write ? (O_RDWR) : (O_RDONLY|O_NONBLOCK));
#endif
if (fd < 0) {
}
if (!write) {
- lyx_gui::register_socket_callback(fd, boost::bind(&LyXComm::read_ready, *this));
+ lyx_gui::register_socket_callback(fd, boost::bind(&LyXComm::read_ready, this));
}
return fd;
#endif
}
+#endif // defined (HAVE_MKFIFO)
+
+
+string const LyXComm::inPipeName() const
+{
+ return pipename + string(".in");
+}
+
+
+string const LyXComm::outPipeName() const
+{
+ return pipename + string(".out");
+}
+
// LyXServer class