mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-13 17:20:55 +00:00
Clean-up interface to os::init.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@9371 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
40113d7c95
commit
c6b604aad4
@ -1,3 +1,7 @@
|
||||
2004-12-14 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* main.C: (main): no longer pass pointers to os::init.
|
||||
|
||||
2004-12-14 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* BufferView_pimpl.C: remove unnecessary #include <sys/wait.h>.
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
os::init(&argc, &argv);
|
||||
os::init(argc, argv);
|
||||
|
||||
// lyx_localedir is used by gettext_init() is we have
|
||||
// i18n support built-in
|
||||
|
@ -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.
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
};
|
||||
|
||||
//
|
||||
static void init(int * argc, char ** argv[]);
|
||||
static void init(int argc, char * argv[]);
|
||||
|
||||
//
|
||||
static string binpath() {return binpath_;}
|
||||
|
@ -18,40 +18,40 @@ string os::tmpdir_ = string();
|
||||
os::shell_type os::_shell = os::UNIX;
|
||||
unsigned long os::cp_ = 0;
|
||||
|
||||
void os::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);
|
||||
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);
|
||||
p = slashify_path(p);
|
||||
binname_ = OnlyFilename(p);
|
||||
binname_.erase(binname_.length()-4, string::npos);
|
||||
binpath_ = OnlyPath(p);
|
||||
void os::init(int argc, char * argv[])
|
||||
{
|
||||
_wildcard(&argc, &argv);
|
||||
PTIB ptib = new TIB[1];
|
||||
PPIB ppib = new PIB[1];
|
||||
APIRET rc = DosGetInfoBlocks(&ptib, &ppib);
|
||||
if (rc != NO_ERROR)
|
||||
exit(rc);
|
||||
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);
|
||||
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;
|
||||
// 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) return;
|
||||
initialized = true;
|
||||
|
@ -13,14 +13,15 @@ string os::tmpdir_ = string();
|
||||
os::shell_type os::_shell = os::UNIX;
|
||||
unsigned long os::cp_ = 0;
|
||||
|
||||
void os::init(int * /*argc*/, char ** argv[]) /* :cp_(0), _shell(os::UNIX) */ {
|
||||
void os::init(int /*argc*/, char * argv[]) /* :cp_(0), _shell(os::UNIX) */
|
||||
{
|
||||
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 (!os::is_absolute_path(tmp)) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// os_win32.C copyright "Ruurd A. Reitsma" <R.A.Reitsma@wbmt.tudelft.nl>
|
||||
// os_win32.C copyright "Ruurd A. Reitsma" <rareitsma@yahoo.com>
|
||||
|
||||
// Various OS specific functions
|
||||
#include <config.h>
|
||||
@ -21,11 +21,11 @@ unsigned long os::cp_ = 0;
|
||||
|
||||
using std::endl;
|
||||
|
||||
void os::init(int * /* argc */, char ** argv[]) {
|
||||
void os::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 ~/
|
||||
|
||||
@ -33,7 +33,7 @@ void os::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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user