]> granicus.if.org Git - strace/blobdiff - term.c
unwind: fix a bug in range updating of binary search
[strace] / term.c
diff --git a/term.c b/term.c
index a4b5b4857faf13ec8a138db6c679844b765823ee..d1c9b6530a6d31d61d66a30214ede29f288a5979 100644 (file)
--- a/term.c
+++ b/term.c
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *     $Id$
  */
 
 #include "defs.h"
-
-#ifdef LINUX
 /*
  * The C library's definition of struct termios might differ from
  * the kernel one, and we need to use the kernel layout.
  */
 #include <linux/termios.h>
-#else
-
-#ifdef HAVE_TERMIO_H
-#include <termio.h>
-#endif /* HAVE_TERMIO_H */
-
-#include <termios.h>
-#endif
-
 #ifdef HAVE_SYS_FILIO_H
-#include <sys/filio.h>
+# include <sys/filio.h>
 #endif
 
-static const struct xlat tcxonc_options[] = {
-       { TCOOFF,       "TCOOFF"        },
-       { TCOON,        "TCOON"         },
-       { TCIOFF,       "TCIOFF"        },
-       { TCION,        "TCION"         },
-       { 0,            NULL            },
-};
+#include "xlat/tcxonc_options.h"
 
 #ifdef TCLFLSH
-static const struct xlat tcflsh_options[] = {
-       { TCIFLUSH,     "TCIFLUSH"      },
-       { TCOFLUSH,     "TCOFLUSH"      },
-       { TCIOFLUSH,    "TCIOFLUSH"     },
-       { 0,            NULL            },
-};
+#include "xlat/tcflsh_options.h"
 #endif
 
-static const struct xlat baud_options[] = {
-       { B0,           "B0"            },
-       { B50,          "B50"           },
-       { B75,          "B75"           },
-       { B110,         "B110"          },
-       { B134,         "B134"          },
-       { B150,         "B150"          },
-       { B200,         "B200"          },
-       { B300,         "B300"          },
-       { B600,         "B600"          },
-       { B1200,        "B1200"         },
-       { B1800,        "B1800"         },
-       { B2400,        "B2400"         },
-       { B4800,        "B4800"         },
-       { B9600,        "B9600"         },
-#ifdef B19200
-       { B19200,       "B19200"        },
-#endif
-#ifdef B38400
-       { B38400,       "B38400"        },
-#endif
-#ifdef B57600
-       { B57600,       "B57600"        },
-#endif
-#ifdef B115200
-       { B115200,      "B115200"       },
-#endif
-#ifdef B230400
-       { B230400,      "B230400"       },
-#endif
-#ifdef B460800
-       { B460800,      "B460800"       },
-#endif
-#ifdef B500000
-       { B500000,      "B500000"       },
-#endif
-#ifdef B576000
-       { B576000,      "B576000"       },
-#endif
-#ifdef B921600
-       { B921600,      "B921600"       },
-#endif
-#ifdef B1000000
-       { B1000000,     "B1000000"      },
-#endif
-#ifdef B1152000
-       { B1152000,     "B1152000"      },
-#endif
-#ifdef B1500000
-       { B1500000,     "B1500000"      },
-#endif
-#ifdef B2000000
-       { B2000000,     "B2000000"      },
-#endif
-#ifdef B2500000
-       { B2500000,     "B2500000"      },
-#endif
-#ifdef B3000000
-       { B3000000,     "B3000000"      },
-#endif
-#ifdef B3500000
-       { B3500000,     "B3500000"      },
-#endif
-#ifdef B4000000
-       { B4000000,     "B4000000"      },
-#endif
-#ifdef EXTA
-       { EXTA,         "EXTA"          },
-#endif
-#ifdef EXTB
-       { EXTB,         "EXTB"          },
-#endif
-       { 0,            NULL            },
-};
-
-static const struct xlat modem_flags[] = {
-#ifdef TIOCM_LE
-       { TIOCM_LE,     "TIOCM_LE",     },
-#endif
-#ifdef TIOCM_DTR
-       { TIOCM_DTR,    "TIOCM_DTR",    },
-#endif
-#ifdef TIOCM_RTS
-       { TIOCM_RTS,    "TIOCM_RTS",    },
-#endif
-#ifdef TIOCM_ST
-       { TIOCM_ST,     "TIOCM_ST",     },
-#endif
-#ifdef TIOCM_SR
-       { TIOCM_SR,     "TIOCM_SR",     },
-#endif
-#ifdef TIOCM_CTS
-       { TIOCM_CTS,    "TIOCM_CTS",    },
-#endif
-#ifdef TIOCM_CAR
-       { TIOCM_CAR,    "TIOCM_CAR",    },
-#endif
-#ifdef TIOCM_CD
-       { TIOCM_CD,     "TIOCM_CD",     },
-#endif
-#ifdef TIOCM_RNG
-       { TIOCM_RNG,    "TIOCM_RNG",    },
-#endif
-#ifdef TIOCM_RI
-       { TIOCM_RI,     "TIOCM_RI",     },
-#endif
-#ifdef TIOCM_DSR
-       { TIOCM_DSR,    "TIOCM_DSR",    },
-#endif
-       { 0,            NULL,           },
-};
-
+#include "xlat/baud_options.h"
+#include "xlat/modem_flags.h"
 
 int term_ioctl(struct tcb *tcp, long code, long arg)
 {
        struct termios tios;
-#ifndef FREEBSD
        struct termio tio;
-#else
-       #define TCGETS  TIOCGETA
-       #define TCSETS  TIOCSETA
-       #define TCSETSW TIOCSETAW
-       #define TCSETSF TIOCSETAF
-#endif
        struct winsize ws;
 #ifdef TIOCGSIZE
        struct  ttysize ts;
@@ -213,16 +72,7 @@ int term_ioctl(struct tcb *tcp, long code, long arg)
                        return 0;
                if (abbrev(tcp)) {
                        tprints(", {");
-#ifndef FREEBSD
                        printxval(baud_options, tios.c_cflag & CBAUD, "B???");
-#else
-                       printxval(baud_options, tios.c_ispeed, "B???");
-                       if (tios.c_ispeed != tios.c_ospeed) {
-                               tprints(" (in)");
-                               printxval(baud_options, tios.c_ospeed, "B???");
-                               tprints(" (out)");
-                       }
-#endif
                        tprintf(" %sopost %sisig %sicanon %secho ...}",
                                (tios.c_oflag & OPOST) ? "" : "-",
                                (tios.c_lflag & ISIG) ? "" : "-",
@@ -234,9 +84,7 @@ int term_ioctl(struct tcb *tcp, long code, long arg)
                        (long) tios.c_iflag, (long) tios.c_oflag);
                tprintf("c_cflags=%#lx, c_lflags=%#lx, ",
                        (long) tios.c_cflag, (long) tios.c_lflag);
-#if !defined(SVR4) && !defined(FREEBSD)
                tprintf("c_line=%u, ", tios.c_line);
-#endif
                if (!(tios.c_lflag & ICANON))
                        tprintf("c_cc[VMIN]=%d, c_cc[VTIME]=%d, ",
                                tios.c_cc[VMIN], tios.c_cc[VTIME]);