Clean-up interface to os::init.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9372 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2004-12-14 16:20:07 +00:00
parent 548a928e9b
commit 005322c183
9 changed files with 51 additions and 41 deletions

View File

@ -1,3 +1,6 @@
2004-12-14 Angus Leeming <leeming@lyx.org>
* main.C: (main): no longer pass pointers to os::init.
2004-12-06 Alfredo Braunstein <abraunst@lyx.org>

View File

@ -34,7 +34,7 @@ int main(int argc, char * argv[])
// early as possible.
lyxerr.rdbuf(std::cerr.rdbuf());
os::init(&argc, &argv);
os::init(argc, argv);
// initialize for internationalized version *EK*
locale_init();

View File

@ -1,3 +1,8 @@
2004-12-14 Angus Leeming <leeming@lyx.org>
* os.h, os_{os2,unix,win32}.C (init): change interface to no longer
pass the addresses of the parameters received by main.
2004-12-14 Angus Leeming <leeming@lyx.org>
* copy.C (copy): open the ifstream with ios::binary.

View File

@ -28,7 +28,7 @@ enum shell_type {
};
// do some work just once
void init(int * argc, char ** argv[]);
void init(int argc, char * argv[]);
// returns path of LyX binary
std::string binpath();
// returns name of LyX binary
@ -45,9 +45,9 @@ shell_type shell();
std::string::size_type common_path(std::string const & p1, std::string const & p2);
// no-op on UNIX, '\\'->'/' on OS/2 and Win32, ':'->'/' on MacOS, etc.
std::string slashify_path(std::string const & p);
// converts a host OS path to unix style
// Converts a unix style path to host OS style.
std::string external_path(std::string const & p);
// converts a unix path to host OS style
// Converts a host OS style path to unix style.
std::string internal_path(std::string const & p);
// is path absolute?
bool is_absolute_path(std::string const & p);

View File

@ -39,10 +39,9 @@ unsigned long cp_ = 0;
namespace os {
void init(int * argc, char ** argv[])
void init(int argc, char * argv[])
{
if (argc != 0 /* This is a hack! */) {
_wildcard(argc, argv);
_wildcard(&argc, &argv);
PTIB ptib = new TIB[1];
PPIB ppib = new PIB[1];
APIRET rc = DosGetInfoBlocks(&ptib, &ppib);
@ -72,7 +71,6 @@ void init(int * argc, char ** argv[])
shell_ = os::CMD_EXE;
else
shell_ = os::UNIX;
}
static bool initialized = false;
if (initialized)

View File

@ -32,14 +32,14 @@ namespace lyx {
namespace support {
namespace os {
void init(int * /*argc*/, char ** argv[])
void init(int /*argc*/, char * argv[])
{
static bool initialized = false;
if (initialized)
return;
initialized = true;
string tmp = *argv[0];
string tmp = argv[0];
binname_ = OnlyFilename(tmp);
tmp = ExpandPath(tmp); // This expands ./ and ~/
if (!is_absolute_path(tmp)) {

View File

@ -40,14 +40,14 @@ namespace lyx {
namespace support {
namespace os {
void init(int * /* argc */, char ** argv[])
void init(int /* argc */, char * argv[])
{
static bool initialized = false;
if (initialized)
return;
initialized = true;
string tmp = *argv[0];
string tmp = argv[0];
binname_ = OnlyFilename(tmp);
tmp = ExpandPath(tmp); // This expands ./ and ~/
@ -55,7 +55,7 @@ void init(int * /* argc */, char ** argv[])
string binsearchpath = GetEnvPath("PATH");
// This will make "src/lyx" work always :-)
binsearchpath += ";.";
tmp = *argv[0];
tmp = argv[0];
tmp = FileOpenSearch(binsearchpath, tmp);
}

View File

@ -1,3 +1,7 @@
2004-12-14 Angus Leeming <leeming@lyx.org>
* tex2lyx.C (main): no longer pass pointers to os::init.
2004-12-14 Angus Leeming <leeming@lyx.org>
* Makefile.am (AM_CPPFLAGS): Remove trailing slash from -Ifoo/

View File

@ -347,7 +347,7 @@ int main(int argc, char * argv[])
return 2;
}
lyx::support::os::init(&argc, &argv);
lyx::support::os::init(argc, argv);
lyx::support::setLyxPaths();
string const system_syntaxfile = lyx::support::LibFileSearch("reLyX", "syntax.default");