summaryrefslogtreecommitdiffstats
path: root/lib/libcurses/base
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1999-11-28 17:45:31 +0000
committermillert <millert@openbsd.org>1999-11-28 17:45:31 +0000
commit9ee63291f793bbca5703d9810744805f68d8a256 (patch)
treeee819b04f65c1c36ea0e5d120c0a0e30a7f39582 /lib/libcurses/base
parentSync with FreeBSD (convert to mii). Good for 3k+ kernel shrinkage. (diff)
downloadwireguard-openbsd-9ee63291f793bbca5703d9810744805f68d8a256.tar.xz
wireguard-openbsd-9ee63291f793bbca5703d9810744805f68d8a256.zip
update to ncurses-5.0-19991127
Diffstat (limited to 'lib/libcurses/base')
-rw-r--r--lib/libcurses/base/lib_beep.c8
-rw-r--r--lib/libcurses/base/lib_color.c89
-rw-r--r--lib/libcurses/base/lib_dft_fgbg.c31
-rw-r--r--lib/libcurses/base/lib_flash.c8
-rw-r--r--lib/libcurses/base/lib_freeall.c127
-rw-r--r--lib/libcurses/base/lib_mouse.c6
-rw-r--r--lib/libcurses/base/lib_newwin.c8
-rw-r--r--lib/libcurses/base/lib_nl.c12
-rw-r--r--lib/libcurses/base/lib_set_term.c8
-rw-r--r--lib/libcurses/base/lib_slk.c8
-rw-r--r--lib/libcurses/base/safe_sprintf.c12
-rw-r--r--lib/libcurses/base/version.c48
12 files changed, 228 insertions, 137 deletions
diff --git a/lib/libcurses/base/lib_beep.c b/lib/libcurses/base/lib_beep.c
index e4ca5aaaed9..071eec1b2e3 100644
--- a/lib/libcurses/base/lib_beep.c
+++ b/lib/libcurses/base/lib_beep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_beep.c,v 1.1 1999/01/18 19:09:35 millert Exp $ */
+/* $OpenBSD: lib_beep.c,v 1.2 1999/11/28 17:49:53 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -44,7 +44,7 @@
#include <curses.priv.h>
#include <term.h> /* beep, flash */
-MODULE_ID("$From: lib_beep.c,v 1.6 1998/06/29 19:34:16 Alexander.V.Lukyanov Exp $")
+MODULE_ID("$From: lib_beep.c,v 1.7 1999/10/22 21:39:09 tom Exp $")
/*
* beep()
@@ -64,11 +64,11 @@ int beep(void)
if (bell) {
TPUTS_TRACE("bell");
res = putp(bell);
- fflush(SP->_ofp);
+ _nc_flush();
} else if (flash_screen) {
TPUTS_TRACE("flash_screen");
res = putp(flash_screen);
- fflush(SP->_ofp);
+ _nc_flush();
}
returnCode(res);
diff --git a/lib/libcurses/base/lib_color.c b/lib/libcurses/base/lib_color.c
index dceb1e8f215..a06b5bbf354 100644
--- a/lib/libcurses/base/lib_color.c
+++ b/lib/libcurses/base/lib_color.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_color.c,v 1.3 1999/03/15 19:12:22 millert Exp $ */
+/* $OpenBSD: lib_color.c,v 1.4 1999/11/28 17:49:53 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 *
@@ -36,22 +36,21 @@
/* lib_color.c
*
* Handles color emulation of SYS V curses
- *
*/
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$From: lib_color.c,v 1.35 1999/03/15 01:45:14 Alexander.V.Lukyanov Exp $")
+MODULE_ID("$From: lib_color.c,v 1.40 1999/11/27 22:24:18 tom Exp $")
/*
* These should be screen structure members. They need to be globals for
* hystorical reasons. So we assign them in start_color() and also in
* set_term()'s screen-switching logic.
*/
-int COLOR_PAIRS;
-int COLORS;
+int COLOR_PAIRS = 0;
+int COLORS = 0;
/*
* Given a RGB range of 0..1000, we'll normally set the individual values
@@ -85,6 +84,23 @@ static const color_t hls_palette[] =
{0, 50, 100}, /* COLOR_WHITE */
};
+#ifdef NCURSES_EXT_FUNCS
+static int
+default_fg(void)
+{
+ return (SP->_default_fg >= 0) ? SP->_default_fg : COLOR_WHITE;
+}
+
+static int
+default_bg(void)
+{
+ return (SP->_default_bg >= 0) ? SP->_default_bg : COLOR_BLACK;
+}
+#else
+#define default_fg() COLOR_WHITE
+#define default_bg() COLOR_BLACK
+#endif
+
/*
* SVr4 curses is known to interchange color codes (1,4) and (3,6), possibly
* to maintain compatibility with a pre-ANSI scheme. The same scheme is
@@ -147,12 +163,15 @@ static bool set_original_colors(void)
int start_color(void)
{
+ int n;
+ const color_t *tp;
+
T((T_CALLED("start_color()")));
if (set_original_colors() != TRUE)
{
- set_foreground_color(COLOR_WHITE, _nc_outch);
- set_background_color(COLOR_BLACK, _nc_outch);
+ set_foreground_color(default_fg(), _nc_outch);
+ set_background_color(default_bg(), _nc_outch);
}
if (max_pairs != -1)
@@ -161,7 +180,7 @@ int start_color(void)
returnCode(ERR);
if ((SP->_color_pairs = typeCalloc(unsigned short, max_pairs)) == 0)
returnCode(ERR);
- SP->_color_pairs[0] = PAIR_OF(COLOR_WHITE, COLOR_BLACK);
+ SP->_color_pairs[0] = PAIR_OF(default_fg(), default_bg());
if (max_colors != -1)
COLORS = SP->_color_count = max_colors;
else
@@ -170,10 +189,24 @@ int start_color(void)
if ((SP->_color_table = typeMalloc(color_t, COLORS)) == 0)
returnCode(ERR);
- if (hue_lightness_saturation)
- memcpy(SP->_color_table, hls_palette, sizeof(color_t) * COLORS);
- else
- memcpy(SP->_color_table, cga_palette, sizeof(color_t) * COLORS);
+ tp = (hue_lightness_saturation) ? hls_palette : cga_palette;
+ for (n = 0; n < COLORS; n++) {
+ if (n < 8) {
+ SP->_color_table[n] = tp[n];
+ } else {
+ SP->_color_table[n] = tp[n % 8];
+ if (hue_lightness_saturation) {
+ SP->_color_table[n].green = 100;
+ } else {
+ if (SP->_color_table[n].red)
+ SP->_color_table[n].red = 1000;
+ if (SP->_color_table[n].green)
+ SP->_color_table[n].green = 1000;
+ if (SP->_color_table[n].blue)
+ SP->_color_table[n].blue = 1000;
+ }
+ }
+ }
T(("started color: COLORS = %d, COLOR_PAIRS = %d", COLORS, COLOR_PAIRS));
@@ -228,6 +261,7 @@ int init_pair(short pair, short f, short b)
if ((pair < 1) || (pair >= COLOR_PAIRS))
returnCode(ERR);
+#ifdef NCURSES_EXT_FUNCS
if (SP->_default_color)
{
if (f < 0)
@@ -240,6 +274,7 @@ int init_pair(short pair, short f, short b)
returnCode(ERR);
}
else
+#endif
if ((f < 0) || (f >= COLORS)
|| (b < 0) || (b >= COLORS))
returnCode(ERR);
@@ -347,7 +382,7 @@ bool has_colors(void)
int color_content(short color, short *r, short *g, short *b)
{
T((T_CALLED("color_content(%d,%p,%p,%p)"), color, r, g, b));
- if (color < 0 || color > COLORS)
+ if (color < 0 || color >= COLORS)
returnCode(ERR);
if (r) *r = SP->_color_table[color].red;
@@ -360,7 +395,7 @@ int pair_content(short pair, short *f, short *b)
{
T((T_CALLED("pair_content(%d,%p,%p)"), pair, f, b));
- if ((pair < 0) || (pair > COLOR_PAIRS))
+ if ((pair < 0) || (pair >= COLOR_PAIRS))
returnCode(ERR);
if (f) *f = ((SP->_color_pairs[pair] >> C_SHIFT) & C_MASK);
if (b) *b = (SP->_color_pairs[pair] & C_MASK);
@@ -374,20 +409,14 @@ void _nc_do_color(int pair, bool reverse, int (*outc)(int))
if (pair == 0)
{
- if (orig_pair)
- {
- TPUTS_TRACE("orig_pair");
- tputs(orig_pair, 1, outc);
- }
- else if (set_color_pair)
- {
- TPUTS_TRACE("set_color_pair");
- tputs(tparm(set_color_pair, pair), 1, outc);
- }
- else
+ if (
+#ifdef NCURSES_EXT_FUNCS
+ !SP->_default_color ||
+#endif
+ !set_original_colors())
{
- set_foreground_color(COLOR_WHITE, outc);
- set_background_color(COLOR_BLACK, outc);
+ set_foreground_color(default_fg(), outc);
+ set_background_color(default_bg(), outc);
}
}
else
@@ -413,9 +442,9 @@ void _nc_do_color(int pair, bool reverse, int (*outc)(int))
if (set_original_colors() != TRUE)
{
if (fg == C_MASK)
- set_foreground_color(COLOR_WHITE, outc);
+ set_foreground_color(default_fg(), outc);
if (bg == C_MASK)
- set_background_color(COLOR_BLACK, outc);
+ set_background_color(default_bg(), outc);
}
}
if (fg != C_MASK)
diff --git a/lib/libcurses/base/lib_dft_fgbg.c b/lib/libcurses/base/lib_dft_fgbg.c
index b1bef7ceb4d..80da38979a6 100644
--- a/lib/libcurses/base/lib_dft_fgbg.c
+++ b/lib/libcurses/base/lib_dft_fgbg.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_dft_fgbg.c,v 1.1 1999/01/18 19:09:41 millert Exp $ */
+/* $OpenBSD: lib_dft_fgbg.c,v 1.2 1999/11/28 17:49:53 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 *
@@ -29,26 +29,32 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey <dickey@clark.net> 1997 *
+ * Author: Thomas E. Dickey <dickey@clark.net> 1997,1999 *
****************************************************************************/
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$From: lib_dft_fgbg.c,v 1.3 1998/02/11 12:13:54 tom Exp $")
+MODULE_ID("$From: lib_dft_fgbg.c,v 1.7 1999/11/14 01:22:11 tom Exp $")
/*
* Modify the behavior of color-pair 0 so that the library doesn't assume that
- * it is black on white. This is an extension to XSI curses.
- *
- * Invoke this function after 'start_color()'.
+ * it is white on black. This is an extension to XSI curses.
*/
int
use_default_colors(void)
{
T((T_CALLED("use_default_colors()")));
+ returnCode(assume_default_colors(C_MASK, C_MASK));
+}
- if (!SP->_coloron)
- returnCode(ERR);
+/*
+ * Modify the behavior of color-pair 0 so that the library assumes that it
+ * is something specific, possibly not white on black.
+ */
+int
+assume_default_colors(int fg, int bg)
+{
+ T((T_CALLED("assume_default_colors(%d,%d)"), fg, bg));
if (!orig_pair && !orig_colors)
returnCode(ERR);
@@ -56,7 +62,10 @@ use_default_colors(void)
if (initialize_pair) /* don't know how to handle this */
returnCode(ERR);
- SP->_default_color = TRUE;
- SP->_color_pairs[0] = PAIR_OF(C_MASK, C_MASK);
+ SP->_default_color = (fg != COLOR_WHITE) || (bg != COLOR_BLACK);
+ SP->_default_fg = fg;
+ SP->_default_bg = bg;
+ if (SP->_color_pairs != 0)
+ SP->_color_pairs[0] = PAIR_OF(fg, bg);
returnCode(OK);
}
diff --git a/lib/libcurses/base/lib_flash.c b/lib/libcurses/base/lib_flash.c
index 06fea72969a..df42bd6e5cf 100644
--- a/lib/libcurses/base/lib_flash.c
+++ b/lib/libcurses/base/lib_flash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_flash.c,v 1.1 1999/01/18 19:09:43 millert Exp $ */
+/* $OpenBSD: lib_flash.c,v 1.2 1999/11/28 17:49:53 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -44,7 +44,7 @@
#include <curses.priv.h>
#include <term.h> /* beep, flash */
-MODULE_ID("$From: lib_flash.c,v 1.3 1998/06/29 19:34:16 Alexander.V.Lukyanov Exp $")
+MODULE_ID("$From: lib_flash.c,v 1.4 1999/10/22 21:39:06 tom Exp $")
/*
* flash()
@@ -64,11 +64,11 @@ int flash(void)
if (flash_screen) {
TPUTS_TRACE("flash_screen");
res = putp(flash_screen);
- fflush(SP->_ofp);
+ _nc_flush();
} else if (bell) {
TPUTS_TRACE("bell");
res = putp(bell);
- fflush(SP->_ofp);
+ _nc_flush();
}
returnCode(res);
diff --git a/lib/libcurses/base/lib_freeall.c b/lib/libcurses/base/lib_freeall.c
index 0a07e5b71c0..116d0fcb4b7 100644
--- a/lib/libcurses/base/lib_freeall.c
+++ b/lib/libcurses/base/lib_freeall.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_freeall.c,v 1.2 1999/05/08 20:29:00 millert Exp $ */
+/* $OpenBSD: lib_freeall.c,v 1.3 1999/11/28 17:49:53 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 *
@@ -41,96 +41,101 @@
extern int malloc_errfd; /* FIXME */
#endif
-MODULE_ID("$From: lib_freeall.c,v 1.14 1999/04/03 23:17:06 tom Exp $")
+MODULE_ID("$From: lib_freeall.c,v 1.16 1999/11/28 01:34:11 tom Exp $")
-static void free_slk(SLK *p)
+static void
+free_slk(SLK *p)
{
- if (p != 0) {
- FreeIfNeeded(p->ent);
- FreeIfNeeded(p->buffer);
- free(p);
- }
+ if (p != 0) {
+ FreeIfNeeded(p->ent);
+ FreeIfNeeded(p->buffer);
+ free(p);
+ }
}
-static void free_tries(struct tries *p)
+static void
+free_tries(struct tries *p)
{
- struct tries *q;
-
- while (p != 0) {
- q = p->sibling;
- if (p->child != 0)
- free_tries(p->child);
- free(p);
- p = q;
- }
+ struct tries *q;
+
+ while (p != 0) {
+ q = p->sibling;
+ if (p->child != 0)
+ free_tries(p->child);
+ free(p);
+ p = q;
+ }
}
/*
* Free all ncurses data. This is used for testing only (there's no practical
* use for it as an extension).
*/
-void _nc_freeall(void)
+void
+_nc_freeall(void)
{
- WINDOWLIST *p, *q;
+ WINDOWLIST *p, *q;
#if NO_LEAKS
- _nc_free_tparm();
+ _nc_free_tparm();
#endif
+ if (SP != 0) {
while (_nc_windows != 0) {
- /* Delete only windows that're not a parent */
- for (p = _nc_windows; p != 0; p = p->next) {
- bool found = FALSE;
-
- for (q = _nc_windows; q != 0; q = q->next) {
- if ((p != q)
- && (q->win->_flags & _SUBWIN)
- && (p->win == q->win->_parent)) {
- found = TRUE;
- break;
- }
- }
-
- if (!found) {
- delwin(p->win);
- break;
- }
+ /* Delete only windows that're not a parent */
+ for (p = _nc_windows; p != 0; p = p->next) {
+ bool found = FALSE;
+
+ for (q = _nc_windows; q != 0; q = q->next) {
+ if ((p != q)
+ && (q->win->_flags & _SUBWIN)
+ && (p->win == q->win->_parent)) {
+ found = TRUE;
+ break;
+ }
}
+
+ if (!found) {
+ delwin(p->win);
+ break;
+ }
+ }
}
- if (SP != 0) {
- free_tries (SP->_keytry);
- free_tries (SP->_key_ok);
- free_slk(SP->_slk);
- FreeIfNeeded(SP->_color_pairs);
- FreeIfNeeded(SP->_color_table);
- /* it won't free buffer anyway */
-/* _nc_set_buffer(SP->_ofp, FALSE);*/
+ free_tries(SP->_keytry);
+ free_tries(SP->_key_ok);
+ free_slk(SP->_slk);
+ FreeIfNeeded(SP->_color_pairs);
+ FreeIfNeeded(SP->_color_table);
#if !BROKEN_LINKER
- FreeAndNull(SP);
+ FreeAndNull(SP);
#endif
- }
-
- if (cur_term != 0) {
- _nc_free_termtype(&(cur_term->type));
- free(cur_term);
- }
+ }
+ if (cur_term != 0) {
+ _nc_free_termtype(&(cur_term->type));
+ free(cur_term);
+ }
#ifdef TRACE
- (void) _nc_trace_buf(-1, 0);
+ (void) _nc_trace_buf(-1, 0);
#endif
#if HAVE_LIBDBMALLOC
- malloc_dump(malloc_errfd);
+ malloc_dump(malloc_errfd);
#elif HAVE_LIBDMALLOC
#elif HAVE_PURIFY
- purify_all_inuse();
+ purify_all_inuse();
#endif
}
-void _nc_free_and_exit(int code)
+void
+_nc_free_and_exit(int code)
{
- _nc_freeall();
- exit(code);
+ _nc_freeall();
+ exit(code);
}
+
#else
-void _nc_freeall(void) { }
+void
+_nc_freeall(void)
+{
+}
#endif
diff --git a/lib/libcurses/base/lib_mouse.c b/lib/libcurses/base/lib_mouse.c
index afc52ef37e9..b0263f20cdb 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.4 1999/08/15 11:40:55 millert Exp $ */
+/* $OpenBSD: lib_mouse.c,v 1.5 1999/11/28 17:49:53 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999 Free Software Foundation, Inc. *
@@ -87,7 +87,7 @@
#endif
#endif
-MODULE_ID("$From: lib_mouse.c,v 1.44 1999/07/24 21:10:48 tom Exp $")
+MODULE_ID("$From: lib_mouse.c,v 1.45 1999/10/22 21:39:02 tom Exp $")
#define MY_TRACE TRACE_ICALLS|TRACE_IEVENT
@@ -533,7 +533,7 @@ static void mouse_activate(bool on)
#endif
}
}
- (void) fflush(SP->_ofp);
+ _nc_flush();
}
/**************************************************************************
diff --git a/lib/libcurses/base/lib_newwin.c b/lib/libcurses/base/lib_newwin.c
index db0df629fff..66f2facd537 100644
--- a/lib/libcurses/base/lib_newwin.c
+++ b/lib/libcurses/base/lib_newwin.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_newwin.c,v 1.1 1999/01/18 19:09:54 millert Exp $ */
+/* $OpenBSD: lib_newwin.c,v 1.2 1999/11/28 17:49:53 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -44,7 +44,7 @@
#include <curses.priv.h>
-MODULE_ID("$From: lib_newwin.c,v 1.20 1998/05/23 23:21:32 Alexander.V.Lukyanov Exp $")
+MODULE_ID("$From: lib_newwin.c,v 1.22 1999/11/25 13:48:24 juergen Exp $")
void _nc_freewin(WINDOW *win)
{
@@ -61,8 +61,8 @@ int i;
free(p);
if (! (win->_flags & _SUBWIN)) {
- for (i = 0; i <= win->_maxy && win->_line[i].text; i++)
- free(win->_line[i].text);
+ for (i = 0; i <= win->_maxy; i++)
+ FreeIfNeeded(win->_line[i].text);
}
free(win->_line);
free(win);
diff --git a/lib/libcurses/base/lib_nl.c b/lib/libcurses/base/lib_nl.c
index 2b4fe387462..9895d1d6f8a 100644
--- a/lib/libcurses/base/lib_nl.c
+++ b/lib/libcurses/base/lib_nl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_nl.c,v 1.1 1999/01/18 19:09:54 millert Exp $ */
+/* $OpenBSD: lib_nl.c,v 1.2 1999/11/28 17:49:53 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -45,7 +45,7 @@
#include <curses.priv.h>
-MODULE_ID("$From: lib_nl.c,v 1.3 1998/10/14 15:14:08 Alexander.V.Lukyanov Exp $")
+MODULE_ID("$From: lib_nl.c,v 1.4 1999/10/22 22:31:51 tom Exp $")
#ifdef __EMX__
#include <io.h>
@@ -59,8 +59,8 @@ int nl(void)
SP->_nl = TRUE;
#ifdef __EMX__
- fflush(SP->_ofp);
- _fsetmode(SP->_ofp, "t");
+ _nc_flush();
+ _fsetmode(NC_OUTPUT, "t");
#endif
returnCode(OK);
@@ -73,8 +73,8 @@ int nonl(void)
SP->_nl = FALSE;
#ifdef __EMX__
- fflush(SP->_ofp);
- _fsetmode(SP->_ofp, "b");
+ _nc_flush();
+ _fsetmode(NC_OUTPUT, "b");
#endif
returnCode(OK);
diff --git a/lib/libcurses/base/lib_set_term.c b/lib/libcurses/base/lib_set_term.c
index d05dcffb450..ab67435081b 100644
--- a/lib/libcurses/base/lib_set_term.c
+++ b/lib/libcurses/base/lib_set_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_set_term.c,v 1.4 1999/08/15 11:40:55 millert Exp $ */
+/* $OpenBSD: lib_set_term.c,v 1.5 1999/11/28 17:49:53 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -44,7 +44,7 @@
#include <term.h> /* cur_term */
-MODULE_ID("$From: lib_set_term.c,v 1.46 1999/07/24 20:05:49 tom Exp $")
+MODULE_ID("$From: lib_set_term.c,v 1.47 1999/11/14 00:14:39 tom Exp $")
SCREEN * set_term(SCREEN *screenp)
{
@@ -168,6 +168,10 @@ size_t i;
#ifdef NCURSES_NO_PADDING
SP->_no_padding = getenv("NCURSES_NO_PADDING") != 0;
#endif
+#ifdef NCURSES_EXT_FUNCS
+ SP->_default_fg = COLOR_WHITE;
+ SP->_default_bg = COLOR_BLACK;
+#endif
SP->_maxclick = DEFAULT_MAXCLICK;
SP->_mouse_event = no_mouse_event;
diff --git a/lib/libcurses/base/lib_slk.c b/lib/libcurses/base/lib_slk.c
index 76ba38d65dd..c0cc60ba85b 100644
--- a/lib/libcurses/base/lib_slk.c
+++ b/lib/libcurses/base/lib_slk.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_slk.c,v 1.2 1999/03/11 21:03:55 millert Exp $ */
+/* $OpenBSD: lib_slk.c,v 1.3 1999/11/28 17:49:53 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 *
@@ -43,13 +43,13 @@
#include <ctype.h>
#include <term.h> /* num_labels, label_*, plab_norm */
-MODULE_ID("$From: lib_slk.c,v 1.16 1999/03/03 23:44:22 juergen Exp $")
+MODULE_ID("$From: lib_slk.c,v 1.17 1999/10/30 23:00:16 tom Exp $")
/*
* We'd like to move these into the screen context structure, but cannot,
* because slk_init() is called before initscr()/newterm().
*/
-int _nc_slk_format; /* one more than format specified in slk_init() */
+int _nc_slk_format = 0; /* one more than format specified in slk_init() */
/*
* Paint the info line for the PC style SLK emulation.
diff --git a/lib/libcurses/base/safe_sprintf.c b/lib/libcurses/base/safe_sprintf.c
index a5dd7c4a8e1..d344b79463e 100644
--- a/lib/libcurses/base/safe_sprintf.c
+++ b/lib/libcurses/base/safe_sprintf.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: safe_sprintf.c,v 1.2 1999/03/02 06:23:27 millert Exp $ */
+/* $OpenBSD: safe_sprintf.c,v 1.3 1999/11/28 17:49:53 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 *
@@ -35,7 +35,7 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$From: safe_sprintf.c,v 1.10 1999/02/27 19:56:37 tom Exp $")
+MODULE_ID("$From: safe_sprintf.c,v 1.11 1999/09/11 18:03:27 tom Exp $")
#if USE_SAFE_SPRINTF
@@ -114,7 +114,6 @@ _nc_printf_length(const char *fmt, va_list ap)
case 'Z': /* FALLTHRU */
case 'h': /* FALLTHRU */
case 'l': /* FALLTHRU */
- case 'L': /* FALLTHRU */
done = FALSE;
type = *fmt;
break;
@@ -136,10 +135,7 @@ _nc_printf_length(const char *fmt, va_list ap)
case 'E': /* FALLTHRU */
case 'g': /* FALLTHRU */
case 'G': /* FALLTHRU */
- if (type == 'L')
- VA_FLOAT(long double);
- else
- VA_FLOAT(double);
+ VA_FLOAT(double);
used = 'f';
break;
case 'c':
diff --git a/lib/libcurses/base/version.c b/lib/libcurses/base/version.c
new file mode 100644
index 00000000000..a8f78015cec
--- /dev/null
+++ b/lib/libcurses/base/version.c
@@ -0,0 +1,48 @@
+/****************************************************************************
+ * Copyright (c) 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Thomas E. Dickey <dickey@clark.net> 1999 *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$From: version.c,v 1.1 1999/10/23 13:28:49 tom Exp $")
+
+const char *
+curses_version(void)
+{
+ static char my_version[80];
+
+ T((T_CALLED("curses_version()")));
+ sprintf(my_version, "ncurses %d.%d.%d",
+ NCURSES_VERSION_MAJOR,
+ NCURSES_VERSION_MINOR,
+ NCURSES_VERSION_PATCH);
+ returnPtr(my_version);
+}