]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/trace/visbuf.c
ncurses 6.1 - patch 20190406
[ncurses.git] / ncurses / trace / visbuf.c
index 66d0c8a797ffde2fbf3b3751491ede1fe66b2295..17b590a725291a1851b654c7d5951273f6eed71a 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2001-2014,2016 Free Software Foundation, Inc.              *
+ * Copyright (c) 2001-2017,2019 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            *
@@ -42,7 +42,7 @@
 #include <tic.h>
 #include <ctype.h>
 
-MODULE_ID("$Id: visbuf.c,v 1.47 2016/05/28 23:29:37 tom Exp $")
+MODULE_ID("$Id: visbuf.c,v 1.50 2019/02/16 21:18:42 tom Exp $")
 
 #define NUM_VISBUFS 4
 
@@ -80,6 +80,9 @@ _nc_vischar(char *tp, unsigned c LIMIT_ARG)
     } else if (c == '\b') {
        *tp++ = '\\';
        *tp++ = 'b';
+    } else if (c == '\t') {
+       *tp++ = '\\';
+       *tp++ = 't';
     } else if (c == '\033') {
        *tp++ = '\\';
        *tp++ = 'e';
@@ -333,9 +336,10 @@ _nc_viscbuf2(int bufnum, const NCURSES_CH_T * buf, int len)
                        PUTC_n = (int) wcrtomb(PUTC_buf,
                                               buf[j].chars[PUTC_i], &PUT_st);
                        if (PUTC_n <= 0 || buf[j].chars[PUTC_i] > 255) {
-                           sprintf(temp, "{%d:\\u%x}",
-                                   wcwidth(buf[j].chars[PUTC_i]),
-                                   buf[j].chars[PUTC_i]);
+                           _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
+                                       "{%d:\\u%lx}",
+                                       wcwidth(buf[j].chars[PUTC_i]),
+                                       (unsigned long) buf[j].chars[PUTC_i]);
                            (void) _nc_trace_bufcat(bufnum, temp);
                            break;
                        }