From b793748293cd1a764b1a858455399ad899b5a8a1 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 21 May 2017 01:35:04 +0000 Subject: [PATCH] ncurses 6.0 - patch 20170520 + modify test/picsmap.c to read xpm files. + modify package/debian/* to create documentation packages, so the related files can be checked with lintian. + fix some typos in manpages (report/patch by Sven Joachim). --- NEWS | 8 +- VERSION | 2 +- dist.mk | 4 +- doc/html/man/adacurses6-config.1.html | 2 +- doc/html/man/captoinfo.1m.html | 2 +- doc/html/man/clear.1.html | 2 +- doc/html/man/curs_add_wch.3x.html | 8 +- doc/html/man/curs_mouse.3x.html | 8 +- doc/html/man/form.3x.html | 2 +- doc/html/man/infocmp.1m.html | 2 +- doc/html/man/infotocap.1m.html | 2 +- doc/html/man/menu.3x.html | 2 +- doc/html/man/ncurses.3x.html | 2 +- doc/html/man/ncurses6-config.1.html | 2 +- doc/html/man/panel.3x.html | 2 +- doc/html/man/tabs.1.html | 2 +- doc/html/man/terminfo.5.html | 2 +- doc/html/man/tic.1m.html | 2 +- doc/html/man/toe.1m.html | 2 +- doc/html/man/tput.1.html | 2 +- doc/html/man/tset.1.html | 2 +- man/curs_add_wch.3x | 4 +- man/curs_mouse.3x | 8 +- package/debian-mingw/changelog | 4 +- package/debian-mingw64/changelog | 4 +- package/debian/changelog | 4 +- package/debian/control | 19 ++ package/debian/rules | 32 +++- package/mingw-ncurses.nsi | 4 +- package/mingw-ncurses.spec | 2 +- package/ncurses.spec | 2 +- test/picsmap.c | 247 +++++++++++++++++++++++++- 32 files changed, 345 insertions(+), 47 deletions(-) diff --git a/NEWS b/NEWS index 00a8c6de..64e1886e 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.2841 2017/05/13 23:01:06 tom Exp $ +-- $Id: NEWS,v 1.2844 2017/05/21 00:24:14 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,12 @@ 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. +20170520 + + modify test/picsmap.c to read xpm files. + + modify package/debian/* to create documentation packages, so the + related files can be checked with lintian. + + fix some typos in manpages (report/patch by Sven Joachim). + 20170513 + add test/picsmap.c to fill in some testing issues not met by dots. The initial version reads X bitmap (".xbm") files. diff --git a/VERSION b/VERSION index 5049332f..cbe3600b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:9 6.0 20170513 +5:0:9 6.0 20170520 diff --git a/dist.mk b/dist.mk index dc30ab38..bcc272cd 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.1163 2017/05/07 17:07:55 tom Exp $ +# $Id: dist.mk,v 1.1164 2017/05/14 15:18:36 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 = 6 NCURSES_MINOR = 0 -NCURSES_PATCH = 20170513 +NCURSES_PATCH = 20170520 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/doc/html/man/adacurses6-config.1.html b/doc/html/man/adacurses6-config.1.html index 06208243..5afe14d8 100644 --- a/doc/html/man/adacurses6-config.1.html +++ b/doc/html/man/adacurses6-config.1.html @@ -125,7 +125,7 @@

SEE ALSO

        curses(3x)
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 
diff --git a/doc/html/man/captoinfo.1m.html b/doc/html/man/captoinfo.1m.html
index 9bd10364..0cf55f33 100644
--- a/doc/html/man/captoinfo.1m.html
+++ b/doc/html/man/captoinfo.1m.html
@@ -190,7 +190,7 @@
 

SEE ALSO

        infocmp(1m), curses(3x), terminfo(5)
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 

AUTHOR

diff --git a/doc/html/man/clear.1.html b/doc/html/man/clear.1.html
index 36beee1f..5252f616 100644
--- a/doc/html/man/clear.1.html
+++ b/doc/html/man/clear.1.html
@@ -138,7 +138,7 @@
 

SEE ALSO

        tput(1), terminfo(5)
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 
diff --git a/doc/html/man/curs_add_wch.3x.html b/doc/html/man/curs_add_wch.3x.html
index b0d8b614..d4f741d9 100644
--- a/doc/html/man/curs_add_wch.3x.html
+++ b/doc/html/man/curs_add_wch.3x.html
@@ -26,7 +26,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_add_wch.3x,v 1.22 2017/05/06 14:01:26 tom Exp @
+  * @Id: curs_add_wch.3x,v 1.23 2017/05/20 14:45:24 Sven.Joachim Exp @
 -->
 
 
@@ -237,9 +237,9 @@
            intended.  But there are several possibilities, all with problems.
 
            Unicode  6.0  (2010)  does provide two lantern symbols: U+1F383 and
-           U+1F3EE.  Those were not availble in 2002, and are irrelevant since
-           they  lie  outside the BMP and as a result are not generally avail-
-           able in terminals.  They are not storm lanterns, in any case.
+           U+1F3EE.  Those were not available  in  2002,  and  are  irrelevant
+           since  they  lie  outside the BMP and as a result are not generally
+           available in terminals.  They are not storm lanterns, in any case.
 
            Most storm lanterns have a tapering glass chimney (to guard against
            tipping); some have a wire grid protecting the chimney.
diff --git a/doc/html/man/curs_mouse.3x.html b/doc/html/man/curs_mouse.3x.html
index 2506e2b5..9fe80305 100644
--- a/doc/html/man/curs_mouse.3x.html
+++ b/doc/html/man/curs_mouse.3x.html
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_mouse.3x,v 1.45 2017/05/06 17:29:26 tom Exp @
+  * @Id: curs_mouse.3x,v 1.46 2017/05/20 14:42:41 Sven.Joachim Exp @
 -->
 
 
@@ -247,7 +247,7 @@
        SVr4 curses had support for the mouse in a variant  of  xterm.   It  is
        mentioned in a few places, but with no supporting documentation:
 
-       o   the  libcurses  manual  page lists functions for this feature which
+       o   the  "libcurses" manual page lists functions for this feature which
            are prototyped in curses.h:
 
              extern int mouse_set(long int);
@@ -258,11 +258,11 @@
              extern void wmouse_position(WINDOW *, int *, int *);
              extern unsigned long getmouse(void), getbmap(void);
 
-       o   the terminfo manual page lists capabilities for the feature
+       o   the "terminfo" manual page lists capabilities for the feature
 
              buttons           btns    BT       Number of buttons on the mouse
              get_mouse         getm    Gm       Curses should get button events
-             key_mouse         kmous   Km       0631, Mouse event has occured
+             key_mouse         kmous   Km       0631, Mouse event has occurred
              mouse_info        minfo   Mi       Mouse status information
              req_mouse_pos     reqmp   RQ       Request mouse position report
 
diff --git a/doc/html/man/form.3x.html b/doc/html/man/form.3x.html
index ae8a885e..2643c134 100644
--- a/doc/html/man/form.3x.html
+++ b/doc/html/man/form.3x.html
@@ -234,7 +234,7 @@
        curses(3x)  and  related  pages  whose names begin "form_" for detailed
        descriptions of the entry points.
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 
diff --git a/doc/html/man/infocmp.1m.html b/doc/html/man/infocmp.1m.html
index 25f5e5af..b35c733d 100644
--- a/doc/html/man/infocmp.1m.html
+++ b/doc/html/man/infocmp.1m.html
@@ -470,7 +470,7 @@
 
        http://invisible-island.net/ncurses/tctest.html
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 

AUTHOR

diff --git a/doc/html/man/infotocap.1m.html b/doc/html/man/infotocap.1m.html
index 22682c35..6e72844f 100644
--- a/doc/html/man/infotocap.1m.html
+++ b/doc/html/man/infotocap.1m.html
@@ -85,7 +85,7 @@
 

SEE ALSO

        curses(3x), tic(1m), infocmp(1m), terminfo(5)
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 

AUTHOR

diff --git a/doc/html/man/menu.3x.html b/doc/html/man/menu.3x.html
index c09e5337..2a9f20c8 100644
--- a/doc/html/man/menu.3x.html
+++ b/doc/html/man/menu.3x.html
@@ -210,7 +210,7 @@
        curses(3x) and related pages whose names  begin  "menu_"  for  detailed
        descriptions of the entry points.
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 
diff --git a/doc/html/man/ncurses.3x.html b/doc/html/man/ncurses.3x.html
index c4598bc3..b1f5bad6 100644
--- a/doc/html/man/ncurses.3x.html
+++ b/doc/html/man/ncurses.3x.html
@@ -59,7 +59,7 @@
        method of updating  character  screens  with  reasonable  optimization.
        This  implementation  is  "new  curses"  (ncurses)  and is the approved
        replacement for 4.4BSD classic curses,  which  has  been  discontinued.
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
        The  ncurses  library emulates the curses library of System V Release 4
        UNIX, and XPG4 (X/Open Portability Guide) curses  (also  known  as  XSI
diff --git a/doc/html/man/ncurses6-config.1.html b/doc/html/man/ncurses6-config.1.html
index d73eca58..184ffd74 100644
--- a/doc/html/man/ncurses6-config.1.html
+++ b/doc/html/man/ncurses6-config.1.html
@@ -112,7 +112,7 @@
 

SEE ALSO

        curses(3x)
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 
diff --git a/doc/html/man/panel.3x.html b/doc/html/man/panel.3x.html
index 0c526c6a..edad3965 100644
--- a/doc/html/man/panel.3x.html
+++ b/doc/html/man/panel.3x.html
@@ -194,7 +194,7 @@
 

SEE ALSO

        curses(3x), curs_variables(3x),
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 

AUTHOR

diff --git a/doc/html/man/tabs.1.html b/doc/html/man/tabs.1.html
index 466f6c3c..f3d9b8a5 100644
--- a/doc/html/man/tabs.1.html
+++ b/doc/html/man/tabs.1.html
@@ -164,7 +164,7 @@
 

SEE ALSO

        tset(1), infocmp(1m), curses(3x), terminfo(5).
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 
diff --git a/doc/html/man/terminfo.5.html b/doc/html/man/terminfo.5.html
index cce59d63..50a9cf3f 100644
--- a/doc/html/man/terminfo.5.html
+++ b/doc/html/man/terminfo.5.html
@@ -74,7 +74,7 @@
        Terminfo describes terminals by giving a set of capabilities which they
        have, by specifying how to perform screen operations, and by specifying
        padding  requirements  and  initialization  sequences.   This describes
-       ncurses version 6.0 (patch 20170506).
+       ncurses version 6.0 (patch 20170520).
 
 
 

Terminfo Entry Syntax

diff --git a/doc/html/man/tic.1m.html b/doc/html/man/tic.1m.html
index 3329413f..83c220a4 100644
--- a/doc/html/man/tic.1m.html
+++ b/doc/html/man/tic.1m.html
@@ -361,7 +361,7 @@
        infocmp(1m),   captoinfo(1m),   infotocap(1m),   toe(1m),   curses(3x),
        term(5).  terminfo(5).
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 

AUTHOR

diff --git a/doc/html/man/toe.1m.html b/doc/html/man/toe.1m.html
index abc1ccd2..3e01cae0 100644
--- a/doc/html/man/toe.1m.html
+++ b/doc/html/man/toe.1m.html
@@ -113,7 +113,7 @@
        tic(1m), infocmp(1m), captoinfo(1m),  infotocap(1m),  curses(3x),  ter-
        minfo(5).
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 
diff --git a/doc/html/man/tput.1.html b/doc/html/man/tput.1.html
index a7c02e63..b2c39229 100644
--- a/doc/html/man/tput.1.html
+++ b/doc/html/man/tput.1.html
@@ -478,7 +478,7 @@
 

SEE ALSO

        clear(1), stty(1), tabs(1), tset(1), terminfo(5), curs_termcap(3x).
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 
diff --git a/doc/html/man/tset.1.html b/doc/html/man/tset.1.html
index 0891fcbc..4fec77d8 100644
--- a/doc/html/man/tset.1.html
+++ b/doc/html/man/tset.1.html
@@ -389,7 +389,7 @@
        csh(1),  sh(1),  stty(1),   curs_terminfo(3x),   tty(4),   terminfo(5),
        ttys(5), environ(7)
 
-       This describes ncurses version 6.0 (patch 20170506).
+       This describes ncurses version 6.0 (patch 20170520).
 
 
 
diff --git a/man/curs_add_wch.3x b/man/curs_add_wch.3x
index b5397eb7..ed97099f 100644
--- a/man/curs_add_wch.3x
+++ b/man/curs_add_wch.3x
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_add_wch.3x,v 1.22 2017/05/06 14:01:26 tom Exp $
+.\" $Id: curs_add_wch.3x,v 1.23 2017/05/20 14:45:24 Sven.Joachim Exp $
 .TH curs_add_wch 3X ""
 .ie \n(.g .ds `` \(lq
 .el       .ds `` ``
@@ -270,7 +270,7 @@ was intended.
 But there are several possibilities, all with problems.
 .IP
 Unicode 6.0 (2010) does provide two lantern symbols: U+1F383 and U+1F3EE.
-Those were not availble in 2002, and are irrelevant since
+Those were not available in 2002, and are irrelevant since
 they lie outside the BMP and as a result are not generally available
 in terminals.
 They are not storm lanterns, in any case.
diff --git a/man/curs_mouse.3x b/man/curs_mouse.3x
index 8b433ec5..2a34e930 100644
--- a/man/curs_mouse.3x
+++ b/man/curs_mouse.3x
@@ -27,7 +27,11 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_mouse.3x,v 1.45 2017/05/06 17:29:26 tom Exp $
+.\" $Id: curs_mouse.3x,v 1.46 2017/05/20 14:42:41 Sven.Joachim Exp $
+.ie \n(.g .ds `` \(lq
+.el       .ds `` ``
+.ie \n(.g .ds '' \(rq
+.el       .ds '' ''
 .de NS
 .ie \n(.sp
 .el    .sp .5
@@ -289,7 +293,7 @@ the \*(``terminfo\*('' manual page lists capabilities for the feature
 .NS
 buttons           btns    BT       Number of buttons on the mouse
 get_mouse         getm    Gm       Curses should get button events
-key_mouse         kmous   Km       0631, Mouse event has occured
+key_mouse         kmous   Km       0631, Mouse event has occurred
 mouse_info        minfo   Mi       Mouse status information
 req_mouse_pos     reqmp   RQ       Request mouse position report
 .NE
diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog
index db30b2ca..f0aa79e5 100644
--- a/package/debian-mingw/changelog
+++ b/package/debian-mingw/changelog
@@ -1,8 +1,8 @@
-ncurses6 (6.0+20170513) unstable; urgency=low
+ncurses6 (6.0+20170520) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey   Sun, 07 May 2017 13:07:55 -0400
+ -- Thomas E. Dickey   Sun, 14 May 2017 11:18:36 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog
index db30b2ca..f0aa79e5 100644
--- a/package/debian-mingw64/changelog
+++ b/package/debian-mingw64/changelog
@@ -1,8 +1,8 @@
-ncurses6 (6.0+20170513) unstable; urgency=low
+ncurses6 (6.0+20170520) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey   Sun, 07 May 2017 13:07:55 -0400
+ -- Thomas E. Dickey   Sun, 14 May 2017 11:18:36 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
diff --git a/package/debian/changelog b/package/debian/changelog
index 4b5a8a59..06ffacff 100644
--- a/package/debian/changelog
+++ b/package/debian/changelog
@@ -1,8 +1,8 @@
-ncurses6 (6.0+20170513) unstable; urgency=low
+ncurses6 (6.0+20170520) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey   Sun, 07 May 2017 13:07:55 -0400
+ -- Thomas E. Dickey   Sun, 14 May 2017 11:18:35 -0400
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
diff --git a/package/debian/control b/package/debian/control
index 4c6e82c2..8118544c 100644
--- a/package/debian/control
+++ b/package/debian/control
@@ -23,3 +23,22 @@ Description: shared libraries for terminal handling
  updating character screens with reasonable optimization.
  .
  This package is used for testing ABI 6 with pthreads.
+
+Package: ncurses6-doc
+Section: doc
+Architecture: all
+Depends: groff-base
+Description: shared libraries for terminal handling
+ The ncurses library routines are a terminal-independent method of
+ updating character screens with reasonable optimization.
+ .
+ This package is used for testing ncurses6 document packaging.
+
+Package: ncurses6-doc-html
+Section: doc
+Architecture: all
+Description: shared libraries for terminal handling
+ The ncurses library routines are a terminal-independent method of
+ updating character screens with reasonable optimization.
+ .
+ This package is used for testing ncurses6 document packaging.
diff --git a/package/debian/rules b/package/debian/rules
index 49978d86..9d0eb980 100755
--- a/package/debian/rules
+++ b/package/debian/rules
@@ -7,7 +7,7 @@
 #export DH_VERBOSE=1
 
 # packages
-PACKAGES.indep = # ncurses6-docs
+PACKAGES.indep = ncurses6-doc ncurses6-doc-html
 PACKAGES.arch  = ncurses6 ncursest6
 
 # These are used for cross-compiling and for saving the configure script
@@ -131,6 +131,10 @@ config-ncursest6-stamp:
 		--with-pthread
 	touch $@
 
+config-ncurses6-doc-stamp \
+config-ncurses6-doc-html-stamp: config-ncurses6-stamp
+	touch $@
+
 build-ncurses6-stamp: config-ncurses6-stamp
 	dh_testdir
 
@@ -145,6 +149,10 @@ build-ncursest6-stamp: config-ncursest6-stamp
 
 	touch $@
 
+build-ncurses6-doc-stamp \
+build-ncurses6-doc-html-stamp: build-ncurses6-stamp
+	touch $@
+
 install-ncurses6-stamp: build-ncurses6-stamp
 	dh_testdir
 	dh_testroot
@@ -171,6 +179,28 @@ install-ncursest6-stamp: build-ncursest6-stamp
 
 	touch $@
 
+install-ncurses6-doc-stamp: build-ncurses6-stamp
+	dh_testdir
+	dh_testroot
+	dh_installdirs $(verbose)
+	dh_prep        $(verbose) -pncurses6-doc
+
+	$(MAKE) -C t/ncurses6 install.man DESTDIR=$(NCURSES6_DIR)-doc
+
+	touch $@
+
+HTML_DESTDIR=$(NCURSES6_DIR)-doc-html/usr/share/ncurses6-doc-html
+install-ncurses6-doc-html-stamp: build-ncurses6-stamp
+	dh_testdir
+	dh_testroot
+	dh_installdirs $(verbose)
+	dh_prep        $(verbose) -pncurses6-doc-html
+
+	cd doc/html && find * -type d | sort | xargs -I{} mkdir -p -v $(HTML_DESTDIR)/{}
+	cd doc/html && find * -type f -name '*.html' | sort | xargs -I{} install -m 644 -p -v -T {} $(HTML_DESTDIR)/{}
+
+	touch $@
+
 # Build architecture-independent files here.
 binary-indep: install-indep
 ifneq ($(PACKAGES.indep),)
diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi
index 1ac01a1c..734d9e84 100644
--- a/package/mingw-ncurses.nsi
+++ b/package/mingw-ncurses.nsi
@@ -1,4 +1,4 @@
-; $Id: mingw-ncurses.nsi,v 1.211 2017/05/07 17:07:55 tom Exp $
+; $Id: mingw-ncurses.nsi,v 1.212 2017/05/14 15:18:36 tom Exp $
 
 ; TODO add examples
 ; TODO bump ABI to 6
@@ -10,7 +10,7 @@
 !define VERSION_MAJOR "6"
 !define VERSION_MINOR "0"
 !define VERSION_YYYY  "2017"
-!define VERSION_MMDD  "0513"
+!define VERSION_MMDD  "0520"
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
 
 !define MY_ABI   "5"
diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec
index 91c85799..430ca112 100644
--- a/package/mingw-ncurses.spec
+++ b/package/mingw-ncurses.spec
@@ -3,7 +3,7 @@
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 6.0
-Release: 20170513
+Release: 20170520
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
diff --git a/package/ncurses.spec b/package/ncurses.spec
index 327cf523..7ddc74d9 100644
--- a/package/ncurses.spec
+++ b/package/ncurses.spec
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 6.0
-Release: 20170513
+Release: 20170520
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
diff --git a/test/picsmap.c b/test/picsmap.c
index 7eb0de9e..47349819 100644
--- a/test/picsmap.c
+++ b/test/picsmap.c
@@ -26,14 +26,15 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: picsmap.c,v 1.8 2017/05/14 01:26:30 tom Exp $
+ * $Id: picsmap.c,v 1.17 2017/05/21 00:22:22 tom Exp $
  *
  * Author: Thomas E. Dickey
  *
  * A little more interesting than "dots", read a simple image into memory and
  * measure the time taken to paint it normally vs randomly.
  *
- * TODO read xpm file
+ * TODO handle hex color-codes for xpm other than 3-bytes
+ * TODO read rgb.txt to handle xpm color names other than "None"
  * TODO read "convert" via pipe (from ImageMagick)
  * TODO write cells/second to stderr (or log)
  * TODO write picture left-to-right/top-to-bottom
@@ -72,6 +73,21 @@ typedef struct {
 
 static bool in_curses = FALSE;
 
+static void
+free_data(char **data)
+{
+    free(data[0]);
+    free(data);
+}
+
+static void
+free_pics_head(PICS_HEAD * pics)
+{
+    free(pics->pairs);
+    free(pics->cells);
+    free(pics);
+}
+
 /*
  * Simplify reading xbm/xpm files by first making an array of lines.  Blank
  * lines are filtered out.
@@ -170,6 +186,85 @@ bytes_of(int value)
     return value;
 }
 
+static int match_c(const char *, const char *,...) GCC_SCANFLIKE(2,3);
+
+static const char *
+skip_s(const char *s)
+{
+    while (isspace(UChar(*s)))
+	s++;
+    return s;
+}
+
+static int
+match_c(const char *source, const char *pattern,...)
+{
+    const char *last_s = source + strlen(source);
+    va_list ap;
+    int ch;
+    int *ip;
+    char *cp;
+    long lv;
+
+    va_start(ap, pattern);
+
+    while (*pattern != '\0') {
+	ch = UChar(*pattern++);
+	/* blank in the pattern matches zero-or-more blanks in source */
+	if (isspace(ch)) {
+	    source = skip_s(source);
+	    continue;
+	}
+	/* %c, %d, %s are like sscanf except for special treatment of blanks */
+	if (ch == '%' && *pattern != '\0' && strchr("cds", *pattern)) {
+	    bool found = FALSE;
+	    ch = *pattern++;
+	    switch (ch) {
+	    case 'c':
+		cp = va_arg(ap, char *);
+		*cp = *source++;
+		break;
+	    case 'd':
+		ip = va_arg(ap, int *);
+		lv = strtol(source, &cp, 0);
+		if (cp != 0 && cp != source) {
+		    *ip = (int) lv;
+		    source = cp;
+		} else {
+		    goto finish;
+		}
+		break;
+	    case 's':
+		cp = va_arg(ap, char *);
+		while (*source != '\0') {
+		    ch = UChar(*source);
+		    if (isspace(ch)) {
+			break;
+		    } else if (found && (ch == *skip_s(pattern))) {
+			break;
+		    } else {
+			*cp++ = *source++;
+			found = TRUE;
+		    }
+		}
+		*cp = '\0';
+		break;
+	    }
+	    continue;
+	}
+	/* other characters are matched literally */
+	if (*source++ != ch) {
+	    break;
+	}
+    }
+  finish:
+
+    va_end(ap);
+    if (source > last_s)
+	source = last_s;
+    return (*source || *pattern) ? 0 : 1;
+}
+
 static PICS_HEAD *
 parse_xbm(char **data)
 {
@@ -280,6 +375,137 @@ parse_xbm(char **data)
     return result;
 }
 
