]> git.lyx.org Git - lyx.git/blobdiff - src/support/os_os2.C
make "make distcheck" work
[lyx.git] / src / support / os_os2.C
index 1b7c1465cc56c7895ac040c361aace2110f4c657..86713af6ee655f8efaa022f24653abae0f960c23 100644 (file)
 #define INCL_DOSERRORS
 #include <os2.h>
 
-#include <boost/scoped_array.hpp>
 
-using boost::scoped_array;
+namespace lyx {
+namespace support {
+namespace os {
 
 namespace {
 
-string binpath_;
-string binname_;
-string tmpdir_;
-string homepath_;
-string nulldev_;
-
-os::shell_type shell_ = os::UNIX;
+shell_type shell_ = UNIX;
 unsigned long cp_ = 0;
 
 }
 
 
-namespace os {
-
-
 void init(int argc, char * argv[])
 {
        _wildcard(&argc, &argv);
@@ -50,22 +42,12 @@ void init(int argc, char * argv[])
        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"));
+       string sh = OnlyFilename(getEnvPath("EMXSHELL"));
        if (sh.empty()) {
                // COMSPEC is set, unless user unsets
-               sh = OnlyFilename(GetEnvPath("COMSPEC"));
+               sh = OnlyFilename(getEnvPath("COMSPEC"));
                if (sh.empty())
                        sh = "cmd.exe";
        }
@@ -89,16 +71,6 @@ void init(int argc, char * argv[])
        // CPList[1] == system default codepage, the rest are auxilary.
        // Once cp_ is correctly set, you can call other routines.
        cp_ = CPList[1];
-
-       tmpdir_ = "/tmp";
-       homepath_ = GetEnvPath("HOME");
-       nulldev_ = "null";
-}
-
-
-void warn(string const & /*mesg*/)
-{
-       return;
 }
 
 
@@ -128,8 +100,8 @@ string::size_type common_path(string const & p1, string const & p2)
        COUNTRYCODE cntry;
        cntry.country = 0;
        cntry.codepage = cp_;
-       string temp1 = slashify_path(p1);
-       string temp2 = slashify_path(p2);
+       string temp1 = internal_path(p1);
+       string temp2 = internal_path(p2);
        char * tmp1 = const_cast<char *> (temp1.c_str());
        char * tmp2 = const_cast<char *> (temp2.c_str());
        /* rc = */ DosMapCase(p1.length(), &cntry, tmp1);
@@ -157,7 +129,7 @@ string::size_type common_path(string const & p1, string const & p2)
 }
 
 
-string slashify_path(string const & p)
+string internal_path(string const & p)
 {
        static bool initialized = false;
        static bool leadbyte[256] = {false};
@@ -202,12 +174,6 @@ string external_path(string const & p)
 }
 
 
-string internal_path(string const & p)
-{
-       return p;
-}
-
-
 bool is_absolute_path(string const & p)
 {
        return (p.length() > 1
@@ -224,45 +190,28 @@ char const * popen_read_mode()
 }
 
 
-string const & binpath()
-{
-       return binpath_;
-}
-
-
-string const & binname()
-{
-       return binname_;
-}
-
-
-void setTmpDir(string const & p)
-{
-       tmpdir_ = p;
-}
-
-
-string const & getTmpDir()
+string const & nulldev()
 {
-       return tmpdir_;
+       static string const nulldev_ = "null";
+       return nulldev_;
 }
 
 
-string const & homepath()
+shell_type shell()
 {
-       return homepath_;
+       return shell_;
 }
 
 
-string const & nulldev()
+char path_separator()
 {
-       return nulldev_;
+       return ';';
 }
 
 
-shell_type shell()
-{
-       return shell_;
-}
+void cygwin_path_fix(bool)
+{}
 
-} // end namespace os
+} // namespace os
+} // namespace support
+} // namespace lyx