diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-01-31 20:17:11 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-01-31 20:17:11 +0000 |
commit | fb70e89dae9574330a73792f0fceddfab62202b9 (patch) | |
tree | 18b545328dd6256be0c7c1201cf94a31446e9d16 /lib/libcurses | |
parent | 3b9b932e9a8c5afd5438f8d93bf20a7f032d8847 (diff) |
ncurses-4.2-990130
Diffstat (limited to 'lib/libcurses')
-rw-r--r-- | lib/libcurses/base/lib_mouse.c | 20 | ||||
-rw-r--r-- | lib/libcurses/base/lib_newterm.c | 8 | ||||
-rw-r--r-- | lib/libcurses/curs_border.3 | 4 | ||||
-rw-r--r-- | lib/libcurses/curses.h | 4 | ||||
-rw-r--r-- | lib/libcurses/ncurses_cfg.h | 3 | ||||
-rw-r--r-- | lib/libcurses/terminfo.5tbl | 7 | ||||
-rw-r--r-- | lib/libcurses/tinfo/lib_baudrate.c | 25 | ||||
-rw-r--r-- | lib/libcurses/tinfo/lib_data.c | 8 | ||||
-rw-r--r-- | lib/libcurses/tty/lib_tstp.c | 36 | ||||
-rw-r--r-- | lib/libcurses/tty/tty_update.c | 35 |
10 files changed, 89 insertions, 61 deletions
diff --git a/lib/libcurses/base/lib_mouse.c b/lib/libcurses/base/lib_mouse.c index 2454f0d5f5f..487503f4c35 100644 --- a/lib/libcurses/base/lib_mouse.c +++ b/lib/libcurses/base/lib_mouse.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_mouse.c,v 1.1 1999/01/18 19:09:52 millert Exp $ */ +/* $OpenBSD: lib_mouse.c,v 1.2 1999/01/31 20:17:09 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 * @@ -38,7 +38,7 @@ * devices. * * The first method used is xterm's internal mouse-tracking facility. - * The second (not yet implemented) will be Alessandro Rubini's GPM server. + * The second is Alessandro Rubini's GPM server. * * Notes for implementors of new mouse-interface methods: * @@ -86,7 +86,7 @@ #endif #endif -MODULE_ID("$From: lib_mouse.c,v 1.41 1998/12/02 15:03:22 juergen Exp $") +MODULE_ID("$From: lib_mouse.c,v 1.42 1999/01/31 01:17:53 tom Exp $") #define MY_TRACE TRACE_ICALLS|TRACE_IEVENT @@ -225,10 +225,14 @@ server_state(const int state) /* FIXME: The list of names should be configurable */ static int is_xterm(const char *name) { - return (!strncmp(name, "xterm", 5) - || !strncmp(name, "rxvt", 4) - || !strncmp(name, "kterm", 5) - || !strncmp(name, "color_xterm", 11)); + while (*name != 0) { + if (!strncmp(name, "xterm", 5) + || !strncmp(name, "rxvt", 4) + || !strncmp(name, "kterm", 5)) + return TRUE; + name++; + } + return FALSE; } static int initialized; diff --git a/lib/libcurses/base/lib_newterm.c b/lib/libcurses/base/lib_newterm.c index a82c2e1b247..6218dfa32a2 100644 --- a/lib/libcurses/base/lib_newterm.c +++ b/lib/libcurses/base/lib_newterm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_newterm.c,v 1.1 1999/01/18 19:09:53 millert Exp $ */ +/* $OpenBSD: lib_newterm.c,v 1.2 1999/01/31 20:17:09 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998 Free Software Foundation, Inc. * @@ -50,7 +50,7 @@ #include <term.h> /* clear_screen, cup & friends, cur_term */ -MODULE_ID("$From: lib_newterm.c,v 1.37 1999/01/02 22:56:08 tom Exp $") +MODULE_ID("$From: lib_newterm.c,v 1.38 1999/01/31 01:23:25 tom Exp $") #ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */ #define ONLCR 0 @@ -196,14 +196,14 @@ int t = _nc_getenv_num("NCURSES_TRACE"); /* compute movement costs so we can do better move optimization */ _nc_mvcur_init(); - _nc_signal_handler(TRUE); - /* initialize terminal to a sane state */ _nc_screen_init(); /* Initialize the terminal line settings. */ _nc_initscr(); + _nc_signal_handler(TRUE); + T((T_RETURN("%p"), SP)); return(SP); } diff --git a/lib/libcurses/curs_border.3 b/lib/libcurses/curs_border.3 index dcf1d0fd662..fd44d3c67b1 100644 --- a/lib/libcurses/curs_border.3 +++ b/lib/libcurses/curs_border.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: curs_border.3,v 1.8 1999/01/24 19:20:54 millert Exp $ +.\" $OpenBSD: curs_border.3,v 1.9 1999/01/31 20:17:05 millert Exp $ .\" .\"*************************************************************************** .\" Copyright (c) 1998 Free Software Foundation, Inc. * @@ -28,7 +28,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: curs_border.3x,v 1.10 1998/12/26 20:07:03 tom Exp $ +.\" $From: curs_border.3x,v 1.11 1999/01/30 23:11:47 tom Exp $ .TH curs_border 3 "" .SH NAME \fBborder\fR, \fBwborder\fR, \fBbox\fR, diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h index 319768892b2..fc0b7a85858 100644 --- a/lib/libcurses/curses.h +++ b/lib/libcurses/curses.h @@ -1,4 +1,4 @@ -/* $OpenBSD: curses.h,v 1.16 1999/01/24 20:06:44 millert Exp $ */ +/* $OpenBSD: curses.h,v 1.17 1999/01/31 20:17:06 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998 Free Software Foundation, Inc. * @@ -50,7 +50,7 @@ /* These are defined only in curses.h, and are used for conditional compiles */ #define NCURSES_VERSION_MAJOR 4 #define NCURSES_VERSION_MINOR 2 -#define NCURSES_VERSION_PATCH 990123 +#define NCURSES_VERSION_PATCH 990130 /* This is defined in more than one ncurses header, for identification */ #undef NCURSES_VERSION diff --git a/lib/libcurses/ncurses_cfg.h b/lib/libcurses/ncurses_cfg.h index 9e8dff756b3..4b4e87ba087 100644 --- a/lib/libcurses/ncurses_cfg.h +++ b/lib/libcurses/ncurses_cfg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ncurses_cfg.h,v 1.8 1999/01/18 19:09:03 millert Exp $ */ +/* $OpenBSD: ncurses_cfg.h,v 1.9 1999/01/31 20:17:07 millert Exp $ */ /* include/ncurses_cfg.h. Generated automatically by configure. */ /**************************************************************************** @@ -100,6 +100,7 @@ #define HAVE_USLEEP 1 #define HAVE_VSNPRINTF 1 #define HAVE_VSSCANF 1 +#define HAVE_TCGETPGRP 1 #define HAVE_BSD_CGETENT 1 #define NCURSES_EXT_FUNCS 1 #define NCURSES_NO_PADDING 1 diff --git a/lib/libcurses/terminfo.5tbl b/lib/libcurses/terminfo.5tbl index 5503a80d478..7110266ee87 100644 --- a/lib/libcurses/terminfo.5tbl +++ b/lib/libcurses/terminfo.5tbl @@ -33,7 +33,7 @@ .\"*************************************************************************** .\" .\" $From: terminfo.head,v 1.8 1998/03/11 21:12:53 juergen Exp $ -.\" $OpenBSD: terminfo.5tbl,v 1.2 1999/01/18 19:09:17 millert Exp $ +.\" $OpenBSD: terminfo.5tbl,v 1.3 1999/01/31 20:17:07 millert Exp $ .TH TERMINFO 5 "" "" "File Formats" .ds n 5 .ds d /usr/share/terminfo @@ -1623,7 +1623,7 @@ YI Set page length to #1 hundredth of an inch T} .TE .ad -.\" $Id: terminfo.5tbl,v 1.2 1999/01/18 19:09:17 millert Exp $ +.\" $Id: terminfo.5tbl,v 1.3 1999/01/31 20:17:07 millert Exp $ .\" Beginning of terminfo.tail file .ps +1 .PP @@ -2804,6 +2804,9 @@ For example, on many IBM PC consoles, the underline attribute collides with the foreground color blue and is not available in color mode. These should have an \fBncv\fR capability of 2. .PP +SVr4 curses does nothing with \fBncv\fR, ncurses recognizes it and optimizes +the output in favor of colors. +.PP .SS Miscellaneous .PP If the terminal can move up or down half a line, diff --git a/lib/libcurses/tinfo/lib_baudrate.c b/lib/libcurses/tinfo/lib_baudrate.c index 97b5eb7c5be..d0c946d20fa 100644 --- a/lib/libcurses/tinfo/lib_baudrate.c +++ b/lib/libcurses/tinfo/lib_baudrate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_baudrate.c,v 1.1 1999/01/18 19:10:16 millert Exp $ */ +/* $OpenBSD: lib_baudrate.c,v 1.2 1999/01/31 20:17:10 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998 Free Software Foundation, Inc. * @@ -43,7 +43,7 @@ #include <term.h> /* cur_term, pad_char */ #include <termcap.h> /* ospeed */ -MODULE_ID("$From: lib_baudrate.c,v 1.14 1999/01/03 01:31:45 tom Exp $") +MODULE_ID("$From: lib_baudrate.c,v 1.15 1999/01/31 03:05:25 tom Exp $") /* * int @@ -103,16 +103,25 @@ static struct speed const speeds[] = { int _nc_baudrate(int OSpeed) { - int result = ERR; + static int last_OSpeed; + static int last_baudrate; + + int result; unsigned i; - if (OSpeed >= 0) { - for (i = 0; i < SIZEOF(speeds); i++) { - if (speeds[i].s == (speed_t)OSpeed) { - result = speeds[i].sp; - break; + if (OSpeed == last_OSpeed) { + result = last_baudrate; + } else { + result = ERR; + if (OSpeed >= 0) { + for (i = 0; i < SIZEOF(speeds); i++) { + if (speeds[i].s == (speed_t)OSpeed) { + result = speeds[i].sp; + break; + } } } + last_baudrate = result; } return (result); } diff --git a/lib/libcurses/tinfo/lib_data.c b/lib/libcurses/tinfo/lib_data.c index 9fad1c97b3e..f686f40b4da 100644 --- a/lib/libcurses/tinfo/lib_data.c +++ b/lib/libcurses/tinfo/lib_data.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_data.c,v 1.1 1999/01/18 19:10:17 millert Exp $ */ +/* $OpenBSD: lib_data.c,v 1.2 1999/01/31 20:17:10 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 * @@ -42,7 +42,7 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_data.c,v 1.13 1998/02/11 12:14:00 tom Exp $") +MODULE_ID("$From: lib_data.c,v 1.14 1999/01/31 01:34:33 Ilya.Zakharevich Exp $") /* * OS/2's native linker complains if we don't initialize public data when @@ -82,5 +82,5 @@ void _nc_set_screen(SCREEN *sp) my_screen = sp; } #else -SCREEN *SP; +SCREEN *SP = NULL; /* Some linkers require initialized data... */ #endif diff --git a/lib/libcurses/tty/lib_tstp.c b/lib/libcurses/tty/lib_tstp.c index 709b7ce492a..11455deff2c 100644 --- a/lib/libcurses/tty/lib_tstp.c +++ b/lib/libcurses/tty/lib_tstp.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_tstp.c,v 1.1 1999/01/18 19:10:26 millert Exp $ */ +/* $OpenBSD: lib_tstp.c,v 1.2 1999/01/31 20:17:10 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 * @@ -50,7 +50,7 @@ #define _POSIX_SOURCE #endif -MODULE_ID("$From: lib_tstp.c,v 1.15 1998/02/11 12:13:57 tom Exp $") +MODULE_ID("$From: lib_tstp.c,v 1.17 1999/01/31 01:06:14 tom Exp $") /* * Note: This code is fragile! Its problem is that different OSs @@ -101,12 +101,25 @@ static void tstp(int dummy GCC_UNUSED) sigset_t mask, omask; sigaction_t act, oact; +#ifdef SIGTTOU + int sigttou_blocked; +#endif + T(("tstp() called")); /* * The user may have changed the prog_mode tty bits, so save them. + * + * But first try to detect whether we still are in the foreground + * process group - if not, an interactive shell may already have + * taken ownership of the tty and modified the settings when our + * parent was stopped before us, and we would likely pick up the + * settings already modified by the shell. */ - def_prog_mode(); +#if HAVE_TCGETPGRP + if (tcgetpgrp(STDIN_FILENO) == getpgrp()) +#endif + def_prog_mode(); /* * Block window change and timer signals. The latter @@ -120,6 +133,15 @@ static void tstp(int dummy GCC_UNUSED) #endif (void)sigprocmask(SIG_BLOCK, &mask, &omask); +#ifdef SIGTTOU + sigttou_blocked = sigismember(&omask, SIGTTOU); + if (!sigttou_blocked) { + (void)sigemptyset(&mask); + (void)sigaddset(&mask, SIGTTOU); + (void)sigprocmask(SIG_BLOCK, &mask, NULL); + } +#endif + /* * End window mode, which also resets the terminal state to the * original (pre-curses) modes. @@ -129,6 +151,12 @@ static void tstp(int dummy GCC_UNUSED) /* Unblock SIGTSTP. */ (void)sigemptyset(&mask); (void)sigaddset(&mask, SIGTSTP); +#ifdef SIGTTOU + if (!sigttou_blocked) { + /* Unblock this too if it wasn't blocked on entry */ + (void)sigaddset(&mask, SIGTTOU); + } +#endif (void)sigprocmask(SIG_UNBLOCK, &mask, NULL); /* Now we want to resend SIGSTP to this process and suspend it */ diff --git a/lib/libcurses/tty/tty_update.c b/lib/libcurses/tty/tty_update.c index 9fd81963b5e..503b63c654d 100644 --- a/lib/libcurses/tty/tty_update.c +++ b/lib/libcurses/tty/tty_update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_update.c,v 1.1 1999/01/18 19:10:27 millert Exp $ */ +/* $OpenBSD: tty_update.c,v 1.2 1999/01/31 20:17:10 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998 Free Software Foundation, Inc. * @@ -77,7 +77,7 @@ #include <term.h> -MODULE_ID("$From: tty_update.c,v 1.109 1998/10/03 19:08:33 tom Exp $") +MODULE_ID("$From: tty_update.c,v 1.110 1999/01/31 01:45:37 Alexander.V.Lukyanov Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -101,7 +101,7 @@ static inline chtype ClrBlank ( WINDOW *win ); static int ClrBottom(int total); static int InsStr( chtype *line, int count ); static void ClearScreen( chtype blank ); -static void ClrUpdate( WINDOW *win ); +static void ClrUpdate( void ); static void DelChar( int count ); static void TransformLine( int const lineno ); @@ -682,19 +682,11 @@ struct tms before, after; #endif /* USE_XMC_SUPPORT */ nonempty = 0; - if (curscr->_clear) { /* force refresh ? */ - /* yes, clear all & update */ - T(("clearing and updating curscr")); - if (is_wintouched(newscr)) - ClrUpdate(newscr); - else - ClrUpdate(curscr); + if (curscr->_clear || newscr->_clear) { /* force refresh ? */ + T(("clearing and updating from scratch")); + ClrUpdate(); curscr->_clear = FALSE; /* reset flag */ newscr->_clear = FALSE; /* reset flag */ - } else if (newscr->_clear) { - T(("clearing and updating newscr")); - ClrUpdate(newscr); - newscr->_clear = FALSE; } else { int changedlines = CHECK_INTERVAL; @@ -802,29 +794,20 @@ chtype blank = BLANK; } /* -** ClrUpdate(win) +** ClrUpdate() ** ** Update by clearing and redrawing the entire screen. ** */ -static void ClrUpdate(WINDOW *win) +static void ClrUpdate(void) { int i; - chtype blank = ClrBlank(win); + chtype blank = ClrBlank(stdscr); int nonempty = min(screen_lines, newscr->_maxy+1); T(("ClrUpdate() called")); - if (win == curscr) { - /* discard updates */ - for (i = 0; i < screen_lines ; i++) { - memcpy( newscr->_line[i].text, - curscr->_line[i].text, - screen_columns * sizeof(chtype)); - } - } - ClearScreen(blank); T(("updating screen from scratch")); |