+static PICS_HEAD *
+parse_xpm(char **data)
+{
+    int state = 0;
+    PICS_HEAD *result = typeCalloc(PICS_HEAD, 1);
+    int n;
+    int cells = 0;
+    int color = 0;
+    int cpp = 1;		/* chars per pixel */
+    int num[6];
+    int which = 0;
+    char ch;
+    const char *cs;
+    char *s;
+    char buf[BUFSIZ];
+    char arg1[BUFSIZ];
+    char arg2[BUFSIZ];
+    char arg3[BUFSIZ];
+    char **list = 0;
+
+    for (n = 0; data[n] != 0; ++n) {
+	if (strlen(s = data[n]) >= sizeof(buf) - 1)
+	    continue;
+	switch (state) {
+	case 0:
+	    if (match_c(s, " /* XPM */ ")) {
+		state = 1;
+	    }
+	    break;
+	case 1:
+	    if (match_c(s, " static char * %s [] = %c ", arg1, &ch) &&
+		ch == L_CURL) {
+		result->name = strdup(arg1);
+		state = 2;
+	    }
+	    break;
+	case 2:
+	    if (match_c(s, " \" %d %d %d %d \" , ",
+			num + 0, num + 1, num + 2, num + 3) ||
+		match_c(s, " \" %d %d %d %d %d %d \" , ",
+			num + 0, num + 1, num + 2, num + 3, num + 4, num + 5)) {
+		result->wide = num[0];
+		result->high = num[1];
+		result->colors = num[2];
+		result->pairs = typeCalloc(PICS_PAIR, result->colors);
+		cells = (size_t) (result->wide * result->high);
+		result->cells = typeCalloc(PICS_CELL, cells);
+		list = typeCalloc(char *, result->colors);
+		cpp = num[3];
+		state = 3;
+	    }
+	    break;
+	case 3:
+	    if (match_c(s, " \" %s %s %s \" , ", arg1, arg2, arg3)) {
+		;
+	    } else if (match_c(s, " \" %s %s \" , ", arg2, arg3)) {
+		strcpy(arg1, " ");
+	    } else {
+		break;
+	    }
+	    while ((int) strlen(arg1) < cpp)
+		strcat(arg1, " ");
+	    list[color] = strdup(arg1);
+	    if (!strcmp(arg3, "None")) {
+		result->pairs[color].fg = -1;
+	    } else if (*arg3 == '#') {
+		unsigned long value = strtoul(arg3 + 1, &s, 16);
+		result->pairs[color].fg = (int) value;
+	    } else {
+		result->pairs[color].fg = 0;	/* actually an error */
+	    }
+	    if (++color >= result->colors)
+		state = 4;
+	    break;
+	case 4:
+	    if (*(cs = skip_s(s)) == '"') {
+		++cs;
+		while (*cs != '\0' && *cs != '"') {
+		    int c;
+
+		    for (c = 0; c < result->colors; ++c) {
+			if (!strncmp(cs, list[c], cpp)) {
+			    result->cells[which].ch = list[c][0];
+			    result->cells[which].fg = c;
+			    break;
+			}
+		    }
+
+		    if (result->cells[which].ch == 0) {
+			result->cells[which].ch = '?';
+			result->cells[which].fg = 0;
+		    }
+
+		    if (++which >= cells) {
+			state = 5;
+			break;
+		    }
+		    for (c = cpp; c > 0; --c, ++cs) ;
+		}
+	    }
+	    break;
+	}
+    }
+
+    if (result && list) {
+	for (n = 0; n < result->colors; ++n)
+	    free(list[n]);
+	free(list);
+    }
+
+    if (state < 5) {
+	free_pics_head(result);
+	result = 0;
+    }
+
+    return result;
+}
+
+static PICS_HEAD *
+read_picture(const char *filename, char **data)
+{
+    PICS_HEAD *pics;
+    if ((pics = parse_xbm(data)) == 0) {
+	if ((pics = parse_xpm(data)) == 0) {
+	    free_data(data);
+	    giveup("unexpected file-format for \"%s\"", filename);
+	}
+    }
+    return pics;
+}
+
 static void
 dump_picture(PICS_HEAD * pics)
 {
@@ -287,6 +513,14 @@ dump_picture(PICS_HEAD * pics)
 
     printf("Name %s\n", pics->name);
     printf("Size %dx%d\n", pics->high, pics->wide);
+    printf("Color\n");
+    for (y = 0; y < pics->colors; ++y) {
+	if (pics->pairs[y].fg < 0) {
+	    printf(" %3d: %d\n", y, pics->pairs[y].fg);
+	} else {
+	    printf(" %3d: #%06x\n", y, pics->pairs[y].fg);
+	}
+    }
     for (y = 0; y < pics->high; ++y) {
 	for (x = 0; x < pics->wide; ++x) {
 	    putchar(pics->cells[y * pics->wide + x].ch);
@@ -346,13 +580,18 @@ main(int argc, char *argv[])
 	    PICS_HEAD *pics;
 	    if (data == 0) {
 		giveup("cannot read \"%s\"", argv[n]);
-	    } else if ((pics = parse_xbm(data)) == 0) {
+	    }
+	    if ((pics = read_picture(argv[n], data)) == 0) {
+		free_data(data);
 		giveup("unexpected file-format for \"%s\"", argv[n]);
-	    } else if (isatty(fileno(stdout))) {
+	    }
+	    if (isatty(fileno(stdout))) {
 		show_picture(pics);
 	    } else {
 		dump_picture(pics);
 	    }
+	    free_data(data);
+	    free_pics_head(pics);
 	}
     } else {
 	usage();
-- 
2.44.0