const char * sep
) : SearchPath(user, envvar, sep)
{
-#if defined(__FreeBSD__)
- /* Installer on FreeBSD sets up man configuration so that
- * setting MANPATH is not necessary
- */
- if (!user->OS()->MANPATH().isNull()) {
-#endif
if (user->DTMANPATH())
search_path = user->FactoryManPath() + "," + *user->DTMANPATH();
else
NormalizePath();
TraversePath();
-#if defined(__FreeBSD__)
- }
-#endif
}
}
}
+#if defined(__FreeBSD__)
+/*****************************************************************
+ * useSystemPath()
+ *
+ * Check whether to leave MANPATH unmodified (or unset)
+ *
+ */
+int ManSearchPath::useSystemPath()
+{
+ if (user->OS()->getEnvironmentVariable("MANPATH").isNull()) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+#endif
/*****************************************************************
* ExportPath()
*****************************************************************/
void ManSearchPath::ExportPath()
{
- CString env(GetEnvVar());
- user->OS()->shell()->putToEnv(env,
+ if (!useSystemPath()) {
+ CString env(GetEnvVar());
+ user->OS()->shell()->putToEnv(env,
final_search_path.data());
+ }
}
{
printf("%s:\n", GetEnvVar());
CString sp(GetSearchPath());
- if (!sp.isNull()) {
+ if (!useSystemPath() && !sp.isNull()) {
CTokenizedString path (sp,Separator().data());
CString subpath = path.next();
while (!subpath.isNull()) {
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()
*
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());
+ }
}
{
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()) {
CString Separator() const { return separator; }
virtual int validSearchPath (const CString &) const;
+ virtual int useSystemPath();
void setSeparator (const char * sep) { separator = sep; }
protected:
virtual void MakePath (const CString &);
+#if defined(__FreeBSD__)
+ virtual int useSystemPath();
+#endif
private:
};