/****************************************************************************
- * Copyright (c) 2008-2015,2016 Free Software Foundation, Inc. *
+ * Copyright (c) 2008-2016,2017 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 *
#include <curses.priv.h>
#define CUR ((TERMINAL*)TCB)->type.
#include <tic.h>
+#include <termcap.h> /* ospeed */
#if HAVE_NANOSLEEP
#include <time.h>
# endif
#endif
-MODULE_ID("$Id: tinfo_driver.c,v 1.41 2016/09/10 20:14:56 tom Exp $")
+MODULE_ID("$Id: tinfo_driver.c,v 1.44 2017/01/07 16:34:52 tom Exp $")
/*
* SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
return "tinfo";
}
+static void
+get_baudrate(TERMINAL * termp)
+{
+ int my_ospeed;
+ int result;
+ if (GET_TTY(termp->Filedes, &termp->Nttyb) == OK) {
+#ifdef TERMIOS
+ termp->Nttyb.c_oflag &= (unsigned) (~OFLAGS_TABS);
+#else
+ termp->Nttyb.sg_flags &= (unsigned) (~XTABS);
+#endif
+ }
+#ifdef USE_OLD_TTY
+ result = (int) cfgetospeed(&(termp->Nttyb));
+ my_ospeed = (NCURSES_OSPEED) _nc_ospeed(result);
+#else /* !USE_OLD_TTY */
+#ifdef TERMIOS
+ my_ospeed = (NCURSES_OSPEED) cfgetospeed(&(termp->Nttyb));
+#else
+ my_ospeed = (NCURSES_OSPEED) termp->Nttyb.sg_ospeed;
+#endif
+ result = _nc_baudrate(my_ospeed);
+#endif
+ termp->_baudrate = result;
+ ospeed = (NCURSES_OSPEED) my_ospeed;
+}
+
#undef SETUP_FAIL
#define SETUP_FAIL FALSE
if (command_character)
_nc_tinfo_cmdch(termp, *command_character);
+ /*
+ * If an application calls setupterm() rather than initscr() or
+ * newterm(), we will not have the def_prog_mode() call in
+ * _nc_setupscreen(). Do it now anyway, so we can initialize the
+ * baudrate.
+ */
+ if (sp == 0 && NC_ISATTY(termp->Filedes)) {
+ get_baudrate(termp);
+ }
+
if (generic_type) {
/*
* BSD 4.3's termcap contains mis-typed "gn" for wy99. Do a sanity
if (sp) {
useEnv = sp->_use_env;
- useTioctl = sp->_use_tioctl;
+ useTioctl = sp->use_tioctl;
} else {
useEnv = _nc_prescreen.use_env;
useTioctl = _nc_prescreen.use_tioctl;