diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-12-28 15:58:00 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-12-28 15:58:00 +0000 |
commit | 29b9ba0641956d02f20ecf79f3c5012baf5bd8e8 (patch) | |
tree | c060b138de336bc24abca99acb5a4d7c2753dd31 | |
parent | 031c7ae2dc97a1f984a63e6e5c37a962a15b01e2 (diff) |
Update to ncurses-19991218
o reorder tests during mouse initialization to allow for gpm to run in
xterm, or for xterm to be used under OS/2 EMX. Also drop test for
$DISPLAY in favor of kmous=\E[M or $TERM containing "xterm" (report
by Christian Weisgerber <naddy@mips.rhein-neckar.de>).
o modify raw() and noraw() to clear/restore IEXTEN flag which affects
stty lnext on systems such as FreeBSD (report by Bruce Evans
<bde@zeta.org.au>, via Jason Evans <jasone@canonware.com>).
o add manual-page for ncurses extensions, documented curses_version(),
use_extended_names().
-rw-r--r-- | lib/libcurses/Makefile | 18 | ||||
-rw-r--r-- | lib/libcurses/base/lib_mouse.c | 481 | ||||
-rw-r--r-- | lib/libcurses/curses.3tbl | 18 | ||||
-rw-r--r-- | lib/libcurses/tinfo/lib_raw.c | 201 |
4 files changed, 365 insertions, 353 deletions
diff --git a/lib/libcurses/Makefile b/lib/libcurses/Makefile index 2387c159530..178b1a189a3 100644 --- a/lib/libcurses/Makefile +++ b/lib/libcurses/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.42 1999/11/28 17:53:40 millert Exp $ +# $OpenBSD: Makefile,v 1.43 1999/12/28 15:57:59 millert Exp $ # Uncomment this to enable tracing in libcurses #CURSESTRACE=-DTRACE @@ -53,14 +53,14 @@ SRCS+= hardscroll.c hashmap.c lib_mvcur.c lib_tstp.c lib_twait.c \ CFLAGS+= -I. -I${.CURDIR} ${CURSESTRACE} MAN= curs_addch.3 curs_addchstr.3 curs_addstr.3 curs_attr.3 curs_beep.3 \ curs_bkgd.3 curs_border.3 curs_clear.3 curs_color.3 curs_delch.3 \ - curs_deleteln.3 curs_getch.3 curs_getstr.3 curs_getyx.3 curs_inch.3 \ - curs_inchstr.3 curs_initscr.3 curs_inopts.3 curs_insch.3 curs_insstr.3 \ - curs_instr.3 curs_kernel.3 curs_mouse.3 curs_move.3 curs_outopts.3 \ - curs_overlay.3 curs_pad.3 curs_print.3 curs_printw.3 curs_refresh.3 \ - curs_scanw.3 curs_scr_dump.3 curs_scroll.3 curs_slk.3 curs_termattrs.3 \ - curs_touch.3 curs_util.3 curs_window.3 curses.3 define_key.3 \ - dft_fgbg.3 keybound.3 keyok.3 resizeterm.3 wresize.3 termcap.3 \ - terminfo.3 terminfo.5 term.5 term.7 + curs_deleteln.3 curs_extend.3 curs_getch.3 curs_getstr.3 curs_getyx.3 \ + curs_inch.3 curs_inchstr.3 curs_initscr.3 curs_inopts.3 curs_insch.3 \ + curs_insstr.3 curs_instr.3 curs_kernel.3 curs_mouse.3 curs_move.3 \ + curs_outopts.3 curs_overlay.3 curs_pad.3 curs_print.3 curs_printw.3 \ + curs_refresh.3 curs_scanw.3 curs_scr_dump.3 curs_scroll.3 curs_slk.3 \ + curs_termattrs.3 curs_touch.3 curs_util.3 curs_window.3 curses.3 \ + define_key.3 dft_fgbg.3 keybound.3 keyok.3 resizeterm.3 wresize.3 \ + termcap.3 terminfo.3 terminfo.5 term.5 term.7 MLINKS+=curses.3 ncurses.3 MLINKS+=curs_addch.3 addch.3 curs_addch.3 waddch.3 curs_addch.3 mvaddch.3 \ curs_addch.3 mvwaddch.3 curs_addch.3 echochar.3 curs_addch.3 \ diff --git a/lib/libcurses/base/lib_mouse.c b/lib/libcurses/base/lib_mouse.c index b0263f20cdb..e3ef84222d5 100644 --- a/lib/libcurses/base/lib_mouse.c +++ b/lib/libcurses/base/lib_mouse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_mouse.c,v 1.5 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: lib_mouse.c,v 1.6 1999/12/28 15:57:59 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999 Free Software Foundation, Inc. * @@ -87,13 +87,13 @@ #endif #endif -MODULE_ID("$From: lib_mouse.c,v 1.45 1999/10/22 21:39:02 tom Exp $") +MODULE_ID("$From: lib_mouse.c,v 1.47 1999/12/19 01:49:40 tom Exp $") #define MY_TRACE TRACE_ICALLS|TRACE_IEVENT #define INVALID_EVENT -1 -static int mousetype; +static int mousetype; #define M_XTERM -1 /* use xterm's mouse tracking? */ #define M_NONE 0 /* no mouse device */ #define M_GPM 1 /* use GPM */ @@ -106,7 +106,7 @@ static Gpm_Connect gpm_connect; #endif #endif -static mmask_t eventmask; /* current event mask */ +static mmask_t eventmask; /* current event mask */ static bool _nc_mouse_parse(int); static void _nc_mouse_resume(SCREEN *); @@ -118,22 +118,23 @@ static void _nc_mouse_wrap(SCREEN *); * wgetch() may refer to the size and call _nc_mouse_parse() before circular * list overflow. */ -static MEVENT events[EV_MAX]; /* hold the last mouse event seen */ -static MEVENT *eventp = events; /* next free slot in event queue */ +static MEVENT events[EV_MAX]; /* hold the last mouse event seen */ +static MEVENT *eventp = events; /* next free slot in event queue */ #define NEXT(ep) ((ep == events + EV_MAX - 1) ? events : ep + 1) #define PREV(ep) ((ep == events) ? events + EV_MAX - 1 : ep - 1) #ifdef TRACE -static void _trace_slot(const char *tag) +static void +_trace_slot(const char *tag) { - MEVENT *ep; + MEVENT *ep; - _tracef(tag); + _tracef(tag); - for (ep = events; ep < events + EV_MAX; ep++) - _tracef("mouse event queue slot %ld = %s", - (long) (ep - events), - _tracemouse(ep)); + for (ep = events; ep < events + EV_MAX; ep++) + _tracef("mouse event queue slot %ld = %s", + (long) (ep - events), + _tracemouse(ep)); } #endif @@ -145,8 +146,8 @@ static void _trace_slot(const char *tag) static int mouse_wfd; static int mouse_thread; static int mouse_activated; -static char mouse_buttons[] = { 0, 1, 3, 2}; - +static char mouse_buttons[] = +{0, 1, 3, 2}; # define M_FD(sp) sp->_mouse_fd @@ -176,34 +177,34 @@ mouse_server(unsigned long ignored GCC_UNUSED) unsigned long ignore; /* open the handle for the mouse */ - if (MouOpen(NULL,&hmou) == 0) { + if (MouOpen(NULL, &hmou) == 0) { - if (MouSetEventMask(&mask,hmou) == 0 - && MouDrawPtr(hmou) == 0) { + if (MouSetEventMask(&mask, hmou) == 0 + && MouDrawPtr(hmou) == 0) { for (;;) { /* sit and wait on the event queue */ - if (MouReadEventQue(&mouev,&fWait,hmou)) - break; + if (MouReadEventQue(&mouev, &fWait, hmou)) + break; if (!mouse_activated) goto finish; /* * OS/2 numbers a 3-button mouse inconsistently from other * platforms: - * 1 = left - * 2 = right - * 3 = middle. + * 1 = left + * 2 = right + * 3 = middle. */ if ((mouev.fs ^ oldstate) & MOUSE_BN1_DOWN) - write_event(mouev.fs & MOUSE_BN1_DOWN, - mouse_buttons[1], mouev.col, mouev.row); + write_event(mouev.fs & MOUSE_BN1_DOWN, + mouse_buttons[1], mouev.col, mouev.row); if ((mouev.fs ^ oldstate) & MOUSE_BN2_DOWN) - write_event(mouev.fs & MOUSE_BN2_DOWN, - mouse_buttons[3], mouev.col, mouev.row); + write_event(mouev.fs & MOUSE_BN2_DOWN, + mouse_buttons[3], mouev.col, mouev.row); if ((mouev.fs ^ oldstate) & MOUSE_BN3_DOWN) - write_event(mouev.fs & MOUSE_BN3_DOWN, - mouse_buttons[2], mouev.col, mouev.row); + write_event(mouev.fs & MOUSE_BN3_DOWN, + mouse_buttons[2], mouev.col, mouev.row); finish: oldstate = mouev.fs; @@ -213,11 +214,11 @@ mouse_server(unsigned long ignored GCC_UNUSED) DosWrite(2, errmess, strlen(errmess), &ignore); MouClose(hmou); } - DosExit(EXIT_THREAD, 0L ); + DosExit(EXIT_THREAD, 0L); } static void server_state(const int state) -{ /* It would be nice to implement pointer-off and stop looping... */ +{ /* It would be nice to implement pointer-off and stop looping... */ mouse_activated = state; } @@ -225,44 +226,30 @@ server_state(const int state) static int initialized; -static void _nc_mouse_init(void) -/* initialize the mouse */ +static void +initialize_mousetype(void) { - int i; - - if (initialized) { - return; - } - initialized = TRUE; - - TR(MY_TRACE, ("_nc_mouse_init() called")); - - for (i = 0; i < EV_MAX; i++) - events[i].id = INVALID_EVENT; - - /* we know how to recognize mouse events under xterm */ - if (key_mouse != 0 - && getenv("DISPLAY") != 0) - mousetype = M_XTERM; + static char *xterm_kmous = "\033[M"; + /* Try gpm first, because gpm may be configured to run in xterm */ #if USE_GPM_SUPPORT - else if (!strncmp(cur_term->type.term_names, "linux", 5)) - { - /* GPM: initialize connection to gpm server */ - gpm_connect.eventMask = GPM_DOWN|GPM_UP; - gpm_connect.defaultMask = ~(gpm_connect.eventMask|GPM_HARD); - gpm_connect.minMod = 0; - gpm_connect.maxMod = ~((1<<KG_SHIFT)|(1<<KG_SHIFTL)|(1<<KG_SHIFTR)); - if (Gpm_Open (&gpm_connect, 0) >= 0) { /* returns the file-descriptor */ - mousetype = M_GPM; - SP->_mouse_fd = gpm_fd; - } + /* GPM: initialize connection to gpm server */ + gpm_connect.eventMask = GPM_DOWN | GPM_UP; + gpm_connect.defaultMask = ~(gpm_connect.eventMask | GPM_HARD); + gpm_connect.minMod = 0; + gpm_connect.maxMod = ~((1 << KG_SHIFT) | (1 << KG_SHIFTL) | (1 << KG_SHIFTR)); + if (Gpm_Open(&gpm_connect, 0) >= 0) { /* returns the file-descriptor */ + mousetype = M_GPM; + SP->_mouse_fd = gpm_fd; + return; } #endif /* OS/2 VIO */ #ifdef USE_EMX_MOUSE - if (!mouse_thread && mousetype != M_XTERM && key_mouse) { + if (!mouse_thread + && strstr(cur_term->type.term_names, "xterm") == 0 + && key_mouse) { int handles[2]; if (pipe(handles) < 0) { perror("mouse pipe error"); @@ -285,19 +272,53 @@ static void _nc_mouse_init(void) setmode(handles[0], O_BINARY); setmode(handles[1], O_BINARY); /* Do not use CRT functions, we may single-threaded. */ - rc = DosCreateThread((unsigned long*)&mouse_thread, mouse_server, 0, 0, 8192); - if (rc) + rc = DosCreateThread((unsigned long *) &mouse_thread, + mouse_server, 0, 0, 8192); + if (rc) { printf("mouse thread error %d=%#x", rc, rc); - else + } else { mousetype = M_XTERM; + return; + } } } #endif - T(("_nc_mouse_init() set mousetype to %d", mousetype)); + /* we know how to recognize mouse events under "xterm" */ + if (key_mouse != 0) { + if (!strcmp(key_mouse, xterm_kmous)) { + mousetype = M_XTERM; + return; + } + } else if (strstr(cur_term->type.term_names, "xterm") != 0) { + (void) _nc_add_to_try(&(SP->_keytry), xterm_kmous, KEY_MOUSE); + mousetype = M_XTERM; + return; + } +} + +static void +_nc_mouse_init(void) +/* initialize the mouse */ +{ + int i; + + if (!initialized) { + initialized = TRUE; + + TR(MY_TRACE, ("_nc_mouse_init() called")); + + for (i = 0; i < EV_MAX; i++) + events[i].id = INVALID_EVENT; + + initialize_mousetype(); + + T(("_nc_mouse_init() set mousetype to %d", mousetype)); + } } -static bool _nc_mouse_event(SCREEN *sp GCC_UNUSED) +static bool +_nc_mouse_event(SCREEN * sp GCC_UNUSED) /* query to see if there is a pending mouse event */ { #if USE_GPM_SUPPORT @@ -305,23 +326,27 @@ static bool _nc_mouse_event(SCREEN *sp GCC_UNUSED) Gpm_Event ev; if (gpm_fd >= 0 - && _nc_timed_wait(2, 0, (int *)0) - && Gpm_GetEvent(&ev) == 1) - { + && _nc_timed_wait(2, 0, (int *) 0) + && Gpm_GetEvent(&ev) == 1) { eventp->id = 0; /* there's only one mouse... */ eventp->bstate = 0; - switch (ev.type & 0x0f) - { - case(GPM_DOWN): - if (ev.buttons & GPM_B_LEFT) eventp->bstate |= BUTTON1_PRESSED; - if (ev.buttons & GPM_B_MIDDLE) eventp->bstate |= BUTTON2_PRESSED; - if (ev.buttons & GPM_B_RIGHT) eventp->bstate |= BUTTON3_PRESSED; + switch (ev.type & 0x0f) { + case (GPM_DOWN): + if (ev.buttons & GPM_B_LEFT) + eventp->bstate |= BUTTON1_PRESSED; + if (ev.buttons & GPM_B_MIDDLE) + eventp->bstate |= BUTTON2_PRESSED; + if (ev.buttons & GPM_B_RIGHT) + eventp->bstate |= BUTTON3_PRESSED; break; - case(GPM_UP): - if (ev.buttons & GPM_B_LEFT) eventp->bstate |= BUTTON1_RELEASED; - if (ev.buttons & GPM_B_MIDDLE) eventp->bstate |= BUTTON2_RELEASED; - if (ev.buttons & GPM_B_RIGHT) eventp->bstate |= BUTTON3_RELEASED; + case (GPM_UP): + if (ev.buttons & GPM_B_LEFT) + eventp->bstate |= BUTTON1_RELEASED; + if (ev.buttons & GPM_B_MIDDLE) + eventp->bstate |= BUTTON2_RELEASED; + if (ev.buttons & GPM_B_RIGHT) + eventp->bstate |= BUTTON3_RELEASED; break; default: break; @@ -338,20 +363,20 @@ static bool _nc_mouse_event(SCREEN *sp GCC_UNUSED) #endif /* xterm: never have to query, mouse events are in the keyboard stream */ - return(FALSE); /* no event waiting */ + return (FALSE); /* no event waiting */ } -static bool _nc_mouse_inline(SCREEN *sp) +static bool +_nc_mouse_inline(SCREEN * sp) /* mouse report received in the keyboard stream -- parse its info */ { TR(MY_TRACE, ("_nc_mouse_inline() called")); - if (mousetype == M_XTERM) - { - unsigned char kbuf[4]; - MEVENT *prev; - size_t grabbed; - int res; + if (mousetype == M_XTERM) { + unsigned char kbuf[4]; + MEVENT *prev; + size_t grabbed; + int res; /* This code requires that your xterm entry contain the kmous * capability and that it be set to the \E[M documented in the @@ -383,28 +408,27 @@ static bool _nc_mouse_inline(SCREEN *sp) * single clist item. It always does under Linux but often * fails to under Solaris. */ - for (grabbed = 0; grabbed < 3; grabbed += res) - { + for (grabbed = 0; grabbed < 3; grabbed += res) { - /* For VIO mouse we add extra bit 64 to disambiguate button-up. */ + /* For VIO mouse we add extra bit 64 to disambiguate button-up. */ #ifdef USE_EMX_MOUSE - res = read( M_FD(sp) >= 0 ? M_FD(sp) : sp->_ifd, &kbuf, 3); + res = read(M_FD(sp) >= 0 ? M_FD(sp) : sp->_ifd, &kbuf, 3); #else - res = read(sp->_ifd, kbuf + grabbed, 3-grabbed); + res = read(sp->_ifd, kbuf + grabbed, 3 - grabbed); #endif - if (res == -1) - break; + if (res == -1) + break; } kbuf[3] = '\0'; - TR(TRACE_IEVENT, ("_nc_mouse_inline sees the following xterm data: '%s'", kbuf)); + TR(TRACE_IEVENT, + ("_nc_mouse_inline sees the following xterm data: '%s'", kbuf)); eventp->id = 0; /* there's only one mouse... */ /* processing code goes here */ eventp->bstate = 0; - switch (kbuf[0] & 0x3) - { + switch (kbuf[0] & 0x3) { case 0x0: eventp->bstate = BUTTON1_PRESSED; #ifdef USE_EMX_MOUSE @@ -436,8 +460,8 @@ static bool _nc_mouse_inline(SCREEN *sp) */ eventp->bstate = (BUTTON1_RELEASED | - BUTTON2_RELEASED | - BUTTON3_RELEASED); + BUTTON2_RELEASED | + BUTTON3_RELEASED); /* * ...however, because there are no kinds of mouse events under * xterm that can intervene between press and release, we can @@ -446,11 +470,11 @@ static bool _nc_mouse_inline(SCREEN *sp) */ prev = PREV(eventp); if (!(prev->bstate & BUTTON1_PRESSED)) - eventp->bstate &=~ BUTTON1_RELEASED; + eventp->bstate &= ~BUTTON1_RELEASED; if (!(prev->bstate & BUTTON2_PRESSED)) - eventp->bstate &=~ BUTTON2_RELEASED; + eventp->bstate &= ~BUTTON2_RELEASED; if (!(prev->bstate & BUTTON3_PRESSED)) - eventp->bstate &=~ BUTTON3_RELEASED; + eventp->bstate &= ~BUTTON3_RELEASED; break; } @@ -466,21 +490,23 @@ static bool _nc_mouse_inline(SCREEN *sp) eventp->x = (kbuf[1] - ' ') - 1; eventp->y = (kbuf[2] - ' ') - 1; - TR(MY_TRACE, ("_nc_mouse_inline: primitive mouse-event %s has slot %ld", + TR(MY_TRACE, + ("_nc_mouse_inline: primitive mouse-event %s has slot %ld", _tracemouse(eventp), (long) (eventp - events))); /* bump the next-free pointer into the circular list */ eventp = NEXT(eventp); -#if 0 /* this return would be needed for QNX's mods to lib_getch.c */ - return(TRUE); +#if 0 /* this return would be needed for QNX's mods to lib_getch.c */ + return (TRUE); #endif } - return(FALSE); + return (FALSE); } -static void mouse_activate(bool on) +static void +mouse_activate(bool on) { if (!on && !initialized) return; @@ -510,11 +536,11 @@ static void mouse_activate(bool on) /* Make runtime binding to cut down on object size of applications that * do not use the mouse (e.g., 'clear'). */ - SP->_mouse_event = _nc_mouse_event; + SP->_mouse_event = _nc_mouse_event; SP->_mouse_inline = _nc_mouse_inline; - SP->_mouse_parse = _nc_mouse_parse; + SP->_mouse_parse = _nc_mouse_parse; SP->_mouse_resume = _nc_mouse_resume; - SP->_mouse_wrap = _nc_mouse_wrap; + SP->_mouse_wrap = _nc_mouse_wrap; } else { @@ -542,12 +568,13 @@ static void mouse_activate(bool on) * **************************************************************************/ -static bool _nc_mouse_parse(int runcount) +static bool +_nc_mouse_parse(int runcount) /* parse a run of atomic mouse events into a gesture */ { - MEVENT *ep, *runp, *next, *prev = PREV(eventp); - int n; - bool merge; + MEVENT *ep, *runp, *next, *prev = PREV(eventp); + int n; + bool merge; TR(MY_TRACE, ("_nc_mouse_parse(%d) called", runcount)); @@ -572,14 +599,14 @@ static bool _nc_mouse_parse(int runcount) * button basis, as long as the device-dependent mouse code puts stuff * on the queue in MEVENT format. */ - if (runcount == 1) - { - TR(MY_TRACE, ("_nc_mouse_parse: returning simple mouse event %s at slot %ld", - _tracemouse(prev), - (long) (prev - events))); + if (runcount == 1) { + TR(MY_TRACE, + ("_nc_mouse_parse: returning simple mouse event %s at slot %ld", + _tracemouse(prev), + (long) (prev - events))); return (prev->id >= 0) - ? ((prev->bstate & eventmask) ? TRUE : FALSE) - : FALSE; + ? ((prev->bstate & eventmask) ? TRUE : FALSE) + : FALSE; } /* find the start of the run */ @@ -589,12 +616,11 @@ static bool _nc_mouse_parse(int runcount) } #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) - { + if (_nc_tracing & TRACE_IEVENT) { _trace_slot("before mouse press/release merge:"); _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", (long) (runp - events), - (long) ((eventp - events) + (EV_MAX-1)) % EV_MAX, + (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX, runcount); } #endif /* TRACE */ @@ -602,36 +628,31 @@ static bool _nc_mouse_parse(int runcount) /* first pass; merge press/release pairs */ do { merge = FALSE; - for (ep = runp; next = NEXT(ep), next != eventp; ep = next) - { + for (ep = runp; next = NEXT(ep), next != eventp; ep = next) { if (ep->x == next->x && ep->y == next->y - && (ep->bstate & (BUTTON1_PRESSED|BUTTON2_PRESSED|BUTTON3_PRESSED)) + && (ep->bstate & (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED)) && (!(ep->bstate & BUTTON1_PRESSED) == !(next->bstate & BUTTON1_RELEASED)) && (!(ep->bstate & BUTTON2_PRESSED) == !(next->bstate & BUTTON2_RELEASED)) && (!(ep->bstate & BUTTON3_PRESSED) == !(next->bstate & BUTTON3_RELEASED)) - ) - { + ) { if ((eventmask & BUTTON1_CLICKED) - && (ep->bstate & BUTTON1_PRESSED)) - { - ep->bstate &=~ BUTTON1_PRESSED; + && (ep->bstate & BUTTON1_PRESSED)) { + ep->bstate &= ~BUTTON1_PRESSED; ep->bstate |= BUTTON1_CLICKED; merge = TRUE; } if ((eventmask & BUTTON2_CLICKED) - && (ep->bstate & BUTTON2_PRESSED)) - { - ep->bstate &=~ BUTTON2_PRESSED; + && (ep->bstate & BUTTON2_PRESSED)) { + ep->bstate &= ~BUTTON2_PRESSED; ep->bstate |= BUTTON2_CLICKED; merge = TRUE; } if ((eventmask & BUTTON3_CLICKED) - && (ep->bstate & BUTTON3_PRESSED)) - { - ep->bstate &=~ BUTTON3_PRESSED; + && (ep->bstate & BUTTON3_PRESSED)) { + ep->bstate &= ~BUTTON3_PRESSED; ep->bstate |= BUTTON3_CLICKED; merge = TRUE; } @@ -643,12 +664,11 @@ static bool _nc_mouse_parse(int runcount) (merge); #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) - { + if (_nc_tracing & TRACE_IEVENT) { _trace_slot("before mouse click merge:"); _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", (long) (runp - events), - (long) ((eventp - events) + (EV_MAX-1)) % EV_MAX, + (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX, runcount); } #endif /* TRACE */ @@ -670,12 +690,11 @@ static bool _nc_mouse_parse(int runcount) * which would get us into portability trouble. */ do { - MEVENT *follower; + MEVENT *follower; merge = FALSE; for (ep = runp; next = NEXT(ep), next != eventp; ep = next) - if (ep->id != INVALID_EVENT) - { + if (ep->id != INVALID_EVENT) { if (next->id != INVALID_EVENT) continue; follower = NEXT(next); @@ -686,26 +705,22 @@ static bool _nc_mouse_parse(int runcount) if ((ep->bstate & (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED)) && (follower->bstate & - (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))) - { + (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))) { if ((eventmask & BUTTON1_DOUBLE_CLICKED) - && (follower->bstate & BUTTON1_CLICKED)) - { - follower->bstate &=~ BUTTON1_CLICKED; + && (follower->bstate & BUTTON1_CLICKED)) { + follower->bstate &= ~BUTTON1_CLICKED; follower->bstate |= BUTTON1_DOUBLE_CLICKED; merge = TRUE; } if ((eventmask & BUTTON2_DOUBLE_CLICKED) - && (follower->bstate & BUTTON2_CLICKED)) - { - follower->bstate &=~ BUTTON2_CLICKED; + && (follower->bstate & BUTTON2_CLICKED)) { + follower->bstate &= ~BUTTON2_CLICKED; follower->bstate |= BUTTON2_DOUBLE_CLICKED; merge = TRUE; } if ((eventmask & BUTTON3_DOUBLE_CLICKED) - && (follower->bstate & BUTTON3_CLICKED)) - { - follower->bstate &=~ BUTTON3_CLICKED; + && (follower->bstate & BUTTON3_CLICKED)) { + follower->bstate &= ~BUTTON3_CLICKED; follower->bstate |= BUTTON3_DOUBLE_CLICKED; merge = TRUE; } @@ -716,29 +731,25 @@ static bool _nc_mouse_parse(int runcount) /* merge double-click events forward */ if ((ep->bstate & (BUTTON1_DOUBLE_CLICKED - | BUTTON2_DOUBLE_CLICKED - | BUTTON3_DOUBLE_CLICKED)) + | BUTTON2_DOUBLE_CLICKED + | BUTTON3_DOUBLE_CLICKED)) && (follower->bstate & - (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))) - { + (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))) { if ((eventmask & BUTTON1_TRIPLE_CLICKED) - && (follower->bstate & BUTTON1_CLICKED)) - { - follower->bstate &=~ BUTTON1_CLICKED; + && (follower->bstate & BUTTON1_CLICKED)) { + follower->bstate &= ~BUTTON1_CLICKED; follower->bstate |= BUTTON1_TRIPLE_CLICKED; merge = TRUE; } if ((eventmask & BUTTON2_TRIPLE_CLICKED) - && (follower->bstate & BUTTON2_CLICKED)) - { - follower->bstate &=~ BUTTON2_CLICKED; + && (follower->bstate & BUTTON2_CLICKED)) { + follower->bstate &= ~BUTTON2_CLICKED; follower->bstate |= BUTTON2_TRIPLE_CLICKED; merge = TRUE; } if ((eventmask & BUTTON3_TRIPLE_CLICKED) - && (follower->bstate & BUTTON3_CLICKED)) - { - follower->bstate &=~ BUTTON3_CLICKED; + && (follower->bstate & BUTTON3_CLICKED)) { + follower->bstate &= ~BUTTON3_CLICKED; follower->bstate |= BUTTON3_TRIPLE_CLICKED; merge = TRUE; } @@ -750,12 +761,11 @@ static bool _nc_mouse_parse(int runcount) (merge); #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) - { + if (_nc_tracing & TRACE_IEVENT) { _trace_slot("before mouse event queue compaction:"); _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", (long) (runp - events), - (long) ((eventp - events) + (EV_MAX-1)) % EV_MAX, + (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX, runcount); } #endif /* TRACE */ @@ -768,28 +778,28 @@ static bool _nc_mouse_parse(int runcount) if (prev->id == INVALID_EVENT || !(prev->bstate & eventmask)) { eventp = prev; } - #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) - { + if (_nc_tracing & TRACE_IEVENT) { _trace_slot("after mouse event queue compaction:"); _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", (long) (runp - events), - (long) ((eventp - events) + (EV_MAX-1)) % EV_MAX, + (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX, runcount); } for (ep = runp; ep != eventp; ep = NEXT(ep)) if (ep->id != INVALID_EVENT) - TR(MY_TRACE, ("_nc_mouse_parse: returning composite mouse event %s at slot %ld", - _tracemouse(ep), - (long) (ep - events))); + TR(MY_TRACE, + ("_nc_mouse_parse: returning composite mouse event %s at slot %ld", + _tracemouse(ep), + (long) (ep - events))); #endif /* TRACE */ /* after all this, do we have a valid event? */ - return(PREV(eventp)->id != INVALID_EVENT); + return (PREV(eventp)->id != INVALID_EVENT); } -static void _nc_mouse_wrap(SCREEN *sp GCC_UNUSED) +static void +_nc_mouse_wrap(SCREEN * sp GCC_UNUSED) /* release mouse -- called by endwin() before shellout/exit */ { TR(MY_TRACE, ("_nc_mouse_wrap() called")); @@ -801,13 +811,14 @@ static void _nc_mouse_wrap(SCREEN *sp GCC_UNUSED) break; #if USE_GPM_SUPPORT /* GPM: pass all mouse events to next client */ - case M_GPM: - break; + case M_GPM: + break; #endif } } -static void _nc_mouse_resume(SCREEN *sp GCC_UNUSED) +static void +_nc_mouse_resume(SCREEN * sp GCC_UNUSED) /* re-connect to mouse -- called by doupdate() after shellout */ { TR(MY_TRACE, ("_nc_mouse_resume() called")); @@ -825,22 +836,22 @@ static void _nc_mouse_resume(SCREEN *sp GCC_UNUSED) * **************************************************************************/ -int getmouse(MEVENT *aevent) +int +getmouse(MEVENT * aevent) /* grab a copy of the current mouse event */ { T((T_CALLED("getmouse(%p)"), aevent)); - if (aevent && (mousetype != M_NONE)) - { + if (aevent && (mousetype != M_NONE)) { /* compute the current-event pointer */ - MEVENT *prev = PREV(eventp); + MEVENT *prev = PREV(eventp); /* copy the event we find there */ *aevent = *prev; TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %ld", - _tracemouse(prev), - (long) (prev - events))); + _tracemouse(prev), + (long) (prev - events))); prev->id = INVALID_EVENT; /* so the queue slot becomes free */ returnCode(OK); @@ -848,7 +859,8 @@ int getmouse(MEVENT *aevent) returnCode(ERR); } -int ungetmouse(MEVENT *aevent) +int +ungetmouse(MEVENT * aevent) /* enqueue a synthesized mouse event to be seen by the next wgetch() */ { /* stick the given event in the next-free slot */ @@ -861,7 +873,8 @@ int ungetmouse(MEVENT *aevent) return ungetch(KEY_MOUSE); } -mmask_t mousemask(mmask_t newmask, mmask_t *oldmask) +mmask_t +mousemask(mmask_t newmask, mmask_t * oldmask) /* set the mouse event mask */ { mmask_t result = 0; @@ -875,16 +888,15 @@ mmask_t mousemask(mmask_t newmask, mmask_t *oldmask) returnCode(0); _nc_mouse_init(); - if ( mousetype != M_NONE ) - { + if (mousetype != M_NONE) { eventmask = newmask & (BUTTON_ALT | BUTTON_CTRL | BUTTON_SHIFT - | BUTTON1_PRESSED | BUTTON1_RELEASED | BUTTON1_CLICKED - | BUTTON1_DOUBLE_CLICKED | BUTTON1_TRIPLE_CLICKED - | BUTTON2_PRESSED | BUTTON2_RELEASED | BUTTON2_CLICKED - | BUTTON2_DOUBLE_CLICKED | BUTTON2_TRIPLE_CLICKED - | BUTTON3_PRESSED | BUTTON3_RELEASED | BUTTON3_CLICKED - | BUTTON3_DOUBLE_CLICKED | BUTTON3_TRIPLE_CLICKED); + | BUTTON1_PRESSED | BUTTON1_RELEASED | BUTTON1_CLICKED + | BUTTON1_DOUBLE_CLICKED | BUTTON1_TRIPLE_CLICKED + | BUTTON2_PRESSED | BUTTON2_RELEASED | BUTTON2_CLICKED + | BUTTON2_DOUBLE_CLICKED | BUTTON2_TRIPLE_CLICKED + | BUTTON3_PRESSED | BUTTON3_RELEASED | BUTTON3_CLICKED + | BUTTON3_DOUBLE_CLICKED | BUTTON3_TRIPLE_CLICKED); mouse_activate(eventmask != 0); @@ -894,21 +906,22 @@ mmask_t mousemask(mmask_t newmask, mmask_t *oldmask) returnCode(result); } -bool wenclose(const WINDOW *win, int y, int x) +bool +wenclose(const WINDOW *win, int y, int x) /* check to see if given window encloses given screen location */ { - if (win) - { + if (win) { y -= win->_yoffset; return ((win->_begy <= y && - win->_begx <= x && - (win->_begx + win->_maxx) >= x && - (win->_begy + win->_maxy) >= y) ? TRUE : FALSE); + win->_begx <= x && + (win->_begx + win->_maxx) >= x && + (win->_begy + win->_maxy) >= y) ? TRUE : FALSE); } return FALSE; } -int mouseinterval(int maxclick) +int +mouseinterval(int maxclick) /* set the maximum mouse interval within which to recognize a click */ { int oldval; @@ -921,46 +934,44 @@ int mouseinterval(int maxclick) oldval = DEFAULT_MAXCLICK; } - return(oldval); + return (oldval); } /* This may be used by other routines to ask for the existence of mouse support */ -int _nc_has_mouse(void) { - return (mousetype==M_NONE ? 0:1); +int +_nc_has_mouse(void) +{ + return (mousetype == M_NONE ? 0 : 1); } -bool wmouse_trafo(const WINDOW* win, int* pY, int* pX, bool to_screen) +bool +wmouse_trafo(const WINDOW *win, int *pY, int *pX, bool to_screen) { - bool result = FALSE; - - if (win && pY && pX) - { - int y = *pY; int x = *pX; - - if (to_screen) - { - y += win->_begy + win->_yoffset; - x += win->_begx; - if (wenclose(win,y,x)) - result = TRUE; - } - else - { - if (wenclose(win,y,x)) - { - y -= (win->_begy + win->_yoffset); - x -= win->_begx; - result = TRUE; + bool result = FALSE; + + if (win && pY && pX) { + int y = *pY; + int x = *pX; + + if (to_screen) { + y += win->_begy + win->_yoffset; + x += win->_begx; + if (wenclose(win, y, x)) + result = TRUE; + } else { + if (wenclose(win, y, x)) { + y -= (win->_begy + win->_yoffset); + x -= win->_begx; + result = TRUE; } } - if (result) - { - *pX = x; - *pY = y; + if (result) { + *pX = x; + *pY = y; } } - return(result); + return (result); } /* lib_mouse.c ends here */ diff --git a/lib/libcurses/curses.3tbl b/lib/libcurses/curses.3tbl index 9472517b85e..bf21061b4bc 100644 --- a/lib/libcurses/curses.3tbl +++ b/lib/libcurses/curses.3tbl @@ -1,5 +1,5 @@ '\" t -.\" $OpenBSD: curses.3tbl,v 1.12 1999/11/28 17:53:40 millert Exp $ +.\" $OpenBSD: curses.3tbl,v 1.13 1999/12/28 15:57:59 millert Exp $ .\" .\"*************************************************************************** .\" Copyright (c) 1998,1999 Free Software Foundation, Inc. * @@ -29,7 +29,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: ncurses.3x,v 1.35 1999/10/23 19:50:07 tom Exp $ +.\" $From: ncurses.3x,v 1.39 1999/12/19 01:53:04 tom Exp $ .TH ncurses 3 "" .ds n 5 .ds d /usr/share/terminfo @@ -198,6 +198,7 @@ addch/\fBcurs_addch\fR(3) addchnstr/\fBcurs_addchstr\fR(3) addchstr/\fBcurs_addchstr\fR(3) addnstr/\fBcurs_addstr\fR(3) +assume_default_colors/\fBdft_fgbg\fR(3)* attr_get/\fBcurs_attr\fR(3) attr_off/\fBcurs_attr\fR(3) attr_on/\fBcurs_attr\fR(3) @@ -223,6 +224,7 @@ color_content/\fBcurs_color\fR(3) color_set/\fBcurs_attr\fR(3) copywin/\fBcurs_overlay\fR(3) curs_set/\fBcurs_kernel\fR(3) +curses_version/\fBcurs_extend\fR(3)* def_prog_mode/\fBcurs_kernel\fR(3) def_shell_mode/\fBcurs_kernel\fR(3) define_key/\fBdefine_key\fR(3)* @@ -280,6 +282,7 @@ intrflush/\fBcurs_inopts\fR(3) is_linetouched/\fBcurs_touch\fR(3) is_wintouched/\fBcurs_touch\fR(3) isendwin/\fBcurs_initscr\fR(3) +keybound/\fBkeybound\fR(3)* keyname/\fBcurs_util\fR(3) keyok/\fBkeyok\fR(3)* keypad/\fBcurs_inopts\fR(3) @@ -428,6 +431,7 @@ ungetmouse/\fBcurs_mouse\fR(3)* untouchwin/\fBcurs_touch\fR(3) use_default_colors/\fBdft_fgbg\fR(3)* use_env/\fBcurs_util\fR(3) +use_extended_names/\fBcurs_extend\fR(3)* vidattr/\fBterminfo\fR(3) vidputs/\fBterminfo\fR(3) vline/\fBcurs_border\fR(3) @@ -475,7 +479,7 @@ winsertln/\fBcurs_deleteln\fR(3) winsnstr/\fBcurs_insstr\fR(3) winsstr/\fBcurs_insstr\fR(3) winstr/\fBcurs_instr\fR(3) -wmouse_trafo/\fBcurs_mouse\fR(3) +wmouse_trafo/\fBcurs_mouse\fR(3)* wmove/\fBcurs_move\fR(3) wnoutrefresh/\fBcurs_refresh\fR(3) wprintw/\fBcurs_printw\fR(3) @@ -545,14 +549,6 @@ a terminal description for terminals which are run as emulations. Use the \fBuse_env\fR function to disable this feature. .TP 5 -DISPLAY -Provides a hint to ncurses that your terminal is an X terminal -emulator such as \fBxterm\fP. -If the \fBkmous\fP capability is set to the beginning of the xterm -mouse response, e.g., "kmous=\\E[M", then ncurses will send the terminal -xterm's mouse initialization strings and allow appropriate replies. -See the \fBcurs_mouse\fR(3) manual page for programming information. -.TP 5 ESCDELAY Specifies the total time, in milliseconds, for which curses will await a character sequence, e.g., a function key. diff --git a/lib/libcurses/tinfo/lib_raw.c b/lib/libcurses/tinfo/lib_raw.c index fc414144c3a..c84fcde44de 100644 --- a/lib/libcurses/tinfo/lib_raw.c +++ b/lib/libcurses/tinfo/lib_raw.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_raw.c,v 1.2 1999/03/11 21:03:57 millert Exp $ */ +/* $OpenBSD: lib_raw.c,v 1.3 1999/12/28 15:57:59 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * raw.c * @@ -49,16 +48,16 @@ */ #include <curses.priv.h> -#include <term.h> /* cur_term */ +#include <term.h> /* cur_term */ -MODULE_ID("$From: lib_raw.c,v 1.3 1999/03/06 22:28:24 tom Exp $") +MODULE_ID("$From: lib_raw.c,v 1.5 1999/12/19 01:57:23 tom Exp $") #if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE #endif #if HAVE_SYS_TERMIO_H -#include <sys/termio.h> /* needed for ISC */ +#include <sys/termio.h> /* needed for ISC */ #endif #ifdef __EMX__ @@ -76,160 +75,166 @@ MODULE_ID("$From: lib_raw.c,v 1.3 1999/03/06 22:28:24 tom Exp $") #define AFTER(s) #endif /* TRACE */ -int raw(void) +int +raw(void) { - T((T_CALLED("raw()"))); - if (SP != 0 && cur_term != 0) { + T((T_CALLED("raw()"))); + if (SP != 0 && cur_term != 0) { - SP->_raw = TRUE; - SP->_cbreak = 1; + SP->_raw = TRUE; + SP->_cbreak = 1; #ifdef __EMX__ - setmode(SP->_ifd, O_BINARY); + setmode(SP->_ifd, O_BINARY); #endif #ifdef TERMIOS - BEFORE("raw"); - cur_term->Nttyb.c_lflag &= ~(ICANON|ISIG); - cur_term->Nttyb.c_iflag &= ~(COOKED_INPUT); - cur_term->Nttyb.c_cc[VMIN] = 1; - cur_term->Nttyb.c_cc[VTIME] = 0; - AFTER("raw"); + BEFORE("raw"); + cur_term->Nttyb.c_lflag &= ~(ICANON | ISIG | IEXTEN); + cur_term->Nttyb.c_iflag &= ~(COOKED_INPUT); + cur_term->Nttyb.c_cc[VMIN] = 1; + cur_term->Nttyb.c_cc[VTIME] = 0; + AFTER("raw"); #else - cur_term->Nttyb.sg_flags |= RAW; + cur_term->Nttyb.sg_flags |= RAW; #endif - returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); - } - returnCode(ERR); + returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); + } + returnCode(ERR); } -int cbreak(void) +int +cbreak(void) { - T((T_CALLED("cbreak()"))); + T((T_CALLED("cbreak()"))); - SP->_cbreak = 1; + SP->_cbreak = 1; #ifdef __EMX__ - setmode(SP->_ifd, O_BINARY); + setmode(SP->_ifd, O_BINARY); #endif #ifdef TERMIOS - BEFORE("cbreak"); - cur_term->Nttyb.c_lflag &= ~ICANON; - cur_term->Nttyb.c_iflag &= ~ICRNL; - cur_term->Nttyb.c_lflag |= ISIG; - cur_term->Nttyb.c_cc[VMIN] = 1; - cur_term->Nttyb.c_cc[VTIME] = 0; - AFTER("cbreak"); + BEFORE("cbreak"); + cur_term->Nttyb.c_lflag &= ~ICANON; + cur_term->Nttyb.c_iflag &= ~ICRNL; + cur_term->Nttyb.c_lflag |= ISIG; + cur_term->Nttyb.c_cc[VMIN] = 1; + cur_term->Nttyb.c_cc[VTIME] = 0; + AFTER("cbreak"); #else - cur_term->Nttyb.sg_flags |= CBREAK; + cur_term->Nttyb.sg_flags |= CBREAK; #endif - returnCode(_nc_set_tty_mode( &cur_term->Nttyb)); + returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); } -void qiflush(void) +void +qiflush(void) { - T((T_CALLED("qiflush()"))); + T((T_CALLED("qiflush()"))); - /* - * Note: this implementation may be wrong. See the comment under - * intrflush(). - */ + /* + * Note: this implementation may be wrong. See the comment under + * intrflush(). + */ #ifdef TERMIOS - BEFORE("qiflush"); - cur_term->Nttyb.c_lflag &= ~(NOFLSH); - AFTER("qiflush"); - (void)_nc_set_tty_mode( &cur_term->Nttyb); - returnVoid; + BEFORE("qiflush"); + cur_term->Nttyb.c_lflag &= ~(NOFLSH); + AFTER("qiflush"); + (void) _nc_set_tty_mode(&cur_term->Nttyb); + returnVoid; #endif } - -int noraw(void) +int +noraw(void) { - T((T_CALLED("noraw()"))); + T((T_CALLED("noraw()"))); - SP->_raw = FALSE; - SP->_cbreak = 0; + SP->_raw = FALSE; + SP->_cbreak = 0; #ifdef __EMX__ - setmode(SP->_ifd, O_TEXT); + setmode(SP->_ifd, O_TEXT); #endif #ifdef TERMIOS - BEFORE("noraw"); - cur_term->Nttyb.c_lflag |= ISIG|ICANON; - cur_term->Nttyb.c_iflag |= COOKED_INPUT; - AFTER("noraw"); + BEFORE("noraw"); + cur_term->Nttyb.c_lflag |= ISIG | ICANON | + (cur_term->Ottyb.c_lflag & IEXTEN); + cur_term->Nttyb.c_iflag |= COOKED_INPUT; + AFTER("noraw"); #else - cur_term->Nttyb.sg_flags &= ~(RAW|CBREAK); + cur_term->Nttyb.sg_flags &= ~(RAW | CBREAK); #endif - returnCode(_nc_set_tty_mode( &cur_term->Nttyb)); + returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); } - -int nocbreak(void) +int +nocbreak(void) { - T((T_CALLED("nocbreak()"))); + T((T_CALLED("nocbreak()"))); - SP->_cbreak = 0; + SP->_cbreak = 0; #ifdef __EMX__ - setmode(SP->_ifd, O_TEXT); + setmode(SP->_ifd, O_TEXT); #endif #ifdef TERMIOS - BEFORE("nocbreak"); - cur_term->Nttyb.c_lflag |= ICANON; - cur_term->Nttyb.c_iflag |= ICRNL; - AFTER("nocbreak"); + BEFORE("nocbreak"); + cur_term->Nttyb.c_lflag |= ICANON; + cur_term->Nttyb.c_iflag |= ICRNL; + AFTER("nocbreak"); #else - cur_term->Nttyb.sg_flags &= ~CBREAK; + cur_term->Nttyb.sg_flags &= ~CBREAK; #endif - returnCode(_nc_set_tty_mode( &cur_term->Nttyb)); + returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); } -void noqiflush(void) +void +noqiflush(void) { - T((T_CALLED("noqiflush()"))); + T((T_CALLED("noqiflush()"))); - /* - * Note: this implementation may be wrong. See the comment under - * intrflush(). - */ + /* + * Note: this implementation may be wrong. See the comment under + * intrflush(). + */ #ifdef TERMIOS - BEFORE("noqiflush"); - cur_term->Nttyb.c_lflag |= NOFLSH; - AFTER("noqiflush"); - (void)_nc_set_tty_mode( &cur_term->Nttyb); - returnVoid; + BEFORE("noqiflush"); + cur_term->Nttyb.c_lflag |= NOFLSH; + AFTER("noqiflush"); + (void) _nc_set_tty_mode(&cur_term->Nttyb); + returnVoid; #endif } -int intrflush(WINDOW *win GCC_UNUSED, bool flag) +int +intrflush(WINDOW *win GCC_UNUSED, bool flag) { - T((T_CALLED("intrflush(%d)"), flag)); + T((T_CALLED("intrflush(%d)"), flag)); - /* - * This call does the same thing as the qiflush()/noqiflush() - * pair. We know for certain that SVr3 intrflush() tweaks the - * NOFLSH bit; on the other hand, the match (in the SVr4 man - * pages) between the language describing NOFLSH in termio(7) - * and the language describing qiflush()/noqiflush() in - * curs_inopts(3x) is too exact to be coincidence. - */ + /* + * This call does the same thing as the qiflush()/noqiflush() + * pair. We know for certain that SVr3 intrflush() tweaks the + * NOFLSH bit; on the other hand, the match (in the SVr4 man + * pages) between the language describing NOFLSH in termio(7) + * and the language describing qiflush()/noqiflush() in + * curs_inopts(3x) is too exact to be coincidence. + */ #ifdef TERMIOS - BEFORE("intrflush"); - if (flag) - cur_term->Nttyb.c_lflag &= ~(NOFLSH); - else - cur_term->Nttyb.c_lflag |= (NOFLSH); - AFTER("intrflush"); - returnCode(_nc_set_tty_mode( &cur_term->Nttyb)); + BEFORE("intrflush"); + if (flag) + cur_term->Nttyb.c_lflag &= ~(NOFLSH); + else + cur_term->Nttyb.c_lflag |= (NOFLSH); + AFTER("intrflush"); + returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); #else - returnCode(ERR); + returnCode(ERR); #endif } |