summaryrefslogtreecommitdiff
path: root/lib/libcurses
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-01-16 01:35:20 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-01-16 01:35:20 +0000
commit4f8aa862930674882c18bd874d1e03ef2b683b90 (patch)
treefdd3069af3a177667aa385bd0920bdcceb7cfc55 /lib/libcurses
parentb4d14dd490ae681e832fa406a09c4e29963c25ad (diff)
Update to ncurses-5.0-20000115:
+ additional fixes for non-bce terminals (handling of delete_character) to work when assume_default_colors() is not specified. + modify warning message from _nc_parse_entry() regarding extended capability names to print only if tic/infocmp/toe have the -v flag set, and not at all in ordinary user applications. Otherwise, this warning would be shown for screen's extended capabilities in programs that use the termcap interface. + modify use of _nc_tracing from programs such as tic so their debug level is not in the same range as values set by trace() function. + small panel header cleanup (patch by Juergen Pfeifer).
Diffstat (limited to 'lib/libcurses')
-rw-r--r--lib/libcurses/curses.h4
-rw-r--r--lib/libcurses/tic.h19
-rw-r--r--lib/libcurses/tinfo/comp_scan.c885
-rw-r--r--lib/libcurses/tinfo/lib_termcap.c11
-rw-r--r--lib/libcurses/tinfo/lib_ti.c6
-rw-r--r--lib/libcurses/tinfo/lib_tputs.c324
-rw-r--r--lib/libcurses/tinfo/parse_entry.c480
-rw-r--r--lib/libcurses/tty/tty_update.c30
8 files changed, 876 insertions, 883 deletions
diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h
index 0689baa1e28..6c751a4f665 100644
--- a/lib/libcurses/curses.h
+++ b/lib/libcurses/curses.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: curses.h,v 1.43 2000/01/09 05:06:01 millert Exp $ */
+/* $OpenBSD: curses.h,v 1.44 2000/01/16 01:35:17 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -50,7 +50,7 @@
/* These are defined only in curses.h, and are used for conditional compiles */
#define NCURSES_VERSION_MAJOR 5
#define NCURSES_VERSION_MINOR 0
-#define NCURSES_VERSION_PATCH 20000108
+#define NCURSES_VERSION_PATCH 20000115
/* This is defined in more than one ncurses header, for identification */
#undef NCURSES_VERSION
diff --git a/lib/libcurses/tic.h b/lib/libcurses/tic.h
index f3b6aa4684a..b7652978ff1 100644
--- a/lib/libcurses/tic.h
+++ b/lib/libcurses/tic.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: tic.h,v 1.7 1999/11/28 17:59:28 millert Exp $ */
+/* $OpenBSD: tic.h,v 1.8 2000/01/16 01:35:17 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -99,8 +99,21 @@ extern "C" {
/* location of user's personal info directory */
#define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */
+/*
+ * Some traces are designed to be used via tic's verbose option (and similar in
+ * infocmp and toe) rather than the 'trace()' function. So we use the bits
+ * above the normal trace() parameter as a debug-level.
+ */
+
+#define MAX_DEBUG_LEVEL 15
+#define DEBUG_LEVEL(n) ((n) << 12) /* see TRACE_MAXIMUM */
+
+#define set_trace_level(n) \
+ _nc_tracing &= DEBUG_LEVEL(MAX_DEBUG_LEVEL), \
+ _nc_tracing |= DEBUG_LEVEL(n)
+
#ifdef TRACE
-#define DEBUG(n, a) if (_nc_tracing & (1 << (n - 1))) _tracef a
+#define DEBUG(n, a) if (_nc_tracing >= DEBUG_LEVEL(n)) _tracef a
#else
#define DEBUG(n, a) /*nothing*/
#endif
diff --git a/lib/libcurses/tinfo/comp_scan.c b/lib/libcurses/tinfo/comp_scan.c
index fa5f1e327d1..c8784f0aedc 100644
--- a/lib/libcurses/tinfo/comp_scan.c
+++ b/lib/libcurses/tinfo/comp_scan.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,1999 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -49,7 +49,7 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$From: comp_scan.c,v 1.35 1999/10/30 23:00:16 tom Exp $")
+MODULE_ID("$From: comp_scan.c,v 1.37 2000/01/15 21:52:23 tom Exp $")
/*
* Maximum length of string capability we'll accept before raising an error.
@@ -59,11 +59,11 @@ MODULE_ID("$From: comp_scan.c,v 1.35 1999/10/30 23:00:16 tom Exp $")
#define iswhite(ch) (ch == ' ' || ch == '\t')
-int _nc_syntax = 0; /* termcap or terminfo? */
-long _nc_curr_file_pos = 0; /* file offset of current line */
-long _nc_comment_start = 0; /* start of comment range before name */
-long _nc_comment_end = 0; /* end of comment range before name */
-long _nc_start_line = 0; /* start line of current entry */
+int _nc_syntax = 0; /* termcap or terminfo? */
+long _nc_curr_file_pos = 0; /* file offset of current line */
+long _nc_comment_start = 0; /* start of comment range before name */
+long _nc_comment_end = 0; /* end of comment range before name */
+long _nc_start_line = 0; /* start line of current entry */
/*****************************************************************************
*
@@ -74,21 +74,22 @@ long _nc_start_line = 0; /* start line of current entry */
static bool first_column; /* See 'next_char()' below */
static char separator; /* capability separator */
static int pushtype; /* type of pushback token */
-static char pushname[MAX_NAME_SIZE+1];
+static char pushname[MAX_NAME_SIZE + 1];
-static int last_char(void);
-static int next_char(void);
+static int last_char(void);
+static int next_char(void);
static long stream_pos(void);
static bool end_of_stream(void);
static void push_back(char c);
/* Assume we may be looking at a termcap-style continuation */
-static inline int eat_escaped_newline(int ch)
+static inline int
+eat_escaped_newline(int ch)
{
- if (ch == '\\')
- while ((ch = next_char()) == '\n' || iswhite(ch))
- continue;
- return ch;
+ if (ch == '\\')
+ while ((ch = next_char()) == '\n' || iswhite(ch))
+ continue;
+ return ch;
}
/*
@@ -124,316 +125,299 @@ static inline int eat_escaped_newline(int ch)
*
*/
-int _nc_get_token(void)
+int
+_nc_get_token(void)
{
-static const char terminfo_punct[] = "@%&*!#";
-long number;
-int type;
-int ch;
-char * numchk;
-char numbuf[80];
-unsigned found;
-static char buffer[MAX_ENTRY_SIZE];
-char *ptr;
-int dot_flag = FALSE;
-long token_start;
-
- if (pushtype != NO_PUSHBACK)
- {
- int retval = pushtype;
-
- _nc_set_type(pushname);
- DEBUG(3, ("pushed-back token: `%s', class %d",
- _nc_curr_token.tk_name, pushtype));
-
- pushtype = NO_PUSHBACK;
- pushname[0] = '\0';
-
- /* currtok wasn't altered by _nc_push_token() */
- return(retval);
- }
+ static const char terminfo_punct[] = "@%&*!#";
+ long number;
+ int type;
+ int ch;
+ char *numchk;
+ char numbuf[80];
+ unsigned found;
+ static char buffer[MAX_ENTRY_SIZE];
+ char *ptr;
+ int dot_flag = FALSE;
+ long token_start;
+
+ if (pushtype != NO_PUSHBACK) {
+ int retval = pushtype;
+
+ _nc_set_type(pushname);
+ DEBUG(3, ("pushed-back token: `%s', class %d",
+ _nc_curr_token.tk_name, pushtype));
- if (end_of_stream())
- return(EOF);
+ pushtype = NO_PUSHBACK;
+ pushname[0] = '\0';
-start_token:
- token_start = stream_pos();
- while ((ch = next_char()) == '\n' || iswhite(ch))
- continue;
+ /* currtok wasn't altered by _nc_push_token() */
+ return (retval);
+ }
- ch = eat_escaped_newline(ch);
+ if (end_of_stream())
+ return (EOF);
- if (ch == EOF)
- type = EOF;
- else {
- /* if this is a termcap entry, skip a leading separator */
- if (separator == ':' && ch == ':')
- ch = next_char();
+ start_token:
+ token_start = stream_pos();
+ while ((ch = next_char()) == '\n' || iswhite(ch))
+ continue;
- if (ch == '.') {
- dot_flag = TRUE;
- DEBUG(8, ("dot-flag set"));
+ ch = eat_escaped_newline(ch);
- while ((ch = next_char())=='.' || iswhite(ch))
- continue;
- }
+ if (ch == EOF)
+ type = EOF;
+ else {
+ /* if this is a termcap entry, skip a leading separator */
+ if (separator == ':' && ch == ':')
+ ch = next_char();
- if (ch == EOF) {
- type = EOF;
- goto end_of_token;
- }
+ if (ch == '.') {
+ dot_flag = TRUE;
+ DEBUG(8, ("dot-flag set"));
- /* have to make some punctuation chars legal for terminfo */
- if (!isalnum(ch) && !strchr(terminfo_punct, (char)ch)) {
- _nc_warning("Illegal character (expected alphanumeric or %s) - %s",
- terminfo_punct, _tracechar((chtype)ch));
- _nc_panic_mode(separator);
- goto start_token;
- }
+ while ((ch = next_char()) == '.' || iswhite(ch))
+ continue;
+ }
- 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';
- }
+ if (ch == EOF) {
+ type = EOF;
+ goto end_of_token;
+ }
- /*
- * This is the soonest we have the terminal name
- * fetched. Set up for following warning messages.
- */
- ptr = strchr(buffer, '|');
- if (ptr == (char *)NULL)
- ptr = buffer + strlen(buffer);
- ch = *ptr;
- *ptr = '\0';
- _nc_set_type(buffer);
- *ptr = ch;
-
- /*
- * Compute the boundary between the aliases and the
- * description field for syntax-checking purposes.
- */
- desc = strrchr(buffer, '|');
- if (desc) {
- if (*desc == '\0')
- _nc_warning("empty longname field");
- else if (strchr(desc, ' ') == (char *)NULL)
- _nc_warning("older tic versions may treat the description field as an alias");
- }
- if (!desc)
- desc = buffer + strlen(buffer);
-
- /*
- * Whitespace in a name field other than the long name
- * can confuse rdist and some termcap tools. Slashes
- * are a no-no. Other special characters can be
- * dangerous due to shell expansion.
- */
- for (ptr = buffer; ptr < desc; ptr++)
- {
- if (isspace(*ptr))
- {
- _nc_warning("whitespace in name or alias field");
- break;
- }
- else if (*ptr == '/')
- {
- _nc_warning("slashes aren't allowed in names or aliases");
- break;
- }
- else if (strchr("$[]!*?", *ptr))
- {
- _nc_warning("dubious character `%c' in name or alias field", *ptr);
- break;
- }
- }
+ /* have to make some punctuation chars legal for terminfo */
+ if (!isalnum(ch) && !strchr(terminfo_punct, (char) ch)) {
+ _nc_warning("Illegal character (expected alphanumeric or %s) - %s",
+ terminfo_punct, _tracechar((chtype) ch));
+ _nc_panic_mode(separator);
+ goto start_token;
+ }
- ptr = buffer;
+ ptr = buffer;
+ *(ptr++) = ch;
- _nc_curr_token.tk_name = buffer;
- type = NAMES;
- } else {
- while ((ch = next_char()) != EOF) {
- if (!isalnum(ch)) {
- if (_nc_syntax == SYN_TERMINFO) {
- if (ch != '_')
- break;
- } else { /* allow ';' for "k;" */
- if (ch != ';')
- break;
- }
- }
- *(ptr++) = ch;
- }
+ if (first_column) {
+ char *desc;
- *ptr++ = '\0';
- switch (ch) {
- case ',':
- case ':':
- if (ch != separator)
- _nc_err_abort("Separator inconsistent with syntax");
- _nc_curr_token.tk_name = buffer;
- type = BOOLEAN;
- break;
- case '@':
- if ((ch = next_char()) != separator)
- _nc_warning("Missing separator after `%s', have %s",
- buffer, _tracechar((chtype)ch));
- _nc_curr_token.tk_name = buffer;
- type = CANCEL;
- break;
-
- case '#':
- found = 0;
- while (isalnum(ch = next_char())) {
- numbuf[found++] = ch;
- if (found >= sizeof(numbuf)-1)
- break;
- }
- numbuf[found] = '\0';
- number = strtol(numbuf, &numchk, 0);
- if (numchk == numbuf)
- _nc_warning("no value given for `%s'", buffer);
- if ((*numchk != '\0') || (ch != separator))
- _nc_warning("Missing separator");
- _nc_curr_token.tk_name = buffer;
- _nc_curr_token.tk_valnumber = number;
- type = NUMBER;
- break;
-
- case '=':
- ch = _nc_trans_string(ptr);
- if (ch != separator)
- _nc_warning("Missing separator");
- _nc_curr_token.tk_name = buffer;
- _nc_curr_token.tk_valstring = ptr;
- type = STRING;
- break;
-
- case EOF:
- type = EOF;
- break;
- default:
- /* just to get rid of the compiler warning */
- type = UNDEF;
- _nc_warning("Illegal character - %s",
- _tracechar((chtype)ch));
- }
- } /* end else (first_column == FALSE) */
- } /* end else (ch != EOF) */
-
-end_of_token:
+ _nc_comment_start = token_start;
+ _nc_comment_end = _nc_curr_file_pos;
+ _nc_start_line = _nc_curr_line;
-#ifdef TRACE
- if (dot_flag == TRUE)
- DEBUG(8, ("Commented out "));
-
- if (_nc_tracing & TRACE_IEVENT)
- {
- fprintf(stderr, "Token: ");
- switch (type)
- {
- case BOOLEAN:
- fprintf(stderr, "Boolean; name='%s'\n",
- _nc_curr_token.tk_name);
+ _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';
+ }
- case NUMBER:
- fprintf(stderr, "Number; name='%s', value=%d\n",
- _nc_curr_token.tk_name,
- _nc_curr_token.tk_valnumber);
+ /*
+ * This is the soonest we have the terminal name
+ * fetched. Set up for following warning messages.
+ */
+ ptr = strchr(buffer, '|');
+ if (ptr == (char *) NULL)
+ ptr = buffer + strlen(buffer);
+ ch = *ptr;
+ *ptr = '\0';
+ _nc_set_type(buffer);
+ *ptr = ch;
+
+ /*
+ * Compute the boundary between the aliases and the
+ * description field for syntax-checking purposes.
+ */
+ desc = strrchr(buffer, '|');
+ if (desc) {
+ if (*desc == '\0')
+ _nc_warning("empty longname field");
+ else if (strchr(desc, ' ') == (char *) NULL)
+ _nc_warning("older tic versions may treat the description field as an alias");
+ }
+ if (!desc)
+ desc = buffer + strlen(buffer);
+
+ /*
+ * Whitespace in a name field other than the long name
+ * can confuse rdist and some termcap tools. Slashes
+ * are a no-no. Other special characters can be
+ * dangerous due to shell expansion.
+ */
+ for (ptr = buffer; ptr < desc; ptr++) {
+ if (isspace(*ptr)) {
+ _nc_warning("whitespace in name or alias field");
break;
-
- case STRING:
- fprintf(stderr, "String; name='%s', value=%s\n",
- _nc_curr_token.tk_name,
- _nc_visbuf(_nc_curr_token.tk_valstring));
+ } else if (*ptr == '/') {
+ _nc_warning("slashes aren't allowed in names or aliases");
break;
-
- case CANCEL:
- fprintf(stderr, "Cancel; name='%s'\n",
- _nc_curr_token.tk_name);
+ } else if (strchr("$[]!*?", *ptr)) {
+ _nc_warning("dubious character `%c' in name or alias field", *ptr);
break;
+ }
+ }
+
+ ptr = buffer;
- case NAMES:
+ _nc_curr_token.tk_name = buffer;
+ type = NAMES;
+ } else {
+ while ((ch = next_char()) != EOF) {
+ if (!isalnum(ch)) {
+ if (_nc_syntax == SYN_TERMINFO) {
+ if (ch != '_')
+ break;
+ } else { /* allow ';' for "k;" */
+ if (ch != ';')
+ break;
+ }
+ }
+ *(ptr++) = ch;
+ }
- fprintf(stderr, "Names; value='%s'\n",
- _nc_curr_token.tk_name);
- break;
+ *ptr++ = '\0';
+ switch (ch) {
+ case ',':
+ case ':':
+ if (ch != separator)
+ _nc_err_abort("Separator inconsistent with syntax");
+ _nc_curr_token.tk_name = buffer;
+ type = BOOLEAN;
+ break;
+ case '@':
+ if ((ch = next_char()) != separator)
+ _nc_warning("Missing separator after `%s', have %s",
+ buffer, _tracechar((chtype) ch));
+ _nc_curr_token.tk_name = buffer;
+ type = CANCEL;
+ break;
- case EOF:
- fprintf(stderr, "End of file\n");
- break;
+ case '#':
+ found = 0;
+ while (isalnum(ch = next_char())) {
+ numbuf[found++] = ch;
+ if (found >= sizeof(numbuf) - 1)
+ break;
+ }
+ numbuf[found] = '\0';
+ number = strtol(numbuf, &numchk, 0);
+ if (numchk == numbuf)
+ _nc_warning("no value given for `%s'", buffer);
+ if ((*numchk != '\0') || (ch != separator))
+ _nc_warning("Missing separator");
+ _nc_curr_token.tk_name = buffer;
+ _nc_curr_token.tk_valnumber = number;
+ type = NUMBER;
+ break;
- default:
- _nc_warning("Bad token type");
+ case '=':
+ ch = _nc_trans_string(ptr);
+ if (ch != separator)
+ _nc_warning("Missing separator");
+ _nc_curr_token.tk_name = buffer;
+ _nc_curr_token.tk_valstring = ptr;
+ type = STRING;
+ break;
+
+ case EOF:
+ type = EOF;
+ break;
+ default:
+ /* just to get rid of the compiler warning */
+ type = UNDEF;
+ _nc_warning("Illegal character - %s",
+ _tracechar((chtype) ch));
}
+ } /* end else (first_column == FALSE) */
+ } /* end else (ch != EOF) */
+
+ end_of_token:
+
+#ifdef TRACE
+ if (dot_flag == TRUE)
+ DEBUG(8, ("Commented out "));
+
+ if (_nc_tracing >= DEBUG_LEVEL(7)) {
+ switch (type) {
+ case BOOLEAN:
+ _tracef("Token: Boolean; name='%s'",
+ _nc_curr_token.tk_name);
+ break;
+
+ case NUMBER:
+ _tracef("Token: Number; name='%s', value=%d",
+ _nc_curr_token.tk_name,
+ _nc_curr_token.tk_valnumber);
+ break;
+
+ case STRING:
+ _tracef("Token: String; name='%s', value=%s",
+ _nc_curr_token.tk_name,
+ _nc_visbuf(_nc_curr_token.tk_valstring));
+ break;
+
+ case CANCEL:
+ _tracef("Token: Cancel; name='%s'",
+ _nc_curr_token.tk_name);
+ break;
+
+ case NAMES:
+
+ _tracef("Token: Names; value='%s'",
+ _nc_curr_token.tk_name);
+ break;
+
+ case EOF:
+ _tracef("Token: End of file");
+ break;
+
+ default:
+ _nc_warning("Bad token type");
}
+ }
#endif
- if (dot_flag == TRUE) /* if commented out, use the next one */
- type = _nc_get_token();
+ if (dot_flag == TRUE) /* if commented out, use the next one */
+ type = _nc_get_token();
- DEBUG(3, ("token: `%s', class %d", _nc_curr_token.tk_name, type));
+ DEBUG(3, ("token: `%s', class %d", _nc_curr_token.tk_name, type));
- return(type);
+ return (type);
}
/*
@@ -458,118 +442,142 @@ end_of_token:
char
_nc_trans_string(char *ptr)
{
-int count = 0;
-int number;
-int i, c;
-chtype ch, last_ch = '\0';
-bool ignored = FALSE;
-
- while ((ch = c = next_char()) != (chtype)separator && c != EOF) {
- if ((_nc_syntax == SYN_TERMCAP) && c == '\n')
- break;
- if (ch == '^' && last_ch != '%') {
- ch = c = next_char();
- if (c == EOF)
- _nc_err_abort("Premature EOF");
-
- if (! (is7bits(ch) && isprint(ch))) {
- _nc_warning("Illegal ^ character - %s",
- _tracechar((unsigned char)ch));
- }
- if (ch == '?') {
- *(ptr++) = '\177';
- } else {
- if ((ch &= 037) == 0)
- ch = 128;
- *(ptr++) = (char)(ch);
- }
+ int count = 0;
+ int number;
+ int i, c;
+ chtype ch, last_ch = '\0';
+ bool ignored = FALSE;
+
+ while ((ch = c = next_char()) != (chtype) separator && c != EOF) {
+ if ((_nc_syntax == SYN_TERMCAP) && c == '\n')
+ break;
+ if (ch == '^' && last_ch != '%') {
+ ch = c = next_char();
+ if (c == EOF)
+ _nc_err_abort("Premature EOF");
+
+ if (!(is7bits(ch) && isprint(ch))) {
+ _nc_warning("Illegal ^ character - %s",
+ _tracechar((unsigned char) ch));
}
- else if (ch == '\\') {
- ch = c = next_char();
- if (c == EOF)
- _nc_err_abort("Premature EOF");
-
- if (ch >= '0' && ch <= '7') {
- number = ch - '0';
- for (i=0; i < 2; i++) {
- ch = c = next_char();
- if (c == EOF)
- _nc_err_abort("Premature EOF");
-
- if (c < '0' || c > '7') {
- if (isdigit(c)) {
- _nc_warning("Non-octal digit `%c' in \\ sequence", c);
- /* allow the digit; it'll do less harm */
- } else {
- push_back((char)c);
- break;
- }
+ if (ch == '?') {
+ *(ptr++) = '\177';
+ } else {
+ if ((ch &= 037) == 0)
+ ch = 128;
+ *(ptr++) = (char) (ch);
+ }
+ } else if (ch == '\\') {
+ ch = c = next_char();
+ if (c == EOF)
+ _nc_err_abort("Premature EOF");
+
+ if (ch >= '0' && ch <= '7') {
+ number = ch - '0';
+ for (i = 0; i < 2; i++) {
+ ch = c = next_char();
+ if (c == EOF)
+ _nc_err_abort("Premature EOF");
+
+ if (c < '0' || c > '7') {
+ if (isdigit(c)) {
+ _nc_warning("Non-octal digit `%c' in \\ sequence", c);
+ /* allow the digit; it'll do less harm */
+ } else {
+ push_back((char) c);
+ break;
}
-
- number = number * 8 + c - '0';
}
- if (number == 0)
- number = 0200;
- *(ptr++) = (char) number;
- } else {
- switch (c) {
- case 'E':
- case 'e': *(ptr++) = '\033'; break;
+ number = number * 8 + c - '0';
+ }
- case 'a': *(ptr++) = '\007'; break;
+ if (number == 0)
+ number = 0200;
+ *(ptr++) = (char) number;
+ } else {
+ switch (c) {
+ case 'E':
+ case 'e':
+ *(ptr++) = '\033';
+ break;
- case 'l':
- case 'n': *(ptr++) = '\n'; break;
+ case 'a':
+ *(ptr++) = '\007';
+ break;
- case 'r': *(ptr++) = '\r'; break;
+ case 'l':
+ case 'n':
+ *(ptr++) = '\n';
+ break;
- case 'b': *(ptr++) = '\010'; break;
+ case 'r':
+ *(ptr++) = '\r';
+ break;
- case 's': *(ptr++) = ' '; break;
+ case 'b':
+ *(ptr++) = '\010';
+ break;
- case 'f': *(ptr++) = '\014'; break;
+ case 's':
+ *(ptr++) = ' ';
+ break;
- case 't': *(ptr++) = '\t'; break;
+ case 'f':
+ *(ptr++) = '\014';
+ break;
- case '\\': *(ptr++) = '\\'; break;
+ case 't':
+ *(ptr++) = '\t';
+ break;
- case '^': *(ptr++) = '^'; break;
+ case '\\':
+ *(ptr++) = '\\';
+ break;
- case ',': *(ptr++) = ','; break;
+ case '^':
+ *(ptr++) = '^';
+ break;
- case ':': *(ptr++) = ':'; break;
+ case ',':
+ *(ptr++) = ',';
+ break;
- case '\n':
- continue;
+ case ':':
+ *(ptr++) = ':';
+ break;
- default:
- _nc_warning("Illegal character %s in \\ sequence",
- _tracechar((unsigned char)ch));
- *(ptr++) = (char)ch;
- } /* endswitch (ch) */
- } /* endelse (ch < '0' || ch > '7') */
- } /* end else if (ch == '\\') */
- else if (ch == '\n' && (_nc_syntax == SYN_TERMINFO)) {
- /* newlines embedded in a terminfo string are ignored */
- ignored = TRUE;
- } else {
- *(ptr++) = (char)ch;
- }
+ case '\n':
+ continue;
- if (!ignored) {
- last_ch = ch;
- count ++;
- }
- ignored = FALSE;
+ default:
+ _nc_warning("Illegal character %s in \\ sequence",
+ _tracechar((unsigned char) ch));
+ *(ptr++) = (char) ch;
+ } /* endswitch (ch) */
+ } /* endelse (ch < '0' || ch > '7') */
+ }
+ /* end else if (ch == '\\') */
+ else if (ch == '\n' && (_nc_syntax == SYN_TERMINFO)) {
+ /* newlines embedded in a terminfo string are ignored */
+ ignored = TRUE;
+ } else {
+ *(ptr++) = (char) ch;
+ }
- if (count > MAXCAPLEN)
- _nc_warning("Very long string found. Missing separator?");
- } /* end while */
+ if (!ignored) {
+ last_ch = ch;
+ count++;
+ }
+ ignored = FALSE;
+
+ if (count > MAXCAPLEN)
+ _nc_warning("Very long string found. Missing separator?");
+ } /* end while */
- *ptr = '\0';
+ *ptr = '\0';
- return(ch);
+ return (ch);
}
/*
@@ -579,7 +587,8 @@ bool ignored = FALSE;
* get_token() call.
*/
-void _nc_push_token(int tokclass)
+void
+_nc_push_token(int tokclass)
{
/*
* This implementation is kind of bogus, it will fail if we ever do
@@ -591,23 +600,24 @@ void _nc_push_token(int tokclass)
_nc_get_type(pushname);
DEBUG(3, ("pushing token: `%s', class %d",
- _nc_curr_token.tk_name, pushtype));
+ _nc_curr_token.tk_name, pushtype));
}
/*
* Panic mode error recovery - skip everything until a "ch" is found.
*/
-void _nc_panic_mode(char ch)
+void
+_nc_panic_mode(char ch)
{
- int c;
-
- for (;;) {
- c = next_char();
- if (c == ch)
- return;
- if (c == EOF)
- return;
- }
+ int c;
+
+ for (;;) {
+ c = next_char();
+ if (c == ch)
+ return;
+ if (c == EOF)
+ return;
+ }
}
/*****************************************************************************
@@ -630,16 +640,17 @@ static FILE *yyin; /* scanner's input file descriptor */
* non-null.
*/
-void _nc_reset_input(FILE *fp, char *buf)
+void
+_nc_reset_input(FILE * fp, char *buf)
{
- pushtype = NO_PUSHBACK;
- pushname[0] = '\0';
- yyin = fp;
- bufstart = bufptr = buf;
- _nc_curr_file_pos = 0L;
- if (fp != 0)
- _nc_curr_line = 0;
- _nc_curr_col = 0;
+ pushtype = NO_PUSHBACK;
+ pushname[0] = '\0';
+ yyin = fp;
+ bufstart = bufptr = buf;
+ _nc_curr_file_pos = 0L;
+ if (fp != 0)
+ _nc_curr_line = 0;
+ _nc_curr_col = 0;
}
/*
@@ -650,12 +661,12 @@ void _nc_reset_input(FILE *fp, char *buf)
static int
last_char(void)
{
- size_t len = strlen(bufptr);
- while (len--) {
- if (!isspace(bufptr[len]))
- return bufptr[len];
- }
- return 0;
+ size_t len = strlen(bufptr);
+ while (len--) {
+ if (!isspace(bufptr[len]))
+ return bufptr[len];
+ }
+ return 0;
}
/*
@@ -675,17 +686,14 @@ last_char(void)
static int
next_char(void)
{
- if (!yyin)
- {
+ if (!yyin) {
if (*bufptr == '\0')
- return(EOF);
+ return (EOF);
if (*bufptr == '\n') {
_nc_curr_line++;
_nc_curr_col = 0;
}
- }
- else if (!bufptr || !*bufptr)
- {
+ } else if (!bufptr || !*bufptr) {
/*
* In theory this could be recoded to do its I/O one
* character at a time, saving the buffer space. In
@@ -697,15 +705,15 @@ next_char(void)
size_t len;
do {
- _nc_curr_file_pos = ftell(yyin);
+ _nc_curr_file_pos = ftell(yyin);
- if ((bufstart = fgets(line, LEXBUFSIZ, yyin)) != NULL) {
- _nc_curr_line++;
- _nc_curr_col = 0;
- }
- bufptr = bufstart;
- } while
- (bufstart != NULL && line[0] == '#');
+ if ((bufstart = fgets(line, LEXBUFSIZ, yyin)) != NULL) {
+ _nc_curr_line++;
+ _nc_curr_col = 0;
+ }
+ bufptr = bufstart;
+ } while
+ (bufstart != NULL && line[0] == '#');
if (bufstart == NULL)
return (EOF);
@@ -718,10 +726,10 @@ next_char(void)
* files on OS/2, etc.
*/
if ((len = strlen(bufptr)) > 1) {
- if (bufptr[len-1] == '\n'
- && bufptr[len-2] == '\r') {
- bufptr[len-2] = '\n';
- bufptr[len-1] = '\0';
+ if (bufptr[len - 1] == '\n'
+ && bufptr[len - 2] == '\r') {
+ bufptr[len - 2] = '\n';
+ bufptr[len - 1] = '\0';
}
}
}
@@ -729,28 +737,31 @@ next_char(void)
first_column = (bufptr == bufstart);
_nc_curr_col++;
- return(*bufptr++);
+ return (*bufptr++);
}
-static void push_back(char c)
+static void
+push_back(char c)
/* push a character back onto the input stream */
{
if (bufptr == bufstart)
- _nc_syserr_abort("Can't backspace off beginning of line");
+ _nc_syserr_abort("Can't backspace off beginning of line");
*--bufptr = c;
}
-static long stream_pos(void)
+static long
+stream_pos(void)
/* return our current character position in the input stream */
{
return (yyin ? ftell(yyin) : (bufptr ? bufptr - bufstart : 0));
}
-static bool end_of_stream(void)
+static bool
+end_of_stream(void)
/* are we at end of input? */
{
return ((yyin ? feof(yyin) : (bufptr && *bufptr == '\0'))
- ? TRUE : FALSE);
+ ? TRUE : FALSE);
}
/* comp_scan.c ends here */
diff --git a/lib/libcurses/tinfo/lib_termcap.c b/lib/libcurses/tinfo/lib_termcap.c
index d99749636e0..e28706ed02a 100644
--- a/lib/libcurses/tinfo/lib_termcap.c
+++ b/lib/libcurses/tinfo/lib_termcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_termcap.c,v 1.4 2000/01/02 22:06:51 millert Exp $ */
+/* $OpenBSD: lib_termcap.c,v 1.5 2000/01/16 01:35:18 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998-2000 Free Software Foundation, Inc. *
@@ -41,7 +41,7 @@
#define __INTERNAL_CAPS_VISIBLE
#include <term_entry.h>
-MODULE_ID("$From: lib_termcap.c,v 1.32 2000/01/01 16:49:54 tom Exp $")
+MODULE_ID("$From: lib_termcap.c,v 1.35 2000/01/15 20:47:21 tom Exp $")
/*
some of the code in here was contributed by:
@@ -150,7 +150,7 @@ tgetnum(NCURSES_CONST char *id)
const char *capname = ExtNumname(tp, i, numcodes);
if (!strncmp(id, capname, 2)) {
if (!VALID_NUMERIC(tp->Numbers[i]))
- return ABSENT_NUMERIC;
+ returnCode(ABSENT_NUMERIC);
returnCode(tp->Numbers[i]);
}
}
@@ -177,10 +177,9 @@ tgetstr(NCURSES_CONST char *id, char **area)
TERMTYPE *tp = &(cur_term->type);
for_each_string(i, tp) {
const char *capname = ExtStrname(tp, i, strcodes);
- T(("trying %s", capname));
if (!strncmp(id, capname, 2)) {
- T(("found match : %s", _nc_visbuf(tp->Strings[i])));
- /* setupterm forces cancelled strings to null */
+ TR(TRACE_DATABASE,("found match : %s", _nc_visbuf(tp->Strings[i])));
+ /* setupterm forces canceled strings to null */
if (area != 0
&& *area != 0
&& VALID_STRING(tp->Strings[i])) {
diff --git a/lib/libcurses/tinfo/lib_ti.c b/lib/libcurses/tinfo/lib_ti.c
index 91164f528fb..98fa68f72b8 100644
--- a/lib/libcurses/tinfo/lib_ti.c
+++ b/lib/libcurses/tinfo/lib_ti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_ti.c,v 1.3 2000/01/02 22:06:51 millert Exp $ */
+/* $OpenBSD: lib_ti.c,v 1.4 2000/01/16 01:35:18 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998-2000 Free Software Foundation, Inc. *
@@ -38,7 +38,7 @@
#include <term_entry.h>
#include <tic.h>
-MODULE_ID("$From: lib_ti.c,v 1.18 2000/01/01 16:58:30 tom Exp $")
+MODULE_ID("$From: lib_ti.c,v 1.19 2000/01/15 20:47:37 tom Exp $")
int
tigetflag(NCURSES_CONST char *str)
@@ -74,7 +74,7 @@ tigetnum(NCURSES_CONST char *str)
const char *capname = ExtNumname(tp, i, numnames);
if (!strcmp(str, capname)) {
if (!VALID_NUMERIC(tp->Numbers[i]))
- return ABSENT_NUMERIC;
+ returnCode(ABSENT_NUMERIC);
returnCode(tp->Numbers[i]);
}
}
diff --git a/lib/libcurses/tinfo/lib_tputs.c b/lib/libcurses/tinfo/lib_tputs.c
index e6955723c0b..b6a879fd3ef 100644
--- a/lib/libcurses/tinfo/lib_tputs.c
+++ b/lib/libcurses/tinfo/lib_tputs.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_tputs.c,v 1.3 1999/11/28 17:49:54 millert Exp $ */
+/* $OpenBSD: lib_tputs.c,v 1.4 2000/01/16 01:35:18 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998,1999 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -33,7 +33,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
/*
* tputs.c
* delay_output()
@@ -44,210 +43,211 @@
#include <curses.priv.h>
#include <ctype.h>
-#include <term.h> /* padding_baud_rate, xon_xoff */
-#include <termcap.h> /* ospeed */
+#include <term.h> /* padding_baud_rate, xon_xoff */
+#include <termcap.h> /* ospeed */
#include <tic.h>
-MODULE_ID("$From: lib_tputs.c,v 1.42 1999/10/30 23:00:16 tom Exp $")
+MODULE_ID("$From: lib_tputs.c,v 1.43 2000/01/15 20:13:04 tom Exp $")
-char PC = 0; /* used by termcap library */
-speed_t ospeed = 0; /* used by termcap library */
+char PC = 0; /* used by termcap library */
+speed_t ospeed = 0; /* used by termcap library */
-int _nc_nulls_sent = 0; /* used by 'tack' program */
+int _nc_nulls_sent = 0; /* used by 'tack' program */
-static int (*my_outch)(int c) = _nc_outch;
+static int (*my_outch) (int c) = _nc_outch;
-int delay_output(int ms)
+int
+delay_output(int ms)
{
- T((T_CALLED("delay_output(%d)"), ms));
+ T((T_CALLED("delay_output(%d)"), ms));
- if (no_pad_char)
- napms(ms);
- else {
- register int nullcount;
+ if (no_pad_char)
+ napms(ms);
+ else {
+ register int nullcount;
- nullcount = (ms * _nc_baudrate(ospeed)) / 10000;
- for (_nc_nulls_sent += nullcount; nullcount > 0; nullcount--)
- my_outch(PC);
- if (my_outch == _nc_outch)
- _nc_flush();
- }
+ nullcount = (ms * _nc_baudrate(ospeed)) / 10000;
+ for (_nc_nulls_sent += nullcount; nullcount > 0; nullcount--)
+ my_outch(PC);
+ if (my_outch == _nc_outch)
+ _nc_flush();
+ }
- returnCode(OK);
+ returnCode(OK);
}
-int _nc_outch(int ch)
+int
+_nc_outch(int ch)
{
#ifdef TRACE
- _nc_outchars++;
+ _nc_outchars++;
#endif /* TRACE */
- if (SP != 0
- && SP->_cleanup) {
- char tmp = ch;
- /*
- * POSIX says write() is safe in a signal handler, but the
- * buffered I/O is not.
- */
- write(fileno(NC_OUTPUT), &tmp, 1);
- } else {
- putc(ch, NC_OUTPUT);
- }
- return OK;
+ if (SP != 0
+ && SP->_cleanup) {
+ char tmp = ch;
+ /*
+ * POSIX says write() is safe in a signal handler, but the
+ * buffered I/O is not.
+ */
+ write(fileno(NC_OUTPUT), &tmp, 1);
+ } else {
+ putc(ch, NC_OUTPUT);
+ }
+ return OK;
}
-int putp(const char *string)
+int
+putp(const char *string)
{
- return tputs(string, 1, _nc_outch);
+ return tputs(string, 1, _nc_outch);
}
-int tputs(const char *string, int affcnt, int (*outc)(int))
+int
+tputs(const char *string, int affcnt, int (*outc) (int))
{
-bool always_delay;
-bool normal_delay;
-int number;
+ bool always_delay;
+ bool normal_delay;
+ int number;
#ifdef BSD_TPUTS
-int trailpad;
+ int trailpad;
#endif /* BSD_TPUTS */
#ifdef TRACE
-char addrbuf[32];
-
- if (_nc_tracing & TRACE_TPUTS)
- {
- if (outc == _nc_outch)
- (void) strcpy(addrbuf, "_nc_outch");
- else
- (void) sprintf(addrbuf, "%p", outc);
- if (_nc_tputs_trace) {
- TR(TRACE_MAXIMUM, ("tputs(%s = %s, %d, %s) called", _nc_tputs_trace, _nc_visbuf(string), affcnt, addrbuf));
- }
- else {
- TR(TRACE_MAXIMUM, ("tputs(%s, %d, %s) called", _nc_visbuf(string), affcnt, addrbuf));
- }
- _nc_tputs_trace = (char *)NULL;
+ char addrbuf[32];
+
+ if (_nc_tracing & TRACE_TPUTS) {
+ if (outc == _nc_outch)
+ (void) strcpy(addrbuf, "_nc_outch");
+ else
+ (void) sprintf(addrbuf, "%p", outc);
+ if (_nc_tputs_trace) {
+ _tracef("tputs(%s = %s, %d, %s) called", _nc_tputs_trace,
+ _nc_visbuf(string), affcnt, addrbuf);
+ } else {
+ _tracef("tputs(%s, %d, %s) called", _nc_visbuf(string), affcnt, addrbuf);
}
+ _nc_tputs_trace = (char *) NULL;
+ }
#endif /* TRACE */
-
- if (!VALID_STRING(string))
- return ERR;
- if (cur_term == 0) {
- always_delay = FALSE;
- normal_delay = TRUE;
- } else {
- always_delay = (string == bell) || (string == flash_screen);
- normal_delay =
- !xon_xoff
- && padding_baud_rate
+ if (!VALID_STRING(string))
+ return ERR;
+
+ if (cur_term == 0) {
+ always_delay = FALSE;
+ normal_delay = TRUE;
+ } else {
+ always_delay = (string == bell) || (string == flash_screen);
+ normal_delay =
+ !xon_xoff
+ && padding_baud_rate
#ifdef NCURSES_NO_PADDING
- && (SP == 0 || !(SP->_no_padding))
+ && (SP == 0 || !(SP->_no_padding))
#endif
- && (_nc_baudrate(ospeed) >= padding_baud_rate);
- }
+ && (_nc_baudrate(ospeed) >= padding_baud_rate);
+ }
#ifdef BSD_TPUTS
- /*
- * This ugly kluge deals with the fact that some ancient BSD programs
- * (like nethack) actually do the likes of tputs("50") to get delays.
- */
- trailpad = 0;
- if (isdigit(*string)) {
+ /*
+ * This ugly kluge deals with the fact that some ancient BSD programs
+ * (like nethack) actually do the likes of tputs("50") to get delays.
+ */
+ trailpad = 0;
+ if (isdigit(*string)) {
+ while (isdigit(*string)) {
+ trailpad = trailpad * 10 + (*string - '0');
+ string++;
+ }
+ trailpad *= 10;
+ if (*string == '.') {
+ string++;
+ if (isdigit(*string)) {
+ trailpad += (*string - '0');
+ string++;
+ }
+ while (isdigit(*string))
+ string++;
+ }
+
+ if (*string == '*') {
+ trailpad *= affcnt;
+ string++;
+ }
+ }
+#endif /* BSD_TPUTS */
+
+ my_outch = outc; /* redirect delay_output() */
+ while (*string) {
+ if (*string != '$')
+ (*outc) (*string);
+ else {
+ string++;
+ if (*string != '<') {
+ (*outc) ('$');
+ if (*string)
+ (*outc) (*string);
+ } else {
+ bool mandatory;
+
+ string++;
+ if ((!isdigit(*string) && *string != '.') || !strchr(string, '>')) {
+ (*outc) ('$');
+ (*outc) ('<');
+ continue;
+ }
+
+ number = 0;
while (isdigit(*string)) {
- trailpad = trailpad * 10 + (*string - '0');
- string++;
+ number = number * 10 + (*string - '0');
+ string++;
}
- trailpad *= 10;
+ number *= 10;
if (*string == '.') {
+ string++;
+ if (isdigit(*string)) {
+ number += (*string - '0');
+ string++;
+ }
+ while (isdigit(*string))
string++;
- if (isdigit(*string)) {
- trailpad += (*string - '0');
- string++;
- }
- while (isdigit(*string))
- string++;
}
- if (*string == '*') {
- trailpad *= affcnt;
+ mandatory = FALSE;
+ while (*string == '*' || *string == '/') {
+ if (*string == '*') {
+ number *= affcnt;
+ string++;
+ } else { /* if (*string == '/') */
+ mandatory = TRUE;
string++;
+ }
}
- }
-#endif /* BSD_TPUTS */
- my_outch = outc; /* redirect delay_output() */
- while (*string) {
- if (*string != '$')
- (*outc)(*string);
- else {
- string++;
- if (*string != '<') {
- (*outc)('$');
- if (*string)
- (*outc)(*string);
- } else {
- bool mandatory;
-
- string++;
- if ((!isdigit(*string) && *string != '.') || !strchr(string, '>')) {
- (*outc)('$');
- (*outc)('<');
- continue;
- }
-
- number = 0;
- while (isdigit(*string)) {
- number = number * 10 + (*string - '0');
- string++;
- }
- number *= 10;
- if (*string == '.') {
- string++;
- if (isdigit(*string)) {
- number += (*string - '0');
- string++;
- }
- while (isdigit(*string))
- string++;
- }
-
- mandatory = FALSE;
- while (*string == '*' || *string == '/')
- {
- if (*string == '*') {
- number *= affcnt;
- string++;
- }
- else /* if (*string == '/') */ {
- mandatory = TRUE;
- string++;
- }
- }
-
- if (number > 0
- && (always_delay
- || normal_delay
- || mandatory))
- delay_output(number/10);
-
- } /* endelse (*string == '<') */
- } /* endelse (*string == '$') */
-
- if (*string == '\0')
- break;
+ if (number > 0
+ && (always_delay
+ || normal_delay
+ || mandatory))
+ delay_output(number / 10);
- string++;
- }
+ } /* endelse (*string == '<') */
+ } /* endelse (*string == '$') */
+
+ if (*string == '\0')
+ break;
+
+ string++;
+ }
#ifdef BSD_TPUTS
- /*
- * Emit any BSD-style prefix padding that we've accumulated now.
- */
- if (trailpad > 0
- && (always_delay || normal_delay))
- delay_output(trailpad/10);
+ /*
+ * Emit any BSD-style prefix padding that we've accumulated now.
+ */
+ if (trailpad > 0
+ && (always_delay || normal_delay))
+ delay_output(trailpad / 10);
#endif /* BSD_TPUTS */
- my_outch = _nc_outch;
- return OK;
+ my_outch = _nc_outch;
+ return OK;
}
diff --git a/lib/libcurses/tinfo/parse_entry.c b/lib/libcurses/tinfo/parse_entry.c
index 08a2a859fba..cfc70ee2ffc 100644
--- a/lib/libcurses/tinfo/parse_entry.c
+++ b/lib/libcurses/tinfo/parse_entry.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: parse_entry.c,v 1.3 1999/11/28 17:49:54 millert Exp $ */
+/* $OpenBSD: parse_entry.c,v 1.4 2000/01/16 01:35:18 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1999,1999 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -33,7 +33,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
/*
* parse_entry.c -- compile one terminfo or termcap entry
*
@@ -50,24 +49,26 @@
#define __INTERNAL_CAPS_VISIBLE
#include <term_entry.h>
-MODULE_ID("$From: parse_entry.c,v 1.40 1999/10/30 23:00:16 tom Exp $")
+MODULE_ID("$From: parse_entry.c,v 1.41 2000/01/15 22:30:27 tom Exp $")
#ifdef LINT
-static short const parametrized[] = { 0 };
+static short const parametrized[] =
+{0};
#else
#include <parametrized.h>
#endif
-struct token _nc_curr_token = { 0, 0, 0 };
+struct token _nc_curr_token =
+{0, 0, 0};
-static void postprocess_termcap(TERMTYPE *, bool);
-static void postprocess_terminfo(TERMTYPE *);
-static struct name_table_entry const * lookup_fullname(const char *name);
+static void postprocess_termcap(TERMTYPE *, bool);
+static void postprocess_terminfo(TERMTYPE *);
+static struct name_table_entry const *lookup_fullname(const char *name);
#if NCURSES_XNAMES
-static struct name_table_entry const *
-_nc_extend_names(ENTRY *entryp, char *name, int token_type)
+static struct name_table_entry const *
+_nc_extend_names(ENTRY * entryp, char *name, int token_type)
{
static struct name_table_entry temp;
TERMTYPE *tp = &(entryp->tterm);
@@ -79,20 +80,20 @@ _nc_extend_names(ENTRY *entryp, char *name, int token_type)
switch (token_type) {
case BOOLEAN:
- first = 0;
- last = tp->ext_Booleans;
+ first = 0;
+ last = tp->ext_Booleans;
offset = tp->ext_Booleans;
tindex = tp->num_Booleans;
break;
case NUMBER:
- first = tp->ext_Booleans;
- last = tp->ext_Numbers + first;
+ first = tp->ext_Booleans;
+ last = tp->ext_Numbers + first;
offset = tp->ext_Booleans + tp->ext_Numbers;
tindex = tp->num_Numbers;
break;
case STRING:
- first = tp->ext_Booleans + tp->ext_Numbers;
- last = tp->ext_Strings + first;
+ first = tp->ext_Booleans + tp->ext_Numbers;
+ last = tp->ext_Strings + first;
offset = tp->ext_Booleans + tp->ext_Numbers + tp->ext_Strings;
tindex = tp->num_Strings;
break;
@@ -100,7 +101,7 @@ _nc_extend_names(ENTRY *entryp, char *name, int token_type)
actual = NUM_EXT_NAMES(tp);
for (n = 0; n < actual; n++) {
if (!strcmp(name, tp->ext_Names[n])) {
- if (n > (unsigned)(tp->ext_Booleans + tp->ext_Numbers)) {
+ if (n > (unsigned) (tp->ext_Booleans + tp->ext_Numbers)) {
token_type = STRING;
} else if (n > tp->ext_Booleans) {
token_type = NUMBER;
@@ -127,9 +128,15 @@ _nc_extend_names(ENTRY *entryp, char *name, int token_type)
offset = n;
tindex = n - first;
switch (token_type) {
- case BOOLEAN: tindex += BOOLCOUNT; break;
- case NUMBER: tindex += NUMCOUNT; break;
- case STRING: tindex += STRCOUNT; break;
+ case BOOLEAN:
+ tindex += BOOLCOUNT;
+ break;
+ case NUMBER:
+ tindex += NUMCOUNT;
+ break;
+ case STRING:
+ tindex += STRCOUNT;
+ break;
}
break;
}
@@ -140,35 +147,35 @@ _nc_extend_names(ENTRY *entryp, char *name, int token_type)
tp->ext_Booleans += 1;
tp->num_Booleans += 1;
tp->Booleans = typeRealloc(char, tp->num_Booleans, tp->Booleans);
- for (last = tp->num_Booleans-1; last > tindex; last--)
- tp->Booleans[last] = tp->Booleans[last-1];
+ for (last = tp->num_Booleans - 1; last > tindex; last--)
+ tp->Booleans[last] = tp->Booleans[last - 1];
break;
case NUMBER:
tp->ext_Numbers += 1;
tp->num_Numbers += 1;
tp->Numbers = typeRealloc(short, tp->num_Numbers, tp->Numbers);
- for (last = tp->num_Numbers-1; last > tindex; last--)
- tp->Numbers[last] = tp->Numbers[last-1];
+ for (last = tp->num_Numbers - 1; last > tindex; last--)
+ tp->Numbers[last] = tp->Numbers[last - 1];
break;
case STRING:
tp->ext_Strings += 1;
tp->num_Strings += 1;
tp->Strings = typeRealloc(char *, tp->num_Strings, tp->Strings);
- for (last = tp->num_Strings-1; last > tindex; last--)
- tp->Strings[last] = tp->Strings[last-1];
+ for (last = tp->num_Strings - 1; last > tindex; last--)
+ tp->Strings[last] = tp->Strings[last - 1];
break;
}
actual = NUM_EXT_NAMES(tp);
- tp->ext_Names = typeRealloc(char *, actual, tp->ext_Names);
+ tp->ext_Names = typeRealloc(char *, actual, tp->ext_Names);
while (--actual > offset)
- tp->ext_Names[actual] = tp->ext_Names[actual-1];
+ tp->ext_Names[actual] = tp->ext_Names[actual - 1];
tp->ext_Names[offset] = _nc_save_str(name);
}
- temp.nte_name = tp->ext_Names[offset];
- temp.nte_type = token_type;
+ temp.nte_name = tp->ext_Names[offset];
+ temp.nte_type = token_type;
temp.nte_index = tindex;
- temp.nte_link = -1;
+ temp.nte_link = -1;
return &temp;
}
@@ -193,16 +200,17 @@ _nc_extend_names(ENTRY *entryp, char *name, int token_type)
* push back token
*/
-int _nc_parse_entry(struct entry *entryp, int literal, bool silent)
+int
+_nc_parse_entry(struct entry *entryp, int literal, bool silent)
{
- int token_type;
- struct name_table_entry const *entry_ptr;
- char *ptr, namecpy[MAX_NAME_SIZE+1];
+ int token_type;
+ struct name_table_entry const *entry_ptr;
+ char *ptr, namecpy[MAX_NAME_SIZE + 1];
token_type = _nc_get_token();
if (token_type == EOF)
- return(EOF);
+ return (EOF);
if (token_type != NAMES)
_nc_err_abort("Entry does not start with terminal names in column one");
@@ -215,8 +223,7 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent)
/* junk the 2-character termcap name, if present */
ptr = _nc_curr_token.tk_name;
- if (ptr[2] == '|')
- {
+ if (ptr[2] == '|') {
ptr = _nc_curr_token.tk_name + 3;
_nc_curr_token.tk_name[2] = '\0';
}
@@ -234,30 +241,29 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent)
/* check for overly-long names and aliases */
(void) strlcpy(namecpy, entryp->tterm.term_names, sizeof(namecpy));
- if ((ptr = strrchr(namecpy, '|')) != (char *)0)
+ if ((ptr = strrchr(namecpy, '|')) != (char *) 0)
*ptr = '\0';
ptr = strtok(namecpy, "|");
if (strlen(ptr) > MAX_ALIAS)
_nc_warning("primary name may be too long");
- while ((ptr = strtok((char *)0, "|")) != (char *)0)
+ while ((ptr = strtok((char *) 0, "|")) != (char *) 0)
if (strlen(ptr) > MAX_ALIAS)
_nc_warning("alias `%s' may be too long", ptr);
entryp->nuses = 0;
for (token_type = _nc_get_token();
- token_type != EOF && token_type != NAMES;
- token_type = _nc_get_token())
- {
+ token_type != EOF && token_type != NAMES;
+ token_type = _nc_get_token()) {
if (strcmp(_nc_curr_token.tk_name, "use") == 0
|| strcmp(_nc_curr_token.tk_name, "tc") == 0) {
- entryp->uses[entryp->nuses].parent = (void *)_nc_save_str(_nc_curr_token.tk_valstring);
+ entryp->uses[entryp->nuses].parent = (void *) _nc_save_str(_nc_curr_token.tk_valstring);
entryp->uses[entryp->nuses].line = _nc_curr_line;
entryp->nuses++;
} else {
/* normal token lookup */
entry_ptr = _nc_find_entry(_nc_curr_token.tk_name,
- _nc_syntax ? _nc_cap_hash_table : _nc_info_hash_table);
+ _nc_syntax ? _nc_cap_hash_table : _nc_info_hash_table);
/*
* Our kluge to handle aliasing. The reason it's done
@@ -267,43 +273,37 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent)
* making this case fast, aliased caps aren't common now
* and will get rarer.
*/
- if (entry_ptr == NOTFOUND)
- {
- const struct alias *ap;
+ if (entry_ptr == NOTFOUND) {
+ const struct alias *ap;
- if (_nc_syntax == SYN_TERMCAP)
- {
+ if (_nc_syntax == SYN_TERMCAP) {
for (ap = _nc_capalias_table; ap->from; ap++)
- if (strcmp(ap->from, _nc_curr_token.tk_name) == 0)
- {
- if (ap->to == (char *)0)
- {
+ if (strcmp(ap->from, _nc_curr_token.tk_name) == 0) {
+ if (ap->to == (char *) 0) {
_nc_warning("%s (%s termcap extension) ignored",
- ap->from, ap->source);
+ ap->from, ap->source);
goto nexttok;
}
entry_ptr = _nc_find_entry(ap->to, _nc_cap_hash_table);
if (entry_ptr && !silent)
- _nc_warning("%s (%s termcap extension) aliased to %s", ap->from, ap->source, ap->to);
+ _nc_warning("%s (%s termcap extension) aliased to %s",
+ ap->from, ap->source, ap->to);
break;
}
- }
- else /* if (_nc_syntax == SYN_TERMINFO) */
- {
+ } else { /* if (_nc_syntax == SYN_TERMINFO) */
for (ap = _nc_infoalias_table; ap->from; ap++)
- if (strcmp(ap->from, _nc_curr_token.tk_name) == 0)
- {
- if (ap->to == (char *)0)
- {
+ if (strcmp(ap->from, _nc_curr_token.tk_name) == 0) {
+ if (ap->to == (char *) 0) {
_nc_warning("%s (%s terminfo extension) ignored",
- ap->from, ap->source);
+ ap->from, ap->source);
goto nexttok;
}
entry_ptr = _nc_find_entry(ap->to, _nc_info_hash_table);
if (entry_ptr && !silent)
- _nc_warning("%s (%s terminfo extension) aliased to %s", ap->from, ap->source, ap->to);
+ _nc_warning("%s (%s terminfo extension) aliased to %s",
+ ap->from, ap->source, ap->to);
break;
}
@@ -312,16 +312,17 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent)
}
}
}
-
#if NCURSES_XNAMES
/*
* If we have extended-names active, we will automatically
* define a name based on its context.
*/
if (entry_ptr == NOTFOUND
- && _nc_user_definable
- && (entry_ptr = _nc_extend_names(entryp, _nc_curr_token.tk_name, token_type)) != 0) {
- _nc_warning("extended capability '%s'", _nc_curr_token.tk_name);
+ && _nc_user_definable
+ && (entry_ptr = _nc_extend_names(entryp,
+ _nc_curr_token.tk_name, token_type)) != 0) {
+ if (_nc_tracing >= DEBUG_LEVEL(1))
+ _nc_warning("extended capability '%s'", _nc_curr_token.tk_name);
}
#endif /* NCURSES_XNAMES */
@@ -329,13 +330,12 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent)
if (entry_ptr == NOTFOUND) {
if (!silent)
_nc_warning("unknown capability '%s'",
- _nc_curr_token.tk_name);
+ _nc_curr_token.tk_name);
continue;
}
/* deal with bad type/value combinations. */
- if (token_type != CANCEL && entry_ptr->nte_type != token_type)
- {
+ if (token_type != CANCEL && entry_ptr->nte_type != token_type) {
/*
* Nasty special cases here handle situations in which type
* information can resolve name clashes. Normal lookup
@@ -349,39 +349,36 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent)
/* tell max_attributes from arrow_key_map */
if (token_type == NUMBER && !strcmp("ma", _nc_curr_token.tk_name))
entry_ptr = _nc_find_type_entry("ma", NUMBER,
- _nc_get_table(_nc_syntax != 0));
+ _nc_get_table(_nc_syntax != 0));
/* map terminfo's string MT to MT */
- else if (token_type==STRING &&!strcmp("MT",_nc_curr_token.tk_name))
+ else if (token_type == STRING && !strcmp("MT", _nc_curr_token.tk_name))
entry_ptr = _nc_find_type_entry("MT", STRING,
- _nc_get_table(_nc_syntax != 0));
+ _nc_get_table(_nc_syntax != 0));
/* treat strings without following "=" as empty strings */
- else if (token_type==BOOLEAN && entry_ptr->nte_type==STRING)
+ else if (token_type == BOOLEAN && entry_ptr->nte_type == STRING)
token_type = STRING;
/* we couldn't recover; skip this token */
- else
- {
- if (!silent)
- {
+ else {
+ if (!silent) {
const char *type_name;
- switch (entry_ptr->nte_type)
- {
+ switch (entry_ptr->nte_type) {
case BOOLEAN:
- type_name = "boolean";
- break;
+ type_name = "boolean";
+ break;
case STRING:
- type_name = "string";
- break;
+ type_name = "string";
+ break;
case NUMBER:
- type_name = "numeric";
- break;
+ type_name = "numeric";
+ break;
default:
- type_name = "unknown";
- break;
+ type_name = "unknown";
+ break;
}
_nc_warning("wrong type used for %s capability '%s'",
- type_name, _nc_curr_token.tk_name);
+ type_name, _nc_curr_token.tk_name);
}
continue;
}
@@ -416,23 +413,23 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent)
case STRING:
ptr = _nc_curr_token.tk_valstring;
- if (_nc_syntax==SYN_TERMCAP)
+ if (_nc_syntax == SYN_TERMCAP)
ptr = _nc_captoinfo(_nc_curr_token.tk_name,
- ptr,
- parametrized[entry_ptr->nte_index]);
+ ptr,
+ parametrized[entry_ptr->nte_index]);
entryp->tterm.Strings[entry_ptr->nte_index] = _nc_save_str(ptr);
break;
default:
if (!silent)
_nc_warning("unknown token type");
- _nc_panic_mode((_nc_syntax==SYN_TERMCAP) ? ':' : ',');
+ _nc_panic_mode((_nc_syntax == SYN_TERMCAP) ? ':' : ',');
continue;
}
- } /* end else cur_token.name != "use" */
- nexttok:
- continue; /* cannot have a label w/o statement */
- } /* endwhile (not EOF and not NAMES) */
+ } /* end else cur_token.name != "use" */
+ nexttok:
+ continue; /* cannot have a label w/o statement */
+ } /* endwhile (not EOF and not NAMES) */
_nc_push_token(token_type);
_nc_set_type(_nc_first_name(entryp->tterm.term_names));
@@ -444,10 +441,9 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent)
* to be done before entry allocation is wrapped up.
*/
if (!literal) {
- if (_nc_syntax == SYN_TERMCAP)
- {
- bool has_base_entry = FALSE;
- int i;
+ if (_nc_syntax == SYN_TERMCAP) {
+ bool has_base_entry = FALSE;
+ int i;
/*
* Don't insert defaults if this is a `+' entry meant only
@@ -462,50 +458,49 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent)
* have picked up defaults via translation.
*/
for (i = 0; i < entryp->nuses; i++)
- if (!strchr((char *)entryp->uses[i].parent, '+'))
+ if (!strchr((char *) entryp->uses[i].parent, '+'))
has_base_entry = TRUE;
postprocess_termcap(&entryp->tterm, has_base_entry);
- }
- else
+ } else
postprocess_terminfo(&entryp->tterm);
}
_nc_wrap_entry(entryp);
- return(OK);
+ return (OK);
}
-int _nc_capcmp(const char *s, const char *t)
+int
+_nc_capcmp(const char *s, const char *t)
/* compare two string capabilities, stripping out padding */
{
if (!s && !t)
- return(0);
+ return (0);
else if (!s || !t)
- return(1);
-
- for (;;)
- {
- if (s[0] == '$' && s[1] == '<')
- {
- for (s += 2; ; s++)
- if (!(isdigit(*s) || *s=='.' || *s=='*' || *s=='/' || *s=='>'))
+ return (1);
+
+ for (;;) {
+ if (s[0] == '$' && s[1] == '<') {
+ for (s += 2;; s++)
+ if (!(isdigit(*s) || *s == '.' || *s == '*' || *s == '/' ||
+ *s == '>'))
break;
}
- if (t[0] == '$' && t[1] == '<')
- {
- for (t += 2; ; t++)
- if (!(isdigit(*t) || *t=='.' || *t=='*' || *t=='/' || *t=='>'))
+ if (t[0] == '$' && t[1] == '<') {
+ for (t += 2;; t++)
+ if (!(isdigit(*t) || *t == '.' || *t == '*' || *t == '/' ||
+ *t == '>'))
break;
}
/* we've now pushed s and t past any padding they were pointing at */
if (*s == '\0' && *t == '\0')
- return(0);
+ return (0);
if (*s != *t)
- return(*t - *s);
+ return (*t - *s);
/* else *s == *t but one is not NUL, so continue */
s++, t++;
@@ -517,29 +512,32 @@ int _nc_capcmp(const char *s, const char *t)
* list. For each capability, we may assume there is a keycap that sends the
* string which is the value of that capability.
*/
-typedef struct {const char *from; const char *to;} assoc;
+typedef struct {
+ const char *from;
+ const char *to;
+} assoc;
static assoc const ko_xlate[] =
{
- {"al", "kil1"}, /* insert line key -> KEY_IL */
- {"bt", "kcbt"}, /* back tab -> KEY_BTAB */
- {"cd", "ked"}, /* clear-to-eos key -> KEY_EOL */
- {"ce", "kel"}, /* clear-to-eol key -> KEY_EOS */
- {"cl", "kclr"}, /* clear key -> KEY_CLEAR */
- {"ct", "tbc"}, /* clear all tabs -> KEY_CATAB */
- {"dc", "kdch1"}, /* delete char -> KEY_DC */
- {"dl", "kdl1"}, /* delete line -> KEY_DL */
- {"do", "kcud1"}, /* down key -> KEY_DOWN */
- {"ei", "krmir"}, /* exit insert key -> KEY_EIC */
- {"ho", "khome"}, /* home key -> KEY_HOME */
- {"ic", "kich1"}, /* insert char key -> KEY_IC */
- {"im", "kIC"}, /* insert-mode key -> KEY_SIC */
- {"le", "kcub1"}, /* le key -> KEY_LEFT */
- {"nd", "kcuf1"}, /* nd key -> KEY_RIGHT */
- {"nl", "kent"}, /* new line key -> KEY_ENTER */
- {"st", "khts"}, /* set-tab key -> KEY_STAB */
- {"ta", CANCELLED_STRING},
- {"up", "kcuu1"}, /* up-arrow key -> KEY_UP */
- {(char *)0, (char *)0},
+ {"al", "kil1"}, /* insert line key -> KEY_IL */
+ {"bt", "kcbt"}, /* back tab -> KEY_BTAB */
+ {"cd", "ked"}, /* clear-to-eos key -> KEY_EOL */
+ {"ce", "kel"}, /* clear-to-eol key -> KEY_EOS */
+ {"cl", "kclr"}, /* clear key -> KEY_CLEAR */
+ {"ct", "tbc"}, /* clear all tabs -> KEY_CATAB */
+ {"dc", "kdch1"}, /* delete char -> KEY_DC */
+ {"dl", "kdl1"}, /* delete line -> KEY_DL */
+ {"do", "kcud1"}, /* down key -> KEY_DOWN */
+ {"ei", "krmir"}, /* exit insert key -> KEY_EIC */
+ {"ho", "khome"}, /* home key -> KEY_HOME */
+ {"ic", "kich1"}, /* insert char key -> KEY_IC */
+ {"im", "kIC"}, /* insert-mode key -> KEY_SIC */
+ {"le", "kcub1"}, /* le key -> KEY_LEFT */
+ {"nd", "kcuf1"}, /* nd key -> KEY_RIGHT */
+ {"nl", "kent"}, /* new line key -> KEY_ENTER */
+ {"st", "khts"}, /* set-tab key -> KEY_STAB */
+ {"ta", CANCELLED_STRING},
+ {"up", "kcuu1"}, /* up-arrow key -> KEY_UP */
+ {(char *) 0, (char *) 0},
};
/*
@@ -570,7 +568,8 @@ static const char C_HT[] = "\t";
#define CUR tp->
static
-void postprocess_termcap(TERMTYPE *tp, bool has_base)
+void
+postprocess_termcap(TERMTYPE * tp, bool has_base)
{
char buf[MAX_LINE * 2 + 2];
@@ -583,8 +582,7 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base)
*/
/* if there was a tc entry, assume we picked up defaults via that */
- if (!has_base)
- {
+ if (!has_base) {
if (WANTED(init_3string) && termcap_init2)
init_3string = _nc_save_str(termcap_init2);
@@ -638,12 +636,12 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base)
} else
newline = _nc_save_str(C_LF);
} else if (PRESENT(carriage_return) && PRESENT(scroll_forward)) {
- strlcpy(buf, carriage_return, MAX_LINE+1);
- strlcat(buf, scroll_forward, MAX_LINE+1);
+ strlcpy(buf, carriage_return, MAX_LINE + 1);
+ strlcat(buf, scroll_forward, MAX_LINE + 1);
newline = _nc_save_str(buf);
} else if (PRESENT(carriage_return) && PRESENT(cursor_down)) {
- strlcpy(buf, carriage_return, MAX_LINE+1);
- strlcat(buf, cursor_down, MAX_LINE+1);
+ strlcpy(buf, carriage_return, MAX_LINE + 1);
+ strlcat(buf, cursor_down, MAX_LINE + 1);
newline = _nc_save_str(buf);
}
}
@@ -658,8 +656,7 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base)
* These translations will *not* be inverted by tgetent().
*/
- if (!has_base)
- {
+ if (!has_base) {
/*
* We wait until now to decide if we've got a working cr because even
* one that doesn't work can be used for newline. Unfortunately the
@@ -695,13 +692,11 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base)
if (has_hardware_tabs == TRUE) {
if (init_tabs != 8 && init_tabs != ABSENT_NUMERIC)
_nc_warning("hardware tabs with a width other than 8: %d", init_tabs);
- else
- {
+ else {
if (tab && _nc_capcmp(tab, C_HT))
_nc_warning("hardware tabs with a non-^I tab string %s",
- _nc_visbuf(tab));
- else
- {
+ _nc_visbuf(tab));
+ else {
if (WANTED(tab))
tab = _nc_save_str(C_HT);
init_tabs = 8;
@@ -712,14 +707,13 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base)
* Now translate the ko capability, if there is one. This
* isn't from mytinfo...
*/
- if (PRESENT(other_non_function_keys))
- {
- char *dp, *cp = strtok(other_non_function_keys, ",");
- struct name_table_entry const *from_ptr;
- struct name_table_entry const *to_ptr;
- assoc const *ap;
- char buf2[MAX_TERMINFO_LENGTH];
- bool foundim;
+ if (PRESENT(other_non_function_keys)) {
+ char *dp, *cp = strtok(other_non_function_keys, ",");
+ struct name_table_entry const *from_ptr;
+ struct name_table_entry const *to_ptr;
+ assoc const *ap;
+ char buf2[MAX_TERMINFO_LENGTH];
+ bool foundim;
/* we're going to use this for a special case later */
dp = strchr(other_non_function_keys, 'i');
@@ -730,30 +724,26 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base)
for (ap = ko_xlate; ap->from; ap++)
if (strcmp(ap->from, cp) == 0)
break;
- if (!ap->to)
- {
+ if (!ap->to) {
_nc_warning("unknown capability `%s' in ko string", cp);
continue;
- }
- else if (ap->to == CANCELLED_STRING) /* ignore it */
+ } else if (ap->to == CANCELLED_STRING) /* ignore it */
continue;
/* now we know we found a match in ko_table, so... */
from_ptr = _nc_find_entry(ap->from, _nc_cap_hash_table);
- to_ptr = _nc_find_entry(ap->to, _nc_info_hash_table);
+ to_ptr = _nc_find_entry(ap->to, _nc_info_hash_table);
if (!from_ptr || !to_ptr) /* should never happen! */
_nc_err_abort("ko translation table is invalid, I give up");
- if (WANTED(tp->Strings[from_ptr->nte_index]))
- {
+ if (WANTED(tp->Strings[from_ptr->nte_index])) {
_nc_warning("no value for ko capability %s", ap->from);
continue;
}
- if (tp->Strings[to_ptr->nte_index])
- {
+ if (tp->Strings[to_ptr->nte_index]) {
/* There's no point in warning about it if it's the same
* string; that's just an inefficiency.
*/
@@ -761,8 +751,8 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base)
tp->Strings[from_ptr->nte_index],
tp->Strings[to_ptr->nte_index]) != 0)
_nc_warning("%s (%s) already has an explicit value %s, ignoring ko",
- ap->to, ap->from,
- _nc_visbuf(tp->Strings[to_ptr->nte_index]) );
+ ap->to, ap->from,
+ _nc_visbuf(tp->Strings[to_ptr->nte_index]));
continue;
}
@@ -771,24 +761,21 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base)
* stripping out padding.
*/
dp = buf2;
- for (cp = tp->Strings[from_ptr->nte_index]; *cp; cp++)
- {
- if (cp[0] == '$' && cp[1] == '<')
- {
+ for (cp = tp->Strings[from_ptr->nte_index]; *cp; cp++) {
+ if (cp[0] == '$' && cp[1] == '<') {
while (*cp && *cp != '>')
if (!*cp)
break;
- else
+ else
++cp;
- }
- else
+ } else
*dp++ = *cp;
}
*dp++ = '\0';
tp->Strings[to_ptr->nte_index] = _nc_save_str(buf2);
} while
- ((cp = strtok((char *)0, ",")) != 0);
+ ((cp = strtok((char *) 0, ",")) != 0);
/*
* Note: ko=im and ko=ic both want to grab the `Insert'
@@ -796,15 +783,13 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base)
* got mapped to kich1 and im to kIC to avoid a collision.
* If the description has im but not ic, hack kIC back to kich1.
*/
- if (foundim && WANTED(key_ic) && key_sic)
- {
+ if (foundim && WANTED(key_ic) && key_sic) {
key_ic = key_sic;
key_sic = ABSENT_STRING;
}
}
- if (!hard_copy)
- {
+ if (!hard_copy) {
if (WANTED(key_backspace))
key_backspace = _nc_save_str(C_BS);
if (WANTED(key_left))
@@ -826,90 +811,76 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base)
PRESENT(acs_ttee) ||
PRESENT(acs_hline) ||
PRESENT(acs_vline) ||
- PRESENT(acs_plus))
- {
- char buf2[MAX_TERMCAP_LENGTH], *bp = buf2;
+ PRESENT(acs_plus)) {
+ char buf2[MAX_TERMCAP_LENGTH], *bp = buf2;
- if (acs_chars)
- {
- (void)strcpy(bp, acs_chars);
+ if (acs_chars) {
+ (void) strcpy(bp, acs_chars);
bp += strlen(bp);
}
- if (acs_ulcorner && acs_ulcorner[1] == '\0')
- {
+ if (acs_ulcorner && acs_ulcorner[1] == '\0') {
*bp++ = 'l';
*bp++ = *acs_ulcorner;
}
- if (acs_llcorner && acs_llcorner[1] == '\0')
- {
+ if (acs_llcorner && acs_llcorner[1] == '\0') {
*bp++ = 'm';
*bp++ = *acs_llcorner;
}
- if (acs_urcorner && acs_urcorner[1] == '\0')
- {
+ if (acs_urcorner && acs_urcorner[1] == '\0') {
*bp++ = 'k';
*bp++ = *acs_urcorner;
}
- if (acs_lrcorner && acs_lrcorner[1] == '\0')
- {
+ if (acs_lrcorner && acs_lrcorner[1] == '\0') {
*bp++ = 'j';
*bp++ = *acs_lrcorner;
}
- if (acs_ltee && acs_ltee[1] == '\0')
- {
+ if (acs_ltee && acs_ltee[1] == '\0') {
*bp++ = 't';
*bp++ = *acs_ltee;
}
- if (acs_rtee && acs_rtee[1] == '\0')
- {
+ if (acs_rtee && acs_rtee[1] == '\0') {
*bp++ = 'u';
*bp++ = *acs_rtee;
}
- if (acs_btee && acs_btee[1] == '\0')
- {
+ if (acs_btee && acs_btee[1] == '\0') {
*bp++ = 'v';
*bp++ = *acs_btee;
}
- if (acs_ttee && acs_ttee[1] == '\0')
- {
+ if (acs_ttee && acs_ttee[1] == '\0') {
*bp++ = 'w';
*bp++ = *acs_ttee;
}
- if (acs_hline && acs_hline[1] == '\0')
- {
+ if (acs_hline && acs_hline[1] == '\0') {
*bp++ = 'q';
*bp++ = *acs_hline;
}
- if (acs_vline && acs_vline[1] == '\0')
- {
+ if (acs_vline && acs_vline[1] == '\0') {
*bp++ = 'x';
*bp++ = *acs_vline;
}
- if (acs_plus)
- {
+ if (acs_plus) {
*bp++ = 'n';
strcpy(bp, acs_plus);
bp = buf2 + strlen(buf2);
}
- if (bp != buf2)
- {
+ if (bp != buf2) {
*bp++ = '\0';
acs_chars = _nc_save_str(buf2);
_nc_warning("acsc string synthesized from XENIX capabilities");
}
- }
- else if (acs_chars == 0
- && enter_alt_charset_mode != 0
- && exit_alt_charset_mode != 0)
- {
- acs_chars = _nc_save_str("``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~");
+ } else if (acs_chars == 0
+ && enter_alt_charset_mode != 0
+ && exit_alt_charset_mode != 0) {
+ acs_chars =
+ _nc_save_str("``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~");
}
}
static
-void postprocess_terminfo(TERMTYPE *tp)
+void
+postprocess_terminfo(TERMTYPE * tp)
{
/*
* TERMINFO-TO-TERMINFO MAPPINGS FOR SOURCE TRANSLATION
@@ -919,74 +890,60 @@ void postprocess_terminfo(TERMTYPE *tp)
/*
* Translate AIX forms characters.
*/
- if (PRESENT(box_chars_1))
- {
- char buf2[MAX_TERMCAP_LENGTH], *bp = buf2;
+ if (PRESENT(box_chars_1)) {
+ char buf2[MAX_TERMCAP_LENGTH], *bp = buf2;
- if (acs_chars)
- {
- (void)strcpy(bp, acs_chars);
+ if (acs_chars) {
+ (void) strcpy(bp, acs_chars);
bp += strlen(bp);
}
- if (box_chars_1[0]) /* ACS_ULCORNER */
- {
+ if (box_chars_1[0]) { /* ACS_ULCORNER */
*bp++ = 'l';
*bp++ = box_chars_1[0];
}
- if (box_chars_1[1]) /* ACS_HLINE */
- {
+ if (box_chars_1[1]) { /* ACS_HLINE */
*bp++ = 'q';
*bp++ = box_chars_1[1];
}
- if (box_chars_1[2]) /* ACS_URCORNER */
- {
+ if (box_chars_1[2]) { /* ACS_URCORNER */
*bp++ = 'k';
*bp++ = box_chars_1[2];
}
- if (box_chars_1[3]) /* ACS_VLINE */
- {
+ if (box_chars_1[3]) { /* ACS_VLINE */
*bp++ = 'x';
*bp++ = box_chars_1[3];
}
- if (box_chars_1[4]) /* ACS_LRCORNER */
- {
+ if (box_chars_1[4]) { /* ACS_LRCORNER */
*bp++ = 'j';
*bp++ = box_chars_1[4];
}
- if (box_chars_1[5]) /* ACS_LLCORNER */
- {
+ if (box_chars_1[5]) { /* ACS_LLCORNER */
*bp++ = 'm';
*bp++ = box_chars_1[5];
}
- if (box_chars_1[6]) /* ACS_TTEE */
- {
+ if (box_chars_1[6]) { /* ACS_TTEE */
*bp++ = 'w';
*bp++ = box_chars_1[6];
}
- if (box_chars_1[7]) /* ACS_RTEE */
- {
+ if (box_chars_1[7]) { /* ACS_RTEE */
*bp++ = 'u';
*bp++ = box_chars_1[7];
}
- if (box_chars_1[8]) /* ACS_BTEE */
- {
+ if (box_chars_1[8]) { /* ACS_BTEE */
*bp++ = 'v';
*bp++ = box_chars_1[8];
}
- if (box_chars_1[9]) /* ACS_LTEE */
- {
+ if (box_chars_1[9]) { /* ACS_LTEE */
*bp++ = 't';
*bp++ = box_chars_1[9];
}
- if (box_chars_1[10]) /* ACS_PLUS */
- {
+ if (box_chars_1[10]) { /* ACS_PLUS */
*bp++ = 'n';
*bp++ = box_chars_1[10];
}
- if (bp != buf2)
- {
+ if (bp != buf2) {
*bp++ = '\0';
acs_chars = _nc_save_str(buf2);
_nc_warning("acsc string synthesized from AIX capabilities");
@@ -1007,7 +964,8 @@ void postprocess_terminfo(TERMTYPE *tp)
* sorted, but the nte_type fields are not necessarily grouped together.
*/
static
-struct name_table_entry const * lookup_fullname(const char *find)
+struct name_table_entry const *
+lookup_fullname(const char *find)
{
int state = -1;
@@ -1031,10 +989,10 @@ struct name_table_entry const * lookup_fullname(const char *find)
for (count = 0; names[count] != 0; count++) {
if (!strcmp(names[count], find)) {
- struct name_table_entry const *entry_ptr = _nc_get_table(FALSE);
- while (entry_ptr->nte_type != state
+ struct name_table_entry const *entry_ptr = _nc_get_table(FALSE);
+ while (entry_ptr->nte_type != state
|| entry_ptr->nte_index != count)
- entry_ptr++;
+ entry_ptr++;
return entry_ptr;
}
}
diff --git a/lib/libcurses/tty/tty_update.c b/lib/libcurses/tty/tty_update.c
index 2df0aa2f81d..07102426eeb 100644
--- a/lib/libcurses/tty/tty_update.c
+++ b/lib/libcurses/tty/tty_update.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: tty_update.c,v 1.4 1999/11/28 17:49:55 millert Exp $ */
+/* $OpenBSD: tty_update.c,v 1.5 2000/01/16 01:35:18 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -75,7 +75,7 @@
#include <term.h>
-MODULE_ID("$From: tty_update.c,v 1.122 1999/11/28 03:07:38 tom Exp $")
+MODULE_ID("$From: tty_update.c,v 1.123 2000/01/15 23:49:36 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
@@ -88,6 +88,7 @@ MODULE_ID("$From: tty_update.c,v 1.122 1999/11/28 03:07:38 tom Exp $")
*/
#define CHECK_INTERVAL 5
+#define FILL_BCE() (SP->_coloron && !SP->_default_color && !back_color_erase)
/*
* Enable checking to see if doupdate and friends are tracking the true
* cursor position correctly. NOTE: this is a debugging hack which will
@@ -874,7 +875,7 @@ bool needclear = FALSE;
TPUTS_TRACE("clr_eol");
if (SP->_el_cost > (screen_columns - SP->_curscol)
#ifdef NCURSES_EXT_FUNCS
- || (SP->_coloron && !SP->_default_color && !back_color_erase)
+ || FILL_BCE()
#endif
)
{
@@ -901,7 +902,7 @@ int row, col;
col = SP->_curscol;
#ifdef NCURSES_EXT_FUNCS
- if (SP->_coloron && !SP->_default_color && !back_color_erase) {
+ if (FILL_BCE()) {
int i, j, k = col;
for (i = row; i < screen_lines; i++) {
GoTo(i, k);
@@ -1377,18 +1378,29 @@ static void InsStr(chtype *line, int count)
static void DelChar(int count)
{
+ int n;
+
T(("DelChar(%d) called, position = (%d,%d)", count, newscr->_cury, newscr->_curx));
if (parm_dch) {
TPUTS_TRACE("parm_dch");
tputs(tparm(parm_dch, count), count, _nc_outch);
} else {
- while (count--)
- {
+ for (n = 0; n < count; n++) {
TPUTS_TRACE("delete_character");
putp(delete_character);
}
}
+#ifdef NCURSES_EXT_FUNCS
+ if (FILL_BCE()) {
+ chtype blank = ClrBlank(stdscr);
+ GoTo(SP->_cursrow, screen_columns - count);
+ UpdateAttrs(blank);
+ for (n = 0; n < count; n++) {
+ PutChar(blank);
+ }
+ }
+#endif
}
/*
@@ -1492,7 +1504,7 @@ static int scroll_csr_forward(int n, int top, int bot, int miny, int maxy, chtyp
return ERR;
#ifdef NCURSES_EXT_FUNCS
- if (SP->_coloron && !SP->_default_color && !back_color_erase) {
+ if (FILL_BCE()) {
for (i = 0; i < n; i++) {
GoTo(bot-i, 0);
for (j = 0; j < screen_columns; j++)
@@ -1561,7 +1573,7 @@ static int scroll_csr_backward(int n, int top, int bot, int miny, int maxy, chty
return ERR;
#ifdef NCURSES_EXT_FUNCS
- if (SP->_coloron && !SP->_default_color && !back_color_erase) {
+ if (FILL_BCE()) {
for (i = 0; i < n; i++) {
GoTo(top+i, 0);
for (j = 0; j < screen_columns; j++)