From a7de4c96cafdd45795ad605bec72dd77177534c9 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sat, 15 Jun 2013 22:39:16 +0000 Subject: [PATCH] ncurses 5.9 - patch 20130615 + minor changes to some configure macros to make them more reusable. + fixes for tabs program (prompted by report by Nick Andrik): + corrected logic in command-line parsing of -a and -c predefined tab-lists options. + allow "-0" and "-8" options to be combined with others, e.g.,"-0d". + make warning messages more consistent with the other utilities by not printing the full pathname of the program. + add -V option for consistency with other utilities. + fix off-by-one in columns for tabs program when processing an option such as "-5" (patch by Nick Andrik). --- Ada95/aclocal.m4 | 8 ++---- MANIFEST | 1 + NEWS | 14 ++++++++- aclocal.m4 | 8 ++---- dist.mk | 4 +-- man/tabs.1 | 9 ++++-- package/debian/changelog | 4 +-- package/ncurses.spec | 2 +- progs/tabs.c | 62 +++++++++++++++++++++++++++------------- 9 files changed, 73 insertions(+), 39 deletions(-) diff --git a/Ada95/aclocal.m4 b/Ada95/aclocal.m4 index 3f7ad84e..a289df67 100644 --- a/Ada95/aclocal.m4 +++ b/Ada95/aclocal.m4 @@ -28,7 +28,7 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey dnl -dnl $Id: aclocal.m4,v 1.66 2013/04/13 23:00:18 tom Exp $ +dnl $Id: aclocal.m4,v 1.67 2013/06/15 21:13:50 tom Exp $ dnl Macros used in NCURSES Ada95 auto-configuration script. dnl dnl These macros are maintained separately from NCURSES. The copyright on @@ -1752,7 +1752,7 @@ ifelse($1,,,[$1=$LIB_PREFIX]) AC_SUBST(LIB_PREFIX) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LIB_SUFFIX version: 18 updated: 2012/02/25 15:20:07 +dnl CF_LIB_SUFFIX version: 19 updated: 2013/06/15 11:58:48 dnl ------------- dnl Compute the library file-suffix from the given model name dnl $1 = model name @@ -1761,7 +1761,6 @@ dnl $3 = dependency variable to set (actual filename) dnl The variable $LIB_SUFFIX, if set, prepends the variable to set. AC_DEFUN([CF_LIB_SUFFIX], [ - AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) case $1 in #(vi libtool) #(vi $2='.la' @@ -2835,7 +2834,7 @@ define([CF_REMOVE_LIB], $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'` ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SHARED_OPTS version: 72 updated: 2013/01/26 16:26:12 +dnl CF_SHARED_OPTS version: 73 updated: 2013/06/15 12:17:19 dnl -------------- dnl -------------- dnl Attempt to determine the appropriate CC/LD options for creating a shared @@ -2861,7 +2860,6 @@ dnl dnl Some loaders leave 'so_locations' lying around. It's nice to clean up. AC_DEFUN([CF_SHARED_OPTS], [ - AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) AC_REQUIRE([CF_LD_RPATH_OPT]) LOCAL_LDFLAGS= LOCAL_LDFLAGS2= diff --git a/MANIFEST b/MANIFEST index b7eb0160..b42877d3 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1050,6 +1050,7 @@ ./test/ditto.c ./test/dots.c ./test/dots_mvcur.c +./test/dots_termcap.c ./test/echochar.c ./test/edit_field.c ./test/edit_field.h diff --git a/NEWS b/NEWS index f38adef0..93d1e873 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.2069 2013/06/08 21:00:03 tom Exp $ +-- $Id: NEWS,v 1.2072 2013/06/15 21:16:04 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,18 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20130615 + + minor changes to some configure macros to make them more reusable. + + fixes for tabs program (prompted by report by Nick Andrik): + + corrected logic in command-line parsing of -a and -c predefined + tab-lists options. + + allow "-0" and "-8" options to be combined with others, e.g.,"-0d". + + make warning messages more consistent with the other utilities by + not printing the full pathname of the program. + + add -V option for consistency with other utilities. + + fix off-by-one in columns for tabs program when processing an option + such as "-5" (patch by Nick Andrik). + 20130608 + add to test/demo_forms.c examples of using the menu-hooks as well as showing how the menu item user-data can be used to pass a callback diff --git a/aclocal.m4 b/aclocal.m4 index 9a8c65ec..c173bebe 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -28,7 +28,7 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey 1995-on dnl -dnl $Id: aclocal.m4,v 1.666 2013/04/13 22:59:35 tom Exp $ +dnl $Id: aclocal.m4,v 1.668 2013/06/15 16:22:56 tom Exp $ dnl Macros used in NCURSES auto-configuration script. dnl dnl These macros are maintained separately from NCURSES. The copyright on @@ -3673,7 +3673,7 @@ fi ]) ]) dnl --------------------------------------------------------------------------- -dnl CF_LIB_SUFFIX version: 18 updated: 2012/02/25 15:20:07 +dnl CF_LIB_SUFFIX version: 19 updated: 2013/06/15 11:58:48 dnl ------------- dnl Compute the library file-suffix from the given model name dnl $1 = model name @@ -3682,7 +3682,6 @@ dnl $3 = dependency variable to set (actual filename) dnl The variable $LIB_SUFFIX, if set, prepends the variable to set. AC_DEFUN([CF_LIB_SUFFIX], [ - AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) case $1 in #(vi libtool) #(vi $2='.la' @@ -5335,7 +5334,7 @@ CF_VERBOSE(...checked $1 [$]$1) AC_SUBST(EXTRA_LDFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SHARED_OPTS version: 72 updated: 2013/01/26 16:26:12 +dnl CF_SHARED_OPTS version: 73 updated: 2013/06/15 12:17:19 dnl -------------- dnl -------------- dnl Attempt to determine the appropriate CC/LD options for creating a shared @@ -5361,7 +5360,6 @@ dnl dnl Some loaders leave 'so_locations' lying around. It's nice to clean up. AC_DEFUN([CF_SHARED_OPTS], [ - AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) AC_REQUIRE([CF_LD_RPATH_OPT]) LOCAL_LDFLAGS= LOCAL_LDFLAGS2= diff --git a/dist.mk b/dist.mk index d439d575..f38a92c6 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.932 2013/06/07 08:08:46 tom Exp $ +# $Id: dist.mk,v 1.933 2013/06/15 21:17:44 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -37,7 +37,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 5 NCURSES_MINOR = 9 -NCURSES_PATCH = 20130608 +NCURSES_PATCH = 20130615 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/man/tabs.1 b/man/tabs.1 index 32d30520..77323492 100644 --- a/man/tabs.1 +++ b/man/tabs.1 @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 2008-2010,2011 Free Software Foundation, Inc. * +.\" Copyright (c) 2008-2011,2013 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 * @@ -26,13 +26,13 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: tabs.1,v 1.9 2011/12/17 23:31:59 tom Exp $ +.\" $Id: tabs.1,v 1.10 2013/06/11 00:56:40 tom Exp $ .TH @TABS@ 1 "" .ds n 5 .SH NAME \fB@TABS@\fR \- set tabs on a terminal .SH SYNOPSIS -\fB@TABS@\fR [\fB\-v\fR[\fIn\fR]] [\fB\-ahuUV\fR] \fIfile...\fR +\fB@TABS@\fR [\fIoptions\fR]] \fI[tabstop-list]\fR .br .SH DESCRIPTION .PP @@ -61,6 +61,9 @@ The second data line shows the actual tab-stops, marked with asterisks. .B \-n This option tells \fB@TABS@\fP to check the options and run any debugging option, but not to modify the terminal settings. +.TP +\fB\-V\fR +reports the version of ncurses which was used in this program, and exits. .PP The \fB@TABS@\fP program processes a single list of tab stops. The last option to be processed which defines a list is the one that diff --git a/package/debian/changelog b/package/debian/changelog index cbd95db4..675d7dea 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (5.9-20130608) unstable; urgency=low +ncurses6 (5.9-20130615) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 01 Jun 2013 07:49:17 -0400 + -- Thomas E. Dickey Sat, 15 Jun 2013 17:17:42 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/ncurses.spec b/package/ncurses.spec index 8a285ac0..bf1f4dd8 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Release: 5.9 -Version: 20130608 +Version: 20130615 License: X11 Group: Development/Libraries Source: ncurses-%{release}-%{version}.tgz diff --git a/progs/tabs.c b/progs/tabs.c index bded0b04..7ed30075 100644 --- a/progs/tabs.c +++ b/progs/tabs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2008-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 2008-2012,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,10 +37,11 @@ #define USE_LIBTINFO #include -MODULE_ID("$Id: tabs.c,v 1.25 2012/11/18 01:21:47 tom Exp $") +MODULE_ID("$Id: tabs.c,v 1.34 2013/06/11 08:18:27 tom Exp $") static void usage(void) GCC_NORETURN; +static char *prg_name; static int max_cols; static void @@ -101,8 +102,8 @@ decode_tabs(const char *tab_list) result[n] = value + prior; if (n > 0 && result[n] <= result[n - 1]) { fprintf(stderr, - "tab-stops are not in increasing order: %d %d\n", - value, result[n - 1]); + "%s: tab-stops are not in increasing order: %d %d\n", + prg_name, value, result[n - 1]); free(result); result = 0; break; @@ -122,6 +123,7 @@ decode_tabs(const char *tab_list) */ if ((n == 0) && (value > 0)) { int step = value; + value = 1; while (n < max_cols - 1) { result[n++] = value; value += step; @@ -293,7 +295,7 @@ add_to_tab_list(char **append, const char *value) * Check for illegal characters in the tab-list. */ static bool -legal_tab_list(const char *program, const char *tab_list) +legal_tab_list(const char *tab_list) { bool result = TRUE; @@ -305,22 +307,34 @@ legal_tab_list(const char *program, const char *tab_list) if (!(isdigit(ch) || ch == ',' || ch == '+')) { fprintf(stderr, "%s: unexpected character found '%c'\n", - program, ch); + prg_name, ch); result = FALSE; break; } } } else { - fprintf(stderr, "%s: trailing comma found '%s'\n", program, tab_list); + fprintf(stderr, "%s: trailing comma found '%s'\n", prg_name, tab_list); result = FALSE; } } else { - fprintf(stderr, "%s: no tab-list given\n", program); + fprintf(stderr, "%s: no tab-list given\n", prg_name); result = FALSE; } return result; } +static char * +skip_list(char *value) +{ + while (*value != '\0' && + (isdigit(UChar(*value)) || + isspace(UChar(*value)) || + strchr("+,", UChar(*value)) != 0)) { + ++value; + } + return value; +} + static void usage(void) { @@ -343,6 +357,7 @@ usage(void) ," -s SNOBOL" ," -u UNIVAC 1100 Assembler" ," -T name use terminal type 'name'" + ," -V print version" ,"" ,"A tabstop-list is an ordered list of column numbers, e.g., 1,11,21" ,"or 1,+10,+10 which is the same." @@ -367,6 +382,8 @@ main(int argc, char *argv[]) char *append = 0; const char *tab_list = 0; + prg_name = _nc_rootname(argv[0]); + if ((term_name = getenv("TERM")) == 0) term_name = "ansi+tabs"; @@ -378,23 +395,25 @@ main(int argc, char *argv[]) while ((ch = *++option) != '\0') { switch (ch) { case 'a': - switch (*option) { + switch (*++option) { + default: case '\0': tab_list = "1,10,16,36,72"; + option--; /* Assembler, IBM S/370, first format */ break; case '2': tab_list = "1,10,16,40,72"; /* Assembler, IBM S/370, second format */ break; - default: - usage(); } break; case 'c': - switch (*option) { + switch (*++option) { + default: case '\0': tab_list = "1,8,12,16,20,55"; + option--; /* COBOL, normal format */ break; case '2': @@ -405,8 +424,6 @@ main(int argc, char *argv[]) tab_list = "1,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,67"; /* COBOL compact format extended */ break; - default: - usage(); } break; case 'd': /* ncurses extension */ @@ -437,17 +454,22 @@ main(int argc, char *argv[]) term_name = option; } else { term_name = argv[n++]; + option--; } option += ((int) strlen(option)) - 1; continue; + case 'V': + puts(curses_version()); + ExitProgram(EXIT_SUCCESS); default: if (isdigit(UChar(*option))) { - tab_list = option; - ++n; + char *copy = strdup(option); + *skip_list(copy) = '\0'; + tab_list = copy; + option = skip_list(option) - 1; } else { usage(); } - option += ((int) strlen(option)) - 1; break; } } @@ -491,12 +513,12 @@ main(int argc, char *argv[]) if (!VALID_STRING(clear_all_tabs)) { fprintf(stderr, "%s: terminal type '%s' cannot reset tabs\n", - argv[0], term_name); + prg_name, term_name); } else if (!VALID_STRING(set_tab)) { fprintf(stderr, "%s: terminal type '%s' cannot set tabs\n", - argv[0], term_name); - } else if (legal_tab_list(argv[0], tab_list)) { + prg_name, term_name); + } else if (legal_tab_list(tab_list)) { int *list = decode_tabs(tab_list); if (!no_op) -- 2.44.0