aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/ncurses/trace/lib_traceatr.c
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2002-06-20 19:42:51 +0000
committerPeter Wemm <peter@FreeBSD.org>2002-06-20 19:42:51 +0000
commitb82face19ffe7bbde78f772e93cf2d0d9f42fbdf (patch)
tree91a3f3ec93c8c476cbd12ad790a9ed6ab430d4e3 /contrib/ncurses/ncurses/trace/lib_traceatr.c
parent3badd6bcab72af1619f1e9694025996b49c5df61 (diff)
downloadsrc-b82face19ffe7bbde78f772e93cf2d0d9f42fbdf.tar.gz
src-b82face19ffe7bbde78f772e93cf2d0d9f42fbdf.zip
Import ncurses 5.2-20020615 to fix a first-column display bug.vendor/ncurses/5.2-20020615
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=98503 svn path=/vendor/ncurses/5.2-20020615/; revision=98505; tag=vendor/ncurses/5.2-20020615
Diffstat (limited to 'contrib/ncurses/ncurses/trace/lib_traceatr.c')
-rw-r--r--contrib/ncurses/ncurses/trace/lib_traceatr.c63
1 files changed, 33 insertions, 30 deletions
diff --git a/contrib/ncurses/ncurses/trace/lib_traceatr.c b/contrib/ncurses/ncurses/trace/lib_traceatr.c
index 714e508f3040..870624f3f514 100644
--- a/contrib/ncurses/ncurses/trace/lib_traceatr.c
+++ b/contrib/ncurses/ncurses/trace/lib_traceatr.c
@@ -39,7 +39,7 @@
#include <curses.priv.h>
#include <term.h> /* acs_chars */
-MODULE_ID("$Id: lib_traceatr.c,v 1.41 2002/02/10 01:26:56 tom Exp $")
+MODULE_ID("$Id: lib_traceatr.c,v 1.42 2002/06/16 00:35:01 tom Exp $")
#define COLOR_OF(c) (c < 0 || c > 7 ? "default" : colors[c].name)
@@ -249,39 +249,42 @@ NCURSES_EXPORT(char *)
_tracecchar_t2 (int bufnum, const cchar_t *ch)
{
char *buf = _nc_trace_buf(bufnum, BUFSIZ);
- attr_t attr = AttrOfD(ch);
+ attr_t attr;
const char *found;
strcpy(buf, l_brace);
- if ((found = _nc_altcharset_name(attr, CharOfD(ch))) != 0) {
- (void) strcat(buf, found);
- attr &= ~A_ALTCHARSET;
- } else if (!isnac(CHDEREF(ch))) {
- PUTC_DATA;
- int n;
-
- memset (&PUT_st, '\0', sizeof (PUT_st));
- PUTC_i = 0;
- (void) strcat(buf, "{ ");
- do {
- PUTC_ch = PUTC_i < CCHARW_MAX ? ch->chars[PUTC_i] : L'\0';
- PUTC_n = wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st);
- if (PUTC_ch == L'\0')
- --PUTC_n;
- if (PUTC_n <= 0)
- break;
- for (n = 0; n < PUTC_n; n++) {
- if (n)
- (void) strcat(buf, ", ");
- (void) strcat(buf, _tracechar(UChar(PUTC_buf[n])));
- }
- ++PUTC_i;
- } while (PUTC_ch != L'\0');
- (void) strcat(buf, " }");
+ if (ch != 0) {
+ attr = AttrOfD(ch);
+ if ((found = _nc_altcharset_name(attr, CharOfD(ch))) != 0) {
+ (void) strcat(buf, found);
+ attr &= ~A_ALTCHARSET;
+ } else if (!isnac(CHDEREF(ch))) {
+ PUTC_DATA;
+ int n;
+
+ memset (&PUT_st, '\0', sizeof (PUT_st));
+ PUTC_i = 0;
+ (void) strcat(buf, "{ ");
+ do {
+ PUTC_ch = PUTC_i < CCHARW_MAX ? ch->chars[PUTC_i] : L'\0';
+ PUTC_n = wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st);
+ if (PUTC_ch == L'\0')
+ --PUTC_n;
+ if (PUTC_n <= 0)
+ break;
+ for (n = 0; n < PUTC_n; n++) {
+ if (n)
+ (void) strcat(buf, ", ");
+ (void) strcat(buf, _tracechar(UChar(PUTC_buf[n])));
+ }
+ ++PUTC_i;
+ } while (PUTC_ch != L'\0');
+ (void) strcat(buf, " }");
+ }
+ if (attr != A_NORMAL)
+ (void) sprintf(buf + strlen(buf), " | %s",
+ _traceattr2(bufnum + 20, attr));
}
- if (attr != A_NORMAL)
- (void) sprintf(buf + strlen(buf), " | %s",
- _traceattr2(bufnum + 20, attr));
return (strcat(buf, r_brace));
}