'notdef' means it's not used, so we remove it
[oweals/cde.git] / cde / lib / tt / lib / util / tt_host_equiv.C
index dec527bc063901733e6a3df3628603c4e323a3a7..9778fa340cfcb96fd32c14374f59b42c86c4d636 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
  */
 
 #define X_INCLUDE_NETDB_H
 #define XOS_USE_XT_LOCKING
-#if defined(linux) || defined(CSRG_BASED)
+#if defined(__linux__) || defined(CSRG_BASED)
 #define index
 #define rindex
 #endif
 #include <X11/Xos_r.h>
-#if defined(linux) || defined(CSRG_BASED)
+#if defined(__linux__) || defined(CSRG_BASED)
 #undef index
 #undef rindex
 #endif
@@ -53,6 +53,7 @@ _Tt_hostname_cache::
 _Tt_hostname_cache()
 {
        hostname = (_Tt_string) 0;
+       addr_length = 0;
 }
 
 _Tt_hostname_cache::
@@ -107,11 +108,6 @@ prefix_host(const _Tt_string & host, const _Tt_string & localhost)
        _Tt_string h_prefix = host, l_prefix = localhost,
                   h, l, rpart_host, rpart_localhost;
 
-#ifdef notdef
-printf("DEBUG prefix_host: host = %s, localhost = %s\n",
-       (char *) host, (char *) localhost);
-#endif
-
        while (rpart_host == rpart_localhost) {
                h = h_prefix;
                l = l_prefix;
@@ -125,9 +121,6 @@ printf("DEBUG prefix_host: host = %s, localhost = %s\n",
                rpart_localhost = l.split(j, l_prefix);
        }
 
-#ifdef notdef
-printf("DEBUG prefix_host: returning %s\n", (char *) h);
-#endif
        return h;
 }
 
@@ -141,9 +134,6 @@ hostname_equiv(const _Tt_string & host1, const _Tt_string & host2)
 {
         // First try a simple comparison.
         if (host1 == host2) {
-#ifdef notdef
-printf("DEBUG hostname_equiv: host1 == host2, returning 1\n");
-#endif
                 return 1;
         }
 
@@ -193,10 +183,6 @@ printf("DEBUG hostname_equiv: host1 == host2, returning 1\n");
                        // so do just one comparison.
 
                        if (short_tmp != long_prefix) {
-#ifdef notdef
-printf("DEBUG hostname_equiv: short_tmp %s != long_prefix %s, returning 0\n",
-       (char *) short_tmp, (char *) long_prefix);
-#endif
                                return 0;
                        }
                        is_found = 1;
@@ -204,18 +190,11 @@ printf("DEBUG hostname_equiv: short_tmp %s != long_prefix %s, returning 0\n",
                }
 
                if (short_prefix != long_prefix) {
-#ifdef notdef
-printf("DEBUG hostname_equiv: short_prefix %s != long_prefix %s, returning 0\n",
-       (char *) short_prefix, (char *) long_prefix);
-#endif
                        return 0;
                }
        }
 
        if (is_found != 1) {
-#ifdef notdef
-printf("DEBUG hostname_equiv: is_found != 1, returning 0\n");
-#endif
                return 0;       // no prefix was found
        }
 
@@ -238,9 +217,6 @@ printf("DEBUG hostname_equiv: is_found != 1, returning 0\n");
                if (_cache_it(sh, shorthost) == 1) {
                        _cache_table->insert(sh);
                } else {
-#ifdef notdef
-printf("DEBUG hostname_equiv: sh.is_null(): returning 0\n");
-#endif
                        return 0;
                }
        }
@@ -252,9 +228,6 @@ printf("DEBUG hostname_equiv: sh.is_null(): returning 0\n");
                if (_cache_it(lh, longhost) == 1) {
                        _cache_table->insert(lh);
                } else {
-#ifdef notdef
-printf("DEBUG hostname_equiv: lh.is_null(): returning 0\n");
-#endif
                        return 0;
                }
        }
@@ -265,10 +238,6 @@ printf("DEBUG hostname_equiv: lh.is_null(): returning 0\n");
        // This will probably never happen but why
        // not be careful?
        if (sh->addr_length != lh->addr_length) {
-#ifdef notdef
-printf("DEBUG hostname_equiv: sh->addr_length %d != h->addr_length %d, returning 0\n",
-       sh->addr_length, lh->addr_length);
-#endif
                return 0;
        }
 
@@ -277,17 +246,10 @@ printf("DEBUG hostname_equiv: sh->addr_length %d != h->addr_length %d, returning
 
         while (sh_c.next()) {
                while (lh_c.next()) {
-#ifdef notdef
-printf("DEBUG hostname_equiv: checking address at 0x%x w/ 0x%x\n", 
-       (char *) *sh_c, (char *) *lh_c);
-#endif
                        // Do the IP addresses match?
                        if (memcmp((char *) *sh_c, (char *) *lh_c,
                                    sh->addr_length) == 0) {
                                // success!
-#ifdef notdef
-printf("DEBUG hostname_equiv: found match!\n");
-#endif
                                return 1;
                        }
                 }
@@ -307,7 +269,6 @@ _cache_it(_Tt_hostname_cache_ptr cache_ptr, _Tt_string & hostname)
         _Tt_hostname_cache_ptr sh, lh;
        struct hostent         *host_ret;
        _Xgethostbynameparams   host_buf;
-       int                     failed = 0;
        char                    **h_addr_list;