diff --git a/ChangeLog b/ChangeLog index 58772aa886..2727b6760b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +1999-11-01 Lars Gullik Bjønnes + + * added patch for OS/2 from SMiyata. + 1999-10-28 Jean-Marc Lasgouttes * src/support/syscall.C (Systemcalls::kill): diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 8b46912c9b..7adbc5328f 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -601,8 +601,9 @@ bool RunScript(Buffer *buffer, bool wait, if (sh.empty()) sh = "cmd.exe"; } - sh = lowercase(sh); - if (sh.contains("cmd.exe") || sh.contains("4os2.exe")) + sh = lowercase(sh); + if (contains(sh, "cmd.exe") + || contains(sh, "4os2.exe")) cmd = "start /min/n " + cmd; else cmd += " &"; @@ -1076,13 +1077,14 @@ Buffer * NewLyxFile(string const & filename) { // Split argument by : string name; - string tmpname=split(filename, name, ':'); + string tmpname = split(filename, name, ':'); #ifdef __EMX__ // Fix me! lyx_cb.C may not be low level enough to allow this. - if (name.length() == 1 && isalpha((unsigned char) name[0]) && - (tmpname.prefixIs("/") || tmpname.prefixIs("\\"))) { + if (name.length() == 1 + && isalpha(static_cast(name[0])) + && (prefixIs(tmpname, "/") || prefixIs(tmpname, "\\"))) { name += ':'; - name += tmpname.token(':'); - tmpname = split(tmpname, ':'); + name += token(tmpname, ':', 0); + tmpname = split(tmpname, ':'); } #endif lyxerr.debug() << "Arg is " << filename diff --git a/src/lyxserver.C b/src/lyxserver.C index 719412757e..9dafa73de0 100644 --- a/src/lyxserver.C +++ b/src/lyxserver.C @@ -139,8 +139,8 @@ void LyXComm::openConnection() { rc = DosConnectNPipe(fd); if (rc != NO_ERROR && rc != ERROR_PIPE_NOT_CONNECTED) { errnum = TranslateOS2Error(rc); - lyxerr <<"LyXComm: Could not create pipe " + tmp); - lyxerr <0 && TempBase[i] != '/') --i; - if (i>0) + if (i < 0) i = 0; + while (i > 0 && TempBase[i] != '/') --i; + if (i > 0) #else - if (i<2) i=2; - while (i>2 && TempBase[i] != '/') --i; - if (i>2) + if (i < 2) i = 2; + while (i > 2 && TempBase[i] != '/') --i; + if (i > 2) #endif TempBase.erase(i, string::npos); else @@ -619,7 +603,7 @@ bool AbsolutePath(string const & path) #ifndef __EMX__ return (!path.empty() && path[0] == '/'); #else - return (!path.empty() && path[0]=='/' || (isalpha((unsigned char) path[0]) && path[1]==':')); + return (!path.empty() && (path[0]=='/' || (isalpha((unsigned char) path[0]) && path.length()>1 && path[1]==':'))); #endif } diff --git a/src/support/lyxlib.h b/src/support/lyxlib.h index 87a5aaee80..fc894c8707 100644 --- a/src/support/lyxlib.h +++ b/src/support/lyxlib.h @@ -13,6 +13,8 @@ #define LYX_LIB_H #include +#include + #include "LString.h" #include "gettext.h" #include "support/filetools.h" @@ -44,4 +46,22 @@ inline string getUserName() userName = _("unknown"); return userName; } + +// This should have been a namespace +struct lyx { + static char * getcwd(char * buffer, size_t size) { +#ifndef __EMX__ + return ::getcwd(buffer, size); +#else + return ::_getcwd2(buffer, size); +#endif + }; + static chdir(const char * name) { +#ifndef __EMX__ + return ::chdir(name); +#else + return ::_chdir2(name); +#endif + }; +}; #endif diff --git a/src/support/path.h b/src/support/path.h index ad5a905b40..532e808d4f 100644 --- a/src/support/path.h +++ b/src/support/path.h @@ -7,6 +7,7 @@ #include "gettext.h" #include "support/filetools.h" #include "lyx_gui_misc.h" +#include "lyxlib.h" class Path { public: @@ -16,7 +17,7 @@ public: { if (!path.empty()) { pushedDir_ = GetCWD(); - if (pushedDir_.empty() || chdir(path.c_str())) { + if (pushedDir_.empty() || lyx::chdir(path.c_str())) { WriteFSAlert(_("Error: Could not change to directory: "), path); } @@ -37,7 +38,7 @@ public: pushedDir_); return 0; } - if (chdir(pushedDir_.c_str())) { + if (lyx::chdir(pushedDir_.c_str())) { WriteFSAlert( _("Error: Could not change to directory: "), pushedDir_);