]> granicus.if.org Git - strace/commitdiff
term: use print_quoted_string
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sat, 26 Aug 2017 22:42:55 +0000 (00:42 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 27 Aug 2017 11:06:14 +0000 (11:06 +0000)
* term.c (decode_termios): Use print_quoted_string for printing c_cc field
instead of writing the printing code by hand.

term.c

diff --git a/term.c b/term.c
index 6a7a65b801e4c9739d9478a0c5120b7e1e730f30..9a5d62d9dba6c700ea7e04488f8561904df2ebc7 100644 (file)
--- a/term.c
+++ b/term.c
@@ -42,7 +42,6 @@ static void
 decode_termios(struct tcb *const tcp, const kernel_ulong_t addr)
 {
        struct termios tios;
-       int i;
 
        tprints(", ");
        if (umove_or_printaddr(tcp, addr, &tios))
@@ -65,10 +64,9 @@ decode_termios(struct tcb *const tcp, const kernel_ulong_t addr)
        if (!(tios.c_lflag & ICANON))
                tprintf("c_cc[VMIN]=%d, c_cc[VTIME]=%d, ",
                        tios.c_cc[VMIN], tios.c_cc[VTIME]);
-       tprints("c_cc=\"");
-       for (i = 0; i < NCCS; i++)
-               tprintf("\\x%02x", tios.c_cc[i]);
-       tprints("\"}");
+       tprints("c_cc=");
+       print_quoted_string((char *) tios.c_cc, NCCS, QUOTE_FORCE_HEX);
+       tprints("}");
 }
 
 static void