+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>
// early as possible.
lyxerr.rdbuf(std::cerr.rdbuf());
- os::init(&argc, &argv);
+ os::init(argc, argv);
// initialize for internationalized version *EK*
locale_init();
+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.
};
// 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
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);
namespace os {
-void init(int * argc, char ** argv[])
+void init(int argc, char * argv[])
{
- if (argc != 0 /* This is a hack! */) {
- _wildcard(argc, argv);
- PTIB ptib = new TIB[1];
- PPIB ppib = new PIB[1];
- APIRET rc = DosGetInfoBlocks(&ptib, &ppib);
- if (rc != NO_ERROR)
- exit(rc);
- scoped_array<char> tmp(new char[256]);
- // This is the only reliable way to retrieve the executable name.
- rc = DosQueryModuleName(ppib->pib_hmte, 256L, tmp);
- if (rc != NO_ERROR)
- exit(rc);
- string p = tmp.get();
- p = slashify_path(p);
- binname_ = OnlyFilename(p);
- binname_.erase(binname_.length()-4, string::npos);
- binpath_ = OnlyPath(p);
-
- // OS/2 cmd.exe has another use for '&'
- string sh = OnlyFilename(GetEnvPath("EMXSHELL"));
- if (sh.empty()) {
- // COMSPEC is set, unless user unsets
- sh = OnlyFilename(GetEnvPath("COMSPEC"));
- if (sh.empty())
- sh = "cmd.exe";
- }
- sh = lowercase(sh); // DosMapCase() is an overkill here
- if (contains(sh, "cmd.exe") || contains(sh, "4os2.exe"))
- shell_ = os::CMD_EXE;
- else
- shell_ = os::UNIX;
+ _wildcard(&argc, &argv);
+ PTIB ptib = new TIB[1];
+ PPIB ppib = new PIB[1];
+ APIRET rc = DosGetInfoBlocks(&ptib, &ppib);
+ if (rc != NO_ERROR)
+ exit(rc);
+ scoped_array<char> tmp(new char[256]);
+ // This is the only reliable way to retrieve the executable name.
+ rc = DosQueryModuleName(ppib->pib_hmte, 256L, tmp);
+ if (rc != NO_ERROR)
+ exit(rc);
+ string p = tmp.get();
+ p = slashify_path(p);
+ binname_ = OnlyFilename(p);
+ binname_.erase(binname_.length()-4, string::npos);
+ binpath_ = OnlyPath(p);
+
+ // OS/2 cmd.exe has another use for '&'
+ string sh = OnlyFilename(GetEnvPath("EMXSHELL"));
+ if (sh.empty()) {
+ // COMSPEC is set, unless user unsets
+ sh = OnlyFilename(GetEnvPath("COMSPEC"));
+ if (sh.empty())
+ sh = "cmd.exe";
}
+ sh = lowercase(sh); // DosMapCase() is an overkill here
+ if (contains(sh, "cmd.exe") || contains(sh, "4os2.exe"))
+ shell_ = os::CMD_EXE;
+ else
+ shell_ = os::UNIX;
static bool initialized = false;
if (initialized)
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)) {
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 ~/
string binsearchpath = GetEnvPath("PATH");
// This will make "src/lyx" work always :-)
binsearchpath += ";.";
- tmp = *argv[0];
+ tmp = argv[0];
tmp = FileOpenSearch(binsearchpath, tmp);
}
+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/
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");