cosmetics

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21821 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-11-27 19:30:59 +00:00
parent 44e715cd8c
commit f5d02d7dc6
2 changed files with 47 additions and 31 deletions

View File

@ -15,14 +15,13 @@
#include "support/Package.h"
#include "support/unicode.h"
#include <boost/current_function.hpp>
#include <cerrno>
namespace lyx {
using lyx::support::package;
using support::package;
using std::endl;
using std::string;
@ -32,7 +31,7 @@ using std::string;
#if 0
-#include <locale>
#include <locale>
// This version of the Pimpl utilizes the message capability of
// libstdc++ that is distributed with GNU G++.
@ -116,7 +115,7 @@ public:
char const * c = bindtextdomain(PACKAGE, locale_dir.c_str());
int e = errno;
if (e) {
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << '\n'
LYXERR(Debug::DEBUG, "Messages::get()" << '\n'
<< "Error code: " << errno << '\n'
<< "Lang, mess: " << lang_ << " " << m << '\n'
<< "Directory : " << package().locale_dir().absFilename() << '\n'
@ -124,7 +123,7 @@ public:
}
if (!bind_textdomain_codeset(PACKAGE, ucs4_codeset)) {
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << '\n'
LYXERR(Debug::DEBUG, "Messages::get()" << '\n'
<< "Error code: " << errno << '\n'
<< "Codeset : " << ucs4_codeset << '\n');
}

View File

@ -18,7 +18,6 @@
#include "support/lstrings.h"
#include <boost/filesystem/operations.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/scoped_ptr.hpp>
// getpid(), getppid()
@ -76,7 +75,9 @@ namespace support {
string itoa(unsigned int i)
{
return ::boost::lexical_cast<string>(i);
char buf[20];
sprintf(buf, "%d", i);
return buf;
}
@ -161,7 +162,12 @@ int connect(FileName const & name)
// Class IOWatch ------------------------------------------------------------
/////////////////////////////////////////////////////////////////////
//
// IOWatch
//
/////////////////////////////////////////////////////////////////////
class IOWatch {
public:
IOWatch();
@ -213,13 +219,19 @@ bool IOWatch::wait()
}
bool IOWatch::isset(int fd) {
bool IOWatch::isset(int fd)
{
return FD_ISSET(fd, &act);
}
// ~Class IOWatch ------------------------------------------------------------
// Class LyXDataSocket -------------------------------------------------------
/////////////////////////////////////////////////////////////////////
//
// LyXDataSocket
//
/////////////////////////////////////////////////////////////////////
// Modified LyXDataSocket class for use with the client
class LyXDataSocket {
public:
@ -327,10 +339,14 @@ void LyXDataSocket::writeln(string const & line)
connected_ = false;
}
}
// ~Class LyXDataSocket -------------------------------------------------------
// Class CmdLineParser -------------------------------------------------------
/////////////////////////////////////////////////////////////////////
//
// CmdLineParser
//
/////////////////////////////////////////////////////////////////////
class CmdLineParser {
public:
typedef int (*optfunc)(vector<docstring> const & args);
@ -387,21 +403,22 @@ namespace cmdline {
void usage()
{
cerr << "Usage: lyxclient [options]" << endl
<< "Options are:" << endl
<< " -a address set address of the lyx socket" << endl
<< " -t directory set system temporary directory" << endl
<< " -p pid select a running lyx by pid" << endl
<< " -c command send a single command and quit" << endl
<< " -g file row send a command to go to file and row" << endl
<< " -n name set client name" << endl
<< " -h name display this help end exit" << endl
<< "If -a is not used, lyxclient will use the arguments of -t and -p to look for" << endl
<< "a running lyx. If -t is not set, 'directory' defaults to /tmp. If -p is set," << endl
<< "lyxclient will connect only to a lyx with the specified pid. Options -c and -g" << endl
<< "cannot be set simultaneoulsly. If no -c or -g options are given, lyxclient" << endl
<< "will read commands from standard input and disconnect when command read is BYE:"
<< endl;
cerr <<
"Usage: lyxclient [options]\n"
"Options are:\n"
" -a address set address of the lyx socket\n"
" -t directory set system temporary directory\n"
" -p pid select a running lyx by pidi\n"
" -c command send a single command and quit\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 -a is not used, lyxclient will use the arguments of -t and -p to look for\n"
"a running lyx. If -t is not set, 'directory' defaults to /tmp. If -p is set,\n"
"lyxclient will connect only to a lyx with the specified pid. Options -c and -g\n"
"cannot be set simultaneoulsly. If no -c or -g options are given, lyxclient\n"
"will read commands from standard input and disconnect when command read is BYE:"
<< endl;
}
@ -412,7 +429,8 @@ int h(vector<docstring> const &)
}
docstring clientName(from_ascii(support::itoa(::getppid()) + ">" + support::itoa(::getpid())));
docstring clientName =
from_ascii(support::itoa(::getppid()) + ">" + support::itoa(::getpid()));
int n(vector<docstring> const & arg)
{
@ -503,7 +521,6 @@ int p(vector<docstring> const & arg)
} // namespace cmdline
} // namespace lyx