mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 19:52:20 +00:00
Improve MANPATH control
* Revert changes to programs/dtsearchpath/libCliSrv/UnixEnv.C
introduced by c3cb5b8aa6
that could have produced disappearing Application Manager
icons on FreeBSD
* Introduce SearchPath:useSystemPath() virtual method to tell
dtsearchpath to leave some environment variables alone.
It is currently overriden for FreeBSD only if the MANPATH
is empty (system default). Other operating systems
might want to override it if they prefer to have distribution
specific control of a search path in effect.
* Symlink /usr/dt/share/man to /usr/dt/man for FreeBSD
This allows dtsearchpath to actually include /usr/dt/man
in the MANPATH when MANPATH override is in effect.
This commit is contained in:
parent
071da0d223
commit
464bc5b3f6
5 changed files with 47 additions and 15 deletions
|
@ -1288,6 +1288,10 @@ doc/C/man/man4/mwmrc.4
|
|||
install_target = /usr/dt/man
|
||||
type = sym_link
|
||||
}
|
||||
{ freebsd
|
||||
install_target = /usr/dt/man
|
||||
type = sym_link
|
||||
}
|
||||
#
|
||||
./share/catman
|
||||
{ uxp
|
||||
|
|
|
@ -42,12 +42,6 @@ ManSearchPath::ManSearchPath
|
|||
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
|
||||
|
@ -61,9 +55,6 @@ ManSearchPath::ManSearchPath
|
|||
|
||||
NormalizePath();
|
||||
TraversePath();
|
||||
#if defined(__FreeBSD__)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,6 +88,22 @@ void ManSearchPath::MakePath
|
|||
}
|
||||
}
|
||||
|
||||
#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()
|
||||
|
@ -106,9 +113,11 @@ void ManSearchPath::MakePath
|
|||
*****************************************************************/
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -116,7 +125,7 @@ void ManSearchPath::Print()
|
|||
{
|
||||
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()) {
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -78,6 +78,7 @@ class SearchPath {
|
|||
CString Separator() const { return separator; }
|
||||
|
||||
virtual int validSearchPath (const CString &) const;
|
||||
virtual int useSystemPath();
|
||||
|
||||
void setSeparator (const char * sep) { separator = sep; }
|
||||
|
||||
|
@ -193,6 +194,9 @@ class ManSearchPath : public SearchPath {
|
|||
|
||||
protected:
|
||||
virtual void MakePath (const CString &);
|
||||
#if defined(__FreeBSD__)
|
||||
virtual int useSystemPath();
|
||||
#endif
|
||||
|
||||
private:
|
||||
};
|
||||
|
|
|
@ -83,7 +83,7 @@ UnixEnvironment::UnixEnvironment()
|
|||
#elif defined(__OpenBSD__)
|
||||
manpath = "/usr/share/man:/usr/X11R6/man:/usr/local/man:/usr/ports/infrastructure/man";
|
||||
#elif defined(__FreeBSD__)
|
||||
manpath = temp;
|
||||
manpath = "/usr/share/man:/usr/local/man";
|
||||
#endif
|
||||
else
|
||||
manpath = temp;
|
||||
|
|
Loading…
Reference in a new issue