]> git.lyx.org Git - lyx.git/blobdiff - src/client/client.C
cleanup some debug messages
[lyx.git] / src / client / client.C
index 56cde72886cc60f2d42c040b072623b8ff51fa88..4cc3ab70ac509d7fff3c298c628b3bee7fb2fb03 100644 (file)
 #include <boost/scoped_ptr.hpp>
 
 // getpid(), getppid()
-#include <sys/types.h>
-#include <unistd.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 
 // select()
-#include <sys/select.h>
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
 
 // socket(), connect()
-#include <sys/socket.h>
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
 #include <sys/un.h>
 
 // fcntl()
 #include <fcntl.h>
 
+#include <cerrno>
 #include <cstdlib>
 #include <string>
 #include <vector>
@@ -115,12 +124,14 @@ int connect(string const & name)
                     << strerror(errno) << endl;
                return -1;
        }
-       if (::connect(fd, (struct sockaddr *)&addr, SUN_LEN(&addr)) == -1) {
+       if (::connect(fd,
+                     reinterpret_cast<struct sockaddr *>(&addr),
+                     sizeof(addr)) == -1) {
                cerr << "lyxclient: Could not connect to socket " << name
                     << ": " << strerror(errno) << endl;
                ::close(fd);
                return -1;
-        }
+       }
        if (::fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
                cerr << "lyxclient: Could not set O_NONBLOCK for socket: "
                     << strerror(errno) << endl;
@@ -253,7 +264,7 @@ bool LyXDataSocket::connected() const
 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;
        string::size_type pos;