]> granicus.if.org Git - strace/blobdiff - term.c
tests: move F_OFD_SETLK* checks from fcntl64.c to fcntl-common.c
[strace] / term.c
diff --git a/term.c b/term.c
index dcac3ccd36b32998e63c28a5b770d6aee1ed780b..cfb878b0fa561e8974b4369441ac2cfdbb5867b6 100644 (file)
--- a/term.c
+++ b/term.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
+ * Copyright (c) 1996-2018 The strace developers.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -41,10 +42,6 @@ static void
 decode_termios(struct tcb *const tcp, const kernel_ulong_t addr)
 {
        struct termios tios;
-       int i;
-
-       if (!verbose(tcp))
-               return;
 
        tprints(", ");
        if (umove_or_printaddr(tcp, addr, &tios))
@@ -67,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
@@ -79,9 +75,6 @@ decode_termio(struct tcb *const tcp, const kernel_ulong_t addr)
        struct termio tio;
        int i;
 
-       if (!verbose(tcp))
-               return;
-
        tprints(", ");
        if (umove_or_printaddr(tcp, addr, &tio))
                return;
@@ -120,9 +113,6 @@ decode_winsize(struct tcb *const tcp, const kernel_ulong_t addr)
 {
        struct winsize ws;
 
-       if (!verbose(tcp))
-               return;
-
        tprints(", ");
        if (umove_or_printaddr(tcp, addr, &ws))
                return;
@@ -136,9 +126,6 @@ decode_ttysize(struct tcb *const tcp, const kernel_ulong_t addr)
 {
        struct ttysize ts;
 
-       if (!verbose(tcp))
-               return;
-
        tprints(", ");
        if (umove_or_printaddr(tcp, addr, &ts))
                return;
@@ -152,9 +139,6 @@ decode_modem_flags(struct tcb *const tcp, const kernel_ulong_t addr)
 {
        int i;
 
-       if (!verbose(tcp))
-               return;
-
        tprints(", ");
        if (umove_or_printaddr(tcp, addr, &i))
                return;
@@ -176,6 +160,7 @@ term_ioctl(struct tcb *const tcp, const unsigned int code,
        case TIOCGLCKTRMIOS:
                if (entering(tcp))
                        return 0;
+               ATTRIBUTE_FALLTHROUGH;
        case TCSETS:
 #ifdef TCSETS2
        case TCSETS2:
@@ -196,6 +181,7 @@ term_ioctl(struct tcb *const tcp, const unsigned int code,
        case TCGETA:
                if (entering(tcp))
                        return 0;
+               ATTRIBUTE_FALLTHROUGH;
        case TCSETA:
        case TCSETAW:
        case TCSETAF:
@@ -206,6 +192,7 @@ term_ioctl(struct tcb *const tcp, const unsigned int code,
        case TIOCGWINSZ:
                if (entering(tcp))
                        return 0;
+               ATTRIBUTE_FALLTHROUGH;
        case TIOCSWINSZ:
                decode_winsize(tcp, arg);
                break;
@@ -215,6 +202,7 @@ term_ioctl(struct tcb *const tcp, const unsigned int code,
        case TIOCGSIZE:
                if (entering(tcp))
                        return 0;
+               ATTRIBUTE_FALLTHROUGH;
        case TIOCSSIZE:
                decode_ttysize(tcp, arg);
                break;
@@ -239,6 +227,7 @@ term_ioctl(struct tcb *const tcp, const unsigned int code,
        case TIOCMGET:
                if (entering(tcp))
                        return 0;
+               ATTRIBUTE_FALLTHROUGH;
        case TIOCMBIS:
        case TIOCMBIC:
        case TIOCMSET:
@@ -261,6 +250,7 @@ term_ioctl(struct tcb *const tcp, const unsigned int code,
 #endif
                if (entering(tcp))
                        return 0;
+               ATTRIBUTE_FALLTHROUGH;
        case TIOCSPGRP:
        case TIOCSETD:
        case FIONBIO:
@@ -302,5 +292,5 @@ term_ioctl(struct tcb *const tcp, const unsigned int code,
                return RVAL_DECODED;
        }
 
-       return RVAL_DECODED | 1;
+       return RVAL_IOCTL_DECODED;
 }