- ptr = buffer;
- *(ptr++) = ch;
-
- if (first_column) {
- char *desc;
-
- _nc_comment_start = token_start;
- _nc_comment_end = _nc_curr_file_pos;
- _nc_start_line = _nc_curr_line;
-
- _nc_syntax = ERR;
- while ((ch = next_char()) != '\n')
- {
- if (ch == EOF)
- _nc_err_abort("premature EOF");
- else if (ch == ':' && last_char() != ',')
- {
- _nc_syntax = SYN_TERMCAP;
- separator = ':';
- break;
- }
- else if (ch == ',')
- {
- _nc_syntax = SYN_TERMINFO;
- separator = ',';
- /*
- * Fall-through here is not an accident.
- * The idea is that if we see a comma, we
- * figure this is terminfo unless we
- * subsequently run into a colon -- but
- * we don't stop looking for that colon until
- * hitting a newline. This allows commas to
- * be embedded in description fields of
- * either syntax.
- */
- /* FALLTHRU */
- }
- else
- ch = eat_escaped_newline(ch);
-
- *ptr++ = ch;
- }
- ptr[0] = '\0';
- if (_nc_syntax == ERR)
- {
- /*
- * Grrr...what we ought to do here is barf,
- * complaining that the entry is malformed.
- * But because a couple of name fields in the
- * 8.2 termcap file end with |\, we just have
- * to assume it's termcap syntax.
- */
- _nc_syntax = SYN_TERMCAP;
- separator = ':';
- }
- else if (_nc_syntax == SYN_TERMINFO)
- {
- /* throw away trailing /, *$/ */
- for (--ptr; iswhite(*ptr) || *ptr == ','; ptr--)
- continue;
- ptr[1] = '\0';
- }