+ return termcap ? build_alias(cap) : build_alias(info) ;
+}
+
+static HashValue
+info_hash(const char *string)
+{
+ long sum = 0;
+
+ DEBUG(9, ("hashing %s", string));
+ while (*string) {
+ sum += (long) (*string + (*(string + 1) << 8));
+ string++;
+ }
+
+ DEBUG(9, ("sum is %ld", sum));
+ return (HashValue) (sum % HASHTABSIZE);
+}
+
+#define TCAP_LEN 2 /* only 1- or 2-character names are used */
+
+static HashValue
+tcap_hash(const char *string)
+{
+ char temp[TCAP_LEN + 1];
+ int limit = 0;
+
+ while (*string) {
+ temp[limit++] = *string++;
+ if (limit >= TCAP_LEN)
+ break;
+ }
+ temp[limit] = '\0';
+ return info_hash(temp);
+}
+
+static int
+compare_tcap_names(const char *a, const char *b)
+{
+ return !strncmp(a, b, (size_t) TCAP_LEN);
+}
+
+static int
+compare_info_names(const char *a, const char *b)
+{
+ return !strcmp(a, b);
+}
+
+static const HashData hash_data[2] = {
+ { HASHTABSIZE, _nc_info_hash_table, info_hash, compare_info_names },
+ { HASHTABSIZE, _nc_cap_hash_table, tcap_hash, compare_tcap_names }
+};
+
+NCURSES_EXPORT(const HashData *) _nc_get_hash_info (bool termcap)
+{
+ return &hash_data[(termcap != FALSE)];