X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=538f75d48e66d3606c853471ec50ddccc96ec69e;hb=dba4f28b6269c0ebd7a4e70a82ca10cf6c4a6ff8;hp=d42e4d4ea386396f4bc1ff3398ce4f4bddfbec51;hpb=0d71b517968a09a2cd592cb3177a21b4b25294b5;p=lyx.git diff --git a/src/client/client.cpp b/src/client/client.cpp index d42e4d4ea3..538f75d48e 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -3,8 +3,8 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author João Luis M. Assirati - * \author Lars Gullik Bjønnes + * \author João Luis M. Assirati + * \author Lars Gullik Bjønnes * * Full author contact details are available in file CREDITS. */ @@ -47,7 +47,11 @@ // fcntl() #include +// strerror() +#include + #include +#include #include #include #include @@ -61,6 +65,15 @@ using ::boost::scoped_ptr; namespace lyx { +// Dummy LyXRC support +struct LyXRC { + string icon_set; +} lyxrc; + +// Keep the linker happy on Windows +void lyx_exit(int) +{} + namespace support { string itoa(unsigned int i) @@ -78,7 +91,7 @@ FileNameList lyxSockets(string const & dir, string const & pid) { FileNameList dirlist; - FileName dirpath(dir); + FileName dirpath(dir + "/"); if (!dirpath.exists() || !dirpath.isDirectory()) { lyxerr << dir << " does not exist or is not a directory." @@ -93,7 +106,7 @@ FileNameList lyxSockets(string const & dir, string const & pid) for (; it != end; ++it) { if (!it->isDirectory()) continue; - string const tmpdir = it->absFilename(); + string const tmpdir = it->absFileName(); if (!contains(tmpdir, "lyx_tmpdir" + pid)) continue; @@ -136,7 +149,7 @@ int connect(FileName const & name) if (::connect(fd, reinterpret_cast(&addr), sizeof(addr)) == -1) { - cerr << "lyxclient: Could not connect to socket " << name.absFilename() + cerr << "lyxclient: Could not connect to socket " << name.absFileName() << ": " << strerror(errno) << endl; ::close(fd); return -1; @@ -401,9 +414,9 @@ void usage() "Usage: lyxclient [options]\n" "Options are:\n" " -a address set address of the lyx socket\n" - " -t directory set system temporary directory\n" + " -t directory set system temporary directory (for detecting sockets)\n" " -p pid select a running lyx by pidi\n" - " -c command send a single command and quit\n" + " -c command send a single command and quit (LYXCMD prefix needed)\n" " -g file row send a command to go to file and row\n" " -n name set client name\n" " -h name display this help end exit\n" @@ -565,14 +578,14 @@ int main(int argc, char * argv[]) if (server->connected()) break; lyxerr << "lyxclient: " << "Could not connect to " - << addr->absFilename() << endl; + << addr->absFileName() << endl; } if (addr == end) { lyxerr << "lyxclient: No suitable server found." << endl; return EXIT_FAILURE; } - cerr << "lyxclient: " << "Connected to " << addr->string() << endl; + cerr << "lyxclient: " << "Connected to " << addr->absFileName() << endl; } int const serverfd = server->fd(); @@ -619,7 +632,9 @@ int main(int argc, char * argv[]) iowatch.wait(); if (iowatch.isset(0)) { string command; - cin >> command; + getline(cin, command); + if (command.empty()) + continue; if (command == "BYE:") { server->writeln("BYE:"); saidbye = true;