From 408f8256cde9c70ee14cf58a4235900f3afe0581 Mon Sep 17 00:00:00 2001 From: "Matthew R. Trower" Date: Tue, 19 Jun 2018 15:25:20 -0500 Subject: [PATCH 1/4] Resolve inconsistent strcasestr availability on Sun --- cde/programs/dtmail/dtmail/FindDialog.C | 4 ++-- cde/programs/dtmail/dtmail/FindDialog.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cde/programs/dtmail/dtmail/FindDialog.C b/cde/programs/dtmail/dtmail/FindDialog.C index 1f489b5b2..cef88a7d5 100644 --- a/cde/programs/dtmail/dtmail/FindDialog.C +++ b/cde/programs/dtmail/dtmail/FindDialog.C @@ -729,13 +729,13 @@ FindDialog::compareMessage(DtMailMessageHandle handle) return(found); } -#if !defined(CSRG_BASED) && !defined(__linux__) && !defined(sun) +#if !defined(CSRG_BASED) && !defined(__linux__) // // See if string 'toFind' is anyware in string 'str'. // A case-insensitive version of strstr(). // static const char * -strcasestr(const char *str, const char *toFind) +FindDialog::strcasestr(const char *str, const char *toFind) { const char *result = NULL; // Default to not found. diff --git a/cde/programs/dtmail/dtmail/FindDialog.h b/cde/programs/dtmail/dtmail/FindDialog.h index b3dc141db..2b99d44b1 100644 --- a/cde/programs/dtmail/dtmail/FindDialog.h +++ b/cde/programs/dtmail/dtmail/FindDialog.h @@ -102,6 +102,11 @@ private: Boolean compareMessage(DtMailMessageHandle handle); + #if !defined(CSRG_BASED) && !defined(__linux__) + static const char * strcasestr(const char *str, + const char *toFind); + #endif + Boolean compareHeader(DtMailEnv & error, DtMailValueSeq & seq, const char * cmpToString); From b2540645a39e1ccd613717940ce39e7fc9dacdc8 Mon Sep 17 00:00:00 2001 From: "Matthew R. Trower" Date: Mon, 11 Jun 2018 23:10:39 -0500 Subject: [PATCH 2/4] Minor corrections and cleanup to sun.cf --- cde/config/cf/sun.cf | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cde/config/cf/sun.cf b/cde/config/cf/sun.cf index e238bd214..86f21f39e 100644 --- a/cde/config/cf/sun.cf +++ b/cde/config/cf/sun.cf @@ -29,8 +29,7 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe * configuration varibles used here. * * If you don't tell us which C compiler you have, we assume you have - * the Gcc C compiler under Solaris 5.x. - * under SunOS 4.1.x + * the Gcc C compiler under Solaris 2.x. * * === C++ Compiler Setup ========================================== * @@ -43,8 +42,8 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe * In any case, you may also need to set CplusplusDependIncludes. * * If you say you have the SunPro C++ compiler, we assume you have - * version 5.0.x of the compiler. If you have version 4.0.x instead, - * define CplusplusCompilerMajorVersion as 4 in host.def. + * version 5.0.x of the compiler. If you have an earlier version + * instead, define CplusplusCompilerMajorVersion in host.def. * */ @@ -182,8 +181,10 @@ XCOMM Gnu C++ CplusplusCompilerMajorVersion./**/CplusplusCompilerMinorVersion # define OptimizedCplusplusDebugFlags -O2 -erroff=attrskipunsup #endif #ifndef CplusplusDependIncludes -#if CplusplusCompilerMajorVersion > 3 +#if CplusplusCompilerMajorVersion > 4 # define CplusplusDependIncludes -I/opt/solarisstudio/prod/include/CC -I/opt/solarisstudio/prod/include/CC/Cstd -I/opt/solarisstudio/prod/include/CC/std +#elif CplusplusCompilerMajorVersion > 3 +# define CplusplusDependIncludes -I/opt/SUNWspro/SC4.0/include/CC #elif CplusplusCompilerMajorVersion > 2 # define CplusplusDependIncludes -I/opt/SUNWspro/SC3.0/include/CC #else From 8c1ad2d3a8ec095e86da02dbea3adec228c48820 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Wed, 20 Jun 2018 16:59:34 -0600 Subject: [PATCH 3/4] libtt: if local hostname lookup fails, default to localhost A recurring problem, mainly on the BSD's, and also on some Linux installations, is a failure for ttsession to start and any clients trying to attach to it failing due to having a hostname that is not associated with an IP address. This is due to code which looks up the hostname, and if it does not have a valid host record, then TT just fails. This has required those users to add an alias for their host name in their /etc/hosts file. With this commit, this should no longer be necessary. Now, if _XGethostbyname() fails when looking up the local name, a default of "localhost" is used, which should always exist. This was run tested on Linux and FreeBSD 11.1. It was compile tested on OpenBSD 6.2. --- cde/lib/tt/lib/util/tt_host.C | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/cde/lib/tt/lib/util/tt_host.C b/cde/lib/tt/lib/util/tt_host.C index f73fd4bac..d608b57e1 100644 --- a/cde/lib/tt/lib/util/tt_host.C +++ b/cde/lib/tt/lib/util/tt_host.C @@ -207,7 +207,38 @@ init_byname(_Tt_string name) memset((char*) &host_buf, 0, sizeof(_Xgethostbynameparams)); if (name.len() == 0) { - _name = _tt_gethostname(); + /* JET - many machines in this modern era have a hostname + * that does not have an IP address associated with it. + * So, we do a quick check to see if XGethostbyname() is + * happy with the returned name. If it isn't, then we set + * the name to "localhost", which should always exist on + * any machine with IP networking. If your machine does + * not have IP networking, you shouldn't be running TT :) + * + * This should fix those cases, particularly on BSD + * machines, whereby TT fails to start. They should no + * longer need to add their hostname manually to + * /etc/hosts (as an alias to localhost) in order to start + * CDE + */ + _name = _tt_gethostname(); + if(!_XGethostbyname((char *)_name, host_buf)) + { + /* this gets a little verbose - you see one for every + * client, so if-0 out. Leave for future debugging + * though... + */ +#if 0 + _tt_syslog(0, LOG_WARNING, "_XGethostbyname(%s) failed," + " defaulting to localhost", + (const char *)_name); +#endif + + /* fall back to localhost */ + _name = "localhost"; + } + /* clear host_buf again, for the final run below */ + memset((char*) &host_buf, 0, sizeof(_Xgethostbynameparams)); } else { qual = name.split(':',_name); if (_name.len()== 0) { From aaa93056535175b43ef859f6b53ac4db1264aae4 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Sun, 24 Jun 2018 12:48:14 -0600 Subject: [PATCH 4/4] linux/site.def: use an if !defined() gaurd for DtLocalesToBuild Without this, you cannot use the command line to select the languages to build, you would have to edit site.def directly. With this fix, you can build a language on linux with something like: make World IMAKE_DEFINES='-DDtLocalesToBuild="de_DE.ISO8859-1 es_ES.ISO8859-1"' to build the DE (German) and es (Spanish) locales. --- cde/config/cf/site.def | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cde/config/cf/site.def b/cde/config/cf/site.def index 785d25945..3b8bb82f5 100644 --- a/cde/config/cf/site.def +++ b/cde/config/cf/site.def @@ -126,7 +126,9 @@ XCOMM or building non-C locales will cause build failures. XCOMM Make sure you have installed the de_DE, es_ES, fr_FR and it_IT locales. XCOMM or building non-C locales will cause build failures. XCOMM DtLocalesToBuild: de_DE.ISO8859-1 es_ES.ISO8859-1 fr_FR.ISO8859-1 it_IT.ISO8859-1 en_US.UTF-8 -# define DtLocalesToBuild en_US.UTF-8 +# if !defined(DtLocalesToBuild) +# define DtLocalesToBuild en_US.UTF-8 +# endif # define UTF8_NLS_SUPPORT #endif