+ c0 = last_char(0);
+ c1 = last_char(1);
+ if (c1 != ':' && c0 != '\\' && c0 != ':') {
+ bool capability = FALSE;
+
+ /*
+ * Since it is not termcap, assume the line is terminfo
+ * format. However, the comma can be embedded in a
+ * description field. It also can be a separator
+ * between a description field and a capability.
+ *
+ * Improve the guess by checking if the next word after
+ * the comma does not look like a capability. In that
+ * case, extend the description past the comma.
+ */
+ for (s = bufptr; isspace(UChar(*s)); ++s) {
+ ;
+ }
+ if (islower(UChar(*s))) {
+ char *name = s;
+ while (isalnum(UChar(*s))) {
+ ++s;
+ }
+ if (*s == '#' || *s == '=' || *s == '@') {
+ /*
+ * Checking solely with syntax allows us to
+ * support extended capabilities with string
+ * values.
+ */
+ capability = TRUE;
+ } else if (*s == ',') {
+ c0 = *s;
+ *s = '\0';
+ /*
+ * Otherwise, we can handle predefined boolean
+ * capabilities, still aided by syntax.
+ */
+ if (_nc_find_entry(name,
+ _nc_get_hash_table(FALSE))) {
+ capability = TRUE;
+ }
+ *s = (char) c0;
+ }
+ }
+ if (capability) {
+ break;
+ }
+ }