diff options
Diffstat (limited to 'lib/libcurses')
160 files changed, 4427 insertions, 4140 deletions
diff --git a/lib/libcurses/SigAction.h b/lib/libcurses/SigAction.h index 1f06fc2c3b6..5faf7c43e53 100644 --- a/lib/libcurses/SigAction.h +++ b/lib/libcurses/SigAction.h @@ -1,7 +1,7 @@ -/* $OpenBSD: SigAction.h,v 1.2 1999/06/27 08:15:19 millert Exp $ */ +/* $OpenBSD: SigAction.h,v 1.3 2001/01/22 18:01:32 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -34,7 +34,7 @@ ****************************************************************************/ /* - * $From: SigAction.h,v 1.5 1999/06/19 23:00:54 tom Exp $ + * $From: SigAction.h,v 1.6 2000/12/10 02:36:10 tom Exp $ * * This file exists to handle non-POSIX systems which don't have <unistd.h>, * and usually no sigaction() nor <termios.h> @@ -107,12 +107,12 @@ typedef unsigned long sigset_t; #undef sigaddset #define sigaddset _nc_sigaddset -extern int sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact); -extern int sigprocmask (int how, sigset_t *mask, sigset_t *omask); -extern int sigemptyset (sigset_t *mask); -extern int sigsuspend (sigset_t *mask); -extern int sigdelset (sigset_t *mask, int sig); -extern int sigaddset (sigset_t *mask, int sig); +extern NCURSES_EXPORT(int) sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact); +extern NCURSES_EXPORT(int) sigprocmask (int how, sigset_t *mask, sigset_t *omask); +extern NCURSES_EXPORT(int) sigemptyset (sigset_t *mask); +extern NCURSES_EXPORT(int) sigsuspend (sigset_t *mask); +extern NCURSES_EXPORT(int) sigdelset (sigset_t *mask, int sig); +extern NCURSES_EXPORT(int) sigaddset (sigset_t *mask, int sig); #endif /* HAVE_SIGVEC */ #endif /* HAVE_SIGACTION */ diff --git a/lib/libcurses/base/MKkeyname.awk b/lib/libcurses/base/MKkeyname.awk index df70e9b89d3..0bf3da063a6 100644 --- a/lib/libcurses/base/MKkeyname.awk +++ b/lib/libcurses/base/MKkeyname.awk @@ -1,7 +1,7 @@ -# $OpenBSD: MKkeyname.awk,v 1.2 1999/02/24 06:31:07 millert Exp $ -# $From: MKkeyname.awk,v 1.17 1999/02/18 11:18:06 tom Exp $ +# $OpenBSD: MKkeyname.awk,v 1.3 2001/01/22 18:01:36 millert Exp $ +# $From: MKkeyname.awk,v 1.18 2000/12/10 02:25:23 tom Exp $ ############################################################################## -# Copyright (c) 1999 Free Software Foundation, Inc. # +# Copyright (c) 1999,2000 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"), # @@ -46,7 +46,7 @@ BEGIN { END { printf "\t{ 0, 0 }};\n" print "" - print "NCURSES_CONST char *keyname(int c)" + print "NCURSES_EXPORT(NCURSES_CONST char *) keyname (int c)" print "{" print "int i;" print "static char name[20];" diff --git a/lib/libcurses/base/MKlib_gen.sh b/lib/libcurses/base/MKlib_gen.sh index 2efe9091a08..ad30cb2b149 100644 --- a/lib/libcurses/base/MKlib_gen.sh +++ b/lib/libcurses/base/MKlib_gen.sh @@ -2,8 +2,8 @@ # # MKlib_gen.sh -- generate sources from curses.h macro definitions # -# $OpenBSD: MKlib_gen.sh,v 1.2 2000/10/08 22:46:58 millert Exp $ -# ($From: MKlib_gen.sh,v 1.12 2000/07/29 16:30:11 tom Exp $) +# $OpenBSD: MKlib_gen.sh,v 1.3 2001/01/22 18:01:36 millert Exp $ +# ($From: MKlib_gen.sh,v 1.13 2000/12/10 00:30:25 tom Exp $) # # The XSI Curses standard requires all curses entry points to exist as # functions, even though many definitions would normally be shadowed @@ -227,7 +227,9 @@ BEGIN { } EOF1 -sed -n -f $ED1 | sed -f $ED2 \ +sed -n -f $ED1 \ +| sed -e 's/NCURSES_EXPORT(\(.*\)) \(.*\) (\(.*\))/\1 \2(\3)/' \ +| sed -f $ED2 \ | $AWK -f $AW1 ) \ | sed \ -e '/^\([a-z_][a-z_]*\) /s//\1 gen_/' >$TMP @@ -256,5 +258,7 @@ BEGIN { | sed -f $ED3 \ | sed \ -e 's/^.*T_CALLED.*returnCode( \([a-z].*) \));/ return \1;/' \ - -e 's/^.*T_CALLED.*returnCode( \((wmove.*) \));/ return \1;/' + -e 's/^.*T_CALLED.*returnCode( \((wmove.*) \));/ return \1;/' \ +| sed \ + -e 's/^\(.*\) \(.*\) (\(.*\))$/NCURSES_EXPORT(\1) \2 (\3)/' diff --git a/lib/libcurses/base/MKunctrl.awk b/lib/libcurses/base/MKunctrl.awk index 2084622303c..ee9423558c5 100644 --- a/lib/libcurses/base/MKunctrl.awk +++ b/lib/libcurses/base/MKunctrl.awk @@ -1,7 +1,7 @@ -# $OpenBSD: MKunctrl.awk,v 1.2 2000/04/04 16:49:59 millert Exp $ -# $From: MKunctrl.awk,v 1.7 2000/04/01 19:49:26 tom Exp $ +# $OpenBSD: MKunctrl.awk,v 1.3 2001/01/22 18:01:36 millert Exp $ +# $From: MKunctrl.awk,v 1.8 2000/12/10 02:25:37 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998,2000 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"), # @@ -40,7 +40,7 @@ BEGIN { print "" } END { - print "NCURSES_CONST char *unctrl(register chtype ch)" + print "NCURSES_EXPORT(NCURSES_CONST char *) unctrl (register chtype ch)" print "{" printf "static const char* const table[] = {" for ( ch = 0; ch < 256; ch++ ) { diff --git a/lib/libcurses/base/define_key.c b/lib/libcurses/base/define_key.c index 97d2b6e9558..5dd6dcda7ea 100644 --- a/lib/libcurses/base/define_key.c +++ b/lib/libcurses/base/define_key.c @@ -1,7 +1,7 @@ -/* $OpenBSD: define_key.c,v 1.3 1999/03/02 06:23:27 millert Exp $ */ +/* $OpenBSD: define_key.c,v 1.4 2001/01/22 18:01:36 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -34,28 +34,29 @@ #include <curses.priv.h> -MODULE_ID("$From: define_key.c,v 1.4 1999/02/21 13:03:55 tom Exp $") +MODULE_ID("$From: define_key.c,v 1.6 2000/12/10 02:43:26 tom Exp $") -int -define_key(char *str, int keycode) +NCURSES_EXPORT(int) +define_key +(char *str, int keycode) { - int code = ERR; + int code = ERR; - T((T_CALLED("define_key(%s,%d)"), _nc_visbuf(str), keycode)); - if (keycode > 0) { - if (str != 0) { - define_key(str, 0); - } else if (has_key(keycode)) { - while (_nc_remove_key(&(SP->_keytry), keycode)) - code = OK; - } - if (str != 0) { - (void) _nc_add_to_try(&(SP->_keytry), str, keycode); - code = OK; - } - } else { - while (_nc_remove_string(&(SP->_keytry), str)) - code = OK; + T((T_CALLED("define_key(%s,%d)"), _nc_visbuf(str), keycode)); + if (keycode > 0) { + if (str != 0) { + define_key(str, 0); + } else if (has_key(keycode)) { + while (_nc_remove_key(&(SP->_keytry), keycode)) + code = OK; } - returnCode(code); + if (str != 0) { + (void) _nc_add_to_try(&(SP->_keytry), str, keycode); + code = OK; + } + } else { + while (_nc_remove_string(&(SP->_keytry), str)) + code = OK; + } + returnCode(code); } diff --git a/lib/libcurses/base/keybound.c b/lib/libcurses/base/keybound.c index c1c8506a4a5..adee55cd0e4 100644 --- a/lib/libcurses/base/keybound.c +++ b/lib/libcurses/base/keybound.c @@ -1,7 +1,7 @@ -/* $OpenBSD: keybound.c,v 1.1 1999/02/24 06:31:07 millert Exp $ */ +/* $OpenBSD: keybound.c,v 1.2 2001/01/22 18:01:36 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 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 * @@ -34,14 +34,15 @@ #include <curses.priv.h> -MODULE_ID("$From: keybound.c,v 1.1 1999/02/19 11:55:56 tom Exp $") +MODULE_ID("$From: keybound.c,v 1.3 2000/12/10 02:43:26 tom Exp $") /* * Returns the count'th string definition which is associated with the * given keycode. The result is malloc'd, must be freed by the caller. */ -char *keybound(int code, int count) +NCURSES_EXPORT(char *) +keybound(int code, int count) { - return _nc_expand_try(SP->_key_ok, code, &count, 0); + return _nc_expand_try(SP->_key_ok, code, &count, 0); } diff --git a/lib/libcurses/base/keyok.c b/lib/libcurses/base/keyok.c index 24736fe8d93..5e4b5880e86 100644 --- a/lib/libcurses/base/keyok.c +++ b/lib/libcurses/base/keyok.c @@ -1,7 +1,7 @@ -/* $OpenBSD: keyok.c,v 1.2 1999/02/24 06:31:08 millert Exp $ */ +/* $OpenBSD: keyok.c,v 1.3 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -34,7 +34,7 @@ #include <curses.priv.h> -MODULE_ID("$From: keyok.c,v 1.3 1999/02/19 11:29:48 tom Exp $") +MODULE_ID("$From: keyok.c,v 1.5 2000/12/10 02:43:26 tom Exp $") /* * Enable (or disable) ncurses' interpretation of a keycode by adding (or @@ -46,29 +46,30 @@ MODULE_ID("$From: keyok.c,v 1.3 1999/02/19 11:29:48 tom Exp $") * corresponding tree. */ -int keyok(int c, bool flag) +NCURSES_EXPORT(int) +keyok(int c, bool flag) { - int code = ERR; - int count = 0; - char *s; + int code = ERR; + int count = 0; + char *s; - T((T_CALLED("keyok(%d,%d)"), c, flag)); - if (flag) { - while ((s = _nc_expand_try(SP->_key_ok, c, &count, 0)) != 0 - && _nc_remove_key(&(SP->_key_ok), c)) { - _nc_add_to_try(&(SP->_keytry), s, c); - free(s); - code = OK; - count = 0; - } - } else { - while ((s = _nc_expand_try(SP->_keytry, c, &count, 0)) != 0 - && _nc_remove_key(&(SP->_keytry), c)) { - _nc_add_to_try(&(SP->_key_ok), s, c); - free(s); - code = OK; - count = 0; - } + T((T_CALLED("keyok(%d,%d)"), c, flag)); + if (flag) { + while ((s = _nc_expand_try(SP->_key_ok, c, &count, 0)) != 0 + && _nc_remove_key(&(SP->_key_ok), c)) { + _nc_add_to_try(&(SP->_keytry), s, c); + free(s); + code = OK; + count = 0; } - returnCode(code); + } else { + while ((s = _nc_expand_try(SP->_keytry, c, &count, 0)) != 0 + && _nc_remove_key(&(SP->_keytry), c)) { + _nc_add_to_try(&(SP->_key_ok), s, c); + free(s); + code = OK; + count = 0; + } + } + returnCode(code); } diff --git a/lib/libcurses/base/lib_addch.c b/lib/libcurses/base/lib_addch.c index 43dc5aca13b..4408a6cc43c 100644 --- a/lib/libcurses/base/lib_addch.c +++ b/lib/libcurses/base/lib_addch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_addch.c,v 1.3 2000/06/19 03:53:38 millert Exp $ */ +/* $OpenBSD: lib_addch.c,v 1.4 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -43,7 +43,7 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$From: lib_addch.c,v 1.44 2000/05/20 21:13:11 tom Exp $") +MODULE_ID("$From: lib_addch.c,v 1.47 2000/12/10 02:43:26 tom Exp $") /* * Ugly microtweaking alert. Everything from here to end of module is @@ -75,20 +75,22 @@ render_char(WINDOW *win, chtype ch) } TR(TRACE_VIRTPUT, ("bkg = %lx, attrs = %lx -> ch = %lx", win->_bkgd, - win->_attrs, ch)); + win->_attrs, ch)); return (ch); } -chtype -_nc_background(WINDOW *win) +NCURSES_EXPORT(chtype) +_nc_background +(WINDOW *win) /* make render_char() visible while still allowing us to inline it below */ { return (win->_bkgd); } -chtype -_nc_render(WINDOW *win, chtype ch) +NCURSES_EXPORT(chtype) +_nc_render +(WINDOW *win, chtype ch) /* make render_char() visible while still allowing us to inline it below */ { return render_char(win, ch); @@ -124,7 +126,7 @@ waddch_literal(WINDOW *win, chtype ch) * If we're trying to add a character at the lower-right corner more * than once, fail. (Moving the cursor will clear the flag). */ -#if 0 /* Solaris 2.6 allows updating the corner more than once */ +#if 0 /* Solaris 2.6 allows updating the corner more than once */ if (win->_flags & _WRAPPED) { if (x >= win->_maxx) return (ERR); @@ -173,7 +175,7 @@ waddch_nosync(WINDOW *win, const chtype ch) /* the workhorse function -- add a character to the given window */ { int x, y; - int t = 0; + chtype t = 0; const char *s = 0; if ((ch & A_ALTCHARSET) @@ -248,8 +250,9 @@ waddch_nosync(WINDOW *win, const chtype ch) return (OK); } -int -_nc_waddch_nosync(WINDOW *win, const chtype c) +NCURSES_EXPORT(int) +_nc_waddch_nosync +(WINDOW *win, const chtype c) /* export copy of waddch_nosync() so the string-put functions can use it */ { return (waddch_nosync(win, c)); @@ -263,13 +266,14 @@ _nc_waddch_nosync(WINDOW *win, const chtype c) /* These are actual entry points */ -int -waddch(WINDOW *win, const chtype ch) +NCURSES_EXPORT(int) +waddch +(WINDOW *win, const chtype ch) { int code = ERR; TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("waddch(%p, %s)"), win, - _tracechtype(ch))); + _tracechtype(ch))); if (win && (waddch_nosync(win, ch) != ERR)) { _nc_synchook(win); @@ -280,13 +284,14 @@ waddch(WINDOW *win, const chtype ch) return (code); } -int -wechochar(WINDOW *win, const chtype ch) +NCURSES_EXPORT(int) +wechochar +(WINDOW *win, const chtype ch) { int code = ERR; TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), win, - _tracechtype(ch))); + _tracechtype(ch))); if (win && (waddch_nosync(win, ch) != ERR)) { bool save_immed = win->_immed; diff --git a/lib/libcurses/base/lib_addstr.c b/lib/libcurses/base/lib_addstr.c index 99d76a18aa8..79e9f9eec87 100644 --- a/lib/libcurses/base/lib_addstr.c +++ b/lib/libcurses/base/lib_addstr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_addstr.c,v 1.3 2000/10/08 22:46:58 millert Exp $ */ +/* $OpenBSD: lib_addstr.c,v 1.4 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,10 +42,11 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_addstr.c,v 1.18 2000/07/29 16:42:41 tom Exp $") +MODULE_ID("$From: lib_addstr.c,v 1.19 2000/12/10 01:24:50 tom Exp $") -int -waddnstr(WINDOW *win, const char *const astr, int n) +NCURSES_EXPORT(int) +waddnstr +(WINDOW *win, const char *const astr, int n) { unsigned const char *str = (unsigned const char *) astr; int code = ERR; @@ -72,8 +73,9 @@ waddnstr(WINDOW *win, const char *const astr, int n) returnCode(code); } -int -waddchnstr(WINDOW *win, const chtype * const astr, int n) +NCURSES_EXPORT(int) +waddchnstr +(WINDOW *win, const chtype * const astr, int n) { NCURSES_SIZE_T y = win->_cury; NCURSES_SIZE_T x = win->_curx; diff --git a/lib/libcurses/base/lib_beep.c b/lib/libcurses/base/lib_beep.c index 071eec1b2e3..fa30974bbeb 100644 --- a/lib/libcurses/base/lib_beep.c +++ b/lib/libcurses/base/lib_beep.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_beep.c,v 1.2 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: lib_beep.c,v 1.3 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* * beep.c * @@ -42,9 +41,9 @@ */ #include <curses.priv.h> -#include <term.h> /* beep, flash */ +#include <term.h> /* beep, flash */ -MODULE_ID("$From: lib_beep.c,v 1.7 1999/10/22 21:39:09 tom Exp $") +MODULE_ID("$From: lib_beep.c,v 1.9 2000/12/10 02:43:26 tom Exp $") /* * beep() @@ -54,22 +53,23 @@ MODULE_ID("$From: lib_beep.c,v 1.7 1999/10/22 21:39:09 tom Exp $") * */ -int beep(void) +NCURSES_EXPORT(int) +beep(void) { - int res = ERR; + int res = ERR; - T((T_CALLED("beep()"))); + T((T_CALLED("beep()"))); - /* FIXME: should make sure that we are not in altchar mode */ - if (bell) { - TPUTS_TRACE("bell"); - res = putp(bell); - _nc_flush(); - } else if (flash_screen) { - TPUTS_TRACE("flash_screen"); - res = putp(flash_screen); - _nc_flush(); - } + /* FIXME: should make sure that we are not in altchar mode */ + if (bell) { + TPUTS_TRACE("bell"); + res = putp(bell); + _nc_flush(); + } else if (flash_screen) { + TPUTS_TRACE("flash_screen"); + res = putp(flash_screen); + _nc_flush(); + } - returnCode(res); + returnCode(res); } diff --git a/lib/libcurses/base/lib_bkgd.c b/lib/libcurses/base/lib_bkgd.c index eacb4c36510..88a7461eb0e 100644 --- a/lib/libcurses/base/lib_bkgd.c +++ b/lib/libcurses/base/lib_bkgd.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_bkgd.c,v 1.1 1999/01/18 19:09:36 millert Exp $ */ +/* $OpenBSD: lib_bkgd.c,v 1.2 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,54 +35,56 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_bkgd.c,v 1.12 1998/02/11 12:13:54 tom Exp $") +MODULE_ID("$From: lib_bkgd.c,v 1.14 2000/12/10 02:43:26 tom Exp $") -void wbkgdset(WINDOW *win, chtype ch) +NCURSES_EXPORT(void) +wbkgdset(WINDOW *win, chtype ch) { - T((T_CALLED("wbkgdset(%p,%s)"), win, _tracechtype(ch))); - - if (win) { - chtype off = AttrOf(win->_bkgd); - chtype on = AttrOf(ch); - - toggle_attr_off(win->_attrs,off); - toggle_attr_on (win->_attrs,on); - - if (TextOf(ch)==0) - ch |= BLANK; - win->_bkgd = ch; - } - returnVoid; + T((T_CALLED("wbkgdset(%p,%s)"), win, _tracechtype(ch))); + + if (win) { + chtype off = AttrOf(win->_bkgd); + chtype on = AttrOf(ch); + + toggle_attr_off(win->_attrs, off); + toggle_attr_on(win->_attrs, on); + + if (TextOf(ch) == 0) + ch |= BLANK; + win->_bkgd = ch; + } + returnVoid; } -int wbkgd(WINDOW *win, const chtype ch) +NCURSES_EXPORT(int) +wbkgd(WINDOW *win, const chtype ch) { - int code = ERR; - int x, y; - chtype new_bkgd = ch; + int code = ERR; + int x, y; + chtype new_bkgd = ch; + + T((T_CALLED("wbkgd(%p,%s)"), win, _tracechtype(new_bkgd))); - T((T_CALLED("wbkgd(%p,%s)"), win, _tracechtype(new_bkgd))); + if (win) { + chtype old_bkgd = getbkgd(win); - if (win) { - chtype old_bkgd = getbkgd(win); + wbkgdset(win, new_bkgd); + wattrset(win, AttrOf(win->_bkgd)); - wbkgdset(win, new_bkgd); - wattrset(win, AttrOf(win->_bkgd)); - - for (y = 0; y <= win->_maxy; y++) { - for (x = 0; x <= win->_maxx; x++) { - if (win->_line[y].text[x] == old_bkgd) - win->_line[y].text[x] = win->_bkgd; - else - win->_line[y].text[x] = - _nc_render(win,(A_ALTCHARSET & - AttrOf(win->_line[y].text[x])) - | TextOf(win->_line[y].text[x])); - } + for (y = 0; y <= win->_maxy; y++) { + for (x = 0; x <= win->_maxx; x++) { + if (win->_line[y].text[x] == old_bkgd) + win->_line[y].text[x] = win->_bkgd; + else + win->_line[y].text[x] = + _nc_render(win, (A_ALTCHARSET & + AttrOf(win->_line[y].text[x])) + | TextOf(win->_line[y].text[x])); + } + } + touchwin(win); + _nc_synchook(win); + code = OK; } - touchwin(win); - _nc_synchook(win); - code = OK; - } - returnCode(code); + returnCode(code); } diff --git a/lib/libcurses/base/lib_box.c b/lib/libcurses/base/lib_box.c index 0593b769e4e..f97ee247c99 100644 --- a/lib/libcurses/base/lib_box.c +++ b/lib/libcurses/base/lib_box.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_box.c,v 1.2 2000/06/19 03:53:39 millert Exp $ */ +/* $OpenBSD: lib_box.c,v 1.3 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -42,26 +42,27 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_box.c,v 1.11 2000/04/29 21:12:37 tom Exp $") +MODULE_ID("$From: lib_box.c,v 1.13 2000/12/10 02:43:26 tom Exp $") -int -wborder(WINDOW *win, - chtype ls, chtype rs, chtype ts, chtype bs, - chtype tl, chtype tr, chtype bl, chtype br) +NCURSES_EXPORT(int) +wborder +(WINDOW *win, + chtype ls, chtype rs, chtype ts, chtype bs, + chtype tl, chtype tr, chtype bl, chtype br) { NCURSES_SIZE_T i; NCURSES_SIZE_T endx, endy; T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"), - win, - _tracechtype2(1, ls), - _tracechtype2(2, rs), - _tracechtype2(3, ts), - _tracechtype2(4, bs), - _tracechtype2(5, tl), - _tracechtype2(6, tr), - _tracechtype2(7, bl), - _tracechtype2(8, br))); + win, + _tracechtype2(1, ls), + _tracechtype2(2, rs), + _tracechtype2(3, ts), + _tracechtype2(4, bs), + _tracechtype2(5, tl), + _tracechtype2(6, tr), + _tracechtype2(7, bl), + _tracechtype2(8, br))); if (!win) returnCode(ERR); @@ -93,7 +94,7 @@ wborder(WINDOW *win, br = _nc_render(win, br); T(("using %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx", - ls, rs, ts, bs, tl, tr, bl, br)); + ls, rs, ts, bs, tl, tr, bl, br)); endx = win->_maxx; endy = win->_maxy; diff --git a/lib/libcurses/base/lib_chgat.c b/lib/libcurses/base/lib_chgat.c index 1ed997d1499..d48c9aba297 100644 --- a/lib/libcurses/base/lib_chgat.c +++ b/lib/libcurses/base/lib_chgat.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_chgat.c,v 1.1 1999/01/18 19:09:37 millert Exp $ */ +/* $OpenBSD: lib_chgat.c,v 1.2 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,23 +42,24 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_chgat.c,v 1.2 1998/02/11 12:14:00 tom Exp $") +MODULE_ID("$From: lib_chgat.c,v 1.4 2000/12/10 02:43:26 tom Exp $") -int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED) +NCURSES_EXPORT(int) +wchgat +(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED) { - int i; + int i; T((T_CALLED("wchgat(%p,%d,%s,%d)"), win, n, _traceattr(attr), color)); if (win) { - toggle_attr_on(attr,COLOR_PAIR(color)); + toggle_attr_on(attr, COLOR_PAIR(color)); - for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) - win->_line[win->_cury].text[i] - = TextOf(win->_line[win->_cury].text[i]) | attr; + for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) + win->_line[win->_cury].text[i] + = TextOf(win->_line[win->_cury].text[i]) | attr; - returnCode(OK); - } - else - returnCode(ERR); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_clear.c b/lib/libcurses/base/lib_clear.c index c668ea1c42b..6cb0a2f7929 100644 --- a/lib/libcurses/base/lib_clear.c +++ b/lib/libcurses/base/lib_clear.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_clear.c,v 1.1 1999/01/18 19:09:38 millert Exp $ */ +/* $OpenBSD: lib_clear.c,v 1.2 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,16 +42,17 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_clear.c,v 1.5 1998/02/11 12:13:53 tom Exp $") +MODULE_ID("$From: lib_clear.c,v 1.7 2000/12/10 02:43:26 tom Exp $") -int wclear(WINDOW *win) +NCURSES_EXPORT(int) +wclear(WINDOW *win) { -int code = ERR; + int code = ERR; - T((T_CALLED("wclear(%p)"), win)); + T((T_CALLED("wclear(%p)"), win)); - if ((code = werase(win))!=ERR) - win->_clear = TRUE; - - returnCode(code); + if ((code = werase(win)) != ERR) + win->_clear = TRUE; + + returnCode(code); } diff --git a/lib/libcurses/base/lib_clearok.c b/lib/libcurses/base/lib_clearok.c index 3c51e6fac99..ccf11335497 100644 --- a/lib/libcurses/base/lib_clearok.c +++ b/lib/libcurses/base/lib_clearok.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_clearok.c,v 1.1 1999/01/18 19:09:38 millert Exp $ */ +/* $OpenBSD: lib_clearok.c,v 1.2 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* ** lib_clearok.c ** @@ -43,16 +42,16 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_clearok.c,v 1.2 1998/02/11 12:14:00 tom Exp $") +MODULE_ID("$From: lib_clearok.c,v 1.4 2000/12/10 02:43:26 tom Exp $") -int clearok(WINDOW *win, bool flag) +NCURSES_EXPORT(int) +clearok(WINDOW *win, bool flag) { - T((T_CALLED("clearok(%p,%d)"), win, flag)); + T((T_CALLED("clearok(%p,%d)"), win, flag)); - if (win) { - win->_clear = flag; - returnCode(OK); - } - else - returnCode(ERR); + if (win) { + win->_clear = flag; + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_clrbot.c b/lib/libcurses/base/lib_clrbot.c index 683b4f923d6..c947b668613 100644 --- a/lib/libcurses/base/lib_clrbot.c +++ b/lib/libcurses/base/lib_clrbot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_clrbot.c,v 1.2 2000/06/19 03:53:39 millert Exp $ */ +/* $OpenBSD: lib_clrbot.c,v 1.3 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_clrbot.c,v 1.15 2000/04/29 21:15:26 tom Exp $") +MODULE_ID("$From: lib_clrbot.c,v 1.17 2000/12/10 02:43:26 tom Exp $") -int +NCURSES_EXPORT(int) wclrtobot(WINDOW *win) { int code = ERR; @@ -57,7 +57,7 @@ wclrtobot(WINDOW *win) chtype blank = _nc_background(win); T(("clearing from y = %d to y = %d with maxx = %d", - win->_cury, win->_maxy, win->_maxx)); + win->_cury, win->_maxy, win->_maxx)); for (y = win->_cury; y <= win->_maxy; y++) { struct ldat *line = &(win->_line[y]); diff --git a/lib/libcurses/base/lib_clreol.c b/lib/libcurses/base/lib_clreol.c index 29c417f5ed3..7c00cd16d5b 100644 --- a/lib/libcurses/base/lib_clreol.c +++ b/lib/libcurses/base/lib_clreol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_clreol.c,v 1.2 2000/06/19 03:53:40 millert Exp $ */ +/* $OpenBSD: lib_clreol.c,v 1.3 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_clreol.c,v 1.16 2000/04/29 21:14:54 tom Exp $") +MODULE_ID("$From: lib_clreol.c,v 1.19 2000/12/10 02:43:26 tom Exp $") -int +NCURSES_EXPORT(int) wclrtoeol(WINDOW *win) { int code = ERR; @@ -62,7 +62,7 @@ wclrtoeol(WINDOW *win) * If we have just wrapped the cursor, the clear applies to the * new line, unless we are at the lower right corner. */ - if (win->_flags & _WRAPPED + if ((win->_flags & _WRAPPED) != 0 && y < win->_maxy) { win->_flags &= ~_WRAPPED; } @@ -71,7 +71,7 @@ wclrtoeol(WINDOW *win) * There's no point in clearing if we're not on a legal * position, either. */ - if (win->_flags & _WRAPPED + if ((win->_flags & _WRAPPED) != 0 || y > win->_maxy || x > win->_maxx) returnCode(ERR); diff --git a/lib/libcurses/base/lib_color.c b/lib/libcurses/base/lib_color.c index 952698083d0..06b88fe43e5 100644 --- a/lib/libcurses/base/lib_color.c +++ b/lib/libcurses/base/lib_color.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_color.c,v 1.9 2000/10/08 22:46:58 millert Exp $ */ +/* $OpenBSD: lib_color.c,v 1.10 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -43,15 +43,17 @@ #include <term.h> #include <tic.h> -MODULE_ID("$From: lib_color.c,v 1.53 2000/09/02 18:02:15 tom Exp $") +MODULE_ID("$From: lib_color.c,v 1.55 2000/12/10 02:43:27 tom Exp $") /* * These should be screen structure members. They need to be globals for * historical reasons. So we assign them in start_color() and also in * set_term()'s screen-switching logic. */ -int COLOR_PAIRS = 0; -int COLORS = 0; +NCURSES_EXPORT_VAR(int) +COLOR_PAIRS = 0; +NCURSES_EXPORT_VAR(int) +COLORS = 0; /* * Given a RGB range of 0..1000, we'll normally set the individual values @@ -92,8 +94,8 @@ static const color_t hls_palette[] = * These are called from _nc_do_color(), which in turn is called from * vidattr - so we have to assume that SP may be null. */ -static int -default_fg(void) + static int + default_fg(void) { return (SP != 0) ? SP->_default_fg : COLOR_WHITE; } @@ -113,13 +115,13 @@ default_bg(void) * to maintain compatibility with a pre-ANSI scheme. The same scheme is * also used in the FreeBSD syscons. */ -static int -toggled_colors(int c) + static int + toggled_colors(int c) { if (c < 16) { static const int table[] = {0, 4, 2, 6, 1, 5, 3, 7, - 8, 12, 10, 14, 9, 13, 11, 15}; + 8, 12, 10, 14, 9, 13, 11, 15}; c = table[c]; } return c; @@ -164,7 +166,7 @@ set_original_colors(void) return FALSE; } -int +NCURSES_EXPORT(int) start_color(void) { int n; @@ -258,8 +260,9 @@ rgb2hls(short r, short g, short b, short *h, short *l, short *s) * Extension (1997/1/18) - Allow negative f/b values to set default color * values. */ -int -init_pair(short pair, short f, short b) +NCURSES_EXPORT(int) +init_pair +(short pair, short f, short b) { unsigned result; @@ -321,24 +324,25 @@ init_pair(short pair, short f, short b) const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette; T(("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)", - pair, - tp[f].red, tp[f].green, tp[f].blue, - tp[b].red, tp[b].green, tp[b].blue)); + pair, + tp[f].red, tp[f].green, tp[f].blue, + tp[b].red, tp[b].green, tp[b].blue)); if (initialize_pair) { TPUTS_TRACE("initialize_pair"); putp(tparm(initialize_pair, - pair, - tp[f].red, tp[f].green, tp[f].blue, - tp[b].red, tp[b].green, tp[b].blue)); + pair, + tp[f].red, tp[f].green, tp[f].blue, + tp[b].red, tp[b].green, tp[b].blue)); } } returnCode(OK); } -int -init_color(short color, short r, short g, short b) +NCURSES_EXPORT(int) +init_color +(short color, short r, short g, short b) { T((T_CALLED("init_color(%d,%d,%d,%d)"), color, r, g, b)); @@ -352,9 +356,9 @@ init_color(short color, short r, short g, short b) if (hue_lightness_saturation) rgb2hls(r, g, b, - &SP->_color_table[color].red, - &SP->_color_table[color].green, - &SP->_color_table[color].blue); + &SP->_color_table[color].red, + &SP->_color_table[color].green, + &SP->_color_table[color].blue); else { SP->_color_table[color].red = r; SP->_color_table[color].green = g; @@ -368,27 +372,28 @@ init_color(short color, short r, short g, short b) returnCode(OK); } -bool +NCURSES_EXPORT(bool) can_change_color(void) { T((T_CALLED("can_change_color()"))); returnCode((can_change != 0) ? TRUE : FALSE); } -bool +NCURSES_EXPORT(bool) has_colors(void) { T((T_CALLED("has_colors()"))); returnCode((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs) - && (((set_foreground != NULL) - && (set_background != NULL)) - || ((set_a_foreground != NULL) - && (set_a_background != NULL)) - || set_color_pair)) ? TRUE : FALSE); + && (((set_foreground != NULL) + && (set_background != NULL)) + || ((set_a_foreground != NULL) + && (set_a_background != NULL)) + || set_color_pair)) ? TRUE : FALSE); } -int -color_content(short color, short *r, short *g, short *b) +NCURSES_EXPORT(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) @@ -403,8 +408,9 @@ color_content(short color, short *r, short *g, short *b) returnCode(OK); } -int -pair_content(short pair, short *f, short *b) +NCURSES_EXPORT(int) +pair_content +(short pair, short *f, short *b) { T((T_CALLED("pair_content(%d,%p,%p)"), pair, f, b)); @@ -418,8 +424,9 @@ pair_content(short pair, short *f, short *b) returnCode(OK); } -void -_nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) +NCURSES_EXPORT(void) +_nc_do_color +(int old_pair, int pair, bool reverse, int (*outc) (int)) { NCURSES_COLOR_T fg = C_MASK, bg = C_MASK; NCURSES_COLOR_T old_fg, old_bg; @@ -473,7 +480,8 @@ _nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) bg = xx; } - TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg)); + TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair, + fg, bg)); if (fg != C_MASK) { set_foreground_color(fg, outc); diff --git a/lib/libcurses/base/lib_colorset.c b/lib/libcurses/base/lib_colorset.c index 0c03674baab..73cd69e609c 100644 --- a/lib/libcurses/base/lib_colorset.c +++ b/lib/libcurses/base/lib_colorset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_colorset.c,v 1.3 2000/10/08 22:46:58 millert Exp $ */ +/* $OpenBSD: lib_colorset.c,v 1.4 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -42,10 +42,11 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$From: lib_colorset.c,v 1.6 2000/07/29 16:37:19 tom Exp $") +MODULE_ID("$From: lib_colorset.c,v 1.7 2000/12/10 01:24:50 tom Exp $") -int -wcolor_set(WINDOW *win, short color_pair_number, void *opts) +NCURSES_EXPORT(int) +wcolor_set +(WINDOW *win, short color_pair_number, void *opts) { T((T_CALLED("wcolor_set(%p,%d)"), win, color_pair_number)); if (win diff --git a/lib/libcurses/base/lib_delch.c b/lib/libcurses/base/lib_delch.c index 7832e20db1d..d07198c60a4 100644 --- a/lib/libcurses/base/lib_delch.c +++ b/lib/libcurses/base/lib_delch.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_delch.c,v 1.1 1999/01/18 19:09:40 millert Exp $ */ +/* $OpenBSD: lib_delch.c,v 1.2 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,29 +42,30 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_delch.c,v 1.8 1998/06/28 00:28:17 tom Exp $") +MODULE_ID("$From: lib_delch.c,v 1.10 2000/12/10 02:43:27 tom Exp $") -int wdelch(WINDOW *win) +NCURSES_EXPORT(int) +wdelch(WINDOW *win) { -int code = ERR; + int code = ERR; - T((T_CALLED("wdelch(%p)"), win)); + T((T_CALLED("wdelch(%p)"), win)); - if (win) { - chtype blank = _nc_background(win); - struct ldat *line = &(win->_line[win->_cury]); - chtype *end = &(line->text[win->_maxx]); - chtype *temp2 = &(line->text[win->_curx + 1]); - chtype *temp1 = temp2 - 1; + if (win) { + chtype blank = _nc_background(win); + struct ldat *line = &(win->_line[win->_cury]); + chtype *end = &(line->text[win->_maxx]); + chtype *temp2 = &(line->text[win->_curx + 1]); + chtype *temp1 = temp2 - 1; - CHANGED_TO_EOL(line, win->_curx, win->_maxx); - while (temp1 < end) - *temp1++ = *temp2++; + CHANGED_TO_EOL(line, win->_curx, win->_maxx); + while (temp1 < end) + *temp1++ = *temp2++; - *temp1 = blank; + *temp1 = blank; - _nc_synchook(win); - code = OK; - } - returnCode(code); + _nc_synchook(win); + code = OK; + } + returnCode(code); } diff --git a/lib/libcurses/base/lib_delwin.c b/lib/libcurses/base/lib_delwin.c index 0ef17261a65..5358ae94f00 100644 --- a/lib/libcurses/base/lib_delwin.c +++ b/lib/libcurses/base/lib_delwin.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_delwin.c,v 1.1 1999/01/18 19:09:41 millert Exp $ */ +/* $OpenBSD: lib_delwin.c,v 1.2 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,33 +42,39 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_delwin.c,v 1.9 1998/02/11 12:13:53 tom Exp $") +MODULE_ID("$From: lib_delwin.c,v 1.12 2000/12/10 02:43:27 tom Exp $") -static bool have_children(WINDOW *win) +static bool +cannot_delete(WINDOW *win) { - WINDOWLIST *p; - for (p = _nc_windows; p != 0; p = p->next) { - if (p->win->_flags & _SUBWIN - && p->win->_parent == win) - return TRUE; + WINDOWLIST *p; + bool result = TRUE; + + for (p = _nc_windows; p != 0; p = p->next) { + if (p->win == win) { + result = FALSE; + } else if ((p->win->_flags & _SUBWIN) != 0 + && p->win->_parent == win) { + result = TRUE; + break; } - return FALSE; + } + return result; } -int delwin(WINDOW *win) +NCURSES_EXPORT(int) +delwin(WINDOW *win) { - T((T_CALLED("delwin(%p)"), win)); - - if (win == 0 - || have_children(win)) - returnCode(ERR); + T((T_CALLED("delwin(%p)"), win)); - if (win->_flags & _SUBWIN) - touchwin(win->_parent); - else if (curscr != 0) - touchwin(curscr); + if (win == 0 + || cannot_delete(win)) + returnCode(ERR); - _nc_freewin(win); + if (win->_flags & _SUBWIN) + touchwin(win->_parent); + else if (curscr != 0) + touchwin(curscr); - returnCode(OK); + returnCode(_nc_freewin(win)); } diff --git a/lib/libcurses/base/lib_dft_fgbg.c b/lib/libcurses/base/lib_dft_fgbg.c index 3604fc151f0..45aeac0c4dd 100644 --- a/lib/libcurses/base/lib_dft_fgbg.c +++ b/lib/libcurses/base/lib_dft_fgbg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_dft_fgbg.c,v 1.6 2000/07/10 03:06:12 millert Exp $ */ +/* $OpenBSD: lib_dft_fgbg.c,v 1.7 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -35,13 +35,13 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: lib_dft_fgbg.c,v 1.13 2000/07/07 16:50:27 tom Exp $") +MODULE_ID("$From: lib_dft_fgbg.c,v 1.15 2000/12/10 02:43:27 tom Exp $") /* * Modify the behavior of color-pair 0 so that the library doesn't assume that * it is white on black. This is an extension to XSI curses. */ -int +NCURSES_EXPORT(int) use_default_colors(void) { T((T_CALLED("use_default_colors()"))); @@ -52,7 +52,7 @@ use_default_colors(void) * Modify the behavior of color-pair 0 so that the library assumes that it * is something specific, possibly not white on black. */ -int +NCURSES_EXPORT(int) assume_default_colors(int fg, int bg) { T((T_CALLED("assume_default_colors(%d,%d)"), fg, bg)); diff --git a/lib/libcurses/base/lib_echo.c b/lib/libcurses/base/lib_echo.c index 5ca72d31a42..6f101ba3399 100644 --- a/lib/libcurses/base/lib_echo.c +++ b/lib/libcurses/base/lib_echo.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_echo.c,v 1.1 1999/01/18 19:09:42 millert Exp $ */ +/* $OpenBSD: lib_echo.c,v 1.2 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* * echo.c * @@ -45,18 +44,20 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_echo.c,v 1.3 1998/10/12 13:15:33 Alexander.V.Lukyanov Exp $") +MODULE_ID("$From: lib_echo.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int echo(void) +NCURSES_EXPORT(int) +echo(void) { - T((T_CALLED("echo()"))); - SP->_echo = TRUE; - returnCode(OK); + T((T_CALLED("echo()"))); + SP->_echo = TRUE; + returnCode(OK); } -int noecho(void) +NCURSES_EXPORT(int) +noecho(void) { - T((T_CALLED("noecho()"))); - SP->_echo = FALSE; - returnCode(OK); + T((T_CALLED("noecho()"))); + SP->_echo = FALSE; + returnCode(OK); } diff --git a/lib/libcurses/base/lib_endwin.c b/lib/libcurses/base/lib_endwin.c index 1a6614a3ebc..971bc9a06c8 100644 --- a/lib/libcurses/base/lib_endwin.c +++ b/lib/libcurses/base/lib_endwin.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_endwin.c,v 1.2 1999/06/14 02:29:15 millert Exp $ */ +/* $OpenBSD: lib_endwin.c,v 1.3 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* ** lib_endwin.c ** @@ -44,20 +43,20 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: lib_endwin.c,v 1.17 1999/06/12 23:01:46 tom Exp $") +MODULE_ID("$From: lib_endwin.c,v 1.19 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) endwin(void) { - T((T_CALLED("endwin()"))); + T((T_CALLED("endwin()"))); - if (SP) { - SP->_endwin = TRUE; - SP->_mouse_wrap(SP); - _nc_screen_wrap(); - _nc_mvcur_wrap(); /* wrap up cursor addressing */ - returnCode(reset_shell_mode()); - } + if (SP) { + SP->_endwin = TRUE; + SP->_mouse_wrap(SP); + _nc_screen_wrap(); + _nc_mvcur_wrap(); /* wrap up cursor addressing */ + returnCode(reset_shell_mode()); + } - returnCode(ERR); + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_erase.c b/lib/libcurses/base/lib_erase.c index e341ed6064e..44e51e8ce27 100644 --- a/lib/libcurses/base/lib_erase.c +++ b/lib/libcurses/base/lib_erase.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_erase.c,v 1.1 1999/01/18 19:09:42 millert Exp $ */ +/* $OpenBSD: lib_erase.c,v 1.2 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* ** lib_erase.c ** @@ -43,33 +42,34 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_erase.c,v 1.11 1998/02/11 12:13:54 tom Exp $") +MODULE_ID("$From: lib_erase.c,v 1.13 2000/12/10 02:43:27 tom Exp $") -int werase(WINDOW *win) +NCURSES_EXPORT(int) +werase(WINDOW *win) { -int code = ERR; -int y; -chtype blank; -chtype *sp, *end, *start; + int code = ERR; + int y; + chtype blank; + chtype *sp, *end, *start; - T((T_CALLED("werase(%p)"), win)); + T((T_CALLED("werase(%p)"), win)); - if (win) { - blank = _nc_background(win); - for (y = 0; y <= win->_maxy; y++) { + if (win) { + blank = _nc_background(win); + for (y = 0; y <= win->_maxy; y++) { start = win->_line[y].text; end = &start[win->_maxx]; - + for (sp = start; sp <= end; sp++) - *sp = blank; - + *sp = blank; + win->_line[y].firstchar = 0; win->_line[y].lastchar = win->_maxx; - } - win->_curx = win->_cury = 0; - win->_flags &= ~_WRAPPED; - _nc_synchook(win); - code = OK; } - returnCode(code); + win->_curx = win->_cury = 0; + win->_flags &= ~_WRAPPED; + _nc_synchook(win); + code = OK; + } + returnCode(code); } diff --git a/lib/libcurses/base/lib_flash.c b/lib/libcurses/base/lib_flash.c index df42bd6e5cf..fd4c3c07658 100644 --- a/lib/libcurses/base/lib_flash.c +++ b/lib/libcurses/base/lib_flash.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_flash.c,v 1.2 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: lib_flash.c,v 1.3 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* * flash.c * @@ -42,9 +41,9 @@ */ #include <curses.priv.h> -#include <term.h> /* beep, flash */ +#include <term.h> /* beep, flash */ -MODULE_ID("$From: lib_flash.c,v 1.4 1999/10/22 21:39:06 tom Exp $") +MODULE_ID("$From: lib_flash.c,v 1.6 2000/12/10 02:43:27 tom Exp $") /* * flash() @@ -54,22 +53,23 @@ MODULE_ID("$From: lib_flash.c,v 1.4 1999/10/22 21:39:06 tom Exp $") * */ -int flash(void) +NCURSES_EXPORT(int) +flash(void) { - int res = ERR; + int res = ERR; - T((T_CALLED("flash()"))); + T((T_CALLED("flash()"))); - /* FIXME: should make sure that we are not in altchar mode */ - if (flash_screen) { - TPUTS_TRACE("flash_screen"); - res = putp(flash_screen); - _nc_flush(); - } else if (bell) { - TPUTS_TRACE("bell"); - res = putp(bell); - _nc_flush(); - } + /* FIXME: should make sure that we are not in altchar mode */ + if (flash_screen) { + TPUTS_TRACE("flash_screen"); + res = putp(flash_screen); + _nc_flush(); + } else if (bell) { + TPUTS_TRACE("bell"); + res = putp(bell); + _nc_flush(); + } - returnCode(res); + returnCode(res); } diff --git a/lib/libcurses/base/lib_freeall.c b/lib/libcurses/base/lib_freeall.c index 116d0fcb4b7..5fc67234223 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.3 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: lib_freeall.c,v 1.4 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 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,10 +41,10 @@ extern int malloc_errfd; /* FIXME */ #endif -MODULE_ID("$From: lib_freeall.c,v 1.16 1999/11/28 01:34:11 tom Exp $") +MODULE_ID("$From: lib_freeall.c,v 1.18 2000/12/10 02:43:27 tom Exp $") static void -free_slk(SLK *p) +free_slk(SLK * p) { if (p != 0) { FreeIfNeeded(p->ent); @@ -71,7 +71,7 @@ free_tries(struct tries *p) * Free all ncurses data. This is used for testing only (there's no practical * use for it as an extension). */ -void +NCURSES_EXPORT(void) _nc_freeall(void) { WINDOWLIST *p, *q; @@ -126,7 +126,7 @@ _nc_freeall(void) #endif } -void +NCURSES_EXPORT(void) _nc_free_and_exit(int code) { _nc_freeall(); @@ -134,7 +134,7 @@ _nc_free_and_exit(int code) } #else -void +NCURSES_EXPORT(void) _nc_freeall(void) { } diff --git a/lib/libcurses/base/lib_getch.c b/lib/libcurses/base/lib_getch.c index 97cf02ccc55..0b17a36d043 100644 --- a/lib/libcurses/base/lib_getch.c +++ b/lib/libcurses/base/lib_getch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_getch.c,v 1.9 2000/10/22 18:27:22 millert Exp $ */ +/* $OpenBSD: lib_getch.c,v 1.10 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,14 +42,15 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_getch.c,v 1.50 2000/10/09 23:53:57 Ilya.Zakharevich Exp $") +MODULE_ID("$From: lib_getch.c,v 1.54 2000/12/10 02:43:27 tom Exp $") #include <fifo_defs.h> -int ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */ +NCURSES_EXPORT_VAR(int) +ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */ -static inline int -fifo_peek(void) + static inline int + fifo_peek(void) { int ch = SP->_fifo[peek]; TR(TRACE_IEVENT, ("peeking at %d", peek)); @@ -82,7 +83,7 @@ static inline int fifo_push(void) { int n; - unsigned int ch; + int ch; if (tail == -1) return ERR; @@ -103,7 +104,7 @@ fifo_push(void) { unsigned char c2 = 0; n = read(SP->_ifd, &c2, 1); - ch = c2 & 0xff; + ch = CharOf(c2); } #ifdef HIDE_EINTR @@ -155,7 +156,7 @@ static int kgetch(WINDOW *); (is_wintouched(win) || (win->_flags & _HASMOVED)) \ && !(win->_flags & _ISPAD)) -int +NCURSES_EXPORT(int) wgetch(WINDOW *win) { int ch; @@ -237,8 +238,8 @@ wgetch(WINDOW *win) } } while (ch == KEY_MOUSE - && (_nc_timed_wait(3, SP->_maxclick, (int *) 0) - || !SP->_mouse_parse(runcount))); + && (_nc_timed_wait(3, SP->_maxclick, (int *) 0) + || !SP->_mouse_parse(runcount))); if (runcount > 0 && ch != KEY_MOUSE) { /* mouse event sequence ended by keystroke, push it */ ungetch(ch); @@ -359,7 +360,7 @@ kgetch(WINDOW *win GCC_UNUSED) TR(TRACE_IEVENT, ("ptr is null")); } else TR(TRACE_IEVENT, ("ptr=%p, ch=%d, value=%d", - ptr, ptr->ch, ptr->value)); + ptr, ptr->ch, ptr->value)); #endif /* TRACE */ if (ptr == NULL) diff --git a/lib/libcurses/base/lib_getstr.c b/lib/libcurses/base/lib_getstr.c index 431a60cef5c..0744f96f40e 100644 --- a/lib/libcurses/base/lib_getstr.c +++ b/lib/libcurses/base/lib_getstr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_getstr.c,v 1.1 1999/01/18 19:09:46 millert Exp $ */ +/* $OpenBSD: lib_getstr.c,v 1.2 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* ** lib_getstr.c ** @@ -44,151 +43,153 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: lib_getstr.c,v 1.20 1998/12/20 00:16:01 tom Exp $") +MODULE_ID("$From: lib_getstr.c,v 1.23 2000/12/10 02:43:27 tom Exp $") /* * This wipes out the last character, no matter whether it was a tab, control * or other character, and handles reverse wraparound. */ -static char *WipeOut(WINDOW *win, int y, int x, char *first, char *last, bool echoed) +static char * +WipeOut(WINDOW *win, int y, int x, char *first, char *last, bool echoed) { - if (last > first) { - *--last = '\0'; - if (echoed) { - int y1 = win->_cury; - int x1 = win->_curx; - - wmove(win, y, x); - waddstr(win, first); - getyx(win, y, x); - while (win->_cury < y1 - || (win->_cury == y1 && win->_curx < x1)) - waddch(win, ' '); - - wmove(win, y, x); - } + if (last > first) { + *--last = '\0'; + if (echoed) { + int y1 = win->_cury; + int x1 = win->_curx; + + wmove(win, y, x); + waddstr(win, first); + getyx(win, y, x); + while (win->_cury < y1 + || (win->_cury == y1 && win->_curx < x1)) + waddch(win, (chtype) ' '); + + wmove(win, y, x); } - return last; + } + return last; } -int wgetnstr(WINDOW *win, char *str, int maxlen) +NCURSES_EXPORT(int) +wgetnstr(WINDOW *win, char *str, int maxlen) { -TTY buf; -bool oldnl, oldecho, oldraw, oldcbreak; -char erasec; -char killc; -char *oldstr; -int ch; -int y, x; + TTY buf; + bool oldnl, oldecho, oldraw, oldcbreak; + char erasec; + char killc; + char *oldstr; + int ch; + int y, x; - T((T_CALLED("wgetnstr(%p,%p, %d)"), win, str, maxlen)); + T((T_CALLED("wgetnstr(%p,%p, %d)"), win, str, maxlen)); - if (!win) - returnCode(ERR); + if (!win) + returnCode(ERR); - _nc_get_tty_mode(&buf); + _nc_get_tty_mode(&buf); - oldnl = SP->_nl; - oldecho = SP->_echo; - oldraw = SP->_raw; - oldcbreak = SP->_cbreak; - nl(); - noecho(); - noraw(); - cbreak(); + oldnl = SP->_nl; + oldecho = SP->_echo; + oldraw = SP->_raw; + oldcbreak = SP->_cbreak; + nl(); + noecho(); + noraw(); + cbreak(); - erasec = erasechar(); - killc = killchar(); + erasec = erasechar(); + killc = killchar(); - oldstr = str; - getyx(win, y, x); + oldstr = str; + getyx(win, y, x); - if (is_wintouched(win) || (win->_flags & _HASMOVED)) - wrefresh(win); + if (is_wintouched(win) || (win->_flags & _HASMOVED)) + wrefresh(win); - while ((ch = wgetch(win)) != ERR) { - /* - * Some terminals (the Wyse-50 is the most common) generate - * a \n from the down-arrow key. With this logic, it's the - * user's choice whether to set kcud=\n for wgetch(); - * terminating *getstr() with \n should work either way. - */ - if (ch == '\n' - || ch == '\r' - || ch == KEY_DOWN - || ch == KEY_ENTER) { - if (oldecho == TRUE - && win->_cury == win->_maxy - && win->_scroll) - wechochar(win, '\n'); - break; - } - if (ch == erasec || ch == KEY_LEFT || ch == KEY_BACKSPACE) { - if (str > oldstr) { - str = WipeOut(win, y, x, oldstr, str, oldecho); - } - } else if (ch == killc) { - while (str > oldstr) { - str = WipeOut(win, y, x, oldstr, str, oldecho); - } - } else if (ch >= KEY_MIN - || (maxlen >= 0 && str - oldstr >= maxlen)) { - beep(); - } else { - *str++ = ch; - if (oldecho == TRUE) { - int oldy = win->_cury; - if (waddch(win, ch) == ERR) { - /* - * We can't really use the lower-right - * corner for input, since it'll mess - * up bookkeeping for erases. - */ - win->_flags &= ~_WRAPPED; - waddch(win, ' '); - str = WipeOut(win, y, x, oldstr, str, oldecho); - continue; - } else if (win->_flags & _WRAPPED) { - /* - * If the last waddch forced a wrap & - * scroll, adjust our reference point - * for erasures. - */ - if (win->_scroll - && oldy == win->_maxy - && win->_cury == win->_maxy) { - if (--y <= 0) { - y = 0; - } - } - win->_flags &= ~_WRAPPED; - } - wrefresh(win); + while ((ch = wgetch(win)) != ERR) { + /* + * Some terminals (the Wyse-50 is the most common) generate + * a \n from the down-arrow key. With this logic, it's the + * user's choice whether to set kcud=\n for wgetch(); + * terminating *getstr() with \n should work either way. + */ + if (ch == '\n' + || ch == '\r' + || ch == KEY_DOWN + || ch == KEY_ENTER) { + if (oldecho == TRUE + && win->_cury == win->_maxy + && win->_scroll) + wechochar(win, (chtype) '\n'); + break; + } + if (ch == erasec || ch == KEY_LEFT || ch == KEY_BACKSPACE) { + if (str > oldstr) { + str = WipeOut(win, y, x, oldstr, str, oldecho); + } + } else if (ch == killc) { + while (str > oldstr) { + str = WipeOut(win, y, x, oldstr, str, oldecho); + } + } else if (ch >= KEY_MIN + || (maxlen >= 0 && str - oldstr >= maxlen)) { + beep(); + } else { + *str++ = ch; + if (oldecho == TRUE) { + int oldy = win->_cury; + if (waddch(win, (chtype) ch) == ERR) { + /* + * We can't really use the lower-right + * corner for input, since it'll mess + * up bookkeeping for erases. + */ + win->_flags &= ~_WRAPPED; + waddch(win, (chtype) ' '); + str = WipeOut(win, y, x, oldstr, str, oldecho); + continue; + } else if (win->_flags & _WRAPPED) { + /* + * If the last waddch forced a wrap & + * scroll, adjust our reference point + * for erasures. + */ + if (win->_scroll + && oldy == win->_maxy + && win->_cury == win->_maxy) { + if (--y <= 0) { + y = 0; } + } + win->_flags &= ~_WRAPPED; } + wrefresh(win); + } } + } - win->_curx = 0; - win->_flags &= ~_WRAPPED; - if (win->_cury < win->_maxy) - win->_cury++; - wrefresh(win); + win->_curx = 0; + win->_flags &= ~_WRAPPED; + if (win->_cury < win->_maxy) + win->_cury++; + wrefresh(win); - /* Restore with a single I/O call, to fix minor asymmetry between - * raw/noraw, etc. - */ - SP->_nl = oldnl; - SP->_echo = oldecho; - SP->_raw = oldraw; - SP->_cbreak = oldcbreak; + /* Restore with a single I/O call, to fix minor asymmetry between + * raw/noraw, etc. + */ + SP->_nl = oldnl; + SP->_echo = oldecho; + SP->_raw = oldraw; + SP->_cbreak = oldcbreak; - _nc_set_tty_mode(&buf); + _nc_set_tty_mode(&buf); - *str = '\0'; - if (ch == ERR) - returnCode(ERR); + *str = '\0'; + if (ch == ERR) + returnCode(ERR); - T(("wgetnstr returns %s", _nc_visbuf(oldstr))); + T(("wgetnstr returns %s", _nc_visbuf(oldstr))); - returnCode(OK); + returnCode(OK); } diff --git a/lib/libcurses/base/lib_hline.c b/lib/libcurses/base/lib_hline.c index 1cb06b44664..6854c5a61a1 100644 --- a/lib/libcurses/base/lib_hline.c +++ b/lib/libcurses/base/lib_hline.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_hline.c,v 1.3 2000/07/10 03:06:14 millert Exp $ */ +/* $OpenBSD: lib_hline.c,v 1.4 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_hline.c,v 1.6 2000/07/04 14:08:09 Philippe.Blain Exp $") +MODULE_ID("$From: lib_hline.c,v 1.8 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) whline(WINDOW *win, chtype ch, int n) { int code = ERR; diff --git a/lib/libcurses/base/lib_immedok.c b/lib/libcurses/base/lib_immedok.c index 4bd7234bef6..f5925446e8d 100644 --- a/lib/libcurses/base/lib_immedok.c +++ b/lib/libcurses/base/lib_immedok.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_immedok.c,v 1.1 1999/01/18 19:09:47 millert Exp $ */ +/* $OpenBSD: lib_immedok.c,v 1.2 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* ** lib_immedok.c ** @@ -43,14 +42,15 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_immedok.c,v 1.2 1998/02/11 12:14:01 tom Exp $") +MODULE_ID("$From: lib_immedok.c,v 1.4 2000/12/10 02:43:27 tom Exp $") -void immedok(WINDOW *win, bool flag) +NCURSES_EXPORT(void) +immedok(WINDOW *win, bool flag) { - T((T_CALLED("immedok(%p,%d)"), win, flag)); + T((T_CALLED("immedok(%p,%d)"), win, flag)); - if (win) - win->_immed = flag; + if (win) + win->_immed = flag; - returnVoid; + returnVoid; } diff --git a/lib/libcurses/base/lib_inchstr.c b/lib/libcurses/base/lib_inchstr.c index ee0b93d7332..0965de4ffdb 100644 --- a/lib/libcurses/base/lib_inchstr.c +++ b/lib/libcurses/base/lib_inchstr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_inchstr.c,v 1.1 1999/01/18 19:09:48 millert Exp $ */ +/* $OpenBSD: lib_inchstr.c,v 1.2 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* ** lib_inchstr.c ** @@ -43,22 +42,23 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_inchstr.c,v 1.7 1998/02/11 12:13:55 tom Exp $") +MODULE_ID("$From: lib_inchstr.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -int winchnstr(WINDOW *win, chtype *str, int n) +NCURSES_EXPORT(int) +winchnstr(WINDOW *win, chtype * str, int n) { - int i = 0; + int i = 0; - T((T_CALLED("winchnstr(%p,%p,%d)"), win, str, n)); + T((T_CALLED("winchnstr(%p,%p,%d)"), win, str, n)); - if (!str) - returnCode(0); + if (!str) + returnCode(0); - if (win) { - for (; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++) + if (win) { + for (; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++) str[i] = win->_line[win->_cury].text[win->_curx + i]; - } - str[i] = (chtype)0; + } + str[i] = (chtype) 0; - returnCode(i); + returnCode(i); } diff --git a/lib/libcurses/base/lib_initscr.c b/lib/libcurses/base/lib_initscr.c index 8d179b4bc7e..c3fa8fecbdd 100644 --- a/lib/libcurses/base/lib_initscr.c +++ b/lib/libcurses/base/lib_initscr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_initscr.c,v 1.1 1999/01/18 19:09:48 millert Exp $ */ +/* $OpenBSD: lib_initscr.c,v 1.2 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,40 +41,41 @@ */ #include <curses.priv.h> -#include <tic.h> /* for MAX_ALIAS */ +#include <tic.h> /* for MAX_ALIAS */ #if HAVE_SYS_TERMIO_H -#include <sys/termio.h> /* needed for ISC */ +#include <sys/termio.h> /* needed for ISC */ #endif -MODULE_ID("$From: lib_initscr.c,v 1.26 1998/12/19 23:10:09 tom Exp $") +MODULE_ID("$From: lib_initscr.c,v 1.28 2000/12/10 02:43:27 tom Exp $") -WINDOW *initscr(void) +NCURSES_EXPORT(WINDOW *) +initscr(void) { -static bool initialized = FALSE; -NCURSES_CONST char *name; -int value; + static bool initialized = FALSE; + NCURSES_CONST char *name; + int value; - T((T_CALLED("initscr()"))); - /* Portable applications must not call initscr() more than once */ - if (!initialized) { - initialized = TRUE; + T((T_CALLED("initscr()"))); + /* Portable applications must not call initscr() more than once */ + if (!initialized) { + initialized = TRUE; - if ((name = getenv("TERM")) == 0 - || *name == '\0') - name = "unknown"; - if (newterm(name, stdout, stdin) == 0) { - fprintf(stderr, "Error opening terminal: %s.\n", name); - exit(EXIT_FAILURE); - } - - /* allow user to set maximum escape delay from the environment */ - if ((value = _nc_getenv_num("ESCDELAY")) >= 0) { - ESCDELAY = value; - } + if ((name = getenv("TERM")) == 0 + || *name == '\0') + name = "unknown"; + if (newterm(name, stdout, stdin) == 0) { + fprintf(stderr, "Error opening terminal: %s.\n", name); + exit(EXIT_FAILURE); + } - /* def_shell_mode - done in newterm/_nc_setupscreen */ - def_prog_mode(); + /* allow user to set maximum escape delay from the environment */ + if ((value = _nc_getenv_num("ESCDELAY")) >= 0) { + ESCDELAY = value; } - returnWin(stdscr); + + /* def_shell_mode - done in newterm/_nc_setupscreen */ + def_prog_mode(); + } + returnWin(stdscr); } diff --git a/lib/libcurses/base/lib_insch.c b/lib/libcurses/base/lib_insch.c index dae6ce048ea..5d6ef421df9 100644 --- a/lib/libcurses/base/lib_insch.c +++ b/lib/libcurses/base/lib_insch.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_insch.c,v 1.1 1999/01/18 19:09:49 millert Exp $ */ +/* $OpenBSD: lib_insch.c,v 1.2 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,8 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_insch.c ** @@ -44,26 +42,27 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_insch.c,v 1.10 1998/06/28 00:26:52 tom Exp $") +MODULE_ID("$From: lib_insch.c,v 1.12 2000/12/10 02:43:27 tom Exp $") -int winsch(WINDOW *win, chtype c) +NCURSES_EXPORT(int) +winsch(WINDOW *win, chtype c) { -int code = ERR; + int code = ERR; - T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c))); + T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c))); - if (win) { - struct ldat *line = &(win->_line[win->_cury]); - chtype *end = &(line->text[win->_curx]); - chtype *temp1 = &(line->text[win->_maxx]); - chtype *temp2 = temp1 - 1; + if (win) { + struct ldat *line = &(win->_line[win->_cury]); + chtype *end = &(line->text[win->_curx]); + chtype *temp1 = &(line->text[win->_maxx]); + chtype *temp2 = temp1 - 1; - CHANGED_TO_EOL(line, win->_curx, win->_maxx); - while (temp1 > end) - *temp1-- = *temp2--; + CHANGED_TO_EOL(line, win->_curx, win->_maxx); + while (temp1 > end) + *temp1-- = *temp2--; - *temp1 = _nc_render(win, c); - code = OK; - } - returnCode(code); + *temp1 = _nc_render(win, c); + code = OK; + } + returnCode(code); } diff --git a/lib/libcurses/base/lib_insdel.c b/lib/libcurses/base/lib_insdel.c index 51dcc51124e..9c02cfda019 100644 --- a/lib/libcurses/base/lib_insdel.c +++ b/lib/libcurses/base/lib_insdel.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_insdel.c,v 1.1 1999/01/18 19:09:49 millert Exp $ */ +/* $OpenBSD: lib_insdel.c,v 1.2 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -44,21 +44,22 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_insdel.c,v 1.8 1998/02/11 12:13:55 tom Exp $") +MODULE_ID("$From: lib_insdel.c,v 1.10 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) winsdelln(WINDOW *win, int n) { -int code = ERR; + int code = ERR; - T((T_CALLED("winsdel(%p,%d)"), win, n)); + T((T_CALLED("winsdel(%p,%d)"), win, n)); - if (win) { - if (n != 0) { - _nc_scroll_window(win, -n, win->_cury, win->_maxy, _nc_background(win)); + if (win) { + if (n != 0) { + _nc_scroll_window(win, -n, win->_cury, win->_maxy, + _nc_background(win)); _nc_synchook(win); - } - code = OK; } - returnCode(code); + code = OK; + } + returnCode(code); } diff --git a/lib/libcurses/base/lib_insstr.c b/lib/libcurses/base/lib_insstr.c index 69b1777f172..20ed15f9f60 100644 --- a/lib/libcurses/base/lib_insstr.c +++ b/lib/libcurses/base/lib_insstr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_insstr.c,v 1.3 2000/06/19 03:53:42 millert Exp $ */ +/* $OpenBSD: lib_insstr.c,v 1.4 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -43,9 +43,9 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$From: lib_insstr.c,v 1.14 2000/04/29 21:16:41 tom Exp $") +MODULE_ID("$From: lib_insstr.c,v 1.17 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) winsnstr(WINDOW *win, const char *s, int n) { int code = ERR; @@ -64,7 +64,7 @@ winsnstr(WINDOW *win, const char *s, int n) _nc_waddch_nosync(win, (chtype) (*cp)); else if (is7bits(*cp) && iscntrl(*cp)) { winsch(win, ' ' + (chtype) (*cp)); - winsch(win, '^'); + winsch(win, (chtype) '^'); win->_curx += 2; } else { winsch(win, (chtype) (*cp)); diff --git a/lib/libcurses/base/lib_instr.c b/lib/libcurses/base/lib_instr.c index 78127c403df..8977e40484a 100644 --- a/lib/libcurses/base/lib_instr.c +++ b/lib/libcurses/base/lib_instr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_instr.c,v 1.1 1999/01/18 19:09:50 millert Exp $ */ +/* $OpenBSD: lib_instr.c,v 1.2 2001/01/22 18:01:41 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* ** lib_instr.c ** @@ -43,33 +42,33 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_instr.c,v 1.8 1998/02/11 12:13:54 tom Exp $") +MODULE_ID("$From: lib_instr.c,v 1.10 2000/12/10 02:43:27 tom Exp $") -int winnstr(WINDOW *win, char *str, int n) +NCURSES_EXPORT(int) +winnstr(WINDOW *win, char *str, int n) { - int i=0, row, col; + int i = 0, row, col; + + T((T_CALLED("winnstr(%p,%p,%d)"), win, str, n)); - T((T_CALLED("winnstr(%p,%p,%d)"), win, str, n)); + if (!str) + returnCode(0); - if (!str) - returnCode(0); - - if (win) { - getyx(win, row, col); + if (win) { + getyx(win, row, col); - if (n < 0) + if (n < 0) n = win->_maxx - win->_curx + 1; - for (; i < n;) { + for (; i < n;) { str[i++] = TextOf(win->_line[row].text[col]); if (++col > win->_maxx) { - col = 0; - if (++row > win->_maxy) - break; + col = 0; + if (++row > win->_maxy) + break; } - } } - str[i] = '\0'; /* SVr4 does not seem to count the null */ - returnCode(i); + } + str[i] = '\0'; /* SVr4 does not seem to count the null */ + returnCode(i); } - diff --git a/lib/libcurses/base/lib_isendwin.c b/lib/libcurses/base/lib_isendwin.c index 093bf9311f2..55495476584 100644 --- a/lib/libcurses/base/lib_isendwin.c +++ b/lib/libcurses/base/lib_isendwin.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_isendwin.c,v 1.1 1999/01/18 19:09:51 millert Exp $ */ +/* $OpenBSD: lib_isendwin.c,v 1.2 2001/01/22 18:01:41 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* ** lib_endwin.c ** @@ -43,11 +42,12 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_isendwin.c,v 1.4 1998/04/11 22:52:32 tom Exp $") +MODULE_ID("$From: lib_isendwin.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -bool isendwin(void) +NCURSES_EXPORT(bool) +isendwin(void) { - if (SP == NULL) - return FALSE; - return SP->_endwin; + if (SP == NULL) + return FALSE; + return SP->_endwin; } diff --git a/lib/libcurses/base/lib_leaveok.c b/lib/libcurses/base/lib_leaveok.c index f89eb5eb35b..a496d226c42 100644 --- a/lib/libcurses/base/lib_leaveok.c +++ b/lib/libcurses/base/lib_leaveok.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_leaveok.c,v 1.1 1999/01/18 19:09:51 millert Exp $ */ +/* $OpenBSD: lib_leaveok.c,v 1.2 2001/01/22 18:01:41 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* ** lib_leaveok.c ** @@ -43,16 +42,16 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_leaveok.c,v 1.3 1998/03/21 22:54:20 jtc Exp $") +MODULE_ID("$From: lib_leaveok.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int leaveok(WINDOW *win, bool flag) +NCURSES_EXPORT(int) +leaveok(WINDOW *win, bool flag) { - T((T_CALLED("leaveok(%p,%d)"), win, flag)); + T((T_CALLED("leaveok(%p,%d)"), win, flag)); - if (win) { - win->_leaveok = flag; - returnCode(OK); - } - else - returnCode(ERR); + if (win) { + win->_leaveok = flag; + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_mouse.c b/lib/libcurses/base/lib_mouse.c index 28546dc0853..a6108e32517 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.12 2000/10/22 18:27:22 millert Exp $ */ +/* $OpenBSD: lib_mouse.c,v 1.13 2001/01/22 18:01:41 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -86,7 +86,7 @@ #endif #endif -MODULE_ID("$From: lib_mouse.c,v 1.55 2000/10/10 00:07:28 Ilya.Zakharevich Exp $") +MODULE_ID("$From: lib_mouse.c,v 1.57 2000/12/10 02:43:27 tom Exp $") #define MY_TRACE TRACE_ICALLS|TRACE_IEVENT @@ -867,7 +867,7 @@ _nc_mouse_resume(SCREEN * sp GCC_UNUSED) * **************************************************************************/ -int +NCURSES_EXPORT(int) getmouse(MEVENT * aevent) /* grab a copy of the current mouse event */ { @@ -890,7 +890,7 @@ getmouse(MEVENT * aevent) returnCode(ERR); } -int +NCURSES_EXPORT(int) ungetmouse(MEVENT * aevent) /* enqueue a synthesized mouse event to be seen by the next wgetch() */ { @@ -904,7 +904,7 @@ ungetmouse(MEVENT * aevent) return ungetch(KEY_MOUSE); } -mmask_t +NCURSES_EXPORT(mmask_t) mousemask(mmask_t newmask, mmask_t * oldmask) /* set the mouse event mask */ { @@ -937,7 +937,7 @@ mousemask(mmask_t newmask, mmask_t * oldmask) returnCode(result); } -bool +NCURSES_EXPORT(bool) wenclose(const WINDOW *win, int y, int x) /* check to see if given window encloses given screen location */ { @@ -951,7 +951,7 @@ wenclose(const WINDOW *win, int y, int x) return FALSE; } -int +NCURSES_EXPORT(int) mouseinterval(int maxclick) /* set the maximum mouse interval within which to recognize a click */ { @@ -970,14 +970,15 @@ mouseinterval(int maxclick) /* This may be used by other routines to ask for the existence of mouse support */ -int +NCURSES_EXPORT(int) _nc_has_mouse(void) { return (mousetype == M_NONE ? 0 : 1); } -bool -wmouse_trafo(const WINDOW *win, int *pY, int *pX, bool to_screen) +NCURSES_EXPORT(bool) +wmouse_trafo +(const WINDOW *win, int *pY, int *pX, bool to_screen) { bool result = FALSE; diff --git a/lib/libcurses/base/lib_move.c b/lib/libcurses/base/lib_move.c index ce700863e59..629dacbd719 100644 --- a/lib/libcurses/base/lib_move.c +++ b/lib/libcurses/base/lib_move.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_move.c,v 1.2 2000/06/19 03:53:43 millert Exp $ */ +/* $OpenBSD: lib_move.c,v 1.3 2001/01/22 18:01:41 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_move.c,v 1.9 2000/04/29 21:11:19 tom Exp $") +MODULE_ID("$From: lib_move.c,v 1.11 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) wmove(WINDOW *win, int y, int x) { T((T_CALLED("wmove(%p,%d,%d)"), win, y, x)); diff --git a/lib/libcurses/base/lib_mvwin.c b/lib/libcurses/base/lib_mvwin.c index b41bea721be..dbd28576f1b 100644 --- a/lib/libcurses/base/lib_mvwin.c +++ b/lib/libcurses/base/lib_mvwin.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_mvwin.c,v 1.1 1999/01/18 19:09:53 millert Exp $ */ +/* $OpenBSD: lib_mvwin.c,v 1.2 2001/01/22 18:01:41 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,8 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_mvwin.c ** @@ -44,68 +42,68 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_mvwin.c,v 1.7 1998/02/11 12:13:55 tom Exp $") +MODULE_ID("$From: lib_mvwin.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -int mvwin(WINDOW *win, int by, int bx) +NCURSES_EXPORT(int) +mvwin(WINDOW *win, int by, int bx) { - T((T_CALLED("mvwin(%p,%d,%d)"), win, by, bx)); + T((T_CALLED("mvwin(%p,%d,%d)"), win, by, bx)); - if (!win || (win->_flags & _ISPAD)) - returnCode(ERR); + if (!win || (win->_flags & _ISPAD)) + returnCode(ERR); - /* Copying subwindows is allowed, but it is expensive... */ - if (win->_flags & _SUBWIN) { - int err = ERR; - WINDOW *parent = win->_parent; - if (parent) - { /* Now comes the complicated and costly part, you should really - * try to avoid to move subwindows. Because a subwindow shares - * the text buffers with its parent, one can't do a simple - * memmove of the text buffers. One has to create a copy, then - * to relocate the subwindow and then to do a copy. - */ - if ((by - parent->_begy == win->_pary) && - (bx - parent->_begx == win->_parx)) - err=OK; /* we don't actually move */ - else { - WINDOW* clone = dupwin(win); + /* Copying subwindows is allowed, but it is expensive... */ + if (win->_flags & _SUBWIN) { + int err = ERR; + WINDOW *parent = win->_parent; + if (parent) { /* Now comes the complicated and costly part, you should really + * try to avoid to move subwindows. Because a subwindow shares + * the text buffers with its parent, one can't do a simple + * memmove of the text buffers. One has to create a copy, then + * to relocate the subwindow and then to do a copy. + */ + if ((by - parent->_begy == win->_pary) && + (bx - parent->_begx == win->_parx)) + err = OK; /* we don't actually move */ + else { + WINDOW *clone = dupwin(win); if (clone) { - /* now we have the clone, so relocate win */ - - werase(win); /* Erase the original place */ - wbkgd(win,parent->_bkgd);/* fill with parents background */ - wsyncup(win); /* Tell the parent(s) */ - - err = mvderwin(win, - by - parent->_begy, - bx - parent->_begx); - if (err!=ERR) { - err = copywin(clone,win, - 0, 0, 0, 0, win->_maxy, win->_maxx, 0); - if (ERR!=err) - wsyncup(win); - } - if (ERR==delwin(clone)) - err=ERR; + /* now we have the clone, so relocate win */ + + werase(win); /* Erase the original place */ + wbkgd(win, parent->_bkgd); /* fill with parents background */ + wsyncup(win); /* Tell the parent(s) */ + + err = mvderwin(win, + by - parent->_begy, + bx - parent->_begx); + if (err != ERR) { + err = copywin(clone, win, + 0, 0, 0, 0, win->_maxy, win->_maxx, 0); + if (ERR != err) + wsyncup(win); + } + if (ERR == delwin(clone)) + err = ERR; } - } } - returnCode(err); } + returnCode(err); + } - if (by + win->_maxy > screen_lines - 1 - || bx + win->_maxx > screen_columns - 1 - || by < 0 - || bx < 0) - returnCode(ERR); + if (by + win->_maxy > screen_lines - 1 + || bx + win->_maxx > screen_columns - 1 + || by < 0 + || bx < 0) + returnCode(ERR); - /* - * Whether or not the window is moved, touch the window's contents so - * that a following call to 'wrefresh()' will paint the window at the - * new location. This ensures that if the caller has refreshed another - * window at the same location, that this one will be displayed. - */ - win->_begy = by; - win->_begx = bx; - returnCode(touchwin(win)); + /* + * Whether or not the window is moved, touch the window's contents so + * that a following call to 'wrefresh()' will paint the window at the + * new location. This ensures that if the caller has refreshed another + * window at the same location, that this one will be displayed. + */ + win->_begy = by; + win->_begx = bx; + returnCode(touchwin(win)); } diff --git a/lib/libcurses/base/lib_newterm.c b/lib/libcurses/base/lib_newterm.c index 2dbe3e87230..0dc1f85592d 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.11 2000/10/08 22:46:59 millert Exp $ */ +/* $OpenBSD: lib_newterm.c,v 1.12 2001/01/22 18:01:42 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -49,7 +49,7 @@ #include <term.h> /* clear_screen, cup & friends, cur_term */ #include <tic.h> -MODULE_ID("$From: lib_newterm.c,v 1.48 2000/09/02 18:11:42 tom Exp $") +MODULE_ID("$From: lib_newterm.c,v 1.50 2000/12/10 02:43:27 tom Exp $") #ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */ #define ONLCR 0 @@ -88,14 +88,15 @@ _nc_initscr(void) */ static int filter_mode = FALSE; -void +NCURSES_EXPORT(void) filter(void) { filter_mode = TRUE; } -SCREEN * -newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) +NCURSES_EXPORT(SCREEN *) +newterm +(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) { int errret; int slk_format = _nc_slk_format; @@ -140,7 +141,7 @@ newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) if (num_labels <= 0 || !SLK_STDFMT(slk_format)) if (slk_format) { if (ERR == _nc_ripoffline(-SLK_LINES(slk_format), - _nc_slk_initialize)) + _nc_slk_initialize)) return 0; } /* this actually allocates the screen structure, and saves the @@ -162,7 +163,7 @@ newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) typeahead(fileno(ifp)); #ifdef TERMIOS SP->_use_meta = ((cur_term->Ottyb.c_cflag & CSIZE) == CS8 && - !(cur_term->Ottyb.c_iflag & ISTRIP)); + !(cur_term->Ottyb.c_iflag & ISTRIP)); #else SP->_use_meta = FALSE; #endif @@ -173,8 +174,8 @@ newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) * will be useless. */ SP->_scrolling = ((scroll_forward && scroll_reverse) || - ((parm_rindex || parm_insert_line || insert_line) && - (parm_index || parm_delete_line || delete_line))); + ((parm_rindex || parm_insert_line || insert_line) && + (parm_index || parm_delete_line || delete_line))); baudrate(); /* sets a field in the SP structure */ diff --git a/lib/libcurses/base/lib_newwin.c b/lib/libcurses/base/lib_newwin.c index e7d2def4ebf..d8d4536b651 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.3 2000/06/19 03:53:43 millert Exp $ */ +/* $OpenBSD: lib_newwin.c,v 1.4 2001/01/22 18:01:42 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,13 +42,14 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_newwin.c,v 1.24 2000/04/29 18:49:51 tom Exp $") +MODULE_ID("$From: lib_newwin.c,v 1.27 2000/12/10 02:43:27 tom Exp $") -void +NCURSES_EXPORT(int) _nc_freewin(WINDOW *win) { WINDOWLIST *p, *q; int i; + int result = ERR; if (win != 0) { for (p = _nc_windows, q = 0; p != 0; q = p, p = p->next) { @@ -73,15 +74,18 @@ _nc_freewin(WINDOW *win) if (win == newscr) newscr = 0; + result = OK; T(("...deleted win=%p", win)); break; } } } + return result; } -WINDOW * -newwin(int num_lines, int num_columns, int begy, int begx) +NCURSES_EXPORT(WINDOW *) +newwin +(int num_lines, int num_columns, int begy, int begx) { WINDOW *win; chtype *ptr; @@ -106,11 +110,11 @@ newwin(int num_lines, int num_columns, int begy, int begx) for (i = 0; i < num_lines; i++) { win->_line[i].text = typeCalloc(chtype, (unsigned) num_columns); if (win->_line[i].text == 0) { - _nc_freewin(win); + (void) _nc_freewin(win); returnWin(0); } for (ptr = win->_line[i].text; ptr < win->_line[i].text + - num_columns;) + num_columns;) *ptr++ = ' '; } @@ -119,15 +123,16 @@ newwin(int num_lines, int num_columns, int begy, int begx) returnWin(win); } -WINDOW * -derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) +NCURSES_EXPORT(WINDOW *) +derwin +(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) { WINDOW *win; int i; int flags = _SUBWIN; T((T_CALLED("derwin(%p,%d,%d,%d,%d)"), orig, num_lines, num_columns, - begy, begx)); + begy, begx)); /* ** make sure window fits inside the original one @@ -148,7 +153,7 @@ derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) flags |= _ISPAD; if ((win = _nc_makenew(num_lines, num_columns, orig->_begy + begy, - orig->_begx + begx, flags)) == 0) + orig->_begx + begx, flags)) == 0) returnWin(0); win->_pary = begy; @@ -166,8 +171,9 @@ derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) returnWin(win); } -WINDOW * -subwin(WINDOW *w, int l, int c, int y, int x) +NCURSES_EXPORT(WINDOW *) +subwin +(WINDOW *w, int l, int c, int y, int x) { T((T_CALLED("subwin(%p, %d, %d, %d, %d)"), w, l, c, y, x)); T(("parent has begy = %d, begx = %d", w->_begy, w->_begx)); @@ -182,8 +188,9 @@ dimension_limit(int value) return (test == value && value > 0); } -WINDOW * -_nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags) +NCURSES_EXPORT(WINDOW *) +_nc_makenew +(int num_lines, int num_columns, int begy, int begx, int flags) { int i; WINDOWLIST *wp; @@ -218,8 +225,8 @@ _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags) win->_attrs = A_NORMAL; win->_bkgd = BLANK; - win->_clear = is_pad ? FALSE : (num_lines == screen_lines && num_columns - == screen_columns); + win->_clear = is_pad ? FALSE : (num_lines == screen_lines + && num_columns == screen_columns); win->_idlok = FALSE; win->_idcok = TRUE; win->_scroll = FALSE; diff --git a/lib/libcurses/base/lib_nl.c b/lib/libcurses/base/lib_nl.c index 9e089cb9216..b24cb3ec14e 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.4 2000/03/10 01:35:02 millert Exp $ */ +/* $OpenBSD: lib_nl.c,v 1.5 2001/01/22 18:01:42 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -44,13 +44,13 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_nl.c,v 1.6 2000/02/13 00:59:39 tom Exp $") +MODULE_ID("$From: lib_nl.c,v 1.8 2000/12/10 02:43:27 tom Exp $") #ifdef __EMX__ #include <io.h> #endif -int +NCURSES_EXPORT(int) nl(void) { T((T_CALLED("nl()"))); @@ -65,7 +65,7 @@ nl(void) returnCode(OK); } -int +NCURSES_EXPORT(int) nonl(void) { T((T_CALLED("nonl()"))); diff --git a/lib/libcurses/base/lib_overlay.c b/lib/libcurses/base/lib_overlay.c index 87fa1bd2ee3..7e3c169f08c 100644 --- a/lib/libcurses/base/lib_overlay.c +++ b/lib/libcurses/base/lib_overlay.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_overlay.c,v 1.1 1999/01/18 19:09:55 millert Exp $ */ +/* $OpenBSD: lib_overlay.c,v 1.2 2001/01/22 18:01:42 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* ** lib_overlay.c ** @@ -43,29 +42,30 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_overlay.c,v 1.12 1998/02/11 12:13:59 tom Exp $") +MODULE_ID("$From: lib_overlay.c,v 1.14 2000/12/10 02:43:27 tom Exp $") -static int overlap(const WINDOW *const s, WINDOW *const d, int const flag) +static int +overlap(const WINDOW *const s, WINDOW *const d, int const flag) { -int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; - - T(("overlap : sby %d, sbx %d, smy %d, smx %d, dby %d, dbx %d, dmy %d, dmx %d", - s->_begy, s->_begx, s->_maxy, s->_maxx, - d->_begy, d->_begx, d->_maxy, d->_maxx)); - - if (!s || !d) - returnCode(ERR); - - sminrow = max(s->_begy, d->_begy) - s->_begy; - smincol = max(s->_begx, d->_begx) - s->_begx; - dminrow = max(s->_begy, d->_begy) - d->_begy; - dmincol = max(s->_begx, d->_begx) - d->_begx; - dmaxrow = min(s->_maxy+s->_begy, d->_maxy+d->_begy) - d->_begy; - dmaxcol = min(s->_maxx+s->_begx, d->_maxx+d->_begx) - d->_begx; - - return(copywin(s, d, - sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, - flag)); + int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; + + T(("overlap : sby %d, sbx %d, smy %d, smx %d, dby %d, dbx %d, dmy %d, dmx %d", + s->_begy, s->_begx, s->_maxy, s->_maxx, + d->_begy, d->_begx, d->_maxy, d->_maxx)); + + if (!s || !d) + returnCode(ERR); + + sminrow = max(s->_begy, d->_begy) - s->_begy; + smincol = max(s->_begx, d->_begx) - s->_begx; + dminrow = max(s->_begy, d->_begy) - d->_begy; + dmincol = max(s->_begx, d->_begx) - d->_begx; + dmaxrow = min(s->_maxy + s->_begy, d->_maxy + d->_begy) - d->_begy; + dmaxcol = min(s->_maxx + s->_begx, d->_maxx + d->_begx) - d->_begx; + + return (copywin(s, d, + sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, + flag)); } /* @@ -78,10 +78,11 @@ int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; ** **/ -int overlay(const WINDOW *win1, WINDOW *win2) +NCURSES_EXPORT(int) +overlay(const WINDOW *win1, WINDOW *win2) { - T((T_CALLED("overlay(%p,%p)"), win1, win2)); - returnCode(overlap(win1, win2, TRUE)); + T((T_CALLED("overlay(%p,%p)"), win1, win2)); + returnCode(overlap(win1, win2, TRUE)); } /* @@ -94,70 +95,67 @@ int overlay(const WINDOW *win1, WINDOW *win2) ** **/ -int overwrite(const WINDOW *win1, WINDOW *win2) +NCURSES_EXPORT(int) +overwrite(const WINDOW *win1, WINDOW *win2) { - T((T_CALLED("overwrite(%p,%p)"), win1, win2)); - returnCode(overlap(win1, win2, FALSE)); + T((T_CALLED("overwrite(%p,%p)"), win1, win2)); + returnCode(overlap(win1, win2, FALSE)); } -int copywin(const WINDOW *src, WINDOW *dst, - int sminrow, int smincol, - int dminrow, int dmincol, int dmaxrow, int dmaxcol, - int over) +NCURSES_EXPORT(int) +copywin +(const WINDOW *src, WINDOW *dst, + int sminrow, int smincol, + int dminrow, int dmincol, int dmaxrow, int dmaxcol, + int over) { -int sx, sy, dx, dy; -bool touched; -chtype bk = AttrOf(dst->_bkgd); -chtype mask = ~(chtype)((bk&A_COLOR) ? A_COLOR : 0); - - T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"), - src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over)); - - if (!src || !dst) - returnCode(ERR); - - /* make sure rectangle exists in source */ - if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) || - (smincol + dmaxcol - dmincol) > (src->_maxx + 1)) { - returnCode(ERR); - } - - T(("rectangle exists in source")); - - /* make sure rectangle fits in destination */ - if (dmaxrow > dst->_maxy || dmaxcol > dst->_maxx) { - returnCode(ERR); + int sx, sy, dx, dy; + bool touched; + chtype bk = AttrOf(dst->_bkgd); + chtype mask = ~(chtype) ((bk & A_COLOR) ? A_COLOR : 0); + + T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"), + src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over)); + + if (!src || !dst) + returnCode(ERR); + + /* make sure rectangle exists in source */ + if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) || + (smincol + dmaxcol - dmincol) > (src->_maxx + 1)) { + returnCode(ERR); + } + + T(("rectangle exists in source")); + + /* make sure rectangle fits in destination */ + if (dmaxrow > dst->_maxy || dmaxcol > dst->_maxx) { + returnCode(ERR); + } + + T(("rectangle fits in destination")); + + for (dy = dminrow, sy = sminrow; dy <= dmaxrow; sy++, dy++) { + touched = FALSE; + for (dx = dmincol, sx = smincol; dx <= dmaxcol; sx++, dx++) { + if (over) { + if ((TextOf(src->_line[sy].text[sx]) != ' ') && + (dst->_line[dy].text[dx] != src->_line[sy].text[sx])) { + dst->_line[dy].text[dx] = + (src->_line[sy].text[sx] & mask) | bk; + touched = TRUE; + } + } else { + if (dst->_line[dy].text[dx] != src->_line[sy].text[sx]) { + dst->_line[dy].text[dx] = src->_line[sy].text[sx]; + touched = TRUE; + } + } } - - T(("rectangle fits in destination")); - - for (dy = dminrow, sy = sminrow; dy <= dmaxrow; sy++, dy++) { - touched = FALSE; - for(dx=dmincol, sx=smincol; dx <= dmaxcol; sx++, dx++) - { - if (over) - { - if ((TextOf(src->_line[sy].text[sx]) != ' ') && - (dst->_line[dy].text[dx]!=src->_line[sy].text[sx])) - { - dst->_line[dy].text[dx] = - (src->_line[sy].text[sx] & mask) | bk; - touched = TRUE; - } - } - else { - if (dst->_line[dy].text[dx] != src->_line[sy].text[sx]) - { - dst->_line[dy].text[dx] = src->_line[sy].text[sx]; - touched = TRUE; - } - } - } - if (touched) - { - touchline(dst,0,getmaxy(dst)); - } + if (touched) { + touchline(dst, 0, getmaxy(dst)); } - T(("finished copywin")); - returnCode(OK); + } + T(("finished copywin")); + returnCode(OK); } diff --git a/lib/libcurses/base/lib_pad.c b/lib/libcurses/base/lib_pad.c index 5289ef67cc5..f53f6a0f2a6 100644 --- a/lib/libcurses/base/lib_pad.c +++ b/lib/libcurses/base/lib_pad.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_pad.c,v 1.3 2000/06/19 03:53:44 millert Exp $ */ +/* $OpenBSD: lib_pad.c,v 1.4 2001/01/22 18:01:42 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_pad.c,v 1.29 2000/04/29 21:19:44 tom Exp $") +MODULE_ID("$From: lib_pad.c,v 1.32 2000/12/10 02:43:27 tom Exp $") -WINDOW * +NCURSES_EXPORT(WINDOW *) newpad(int l, int c) { WINDOW *win; @@ -62,7 +62,7 @@ newpad(int l, int c) for (i = 0; i < l; i++) { if_USE_SCROLL_HINTS(win->_line[i].oldindex = _NEWINDEX); if ((win->_line[i].text = typeCalloc(chtype, ((size_t) c))) == 0) { - _nc_freewin(win); + (void) _nc_freewin(win); returnWin(0); } for (ptr = win->_line[i].text; ptr < win->_line[i].text + c;) @@ -72,8 +72,9 @@ newpad(int l, int c) returnWin(win); } -WINDOW * -subpad(WINDOW *orig, int l, int c, int begy, int begx) +NCURSES_EXPORT(WINDOW *) +subpad +(WINDOW *orig, int l, int c, int begy, int begx) { WINDOW *win = (WINDOW *) 0; @@ -87,33 +88,38 @@ subpad(WINDOW *orig, int l, int c, int begy, int begx) returnWin(win); } -int -prefresh(WINDOW *win, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol) +NCURSES_EXPORT(int) +prefresh +(WINDOW *win, int pminrow, int pmincol, + int sminrow, int smincol, int smaxrow, int smaxcol) { T((T_CALLED("prefresh()"))); if (pnoutrefresh(win, pminrow, pmincol, sminrow, smincol, smaxrow, - smaxcol) != ERR + smaxcol) != ERR && doupdate() != ERR) { returnCode(OK); } returnCode(ERR); } -int -pnoutrefresh(WINDOW *win, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol) +NCURSES_EXPORT(int) +pnoutrefresh +(WINDOW *win, int pminrow, int pmincol, + int sminrow, int smincol, int smaxrow, int smaxcol) { - const int my_len = 2; /* parameterize the threshold for hardscroll */ NCURSES_SIZE_T i, j; NCURSES_SIZE_T m, n; NCURSES_SIZE_T pmaxrow; NCURSES_SIZE_T pmaxcol; + +#if USE_SCROLL_HINTS + const int my_len = 2; /* parameterize the threshold for hardscroll */ NCURSES_SIZE_T displaced; bool wide; +#endif T((T_CALLED("pnoutrefresh(%p, %d, %d, %d, %d, %d, %d)"), - win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)); + win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)); if (win == 0) returnCode(ERR); @@ -157,12 +163,14 @@ pnoutrefresh(WINDOW *win, int pminrow, int pmincol, T(("pad being refreshed")); +#if USE_SCROLL_HINTS if (win->_pad._pad_y >= 0) { displaced = pminrow - win->_pad._pad_y - (sminrow - win->_pad._pad_top); T(("pad being shifted by %d line(s)", displaced)); } else displaced = 0; +#endif /* * For pure efficiency, we'd want to transfer scrolling information @@ -178,11 +186,13 @@ pnoutrefresh(WINDOW *win, int pminrow, int pmincol, * windows). Note that changing this formula will not break any code, * merely change the costs of various update cases. */ +#if USE_SCROLL_HINTS wide = (smincol < my_len && smaxcol > (newscr->_maxx - my_len)); +#endif for (i = pminrow, m = sminrow + win->_yoffset; - i <= pmaxrow && m <= newscr->_maxy; - i++, m++) { + i <= pmaxrow && m <= newscr->_maxy; + i++, m++) { register struct ldat *nline = &newscr->_line[m]; register struct ldat *oline = &win->_line[i]; @@ -229,7 +239,7 @@ pnoutrefresh(WINDOW *win, int pminrow, int pmincol, for (i = pminrow - 1; (i >= 0) && (win->_line[i].oldindex >= 0); i--) win->_line[i].oldindex = _NEWINDEX; for (i = pmaxrow + 1; (i <= win->_maxy) - && (win->_line[i].oldindex >= 0); i++) + && (win->_line[i].oldindex >= 0); i++) win->_line[i].oldindex = _NEWINDEX; #endif @@ -271,7 +281,7 @@ pnoutrefresh(WINDOW *win, int pminrow, int pmincol, returnCode(OK); } -int +NCURSES_EXPORT(int) pechochar(WINDOW *pad, const chtype ch) { T((T_CALLED("pechochar(%p, %s)"), pad, _tracechtype(ch))); @@ -284,11 +294,11 @@ pechochar(WINDOW *pad, const chtype ch) waddch(pad, ch); prefresh(pad, pad->_pad._pad_y, - pad->_pad._pad_x, - pad->_pad._pad_top, - pad->_pad._pad_left, - pad->_pad._pad_bottom, - pad->_pad._pad_right); + pad->_pad._pad_x, + pad->_pad._pad_top, + pad->_pad._pad_left, + pad->_pad._pad_bottom, + pad->_pad._pad_right); returnCode(OK); } diff --git a/lib/libcurses/base/lib_printw.c b/lib/libcurses/base/lib_printw.c index 0b1380ce5df..3a567584b0e 100644 --- a/lib/libcurses/base/lib_printw.c +++ b/lib/libcurses/base/lib_printw.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_printw.c,v 1.1 1999/01/18 19:09:56 millert Exp $ */ +/* $OpenBSD: lib_printw.c,v 1.2 2001/01/22 18:01:42 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,72 +41,79 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_printw.c,v 1.7 1998/04/11 22:53:44 tom Exp $") +MODULE_ID("$From: lib_printw.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -int printw(NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +printw(NCURSES_CONST char *fmt,...) { - va_list argp; - int code; + va_list argp; + int code; - T(("printw(%s,...) called", _nc_visbuf(fmt))); + T(("printw(%s,...) called", _nc_visbuf(fmt))); - va_start(argp, fmt); - code = vwprintw(stdscr, fmt, argp); - va_end(argp); + va_start(argp, fmt); + code = vwprintw(stdscr, fmt, argp); + va_end(argp); - return code; + return code; } -int wprintw(WINDOW *win, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +wprintw(WINDOW *win, NCURSES_CONST char *fmt,...) { - va_list argp; - int code; + va_list argp; + int code; - T(("wprintw(%p,%s,...) called", win, _nc_visbuf(fmt))); + T(("wprintw(%p,%s,...) called", win, _nc_visbuf(fmt))); - va_start(argp, fmt); - code = vwprintw(win, fmt, argp); - va_end(argp); + va_start(argp, fmt); + code = vwprintw(win, fmt, argp); + va_end(argp); - return code; + return code; } -int mvprintw(int y, int x, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +mvprintw(int y, int x, NCURSES_CONST char *fmt,...) { - va_list argp; - int code = move(y, x); - - if (code != ERR) { - va_start(argp, fmt); - code = vwprintw(stdscr, fmt, argp); - va_end(argp); - } - return code; + va_list argp; + int code = move(y, x); + + if (code != ERR) { + va_start(argp, fmt); + code = vwprintw(stdscr, fmt, argp); + va_end(argp); + } + return code; } -int mvwprintw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +mvwprintw +(WINDOW *win, int y, int x, NCURSES_CONST char *fmt,...) { - va_list argp; - int code = wmove(win, y, x); - - if (code != ERR) { - va_start(argp, fmt); - code = vwprintw(win, fmt, argp); - va_end(argp); - } - return code; + va_list argp; + int code = wmove(win, y, x); + + if (code != ERR) { + va_start(argp, fmt); + code = vwprintw(win, fmt, argp); + va_end(argp); + } + return code; } -int vwprintw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) +NCURSES_EXPORT(int) +vwprintw +(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) { - char *buf = _nc_printf_string(fmt, argp); - int code = ERR; + char *buf = _nc_printf_string(fmt, argp); + int code = ERR; - if (buf != 0) { - code = waddstr(win, buf); + if (buf != 0) { + code = waddstr(win, buf); #if USE_SAFE_SPRINTF - free(buf); + free(buf); #endif - } - return code; + } + return code; } diff --git a/lib/libcurses/base/lib_redrawln.c b/lib/libcurses/base/lib_redrawln.c index 51a22c3d8f1..82ce92b216b 100644 --- a/lib/libcurses/base/lib_redrawln.c +++ b/lib/libcurses/base/lib_redrawln.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_redrawln.c,v 1.1 1999/01/18 19:09:57 millert Exp $ */ +/* $OpenBSD: lib_redrawln.c,v 1.2 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,31 +41,31 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_redrawln.c,v 1.7 1998/09/19 20:09:50 Alexander.V.Lukyanov Exp $") +MODULE_ID("$From: lib_redrawln.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -int wredrawln(WINDOW *win, int beg, int num) +NCURSES_EXPORT(int) +wredrawln(WINDOW *win, int beg, int num) { - int i; - int end; - size_t len = (win->_maxx + 1) * sizeof(chtype); + int i; + int end; + size_t len = (win->_maxx + 1) * sizeof(chtype); - T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num)); + T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num)); - if (beg < 0) - beg = 0; + if (beg < 0) + beg = 0; - if (touchline (win, beg, num) == ERR) - returnCode(ERR); + if (touchline(win, beg, num) == ERR) + returnCode(ERR); - end = beg + num; - if (end > win->_maxy + 1) - end = win->_maxy + 1; + end = beg + num; + if (end > win->_maxy + 1) + end = win->_maxy + 1; - for (i = beg; i < end; i++) - { - memset (curscr->_line[i+win->_begy].text+win->_begx, 0, len); - _nc_make_oldhash(i+win->_begy); - } + for (i = beg; i < end; i++) { + memset(curscr->_line[i + win->_begy].text + win->_begx, 0, len); + _nc_make_oldhash(i + win->_begy); + } - returnCode(OK); + returnCode(OK); } diff --git a/lib/libcurses/base/lib_refresh.c b/lib/libcurses/base/lib_refresh.c index 4ae172db5f7..d3d65e7434a 100644 --- a/lib/libcurses/base/lib_refresh.c +++ b/lib/libcurses/base/lib_refresh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_refresh.c,v 1.3 2000/06/19 03:53:44 millert Exp $ */ +/* $OpenBSD: lib_refresh.c,v 1.4 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_refresh.c,v 1.25 2000/04/29 21:17:08 tom Exp $") +MODULE_ID("$From: lib_refresh.c,v 1.28 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) wrefresh(WINDOW *win) { int code; @@ -69,7 +69,7 @@ wrefresh(WINDOW *win) returnCode(code); } -int +NCURSES_EXPORT(int) wnoutrefresh(WINDOW *win) { NCURSES_SIZE_T limit_x; @@ -77,7 +77,9 @@ wnoutrefresh(WINDOW *win) NCURSES_SIZE_T begx; NCURSES_SIZE_T begy; NCURSES_SIZE_T m, n; +#if USE_SCROLL_HINTS bool wide; +#endif T((T_CALLED("wnoutrefresh(%p)"), win)); #ifdef TRACE @@ -102,6 +104,7 @@ wnoutrefresh(WINDOW *win) /* merge in change information from all subwindows of this window */ wsyncdown(win); +#if USE_SCROLL_HINTS /* * For pure efficiency, we'd want to transfer scrolling information * from the window to newscr whenever the window is wide enough that @@ -117,6 +120,7 @@ wnoutrefresh(WINDOW *win) * merely change the costs of various update cases. */ wide = (begx <= 1 && win->_maxx >= (newscr->_maxx - 1)); +#endif win->_flags &= ~_HASMOVED; @@ -134,8 +138,8 @@ wnoutrefresh(WINDOW *win) limit_x = win->_maxx; for (i = 0, m = begy + win->_yoffset; - i <= win->_maxy && m <= newscr->_maxy; - i++, m++) { + i <= win->_maxy && m <= newscr->_maxy; + i++, m++) { register struct ldat *nline = &newscr->_line[m]; register struct ldat *oline = &win->_line[i]; diff --git a/lib/libcurses/base/lib_restart.c b/lib/libcurses/base/lib_restart.c index c77edbeb067..c7a2797b7d1 100644 --- a/lib/libcurses/base/lib_restart.c +++ b/lib/libcurses/base/lib_restart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_restart.c,v 1.3 2000/10/08 22:46:59 millert Exp $ */ +/* $OpenBSD: lib_restart.c,v 1.4 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -49,10 +49,11 @@ #include <term.h> /* lines, columns, cur_term */ -MODULE_ID("$From: lib_restart.c,v 1.3 2000/09/02 18:09:44 tom Exp $") +MODULE_ID("$From: lib_restart.c,v 1.4 2000/12/10 01:26:52 tom Exp $") -int -restartterm(NCURSES_CONST char *termp, int filenum, int *errret) +NCURSES_EXPORT(int) +restartterm +(NCURSES_CONST char *termp, int filenum, int *errret) { int saveecho = SP->_echo; int savecbreak = SP->_cbreak; diff --git a/lib/libcurses/base/lib_scanw.c b/lib/libcurses/base/lib_scanw.c index abf6154786d..057f57adee0 100644 --- a/lib/libcurses/base/lib_scanw.c +++ b/lib/libcurses/base/lib_scanw.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_scanw.c,v 1.1 1999/01/18 19:09:58 millert Exp $ */ +/* $OpenBSD: lib_scanw.c,v 1.2 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,8 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_scanw.c ** @@ -44,70 +42,75 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_scanw.c,v 1.8 1998/04/11 22:54:18 tom Exp $") +MODULE_ID("$From: lib_scanw.c,v 1.10 2000/12/10 02:43:27 tom Exp $") #if !HAVE_VSSCANF #if defined(__QNX__) extern int vsscanf(const char *str, const char *format, __va_list __arg); #else -extern int vsscanf(const char *str, const char *format, ...); +extern int vsscanf(const char *str, const char *format,...); #endif #endif -int vwscanw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) +NCURSES_EXPORT(int) +vwscanw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) { -char buf[BUFSIZ]; + char buf[BUFSIZ]; - if (wgetnstr(win, buf, sizeof(buf)-1) == ERR) - return(ERR); + if (wgetnstr(win, buf, sizeof(buf) - 1) == ERR) + return (ERR); - return(vsscanf(buf, fmt, argp)); + return (vsscanf(buf, fmt, argp)); } -int scanw(NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +scanw(NCURSES_CONST char *fmt,...) { -int code; -va_list ap; + int code; + va_list ap; - T(("scanw(\"%s\",...) called", fmt)); + T(("scanw(\"%s\",...) called", fmt)); - va_start(ap, fmt); - code = vwscanw(stdscr, fmt, ap); - va_end(ap); - return (code); + va_start(ap, fmt); + code = vwscanw(stdscr, fmt, ap); + va_end(ap); + return (code); } -int wscanw(WINDOW *win, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +wscanw(WINDOW *win, NCURSES_CONST char *fmt,...) { -int code; -va_list ap; + int code; + va_list ap; - T(("wscanw(%p,\"%s\",...) called", win, fmt)); + T(("wscanw(%p,\"%s\",...) called", win, fmt)); - va_start(ap, fmt); - code = vwscanw(win, fmt, ap); - va_end(ap); - return (code); + va_start(ap, fmt); + code = vwscanw(win, fmt, ap); + va_end(ap); + return (code); } -int mvscanw(int y, int x, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +mvscanw(int y, int x, NCURSES_CONST char *fmt,...) { -int code; -va_list ap; + int code; + va_list ap; - va_start(ap, fmt); - code = (move(y, x) == OK) ? vwscanw(stdscr, fmt, ap) : ERR; - va_end(ap); - return (code); + va_start(ap, fmt); + code = (move(y, x) == OK) ? vwscanw(stdscr, fmt, ap) : ERR; + va_end(ap); + return (code); } -int mvwscanw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +mvwscanw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt,...) { -int code; -va_list ap; + int code; + va_list ap; - va_start(ap, fmt); - code = (wmove(win, y, x) == OK) ? vwscanw(win, fmt, ap) : ERR; - va_end(ap); - return (code); + va_start(ap, fmt); + code = (wmove(win, y, x) == OK) ? vwscanw(win, fmt, ap) : ERR; + va_end(ap); + return (code); } diff --git a/lib/libcurses/base/lib_screen.c b/lib/libcurses/base/lib_screen.c index e7f3a3a9fd7..8f7f830a708 100644 --- a/lib/libcurses/base/lib_screen.c +++ b/lib/libcurses/base/lib_screen.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_screen.c,v 1.2 1999/08/15 11:40:55 millert Exp $ */ +/* $OpenBSD: lib_screen.c,v 1.3 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,166 +33,164 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - #include <curses.priv.h> #include <sys/stat.h> #include <time.h> -#include <term.h> /* exit_ca_mode, non_rev_rmcup */ +#include <term.h> /* exit_ca_mode, non_rev_rmcup */ -MODULE_ID("$From: lib_screen.c,v 1.15 1999/07/24 20:05:29 tom Exp $") +MODULE_ID("$From: lib_screen.c,v 1.17 2000/12/10 02:43:27 tom Exp $") -static time_t dumptime; +static time_t dumptime; -WINDOW *getwin(FILE *filep) +NCURSES_EXPORT(WINDOW *) +getwin(FILE * filep) { - WINDOW tmp, *nwin; - int n; - - T((T_CALLED("getwin(%p)"), filep)); - - (void) fread(&tmp, sizeof(WINDOW), 1, filep); - if (ferror(filep)) - returnWin(0); - - if ((nwin = newwin(tmp._maxy+1, tmp._maxx+1, 0, 0)) == 0) - returnWin(0); - - /* - * We deliberately do not restore the _parx, _pary, or _parent - * fields, because the window hierarchy within which they - * made sense is probably gone. - */ - nwin->_curx = tmp._curx; - nwin->_cury = tmp._cury; - nwin->_maxy = tmp._maxy; - nwin->_maxx = tmp._maxx; - nwin->_begy = tmp._begy; - nwin->_begx = tmp._begx; - nwin->_yoffset = tmp._yoffset; - nwin->_flags = tmp._flags & ~(_SUBWIN|_ISPAD); - - nwin->_attrs = tmp._attrs; - nwin->_bkgd = tmp._bkgd; - - nwin->_clear = tmp._clear; - nwin->_scroll = tmp._scroll; - nwin->_leaveok = tmp._leaveok; - nwin->_use_keypad = tmp._use_keypad; - nwin->_delay = tmp._delay; - nwin->_immed = tmp._immed; - nwin->_sync = tmp._sync; - - nwin->_regtop = tmp._regtop; - nwin->_regbottom = tmp._regbottom; - - for (n = 0; n < nwin->_maxy + 1; n++) - { - (void) fread(nwin->_line[n].text, - sizeof(chtype), (size_t)(nwin->_maxx + 1), filep); - if (ferror(filep)) - { - delwin(nwin); - returnWin(0); - } + WINDOW tmp, *nwin; + int n; + + T((T_CALLED("getwin(%p)"), filep)); + + (void) fread(&tmp, sizeof(WINDOW), 1, filep); + if (ferror(filep)) + returnWin(0); + + if ((nwin = newwin(tmp._maxy + 1, tmp._maxx + 1, 0, 0)) == 0) + returnWin(0); + + /* + * We deliberately do not restore the _parx, _pary, or _parent + * fields, because the window hierarchy within which they + * made sense is probably gone. + */ + nwin->_curx = tmp._curx; + nwin->_cury = tmp._cury; + nwin->_maxy = tmp._maxy; + nwin->_maxx = tmp._maxx; + nwin->_begy = tmp._begy; + nwin->_begx = tmp._begx; + nwin->_yoffset = tmp._yoffset; + nwin->_flags = tmp._flags & ~(_SUBWIN | _ISPAD); + + nwin->_attrs = tmp._attrs; + nwin->_bkgd = tmp._bkgd; + + nwin->_clear = tmp._clear; + nwin->_scroll = tmp._scroll; + nwin->_leaveok = tmp._leaveok; + nwin->_use_keypad = tmp._use_keypad; + nwin->_delay = tmp._delay; + nwin->_immed = tmp._immed; + nwin->_sync = tmp._sync; + + nwin->_regtop = tmp._regtop; + nwin->_regbottom = tmp._regbottom; + + for (n = 0; n < nwin->_maxy + 1; n++) { + (void) fread(nwin->_line[n].text, + sizeof(chtype), (size_t) (nwin->_maxx + 1), filep); + if (ferror(filep)) { + delwin(nwin); + returnWin(0); } - touchwin(nwin); + } + touchwin(nwin); - returnWin(nwin); + returnWin(nwin); } -int putwin(WINDOW *win, FILE *filep) +NCURSES_EXPORT(int) +putwin(WINDOW *win, FILE * filep) { - int code = ERR; - int n; + int code = ERR; + int n; - T((T_CALLED("putwin(%p,%p)"), win, filep)); + T((T_CALLED("putwin(%p,%p)"), win, filep)); - if (win) { - (void) fwrite(win, sizeof(WINDOW), 1, filep); - if (ferror(filep)) + if (win) { + (void) fwrite(win, sizeof(WINDOW), 1, filep); + if (ferror(filep)) returnCode(code); - for (n = 0; n < win->_maxy + 1; n++) - { - (void) fwrite(win->_line[n].text, - sizeof(chtype), (size_t)(win->_maxx + 1), filep); - if (ferror(filep)) + for (n = 0; n < win->_maxy + 1; n++) { + (void) fwrite(win->_line[n].text, + sizeof(chtype), (size_t) (win->_maxx + 1), filep); + if (ferror(filep)) returnCode(code); - } - code = OK; } - returnCode(code); + code = OK; + } + returnCode(code); } -int scr_restore(const char *file) +NCURSES_EXPORT(int) +scr_restore(const char *file) { - FILE *fp = 0; - - T((T_CALLED("scr_restore(%s)"), _nc_visbuf(file))); - - if (_nc_access(file, R_OK) < 0 - || (fp = fopen(file, "rb")) == 0) - returnCode(ERR); - else - { - delwin(newscr); - newscr = getwin(fp); - (void) fclose(fp); - returnCode(OK); - } + FILE *fp = 0; + + T((T_CALLED("scr_restore(%s)"), _nc_visbuf(file))); + + if (_nc_access(file, R_OK) < 0 + || (fp = fopen(file, "rb")) == 0) + returnCode(ERR); + else { + delwin(newscr); + newscr = getwin(fp); + (void) fclose(fp); + returnCode(OK); + } } -int scr_dump(const char *file) +NCURSES_EXPORT(int) +scr_dump(const char *file) { - FILE *fp = 0; - - T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file))); - - if (_nc_access(file, W_OK) < 0 - || (fp = fopen(file, "wb")) == 0) - returnCode(ERR); - else - { - (void) putwin(newscr, fp); - (void) fclose(fp); - dumptime = time((time_t *)0); - returnCode(OK); - } + FILE *fp = 0; + + T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file))); + + if (_nc_access(file, W_OK) < 0 + || (fp = fopen(file, "wb")) == 0) + returnCode(ERR); + else { + (void) putwin(newscr, fp); + (void) fclose(fp); + dumptime = time((time_t *) 0); + returnCode(OK); + } } -int scr_init(const char *file) +NCURSES_EXPORT(int) +scr_init(const char *file) { - FILE *fp = 0; - struct stat stb; - - T((T_CALLED("scr_init(%s)"), _nc_visbuf(file))); - - if (exit_ca_mode && non_rev_rmcup) - returnCode(ERR); - - if (_nc_access(file, R_OK) < 0 - || (fp = fopen(file, "rb")) == 0) - returnCode(ERR); - else if (fstat(STDOUT_FILENO, &stb) || stb.st_mtime > dumptime) - returnCode(ERR); - else - { - delwin(curscr); - curscr = getwin(fp); - (void) fclose(fp); - returnCode(OK); - } + FILE *fp = 0; + struct stat stb; + + T((T_CALLED("scr_init(%s)"), _nc_visbuf(file))); + + if (exit_ca_mode && non_rev_rmcup) + returnCode(ERR); + + if (_nc_access(file, R_OK) < 0 + || (fp = fopen(file, "rb")) == 0) + returnCode(ERR); + else if (fstat(STDOUT_FILENO, &stb) || stb.st_mtime > dumptime) + returnCode(ERR); + else { + delwin(curscr); + curscr = getwin(fp); + (void) fclose(fp); + returnCode(OK); + } } -int scr_set(const char *file) +NCURSES_EXPORT(int) +scr_set(const char *file) { T((T_CALLED("scr_set(%s)"), _nc_visbuf(file))); if (scr_init(file) == ERR) returnCode(ERR); - else - { + else { delwin(newscr); newscr = dupwin(curscr); returnCode(OK); diff --git a/lib/libcurses/base/lib_scroll.c b/lib/libcurses/base/lib_scroll.c index 511ca93850a..8f9b3c5e17b 100644 --- a/lib/libcurses/base/lib_scroll.c +++ b/lib/libcurses/base/lib_scroll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_scroll.c,v 1.2 2000/06/19 03:53:45 millert Exp $ */ +/* $OpenBSD: lib_scroll.c,v 1.3 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -44,11 +44,12 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_scroll.c,v 1.17 2000/04/29 21:10:51 tom Exp $") +MODULE_ID("$From: lib_scroll.c,v 1.20 2000/12/10 02:54:03 tom Exp $") -void -_nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, - NCURSES_SIZE_T const bottom, chtype blank) +NCURSES_EXPORT(void) +_nc_scroll_window +(WINDOW *win, int const n, NCURSES_SIZE_T const top, + NCURSES_SIZE_T const bottom, chtype blank) { int line, j; size_t to_copy = (size_t) (sizeof(chtype) * (win->_maxx + 1)); @@ -70,10 +71,11 @@ _nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, if (n < 0) { for (line = bottom; line >= top - n; line--) { memcpy(win->_line[line].text, - win->_line[line + n].text, - to_copy); - if_USE_SCROLL_HINTS(win->_line[line].oldindex = win->_line[line - + n].oldindex); + win->_line[line + n].text, + to_copy); + if_USE_SCROLL_HINTS( + win->_line[line].oldindex = + win->_line[line + n].oldindex); } for (line = top; line < top - n; line++) { for (j = 0; j <= win->_maxx; j++) @@ -86,10 +88,10 @@ _nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, if (n > 0) { for (line = top; line <= bottom - n; line++) { memcpy(win->_line[line].text, - win->_line[line + n].text, - to_copy); - if_USE_SCROLL_HINTS(win->_line[line].oldindex = win->_line[line - + n].oldindex); + win->_line[line + n].text, + to_copy); + if_USE_SCROLL_HINTS(win->_line[line].oldindex = + win->_line[line + n].oldindex); } for (line = bottom; line > bottom - n; line--) { for (j = 0; j <= win->_maxx; j++) @@ -100,7 +102,7 @@ _nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, touchline(win, top, bottom - top + 1); } -int +NCURSES_EXPORT(int) wscrl(WINDOW *win, int n) { T((T_CALLED("wscrl(%p,%d)"), win, n)); diff --git a/lib/libcurses/base/lib_scrollok.c b/lib/libcurses/base/lib_scrollok.c index 927b5495518..3cd16dc0891 100644 --- a/lib/libcurses/base/lib_scrollok.c +++ b/lib/libcurses/base/lib_scrollok.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_scrollok.c,v 1.1 1999/01/18 19:09:58 millert Exp $ */ +/* $OpenBSD: lib_scrollok.c,v 1.2 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* ** lib_scrollok.c ** @@ -43,16 +42,16 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_scrollok.c,v 1.2 1998/02/11 12:14:01 tom Exp $") +MODULE_ID("$From: lib_scrollok.c,v 1.4 2000/12/10 02:43:27 tom Exp $") -int scrollok(WINDOW *win, bool flag) +NCURSES_EXPORT(int) +scrollok(WINDOW *win, bool flag) { - T((T_CALLED("scrollok(%p,%d)"), win, flag)); + T((T_CALLED("scrollok(%p,%d)"), win, flag)); - if (win) { - win->_scroll = flag; - returnCode(OK); - } - else - returnCode(ERR); + if (win) { + win->_scroll = flag; + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_scrreg.c b/lib/libcurses/base/lib_scrreg.c index 0ee5b425137..d7f8fa7a91a 100644 --- a/lib/libcurses/base/lib_scrreg.c +++ b/lib/libcurses/base/lib_scrreg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_scrreg.c,v 1.2 2000/06/19 03:53:45 millert Exp $ */ +/* $OpenBSD: lib_scrreg.c,v 1.3 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_scrreg.c,v 1.8 2000/04/29 21:13:04 tom Exp $") +MODULE_ID("$From: lib_scrreg.c,v 1.10 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) wsetscrreg(WINDOW *win, int top, int bottom) { T((T_CALLED("wsetscrreg(%p,%d,%d)"), win, top, bottom)); diff --git a/lib/libcurses/base/lib_set_term.c b/lib/libcurses/base/lib_set_term.c index 6952649ddfe..d9653821351 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.11 2000/10/08 22:46:59 millert Exp $ */ +/* $OpenBSD: lib_set_term.c,v 1.12 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -45,9 +45,9 @@ #include <term.h> /* cur_term */ #include <tic.h> -MODULE_ID("$From: lib_set_term.c,v 1.58 2000/10/04 22:05:48 tom Exp $") +MODULE_ID("$From: lib_set_term.c,v 1.61 2000/12/10 02:43:27 tom Exp $") -SCREEN * +NCURSES_EXPORT(SCREEN *) set_term(SCREEN * screenp) { SCREEN *oldSP; @@ -82,7 +82,7 @@ _nc_free_keytry(struct tries *kt) /* * Free the storage associated with the given SCREEN sp. */ -void +NCURSES_EXPORT(void) delscreen(SCREEN * sp) { SCREEN **scan = &_nc_screen_chain; @@ -97,9 +97,9 @@ delscreen(SCREEN * sp) scan = &(*scan)->_next_screen; } - _nc_freewin(sp->_curscr); - _nc_freewin(sp->_newscr); - _nc_freewin(sp->_stdscr); + (void) _nc_freewin(sp->_curscr); + (void) _nc_freewin(sp->_newscr); + (void) _nc_freewin(sp->_stdscr); _nc_free_keytry(sp->_keytry); _nc_free_keytry(sp->_key_ok); @@ -193,8 +193,9 @@ extract_fgbg(char *src, int *result) } #endif -int -_nc_setupscreen(short slines, short const scolumns, FILE * output) +NCURSES_EXPORT(int) +_nc_setupscreen +(short slines, short const scolumns, FILE * output) /* OS-independent screen initializations */ { int bottom_stolen = 0; @@ -226,7 +227,7 @@ _nc_setupscreen(short slines, short const scolumns, FILE * output) #if NCURSES_NO_PADDING SP->_no_padding = getenv("NCURSES_NO_PADDING") != 0; TR(TRACE_CHARPUT | TRACE_MOVE, ("padding will%s be used", - SP->_no_padding ? " not" : "")); + SP->_no_padding ? " not" : "")); #endif #if NCURSES_EXT_FUNCS @@ -297,12 +298,12 @@ _nc_setupscreen(short slines, short const scolumns, FILE * output) if (magic_cookie_glitch > 0) { SP->_xmc_triggers = termattrs() & ( - A_ALTCHARSET | - A_BLINK | - A_BOLD | - A_REVERSE | - A_STANDOUT | - A_UNDERLINE + A_ALTCHARSET | + A_BLINK | + A_BOLD | + A_REVERSE | + A_STANDOUT | + A_UNDERLINE ); SP->_xmc_suppress = SP->_xmc_triggers & (chtype) ~ (A_BOLD); @@ -392,7 +393,7 @@ _nc_setupscreen(short slines, short const scolumns, FILE * output) /* The internal implementation interprets line as the number of lines to rip off from the top or bottom. */ -int +NCURSES_EXPORT(int) _nc_ripoffline(int line, int (*init) (WINDOW *, int)) { if (line == 0) @@ -409,7 +410,7 @@ _nc_ripoffline(int line, int (*init) (WINDOW *, int)) return (OK); } -int +NCURSES_EXPORT(int) ripoffline(int line, int (*init) (WINDOW *, int)) { T((T_CALLED("ripoffline(%d,%p)"), line, init)); diff --git a/lib/libcurses/base/lib_slk.c b/lib/libcurses/base/lib_slk.c index c0cc60ba85b..7b72ce85844 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.3 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: lib_slk.c,v 1.4 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 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,43 +41,41 @@ #include <curses.priv.h> #include <ctype.h> -#include <term.h> /* num_labels, label_*, plab_norm */ +#include <term.h> /* num_labels, label_*, plab_norm */ -MODULE_ID("$From: lib_slk.c,v 1.17 1999/10/30 23:00:16 tom Exp $") +MODULE_ID("$From: lib_slk.c,v 1.20 2000/12/10 02:43:27 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 = 0; /* one more than format specified in slk_init() */ +NCURSES_EXPORT_VAR(int) +_nc_slk_format = 0; /* one more than format specified in slk_init() */ /* * Paint the info line for the PC style SLK emulation. * */ -static void -slk_paint_info(WINDOW *win) + static void + slk_paint_info(WINDOW *win) { - if (win && SP->slk_format==4) - { - int i; - - mvwhline (win,0,0,0,getmaxx(win)); - wmove (win,0,0); - - for (i = 0; i < SP->_slk->maxlab; i++) { - if (win && SP->slk_format==4) - { - mvwaddch(win,0,SP->_slk->ent[i].x,'F'); - if (i<9) - waddch(win,'1'+i); - else - { - waddch(win,'1'); - waddch(win,'0' + (i-9)); - } - } - } + if (win && SP->slk_format == 4) { + int i; + + mvwhline(win, 0, 0, 0, getmaxx(win)); + wmove(win, 0, 0); + + for (i = 0; i < SP->_slk->maxlab; i++) { + if (win && SP->slk_format == 4) { + mvwaddch(win, 0, SP->_slk->ent[i].x, (chtype) 'F'); + if (i < 9) + waddch(win, (chtype) '1' + i); + else { + waddch(win, (chtype) '1'); + waddch(win, (chtype) '0' + (i - 9)); + } + } + } } } @@ -85,132 +83,122 @@ slk_paint_info(WINDOW *win) * Initialize soft labels. * Called from newterm() */ -int +NCURSES_EXPORT(int) _nc_slk_initialize(WINDOW *stwin, int cols) { -int i, x; -int res = OK; -char *p; - - T(("slk_initialize()")); - - if (SP->_slk) - { /* we did this already, so simply return */ - return(OK); - } - else - if ((SP->_slk = typeCalloc(SLK, 1)) == 0) - return(ERR); - - SP->_slk->ent = NULL; - SP->_slk->buffer = NULL; - SP->_slk->attr = A_STANDOUT; - - SP->_slk->maxlab = (num_labels > 0) ? - num_labels : MAX_SKEY(_nc_slk_format); - SP->_slk->maxlen = (num_labels > 0) ? - label_width * label_height : MAX_SKEY_LEN(_nc_slk_format); - SP->_slk->labcnt = (SP->_slk->maxlab < MAX_SKEY(_nc_slk_format)) ? - MAX_SKEY(_nc_slk_format) : SP->_slk->maxlab; - - SP->_slk->ent = typeCalloc(slk_ent, SP->_slk->labcnt); - if (SP->_slk->ent == NULL) - goto exception; - - p = SP->_slk->buffer = (char*) calloc(2*SP->_slk->labcnt,(1+SP->_slk->maxlen)); - if (SP->_slk->buffer == NULL) - goto exception; - - for (i = 0; i < SP->_slk->labcnt; i++) { - SP->_slk->ent[i].text = p; - p += (1 + SP->_slk->maxlen); - SP->_slk->ent[i].form_text = p; - p += (1 + SP->_slk->maxlen); - memset(SP->_slk->ent[i].form_text, ' ', (unsigned)(SP->_slk->maxlen)); - SP->_slk->ent[i].visible = (i < SP->_slk->maxlab); - } - if (_nc_slk_format >= 3) /* PC style */ - { - int gap = (cols - 3 * (3 + 4*SP->_slk->maxlen))/2; + int i, x; + int res = OK; + char *p; + + T(("slk_initialize()")); + + if (SP->_slk) { /* we did this already, so simply return */ + return (OK); + } else if ((SP->_slk = typeCalloc(SLK, 1)) == 0) + return (ERR); + + SP->_slk->ent = NULL; + SP->_slk->buffer = NULL; + SP->_slk->attr = A_STANDOUT; + + SP->_slk->maxlab = (num_labels > 0) ? + num_labels : MAX_SKEY(_nc_slk_format); + SP->_slk->maxlen = (num_labels > 0) ? + label_width * label_height : MAX_SKEY_LEN(_nc_slk_format); + SP->_slk->labcnt = (SP->_slk->maxlab < MAX_SKEY(_nc_slk_format)) ? + MAX_SKEY(_nc_slk_format) : SP->_slk->maxlab; + + SP->_slk->ent = typeCalloc(slk_ent, SP->_slk->labcnt); + if (SP->_slk->ent == NULL) + goto exception; + + p = SP->_slk->buffer = (char *) calloc(2 * SP->_slk->labcnt, (1 + SP->_slk->maxlen)); + if (SP->_slk->buffer == NULL) + goto exception; + + for (i = 0; i < SP->_slk->labcnt; i++) { + SP->_slk->ent[i].text = p; + p += (1 + SP->_slk->maxlen); + SP->_slk->ent[i].form_text = p; + p += (1 + SP->_slk->maxlen); + memset(SP->_slk->ent[i].form_text, ' ', (unsigned) (SP->_slk->maxlen)); + SP->_slk->ent[i].visible = (i < SP->_slk->maxlab); + } + if (_nc_slk_format >= 3) { /* PC style */ + int gap = (cols - 3 * (3 + 4 * SP->_slk->maxlen)) / 2; - if (gap < 1) - gap = 1; + if (gap < 1) + gap = 1; - for (i = x = 0; i < SP->_slk->maxlab; i++) { - SP->_slk->ent[i].x = x; - x += SP->_slk->maxlen; - x += (i==3 || i==7) ? gap : 1; - } - if (_nc_slk_format == 4) - slk_paint_info (stwin); - } - else { - if (_nc_slk_format == 2) { /* 4-4 */ + for (i = x = 0; i < SP->_slk->maxlab; i++) { + SP->_slk->ent[i].x = x; + x += SP->_slk->maxlen; + x += (i == 3 || i == 7) ? gap : 1; + } + if (_nc_slk_format == 4) + slk_paint_info(stwin); + } else { + if (_nc_slk_format == 2) { /* 4-4 */ int gap = cols - (SP->_slk->maxlab * SP->_slk->maxlen) - 6; if (gap < 1) - gap = 1; + gap = 1; for (i = x = 0; i < SP->_slk->maxlab; i++) { - SP->_slk->ent[i].x = x; - x += SP->_slk->maxlen; - x += (i == 3) ? gap : 1; + SP->_slk->ent[i].x = x; + x += SP->_slk->maxlen; + x += (i == 3) ? gap : 1; } - } - else - { - if (_nc_slk_format == 1) { /* 1 -> 3-2-3 */ - int gap = (cols - (SP->_slk->maxlab * SP->_slk->maxlen) - 5) / 2; + } else { + if (_nc_slk_format == 1) { /* 1 -> 3-2-3 */ + int gap = (cols - (SP->_slk->maxlab * SP->_slk->maxlen) - 5) + / 2; if (gap < 1) - gap = 1; + gap = 1; for (i = x = 0; i < SP->_slk->maxlab; i++) { - SP->_slk->ent[i].x = x; - x += SP->_slk->maxlen; - x += (i == 2 || i == 4) ? gap : 1; + SP->_slk->ent[i].x = x; + x += SP->_slk->maxlen; + x += (i == 2 || i == 4) ? gap : 1; } - } - else + } else goto exception; - } } - SP->_slk->dirty = TRUE; - if ((SP->_slk->win = stwin) == NULL) - { - exception: - if (SP->_slk) - { - FreeIfNeeded(SP->_slk->buffer); - FreeIfNeeded(SP->_slk->ent); - free(SP->_slk); - SP->_slk = (SLK*)0; - res = (ERR); - } + } + SP->_slk->dirty = TRUE; + if ((SP->_slk->win = stwin) == NULL) { + exception: + if (SP->_slk) { + FreeIfNeeded(SP->_slk->buffer); + FreeIfNeeded(SP->_slk->ent); + free(SP->_slk); + SP->_slk = (SLK *) 0; + res = (ERR); } + } - /* We now reset the format so that the next newterm has again - * per default no SLK keys and may call slk_init again to - * define a new layout. (juergen 03-Mar-1999) - */ - SP->slk_format = _nc_slk_format; - _nc_slk_format = 0; - return(res); + /* We now reset the format so that the next newterm has again + * per default no SLK keys and may call slk_init again to + * define a new layout. (juergen 03-Mar-1999) + */ + SP->slk_format = _nc_slk_format; + _nc_slk_format = 0; + return (res); } - /* * Restore the soft labels on the screen. */ -int +NCURSES_EXPORT(int) slk_restore(void) { - T((T_CALLED("slk_restore()"))); + T((T_CALLED("slk_restore()"))); - if (SP->_slk == NULL) - return(ERR); - SP->_slk->hidden = FALSE; - SP->_slk->dirty = TRUE; - /* we have to repaint info line eventually */ - slk_paint_info(SP->_slk->win); + if (SP->_slk == NULL) + return (ERR); + SP->_slk->hidden = FALSE; + SP->_slk->dirty = TRUE; + /* we have to repaint info line eventually */ + slk_paint_info(SP->_slk->win); - returnCode(slk_refresh()); + returnCode(slk_refresh()); } diff --git a/lib/libcurses/base/lib_slkatr_set.c b/lib/libcurses/base/lib_slkatr_set.c index 4f22dd3517b..403ec288aab 100644 --- a/lib/libcurses/base/lib_slkatr_set.c +++ b/lib/libcurses/base/lib_slkatr_set.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkatr_set.c,v 1.2 1999/05/17 03:03:59 millert Exp $ */ +/* $OpenBSD: lib_slkatr_set.c,v 1.3 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -39,20 +39,19 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkatr_set.c,v 1.3 1999/05/16 17:13:59 juergen Exp $") +MODULE_ID("$From: lib_slkatr_set.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int -slk_attr_set(const attr_t attr, short color_pair_number, void* opts) +NCURSES_EXPORT(int) +slk_attr_set +(const attr_t attr, short color_pair_number, void *opts) { - T((T_CALLED("slk_attr_set(%s,%d)"), _traceattr(attr), color_pair_number)); + T((T_CALLED("slk_attr_set(%s,%d)"), _traceattr(attr), color_pair_number)); - if (SP!=0 && SP->_slk!=0 && !opts && - color_pair_number>=0 && color_pair_number<COLOR_PAIRS) - { - SP->_slk->attr = attr; - toggle_attr_on(SP->_slk->attr,COLOR_PAIR(color_pair_number)); - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0 && !opts && + color_pair_number >= 0 && color_pair_number < COLOR_PAIRS) { + SP->_slk->attr = attr; + toggle_attr_on(SP->_slk->attr, COLOR_PAIR(color_pair_number)); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_slkatrof.c b/lib/libcurses/base/lib_slkatrof.c index 3dcfb708042..36e2c128e80 100644 --- a/lib/libcurses/base/lib_slkatrof.c +++ b/lib/libcurses/base/lib_slkatrof.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkatrof.c,v 1.1 1999/01/18 19:10:00 millert Exp $ */ +/* $OpenBSD: lib_slkatrof.c,v 1.2 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -40,18 +40,16 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkatrof.c,v 1.4 1998/03/11 19:26:07 juergen Exp $") +MODULE_ID("$From: lib_slkatrof.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_attroff(const chtype attr) { - T((T_CALLED("slk_attroff(%s)"), _traceattr(attr))); + T((T_CALLED("slk_attroff(%s)"), _traceattr(attr))); - if (SP!=0 && SP->_slk!=0) - { - toggle_attr_off(SP->_slk->attr,attr); - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0) { + toggle_attr_off(SP->_slk->attr, attr); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_slkatron.c b/lib/libcurses/base/lib_slkatron.c index e809e6696fa..f12bd7ad20f 100644 --- a/lib/libcurses/base/lib_slkatron.c +++ b/lib/libcurses/base/lib_slkatron.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkatron.c,v 1.1 1999/01/18 19:10:01 millert Exp $ */ +/* $OpenBSD: lib_slkatron.c,v 1.2 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -40,18 +40,16 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkatron.c,v 1.4 1998/03/11 19:26:07 juergen Exp $") +MODULE_ID("$From: lib_slkatron.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_attron(const chtype attr) { - T((T_CALLED("slk_attron(%s)"), _traceattr(attr))); + T((T_CALLED("slk_attron(%s)"), _traceattr(attr))); - if (SP!=0 && SP->_slk!=0) - { - toggle_attr_on(SP->_slk->attr,attr); - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0) { + toggle_attr_on(SP->_slk->attr, attr); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_slkatrset.c b/lib/libcurses/base/lib_slkatrset.c index 7143fff4cb8..3d3fb73d5e1 100644 --- a/lib/libcurses/base/lib_slkatrset.c +++ b/lib/libcurses/base/lib_slkatrset.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkatrset.c,v 1.1 1999/01/18 19:10:01 millert Exp $ */ +/* $OpenBSD: lib_slkatrset.c,v 1.2 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -40,18 +40,16 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkatrset.c,v 1.4 1998/03/11 19:26:01 juergen Exp $") +MODULE_ID("$From: lib_slkatrset.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_attrset(const chtype attr) { - T((T_CALLED("slk_attrset(%s)"), _traceattr(attr))); + T((T_CALLED("slk_attrset(%s)"), _traceattr(attr))); - if (SP!=0 && SP->_slk!=0) - { - SP->_slk->attr = attr; - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0) { + SP->_slk->attr = attr; + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_slkattr.c b/lib/libcurses/base/lib_slkattr.c index e1252181f34..2ddc36f926c 100644 --- a/lib/libcurses/base/lib_slkattr.c +++ b/lib/libcurses/base/lib_slkattr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkattr.c,v 1.1 1999/01/18 19:10:01 millert Exp $ */ +/* $OpenBSD: lib_slkattr.c,v 1.2 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -40,17 +40,15 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkattr.c,v 1.3 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$From: lib_slkattr.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -attr_t +NCURSES_EXPORT(attr_t) slk_attr(void) { - T((T_CALLED("slk_attr()"))); + T((T_CALLED("slk_attr()"))); - if (SP!=0 && SP->_slk!=0) - { - returnAttr(SP->_slk->attr); - } - else - returnAttr(0); + if (SP != 0 && SP->_slk != 0) { + returnAttr(SP->_slk->attr); + } else + returnAttr(0); } diff --git a/lib/libcurses/base/lib_slkclear.c b/lib/libcurses/base/lib_slkclear.c index eef57c72fd4..729ece1f185 100644 --- a/lib/libcurses/base/lib_slkclear.c +++ b/lib/libcurses/base/lib_slkclear.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkclear.c,v 1.2 1999/03/11 21:03:56 millert Exp $ */ +/* $OpenBSD: lib_slkclear.c,v 1.3 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -40,25 +40,24 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkclear.c,v 1.4 1999/03/03 23:44:22 juergen Exp $") +MODULE_ID("$From: lib_slkclear.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_clear(void) { - T((T_CALLED("slk_clear()"))); + T((T_CALLED("slk_clear()"))); - if (SP == NULL || SP->_slk == NULL) - returnCode(ERR); - SP->_slk->hidden = TRUE; - /* For simulated SLK's it's looks much more natural to - inherit those attributes from the standard screen */ - SP->_slk->win->_bkgd = stdscr->_bkgd; - SP->_slk->win->_attrs = stdscr->_attrs; - if (SP->_slk->win == stdscr) { - returnCode(OK); - } - else { - werase(SP->_slk->win); - returnCode(wrefresh(SP->_slk->win)); - } + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + SP->_slk->hidden = TRUE; + /* For simulated SLK's it's looks much more natural to + inherit those attributes from the standard screen */ + SP->_slk->win->_bkgd = stdscr->_bkgd; + SP->_slk->win->_attrs = stdscr->_attrs; + if (SP->_slk->win == stdscr) { + returnCode(OK); + } else { + werase(SP->_slk->win); + returnCode(wrefresh(SP->_slk->win)); + } } diff --git a/lib/libcurses/base/lib_slkcolor.c b/lib/libcurses/base/lib_slkcolor.c index 3eb448906e9..6b06426dbbe 100644 --- a/lib/libcurses/base/lib_slkcolor.c +++ b/lib/libcurses/base/lib_slkcolor.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkcolor.c,v 1.2 1999/05/17 03:04:00 millert Exp $ */ +/* $OpenBSD: lib_slkcolor.c,v 1.3 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -37,20 +37,18 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkcolor.c,v 1.5 1999/05/16 17:14:13 juergen Exp $") +MODULE_ID("$From: lib_slkcolor.c,v 1.7 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_color(short color_pair_number) { - T((T_CALLED("slk_color(%d)"), color_pair_number)); + T((T_CALLED("slk_color(%d)"), color_pair_number)); - if (SP!=0 && SP->_slk!=0 && - color_pair_number>=0 && color_pair_number<COLOR_PAIRS) - { - T(("... current %ld", (long) PAIR_NUMBER(SP->_slk->attr))); - toggle_attr_on(SP->_slk->attr,COLOR_PAIR(color_pair_number)); - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0 && + color_pair_number >= 0 && color_pair_number < COLOR_PAIRS) { + T(("... current %ld", (long) PAIR_NUMBER(SP->_slk->attr))); + toggle_attr_on(SP->_slk->attr, COLOR_PAIR(color_pair_number)); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_slkinit.c b/lib/libcurses/base/lib_slkinit.c index 320e581900b..6159dc6a209 100644 --- a/lib/libcurses/base/lib_slkinit.c +++ b/lib/libcurses/base/lib_slkinit.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkinit.c,v 1.1 1999/01/18 19:10:03 millert Exp $ */ +/* $OpenBSD: lib_slkinit.c,v 1.2 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -40,14 +40,14 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkinit.c,v 1.3 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$From: lib_slkinit.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_init(int format) { - T((T_CALLED("slk_init(%d)"), format)); - if (format < 0 || format > 3) - returnCode(ERR); - _nc_slk_format = 1 + format; - returnCode(OK); + T((T_CALLED("slk_init(%d)"), format)); + if (format < 0 || format > 3) + returnCode(ERR); + _nc_slk_format = 1 + format; + returnCode(OK); } diff --git a/lib/libcurses/base/lib_slklab.c b/lib/libcurses/base/lib_slklab.c index 0136b16292b..2eb3ff6e0d0 100644 --- a/lib/libcurses/base/lib_slklab.c +++ b/lib/libcurses/base/lib_slklab.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slklab.c,v 1.1 1999/01/18 19:10:03 millert Exp $ */ +/* $OpenBSD: lib_slklab.c,v 1.2 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -40,14 +40,14 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slklab.c,v 1.4 1998/02/11 12:13:54 tom Exp $") +MODULE_ID("$From: lib_slklab.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -char* +NCURSES_EXPORT(char *) slk_label(int n) { - T((T_CALLED("slk_label(%d)"), n)); + T((T_CALLED("slk_label(%d)"), n)); - if (SP == NULL || SP->_slk == NULL || n < 1 || n > SP->_slk->labcnt) - returnPtr(0); - returnPtr(SP->_slk->ent[n-1].text); + if (SP == NULL || SP->_slk == NULL || n < 1 || n > SP->_slk->labcnt) + returnPtr(0); + returnPtr(SP->_slk->ent[n - 1].text); } diff --git a/lib/libcurses/base/lib_slkrefr.c b/lib/libcurses/base/lib_slkrefr.c index bbad7326c7c..80cdec3e66a 100644 --- a/lib/libcurses/base/lib_slkrefr.c +++ b/lib/libcurses/base/lib_slkrefr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkrefr.c,v 1.3 1999/03/14 03:10:32 millert Exp $ */ +/* $OpenBSD: lib_slkrefr.c,v 1.4 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,91 +38,85 @@ * Write SLK window to the (virtual) screen. */ #include <curses.priv.h> -#include <term.h> /* num_labels, label_*, plab_norm */ +#include <term.h> /* num_labels, label_*, plab_norm */ -MODULE_ID("$From: lib_slkrefr.c,v 1.8 1999/03/14 00:10:27 Alexander.V.Lukyanov Exp $") +MODULE_ID("$From: lib_slkrefr.c,v 1.10 2000/12/10 02:43:27 tom Exp $") /* * Write the soft labels to the soft-key window. */ static void -slk_intern_refresh(SLK *slk) +slk_intern_refresh(SLK * slk) { -int i; -int fmt = SP->slk_format; + int i; + int fmt = SP->slk_format; - for (i = 0; i < slk->labcnt; i++) { - if (slk->dirty || slk->ent[i].dirty) { - if (slk->ent[i].visible) { - if (num_labels > 0 && SLK_STDFMT(fmt)) - { - if (i < num_labels) { - TPUTS_TRACE("plab_norm"); - putp(tparm(plab_norm, i+1, slk->ent[i].form_text)); - } - } - else - { - wmove(slk->win,SLK_LINES(fmt)-1,slk->ent[i].x); - if (SP && SP->_slk) - wattrset(slk->win,SP->_slk->attr); - waddnstr(slk->win,slk->ent[i].form_text, - MAX_SKEY_LEN(fmt)); - /* if we simulate SLK's, it's looking much more - natural to use the current ATTRIBUTE also - for the label window */ - wattrset(slk->win,stdscr->_attrs); - } - } - slk->ent[i].dirty = FALSE; + for (i = 0; i < slk->labcnt; i++) { + if (slk->dirty || slk->ent[i].dirty) { + if (slk->ent[i].visible) { + if (num_labels > 0 && SLK_STDFMT(fmt)) { + if (i < num_labels) { + TPUTS_TRACE("plab_norm"); + putp(tparm(plab_norm, i + 1, slk->ent[i].form_text)); + } + } else { + wmove(slk->win, SLK_LINES(fmt) - 1, slk->ent[i].x); + if (SP && SP->_slk) + wattrset(slk->win, SP->_slk->attr); + waddnstr(slk->win, slk->ent[i].form_text, + MAX_SKEY_LEN(fmt)); + /* if we simulate SLK's, it's looking much more + natural to use the current ATTRIBUTE also + for the label window */ + wattrset(slk->win, stdscr->_attrs); } + } + slk->ent[i].dirty = FALSE; } - slk->dirty = FALSE; + } + slk->dirty = FALSE; - if (num_labels > 0) { - if (slk->hidden) - { - TPUTS_TRACE("label_off"); - putp(label_off); - } - else - { - TPUTS_TRACE("label_on"); - putp(label_on); - } + if (num_labels > 0) { + if (slk->hidden) { + TPUTS_TRACE("label_off"); + putp(label_off); + } else { + TPUTS_TRACE("label_on"); + putp(label_on); } + } } /* * Refresh the soft labels. */ -int +NCURSES_EXPORT(int) slk_noutrefresh(void) { - T((T_CALLED("slk_noutrefresh()"))); + T((T_CALLED("slk_noutrefresh()"))); - if (SP == NULL || SP->_slk == NULL) - returnCode(ERR); - if (SP->_slk->hidden) - returnCode(OK); - slk_intern_refresh(SP->_slk); + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + if (SP->_slk->hidden) + returnCode(OK); + slk_intern_refresh(SP->_slk); - returnCode(wnoutrefresh(SP->_slk->win)); + returnCode(wnoutrefresh(SP->_slk->win)); } /* * Refresh the soft labels. */ -int +NCURSES_EXPORT(int) slk_refresh(void) { - T((T_CALLED("slk_refresh()"))); + T((T_CALLED("slk_refresh()"))); - if (SP == NULL || SP->_slk == NULL) - returnCode(ERR); - if (SP->_slk->hidden) - returnCode(OK); - slk_intern_refresh(SP->_slk); + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + if (SP->_slk->hidden) + returnCode(OK); + slk_intern_refresh(SP->_slk); - returnCode(wrefresh(SP->_slk->win)); + returnCode(wrefresh(SP->_slk->win)); } diff --git a/lib/libcurses/base/lib_slkset.c b/lib/libcurses/base/lib_slkset.c index 8d2ae2c403e..9014957a5d6 100644 --- a/lib/libcurses/base/lib_slkset.c +++ b/lib/libcurses/base/lib_slkset.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkset.c,v 1.1 1999/01/18 19:10:04 millert Exp $ */ +/* $OpenBSD: lib_slkset.c,v 1.2 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * diff --git a/lib/libcurses/base/lib_slktouch.c b/lib/libcurses/base/lib_slktouch.c index b7d217fe4c6..34f4fde8261 100644 --- a/lib/libcurses/base/lib_slktouch.c +++ b/lib/libcurses/base/lib_slktouch.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slktouch.c,v 1.1 1999/01/18 19:10:04 millert Exp $ */ +/* $OpenBSD: lib_slktouch.c,v 1.2 2001/01/22 18:01:47 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -40,16 +40,16 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slktouch.c,v 1.3 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$From: lib_slktouch.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_touch(void) { - T((T_CALLED("slk_touch()"))); + T((T_CALLED("slk_touch()"))); - if (SP == NULL || SP->_slk == NULL) - returnCode(ERR); - SP->_slk->dirty = TRUE; + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + SP->_slk->dirty = TRUE; - returnCode(OK); + returnCode(OK); } diff --git a/lib/libcurses/base/lib_touch.c b/lib/libcurses/base/lib_touch.c index 7b223b666d0..c883fc6b91f 100644 --- a/lib/libcurses/base/lib_touch.c +++ b/lib/libcurses/base/lib_touch.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_touch.c,v 1.1 1999/01/18 19:10:05 millert Exp $ */ +/* $OpenBSD: lib_touch.c,v 1.2 2001/01/22 18:01:47 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -45,45 +45,49 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_touch.c,v 1.6 1998/04/11 22:55:02 tom Exp $") +MODULE_ID("$From: lib_touch.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -bool is_linetouched(WINDOW *win, int line) +NCURSES_EXPORT(bool) +is_linetouched(WINDOW *win, int line) { - T((T_CALLED("is_linetouched(%p,%d)"), win, line)); + T((T_CALLED("is_linetouched(%p,%d)"), win, line)); - /* XSI doesn't define any error */ - if (!win || (line > win->_maxy) || (line < 0)) - returnCode(ERR); + /* XSI doesn't define any error */ + if (!win || (line > win->_maxy) || (line < 0)) + returnCode((bool) ERR); - returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE); + returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE); } -bool is_wintouched(WINDOW *win) +NCURSES_EXPORT(bool) +is_wintouched(WINDOW *win) { -int i; + int i; - T((T_CALLED("is_wintouched(%p)"), win)); + T((T_CALLED("is_wintouched(%p)"), win)); - if (win) - for (i = 0; i <= win->_maxy; i++) - if (win->_line[i].firstchar != _NOCHANGE) - returnCode(TRUE); - returnCode(FALSE); + if (win) + for (i = 0; i <= win->_maxy; i++) + if (win->_line[i].firstchar != _NOCHANGE) + returnCode(TRUE); + returnCode(FALSE); } -int wtouchln(WINDOW *win, int y, int n, int changed) +NCURSES_EXPORT(int) +wtouchln(WINDOW *win, int y, int n, int changed) { -int i; + int i; - T((T_CALLED("wtouchln(%p,%d,%d,%d)"), win, y, n, changed)); + T((T_CALLED("wtouchln(%p,%d,%d,%d)"), win, y, n, changed)); - if (!win || (n<0) || (y<0) || (y>win->_maxy)) - returnCode(ERR); + if (!win || (n < 0) || (y < 0) || (y > win->_maxy)) + returnCode(ERR); - for (i = y; i < y+n; i++) { - if (i>win->_maxy) break; - win->_line[i].firstchar = changed ? 0 : _NOCHANGE; - win->_line[i].lastchar = changed ? win->_maxx : _NOCHANGE; - } - returnCode(OK); + for (i = y; i < y + n; i++) { + if (i > win->_maxy) + break; + win->_line[i].firstchar = changed ? 0 : _NOCHANGE; + win->_line[i].lastchar = changed ? win->_maxx : _NOCHANGE; + } + returnCode(OK); } diff --git a/lib/libcurses/base/lib_ungetch.c b/lib/libcurses/base/lib_ungetch.c index 81b315d6a42..3837f645b3a 100644 --- a/lib/libcurses/base/lib_ungetch.c +++ b/lib/libcurses/base/lib_ungetch.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_ungetch.c,v 1.1 1999/01/18 19:10:05 millert Exp $ */ +/* $OpenBSD: lib_ungetch.c,v 1.2 2001/01/22 18:01:47 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,35 +42,38 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_ungetch.c,v 1.2 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$From: lib_ungetch.c,v 1.4 2000/12/10 02:43:27 tom Exp $") #include <fifo_defs.h> #ifdef TRACE -void _nc_fifo_dump(void) +NCURSES_EXPORT(void) +_nc_fifo_dump(void) { -int i; - T(("head = %d, tail = %d, peek = %d", head, tail, peek)); - for (i = 0; i < 10; i++) - T(("char %d = %s", i, _trace_key(SP->_fifo[i]))); + int i; + T(("head = %d, tail = %d, peek = %d", head, tail, peek)); + for (i = 0; i < 10; i++) + T(("char %d = %s", i, _trace_key(SP->_fifo[i]))); } #endif /* TRACE */ -int ungetch(int ch) +NCURSES_EXPORT(int) +ungetch(int ch) { - if (tail == -1) - return ERR; - if (head == -1) { - head = 0; - t_inc() - peek = tail; /* no raw keys */ - } else - h_dec(); + if (tail == -1) + return ERR; + if (head == -1) { + head = 0; + t_inc() + peek = tail; /* no raw keys */ + } else + h_dec(); - SP->_fifo[head] = ch; - T(("ungetch %#x ok", ch)); + SP->_fifo[head] = ch; + T(("ungetch %#x ok", ch)); #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) _nc_fifo_dump(); + if (_nc_tracing & TRACE_IEVENT) + _nc_fifo_dump(); #endif - return OK; + return OK; } diff --git a/lib/libcurses/base/lib_vline.c b/lib/libcurses/base/lib_vline.c index 7f1a9a09bb2..03dee2977ae 100644 --- a/lib/libcurses/base/lib_vline.c +++ b/lib/libcurses/base/lib_vline.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_vline.c,v 1.2 2000/06/19 03:53:46 millert Exp $ */ +/* $OpenBSD: lib_vline.c,v 1.3 2001/01/22 18:01:47 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_vline.c,v 1.5 2000/04/29 21:14:11 tom Exp $") +MODULE_ID("$From: lib_vline.c,v 1.7 2000/12/10 02:43:28 tom Exp $") -int +NCURSES_EXPORT(int) wvline(WINDOW *win, chtype ch, int n) { int code = ERR; diff --git a/lib/libcurses/base/lib_wattroff.c b/lib/libcurses/base/lib_wattroff.c index cb4bf92b812..38d5cfb0d31 100644 --- a/lib/libcurses/base/lib_wattroff.c +++ b/lib/libcurses/base/lib_wattroff.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_wattroff.c,v 1.1 1999/01/18 19:10:06 millert Exp $ */ +/* $OpenBSD: lib_wattroff.c,v 1.2 2001/01/22 18:01:47 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,15 +43,17 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$From: lib_wattroff.c,v 1.4 1998/05/10 12:02:11 tom Exp $") +MODULE_ID("$From: lib_wattroff.c,v 1.6 2000/12/10 02:43:28 tom Exp $") -int wattr_off(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED) +NCURSES_EXPORT(int) +wattr_off +(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED) { - T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at))); - if (win) { - T(("... current %s", _traceattr(win->_attrs))); - toggle_attr_off(win->_attrs,at); - returnCode(OK); - } else - returnCode(ERR); + T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at))); + if (win) { + T(("... current %s", _traceattr(win->_attrs))); + toggle_attr_off(win->_attrs, at); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_wattron.c b/lib/libcurses/base/lib_wattron.c index cd3c195e120..b788582bc19 100644 --- a/lib/libcurses/base/lib_wattron.c +++ b/lib/libcurses/base/lib_wattron.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_wattron.c,v 1.1 1999/01/18 19:10:06 millert Exp $ */ +/* $OpenBSD: lib_wattron.c,v 1.2 2001/01/22 18:01:47 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,15 +43,17 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$From: lib_wattron.c,v 1.4 1998/05/10 12:02:28 tom Exp $") +MODULE_ID("$From: lib_wattron.c,v 1.6 2000/12/10 02:43:28 tom Exp $") -int wattr_on(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED) +NCURSES_EXPORT(int) +wattr_on +(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED) { - T((T_CALLED("wattr_on(%p,%s)"), win, _traceattr(at))); - if (win) { - T(("... current %s", _traceattr(win->_attrs))); - toggle_attr_on(win->_attrs,at); - returnCode(OK); - } else - returnCode(ERR); + T((T_CALLED("wattr_on(%p,%s)"), win, _traceattr(at))); + if (win) { + T(("... current %s", _traceattr(win->_attrs))); + toggle_attr_on(win->_attrs, at); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_winch.c b/lib/libcurses/base/lib_winch.c index 1c468be590b..9dc58e732b9 100644 --- a/lib/libcurses/base/lib_winch.c +++ b/lib/libcurses/base/lib_winch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_winch.c,v 1.2 2000/10/08 22:46:59 millert Exp $ */ +/* $OpenBSD: lib_winch.c,v 1.3 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -41,9 +41,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_winch.c,v 1.2 2000/07/29 16:41:44 tom Exp $") +MODULE_ID("$From: lib_winch.c,v 1.4 2000/12/10 02:43:28 tom Exp $") -chtype +NCURSES_EXPORT(chtype) winch(WINDOW *win) { T((T_CALLED("winch(%p)"), win)); diff --git a/lib/libcurses/base/lib_window.c b/lib/libcurses/base/lib_window.c index 51f459fb509..6cfe4ac6fc4 100644 --- a/lib/libcurses/base/lib_window.c +++ b/lib/libcurses/base/lib_window.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_window.c,v 1.1 1999/01/18 19:10:06 millert Exp $ */ +/* $OpenBSD: lib_window.c,v 1.2 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,183 +41,185 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_window.c,v 1.13 1998/06/28 00:10:59 tom Exp $") +MODULE_ID("$From: lib_window.c,v 1.15 2000/12/10 02:43:28 tom Exp $") -void _nc_synchook(WINDOW *win) +NCURSES_EXPORT(void) +_nc_synchook(WINDOW *win) /* hook to be called after each window change */ { - if (win->_immed) wrefresh(win); - if (win->_sync) wsyncup(win); + if (win->_immed) + wrefresh(win); + if (win->_sync) + wsyncup(win); } -int mvderwin(WINDOW *win, int y, int x) +NCURSES_EXPORT(int) +mvderwin(WINDOW *win, int y, int x) /* move a derived window */ { - WINDOW *orig; - int i; - - T((T_CALLED("mvderwin(%p,%d,%d)"), win, y, x)); - - if (win && (orig = win->_parent)) - { - if (win->_parx==x && win->_pary==y) - returnCode(OK); - if (x<0 || y<0) + WINDOW *orig; + int i; + + T((T_CALLED("mvderwin(%p,%d,%d)"), win, y, x)); + + if (win && (orig = win->_parent)) { + if (win->_parx == x && win->_pary == y) + returnCode(OK); + if (x < 0 || y < 0) + returnCode(ERR); + if ((x + getmaxx(win) > getmaxx(orig)) || + (y + getmaxy(win) > getmaxy(orig))) + returnCode(ERR); + } else returnCode(ERR); - if ( (x+getmaxx(win) > getmaxx(orig)) || - (y+getmaxy(win) > getmaxy(orig)) ) - returnCode(ERR); - } - else - returnCode(ERR); - wsyncup(win); - win->_parx = x; - win->_pary = y; - for(i=0;i<getmaxy(win);i++) - win->_line[i].text = &(orig->_line[y++].text[x]); - returnCode(OK); + wsyncup(win); + win->_parx = x; + win->_pary = y; + for (i = 0; i < getmaxy(win); i++) + win->_line[i].text = &(orig->_line[y++].text[x]); + returnCode(OK); } -int syncok(WINDOW *win, bool bf) +NCURSES_EXPORT(int) +syncok(WINDOW *win, bool bf) /* enable/disable automatic wsyncup() on each change to window */ { - T((T_CALLED("syncok(%p,%d)"), win, bf)); + T((T_CALLED("syncok(%p,%d)"), win, bf)); - if (win) { - win->_sync = bf; - returnCode(OK); - } else - returnCode(ERR); + if (win) { + win->_sync = bf; + returnCode(OK); + } else + returnCode(ERR); } -void wsyncup(WINDOW *win) +NCURSES_EXPORT(void) +wsyncup(WINDOW *win) /* mark changed every cell in win's ancestors that is changed in win */ /* Rewritten by J. Pfeifer, 1-Apr-96 (don't even think that...) */ { - WINDOW *wp; - - if (win && win->_parent) - for (wp = win; wp->_parent; wp = wp->_parent) - { - int y; - WINDOW *pp = wp->_parent; - - assert((wp->_pary <= pp->_maxy) && - ((wp->_pary+wp->_maxy) <= pp->_maxy)); - - for (y = 0; y <= wp->_maxy; y++) - { - int left = wp->_line[y].firstchar; - if (left >= 0) /* line is touched */ - { - struct ldat *line = &(pp->_line[wp->_pary + y]); - /* left & right character in parent window coordinates */ - int right = wp->_line[y].lastchar + wp->_parx; - left += wp->_parx; - - CHANGED_RANGE(line, left, right); - } - } - } + WINDOW *wp; + + if (win && win->_parent) + for (wp = win; wp->_parent; wp = wp->_parent) { + int y; + WINDOW *pp = wp->_parent; + + assert((wp->_pary <= pp->_maxy) && + ((wp->_pary + wp->_maxy) <= pp->_maxy)); + + for (y = 0; y <= wp->_maxy; y++) { + int left = wp->_line[y].firstchar; + if (left >= 0) { /* line is touched */ + struct ldat *line = &(pp->_line[wp->_pary + y]); + /* left & right character in parent window coordinates */ + int right = wp->_line[y].lastchar + wp->_parx; + left += wp->_parx; + + CHANGED_RANGE(line, left, right); + } + } + } } -void wsyncdown(WINDOW *win) +NCURSES_EXPORT(void) +wsyncdown(WINDOW *win) /* mark changed every cell in win that is changed in any of its ancestors */ /* Rewritten by J. Pfeifer, 1-Apr-96 (don't even think that...) */ { - if (win && win->_parent) - { - WINDOW *pp = win->_parent; - int y; - - /* This recursion guarantees, that the changes are propagated down- - wards from the root to our direct parent. */ - wsyncdown(pp); - - /* and now we only have to propagate the changes from our direct - parent, if there are any. */ - assert((win->_pary <= pp->_maxy) && - ((win->_pary + win->_maxy) <= pp->_maxy)); - - for (y = 0; y <= win->_maxy; y++) - { - if (pp->_line[win->_pary + y].firstchar >= 0) /* parent changed */ - { - struct ldat *line = &(win->_line[y]); - /* left and right character in child coordinates */ - int left = pp->_line[win->_pary + y].firstchar - win->_parx; - int right = pp->_line[win->_pary + y].lastchar - win->_parx; - /* The change maybe outside the childs range */ - if (left<0) - left = 0; - if (right > win->_maxx) - right = win->_maxx; - CHANGED_RANGE(line, left, right); + if (win && win->_parent) { + WINDOW *pp = win->_parent; + int y; + + /* This recursion guarantees, that the changes are propagated down- + wards from the root to our direct parent. */ + wsyncdown(pp); + + /* and now we only have to propagate the changes from our direct + parent, if there are any. */ + assert((win->_pary <= pp->_maxy) && + ((win->_pary + win->_maxy) <= pp->_maxy)); + + for (y = 0; y <= win->_maxy; y++) { + if (pp->_line[win->_pary + y].firstchar >= 0) { /* parent changed */ + struct ldat *line = &(win->_line[y]); + /* left and right character in child coordinates */ + int left = pp->_line[win->_pary + y].firstchar - win->_parx; + int right = pp->_line[win->_pary + y].lastchar - win->_parx; + /* The change maybe outside the childs range */ + if (left < 0) + left = 0; + if (right > win->_maxx) + right = win->_maxx; + CHANGED_RANGE(line, left, right); } } } } -void wcursyncup(WINDOW *win) +NCURSES_EXPORT(void) +wcursyncup(WINDOW *win) /* sync the cursor in all derived windows to its value in the base window */ { - WINDOW *wp; - for( wp = win; wp && wp->_parent; wp = wp->_parent ) { - wmove( wp->_parent, wp->_pary + wp->_cury, wp->_parx + wp->_curx ); - } + WINDOW *wp; + for (wp = win; wp && wp->_parent; wp = wp->_parent) { + wmove(wp->_parent, wp->_pary + wp->_cury, wp->_parx + wp->_curx); + } } -WINDOW *dupwin(WINDOW *win) +NCURSES_EXPORT(WINDOW *) +dupwin(WINDOW *win) /* make an exact duplicate of the given window */ { -WINDOW *nwin; -size_t linesize; -int i; - - T((T_CALLED("dupwin(%p)"), win)); - - if ((win==NULL) || - ((nwin = newwin(win->_maxy + 1, win->_maxx + 1, win->_begy, win->_begx)) == NULL)) - returnWin(0); - - nwin->_curx = win->_curx; - nwin->_cury = win->_cury; - nwin->_maxy = win->_maxy; - nwin->_maxx = win->_maxx; - nwin->_begy = win->_begy; - nwin->_begx = win->_begx; - nwin->_yoffset = win->_yoffset; - - nwin->_flags = win->_flags & ~_SUBWIN; - /* Due to the use of newwin(), the clone is not a subwindow. - * The text is really copied into the clone. - */ - - nwin->_attrs = win->_attrs; - nwin->_bkgd = win->_bkgd; - - nwin->_clear = win->_clear; - nwin->_scroll = win->_scroll; - nwin->_leaveok = win->_leaveok; - nwin->_use_keypad = win->_use_keypad; - nwin->_delay = win->_delay; - nwin->_immed = win->_immed; - nwin->_sync = win->_sync; - - nwin->_parx = 0; - nwin->_pary = 0; - nwin->_parent = (WINDOW*)0; - /* See above: the clone isn't a subwindow! */ - - nwin->_regtop = win->_regtop; - nwin->_regbottom = win->_regbottom; - - linesize = (win->_maxx + 1) * sizeof(chtype); - for (i = 0; i <= nwin->_maxy; i++) { - memcpy(nwin->_line[i].text, win->_line[i].text, linesize); - nwin->_line[i].firstchar = win->_line[i].firstchar; - nwin->_line[i].lastchar = win->_line[i].lastchar; - } + WINDOW *nwin; + size_t linesize; + int i; + + T((T_CALLED("dupwin(%p)"), win)); + + if ((win == NULL) || + ((nwin = newwin(win->_maxy + 1, win->_maxx + 1, win->_begy, + win->_begx)) == NULL)) + returnWin(0); + + nwin->_curx = win->_curx; + nwin->_cury = win->_cury; + nwin->_maxy = win->_maxy; + nwin->_maxx = win->_maxx; + nwin->_begy = win->_begy; + nwin->_begx = win->_begx; + nwin->_yoffset = win->_yoffset; + + nwin->_flags = win->_flags & ~_SUBWIN; + /* Due to the use of newwin(), the clone is not a subwindow. + * The text is really copied into the clone. + */ + + nwin->_attrs = win->_attrs; + nwin->_bkgd = win->_bkgd; + + nwin->_clear = win->_clear; + nwin->_scroll = win->_scroll; + nwin->_leaveok = win->_leaveok; + nwin->_use_keypad = win->_use_keypad; + nwin->_delay = win->_delay; + nwin->_immed = win->_immed; + nwin->_sync = win->_sync; + + nwin->_parx = 0; + nwin->_pary = 0; + nwin->_parent = (WINDOW *) 0; + /* See above: the clone isn't a subwindow! */ + + nwin->_regtop = win->_regtop; + nwin->_regbottom = win->_regbottom; + + linesize = (win->_maxx + 1) * sizeof(chtype); + for (i = 0; i <= nwin->_maxy; i++) { + memcpy(nwin->_line[i].text, win->_line[i].text, linesize); + nwin->_line[i].firstchar = win->_line[i].firstchar; + nwin->_line[i].lastchar = win->_line[i].lastchar; + } - returnWin(nwin); + returnWin(nwin); } diff --git a/lib/libcurses/base/nc_panel.c b/lib/libcurses/base/nc_panel.c index 5900b317c4b..00bbda062f8 100644 --- a/lib/libcurses/base/nc_panel.c +++ b/lib/libcurses/base/nc_panel.c @@ -1,7 +1,7 @@ -/* $OpenBSD: nc_panel.c,v 1.1 1999/01/18 19:10:06 millert Exp $ */ +/* $OpenBSD: nc_panel.c,v 1.2 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -34,10 +34,10 @@ #include <curses.priv.h> -MODULE_ID("$From: nc_panel.c,v 1.2 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$From: nc_panel.c,v 1.4 2000/12/10 02:43:28 tom Exp $") -struct panelhook* +NCURSES_EXPORT(struct panelhook *) _nc_panelhook(void) { - return (SP ? &(SP->_panelHook) : NULL); + return (SP ? &(SP->_panelHook) : NULL); } diff --git a/lib/libcurses/base/resizeterm.c b/lib/libcurses/base/resizeterm.c index 3219be06cf5..829f9148820 100644 --- a/lib/libcurses/base/resizeterm.c +++ b/lib/libcurses/base/resizeterm.c @@ -1,7 +1,7 @@ -/* $OpenBSD: resizeterm.c,v 1.1 1999/01/18 19:10:07 millert Exp $ */ +/* $OpenBSD: resizeterm.c,v 1.2 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,7 +43,7 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: resizeterm.c,v 1.7 1998/09/19 19:27:43 Alexander.V.Lukyanov Exp $") +MODULE_ID("$From: resizeterm.c,v 1.9 2000/12/10 02:43:28 tom Exp $") /* * This function reallocates NCURSES window structures. It is invoked in @@ -53,71 +53,74 @@ MODULE_ID("$From: resizeterm.c,v 1.7 1998/09/19 19:27:43 Alexander.V.Lukyanov Ex * Because this performs memory allocation, it should not (in general) be * invoked directly from the signal handler. */ -int +NCURSES_EXPORT(int) resizeterm(int ToLines, int ToCols) { - int stolen = screen_lines - SP->_lines_avail; - int bottom = screen_lines + SP->_topstolen - stolen; + int stolen = screen_lines - SP->_lines_avail; + int bottom = screen_lines + SP->_topstolen - stolen; - T((T_CALLED("resizeterm(%d,%d) old(%d,%d)"), - ToLines, ToCols, - screen_lines, screen_columns)); + T((T_CALLED("resizeterm(%d,%d) old(%d,%d)"), + ToLines, ToCols, + screen_lines, screen_columns)); - SP->_sig_winch = FALSE; + SP->_sig_winch = FALSE; - if (ToLines != screen_lines - || ToCols != screen_columns) { - WINDOWLIST *wp; + if (ToLines != screen_lines + || ToCols != screen_columns) { + WINDOWLIST *wp; #if USE_SIGWINCH - ungetch(KEY_RESIZE); /* so application can know this */ - clearok(curscr, TRUE); /* screen contents are unknown */ + ungetch(KEY_RESIZE); /* so application can know this */ + clearok(curscr, TRUE); /* screen contents are unknown */ #endif - for (wp = _nc_windows; wp != 0; wp = wp->next) { - WINDOW *win = wp->win; - int myLines = win->_maxy + 1; - int myCols = win->_maxx + 1; - - /* pads aren't treated this way */ - if (win->_flags & _ISPAD) - continue; - - if (win->_begy >= bottom) { - win->_begy += (ToLines - screen_lines); - } else { - if (myLines == screen_lines - stolen - && ToLines != screen_lines) - myLines = ToLines - stolen; - else - if (myLines == screen_lines - && ToLines != screen_lines) - myLines = ToLines; - } - - if (myCols == screen_columns - && ToCols != screen_columns) - myCols = ToCols; - - if (wresize(win, myLines, myCols) != OK) - returnCode(ERR); - } - - screen_lines = lines = ToLines; - screen_columns = columns = ToCols; - - SP->_lines_avail = lines - stolen; - - if (SP->oldhash) { FreeAndNull(SP->oldhash); } - if (SP->newhash) { FreeAndNull(SP->newhash); } + for (wp = _nc_windows; wp != 0; wp = wp->next) { + WINDOW *win = wp->win; + int myLines = win->_maxy + 1; + int myCols = win->_maxx + 1; + + /* pads aren't treated this way */ + if (win->_flags & _ISPAD) + continue; + + if (win->_begy >= bottom) { + win->_begy += (ToLines - screen_lines); + } else { + if (myLines == screen_lines - stolen + && ToLines != screen_lines) + myLines = ToLines - stolen; + else if (myLines == screen_lines + && ToLines != screen_lines) + myLines = ToLines; + } + + if (myCols == screen_columns + && ToCols != screen_columns) + myCols = ToCols; + + if (wresize(win, myLines, myCols) != OK) + returnCode(ERR); } - /* - * Always update LINES, to allow for call from lib_doupdate.c which - * needs to have the count adjusted by the stolen (ripped off) lines. - */ - LINES = ToLines - stolen; - COLS = ToCols; + screen_lines = lines = ToLines; + screen_columns = columns = ToCols; - returnCode(OK); + SP->_lines_avail = lines - stolen; + + if (SP->oldhash) { + FreeAndNull(SP->oldhash); + } + if (SP->newhash) { + FreeAndNull(SP->newhash); + } + } + + /* + * Always update LINES, to allow for call from lib_doupdate.c which + * needs to have the count adjusted by the stolen (ripped off) lines. + */ + LINES = ToLines - stolen; + COLS = ToCols; + + returnCode(OK); } diff --git a/lib/libcurses/base/safe_sprintf.c b/lib/libcurses/base/safe_sprintf.c index d344b79463e..616a50127c7 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.3 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: safe_sprintf.c,v 1.4 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 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,11 +35,13 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$From: safe_sprintf.c,v 1.11 1999/09/11 18:03:27 tom Exp $") +MODULE_ID("$From: safe_sprintf.c,v 1.13 2000/12/10 02:43:28 tom Exp $") #if USE_SAFE_SPRINTF -typedef enum { Flags, Width, Prec, Type, Format } PRINTF; +typedef enum { + Flags, Width, Prec, Type, Format +} PRINTF; #define VA_INTGR(type) ival = va_arg(ap, type) #define VA_FLOAT(type) fval = va_arg(ap, type) @@ -52,190 +54,193 @@ typedef enum { Flags, Width, Prec, Type, Format } PRINTF; static int _nc_printf_length(const char *fmt, va_list ap) { - size_t length = BUFSIZ; - char *buffer; - char *format; - int len = 0; - - if (fmt == 0 || *fmt == '\0') - return -1; - if ((format = typeMalloc(char, strlen(fmt)+1)) == 0) - return -1; - if ((buffer = typeMalloc(char, length)) == 0) { - free(format); - return -1; - } - - while (*fmt != '\0') { - if (*fmt == '%') { - static char dummy[] = ""; - PRINTF state = Flags; - char *pval = dummy; /* avoid const-cast */ - double fval = 0.0; - int done = FALSE; - int ival = 0; - int prec = -1; - int type = 0; - int used = 0; - int width = -1; - size_t f = 0; - - format[f++] = *fmt; - while (*++fmt != '\0' && len >= 0 && !done) { - format[f++] = *fmt; - - if (isdigit(*fmt)) { - int num = *fmt - '0'; - if (state == Flags && num != 0) - state = Width; - if (state == Width) { - if (width < 0) - width = 0; - width = (width * 10) + num; - } else if (state == Prec) { - if (prec < 0) - prec = 0; - prec = (prec * 10) + num; - } - } else if (*fmt == '*') { - VA_INTGR(int); - if (state == Flags) - state = Width; - if (state == Width) { - width = ival; - } else if (state == Prec) { - prec = ival; - } - sprintf(&format[--f], "%d", ival); - f = strlen(format); - } else if (isalpha(*fmt)) { - done = TRUE; - switch (*fmt) { - case 'Z': /* FALLTHRU */ - case 'h': /* FALLTHRU */ - case 'l': /* FALLTHRU */ - done = FALSE; - type = *fmt; - break; - case 'i': /* FALLTHRU */ - case 'd': /* FALLTHRU */ - case 'u': /* FALLTHRU */ - case 'x': /* FALLTHRU */ - case 'X': /* FALLTHRU */ - if (type == 'l') - VA_INTGR(long); - else if (type == 'Z') - VA_INTGR(size_t); - else - VA_INTGR(int); - used = 'i'; - break; - case 'f': /* FALLTHRU */ - case 'e': /* FALLTHRU */ - case 'E': /* FALLTHRU */ - case 'g': /* FALLTHRU */ - case 'G': /* FALLTHRU */ - VA_FLOAT(double); - used = 'f'; - break; - case 'c': - VA_INTGR(int); - used = 'i'; - break; - case 's': - VA_POINT(char *); - if (prec < 0) - prec = strlen(pval); - if (prec > (int)length) { - length = length + prec; - buffer = typeRealloc(char, length, buffer); - if (buffer == 0) { - free(format); - return -1; - } - } - used = 'p'; - break; - case 'p': - VA_POINT(void *); - used = 'p'; - break; - case 'n': - VA_POINT(int *); - used = 0; - break; - default: - break; - } - } else if (*fmt == '.') { - state = Prec; - } else if (*fmt == '%') { - done = TRUE; - used = 'p'; - } - } - format[f] = '\0'; - switch (used) { - case 'i': - sprintf(buffer, format, ival); - break; - case 'f': - sprintf(buffer, format, fval); - break; - default: - sprintf(buffer, format, pval); - break; + size_t length = BUFSIZ; + char *buffer; + char *format; + int len = 0; + + if (fmt == 0 || *fmt == '\0') + return -1; + if ((format = typeMalloc(char, strlen(fmt) + 1)) == 0) + return -1; + if ((buffer = typeMalloc(char, length)) == 0) { + free(format); + return -1; + } + + while (*fmt != '\0') { + if (*fmt == '%') { + static char dummy[] = ""; + PRINTF state = Flags; + char *pval = dummy; /* avoid const-cast */ + double fval = 0.0; + int done = FALSE; + int ival = 0; + int prec = -1; + int type = 0; + int used = 0; + int width = -1; + size_t f = 0; + + format[f++] = *fmt; + while (*++fmt != '\0' && len >= 0 && !done) { + format[f++] = *fmt; + + if (isdigit(*fmt)) { + int num = *fmt - '0'; + if (state == Flags && num != 0) + state = Width; + if (state == Width) { + if (width < 0) + width = 0; + width = (width * 10) + num; + } else if (state == Prec) { + if (prec < 0) + prec = 0; + prec = (prec * 10) + num; + } + } else if (*fmt == '*') { + VA_INTGR(int); + if (state == Flags) + state = Width; + if (state == Width) { + width = ival; + } else if (state == Prec) { + prec = ival; + } + sprintf(&format[--f], "%d", ival); + f = strlen(format); + } else if (isalpha(*fmt)) { + done = TRUE; + switch (*fmt) { + case 'Z': /* FALLTHRU */ + case 'h': /* FALLTHRU */ + case 'l': /* FALLTHRU */ + done = FALSE; + type = *fmt; + break; + case 'i': /* FALLTHRU */ + case 'd': /* FALLTHRU */ + case 'u': /* FALLTHRU */ + case 'x': /* FALLTHRU */ + case 'X': /* FALLTHRU */ + if (type == 'l') + VA_INTGR(long); + else if (type == 'Z') + VA_INTGR(size_t); + else + VA_INTGR(int); + used = 'i'; + break; + case 'f': /* FALLTHRU */ + case 'e': /* FALLTHRU */ + case 'E': /* FALLTHRU */ + case 'g': /* FALLTHRU */ + case 'G': /* FALLTHRU */ + VA_FLOAT(double); + used = 'f'; + break; + case 'c': + VA_INTGR(int); + used = 'i'; + break; + case 's': + VA_POINT(char *); + if (prec < 0) + prec = strlen(pval); + if (prec > (int) length) { + length = length + prec; + buffer = typeRealloc(char, length, buffer); + if (buffer == 0) { + free(format); + return -1; + } } - len += (int)strlen(buffer); - } else { - fmt++; - len++; + used = 'p'; + break; + case 'p': + VA_POINT(void *); + used = 'p'; + break; + case 'n': + VA_POINT(int *); + used = 0; + break; + default: + break; + } + } else if (*fmt == '.') { + state = Prec; + } else if (*fmt == '%') { + done = TRUE; + used = 'p'; } + } + format[f] = '\0'; + switch (used) { + case 'i': + sprintf(buffer, format, ival); + break; + case 'f': + sprintf(buffer, format, fval); + break; + default: + sprintf(buffer, format, pval); + break; + } + len += (int) strlen(buffer); + } else { + fmt++; + len++; } + } - free(buffer); - free(format); - return len; + free(buffer); + free(format); + return len; } #endif /* * Wrapper for vsprintf that allocates a buffer big enough to hold the result. */ -char * -_nc_printf_string(const char *fmt, va_list ap) +NCURSES_EXPORT(char *) +_nc_printf_string +(const char *fmt, va_list ap) { #if USE_SAFE_SPRINTF - char *buf = 0; - int len = _nc_printf_length(fmt, ap); - - if (len > 0) { - if ((buf = typeMalloc(char, len+1)) == 0) - return(0); - vsprintf(buf, fmt, ap); - } + char *buf = 0; + int len = _nc_printf_length(fmt, ap); + + if (len > 0) { + if ((buf = typeMalloc(char, len + 1)) == 0) + return (0); + vsprintf(buf, fmt, ap); + } #else - static int rows, cols; - static char *buf; - static size_t len; - - if (screen_lines > rows || screen_columns > cols) { - if (screen_lines > rows) rows = screen_lines; - if (screen_columns > cols) cols = screen_columns; - len = (rows * (cols + 1)) + 1; - buf = typeRealloc(char, len, buf); - if (buf == 0) { - return(0); - } + static int rows, cols; + static char *buf; + static size_t len; + + if (screen_lines > rows || screen_columns > cols) { + if (screen_lines > rows) + rows = screen_lines; + if (screen_columns > cols) + cols = screen_columns; + len = (rows * (cols + 1)) + 1; + buf = typeRealloc(char, len, buf); + if (buf == 0) { + return (0); } + } - if (buf != 0) { + if (buf != 0) { # if HAVE_VSNPRINTF - vsnprintf(buf, len, fmt, ap); /* GNU extension */ + vsnprintf(buf, len, fmt, ap); /* GNU extension */ # else - vsprintf(buf, fmt, ap); /* ANSI */ + vsprintf(buf, fmt, ap); /* ANSI */ # endif - } + } #endif - return buf; + return buf; } diff --git a/lib/libcurses/base/sigaction.c b/lib/libcurses/base/sigaction.c index 71ab97bbaf7..f25543c4dea 100644 --- a/lib/libcurses/base/sigaction.c +++ b/lib/libcurses/base/sigaction.c @@ -1,7 +1,7 @@ -/* $OpenBSD: sigaction.c,v 1.3 1999/06/27 08:14:21 millert Exp $ */ +/* $OpenBSD: sigaction.c,v 1.4 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,66 +43,78 @@ #if !HAVE_SIGACTION && HAVE_SIGVEC -MODULE_ID("$From: sigaction.c,v 1.9 1999/06/19 23:05:16 tom Exp $") +MODULE_ID("$From: sigaction.c,v 1.11 2000/12/10 02:43:28 tom Exp $") -int -sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact) +NCURSES_EXPORT(int) +sigaction +(int sig, sigaction_t * sigact, sigaction_t * osigact) { - return sigvec(sig, sigact, osigact); + return sigvec(sig, sigact, osigact); } -int -sigemptyset (sigset_t * mask) +NCURSES_EXPORT(int) +sigemptyset +(sigset_t * mask) { - *mask = 0; - return 0; + *mask = 0; + return 0; } -int -sigprocmask (int mode, sigset_t * mask, sigset_t * omask) +NCURSES_EXPORT(int) +sigprocmask +(int mode, sigset_t * mask, sigset_t * omask) { - sigset_t current = sigsetmask(0); + sigset_t current = sigsetmask(0); - if (omask) *omask = current; + if (omask) + *omask = current; - if (mode==SIG_BLOCK) - current |= *mask; - else if (mode==SIG_UNBLOCK) - current &= ~*mask; - else if (mode==SIG_SETMASK) - current = *mask; + if (mode == SIG_BLOCK) + current |= *mask; + else if (mode == SIG_UNBLOCK) + current &= ~*mask; + else if (mode == SIG_SETMASK) + current = *mask; - sigsetmask(current); - return 0; + sigsetmask(current); + return 0; } -int -sigsuspend (sigset_t * mask) +NCURSES_EXPORT(int) +sigsuspend(sigset_t * mask) { - return sigpause (*mask); + return sigpause(*mask); } -int -sigdelset (sigset_t * mask, int sig) +NCURSES_EXPORT(int) +sigdelset +(sigset_t * mask, int sig) { - *mask &= ~sigmask (sig); - return 0; + *mask &= ~sigmask(sig); + return 0; } -int -sigaddset (sigset_t * mask, int sig) +NCURSES_EXPORT(int) +sigaddset +(sigset_t * mask, int sig) { - *mask |= sigmask (sig); - return 0; + *mask |= sigmask(sig); + return 0; } -int -sigismember (sigset_t * mask, int sig) +NCURSES_EXPORT(int) +sigismember +(sigset_t * mask, int sig) { - return (*mask & sigmask (sig)) != 0; + return (*mask & sigmask(sig)) != 0; } #else -extern void _nc_sigaction(void); /* quiet's gcc warning */ -void _nc_sigaction(void) { } /* nonempty for strict ANSI compilers */ +extern +NCURSES_EXPORT(void) +_nc_sigaction(void); /* quiet's gcc warning */ +NCURSES_EXPORT(void) +_nc_sigaction(void) +{ +} /* nonempty for strict ANSI compilers */ #endif diff --git a/lib/libcurses/base/tries.c b/lib/libcurses/base/tries.c index 11c57829141..15d48289d49 100644 --- a/lib/libcurses/base/tries.c +++ b/lib/libcurses/base/tries.c @@ -1,7 +1,7 @@ -/* $OpenBSD: tries.c,v 1.3 1999/03/02 06:23:27 millert Exp $ */ +/* $OpenBSD: tries.c,v 1.4 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,100 +41,106 @@ #include <curses.priv.h> -MODULE_ID("$From: tries.c,v 1.12 1999/03/01 23:23:59 tom Exp $") +MODULE_ID("$From: tries.c,v 1.14 2000/12/10 02:43:28 tom Exp $") /* * Expand a keycode into the string that it corresponds to, returning null if * no match was found, otherwise allocating a string of the result. */ -char *_nc_expand_try(struct tries *tree, unsigned short code, int *count, size_t len) +NCURSES_EXPORT(char *) +_nc_expand_try +(struct tries *tree, unsigned short code, int *count, size_t len) { - struct tries *ptr = tree; - char *result = 0; + struct tries *ptr = tree; + char *result = 0; - if (code != 0) { - while (ptr != 0) { - if ((result = _nc_expand_try(ptr->child, code, count, len + 1)) != 0) { - break; - } - if (ptr->value == code) { - *count -= 1; - if (*count == -1) { - result = typeCalloc(char, len+2); - break; - } - } - ptr = ptr->sibling; + if (code != 0) { + while (ptr != 0) { + if ((result = _nc_expand_try(ptr->child, code, count, len + 1)) + != 0) { + break; + } + if (ptr->value == code) { + *count -= 1; + if (*count == -1) { + result = typeCalloc(char, len + 2); + break; } + } + ptr = ptr->sibling; } - if (result != 0) { - if ((result[len] = ptr->ch) == 0) - *((unsigned char *)(result+len)) = 128; + } + if (result != 0) { + if ((result[len] = ptr->ch) == 0) + *((unsigned char *) (result + len)) = 128; #ifdef TRACE - if (len == 0) - _tracef("expand_key %s %s", _trace_key(code), _nc_visbuf(result)); + if (len == 0) + _tracef("expand_key %s %s", _trace_key(code), _nc_visbuf(result)); #endif - } - return result; + } + return result; } /* * Remove a code from the specified tree, freeing the unused nodes. Returns * true if the code was found/removed. */ -int _nc_remove_key(struct tries **tree, unsigned short code) +NCURSES_EXPORT(int) +_nc_remove_key +(struct tries **tree, unsigned short code) { - T((T_CALLED("_nc_remove_key(%p,%d)"), tree, code)); + T((T_CALLED("_nc_remove_key(%p,%d)"), tree, code)); - if (code == 0) - returnCode(FALSE); - - while (*tree != 0) { - if (_nc_remove_key(&(*tree)->child, code)) { - returnCode(TRUE); - } - if ((*tree)->value == code) { - if((*tree)->child) { - /* don't cut the whole sub-tree */ - (*tree)->value = 0; - } else { - struct tries *to_free = *tree; - *tree = (*tree)->sibling; - free(to_free); - } - returnCode(TRUE); - } - tree = &(*tree)->sibling; - } + if (code == 0) returnCode(FALSE); + + while (*tree != 0) { + if (_nc_remove_key(&(*tree)->child, code)) { + returnCode(TRUE); + } + if ((*tree)->value == code) { + if ((*tree)->child) { + /* don't cut the whole sub-tree */ + (*tree)->value = 0; + } else { + struct tries *to_free = *tree; + *tree = (*tree)->sibling; + free(to_free); + } + returnCode(TRUE); + } + tree = &(*tree)->sibling; + } + returnCode(FALSE); } /* * Remove a string from the specified tree, freeing the unused nodes. Returns * true if the string was found/removed. */ -int _nc_remove_string(struct tries **tree, char *string) +NCURSES_EXPORT(int) +_nc_remove_string(struct tries **tree, char *string) { - T((T_CALLED("_nc_remove_string(%p,%s)"), tree, _nc_visbuf(string))); + T((T_CALLED("_nc_remove_string(%p,%s)"), tree, _nc_visbuf(string))); - if (string == 0 || *string == 0) - returnCode(FALSE); - - while (*tree != 0) { - if ((unsigned char)(*tree)->ch == (unsigned char)*string) { - if (string[1] != 0) - returnCode(_nc_remove_string(&(*tree)->child, string+1)); - if((*tree)->child) { - /* don't cut the whole sub-tree */ - (*tree)->value = 0; - } else { - struct tries *to_free = *tree; - *tree = (*tree)->sibling; - free(to_free); - } - returnCode(TRUE); - } - tree = &(*tree)->sibling; - } + if (string == 0 || *string == 0) returnCode(FALSE); + + while (*tree != 0) { + if ((unsigned char) (*tree)->ch == (unsigned char) *string) { + if (string[1] != 0) + returnCode(_nc_remove_string(&(*tree)->child, string + 1)); + if ((*tree)->child) { + /* don't cut the whole sub-tree */ + (*tree)->value = 0; + } else { + struct tries *to_free = *tree; + *tree = (*tree)->sibling; + free(to_free); + } + returnCode(TRUE); + } + tree = &(*tree)->sibling; + } + returnCode(FALSE); } diff --git a/lib/libcurses/base/version.c b/lib/libcurses/base/version.c index df07a6f9dc0..d404e11d6ed 100644 --- a/lib/libcurses/base/version.c +++ b/lib/libcurses/base/version.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 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 * @@ -32,16 +32,16 @@ #include <curses.priv.h> -MODULE_ID("$From: version.c,v 1.1 1999/10/23 13:28:49 tom Exp $") +MODULE_ID("$From: version.c,v 1.4 2000/12/10 02:43:28 tom Exp $") -const char * +NCURSES_EXPORT(const char *) curses_version(void) { static char my_version[80]; T((T_CALLED("curses_version()"))); sprintf(my_version, "ncurses %s.%d", - NCURSES_VERSION, - NCURSES_VERSION_PATCH); + NCURSES_VERSION, + NCURSES_VERSION_PATCH); returnPtr(my_version); } diff --git a/lib/libcurses/base/wresize.c b/lib/libcurses/base/wresize.c index 9eacdbf6a0d..d513f29b9d3 100644 --- a/lib/libcurses/base/wresize.c +++ b/lib/libcurses/base/wresize.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wresize.c,v 1.3 2000/03/10 01:35:03 millert Exp $ */ +/* $OpenBSD: wresize.c,v 1.4 2001/01/22 18:01:49 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -34,7 +34,7 @@ #include <curses.priv.h> -MODULE_ID("$From: wresize.c,v 1.16 2000/03/05 00:14:35 tom Exp $") +MODULE_ID("$From: wresize.c,v 1.18 2000/12/10 02:43:28 tom Exp $") /* * Reallocate a curses WINDOW struct to either shrink or grow to the specified @@ -46,7 +46,7 @@ MODULE_ID("$From: wresize.c,v 1.16 2000/03/05 00:14:35 tom Exp $") #define ld_ALLOC(p,n) DOALLOC(p,struct ldat,n) #define c_ALLOC(p,n) DOALLOC(p,chtype,n) -int +NCURSES_EXPORT(int) wresize(WINDOW *win, int ToLines, int ToCols) { register int row; @@ -58,9 +58,9 @@ wresize(WINDOW *win, int ToLines, int ToCols) T((T_CALLED("wresize(%p,%d,%d)"), win, ToLines, ToCols)); if (win) { TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", - win->_begy, win->_begx, - win->_maxy, win->_maxx, - win->_regtop, win->_regbottom)); + win->_begy, win->_begx, + win->_maxy, win->_maxx, + win->_regtop, win->_regbottom)); if (_nc_tracing & TRACE_UPDATE) _tracedump("...before", win); } @@ -171,9 +171,9 @@ wresize(WINDOW *win, int ToLines, int ToCols) #ifdef TRACE TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", - win->_begy, win->_begx, - win->_maxy, win->_maxx, - win->_regtop, win->_regbottom)); + win->_begy, win->_begx, + win->_maxy, win->_maxx, + win->_regtop, win->_regbottom)); if (_nc_tracing & TRACE_UPDATE) _tracedump("...after:", win); #endif diff --git a/lib/libcurses/curs_deleteln.3 b/lib/libcurses/curs_deleteln.3 index 938c5e40aa7..69699b7d430 100644 --- a/lib/libcurses/curs_deleteln.3 +++ b/lib/libcurses/curs_deleteln.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: curs_deleteln.3,v 1.7 2000/07/10 03:06:06 millert Exp $ +.\" $OpenBSD: curs_deleteln.3,v 1.8 2001/01/22 18:01:33 millert Exp $ .\" .\"*************************************************************************** .\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -28,7 +28,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: curs_deleteln.3x,v 1.6 2000/07/01 19:56:12 tom Exp $ +.\" $From: curs_deleteln.3x,v 1.7 2000/11/11 20:43:20 Bernhard.Rosenkraenzer Exp $ .TH curs_deleteln 3 "" .SH NAME \fBdeleteln\fR, @@ -63,7 +63,7 @@ bottom lines are lost. For negative \fIn\fR, delete \fIn\fR lines (starting with the one under the cursor), and move the remaining lines up. The bottom \fIn\fR lines are cleared. The current cursor position remains the same. -The \fBinsertln\fR and \fBinsertln\fR routines, insert a blank line above the +The \fBinsertln\fR and \fBwinsertln\fR routines, insert a blank line above the current line and the bottom line is lost. .SH RETURN VALUE All routines return the integer \fBERR\fR upon failure and an \fBOK\fR (SVr4 diff --git a/lib/libcurses/curses.3tbl b/lib/libcurses/curses.3tbl index 434f675bf54..8ee2a5657bf 100644 --- a/lib/libcurses/curses.3tbl +++ b/lib/libcurses/curses.3tbl @@ -1,5 +1,5 @@ '\" t -.\" $OpenBSD: curses.3tbl,v 1.17 2000/10/10 15:10:29 millert Exp $ +.\" $OpenBSD: curses.3tbl,v 1.18 2001/01/22 18:01:33 millert Exp $ .\" .\"*************************************************************************** .\" Copyright (c) 1998,1999 Free Software Foundation, Inc. * @@ -29,7 +29,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: ncurses.3x,v 1.44 2000/10/08 01:39:26 tom Exp $ +.\" $From: ncurses.3x,v 1.46 2000/11/25 21:58:45 tom Exp $ .TH ncurses 3 "" .ds n 5 .ds d /usr/share/terminfo diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h index e738eee8088..cd125521da8 100644 --- a/lib/libcurses/curses.h +++ b/lib/libcurses/curses.h @@ -1,4 +1,4 @@ -/* $OpenBSD: curses.h,v 1.56 2000/12/06 17:18:49 deraadt Exp $ */ +/* $OpenBSD: curses.h,v 1.57 2001/01/22 18:01:33 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -33,7 +33,7 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ -/* $From: curses.h.in,v 1.96 2000/09/16 16:11:01 tom Exp $ */ +/* $From: curses.h.in,v 1.97 2000/12/10 02:00:24 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H @@ -50,12 +50,25 @@ /* These are defined only in curses.h, and are used for conditional compiles */ #define NCURSES_VERSION_MAJOR 5 #define NCURSES_VERSION_MINOR 2 -#define NCURSES_VERSION_PATCH 20001021 +#define NCURSES_VERSION_PATCH 20010114 /* This is defined in more than one ncurses header, for identification */ #undef NCURSES_VERSION #define NCURSES_VERSION "5.2" +#if !defined(NCURSES_IMPEXP) +# define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +# define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + #ifdef NCURSES_NOMACROS #define NCURSES_ATTR_T attr_t #endif @@ -125,8 +138,8 @@ extern "C" { #define WA_VERTICAL A_VERTICAL /* colors */ -extern int COLORS; -extern int COLOR_PAIRS; +extern NCURSES_EXPORT_VAR(int) COLORS; +extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; #define COLOR_BLACK 0 #define COLOR_RED 1 @@ -139,7 +152,7 @@ extern int COLOR_PAIRS; /* line graphics */ -extern chtype acs_map[]; +extern NCURSES_EXPORT_VAR(chtype) acs_map[]; /* VT100 symbols begin here */ #define ACS_ULCORNER (acs_map['l']) /* upper left corner */ @@ -306,33 +319,33 @@ struct _win_st NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ }; -extern WINDOW *stdscr; -extern WINDOW *curscr; -extern WINDOW *newscr; +extern NCURSES_EXPORT_VAR(WINDOW *) stdscr; +extern NCURSES_EXPORT_VAR(WINDOW *) curscr; +extern NCURSES_EXPORT_VAR(WINDOW *) newscr; -extern int LINES; -extern int COLS; -extern int TABSIZE; +extern NCURSES_EXPORT_VAR(int) LINES; +extern NCURSES_EXPORT_VAR(int) COLS; +extern NCURSES_EXPORT_VAR(int) TABSIZE; /* * This global was an undocumented feature under AIX curses. */ -extern int ESCDELAY; /* ESC expire time in milliseconds */ +extern NCURSES_EXPORT_VAR(int) ESCDELAY; /* ESC expire time in milliseconds */ -extern char ttytype[]; /* needed for backward compatibility */ +extern NCURSES_EXPORT_VAR(char) ttytype[]; /* needed for backward compatibility */ /* * These functions are extensions - not in XSI Curses. */ -extern char *keybound (int, int); -extern const char *curses_version (void); -extern int assume_default_colors (int, int); -extern int define_key (char *, int); -extern int keyok (int, bool); -extern int resizeterm (int, int); -extern int use_default_colors (void); -extern int use_extended_names (bool); -extern int wresize (WINDOW *, int, int); +extern NCURSES_EXPORT(char *) keybound (int, int); +extern NCURSES_EXPORT(const char *) curses_version (void); +extern NCURSES_EXPORT(int) assume_default_colors (int, int); +extern NCURSES_EXPORT(int) define_key (char *, int); +extern NCURSES_EXPORT(int) keyok (int, bool); +extern NCURSES_EXPORT(int) resizeterm (int, int); +extern NCURSES_EXPORT(int) use_default_colors (void); +extern NCURSES_EXPORT(int) use_extended_names (bool); +extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int); /* * GCC (and some other compilers) define '__attribute__'; we're using this @@ -386,478 +399,478 @@ extern int wresize (WINDOW *, int, int); * requirements. */ -extern int addch(const chtype); /* generated */ -extern int addchnstr(const chtype *, int); /* generated */ -extern int addchstr(const chtype *); /* generated */ -extern int addnstr(const char *, int); /* generated */ -extern int addstr(const char *); /* generated */ +extern NCURSES_EXPORT(int) addch (const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */ +extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) addstr (const char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int addnwstr(const wchar_t *, int); /* missing */ -extern int addwstr(const wchar_t *); /* missing */ -extern int add_wch(const cchar_t *); /* missing */ -extern int add_wchnstr(const cchar_t *, int); /* missing */ -extern int add_wchstr(const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) addnwstr (const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) addwstr (const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) add_wch (const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) add_wchnstr (const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) add_wchstr (const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int attroff(NCURSES_ATTR_T); /* generated */ -extern int attron(NCURSES_ATTR_T); /* generated */ -extern int attrset(NCURSES_ATTR_T); /* generated */ -extern int attr_get(attr_t *, short *, void *); /* generated */ -extern int attr_off(attr_t, void *); /* generated */ -extern int attr_on(attr_t, void *); /* generated */ -extern int attr_set(attr_t, short, void *); /* generated */ -extern int baudrate(void); /* implemented */ -extern int beep(void); /* implemented */ -extern int bkgd(chtype); /* generated */ -extern void bkgdset(chtype); /* generated */ +extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *); /* generated */ +extern NCURSES_EXPORT(int) baudrate (void); /* implemented */ +extern NCURSES_EXPORT(int) beep (void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern void bkgrndset(const cchar_t *); /* missing */ -extern int bkgrnd(const cchar_t *); /* missing */ +extern NCURSES_EXPORT(void) bkgrndset (const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) bkgrnd (const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int border(chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ +extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int border_set(const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* missing */ +extern NCURSES_EXPORT(int) border_set (const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int box(WINDOW *, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int box_set(WINDOW *, const cchar_t *, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) box_set (WINDOW *, const cchar_t *, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern bool can_change_color(void); /* implemented */ -extern int cbreak(void); /* implemented */ -extern int chgat(int, attr_t, short, const void *); /* generated */ -extern int clear(void); /* generated */ -extern int clearok(WINDOW *,bool); /* implemented */ -extern int clrtobot(void); /* generated */ -extern int clrtoeol(void); /* generated */ -extern int color_content(short,short*,short*,short*); /* implemented */ -extern int color_set(short,void*); /* generated */ -extern int COLOR_PAIR(int); /* generated */ -extern int copywin(const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ -extern int curs_set(int); /* implemented */ -extern int def_prog_mode(void); /* implemented */ -extern int def_shell_mode(void); /* implemented */ -extern int delay_output(int); /* implemented */ -extern int delch(void); /* generated */ -extern void delscreen(SCREEN *); /* implemented */ -extern int delwin(WINDOW *); /* implemented */ -extern int deleteln(void); /* generated */ -extern WINDOW *derwin(WINDOW *,int,int,int,int); /* implemented */ -extern int doupdate(void); /* implemented */ -extern WINDOW *dupwin(WINDOW *); /* implemented */ -extern int echo(void); /* implemented */ -extern int echochar(const chtype); /* generated */ -extern int erase(void); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *); /* generated */ +extern NCURSES_EXPORT(int) clear (void); /* generated */ +extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot (void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */ +extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*); /* implemented */ +extern NCURSES_EXPORT(int) color_set (short,void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */ +extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set (int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output (int); /* implemented */ +extern NCURSES_EXPORT(int) delch (void); /* generated */ +extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) deleteln (void); /* generated */ +extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) echo (void); /* implemented */ +extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase (void); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int echo_wchar(const cchar_t *); /* missing */ -extern int erasewchar(wchar_t*); /* missing */ +extern NCURSES_EXPORT(int) echo_wchar (const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) erasewchar (wchar_t*); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int endwin(void); /* implemented */ -extern char erasechar(void); /* implemented */ -extern void filter(void); /* implemented */ -extern int flash(void); /* implemented */ -extern int flushinp(void); /* implemented */ -extern chtype getbkgd(WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) endwin (void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar (void); /* implemented */ +extern NCURSES_EXPORT(void) filter (void); /* implemented */ +extern NCURSES_EXPORT(int) flash (void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp (void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int getbkgrnd(cchar_t *); /* missing */ -extern int getcchar(const cchar_t *, wchar_t*, attr_t*, short*, void*); /* missing */ +extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, short*, void*); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int getch(void); /* generated */ -extern int getnstr(char *, int); /* generated */ +extern NCURSES_EXPORT(int) getch (void); /* generated */ +extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int getn_wstr(wint_t *, int); /* missing */ +extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int getstr(char *); /* generated */ +extern NCURSES_EXPORT(int) getstr (char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int get_wch(wint_t *); /* missing */ +extern NCURSES_EXPORT(int) get_wch (wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern WINDOW *getwin(FILE *); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int get_wstr(wint_t *); /* missing */ +extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int halfdelay(int); /* implemented */ -extern bool has_colors(void); /* implemented */ -extern bool has_ic(void); /* implemented */ -extern bool has_il(void); /* implemented */ -extern int hline(chtype, int); /* generated */ +extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il (void); /* implemented */ +extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int hline_set(const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern void idcok(WINDOW *, bool); /* implemented */ -extern int idlok(WINDOW *, bool); /* implemented */ -extern void immedok(WINDOW *, bool); /* implemented */ -extern chtype inch(void); /* generated */ -extern int inchnstr(chtype *, int); /* generated */ -extern int inchstr(chtype *); /* generated */ -extern WINDOW *initscr(void); /* implemented */ -extern int init_color(short,short,short,short); /* implemented */ -extern int init_pair(short,short,short); /* implemented */ -extern int innstr(char *, int); /* generated */ +extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch (void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */ +extern NCURSES_EXPORT(int) init_color (short,short,short,short); /* implemented */ +extern NCURSES_EXPORT(int) init_pair (short,short,short); /* implemented */ +extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int innwstr(wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) innwstr (wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int insch(chtype); /* generated */ -extern int insdelln(int); /* generated */ -extern int insertln(void); /* generated */ -extern int insnstr(const char *, int); /* generated */ -extern int insstr(const char *); /* generated */ -extern int instr(char *); /* generated */ +extern NCURSES_EXPORT(int) insch (chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln (int); /* generated */ +extern NCURSES_EXPORT(int) insertln (void); /* generated */ +extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) insstr (const char *); /* generated */ +extern NCURSES_EXPORT(int) instr (char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int ins_nwstr(const wchar_t *, int); /* missing */ -extern int ins_wch(const cchar_t *); /* missing */ -extern int ins_wstr(const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) ins_nwstr (const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) ins_wch (const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) ins_wstr (const wchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int intrflush(WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int inwstr(wchar_t *); /* missing */ -extern int in_wch(NCURSES_CONST cchar_t *); /* missing */ -extern int in_wchstr(NCURSES_CONST cchar_t *); /* missing */ -extern int in_wchnstr(NCURSES_CONST cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) inwstr (wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) in_wch (NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) in_wchstr (NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) in_wchnstr (NCURSES_CONST cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern bool isendwin(void); /* implemented */ -extern bool is_linetouched(WINDOW *,int); /* implemented */ -extern bool is_wintouched(WINDOW *); /* implemented */ -extern NCURSES_CONST char *keyname(int); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern char *key_name(wchar_t); /* missing */ +extern NCURSES_EXPORT(char *) key_name (wchar_t); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int keypad(WINDOW *,bool); /* implemented */ -extern char killchar(void); /* implemented */ +extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar (void); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int killwchar(wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) killwchar (wchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int leaveok(WINDOW *,bool); /* implemented */ -extern char *longname(void); /* implemented */ -extern int meta(WINDOW *,bool); /* implemented */ -extern int move(int, int); /* generated */ -extern int mvaddch(int, int, const chtype); /* generated */ -extern int mvaddchnstr(int, int, const chtype *, int); /* generated */ -extern int mvaddchstr(int, int, const chtype *); /* generated */ -extern int mvaddnstr(int, int, const char *, int); /* generated */ -extern int mvaddstr(int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char *) longname (void); /* implemented */ +extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) move (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvaddnwstr(int, int, const wchar_t *, int); /* missing */ -extern int mvaddwstr(int, int, const wchar_t *); /* missing */ -extern int mvadd_wch(int, int, const cchar_t *); /* missing */ -extern int mvadd_wchnstr(int, int, const cchar_t *, int);/* missing */ -extern int mvadd_wchstr(int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvaddnwstr (int, int, const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvaddwstr (int, int, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvadd_wch (int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvadd_wchnstr (int, int, const cchar_t *, int);/* missing */ +extern NCURSES_EXPORT(int) mvadd_wchstr (int, int, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvchgat(int, int, int, attr_t, short, const void *); /* generated */ -extern int mvcur(int,int,int,int); /* implemented */ -extern int mvdelch(int, int); /* generated */ -extern int mvderwin(WINDOW *, int, int); /* implemented */ -extern int mvgetch(int, int); /* generated */ -extern int mvgetnstr(int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *); /* generated */ +extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvgetn_wstr(int, int, wint_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvgetn_wstr (int, int, wint_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvgetstr(int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvget_wch(int, int, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) mvget_wch (int, int, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvget_wstr(int, int, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) mvget_wstr (int, int, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvhline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvhline_set(int, int, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvhline_set (int, int, const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern chtype mvinch(int, int); /* generated */ -extern int mvinchnstr(int, int, chtype *, int); /* generated */ -extern int mvinchstr(int, int, chtype *); /* generated */ -extern int mvinnstr(int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvinnwstr(int, int, wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvinnwstr (int, int, wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvinsch(int, int, chtype); /* generated */ -extern int mvinsnstr(int, int, const char *, int); /* generated */ -extern int mvinsstr(int, int, const char *); /* generated */ -extern int mvinstr(int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvins_nwstr(int, int, const wchar_t *, int); /* missing */ -extern int mvins_wch(int, int, const cchar_t *); /* missing */ -extern int mvins_wstr(int, int, const wchar_t *); /* missing */ -extern int mvinwstr(int, int, wchar_t *); /* missing */ -extern int mvin_wch(int, int, NCURSES_CONST cchar_t *); /* missing */ -extern int mvin_wchstr(int, int, NCURSES_CONST cchar_t *); /* missing */ -extern int mvin_wchnstr(int, int, NCURSES_CONST cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvins_nwstr (int, int, const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvins_wch (int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvins_wstr (int, int, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvinwstr (int, int, wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvin_wch (int, int, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvin_wchstr (int, int, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvin_wchnstr (int, int, NCURSES_CONST cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvprintw(int,int, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) mvprintw (int,int, NCURSES_CONST char *,...) /* implemented */ GCC_PRINTFLIKE(3,4); -extern int mvscanw(int,int, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(3,4); -extern int mvvline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvvline_set(int, int, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvvline_set (int, int, const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwaddch(WINDOW *, int, int, const chtype); /* generated */ -extern int mvwaddchnstr(WINDOW *, int, int, const chtype *, int);/* generated */ -extern int mvwaddchstr(WINDOW *, int, int, const chtype *); /* generated */ -extern int mvwaddnstr(WINDOW *, int, int, const char *, int); /* generated */ -extern int mvwaddstr(WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */ +extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);/* missing */ -extern int mvwaddwstr(WINDOW *, int, int, const wchar_t *); /* missing */ -extern int mvwadd_wch(WINDOW *, int, int, const cchar_t *); /* missing */ -extern int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int); /* missing */ -extern int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwaddnwstr (WINDOW *, int, int, const wchar_t *, int);/* missing */ +extern NCURSES_EXPORT(int) mvwaddwstr (WINDOW *, int, int, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwadd_wch (WINDOW *, int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwadd_wchnstr (WINDOW *, int, int, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW *, int, int, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);/* generated */ -extern int mvwdelch(WINDOW *, int, int); /* generated */ -extern int mvwgetch(WINDOW *, int, int); /* generated */ -extern int mvwgetnstr(WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */ +extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int);/* missing */ +extern NCURSES_EXPORT(int) mvwgetn_wstr (WINDOW *, int, int, wint_t *, int);/* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwgetstr(WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwget_wch(WINDOW *, int, int, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwget_wch (WINDOW *, int, int, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwget_wstr(WINDOW *, int, int, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwget_wstr (WINDOW *, int, int, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwhline(WINDOW *, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwhline_set(WINDOW *, int, int, const cchar_t *, int);/* missing */ +extern NCURSES_EXPORT(int) mvwhline_set (WINDOW *, int, int, const cchar_t *, int);/* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwin(WINDOW *,int,int); /* implemented */ -extern chtype mvwinch(WINDOW *, int, int); /* generated */ -extern int mvwinchnstr(WINDOW *, int, int, chtype *, int); /* generated */ -extern int mvwinchstr(WINDOW *, int, int, chtype *); /* generated */ -extern int mvwinnstr(WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwinnwstr(WINDOW *, int, int, wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwinsch(WINDOW *, int, int, chtype); /* generated */ -extern int mvwinsnstr(WINDOW *, int, int, const char *, int); /* generated */ -extern int mvwinsstr(WINDOW *, int, int, const char *); /* generated */ -extern int mvwinstr(WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwins_nwstr(WINDOW *, int,int, const wchar_t *,int); /* missing */ -extern int mvwins_wch(WINDOW *, int, int, const cchar_t *); /* missing */ -extern int mvwins_wstr(WINDOW *, int, int, const wchar_t *); /* missing */ -extern int mvwinwstr(WINDOW *, int, int, wchar_t *); /* missing */ -extern int mvwin_wch(WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */ -extern int mvwin_wchnstr(WINDOW *, int,int, NCURSES_CONST cchar_t *,int); /* missing */ -extern int mvwin_wchstr(WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwins_nwstr (WINDOW *, int,int, const wchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) mvwins_wch (WINDOW *, int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwin_wch (WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW *, int,int, NCURSES_CONST cchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) mvwin_wchstr (WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwprintw(WINDOW*,int,int, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, NCURSES_CONST char *,...) /* implemented */ GCC_PRINTFLIKE(4,5); -extern int mvwscanw(WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(4,5); -extern int mvwvline(WINDOW *,int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwvline_set(WINDOW *, int,int, const cchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int napms(int); /* implemented */ -extern WINDOW *newpad(int,int); /* implemented */ -extern SCREEN *newterm(NCURSES_CONST char *,FILE *,FILE *); /* implemented */ -extern WINDOW *newwin(int,int,int,int); /* implemented */ -extern int nl(void); /* implemented */ -extern int nocbreak(void); /* implemented */ -extern int nodelay(WINDOW *,bool); /* implemented */ -extern int noecho(void); /* implemented */ -extern int nonl(void); /* implemented */ -extern void noqiflush(void); /* implemented */ -extern int noraw(void); /* implemented */ -extern int notimeout(WINDOW *,bool); /* implemented */ -extern int overlay(const WINDOW*,WINDOW *); /* implemented */ -extern int overwrite(const WINDOW*,WINDOW *); /* implemented */ -extern int pair_content(short,short*,short*); /* implemented */ -extern int PAIR_NUMBER(int); /* generated */ -extern int pechochar(WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) napms (int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */ +extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) nl (void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho (void); /* implemented */ +extern NCURSES_EXPORT(int) nonl (void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) noraw (void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) pair_content (short,short*,short*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */ +extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int pecho_wchar(WINDOW *, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int pnoutrefresh(WINDOW*,int,int,int,int,int,int);/* implemented */ -extern int prefresh(WINDOW *,int,int,int,int,int,int); /* implemented */ -extern int printw(NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */ +extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) printw (NCURSES_CONST char *,...) /* implemented */ GCC_PRINTFLIKE(1,2); -extern int putp(const char *); /* implemented */ -extern int putwin(WINDOW *, FILE *); /* implemented */ -extern void qiflush(void); /* implemented */ -extern int raw(void); /* implemented */ -extern int redrawwin(WINDOW *); /* generated */ -extern int refresh(void); /* generated */ -extern int resetty(void); /* implemented */ -extern int reset_prog_mode(void); /* implemented */ -extern int reset_shell_mode(void); /* implemented */ -extern int ripoffline(int, int (*init)(WINDOW *, int)); /* implemented */ -extern int savetty(void); /* implemented */ -extern int scanw(NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) putp (const char *); /* implemented */ +extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */ +extern NCURSES_EXPORT(void) qiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) raw (void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) refresh (void); /* generated */ +extern NCURSES_EXPORT(int) resetty (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) ripoffline (int, int (*init)(WINDOW *, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty (void); /* implemented */ +extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(1,2); -extern int scr_dump(const char *); /* implemented */ -extern int scr_init(const char *); /* implemented */ -extern int scrl(int); /* generated */ -extern int scroll(WINDOW *); /* generated */ -extern int scrollok(WINDOW *,bool); /* implemented */ -extern int scr_restore(const char *); /* implemented */ -extern int scr_set(const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scrl (int); /* generated */ +extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int setcchar(cchar_t *, const wchar_t *, const attr_t, short, const void *); /* missing */ +extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, short, const void *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int setscrreg(int,int); /* generated */ -extern SCREEN *set_term(SCREEN *); /* implemented */ -extern int slk_attroff(const chtype); /* implemented */ -extern int slk_attr_off(const attr_t, void *); /* generated:WIDEC */ -extern int slk_attron(const chtype); /* implemented */ -extern int slk_attr_on(attr_t,void*); /* generated:WIDEC */ -extern int slk_attrset(const chtype); /* implemented */ -extern attr_t slk_attr(void); /* implemented */ -extern int slk_attr_set(const attr_t,short,void*); /* implemented */ -extern int slk_clear(void); /* implemented */ -extern int slk_color(short); /* implemented */ -extern int slk_init(int); /* implemented */ -extern char *slk_label(int); /* implemented */ -extern int slk_noutrefresh(void); /* implemented */ -extern int slk_refresh(void); /* implemented */ -extern int slk_restore(void); /* implemented */ -extern int slk_set(int,const char *,int); /* implemented */ -extern int slk_touch(void); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */ +extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color (short); /* implemented */ +extern NCURSES_EXPORT(int) slk_init (int); /* implemented */ +extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int slk_wset(int, const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int standout(void); /* generated */ -extern int standend(void); /* generated */ -extern int start_color(void); /* implemented */ -extern WINDOW *subpad(WINDOW *, int, int, int, int); /* implemented */ -extern WINDOW *subwin(WINDOW *,int,int,int,int); /* implemented */ -extern int syncok(WINDOW *, bool); /* implemented */ -extern chtype termattrs(void); /* implemented */ -extern attr_t term_attrs(void); /* missing */ -extern char *termname(void); /* implemented */ -extern int tigetflag(NCURSES_CONST char *); /* implemented */ -extern int tigetnum(NCURSES_CONST char *); /* implemented */ -extern char *tigetstr(NCURSES_CONST char *); /* implemented */ -extern void timeout(int); /* generated */ -extern int touchline(WINDOW *, int, int); /* generated */ -extern int touchwin(WINDOW *); /* generated */ -extern char *tparm(NCURSES_CONST char *, ...); /* implemented */ -extern int typeahead(int); /* implemented */ -extern int ungetch(int); /* implemented */ +extern NCURSES_EXPORT(int) standout (void); /* generated */ +extern NCURSES_EXPORT(int) standend (void); /* generated */ +extern NCURSES_EXPORT(int) start_color (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */ +extern NCURSES_EXPORT(attr_t) term_attrs (void); /* missing */ +extern NCURSES_EXPORT(char *) termname (void); /* implemented */ +extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(void) timeout (int); /* generated */ +extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* implemented */ +extern NCURSES_EXPORT(int) typeahead (int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch (int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int unget_wch(const wchar_t); /* missing */ +extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int untouchwin(WINDOW *); /* generated */ -extern void use_env(bool); /* implemented */ -extern int vidattr(chtype); /* implemented */ -extern int vid_attr(attr_t, short, void *); /* generated:WIDEC */ -extern int vidputs(chtype, int (*)(int)); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) use_env (bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */ +extern NCURSES_EXPORT(int) vid_attr (attr_t, short, void *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int)); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int vid_puts(attr_t, short, void *, int (*)(int)); /* missing */ +extern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, int (*)(int)); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int vline(chtype, int); /* generated */ +extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int vline_set(const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int vwprintw(WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ -extern int vw_printw(WINDOW *, NCURSES_CONST char *,va_list); /* generated */ -extern int vwscanw(WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ -extern int vw_scanw(WINDOW *, NCURSES_CONST char *,va_list); /* generated */ -extern int waddch(WINDOW *, const chtype); /* implemented */ -extern int waddchnstr(WINDOW *,const chtype *const,int); /* implemented */ -extern int waddchstr(WINDOW *,const chtype *); /* generated */ -extern int waddnstr(WINDOW *,const char *const,int); /* implemented */ -extern int waddstr(WINDOW *,const char *); /* generated */ +extern NCURSES_EXPORT(int) vwprintw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ +extern NCURSES_EXPORT(int) vw_printw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */ +extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ +extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */ +extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *const,int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */ +extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *const,int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int waddwstr(WINDOW *,const wchar_t *); /* missing */ -extern int waddnwstr(WINDOW *,const wchar_t *,int); /* missing */ -extern int wadd_wch(WINDOW *,const cchar_t *); /* missing */ -extern int wadd_wchnstr(WINDOW *,const cchar_t *,int); /* missing */ -extern int wadd_wchstr(WINDOW *,const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) waddnwstr (WINDOW *,const wchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) wadd_wchstr (WINDOW *,const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wattron(WINDOW *, int); /* generated */ -extern int wattroff(WINDOW *, int); /* generated */ -extern int wattrset(WINDOW *, int); /* generated */ -extern int wattr_get(WINDOW *, attr_t *, short *, void *); /* generated */ -extern int wattr_on(WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ -extern int wattr_off(WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ -extern int wattr_set(WINDOW *, attr_t, short, void *); /* generated */ -extern int wbkgd(WINDOW *,const chtype); /* implemented */ -extern void wbkgdset(WINDOW *,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *); /* generated */ +extern NCURSES_EXPORT(int) wattr_on (WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off (WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *); /* generated */ +extern NCURSES_EXPORT(int) wbkgd (WINDOW *,const chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern void wbkgrndset(WINDOW *,const cchar_t *); /* missing */ -extern int wbkgrnd(WINDOW *,const cchar_t *); /* missing */ +extern NCURSES_EXPORT(void) wbkgrndset (WINDOW *,const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wbkgrnd (WINDOW *,const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wborder(WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wborder_set(WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* missing */ +extern NCURSES_EXPORT(int) wborder_set (WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wchgat(WINDOW *, int, attr_t, short, const void *);/* implemented */ -extern int wclear(WINDOW *); /* implemented */ -extern int wclrtobot(WINDOW *); /* implemented */ -extern int wclrtoeol(WINDOW *); /* implemented */ -extern int wcolor_set(WINDOW*,short,void*); /* implemented */ -extern void wcursyncup(WINDOW *); /* implemented */ -extern int wdelch(WINDOW *); /* implemented */ -extern int wdeleteln(WINDOW *); /* generated */ -extern int wechochar(WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */ +extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wecho_wchar(WINDOW *, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wecho_wchar (WINDOW *, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int werase(WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wgetbkgrnd(WINDOW *, cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wgetbkgrnd (WINDOW *, cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wgetch(WINDOW *); /* implemented */ -extern int wgetnstr(WINDOW *,char *,int); /* implemented */ +extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wgetn_wstr(WINDOW *,wint_t *, int); /* missing */ +extern NCURSES_EXPORT(int) wgetn_wstr (WINDOW *,wint_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wgetstr(WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wget_wch(WINDOW *, wint_t *); /* missing */ -extern int wget_wstr(WINDOW *, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) wget_wch (WINDOW *, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) wget_wstr (WINDOW *, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int whline(WINDOW *, chtype, int); /* implemented */ +extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int whline_set(WINDOW *, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) whline_set (WINDOW *, const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern chtype winch(WINDOW *); /* implemented */ -extern int winchnstr(WINDOW *, chtype *, int); /* implemented */ -extern int winchstr(WINDOW *, chtype *); /* generated */ -extern int winnstr(WINDOW *, char *, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */ +extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int winnwstr(WINDOW *, wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int winsch(WINDOW *, chtype); /* implemented */ -extern int winsdelln(WINDOW *,int); /* implemented */ -extern int winsertln(WINDOW *); /* generated */ -extern int winsnstr(WINDOW *, const char *,int); /* implemented */ -extern int winsstr(WINDOW *, const char *); /* generated */ -extern int winstr(WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */ +extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wins_nwstr(WINDOW *, const wchar_t *, int); /* missing */ -extern int wins_wch(WINDOW *, const cchar_t *); /* missing */ -extern int wins_wstr(WINDOW *, const wchar_t *); /* missing */ -extern int winwstr(WINDOW *, wchar_t *); /* missing */ -extern int win_wch(WINDOW *, NCURSES_CONST cchar_t *); /* missing */ -extern int win_wchnstr(WINDOW *, NCURSES_CONST cchar_t *, int); /* missing */ -extern int win_wchstr(WINDOW *, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) win_wch (WINDOW *, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) win_wchnstr (WINDOW *, NCURSES_CONST cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) win_wchstr (WINDOW *, NCURSES_CONST cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wmove(WINDOW *,int,int); /* implemented */ -extern int wnoutrefresh(WINDOW *); /* implemented */ -extern int wprintw(WINDOW *, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wprintw (WINDOW *, NCURSES_CONST char *,...) /* implemented */ GCC_PRINTFLIKE(2,3); -extern int wredrawln(WINDOW *,int,int); /* implemented */ -extern int wrefresh(WINDOW *); /* implemented */ -extern int wscanw(WINDOW *, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(2,3); -extern int wscrl(WINDOW *,int); /* implemented */ -extern int wsetscrreg(WINDOW *,int,int); /* implemented */ -extern int wstandout(WINDOW *); /* generated */ -extern int wstandend(WINDOW *); /* generated */ -extern void wsyncdown(WINDOW *); /* implemented */ -extern void wsyncup(WINDOW *); /* implemented */ -extern void wtimeout(WINDOW *,int); /* implemented */ -extern int wtouchln(WINDOW *,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern wchar_t *wunctrl(cchar_t *); /* missing */ +extern NCURSES_EXPORT(wchar_t *) wunctrl (cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wvline(WINDOW *,chtype,int); /* implemented */ +extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern bool mouse_trafo(int*, int*, bool); /* generated */ +extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */ /* attributes */ @@ -1303,32 +1316,32 @@ typedef struct } MEVENT; -extern int getmouse(MEVENT *); -extern int ungetmouse(MEVENT *); -extern mmask_t mousemask(mmask_t, mmask_t *); -extern bool wenclose(const WINDOW *, int, int); -extern int mouseinterval(int); -extern bool wmouse_trafo(const WINDOW* win,int* y, int* x, bool to_screen); +extern NCURSES_EXPORT(int) getmouse (MEVENT *); +extern NCURSES_EXPORT(int) ungetmouse (MEVENT *); +extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *); +extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int); +extern NCURSES_EXPORT(int) mouseinterval (int); +extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW* win,int* y, int* x, bool to_screen); #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) /* other non-XSI functions */ -extern int mcprint(char *, int); /* direct data to printer */ -extern int has_key(int); /* do we have given key? */ +extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */ /* Debugging : use with libncurses_g.a */ -extern void _tracef(const char *, ...) GCC_PRINTFLIKE(1,2); -extern void _tracedump(const char *, WINDOW *); -extern char *_traceattr(attr_t); -extern char *_traceattr2(int, chtype); -extern char *_nc_tracebits(void); -extern char *_tracechar(const unsigned char); -extern char *_tracechtype(chtype); -extern char *_tracechtype2(int, chtype); -extern char *_tracemouse(const MEVENT *); -extern void trace(const unsigned int); +extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *); +extern NCURSES_EXPORT(char *) _traceattr (attr_t); +extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype); +extern NCURSES_EXPORT(char *) _nc_tracebits (void); +extern NCURSES_EXPORT(char *) _tracechar (const unsigned char); +extern NCURSES_EXPORT(char *) _tracechtype (chtype); +extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype); +extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *); +extern NCURSES_EXPORT(void) trace (const unsigned int); /* trace masks */ #define TRACE_DISABLE 0x0000 /* turn off tracing */ @@ -1349,8 +1362,8 @@ extern void trace(const unsigned int); #define TRACE_MAXIMUM 0xffff /* maximum trace level */ #if defined(TRACE) || defined(NCURSES_TEST) -extern int _nc_optimize_enable; /* enable optimizations */ -extern const char *_nc_visbuf(const char *); +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); #define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ #define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ #define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ diff --git a/lib/libcurses/curses.priv.h b/lib/libcurses/curses.priv.h index 30fff8b8bcf..fd4f605ab45 100644 --- a/lib/libcurses/curses.priv.h +++ b/lib/libcurses/curses.priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: curses.priv.h,v 1.30 2000/10/10 15:10:29 millert Exp $ */ +/* $OpenBSD: curses.priv.h,v 1.31 2001/01/22 18:01:34 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -35,7 +35,7 @@ /* - * $From: curses.priv.h,v 1.168 2000/10/08 01:24:59 tom Exp $ + * $From: curses.priv.h,v 1.171 2000/12/10 00:13:52 tom Exp $ * * curses.priv.h * @@ -47,6 +47,19 @@ #ifndef CURSES_PRIV_H #define CURSES_PRIV_H 1 +#if !defined(NCURSES_IMPEXP) +# define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +# define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + #ifdef __cplusplus extern "C" { #endif @@ -158,7 +171,7 @@ extern int errno; #endif #else #define use_terminfo_vars() _nc_env_access() -extern int _nc_env_access(void); +extern NCURSES_EXPORT(int) _nc_env_access (void); #endif /* @@ -169,7 +182,7 @@ extern int _nc_env_access(void); #define memmove(d,s,n) bcopy(s,d,n) #elif USE_MY_MEMMOVE #define memmove(d,s,n) _nc_memmove(d,s,n) -extern void * _nc_memmove(void *, const void *, size_t); +extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t); #endif /* @@ -420,7 +433,7 @@ struct screen { int (*_outch)(int); /* output handler if not putc */ }; -extern SCREEN *_nc_screen_chain; +extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; #if NCURSES_NOMACROS #include <nomacros.h> @@ -490,6 +503,7 @@ typedef struct { #define O_BINARY 0 #endif +#define CharOf(c) ((unsigned char)(c)) #define TextOf(c) ((c) & (chtype)A_CHARTEXT) #define AttrOf(c) ((c) & (chtype)A_ATTRIBUTES) @@ -550,14 +564,14 @@ typedef struct { #define returnPtr(code) TRACE_RETURN(code,ptr) #define returnVoid T((T_RETURN(""))); return #define returnWin(code) TRACE_RETURN(code,win) -extern WINDOW * _nc_retrace_win(WINDOW *); -extern attr_t _nc_retrace_attr_t(attr_t); -extern attr_t _nc_retrace_chtype(chtype); -extern char *_nc_retrace_ptr(char *); -extern const char *_nc_tputs_trace; -extern int _nc_retrace_int(int); -extern long _nc_outchars; -extern void _nc_fifo_dump(void); +extern NCURSES_EXPORT(WINDOW *) _nc_retrace_win (WINDOW *); +extern NCURSES_EXPORT(attr_t) _nc_retrace_attr_t (attr_t); +extern NCURSES_EXPORT(attr_t) _nc_retrace_chtype (chtype); +extern NCURSES_EXPORT(char *) _nc_retrace_ptr (char *); +extern NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace; +extern NCURSES_EXPORT(int) _nc_retrace_int (int); +extern NCURSES_EXPORT_VAR(long) _nc_outchars; +extern NCURSES_EXPORT(void) _nc_fifo_dump (void); #else #define T(a) #define TR(n, a) @@ -570,8 +584,8 @@ extern void _nc_fifo_dump(void); #define returnWin(code) return code #endif -extern unsigned _nc_tracing; -extern const char *_nc_visbuf2(int, const char *); +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; +extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *); #define _trace_key(ch) ((ch > KEY_MIN) ? keyname(ch) : _tracechar((unsigned char)ch)) @@ -642,27 +656,27 @@ extern const char *_nc_visbuf2(int, const char *); #undef toggle_attr_on #define toggle_attr_on(S,at) _nc_toggle_attr_on(&(S), at) -extern void _nc_toggle_attr_on(attr_t *, attr_t); +extern NCURSES_EXPORT(void) _nc_toggle_attr_on (attr_t *, attr_t); #undef toggle_attr_off #define toggle_attr_off(S,at) _nc_toggle_attr_off(&(S), at) -extern void _nc_toggle_attr_off(attr_t *, attr_t); +extern NCURSES_EXPORT(void) _nc_toggle_attr_off (attr_t *, attr_t); #undef DelCharCost #define DelCharCost(count) _nc_DelCharCost(count) -extern int _nc_DelCharCost(int); +extern NCURSES_EXPORT(int) _nc_DelCharCost (int); #undef InsCharCost #define InsCharCost(count) _nc_InsCharCost(count) -extern int _nc_InsCharCost(int); +extern NCURSES_EXPORT(int) _nc_InsCharCost (int); #undef UpdateAttrs #define UpdateAttrs(c) _nc_UpdateAttrs(c) -extern void _nc_UpdateAttrs(chtype); +extern NCURSES_EXPORT(void) _nc_UpdateAttrs (chtype); #else -extern void _nc_expanded(void); +extern NCURSES_EXPORT(void) _nc_expanded (void); #endif @@ -672,33 +686,33 @@ extern void _nc_expanded(void); /* doupdate.c */ #if USE_XMC_SUPPORT -extern void _nc_do_xmc_glitch(attr_t); +extern NCURSES_EXPORT(void) _nc_do_xmc_glitch (attr_t); #endif /* hardscroll.c */ #if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG) -extern void _nc_linedump(void); +extern NCURSES_EXPORT(void) _nc_linedump (void); #endif /* lib_acs.c */ -extern void _nc_init_acs(void); /* corresponds to traditional 'init_acs()' */ -extern int _nc_msec_cost(const char *const, int); /* used by 'tack' program */ +extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */ +extern NCURSES_EXPORT(int) _nc_msec_cost (const char *const, int); /* used by 'tack' program */ /* lib_mvcur.c */ #define INFINITY 1000000 /* cost: too high to use */ -extern void _nc_mvcur_init(void); -extern void _nc_mvcur_resume(void); -extern void _nc_mvcur_wrap(void); +extern NCURSES_EXPORT(void) _nc_mvcur_init (void); +extern NCURSES_EXPORT(void) _nc_mvcur_resume (void); +extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void); -extern int _nc_scrolln(int, int, int, int); +extern NCURSES_EXPORT(int) _nc_scrolln (int, int, int, int); -extern void _nc_screen_init(void); -extern void _nc_screen_resume(void); -extern void _nc_screen_wrap(void); +extern NCURSES_EXPORT(void) _nc_screen_init (void); +extern NCURSES_EXPORT(void) _nc_screen_resume (void); +extern NCURSES_EXPORT(void) _nc_screen_wrap (void); /* lib_mouse.c */ -extern int _nc_has_mouse(void); +extern NCURSES_EXPORT(int) _nc_has_mouse (void); /* lib_mvcur.c */ #define INFINITY 1000000 /* cost: too high to use */ @@ -710,78 +724,78 @@ typedef struct { } string_desc; /* strings.c */ -extern string_desc *_nc_str_init(string_desc * dst, char *src, size_t len); -extern string_desc *_nc_str_null(string_desc * dst, size_t len); -extern string_desc *_nc_str_copy(string_desc * dst, string_desc * src); -extern bool _nc_safe_strcat(string_desc * dst, const char *src); -extern bool _nc_safe_strcpy(string_desc * dst, const char *src); +extern NCURSES_EXPORT(string_desc *) _nc_str_init (string_desc * dst, char *src, size_t len); +extern NCURSES_EXPORT(string_desc *) _nc_str_null (string_desc * dst, size_t len); +extern NCURSES_EXPORT(string_desc *) _nc_str_copy (string_desc * dst, string_desc * src); +extern NCURSES_EXPORT(bool) _nc_safe_strcat (string_desc * dst, const char *src); +extern NCURSES_EXPORT(bool) _nc_safe_strcpy (string_desc * dst, const char *src); -extern void _nc_mvcur_init(void); -extern void _nc_mvcur_resume(void); -extern void _nc_mvcur_wrap(void); +extern NCURSES_EXPORT(void) _nc_mvcur_init (void); +extern NCURSES_EXPORT(void) _nc_mvcur_resume (void); +extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void); -extern int _nc_scrolln(int, int, int, int); +extern NCURSES_EXPORT(int) _nc_scrolln (int, int, int, int); -extern void _nc_screen_init(void); -extern void _nc_screen_resume(void); -extern void _nc_screen_wrap(void); +extern NCURSES_EXPORT(void) _nc_screen_init (void); +extern NCURSES_EXPORT(void) _nc_screen_resume (void); +extern NCURSES_EXPORT(void) _nc_screen_wrap (void); #if !HAVE_STRSTR #define strstr _nc_strstr -extern char *_nc_strstr(const char *, const char *); +extern NCURSES_EXPORT(char *) _nc_strstr (const char *, const char *); #endif /* safe_sprintf.c */ -extern char * _nc_printf_string(const char *fmt, va_list ap); +extern NCURSES_EXPORT(char *) _nc_printf_string (const char *fmt, va_list ap); /* tries.c */ -extern void _nc_add_to_try(struct tries **tree, const char *str, unsigned short code); -extern char *_nc_expand_try(struct tries *tree, unsigned short code, int *count, size_t len); -extern int _nc_remove_key(struct tries **tree, unsigned short code); -extern int _nc_remove_string(struct tries **tree, char *string); +extern NCURSES_EXPORT(void) _nc_add_to_try (struct tries **tree, const char *str, unsigned short code); +extern NCURSES_EXPORT(char *) _nc_expand_try (struct tries *tree, unsigned short code, int *count, size_t len); +extern NCURSES_EXPORT(int) _nc_remove_key (struct tries **tree, unsigned short code); +extern NCURSES_EXPORT(int) _nc_remove_string (struct tries **tree, char *string); /* elsewhere ... */ -extern WINDOW *_nc_makenew(int, int, int, int, int); -extern char *_nc_home_terminfo(void); -extern char *_nc_trace_buf(int, size_t); -extern chtype _nc_background(WINDOW *); -extern chtype _nc_render(WINDOW *, chtype); -extern int _nc_access(const char *, int); -extern int _nc_baudrate(int); -extern int _nc_getenv_num(const char *); -extern int _nc_keypad(bool); -extern int _nc_ospeed(int); -extern int _nc_outch(int); -extern int _nc_setupscreen(short, short const, FILE *); -extern int _nc_timed_wait(int, int, int *); -extern int _nc_waddch_nosync(WINDOW *, const chtype); -extern void _nc_do_color(int, int, bool, int (*)(int)); -extern void _nc_freeall(void); -extern void _nc_freewin(WINDOW *win); -extern void _nc_hash_map(void); -extern void _nc_init_keytry(void); -extern void _nc_keep_tic_dir(const char *); -extern void _nc_make_oldhash(int i); -extern void _nc_flush(void); -extern void _nc_outstr(const char *str); -extern void _nc_scroll_oldhash(int n, int top, int bot); -extern void _nc_scroll_optimize(void); -extern void _nc_scroll_window(WINDOW *, int const, short const, short const, chtype); -extern void _nc_set_buffer(FILE *, bool); -extern void _nc_signal_handler(bool); -extern void _nc_synchook(WINDOW *win); -extern void _nc_trace_tries(struct tries *tree); +extern NCURSES_EXPORT(WINDOW *) _nc_makenew (int, int, int, int, int); +extern NCURSES_EXPORT(char *) _nc_home_terminfo (void); +extern NCURSES_EXPORT(char *) _nc_trace_buf (int, size_t); +extern NCURSES_EXPORT(chtype) _nc_background (WINDOW *); +extern NCURSES_EXPORT(chtype) _nc_render (WINDOW *, chtype); +extern NCURSES_EXPORT(int) _nc_access (const char *, int); +extern NCURSES_EXPORT(int) _nc_baudrate (int); +extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *win); +extern NCURSES_EXPORT(int) _nc_getenv_num (const char *); +extern NCURSES_EXPORT(int) _nc_keypad (bool); +extern NCURSES_EXPORT(int) _nc_ospeed (int); +extern NCURSES_EXPORT(int) _nc_outch (int); +extern NCURSES_EXPORT(int) _nc_setupscreen (short, short const, FILE *); +extern NCURSES_EXPORT(int) _nc_timed_wait (int, int, int *); +extern NCURSES_EXPORT(int) _nc_waddch_nosync (WINDOW *, const chtype); +extern NCURSES_EXPORT(void) _nc_do_color (int, int, bool, int (*)(int)); +extern NCURSES_EXPORT(void) _nc_flush (void); +extern NCURSES_EXPORT(void) _nc_freeall (void); +extern NCURSES_EXPORT(void) _nc_hash_map (void); +extern NCURSES_EXPORT(void) _nc_init_keytry (void); +extern NCURSES_EXPORT(void) _nc_keep_tic_dir (const char *); +extern NCURSES_EXPORT(void) _nc_make_oldhash (int i); +extern NCURSES_EXPORT(void) _nc_outstr (const char *str); +extern NCURSES_EXPORT(void) _nc_scroll_oldhash (int n, int top, int bot); +extern NCURSES_EXPORT(void) _nc_scroll_optimize (void); +extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, short const, short const, chtype); +extern NCURSES_EXPORT(void) _nc_set_buffer (FILE *, bool); +extern NCURSES_EXPORT(void) _nc_signal_handler (bool); +extern NCURSES_EXPORT(void) _nc_synchook (WINDOW *win); +extern NCURSES_EXPORT(void) _nc_trace_tries (struct tries *tree); #if USE_SIZECHANGE -extern void _nc_update_screensize(void); +extern NCURSES_EXPORT(void) _nc_update_screensize (void); #endif #if USE_WIDEC_SUPPORT -extern int _nc_utf8_outch(int); +extern NCURSES_EXPORT(int) _nc_utf8_outch (int); #endif /* scroll indices */ -extern int *_nc_oldnums; +extern NCURSES_EXPORT_VAR(int *) _nc_oldnums; #define USE_SETBUF_0 0 @@ -797,12 +811,12 @@ extern int *_nc_oldnums; */ #if BROKEN_LINKER #define SP _nc_screen() -extern SCREEN *_nc_screen(void); -extern int _nc_alloc_screen(void); -extern void _nc_set_screen(SCREEN *); +extern NCURSES_EXPORT(SCREEN *) _nc_screen (void); +extern NCURSES_EXPORT(int) _nc_alloc_screen (void); +extern NCURSES_EXPORT(void) _nc_set_screen (SCREEN *); #else /* current screen is private data; avoid possible linking conflicts too */ -extern SCREEN *SP; +extern NCURSES_EXPORT_VAR(SCREEN *) SP; #define _nc_alloc_screen() ((SP = typeCalloc(SCREEN, 1)) != 0) #define _nc_set_screen(sp) SP = sp #endif @@ -816,8 +830,8 @@ extern SCREEN *SP; #define screen_lines SP->_lines #define screen_columns SP->_columns -extern int _nc_slk_format; /* != 0 if slk_init() called */ -extern int _nc_slk_initialize(WINDOW *, int); +extern NCURSES_EXPORT_VAR(int) _nc_slk_format; /* != 0 if slk_init() called */ +extern NCURSES_EXPORT(int) _nc_slk_initialize (WINDOW *, int); /* * Some constants related to SLK's @@ -835,7 +849,7 @@ extern int _nc_slk_initialize(WINDOW *, int); #define MAX_SKEY(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_OLD : MAX_SKEY_PC) #define MAX_SKEY_LEN(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_LEN_OLD : MAX_SKEY_LEN_PC) -extern int _nc_ripoffline(int line, int (*init)(WINDOW *,int)); +extern NCURSES_EXPORT(int) _nc_ripoffline (int line, int (*init)(WINDOW *,int)); #ifdef __cplusplus } diff --git a/lib/libcurses/nc_panel.h b/lib/libcurses/nc_panel.h index 882e4831ad7..107f555d5e4 100644 --- a/lib/libcurses/nc_panel.h +++ b/lib/libcurses/nc_panel.h @@ -1,7 +1,7 @@ -/* $OpenBSD: nc_panel.h,v 1.2 1998/07/23 21:19:56 millert Exp $ */ +/* $OpenBSD: nc_panel.h,v 1.3 2001/01/22 18:01:34 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 @@ /* - * $From: nc_panel.h,v 1.2 1998/02/11 12:13:45 tom Exp $ + * $From: nc_panel.h,v 1.3 2000/12/10 02:04:35 tom Exp $ * * nc_panel.h * @@ -59,7 +59,7 @@ struct panelhook { }; /* Retrieve the panelhook of the current screen */ -extern struct panelhook* _nc_panelhook(void); +extern NCURSES_EXPORT(struct panelhook*) _nc_panelhook (void); #ifdef __cplusplus } diff --git a/lib/libcurses/ncurses_cfg.h b/lib/libcurses/ncurses_cfg.h index 976152d7045..493f1fcb2c4 100644 --- a/lib/libcurses/ncurses_cfg.h +++ b/lib/libcurses/ncurses_cfg.h @@ -50,7 +50,6 @@ #define CC_HAS_INLINE_FUNCS 1 #define CC_HAS_PROTOS 1 #define CPP_HAS_PARAM_INIT 1 -#define ETIP_NEEDS_MATH_H 1 #define GCC_NORETURN __attribute__((__noreturn__)) #define GCC_PRINTF 1 #define GCC_SCANF 1 @@ -121,6 +120,7 @@ #define MIXEDCASE_FILENAMES 1 #define NCURSES_EXT_FUNCS 1 #define NCURSES_NO_PADDING 1 +#define NCURSES_PATHSEP ':' #define NDEBUG 1 #define RETSIGTYPE void #define STDC_HEADERS 1 diff --git a/lib/libcurses/term.h b/lib/libcurses/term.h index 5791e6eeb7d..e8221bbb208 100644 --- a/lib/libcurses/term.h +++ b/lib/libcurses/term.h @@ -1,4 +1,4 @@ -/* $OpenBSD: term.h,v 1.11 2000/10/22 18:27:19 millert Exp $ */ +/* $OpenBSD: term.h,v 1.12 2001/01/22 18:01:34 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -33,7 +33,7 @@ /* and: Eric S. Raymond <esr@snark.thyrsus.com> */ /****************************************************************************/ -/* $From: MKterm.h.awk.in,v 1.37 2000/03/12 02:40:07 tom Exp $ */ +/* $From: MKterm.h.awk.in,v 1.38 2000/12/09 23:54:00 tom Exp $ */ /* ** term.h -- Definition of struct term @@ -49,6 +49,20 @@ #undef NCURSES_VERSION #define NCURSES_VERSION "5.2" +#if !defined(NCURSES_IMPEXP) +# define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +# define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + + #ifdef __cplusplus extern "C" { #endif @@ -724,7 +738,7 @@ typedef struct term { /* describe an actual terminal */ int _baudrate; /* used to compute padding */ } TERMINAL; -extern TERMINAL *cur_term; +extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; #if BROKEN_LINKER #define boolnames _nc_boolnames() @@ -737,66 +751,66 @@ extern TERMINAL *cur_term; #define strcodes _nc_strcodes() #define strfnames _nc_strfnames() -extern NCURSES_CONST char * const *_nc_boolnames(void); -extern NCURSES_CONST char * const *_nc_boolcodes(void); -extern NCURSES_CONST char * const *_nc_boolfnames(void); -extern NCURSES_CONST char * const *_nc_numnames(void); -extern NCURSES_CONST char * const *_nc_numcodes(void); -extern NCURSES_CONST char * const *_nc_numfnames(void); -extern NCURSES_CONST char * const *_nc_strnames(void); -extern NCURSES_CONST char * const *_nc_strcodes(void); -extern NCURSES_CONST char * const *_nc_strfnames(void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolcodes (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolfnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numcodes (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numfnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strcodes (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strfnames (void); #else -extern NCURSES_CONST char *const boolnames[]; -extern NCURSES_CONST char *const boolcodes[]; -extern NCURSES_CONST char *const boolfnames[]; -extern NCURSES_CONST char *const numnames[]; -extern NCURSES_CONST char *const numcodes[]; -extern NCURSES_CONST char *const numfnames[]; -extern NCURSES_CONST char *const strnames[]; -extern NCURSES_CONST char *const strcodes[]; -extern NCURSES_CONST char *const strfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[]; #endif /* internals */ -extern int _nc_set_tty_mode(TTY *buf); -extern int _nc_get_tty_mode(TTY *buf); -extern int _nc_read_entry(const char * const, char * const, TERMTYPE *const); -extern int _nc_read_file_entry(const char *const, TERMTYPE *); -extern char *_nc_first_name(const char *const); -extern int _nc_name_match(const char *const, const char *const, const char *const); -extern int _nc_read_termcap_entry(const char *const, TERMTYPE *const); -extern const TERMTYPE *_nc_fallback(const char *); +extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf); +extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf); +extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const); +extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *); +extern NCURSES_EXPORT(char *) _nc_first_name (const char *const); +extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const); +extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const); +extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *); /* entry points */ -extern TERMINAL *set_curterm(TERMINAL *); -extern int del_curterm(TERMINAL *); +extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *); +extern NCURSES_EXPORT(int) del_curterm (TERMINAL *); /* miscellaneous entry points */ -extern int restartterm(NCURSES_CONST char *, int, int *); -extern int setupterm(NCURSES_CONST char *,int,int *); +extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *); +extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *); /* terminfo entry points, also declared in curses.h */ #if !defined(__NCURSES_H) -extern char *tigetstr(NCURSES_CONST char *); -extern char *tparm(NCURSES_CONST char *, ...); -extern char ttytype[]; -extern int putp(const char *); -extern int tigetflag(NCURSES_CONST char *); -extern int tigetnum(NCURSES_CONST char *); +extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); +extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT(int) putp (const char *); +extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); #endif /* __NCURSES_H */ /* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ #if !defined(_NCU_TERMCAP_H) -extern char *tgetstr(NCURSES_CONST char *, char **); -extern char *tgoto(const char *, int, int); -extern int tgetent(char *, const char *); -extern int tgetflag(NCURSES_CONST char *); -extern int tgetnum(NCURSES_CONST char *); -extern int tputs(const char *, int, int (*)(int)); +extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); #endif /* _NCU_TERMCAP_H */ #ifdef __cplusplus diff --git a/lib/libcurses/term_entry.h b/lib/libcurses/term_entry.h index a1c8678bc8f..d8d4b36c631 100644 --- a/lib/libcurses/term_entry.h +++ b/lib/libcurses/term_entry.h @@ -1,4 +1,4 @@ -/* $OpenBSD: term_entry.h,v 1.10 2000/03/26 16:45:03 millert Exp $ */ +/* $OpenBSD: term_entry.h,v 1.11 2001/01/22 18:01:35 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -33,7 +33,7 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ -/* $From: term_entry.h,v 1.29 2000/03/19 02:04:15 tom Exp $ */ +/* $From: term_entry.h,v 1.31 2001/01/13 22:44:41 tom Exp $ */ /* * term_entry.h -- interface to entry-manipulation code @@ -92,7 +92,8 @@ ENTRY; #define ExtNumname(tp,i,names) EXT_NAMES(tp, i, NUMCOUNT, (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, names) #define ExtStrname(tp,i,names) EXT_NAMES(tp, i, STRCOUNT, (i - (tp->num_Strings - tp->ext_Strings)) + (tp->ext_Numbers + tp->ext_Booleans), names) -extern ENTRY *_nc_head, *_nc_tail; +extern NCURSES_EXPORT_VAR(ENTRY *) _nc_head; +extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail; #define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next) #define MAX_LINE 132 @@ -118,43 +119,49 @@ extern ENTRY *_nc_head, *_nc_tail; } /* alloc_entry.c: elementary allocation code */ -extern ENTRY *_nc_copy_entry(ENTRY *oldp); -extern char *_nc_save_str(const char *const); -extern void _nc_init_entry(TERMTYPE *const); -extern void _nc_merge_entry(TERMTYPE *const, TERMTYPE *const); -extern void _nc_wrap_entry(ENTRY *const); +extern NCURSES_EXPORT(ENTRY *) _nc_copy_entry (ENTRY *oldp); +extern NCURSES_EXPORT(char *) _nc_save_str (const char *const); +extern NCURSES_EXPORT(void) _nc_init_entry (TERMTYPE *const); +extern NCURSES_EXPORT(void) _nc_merge_entry (TERMTYPE *const, TERMTYPE *const); +extern NCURSES_EXPORT(void) _nc_wrap_entry (ENTRY *const, bool); /* alloc_ttype.c: elementary allocation code */ -extern void _nc_align_termtype(TERMTYPE *, TERMTYPE *); -extern void _nc_copy_termtype(TERMTYPE *, TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE *, TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, TERMTYPE *); /* free_ttype.c: elementary allocation code */ -extern void _nc_free_termtype(TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *); /* lib_acs.c */ -extern void _nc_init_acs(void); /* corresponds to traditional 'init_acs()' */ +extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */ /* parse_entry.c: entry-parsing code */ #if NCURSES_XNAMES -extern bool _nc_user_definable; -extern bool _nc_disable_period; +extern NCURSES_EXPORT_VAR(bool) _nc_user_definable; +extern NCURSES_EXPORT_VAR(bool) _nc_disable_period; #endif -extern int _nc_parse_entry(ENTRY *, int, bool); -extern int _nc_capcmp(const char *, const char *); +extern NCURSES_EXPORT(int) _nc_parse_entry (ENTRY *, int, bool); +extern NCURSES_EXPORT(int) _nc_capcmp (const char *, const char *); /* write_entry.c: writing an entry to the file system */ -extern void _nc_set_writedir(char *); -extern void _nc_write_entry(TERMTYPE *const); +extern NCURSES_EXPORT(void) _nc_set_writedir (char *); +extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE *const); /* comp_parse.c: entry list handling */ -extern void _nc_read_entry_source(FILE*, char*, int, bool, bool (*)(ENTRY*)); -extern bool _nc_entry_match(char *, char *); -extern int _nc_resolve_uses(bool); -extern void _nc_free_entries(ENTRY *); -extern void (*_nc_check_termtype)(TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_read_entry_source (FILE*, char*, int, bool, bool (*)(ENTRY*)); +extern NCURSES_EXPORT(bool) _nc_entry_match (char *, char *); +extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); +extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *); +extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)(TERMTYPE *); /* trace_xnames.c */ -extern void _nc_trace_xnames(TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *); + +#ifdef __OpenBSD__ +/* read_bsd_terminfo.c: terminfo.db reading */ +extern int _nc_read_bsd_terminfo_entry(const char * const, char * const, TERMTYPE *const); +extern int _nc_read_bsd_terminfo_file(const char * const, TERMTYPE *const); +#endif /* __OpenBSD__ */ #ifdef __cplusplus } diff --git a/lib/libcurses/termcap.3 b/lib/libcurses/termcap.3 index ab409e75698..a0328ee5245 100644 --- a/lib/libcurses/termcap.3 +++ b/lib/libcurses/termcap.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: termcap.3,v 1.5 2000/07/10 03:06:11 millert Exp $ +.\" $OpenBSD: termcap.3,v 1.6 2001/01/22 18:01:35 millert Exp $ .\" .\"*************************************************************************** .\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -28,7 +28,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: curs_termcap.3x,v 1.13 2000/07/01 20:10:57 tom Exp $ +.\" $From: curs_termcap.3x,v 1.14 2000/12/02 22:47:14 tom Exp $ .TH termcap 3 "" .ds n 5 .SH NAME @@ -43,13 +43,13 @@ .br \fB#include <term.h>\fR .br -\fBint tgetent(const char *bp, char *name);\fR +\fBint tgetent(char *bp, const char *name);\fR .br -\fBint tgetflag(const char *id);\fR +\fBint tgetflag(char *id);\fR .br -\fBint tgetnum(const char *id);\fR +\fBint tgetnum(char *id);\fR .br -\fBchar *tgetstr(const char *id, char **area);\fR +\fBchar *tgetstr(char *id, char **area);\fR .br \fBchar *tgoto(const char *cap, int col, int row);\fR .br @@ -80,6 +80,11 @@ The return value will also be copied to the buffer pointed to by \fIarea\fR, and the \fIarea\fR value will be updated to point past the null ending this value. +Only the first two characters of the \fBid\fR parameter of +\fBtgetflag\fR, +\fBtgetnum\fR and +\fBtgetstr\fR are compared in lookups. + The \fBtgoto\fR routine instantiates the parameters into the given capability. The output from this routine is to be passed to \fBtputs\fR. @@ -98,7 +103,11 @@ If you call \fBtgetstr\fR to fetch \fBca\fR or any other parameterized string, be aware that it will be returned in terminfo notation, not the older and not-quite-compatible termcap notation. This won't cause problems if all you do with it is call \fBtgoto\fR or \fBtparm\fR, which both expand -terminfo-style. +terminfo-style strings as terminfo. +(The \fBtgoto\fR function, if configured to support termcap, will check +if the string is indeed terminfo-style by looking for "%p" parameters or +"$<..>" delays, and invoke a termcap-style parser if the string does not +appear to be terminfo). Because terminfo conventions for representing padding in string capabilities differ from termcap's, \fBtputs("50");\fR will put out a literal "50" rather diff --git a/lib/libcurses/termcap.h b/lib/libcurses/termcap.h index 91fbfbcd676..f4e1a62ecd0 100644 --- a/lib/libcurses/termcap.h +++ b/lib/libcurses/termcap.h @@ -1,7 +1,7 @@ -/* $OpenBSD: termcap.h,v 1.7 2000/10/22 18:27:19 millert Exp $ */ +/* $OpenBSD: termcap.h,v 1.8 2001/01/22 18:01:35 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,7 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ -/* $From: termcap.h.in,v 1.12 2000/10/08 01:06:37 tom Exp $ */ +/* $From: termcap.h.in,v 1.15 2000/12/10 02:01:50 tom Exp $ */ #ifndef _NCU_TERMCAP_H #define _NCU_TERMCAP_H 1 @@ -41,6 +41,19 @@ #undef NCURSES_VERSION #define NCURSES_VERSION "5.2" +#if !defined(NCURSES_IMPEXP) +# define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +# define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + #ifdef __cplusplus extern "C" { @@ -51,18 +64,21 @@ extern "C" #undef NCURSES_CONST #define NCURSES_CONST -extern char PC; -extern char *UP; -extern char *BC; -extern short ospeed; +#undef NCURSES_OSPEED +#define NCURSES_OSPEED short + +extern NCURSES_EXPORT_VAR(char) PC; +extern NCURSES_EXPORT_VAR(char *) UP; +extern NCURSES_EXPORT_VAR(char *) BC; +extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; #if !defined(_NCU_TERM_H) -extern char *tgetstr(NCURSES_CONST char *, char **); -extern char *tgoto(const char *, int, int); -extern int tgetent(char *, const char *); -extern int tgetflag(NCURSES_CONST char *); -extern int tgetnum(NCURSES_CONST char *); -extern int tputs(const char *, int, int (*)(int)); +extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); #endif #ifdef __cplusplus diff --git a/lib/libcurses/terminfo.3 b/lib/libcurses/terminfo.3 index c68d17f6718..06afcd61c55 100644 --- a/lib/libcurses/terminfo.3 +++ b/lib/libcurses/terminfo.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: terminfo.3,v 1.7 2000/07/10 03:06:11 millert Exp $ +.\" $OpenBSD: terminfo.3,v 1.8 2001/01/22 18:01:35 millert Exp $ .\" .\"*************************************************************************** .\" Copyright (c) 1999,2000 Free Software Foundation, Inc. * @@ -28,7 +28,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: curs_terminfo.3x,v 1.13 2000/07/01 20:07:34 tom Exp $ +.\" $From: curs_terminfo.3x,v 1.14 2000/12/03 00:07:23 tom Exp $ .TH terminfo 3 "" .ds n 5 .SH NAME @@ -255,6 +255,10 @@ In System V Release 4, the third argument of \fBtputs\fR has the type The XSI Curses standard prototypes \fBtparm\fR with a fixed number of parameters, rather than a variable argument list. +That prototype assumes that none of the parameters are strings +(or if so, that a long is big enough to hold a pointer). +The variable argument list implemented in ncurses does not rely on +that assumption. XSI notes that after calling \fBmvcur\fR, the curses state may not match the actual terminal state, and that an application should touch and refresh diff --git a/lib/libcurses/tic.h b/lib/libcurses/tic.h index d36fcbf584b..bbec5f2a88a 100644 --- a/lib/libcurses/tic.h +++ b/lib/libcurses/tic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tic.h,v 1.10 2000/10/08 22:46:56 millert Exp $ */ +/* $OpenBSD: tic.h,v 1.11 2001/01/22 18:01:35 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998-2000 Free Software Foundation, Inc. * @@ -34,7 +34,7 @@ ****************************************************************************/ /* - * $From: tic.h,v 1.35 2000/09/09 19:47:16 tom Exp $ + * $From: tic.h,v 1.36 2000/12/10 02:03:28 tom Exp $ * tic.h - Global variables and structures for the terminfo * compiler. */ @@ -118,9 +118,9 @@ extern "C" { #define DEBUG(n, a) /*nothing*/ #endif -extern unsigned _nc_tracing; -extern void _nc_tracef(char *, ...) GCC_PRINTFLIKE(1,2); -extern const char *_nc_visbuf(const char *); +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; +extern NCURSES_EXPORT(void) _nc_tracef (char *, ...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); /* * These are the types of tokens returned by the scanner. The first @@ -151,7 +151,7 @@ struct token char *tk_valstring; /* value of capability (if a string) */ }; -extern struct token _nc_curr_token; +extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token; /* * List of keynames with their corresponding code. @@ -161,7 +161,7 @@ struct kn { int code; }; -extern const struct kn _nc_key_names[]; +extern NCURSES_EXPORT_VAR(const struct kn) _nc_key_names[]; /* * Offsets to string capabilities, with the corresponding functionkey @@ -175,11 +175,11 @@ struct tinfo_fkeys { #if BROKEN_LINKER #define _nc_tinfo_fkeys _nc_tinfo_fkeysf() -extern struct tinfo_fkeys *_nc_tinfo_fkeysf(void); +extern NCURSES_EXPORT(struct tinfo_fkeys *) _nc_tinfo_fkeysf (void); #else -extern struct tinfo_fkeys _nc_tinfo_fkeys[]; +extern NCURSES_EXPORT_VAR(struct tinfo_fkeys) _nc_tinfo_fkeys[]; #endif @@ -204,14 +204,14 @@ struct alias const char *source; }; -extern const struct name_table_entry * const _nc_info_hash_table[]; -extern const struct name_table_entry * const _nc_cap_hash_table[]; +extern NCURSES_EXPORT_VAR(const struct name_table_entry * const) _nc_info_hash_table[]; +extern NCURSES_EXPORT_VAR(const struct name_table_entry * const) _nc_cap_hash_table[]; -extern const struct alias _nc_capalias_table[]; -extern const struct alias _nc_infoalias_table[]; +extern NCURSES_EXPORT_VAR(const struct alias) _nc_capalias_table[]; +extern NCURSES_EXPORT_VAR(const struct alias) _nc_infoalias_table[]; -extern const struct name_table_entry *_nc_get_table(bool); -extern const struct name_table_entry * const *_nc_get_hash_table(bool); +extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool); +extern NCURSES_EXPORT(const struct name_table_entry * const *) _nc_get_hash_table (bool); #define NOTFOUND ((struct name_table_entry *) 0) @@ -240,59 +240,59 @@ extern const struct name_table_entry * const *_nc_get_hash_table(bool); #endif /* access.c */ -extern char *_nc_basename(char *); +extern NCURSES_EXPORT(char *) _nc_basename (char *); /* comp_hash.c: name lookup */ -struct name_table_entry const *_nc_find_entry(const char *, - const struct name_table_entry *const *); -struct name_table_entry const *_nc_find_type_entry(const char *, - int, - const struct name_table_entry *); +extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry + (const char *, const struct name_table_entry *const *); +extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry + (const char *, int, const struct name_table_entry *); /* comp_scan.c: lexical analysis */ -extern int _nc_get_token(void); -extern void _nc_push_token(int); -extern void _nc_reset_input(FILE *, char *); -extern void _nc_panic_mode(char); -extern int _nc_curr_line; -extern int _nc_curr_col; -extern long _nc_curr_file_pos; -extern long _nc_comment_start, _nc_comment_end; -extern int _nc_syntax; -extern long _nc_start_line; +extern NCURSES_EXPORT(int) _nc_get_token (void); +extern NCURSES_EXPORT(void) _nc_panic_mode (char); +extern NCURSES_EXPORT(void) _nc_push_token (int); +extern NCURSES_EXPORT(void) _nc_reset_input (FILE *, char *); +extern NCURSES_EXPORT_VAR(int) _nc_curr_col; +extern NCURSES_EXPORT_VAR(int) _nc_curr_line; +extern NCURSES_EXPORT_VAR(int) _nc_syntax; +extern NCURSES_EXPORT_VAR(long) _nc_comment_end; +extern NCURSES_EXPORT_VAR(long) _nc_comment_start; +extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos; +extern NCURSES_EXPORT_VAR(long) _nc_start_line; #define SYN_TERMINFO 0 #define SYN_TERMCAP 1 /* comp_error.c: warning & abort messages */ -extern void _nc_set_source(const char *const name); -extern void _nc_get_type(char *name); -extern void _nc_set_type(const char *const name); -extern void _nc_syserr_abort(const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; -extern void _nc_err_abort(const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; -extern void _nc_warning(const char *const,...) GCC_PRINTFLIKE(1,2); -extern bool _nc_suppress_warnings; +extern NCURSES_EXPORT(void) _nc_set_source (const char *const name); +extern NCURSES_EXPORT(void) _nc_get_type (char *name); +extern NCURSES_EXPORT(void) _nc_set_type (const char *const name); +extern NCURSES_EXPORT(void) _nc_syserr_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_warning (const char *const,...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings; /* comp_expand.c: expand string into readable form */ -extern char *_nc_tic_expand(const char *, bool, int); +extern NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int); /* comp_scan.c: decode string from readable form */ -extern char _nc_trans_string(char *, char *); +extern NCURSES_EXPORT(char) _nc_trans_string (char *, char *); /* captoinfo.c: capability conversion */ -extern char *_nc_captoinfo(const char *, const char *, int const); -extern char *_nc_infotocap(const char *, const char *, int const); +extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const); +extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int const); /* lib_tputs.c */ -extern int _nc_nulls_sent; /* Add one for every null sent */ +extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */ /* comp_main.c: compiler main */ -extern const char *_nc_progname; +extern const char * _nc_progname; /* read_entry.c */ -extern const char *_nc_tic_dir(const char *); +extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *); /* write_entry.c */ -extern int _nc_tic_written(void); +extern NCURSES_EXPORT(int) _nc_tic_written (void); #ifdef __cplusplus } diff --git a/lib/libcurses/tinfo/MKcaptab.awk b/lib/libcurses/tinfo/MKcaptab.awk index 8d9a41b4877..4f5df3afdb2 100644 --- a/lib/libcurses/tinfo/MKcaptab.awk +++ b/lib/libcurses/tinfo/MKcaptab.awk @@ -1,6 +1,6 @@ #!/bin/sh -# $OpenBSD: MKcaptab.awk,v 1.2 1999/01/24 20:06:47 millert Exp $ -# $From: MKcaptab.awk,v 1.11 1999/01/24 02:46:42 Jeffrey.C.Honig Exp $ +# $OpenBSD: MKcaptab.awk,v 1.3 2001/01/22 18:01:49 millert Exp $ +# $From: MKcaptab.awk,v 1.12 2000/12/10 00:14:12 tom Exp $ AWK=${1-awk} DATA=${2-../include/Caps} @@ -12,6 +12,7 @@ cat <<'EOF' */ #include <ncurses_cfg.h> +#include <curses.priv.h> #include <tic.h> #include <term.h> @@ -59,12 +60,12 @@ cat <<'EOF' {(char *)NULL, (char *)NULL, (char *)NULL} }; -const struct name_table_entry *_nc_get_table(bool termcap) +NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool termcap) { return termcap ? _nc_cap_table: _nc_info_table ; } -const struct name_table_entry * const * _nc_get_hash_table(bool termcap) +NCURSES_EXPORT(const struct name_table_entry * const *) _nc_get_hash_table (bool termcap) { return termcap ? _nc_cap_hash_table: _nc_info_hash_table ; } diff --git a/lib/libcurses/tinfo/MKfallback.sh b/lib/libcurses/tinfo/MKfallback.sh index 0c1eaef70c7..ce7d14cb7a4 100644 --- a/lib/libcurses/tinfo/MKfallback.sh +++ b/lib/libcurses/tinfo/MKfallback.sh @@ -1,6 +1,6 @@ #!/bin/sh -# $OpenBSD: MKfallback.sh,v 1.2 1999/06/27 08:14:21 millert Exp $ -# $From: MKfallback.sh,v 1.9 1999/06/15 22:57:45 tom Exp $ +# $OpenBSD: MKfallback.sh,v 1.3 2001/01/22 18:01:50 millert Exp $ +# $From: MKfallback.sh,v 1.10 2000/12/10 00:14:39 tom Exp $ # # MKfallback.sh -- create fallback table for entry reads # @@ -51,7 +51,7 @@ EOF fi cat <<EOF -const TERMTYPE *_nc_fallback(const char *name GCC_UNUSED) +NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *name GCC_UNUSED) { EOF diff --git a/lib/libcurses/tinfo/MKnames.awk b/lib/libcurses/tinfo/MKnames.awk index 7f49c21b9f5..5fdb8c20690 100644 --- a/lib/libcurses/tinfo/MKnames.awk +++ b/lib/libcurses/tinfo/MKnames.awk @@ -1,5 +1,5 @@ -# $OpenBSD -# $From: MKnames.awk,v 1.10 1999/01/16 23:36:34 tom Exp $ +# $OpenBSD: MKnames.awk,v 1.2 2001/01/22 18:01:50 millert Exp $ +# $From: MKnames.awk,v 1.11 2000/12/09 23:46:13 tom Exp $ BEGIN { print "/* This file was generated by MKnames.awk */" > "namehdr" print "" > "namehdr" @@ -11,7 +11,7 @@ BEGIN { print "#include <term.h>" > "namehdr" print "#define DCL(it) static IT data##it[]" > "namehdr" print "#else" > "namehdr" - print "#define DCL(it) IT it[]" > "namehdr" + print "#define DCL(it) NCURSES_EXPORT_VAR(IT) it[]" > "namehdr" print "#endif" > "namehdr" print "" > "namehdr" print "/*" > "boolnames" @@ -81,7 +81,7 @@ END { print "};" > "strcodes" print "" > "strcodes" print "#if BROKEN_LINKER" > "nameftr" - print "#define FIX(it) IT *_nc_##it(void) { return data##it; }" > "nameftr" + print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "nameftr" print "FIX(boolnames)" > "nameftr" print "FIX(boolfnames)" > "nameftr" print "FIX(numnames)" > "nameftr" @@ -91,7 +91,7 @@ END { print "#endif /* BROKEN_LINKER */" > "nameftr" print "" > "codeftr" print "#if BROKEN_LINKER" > "codeftr" - print "#define FIX(it) IT *_nc_##it(void) { return data##it; }" > "codeftr" + print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "codeftr" print "FIX(boolcodes)" > "codeftr" print "FIX(numcodes)" > "codeftr" print "FIX(strcodes)" > "codeftr" diff --git a/lib/libcurses/tinfo/access.c b/lib/libcurses/tinfo/access.c index 5c0e4c64920..7a2bc501c50 100644 --- a/lib/libcurses/tinfo/access.c +++ b/lib/libcurses/tinfo/access.c @@ -33,9 +33,9 @@ #include <curses.priv.h> #include <tic.h> -MODULE_ID("$From: access.c,v 1.4 2000/10/08 01:25:06 tom Exp $") +MODULE_ID("$From: access.c,v 1.7 2000/12/10 02:55:07 tom Exp $") -char * +NCURSES_EXPORT(char *) _nc_basename(char *path) { char *result = strrchr(path, '/'); @@ -50,7 +50,7 @@ _nc_basename(char *path) return result; } -int +NCURSES_EXPORT(int) _nc_access(const char *path, int mode) { if (access(path, mode) < 0) { @@ -78,7 +78,7 @@ _nc_access(const char *path, int mode) * Returns true if we allow application to use environment variables that are * used for searching lists of directories, etc. */ -int +NCURSES_EXPORT(int) _nc_env_access(void) { #if HAVE_ISSETUGID @@ -86,9 +86,9 @@ _nc_env_access(void) return FALSE; #elif HAVE_GETEUID && HAVE_GETEGID if (getuid() != geteuid() - || getgid() != getegid()) + || getgid() != getegid()) return FALSE; #endif - return getuid() != 0; /* ...finally, disallow root */ + return getuid() != 0 && geteuid() != 0; /* ...finally, disallow root */ } #endif diff --git a/lib/libcurses/tinfo/add_tries.c b/lib/libcurses/tinfo/add_tries.c index fddee879548..55ad69543d5 100644 --- a/lib/libcurses/tinfo/add_tries.c +++ b/lib/libcurses/tinfo/add_tries.c @@ -1,4 +1,4 @@ -/* $OpenBSD: add_tries.c,v 1.2 2000/03/26 16:45:03 millert Exp $ */ +/* $OpenBSD: add_tries.c,v 1.3 2001/01/22 18:01:50 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -41,12 +41,12 @@ #include <curses.priv.h> -MODULE_ID("$From: add_tries.c,v 1.2 2000/03/18 22:23:56 tom Exp $") +MODULE_ID("$From: add_tries.c,v 1.4 2000/12/10 02:55:07 tom Exp $") #define SET_TRY(dst,src) if ((dst->ch = *src++) == 128) dst->ch = '\0' #define CMP_TRY(a,b) ((a)? (a == b) : (b == 128)) -void +NCURSES_EXPORT(void) _nc_add_to_try(struct tries **tree, const char *str, unsigned short code) { static bool out_of_memory = FALSE; @@ -63,7 +63,7 @@ _nc_add_to_try(struct tries **tree, const char *str, unsigned short code) unsigned char cmp = *txt; while (!CMP_TRY(ptr->ch, cmp) - && ptr->sibling != 0) + && ptr->sibling != 0) ptr = ptr->sibling; if (CMP_TRY(ptr->ch, cmp)) { diff --git a/lib/libcurses/tinfo/alloc_entry.c b/lib/libcurses/tinfo/alloc_entry.c index b019f59ce6e..8429ab5fbbc 100644 --- a/lib/libcurses/tinfo/alloc_entry.c +++ b/lib/libcurses/tinfo/alloc_entry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc_entry.c,v 1.3 2000/03/13 23:53:39 millert Exp $ */ +/* $OpenBSD: alloc_entry.c,v 1.4 2001/01/22 18:01:50 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -49,7 +49,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: alloc_entry.c,v 1.32 2000/03/12 00:16:31 tom Exp $") +MODULE_ID("$From: alloc_entry.c,v 1.35 2001/01/13 22:40:17 tom Exp $") #define ABSENT_OFFSET -1 #define CANCELLED_OFFSET -2 @@ -59,7 +59,7 @@ MODULE_ID("$From: alloc_entry.c,v 1.32 2000/03/12 00:16:31 tom Exp $") static char stringbuf[MAX_STRTAB]; /* buffer for string capabilities */ static size_t next_free; /* next free character in stringbuf */ -void +NCURSES_EXPORT(void) _nc_init_entry(TERMTYPE * const tp) /* initialize a terminal type data block */ { @@ -92,7 +92,7 @@ _nc_init_entry(TERMTYPE * const tp) next_free = 0; } -ENTRY * +NCURSES_EXPORT(ENTRY *) _nc_copy_entry(ENTRY * oldp) { ENTRY *newp = typeCalloc(ENTRY, 1); @@ -104,7 +104,7 @@ _nc_copy_entry(ENTRY * oldp) return newp; } -char * +NCURSES_EXPORT(char *) _nc_save_str(const char *const string) /* save a copy of string in the string buffer */ { @@ -120,14 +120,35 @@ _nc_save_str(const char *const string) return (stringbuf + old_next_free); } -void -_nc_wrap_entry(ENTRY * const ep) +NCURSES_EXPORT(void) +_nc_wrap_entry(ENTRY * const ep, bool copy_strings) /* copy the string parts to allocated storage, preserving pointers to it */ { int offsets[MAX_ENTRY_SIZE / 2], useoffsets[MAX_USES]; int i, n; TERMTYPE *tp = &(ep->tterm); + if (copy_strings) { + next_free = 0; /* clear static storage */ + + /* copy term_names, Strings, uses */ + tp->term_names = _nc_save_str(tp->term_names); + for_each_string(i, tp) { + if (tp->Strings[i] != ABSENT_STRING && + tp->Strings[i] != CANCELLED_STRING) { + tp->Strings[i] = _nc_save_str(tp->Strings[i]); + } + } + + for (i = 0; i < ep->nuses; i++) { + if (ep->uses[i].name == 0) { + ep->uses[i].name = _nc_save_str(ep->uses[i].name); + } + } + + free(tp->str_table); + } + n = tp->term_names - stringbuf; for_each_string(i, &(ep->tterm)) { if (tp->Strings[i] == ABSENT_STRING) @@ -160,18 +181,20 @@ _nc_wrap_entry(ENTRY * const ep) } #if NCURSES_XNAMES - if ((n = NUM_EXT_NAMES(tp)) != 0) { - unsigned length = 0; - for (i = 0; i < n; i++) { - length += strlen(tp->ext_Names[i]) + 1; - offsets[i] = tp->ext_Names[i] - stringbuf; - } - if ((tp->ext_str_table = typeMalloc(char, length)) == 0) - _nc_err_abort("Out of memory"); - for (i = 0, length = 0; i < n; i++) { - tp->ext_Names[i] = tp->ext_str_table + length; - strcpy(tp->ext_Names[i], stringbuf + offsets[i]); - length += strlen(tp->ext_Names[i]) + 1; + if (!copy_strings) { + if ((n = NUM_EXT_NAMES(tp)) != 0) { + unsigned length = 0; + for (i = 0; i < n; i++) { + length += strlen(tp->ext_Names[i]) + 1; + offsets[i] = tp->ext_Names[i] - stringbuf; + } + if ((tp->ext_str_table = typeMalloc(char, length)) == 0) + _nc_err_abort("Out of memory"); + for (i = 0, length = 0; i < n; i++) { + tp->ext_Names[i] = tp->ext_str_table + length; + strcpy(tp->ext_Names[i], stringbuf + offsets[i]); + length += strlen(tp->ext_Names[i]) + 1; + } } } #endif @@ -184,8 +207,9 @@ _nc_wrap_entry(ENTRY * const ep) } } -void -_nc_merge_entry(TERMTYPE * const to, TERMTYPE * const from) +NCURSES_EXPORT(void) +_nc_merge_entry +(TERMTYPE * const to, TERMTYPE * const from) /* merge capabilities from `from' entry into `to' entry */ { int i; diff --git a/lib/libcurses/tinfo/alloc_ttype.c b/lib/libcurses/tinfo/alloc_ttype.c index c03a3a5919c..43583824c0f 100644 --- a/lib/libcurses/tinfo/alloc_ttype.c +++ b/lib/libcurses/tinfo/alloc_ttype.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc_ttype.c,v 1.4 2000/10/08 22:47:00 millert Exp $ */ +/* $OpenBSD: alloc_ttype.c,v 1.5 2001/01/22 18:01:50 millert Exp $ */ /**************************************************************************** * Copyright (c) 1999,2000 Free Software Foundation, Inc. * @@ -45,7 +45,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: alloc_ttype.c,v 1.10 2000/08/12 21:56:24 tom Exp $") +MODULE_ID("$From: alloc_ttype.c,v 1.12 2000/12/10 02:55:07 tom Exp $") #if NCURSES_XNAMES /* @@ -372,8 +372,9 @@ adjust_cancels(TERMTYPE * to, TERMTYPE * from) } } -void -_nc_align_termtype(TERMTYPE * to, TERMTYPE * from) +NCURSES_EXPORT(void) +_nc_align_termtype +(TERMTYPE * to, TERMTYPE * from) { int na = NUM_EXT_NAMES(to); int nb = NUM_EXT_NAMES(from); @@ -457,8 +458,9 @@ _nc_align_termtype(TERMTYPE * to, TERMTYPE * from) } #endif -void -_nc_copy_termtype(TERMTYPE * dst, TERMTYPE * src) +NCURSES_EXPORT(void) +_nc_copy_termtype +(TERMTYPE * dst, TERMTYPE * src) { int i; diff --git a/lib/libcurses/tinfo/captoinfo.c b/lib/libcurses/tinfo/captoinfo.c index 2a797d038e5..c36f7160660 100644 --- a/lib/libcurses/tinfo/captoinfo.c +++ b/lib/libcurses/tinfo/captoinfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: captoinfo.c,v 1.8 2000/04/04 16:49:59 millert Exp $ */ +/* $OpenBSD: captoinfo.c,v 1.9 2001/01/22 18:01:50 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -41,7 +41,7 @@ * * There is just one entry point: * - * char *captoinfo(n, s, parametrized) + * char *_nc_captoinfo(n, s, parametrized) * * Convert value s for termcap string capability named n into terminfo * format. @@ -94,7 +94,7 @@ #include <ctype.h> #include <tic.h> -MODULE_ID("$From: captoinfo.c,v 1.37 2000/04/01 20:07:34 tom Exp $") +MODULE_ID("$From: captoinfo.c,v 1.40 2000/11/05 00:22:36 tom Exp $") #define MAX_PUSHED 16 /* max # args we can push onto the stack */ @@ -196,7 +196,7 @@ cvtchar(register const char *sp) case '2': case '3': len = 1; - while (isdigit(*sp)) { + while (isdigit(CharOf(*sp))) { c = 8 * c + (*sp++ - '0'); len++; } @@ -270,13 +270,16 @@ getparm(int parm, int n) } } +/* + * Convert a termcap string to terminfo format. + * 'cap' is the relevant terminfo capability index. + * 's' is the string value of the capability. + * 'parametrized' tells what type of translations to do: + * % translations if 1 + * pad translations if >=0 + */ char * -_nc_captoinfo( -/* convert a termcap string to terminfo format */ - register const char *cap, /* relevant terminfo capability index */ - register const char *s, /* string value of the capability */ - int const parametrized /* do % translations if 1, pad translations if >=0 */ -) +_nc_captoinfo(const char *cap, const char *s, int const parametrized) { const char *capstart; @@ -293,9 +296,9 @@ _nc_captoinfo( capstart = 0; if (s == 0) s = ""; - if (parametrized >= 0 && isdigit(*s)) + if (parametrized >= 0 && isdigit(CharOf(*s))) for (capstart = s;; s++) - if (!(isdigit(*s) || *s == '*' || *s == '.')) + if (!(isdigit(CharOf(*s)) || *s == '*' || *s == '.')) break; while (*s != '\0') { @@ -351,7 +354,7 @@ _nc_captoinfo( break; case 'a': if ((*s == '=' || *s == '+' || *s == '-' - || *s == '*' || *s == '/') + || *s == '*' || *s == '/') && (s[1] == 'p' || s[1] == 'c') && s[2] != '\0') { int l; @@ -463,7 +466,7 @@ _nc_captoinfo( dp = save_char(dp, '%'); s--; _nc_warning("unknown %% code %s (%#x) in %s", - unctrl(*s), (*s) & 0xff, cap); + unctrl((chtype) * s), CharOf(*s), cap); break; } break; @@ -544,7 +547,7 @@ _nc_captoinfo( if (capstart) { dp = save_string(dp, "$<"); for (s = capstart;; s++) - if (isdigit(*s) || *s == '*' || *s == '.') + if (isdigit(CharOf(*s)) || *s == '*' || *s == '.') dp = save_char(dp, *s); else break; @@ -568,8 +571,8 @@ bcd_expression(const char *str) char ch1, ch2; if (sscanf(str, fmt, &ch1, &ch2) == 2 - && isdigit(ch1) - && isdigit(ch2) + && isdigit(CharOf(ch1)) + && isdigit(CharOf(ch2)) && (ch1 == ch2)) { len = 28; #ifndef NDEBUG @@ -596,7 +599,7 @@ save_tc_char(char *bufptr, int c1) bufptr = save_char(bufptr, c1); } else { if (c1 == (c1 & 0x1f)) /* iscntrl() returns T on 255 */ - (void) strcpy(temp, unctrl(c1)); + (void) strcpy(temp, unctrl((chtype) c1)); else (void) sprintf(temp, "\\%03o", c1); bufptr = save_string(bufptr, temp); @@ -631,13 +634,12 @@ save_tc_inequality(char *bufptr, int c1, int c2) * %m exclusive-or all parameters with 0177 (not in 4.4BSD) */ +/* + * Convert a terminfo string to termcap format. Parameters are as in + * _nc_captoinfo(). + */ char * -_nc_infotocap( -/* convert a terminfo string to termcap format */ - register const char *cap GCC_UNUSED, /* relevant termcap capability index */ - register const char *str, /* string value of the capability */ - int const parametrized /* do % translations if 1, pad translations if >=0 */ -) +_nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parametrized) { int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0; const char *padding; @@ -651,13 +653,13 @@ _nc_infotocap( padding = str + strlen(str) - 1; if (*padding == '>' && *--padding == '/') { --padding; - while (isdigit(*padding) || *padding == '.' || *padding == '*') + while (isdigit(CharOf(*padding)) || *padding == '.' || *padding == '*') padding--; if (*padding == '<' && *--padding == '$') trimmed = padding; padding += 2; - while (isdigit(*padding) || *padding == '.' || *padding == '*') + while (isdigit(CharOf(*padding)) || *padding == '.' || *padding == '*') bufptr = save_char(bufptr, *padding++); } @@ -669,8 +671,11 @@ _nc_infotocap( bufptr = save_char(bufptr, *++str); } else if (str[0] == '$' && str[1] == '<') { /* discard padding */ str += 2; - while (isdigit(*str) || *str == '.' || *str == '*' || *str == - '/' || *str == '>') + while (isdigit(CharOf(*str)) + || *str == '.' + || *str == '*' + || *str == '/' + || *str == '>') str++; --str; } else if (str[0] == '%' && str[1] == '%') { /* escaped '%' */ @@ -694,7 +699,7 @@ _nc_infotocap( bufptr = save_string(bufptr, "%B"); } else if ((sscanf(str, "%%{%d}%%+%%c", &c1) == 1 || sscanf(str, "%%'%c'%%+%%c", &ch1) == 1) - && (cp = strchr(str, '+'))) { + && (cp = strchr(str, '+'))) { str = cp + 2; bufptr = save_string(bufptr, "%+"); @@ -734,7 +739,7 @@ _nc_infotocap( case '8': case '9': bufptr = save_char(bufptr, '%'); - while (isdigit(*str)) + while (isdigit(CharOf(*str))) bufptr = save_char(bufptr, *str++); if (strchr("doxX.", *str)) { if (*str != 'd') /* termcap doesn't have octal, hex */ diff --git a/lib/libcurses/tinfo/comp_error.c b/lib/libcurses/tinfo/comp_error.c index 38580200f4d..cfa5dfd59be 100644 --- a/lib/libcurses/tinfo/comp_error.c +++ b/lib/libcurses/tinfo/comp_error.c @@ -1,7 +1,7 @@ -/* $OpenBSD: comp_error.c,v 1.2 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: comp_error.c,v 1.3 2001/01/22 18:01:50 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 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> * ****************************************************************************/ - /* * comp_error.c -- Error message routines * diff --git a/lib/libcurses/tinfo/comp_expand.c b/lib/libcurses/tinfo/comp_expand.c index bf2bb3d397d..3de650bd120 100644 --- a/lib/libcurses/tinfo/comp_expand.c +++ b/lib/libcurses/tinfo/comp_expand.c @@ -1,7 +1,7 @@ -/* $OpenBSD: comp_expand.c,v 1.3 1999/03/11 21:03:57 millert Exp $ */ +/* $OpenBSD: comp_expand.c,v 1.4 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -37,13 +37,14 @@ #include <ctype.h> #include <tic.h> -MODULE_ID("$From: comp_expand.c,v 1.11 1999/03/07 00:51:07 tom Exp $") +MODULE_ID("$From: comp_expand.c,v 1.15 2000/12/10 01:30:10 tom Exp $") -static int trailing_spaces(const char *src) +static int +trailing_spaces(const char *src) { - while (*src == ' ') - src++; - return *src == 0; + while (*src == ' ') + src++; + return *src == 0; } /* this deals with differences over whether 0x7f and 0x80..0x9f are controls */ @@ -51,141 +52,136 @@ static int trailing_spaces(const char *src) #define REALCTL(s) (CHAR_OF(s) < 127 && iscntrl(CHAR_OF(s))) #define REALPRINT(s) (CHAR_OF(s) < 127 && isprint(CHAR_OF(s))) -char *_nc_tic_expand(const char *srcp, bool tic_format, int numbers) +NCURSES_EXPORT(char *) +_nc_tic_expand +(const char *srcp, bool tic_format, int numbers) { -static char * buffer; -static size_t length; + static char *buffer; + static size_t length; -int bufp; -const char *ptr, *str = VALID_STRING(srcp) ? srcp : ""; -bool islong = (strlen(str) > 3); -size_t need = (2 + strlen(str)) * 4; -int ch; + int bufp; + const char *str = VALID_STRING(srcp) ? srcp : ""; + bool islong = (strlen(str) > 3); + size_t need = (2 + strlen(str)) * 4; + int ch; - if (buffer == 0 || need > length) { - if ((buffer = typeRealloc(char, length = need, buffer)) == 0) - return 0; - } + if (buffer == 0 || need > length) { + if ((buffer = typeRealloc(char, length = need, buffer)) == 0) + return 0; + } - bufp = 0; - ptr = str; - while ((ch = (*str & 0xff)) != 0) { - if (ch == '%' && REALPRINT(str+1)) { - buffer[bufp++] = *str++; - /* - * Though the character literals are more compact, most - * terminal descriptions use numbers and are not easy - * to read in character-literal form. - */ - switch (numbers) { - case -1: - if (str[0] == S_QUOTE - && str[1] != '\\' - && REALPRINT(str+1) - && str[2] == S_QUOTE) { - sprintf(buffer+bufp, "{%d}", str[1]); - bufp += strlen(buffer+bufp); - str += 2; - } else { - buffer[bufp++] = *str; - } - break; - /* - * If we have a "%{number}", try to translate it into - * a "%'char'" form, since that will run a little faster - * when we're interpreting it. Also, having one form - * for the constant makes it simpler to compare terminal - * descriptions. - */ - case 1: - if (str[0] == L_BRACE - && isdigit(str[1])) { - char *dst = 0; - long value = strtol(str+1, &dst, 0); - if (dst != 0 - && *dst == R_BRACE - && value < 127 - && value != '\\' /* FIXME */ - && isprint((int)value)) { - ch = (int)value; - buffer[bufp++] = S_QUOTE; - if (ch == '\\' - || ch == S_QUOTE) - buffer[bufp++] = '\\'; - buffer[bufp++] = ch; - buffer[bufp++] = S_QUOTE; - str = dst; - } else { - buffer[bufp++] = *str; - } - } else { - buffer[bufp++] = *str; - } - break; - default: - buffer[bufp++] = *str; - break; - } - } - else if (ch == 128) { - buffer[bufp++] = '\\'; - buffer[bufp++] = '0'; - } - else if (ch == '\033') { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'E'; - } - else if (ch == '\\' && tic_format && (str == srcp || str[-1] != '^')) { - buffer[bufp++] = '\\'; - buffer[bufp++] = '\\'; - } - else if (ch == ' ' && tic_format && (str == srcp || trailing_spaces(str))) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 's'; + bufp = 0; + while ((ch = CharOf(*str)) != 0) { + if (ch == '%' && REALPRINT(str + 1)) { + buffer[bufp++] = *str++; + /* + * Though the character literals are more compact, most + * terminal descriptions use numbers and are not easy + * to read in character-literal form. + */ + switch (numbers) { + case -1: + if (str[0] == S_QUOTE + && str[1] != '\\' + && REALPRINT(str + 1) + && str[2] == S_QUOTE) { + sprintf(buffer + bufp, "{%d}", str[1]); + bufp += strlen(buffer + bufp); + str += 2; + } else { + buffer[bufp++] = *str; } - else if ((ch == ',' || ch == ':' || ch == '^') && tic_format) { - buffer[bufp++] = '\\'; + break; + /* + * If we have a "%{number}", try to translate it into + * a "%'char'" form, since that will run a little faster + * when we're interpreting it. Also, having one form + * for the constant makes it simpler to compare terminal + * descriptions. + */ + case 1: + if (str[0] == L_BRACE + && isdigit(CharOf(str[1]))) { + char *dst = 0; + long value = strtol(str + 1, &dst, 0); + if (dst != 0 + && *dst == R_BRACE + && value < 127 + && value != '\\' /* FIXME */ + && isprint((int) value)) { + ch = (int) value; + buffer[bufp++] = S_QUOTE; + if (ch == '\\' + || ch == S_QUOTE) + buffer[bufp++] = '\\'; buffer[bufp++] = ch; + buffer[bufp++] = S_QUOTE; + str = dst; + } else { + buffer[bufp++] = *str; + } + } else { + buffer[bufp++] = *str; } - else if (REALPRINT(str) && (ch != ',' && ch != ':' && !(ch == '!' && !tic_format) && ch != '^')) - buffer[bufp++] = ch; -#if 0 /* FIXME: this would be more readable (in fact the whole 'islong' logic should be removed) */ - else if (ch == '\b') { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'b'; - } - else if (ch == '\f') { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'f'; - } - else if (ch == '\t' && islong) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 't'; - } + break; + default: + buffer[bufp++] = *str; + break; + } + } else if (ch == 128) { + buffer[bufp++] = '\\'; + buffer[bufp++] = '0'; + } else if (ch == '\033') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'E'; + } else if (ch == '\\' && tic_format && (str == srcp || str[-1] != '^')) { + buffer[bufp++] = '\\'; + buffer[bufp++] = '\\'; + } else if (ch == ' ' && tic_format && (str == srcp || + trailing_spaces(str))) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 's'; + } else if ((ch == ',' || ch == ':' || ch == '^') && tic_format) { + buffer[bufp++] = '\\'; + buffer[bufp++] = ch; + } else if (REALPRINT(str) + && (ch != ',' + && ch != ':' + && !(ch == '!' && !tic_format) + && ch != '^')) + buffer[bufp++] = ch; +#if 0 /* FIXME: this would be more readable (in fact the whole 'islong' logic should be removed) */ + else if (ch == '\b') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'b'; + } else if (ch == '\f') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'f'; + } else if (ch == '\t' && islong) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 't'; + } #endif - else if (ch == '\r' && (islong || (strlen(srcp) > 2 && str[1] == '\0'))) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'r'; - } - else if (ch == '\n' && islong) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'n'; - } + else if (ch == '\r' && (islong || (strlen(srcp) > 2 && str[1] == '\0'))) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'r'; + } else if (ch == '\n' && islong) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'n'; + } #define UnCtl(c) ((c) + '@') - else if (REALCTL(str) && ch != '\\' && (!islong || isdigit(str[1]))) - { - (void) sprintf(&buffer[bufp], "^%c", UnCtl(ch)); - bufp += 2; - } - else - { - (void) sprintf(&buffer[bufp], "\\%03o", ch); - bufp += 4; - } - - str++; + else if (REALCTL(str) && ch != '\\' + && (!islong || isdigit(CharOf(str[1])))) { + (void) sprintf(&buffer[bufp], "^%c", UnCtl(ch)); + bufp += 2; + } else { + (void) sprintf(&buffer[bufp], "\\%03o", ch); + bufp += 4; } - buffer[bufp] = '\0'; - return(buffer); + str++; + } + + buffer[bufp] = '\0'; + return (buffer); } diff --git a/lib/libcurses/tinfo/comp_parse.c b/lib/libcurses/tinfo/comp_parse.c index 161b6d977c3..7a8992726ac 100644 --- a/lib/libcurses/tinfo/comp_parse.c +++ b/lib/libcurses/tinfo/comp_parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: comp_parse.c,v 1.9 2000/10/22 18:27:23 millert Exp $ */ +/* $OpenBSD: comp_parse.c,v 1.10 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -54,10 +54,10 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: comp_parse.c,v 1.42 2000/10/14 17:50:45 Bernhard.Rosenkraenzer Exp $") +MODULE_ID("$From: comp_parse.c,v 1.48 2001/01/15 00:44:51 tom Exp $") static void sanity_check(TERMTYPE *); -void (*_nc_check_termtype) (TERMTYPE *) = sanity_check; +NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype) (TERMTYPE *) = sanity_check; /**************************************************************************** * @@ -80,10 +80,11 @@ void (*_nc_check_termtype) (TERMTYPE *) = sanity_check; * _nc_head _nc_tail */ -ENTRY *_nc_head = 0, *_nc_tail = 0; +NCURSES_EXPORT_VAR(ENTRY *) _nc_head = 0; +NCURSES_EXPORT_VAR(ENTRY *) _nc_tail = 0; -static void -enqueue(ENTRY * ep) + static void + enqueue(ENTRY * ep) /* add an entry to the in-core list */ { ENTRY *newp = _nc_copy_entry(ep); @@ -99,7 +100,7 @@ enqueue(ENTRY * ep) newp->last->next = newp; } -void +NCURSES_EXPORT(void) _nc_free_entries(ENTRY * headp) /* free the allocated storage consumed by list entries */ { @@ -139,7 +140,7 @@ force_bar(char *dst, char *src, size_t siz) return src; } -bool +NCURSES_EXPORT(bool) _nc_entry_match(char *n1, char *n2) /* do any of the aliases in a pair of terminal names match? */ { @@ -164,10 +165,10 @@ _nc_entry_match(char *n1, char *n2) * ****************************************************************************/ -void +NCURSES_EXPORT(void) _nc_read_entry_source(FILE * fp, char *buf, - int literal, bool silent, - bool(*hook) (ENTRY *)) + int literal, bool silent, + bool(*hook) (ENTRY *)) /* slurp all entries in the given file into core */ { ENTRY thisentry; @@ -182,7 +183,7 @@ _nc_read_entry_source(FILE * fp, char *buf, memset(&thisentry, 0, sizeof(thisentry)); if (_nc_parse_entry(&thisentry, literal, silent) == ERR) break; - if (!isalnum(thisentry.tterm.term_names[0])) + if (!isalnum(CharOf(thisentry.tterm.term_names[0]))) _nc_err_abort("terminal names must start with letter or digit"); /* @@ -212,7 +213,7 @@ _nc_read_entry_source(FILE * fp, char *buf, _nc_suppress_warnings = oldsuppress; } -int +NCURSES_EXPORT(int) _nc_resolve_uses(bool fullresolve) /* try to resolve all use capabilities */ { @@ -229,17 +230,18 @@ _nc_resolve_uses(bool fullresolve) for_entry_list(qp) { int matchcount = 0; - for_entry_list(rp) + for_entry_list(rp) { if (qp > rp - && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) { - matchcount++; - if (matchcount == 1) { - (void) fprintf(stderr, "Name collision between %s", - _nc_first_name(qp->tterm.term_names)); - multiples++; + && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) { + matchcount++; + if (matchcount == 1) { + (void) fprintf(stderr, "Name collision between %s", + _nc_first_name(qp->tterm.term_names)); + multiples++; + } + if (matchcount >= 1) + (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names)); } - if (matchcount >= 1) - (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names)); } if (matchcount >= 1) (void) putc('\n', stderr); @@ -267,14 +269,15 @@ _nc_resolve_uses(bool fullresolve) _nc_set_type(child); /* first, try to resolve from in-core records */ - for_entry_list(rp) + for_entry_list(rp) { if (rp != qp - && _nc_name_match(rp->tterm.term_names, lookfor, "|")) { - DEBUG(2, ("%s: resolving use=%s (in core)", - child, lookfor)); + && _nc_name_match(rp->tterm.term_names, lookfor, "|")) { + DEBUG(2, ("%s: resolving use=%s (in core)", + child, lookfor)); - qp->uses[i].link = rp; - foundit = TRUE; + qp->uses[i].link = rp; + foundit = TRUE; + } } /* if that didn't work, try to merge in a compiled entry */ @@ -285,7 +288,7 @@ _nc_resolve_uses(bool fullresolve) memset(&thisterm, 0, sizeof(thisterm)); if (_nc_read_entry(lookfor, filename, &thisterm) == 1) { DEBUG(2, ("%s: resolving use=%s (compiled)", - child, lookfor)); + child, lookfor)); rp = typeMalloc(ENTRY, 1); if (rp == 0) @@ -333,7 +336,7 @@ _nc_resolve_uses(bool fullresolve) for_entry_list(qp) { if (qp->nuses > 0) { DEBUG(2, ("%s: attempting merge", - _nc_first_name(qp->tterm.term_names))); + _nc_first_name(qp->tterm.term_names))); /* * If any of the use entries we're looking for is * incomplete, punt. We'll catch this entry on a @@ -342,7 +345,7 @@ _nc_resolve_uses(bool fullresolve) for (i = 0; i < qp->nuses; i++) if (qp->uses[i].link->nuses) { DEBUG(2, ("%s: use entry %d unresolved", - _nc_first_name(qp->tterm.term_names), i)); + _nc_first_name(qp->tterm.term_names), i)); goto incomplete; } @@ -360,7 +363,7 @@ _nc_resolve_uses(bool fullresolve) */ for (; qp->nuses; qp->nuses--) _nc_merge_entry(&merged, - &qp->uses[qp->nuses - 1].link->tterm); + &qp->uses[qp->nuses - 1].link->tterm); /* * Now merge in the original entry. @@ -374,6 +377,7 @@ _nc_resolve_uses(bool fullresolve) FreeIfNeeded(qp->tterm.Numbers); FreeIfNeeded(qp->tterm.Strings); qp->tterm = merged; + _nc_wrap_entry(qp, TRUE); /* * We know every entry is resolvable because name resolution @@ -395,15 +399,18 @@ _nc_resolve_uses(bool fullresolve) * entry there should be no cancellation markers. */ for_entry_list(qp) { - for_each_boolean(j, &(qp->tterm)) - if (qp->tterm.Booleans[j] == CANCELLED_BOOLEAN) - qp->tterm.Booleans[j] = ABSENT_BOOLEAN; - for_each_number(j, &(qp->tterm)) + for_each_boolean(j, &(qp->tterm)) { + if ((int) qp->tterm.Booleans[j] == CANCELLED_BOOLEAN) + qp->tterm.Booleans[j] = ABSENT_BOOLEAN; + } + for_each_number(j, &(qp->tterm)) { if (qp->tterm.Numbers[j] == CANCELLED_NUMERIC) - qp->tterm.Numbers[j] = ABSENT_NUMERIC; - for_each_string(j, &(qp->tterm)) + qp->tterm.Numbers[j] = ABSENT_NUMERIC; + } + for_each_string(j, &(qp->tterm)) { if (qp->tterm.Strings[j] == CANCELLED_STRING) - qp->tterm.Strings[j] = ABSENT_STRING; + qp->tterm.Strings[j] = ABSENT_STRING; + } } } @@ -447,14 +454,14 @@ sanity_check(TERMTYPE * tp) bool terminal_entry = !strchr(tp->term_names, '+'); if (terminal_entry && (PRESENT(set_attributes) - || PRESENT(enter_standout_mode) - || PRESENT(enter_underline_mode) - || PRESENT(enter_blink_mode) - || PRESENT(enter_bold_mode) - || PRESENT(enter_dim_mode) - || PRESENT(enter_secure_mode) - || PRESENT(enter_protected_mode) - || PRESENT(enter_reverse_mode))) + || PRESENT(enter_standout_mode) + || PRESENT(enter_underline_mode) + || PRESENT(enter_blink_mode) + || PRESENT(enter_bold_mode) + || PRESENT(enter_dim_mode) + || PRESENT(enter_secure_mode) + || PRESENT(enter_protected_mode) + || PRESENT(enter_reverse_mode))) _nc_warning("no exit_attribute_mode"); #endif /* __UNUSED__ */ PAIRED(enter_standout_mode, exit_standout_mode) diff --git a/lib/libcurses/tinfo/comp_scan.c b/lib/libcurses/tinfo/comp_scan.c index 2ada427fc8c..80b4b84cec5 100644 --- a/lib/libcurses/tinfo/comp_scan.c +++ b/lib/libcurses/tinfo/comp_scan.c @@ -50,7 +50,7 @@ #include <term_entry.h> #include <tic.h> -MODULE_ID("$From: comp_scan.c,v 1.47 2000/09/24 01:15:17 tom Exp $") +MODULE_ID("$From: comp_scan.c,v 1.52 2000/12/10 02:55:07 tom Exp $") /* * Maximum length of string capability we'll accept before raising an error. @@ -60,14 +60,22 @@ MODULE_ID("$From: comp_scan.c,v 1.47 2000/09/24 01:15:17 tom Exp $") #define iswhite(ch) (ch == ' ' || ch == '\t') -int _nc_syntax = 0; /* termcap or terminfo? */ -long _nc_curr_file_pos = 0; /* file offset of current line */ -long _nc_comment_start = 0; /* start of comment range before name */ -long _nc_comment_end = 0; /* end of comment range before name */ -long _nc_start_line = 0; /* start line of current entry */ - -struct token _nc_curr_token = -{0, 0, 0}; +NCURSES_EXPORT_VAR(int) +_nc_syntax = 0; /* termcap or terminfo? */ +NCURSES_EXPORT_VAR(long) +_nc_curr_file_pos = 0; /* file offset of current line */ +NCURSES_EXPORT_VAR(long) +_nc_comment_start = 0; /* start of comment range before name */ +NCURSES_EXPORT_VAR(long) +_nc_comment_end = 0; /* end of comment range before name */ +NCURSES_EXPORT_VAR(long) +_nc_start_line = 0; /* start line of current entry */ + +NCURSES_EXPORT_VAR(struct token) +_nc_curr_token = +{ + 0, 0, 0 +}; /***************************************************************************** * @@ -81,18 +89,18 @@ static int pushtype; /* type of pushback token */ static char pushname[MAX_NAME_SIZE + 1]; #if NCURSES_EXT_FUNCS -bool _nc_disable_period = FALSE; /* used by tic -a option */ +NCURSES_EXPORT_VAR(bool) _nc_disable_period = FALSE; /* used by tic -a option */ #endif -static int last_char(void); -static int next_char(void); -static long stream_pos(void); -static bool end_of_stream(void); -static void push_back(char c); + static int last_char(void); + static int next_char(void); + static long stream_pos(void); + static bool end_of_stream(void); + static void push_back(char c); /* Assume we may be looking at a termcap-style continuation */ -static inline int -eat_escaped_newline(int ch) + static inline int + eat_escaped_newline(int ch) { if (ch == '\\') while ((ch = next_char()) == '\n' || iswhite(ch)) @@ -133,7 +141,7 @@ eat_escaped_newline(int ch) * */ -int +NCURSES_EXPORT(int) _nc_get_token(void) { static const char terminfo_punct[] = "@%&*!#"; @@ -203,7 +211,7 @@ _nc_get_token(void) #endif && !strchr(terminfo_punct, (char) ch)) { _nc_warning("Illegal character (expected alphanumeric or %s) - %s", - terminfo_punct, unctrl(ch)); + terminfo_punct, unctrl((chtype) ch)); _nc_panic_mode(separator); goto start_token; } @@ -296,7 +304,7 @@ _nc_get_token(void) * dangerous due to shell expansion. */ for (ptr = buffer; ptr < desc; ptr++) { - if (isspace(*ptr)) { + if (isspace(CharOf(*ptr))) { _nc_warning("whitespace in name or alias field"); break; } else if (*ptr == '/') { @@ -338,7 +346,7 @@ _nc_get_token(void) case '@': if ((ch = next_char()) != separator) _nc_warning("Missing separator after `%s', have %s", - buffer, unctrl(ch)); + buffer, unctrl((chtype) ch)); _nc_curr_token.tk_name = buffer; type = CANCEL; break; @@ -376,7 +384,7 @@ _nc_get_token(void) default: /* just to get rid of the compiler warning */ type = UNDEF; - _nc_warning("Illegal character - %s", unctrl(ch)); + _nc_warning("Illegal character - %s", unctrl((chtype) ch)); } } /* end else (first_column == FALSE) */ } /* end else (ch != EOF) */ @@ -454,11 +462,11 @@ _nc_get_token(void) * */ -char +NCURSES_EXPORT(char) _nc_trans_string(char *ptr, char *last) { int count = 0; - int number; + int number = 0; int i, c; chtype ch, last_ch = '\0'; bool ignored = FALSE; @@ -608,7 +616,7 @@ _nc_trans_string(char *ptr, char *last) * get_token() call. */ -void +NCURSES_EXPORT(void) _nc_push_token(int tokclass) { /* @@ -627,7 +635,7 @@ _nc_push_token(int tokclass) /* * Panic mode error recovery - skip everything until a "ch" is found. */ -void +NCURSES_EXPORT(void) _nc_panic_mode(char ch) { int c; @@ -661,7 +669,7 @@ static FILE *yyin; /* scanner's input file descriptor */ * non-null. */ -void +NCURSES_EXPORT(void) _nc_reset_input(FILE * fp, char *buf) { pushtype = NO_PUSHBACK; @@ -684,7 +692,7 @@ last_char(void) { size_t len = strlen(bufptr); while (len--) { - if (!isspace(bufptr[len])) + if (!isspace(CharOf(bufptr[len]))) return bufptr[len]; } return 0; diff --git a/lib/libcurses/tinfo/doalloc.c b/lib/libcurses/tinfo/doalloc.c index 2afac65e2ef..14628653065 100644 --- a/lib/libcurses/tinfo/doalloc.c +++ b/lib/libcurses/tinfo/doalloc.c @@ -1,7 +1,7 @@ -/* $OpenBSD: doalloc.c,v 1.4 1999/05/08 20:29:01 millert Exp $ */ +/* $OpenBSD: doalloc.c,v 1.5 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -32,7 +32,6 @@ * Author: Thomas E. Dickey <dickey@clark.net> 1998 * ****************************************************************************/ - /* * Wrapper for malloc/realloc. Standard implementations allow realloc with * a null pointer, but older libraries may not (e.g., SunOS). @@ -42,31 +41,33 @@ #include <curses.priv.h> -MODULE_ID("$From: doalloc.c,v 1.5 1999/03/14 12:25:27 tom Exp $") +MODULE_ID("$From: doalloc.c,v 1.7 2000/12/10 02:55:07 tom Exp $") -void *_nc_doalloc(void *oldp, size_t amount) +NCURSES_EXPORT(void *) +_nc_doalloc(void *oldp, size_t amount) { - void *newp; + void *newp; - if (oldp != 0) { - if ((newp = realloc(oldp, amount)) == 0) { - free(oldp); - errno = ENOMEM; /* just in case 'free' reset */ - } - } else { - newp = typeMalloc(char, amount); + if (oldp != 0) { + if ((newp = realloc(oldp, amount)) == 0) { + free(oldp); + errno = ENOMEM; /* just in case 'free' reset */ } - return newp; + } else { + newp = typeMalloc(char, amount); + } + return newp; } #if !HAVE_STRDUP -char *_nc_strdup(const char *src) +NCURSES_EXPORT(char *) +_nc_strdup(const char *src) { char *dst; if (src != 0) { dst = typeMalloc(char, strlen(src) + 1); if (dst != 0) { - (void)strcpy(dst, src); + (void) strcpy(dst, src); } } else { dst = 0; diff --git a/lib/libcurses/tinfo/free_ttype.c b/lib/libcurses/tinfo/free_ttype.c index 31588f3f458..987a3dfd4b1 100644 --- a/lib/libcurses/tinfo/free_ttype.c +++ b/lib/libcurses/tinfo/free_ttype.c @@ -1,4 +1,4 @@ -/* $OpenBSD: free_ttype.c,v 1.4 2000/07/10 03:06:16 millert Exp $ */ +/* $OpenBSD: free_ttype.c,v 1.5 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** * Copyright (c) 1999,2000 Free Software Foundation, Inc. * @@ -32,7 +32,6 @@ * Author: Thomas E. Dickey <dickey@clark.net> 1999 * ****************************************************************************/ - /* * free_ttype.c -- allocation functions for TERMTYPE * @@ -46,9 +45,10 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: free_ttype.c,v 1.5 2000/07/08 00:43:58 tom Exp $") +MODULE_ID("$From: free_ttype.c,v 1.7 2000/12/10 02:55:07 tom Exp $") -void _nc_free_termtype(TERMTYPE *ptr) +NCURSES_EXPORT(void) +_nc_free_termtype(TERMTYPE * ptr) { FreeIfNeeded(ptr->str_table); FreeIfNeeded(ptr->term_names); @@ -63,9 +63,10 @@ void _nc_free_termtype(TERMTYPE *ptr) } #if NCURSES_XNAMES -bool _nc_user_definable = TRUE; +NCURSES_EXPORT_VAR(bool) _nc_user_definable = TRUE; -int use_extended_names(bool flag) +NCURSES_EXPORT(int) +use_extended_names(bool flag) { int oldflag = _nc_user_definable; _nc_user_definable = flag; diff --git a/lib/libcurses/tinfo/getenv_num.c b/lib/libcurses/tinfo/getenv_num.c index 21e48bdbafe..80723dbedf8 100644 --- a/lib/libcurses/tinfo/getenv_num.c +++ b/lib/libcurses/tinfo/getenv_num.c @@ -1,7 +1,7 @@ -/* $OpenBSD: getenv_num.c,v 1.1 1999/01/18 19:10:15 millert Exp $ */ +/* $OpenBSD: getenv_num.c,v 1.2 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,21 +38,21 @@ #include <curses.priv.h> -MODULE_ID("$From: getenv_num.c,v 1.1 1998/09/19 21:30:23 tom Exp $") +MODULE_ID("$From: getenv_num.c,v 1.3 2000/12/10 02:55:07 tom Exp $") -int +NCURSES_EXPORT(int) _nc_getenv_num(const char *name) { - char *dst = 0; - char *src = getenv(name); - long value; - - if ((src == 0) - || (value = strtol(src, &dst, 0)) < 0 - || (dst == src) - || (*dst != '\0') - || (int)value < value) - value = -1; - - return (int) value; + char *dst = 0; + char *src = getenv(name); + long value; + + if ((src == 0) + || (value = strtol(src, &dst, 0)) < 0 + || (dst == src) + || (*dst != '\0') + || (int) value < value) + value = -1; + + return (int) value; } diff --git a/lib/libcurses/tinfo/home_terminfo.c b/lib/libcurses/tinfo/home_terminfo.c index 367bfa68fe7..13b0cad7e6c 100644 --- a/lib/libcurses/tinfo/home_terminfo.c +++ b/lib/libcurses/tinfo/home_terminfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: home_terminfo.c,v 1.6 2000/10/09 14:39:50 millert Exp $ */ +/* $OpenBSD: home_terminfo.c,v 1.7 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -39,13 +39,13 @@ #include <curses.priv.h> #include <tic.h> -MODULE_ID("$From: home_terminfo.c,v 1.3 2000/10/04 02:31:53 tom Exp $"); +MODULE_ID("$From: home_terminfo.c,v 1.6 2000/12/10 02:55:07 tom Exp $") #define my_length (strlen(home) + sizeof(PRIVATE_INFO)) /* ncurses extension...fall back on user's private directory */ -char * +NCURSES_EXPORT(char *) _nc_home_terminfo(void) { char *home; diff --git a/lib/libcurses/tinfo/init_keytry.c b/lib/libcurses/tinfo/init_keytry.c index d4c96517309..083861d2690 100644 --- a/lib/libcurses/tinfo/init_keytry.c +++ b/lib/libcurses/tinfo/init_keytry.c @@ -1,7 +1,7 @@ -/* $OpenBSD: init_keytry.c,v 1.4 2000/03/13 23:53:40 millert Exp $ */ +/* $OpenBSD: init_keytry.c,v 1.5 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 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 * @@ -30,11 +30,11 @@ #include <curses.priv.h> -#include <term.h> /* keypad_xmit, keypad_local, meta_on, meta_off */ +#include <term.h> /* keypad_xmit, keypad_local, meta_on, meta_off */ /* cursor_visible,cursor_normal,cursor_invisible */ -#include <tic.h> /* struct tinfo_fkeys */ +#include <tic.h> /* struct tinfo_fkeys */ -MODULE_ID("$From: init_keytry.c,v 1.3 2000/03/12 02:55:50 Todd.C.Miller Exp $") +MODULE_ID("$From: init_keytry.c,v 1.5 2000/12/10 02:55:07 tom Exp $") /* ** _nc_init_keytry() @@ -54,27 +54,29 @@ MODULE_ID("$From: init_keytry.c,v 1.3 2000/03/12 02:55:50 Todd.C.Miller Exp $") #endif*/ #if BROKEN_LINKER -struct tinfo_fkeys *_nc_tinfo_fkeysf(void) +struct tinfo_fkeys * +_nc_tinfo_fkeysf(void) { - return _nc_tinfo_fkeys; + return _nc_tinfo_fkeys; } #endif -void _nc_init_keytry(void) +NCURSES_EXPORT(void) +_nc_init_keytry(void) { - size_t n; + size_t n; - /* The SP->_keytry value is initialized in newterm(), where the SP - * structure is created, because we can not tell where keypad() or - * mouse_activate() (which will call keyok()) are first called. - */ + /* The SP->_keytry value is initialized in newterm(), where the SP + * structure is created, because we can not tell where keypad() or + * mouse_activate() (which will call keyok()) are first called. + */ - for (n = 0; _nc_tinfo_fkeys[n].code; n++) - if (_nc_tinfo_fkeys[n].offset < STRCOUNT) - _nc_add_to_try(&(SP->_keytry), - CUR Strings[_nc_tinfo_fkeys[n].offset], - _nc_tinfo_fkeys[n].code); + for (n = 0; _nc_tinfo_fkeys[n].code; n++) + if (_nc_tinfo_fkeys[n].offset < STRCOUNT) + _nc_add_to_try(&(SP->_keytry), + CUR Strings[_nc_tinfo_fkeys[n].offset], + _nc_tinfo_fkeys[n].code); #ifdef TRACE - _nc_trace_tries(SP->_keytry); + _nc_trace_tries(SP->_keytry); #endif } diff --git a/lib/libcurses/tinfo/lib_acs.c b/lib/libcurses/tinfo/lib_acs.c index a9b142b9b64..9e406cf4d18 100644 --- a/lib/libcurses/tinfo/lib_acs.c +++ b/lib/libcurses/tinfo/lib_acs.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_acs.c,v 1.3 1999/11/28 17:49:54 millert Exp $ */ +/* $OpenBSD: lib_acs.c,v 1.4 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 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,109 +33,133 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - #include <curses.priv.h> -#include <term.h> /* ena_acs, acs_chars */ - -MODULE_ID("$From: lib_acs.c,v 1.16 1999/10/30 23:00:16 tom Exp $") +#include <term.h> /* ena_acs, acs_chars */ -chtype acs_map[ACS_LEN] = { 0 }; +MODULE_ID("$From: lib_acs.c,v 1.18 2000/12/10 02:55:07 tom Exp $") -void _nc_init_acs(void) +NCURSES_EXPORT_VAR(chtype) acs_map[ACS_LEN] = { - T(("initializing ACS map")); + 0 +}; - /* - * Initializations for a UNIX-like multi-terminal environment. Use - * ASCII chars and count on the terminfo description to do better. - */ - ACS_ULCORNER = '+'; /* should be upper left corner */ - ACS_LLCORNER = '+'; /* should be lower left corner */ - ACS_URCORNER = '+'; /* should be upper right corner */ - ACS_LRCORNER = '+'; /* should be lower right corner */ - ACS_RTEE = '+'; /* should be tee pointing left */ - ACS_LTEE = '+'; /* should be tee pointing right */ - ACS_BTEE = '+'; /* should be tee pointing up */ - ACS_TTEE = '+'; /* should be tee pointing down */ - ACS_HLINE = '-'; /* should be horizontal line */ - ACS_VLINE = '|'; /* should be vertical line */ - ACS_PLUS = '+'; /* should be large plus or crossover */ - ACS_S1 = '~'; /* should be scan line 1 */ - ACS_S9 = '_'; /* should be scan line 9 */ - ACS_DIAMOND = '+'; /* should be diamond */ - ACS_CKBOARD = ':'; /* should be checker board (stipple) */ - ACS_DEGREE = '\''; /* should be degree symbol */ - ACS_PLMINUS = '#'; /* should be plus/minus */ - ACS_BULLET = 'o'; /* should be bullet */ - ACS_LARROW = '<'; /* should be arrow pointing left */ - ACS_RARROW = '>'; /* should be arrow pointing right */ - ACS_DARROW = 'v'; /* should be arrow pointing down */ - ACS_UARROW = '^'; /* should be arrow pointing up */ - ACS_BOARD = '#'; /* should be board of squares */ - ACS_LANTERN = '#'; /* should be lantern symbol */ - ACS_BLOCK = '#'; /* should be solid square block */ - /* these defaults were invented for ncurses */ - ACS_S3 = '-'; /* should be scan line 3 */ - ACS_S7 = '-'; /* should be scan line 7 */ - ACS_LEQUAL = '<'; /* should be less-than-or-equal-to */ - ACS_GEQUAL = '>'; /* should be greater-than-or-equal-to */ - ACS_PI = '*'; /* should be greek pi */ - ACS_NEQUAL = '!'; /* should be not-equal */ - ACS_STERLING = 'f'; /* should be pound-sterling symbol */ +NCURSES_EXPORT(void) +_nc_init_acs(void) +{ + T(("initializing ACS map")); - if (ena_acs != NULL) - { - TPUTS_TRACE("ena_acs"); - putp(ena_acs); - } + /* + * Initializations for a UNIX-like multi-terminal environment. Use + * ASCII chars and count on the terminfo description to do better. + */ + ACS_ULCORNER = '+'; /* should be upper left corner */ + ACS_LLCORNER = '+'; /* should be lower left corner */ + ACS_URCORNER = '+'; /* should be upper right corner */ + ACS_LRCORNER = '+'; /* should be lower right corner */ + ACS_RTEE = '+'; /* should be tee pointing left */ + ACS_LTEE = '+'; /* should be tee pointing right */ + ACS_BTEE = '+'; /* should be tee pointing up */ + ACS_TTEE = '+'; /* should be tee pointing down */ + ACS_HLINE = '-'; /* should be horizontal line */ + ACS_VLINE = '|'; /* should be vertical line */ + ACS_PLUS = '+'; /* should be large plus or crossover */ + ACS_S1 = '~'; /* should be scan line 1 */ + ACS_S9 = '_'; /* should be scan line 9 */ + ACS_DIAMOND = '+'; /* should be diamond */ + ACS_CKBOARD = ':'; /* should be checker board (stipple) */ + ACS_DEGREE = '\''; /* should be degree symbol */ + ACS_PLMINUS = '#'; /* should be plus/minus */ + ACS_BULLET = 'o'; /* should be bullet */ + ACS_LARROW = '<'; /* should be arrow pointing left */ + ACS_RARROW = '>'; /* should be arrow pointing right */ + ACS_DARROW = 'v'; /* should be arrow pointing down */ + ACS_UARROW = '^'; /* should be arrow pointing up */ + ACS_BOARD = '#'; /* should be board of squares */ + ACS_LANTERN = '#'; /* should be lantern symbol */ + ACS_BLOCK = '#'; /* should be solid square block */ + /* these defaults were invented for ncurses */ + ACS_S3 = '-'; /* should be scan line 3 */ + ACS_S7 = '-'; /* should be scan line 7 */ + ACS_LEQUAL = '<'; /* should be less-than-or-equal-to */ + ACS_GEQUAL = '>'; /* should be greater-than-or-equal-to */ + ACS_PI = '*'; /* should be greek pi */ + ACS_NEQUAL = '!'; /* should be not-equal */ + ACS_STERLING = 'f'; /* should be pound-sterling symbol */ + if (ena_acs != NULL) { + TPUTS_TRACE("ena_acs"); + putp(ena_acs); + } #define ALTCHAR(c) ((chtype)(((unsigned char)(c)) | A_ALTCHARSET)) - if (acs_chars != NULL) { - size_t i = 0; - size_t length = strlen(acs_chars); + if (acs_chars != NULL) { + size_t i = 0; + size_t length = strlen(acs_chars); - while (i < length) - switch (acs_chars[i]) { - case 'l':case 'm':case 'k':case 'j': - case 'u':case 't':case 'v':case 'w': - case 'q':case 'x':case 'n':case 'o': - case 's':case '`':case 'a':case 'f': - case 'g':case '~':case ',':case '+': - case '.':case '-':case 'h':case 'i': - case '0':case 'p':case 'r':case 'y': - case 'z':case '{':case '|':case '}': - acs_map[(unsigned int)acs_chars[i]] = - ALTCHAR(acs_chars[i+1]); - i++; - /* FALLTHRU */ - default: - i++; - break; - } - } + while (i < length) + switch (acs_chars[i]) { + case 'l': + case 'm': + case 'k': + case 'j': + case 'u': + case 't': + case 'v': + case 'w': + case 'q': + case 'x': + case 'n': + case 'o': + case 's': + case '`': + case 'a': + case 'f': + case 'g': + case '~': + case ',': + case '+': + case '.': + case '-': + case 'h': + case 'i': + case '0': + case 'p': + case 'r': + case 'y': + case 'z': + case '{': + case '|': + case '}': + acs_map[(unsigned int) acs_chars[i]] = + ALTCHAR(acs_chars[i + 1]); + i++; + /* FALLTHRU */ + default: + i++; + break; + } + } #ifdef TRACE - /* Show the equivalent mapping, noting if it does not match the - * given attribute, whether by re-ordering or duplication. - */ - if (_nc_tracing & TRACE_CALLS) { - size_t n, m; - char show[SIZEOF(acs_map) + 1]; - for (n = 1, m = 0; n < SIZEOF(acs_map); n++) { - if (acs_map[n] != 0) { - show[m++] = (char)n; - show[m++] = TextOf(acs_map[n]); - } - } - show[m] = 0; - _tracef("%s acs_chars %s", - (acs_chars == NULL) - ? "NULL" - : (strcmp(acs_chars, show) - ? "DIFF" - : "SAME"), - _nc_visbuf(show)); + /* Show the equivalent mapping, noting if it does not match the + * given attribute, whether by re-ordering or duplication. + */ + if (_nc_tracing & TRACE_CALLS) { + size_t n, m; + char show[SIZEOF(acs_map) + 1]; + for (n = 1, m = 0; n < SIZEOF(acs_map); n++) { + if (acs_map[n] != 0) { + show[m++] = (char) n; + show[m++] = TextOf(acs_map[n]); + } } + show[m] = 0; + _tracef("%s acs_chars %s", + (acs_chars == NULL) + ? "NULL" + : (strcmp(acs_chars, show) + ? "DIFF" + : "SAME"), + _nc_visbuf(show)); + } #endif /* TRACE */ } diff --git a/lib/libcurses/tinfo/lib_baudrate.c b/lib/libcurses/tinfo/lib_baudrate.c index 31a78c107f6..39342dcb9ab 100644 --- a/lib/libcurses/tinfo/lib_baudrate.c +++ b/lib/libcurses/tinfo/lib_baudrate.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_baudrate.c,v 1.3 2000/10/08 22:47:01 millert Exp $ */ +/* $OpenBSD: lib_baudrate.c,v 1.4 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 <term.h> /* cur_term, pad_char */ #include <termcap.h> /* ospeed */ -MODULE_ID("$From: lib_baudrate.c,v 1.17 2000/10/08 00:59:08 tom Exp $") +MODULE_ID("$From: lib_baudrate.c,v 1.19 2000/12/10 02:55:07 tom Exp $") /* * int @@ -53,8 +53,8 @@ MODULE_ID("$From: lib_baudrate.c,v 1.17 2000/10/08 00:59:08 tom Exp $") */ struct speed { - int s; /* value for 'ospeed' is an index */ - int sp; /* the actual speed */ + int s; /* value for 'ospeed' is an index */ + int sp; /* the actual speed */ }; static struct speed const speeds[] = @@ -101,7 +101,7 @@ static struct speed const speeds[] = #endif }; -int +NCURSES_EXPORT(int) _nc_baudrate(int OSpeed) { static int last_OSpeed; @@ -127,7 +127,7 @@ _nc_baudrate(int OSpeed) return (result); } -int +NCURSES_EXPORT(int) _nc_ospeed(int BaudRate) { int result = 1; @@ -144,7 +144,7 @@ _nc_ospeed(int BaudRate) return (result); } -int +NCURSES_EXPORT(int) baudrate(void) { int result; diff --git a/lib/libcurses/tinfo/lib_cur_term.c b/lib/libcurses/tinfo/lib_cur_term.c index 22bdcaa77df..3fcf4abe47c 100644 --- a/lib/libcurses/tinfo/lib_cur_term.c +++ b/lib/libcurses/tinfo/lib_cur_term.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_cur_term.c,v 1.4 1999/11/28 17:49:54 millert Exp $ */ +/* $OpenBSD: lib_cur_term.c,v 1.5 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 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 * @@ -39,34 +39,36 @@ */ #include <curses.priv.h> -#include <term_entry.h> /* TTY, cur_term */ -#include <termcap.h> /* ospeed */ +#include <term_entry.h> /* TTY, cur_term */ +#include <termcap.h> /* ospeed */ -MODULE_ID("$From: lib_cur_term.c,v 1.9 1999/10/30 23:00:16 tom Exp $") +MODULE_ID("$From: lib_cur_term.c,v 1.11 2000/12/10 02:55:07 tom Exp $") -TERMINAL *cur_term = 0; +NCURSES_EXPORT_VAR(TERMINAL *) cur_term = 0; -TERMINAL *set_curterm(TERMINAL *termp) +NCURSES_EXPORT(TERMINAL *) +set_curterm(TERMINAL * termp) { - TERMINAL *oldterm = cur_term; + TERMINAL *oldterm = cur_term; - if ((cur_term = termp) != 0) { - ospeed = _nc_ospeed(cur_term->_baudrate); - PC = (pad_char != NULL) ? pad_char[0] : 0; - } - return oldterm; + if ((cur_term = termp) != 0) { + ospeed = _nc_ospeed(cur_term->_baudrate); + PC = (pad_char != NULL) ? pad_char[0] : 0; + } + return oldterm; } -int del_curterm(TERMINAL *termp) +NCURSES_EXPORT(int) +del_curterm(TERMINAL * termp) { - T((T_CALLED("del_curterm(%p)"), termp)); + T((T_CALLED("del_curterm(%p)"), termp)); - if (termp != 0) { - _nc_free_termtype(&(termp->type)); - free(termp); - if (termp == cur_term) - cur_term = 0; - returnCode(OK); - } - returnCode(ERR); + if (termp != 0) { + _nc_free_termtype(&(termp->type)); + free(termp); + if (termp == cur_term) + cur_term = 0; + returnCode(OK); + } + returnCode(ERR); } diff --git a/lib/libcurses/tinfo/lib_data.c b/lib/libcurses/tinfo/lib_data.c index f686f40b4da..cdc8044ab18 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.2 1999/01/31 20:17:10 millert Exp $ */ +/* $OpenBSD: lib_data.c,v 1.3 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 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,17 +42,20 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_data.c,v 1.14 1999/01/31 01:34:33 Ilya.Zakharevich Exp $") +MODULE_ID("$From: lib_data.c,v 1.16 2000/12/10 02:55:07 tom Exp $") /* * OS/2's native linker complains if we don't initialize public data when * constructing a dll (reported by J.J.G.Ripoll). */ -WINDOW *stdscr = 0; -WINDOW *curscr = 0; -WINDOW *newscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) +stdscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) +curscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) +newscr = 0; -SCREEN *_nc_screen_chain = 0; +NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain = 0; /* * The variable 'SP' will be defined as a function on systems that cannot link @@ -65,22 +68,26 @@ SCREEN *_nc_screen_chain = 0; * module coupling that increases the size of the executable. */ #if BROKEN_LINKER -static SCREEN *my_screen; + static SCREEN *my_screen; -SCREEN *_nc_screen(void) +NCURSES_EXPORT(SCREEN *) +_nc_screen(void) { - return my_screen; + return my_screen; } -int _nc_alloc_screen(void) +NCURSES_EXPORT(int) +_nc_alloc_screen(void) { - return ((my_screen = typeCalloc(SCREEN, 1)) != 0); + return ((my_screen = typeCalloc(SCREEN, 1)) != 0); } -void _nc_set_screen(SCREEN *sp) +NCURSES_EXPORT(void) +_nc_set_screen(SCREEN * sp) { - my_screen = sp; + my_screen = sp; } + #else -SCREEN *SP = NULL; /* Some linkers require initialized data... */ +NCURSES_EXPORT_VAR(SCREEN *) SP = NULL; /* Some linkers require initialized data... */ #endif diff --git a/lib/libcurses/tinfo/lib_has_cap.c b/lib/libcurses/tinfo/lib_has_cap.c index de5ebb5c133..d95e3f908c7 100644 --- a/lib/libcurses/tinfo/lib_has_cap.c +++ b/lib/libcurses/tinfo/lib_has_cap.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_has_cap.c,v 1.1 1999/01/18 19:10:17 millert Exp $ */ +/* $OpenBSD: lib_has_cap.c,v 1.2 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* ** lib_has_cap.c ** @@ -45,21 +44,23 @@ #include <term.h> -MODULE_ID("$From: lib_has_cap.c,v 1.1 1998/10/23 15:32:21 tom Exp $") +MODULE_ID("$From: lib_has_cap.c,v 1.3 2000/12/10 02:55:07 tom Exp $") -bool has_ic(void) +NCURSES_EXPORT(bool) +has_ic(void) { - T((T_CALLED("has_ic()"))); - returnCode(cur_term && - (insert_character || parm_ich - || (enter_insert_mode && exit_insert_mode)) - && (delete_character || parm_dch)); + T((T_CALLED("has_ic()"))); + returnCode(cur_term && + (insert_character || parm_ich + || (enter_insert_mode && exit_insert_mode)) + && (delete_character || parm_dch)); } -bool has_il(void) +NCURSES_EXPORT(bool) +has_il(void) { - T((T_CALLED("has_il()"))); - returnCode(cur_term - && (insert_line || parm_insert_line) - && (delete_line || parm_delete_line)); + T((T_CALLED("has_il()"))); + returnCode(cur_term + && (insert_line || parm_insert_line) + && (delete_line || parm_delete_line)); } diff --git a/lib/libcurses/tinfo/lib_kernel.c b/lib/libcurses/tinfo/lib_kernel.c index 16cb06afe9d..730ba1551fd 100644 --- a/lib/libcurses/tinfo/lib_kernel.c +++ b/lib/libcurses/tinfo/lib_kernel.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_kernel.c,v 1.1 1999/01/18 19:10:17 millert Exp $ */ +/* $OpenBSD: lib_kernel.c,v 1.2 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* * lib_kernel.c * @@ -48,9 +47,9 @@ */ #include <curses.priv.h> -#include <term.h> /* cur_term */ +#include <term.h> /* cur_term */ -MODULE_ID("$From: lib_kernel.c,v 1.19 1998/12/20 00:18:45 tom Exp $") +MODULE_ID("$From: lib_kernel.c,v 1.21 2000/12/10 02:55:07 tom Exp $") /* * erasechar() @@ -59,23 +58,21 @@ MODULE_ID("$From: lib_kernel.c,v 1.19 1998/12/20 00:18:45 tom Exp $") * */ -char +NCURSES_EXPORT(char) erasechar(void) { - T((T_CALLED("erasechar()"))); + T((T_CALLED("erasechar()"))); - if (cur_term != 0) { + if (cur_term != 0) { #ifdef TERMIOS - returnCode(cur_term->Ottyb.c_cc[VERASE]); + returnCode(cur_term->Ottyb.c_cc[VERASE]); #else - returnCode(cur_term->Ottyb.sg_erase); + returnCode(cur_term->Ottyb.sg_erase); #endif - } - returnCode(ERR); + } + returnCode(ERR); } - - /* * killchar() * @@ -83,23 +80,21 @@ erasechar(void) * */ -char +NCURSES_EXPORT(char) killchar(void) { - T((T_CALLED("killchar()"))); + T((T_CALLED("killchar()"))); - if (cur_term != 0) { + if (cur_term != 0) { #ifdef TERMIOS - returnCode(cur_term->Ottyb.c_cc[VKILL]); + returnCode(cur_term->Ottyb.c_cc[VKILL]); #else - returnCode(cur_term->Ottyb.sg_kill); + returnCode(cur_term->Ottyb.sg_kill); #endif - } - returnCode(ERR); + } + returnCode(ERR); } - - /* * flushinp() * @@ -107,26 +102,27 @@ killchar(void) * */ -int flushinp(void) +NCURSES_EXPORT(int) +flushinp(void) { - T((T_CALLED("flushinp()"))); + T((T_CALLED("flushinp()"))); - if (cur_term != 0) { + if (cur_term != 0) { #ifdef TERMIOS - tcflush(cur_term->Filedes, TCIFLUSH); + tcflush(cur_term->Filedes, TCIFLUSH); #else - errno = 0; - do { - ioctl(cur_term->Filedes, TIOCFLUSH, 0); - } while - (errno == EINTR); + errno = 0; + do { + ioctl(cur_term->Filedes, TIOCFLUSH, 0); + } while + (errno == EINTR); #endif - if (SP) { - SP->_fifohead = -1; - SP->_fifotail = 0; - SP->_fifopeek = 0; - } - returnCode(OK); + if (SP) { + SP->_fifohead = -1; + SP->_fifotail = 0; + SP->_fifopeek = 0; } - returnCode(ERR); + returnCode(OK); + } + returnCode(ERR); } diff --git a/lib/libcurses/tinfo/lib_longname.c b/lib/libcurses/tinfo/lib_longname.c index 558453a69bb..9cbbf5fcbf5 100644 --- a/lib/libcurses/tinfo/lib_longname.c +++ b/lib/libcurses/tinfo/lib_longname.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_longname.c,v 1.1 1999/01/18 19:10:18 millert Exp $ */ +/* $OpenBSD: lib_longname.c,v 1.2 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /* ** lib_longname.c ** @@ -43,18 +42,18 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_longname.c,v 1.7 1999/01/03 01:47:45 tom Exp $") +MODULE_ID("$From: lib_longname.c,v 1.9 2000/12/10 02:55:07 tom Exp $") -char * +NCURSES_EXPORT(char *) longname(void) { -char *ptr; + char *ptr; - T((T_CALLED("longname()"))); + T((T_CALLED("longname()"))); - for (ptr = ttytype + strlen(ttytype); ptr > ttytype; ptr--) - if (*ptr == '|') - returnPtr(ptr + 1); + for (ptr = ttytype + strlen(ttytype); ptr > ttytype; ptr--) + if (*ptr == '|') + returnPtr(ptr + 1); - returnPtr(ttytype); + returnPtr(ttytype); } diff --git a/lib/libcurses/tinfo/lib_napms.c b/lib/libcurses/tinfo/lib_napms.c index de4f97efce7..bf29ef488f5 100644 --- a/lib/libcurses/tinfo/lib_napms.c +++ b/lib/libcurses/tinfo/lib_napms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_napms.c,v 1.6 2000/06/19 03:53:50 millert Exp $ */ +/* $OpenBSD: lib_napms.c,v 1.7 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -60,9 +60,9 @@ #endif #endif -MODULE_ID("$From: lib_napms.c,v 1.9 2000/04/29 23:42:56 tom Exp $") +MODULE_ID("$From: lib_napms.c,v 1.11 2000/12/10 02:55:07 tom Exp $") -int +NCURSES_EXPORT(int) napms(int ms) { T((T_CALLED("napms(%d)"), ms)); diff --git a/lib/libcurses/tinfo/lib_options.c b/lib/libcurses/tinfo/lib_options.c index ad42bf8b41f..ca96bc3d7db 100644 --- a/lib/libcurses/tinfo/lib_options.c +++ b/lib/libcurses/tinfo/lib_options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_options.c,v 1.8 2000/10/08 22:47:01 millert Exp $ */ +/* $OpenBSD: lib_options.c,v 1.9 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -44,9 +44,9 @@ #include <term.h> -MODULE_ID("$From: lib_options.c,v 1.40 2000/09/02 18:02:05 tom Exp $") +MODULE_ID("$From: lib_options.c,v 1.42 2000/12/10 02:55:07 tom Exp $") -int +NCURSES_EXPORT(int) idlok(WINDOW *win, bool flag) { T((T_CALLED("idlok(%p,%d)"), win, flag)); @@ -58,7 +58,7 @@ idlok(WINDOW *win, bool flag) returnCode(ERR); } -void +NCURSES_EXPORT(void) idcok(WINDOW *win, bool flag) { T((T_CALLED("idcok(%p,%d)"), win, flag)); @@ -69,7 +69,7 @@ idcok(WINDOW *win, bool flag) returnVoid; } -int +NCURSES_EXPORT(int) halfdelay(int t) { T((T_CALLED("halfdelay(%d)"), t)); @@ -82,7 +82,7 @@ halfdelay(int t) returnCode(OK); } -int +NCURSES_EXPORT(int) nodelay(WINDOW *win, bool flag) { T((T_CALLED("nodelay(%p,%d)"), win, flag)); @@ -97,7 +97,7 @@ nodelay(WINDOW *win, bool flag) returnCode(ERR); } -int +NCURSES_EXPORT(int) notimeout(WINDOW *win, bool f) { T((T_CALLED("notimout(%p,%d)"), win, f)); @@ -109,7 +109,7 @@ notimeout(WINDOW *win, bool f) returnCode(ERR); } -void +NCURSES_EXPORT(void) wtimeout(WINDOW *win, int delay) { T((T_CALLED("wtimeout(%p,%d)"), win, delay)); @@ -119,7 +119,7 @@ wtimeout(WINDOW *win, int delay) } } -int +NCURSES_EXPORT(int) keypad(WINDOW *win, bool flag) { T((T_CALLED("keypad(%p,%d)"), win, flag)); @@ -131,7 +131,7 @@ keypad(WINDOW *win, bool flag) returnCode(ERR); } -int +NCURSES_EXPORT(int) meta(WINDOW *win GCC_UNUSED, bool flag) { /* Ok, we stay relaxed and don't signal an error if win is NULL */ @@ -151,7 +151,7 @@ meta(WINDOW *win GCC_UNUSED, bool flag) /* curs_set() moved here to narrow the kernel interface */ -int +NCURSES_EXPORT(int) curs_set(int vis) { int cursor = SP->_cursor; @@ -193,7 +193,7 @@ curs_set(int vis) returnCode(cursor == -1 ? 1 : cursor); } -int +NCURSES_EXPORT(int) typeahead(int fd) { T((T_CALLED("typeahead(%d)"), fd)); @@ -218,10 +218,10 @@ has_key_internal(int keycode, struct tries *tp) return (TRUE); else return (has_key_internal(keycode, tp->child) - || has_key_internal(keycode, tp->sibling)); + || has_key_internal(keycode, tp->sibling)); } -int +NCURSES_EXPORT(int) has_key(int keycode) { T((T_CALLED("has_key(%d)"), keycode)); @@ -236,7 +236,7 @@ has_key(int keycode) * flush, then the next wgetch may get the escape sequence that corresponds to * the terminal state _before_ switching modes. */ -int +NCURSES_EXPORT(int) _nc_keypad(bool flag) { if (flag && keypad_xmit) { diff --git a/lib/libcurses/tinfo/lib_print.c b/lib/libcurses/tinfo/lib_print.c index a42bccf6f21..0bb6b5a4c6b 100644 --- a/lib/libcurses/tinfo/lib_print.c +++ b/lib/libcurses/tinfo/lib_print.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_print.c,v 1.2 1999/03/02 06:23:28 millert Exp $ */ +/* $OpenBSD: lib_print.c,v 1.3 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,49 +33,44 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: lib_print.c,v 1.11 1999/02/27 19:59:05 tom Exp $") +MODULE_ID("$From: lib_print.c,v 1.13 2000/12/10 02:55:07 tom Exp $") -int mcprint(char *data, int len) +NCURSES_EXPORT(int) +mcprint(char *data, int len) /* ship binary character data to the printer via mc4/mc5/mc5p */ { - char *mybuf, *switchon; - size_t onsize, offsize, res; + char *mybuf, *switchon; + size_t onsize, offsize, res; errno = 0; - if (!cur_term || (!prtr_non && (!prtr_on || !prtr_off))) - { + if (!cur_term || (!prtr_non && (!prtr_on || !prtr_off))) { errno = ENODEV; - return(ERR); + return (ERR); } - if (prtr_non) - { + if (prtr_non) { switchon = tparm(prtr_non, len); onsize = strlen(switchon); offsize = 0; - } - else - { + } else { switchon = prtr_on; onsize = strlen(prtr_on); offsize = strlen(prtr_off); } - if ((mybuf = typeMalloc(char, onsize + len + offsize + 1)) == (char *)0) - { + if ((mybuf = typeMalloc(char, onsize + len + offsize + 1)) == (char *) 0) { errno = ENOMEM; - return(ERR); + return (ERR); } (void) strcpy(mybuf, switchon); memcpy(mybuf + onsize, data, len); if (offsize) - (void) strcpy(mybuf + onsize + len, prtr_off); + (void) strcpy(mybuf + onsize + len, prtr_off); /* * We're relying on the atomicity of UNIX writes here. The @@ -94,5 +89,5 @@ int mcprint(char *data, int len) (void) sleep(0); free(mybuf); - return(res); + return (res); } diff --git a/lib/libcurses/tinfo/lib_raw.c b/lib/libcurses/tinfo/lib_raw.c index be87b5a3049..eb10b64e30b 100644 --- a/lib/libcurses/tinfo/lib_raw.c +++ b/lib/libcurses/tinfo/lib_raw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_raw.c,v 1.6 2000/10/08 22:47:01 millert Exp $ */ +/* $OpenBSD: lib_raw.c,v 1.7 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -50,7 +50,7 @@ #include <curses.priv.h> #include <term.h> /* cur_term */ -MODULE_ID("$From: lib_raw.c,v 1.8 2000/09/02 18:08:48 tom Exp $") +MODULE_ID("$From: lib_raw.c,v 1.10 2000/12/10 02:55:07 tom Exp $") #if SVR4_TERMIO && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE @@ -74,7 +74,7 @@ MODULE_ID("$From: lib_raw.c,v 1.8 2000/09/02 18:08:48 tom Exp $") #define AFTER(s) #endif /* TRACE */ -int +NCURSES_EXPORT(int) raw(void) { T((T_CALLED("raw()"))); @@ -102,7 +102,7 @@ raw(void) returnCode(ERR); } -int +NCURSES_EXPORT(int) cbreak(void) { T((T_CALLED("cbreak()"))); @@ -127,7 +127,7 @@ cbreak(void) returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); } -void +NCURSES_EXPORT(void) qiflush(void) { T((T_CALLED("qiflush()"))); @@ -146,7 +146,7 @@ qiflush(void) #endif } -int +NCURSES_EXPORT(int) noraw(void) { T((T_CALLED("noraw()"))); @@ -170,7 +170,7 @@ noraw(void) returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); } -int +NCURSES_EXPORT(int) nocbreak(void) { T((T_CALLED("nocbreak()"))); @@ -192,7 +192,7 @@ nocbreak(void) returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); } -void +NCURSES_EXPORT(void) noqiflush(void) { T((T_CALLED("noqiflush()"))); @@ -211,7 +211,7 @@ noqiflush(void) #endif } -int +NCURSES_EXPORT(int) intrflush(WINDOW *win GCC_UNUSED, bool flag) { T((T_CALLED("intrflush(%d)"), flag)); diff --git a/lib/libcurses/tinfo/lib_setup.c b/lib/libcurses/tinfo/lib_setup.c index 77003ad61ab..1db8a06bc1b 100644 --- a/lib/libcurses/tinfo/lib_setup.c +++ b/lib/libcurses/tinfo/lib_setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_setup.c,v 1.10 2000/10/08 22:47:01 millert Exp $ */ +/* $OpenBSD: lib_setup.c,v 1.11 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -50,7 +50,7 @@ #include <term.h> /* lines, columns, cur_term */ -MODULE_ID("$From: lib_setup.c,v 1.60 2000/09/02 18:13:12 tom Exp $") +MODULE_ID("$From: lib_setup.c,v 1.64 2000/12/10 02:55:07 tom Exp $") /**************************************************************************** * @@ -96,16 +96,21 @@ static int _use_env = TRUE; static void do_prototype(void); -void +NCURSES_EXPORT(void) use_env(bool f) { _use_env = f; } -int LINES = 0, COLS = 0, TABSIZE = 0; +NCURSES_EXPORT_VAR(int) +LINES = 0; +NCURSES_EXPORT_VAR(int) +COLS = 0; +NCURSES_EXPORT_VAR(int) +TABSIZE = 0; -static void -_nc_get_screensize(int *linep, int *colp) + static void + _nc_get_screensize(int *linep, int *colp) /* Obtain lines/columns values from the environment and/or terminfo entry */ { /* figure out the size of the screen */ @@ -135,7 +140,7 @@ _nc_get_screensize(int *linep, int *colp) *colp = screendata[0]; *linep = screendata[1]; T(("EMX screen size: environment LINES = %d COLUMNS = %d", - *linep, *colp)); + *linep, *colp)); } #endif #if HAVE_SIZECHANGE @@ -167,11 +172,12 @@ _nc_get_screensize(int *linep, int *colp) #endif /* HAVE_SIZECHANGE */ /* if we can't get dynamic info about the size, use static */ - if (*linep <= 0 || *colp <= 0) - if (lines > 0 && columns > 0) { - *linep = (int) lines; - *colp = (int) columns; - } + if (*linep <= 0) { + *linep = (int) lines; + } + if (*colp <= 0) { + *colp = (int) columns; + } /* the ultimate fallback, assume fixed 24x80 size */ if (*linep <= 0 || *colp <= 0) { @@ -198,7 +204,7 @@ _nc_get_screensize(int *linep, int *colp) } #if USE_SIZECHANGE -void +NCURSES_EXPORT(void) _nc_update_screensize(void) { int my_lines, my_cols; @@ -267,18 +273,20 @@ grab_entry(const char *const tn, TERMTYPE * const tp) */ if (status == 1) { int n; - for_each_boolean(n, tp) + for_each_boolean(n, tp) { if (!VALID_BOOLEAN(tp->Booleans[n])) - tp->Booleans[n] = FALSE; - for_each_string(n, tp) + tp->Booleans[n] = FALSE; + } + for_each_string(n, tp) { if (tp->Strings[n] == CANCELLED_STRING) - tp->Strings[n] = ABSENT_STRING; + tp->Strings[n] = ABSENT_STRING; + } } return (status); } #endif -char ttytype[NAMESIZE] = ""; +NCURSES_EXPORT_VAR(char) ttytype[NAMESIZE] = ""; /* * setupterm(termname, Filedes, errret) @@ -288,8 +296,9 @@ char ttytype[NAMESIZE] = ""; * */ -int -setupterm(NCURSES_CONST char *tname, int Filedes, int *errret) +NCURSES_EXPORT(int) +setupterm +(NCURSES_CONST char *tname, int Filedes, int *errret) { struct term *term_ptr; int status; @@ -304,7 +313,7 @@ setupterm(NCURSES_CONST char *tname, int Filedes, int *errret) } if (strlen(tname) > MAX_NAME_SIZE) { ret_error(-1, "TERM environment must be <= %d characters.\n", - MAX_NAME_SIZE); + MAX_NAME_SIZE); } T(("your terminal name is %s", tname)); diff --git a/lib/libcurses/tinfo/lib_termcap.c b/lib/libcurses/tinfo/lib_termcap.c index 3c3e11afc6b..94173a7a576 100644 --- a/lib/libcurses/tinfo/lib_termcap.c +++ b/lib/libcurses/tinfo/lib_termcap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_termcap.c,v 1.7 2000/10/08 22:47:02 millert Exp $ */ +/* $OpenBSD: lib_termcap.c,v 1.8 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -41,15 +41,17 @@ #define __INTERNAL_CAPS_VISIBLE #include <term_entry.h> -MODULE_ID("$From: lib_termcap.c,v 1.37 2000/09/16 20:30:16 tom Exp $") +MODULE_ID("$From: lib_termcap.c,v 1.39 2000/12/10 02:56:30 tom Exp $") /* some of the code in here was contributed by: Magnus Bengtsson, d6mbeng@dtek.chalmers.se */ -char *UP = 0; -char *BC = 0; +NCURSES_EXPORT_VAR(char *) +UP = 0; +NCURSES_EXPORT_VAR(char *) +BC = 0; /*************************************************************************** * @@ -66,8 +68,9 @@ char *BC = 0; * ***************************************************************************/ -int -tgetent(char *bufp GCC_UNUSED, const char *name) +NCURSES_EXPORT(int) +tgetent +(char *bufp GCC_UNUSED, const char *name) { int errcode; @@ -110,7 +113,7 @@ tgetent(char *bufp GCC_UNUSED, const char *name) * ***************************************************************************/ -int +NCURSES_EXPORT(int) tgetflag(NCURSES_CONST char *id) { int i; @@ -138,7 +141,7 @@ tgetflag(NCURSES_CONST char *id) * ***************************************************************************/ -int +NCURSES_EXPORT(int) tgetnum(NCURSES_CONST char *id) { int i; @@ -167,8 +170,9 @@ tgetnum(NCURSES_CONST char *id) * ***************************************************************************/ -char * -tgetstr(NCURSES_CONST char *id, char **area) +NCURSES_EXPORT(char *) +tgetstr +(NCURSES_CONST char *id, char **area) { int i; @@ -178,7 +182,7 @@ tgetstr(NCURSES_CONST char *id, char **area) for_each_string(i, tp) { const char *capname = ExtStrname(tp, i, strcodes); if (!strncmp(id, capname, 2)) { - TR(TRACE_DATABASE,("found match : %s", _nc_visbuf(tp->Strings[i]))); + TR(TRACE_DATABASE, ("found match : %s", _nc_visbuf(tp->Strings[i]))); /* setupterm forces canceled strings to null */ if (area != 0 && *area != 0 diff --git a/lib/libcurses/tinfo/lib_termname.c b/lib/libcurses/tinfo/lib_termname.c index ad6353e01e9..f063c300fb8 100644 --- a/lib/libcurses/tinfo/lib_termname.c +++ b/lib/libcurses/tinfo/lib_termname.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_termname.c,v 1.2 1999/08/15 11:40:55 millert Exp $ */ +/* $OpenBSD: lib_termname.c,v 1.3 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,20 +29,22 @@ ****************************************************************************/ #include <curses.priv.h> -#include <tic.h> /* for MAX_ALIAS */ +#include <tic.h> /* for MAX_ALIAS */ -MODULE_ID("$From: lib_termname.c,v 1.2 1999/07/24 21:02:40 tom Exp $") +MODULE_ID("$From: lib_termname.c,v 1.6 2000/12/10 02:55:08 tom Exp $") -char *termname(void) +NCURSES_EXPORT(char *) +termname(void) { -char *name = getenv("TERM"); -static char ret[MAX_ALIAS+1]; + char *name = getenv("TERM"); + static char ret[MAX_ALIAS + 1]; - T(("termname() called")); + T(("termname() called")); - if (name != 0) { - (void) strncpy(ret, name, sizeof(ret) - 1); - name = ret; - } - return name; + if (name != 0) { + ret[0] = '\0'; + (void) strncat(ret, name, sizeof(ret) - 1); + name = ret; + } + return name; } diff --git a/lib/libcurses/tinfo/lib_tgoto.c b/lib/libcurses/tinfo/lib_tgoto.c index b305935cdee..c54cb39443c 100644 --- a/lib/libcurses/tinfo/lib_tgoto.c +++ b/lib/libcurses/tinfo/lib_tgoto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_tgoto.c,v 1.1 2000/10/08 22:47:02 millert Exp $ */ +/* $OpenBSD: lib_tgoto.c,v 1.2 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** * Copyright (c) 2000 Free Software Foundation, Inc. * @@ -37,7 +37,7 @@ #include <ctype.h> #include <termcap.h> -MODULE_ID("$From: lib_tgoto.c,v 1.2 2000/09/24 00:19:14 tom Exp $") +MODULE_ID("$From: lib_tgoto.c,v 1.5 2000/12/10 01:33:16 tom Exp $") #if !PURE_TERMINFO static bool @@ -45,20 +45,24 @@ is_termcap(const char *string) { bool result = TRUE; - while ((*string != '\0') && result) { - if (*string == '%') { - switch (*++string) { - case 'p': + if (string == 0 || *string == '\0') { + result = FALSE; /* tparm() handles empty strings */ + } else { + while ((*string != '\0') && result) { + if (*string == '%') { + switch (*++string) { + case 'p': + result = FALSE; + break; + case '\0': + string--; + break; + } + } else if (string[0] == '$' && string[1] == '<') { result = FALSE; - break; - case '\0': - string--; - break; } - } else if (string[0] == '$' && string[1] == '<') { - result = FALSE; + string++; } - string++; } return result; } @@ -110,7 +114,7 @@ tgoto_internal(const char *string, int x, int y) *value %= 1000; break; case '+': - *value += (*++string & 0xff); + *value += CharOf(*++string); /* FALLTHRU */ case '.': /* @@ -183,8 +187,9 @@ tgoto_internal(const char *string, int x, int y) * Retained solely for upward compatibility. Note the intentional reversing of * the last two arguments when invoking tparm(). */ -char * -tgoto(const char *string, int x, int y) +NCURSES_EXPORT(char *) +tgoto +(const char *string, int x, int y) { char *result; diff --git a/lib/libcurses/tinfo/lib_ti.c b/lib/libcurses/tinfo/lib_ti.c index df4b8a3a5a2..3c1595aef0c 100644 --- a/lib/libcurses/tinfo/lib_ti.c +++ b/lib/libcurses/tinfo/lib_ti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_ti.c,v 1.5 2000/03/10 01:35:04 millert Exp $ */ +/* $OpenBSD: lib_ti.c,v 1.6 2001/01/22 18:01:54 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -38,9 +38,9 @@ #include <term_entry.h> #include <tic.h> -MODULE_ID("$From: lib_ti.c,v 1.20 2000/02/13 01:01:26 tom Exp $") +MODULE_ID("$From: lib_ti.c,v 1.22 2000/12/10 02:55:08 tom Exp $") -int +NCURSES_EXPORT(int) tigetflag(NCURSES_CONST char *str) { int i; @@ -61,7 +61,7 @@ tigetflag(NCURSES_CONST char *str) returnCode(ABSENT_BOOLEAN); } -int +NCURSES_EXPORT(int) tigetnum(NCURSES_CONST char *str) { int i; @@ -83,7 +83,7 @@ tigetnum(NCURSES_CONST char *str) returnCode(CANCELLED_NUMERIC); /* Solaris returns a -1 instead */ } -char * +NCURSES_EXPORT(char *) tigetstr(NCURSES_CONST char *str) { int i; diff --git a/lib/libcurses/tinfo/lib_tparm.c b/lib/libcurses/tinfo/lib_tparm.c index 536301ca9c4..e5c496dd1c3 100644 --- a/lib/libcurses/tinfo/lib_tparm.c +++ b/lib/libcurses/tinfo/lib_tparm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_tparm.c,v 1.6 2000/10/22 18:27:23 millert Exp $ */ +/* $OpenBSD: lib_tparm.c,v 1.7 2001/01/22 18:01:54 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -44,7 +44,7 @@ #include <term.h> #include <tic.h> -MODULE_ID("$From: lib_tparm.c,v 1.48 2000/10/14 17:45:00 Sergei.Ivanov Exp $") +MODULE_ID("$From: lib_tparm.c,v 1.51 2000/12/10 02:55:08 tom Exp $") /* * char * @@ -128,7 +128,7 @@ static size_t out_size; static size_t out_used; #if NO_LEAKS -void +NCURSES_EXPORT(void) _nc_free_tparm(void) { if (out_buff != 0) { @@ -288,7 +288,7 @@ parse_format(const char *s, char *format, int *len) } break; default: - if (isdigit(*s)) { + if (isdigit(CharOf(*s))) { value = (value * 10) + (*s - '0'); if (value > 10000) err = TRUE; @@ -726,8 +726,9 @@ tparam_internal(const char *string, va_list ap) return (out_buff); } -char * -tparm(NCURSES_CONST char *string,...) +NCURSES_EXPORT(char *) +tparm +(NCURSES_CONST char *string,...) { va_list ap; char *result; diff --git a/lib/libcurses/tinfo/lib_tputs.c b/lib/libcurses/tinfo/lib_tputs.c index 6084d441902..fb20e9dc782 100644 --- a/lib/libcurses/tinfo/lib_tputs.c +++ b/lib/libcurses/tinfo/lib_tputs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_tputs.c,v 1.8 2000/10/08 22:47:02 millert Exp $ */ +/* $OpenBSD: lib_tputs.c,v 1.9 2001/01/22 18:01:54 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -47,16 +47,18 @@ #include <termcap.h> /* ospeed */ #include <tic.h> -MODULE_ID("$From: lib_tputs.c,v 1.51 2000/10/08 00:22:24 tom Exp $") +MODULE_ID("$From: lib_tputs.c,v 1.55 2000/12/10 02:55:08 tom Exp $"); -char PC = 0; /* used by termcap library */ -short ospeed = 0; /* used by termcap library */ +NCURSES_EXPORT_VAR(char) +PC = 0; /* used by termcap library */ +NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ -int _nc_nulls_sent = 0; /* used by 'tack' program */ +NCURSES_EXPORT_VAR(int) +_nc_nulls_sent = 0; /* used by 'tack' program */ -static int (*my_outch) (int c) = _nc_outch; + static int (*my_outch) (int c) = _nc_outch; -int +NCURSES_EXPORT(int) delay_output(int ms) { T((T_CALLED("delay_output(%d)"), ms)); @@ -77,13 +79,13 @@ delay_output(int ms) returnCode(OK); } -void +NCURSES_EXPORT(void) _nc_flush(void) { (void) fflush(NC_OUTPUT); } -int +NCURSES_EXPORT(int) _nc_outch(int ch) { #ifdef TRACE @@ -111,7 +113,7 @@ _nc_outch(int ch) * No surrogates supported (we're storing only one 16-bit Unicode value per * cell). */ -int +NCURSES_EXPORT(int) _nc_utf8_outch(int ch) { static const unsigned byteMask = 0xBF; @@ -170,14 +172,15 @@ _nc_utf8_outch(int ch) } #endif -int +NCURSES_EXPORT(int) putp(const char *string) { return tputs(string, 1, _nc_outch); } -int -tputs(const char *string, int affcnt, int (*outc) (int)) +NCURSES_EXPORT(int) +tputs +(const char *string, int affcnt, int (*outc) (int)) { bool always_delay; bool normal_delay; @@ -264,25 +267,26 @@ tputs(const char *string, int affcnt, int (*outc) (int)) bool mandatory; string++; - if ((!isdigit(*string) && *string != '.') || !strchr(string, '>')) { + if ((!isdigit(CharOf(*string)) && *string != '.') + || !strchr(string, '>')) { (*outc) ('$'); (*outc) ('<'); continue; } number = 0; - while (isdigit(*string)) { + while (isdigit(CharOf(*string))) { number = number * 10 + (*string - '0'); string++; } number *= 10; if (*string == '.') { string++; - if (isdigit(*string)) { + if (isdigit(CharOf(*string))) { number += (*string - '0'); string++; } - while (isdigit(*string)) + while (isdigit(CharOf(*string))) string++; } diff --git a/lib/libcurses/tinfo/lib_ttyflags.c b/lib/libcurses/tinfo/lib_ttyflags.c index 9a4825e8384..615e0092564 100644 --- a/lib/libcurses/tinfo/lib_ttyflags.c +++ b/lib/libcurses/tinfo/lib_ttyflags.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_ttyflags.c,v 1.3 1999/11/28 17:49:54 millert Exp $ */ +/* $OpenBSD: lib_ttyflags.c,v 1.4 2001/01/22 18:01:54 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,9 +38,9 @@ */ #include <curses.priv.h> -#include <term.h> /* cur_term */ +#include <term.h> /* cur_term */ -MODULE_ID("$From: lib_ttyflags.c,v 1.3 1999/10/22 21:38:55 tom Exp $") +MODULE_ID("$From: lib_ttyflags.c,v 1.5 2000/12/10 02:55:08 tom Exp $") #undef tabs @@ -58,89 +58,94 @@ MODULE_ID("$From: lib_ttyflags.c,v 1.3 1999/10/22 21:38:55 tom Exp $") # endif #endif -int _nc_get_tty_mode(TTY *buf) +NCURSES_EXPORT(int) +_nc_get_tty_mode(TTY * buf) { - if (cur_term == 0 - || GET_TTY(cur_term->Filedes, buf) != 0) - return(ERR); - TR(TRACE_BITS,("_nc_get_tty_mode: %s", _nc_tracebits())); - return (OK); + if (cur_term == 0 + || GET_TTY(cur_term->Filedes, buf) != 0) + return (ERR); + TR(TRACE_BITS, ("_nc_get_tty_mode: %s", _nc_tracebits())); + return (OK); } -int _nc_set_tty_mode(TTY *buf) +NCURSES_EXPORT(int) +_nc_set_tty_mode(TTY * buf) { - if (cur_term == 0 - || SET_TTY(cur_term->Filedes, buf) != 0) - return(ERR); - TR(TRACE_BITS,("_nc_set_tty_mode: %s", _nc_tracebits())); - return (OK); + if (cur_term == 0 + || SET_TTY(cur_term->Filedes, buf) != 0) + return (ERR); + TR(TRACE_BITS, ("_nc_set_tty_mode: %s", _nc_tracebits())); + return (OK); } -int def_shell_mode(void) +NCURSES_EXPORT(int) +def_shell_mode(void) { - T((T_CALLED("def_shell_mode()"))); + T((T_CALLED("def_shell_mode()"))); - /* - * Turn off the XTABS bit in the tty structure if it was on. If XTABS - * was on, remove the tab and backtab capabilities. - */ + /* + * Turn off the XTABS bit in the tty structure if it was on. If XTABS + * was on, remove the tab and backtab capabilities. + */ - if (_nc_get_tty_mode(&cur_term->Ottyb) != OK) - returnCode(ERR); + if (_nc_get_tty_mode(&cur_term->Ottyb) != OK) + returnCode(ERR); #ifdef TERMIOS - if (cur_term->Ottyb.c_oflag & tabs) - tab = back_tab = NULL; + if (cur_term->Ottyb.c_oflag & tabs) + tab = back_tab = NULL; #else - if (cur_term->Ottyb.sg_flags & XTABS) - tab = back_tab = NULL; + if (cur_term->Ottyb.sg_flags & XTABS) + tab = back_tab = NULL; #endif - returnCode(OK); + returnCode(OK); } -int def_prog_mode(void) +NCURSES_EXPORT(int) +def_prog_mode(void) { - T((T_CALLED("def_prog_mode()"))); + T((T_CALLED("def_prog_mode()"))); - if (_nc_get_tty_mode(&cur_term->Nttyb) != OK) - returnCode(ERR); + if (_nc_get_tty_mode(&cur_term->Nttyb) != OK) + returnCode(ERR); #ifdef TERMIOS - cur_term->Nttyb.c_oflag &= ~tabs; + cur_term->Nttyb.c_oflag &= ~tabs; #else - cur_term->Nttyb.sg_flags &= ~XTABS; + cur_term->Nttyb.sg_flags &= ~XTABS; #endif - returnCode(OK); + returnCode(OK); } -int reset_prog_mode(void) +NCURSES_EXPORT(int) +reset_prog_mode(void) { - T((T_CALLED("reset_prog_mode()"))); - - if (cur_term != 0) { - _nc_set_tty_mode(&cur_term->Nttyb); - if (SP) { - if (stdscr && stdscr->_use_keypad) - _nc_keypad(TRUE); - NC_BUFFERED(TRUE); - } - returnCode(OK); + T((T_CALLED("reset_prog_mode()"))); + + if (cur_term != 0) { + _nc_set_tty_mode(&cur_term->Nttyb); + if (SP) { + if (stdscr && stdscr->_use_keypad) + _nc_keypad(TRUE); + NC_BUFFERED(TRUE); } - returnCode(ERR); + returnCode(OK); + } + returnCode(ERR); } -int reset_shell_mode(void) +NCURSES_EXPORT(int) +reset_shell_mode(void) { - T((T_CALLED("reset_shell_mode()"))); - - if (cur_term != 0) { - if (SP) - { - _nc_keypad(FALSE); - _nc_flush(); - NC_BUFFERED(FALSE); - } - returnCode(_nc_set_tty_mode(&cur_term->Ottyb)); + T((T_CALLED("reset_shell_mode()"))); + + if (cur_term != 0) { + if (SP) { + _nc_keypad(FALSE); + _nc_flush(); + NC_BUFFERED(FALSE); } - returnCode(ERR); + returnCode(_nc_set_tty_mode(&cur_term->Ottyb)); + } + returnCode(ERR); } /* @@ -148,18 +153,20 @@ int reset_shell_mode(void) ** */ -static TTY buf; +static TTY buf; -int savetty(void) +NCURSES_EXPORT(int) +savetty(void) { - T((T_CALLED("savetty()"))); + T((T_CALLED("savetty()"))); - returnCode(_nc_get_tty_mode(&buf)); + returnCode(_nc_get_tty_mode(&buf)); } -int resetty(void) +NCURSES_EXPORT(int) +resetty(void) { - T((T_CALLED("resetty()"))); + T((T_CALLED("resetty()"))); - returnCode(_nc_set_tty_mode(&buf)); + returnCode(_nc_set_tty_mode(&buf)); } diff --git a/lib/libcurses/tinfo/make_keys.c b/lib/libcurses/tinfo/make_keys.c index 1f36655815a..d04a9a71608 100644 --- a/lib/libcurses/tinfo/make_keys.c +++ b/lib/libcurses/tinfo/make_keys.c @@ -1,7 +1,7 @@ -/* $OpenBSD: make_keys.c,v 1.6 2000/03/13 23:53:40 millert Exp $ */ +/* $OpenBSD: make_keys.c,v 1.7 2001/01/22 18:01:54 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -39,98 +39,104 @@ */ #include <curses.priv.h> -MODULE_ID("$From: make_keys.c,v 1.8 2000/03/12 02:55:50 Todd.C.Miller Exp $") +MODULE_ID("$From: make_keys.c,v 1.10 2000/12/10 02:55:08 tom Exp $") #include <names.c> #define UNKNOWN (SIZEOF(strnames) + SIZEOF(strfnames)) -static size_t lookup(const char *name) +static size_t +lookup(const char *name) { - size_t n; - bool found = FALSE; - for (n = 0; strnames[n] != 0; n++) { - if (!strcmp(name, strnames[n])) { - found = TRUE; - break; - } + size_t n; + bool found = FALSE; + for (n = 0; strnames[n] != 0; n++) { + if (!strcmp(name, strnames[n])) { + found = TRUE; + break; } - if (!found) { - for (n = 0; strfnames[n] != 0; n++) { - if (!strcmp(name, strfnames[n])) { - found = TRUE; - break; - } - } + } + if (!found) { + for (n = 0; strfnames[n] != 0; n++) { + if (!strcmp(name, strfnames[n])) { + found = TRUE; + break; + } } - return found ? n : UNKNOWN; + } + return found ? n : UNKNOWN; } -static void make_keys(FILE *ifp, FILE *ofp) +static void +make_keys(FILE * ifp, FILE * ofp) { - char buffer[BUFSIZ]; - char from[BUFSIZ]; - char to[BUFSIZ]; - int maxlen = 16; + char buffer[BUFSIZ]; + char from[BUFSIZ]; + char to[BUFSIZ]; + int maxlen = 16; - while (fgets(buffer, sizeof(buffer), ifp) != 0) { - if (*buffer == '#') - continue; - if (sscanf(buffer, "%s %s", to, from) == 2) { - int code = lookup(from); - if (code == UNKNOWN) - continue; - if ((int)strlen(from) > maxlen) - maxlen = strlen(from); - fprintf(ofp, "\t{ %4d, %-*.*s },\t/* %s */\n", - code, - maxlen, maxlen, - to, - from); - } + while (fgets(buffer, sizeof(buffer), ifp) != 0) { + if (*buffer == '#') + continue; + if (sscanf(buffer, "%s %s", to, from) == 2) { + int code = lookup(from); + if (code == UNKNOWN) + continue; + if ((int) strlen(from) > maxlen) + maxlen = strlen(from); + fprintf(ofp, "\t{ %4d, %-*.*s },\t/* %s */\n", + code, + maxlen, maxlen, + to, + from); } + } } -static void write_list(FILE *ofp, const char **list) +static void +write_list(FILE * ofp, const char **list) { - while (*list != 0) - fprintf(ofp, "%s\n", *list++); + while (*list != 0) + fprintf(ofp, "%s\n", *list++); } -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { - static const char *prefix[] = { - "#ifndef NCU_KEYS_H", - "#define NCU_KEYS_H 1", - "", - "/* This file was generated by MAKE_KEYS */", - "", - "#if BROKEN_LINKER", - "static", - "#endif", - "struct tinfo_fkeys _nc_tinfo_fkeys[] = {", - 0 - }; - static const char *suffix[] = { - "\t{ 0, 0} };", - "", - "#endif /* NCU_KEYS_H */", - 0 - }; + static const char *prefix[] = + { + "#ifndef NCU_KEYS_H", + "#define NCU_KEYS_H 1", + "", + "/* This file was generated by MAKE_KEYS */", + "", + "#if BROKEN_LINKER", + "static", + "#endif", + "struct tinfo_fkeys _nc_tinfo_fkeys[] = {", + 0 + }; + static const char *suffix[] = + { + "\t{ 0, 0} };", + "", + "#endif /* NCU_KEYS_H */", + 0 + }; - write_list(stdout, prefix); - if (argc > 1) { - int n; - for (n = 1; n < argc; n++) { - FILE *fp = fopen(argv[n], "r"); - if (fp != 0) { - make_keys(fp, stdout); - fclose(fp); - } - } - } else { - make_keys(stdin, stdout); + write_list(stdout, prefix); + if (argc > 1) { + int n; + for (n = 1; n < argc; n++) { + FILE *fp = fopen(argv[n], "r"); + if (fp != 0) { + make_keys(fp, stdout); + fclose(fp); + } } - write_list(stdout, suffix); - return EXIT_SUCCESS; + } else { + make_keys(stdin, stdout); + } + write_list(stdout, suffix); + return EXIT_SUCCESS; } diff --git a/lib/libcurses/tinfo/name_match.c b/lib/libcurses/tinfo/name_match.c index 77099d601be..6db7ac7057f 100644 --- a/lib/libcurses/tinfo/name_match.c +++ b/lib/libcurses/tinfo/name_match.c @@ -1,7 +1,7 @@ -/* $OpenBSD: name_match.c,v 1.2 1999/03/11 21:03:57 millert Exp $ */ +/* $OpenBSD: name_match.c,v 1.3 2001/01/22 18:01:55 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 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,7 +36,7 @@ #include <term.h> #include <tic.h> -MODULE_ID("$From: name_match.c,v 1.8 1999/03/07 01:58:36 tom Exp $") +MODULE_ID("$From: name_match.c,v 1.10 2000/12/10 02:55:08 tom Exp $") /* * _nc_first_name(char *names) @@ -44,19 +44,20 @@ MODULE_ID("$From: name_match.c,v 1.8 1999/03/07 01:58:36 tom Exp $") * Extract the primary name from a compiled entry. */ -char *_nc_first_name(const char *const sp) +NCURSES_EXPORT(char *) +_nc_first_name(const char *const sp) /* get the first name from the given name list */ { - static char buf[MAX_NAME_SIZE+1]; - register unsigned n; + static char buf[MAX_NAME_SIZE + 1]; + register unsigned n; - for (n = 0; n < sizeof(buf)-1; n++) { - if ((buf[n] = sp[n]) == '\0' - || (buf[n] == '|')) - break; - } - buf[n] = '\0'; - return(buf); + for (n = 0; n < sizeof(buf) - 1; n++) { + if ((buf[n] = sp[n]) == '\0' + || (buf[n] == '|')) + break; + } + buf[n] = '\0'; + return (buf); } /* @@ -65,34 +66,36 @@ char *_nc_first_name(const char *const sp) * Is the given name matched in namelist? */ -int _nc_name_match(const char *const namelst, const char *const name, const char *const delim) +NCURSES_EXPORT(int) +_nc_name_match +(const char *const namelst, const char *const name, const char *const delim) { - const char *s, *d, *t; - int code, found; + const char *s, *d, *t; + int code, found; - if ((s = namelst) != 0) { - while (*s != '\0') { - for (d = name; *d != '\0'; d++) { - if (*s != *d) - break; - s++; - } - found = FALSE; - for (code = TRUE; *s != '\0'; code = FALSE, s++) { - for (t = delim; *t != '\0'; t++) { - if (*s == *t) { - found = TRUE; - break; - } - } - if (found) - break; - } - if (code && *d == '\0') - return code; - if (*s++ == 0) - break; + if ((s = namelst) != 0) { + while (*s != '\0') { + for (d = name; *d != '\0'; d++) { + if (*s != *d) + break; + s++; + } + found = FALSE; + for (code = TRUE; *s != '\0'; code = FALSE, s++) { + for (t = delim; *t != '\0'; t++) { + if (*s == *t) { + found = TRUE; + break; + } } + if (found) + break; + } + if (code && *d == '\0') + return code; + if (*s++ == 0) + break; } - return FALSE; + } + return FALSE; } diff --git a/lib/libcurses/tinfo/parse_entry.c b/lib/libcurses/tinfo/parse_entry.c index 3a88ec027e2..2327915b9db 100644 --- a/lib/libcurses/tinfo/parse_entry.c +++ b/lib/libcurses/tinfo/parse_entry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse_entry.c,v 1.8 2000/10/08 22:47:02 millert Exp $ */ +/* $OpenBSD: parse_entry.c,v 1.9 2001/01/22 18:01:55 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -49,7 +49,7 @@ #define __INTERNAL_CAPS_VISIBLE #include <term_entry.h> -MODULE_ID("$From: parse_entry.c,v 1.48 2000/10/03 09:38:48 tom Exp $") +MODULE_ID("$From: parse_entry.c,v 1.52 2001/01/13 22:44:29 tom Exp $") #ifdef LINT static short const parametrized[] = @@ -197,8 +197,9 @@ _nc_extend_names(ENTRY * entryp, char *name, int token_type) * push back token */ -int -_nc_parse_entry(struct entry *entryp, int literal, bool silent) +NCURSES_EXPORT(int) +_nc_parse_entry +(struct entry *entryp, int literal, bool silent) { int token_type; struct name_table_entry const *entry_ptr; @@ -466,12 +467,12 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent) } else postprocess_terminfo(&entryp->tterm); } - _nc_wrap_entry(entryp); + _nc_wrap_entry(entryp, FALSE); return (OK); } -int +NCURSES_EXPORT(int) _nc_capcmp(const char *s, const char *t) /* compare two string capabilities, stripping out padding */ { @@ -483,15 +484,21 @@ _nc_capcmp(const char *s, const char *t) for (;;) { if (s[0] == '$' && s[1] == '<') { for (s += 2;; s++) - if (!(isdigit(*s) || *s == '.' || *s == '*' || *s == '/' || - *s == '>')) + if (!(isdigit(CharOf(*s)) + || *s == '.' + || *s == '*' + || *s == '/' + || *s == '>')) break; } if (t[0] == '$' && t[1] == '<') { for (t += 2;; t++) - if (!(isdigit(*t) || *t == '.' || *t == '*' || *t == '/' || - *t == '>')) + if (!(isdigit(CharOf(*t)) + || *t == '.' + || *t == '*' + || *t == '/' + || *t == '>')) break; } @@ -509,7 +516,7 @@ _nc_capcmp(const char *s, const char *t) } static void -append_acs0(string_desc *dst, int code, int src) +append_acs0(string_desc * dst, int code, int src) { if (src != 0) { char temp[3]; @@ -521,7 +528,7 @@ append_acs0(string_desc *dst, int code, int src) } static void -append_acs(string_desc *dst, int code, char *src) +append_acs(string_desc * dst, int code, char *src) { if (src != 0 && strlen(src) == 1) { append_acs0(dst, code, *src); @@ -659,12 +666,12 @@ postprocess_termcap(TERMTYPE * tp, bool has_base) } else if (PRESENT(carriage_return) && PRESENT(scroll_forward)) { _nc_str_init(&result, buf, sizeof(buf)); if (_nc_safe_strcat(&result, carriage_return) - && _nc_safe_strcat(&result, scroll_forward)) + && _nc_safe_strcat(&result, scroll_forward)) newline = _nc_save_str(buf); } else if (PRESENT(carriage_return) && PRESENT(cursor_down)) { _nc_str_init(&result, buf, sizeof(buf)); if (_nc_safe_strcat(&result, carriage_return) - && _nc_safe_strcat(&result, cursor_down)) + && _nc_safe_strcat(&result, cursor_down)) newline = _nc_save_str(buf); } } @@ -815,13 +822,15 @@ postprocess_termcap(TERMTYPE * tp, bool has_base) } } - if (!hard_copy) { - if (WANTED(key_backspace)) - key_backspace = _nc_save_str(C_BS); - if (WANTED(key_left)) - key_left = _nc_save_str(C_BS); - if (WANTED(key_down)) - key_down = _nc_save_str(C_LF); + if (!has_base) { + if (!hard_copy) { + if (WANTED(key_backspace)) + key_backspace = _nc_save_str(C_BS); + if (WANTED(key_left)) + key_left = _nc_save_str(C_BS); + if (WANTED(key_down)) + key_down = _nc_save_str(C_LF); + } } /* @@ -843,17 +852,17 @@ postprocess_termcap(TERMTYPE * tp, bool has_base) _nc_str_init(&result, buf2, sizeof(buf2)); _nc_safe_strcat(&result, acs_chars); - append_acs (&result, 'j', acs_lrcorner); - append_acs (&result, 'k', acs_urcorner); - append_acs (&result, 'l', acs_ulcorner); - append_acs (&result, 'm', acs_llcorner); - append_acs (&result, 'n', acs_plus); - append_acs (&result, 'q', acs_hline); - append_acs (&result, 't', acs_ltee); - append_acs (&result, 'u', acs_rtee); - append_acs (&result, 'v', acs_btee); - append_acs (&result, 'w', acs_ttee); - append_acs (&result, 'x', acs_vline); + append_acs(&result, 'j', acs_lrcorner); + append_acs(&result, 'k', acs_urcorner); + append_acs(&result, 'l', acs_ulcorner); + append_acs(&result, 'm', acs_llcorner); + append_acs(&result, 'n', acs_plus); + append_acs(&result, 'q', acs_hline); + append_acs(&result, 't', acs_ltee); + append_acs(&result, 'u', acs_rtee); + append_acs(&result, 'v', acs_btee); + append_acs(&result, 'w', acs_ttee); + append_acs(&result, 'x', acs_vline); if (buf2[0]) { acs_chars = _nc_save_str(buf2); @@ -885,17 +894,17 @@ postprocess_terminfo(TERMTYPE * tp) _nc_str_init(&result, buf2, sizeof(buf2)); _nc_safe_strcat(&result, acs_chars); - append_acs0 (&result, 'l', box_chars_1[0]); /* ACS_ULCORNER */ - append_acs0 (&result, 'q', box_chars_1[1]); /* ACS_HLINE */ - append_acs0 (&result, 'k', box_chars_1[2]); /* ACS_URCORNER */ - append_acs0 (&result, 'x', box_chars_1[3]); /* ACS_VLINE */ - append_acs0 (&result, 'j', box_chars_1[4]); /* ACS_LRCORNER */ - append_acs0 (&result, 'm', box_chars_1[5]); /* ACS_LLCORNER */ - append_acs0 (&result, 'w', box_chars_1[6]); /* ACS_TTEE */ - append_acs0 (&result, 'u', box_chars_1[7]); /* ACS_RTEE */ - append_acs0 (&result, 'v', box_chars_1[8]); /* ACS_BTEE */ - append_acs0 (&result, 't', box_chars_1[9]); /* ACS_LTEE */ - append_acs0 (&result, 'n', box_chars_1[10]); /* ACS_PLUS */ + append_acs0(&result, 'l', box_chars_1[0]); /* ACS_ULCORNER */ + append_acs0(&result, 'q', box_chars_1[1]); /* ACS_HLINE */ + append_acs0(&result, 'k', box_chars_1[2]); /* ACS_URCORNER */ + append_acs0(&result, 'x', box_chars_1[3]); /* ACS_VLINE */ + append_acs0(&result, 'j', box_chars_1[4]); /* ACS_LRCORNER */ + append_acs0(&result, 'm', box_chars_1[5]); /* ACS_LLCORNER */ + append_acs0(&result, 'w', box_chars_1[6]); /* ACS_TTEE */ + append_acs0(&result, 'u', box_chars_1[7]); /* ACS_RTEE */ + append_acs0(&result, 'v', box_chars_1[8]); /* ACS_BTEE */ + append_acs0(&result, 't', box_chars_1[9]); /* ACS_LTEE */ + append_acs0(&result, 'n', box_chars_1[10]); /* ACS_PLUS */ if (buf2[0]) { acs_chars = _nc_save_str(buf2); diff --git a/lib/libcurses/tinfo/read_entry.c b/lib/libcurses/tinfo/read_entry.c index 7ebc4785572..2d6f4ba4ba6 100644 --- a/lib/libcurses/tinfo/read_entry.c +++ b/lib/libcurses/tinfo/read_entry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read_entry.c,v 1.11 2000/10/22 18:27:23 millert Exp $ */ +/* $OpenBSD: read_entry.c,v 1.12 2001/01/22 18:01:55 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -43,7 +43,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: read_entry.c,v 1.69 2000/10/10 00:57:40 Todd.Miller Exp $") +MODULE_ID("$From: read_entry.c,v 1.72 2000/12/10 02:55:08 tom Exp $") #if !HAVE_TELL #define tell(fd) 0 /* lseek() is POSIX, but not tell() - odd... */ @@ -72,7 +72,7 @@ static bool keep_tic_directory = FALSE; * Record the "official" location of the terminfo directory, according to * the place where we're writing to, or the normal default, if not. */ -const char * +NCURSES_EXPORT(const char *) _nc_tic_dir(const char *path) { static const char *result = TERMINFO; @@ -95,7 +95,7 @@ _nc_tic_dir(const char *path) * has chdir'd to it. If we let it be changed, then if $TERMINFO has a * relative path, we'll lose track of the actual directory. */ -void +NCURSES_EXPORT(void) _nc_keep_tic_dir(const char *path) { _nc_tic_dir(path); @@ -375,8 +375,9 @@ read_termtype(int fd, TERMTYPE * ptr) return (1); } -int -_nc_read_file_entry(const char *const filename, TERMTYPE * ptr) +NCURSES_EXPORT(int) +_nc_read_file_entry +(const char *const filename, TERMTYPE * ptr) /* return 1 if read, 0 if not found or garbled */ { int code, fd = -1; @@ -435,7 +436,7 @@ _nc_read_terminfo_dirs(const char *dirs, char *const filename, const char *const for (;;) { int c = *a; - if (c == 0 || c == ':') { + if (c == 0 || c == NCURSES_PATHSEP) { *a = 0; if ((b + 1) >= a) b = TERMINFO; @@ -463,8 +464,9 @@ _nc_read_terminfo_dirs(const char *dirs, char *const filename, const char *const * overrun the file buffer. */ -int -_nc_read_entry(const char *const tn, char *const filename, TERMTYPE * const tp) +NCURSES_EXPORT(int) +_nc_read_entry +(const char *const tn, char *const filename, TERMTYPE * const tp) { char *envp; char ttn[MAX_ALIAS + 3]; diff --git a/lib/libcurses/tinfo/read_termcap.c b/lib/libcurses/tinfo/read_termcap.c index fe7aa25c5ad..5240db23745 100644 --- a/lib/libcurses/tinfo/read_termcap.c +++ b/lib/libcurses/tinfo/read_termcap.c @@ -55,7 +55,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: read_termcap.c,v 1.51 2000/10/21 00:34:11 Philip.Guenther Exp $") +MODULE_ID("$From: read_termcap.c,v 1.55 2000/12/10 02:55:08 tom Exp $") #if !PURE_TERMINFO @@ -784,7 +784,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) pvec = pathvec; tbuf = bp; p = pathbuf; - cp = use_terminfo_vars() ? getenv("TERMCAP") : NULL; + cp = use_terminfo_vars()? getenv("TERMCAP") : NULL; /* * TERMCAP can have one of two things in it. It can be the name of a file @@ -821,10 +821,10 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) *fname++ = pathbuf; /* tokenize path into vector of names */ while (*++p) { - if (*p == ' ' || *p == ':') { + if (*p == ' ' || *p == NCURSES_PATHSEP) { *p = '\0'; while (*++p) - if (*p != ' ' && *p != ':') + if (*p != ' ' && *p != NCURSES_PATHSEP) break; if (*p == '\0') break; @@ -917,8 +917,9 @@ add_tc(char *termpaths[], char *path, int count) #define ADD_TC(path, count) filecount = add_tc(termpaths, path, count) #endif /* !USE_GETCAP */ -int -_nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) +NCURSES_EXPORT(int) +_nc_read_termcap_entry +(const char *const tn, TERMTYPE * const tp) { int found = FALSE; ENTRY *ep; @@ -989,7 +990,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) char *cp; for (cp = tc; *cp; cp++) { - if (*cp == ':') + if (*cp == NCURSES_PATHSEP) *cp = '\0'; else if (cp == tc || cp[-1] == '\0') { ADD_TC(cp, filecount); @@ -1102,8 +1103,10 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) return (found); } #else -extern void _nc_read_termcap(void); -void +extern +NCURSES_EXPORT(void) +_nc_read_termcap(void); +NCURSES_EXPORT(void) _nc_read_termcap(void) { } diff --git a/lib/libcurses/tinfo/setbuf.c b/lib/libcurses/tinfo/setbuf.c index d798cce9611..cfe3771b036 100644 --- a/lib/libcurses/tinfo/setbuf.c +++ b/lib/libcurses/tinfo/setbuf.c @@ -1,7 +1,7 @@ -/* $OpenBSD: setbuf.c,v 1.3 1999/03/02 06:23:29 millert Exp $ */ +/* $OpenBSD: setbuf.c,v 1.4 2001/01/22 18:01:57 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,8 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** setbuf.c ** @@ -44,7 +42,7 @@ #include <curses.priv.h> -MODULE_ID("$From: setbuf.c,v 1.5 1999/02/27 20:00:15 tom Exp $") +MODULE_ID("$From: setbuf.c,v 1.7 2000/12/10 02:55:08 tom Exp $") /* * If the output file descriptor is connected to a tty (the typical case) it @@ -101,45 +99,47 @@ MODULE_ID("$From: setbuf.c,v 1.5 1999/02/27 20:00:15 tom Exp $") * do indeed get confused by changing setbuf on/off, and will overrun the * buffer. So we disable this by default (there may yet be a workaround). */ -void _nc_set_buffer(FILE *ofp, bool buffered) +NCURSES_EXPORT(void) +_nc_set_buffer(FILE * ofp, bool buffered) { - /* optional optimization hack -- do before any output to ofp */ + /* optional optimization hack -- do before any output to ofp */ #if HAVE_SETVBUF || HAVE_SETBUFFER - unsigned buf_len; - char *buf_ptr; + unsigned buf_len; + char *buf_ptr; - if (getenv("NCURSES_NO_SETBUF") != 0) - return; + if (getenv("NCURSES_NO_SETBUF") != 0) + return; - fflush(ofp); - if ((SP->_buffered = buffered) != 0) { - buf_len = min(LINES * (COLS + 6), 2800); - if ((buf_ptr = SP->_setbuf) == 0) { - if ((buf_ptr = typeMalloc(char, buf_len)) == NULL) - return; - SP->_setbuf = buf_ptr; - /* Don't try to free this! */ - } + fflush(ofp); + if ((SP->_buffered = buffered) != 0) { + buf_len = min(LINES * (COLS + 6), 2800); + if ((buf_ptr = SP->_setbuf) == 0) { + if ((buf_ptr = typeMalloc(char, buf_len)) == NULL) + return; + SP->_setbuf = buf_ptr; + /* Don't try to free this! */ + } #if !USE_SETBUF_0 - else return; + else + return; #endif - } else { + } else { #if !USE_SETBUF_0 - return; + return; #else - buf_len = 0; - buf_ptr = 0; + buf_len = 0; + buf_ptr = 0; #endif - } + } #if HAVE_SETVBUF -#ifdef SETVBUF_REVERSED /* pre-svr3? */ - (void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IOLBF); +#ifdef SETVBUF_REVERSED /* pre-svr3? */ + (void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IOLBF); #else - (void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IOLBF, buf_len); + (void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IOLBF, buf_len); #endif #elif HAVE_SETBUFFER - (void) setbuffer(ofp, buf_ptr, (int)buf_len); + (void) setbuffer(ofp, buf_ptr, (int) buf_len); #endif #endif /* HAVE_SETVBUF || HAVE_SETBUFFER */ diff --git a/lib/libcurses/tinfo/strings.c b/lib/libcurses/tinfo/strings.c index 28b55f0b9dc..4e3fcf1ea53 100644 --- a/lib/libcurses/tinfo/strings.c +++ b/lib/libcurses/tinfo/strings.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strings.c,v 1.1 2000/10/08 22:47:03 millert Exp $ */ +/* $OpenBSD: strings.c,v 1.2 2001/01/22 18:01:57 millert Exp $ */ /**************************************************************************** * Copyright (c) 2000 Free Software Foundation, Inc. * @@ -38,15 +38,16 @@ #include <curses.priv.h> -MODULE_ID("$Id") +MODULE_ID("$From: strings.c,v 1.3 2000/12/10 02:55:08 tom Exp $") /**************************************************************************** * Useful string functions (especially for mvcur) ****************************************************************************/ #if !HAVE_STRSTR -char * -_nc_strstr(const char *haystack, const char *needle) +NCURSES_EXPORT(char *) +_nc_strstr +(const char *haystack, const char *needle) { size_t len1 = strlen(haystack); size_t len2 = strlen(needle); @@ -66,8 +67,9 @@ _nc_strstr(const char *haystack, const char *needle) /* * Initialize the descriptor so we can append to it. */ -string_desc * -_nc_str_init(string_desc * dst, char *src, size_t len) +NCURSES_EXPORT(string_desc *) +_nc_str_init +(string_desc * dst, char *src, size_t len) { if (dst != 0) { dst->s_head = src; @@ -82,8 +84,9 @@ _nc_str_init(string_desc * dst, char *src, size_t len) /* * Initialize the descriptor for only tracking the amount of memory used. */ -string_desc * -_nc_str_null(string_desc * dst, size_t len) +NCURSES_EXPORT(string_desc *) +_nc_str_null +(string_desc * dst, size_t len) { return _nc_str_init(dst, 0, len); } @@ -91,8 +94,9 @@ _nc_str_null(string_desc * dst, size_t len) /* * Copy a descriptor */ -string_desc * -_nc_str_copy(string_desc * dst, string_desc * src) +NCURSES_EXPORT(string_desc *) +_nc_str_copy +(string_desc * dst, string_desc * src) { *dst = *src; return dst; @@ -101,7 +105,7 @@ _nc_str_copy(string_desc * dst, string_desc * src) /* * Replaces strcat into a fixed buffer, returning false on failure. */ -bool +NCURSES_EXPORT(bool) _nc_safe_strcat(string_desc * dst, const char *src) { if (src != 0) { @@ -122,7 +126,7 @@ _nc_safe_strcat(string_desc * dst, const char *src) /* * Replaces strcpy into a fixed buffer, returning false on failure. */ -bool +NCURSES_EXPORT(bool) _nc_safe_strcpy(string_desc * dst, const char *src) { if (src != 0) { diff --git a/lib/libcurses/tinfo/write_entry.c b/lib/libcurses/tinfo/write_entry.c index b282d069c81..c7a5958a4bf 100644 --- a/lib/libcurses/tinfo/write_entry.c +++ b/lib/libcurses/tinfo/write_entry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: write_entry.c,v 1.9 2000/10/08 22:47:03 millert Exp $ */ +/* $OpenBSD: write_entry.c,v 1.10 2001/01/22 18:01:57 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -54,7 +54,7 @@ #define TRACE_OUT(p) /*nothing */ #endif -MODULE_ID("$From: write_entry.c,v 1.53 2000/10/04 02:32:14 tom Exp $") +MODULE_ID("$From: write_entry.c,v 1.56 2000/12/10 02:55:08 tom Exp $") static int total_written; @@ -111,7 +111,7 @@ make_directory(const char *path) return rc; } -void +NCURSES_EXPORT(void) _nc_set_writedir(char *dir) /* set the write directory for compiled entries */ { @@ -119,7 +119,7 @@ _nc_set_writedir(char *dir) char actual[PATH_MAX]; if (dir == 0 - && use_terminfo_vars()) + && use_terminfo_vars()) dir = getenv("TERMINFO"); if (dir != 0) @@ -133,7 +133,7 @@ _nc_set_writedir(char *dir) destination = home; if (make_directory(destination) < 0) _nc_err_abort("%s: permission denied (errno %d)", - destination, errno); + destination, errno); } } @@ -166,7 +166,7 @@ check_writeable(int code) static bool verified[sizeof(dirnames)]; char dir[2]; - char *s; + char *s = 0; if (code == 0 || (s = strchr(dirnames, code)) == 0) _nc_err_abort("Illegal terminfo subdirectory \"%c\"", code); @@ -277,7 +277,7 @@ _nc_write_entry(TERMTYPE * const tp) if (stat(filename, &statbuf) < 0 || (start_time = statbuf.st_mtime) == 0) { _nc_syserr_abort("error obtaining time from %s/%s", - _nc_tic_dir(0), filename); + _nc_tic_dir(0), filename); } } while (*other_names != '\0') { @@ -303,7 +303,7 @@ _nc_write_entry(TERMTYPE * const tp) if (strcmp(filename, linkname) == 0) { _nc_warning("self-synonym ignored"); } else if (stat(linkname, &statbuf) >= 0 && - statbuf.st_mtime < start_time) { + statbuf.st_mtime < start_time) { _nc_warning("alias %s multiply defined.", ptr); } else if (_nc_access(linkname, W_OK) == 0) #if HAVE_LINK @@ -335,10 +335,16 @@ _nc_write_entry(TERMTYPE * const tp) */ if (code == 0 && errno == EEXIST) _nc_warning("can't link %s to %s", filename, linkname); - else if (code == 0 && errno == EPERM) + else if (code == 0 && (errno == EPERM || errno == ENOENT)) write_file(linkname, tp); - else + else { +#if MIXEDCASE_FILENAMES _nc_syserr_abort("can't link %s to %s", filename, linkname); +#else + _nc_warning("can't link %s to %s (errno=%d)", filename, + linkname, errno); +#endif + } } else { DEBUG(1, ("Linked %s", linkname)); } @@ -522,7 +528,7 @@ write_object(FILE * fp, TERMTYPE * tp) TRACE_OUT(("WRITE %d booleans @%ld", tp->ext_Booleans, ftell(fp))); if (tp->ext_Booleans && fwrite(tp->Booleans + BOOLCOUNT, sizeof(char), - tp->ext_Booleans, fp) != tp->ext_Booleans) + tp->ext_Booleans, fp) != tp->ext_Booleans) return (ERR); if (even_boundary(tp->ext_Booleans)) @@ -551,7 +557,7 @@ write_object(FILE * fp, TERMTYPE * tp) for (i = 0; i < tp->ext_Strings; i++) { if (VALID_STRING(tp->Strings[i + STRCOUNT])) { TRACE_OUT(("WRITE ext_Strings[%d]=%s", i, - _nc_visbuf(tp->Strings[i + STRCOUNT]))); + _nc_visbuf(tp->Strings[i + STRCOUNT]))); if (!WRITE_STRING(tp->Strings[i + STRCOUNT])) return (ERR); } @@ -576,7 +582,7 @@ write_object(FILE * fp, TERMTYPE * tp) /* * Returns the total number of entries written by this process */ -int +NCURSES_EXPORT(int) _nc_tic_written(void) { return total_written; diff --git a/lib/libcurses/trace/lib_trace.c b/lib/libcurses/trace/lib_trace.c index 0eab5abfb93..698c4b9e202 100644 --- a/lib/libcurses/trace/lib_trace.c +++ b/lib/libcurses/trace/lib_trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_trace.c,v 1.5 2000/04/04 16:49:59 millert Exp $ */ +/* $OpenBSD: lib_trace.c,v 1.6 2001/01/22 18:01:58 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,17 +42,20 @@ #include <ctype.h> -MODULE_ID("$From: lib_trace.c,v 1.34 2000/04/01 20:25:47 tom Exp $") +MODULE_ID("$From: lib_trace.c,v 1.38 2000/12/10 03:02:45 tom Exp $") -unsigned _nc_tracing = 0; /* always define this */ +NCURSES_EXPORT_VAR(unsigned) +_nc_tracing = 0; /* always define this */ #ifdef TRACE -const char *_nc_tputs_trace = ""; -long _nc_outchars = 0; +NCURSES_EXPORT_VAR(const char *) +_nc_tputs_trace = ""; +NCURSES_EXPORT_VAR(long) +_nc_outchars = 0; -static FILE *tracefp; /* default to writing to stderr */ + static FILE *tracefp; /* default to writing to stderr */ -void +NCURSES_EXPORT(void) trace(const unsigned int tracelevel GCC_UNUSED) { static bool been_here = FALSE; @@ -63,7 +66,7 @@ trace(const unsigned int tracelevel GCC_UNUSED) been_here = TRUE; if (_nc_access(my_name, W_OK) < 0 - || (tracefp = fopen(my_name, "w")) == 0) { + || (tracefp = fopen(my_name, "wb")) == 0) { perror("curses: Can't open 'trace' file: "); exit(EXIT_FAILURE); } @@ -76,13 +79,12 @@ trace(const unsigned int tracelevel GCC_UNUSED) #elif HAVE_SETBUF /* POSIX */ (void) setbuffer(tracefp, (char *) 0); #endif - _tracef("TRACING NCURSES version %s (%d)", - NCURSES_VERSION, NCURSES_VERSION_PATCH); + _tracef("TRACING NCURSES version %s", curses_version()); } } #endif -const char * +NCURSES_EXPORT(const char *) _nc_visbuf2(int bufnum, const char *buf) /* visibilize a given string */ { @@ -99,9 +101,9 @@ _nc_visbuf2(int bufnum, const char *buf) tp = vbuf = _nc_trace_buf(bufnum, (strlen(buf) * 4) + 5); #else { - static char *mybuf[2]; - mybuf[bufnum] = _nc_doalloc(mybuf[bufnum], (strlen(buf) * 4) + 5); - tp = vbuf = mybuf[bufnum]; + static char *mybuf[2]; + mybuf[bufnum] = _nc_doalloc(mybuf[bufnum], (strlen(buf) * 4) + 5); + tp = vbuf = mybuf[bufnum]; } #endif *tp++ = '"'; @@ -128,7 +130,7 @@ _nc_visbuf2(int bufnum, const char *buf) *tp++ = '^'; *tp++ = '@' + c; } else { - sprintf(tp, "\\%03o", c & 0xff); + sprintf(tp, "\\%03o", CharOf(c)); tp += strlen(tp); } } @@ -137,14 +139,14 @@ _nc_visbuf2(int bufnum, const char *buf) return (vbuf); } -const char * +NCURSES_EXPORT(const char *) _nc_visbuf(const char *buf) { return _nc_visbuf2(0, buf); } #ifdef TRACE -void +NCURSES_EXPORT(void) _tracef(const char *fmt,...) { static const char Called[] = T_CALLED(""); @@ -193,7 +195,7 @@ _tracef(const char *fmt,...) } /* Trace 'int' return-values */ -int +NCURSES_EXPORT(int) _nc_retrace_int(int code) { T((T_RETURN("%d"), code)); @@ -201,7 +203,7 @@ _nc_retrace_int(int code) } /* Trace 'char*' return-values */ -char * +NCURSES_EXPORT(char *) _nc_retrace_ptr(char *code) { T((T_RETURN("%s"), _nc_visbuf(code))); @@ -209,7 +211,7 @@ _nc_retrace_ptr(char *code) } /* Trace 'WINDOW *' return-values */ -WINDOW * +NCURSES_EXPORT(WINDOW *) _nc_retrace_win(WINDOW *code) { T((T_RETURN("%p"), code)); diff --git a/lib/libcurses/trace/lib_traceatr.c b/lib/libcurses/trace/lib_traceatr.c index 30b601275d0..d90d239de86 100644 --- a/lib/libcurses/trace/lib_traceatr.c +++ b/lib/libcurses/trace/lib_traceatr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_traceatr.c,v 1.2 2000/10/08 22:47:03 millert Exp $ */ +/* $OpenBSD: lib_traceatr.c,v 1.3 2001/01/22 18:01:58 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -40,12 +40,12 @@ #include <curses.priv.h> #include <term.h> /* acs_chars */ -MODULE_ID("$From: lib_traceatr.c,v 1.30 2000/07/29 18:06:09 tom Exp $") +MODULE_ID("$From: lib_traceatr.c,v 1.32 2000/12/10 03:02:45 tom Exp $") #define COLOR_OF(c) (c < 0 || c > 7 ? "default" : colors[c].name) #ifdef TRACE -char * +NCURSES_EXPORT(char *) _traceattr2(int bufnum, attr_t newmode) { char *buf = _nc_trace_buf(bufnum, BUFSIZ); @@ -124,21 +124,21 @@ _traceattr2(int bufnum, attr_t newmode) return (strcat(buf, "}")); } -char * +NCURSES_EXPORT(char *) _traceattr(attr_t newmode) { return _traceattr2(0, newmode); } /* Trace 'int' return-values */ -attr_t +NCURSES_EXPORT(attr_t) _nc_retrace_attr_t(attr_t code) { T((T_RETURN("%s"), _traceattr(code))); return code; } -char * +NCURSES_EXPORT(char *) _tracechtype2(int bufnum, chtype ch) { char *buf = _nc_trace_buf(bufnum, BUFSIZ); @@ -219,24 +219,23 @@ _tracechtype2(int bufnum, chtype ch) return (buf); } -char * -_tracechtype(chtype ch) +NCURSES_EXPORT(char *) +_tracechtype (chtype ch) { return _tracechtype2(0, ch); } /* Trace 'chtype' return-values */ -attr_t -_nc_retrace_chtype(attr_t code) +NCURSES_EXPORT(attr_t) +_nc_retrace_chtype (attr_t code) { T((T_RETURN("%s"), _tracechtype(code))); return code; } #else -extern void _nc_lib_traceatr(void); -void -_nc_lib_traceatr(void) +extern NCURSES_EXPORT(void) _nc_lib_traceatr (void); +NCURSES_EXPORT(void) _nc_lib_traceatr (void) { } #endif /* TRACE */ diff --git a/lib/libcurses/trace/lib_tracebits.c b/lib/libcurses/trace/lib_tracebits.c index 494998dd73d..3d7fb492884 100644 --- a/lib/libcurses/trace/lib_tracebits.c +++ b/lib/libcurses/trace/lib_tracebits.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_tracebits.c,v 1.7 2000/10/08 22:47:04 millert Exp $ */ +/* $OpenBSD: lib_tracebits.c,v 1.8 2001/01/22 18:01:58 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -36,7 +36,7 @@ #include <curses.priv.h> #include <term.h> /* cur_term */ -MODULE_ID("$From: lib_tracebits.c,v 1.7 2000/09/02 18:08:37 tom Exp $") +MODULE_ID("$From: lib_tracebits.c,v 1.9 2000/12/10 03:02:45 tom Exp $") #if SVR4_TERMIO && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE @@ -83,7 +83,7 @@ lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned int v (void) strcat(buf, "} "); } -char * +NCURSES_EXPORT(char *) _nc_tracebits(void) /* describe the state of the terminal control bits exactly */ { @@ -139,11 +139,11 @@ _nc_tracebits(void) }; buf = _nc_trace_buf(0, - 8 + sizeof(iflags) + - 8 + sizeof(oflags) + - 8 + sizeof(cflags) + - 8 + sizeof(lflags) + - 8); + 8 + sizeof(iflags) + + 8 + sizeof(oflags) + + 8 + sizeof(cflags) + + 8 + sizeof(lflags) + + 8); if (cur_term->Nttyb.c_iflag & ALLIN) lookup_bits(buf, iflags, "iflags", cur_term->Nttyb.c_iflag); @@ -231,7 +231,7 @@ _nc_tracebits(void) }; buf = _nc_trace_buf(0, - 8 + sizeof(cflags)); + 8 + sizeof(cflags)); if (cur_term->Nttyb.sg_flags & ALLCTRL) { lookup_bits(buf, cflags, "cflags", cur_term->Nttyb.sg_flags); @@ -240,7 +240,7 @@ _nc_tracebits(void) return (buf); } #else -char * +NCURSES_EXPORT(char *) _nc_tracebits(void) { static char tmp[] = ""; diff --git a/lib/libcurses/trace/lib_tracechr.c b/lib/libcurses/trace/lib_tracechr.c index 932ee8d811d..340ca67913b 100644 --- a/lib/libcurses/trace/lib_tracechr.c +++ b/lib/libcurses/trace/lib_tracechr.c @@ -36,16 +36,22 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_tracechr.c,v 1.2 2000/04/01 20:17:26 tom Exp $") +MODULE_ID("$From: lib_tracechr.c,v 1.4 2000/12/10 03:02:45 tom Exp $") #ifdef TRACE -char *_tracechar(const unsigned char ch) +NCURSES_EXPORT(char *) +_tracechar(const unsigned char ch) { static char crep[20]; - (void) sprintf(crep, "'%s' = 0x%02x", unctrl(ch), (unsigned)ch); - return(crep); + (void) sprintf(crep, "'%s' = 0x%02x", unctrl(ch), (unsigned) ch); + return (crep); } #else -extern void _nc_lib_tracechr(void); - void _nc_lib_tracechr(void) { } +extern +NCURSES_EXPORT(void) +_nc_lib_tracechr(void); +NCURSES_EXPORT(void) +_nc_lib_tracechr(void) +{ +} #endif diff --git a/lib/libcurses/trace/lib_tracedmp.c b/lib/libcurses/trace/lib_tracedmp.c index 50859050044..4a709fea869 100644 --- a/lib/libcurses/trace/lib_tracedmp.c +++ b/lib/libcurses/trace/lib_tracedmp.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_tracedmp.c,v 1.1 1999/01/18 19:10:24 millert Exp $ */ +/* $OpenBSD: lib_tracedmp.c,v 1.2 2001/01/22 18:01:58 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -39,92 +39,93 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_tracedmp.c,v 1.13 1998/03/21 18:39:44 tom Exp $") +MODULE_ID("$From: lib_tracedmp.c,v 1.16 2000/12/10 03:02:45 tom Exp $") #ifdef TRACE -void _tracedump(const char *name, WINDOW *win) +NCURSES_EXPORT(void) +_tracedump(const char *name, WINDOW *win) { - int i, j, n, width; + int i, j, n, width; /* compute narrowest possible display width */ - for (width = i = 0; i <= win->_maxy; i++) - { + for (width = i = 0; i <= win->_maxy; i++) { n = 0; for (j = 0; j <= win->_maxx; j++) - if (win->_line[i].text[j] != ' ') - n = j; + if (win->_line[i].text[j] != ' ') + n = j; if (n > width) - width = n; + width = n; } if (width < win->_maxx) - ++width; + ++width; - for (n = 0; n <= win->_maxy; n++) - { - char buf[BUFSIZ], *ep; + for (n = 0; n <= win->_maxy; n++) { + char buf[BUFSIZ], *ep; bool haveattrs, havecolors; /* dump A_CHARTEXT part */ (void) sprintf(buf, "%s[%2d] %3d%3d ='", - name, n, - win->_line[n].firstchar, - win->_line[n].lastchar); + name, n, + win->_line[n].firstchar, + win->_line[n].lastchar); ep = buf + strlen(buf); for (j = 0; j <= width; j++) { ep[j] = TextOf(win->_line[n].text[j]); if (ep[j] == 0) - ep[j] = '.'; + ep[j] = '.'; } ep[j] = '\''; - ep[j+1] = '\0'; + ep[j + 1] = '\0'; _tracef("%s", buf); /* dump A_COLOR part, will screw up if there are more than 96 */ havecolors = FALSE; for (j = 0; j <= width; j++) - if (win->_line[n].text[j] & A_COLOR) - { + if (win->_line[n].text[j] & A_COLOR) { havecolors = TRUE; break; } - if (havecolors) - { - (void) sprintf(buf, "%*s[%2d]%*s='", (int)strlen(name), "colors", n, 8, " "); + if (havecolors) { + (void) sprintf(buf, "%*s[%2d]%*s='", (int) strlen(name), + "colors", n, 8, " "); ep = buf + strlen(buf); for (j = 0; j <= width; j++) - ep[j] = ((win->_line[n].text[j] >> 8) & 0xff) + ' '; + ep[j] = CharOf(win->_line[n].text[j] >> 8) + ' '; ep[j] = '\''; - ep[j+1] = '\0'; + ep[j + 1] = '\0'; _tracef("%s", buf); } - for (i = 0; i < 4; i++) - { - const char *hex = " 123456789ABCDEF"; - chtype mask = (0xf << ((i + 4) * 4)); + for (i = 0; i < 4; i++) { + const char *hex = " 123456789ABCDEF"; + chtype mask = (0xf << ((i + 4) * 4)); haveattrs = FALSE; for (j = 0; j <= width; j++) - if (win->_line[n].text[j] & mask) - { + if (win->_line[n].text[j] & mask) { haveattrs = TRUE; break; } - if (haveattrs) - { - (void) sprintf(buf, "%*s%d[%2d]%*s='", (int)strlen(name)-1, "attrs", i, n, 8, " "); + if (haveattrs) { + (void) sprintf(buf, "%*s%d[%2d]%*s='", (int) strlen(name) - + 1, "attrs", i, n, 8, " "); ep = buf + strlen(buf); for (j = 0; j <= width; j++) ep[j] = hex[(win->_line[n].text[j] & mask) >> ((i + 4) * 4)]; ep[j] = '\''; - ep[j+1] = '\0'; + ep[j + 1] = '\0'; _tracef("%s", buf); } } } } #else -extern void _nc_lib_tracedmp(void); - void _nc_lib_tracedmp(void) { } +extern +NCURSES_EXPORT(void) +_nc_lib_tracedmp(void); +NCURSES_EXPORT(void) +_nc_lib_tracedmp(void) +{ +} #endif /* TRACE */ diff --git a/lib/libcurses/trace/lib_tracemse.c b/lib/libcurses/trace/lib_tracemse.c index a1b649f5c88..c92e4821eb0 100644 --- a/lib/libcurses/trace/lib_tracemse.c +++ b/lib/libcurses/trace/lib_tracemse.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_tracemse.c,v 1.1 1999/01/18 19:10:24 millert Exp $ */ +/* $OpenBSD: lib_tracemse.c,v 1.2 2001/01/22 18:01:58 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,65 +33,68 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* * lib_tracemse.c - Tracing/Debugging routines (mouse events) */ #include <curses.priv.h> -MODULE_ID("$From: lib_tracemse.c,v 1.6 1998/11/16 14:28:17 Alexander.V.Lukyanov Exp $") +MODULE_ID("$From: lib_tracemse.c,v 1.8 2000/12/10 03:02:45 tom Exp $") #ifdef TRACE -char *_tracemouse(MEVENT const *ep) +NCURSES_EXPORT(char *) +_tracemouse(MEVENT const *ep) { - static char buf[80]; + static char buf[80]; - (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {", - ep->id, ep->x, ep->y, ep->z, ep->bstate); + (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {", + ep->id, ep->x, ep->y, ep->z, ep->bstate); #define SHOW(m, s) if ((ep->bstate & m)==m) {strcat(buf,s); strcat(buf, ", ");} - SHOW(BUTTON1_RELEASED, "release-1") - SHOW(BUTTON1_PRESSED, "press-1") - SHOW(BUTTON1_CLICKED, "click-1") - SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1") - SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1") - SHOW(BUTTON1_RESERVED_EVENT, "reserved-1") - SHOW(BUTTON2_RELEASED, "release-2") - SHOW(BUTTON2_PRESSED, "press-2") - SHOW(BUTTON2_CLICKED, "click-2") - SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2") - SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2") - SHOW(BUTTON2_RESERVED_EVENT, "reserved-2") - SHOW(BUTTON3_RELEASED, "release-3") - SHOW(BUTTON3_PRESSED, "press-3") - SHOW(BUTTON3_CLICKED, "click-3") - SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3") - SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3") - SHOW(BUTTON3_RESERVED_EVENT, "reserved-3") - SHOW(BUTTON4_RELEASED, "release-4") - SHOW(BUTTON4_PRESSED, "press-4") - SHOW(BUTTON4_CLICKED, "click-4") - SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4") - SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4") - SHOW(BUTTON4_RESERVED_EVENT, "reserved-4") - SHOW(BUTTON_CTRL, "ctrl") - SHOW(BUTTON_SHIFT, "shift") - SHOW(BUTTON_ALT, "alt") - SHOW(ALL_MOUSE_EVENTS, "all-events") - SHOW(REPORT_MOUSE_POSITION, "position") + SHOW(BUTTON1_RELEASED, "release-1") + SHOW(BUTTON1_PRESSED, "press-1") + SHOW(BUTTON1_CLICKED, "click-1") + SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1") + SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1") + SHOW(BUTTON1_RESERVED_EVENT, "reserved-1") + SHOW(BUTTON2_RELEASED, "release-2") + SHOW(BUTTON2_PRESSED, "press-2") + SHOW(BUTTON2_CLICKED, "click-2") + SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2") + SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2") + SHOW(BUTTON2_RESERVED_EVENT, "reserved-2") + SHOW(BUTTON3_RELEASED, "release-3") + SHOW(BUTTON3_PRESSED, "press-3") + SHOW(BUTTON3_CLICKED, "click-3") + SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3") + SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3") + SHOW(BUTTON3_RESERVED_EVENT, "reserved-3") + SHOW(BUTTON4_RELEASED, "release-4") + SHOW(BUTTON4_PRESSED, "press-4") + SHOW(BUTTON4_CLICKED, "click-4") + SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4") + SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4") + SHOW(BUTTON4_RESERVED_EVENT, "reserved-4") + SHOW(BUTTON_CTRL, "ctrl") + SHOW(BUTTON_SHIFT, "shift") + SHOW(BUTTON_ALT, "alt") + SHOW(ALL_MOUSE_EVENTS, "all-events") + SHOW(REPORT_MOUSE_POSITION, "position") #undef SHOW - if (buf[strlen(buf)-1] == ' ') - buf[strlen(buf)-2] = '\0'; - (void) strcat(buf, "}"); - return(buf); + if (buf[strlen(buf) - 1] == ' ') + buf[strlen(buf) - 2] = '\0'; + (void) strcat(buf, "}"); + return (buf); } #else /* !TRACE */ /* don't make empty module */ -void _nc_lib_tracemouse(void); -void _nc_lib_tracemouse(void) {} +NCURSES_EXPORT(void) +_nc_lib_tracemouse(void); +NCURSES_EXPORT(void) +_nc_lib_tracemouse(void) +{ +} #endif diff --git a/lib/libcurses/trace/trace_buf.c b/lib/libcurses/trace/trace_buf.c index 4e0ed6ce21e..060ef5e686d 100644 --- a/lib/libcurses/trace/trace_buf.c +++ b/lib/libcurses/trace/trace_buf.c @@ -1,7 +1,7 @@ -/* $OpenBSD: trace_buf.c,v 1.2 1999/03/02 06:23:29 millert Exp $ */ +/* $OpenBSD: trace_buf.c,v 1.3 2001/01/22 18:01:58 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -37,46 +37,47 @@ #include <curses.priv.h> -MODULE_ID("$From: trace_buf.c,v 1.7 1999/02/27 19:50:58 tom Exp $") +MODULE_ID("$From: trace_buf.c,v 1.9 2000/12/10 03:02:45 tom Exp $") typedef struct { - char *text; - size_t size; + char *text; + size_t size; } LIST; -char * _nc_trace_buf(int bufnum, size_t want) +NCURSES_EXPORT(char *) +_nc_trace_buf(int bufnum, size_t want) { - static LIST *list; - static size_t have; + static LIST *list; + static size_t have; #if NO_LEAKS - if (bufnum < 0) { - if (have) { - while (have--) { - free(list[have].text); - } - free(list); - } - return 0; + if (bufnum < 0) { + if (have) { + while (have--) { + free(list[have].text); + } + free(list); } + return 0; + } #endif - if ((size_t)(bufnum+1) > have) { - size_t need = (bufnum + 1) * 2; - if ((list = typeRealloc(LIST, need, list)) == 0) - return(0); - while (need > have) - list[have++].text = 0; - } + if ((size_t) (bufnum + 1) > have) { + size_t need = (bufnum + 1) * 2; + if ((list = typeRealloc(LIST, need, list)) == 0) + return (0); + while (need > have) + list[have++].text = 0; + } - if (list[bufnum].text == 0 - || want > list[bufnum].size) - { - if ((list[bufnum].text = typeRealloc(char, want, list[bufnum].text)) != 0) - list[bufnum].size = want; - } + if (list[bufnum].text == 0 + || want > list[bufnum].size) { + if ((list[bufnum].text = typeRealloc(char, want, list[bufnum].text)) + != 0) + list[bufnum].size = want; + } - if (list[bufnum].text != 0) - *(list[bufnum].text) = '\0'; - return list[bufnum].text; + if (list[bufnum].text != 0) + *(list[bufnum].text) = '\0'; + return list[bufnum].text; } diff --git a/lib/libcurses/trace/trace_tries.c b/lib/libcurses/trace/trace_tries.c index effb7378d6c..d0dd538d9be 100644 --- a/lib/libcurses/trace/trace_tries.c +++ b/lib/libcurses/trace/trace_tries.c @@ -1,7 +1,7 @@ -/* $OpenBSD: trace_tries.c,v 1.3 1999/03/11 21:03:58 millert Exp $ */ +/* $OpenBSD: trace_tries.c,v 1.4 2001/01/22 18:01:59 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 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 * @@ -37,40 +37,45 @@ #include <curses.priv.h> -MODULE_ID("$From: trace_tries.c,v 1.6 1999/03/06 22:51:07 tom Exp $") +MODULE_ID("$From: trace_tries.c,v 1.8 2000/12/10 03:03:51 tom Exp $") #ifdef TRACE static unsigned char *buffer; static unsigned len; -static void recur_tries(struct tries *tree, unsigned level) +static void +recur_tries(struct tries *tree, unsigned level) { - if (level > len) - buffer = (unsigned char *)realloc(buffer, len = (level + 1) * 4); + if (level > len) + buffer = (unsigned char *) realloc(buffer, len = (level + 1) * 4); - while (tree != 0) { - if ((buffer[level] = tree->ch) == 0) - buffer[level] = 128; - buffer[level+1] = 0; - if (tree->value != 0) { - _tracef("%5d: %s (%s)", tree->value, _nc_visbuf((char *)buffer), keyname(tree->value)); - } - if (tree->child) - recur_tries(tree->child, level+1); - tree = tree->sibling; + while (tree != 0) { + if ((buffer[level] = tree->ch) == 0) + buffer[level] = 128; + buffer[level + 1] = 0; + if (tree->value != 0) { + _tracef("%5d: %s (%s)", tree->value, + _nc_visbuf((char *) buffer), keyname(tree->value)); } + if (tree->child) + recur_tries(tree->child, level + 1); + tree = tree->sibling; + } } -void _nc_trace_tries(struct tries *tree) +NCURSES_EXPORT(void) +_nc_trace_tries(struct tries *tree) { - buffer = typeMalloc(unsigned char, len = 80); - _tracef("BEGIN tries %p", tree); - recur_tries(tree, 0); - _tracef(". . . tries %p", tree); - free(buffer); + buffer = typeMalloc(unsigned char, len = 80); + _tracef("BEGIN tries %p", tree); + recur_tries(tree, 0); + _tracef(". . . tries %p", tree); + free(buffer); } + #else -void _nc_trace_tries(struct tries *tree GCC_UNUSED) +NCURSES_EXPORT(void) +_nc_trace_tries(struct tries *tree GCC_UNUSED) { } #endif diff --git a/lib/libcurses/trace/trace_xnames.c b/lib/libcurses/trace/trace_xnames.c index a7fa1cbfb65..22dc761419f 100644 --- a/lib/libcurses/trace/trace_xnames.c +++ b/lib/libcurses/trace/trace_xnames.c @@ -1,7 +1,7 @@ -/* $OpenBSD: trace_xnames.c,v 1.2 1999/05/08 20:29:02 millert Exp $ */ +/* $OpenBSD: trace_xnames.c,v 1.3 2001/01/22 18:01:59 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 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,9 +38,10 @@ #include <curses.priv.h> #include <term_entry.h> -MODULE_ID("$From: trace_xnames.c,v 1.3 1999/03/02 01:20:38 tom Exp $") +MODULE_ID("$From: trace_xnames.c,v 1.5 2000/12/10 03:02:45 tom Exp $") -void _nc_trace_xnames(TERMTYPE *tp GCC_UNUSED) +NCURSES_EXPORT(void) +_nc_trace_xnames(TERMTYPE * tp GCC_UNUSED) { #ifdef TRACE #if NCURSES_XNAMES @@ -58,16 +59,16 @@ void _nc_trace_xnames(TERMTYPE *tp GCC_UNUSED) for (n = 0; n < limit; n++) { if ((m = n - begin_str) >= 0) { _tracef("[%d] %s = %s", n, - tp->ext_Names[n], - _nc_visbuf(tp->Strings[tp->num_Strings + m - tp->ext_Strings])); + tp->ext_Names[n], + _nc_visbuf(tp->Strings[tp->num_Strings + m - tp->ext_Strings])); } else if ((m = n - begin_num) >= 0) { _tracef("[%d] %s = %d (num)", n, - tp->ext_Names[n], - tp->Numbers[tp->num_Numbers + m - tp->ext_Numbers]); + tp->ext_Names[n], + tp->Numbers[tp->num_Numbers + m - tp->ext_Numbers]); } else { _tracef("[%d] %s = %d (bool)", n, - tp->ext_Names[n], - tp->Booleans[tp->num_Booleans + n - tp->ext_Booleans]); + tp->ext_Names[n], + tp->Booleans[tp->num_Booleans + n - tp->ext_Booleans]); } } } diff --git a/lib/libcurses/tty/MKexpanded.sh b/lib/libcurses/tty/MKexpanded.sh index 2c4ef80d427..c9de5292ec3 100644 --- a/lib/libcurses/tty/MKexpanded.sh +++ b/lib/libcurses/tty/MKexpanded.sh @@ -29,8 +29,8 @@ # # Author: Thomas E. Dickey <dickey@clark.net> 1997 # -# $OpenBSD: MKexpanded.sh,v 1.2 2000/10/08 22:47:04 millert Exp $ -# $From: MKexpanded.sh,v 1.9 2000/09/02 22:55:21 tom Exp $ +# $OpenBSD: MKexpanded.sh,v 1.3 2001/01/22 18:01:59 millert Exp $ +# $From: MKexpanded.sh,v 1.10 2000/12/10 00:24:33 tom Exp $ # # Script to generate 'expanded.c', a dummy source that contains functions # corresponding to complex macros used in this library. By making functions, @@ -69,23 +69,23 @@ cat >$TMP <<EOF #undef FALSE /* this is a marker */ IGNORE -void _nc_toggle_attr_on(attr_t *S, attr_t at) +NCURSES_EXPORT(void) _nc_toggle_attr_on (attr_t *S, attr_t at) { toggle_attr_on(*S,at); } -void _nc_toggle_attr_off(attr_t *S, attr_t at) +NCURSES_EXPORT(void) _nc_toggle_attr_off (attr_t *S, attr_t at) { toggle_attr_off(*S,at); } -int _nc_DelCharCost(int count) +NCURSES_EXPORT(int) _nc_DelCharCost (int count) { return DelCharCost(count); } -int _nc_InsCharCost(int count) +NCURSES_EXPORT(int) _nc_InsCharCost (int count) { return InsCharCost(count); } -void _nc_UpdateAttrs(chtype c) +NCURSES_EXPORT(void) _nc_UpdateAttrs (chtype c) { UpdateAttrs(c); } @@ -95,6 +95,6 @@ $preprocessor $TMP 2>/dev/null | sed -e '1,/^IGNORE$/d' cat <<EOF #else /* ! NCURSES_EXPANDED */ -void _nc_expanded(void) { } +NCURSES_EXPORT(void) _nc_expanded (void) { } #endif /* NCURSES_EXPANDED */ EOF diff --git a/lib/libcurses/tty/hardscroll.c b/lib/libcurses/tty/hardscroll.c index 2c88ed1f829..7673cffa9c3 100644 --- a/lib/libcurses/tty/hardscroll.c +++ b/lib/libcurses/tty/hardscroll.c @@ -1,7 +1,7 @@ -/* $OpenBSD: hardscroll.c,v 1.2 1999/03/02 06:23:30 millert Exp $ */ +/* $OpenBSD: hardscroll.c,v 1.3 2001/01/22 18:01:59 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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> * ****************************************************************************/ - /****************************************************************************** NAME @@ -148,13 +147,14 @@ AUTHOR #include <curses.priv.h> -MODULE_ID("$From: hardscroll.c,v 1.33 1999/02/27 20:01:29 tom Exp $") +MODULE_ID("$From: hardscroll.c,v 1.36 2001/01/14 00:17:28 tom Exp $") #if defined(SCROLLDEBUG) || defined(HASHDEBUG) # undef screen_lines # define screen_lines MAXLINES -int oldnums[MAXLINES]; +NCURSES_EXPORT_VAR(int) +oldnums[MAXLINES]; # define OLDNUM(n) oldnums[n] # define _tracef printf # undef TR @@ -165,19 +165,21 @@ int oldnums[MAXLINES]; /* OLDNUM(n) indicates which line will be shifted to the position n. if OLDNUM(n) == _NEWINDEX, then the line n in new, not shifted from somewhere. */ +NCURSES_EXPORT_VAR(int *) +_nc_oldnums = 0; + # if USE_HASHMAP -int *_nc_oldnums = 0; -static int oldnums_allocated = 0; + static int oldnums_allocated = 0; # define oldnums _nc_oldnums # define OLDNUM(n) oldnums[n] -# else /* !USE_HASHMAP */ +# else /* !USE_HASHMAP */ # define OLDNUM(n) newscr->_line[n].oldindex -# endif /* !USE_HASHMAP */ +# endif /* !USE_HASHMAP */ #endif /* defined(SCROLLDEBUG) || defined(HASHDEBUG) */ - -void _nc_scroll_optimize(void) +NCURSES_EXPORT(void) +_nc_scroll_optimize(void) /* scroll optimization to transform curscr to newscr */ { int i; @@ -188,8 +190,7 @@ void _nc_scroll_optimize(void) #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) #if USE_HASHMAP /* get enough storage */ - if (oldnums_allocated < screen_lines) - { + if (oldnums_allocated < screen_lines) { int *new_oldnums = typeRealloc(int, screen_lines, oldnums); if (!new_oldnums) return; @@ -207,25 +208,24 @@ void _nc_scroll_optimize(void) #endif /* TRACE */ /* pass 1 - from top to bottom scrolling up */ - for (i = 0; i < screen_lines; ) - { + for (i = 0; i < screen_lines;) { while (i < screen_lines && (OLDNUM(i) == _NEWINDEX || OLDNUM(i) <= i)) i++; if (i >= screen_lines) break; - shift = OLDNUM(i) - i; /* shift > 0 */ + shift = OLDNUM(i) - i; /* shift > 0 */ start = i; i++; - while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) + while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i + == shift) i++; - end = i-1 + shift; + end = i - 1 + shift; TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", start, end, shift)); #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) - if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) - { + if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) { TR(TRACE_UPDATE | TRACE_MOVE, ("unable to scroll")); continue; } @@ -233,25 +233,23 @@ void _nc_scroll_optimize(void) } /* pass 2 - from bottom to top scrolling down */ - for (i = screen_lines-1; i >= 0; ) - { + for (i = screen_lines - 1; i >= 0;) { while (i >= 0 && (OLDNUM(i) == _NEWINDEX || OLDNUM(i) >= i)) i--; if (i < 0) break; - shift = OLDNUM(i) - i; /* shift < 0 */ + shift = OLDNUM(i) - i; /* shift < 0 */ end = i; i--; while (i >= 0 && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) i--; - start = i+1 - (-shift); + start = i + 1 - (-shift); TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", start, end, shift)); #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) - if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) - { + if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) { TR(TRACE_UPDATE | TRACE_MOVE, ("unable to scroll")); continue; } @@ -260,14 +258,15 @@ void _nc_scroll_optimize(void) } #if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG) -void _nc_linedump(void) +NCURSES_EXPORT(void) +_nc_linedump(void) /* dump the state of the real and virtual oldnum fields */ { static size_t have; static char *buf; - int n; - size_t want = (screen_lines + 1) * 4; + int n; + size_t want = (screen_lines + 1) * 4; if (have < want) buf = typeMalloc(char, have = want); @@ -286,28 +285,26 @@ void _nc_linedump(void) #ifdef SCROLLDEBUG int -main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - char line[BUFSIZ], *st; + char line[BUFSIZ], *st; #ifdef TRACE _nc_tracing = TRACE_MOVE; #endif - for (;;) - { - int n; + for (;;) { + int n; for (n = 0; n < screen_lines; n++) oldnums[n] = _NEWINDEX; /* grab the test vector */ - if (fgets(line, sizeof(line), stdin) == (char *)NULL) + if (fgets(line, sizeof(line), stdin) == (char *) NULL) exit(EXIT_SUCCESS); /* parse it */ n = 0; - if (line[0] == '#') - { + if (line[0] == '#') { (void) fputs(line, stderr); continue; } @@ -315,7 +312,7 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) do { oldnums[n++] = atoi(st); } while - ((st = strtok((char *)NULL, " ")) != 0); + ((st = strtok((char *) NULL, " ")) != 0); /* display it */ (void) fputs("Initial input:\n", stderr); diff --git a/lib/libcurses/tty/hashmap.c b/lib/libcurses/tty/hashmap.c index a2442f97c1a..c57e36527cd 100644 --- a/lib/libcurses/tty/hashmap.c +++ b/lib/libcurses/tty/hashmap.c @@ -1,7 +1,7 @@ -/* $OpenBSD: hashmap.c,v 1.5 1999/11/28 17:49:54 millert Exp $ */ +/* $OpenBSD: hashmap.c,v 1.6 2001/01/22 18:01:59 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -70,9 +70,9 @@ AUTHOR *****************************************************************************/ #include <curses.priv.h> -#include <term.h> /* for back_color_erase */ +#include <term.h> /* for back_color_erase */ -MODULE_ID("$From: hashmap.c,v 1.34 1999/11/28 00:10:57 tom Exp $") +MODULE_ID("$From: hashmap.c,v 1.36 2000/12/10 03:04:30 tom Exp $") #ifdef HASHDEBUG @@ -102,41 +102,43 @@ static chtype oldtext[MAXLINES][TEXTWIDTH], newtext[MAXLINES][TEXTWIDTH]; #define oldhash (SP->oldhash) #define newhash (SP->newhash) -static inline unsigned long hash(chtype *text) +static inline unsigned long +hash(chtype * text) { int i; chtype ch; unsigned long result = 0; - for (i = TEXTWIDTH; i>0; i--) - { + for (i = TEXTWIDTH; i > 0; i--) { ch = *text++; - result += (result<<5) + ch; + result += (result << 5) + ch; } return result; } /* approximate update cost */ -static int update_cost(chtype *from,chtype *to) +static int +update_cost(chtype * from, chtype * to) { - int cost=0; + int cost = 0; int i; - for (i=TEXTWIDTH; i>0; i--) + for (i = TEXTWIDTH; i > 0; i--) if (*from++ != *to++) cost++; return cost; } -static int update_cost_from_blank(chtype *to) +static int +update_cost_from_blank(chtype * to) { - int cost=0; + int cost = 0; int i; chtype blank = BLANK; if (back_color_erase) blank |= (stdscr->_bkgd & A_COLOR); - for (i=TEXTWIDTH; i>0; i--) + for (i = TEXTWIDTH; i > 0; i--) if (blank != *to++) cost++; @@ -147,7 +149,8 @@ static int update_cost_from_blank(chtype *to) * Returns true when moving line 'from' to line 'to' seems to be cost * effective. 'blank' indicates whether the line 'to' would become blank. */ -static inline bool cost_effective(const int from, const int to, const bool blank) +static inline bool +cost_effective(const int from, const int to, const bool blank) { int new_from; @@ -163,30 +166,28 @@ static inline bool cost_effective(const int from, const int to, const bool blank * on the right side -- cost after moving. */ return (((blank ? update_cost_from_blank(NEWTEXT(to)) - : update_cost(OLDTEXT(to),NEWTEXT(to))) - + update_cost(OLDTEXT(new_from),NEWTEXT(from))) - >= ((new_from==from ? update_cost_from_blank(NEWTEXT(from)) - : update_cost(OLDTEXT(new_from),NEWTEXT(from))) - + update_cost(OLDTEXT(from),NEWTEXT(to)))) ? TRUE : FALSE; + : update_cost(OLDTEXT(to), NEWTEXT(to))) + + update_cost(OLDTEXT(new_from), NEWTEXT(from))) + >= ((new_from == from ? update_cost_from_blank(NEWTEXT(from)) + : update_cost(OLDTEXT(new_from), NEWTEXT(from))) + + update_cost(OLDTEXT(from), NEWTEXT(to)))) ? TRUE : FALSE; } +typedef struct { + unsigned long hashval; + int oldcount, newcount; + int oldindex, newindex; +} sym; -typedef struct -{ - unsigned long hashval; - int oldcount, newcount; - int oldindex, newindex; -} - sym; - -static sym *hashtab=0; -static int lines_alloc=0; +static sym *hashtab = 0; +static int lines_alloc = 0; -static void grow_hunks(void) +static void +grow_hunks(void) { int start, end, shift; - int back_limit, forward_limit; /* limits for cells to fill */ - int back_ref_limit, forward_ref_limit; /* limits for refrences */ + int back_limit, forward_limit; /* limits for cells to fill */ + int back_ref_limit, forward_ref_limit; /* limits for refrences */ int i; int next_hunk; @@ -200,14 +201,14 @@ static void grow_hunks(void) i = 0; while (i < screen_lines && OLDNUM(i) == _NEWINDEX) i++; - for ( ; i < screen_lines; i=next_hunk) - { + for (; i < screen_lines; i = next_hunk) { start = i; shift = OLDNUM(i) - i; /* get forward limit */ - i = start+1; - while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) + i = start + 1; + while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i + == shift) i++; end = i; while (i < screen_lines && OLDNUM(i) == _NEWINDEX) @@ -219,25 +220,21 @@ static void grow_hunks(void) else forward_ref_limit = OLDNUM(i); - i = start-1; + i = start - 1; /* grow back */ if (shift < 0) back_limit = back_ref_limit + (-shift); - while (i >= back_limit) - { - if(newhash[i] == oldhash[i+shift] - || cost_effective(i+shift, i, shift<0)) - { - OLDNUM(i) = i+shift; + while (i >= back_limit) { + if (newhash[i] == oldhash[i + shift] + || cost_effective(i + shift, i, shift < 0)) { + OLDNUM(i) = i + shift; TR(TRACE_UPDATE | TRACE_MOVE, ("connected new line %d to old line %d (backward continuation)", - i, i+shift)); - } - else - { + i, i + shift)); + } else { TR(TRACE_UPDATE | TRACE_MOVE, ("not connecting new line %d to old line %d (backward continuation)", - i, i+shift)); + i, i + shift)); break; } i--; @@ -247,21 +244,17 @@ static void grow_hunks(void) /* grow forward */ if (shift > 0) forward_limit = forward_ref_limit - shift; - while (i < forward_limit) - { - if(newhash[i] == oldhash[i+shift] - || cost_effective(i+shift, i, shift>0)) - { - OLDNUM(i) = i+shift; + while (i < forward_limit) { + if (newhash[i] == oldhash[i + shift] + || cost_effective(i + shift, i, shift > 0)) { + OLDNUM(i) = i + shift; TR(TRACE_UPDATE | TRACE_MOVE, ("connected new line %d to old line %d (forward continuation)", - i, i+shift)); - } - else - { + i, i + shift)); + } else { TR(TRACE_UPDATE | TRACE_MOVE, ("not connecting new line %d to old line %d (forward continuation)", - i, i+shift)); + i, i + shift)); break; } i++; @@ -273,22 +266,19 @@ static void grow_hunks(void) } } -void _nc_hash_map(void) +NCURSES_EXPORT(void) +_nc_hash_map(void) { sym *sp; register int i; int start, shift, size; - - if (screen_lines > lines_alloc) - { + if (screen_lines > lines_alloc) { if (hashtab) - free (hashtab); - hashtab = typeMalloc(sym, (screen_lines+1)*2); - if (!hashtab) - { - if (oldhash) - { + free(hashtab); + hashtab = typeMalloc(sym, (screen_lines + 1) * 2); + if (!hashtab) { + if (oldhash) { FreeAndNull(oldhash); } lines_alloc = 0; @@ -297,47 +287,40 @@ void _nc_hash_map(void) lines_alloc = screen_lines; } - if (oldhash && newhash) - { + if (oldhash && newhash) { /* re-hash only changed lines */ - for (i = 0; i < screen_lines; i++) - { + for (i = 0; i < screen_lines; i++) { if (PENDING(i)) newhash[i] = hash(NEWTEXT(i)); } - } - else - { + } else { /* re-hash all */ if (oldhash == 0) - oldhash = typeCalloc (unsigned long, screen_lines); + oldhash = typeCalloc(unsigned long, screen_lines); if (newhash == 0) - newhash = typeCalloc (unsigned long, screen_lines); + newhash = typeCalloc(unsigned long, screen_lines); if (!oldhash || !newhash) - return; /* malloc failure */ - for (i = 0; i < screen_lines; i++) - { + return; /* malloc failure */ + for (i = 0; i < screen_lines; i++) { newhash[i] = hash(NEWTEXT(i)); oldhash[i] = hash(OLDTEXT(i)); } } #ifdef HASH_VERIFY - for (i = 0; i < screen_lines; i++) - { - if(newhash[i] != hash(NEWTEXT(i))) - fprintf(stderr,"error in newhash[%d]\n",i); - if(oldhash[i] != hash(OLDTEXT(i))) - fprintf(stderr,"error in oldhash[%d]\n",i); + for (i = 0; i < screen_lines; i++) { + if (newhash[i] != hash(NEWTEXT(i))) + fprintf(stderr, "error in newhash[%d]\n", i); + if (oldhash[i] != hash(OLDTEXT(i))) + fprintf(stderr, "error in oldhash[%d]\n", i); } #endif /* * Set up and count line-hash values. */ - memset(hashtab, '\0', sizeof(*hashtab)*(screen_lines+1)*2); - for (i = 0; i < screen_lines; i++) - { + memset(hashtab, '\0', sizeof(*hashtab) * (screen_lines + 1) * 2); + for (i = 0; i < screen_lines; i++) { unsigned long hashval = oldhash[i]; for (sp = hashtab; sp->hashval; sp++) @@ -347,8 +330,7 @@ void _nc_hash_map(void) sp->oldcount++; sp->oldindex = i; } - for (i = 0; i < screen_lines; i++) - { + for (i = 0; i < screen_lines; i++) { unsigned long hashval = newhash[i]; for (sp = hashtab; sp->hashval; sp++) @@ -370,11 +352,10 @@ void _nc_hash_map(void) */ for (sp = hashtab; sp->hashval; sp++) if (sp->oldcount == 1 && sp->newcount == 1 - && sp->oldindex != sp->newindex) - { + && sp->oldindex != sp->newindex) { TR(TRACE_UPDATE | TRACE_MOVE, ("new line %d is hash-identical to old line %d (unique)", - sp->newindex, sp->oldindex)); + sp->newindex, sp->oldindex)); OLDNUM(sp->newindex) = sp->oldindex; } @@ -386,8 +367,7 @@ void _nc_hash_map(void) * those which are to be moved too far, they are likely to destroy * more than carry. */ - for (i = 0; i < screen_lines; ) - { + for (i = 0; i < screen_lines;) { while (i < screen_lines && OLDNUM(i) == _NEWINDEX) i++; if (i >= screen_lines) @@ -395,13 +375,12 @@ void _nc_hash_map(void) start = i; shift = OLDNUM(i) - i; i++; - while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) + while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i + == shift) i++; size = i - start; - if (size < 3 || size+min(size/8,2) < abs(shift)) - { - while (start < i) - { + if (size < 3 || size + min(size / 8, 2) < abs(shift)) { + while (start < i) { OLDNUM(start) = _NEWINDEX; start++; } @@ -417,13 +396,15 @@ void _nc_hash_map(void) #endif } -void _nc_make_oldhash(int i) +NCURSES_EXPORT(void) +_nc_make_oldhash(int i) { if (oldhash) oldhash[i] = hash(OLDTEXT(i)); } -void _nc_scroll_oldhash(int n, int top, int bot) +NCURSES_EXPORT(void) +_nc_scroll_oldhash(int n, int top, int bot) { int size; int i; @@ -431,27 +412,24 @@ void _nc_scroll_oldhash(int n, int top, int bot) if (!oldhash) return; - size = sizeof(*oldhash) * (bot-top+1-abs(n)); - if (n > 0) - { - memmove (oldhash+top, oldhash+top+n, size); - for (i = bot; i > bot-n; i--) + size = sizeof(*oldhash) * (bot - top + 1 - abs(n)); + if (n > 0) { + memmove(oldhash + top, oldhash + top + n, size); + for (i = bot; i > bot - n; i--) oldhash[i] = hash(OLDTEXT(i)); - } - else - { - memmove (oldhash+top-n, oldhash+top, size); - for (i = top; i < top-n; i++) + } else { + memmove(oldhash + top - n, oldhash + top, size); + for (i = top; i < top - n; i++) oldhash[i] = hash(OLDTEXT(i)); } } - #ifdef HASHDEBUG static void usage(void) { - static const char *table[] = { + static const char *table[] = + { "hashmap test-driver", "", "# comment", @@ -463,19 +441,18 @@ usage(void) "? this message" }; size_t n; - for (n = 0; n < sizeof(table)/sizeof(table[0]); n++) + for (n = 0; n < sizeof(table) / sizeof(table[0]); n++) fprintf(stderr, "%s\n", table[n]); } int -main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - char line[BUFSIZ], *st; - int n; + char line[BUFSIZ], *st; + int n; - SP = typeCalloc(SCREEN,1); - for (n = 0; n < screen_lines; n++) - { + SP = typeCalloc(SCREEN, 1); + for (n = 0; n < screen_lines; n++) { reallines[n] = n; oldnums[n] = _NEWINDEX; oldtext[n][0] = newtext[n][0] = '.'; @@ -487,21 +464,18 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) #ifdef TRACE _nc_tracing = TRACE_MOVE; #endif - for (;;) - { + for (;;) { /* grab a test command */ - if (fgets(line, sizeof(line), stdin) == (char *)NULL) + if (fgets(line, sizeof(line), stdin) == (char *) NULL) exit(EXIT_SUCCESS); - switch(line[0]) - { - case '#': /* comment */ + switch (line[0]) { + case '#': /* comment */ (void) fputs(line, stderr); break; - case 'l': /* get initial line number vector */ - for (n = 0; n < screen_lines; n++) - { + case 'l': /* get initial line number vector */ + for (n = 0; n < screen_lines; n++) { reallines[n] = n; oldnums[n] = _NEWINDEX; } @@ -510,30 +484,30 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) do { oldnums[n++] = atoi(st); } while - ((st = strtok((char *)NULL, " ")) != 0); + ((st = strtok((char *) NULL, " ")) != 0); break; - case 'n': /* use following letters as text of new lines */ + case 'n': /* use following letters as text of new lines */ for (n = 0; n < screen_lines; n++) newtext[n][0] = '.'; for (n = 0; n < screen_lines; n++) - if (line[n+1] == '\n') + if (line[n + 1] == '\n') break; else - newtext[n][0] = line[n+1]; + newtext[n][0] = line[n + 1]; break; - case 'o': /* use following letters as text of old lines */ + case 'o': /* use following letters as text of old lines */ for (n = 0; n < screen_lines; n++) oldtext[n][0] = '.'; for (n = 0; n < screen_lines; n++) - if (line[n+1] == '\n') + if (line[n + 1] == '\n') break; else - oldtext[n][0] = line[n+1]; + oldtext[n][0] = line[n + 1]; break; - case 'd': /* dump state of test arrays */ + case 'd': /* dump state of test arrays */ #ifdef TRACE _nc_linedump(); #endif @@ -549,7 +523,7 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) putchar('\n'); break; - case 'h': /* apply hash mapper and see scroll optimization */ + case 'h': /* apply hash mapper and see scroll optimization */ _nc_hash_map(); (void) fputs("Result:\n", stderr); #ifdef TRACE diff --git a/lib/libcurses/tty/lib_mvcur.c b/lib/libcurses/tty/lib_mvcur.c index 0c72f2b5c96..45b0a2b7178 100644 --- a/lib/libcurses/tty/lib_mvcur.c +++ b/lib/libcurses/tty/lib_mvcur.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_mvcur.c,v 1.9 2000/10/08 22:47:04 millert Exp $ */ +/* $OpenBSD: lib_mvcur.c,v 1.10 2001/01/22 18:02:00 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -154,7 +154,7 @@ #include <term.h> #include <ctype.h> -MODULE_ID("$From: lib_mvcur.c,v 1.72 2000/10/08 00:58:25 tom Exp $") +MODULE_ID("$From: lib_mvcur.c,v 1.77 2000/12/10 03:04:30 tom Exp $") #define CURRENT_ROW SP->_cursrow /* phys cursor row */ #define CURRENT_COLUMN SP->_curscol /* phys cursor column */ @@ -208,8 +208,9 @@ trace_normalized_cost(const char *capname, const char *cap, int affcnt) #endif -int -_nc_msec_cost(const char *const cap, int affcnt) +NCURSES_EXPORT(int) +_nc_msec_cost +(const char *const cap, int affcnt) /* compute the cost of a given operation */ { if (cap == 0) @@ -224,11 +225,11 @@ _nc_msec_cost(const char *const cap, int affcnt) float number = 0.0; for (cp += 2; *cp != '>'; cp++) { - if (isdigit(*cp)) + if (isdigit(CharOf(*cp))) number = number * 10 + (*cp - '0'); else if (*cp == '*') number *= affcnt; - else if (*cp == '.' && (*++cp != '>') && isdigit(*cp)) + else if (*cp == '.' && (*++cp != '>') && isdigit(CharOf(*cp))) number += (*cp - '0') / 10.0; } @@ -264,7 +265,7 @@ reset_scroll_region(void) } } -void +NCURSES_EXPORT(void) _nc_mvcur_resume(void) /* what to do at initialization time and after each shellout */ { @@ -294,7 +295,7 @@ _nc_mvcur_resume(void) } } -void +NCURSES_EXPORT(void) _nc_mvcur_init(void) /* initialize the cost structure */ { @@ -408,7 +409,7 @@ _nc_mvcur_init(void) _nc_mvcur_resume(); } -void +NCURSES_EXPORT(void) _nc_mvcur_wrap(void) /* wrap up cursor-addressing mode */ { @@ -571,6 +572,8 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int #endif /* USE_HARD_TABS */ #if defined(REAL_ATTR) && defined(WANT_CHAR) + if (n <= 0 || n >= (int) check.s_size) + ovw = FALSE; #if BSD_TPUTS /* * If we're allowing BSD-style padding in tputs, don't generate @@ -828,8 +831,9 @@ onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw) return (ERR); } -int -mvcur(int yold, int xold, int ynew, int xnew) +NCURSES_EXPORT(int) +mvcur +(int yold, int xold, int ynew, int xnew) /* optimized cursor move from (yold, xold) to (ynew, xnew) */ { TR(TRACE_MOVE, ("mvcur(%d,%d,%d,%d) called", yold, xold, ynew, xnew)); @@ -883,7 +887,7 @@ mvcur(int yold, int xold, int ynew, int xnew) } #if defined(TRACE) || defined(NCURSES_TEST) -int _nc_optimize_enable = OPTIMIZE_ALL; +NCURSES_EXPORT_VAR(int) _nc_optimize_enable = OPTIMIZE_ALL; #endif #if defined(MAIN) || defined(NCURSES_TEST) @@ -896,13 +900,15 @@ int _nc_optimize_enable = OPTIMIZE_ALL; #include <tic.h> #include <dump_entry.h> -const char *_nc_progname = "mvcur"; +NCURSES_EXPORT_VAR(const char *) +_nc_progname = "mvcur"; -static unsigned long xmits; + static unsigned long xmits; /* these override lib_tputs.c */ -int -tputs(const char *string, int affcnt GCC_UNUSED, int (*outc) (int) GCC_UNUSED) +NCURSES_EXPORT(int) +tputs +(const char *string, int affcnt GCC_UNUSED, int (*outc) (int) GCC_UNUSED) /* stub tputs() that dumps sequences in a visible form */ { if (profiling) @@ -912,24 +918,25 @@ tputs(const char *string, int affcnt GCC_UNUSED, int (*outc) (int) GCC_UNUSED) return (OK); } -int +NCURSES_EXPORT(int) putp(const char *string) { return (tputs(string, 1, _nc_outch)); } -int +NCURSES_EXPORT(int) _nc_outch(int ch) { putc(ch, stdout); return OK; } -char PC = 0; /* used by termcap library */ -short ospeed = 0; /* used by termcap library */ -int _nc_nulls_sent = 0; /* used by 'tack' program */ +NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */ +NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ +NCURSES_EXPORT_VAR(int) +_nc_nulls_sent = 0; /* used by 'tack' program */ -int +NCURSES_EXPORT(int) delay_output(int ms GCC_UNUSED) { return OK; diff --git a/lib/libcurses/tty/lib_tstp.c b/lib/libcurses/tty/lib_tstp.c index e3f0e36e372..23e99cf453e 100644 --- a/lib/libcurses/tty/lib_tstp.c +++ b/lib/libcurses/tty/lib_tstp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_tstp.c,v 1.7 2000/10/08 22:47:05 millert Exp $ */ +/* $OpenBSD: lib_tstp.c,v 1.8 2001/01/22 18:02:00 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -49,7 +49,7 @@ #define _POSIX_SOURCE #endif -MODULE_ID("$From: lib_tstp.c,v 1.22 2000/09/02 18:33:17 tom Exp $") +MODULE_ID("$From: lib_tstp.c,v 1.24 2000/12/10 03:04:30 tom Exp $") #if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC) #define USE_SIGTSTP 1 @@ -306,7 +306,7 @@ CatchIfDefault(int sig, RETSIGTYPE(*handler) (int)) * The XSI document implies that we shouldn't keep the SIGTSTP handler if * the caller later changes its mind, but that doesn't seem correct. */ -void +NCURSES_EXPORT(void) _nc_signal_handler(bool enable) { #if USE_SIGTSTP /* Xenix 2.x doesn't have SIGTSTP, for example */ diff --git a/lib/libcurses/tty/lib_twait.c b/lib/libcurses/tty/lib_twait.c index f882f915b71..0b7c4d2949b 100644 --- a/lib/libcurses/tty/lib_twait.c +++ b/lib/libcurses/tty/lib_twait.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_twait.c,v 1.7 2000/10/10 15:10:32 millert Exp $ */ +/* $OpenBSD: lib_twait.c,v 1.8 2001/01/22 18:02:00 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -61,7 +61,7 @@ # endif #endif -MODULE_ID("$From: lib_twait.c,v 1.39 2000/08/26 19:34:15 tom Exp $") +MODULE_ID("$From: lib_twait.c,v 1.41 2000/12/10 03:04:30 tom Exp $") static long _nc_gettime(bool first) @@ -104,8 +104,9 @@ _nc_gettime(bool first) * If the milliseconds given are -1, the wait blocks until activity on the * descriptors. */ -int -_nc_timed_wait(int mode, int milliseconds, int *timeleft) +NCURSES_EXPORT(int) +_nc_timed_wait +(int mode, int milliseconds, int *timeleft) { int fd; int count; diff --git a/lib/libcurses/tty/lib_vidattr.c b/lib/libcurses/tty/lib_vidattr.c index e9639a730c6..4a5c9354b72 100644 --- a/lib/libcurses/tty/lib_vidattr.c +++ b/lib/libcurses/tty/lib_vidattr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_vidattr.c,v 1.7 2000/10/22 18:27:24 millert Exp $ */ +/* $OpenBSD: lib_vidattr.c,v 1.8 2001/01/22 18:02:00 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -66,7 +66,7 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: lib_vidattr.c,v 1.33 2000/10/09 22:45:29 tom Exp $") +MODULE_ID("$From: lib_vidattr.c,v 1.36 2000/12/10 03:05:48 tom Exp $") #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -88,8 +88,9 @@ MODULE_ID("$From: lib_vidattr.c,v 1.33 2000/10/09 22:45:29 tom Exp $") } \ } -int -vidputs(attr_t newmode, int (*outc) (int)) +NCURSES_EXPORT(int) +vidputs +(attr_t newmode, int (*outc) (int)) { static attr_t previous_attr = A_NORMAL; attr_t turn_on, turn_off; @@ -136,11 +137,13 @@ vidputs(attr_t newmode, int (*outc) (int)) * A_ALTCHARSET (256) down 2 to line up. We use the NCURSES_BITS * macro so this will work properly for the wide-character layout. */ - attr_t mask = NCURSES_BITS((no_color_video & 63) - | ((no_color_video & 192) << 1) - | ((no_color_video & 256) >> 2), 8); + unsigned value = no_color_video; + attr_t mask = NCURSES_BITS((value & 63) + | ((value & 192) << 1) + | ((value & 256) >> 2), 8); - if (mask & A_REVERSE && newmode & A_REVERSE) { + if ((mask & A_REVERSE) != 0 + && (newmode & A_REVERSE) != 0) { reverse = TRUE; mask &= ~A_REVERSE; } @@ -250,7 +253,7 @@ vidputs(attr_t newmode, int (*outc) (int)) returnCode(OK); } -int +NCURSES_EXPORT(int) vidattr(attr_t newmode) { T((T_CALLED("vidattr(%s)"), _traceattr(newmode))); @@ -258,7 +261,7 @@ vidattr(attr_t newmode) returnCode(vidputs(newmode, _nc_outch)); } -chtype +NCURSES_EXPORT(chtype) termattrs(void) { chtype attrs = A_NORMAL; diff --git a/lib/libcurses/tty/tty_display.h b/lib/libcurses/tty/tty_display.h index 198843f51e6..f1e0f47e1d1 100644 --- a/lib/libcurses/tty/tty_display.h +++ b/lib/libcurses/tty/tty_display.h @@ -1,7 +1,7 @@ -/* $OpenBSD: tty_display.h,v 1.2 2000/03/10 01:35:05 millert Exp $ */ +/* $OpenBSD: tty_display.h,v 1.3 2001/01/22 18:02:00 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -31,20 +31,20 @@ #ifndef TTY_DISPLAY_H #define TTY_DISPLAY_H 1 -extern bool _nc_tty_beep(void); -extern bool _nc_tty_check_resize(void); -extern bool _nc_tty_cursor(int); -extern bool _nc_tty_flash(void); -extern bool _nc_tty_init_color(int,int,int,int); -extern bool _nc_tty_init_pair(int,int,int); -extern bool _nc_tty_slk_hide(bool); -extern bool _nc_tty_slk_update(int,const char *); -extern bool _nc_tty_start_color(void); -extern void _nc_tty_display_resume(void); -extern void _nc_tty_display_suspend(void); -extern void _nc_tty_dispose(void); /* frees SP->_term */ -extern void _nc_tty_switch_to(void); -extern void _nc_tty_update(void); +extern NCURSES_EXPORT(bool) _nc_tty_beep (void); +extern NCURSES_EXPORT(bool) _nc_tty_check_resize (void); +extern NCURSES_EXPORT(bool) _nc_tty_cursor (int); +extern NCURSES_EXPORT(bool) _nc_tty_flash (void); +extern NCURSES_EXPORT(bool) _nc_tty_init_color (int,int,int,int); +extern NCURSES_EXPORT(bool) _nc_tty_init_pair (int,int,int); +extern NCURSES_EXPORT(bool) _nc_tty_slk_hide (bool); +extern NCURSES_EXPORT(bool) _nc_tty_slk_update (int,const char *); +extern NCURSES_EXPORT(bool) _nc_tty_start_color (void); +extern NCURSES_EXPORT(void) _nc_tty_display_resume (void); +extern NCURSES_EXPORT(void) _nc_tty_display_suspend (void); +extern NCURSES_EXPORT(void) _nc_tty_dispose (void); /* frees SP->_term */ +extern NCURSES_EXPORT(void) _nc_tty_switch_to (void); +extern NCURSES_EXPORT(void) _nc_tty_update (void); struct tty_display_data { int _fifohold; /* set if breakout marked */ diff --git a/lib/libcurses/tty/tty_input.h b/lib/libcurses/tty/tty_input.h index c42774be14b..21f551a49a2 100644 --- a/lib/libcurses/tty/tty_input.h +++ b/lib/libcurses/tty/tty_input.h @@ -1,7 +1,7 @@ -/* $OpenBSD: tty_input.h,v 1.1 1999/01/18 19:10:27 millert Exp $ */ +/* $OpenBSD: tty_input.h,v 1.2 2001/01/22 18:02:00 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,19 +29,19 @@ ****************************************************************************/ /* - * $From: tty_input.h,v 1.1 1998/12/19 22:42:57 tom Exp $ + * $From: tty_input.h,v 1.2 2000/12/10 02:26:51 tom Exp $ */ #ifndef TTY_INPUT_H #define TTY_INPUT_H 1 -extern bool _nc_tty_mouse_mask(mmask_t); -extern bool _nc_tty_pending(void); -extern int _nc_tty_next_event(int); -extern void _nc_tty_flags_changed(void); -extern void _nc_tty_flush(void); -extern void _nc_tty_input_resume(void); -extern void _nc_tty_input_suspend(void); +extern NCURSES_EXPORT(bool) _nc_tty_mouse_mask (mmask_t); +extern NCURSES_EXPORT(bool) _nc_tty_pending (void); +extern NCURSES_EXPORT(int) _nc_tty_next_event (int); +extern NCURSES_EXPORT(void) _nc_tty_flags_changed (void); +extern NCURSES_EXPORT(void) _nc_tty_flush (void); +extern NCURSES_EXPORT(void) _nc_tty_input_resume (void); +extern NCURSES_EXPORT(void) _nc_tty_input_suspend (void); struct tty_input_data { int _ifd; /* input file ptr for screen */ diff --git a/lib/libcurses/tty/tty_update.c b/lib/libcurses/tty/tty_update.c index 25f04b0339e..194bc4343d9 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.13 2000/10/10 15:10:32 millert Exp $ */ +/* $OpenBSD: tty_update.c,v 1.14 2001/01/22 18:02:01 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -72,7 +72,7 @@ #include <term.h> -MODULE_ID("$From: tty_update.c,v 1.146 2000/10/07 01:11:44 tom Exp $") +MODULE_ID("$From: tty_update.c,v 1.150 2001/01/14 00:16:22 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -527,7 +527,7 @@ callPutChar(chtype const ch) win->_line[row].lastchar = _NOCHANGE; \ if_USE_SCROLL_HINTS(win->_line[row].oldindex = row) -int +NCURSES_EXPORT(int) doupdate(void) { int i; @@ -769,20 +769,20 @@ doupdate(void) /* mark line changed successfully */ if (i <= newscr->_maxy) { - MARK_NOCHANGE(newscr, i) + MARK_NOCHANGE(newscr, i); } if (i <= curscr->_maxy) { - MARK_NOCHANGE(curscr, i) + MARK_NOCHANGE(curscr, i); } } } /* put everything back in sync */ for (i = nonempty; i <= newscr->_maxy; i++) { - MARK_NOCHANGE(newscr, i) + MARK_NOCHANGE(newscr, i); } for (i = nonempty; i <= curscr->_maxy; i++) { - MARK_NOCHANGE(curscr, i) + MARK_NOCHANGE(curscr, i); } if (!newscr->_leaveok) { @@ -1284,7 +1284,7 @@ ClearScreen(chtype blank) #if NCURSES_EXT_FUNCS if (SP->_coloron && !SP->_default_color) { - _nc_do_color(COLOR_PAIR(SP->_current_attr), 0, FALSE, _nc_outch); + _nc_do_color((int) COLOR_PAIR(SP->_current_attr), 0, FALSE, _nc_outch); if (!back_color_erase) { fast_clear = FALSE; } @@ -1419,7 +1419,7 @@ DelChar(int count) ** Emit a string without waiting for update. */ -void +NCURSES_EXPORT(void) _nc_outstr(const char *str) { (void) putp(str); @@ -1612,8 +1612,9 @@ scroll_idl(int n, int del, int ins, chtype blank) return OK; } -int -_nc_scrolln(int n, int top, int bot, int maxy) +NCURSES_EXPORT(int) +_nc_scrolln +(int n, int top, int bot, int maxy) /* scroll region from top to bot by n lines */ { chtype blank = ClrBlank(stdscr); @@ -1734,7 +1735,7 @@ _nc_scrolln(int n, int top, int bot, int maxy) return (OK); } -void +NCURSES_EXPORT(void) _nc_screen_resume(void) { /* make sure terminal is in a sane known state */ @@ -1760,14 +1761,14 @@ _nc_screen_resume(void) putp(auto_right_margin ? enter_am_mode : exit_am_mode); } -void +NCURSES_EXPORT(void) _nc_screen_init(void) { _nc_screen_resume(); } /* wrap up screen handling */ -void +NCURSES_EXPORT(void) _nc_screen_wrap(void) { UpdateAttrs(A_NORMAL); @@ -1788,7 +1789,7 @@ _nc_screen_wrap(void) } #if USE_XMC_SUPPORT -void +NCURSES_EXPORT(void) _nc_do_xmc_glitch(attr_t previous) { attr_t chg = XMC_CHANGES(previous ^ SP->_current_attr); diff --git a/lib/libcurses/unctrl.h b/lib/libcurses/unctrl.h index 92d94a49a65..211540418b9 100644 --- a/lib/libcurses/unctrl.h +++ b/lib/libcurses/unctrl.h @@ -1,7 +1,7 @@ -/* $OpenBSD: unctrl.h,v 1.7 2000/10/22 18:27:21 millert Exp $ */ +/* $OpenBSD: unctrl.h,v 1.8 2001/01/22 18:01:35 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,7 +41,7 @@ * as ^?. Printable characters are displayed as is. */ -/* $From: unctrl.h.in,v 1.8 1998/02/11 12:13:45 tom Exp $ */ +/* $From: unctrl.h.in,v 1.9 2000/12/10 02:02:15 tom Exp $ */ #ifndef _UNCTRL_H #define _UNCTRL_H 1 @@ -56,7 +56,7 @@ extern "C" { #include <curses.h> #undef unctrl -extern NCURSES_CONST char *unctrl(chtype); +NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype); #ifdef __cplusplus } |