* 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.
*/
// fcntl()
#include <fcntl.h>
+// strerror()
+#include <string.h>
+
#include <cerrno>
+#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
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)
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;
if (::connect(fd,
reinterpret_cast<struct sockaddr *>(&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;
"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"
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();
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;