dtprintinfo: Coverity 89561
[oweals/cde.git] / cde / programs / dtsearchpath / dtsp / SearchPath.C
index f0dd4a0e6b5ff1a77cd57891349e9c9545cb6ef1..55334856dedac954867c2b4c58769f992614827a 100644 (file)
@@ -16,7 +16,7 @@
  * details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with these librararies and programs; if not, write
+ * License along with these libraries and programs; if not, write
  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  * Floor, Boston, MA 02110-1301 USA
  */
@@ -329,6 +329,19 @@ int SearchPath::validSearchPath
     return 0;
 }
 
+/*********************************************************************
+ *  useSystemPath()
+ *
+ *    This member function verifies whether system environment variable
+ *    should be left unmodified, since some other configuraton mechanism
+ *    is in effect.
+ *
+ */
+int SearchPath::useSystemPath()
+{
+    return 0;
+}
+
 /*****************************************************************
  *  ExportPath()
  *
@@ -340,7 +353,9 @@ void SearchPath::ExportPath()
     CString env(environment_var);
     env += "SEARCHPATH";
 
-    user->OS()->shell()->putToEnv(env, final_search_path.data());
+    if (!useSystemPath()) {
+      user->OS()->shell()->putToEnv(env, final_search_path.data());
+    }
 }
 
 
@@ -354,7 +369,7 @@ void SearchPath::Print()
 {
     printf("%sSEARCHPATH:\n", GetEnvVar());
     CString sp(GetSearchPath());
-    if (!sp.isNull()) {
+    if (!useSystemPath() && !sp.isNull()) {
        CTokenizedString path (sp,Separator().data());
        CString subpath = path.next();
        while (!subpath.isNull()) {
@@ -372,7 +387,7 @@ void SearchPath::Print()
  *
  ****************************************************************/
 
-#if defined(linux)
+#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
 void SearchPath::PrettyPrint
        (
        std::ostream & os
@@ -387,14 +402,14 @@ void SearchPath::PrettyPrint
     CTokenizedString path (GetSearchPath(), Separator().data());
     CString subpath = path.next();
     while (!subpath.isNull()) {
-#if defined(linux)
+#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
        os << "        " << subpath << std::endl;
 #else
        os << "        " << subpath << endl;
 #endif
        subpath = path.next();
     }
-#if defined(linux)
+#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
     os << std::endl;
 #else
     os << endl;
@@ -409,7 +424,7 @@ void SearchPath::PrettyPrint
  *
  ****************************************************************/
 
-#if defined(linux)
+#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
 std::ostream & operator<< 
        (
        std::ostream & os, 
@@ -423,7 +438,7 @@ ostream & operator<<
        )
 #endif
 {
-#if defined(linux)
+#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
     os << sp.GetEnvVar() << "SEARCHPATH:" << std::endl;
 #else
     os << sp.GetEnvVar() << "SEARCHPATH:" << endl;