# endif
#endif
-MODULE_ID("$Id: tinfo_driver.c,v 1.8 2010/04/03 14:10:56 tom Exp $")
+MODULE_ID("$Id: tinfo_driver.c,v 1.12 2010/07/31 22:16:38 tom Exp $")
/*
* SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
exit(EXIT_FAILURE);\
}
-#if USE_DATABASE || USE_TERMCAP
-/*
- * Return 1 if entry found, 0 if not found, -1 if database not accessible,
- * just like tgetent().
- */
-static int
-grab_entry(const char *const tn, TERMTYPE *const tp)
-{
- char filename[PATH_MAX];
- int status = _nc_read_entry(tn, filename, tp);
-
- /*
- * If we have an entry, force all of the cancelled strings to null
- * pointers so we don't have to test them in the rest of the library.
- * (The terminfo compiler bypasses this logic, since it must know if
- * a string is cancelled, for merging entries).
- */
- if (status == TGETENT_YES) {
- unsigned n;
- for_each_boolean(n, tp) {
- if (!VALID_BOOLEAN(tp->Booleans[n]))
- tp->Booleans[n] = FALSE;
- }
- for_each_string(n, tp) {
- if (tp->Strings[n] == CANCELLED_STRING)
- tp->Strings[n] = ABSENT_STRING;
- }
- }
- return (status);
-}
-#endif
-
static bool
drv_CanHandle(TERMINAL_CONTROL_BLOCK * TCB, const char *tname, int *errret)
{
TCB->magic = TCBMAGIC;
#if (USE_DATABASE || USE_TERMCAP)
- status = grab_entry(tname, &termp->type);
+ status = _nc_setup_tinfo(tname, &termp->type);
#else
status = TGETENT_NO;
#endif
}
}
+static int
+drv_testmouse(TERMINAL_CONTROL_BLOCK * TCB, int delay)
+{
+ int rc = 0;
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+#if USE_SYSMOUSE
+ if ((sp->_mouse_type == M_SYSMOUSE)
+ && (sp->_sysmouse_head < sp->_sysmouse_tail)) {
+ rc = TW_MOUSE;
+ } else
+#endif
+ {
+ rc = TCBOf(sp)->drv->twait(TCBOf(sp),
+ TWAIT_MASK,
+ delay,
+ (int *) 0
+ EVENTLIST_2nd(evl));
+#if USE_SYSMOUSE
+ if ((sp->_mouse_type == M_SYSMOUSE)
+ && (sp->_sysmouse_head < sp->_sysmouse_tail)
+ && (rc == 0)
+ && (errno == EINTR)) {
+ rc |= TW_MOUSE;
+ }
+#endif
+ }
+ return rc;
+}
+
static int
drv_mvcur(TERMINAL_CONTROL_BLOCK * TCB, int yold, int xold, int ynew, int xnew)
{
assert(buf);
SetSP();
+# if USE_PTHREADS_EINTR
+ if ((pthread_self) && (pthread_kill) && (pthread_equal))
+ _nc_globals.read_thread = pthread_self();
+# endif
n = read(sp->_ifd, &c2, 1);
+#if USE_PTHREADS_EINTR
+ _nc_globals.read_thread = 0;
+#endif
*buf = (int) c2;
return n;
}
drv_initcolor, /* initcolor */
drv_do_color, /* docolor */
drv_initmouse, /* initmouse */
+ drv_testmouse, /* testmouse */
drv_setfilter, /* setfilter */
drv_hwlabel, /* hwlabel */
drv_hwlabelOnOff, /* hwlabelOnOff */