diff options
Diffstat (limited to 'contrib/ncurses/tack')
-rw-r--r-- | contrib/ncurses/tack/COPYING | 8 | ||||
-rw-r--r-- | contrib/ncurses/tack/HISTORY | 5 | ||||
-rw-r--r-- | contrib/ncurses/tack/Makefile.in | 103 | ||||
-rw-r--r-- | contrib/ncurses/tack/ansi.c | 6 | ||||
-rw-r--r-- | contrib/ncurses/tack/charset.c | 60 | ||||
-rw-r--r-- | contrib/ncurses/tack/color.c | 114 | ||||
-rw-r--r-- | contrib/ncurses/tack/control.c | 43 | ||||
-rw-r--r-- | contrib/ncurses/tack/crum.c | 24 | ||||
-rw-r--r-- | contrib/ncurses/tack/edit.c | 87 | ||||
-rw-r--r-- | contrib/ncurses/tack/fun.c | 63 | ||||
-rw-r--r-- | contrib/ncurses/tack/init.c | 28 | ||||
-rw-r--r-- | contrib/ncurses/tack/menu.c | 6 | ||||
-rw-r--r-- | contrib/ncurses/tack/modes.c | 22 | ||||
-rw-r--r-- | contrib/ncurses/tack/modules | 29 | ||||
-rw-r--r-- | contrib/ncurses/tack/output.c | 18 | ||||
-rw-r--r-- | contrib/ncurses/tack/pad.c | 47 | ||||
-rw-r--r-- | contrib/ncurses/tack/scan.c | 37 | ||||
-rw-r--r-- | contrib/ncurses/tack/sync.c | 28 | ||||
-rw-r--r-- | contrib/ncurses/tack/sysdep.c | 19 | ||||
-rw-r--r-- | contrib/ncurses/tack/tack.1 | 31 | ||||
-rw-r--r-- | contrib/ncurses/tack/tack.c | 39 | ||||
-rw-r--r-- | contrib/ncurses/tack/tack.h | 207 |
22 files changed, 594 insertions, 430 deletions
diff --git a/contrib/ncurses/tack/COPYING b/contrib/ncurses/tack/COPYING index 60549be514af..b6f92f3dbfa5 100644 --- a/contrib/ncurses/tack/COPYING +++ b/contrib/ncurses/tack/COPYING @@ -2,7 +2,7 @@ Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> + Copyright (C) <year> <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -305,7 +305,7 @@ the "copyright" line and a pointer to where the full notice is found. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Also add information on how to contact you by electronic and paper mail. @@ -313,7 +313,7 @@ Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/contrib/ncurses/tack/HISTORY b/contrib/ncurses/tack/HISTORY index 3fe2cab0cd98..56497fb54264 100644 --- a/contrib/ncurses/tack/HISTORY +++ b/contrib/ncurses/tack/HISTORY @@ -1,6 +1,11 @@ Current history: +2006/11/25 Fixes for ncurses tparm() prototype. +2006/06/24 1.02 Modify to support ncurses extended string capabilities. +2003/10/18 1.01 Fix some logic in pad.c, improve bce test. +2003/09/20 Modified to allow running from compiled-in terminfo. +2001/10/20 Make menu titles agree with descriptions. 2000/03/04 Fix a few spelling errors 1999/09/04 Minor fix to build/link on BeOS 1999/05/16 Minor fix to build/link on CLIX diff --git a/contrib/ncurses/tack/Makefile.in b/contrib/ncurses/tack/Makefile.in index 732da7f96e76..059a702f4869 100644 --- a/contrib/ncurses/tack/Makefile.in +++ b/contrib/ncurses/tack/Makefile.in @@ -1,4 +1,31 @@ -# $Id: Makefile.in,v 1.27 2001/12/08 18:48:01 tom Exp $ +# $Id: Makefile.in,v 1.38 2006/12/17 15:58:32 tom Exp $ +############################################################################## +# Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## # Makefile for tack # # The variable 'srcdir' refers to the source-distribution, and can be set with @@ -15,7 +42,9 @@ THIS = Makefile CF_MFLAGS = @cf_cv_makeflags@ @SET_MAKE@ -x = @PROG_EXT@ + +x = @EXEEXT@ +o = .@OBJEXT@ MODEL = ../@DFT_OBJ_SUBDIR@ DESTDIR = @DESTDIR@ @@ -24,14 +53,19 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ libdir = @libdir@ -mandir = @mandir@/man1 +mandir = @mandir@ includedir = @includedir@ datadir = @datadir@ LIBTOOL = @LIBTOOL@ +LIBTOOL_CLEAN = @LIB_CLEAN@ +LIBTOOL_COMPILE = @LIB_COMPILE@ +LIBTOOL_LINK = @LIB_LINK@ +LIBTOOL_INSTALL = @LIB_INSTALL@ +LIBTOOL_UNINSTALL = @LIB_UNINSTALL@ INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_PROG = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ AWK = @AWK@ @@ -54,16 +88,20 @@ CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) +REL_VERSION = @cf_cv_rel_version@ +ABI_VERSION = @cf_cv_abi_version@ +LOCAL_LIBDIR = @top_builddir@/lib + LD = @LD@ -LINK = @LINK_PROGS@ $(LIBTOOL) $(CC) +LINK = @LINK_PROGS@ $(LIBTOOL_LINK) $(CC) LDFLAGS = @EXTRA_LDFLAGS@ \ - @PROG_ARGS@ @LDFLAGS@ @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ + @TINFO_ARGS@ @LDFLAGS@ @LD_MODEL@ @LIBS@ -LDFLAGS_LIBTOOL = $(LDFLAGS) -LDFLAGS_NORMAL = $(LDFLAGS) -LDFLAGS_DEBUG = $(LDFLAGS) @CC_G_OPT@ -LDFLAGS_PROFILE = $(LDFLAGS) -pg -LDFLAGS_SHARED = $(LDFLAGS) @LD_SHARED_OPTS@ +LDFLAGS_LIBTOOL = $(LDFLAGS) $(CFLAGS_LIBTOOL) +LDFLAGS_NORMAL = $(LDFLAGS) $(CFLAGS_NORMAL) +LDFLAGS_DEBUG = $(LDFLAGS) $(CFLAGS_DEBUG) +LDFLAGS_PROFILE = $(LDFLAGS) $(CFLAGS_PROFILE) +LDFLAGS_SHARED = $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@ LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) @@ -89,15 +127,17 @@ libs \ install.libs \ uninstall.libs: +EDITARGS = $(DESTDIR)$(mandir) $(srcdir) $(srcdir)/*.[0-9]* + install.tack: $(PROGS) \ $(DESTDIR)$(bindir) \ $(DESTDIR)$(mandir) - $(LIBTOOL) $(INSTALL_PROGRAM) tack$x $(DESTDIR)$(bindir)/tack$x - $(INSTALL_DATA) $(srcdir)/tack.1 $(DESTDIR)$(mandir)/tack.1 + $(LIBTOOL_INSTALL) $(INSTALL_PROG) tack$x $(DESTDIR)$(bindir)/tack$x + sh ../edit_man.sh normal installing $(EDITARGS) uninstall.tack: - -@$(LIBTOOL) rm -f $(DESTDIR)$(bindir)/tack$x - -@rm -f $(DESTDIR)$(mandir)/tack.1 + -@$(LIBTOOL_UNINSTALL) rm -f $(DESTDIR)$(bindir)/tack$x + -sh ../edit_man.sh normal removing $(EDITARGS) $(DESTDIR)$(bindir) \ $(DESTDIR)$(mandir) : @@ -108,22 +148,22 @@ $(DESTDIR)$(mandir) : # DEPS_TACK = \ - $(MODEL)/ansi.o \ - $(MODEL)/charset.o \ - $(MODEL)/color.o \ - $(MODEL)/control.o \ - $(MODEL)/crum.o \ - $(MODEL)/edit.o \ - $(MODEL)/fun.o \ - $(MODEL)/init.o \ - $(MODEL)/menu.o \ - $(MODEL)/modes.o \ - $(MODEL)/output.o \ - $(MODEL)/pad.o \ - $(MODEL)/scan.o \ - $(MODEL)/sync.o \ - $(MODEL)/sysdep.o \ - $(MODEL)/tack.o + $(MODEL)/ansi$o \ + $(MODEL)/charset$o \ + $(MODEL)/color$o \ + $(MODEL)/control$o \ + $(MODEL)/crum$o \ + $(MODEL)/edit$o \ + $(MODEL)/fun$o \ + $(MODEL)/init$o \ + $(MODEL)/menu$o \ + $(MODEL)/modes$o \ + $(MODEL)/output$o \ + $(MODEL)/pad$o \ + $(MODEL)/scan$o \ + $(MODEL)/sync$o \ + $(MODEL)/sysdep$o \ + $(MODEL)/tack$o tack$x: $(DEPS_TACK) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(DEPS_TACK) $(LDFLAGS_DEFAULT) -o $@ @@ -142,6 +182,7 @@ mostlyclean :: -rm -f core tags TAGS *~ *.bak *.i *.atac trace clean :: mostlyclean + -sh -c "if test -n '$x' ; then $(MAKE) clean x=''; fi" -rm -f $(PROGS) -rm -rf .libs diff --git a/contrib/ncurses/tack/ansi.c b/contrib/ncurses/tack/ansi.c index 807bc539a6c8..bdbd43372642 100644 --- a/contrib/ncurses/tack/ansi.c +++ b/contrib/ncurses/tack/ansi.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include <tack.h> -MODULE_ID("$Id: ansi.c,v 1.9 2001/06/18 18:44:17 tom Exp $") +MODULE_ID("$Id: ansi.c,v 1.10 2005/09/17 19:49:16 tom Exp $") /* * Standalone tests for ANSI terminals. Three entry points: diff --git a/contrib/ncurses/tack/charset.c b/contrib/ncurses/tack/charset.c index 991401f37437..9783792aa3dd 100644 --- a/contrib/ncurses/tack/charset.c +++ b/contrib/ncurses/tack/charset.c @@ -1,27 +1,27 @@ /* ** Copyright (C) 1991, 1997-2000 Free Software Foundation, Inc. -** +** ** This file is part of TACK. -** +** ** TACK is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2, or (at your option) ** any later version. -** +** ** TACK is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. -** +** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include <tack.h> -MODULE_ID("$Id: charset.c,v 1.8 2001/06/18 18:44:26 tom Exp $") +MODULE_ID("$Id: charset.c,v 1.11 2006/11/26 00:13:36 tom Exp $") /* Menu definitions for alternate character set and SGR tests. @@ -159,7 +159,7 @@ charset_status( ptextln(temp); put_str("This line s"); - s = tparm(to_status_line, 0); + s = TPARM_1(to_status_line, 0); tc_putp(s); for (i = 0; i < max; i++) putchp(m[i]); @@ -194,7 +194,7 @@ charset_dsl( } -void +void eat_cookie(void) { /* put a blank if this is not a magic cookie terminal */ @@ -203,11 +203,11 @@ eat_cookie(void) } -void +void put_mode(char *s) { /* send the attribute string (with or without % execution) */ - tc_putp(tparm(s)); /* allow % execution */ + tc_putp(TPARM_0(s)); /* allow % execution */ } @@ -226,7 +226,7 @@ set_attr(int a) for (i = 0; i < 31; i++) { b[i] = (a >> i) & 1; } - tc_putp(tparm(set_attributes, b[1], b[2], b[3], b[4], b[5], + tc_putp(TPARM_9(set_attributes, b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9])); } @@ -285,7 +285,7 @@ charset_sgr( } put_crlf(); -#ifdef max_attributes +#ifdef max_attributes if (max_attributes >= 0) { sprintf(temp, "(ma) Maximum attributes %d ", max_attributes); ptext(temp); @@ -488,20 +488,20 @@ test_acs( #ifdef ACS_ULCORNER maybe_wait(5); put_mode(enter_alt_charset_mode); - put_this(ACS_ULCORNER); - put_this(ACS_TTEE); - put_this(ACS_URCORNER); - put_this(ACS_ULCORNER); - put_this(ACS_HLINE); - put_this(ACS_URCORNER); + put_that(ACS_ULCORNER); + put_that(ACS_TTEE); + put_that(ACS_URCORNER); + put_that(ACS_ULCORNER); + put_that(ACS_HLINE); + put_that(ACS_URCORNER); char_count += 6; put_mode(exit_alt_charset_mode); put_crlf(); put_mode(enter_alt_charset_mode); - put_this(ACS_LTEE); - put_this(ACS_PLUS); - put_this(ACS_RTEE); - put_this(ACS_VLINE); + put_that(ACS_LTEE); + put_that(ACS_PLUS); + put_that(ACS_RTEE); + put_that(ACS_VLINE); if (magic_cookie_glitch >= 1) put_this(' '); else { @@ -509,18 +509,18 @@ test_acs( put_this(' '); put_mode(enter_alt_charset_mode); } - put_this(ACS_VLINE); + put_that(ACS_VLINE); char_count += 6; put_mode(exit_alt_charset_mode); put_str(" Here are 2 boxes"); put_crlf(); put_mode(enter_alt_charset_mode); - put_this(ACS_LLCORNER); - put_this(ACS_BTEE); - put_this(ACS_LRCORNER); - put_this(ACS_LLCORNER); - put_this(ACS_HLINE); - put_this(ACS_LRCORNER); + put_that(ACS_LLCORNER); + put_that(ACS_BTEE); + put_that(ACS_LRCORNER); + put_that(ACS_LLCORNER); + put_that(ACS_HLINE); + put_that(ACS_LRCORNER); char_count += 6; put_mode(exit_alt_charset_mode); put_crlf(); diff --git a/contrib/ncurses/tack/color.c b/contrib/ncurses/tack/color.c index 479081c9fb38..6fea231efc40 100644 --- a/contrib/ncurses/tack/color.c +++ b/contrib/ncurses/tack/color.c @@ -1,27 +1,27 @@ /* ** Copyright (C) 1991, 1997 Free Software Foundation, Inc. -** +** ** This file is part of TACK. -** +** ** TACK is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2, or (at your option) ** any later version. -** +** ** TACK is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. -** +** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include <tack.h> -MODULE_ID("$Id: color.c,v 1.2 2000/03/04 21:05:54 tom Exp $") +MODULE_ID("$Id: color.c,v 1.7 2006/11/26 00:14:25 tom Exp $") /* * Color terminal tests. Has only one entry point: test_color(). @@ -84,6 +84,12 @@ static int a_bright_color, bright_value; static int cookie_monster, color_step, colors_per_line; static int R, G, B; +static void reset_colors(void) +{ + tc_putp(orig_colors); + tc_putp(TPARM_0(orig_pair)); +} + static int color_trans(int c) { /* translate or load the color */ @@ -104,10 +110,10 @@ color_trans(int c) fg_color[pairs_used] = c; bg_color[pairs_used] = c; if (hue_lightness_saturation) { - tc_putp(tparm(initialize_color, pairs_used, + tc_putp(TPARM_4(initialize_color, pairs_used, def_colors[c].h, def_colors[c].l, def_colors[c].s)); } else { - tc_putp(tparm(initialize_color, pairs_used, + tc_putp(TPARM_4(initialize_color, pairs_used, def_colors[c].r, def_colors[c].g, def_colors[c].b)); } return pairs_used++; @@ -126,17 +132,17 @@ new_color( } if (set_a_foreground) { /* set ANSI color (setaf) (setab) */ - tc_putp(tparm(set_a_foreground, fg)); - tc_putp(tparm(set_a_background, bg)); + tc_putp(TPARM_1(set_a_foreground, fg)); + tc_putp(TPARM_1(set_a_background, bg)); } else if (set_foreground) { /* make sure black is zero */ (void) color_trans(COLOR_BLACK); - tc_putp(tparm(set_foreground, color_trans(fg))); - tc_putp(tparm(set_background, color_trans(bg))); + tc_putp(TPARM_1(set_foreground, color_trans(fg))); + tc_putp(TPARM_1(set_background, color_trans(bg))); } else { /* set color pair */ for (i = 0; i < pairs_used; i++) { if (fg_color[i] == fg && bg_color[i] == bg) { - tc_putp(tparm(set_color_pair, i)); + tc_putp(TPARM_1(set_color_pair, i)); if (hungry) { eat_cookie(); } @@ -149,7 +155,7 @@ new_color( if (fg_color[i] == fg) break; } - tc_putp(tparm(set_color_pair, i)); + tc_putp(TPARM_1(set_color_pair, i)); if (hungry) { eat_cookie(); } @@ -162,15 +168,15 @@ new_color( fg_color[pairs_used] = fg; bg_color[pairs_used] = bg; if (hue_lightness_saturation) { - tc_putp(tparm(initialize_pair, pairs_used, + tc_putp(TPARM_7(initialize_pair, pairs_used, def_colors[fg].h, def_colors[fg].l, def_colors[fg].s, def_colors[bg].h, def_colors[bg].l, def_colors[bg].s)); } else { - tc_putp(tparm(initialize_pair, pairs_used, + tc_putp(TPARM_7(initialize_pair, pairs_used, def_colors[fg].r, def_colors[fg].g, def_colors[fg].b, def_colors[bg].r, def_colors[bg].g, def_colors[bg].b)); } - tc_putp(tparm(set_color_pair, pairs_used)); + tc_putp(TPARM_1(set_color_pair, pairs_used)); pairs_used++; } if (hungry) { @@ -239,9 +245,9 @@ send_color(int p, int r, int g, int b) if (hue_lightness_saturation) { rgb_2_hls(r, g, b, &h, &l, &s); - tc_putp(tparm(initialize_color, p, h, l, s)); + tc_putp(TPARM_4(initialize_color, p, h, l, s)); } else { - tc_putp(tparm(initialize_color, p, r, g, b)); + tc_putp(TPARM_4(initialize_color, p, r, g, b)); } } @@ -254,9 +260,9 @@ send_pair(int p, int fr, int fg, int fb, int br, int bg, int bb) if (hue_lightness_saturation) { rgb_2_hls(fr, fg, fb, &fh, &fl, &fs); rgb_2_hls(br, bg, bb, &bh, &bl, &bs); - tc_putp(tparm(initialize_pair, p, fh, fl, fs, bh, bl, bs)); + tc_putp(TPARM_7(initialize_pair, p, fh, fl, fs, bh, bl, bs)); } else { - tc_putp(tparm(initialize_pair, p, fr, fg, fb, bb, bg, bb)); + tc_putp(TPARM_7(initialize_pair, p, fr, fg, fb, bb, bg, bb)); } } @@ -349,19 +355,19 @@ rainbow(int n) if (i >= max_colors) { break; } - tc_putp(tparm(set_a_foreground, i)); - tc_putp(tparm(set_a_background, i)); + tc_putp(TPARM_1(set_a_foreground, i)); + tc_putp(TPARM_1(set_a_background, i)); } else if (set_foreground) { if (i >= max_colors) { break; } - tc_putp(tparm(set_foreground, i)); - tc_putp(tparm(set_background, i)); + tc_putp(TPARM_1(set_foreground, i)); + tc_putp(TPARM_1(set_background, i)); } else { if (i >= max_pairs) { break; } - tc_putp(tparm(set_color_pair, i)); + tc_putp(TPARM_1(set_color_pair, i)); } putchp(c); } @@ -369,13 +375,13 @@ rainbow(int n) put_mode(exit_attribute_mode); } if (set_a_foreground) { - tc_putp(tparm(set_a_foreground, a_bright_color)); - tc_putp(tparm(set_a_background, 0)); + tc_putp(TPARM_1(set_a_foreground, a_bright_color)); + tc_putp(TPARM_1(set_a_background, 0)); } else if (set_foreground) { - tc_putp(tparm(set_foreground, a_bright_color)); - tc_putp(tparm(set_background, 0)); + tc_putp(TPARM_1(set_foreground, a_bright_color)); + tc_putp(TPARM_1(set_background, 0)); } else { - tc_putp(tparm(set_color_pair, 0)); + tc_putp(TPARM_1(set_color_pair, 0)); } put_str(" "); put_str(splat[d].name); @@ -405,6 +411,7 @@ ncv_display(int m) put_str(alt_modes[m].name); eat_cookie(); set_attr(0); + reset_colors(); put_crlf(); } @@ -436,19 +443,19 @@ dump_colors(void) continue; } send_color(p, R, G, B); - tc_putp(tparm(set_a_background, p)); + tc_putp(TPARM_1(set_a_background, p)); } else if (set_background) { if (p >= max_colors) { continue; } send_color(p, R, G, B); - tc_putp(tparm(set_background, p)); + tc_putp(TPARM_1(set_background, p)); } else { if (p >= max_pairs) { continue; } send_pair(p, R, G, B, R, G, B); - tc_putp(tparm(set_color_pair, p)); + tc_putp(TPARM_1(set_color_pair, p)); } found_one = TRUE; putchp(' '); @@ -517,10 +524,7 @@ color_setf( } /* initialize the color palette */ pairs_used = max_colors >= 8 ? 8 : max_colors; - if (can_change) { - tc_putp(orig_colors); - } - tc_putp(tparm(orig_pair)); + reset_colors(); new_color(COLOR_WHITE, COLOR_BLACK, FALSE); ptextln("(setf) (setb) (scp) The following colors are predefined:"); @@ -528,8 +532,8 @@ color_setf( put_crlf(); j = max_colors > 8 ? 8 : max_colors; /* - the black on white test is the same as the white on black test. - */ + * the black on white test is the same as the white on black test. + */ for (i = 1; i < j; i++) { putchp('0' + def_colors[i].index); putchp(' '); @@ -547,6 +551,7 @@ color_setf( new_color(COLOR_WHITE, COLOR_BLACK, FALSE); put_crlf(); } + reset_colors(); put_crlf(); generic_done_message(t, state, ch); } @@ -589,10 +594,10 @@ color_matrix( } for (j = 0; j < matrix_area; j++) { if (j % matrix_size == 0) { - tc_putp(tparm(orig_pair)); + reset_colors(); put_crlf(); if (brightness) { - tc_putp(exit_standout_mode); + tc_putp(exit_attribute_mode); } (void) sprintf(temp, "%-8s", def_colors[j / matrix_size].name); put_str(temp); @@ -605,9 +610,9 @@ color_matrix( FALSE); put_str(" Hello "); } - tc_putp(tparm(orig_pair)); + reset_colors(); if (brightness) { - tc_putp(exit_standout_mode); + tc_putp(exit_attribute_mode); } put_crlf(); } @@ -649,7 +654,7 @@ color_ncv( } } } - tc_putp(orig_pair); + reset_colors(); put_crlf(); generic_done_message(t, state, ch); } @@ -665,11 +670,11 @@ color_bce( int *state, int *ch) { - new_color(COLOR_BLACK, COLOR_WHITE, FALSE); + new_color(COLOR_CYAN, COLOR_BLUE, FALSE); put_clear(); put_newlines(2); - new_color(COLOR_WHITE, COLOR_BLACK, FALSE); - ptextln("If the two lines above are black then back_color_erase (bce) should be false."); + reset_colors(); + ptextln("If the two lines above are blue then back_color_erase (bce) should be true."); sprintf(temp, "(bce) is %s in the data base.", back_color_erase ? "true" : "false"); ptextln(temp); generic_done_message(t, state, ch); @@ -693,7 +698,7 @@ color_ccc( generic_done_message(t, state, ch); return; } - tc_putp(orig_colors); + reset_colors(); pairs_used = 0; new_color(COLOR_WHITE, COLOR_BLACK, FALSE); sprintf(temp, "Reloading colors (init%c) using %s method", @@ -721,8 +726,7 @@ color_ccc( } generic_done_message(t, state, ch); if (*ch != 0 && *ch != 'n') { - tc_putp(orig_colors); - tc_putp(tparm(orig_pair)); + reset_colors(); return; } @@ -756,12 +760,10 @@ color_ccc( } generic_done_message(t, state, ch); if (*ch != 0 && *ch != 'n') { - tc_putp(orig_colors); - tc_putp(tparm(orig_pair)); + reset_colors(); return; } dump_colors(); - tc_putp(orig_colors); - tc_putp(tparm(orig_pair)); + reset_colors(); generic_done_message(t, state, ch); } diff --git a/contrib/ncurses/tack/control.c b/contrib/ncurses/tack/control.c index 4a85384b4125..360edeffcaef 100644 --- a/contrib/ncurses/tack/control.c +++ b/contrib/ncurses/tack/control.c @@ -15,8 +15,8 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include <tack.h> @@ -25,7 +25,7 @@ #include <sys/time.h> #endif -MODULE_ID("$Id: control.c,v 1.3 2000/03/04 21:10:59 tom Exp $") +MODULE_ID("$Id: control.c,v 1.9 2006/06/24 21:27:53 tom Exp $") /* terminfo test program control subroutines */ @@ -40,11 +40,11 @@ int test_complete; /* counts number of tests completed */ char txt_longer_test_time[80]; /* +) use longer time */ char txt_shorter_test_time[80]; /* -) use shorter time */ -int pad_test_duration = 1; /* number of seconds for a pad test */ +static int pad_test_duration = 1; /* number of seconds for a pad test */ int auto_pad_mode; /* run the time tests */ int no_alarm_event; /* TRUE if the alarm has not gone off yet */ -int usec_run_time; /* length of last test in microseconds */ -MY_TIMER stop_watch[MAX_TIMERS]; /* Hold the start timers */ +unsigned long usec_run_time; /* length of last test in microseconds */ +static MY_TIMER stop_watch[MAX_TIMERS]; /* Hold the start timers */ char txt_longer_augment[80]; /* >) use bigger augment */ char txt_shorter_augment[80]; /* <) use smaller augment */ @@ -66,16 +66,21 @@ int tx_index[TT_MAX]; /* String index */ int tx_delay[TT_MAX]; /* Number of milliseconds delay */ int txp; /* number of entries used */ int tx_characters; /* printing characters sent by test */ -int tx_cps; /* characters per second */ -struct test_list *tx_source; /* The test that generated this data */ - -extern struct test_menu pad_menu; /* Pad menu structure */ -extern struct test_list pad_test_list[]; +unsigned long tx_cps; /* characters per second */ +static struct test_list *tx_source; /* The test that generated this data */ #define RESULT_BLOCK 1024 static int blocks; /* number of result blocks available */ static struct test_results *results; /* pointer to next available */ -struct test_results *pads[STRCOUNT]; /* save pad results here */ +static struct test_results **pads; /* save pad results here */ + +static void +alloc_arrays(void) +{ + if (pads == 0) { + pads = (struct test_results **)calloc(MAX_STRINGS, sizeof(struct test_results *)); + } +} /* ** event_start(number) @@ -365,7 +370,7 @@ int sliding_scale( int dividend, int factor, - int divisor) + unsigned long divisor) { double d = dividend; @@ -432,6 +437,7 @@ pad_test_shutdown( struct test_results *r; /* Results of current test */ int ss_index[TT_MAX]; /* String index */ + alloc_arrays(); if (tty_can_sync == SYNC_TESTED) { bogus = tty_sync_error(); } else { @@ -495,12 +501,13 @@ show_cap_results( struct test_results *r; /* a result */ int delay; + alloc_arrays(); if ((r = pads[x])) { sprintf(temp, "(%s)", strnames[x]); ptext(temp); while (r) { sprintf(temp, "$<%d>", r->delay / 1000); - put_columns(temp, strlen(temp), 10); + put_columns(temp, (int) strlen(temp), 10); r = r->next; } r = pads[x]; @@ -508,7 +515,7 @@ show_cap_results( if (r->reps > 1) { delay = r->delay / (r->reps * 100); sprintf(temp, "$<%d.%d*>", delay / 10, delay % 10); - put_columns(temp, strlen(temp), 10); + put_columns(temp, (int) strlen(temp), 10); } r = r->next; } @@ -544,9 +551,9 @@ dump_test_stats( put_crlf(); } } - sprintf(tbuf, "%011u", usec_run_time); - sprintf(temp, "Test time: %d.%s, characters per second %d, characters %d", - usec_run_time / 1000000, &tbuf[5], tx_cps, tx_characters); + sprintf(tbuf, "%011lu", usec_run_time); + sprintf(temp, "Test time: %lu.%s, characters per second %lu, characters %d", + usec_run_time / 1000000UL, &tbuf[5], tx_cps, tx_characters); ptextln(temp); for (i = 0; i < txp; i++) { if ((j = get_string_cap_byvalue(tx_cap[i])) >= 0) { diff --git a/contrib/ncurses/tack/crum.c b/contrib/ncurses/tack/crum.c index e66cc05eda1a..8cd40690d489 100644 --- a/contrib/ncurses/tack/crum.c +++ b/contrib/ncurses/tack/crum.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include <tack.h> -MODULE_ID("$Id: crum.c,v 1.3 2000/03/04 21:09:18 tom Exp $") +MODULE_ID("$Id: crum.c,v 1.5 2006/11/26 00:15:02 tom Exp $") /* * Test cursor movement. @@ -65,18 +65,18 @@ move_to( char *s; if (sel & 16) { /* use (cup) */ - s = tparm(cursor_address, rt, ct); + s = TPARM_2(cursor_address, rt, ct); tputs(s, lines, tc_putch); return; } if (sel & 8) { /* use (hpa) (vpa) */ if (column_address) { - s = tparm(column_address, ct); + s = TPARM_1(column_address, ct); tputs(s, 1, tc_putch); cf = ct; } if (row_address) { - s = tparm(row_address, rt); + s = TPARM_1(row_address, rt); tputs(s, 1, tc_putch); rf = rt; } @@ -84,25 +84,25 @@ move_to( if (sel & 4) { /* parameterized relative cursor movement */ if (parm_right_cursor) if (cf < ct) { - s = tparm(parm_right_cursor, ct - cf); + s = TPARM_1(parm_right_cursor, ct - cf); tputs(s, ct - cf, tc_putch); cf = ct; } if (parm_left_cursor) if (cf > ct) { - s = tparm(parm_left_cursor, cf - ct); + s = TPARM_1(parm_left_cursor, cf - ct); tputs(s, cf - ct, tc_putch); cf = ct; } if (parm_down_cursor) if (rf < rt) { - s = tparm(parm_down_cursor, rt - rf); + s = TPARM_1(parm_down_cursor, rt - rf); tputs(s, rt - rf, tc_putch); rf = rt; } if (parm_up_cursor) if (rf > rt) { - s = tparm(parm_up_cursor, rf - rt); + s = TPARM_1(parm_up_cursor, rf - rt); tputs(s, rf - rt, tc_putch); rf = rt; } @@ -409,11 +409,11 @@ crum_os( tc_putch('_'); } for (i = 0; i < columns - 2; i++) { - tputs(tparm(cursor_address, 0, i), lines, tc_putch); + tputs(TPARM_2(cursor_address, 0, i), lines, tc_putch); tc_putch('+'); } for (i = 0; i < lines - 2; i++) { - tputs(tparm(cursor_address, i, 0), lines, tc_putch); + tputs(TPARM_2(cursor_address, i, 0), lines, tc_putch); tc_putch(']'); tc_putch('_'); } diff --git a/contrib/ncurses/tack/edit.c b/contrib/ncurses/tack/edit.c index 2d1a780d36a8..b23f3ab04497 100644 --- a/contrib/ncurses/tack/edit.c +++ b/contrib/ncurses/tack/edit.c @@ -1,29 +1,29 @@ /* ** Copyright (C) 1997 Free Software Foundation, Inc. -** +** ** This file is part of TACK. -** +** ** TACK is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2, or (at your option) ** any later version. -** +** ** TACK is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. -** +** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include <tack.h> #include <time.h> #include <tic.h> -MODULE_ID("$Id: edit.c,v 1.8 2001/06/18 18:44:32 tom Exp $") +MODULE_ID("$Id: edit.c,v 1.11 2006/06/24 21:22:42 tom Exp $") /* * Terminfo edit features @@ -52,7 +52,7 @@ struct test_list edit_test_list[] = { }; static char change_pad_text[MAX_CHANGES][80]; -struct test_list change_pad_list[MAX_CHANGES] = { +static struct test_list change_pad_list[MAX_CHANGES] = { {MENU_LAST, 0, 0, 0, 0, 0, 0} }; @@ -65,19 +65,27 @@ struct test_menu change_pad_menu = { build_change_menu, change_pad_list, 0, 0, 0 }; -extern struct test_results *pads[STRCOUNT]; /* save pad results here */ - static TERMTYPE original_term; /* terminal type description */ static char flag_boolean[BOOLCOUNT]; /* flags for booleans */ static char flag_numerics[NUMCOUNT]; /* flags for numerics */ -static char flag_strings[STRCOUNT]; /* flags for strings */ +static char *flag_strings; /* flags for strings */ +static int *label_strings; static int xon_index; /* Subscript for (xon) */ -int xon_shadow; +static int xon_shadow; static int start_display; /* the display has just started */ static int display_lines; /* number of lines displayed */ +static void +alloc_arrays(void) +{ + if (flag_strings == 0) { + label_strings = (int *)calloc(MAX_STRINGS, sizeof(int)); + flag_strings = (char *)calloc(MAX_STRINGS, sizeof(char)); + } +} + /* ** send_info_string(str) ** @@ -156,9 +164,9 @@ show_info( send_info_string(buf, ch); } } - for (i = 0; i < STRCOUNT; i++) { + for (i = 0; i < MAX_STRINGS; i++) { if (CUR Strings[i]) { - sprintf(buf, "%s=%s", strnames[i], + sprintf(buf, "%s=%s", STR_NAME(i), print_expand(CUR Strings[i])); send_info_string(buf, ch); } @@ -237,9 +245,9 @@ save_info( save_info_string(buf, fp); } } - for (i = 0; i < STRCOUNT; i++) { + for (i = 0; i < MAX_STRINGS; i++) { if (CUR Strings[i]) { - sprintf(buf, "%s=%s", strnames[i], + sprintf(buf, "%s=%s", STR_NAME(i), _nc_tic_expand(CUR Strings[i], TRUE, TRUE)); save_info_string(buf, fp); } @@ -401,7 +409,7 @@ get_string_cap_byvalue( int i; if (value) { - for (i = 0; i < STRCOUNT; i++) { + for (i = 0; i < MAX_STRINGS; i++) { if (CUR Strings[i] == value) { return i; } @@ -457,7 +465,7 @@ show_changed( ptextln(temp); } } - for (i = 0; i < STRCOUNT; i++) { + for (i = 0; i < MAX_STRINGS; i++) { a = original_term.Strings[i] ? original_term.Strings[i] : ""; b = CUR Strings[i] ? CUR Strings[i] : ""; if (strcmp(a, b)) { @@ -466,7 +474,7 @@ show_changed( header = 0; } strcpy(abuf, _nc_tic_expand(a, TRUE, TRUE)); - sprintf(temp, "%30s %6s %s", abuf, strnames[i], + sprintf(temp, "%30s %6s %s", abuf, STR_NAME(i), _nc_tic_expand(b, TRUE, TRUE)); putln(temp); } @@ -500,7 +508,7 @@ user_modified(void) return TRUE; } } - for (i = 0; i < STRCOUNT; i++) { + for (i = 0; i < MAX_STRINGS; i++) { a = original_term.Strings[i] ? original_term.Strings[i] : ""; b = CUR Strings[i] ? CUR Strings[i] : ""; if (strcmp(a, b)) { @@ -528,6 +536,7 @@ mark_cap( { struct name_table_entry const *nt; + alloc_arrays(); if ((nt = _nc_find_entry(name, _nc_info_hash_table))) { switch (nt->nte_type) { case BOOLEAN: @@ -670,8 +679,9 @@ show_report( { int i, j, nc, flag; const char *s; - const char *nx[BOOLCOUNT + NUMCOUNT + STRCOUNT]; + const char **nx = malloc(BOOLCOUNT + NUMCOUNT + MAX_STRINGS); + alloc_arrays(); flag = t->flags & 255; nc = 0; for (i = 0; i < BOOLCOUNT; i++) { @@ -684,9 +694,9 @@ show_report( nx[nc++] = numnames[i]; } } - for (i = 0; i < STRCOUNT; i++) { + for (i = 0; i < MAX_STRINGS; i++) { if (flag_strings[i] & flag) { - nx[nc++] = strnames[i]; + nx[nc++] = STR_NAME(i); } } /* sort */ @@ -715,6 +725,7 @@ show_report( } put_newlines(1); *ch = REQUEST_PROMPT; + free (nx); } /* @@ -731,6 +742,7 @@ show_untested( { int i; + alloc_arrays(); ptextln("Caps that are defined but cannot be tested:"); for (i = 0; i < BOOLCOUNT; i++) { if (flag_boolean[i] == 0 && CUR Booleans[i]) { @@ -744,9 +756,9 @@ show_untested( ptext(temp); } } - for (i = 0; i < STRCOUNT; i++) { + for (i = 0; i < MAX_STRINGS; i++) { if (flag_strings[i] == 0 && CUR Strings[i]) { - sprintf(temp, "%s ", strnames[i]); + sprintf(temp, "%s ", STR_NAME(i)); ptext(temp); } } @@ -765,7 +777,8 @@ edit_init(void) int i, j, lc; char *lab; struct name_table_entry const *nt; - int label_strings[STRCOUNT]; + + alloc_arrays(); _nc_copy_termtype(&original_term, &cur_term->type); for (i = 0; i < BOOLCOUNT; i++) { @@ -775,9 +788,9 @@ edit_init(void) original_term.Numbers[i] = CUR Numbers[i]; } /* scan for labels */ - for (i = lc = 0; i < STRCOUNT; i++) { + for (i = lc = 0; i < MAX_STRINGS; i++) { original_term.Strings[i] = CUR Strings[i]; - if (strncmp(strnames[i], "lf", 2) == 0) { + if (strncmp(STR_NAME(i), "lf", 2) == 0) { flag_strings[i] |= FLAG_LABEL; if (CUR Strings[i]) { label_strings[lc++] = i; @@ -785,18 +798,19 @@ edit_init(void) } } /* scan for function keys */ - for (i = 0; i < STRCOUNT; i++) { - if ((strnames[i][0] == 'k') && strcmp(strnames[i], "kmous")) { + for (i = 0; i < MAX_STRINGS; i++) { + const char *this_name = STR_NAME(i); + if ((this_name[0] == 'k') && strcmp(this_name, "kmous")) { flag_strings[i] |= FLAG_FUNCTION_KEY; lab = (char *) 0; for (j = 0; j < lc; j++) { - if (!strcmp(&strnames[i][1], - &strnames[label_strings[j]][1])) { + if (!strcmp(this_name, + STR_NAME(label_strings[j]))) { lab = CUR Strings[label_strings[j]]; break; } } - enter_key(strnames[i], CUR Strings[i], lab); + enter_key(this_name, CUR Strings[i], lab); } } /* Lookup the translated strings */ @@ -814,6 +828,7 @@ edit_init(void) xon_index = nt->nte_index; } xon_shadow = xon_xoff; + free(label_strings); } /* @@ -857,7 +872,7 @@ change_one_entry( } else { x = tx_index[i]; current_string = tx_cap[i]; - strcpy(pad, strnames[x]); + strcpy(pad, STR_NAME(x)); } if (!current_string) { ptextln("That string is not currently defined. Please enter a new value, including the padding delay:"); @@ -867,7 +882,7 @@ change_one_entry( t = (char *)malloc(strlen(pad) + 1); strcpy(t, pad); CUR Strings[x] = t; - sprintf(temp, "new string value %s", strnames[x]); + sprintf(temp, "new string value %s", STR_NAME(x)); ptextln(temp); ptextln(expand(t)); return; @@ -955,7 +970,7 @@ build_change_menu( s = _nc_tic_expand(tx_cap[i], TRUE, TRUE); s[40] = '\0'; sprintf(change_pad_text[j], "%c) (%s) %s", - 'a' + j, strnames[k], s); + 'a' + j, STR_NAME(k), s); change_pad_list[j].flags = i; change_pad_list[j].lines_needed = 4; change_pad_list[j].menu_entry = change_pad_text[j]; diff --git a/contrib/ncurses/tack/fun.c b/contrib/ncurses/tack/fun.c index fd895c372f3b..378887217ce9 100644 --- a/contrib/ncurses/tack/fun.c +++ b/contrib/ncurses/tack/fun.c @@ -1,27 +1,27 @@ /* ** Copyright (C) 1991, 1997 Free Software Foundation, Inc. -** +** ** This file is part of TACK. -** +** ** TACK is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2, or (at your option) ** any later version. -** +** ** TACK is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. -** +** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include <tack.h> -MODULE_ID("$Id: fun.c,v 1.3 2000/03/04 20:29:21 tom Exp $") +MODULE_ID("$Id: fun.c,v 1.9 2006/11/26 00:15:53 tom Exp $") /* * Test the function keys on the terminal. The code for echo tests @@ -56,18 +56,13 @@ struct test_list printer_test_list[] = { {MENU_LAST, 0, 0, 0, 0, 0, 0} }; -#define MAX_STRINGS STRCOUNT - -/* scan code externals */ -extern int scan_max; /* length of longest scan code */ -extern char **scan_up, **scan_down, **scan_name; -extern int *scan_tested, *scan_length; - /* local definitions */ -static const char *fk_name[MAX_STRINGS]; -static char *fkval[MAX_STRINGS]; -static char *fk_label[MAX_STRINGS]; /* function key labels (if any) */ -static int fk_tested[MAX_STRINGS]; +static const char **fk_name; +static char **fkval; +static char **fk_label; /* function key labels (if any) */ +static int *fk_tested; +static int num_strings = 0; + static int fkmax = 1; /* length of longest key */ static int got_labels = 0; /* true if we have some labels */ static int key_count = 0; @@ -80,6 +75,21 @@ static int fk_length[MAX_FK_UNK]; static int funk; /* + * Initialize arrays that depend on the actual number of strings. + */ +static void +alloc_strings(void) +{ + if (num_strings != MAX_STRINGS) { + num_strings = MAX_STRINGS; + fk_name = (const char **)calloc(num_strings, sizeof(const char *)); + fkval = (char **)calloc(num_strings, sizeof(char *)); + fk_label = (char **)calloc(num_strings, sizeof(char *)); + fk_tested = (int *)calloc(num_strings, sizeof(int)); + } +} + +/* ** keys_tested(first-time, show-help, hex-output) ** ** Display a list of the keys not tested. @@ -93,6 +103,7 @@ keys_tested( int i, l; char outbuf[256]; + alloc_strings(); put_clear(); tty_set(); flush_input(); @@ -102,7 +113,7 @@ keys_tested( if (fk_label[i]) { sprintf(outbuf, "%s %s", fk_name[i] ? fk_name[i] : "??", fk_label[i]); - put_columns(outbuf, strlen(outbuf), 16); + put_columns(outbuf, (int) strlen(outbuf), 16); } } put_newlines(2); @@ -193,6 +204,7 @@ enter_key( { int j; + alloc_strings(); if (value) { j = strlen(value); fkmax = fkmax > j ? fkmax : j; @@ -275,6 +287,7 @@ found_match(char *s, int hx, int cc) int j, f; char outbuf[256]; + alloc_strings(); if (!*s) { return 0; } @@ -571,7 +584,7 @@ funkey_label( for (i = 1; i <= num_labels; i++) { sprintf(outbuf, "L%d..............................", i); outbuf[label_width] = '\0'; - tc_putp(tparm(plab_norm, i, outbuf)); + tc_putp(TPARM_2(plab_norm, i, outbuf)); } if (label_off) { ptext("Hit any key to remove the labels: "); @@ -602,7 +615,7 @@ funkey_prog( sprintf(temp, "(pfx) Set function key %d to transmit abc\\n", fk); ptextln(temp); - tc_putp(tparm(pkey_xmit, fk, "abc\n")); + tc_putp(TPARM_2(pkey_xmit, fk, "abc\n")); sprintf(temp, "Hit function key %d\n", fk); ptextln(temp); for (i = 0; i < 4; ++i) @@ -617,7 +630,7 @@ funkey_prog( } flush_input(); if (key_f1) { - tc_putp(tparm(pkey_xmit, fk, key_f1)); + tc_putp(TPARM_2(pkey_xmit, fk, key_f1)); } } else { ptextln("Function key transmit (pfx), not present."); @@ -645,13 +658,13 @@ funkey_local( "(pfloc) Set function key %d to execute a clear and print \"Done!\"", fk); ptextln(temp); sprintf(temp, "%sDone!", liberated(clear_screen)); - tc_putp(tparm(pkey_local, fk, temp)); + tc_putp(TPARM_2(pkey_local, fk, temp)); sprintf(temp, "Hit function key %d. Then hit return.", fk); ptextln(temp); (void) wait_here(); flush_input(); if (key_f1 && pkey_xmit) { - tc_putp(tparm(pkey_xmit, fk, key_f1)); + tc_putp(TPARM_2(pkey_xmit, fk, key_f1)); } } else { ptextln("Function key execute local (pfloc), not present."); @@ -806,7 +819,7 @@ tools_report( ptextln("Begin echo test."); report_help(crx); } - txt[sizeof(txt) - 1] = '\0'; + memset(txt, 0, sizeof(txt)); save_scan_mode = scan_mode; tty_raw(1, char_mask); for (i = crp = high_bit = 0;;) { diff --git a/contrib/ncurses/tack/init.c b/contrib/ncurses/tack/init.c index 8a2e44fa3cc5..3e52dbf3f902 100644 --- a/contrib/ncurses/tack/init.c +++ b/contrib/ncurses/tack/init.c @@ -15,14 +15,14 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ /* initialization and wrapup code */ #include <tack.h> -MODULE_ID("$Id: init.c,v 1.3 2001/06/16 17:54:19 tom Exp $") +MODULE_ID("$Id: init.c,v 1.7 2006/11/26 00:16:01 tom Exp $") #if NCURSES_VERSION_MAJOR >= 5 || NCURSES_VERSION_PATCH >= 981219 #define _nc_get_curterm(p) _nc_get_tty_mode(p) @@ -159,7 +159,7 @@ display_basic(void) } report_cap(" (clear)", clear_screen); if (!cursor_home && cursor_address) { - report_cap("(cup) (home)", tparm(cursor_address, 0, 0)); + report_cap("(cup) (home)", TPARM_2(cursor_address, 0, 0)); } else { report_cap(" (home)", cursor_home); } @@ -170,7 +170,11 @@ display_basic(void) report_cap("ACK (u8)", user8); #endif - sprintf(temp, "\nTerminal size: %d x %d. Baud rate: %ld. Frame size: %d.%d", columns, lines, tty_baud_rate, tty_frame_size >> 1, (tty_frame_size & 1) * 5); + sprintf(temp, "\nTerminal size: %d x %d. Baud rate: %u. Frame size: %d.%d", + columns, lines, + tty_baud_rate, + tty_frame_size >> 1, + (tty_frame_size & 1) * 5); putln(temp); } @@ -196,9 +200,17 @@ curses_setup( ncurses starts scanning the termcap file. **/ if ((status = _nc_read_entry(tty_basename, tty_filename, &term)) == 0) { - fprintf(stderr, "Terminal not found: TERM=%s\n", tty_basename); - show_usage(exec_name); - exit(1); + const TERMTYPE *fallback = _nc_fallback(tty_basename); + + if (fallback) { + term = *fallback; + sprintf(tty_filename, "(fallback)%s", tty_basename); + status = 1; + } else { + fprintf(stderr, "Terminal not found: TERM=%s\n", tty_basename); + show_usage(exec_name); + exit(1); + } } if (status == -1) { fprintf(stderr, "Terminfo database is inaccessible\n"); diff --git a/contrib/ncurses/tack/menu.c b/contrib/ncurses/tack/menu.c index 6714d58dfc94..b4c8c050ad04 100644 --- a/contrib/ncurses/tack/menu.c +++ b/contrib/ncurses/tack/menu.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include <tack.h> -MODULE_ID("$Id: menu.c,v 1.2 2000/03/04 21:13:53 tom Exp $") +MODULE_ID("$Id: menu.c,v 1.3 2005/09/17 19:49:16 tom Exp $") /* Menu control diff --git a/contrib/ncurses/tack/modes.c b/contrib/ncurses/tack/modes.c index f370ba892cc6..b202fa0e6d88 100644 --- a/contrib/ncurses/tack/modes.c +++ b/contrib/ncurses/tack/modes.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include <tack.h> -MODULE_ID("$Id: modes.c,v 1.1 1998/01/10 00:29:53 tom Exp $") +MODULE_ID("$Id: modes.c,v 1.3 2006/11/26 00:16:21 tom Exp $") /* * Tests boolean flags and terminal modes. @@ -760,16 +760,16 @@ subtest_mir( i = line_count; put_str("\nXXX\nXXX\nXXX\nXXX"); tc_putp(enter_insert_mode); - s = tparm(cursor_address, i + 1, 0); + s = TPARM_2(cursor_address, i + 1, 0); tputs(s, lines, tc_putch); putchp('X'); - s = tparm(cursor_address, i + 2, 1); + s = TPARM_2(cursor_address, i + 2, 1); tputs(s, lines, tc_putch); putchp('X'); - s = tparm(cursor_address, i + 3, 2); + s = TPARM_2(cursor_address, i + 3, 2); tputs(s, lines, tc_putch); putchp('X'); - s = tparm(cursor_address, i + 4, 3); + s = TPARM_2(cursor_address, i + 4, 3); tputs(s, lines, tc_putch); putchp('X'); tc_putp(exit_insert_mode); @@ -812,7 +812,7 @@ subtest_msgr( (enter_alt_charset_mode && exit_alt_charset_mode))) { put_crlf(); i = line_count + 1; - tputs(tparm(cursor_address, i, 0), lines, tc_putch); + tputs(TPARM_2(cursor_address, i, 0), lines, tc_putch); put_mode(enter_alt_charset_mode); put_crlf(); /* @@ -826,11 +826,11 @@ subtest_msgr( put_mode(exit_alt_charset_mode); put_mode(enter_standout_mode); putchp('X'); - tputs(tparm(cursor_address, i + 2, 1), lines, tc_putch); + tputs(TPARM_2(cursor_address, i + 2, 1), lines, tc_putch); putchp('X'); - tputs(tparm(cursor_address, i + 3, 2), lines, tc_putch); + tputs(TPARM_2(cursor_address, i + 3, 2), lines, tc_putch); putchp('X'); - tputs(tparm(cursor_address, i + 4, 3), lines, tc_putch); + tputs(TPARM_2(cursor_address, i + 4, 3), lines, tc_putch); putchp('X'); put_mode(exit_standout_mode); put_crlf(); diff --git a/contrib/ncurses/tack/modules b/contrib/ncurses/tack/modules index 79c2d2265f7b..14a8209266c9 100644 --- a/contrib/ncurses/tack/modules +++ b/contrib/ncurses/tack/modules @@ -1,4 +1,31 @@ -# $Id: modules,v 1.4 1999/04/18 01:43:32 tom Exp $ +############################################################################## +# Copyright (c) 1998-1999,2006 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# $Id: modules,v 1.5 2006/04/22 22:37:18 tom Exp $ @ base ansi progs $(srcdir) $(srcdir)/tack.h ../include/term.h charset progs $(srcdir) $(srcdir)/tack.h ../include/term.h diff --git a/contrib/ncurses/tack/output.c b/contrib/ncurses/tack/output.c index 5825bea8e960..8a3d0f42dfeb 100644 --- a/contrib/ncurses/tack/output.c +++ b/contrib/ncurses/tack/output.c @@ -15,15 +15,15 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ /* screen formatting and I/O utility functions */ #include <tack.h> #include <time.h> -MODULE_ID("$Id: output.c,v 1.7 2001/06/18 18:44:40 tom Exp $") +MODULE_ID("$Id: output.c,v 1.11 2006/11/26 00:16:49 tom Exp $") /* globals */ long char_sent; /* number of characters sent */ @@ -34,7 +34,7 @@ int replace_mode; /* used to output replace mode padding */ int can_go_home; /* TRUE if we can fashion a home command */ int can_clear_screen; /* TRUE if we can somehow clear the screen */ int raw_characters_sent; /* Total output characters */ -int log_count; /* Number of characters on a log line */ +static int log_count; /* Number of characters on a log line */ /* translate mode default strings */ #define TM_carriage_return TM_string[0].value @@ -186,9 +186,9 @@ tt_putp(const char *string) } /* -** tt_putparm(string, reps, arg1, arg2, ...) +** tt_putparm(string, reps, arg1, arg2) ** -** Send tt_tputs(tparm(string, args...), reps) +** Send tt_tputs(tparm(string, args1, arg2), reps) ** Use this function inside timing tests. */ void @@ -216,7 +216,7 @@ tt_putparm( break; } } - (void) tputs(tparm((NCURSES_CONST char *)string, arg1, arg2), reps, tc_putch); + (void) tputs(TPARM_2((NCURSES_CONST char *)string, arg1, arg2), reps, tc_putch); } } @@ -506,10 +506,10 @@ expand(const char *s) for (; (ch = *s); s++) { if ((ch & 0x80) && v) { /* print it in reverse video mode */ - strcpy(t, liberated(tparm(v))); + strcpy(t, liberated(TPARM_0(v))); for (; *t; t++); expand_one(ch & 0x7f, &t); - strcpy(t, liberated(tparm(exit_attribute_mode))); + strcpy(t, liberated(TPARM_0(exit_attribute_mode))); for (; *t; t++); } else { expand_one(ch, &t); diff --git a/contrib/ncurses/tack/pad.c b/contrib/ncurses/tack/pad.c index 980258c46f8a..da1e3d782895 100644 --- a/contrib/ncurses/tack/pad.c +++ b/contrib/ncurses/tack/pad.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include <tack.h> -MODULE_ID("$Id: pad.c,v 1.2 2000/03/04 21:04:58 tom Exp $") +MODULE_ID("$Id: pad.c,v 1.6 2005/09/17 19:49:16 tom Exp $") /* test the pad counts on the terminal */ @@ -61,8 +61,6 @@ static void pad_smso(struct test_list *, int *, int *); static void pad_smacs(struct test_list *, int *, int *); static void pad_crash(struct test_list *, int *, int *); -extern struct test_menu change_pad_menu; - /* Any command found in this list, executed from a "Done" prompt will force the default action to repeat rather than next. @@ -168,10 +166,8 @@ struct test_list pad_test_list[] = { {MENU_LAST, 0, 0, 0, 0, 0, 0} }; -extern int test_complete; /* counts number of tests completed */ - /* globals */ -int hzcc; /* horizontal character count */ +static int hzcc; /* horizontal character count */ char letter; /* current character being displayed */ int letter_number; /* points into letters[] */ int augment, repeats; /* number of characters (or lines) effected */ @@ -1274,7 +1270,7 @@ pad_rin( do { sprintf(temp, "%d\r", test_complete); put_str(temp); - if (scroll_reverse && augment == 1) { + if (scroll_reverse && repeats == 1) { tt_putp(scroll_reverse); } else { tt_putparm(parm_rindex, repeats, repeats, 0); @@ -1345,7 +1341,7 @@ pad_il( } } while(still_testing()); put_str("This line should be on the bottom.\r"); - if (scroll_reverse && augment == 1) { + if (insert_line && augment == 1) { for (i = 1; i < lines; i++) { tt_putp(insert_line); } @@ -1386,8 +1382,13 @@ pad_indn( start_message = "(indn) Scroll-forward-n-lines start testing"; } else { /* ind */ - if (!scroll_forward && over_strike) { + if (!scroll_forward) { CAP_NOT_FOUND; + ptext("(ind) Scroll-forward not present. "); + pad_done_message(t, state, ch); + return; + } + if (over_strike) { ptext("(ind) Scroll-forward not tested on overstrike terminals. "); pad_done_message(t, state, ch); return; @@ -1404,14 +1405,14 @@ pad_indn( do { sprintf(temp, "%d\r", test_complete); put_str(temp); - if (augment > 1) { - tt_putparm(parm_index, repeats, repeats, 0); - } else { + if (scroll_forward && repeats == 1) { put_ind(); + } else { + tt_putparm(parm_index, repeats, repeats, 0); } } while(still_testing()); put_str("This line should be on the top.\r"); - if (augment == 1) { + if (scroll_forward && augment == 1) { for (i = 1; i < lines; i++) { put_ind(); } @@ -1466,26 +1467,26 @@ pad_dl( pad_test_startup(1); do { sprintf(temp, "%d\r", test_complete); - if ((i & 0x7f) == 0 && augment < lines - 1) { + if (augment < lines - 1) { go_home(); putln(temp); } put_str(temp); - if (repeats || !delete_line) { - tt_putparm(parm_delete_line, repeats, repeats, 0); - } else { + if (delete_line && repeats == 1) { tt_putp(delete_line); + } else { + tt_putparm(parm_delete_line, repeats, repeats, 0); } } while(still_testing()); home_down(); put_str("This line should be on the top."); go_home(); - if (repeats || !delete_line) { - tt_putparm(parm_delete_line, lines - 1, lines - 1, 0); - } else { + if (delete_line && augment == 1) { for (i = 1; i < lines; i++) { tt_putp(delete_line); } + } else { + tt_putparm(parm_delete_line, lines - 1, lines - 1, 0); } sprintf(temp, "\nDelete %d line%s. ", augment, augment == 1 ? "" : "s"); @@ -1754,7 +1755,7 @@ pad_csr_cup( put_str(every_line); } tt_putparm(change_scroll_region, 1, 0, lines - 1); - tt_putparm(cursor_address, 1, lines - 1, strlen(every_line)); + tt_putparm(cursor_address, 1, lines - 1, (int) strlen(every_line)); } while(still_testing()); pad_test_shutdown(t, 0); put_str(" "); diff --git a/contrib/ncurses/tack/scan.c b/contrib/ncurses/tack/scan.c index d9429c96ee5a..dbe684bd5ce1 100644 --- a/contrib/ncurses/tack/scan.c +++ b/contrib/ncurses/tack/scan.c @@ -15,31 +15,32 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ /* scan mode keyboard support */ #include <tack.h> -MODULE_ID("$Id: scan.c,v 1.2 1999/08/21 23:09:35 tom Exp $") +MODULE_ID("$Id: scan.c,v 1.5 2005/09/17 19:49:16 tom Exp $") -int scan_max; /* length of longest scan code */ +unsigned scan_max; /* length of longest scan code */ char **scan_up, **scan_down, **scan_name; -int *scan_tested, *scan_length, *scan_value; +unsigned *scan_tested, *scan_length; +static unsigned *scan_value; static int shift_state; static char *str; static int debug_char_count; -#define SHIFT_KEY 0x100 +#define SHIFT_KEY 0x100 #define CONTROL_KEY 0x200 -#define META_KEY 0x400 -#define CAPS_LOCK 0x800 +#define META_KEY 0x400 +#define CAPS_LOCK 0x800 static const struct { const char *name; - int type; + unsigned type; } scan_special[] = { {"<shift>", SHIFT_KEY}, {"<left shift>", SHIFT_KEY}, @@ -102,6 +103,7 @@ scan_init(char *fn) char *s, *sl; FILE *fp; int ch, i, j; + unsigned len; char home[512]; if ((str = getenv("HOME"))) @@ -140,9 +142,9 @@ scan_init(char *fn) scan_up = (char **) malloc(sizeof(char *) * MAX_SCAN); scan_down = (char **) malloc(sizeof(char *) * MAX_SCAN); scan_name = (char **) malloc(sizeof(char *) * MAX_SCAN); - scan_tested = (int *) malloc(sizeof(int *) * MAX_SCAN); - scan_length = (int *) malloc(sizeof(int *) * MAX_SCAN); - scan_value = (int *) malloc(sizeof(int *) * MAX_SCAN); + scan_tested = (unsigned *) malloc(sizeof(unsigned *) * MAX_SCAN); + scan_length = (unsigned *) malloc(sizeof(unsigned *) * MAX_SCAN); + scan_value = (unsigned *) malloc(sizeof(unsigned *) * MAX_SCAN); scan_up[0] = scan_down[0] = scan_name[0] = (char *) 0; str = (char *) malloc(4096); /* buffer space */ sl = str + 4000; /* an upper limit */ @@ -165,11 +167,11 @@ scan_init(char *fn) scan_name[i] = str; scan_length[i] = strlen(scan_down[i]); - ch = strlen(scan_up[i]) + scan_length[i]; - if (ch > scan_max) - scan_max = ch; + len = strlen(scan_up[i]) + scan_length[i]; + if (len > scan_max) + scan_max = len; - scan_value[i] = scan_name[i][0]; + scan_value[i] = UChar(scan_name[i][0]); if (scan_name[i][1]) /* multi-character name */ for (j = 0; scan_special[j].name; j++) { if (!strcmp(scan_name[i], scan_special[j].name)) { @@ -202,7 +204,8 @@ int scan_key(void) { /* read a key and translate scan mode to ASCII */ - int i, j, ch; + unsigned i; + int j, ch; char buf[64]; for (i = 1;; i++) { diff --git a/contrib/ncurses/tack/sync.c b/contrib/ncurses/tack/sync.c index 6eb91b256a75..f9358bb19e32 100644 --- a/contrib/ncurses/tack/sync.c +++ b/contrib/ncurses/tack/sync.c @@ -15,14 +15,14 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include <tack.h> #include <time.h> -MODULE_ID("$Id: sync.c,v 1.3 2001/06/16 17:55:48 tom Exp $") +MODULE_ID("$Id: sync.c,v 1.9 2006/05/06 20:45:48 tom Exp $") /* terminal-synchronization and performance tests */ @@ -31,7 +31,7 @@ static void sync_lines(struct test_list *, int *, int *); static void sync_clear(struct test_list *, int *, int *); static void sync_summary(struct test_list *, int *, int *); -struct test_list sync_test_list[] = { +static struct test_list sync_test_list[] = { {MENU_NEXT, 0, 0, 0, "b) baud rate test", sync_home, 0}, {MENU_NEXT, 0, 0, 0, "l) scroll performance", sync_lines, 0}, {MENU_NEXT, 0, 0, 0, "c) clear screen performance", sync_clear, 0}, @@ -48,16 +48,16 @@ struct test_menu sync_menu = { }; int tty_can_sync; /* TRUE if tty_sync_error() returned FALSE */ -int tty_newline_rate; /* The number of newlines per second */ -int tty_clear_rate; /* The number of clear-screens per second */ -int tty_cps; /* The number of characters per second */ +static int tty_newline_rate; /* The number of newlines per second */ +static int tty_clear_rate; /* The number of clear-screens per second */ +unsigned long tty_cps; /* The number of characters per second */ #define TTY_ACK_SIZE 64 -int ACK_terminator; /* terminating ACK character */ -int ACK_length; /* length of ACK string */ -const char *tty_ENQ; /* enquire string */ -char tty_ACK[TTY_ACK_SIZE]; /* ACK response, set by tty_sync_error() */ +static int ACK_terminator; /* terminating ACK character */ +static int ACK_length; /* length of ACK string */ +static const char *tty_ENQ; /* enquire string */ +static char tty_ACK[TTY_ACK_SIZE]; /* ACK response, set by tty_sync_error() */ /***************************************************************************** * @@ -256,7 +256,7 @@ verify_time(void) ** ** Baudrate test */ -void +static void sync_home( struct test_list *t, int *state, @@ -299,7 +299,7 @@ sync_home( if (tx_cps > tty_cps) { tty_cps = tx_cps; } - sprintf(temp, "%d characters per second. Baudrate %d ", tx_cps, j); + sprintf(temp, "%lu characters per second. Baudrate %d ", tx_cps, j); ptext(temp); generic_done_message(t, state, ch); } @@ -395,7 +395,7 @@ sync_summary( put_crlf(); ptextln("Terminal size characters/sec linefeeds/sec clears/sec"); sprintf(size, "%dx%d", columns, lines); - sprintf(temp, "%-10s%-11s%11d %11d %11d", tty_basename, size, + sprintf(temp, "%-10s%-11s%11lu %11d %11d", tty_basename, size, tty_cps, tty_newline_rate, tty_clear_rate); ptextln(temp); generic_done_message(t, state, ch); diff --git a/contrib/ncurses/tack/sysdep.c b/contrib/ncurses/tack/sysdep.c index d8b480237715..78ae095e3bcb 100644 --- a/contrib/ncurses/tack/sysdep.c +++ b/contrib/ncurses/tack/sysdep.c @@ -15,8 +15,8 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ /* * Operating system dependent functions. We assume the POSIX API. @@ -24,6 +24,9 @@ * global has no effect. */ +#ifdef HAVE_CONFIG_H +#include <ncurses_cfg.h> +#endif #include <signal.h> /* include before curses.h to work around glibc bug */ #include <tack.h> @@ -46,7 +49,7 @@ #endif #endif -MODULE_ID("$Id: sysdep.c,v 1.11 2002/04/21 19:40:43 tom Exp $") +MODULE_ID("$Id: sysdep.c,v 1.15 2005/09/17 19:49:16 tom Exp $") #if DECL_ERRNO extern int errno; @@ -60,7 +63,7 @@ extern int errno; /* globals */ int tty_frame_size; /* asynch frame size times 2 */ -unsigned long tty_baud_rate; /* baud rate - bits per second */ +unsigned tty_baud_rate; /* baud rate - bits per second */ int not_a_tty; /* TRUE if output is not a tty (i.e. pipe) */ int nodelay_read; /* TRUE if NDELAY is set */ @@ -179,8 +182,8 @@ tty_set(void) #endif /* NL1 */ break; } - if (!(new_modes.c_oflag & ~OPOST)) - new_modes.c_oflag &= ~OPOST; + if (!(new_modes.c_oflag & (unsigned long) ~OPOST)) + new_modes.c_oflag &= (unsigned long) ~OPOST; #else new_modes.sg_flags |= RAW; if (not_a_tty) @@ -396,7 +399,7 @@ read_key(char *buf, int max) if (ask > max) { ask = max; } - if ((got = read(fileno(stdin), s, ask))) { + if ((got = read(fileno(stdin), s, (unsigned) ask))) { s += got; } else { break; @@ -497,5 +500,5 @@ set_alarm_clock( { signal(SIGALRM, alarm_event); no_alarm_event = 1; - (void) alarm(seconds); + (void) alarm((unsigned) seconds); } diff --git a/contrib/ncurses/tack/tack.1 b/contrib/ncurses/tack/tack.1 index be74e5852cc9..dcab18f55f75 100644 --- a/contrib/ncurses/tack/tack.1 +++ b/contrib/ncurses/tack/tack.1 @@ -1,3 +1,32 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. * +.\" * +.\" Permission is hereby granted, free of charge, to any person obtaining a * +.\" copy of this software and associated documentation files (the * +.\" "Software"), to deal in the Software without restriction, including * +.\" without limitation the rights to use, copy, modify, merge, publish, * +.\" distribute, distribute with modifications, sublicense, and/or sell * +.\" copies of the Software, and to permit persons to whom the Software is * +.\" furnished to do so, subject to the following conditions: * +.\" * +.\" The above copyright notice and this permission notice shall be included * +.\" in all copies or substantial portions of the Software. * +.\" * +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * +.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * +.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * +.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * +.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * +.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * +.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. * +.\" * +.\" Except as contained in this notice, the name(s) of the above copyright * +.\" holders shall not be used in advertising or otherwise to promote the * +.\" sale, use or other dealings in this Software without prior written * +.\" authorization. * +.\"*************************************************************************** +.\" +.\" $Id: tack.1,v 1.3 2006/04/22 22:26:55 tom Exp $ .TH tack 1M "" .ds n 5 .ds d @TERMINFO@ @@ -294,7 +323,7 @@ If you make changes to the terminfo entry \fBtack\fR will save the new terminfo to a file. The file will have the same name as the terminal name. .SH SEE ALSO -\fBterminfo\fR(\*n), \fBncurses\fR(3X), \fBtic\fR(1m), \fBinfocmp\fR(1m). +\fBterminfo\fR(\*n), \fBncurses\fR(3X), \fBtic\fR(1M), \fBinfocmp\fR(1M). You should also have the documentation supplied by the terminal manufacturer. .SH BUGS diff --git a/contrib/ncurses/tack/tack.c b/contrib/ncurses/tack/tack.c index f6e37d44181b..946a2fbf4e82 100644 --- a/contrib/ncurses/tack/tack.c +++ b/contrib/ncurses/tack/tack.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include <tack.h> -MODULE_ID("$Id: tack.c,v 1.2 2001/10/28 01:05:35 tom Exp $") +MODULE_ID("$Id: tack.c,v 1.4 2005/09/17 19:49:16 tom Exp $") /* This program is designed to test terminfo, not curses. Therefore @@ -62,14 +62,12 @@ FILE *log_fp; /* Terminal logfile */ * *****************************************************************************/ -extern struct test_menu sync_menu; - static void tools_hex_echo(struct test_list *, int *, int *); static void tools_debug(struct test_list *, int *, int *); static char hex_echo_menu_entry[80]; -struct test_list tools_test_list[] = { +static struct test_list tools_test_list[] = { {0, 0, 0, 0, "s) ANSI status reports", tools_status, 0}, {0, 0, 0, 0, "g) ANSI SGR modes (bold, underline, reverse)", tools_sgr, 0}, {0, 0, 0, 0, "c) ANSI character sets", tools_charset, 0}, @@ -83,7 +81,7 @@ struct test_list tools_test_list[] = { {MENU_LAST, 0, 0, 0, 0, 0, 0} }; -struct test_menu tools_menu = { +static struct test_menu tools_menu = { 0, 'q', 0, "Tools Menu", "tools", 0, 0, tools_test_list, 0, 0, 0 }; @@ -115,24 +113,18 @@ static struct test_menu tty_menu = { tty_show_state, tty_test_list, 0, 0, 0 }; -extern struct test_list edit_test_list[]; - struct test_menu edit_menu = { 0, 'q', 0, "Edit terminfo menu", "edit", 0, 0, edit_test_list, 0, 0, 0 }; -extern struct test_list mode_test_list[]; - -struct test_menu mode_menu = { +static struct test_menu mode_menu = { 0, 'n', 0, "Test modes and glitches:", "mode", "n) run standard tests", 0, mode_test_list, 0, 0, 0 }; -extern struct test_list acs_test_list[]; - static struct test_menu acs_menu = { 0, 'n', 0, "Test alternate character set and graphics rendition:", @@ -140,17 +132,13 @@ static struct test_menu acs_menu = { 0, acs_test_list, 0, 0, 0 }; -extern struct test_list color_test_list[]; - -struct test_menu color_menu = { +static struct test_menu color_menu = { 0, 'n', 0, "Test color:", "color", "n) run standard tests", 0, color_test_list, 0, 0, 0 }; -extern struct test_list crum_test_list[]; - static struct test_menu crum_menu = { 0, 'n', 0, "Test cursor movement:", @@ -158,8 +146,6 @@ static struct test_menu crum_menu = { 0, crum_test_list, 0, 0, 0 }; -extern struct test_list funkey_test_list[]; - static struct test_menu funkey_menu = { 0, 'n', 0, "Test function keys:", @@ -167,8 +153,6 @@ static struct test_menu funkey_menu = { sync_test, funkey_test_list, 0, 0, 0 }; -extern struct test_list printer_test_list[]; - static struct test_menu printer_menu = { 0, 'n', 0, "Test printer:", @@ -177,7 +161,6 @@ static struct test_menu printer_menu = { }; static void pad_gen(struct test_list *, int *, int *); -extern struct test_list pad_test_list[]; static struct test_menu pad_menu = { 0, 'n', 0, @@ -203,7 +186,7 @@ static struct test_list normal_test_list[] = { }; -struct test_menu normal_menu = { +static struct test_menu normal_menu = { 0, 'n', 0, "Main test menu", "test", "n) run standard tests", 0, normal_test_list, 0, 0, 0 @@ -216,7 +199,7 @@ static void start_log(struct test_list *, int *, int *); static char logging_menu_entry[80] = "l) start logging"; -struct test_list start_test_list[] = { +static struct test_list start_test_list[] = { {0, 0, 0, 0, "b) display basic information", start_basic, 0}, {0, 0, 0, 0, "m) change modes", start_modes, 0}, {0, 0, 0, 0, "t) tools", start_tools, 0}, @@ -226,7 +209,7 @@ struct test_list start_test_list[] = { }; -struct test_menu start_menu = { +static struct test_menu start_menu = { 0, 'n', 0, "Main Menu", "tack", 0, 0, start_test_list, 0, 0, 0 }; @@ -319,7 +302,7 @@ tty_show_state( { put_crlf(); (void) sprintf(temp, - "Accepting %d bits, UNIX delays %d, XON/XOFF %sabled, speed %ld, translate %s, scan-code mode %s.", + "Accepting %d bits, UNIX delays %d, XON/XOFF %sabled, speed %u, translate %s, scan-code mode %s.", (char_mask == ALLOW_PARITY) ? 8 : 7, select_delay_type, select_xon_xoff ? "en" : "dis", diff --git a/contrib/ncurses/tack/tack.h b/contrib/ncurses/tack/tack.h index daca1e12c489..933f542bdb2e 100644 --- a/contrib/ncurses/tack/tack.h +++ b/contrib/ncurses/tack/tack.h @@ -15,11 +15,11 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ -/* $Id: tack.h,v 1.9 2001/06/18 18:44:49 tom Exp $ */ +/* $Id: tack.h,v 1.16 2006/11/25 23:45:00 tom Exp $ */ #ifndef NCURSES_TACK_H_incl #define NCURSES_TACK_H_incl 1 @@ -27,7 +27,7 @@ /* terminfo action checker include file */ #define MAJOR_VERSION 1 -#define MINOR_VERSION 0 +#define MINOR_VERSION 1 #ifdef HAVE_CONFIG_H #include <ncurses_cfg.h> @@ -48,6 +48,7 @@ #include <curses.h> #include <term_entry.h> +#include <nc_tparm.h> #if USE_RCS_IDS #define MODULE_ID(id) static const char Ident[] = id; @@ -60,6 +61,10 @@ extern char *_nc_strstr(const char *, const char *); #define strstr(h,n) _nc_strstr(h,n) #endif +#define CUR_TP (&(cur_term->type)) +#define MAX_STRINGS NUM_STRINGS(CUR_TP) +#define STR_NAME(n) ExtStrname(CUR_TP,n,strnames) + #define UChar(c) ((unsigned char)(c)) extern FILE *log_fp; @@ -77,9 +82,9 @@ extern char tty_shortname[]; extern int tty_can_sync; extern int total_pads_sent; /* count pad characters sent */ extern int total_caps_sent; /* count caps sent */ -extern int total_printing_characters; /* count printing characters sent */ +extern int total_printing_characters; /* count printing characters sent */ extern int no_alarm_event; /* TRUE if the alarm has not gone off yet */ -extern int usec_run_time; /* length of last test in microseconds */ +extern unsigned long usec_run_time; /* length of last test in microseconds */ extern int raw_characters_sent; /* Total output characters */ /* Stopwatch event timers */ @@ -129,8 +134,8 @@ extern int select_delay_type; extern int select_xon_xoff; extern int tty_frame_size; -extern unsigned long tty_baud_rate; -extern int tty_cps; /* The number of characters per second */ +extern unsigned tty_baud_rate; +extern unsigned long tty_cps; /* The number of characters per second */ extern int not_a_tty, nodelay_read; extern int send_reset_init; @@ -194,7 +199,7 @@ extern int tx_delay[TT_MAX]; /* Number of milliseconds delay */ extern int tx_index[TT_MAX]; /* String index */ extern int txp; /* number of entries used */ extern int tx_characters; /* printing characters sent by test */ -extern int tx_cps; /* characters per second */ +extern unsigned long tx_cps; /* characters per second */ /* Menu control for tack. @@ -268,138 +273,156 @@ struct test_menu { #define REQUEST_PROMPT 256 -extern char prompt_string[80]; /* menu prompt storage */ -extern struct test_menu edit_menu; -extern struct test_list *augment_test; - /* tack.c */ +extern struct test_menu edit_menu; extern void show_usage(char *); extern void print_version(void); /* output.c */ -extern void tt_tputs(const char *, int); -extern void tt_putp(const char *); -extern void tt_putparm(NCURSES_CONST char *, int, int, int); -extern int tc_putp(const char *); +extern char *expand(const char *); +extern char *expand_command(const char *); +extern char *expand_to(char *, int); +extern char *hex_expand_to(char *, int); +extern char *print_expand(char *); +extern int getchp(int); +extern int getnext(int); extern int tc_putch(int); -extern void putchp(int); +extern int tc_putp(const char *); +extern int wait_here(void); +extern void go_home(void); +extern void home_down(void); +extern void maybe_wait(int); +extern void ptext(const char *); +extern void ptextln(const char *); +extern void put_clear(void); +extern void put_columns(const char *, int, int); extern void put_cr(void); extern void put_crlf(void); -extern void put_clear(void); extern void put_dec(char *, int); -extern void put_str(const char *); -extern void put_lf(void); extern void put_ind(void); +extern void put_lf(void); extern void put_newlines(int); -extern void put_columns(const char *, int, int); +extern void put_str(const char *); extern void put_this(int); +extern void putchp(int); extern void putln(const char *); -extern void ptext(const char *); -extern void ptextln(const char *); -extern void home_down(void); -extern void go_home(void); -extern void three_digit(char *, int); -extern int getchp(int); -extern char *expand(const char *); -extern char *expand_to(char *, int); -extern char *expand_command(const char *); -extern char *hex_expand_to(char *, int); -extern char *print_expand(char *); -extern void maybe_wait(int); -extern int wait_here(void); extern void read_string(char *, int); -extern int getnext(int); +extern void three_digit(char *, int); +extern void tt_putp(const char *); +extern void tt_putparm(NCURSES_CONST char *, int, int, int); +extern void tt_tputs(const char *, int); + +#define put_that(n) put_this((int) (n)) /* control.c */ -extern void event_start(int); -extern long event_time(int); +extern struct test_list color_test_list[]; extern char *liberated(char *); -extern void page_loop(void); -extern void control_init(void); +extern char txt_longer_augment[80]; +extern char txt_longer_test_time[80]; +extern char txt_shorter_augment[80]; +extern char txt_shorter_test_time[80]; extern int msec_cost(const char *const, int); extern int skip_pad_test(struct test_list *, int *, int *, const char *); -extern void pad_test_startup(int); +extern int sliding_scale(int, int, unsigned long); extern int still_testing(void); -extern void pad_test_shutdown(struct test_list *, int); +extern long event_time(int); +extern void control_init(void); extern void dump_test_stats(struct test_list *, int *, int *); +extern void event_start(int); +extern void longer_augment(struct test_list *, int *, int *); extern void longer_test_time(struct test_list *, int *, int *); -extern void shorter_test_time(struct test_list *, int *, int *); -extern char txt_longer_test_time[80]; -extern char txt_shorter_test_time[80]; +extern void pad_test_shutdown(struct test_list *, int); +extern void pad_test_startup(int); +extern void page_loop(void); extern void set_augment_txt(void); -extern void longer_augment(struct test_list *, int *, int *); extern void shorter_augment(struct test_list *, int *, int *); -extern char txt_longer_augment[80]; -extern char txt_shorter_augment[80]; -extern int sliding_scale(int, int, int); - -/* sync.c */ -extern void verify_time(void); -extern int tty_sync_error(void); -extern void flush_input(void); -extern void sync_test(struct test_menu *); -extern void sync_handshake(struct test_list *, int *, int *); +extern void shorter_test_time(struct test_list *, int *, int *); /* charset.c */ +extern struct test_list acs_test_list[]; extern void set_attr(int); extern void eat_cookie(void); extern void put_mode(char *); -/* init.c */ -extern void reset_init(void); -extern void display_basic(void); -extern void put_name(const char *, const char *); -extern void charset_can_test(void); -extern void curses_setup(char *); -extern void bye_kids(int); - -/* scan.c */ -extern int scan_key(void); -extern void scan_init(char *fn); +/* crum.c */ +extern struct test_list crum_test_list[]; /* ansi.c */ extern void tools_status(struct test_list *, int *, int *); extern void tools_charset(struct test_list *, int *, int *); extern void tools_sgr(struct test_list *, int *, int *); -/* pad.c */ +/* edit.c */ +extern struct test_menu change_pad_menu; +extern struct test_list edit_test_list[]; +extern char *get_string_cap_byname(const char *, const char **); +extern int cap_match(const char *names, const char *cap); +extern int get_string_cap_byvalue(const char *); +extern int user_modified(void); +extern void can_test(const char *, int); +extern void cap_index(const char *, int *); +extern void edit_init(void); +extern void save_info(struct test_list *, int *, int *); +extern void show_report(struct test_list *, int *, int *); /* fun.c */ +extern struct test_list funkey_test_list[]; +extern struct test_list printer_test_list[]; extern void enter_key(const char *, char *, char *); extern int tty_meta_prep(void); extern void tools_report(struct test_list *, int *, int *); +/* init.c */ +extern void reset_init(void); +extern void display_basic(void); +extern void put_name(const char *, const char *); +extern void charset_can_test(void); +extern void curses_setup(char *); +extern void bye_kids(int); + +/* scan.c */ +extern char **scan_up, **scan_down, **scan_name; +extern int scan_key(void); +extern unsigned scan_max; /* length of longest scan code */ +extern unsigned *scan_tested, *scan_length; +extern void scan_init(char *fn); + /* sysdep.c */ -extern void tty_set(void); -extern void tty_raw(int, int); -extern void tty_init(void); -extern void tty_reset(void); -extern void spin_flush(void); +extern int initial_stty_query(int); +extern int stty_query(int); +extern void ignoresig(void); extern void read_key(char *, int); extern void set_alarm_clock(int); -extern void ignoresig(void); -extern int stty_query(int); -extern int initial_stty_query(int); - -/* edit.c */ -extern int user_modified(void); -extern void save_info(struct test_list *, int *, int *); -extern void can_test(const char *, int); -extern void cap_index(const char *, int *); -extern int cap_match(const char *names, const char *cap); -extern void edit_init(void); -extern char *get_string_cap_byname(const char *, const char **); -extern int get_string_cap_byvalue(const char *); -extern void show_report(struct test_list *, int *, int *); +extern void spin_flush(void); +extern void tty_init(void); +extern void tty_raw(int, int); +extern void tty_reset(void); +extern void tty_set(void); /* menu.c */ -extern void menu_prompt(void); -extern void menu_can_scan(const struct test_menu *); -extern void menu_display(struct test_menu *, int *); +extern char prompt_string[80]; /* menu prompt storage */ +extern int subtest_menu(struct test_list *, int *, int *); +extern struct test_list *augment_test; extern void generic_done_message(struct test_list *, int *, int *); -extern void pad_done_message(struct test_list *, int *, int *); +extern void menu_can_scan(const struct test_menu *); extern void menu_clear_screen(struct test_list *, int *, int *); +extern void menu_display(struct test_menu *, int *); +extern void menu_prompt(void); extern void menu_reset_init(struct test_list *, int *, int *); -extern int subtest_menu(struct test_list *, int *, int *); +extern void pad_done_message(struct test_list *, int *, int *); + +/* modes.c */ +extern struct test_list mode_test_list[]; + +/* pad.c */ +extern struct test_list pad_test_list[]; + +/* sync.c */ +extern struct test_menu sync_menu; +extern int tty_sync_error(void); +extern void flush_input(void); +extern void sync_handshake(struct test_list *, int *, int *); +extern void sync_test(struct test_menu *); +extern void verify_time(void); #endif /* NCURSES_TACK_H_incl */ |