+ if (capdb != NULL) {
+ buffer[0] = 0;
+
+ memset(&key, 0, sizeof(key));
+ key.data = term_names;
+ key.size = name_size;
+
+ memset(&data, 0, sizeof(data));
+ data.data = buffer;
+ data.size = offset + 1;
+
+ _nc_db_put(capdb, &key, &data);
+
+ buffer[0] = 2;
+
+ key.data = name_list;
+ key.size = strlen(name_list);
+
+ _nc_STRCPY(buffer + 1,
+ term_names,
+ sizeof(buffer) - 1);
+ data.size = name_size + 1;
+
+ total_size += (int) data.size;
+ total_parts++;
+ _nc_db_put(capdb, &key, &data);
+
+ while (*other_names != '\0') {
+ ptr = other_names++;
+ assert(ptr < buffer + sizeof(buffer) - 1);
+ while (*other_names != '|' && *other_names != '\0')
+ other_names++;
+
+ if (*other_names != '\0')
+ *(other_names++) = '\0';
+
+ key.data = ptr;
+ key.size = strlen(ptr);
+
+ total_size += (int) data.size;
+ total_parts++;
+ _nc_db_put(capdb, &key, &data);
+ }
+ }
+ }
+#else /* !USE_HASHED_DB */
+ if (call_count++ == 0) {
+ start_time = 0;
+ }
+
+ if (strlen(first_name) >= limit2) {
+ _nc_warning("terminal name too long.");
+ saved = first_name[limit2];
+ first_name[limit2] = '\0';
+ }
+
+ _nc_SPRINTF(filename, _nc_SLIMIT(sizeof(filename))
+ LEAF_FMT "/%.*s", UChar(first_name[0]),
+ (int) (sizeof(filename) - (LEAF_LEN + 2)),
+ first_name);
+
+ if (saved)
+ first_name[limit2] = saved;
+
+ /*
+ * Has this primary name been written since the first call to
+ * write_entry()? If so, the newer write will step on the older,
+ * so warn the user.
+ */
+ if (start_time > 0 &&
+ stat(filename, &statbuf) >= 0
+ && statbuf.st_mtime >= start_time) {
+#if HAVE_LINK && !USE_SYMLINKS