Generify source code
Previously we would fail in some parts of the code if we did not have a premade configuration, now we use any code that was marked as Linux, BSD and Solaris as our basis in order to support building unknown Unix systems.
This commit is contained in:
@@ -31,11 +31,7 @@
|
||||
|
||||
#include "Options.h"
|
||||
#include <stdlib.h>
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
#include <iostream>
|
||||
#else
|
||||
#include <iostream.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <pwd.h>
|
||||
|
||||
|
||||
@@ -75,11 +75,7 @@
|
||||
#include "dtappgather.h"
|
||||
#include "DirIterator.h"
|
||||
#include <stdlib.h>
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
#include <iostream>
|
||||
#else
|
||||
#include <iostream.h>
|
||||
#endif
|
||||
|
||||
Options * options;
|
||||
|
||||
@@ -88,7 +84,7 @@ void LegacyCleanUp
|
||||
CDEEnvironment * user
|
||||
)
|
||||
{
|
||||
|
||||
//XXX:
|
||||
// For now, remove the old ApplicationManager subdirectory
|
||||
// so that we don't leave old CDE users with extra baggage
|
||||
// under $HOME.
|
||||
|
||||
@@ -136,25 +136,13 @@ void ManSearchPath::Print()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
std::ostream & operator<<
|
||||
(
|
||||
std::ostream & os,
|
||||
const ManSearchPath & sp
|
||||
)
|
||||
#else
|
||||
ostream & operator<<
|
||||
(
|
||||
ostream & os,
|
||||
const ManSearchPath & sp
|
||||
)
|
||||
#endif
|
||||
{
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
os << sp.GetEnvVar() << std::endl;
|
||||
#else
|
||||
os << sp.GetEnvVar() << endl;
|
||||
#endif
|
||||
sp.PrettyPrint(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -33,11 +33,7 @@
|
||||
|
||||
#include "Options.h"
|
||||
#include <stdlib.h>
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
#include <iostream>
|
||||
#else
|
||||
#include <iostream.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <pwd.h>
|
||||
|
||||
|
||||
@@ -387,33 +387,18 @@ void SearchPath::Print()
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
void SearchPath::PrettyPrint
|
||||
(
|
||||
std::ostream & os
|
||||
) const
|
||||
#else
|
||||
void SearchPath::PrettyPrint
|
||||
(
|
||||
ostream & os
|
||||
) const
|
||||
#endif
|
||||
{
|
||||
CTokenizedString path (GetSearchPath(), Separator().data());
|
||||
CString subpath = path.next();
|
||||
while (!subpath.isNull()) {
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
os << " " << subpath << std::endl;
|
||||
#else
|
||||
os << " " << subpath << endl;
|
||||
#endif
|
||||
subpath = path.next();
|
||||
}
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
os << std::endl;
|
||||
#else
|
||||
os << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -424,25 +409,13 @@ void SearchPath::PrettyPrint
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
std::ostream & operator<<
|
||||
(
|
||||
std::ostream & os,
|
||||
const SearchPath & sp
|
||||
)
|
||||
#else
|
||||
ostream & operator<<
|
||||
(
|
||||
ostream & os,
|
||||
const SearchPath & sp
|
||||
)
|
||||
#endif
|
||||
{
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
os << sp.GetEnvVar() << "SEARCHPATH:" << std::endl;
|
||||
#else
|
||||
os << sp.GetEnvVar() << "SEARCHPATH:" << endl;
|
||||
#endif
|
||||
sp.PrettyPrint(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -34,11 +34,7 @@
|
||||
|
||||
#include "Environ.h"
|
||||
#include "cstring.h"
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
#include <iostream>
|
||||
#else
|
||||
#include <iostream.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
class SearchPath {
|
||||
@@ -51,15 +47,9 @@ class SearchPath {
|
||||
virtual void Print();
|
||||
virtual void AddPredefinedPath();
|
||||
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
virtual void PrettyPrint (std::ostream &) const;
|
||||
|
||||
friend std::ostream & operator<< (std::ostream &, const SearchPath &);
|
||||
#else
|
||||
virtual void PrettyPrint (ostream &) const;
|
||||
|
||||
friend ostream & operator<< (ostream &, const SearchPath &);
|
||||
#endif
|
||||
|
||||
const char * GetEnvVar() const { return environment_var; }
|
||||
CString GetSearchPath() const { return final_search_path; }
|
||||
@@ -186,11 +176,7 @@ class ManSearchPath : public SearchPath {
|
||||
virtual void ExportPath ();
|
||||
virtual void Print();
|
||||
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
friend std::ostream & operator<< (std::ostream &, const ManSearchPath &);
|
||||
#else
|
||||
friend ostream & operator<< (ostream &, const ManSearchPath &);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void MakePath (const CString &);
|
||||
|
||||
@@ -95,32 +95,15 @@ TTFile & TTFile::operator=
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
std::ostream & operator<<
|
||||
(
|
||||
std::ostream & os,
|
||||
TTFile & file
|
||||
)
|
||||
#else
|
||||
ostream & operator<<
|
||||
(
|
||||
ostream & os,
|
||||
TTFile & file
|
||||
)
|
||||
#endif
|
||||
{
|
||||
if (file.ttFileOpFailed())
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
return os << "Error in filename mapping; status = "
|
||||
<< file.getStatus() << std::endl;
|
||||
#else
|
||||
return os << "Error in filename mapping; status = "
|
||||
<< file.getStatus() << endl;
|
||||
#endif
|
||||
else
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
return os << file.data() << std::endl;
|
||||
#else
|
||||
return os << file.data() << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -65,11 +65,7 @@ class TTFile : public CString {
|
||||
};
|
||||
#else
|
||||
void TT_Exception (char *);
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
friend std::ostream & operator<< (std::ostream &, TTFile &);
|
||||
#else
|
||||
friend ostream & operator<< (ostream &, TTFile &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int ttFileOpFailed () { return status != TT_OK; }
|
||||
|
||||
@@ -34,11 +34,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
#include <iostream>
|
||||
#else
|
||||
#include <iostream.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <grp.h>
|
||||
@@ -50,10 +46,8 @@
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(sun) || defined(_AIX) || defined(__linux__) || defined(CSRG_BASED)
|
||||
#define UID_NO_CHANGE ((uid_t) -1)
|
||||
#define GID_NO_CHANGE ((gid_t) -1)
|
||||
#endif
|
||||
|
||||
UnixEnvironment::UnixEnvironment()
|
||||
{
|
||||
|
||||
@@ -566,19 +566,11 @@ int i;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
std::ostream & operator<<
|
||||
(
|
||||
std::ostream & os,
|
||||
const CString & s
|
||||
)
|
||||
#else
|
||||
ostream & operator<<
|
||||
(
|
||||
ostream & os,
|
||||
const CString & s
|
||||
)
|
||||
#endif
|
||||
{
|
||||
if (s.isNull())
|
||||
return os << "(null)";
|
||||
|
||||
@@ -32,11 +32,7 @@
|
||||
#ifndef _CSTRING_H_
|
||||
#define _CSTRING_H_
|
||||
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
#include <iostream>
|
||||
#else
|
||||
#include <iostream.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
class CString {
|
||||
@@ -72,11 +68,7 @@ class CString {
|
||||
int isNull() const;
|
||||
void replace (const CString &, const CString &);
|
||||
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
friend std::ostream & operator<< (std::ostream &, const CString &);
|
||||
#else
|
||||
friend ostream & operator<< (ostream &, const CString &);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
char * contents;
|
||||
|
||||
Reference in New Issue
Block a user