aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/progs
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2007-12-30 11:08:14 +0000
committerRong-En Fan <rafan@FreeBSD.org>2007-12-30 11:08:14 +0000
commit5ca44d1c915a0e0c87f8f347e61f7bfa65d609af (patch)
tree319eb1471eaf8c0c9cfc606e7cb8987ca9167507 /contrib/ncurses/progs
parent01b82453a3d0c6d76d4afc340c07cfc2be4a6b7a (diff)
downloadsrc-5ca44d1c915a0e0c87f8f347e61f7bfa65d609af.tar.gz
src-5ca44d1c915a0e0c87f8f347e61f7bfa65d609af.zip
Import ncurses 5.6-20071222 snapshot onto the vender branch
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=174993
Diffstat (limited to 'contrib/ncurses/progs')
-rw-r--r--contrib/ncurses/progs/Makefile.in35
-rw-r--r--contrib/ncurses/progs/clear.c5
-rw-r--r--contrib/ncurses/progs/dump_entry.c21
-rw-r--r--contrib/ncurses/progs/infocmp.c161
-rw-r--r--contrib/ncurses/progs/modules8
-rw-r--r--contrib/ncurses/progs/progs.priv.h13
-rw-r--r--contrib/ncurses/progs/tic.c38
-rw-r--r--contrib/ncurses/progs/toe.c11
-rw-r--r--contrib/ncurses/progs/tput.c8
-rw-r--r--contrib/ncurses/progs/tset.c24
10 files changed, 206 insertions, 118 deletions
diff --git a/contrib/ncurses/progs/Makefile.in b/contrib/ncurses/progs/Makefile.in
index 820e0b439a6b..38f4e74fbb8e 100644
--- a/contrib/ncurses/progs/Makefile.in
+++ b/contrib/ncurses/progs/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.70 2006/12/17 15:55:48 tom Exp $
+# $Id: Makefile.in,v 1.77 2007/10/13 22:25:53 tom Exp $
##############################################################################
-# Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2006,2007 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"), #
@@ -98,9 +98,8 @@ ABI_VERSION = @cf_cv_abi_version@
LOCAL_LIBDIR = @top_builddir@/lib
LD = @LD@
-LINK = @LINK_PROGS@ $(LIBTOOL_LINK) $(CC)
-LDFLAGS = @EXTRA_LDFLAGS@ \
- @TINFO_ARGS@ @LDFLAGS@ @LD_MODEL@ @LIBS@
+LINK = @LINK_PROGS@ $(LIBTOOL_LINK)
+LDFLAGS = @EXTRA_LDFLAGS@ @LDFLAGS@
LDFLAGS_LIBTOOL = $(LDFLAGS) $(CFLAGS_LIBTOOL)
LDFLAGS_NORMAL = $(LDFLAGS) $(CFLAGS_NORMAL)
@@ -110,6 +109,12 @@ LDFLAGS_SHARED = $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@
LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@)
+LIBS_TIC = @LDFLAGS_STATIC@ @TICS_ARGS@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@
+LDFLAGS_TIC = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TIC)
+
+LIBS_TINFO = @LDFLAGS_STATIC@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@
+LDFLAGS_TINFO = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO)
+
LINT = @LINT@
LINT_OPTS = @LINT_OPTS@
LINT_LIBS = -lncurses @LIBS@
@@ -200,7 +205,7 @@ uninstall.progs:
-@rm -f $(DESTDIR)$(bindir)/$(actual_reset)
$(DESTDIR)$(bindir) :
- sh $(srcdir)/../mkinstalldirs $@
+ sh $(srcdir)/../mkdirs.sh $@
#
# Utilities normally built by make all start here
@@ -211,40 +216,38 @@ DEPS_TIC = \
$(MODEL)/dump_entry$o
tic$x: $(DEPS_TIC) $(DEPS_CURSES) transform.h
- @ECHO_LINK@ $(LINK) $(DEPS_TIC) $(LDFLAGS_DEFAULT) -o $@
+ @ECHO_LINK@ $(LINK) $(DEPS_TIC) $(LDFLAGS_TIC) -o $@
DEPS_TOE = \
- $(MODEL)/toe$o \
- $(MODEL)/dump_entry$o
+ $(MODEL)/toe$o
toe$x: $(DEPS_TOE) $(DEPS_CURSES)
- @ECHO_LINK@ $(LINK) $(DEPS_TOE) $(LDFLAGS_DEFAULT) -o $@
+ @ECHO_LINK@ $(LINK) $(DEPS_TOE) $(LDFLAGS_TIC) -o $@
DEPS_CLEAR = \
$(MODEL)/clear$o
clear$x: $(DEPS_CLEAR) $(DEPS_CURSES)
- @ECHO_LINK@ $(LINK) $(DEPS_CLEAR) $(LDFLAGS_DEFAULT) -o $@
+ @ECHO_LINK@ $(LINK) $(DEPS_CLEAR) $(LDFLAGS_TINFO) -o $@
DEPS_TPUT = \
$(MODEL)/tput$o
tput$x: $(DEPS_TPUT) $(DEPS_CURSES) transform.h
- @ECHO_LINK@ $(LINK) $(DEPS_TPUT) $(LDFLAGS_DEFAULT) -o $@
+ @ECHO_LINK@ $(LINK) $(DEPS_TPUT) $(LDFLAGS_TINFO) -o $@
DEPS_INFOCMP = \
$(MODEL)/infocmp$o \
$(MODEL)/dump_entry$o
infocmp$x: $(DEPS_INFOCMP) $(DEPS_CURSES)
- @ECHO_LINK@ $(LINK) $(DEPS_INFOCMP) $(LDFLAGS_DEFAULT) -o $@
+ @ECHO_LINK@ $(LINK) $(DEPS_INFOCMP) $(LDFLAGS_TIC) -o $@
DEPS_TSET = \
- $(MODEL)/tset$o \
- $(MODEL)/dump_entry$o
+ $(MODEL)/tset$o
tset$x: $(DEPS_TSET) $(DEPS_CURSES) transform.h
- @ECHO_LINK@ $(LINK) $(DEPS_TSET) $(LDFLAGS_DEFAULT) -o $@
+ @ECHO_LINK@ $(LINK) $(DEPS_TSET) $(LDFLAGS_TINFO) -o $@
termsort.c: $(srcdir)/MKtermsort.sh
sh $(srcdir)/MKtermsort.sh $(AWK) $(srcdir)/../include/@TERMINFO_CAPS@ >$@
diff --git a/contrib/ncurses/progs/clear.c b/contrib/ncurses/progs/clear.c
index 4e4aaa98aabc..9f5a543848a1 100644
--- a/contrib/ncurses/progs/clear.c
+++ b/contrib/ncurses/progs/clear.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,9 +36,10 @@
* clear.c -- clears the terminal's screen
*/
+#define USE_LIBTINFO
#include <progs.priv.h>
-MODULE_ID("$Id: clear.c,v 1.10 2006/05/20 17:47:47 tom Exp $")
+MODULE_ID("$Id: clear.c,v 1.11 2007/10/13 22:16:02 tom Exp $")
static int
putch(int c)
diff --git a/contrib/ncurses/progs/dump_entry.c b/contrib/ncurses/progs/dump_entry.c
index 0a3cb38059cd..6320f3c1cf9f 100644
--- a/contrib/ncurses/progs/dump_entry.c
+++ b/contrib/ncurses/progs/dump_entry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,7 +39,7 @@
#include "termsort.c" /* this C file is generated */
#include <parametrized.h> /* so is this */
-MODULE_ID("$Id: dump_entry.c,v 1.79 2006/09/30 20:18:15 tom Exp $")
+MODULE_ID("$Id: dump_entry.c,v 1.81 2007/08/25 20:05:35 tom Exp $")
#define INDENT 8
#define DISCARD(string) string = ABSENT_STRING
@@ -352,14 +352,17 @@ version_filter(PredType type, PredIdx idx)
}
break;
+#define is_termcap(type) (idx < (int) sizeof(type##_from_termcap) && \
+ type##_from_termcap[idx])
+
case V_BSD: /* BSD */
switch (type) {
case BOOLEAN:
- return bool_from_termcap[idx];
+ return is_termcap(bool);
case NUMBER:
- return num_from_termcap[idx];
+ return is_termcap(num);
case STRING:
- return str_from_termcap[idx];
+ return is_termcap(str);
}
break;
}
@@ -788,11 +791,11 @@ fmt_entry(TERMTYPE *tterm,
* Much more work should be done on this to support dumping termcaps.
*/
if (tversion == V_HPUX) {
- if (memory_lock) {
+ if (VALID_STRING(memory_lock)) {
(void) sprintf(buffer, "meml=%s", memory_lock);
WRAP_CONCAT;
}
- if (memory_unlock) {
+ if (VALID_STRING(memory_unlock)) {
(void) sprintf(buffer, "memu=%s", memory_unlock);
WRAP_CONCAT;
}
@@ -1223,7 +1226,7 @@ repair_acsc(TERMTYPE *tp)
bool fix_needed = FALSE;
for (n = 0, source = 0; acs_chars[n] != 0; n++) {
- target = acs_chars[n];
+ target = UChar(acs_chars[n]);
if (source >= target) {
fix_needed = TRUE;
break;
@@ -1235,7 +1238,7 @@ repair_acsc(TERMTYPE *tp)
if (fix_needed) {
memset(mapped, 0, sizeof(mapped));
for (n = 0; acs_chars[n] != 0; n++) {
- source = acs_chars[n];
+ source = UChar(acs_chars[n]);
if ((target = (unsigned char) acs_chars[n + 1]) != 0) {
mapped[source] = target;
n++;
diff --git a/contrib/ncurses/progs/infocmp.c b/contrib/ncurses/progs/infocmp.c
index d3353f26415e..9b74ba00d542 100644
--- a/contrib/ncurses/progs/infocmp.c
+++ b/contrib/ncurses/progs/infocmp.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,18 +35,18 @@
/*
* infocmp.c -- decompile an entry, or compare two entries
* written by Eric S. Raymond
+ * and Thomas E Dickey
*/
#include <progs.priv.h>
#include <dump_entry.h>
-MODULE_ID("$Id: infocmp.c,v 1.85 2006/08/19 21:20:37 tom Exp $")
+MODULE_ID("$Id: infocmp.c,v 1.94 2007/11/17 23:34:26 tom Exp $")
#define L_CURL "{"
#define R_CURL "}"
-#define MAXTERMS 32 /* max # terminal arguments we can handle */
#define MAX_STRING 1024 /* maximum formatted string */
const char *_nc_progname = "infocmp";
@@ -60,8 +60,7 @@ typedef char path[PATH_MAX];
*
***************************************************************************/
-static char *tname[MAXTERMS]; /* terminal type names */
-static ENTRY entries[MAXTERMS]; /* terminfo entries */
+static ENTRY *entries; /* terminfo entries */
static int termcount; /* count of terminal entries */
static bool limited = TRUE; /* "-r" option is not set */
@@ -96,7 +95,8 @@ ExitProgram(int code)
while (termcount-- > 0)
_nc_free_termtype(&entries[termcount].tterm);
_nc_leaks_dump_entry();
- _nc_free_and_exit(code);
+ free(entries);
+ _nc_free_tic(code);
}
#endif
@@ -932,7 +932,8 @@ file_comparison(int argc, char *argv[])
case C_DIFFERENCE:
if (itrace)
(void) fprintf(stderr,
- "infocmp: dumping differences\n");
+ "%s: dumping differences\n",
+ _nc_progname);
(void) printf("comparing %s to %s.\n", name1, name2);
compare_entry(compare_predicate, &entries->tterm, quiet);
break;
@@ -940,7 +941,8 @@ file_comparison(int argc, char *argv[])
case C_COMMON:
if (itrace)
(void) fprintf(stderr,
- "infocmp: dumping common capabilities\n");
+ "%s: dumping common capabilities\n",
+ _nc_progname);
(void) printf("comparing %s to %s.\n", name1, name2);
compare_entry(compare_predicate, &entries->tterm, quiet);
break;
@@ -948,7 +950,8 @@ file_comparison(int argc, char *argv[])
case C_NAND:
if (itrace)
(void) fprintf(stderr,
- "infocmp: dumping differences\n");
+ "%s: dumping differences\n",
+ _nc_progname);
(void) printf("comparing %s to %s.\n", name1, name2);
compare_entry(compare_predicate, &entries->tterm, quiet);
break;
@@ -1083,7 +1086,6 @@ dump_initializers(TERMTYPE *term)
}
*tp++ = '"';
*tp = '\0';
- size += (strlen(term->Strings[n]) + 1);
(void) printf("static char %-20s[] = %s;\n",
string_variable(ExtStrname(term, n, strnames)), buf);
}
@@ -1237,7 +1239,8 @@ terminal_env(void)
if ((terminal = getenv("TERM")) == 0) {
(void) fprintf(stderr,
- "infocmp: environment variable TERM not set\n");
+ "%s: environment variable TERM not set\n",
+ _nc_progname);
exit(EXIT_FAILURE);
}
return terminal;
@@ -1252,10 +1255,15 @@ terminal_env(void)
int
main(int argc, char *argv[])
{
- char *firstdir, *restdir;
/* Avoid "local data >32k" error with mwcc */
/* Also avoid overflowing smaller stacks on systems like AmigaOS */
- path *tfile = (path *) malloc(sizeof(path) * MAXTERMS);
+ path *tfile = 0;
+ char **tname = 0;
+ int maxterms;
+
+ char **myargv;
+
+ char *firstdir, *restdir;
int c, i, len;
bool formatted = FALSE;
bool filecompare = FALSE;
@@ -1270,9 +1278,16 @@ main(int argc, char *argv[])
use_extended_names(FALSE);
#endif
+ _nc_progname = _nc_rootname(argv[0]);
+
+ /* make sure we have enough space to add two terminal entries */
+ myargv = typeCalloc(char *, argc + 3);
+ memcpy(myargv, argv, sizeof(char *) * argc);
+ argv = myargv;
+
while ((c = getopt(argc,
argv,
- "1A:aB:CcdEeFfGgIiLlnpqR:rs:TtUuVv:w:x")) != EOF) {
+ "1A:aB:CcdEeFfGgIiLlnpqR:rs:TtUuVv:w:x")) != -1) {
switch (c) {
case '1':
mwidth = 0;
@@ -1373,7 +1388,6 @@ main(int argc, char *argv[])
case 'r':
tversion = 0;
- limited = FALSE;
break;
case 's':
@@ -1387,7 +1401,8 @@ main(int argc, char *argv[])
sortmode = S_TERMCAP;
else {
(void) fprintf(stderr,
- "infocmp: unknown sort mode\n");
+ "%s: unknown sort mode\n",
+ _nc_progname);
ExitProgram(EXIT_FAILURE);
}
break;
@@ -1435,6 +1450,18 @@ main(int argc, char *argv[])
}
}
+ maxterms = (argc + 1 - optind);
+ tfile = typeMalloc(path, maxterms);
+ tname = typeCalloc(char *, maxterms);
+ entries = typeCalloc(ENTRY, maxterms);
+
+ if (tfile == 0
+ || tname == 0
+ || entries == 0) {
+ fprintf(stderr, "%s: not enough memory\n", _nc_progname);
+ ExitProgram(EXIT_FAILURE);
+ }
+
/* by default, sort by terminfo name */
if (sortmode == S_DEFAULT)
sortmode = S_TERMINFO;
@@ -1458,53 +1485,56 @@ main(int argc, char *argv[])
/* grab the entries */
termcount = 0;
for (; optind < argc; optind++) {
- if (termcount >= MAXTERMS) {
- (void) fprintf(stderr,
- "infocmp: too many terminal type arguments\n");
- ExitProgram(EXIT_FAILURE);
- } else {
- const char *directory = termcount ? restdir : firstdir;
- int status;
+ const char *directory = termcount ? restdir : firstdir;
+ int status;
- tname[termcount] = argv[optind];
+ tname[termcount] = argv[optind];
- if (directory) {
+ if (directory) {
#if USE_DATABASE
- (void) sprintf(tfile[termcount], "%s/%c/%s",
- directory,
- *argv[optind], argv[optind]);
- if (itrace)
- (void) fprintf(stderr,
- "infocmp: reading entry %s from file %s\n",
- argv[optind], tfile[termcount]);
-
- status = _nc_read_file_entry(tfile[termcount],
- &entries[termcount].tterm);
+#if MIXEDCASE_FILENAMES
+#define LEAF_FMT "%c"
#else
- (void) fprintf(stderr, "terminfo files not supported\n");
- ExitProgram(EXIT_FAILURE);
+#define LEAF_FMT "%02x"
#endif
- } else {
- if (itrace)
- (void) fprintf(stderr,
- "infocmp: reading entry %s from database\n",
- tname[termcount]);
-
- status = _nc_read_entry(tname[termcount],
- tfile[termcount],
- &entries[termcount].tterm);
- directory = TERMINFO; /* for error message */
- }
+ (void) sprintf(tfile[termcount], "%s/" LEAF_FMT "/%s",
+ directory,
+ UChar(*argv[optind]), argv[optind]);
+ if (itrace)
+ (void) fprintf(stderr,
+ "%s: reading entry %s from file %s\n",
+ _nc_progname,
+ argv[optind], tfile[termcount]);
- if (status <= 0) {
+ status = _nc_read_file_entry(tfile[termcount],
+ &entries[termcount].tterm);
+#else
+ (void) fprintf(stderr, "%s: terminfo files not supported\n",
+ _nc_progname);
+ ExitProgram(EXIT_FAILURE);
+#endif
+ } else {
+ if (itrace)
(void) fprintf(stderr,
- "infocmp: couldn't open terminfo file %s.\n",
- tfile[termcount]);
- ExitProgram(EXIT_FAILURE);
- }
- repair_acsc(&entries[termcount].tterm);
- termcount++;
+ "%s: reading entry %s from database\n",
+ _nc_progname,
+ tname[termcount]);
+
+ status = _nc_read_entry(tname[termcount],
+ tfile[termcount],
+ &entries[termcount].tterm);
+ directory = TERMINFO; /* for error message */
+ }
+
+ if (status <= 0) {
+ (void) fprintf(stderr,
+ "%s: couldn't open terminfo file %s.\n",
+ _nc_progname,
+ tfile[termcount]);
+ ExitProgram(EXIT_FAILURE);
}
+ repair_acsc(&entries[termcount].tterm);
+ termcount++;
}
#if NCURSES_XNAMES
@@ -1542,7 +1572,8 @@ main(int argc, char *argv[])
case C_DEFAULT:
if (itrace)
(void) fprintf(stderr,
- "infocmp: about to dump %s\n",
+ "%s: about to dump %s\n",
+ _nc_progname,
tname[0]);
(void) printf("#\tReconstructed via infocmp from file: %s\n",
tfile[0]);
@@ -1553,12 +1584,12 @@ main(int argc, char *argv[])
NULL);
len = show_entry();
if (itrace)
- (void) fprintf(stderr, "infocmp: length %d\n", len);
+ (void) fprintf(stderr, "%s: length %d\n", _nc_progname, len);
break;
case C_DIFFERENCE:
if (itrace)
- (void) fprintf(stderr, "infocmp: dumping differences\n");
+ (void) fprintf(stderr, "%s: dumping differences\n", _nc_progname);
(void) printf("comparing %s to %s.\n", tname[0], tname[1]);
compare_entry(compare_predicate, &entries->tterm, quiet);
break;
@@ -1566,7 +1597,8 @@ main(int argc, char *argv[])
case C_COMMON:
if (itrace)
(void) fprintf(stderr,
- "infocmp: dumping common capabilities\n");
+ "%s: dumping common capabilities\n",
+ _nc_progname);
(void) printf("comparing %s to %s.\n", tname[0], tname[1]);
compare_entry(compare_predicate, &entries->tterm, quiet);
break;
@@ -1574,14 +1606,15 @@ main(int argc, char *argv[])
case C_NAND:
if (itrace)
(void) fprintf(stderr,
- "infocmp: dumping differences\n");
+ "%s: dumping differences\n",
+ _nc_progname);
(void) printf("comparing %s to %s.\n", tname[0], tname[1]);
compare_entry(compare_predicate, &entries->tterm, quiet);
break;
case C_USEALL:
if (itrace)
- (void) fprintf(stderr, "infocmp: dumping use entry\n");
+ (void) fprintf(stderr, "%s: dumping use entry\n", _nc_progname);
dump_entry(&entries[0].tterm,
suppress_untranslatable,
limited,
@@ -1592,7 +1625,7 @@ main(int argc, char *argv[])
|| outform == F_TCONVERR));
len = show_entry();
if (itrace)
- (void) fprintf(stderr, "infocmp: length %d\n", len);
+ (void) fprintf(stderr, "%s: length %d\n", _nc_progname, len);
break;
}
}
@@ -1606,7 +1639,11 @@ main(int argc, char *argv[])
else
file_comparison(argc - optind, argv + optind);
+#if NO_LEAKS
+ free(myargv);
free(tfile);
+ free(tname);
+#endif
ExitProgram(EXIT_SUCCESS);
}
diff --git a/contrib/ncurses/progs/modules b/contrib/ncurses/progs/modules
index f8224649b201..3b4f3b602369 100644
--- a/contrib/ncurses/progs/modules
+++ b/contrib/ncurses/progs/modules
@@ -1,7 +1,7 @@
-# $Id: modules,v 1.12 2005/09/25 00:54:22 tom Exp $
+# $Id: modules,v 1.13 2006/12/24 00:53:21 tom Exp $
# Program modules (some are in ncurses lib!)
##############################################################################
-# Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. #
+# 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"), #
@@ -28,7 +28,7 @@
# authorization. #
##############################################################################
#
-# Author: Thomas E. Dickey <dickey@clark.net> 1995,1997
+# Author: Thomas E. Dickey 1995-on
#
@ base
@@ -39,3 +39,5 @@ dump_entry progs $(srcdir) $(HEADER_DEPS) $(srcdir)/dump_entry.h ..
infocmp progs $(srcdir) $(HEADER_DEPS) $(srcdir)/dump_entry.h
tput progs $(srcdir) $(HEADER_DEPS) transform.h termsort.c
tset progs $(srcdir) $(HEADER_DEPS) transform.h $(srcdir)/dump_entry.h ../include/termcap.h
+
+# vile:makemode
diff --git a/contrib/ncurses/progs/progs.priv.h b/contrib/ncurses/progs/progs.priv.h
index eaa4c80f682c..d445c3366591 100644
--- a/contrib/ncurses/progs/progs.priv.h
+++ b/contrib/ncurses/progs/progs.priv.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,7 +30,7 @@
* Author: Thomas E. Dickey 1997-on *
****************************************************************************/
/*
- * $Id: progs.priv.h,v 1.30 2006/11/26 00:28:01 tom Exp $
+ * $Id: progs.priv.h,v 1.33 2007/10/13 20:33:53 tom Exp $
*
* progs.priv.h
*
@@ -110,7 +110,16 @@ extern int optind;
#include <term_entry.h>
#include <tic.h>
#include <nc_tparm.h>
+
#include <nc_alloc.h>
+#if HAVE_NC_FREEALL
+#undef ExitProgram
+#ifdef USE_LIBTINFO
+#define ExitProgram(code) _nc_free_tinfo(code)
+#else
+#define ExitProgram(code) _nc_free_tic(code)
+#endif
+#endif
/* usually in <unistd.h> */
#ifndef STDOUT_FILENO
diff --git a/contrib/ncurses/progs/tic.c b/contrib/ncurses/progs/tic.c
index 1b03f380725e..84781026e51c 100644
--- a/contrib/ncurses/progs/tic.c
+++ b/contrib/ncurses/progs/tic.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,7 +44,7 @@
#include <dump_entry.h>
#include <transform.h>
-MODULE_ID("$Id: tic.c,v 1.131 2006/12/02 22:13:17 tom Exp $")
+MODULE_ID("$Id: tic.c,v 1.133 2007/07/21 17:45:59 tom Exp $")
const char *_nc_progname = "tic";
@@ -353,11 +353,24 @@ open_input(const char *filename)
return fp;
}
+#if NO_LEAKS
+static void
+free_namelist(char **src)
+{
+ if (src != 0) {
+ int n;
+ for (n = 0; src[n] != 0; ++n)
+ free(src[n]);
+ free(src);
+ }
+}
+#endif
+
/* Parse the "-e" option-value into a list of names */
-static const char **
+static char **
make_namelist(char *src)
{
- const char **dst = 0;
+ char **dst = 0;
char *s, *base;
unsigned pass, n, nn;
@@ -374,11 +387,13 @@ make_namelist(char *src)
if ((s = stripped(buffer)) != 0) {
if (dst != 0)
dst[nn] = s;
+ else
+ free(s);
nn++;
}
}
if (pass == 1) {
- dst = typeCalloc(const char *, nn + 1);
+ dst = typeCalloc(char *, nn + 1);
rewind(fp);
}
}
@@ -401,10 +416,10 @@ make_namelist(char *src)
break;
}
if (pass == 1)
- dst = typeCalloc(const char *, nn + 1);
+ dst = typeCalloc(char *, nn + 1);
}
}
- if (showsummary) {
+ if (showsummary && (dst != 0)) {
fprintf(log_fp, "Entries that will be compiled:\n");
for (n = 0; dst[n] != 0; n++)
fprintf(log_fp, "%u:%s\n", n + 1, dst[n]);
@@ -413,7 +428,7 @@ make_namelist(char *src)
}
static bool
-matches(const char **needle, const char *haystack)
+matches(char **needle, const char *haystack)
/* does entry in needle list match |-separated field in haystack? */
{
bool code = FALSE;
@@ -468,7 +483,7 @@ main(int argc, char *argv[])
bool limited = TRUE;
char *tversion = (char *) NULL;
const char *source_file = "terminfo";
- const char **namelst = 0;
+ char **namelst = 0;
char *outdir = (char *) NULL;
bool check_only = FALSE;
bool suppress_untranslatable = FALSE;
@@ -495,7 +510,7 @@ main(int argc, char *argv[])
* be optional.
*/
while ((this_opt = getopt(argc, argv,
- "0123456789CILNR:TUVace:fGgo:rstvwx")) != EOF) {
+ "0123456789CILNR:TUVace:fGgo:rstvwx")) != -1) {
if (isdigit(this_opt)) {
switch (last_opt) {
case 'v':
@@ -784,6 +799,9 @@ main(int argc, char *argv[])
else
fprintf(log_fp, "No entries written\n");
}
+#if NO_LEAKS
+ free_namelist(namelst);
+#endif
cleanup();
ExitProgram(EXIT_SUCCESS);
}
diff --git a/contrib/ncurses/progs/toe.c b/contrib/ncurses/progs/toe.c
index 9c0de791d72b..6bcff07f53e3 100644
--- a/contrib/ncurses/progs/toe.c
+++ b/contrib/ncurses/progs/toe.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,13 +40,11 @@
#include <sys/stat.h>
-#include <dump_entry.h>
-
#if USE_HASHED_DB
#include <hashed_db.h>
#endif
-MODULE_ID("$Id: toe.c,v 1.41 2006/08/19 18:18:09 tom Exp $")
+MODULE_ID("$Id: toe.c,v 1.46 2007/10/13 22:26:38 tom Exp $")
#define isDotname(name) (!strcmp(name, ".") || !strcmp(name, ".."))
@@ -59,8 +57,7 @@ static void
ExitProgram(int code)
{
_nc_free_entries(_nc_head);
- _nc_leaks_dump_entry();
- _nc_free_and_exit(code);
+ _nc_free_tic(code);
}
#endif
@@ -326,7 +323,7 @@ main(int argc, char *argv[])
_nc_progname = _nc_rootname(argv[0]);
- while ((this_opt = getopt(argc, argv, "0123456789ahuvUV")) != EOF) {
+ while ((this_opt = getopt(argc, argv, "0123456789ahuvUV")) != -1) {
/* handle optional parameter */
if (isdigit(this_opt)) {
switch (last_opt) {
diff --git a/contrib/ncurses/progs/tput.c b/contrib/ncurses/progs/tput.c
index 47e4c20174a7..8745cc9977ad 100644
--- a/contrib/ncurses/progs/tput.c
+++ b/contrib/ncurses/progs/tput.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,6 +38,7 @@
* Ross Ridge's mytinfo package.
*/
+#define USE_LIBTINFO
#include <progs.priv.h>
#if !PURE_TERMINFO
@@ -45,7 +46,7 @@
#endif
#include <transform.h>
-MODULE_ID("$Id: tput.c,v 1.38 2006/11/26 00:27:47 tom Exp $")
+MODULE_ID("$Id: tput.c,v 1.41 2007/10/13 20:34:16 tom Exp $")
#define PUTS(s) fputs(s, stdout)
#define PUTCHAR(c) putchar(c)
@@ -325,6 +326,7 @@ tput(int argc, char *argv[])
case Num_Str_Str:
s = TPARM_3(s, numbers[1], strings[2], strings[3]);
break;
+ case Numbers:
default:
(void) _nc_tparm_analyze(s, p_is_s, &popcount);
#define myParam(n) (p_is_s[n - 1] != 0 ? ((long) strings[n]) : numbers[n])
@@ -363,7 +365,7 @@ main(int argc, char **argv)
term = getenv("TERM");
- while ((c = getopt(argc, argv, "ST:V")) != EOF) {
+ while ((c = getopt(argc, argv, "ST:V")) != -1) {
switch (c) {
case 'S':
cmdline = FALSE;
diff --git a/contrib/ncurses/progs/tset.c b/contrib/ncurses/progs/tset.c
index 6ce3f50b8f49..3d6091224979 100644
--- a/contrib/ncurses/progs/tset.c
+++ b/contrib/ncurses/progs/tset.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 *
@@ -73,6 +73,7 @@
* SUCH DAMAGE.
*/
+#define USE_LIBTINFO
#define __INTERNAL_CAPS_VISIBLE /* we need to see has_hardware_tabs */
#include <progs.priv.h>
@@ -103,7 +104,7 @@ char *ttyname(int fd);
#include <dump_entry.h>
#include <transform.h>
-MODULE_ID("$Id: tset.c,v 1.67 2006/09/16 17:51:10 tom Exp $")
+MODULE_ID("$Id: tset.c,v 1.70 2007/10/13 22:22:04 tom Exp $")
extern char **environ;
@@ -777,7 +778,22 @@ reset_mode(void)
| OFDEL
#endif
#ifdef NLDLY
- | NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY
+ | NLDLY
+#endif
+#ifdef CRDLY
+ | CRDLY
+#endif
+#ifdef TABDLY
+ | TABDLY
+#endif
+#ifdef BSDLY
+ | BSDLY
+#endif
+#ifdef VTDLY
+ | VTDLY
+#endif
+#ifdef FFDLY
+ | FFDLY
#endif
);
@@ -1129,7 +1145,7 @@ main(int argc, char **argv)
obsolete(argv);
noinit = noset = quiet = Sflag = sflag = showterm = 0;
- while ((ch = getopt(argc, argv, "a:cd:e:Ii:k:m:np:qQSrsVw")) != EOF) {
+ while ((ch = getopt(argc, argv, "a:cd:e:Ii:k:m:np:qQSrsVw")) != -1) {
switch (ch) {
case 'c': /* set control-chars */
opt_c = TRUE;