- /*
- * If the rendition is the same for the whole string, display it as a
- * quoted string, followed by the rendition. Otherwise, use the more
- * detailed trace function that displays each character separately.
- */
- if (same) {
- static const char d_quote[] =
- {D_QUOTE, 0};
-
- result = _nc_trace_bufcat(bufnum, d_quote);
- while (len-- > 0) {
- if ((found = _nc_altcharset_name(attr, CharOfD(buf))) != 0) {
- result = _nc_trace_bufcat(bufnum, found);
- attr &= ~A_ALTCHARSET;
- } else if (!isWidecExt(CHDEREF(buf))) {
- PUTC_DATA;
-
- PUTC_INIT;
- do {
- PUTC_ch = PUTC_i < CCHARW_MAX ? buf->chars[PUTC_i] : L'\0';
- PUTC_n = wcrtomb(PUTC_buf, buf->chars[PUTC_i], &PUT_st);
- if (PUTC_ch == L'\0')
- --PUTC_n;
- if (PUTC_n <= 0)
- break;
- for (n = 0; n < PUTC_n; n++) {
- char temp[80];
- _nc_vischar(temp, UChar(PUTC_buf[n]));
- result = _nc_trace_bufcat(bufnum, temp);
+ (void) _nc_trace_bufcat(bufnum, l_brace);
+ (void) _nc_trace_bufcat(bufnum, d_quote);
+ for (j = first; j <= last; ++j) {
+ found = _nc_altcharset_name(attr, (chtype) CharOf(buf[j]));
+ if (found != 0) {
+ (void) _nc_trace_bufcat(bufnum, found);
+ attr &= ~A_ALTCHARSET;
+ } else
+#if USE_WIDEC_SUPPORT
+ if (!isWidecExt(buf[j])) {
+ PUTC_DATA;
+
+ PUTC_INIT;
+ for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) {
+ int k;
+
+ PUTC_ch = buf[j].chars[PUTC_i];
+ if (PUTC_ch == L'\0') {
+ if (PUTC_i == 0)
+ (void) _nc_trace_bufcat(bufnum, "\\000");
+ break;
+ }
+ PUTC_n = (int) wcrtomb(PUTC_buf,
+ buf[j].chars[PUTC_i], &PUT_st);
+ if (PUTC_n <= 0)
+ break;
+ for (k = 0; k < PUTC_n; k++) {
+ char temp[80];
+ VisChar(temp, UChar(PUTC_buf[k]), sizeof(temp));
+ (void) _nc_trace_bufcat(bufnum, temp);
+ }