From f0179cb6083cc92e5947ae56e6a0a5c5328aead0 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Fri, 7 Feb 2020 08:36:41 +0000 Subject: Vendor import ncurses 6.1-20200118 --- test/Makefile.in | 21 +- test/README | 533 +- test/aclocal.m4 | 1949 ++- test/background.c | 43 +- test/blue.c | 191 +- test/bs.c | 158 +- test/bulgarian-utf8-tabs.txt | 6 + test/cardfile.c | 38 +- test/chgat.c | 51 +- test/clip_printw.c | 46 +- test/color_content.c | 331 + test/color_name.h | 8 +- test/color_set.c | 7 +- test/configure | 19061 +++++++++++++++++----------- test/configure.in | 240 +- test/demo_altkeys.c | 40 +- test/demo_defkey.c | 49 +- test/demo_forms.c | 79 +- test/demo_keyok.c | 8 +- test/demo_menus.c | 146 +- test/demo_new_pair.c | 355 + test/demo_panels.c | 71 +- test/demo_tabs.c | 119 + test/demo_termcap.c | 673 +- test/demo_terminfo.c | 652 +- test/ditto.c | 28 +- test/dots.c | 119 +- test/dots_curses.c | 218 + test/dots_mvcur.c | 121 +- test/dots_termcap.c | 136 +- test/dots_xcurses.c | 267 + test/dump_window.c | 179 + test/dump_window.h | 40 + test/echochar.c | 40 +- test/edit_field.c | 158 +- test/edit_field.h | 11 +- test/escherknot.xbm | 473 + test/extended_color.c | 251 + test/filter.c | 329 +- test/firework.c | 72 +- test/firstlast.c | 19 +- test/foldkeys.c | 38 +- test/form_driver_w.c | 69 +- test/gdc.6 | 21 +- test/gdc.c | 76 +- test/hanoi.c | 232 +- test/hashtest.c | 16 +- test/inch_wide.c | 25 +- test/inchs.c | 24 +- test/ins_wide.c | 15 +- test/insdelln.c | 40 +- test/inserts.c | 9 +- test/key_names.c | 7 +- test/knight.c | 484 +- test/linedata.h | 14 +- test/list_keys.c | 511 + test/lrtest.c | 11 +- test/make-tar.sh | 8 +- test/mensetmanus.xbm | 258 + test/mini.xterm_48x48.xpm | 264 + test/mk-test.awk | 49 +- test/modules | 44 +- test/movewindow.c | 65 +- test/ncurses.c | 2450 ++-- test/newdemo.c | 34 +- test/package/debian-mingw/compat | 1 + test/package/debian-mingw/control | 18 + test/package/debian-mingw/copyright | 78 + test/package/debian-mingw/docs | 1 + test/package/debian-mingw/rules | 101 + test/package/debian-mingw/source/format | 1 + test/package/debian-mingw/watch | 4 + test/package/debian-mingw64/compat | 1 + test/package/debian-mingw64/control | 18 + test/package/debian-mingw64/copyright | 78 + test/package/debian-mingw64/docs | 1 + test/package/debian-mingw64/rules | 101 + test/package/debian-mingw64/source/format | 1 + test/package/debian-mingw64/watch | 4 + test/package/debian/compat | 2 +- test/package/debian/control | 14 +- test/package/debian/copyright | 17 +- test/package/debian/rules | 158 +- test/package/debian/watch | 2 +- test/package/mingw-ncurses-examples.spec | 42 +- test/package/ncurses-examples.spec | 97 +- test/padview.c | 528 + test/pair_content.c | 317 + test/parse_rgb.h | 98 + test/picsmap.c | 1762 +++ test/picsmap.h | 74 + test/popup_msg.c | 183 + test/popup_msg.h | 42 + test/programs | 48 +- test/railroad.c | 15 +- test/rain.c | 93 +- test/redraw.c | 74 +- test/savescreen.c | 439 +- test/savescreen.sh | 19 +- test/sp_tinfo.c | 351 + test/tclock.c | 69 +- test/terminal.xbm | 52 + test/test.priv.h | 464 +- test/test_add_wchstr.c | 42 +- test/test_addchstr.c | 27 +- test/test_addstr.c | 20 +- test/test_addwstr.c | 47 +- test/test_arrays.c | 152 +- test/test_get_wstr.c | 42 +- test/test_getstr.c | 40 +- test/test_instr.c | 11 +- test/test_inwstr.c | 10 +- test/test_setupterm.c | 215 + test/test_sgr.c | 383 + test/test_termattrs.c | 199 + test/test_vid_puts.c | 33 +- test/test_vidputs.c | 34 +- test/testaddch.c | 14 +- test/testcurs.c | 249 +- test/testscanw.c | 6 +- test/tput-colorcube | 130 + test/tput-initc | 155 + test/tracemunch | 659 +- test/view.c | 671 +- test/widechars-utf8-tabs.txt | 15 + test/widechars.h | 6 +- test/worm.c | 138 +- test/xmas.c | 1664 +-- test/xterm-16color.dat | 10 +- test/xterm-256color.dat | 10 +- test/xterm-88color.dat | 10 +- test/xterm-color_48x48.xpm | 61 + 132 files changed, 30652 insertions(+), 11869 deletions(-) create mode 100644 test/bulgarian-utf8-tabs.txt create mode 100644 test/color_content.c create mode 100644 test/demo_new_pair.c create mode 100644 test/demo_tabs.c create mode 100644 test/dots_curses.c create mode 100644 test/dots_xcurses.c create mode 100644 test/dump_window.c create mode 100644 test/dump_window.h create mode 100644 test/escherknot.xbm create mode 100644 test/extended_color.c create mode 100644 test/list_keys.c create mode 100644 test/mensetmanus.xbm create mode 100644 test/mini.xterm_48x48.xpm create mode 100644 test/package/debian-mingw/compat create mode 100644 test/package/debian-mingw/control create mode 100644 test/package/debian-mingw/copyright create mode 100644 test/package/debian-mingw/docs create mode 100755 test/package/debian-mingw/rules create mode 100644 test/package/debian-mingw/source/format create mode 100644 test/package/debian-mingw/watch create mode 100644 test/package/debian-mingw64/compat create mode 100644 test/package/debian-mingw64/control create mode 100644 test/package/debian-mingw64/copyright create mode 100644 test/package/debian-mingw64/docs create mode 100755 test/package/debian-mingw64/rules create mode 100644 test/package/debian-mingw64/source/format create mode 100644 test/package/debian-mingw64/watch create mode 100644 test/padview.c create mode 100644 test/pair_content.c create mode 100644 test/parse_rgb.h create mode 100644 test/picsmap.c create mode 100644 test/picsmap.h create mode 100644 test/popup_msg.c create mode 100644 test/popup_msg.h create mode 100644 test/sp_tinfo.c create mode 100644 test/terminal.xbm create mode 100644 test/test_setupterm.c create mode 100644 test/test_sgr.c create mode 100644 test/test_termattrs.c create mode 100755 test/tput-colorcube create mode 100755 test/tput-initc create mode 100644 test/widechars-utf8-tabs.txt create mode 100644 test/xterm-color_48x48.xpm (limited to 'test') diff --git a/test/Makefile.in b/test/Makefile.in index 6600cd788254..90f8ecd1906f 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.111 2013/10/05 23:46:10 tom Exp $ +# $Id: Makefile.in,v 1.120 2018/01/15 19:28:45 tom Exp $ ############################################################################## -# Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. # +# Copyright (c) 1998-2017,2018 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"), # @@ -34,7 +34,7 @@ # turn off _all_ suffix rules; we'll generate our own .SUFFIXES: -SHELL = /bin/sh +SHELL = @SHELL@ VPATH = @srcdir@ @SET_MAKE@ @@ -44,6 +44,7 @@ x = @EXEEXT@ o = .@OBJEXT@ MODEL = ../@DFT_OBJ_SUBDIR@ +top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -53,18 +54,26 @@ bindir = @bindir@ libdir = @libdir@ includedir = @includedir@ includesubdir = @includesubdir@ +datarootdir = @datarootdir@ +datadir = @datadir@ BINDIR = $(DESTDIR)$(bindir) LIBDIR = $(DESTDIR)$(libdir) INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) +DATADIR = $(DESTDIR)$(datadir) + +PACKAGE = @PACKAGE@ LIBTOOL = @LIBTOOL@ +LIBTOOL_OPTS = @LIBTOOL_OPTS@ LIBTOOL_CLEAN = @LIB_CLEAN@ LIBTOOL_COMPILE = @LIB_COMPILE@ LIBTOOL_LINK = @LIB_LINK@ -INSTALL = @INSTALL@ -INSTALL_PROG = @INSTALL_PROGRAM@ +INSTALL = @INSTALL@ @INSTALL_OPT_O@ +INSTALL_PROG = @INSTALL_PROGRAM@ @INSTALL_OPT_S@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_DATA = @INSTALL_DATA@ transform = @program_transform_name@ TRANSFORM = sed 's/$x$$//'|sed '$(transform)'|sed 's/$$/$x/' @@ -75,7 +84,7 @@ CC = @CC@ CPP = @CPP@ CFLAGS = @CFLAGS@ @EXTRA_CFLAGS@ -CPPFLAGS = -I. -I$(srcdir) -I../test -DHAVE_CONFIG_H @CPPFLAGS@ +CPPFLAGS = -I. -I$(srcdir) -I../test -DHAVE_CONFIG_H -DDATA_DIR=\"$(datadir)\" @CPPFLAGS@ CCFLAGS = $(CPPFLAGS) $(CFLAGS) diff --git a/test/README b/test/README index 62b6dff3e683..135c31cf1e4d 100644 --- a/test/README +++ b/test/README @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- --- Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. -- +-- Copyright (c) 1998-2018,2019 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 -- @@ -25,31 +25,47 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: README,v 1.48 2013/01/19 21:30:38 tom Exp $ +-- $Id: README,v 1.68 2019/01/21 14:18:33 tom Exp $ ------------------------------------------------------------------------------- -The programs in this directory are designed to test your newest toy :-) -Check the sources for any further details. +The programs in this directory are used to test and demonstrate ncurses. +Some are interesting in themselves, while others merely show how some of +the library calls are used. Some date back to the initial releases of +ncurses during the mid-1990s, such as: -blue - Blue Moon, a nifty solitaire (uses color) -bs.c - the game of Battleships (uses color) -firework.c - multi-colored fireworks (uses color) -gdc.c - Great Digital Clock (uses color) -hanoi.c - the game of hanoi (uses color essentially) -knight.c - the game of Knight's Tour (uses color) -lrtest.c - test of access to the lower-right corner -ncurses.c - multi-test program (uses color) -newdemo.c - another test from PDCurses (uses color) -rain.c - rain drops keep falling on my head... -tclock.c - analog/digital clock -testcurs.c - a test from the PDCurses people (uses color) -worm.c - worms run all over your screen (uses color) -xmas.c - Xmas greeting card + blue - Blue Moon, a nifty solitaire (uses color) + bs.c - the game of Battleships (uses color) + firework.c - multi-colored fireworks (uses color) + gdc.c - Great Digital Clock (uses color) + hanoi.c - the game of hanoi (uses color essentially) + knight.c - the game of Knight's Tour (uses color) + lrtest.c - test of access to the lower-right corner + ncurses.c - multi-test program (uses color) + newdemo.c - another test from PDCurses (uses color) + rain.c - rain drops keep falling on my head... + tclock.c - analog/digital clock + testcurs.c - a test from the PDCurses people (uses color) + tracemunch - Perl script to make trace scripts easier to read + worm.c - worms run all over your screen (uses color) + xmas.c - Xmas greeting card -The bs and knight games demonstrate processing of mouse events under xterm. -This directory also contains: +Besides being built as part of ncurses, the programs are also packaged as +"ncurses-examples". Despite the name, the programs have been adjusted to +allow them to build with other curses implementations, to provide a way to +compare those with ncurses. -tracemunch - Perl script to crunch trace scripts to make them easier to read +You can build the programs by + + ./configure + make + +The configure script has several options which allow you to tell it more +about the curses implementation for which you are building the examples. +Use + + ./configure --help + +to list the options. ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- @@ -57,6 +73,7 @@ tracemunch - Perl script to crunch trace scripts to make them easier to read These programs provide examples of use, but do not comprise a complete set of tests. Here is a list of library externals, noting those that are used: + libform: ------- TYPE_ALNUM test: demo_forms @@ -72,23 +89,24 @@ data_behind test: demo_forms dup_field - dynamic_field_info test: demo_forms field_arg test: demo_forms -field_back test: demo_forms -field_buffer test: cardfile demo_forms edit_field ncurses +field_back test: demo_forms edit_field +field_buffer test: cardfile demo_forms ncurses field_count test: demo_forms field_fore test: demo_forms field_index test: demo_forms -field_info test: ncurses +field_info test: edit_field ncurses field_init - field_just - field_opts test: demo_forms ncurses -field_opts_off test: cardfile demo_forms +field_opts_off test: cardfile demo_forms form_driver_w field_opts_on test: demo_forms field_pad test: demo_forms field_status test: demo_forms field_term - field_type test: demo_forms -field_userptr test: demo_forms edit_field ncurses +field_userptr test: edit_field ncurses form_driver test: cardfile demo_forms edit_field ncurses +form_driver_w test: form_driver_w form_fields test: cardfile demo_forms form_init - form_opts - @@ -100,23 +118,23 @@ form_request_name test: edit_field form_sub test: cardfile demo_forms ncurses form_term - form_userptr - -form_win test: cardfile demo_forms edit_field ncurses -free_field test: cardfile demo_forms ncurses +form_win test: cardfile demo_forms edit_field form_driver_w ncurses +free_field test: cardfile demo_forms form_driver_w ncurses free_fieldtype test: ncurses -free_form test: cardfile demo_forms ncurses +free_form test: cardfile demo_forms form_driver_w ncurses link_field - link_fieldtype - move_field - -new_field test: cardfile demo_forms ncurses +new_field test: cardfile demo_forms form_driver_w ncurses new_fieldtype test: ncurses -new_form test: cardfile demo_forms ncurses +new_form test: cardfile demo_forms form_driver_w ncurses new_form_sp - new_page test: demo_forms pos_form_cursor - -post_form test: cardfile demo_forms ncurses +post_form test: cardfile demo_forms form_driver_w ncurses scale_form test: demo_forms ncurses set_current_field test: demo_forms -set_field_back test: cardfile demo_forms edit_field ncurses +set_field_back test: cardfile demo_forms edit_field form_driver_w ncurses set_field_buffer test: cardfile demo_forms edit_field ncurses set_field_fore test: demo_forms set_field_init - @@ -126,7 +144,7 @@ set_field_pad test: demo_forms set_field_status test: demo_forms set_field_term - set_field_type test: demo_forms ncurses -set_field_userptr test: demo_forms ncurses +set_field_userptr test: edit_field ncurses set_fieldtype_arg - set_fieldtype_choice - set_form_fields - @@ -139,7 +157,8 @@ set_form_userptr - set_form_win test: cardfile demo_forms ncurses set_max_field test: demo_forms set_new_page test: demo_forms -unpost_form test: cardfile demo_forms ncurses +unfocus_current_field - +unpost_form test: cardfile demo_forms form_driver_w ncurses libmenu: ------- @@ -155,7 +174,7 @@ item_opts - item_opts_off - item_opts_on - item_term - -item_userptr - +item_userptr test: demo_menus item_value test: demo_menus ncurses item_visible - menu_back - @@ -185,16 +204,16 @@ pos_menu_cursor lib: menu post_menu test: demo_menus ncurses scale_menu test: demo_menus ncurses set_current_item - -set_item_init - +set_item_init test: demo_menus set_item_opts - -set_item_term - -set_item_userptr - +set_item_term test: demo_menus +set_item_userptr test: demo_menus set_item_value test: demo_menus ncurses set_menu_back test: demo_menus set_menu_fore test: demo_menus set_menu_format test: demo_menus ncurses set_menu_grey - -set_menu_init - +set_menu_init test: demo_menus set_menu_items - set_menu_mark test: demo_menus set_menu_opts - @@ -202,7 +221,7 @@ set_menu_pad - set_menu_pattern - set_menu_spacing - set_menu_sub test: demo_menus ncurses -set_menu_term - +set_menu_term test: demo_menus set_menu_userptr - set_menu_win test: demo_menus ncurses set_top_row - @@ -211,43 +230,45 @@ unpost_menu test: demo_menus ncurses libncurses: ---------- -BC - -COLORS test: echochar ncurses savescreen xmas -COLOR_PAIR test: background blue bs cardfile clip_printw demo_forms demo_menus demo_panels echochar filter firework gdc hanoi ins_wide insdelln inserts knight ncurses newdemo rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr testaddch testcurs view worm xmas -COLOR_PAIRS test: echochar ncurses newdemo savescreen -COLS test: cardfile demo_altkeys demo_defkey demo_forms demo_keyok demo_menus demo_panels ditto echochar edit_field firework foldkeys hashtest inch_wide inchs ins_wide inserts lrtest movewindow ncurses newdemo rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs view worm +BC test: demo_termcap +COLORS test: color_content demo_new_pair dots_curses dots_xcurses echochar ncurses pair_content picsmap savescreen xmas +COLOR_PAIR test: background blue bs cardfile clip_printw demo_forms demo_menus demo_panels dots_curses echochar filter firework gdc hanoi ins_wide insdelln inserts knight ncurses newdemo padview picsmap rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr testaddch testcurs view worm xmas +COLOR_PAIRS test: demo_new_pair dots_curses dots_xcurses echochar ncurses newdemo pair_content +COLS test: cardfile demo_altkeys demo_defkey demo_forms demo_keyok demo_menus demo_panels ditto dots_curses dots_xcurses echochar filter firework foldkeys hashtest inch_wide inchs ins_wide inserts lrtest movewindow ncurses newdemo padview picsmap rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs view worm ESCDELAY test: test_opaque -LINES test: cardfile demo_defkey demo_keyok demo_menus demo_panels ditto echochar edit_field firework hanoi hashtest inch_wide inchs ins_wide inserts lrtest movewindow ncurses newdemo rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs view worm xmas -PAIR_NUMBER test: ncurses -PC lib: ncurses +LINES test: cardfile demo_defkey demo_keyok demo_menus demo_panels ditto dots_curses dots_xcurses echochar firework hanoi hashtest inch_wide inchs ins_wide inserts lrtest movewindow ncurses newdemo padview picsmap rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs view worm xmas +PAIR_NUMBER test: dump_window ncurses +PC test: demo_termcap SP lib: form TABSIZE test: test_opaque -UP - -acs_map test: background gdc ins_wide inserts knight movewindow ncurses newdemo test_add_wchstr test_addchstr test_addstr test_addwstr testcurs -add_wch test: demo_panels ncurses test_add_wchstr test_addwstr +UP test: demo_termcap +acs_map test: background gdc ins_wide inserts knight movewindow ncurses newdemo savescreen test_add_wchstr test_addchstr test_addstr test_addwstr testcurs +add_wch test: demo_new_pair demo_panels ncurses picsmap savescreen test_add_wchstr test_addwstr add_wchnstr test: test_add_wchstr add_wchstr test: test_add_wchstr view -addch test: background blue bs echochar hashtest ncurses savescreen test_add_wchstr test_addchstr test_addstr test_addwstr test_opaque testaddch view worm +addch test: background blue bs color_content dots_curses echochar hashtest ncurses padview pair_content picsmap savescreen test_add_wchstr test_addchstr test_addstr test_addwstr test_opaque testaddch view worm addchnstr test: test_addchstr addchstr test: test_addchstr addnstr test: test_addstr -addnwstr test: ncurses test_addwstr -addstr test: blue bs cardfile gdc hanoi lrtest ncurses savescreen test_addstr -addwstr test: ncurses test_addwstr +addnwstr test: dots_xcurses ncurses test_addwstr +addstr test: blue bs cardfile filter gdc hanoi lrtest ncurses test_addstr +addwstr test: blue test_addwstr +alloc_pair test: demo_new_pair dots_xcurses +alloc_pair_sp - assume_default_colors test: background ncurses assume_default_colors_sp - -attr_get test: ncurses -attr_off test: ncurses -attr_on test: ncurses +attr_get - +attr_off test: dots_xcurses ncurses +attr_on test: dots_xcurses ncurses attr_set test: ncurses -attroff test: echochar filter gdc ncurses tclock -attron test: bs echochar filter gdc ncurses -attrset test: bs firework gdc hanoi insdelln ncurses rain tclock testaddch testcurs -baudrate lib: ncurses -baudrate_sp lib: ncurses -beep test: blue bs cardfile chgat clip_printw demo_forms demo_menus demo_panels edit_field hanoi inch_wide inchs ins_wide insdelln inserts knight movewindow ncurses savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs view xmas +attroff test: blue dots_curses echochar filter gdc ncurses tclock +attron test: blue bs dots_curses echochar filter gdc ncurses +attrset test: bs filter firework gdc hanoi insdelln ncurses picsmap rain tclock testaddch testcurs +baudrate test: ncurses +baudrate_sp test: sp_tinfo +beep test: blue bs cardfile chgat clip_printw demo_forms demo_menus demo_new_pair demo_panels edit_field firstlast hanoi inch_wide inchs ins_wide insdelln inserts knight movewindow ncurses padview popup_msg rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs view xmas beep_sp lib: ncurses -bkgd test: background cardfile demo_forms ncurses savescreen tclock view +bkgd test: background cardfile demo_forms ncurses padview savescreen tclock view bkgdset test: background ncurses testaddch bkgrnd test: ncurses bkgrndset test: ncurses @@ -256,76 +277,86 @@ boolfnames test: demo_terminfo test_arrays progs: dump_entry boolnames test: demo_terminfo test_arrays progs: dump_entry infocmp border - border_set - -box test: cardfile chgat clip_printw demo_forms demo_menus demo_panels ditto edit_field inch_wide inchs ins_wide insdelln inserts lrtest ncurses newdemo redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs +box test: cardfile chgat clip_printw demo_forms demo_menus demo_panels ditto inch_wide inchs ins_wide insdelln inserts lrtest ncurses newdemo popup_msg redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs box_set test: ncurses -can_change_color test: ncurses -can_change_color_sp - -cbreak test: background blue bs cardfile chgat clip_printw color_set demo_altkeys demo_defkey demo_forms demo_keyok demo_menus demo_panels ditto filter firework foldkeys gdc hanoi hashtest inch_wide inchs ins_wide insdelln inserts knight lrtest movewindow ncurses newdemo savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs view worm xmas -cbreak_sp lib: ncurses +can_change_color test: color_content extended_color ncurses +can_change_color_sp test: extended_color +cbreak test: background blue bs cardfile chgat clip_printw color_content color_set demo_altkeys demo_defkey demo_forms demo_keyok demo_menus demo_new_pair demo_panels ditto extended_color filter firework foldkeys form_driver_w gdc hanoi hashtest inch_wide inchs ins_wide insdelln inserts knight lrtest movewindow ncurses newdemo padview pair_content picsmap savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs view worm xmas +cbreak_sp test: sp_tinfo chgat test: chgat -clear test: blue bs gdc ncurses testcurs xmas +clear test: blue bs filter gdc ncurses padview testcurs xmas clearok test: bs knight -clrtobot test: demo_menus ncurses -clrtoeol test: blue bs demo_altkeys demo_menus foldkeys hanoi hashtest movewindow ncurses view -color_content test: ncurses +clrtobot test: demo_menus ncurses view +clrtoeol test: blue bs demo_altkeys filter foldkeys form_driver_w hanoi hashtest movewindow ncurses padview view +color_content test: color_content ncurses picsmap color_content_sp - -color_set test: color_set ncurses +color_set test: color_set dots_xcurses extended_color ncurses copywin test: ncurses testcurs -cur_term test: demo_terminfo dots dots_mvcur lrtest test_vid_puts test_vidputs progs: clear tabs tput tset -curs_set test: echochar firework gdc hanoi lrtest ncurses newdemo rain savescreen tclock testcurs worm xmas -curs_set_sp lib: ncurses -curscr test: demo_panels edit_field knight lrtest ncurses savescreen tclock view -curses_version test: ncurses progs: infocmp tic toe tput tset +cur_term test: demo_termcap demo_terminfo dots dots_mvcur filter list_keys lrtest sp_tinfo test_sgr test_vid_puts test_vidputs progs: clear_cmd reset_cmd tabs tput tset +curs_set test: demo_new_pair echochar firework gdc hanoi lrtest ncurses newdemo picsmap rain savescreen tclock testcurs worm xmas +curs_set_sp test: sp_tinfo +curscr test: demo_panels knight lrtest ncurses popup_msg savescreen tclock +curses_version test: ncurses progs: clear infocmp tabs tic toe tput tset def_prog_mode test: bs ncurses -def_prog_mode_sp lib: ncurses +def_prog_mode_sp test: sp_tinfo def_shell_mode - -def_shell_mode_sp lib: ncurses +def_shell_mode_sp test: sp_tinfo define_key test: demo_altkeys demo_defkey foldkeys -define_key_sp - -del_curterm lib: ncurses +define_key_sp test: sp_tinfo +del_curterm test: demo_terminfo sp_tinfo test_sgr del_curterm_sp lib: ncurses delay_output test: newdemo -delay_output_sp - +delay_output_sp test: sp_tinfo delch - deleteln test: insdelln delscreen test: ditto dots_mvcur -delwin test: cardfile chgat clip_printw demo_forms demo_panels edit_field inch_wide inchs ins_wide insdelln inserts movewindow ncurses newdemo redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs +delwin test: cardfile chgat clip_printw demo_forms demo_panels inch_wide inchs ins_wide insdelln inserts ncurses newdemo popup_msg redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs view derwin test: cardfile chgat clip_printw demo_forms demo_menus ditto inch_wide inchs ins_wide insdelln inserts movewindow ncurses test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque -doupdate test: cardfile demo_menus demo_panels ditto edit_field ins_wide inserts knight movewindow ncurses redraw savescreen test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr +doupdate test: cardfile demo_menus demo_panels ditto ins_wide inserts knight movewindow ncurses padview popup_msg redraw savescreen test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr doupdate_sp lib: ncurses -dupwin test: edit_field +dupwin test: popup_msg echo test: bs hanoi ncurses test_get_wstr test_getstr testcurs testscanw echo_sp lib: ncurses echo_wchar test: ncurses echochar test: echochar ncurses -endwin test: background blue bs cardfile chgat clip_printw color_set demo_altkeys demo_defkey demo_forms demo_keyok demo_menus demo_panels ditto dots_mvcur echochar filter firework firstlast foldkeys gdc hanoi hashtest inch_wide inchs ins_wide insdelln inserts key_names keynames knight lrtest movewindow ncurses newdemo rain redraw savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testaddch testcurs testscanw view worm xmas +endwin test: background blue bs cardfile chgat clip_printw color_content color_set demo_altkeys demo_defkey demo_forms demo_keyok demo_menus demo_new_pair demo_panels ditto dots_curses dots_mvcur dots_xcurses echochar extended_color filter firework firstlast foldkeys form_driver_w gdc hanoi hashtest inch_wide inchs ins_wide insdelln inserts key_names keynames knight lrtest movewindow ncurses newdemo padview pair_content picsmap rain redraw savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testaddch testcurs testscanw view worm xmas endwin_sp lib: ncurses -erase test: cardfile demo_menus filter firework firstlast hanoi lrtest ncurses tclock test_opaque testcurs -erasechar lib: ncurses -erasechar_sp lib: ncurses -erasewchar - +erase test: cardfile demo_menus filter firework firstlast hanoi lrtest ncurses picsmap tclock test_opaque testcurs +erasechar test: ncurses +erasechar_sp test: sp_tinfo +erasewchar test: ncurses +extended_color_content test: color_content extended_color +extended_color_content_sp test: extended_color +extended_pair_content test: extended_color pair_content +extended_pair_content_sp test: extended_color +extended_slk_color test: extended_color +extended_slk_color_sp test: extended_color filter test: filter filter_sp - -flash test: cardfile lrtest movewindow ncurses tclock testcurs +find_pair test: demo_new_pair +find_pair_sp - +flash test: cardfile filter lrtest movewindow ncurses tclock testcurs flash_sp - flushinp test: ncurses newdemo testcurs -flushinp_sp lib: ncurses +flushinp_sp test: sp_tinfo +free_pair test: demo_new_pair +free_pair_sp - get_escdelay - get_escdelay_sp - -get_wch - +get_wch test: form_driver_w get_wstr test: test_get_wstr getattrs - -getbegx test: chgat clip_printw demo_menus demo_panels insdelln movewindow ncurses newdemo redraw testcurs -getbegy test: chgat clip_printw demo_menus demo_panels insdelln movewindow ncurses newdemo redraw testcurs +getbegx test: chgat clip_printw demo_menus demo_panels dump_window insdelln movewindow ncurses newdemo redraw testcurs +getbegy test: chgat clip_printw demo_menus demo_panels dump_window insdelln movewindow ncurses newdemo redraw testcurs getbkgd test: ncurses getbkgrnd test: ncurses -getcchar test: ncurses view -getch test: background blue bs chgat color_set demo_altkeys filter firework firstlast foldkeys hanoi hashtest insdelln lrtest savescreen tclock test_opaque testaddch testcurs view xmas -getcurx test: bs chgat clip_printw demo_altkeys demo_defkey demo_panels firstlast foldkeys insdelln movewindow ncurses redraw savescreen test_get_wstr test_getstr test_opaque testcurs -getcury test: bs chgat clip_printw demo_altkeys demo_defkey demo_panels edit_field firstlast foldkeys insdelln movewindow ncurses redraw savescreen test_opaque testcurs -getmaxx test: chgat clip_printw demo_panels inch_wide inchs insdelln movewindow ncurses newdemo redraw test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs -getmaxy test: chgat clip_printw demo_forms demo_panels inch_wide inchs insdelln movewindow ncurses newdemo redraw test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs -getmouse test: bs knight movewindow ncurses +getcchar test: ncurses savescreen view +getch test: background blue bs chgat color_content color_set demo_altkeys demo_new_pair extended_color filter firework firstlast foldkeys hanoi hashtest insdelln lrtest padview pair_content picsmap savescreen tclock test_opaque testaddch testcurs view xmas +getcurx test: bs chgat clip_printw demo_altkeys demo_defkey demo_panels dump_window extended_color filter firstlast foldkeys insdelln movewindow ncurses redraw savescreen test_get_wstr test_getstr test_opaque testcurs view +getcury test: bs chgat clip_printw demo_altkeys demo_defkey demo_panels dump_window extended_color filter firstlast foldkeys insdelln movewindow ncurses popup_msg redraw savescreen test_opaque testcurs view +getmaxx test: chgat clip_printw demo_panels dump_window firstlast inch_wide inchs insdelln movewindow ncurses newdemo popup_msg redraw test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs +getmaxy test: chgat clip_printw demo_forms demo_panels dump_window firstlast inch_wide inchs insdelln movewindow ncurses newdemo popup_msg redraw test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs +getmouse test: bs demo_menus knight movewindow ncurses testcurs getmouse_sp - getn_wstr test: test_get_wstr getnstr test: filter ncurses test_getstr @@ -334,22 +365,22 @@ getpary test: movewindow getstr test: test_getstr getwin test: ncurses getwin_sp - -halfdelay test: view -halfdelay_sp - -has_colors test: background bs cardfile chgat clip_printw color_set demo_forms demo_menus demo_panels echochar filter firework gdc hanoi ins_wide insdelln inserts knight ncurses newdemo rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr testcurs view worm xmas +halfdelay test: padview view +halfdelay_sp test: sp_tinfo +has_colors test: background bs cardfile chgat clip_printw color_content color_set demo_forms demo_menus demo_new_pair demo_panels dots_curses dots_xcurses echochar extended_color filter firework gdc hanoi ins_wide insdelln inserts knight ncurses newdemo padview pair_content picsmap rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr testcurs view worm xmas has_colors_sp lib: ncurses -has_ic test: lrtest -has_ic_sp lib: ncurses -has_il - -has_il_sp lib: ncurses +has_ic test: lrtest ncurses +has_ic_sp test: sp_tinfo +has_il test: ncurses +has_il_sp test: sp_tinfo has_key - -has_key_sp lib: ncurses +has_key_sp test: sp_tinfo has_mouse - has_mouse_sp - hline test: gdc ncurses hline_set - idcok test: test_opaque -idlok test: ncurses test_opaque testscanw view +idlok test: ncurses padview test_opaque testscanw view immedok test: test_opaque in_wch test: inch_wide in_wchnstr test: inch_wide @@ -357,11 +388,15 @@ in_wchstr test: inch_wide inch test: inchs inchnstr test: inchs inchstr test: inchs -init_color test: ncurses -init_color_sp lib: ncurses -init_pair test: background blue bs cardfile chgat clip_printw color_set demo_forms demo_menus demo_panels echochar filter firework gdc hanoi ins_wide insdelln inserts knight ncurses newdemo rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr testaddch testcurs view worm xmas +init_color test: color_content ncurses +init_color_sp - +init_extended_color test: color_content extended_color +init_extended_color_sp test: extended_color +init_extended_pair test: extended_color ncurses pair_content picsmap +init_extended_pair_sp test: extended_color +init_pair test: background blue bs cardfile chgat clip_printw color_set demo_forms demo_menus demo_new_pair demo_panels dots_curses dots_xcurses echochar filter firework gdc hanoi ins_wide insdelln inserts knight ncurses newdemo padview pair_content picsmap rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr testaddch testcurs view worm xmas init_pair_sp - -initscr test: background blue bs cardfile chgat clip_printw color_set demo_defkey demo_forms demo_keyok demo_menus demo_panels echochar filter firework firstlast gdc hanoi hashtest inch_wide inchs ins_wide insdelln inserts knight lrtest movewindow ncurses newdemo rain redraw savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testaddch testcurs testscanw view worm xmas +initscr test: background blue bs cardfile chgat clip_printw color_content color_set demo_defkey demo_forms demo_keyok demo_menus demo_panels dots_curses dots_xcurses echochar filter firework firstlast form_driver_w gdc hanoi hashtest inch_wide inchs ins_wide insdelln inserts knight lrtest movewindow ncurses newdemo padview pair_content picsmap rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testaddch testcurs testscanw view worm xmas innstr test: test_instr innwstr test: test_inwstr ins_nwstr test: ins_wide @@ -374,19 +409,19 @@ insnstr test: inserts insstr test: inserts instr test: test_instr intrflush test: demo_forms movewindow -intrflush_sp - +intrflush_sp test: sp_tinfo inwstr test: test_inwstr is_cleared test: test_opaque is_idcok test: test_opaque is_idlok test: test_opaque is_immedok test: test_opaque -is_keypad test: test_opaque +is_keypad test: ncurses test_opaque is_leaveok test: test_opaque is_linetouched lib: form is_nodelay test: test_opaque is_notimeout test: test_opaque is_pad - -is_scrollok test: test_opaque +is_scrollok test: ncurses test_opaque is_subwin - is_syncok test: test_opaque is_term_resized - @@ -395,29 +430,30 @@ is_wintouched lib: ncurses isendwin - isendwin_sp - key_defined test: demo_defkey foldkeys -key_defined_sp lib: ncurses +key_defined_sp test: sp_tinfo key_name test: key_names ncurses keybound test: demo_altkeys demo_defkey -keybound_sp lib: ncurses -keyname test: demo_altkeys demo_defkey demo_keyok demo_menus edit_field foldkeys keynames movewindow ncurses redraw test_getstr testcurs view progs: tic -keyname_sp lib: ncurses +keybound_sp test: sp_tinfo +keyname test: demo_altkeys demo_defkey demo_keyok demo_menus edit_field foldkeys keynames movewindow ncurses padview redraw test_getstr testcurs view progs: tic +keyname_sp test: sp_tinfo keyok test: demo_keyok foldkeys -keyok_sp lib: ncurses -keypad test: bs cardfile chgat clip_printw demo_altkeys demo_defkey demo_forms demo_keyok demo_menus demo_panels ditto edit_field filter firework foldkeys hashtest inch_wide inchs ins_wide insdelln inserts key_names keynames knight lrtest movewindow ncurses redraw savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs testscanw view -killchar lib: ncurses -killchar_sp lib: ncurses -killwchar - +keyok_sp test: sp_tinfo +keypad test: bs cardfile chgat clip_printw demo_altkeys demo_defkey demo_forms demo_keyok demo_menus demo_new_pair demo_panels ditto filter firework foldkeys form_driver_w hashtest inch_wide inchs ins_wide insdelln inserts key_names keynames knight lrtest movewindow ncurses padview popup_msg redraw savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs testscanw view +killchar test: ncurses +killchar_sp test: sp_tinfo +killwchar test: ncurses leaveok test: hanoi test_opaque -longname test: testcurs progs: tput +longname test: ncurses testcurs progs: tput +longname_sp test: sp_tinfo mcprint - mcprint_sp - meta test: key_names keynames ncurses -mouse_trafo - +mouse_trafo lib: form mouseinterval - mouseinterval_sp - -mousemask test: bs demo_forms demo_menus knight movewindow ncurses +mousemask test: bs demo_forms demo_menus knight movewindow ncurses testcurs mousemask_sp - -move test: blue bs cardfile chgat demo_altkeys demo_menus echochar foldkeys gdc hanoi hashtest inch_wide inchs ins_wide inserts knight lrtest movewindow ncurses savescreen test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testscanw view xmas +move test: blue bs cardfile chgat demo_altkeys demo_menus demo_new_pair dots_curses dots_xcurses echochar filter foldkeys gdc hanoi hashtest inch_wide inchs ins_wide inserts knight lrtest movewindow ncurses picsmap savescreen test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testscanw view xmas mvadd_wch test: ncurses test_add_wchstr test_addwstr mvadd_wchnstr test: test_add_wchstr mvadd_wchstr test: test_add_wchstr @@ -457,14 +493,14 @@ mvinsnstr test: inserts mvinsstr test: inserts mvinstr test: test_instr mvinwstr test: test_inwstr -mvprintw test: background bs demo_menus firework hanoi ncurses tclock view +mvprintw test: background bs firework form_driver_w hanoi ncurses padview savescreen tclock view mvscanw - mvvline test: ncurses mvvline_set test: ncurses mvwadd_wch test: test_add_wchstr test_addwstr mvwadd_wchnstr test: test_add_wchstr mvwadd_wchstr test: inch_wide test_add_wchstr -mvwaddch test: movewindow newdemo test_add_wchstr test_addchstr test_addstr test_addwstr testcurs xmas +mvwaddch test: movewindow ncurses newdemo test_add_wchstr test_addchstr test_addstr test_addwstr testcurs xmas mvwaddchnstr test: test_addchstr mvwaddchstr test: inchs test_addchstr mvwaddnstr test: newdemo test_addstr testcurs @@ -479,13 +515,13 @@ mvwgetch test: inch_wide inchs test_get_wstr test_getstr test_instr test_inwst mvwgetn_wstr test: test_get_wstr mvwgetnstr test: test_getstr mvwgetstr test: test_getstr -mvwhline test: movewindow +mvwhline test: movewindow ncurses mvwhline_set - -mvwin test: cardfile demo_menus movewindow testcurs xmas +mvwin test: cardfile demo_menus movewindow ncurses testcurs xmas mvwin_wch test: inch_wide mvwin_wchnstr test: inch_wide mvwin_wchstr test: inch_wide -mvwinch test: inchs newdemo testcurs +mvwinch test: dump_window inchs newdemo testcurs mvwinchnstr test: inchs mvwinchstr test: inchs mvwinnstr test: test_instr testcurs @@ -498,74 +534,76 @@ mvwinsnstr test: inserts mvwinsstr test: inserts testcurs mvwinstr test: test_instr mvwinwstr test: test_inwstr -mvwprintw test: chgat clip_printw demo_panels inch_wide inchs insdelln ncurses test_instr test_inwstr testcurs +mvwprintw test: demo_menus demo_panels inch_wide inchs ncurses test_instr test_inwstr testcurs mvwscanw test: testcurs -mvwvline test: ins_wide inserts movewindow test_add_wchstr test_addchstr test_addstr test_addwstr +mvwvline test: ins_wide inserts movewindow ncurses test_add_wchstr test_addchstr test_addstr test_addwstr mvwvline_set - -napms test: demo_panels ditto dots dots_mvcur echochar firework gdc hanoi lrtest ncurses railroad rain tclock test_opaque testcurs view worm xmas progs: tset -napms_sp - -new_prescr lib: ncurses -newpad test: edit_field ncurses testcurs +napms test: demo_panels ditto dots dots_curses dots_mvcur dots_xcurses echochar extended_color firework firstlast gdc hanoi lrtest ncurses padview picsmap railroad rain tclock test_opaque testcurs view worm xmas progs: tset +napms_sp test: sp_tinfo +new_prescr test: sp_tinfo +newpad test: ncurses padview popup_msg testcurs newpad_sp lib: ncurses newscr lib: ncurses -newterm test: demo_altkeys ditto dots_mvcur filter foldkeys gdc key_names keynames +newterm test: demo_altkeys demo_new_pair ditto dots_mvcur extended_color filter foldkeys gdc key_names keynames redraw test_setupterm test_termattrs newterm_sp - -newwin test: cardfile chgat clip_printw demo_defkey demo_forms demo_keyok demo_menus demo_panels ditto edit_field firstlast inch_wide inchs ins_wide insdelln inserts knight movewindow ncurses newdemo redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs xmas +newwin test: cardfile chgat clip_printw demo_defkey demo_forms demo_keyok demo_menus demo_panels ditto firstlast inch_wide inchs ins_wide insdelln inserts knight movewindow ncurses newdemo popup_msg redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs view xmas newwin_sp lib: ncurses nl test: demo_forms ncurses rain testcurs nl_sp lib: ncurses nocbreak test: testcurs -nocbreak_sp lib: ncurses -nodelay test: ditto firework gdc lrtest ncurses newdemo rain tclock test_opaque view worm xmas -noecho test: background bs cardfile chgat clip_printw color_set demo_altkeys demo_defkey demo_forms demo_keyok demo_menus demo_panels ditto firework firstlast foldkeys gdc hanoi hashtest inch_wide inchs ins_wide insdelln inserts knight lrtest movewindow ncurses rain redraw savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs view worm xmas +nocbreak_sp test: sp_tinfo +nodelay test: demo_new_pair ditto extended_color firework gdc lrtest ncurses newdemo padview rain tclock test_opaque view worm xmas +noecho test: background bs cardfile chgat clip_printw color_content color_set demo_altkeys demo_defkey demo_forms demo_keyok demo_menus demo_new_pair demo_panels ditto extended_color firework firstlast foldkeys form_driver_w gdc hanoi hashtest inch_wide inchs ins_wide insdelln inserts knight lrtest movewindow ncurses padview pair_content picsmap rain redraw savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs view worm xmas noecho_sp lib: ncurses nofilter - nofilter_sp - -nonl test: bs demo_forms hashtest movewindow ncurses view worm xmas +nonl test: bs demo_forms hashtest movewindow ncurses padview view worm xmas nonl_sp lib: ncurses noqiflush - -noqiflush_sp - +noqiflush_sp test: sp_tinfo noraw test: demo_forms demo_menus ncurses testcurs -noraw_sp lib: ncurses -notimeout test: test_opaque +noraw_sp test: sp_tinfo +notimeout test: ncurses test_opaque numcodes test: demo_termcap test_arrays progs: dump_entry numfnames test: demo_terminfo test_arrays progs: dump_entry numnames test: demo_terminfo test_arrays progs: dump_entry infocmp -ospeed progs: tset +ospeed test: demo_termcap progs: tset overlay test: ncurses testcurs xmas overwrite test: ncurses savescreen -pair_content test: background color_set +pair_content test: background color_set pair_content pair_content_sp lib: ncurses pecho_wchar - pechochar - -pnoutrefresh test: edit_field ncurses +pnoutrefresh test: ncurses padview popup_msg prefresh test: testcurs -printw test: background blue bs color_set demo_altkeys demo_defkey demo_keyok demo_menus filter foldkeys ncurses savescreen testcurs testscanw view -putp progs: tput -putp_sp - +printw test: background blue bs color_content color_set demo_altkeys demo_defkey demo_keyok extended_color filter foldkeys ncurses pair_content savescreen testcurs testscanw view +putp test: filter test_sgr progs: tput +putp_sp test: sp_tinfo putwin test: ncurses qiflush - -qiflush_sp - +qiflush_sp test: sp_tinfo raw test: demo_forms ncurses redraw testcurs -raw_sp lib: ncurses -redrawwin test: redraw view -refresh test: blue bs demo_defkey demo_forms demo_keyok demo_menus demo_panels echochar filter firstlast gdc hanoi hashtest lrtest movewindow ncurses savescreen tclock testcurs view xmas +raw_sp test: sp_tinfo +redrawwin test: padview redraw view +refresh test: blue bs color_content demo_defkey demo_forms demo_keyok demo_menus demo_panels dots_curses dots_mvcur dots_xcurses echochar filter firstlast form_driver_w gdc hanoi hashtest lrtest movewindow ncurses pair_content picsmap savescreen tclock testcurs view xmas +reset_color_pairs test: picsmap +reset_color_pairs_sp - reset_prog_mode test: filter ncurses -reset_prog_mode_sp lib: ncurses -reset_shell_mode test: bs filter savescreen -reset_shell_mode_sp lib: ncurses +reset_prog_mode_sp test: sp_tinfo +reset_shell_mode test: bs filter savescreen test_setupterm +reset_shell_mode_sp test: sp_tinfo resetty - -resetty_sp - -resize_term test: view +resetty_sp test: sp_tinfo +resize_term - resize_term_sp - resizeterm - resizeterm_sp lib: ncurses -restartterm - +restartterm test: test_setupterm restartterm_sp - ripoffline test: demo_menus ncurses ripoffline_sp - savetty - -savetty_sp - +savetty_sp test: sp_tinfo scanw test: testcurs testscanw scr_dump test: savescreen scr_init test: savescreen @@ -576,17 +614,17 @@ scr_set test: savescreen scr_set_sp - scrl test: view scroll test: testcurs -scrollok test: clip_printw demo_altkeys demo_defkey demo_keyok demo_panels ditto foldkeys hashtest knight ncurses redraw test_opaque testcurs testscanw view -set_curterm lib: ncurses -set_curterm_sp - +scrollok test: clip_printw color_content demo_altkeys demo_defkey demo_keyok demo_new_pair demo_panels ditto foldkeys hashtest knight ncurses pair_content picsmap redraw test_opaque testcurs testscanw view +set_curterm test: list_keys sp_tinfo +set_curterm_sp test: sp_tinfo set_escdelay test: test_opaque set_escdelay_sp lib: ncurses set_tabsize test: test_opaque -set_tabsize_sp - +set_tabsize_sp test: sp_tinfo set_term lib: ncurses -setcchar test: demo_panels ins_wide ncurses test_add_wchstr test_addwstr view +setcchar test: demo_new_pair demo_panels ins_wide ncurses picsmap savescreen test_add_wchstr test_addwstr setscrreg test: view -setupterm test: demo_termcap demo_terminfo dots test_vid_puts test_vidputs progs: clear tabs tput tset +setupterm test: demo_terminfo dots list_keys sp_tinfo test_setupterm test_sgr test_termattrs test_vid_puts test_vidputs progs: clear tabs tput tset slk_attr - slk_attr_off - slk_attr_on - @@ -597,122 +635,122 @@ slk_attroff lib: ncurses slk_attroff_sp - slk_attron lib: ncurses slk_attron_sp - -slk_attrset test: ncurses +slk_attrset test: extended_color ncurses slk_attrset_sp - slk_clear test: ncurses slk_clear_sp - slk_color test: ncurses slk_color_sp - -slk_init test: ncurses +slk_init test: extended_color ncurses slk_init_sp - slk_label test: ncurses slk_label_sp - -slk_noutrefresh test: ncurses +slk_noutrefresh test: extended_color ncurses slk_noutrefresh_sp - slk_refresh test: ncurses slk_refresh_sp lib: ncurses slk_restore test: ncurses slk_restore_sp lib: ncurses -slk_set test: ncurses +slk_set test: extended_color ncurses slk_set_sp - -slk_touch test: ncurses +slk_touch test: extended_color ncurses slk_touch_sp lib: ncurses slk_wset test: ncurses standend test: blue gdc ncurses standout test: blue ncurses -start_color test: background blue bs cardfile chgat clip_printw color_set demo_forms demo_menus demo_panels echochar filter firework gdc hanoi ins_wide insdelln inserts knight ncurses newdemo rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr testaddch testcurs view worm xmas +start_color test: background blue bs cardfile chgat clip_printw color_content color_set demo_forms demo_menus demo_new_pair demo_panels dots_curses dots_xcurses echochar extended_color filter firework gdc hanoi ins_wide insdelln inserts knight ncurses newdemo padview pair_content picsmap rain savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr testaddch testcurs view worm xmas start_color_sp - -stdscr test: bs chgat clip_printw demo_altkeys demo_forms demo_menus demo_panels ditto filter firework foldkeys gdc hanoi hashtest inch_wide inchs ins_wide insdelln inserts key_names keynames knight lrtest movewindow ncurses rain redraw savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs testscanw view worm xmas +stdscr test: background bs chgat clip_printw color_content demo_altkeys demo_forms demo_menus demo_new_pair demo_panels ditto edit_field extended_color filter firework foldkeys form_driver_w gdc hanoi hashtest inch_wide inchs ins_wide insdelln inserts key_names keynames knight lrtest movewindow ncurses padview pair_content picsmap rain redraw savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs testscanw view worm xmas strcodes test: demo_termcap test_arrays progs: dump_entry -strfnames test: demo_terminfo test_arrays progs: dump_entry -strnames test: demo_terminfo foldkeys test_arrays progs: dump_entry infocmp tic +strfnames test: demo_terminfo list_keys test_arrays progs: dump_entry +strnames test: demo_terminfo foldkeys list_keys test_arrays progs: dump_entry infocmp tic subpad test: testcurs subwin test: movewindow ncurses newdemo testcurs syncok test: test_opaque -term_attrs test: ncurses +term_attrs test: ncurses test_termattrs term_attrs_sp - -termattrs test: ncurses testcurs +termattrs test: ncurses test_termattrs testcurs termattrs_sp lib: ncurses -termname test: testcurs -termname_sp lib: ncurses -tgetent test: demo_termcap railroad -tgetent_sp - +termname test: list_keys ncurses testcurs +termname_sp test: sp_tinfo +tgetent test: demo_termcap dots_termcap railroad +tgetent_sp test: sp_tinfo tgetflag test: demo_termcap -tgetflag_sp - -tgetnum test: demo_termcap railroad -tgetnum_sp - -tgetstr test: demo_termcap railroad -tgetstr_sp - -tgoto test: railroad -tigetflag test: demo_terminfo progs: tic tput -tigetflag_sp - -tigetnum test: demo_terminfo ncurses progs: tput -tigetnum_sp - -tigetstr test: demo_defkey demo_terminfo foldkeys testcurs progs: tput -tigetstr_sp - -timeout test: rain savescreen +tgetflag_sp test: sp_tinfo +tgetnum test: demo_termcap dots_termcap railroad +tgetnum_sp test: sp_tinfo +tgetstr test: demo_termcap dots_termcap railroad +tgetstr_sp test: sp_tinfo +tgoto test: dots_termcap railroad progs: tic +tigetflag test: demo_terminfo savescreen progs: tic tput +tigetflag_sp test: sp_tinfo +tigetnum test: demo_terminfo dots dots_mvcur ncurses savescreen progs: tput +tigetnum_sp test: sp_tinfo +tigetstr test: blue demo_defkey demo_new_pair demo_terminfo foldkeys list_keys savescreen test_sgr testcurs progs: clear_cmd tput +tigetstr_sp test: sp_tinfo +timeout test: filter rain savescreen tiparm - touchline test: chgat clip_printw insdelln -touchwin test: chgat clip_printw demo_menus edit_field filter firstlast inch_wide inchs ins_wide insdelln inserts movewindow ncurses redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque xmas -tparm test: dots dots_mvcur progs: tabs tic tput -tputs test: dots dots_mvcur railroad test_vid_puts test_vidputs progs: clear tabs tset -tputs_sp lib: ncurses -trace test: demo_menus hashtest lrtest ncurses testcurs view worm -ttytype lib: ncurses +touchwin test: chgat clip_printw demo_menus filter firstlast inch_wide inchs ins_wide insdelln inserts movewindow ncurses popup_msg redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque xmas +tparm test: dots dots_mvcur test_sgr progs: reset_cmd tabs tic tput +tputs test: dots dots_mvcur dots_termcap railroad test_vid_puts test_vidputs progs: clear_cmd reset_cmd tabs +tputs_sp test: sp_tinfo +trace test: demo_menus hashtest lrtest ncurses padview redraw test_sgr test_termattrs test_vid_puts test_vidputs testcurs view worm +ttytype test: demo_terminfo test_sgr typeahead test: testcurs -typeahead_sp lib: ncurses +typeahead_sp test: sp_tinfo unctrl test: ncurses redraw test_add_wchstr test_addchstr testcurs -unctrl_sp lib: ncurses +unctrl_sp test: sp_tinfo unget_wch - unget_wch_sp - ungetch test: bs knight ungetch_sp lib: ncurses -ungetmouse - +ungetmouse lib: menu ungetmouse_sp - untouchwin lib: form -use_default_colors test: background filter firework gdc hanoi knight ncurses rain tclock worm xmas +use_default_colors test: background dots_curses dots_xcurses filter firework gdc hanoi knight ncurses picsmap rain tclock worm xmas use_default_colors_sp - -use_env test: ncurses progs: tput -use_env_sp - -use_extended_names test: demo_termcap demo_terminfo progs: infocmp tic +use_env test: dots dots_curses dots_mvcur dots_xcurses ncurses progs: clear tput +use_env_sp test: sp_tinfo +use_extended_names test: demo_termcap demo_terminfo list_keys progs: infocmp tic use_legacy_coding - use_legacy_coding_sp - use_screen test: ditto -use_tioctl test: ncurses -use_tioctl_sp - +use_tioctl test: ncurses progs: clear tput +use_tioctl_sp test: sp_tinfo use_window test: rain worm vid_attr test: test_vid_puts vid_attr_sp - vid_puts test: test_vid_puts -vid_puts_sp - +vid_puts_sp lib: ncurses vidattr test: test_vidputs vidattr_sp - vidputs test: test_vidputs -vidputs_sp lib: ncurses +vidputs_sp - vline test: gdc ncurses vline_set - -vw_printw test: clip_printw +vw_printw test: clip_printw movewindow vw_scanw - -vwprintw test: movewindow -vwscanw lib: ncurses -wadd_wch test: inch_wide test_add_wchstr test_addwstr -wadd_wchnstr test: test_add_wchstr +vwprintw - +vwscanw - +wadd_wch test: inch_wide ncurses test_add_wchstr test_addwstr +wadd_wchnstr test: savescreen test_add_wchstr wadd_wchstr test: test_add_wchstr -waddch test: demo_forms demo_panels ditto firstlast inch_wide inchs knight ncurses test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque worm +waddch test: demo_forms demo_panels ditto firstlast inch_wide inchs knight ncurses padview popup_msg redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque view worm waddchnstr test: test_addchstr waddchstr test: test_addchstr -waddnstr test: test_addstr +waddnstr test: demo_forms test_addstr waddnwstr test: ncurses test_addwstr -waddstr test: chgat clip_printw demo_forms demo_panels edit_field firstlast ins_wide insdelln knight ncurses redraw test_add_wchstr test_addstr test_addwstr testcurs -waddwstr test: ins_wide test_add_wchstr test_addwstr test_get_wstr -wattr_get - +waddstr test: chgat clip_printw demo_forms demo_panels firstlast ins_wide insdelln knight ncurses popup_msg redraw test_add_wchstr test_addstr test_addwstr testcurs +waddwstr test: ins_wide ncurses padview test_add_wchstr test_addwstr test_get_wstr view +wattr_get test: ncurses wattr_off lib: ncurses wattr_on lib: ncurses -wattr_set - +wattr_set test: ncurses wattroff test: demo_forms ncurses testcurs xmas wattron test: testcurs xmas -wattrset test: clip_printw demo_forms insdelln ncurses newdemo test_get_wstr test_getstr testcurs xmas -wbkgd test: cardfile demo_forms demo_menus ncurses newdemo testcurs +wattrset test: clip_printw demo_forms insdelln ncurses newdemo padview test_get_wstr test_getstr testcurs xmas +wbkgd test: cardfile demo_forms demo_menus ncurses newdemo padview testcurs wbkgdset test: demo_panels ins_wide inserts ncurses test_add_wchstr test_addchstr test_addstr test_addwstr wbkgrnd lib: ncurses wbkgrndset lib: ncurses @@ -721,7 +759,7 @@ wborder_set test: ncurses wchgat test: chgat test_get_wstr test_getstr view wclear test: ncurses test_opaque testcurs wclrtobot test: firstlast inch_wide inchs ncurses test_instr test_inwstr testcurs -wclrtoeol test: chgat clip_printw demo_defkey demo_keyok demo_panels firstlast inch_wide inchs ins_wide insdelln inserts knight ncurses test_add_wchstr test_addchstr test_addstr test_addwstr test_instr test_inwstr testcurs +wclrtoeol test: chgat clip_printw demo_defkey demo_keyok demo_menus demo_panels firstlast inch_wide inchs ins_wide insdelln inserts knight ncurses test_add_wchstr test_addchstr test_addstr test_addwstr test_instr test_inwstr testcurs wcolor_set lib: ncurses wcursyncup lib: form wdelch test: ncurses testcurs @@ -729,11 +767,12 @@ wdeleteln test: insdelln testcurs wecho_wchar lib: ncurses wechochar lib: ncurses wenclose test: ncurses -werase test: cardfile demo_forms demo_menus demo_panels edit_field firstlast knight ncurses newdemo test_get_wstr test_getstr test_opaque testcurs xmas +werase test: cardfile demo_forms demo_menus demo_panels firstlast knight ncurses newdemo popup_msg test_get_wstr test_getstr test_opaque testcurs view xmas wget_wch test: ins_wide ncurses test_add_wchstr test_addwstr wget_wstr test: test_get_wstr wgetbkgrnd lib: ncurses -wgetch test: cardfile chgat clip_printw demo_defkey demo_keyok demo_menus demo_panels ditto edit_field gdc insdelln inserts knight movewindow ncurses newdemo rain redraw test_addchstr test_addstr test_opaque testcurs worm +wgetch test: cardfile chgat clip_printw demo_defkey demo_keyok demo_menus demo_panels ditto dump_window edit_field gdc insdelln inserts knight movewindow ncurses newdemo popup_msg rain redraw test_addchstr test_addstr test_opaque testcurs worm +wgetdelay - wgetn_wstr test: ncurses test_get_wstr wgetnstr test: ncurses test_getstr wgetparent test: test_opaque @@ -741,8 +780,8 @@ wgetscrreg test: test_opaque wgetstr test: test_getstr whline test: testcurs whline_set lib: ncurses -win_wch test: inch_wide -win_wchnstr test: inch_wide +win_wch test: inch_wide savescreen +win_wchnstr test: inch_wide view win_wchstr test: inch_wide winch test: inchs knight testcurs winchnstr test: inchs @@ -760,12 +799,12 @@ winsstr test: inserts winstr test: test_instr winwstr test: test_inwstr wmouse_trafo test: ncurses -wmove test: chgat clip_printw demo_altkeys demo_defkey demo_keyok demo_menus demo_panels firstlast foldkeys inch_wide inchs ins_wide insdelln inserts knight movewindow ncurses newdemo redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs worm -wnoutrefresh test: demo_menus ditto edit_field inch_wide inchs ins_wide inserts knight movewindow ncurses redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque -wprintw test: chgat clip_printw demo_defkey demo_forms demo_keyok demo_menus demo_panels edit_field inch_wide inchs ins_wide insdelln inserts knight movewindow ncurses test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs +wmove test: chgat clip_printw demo_altkeys demo_defkey demo_keyok demo_menus demo_panels dump_window extended_color firstlast foldkeys inch_wide inchs ins_wide insdelln inserts knight movewindow ncurses newdemo padview picsmap redraw savescreen test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs view worm +wnoutrefresh test: demo_menus ditto inch_wide inchs ins_wide inserts knight movewindow ncurses padview popup_msg redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque +wprintw test: chgat clip_printw demo_defkey demo_forms demo_keyok demo_menus demo_panels inch_wide inchs ins_wide insdelln inserts knight ncurses test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque testcurs wredrawln test: redraw -wrefresh test: chgat clip_printw demo_forms demo_keyok demo_menus demo_panels edit_field firstlast ins_wide insdelln inserts knight lrtest movewindow ncurses newdemo redraw savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr testcurs view worm xmas -wresize test: cardfile ncurses +wrefresh test: chgat clip_printw demo_forms demo_keyok demo_menus demo_panels firstlast ins_wide insdelln inserts knight lrtest movewindow ncurses newdemo popup_msg redraw savescreen tclock test_add_wchstr test_addchstr test_addstr test_addwstr testcurs worm xmas +wresize test: cardfile demo_menus ncurses wscanw test: testcurs wscrl test: ncurses testcurs wsetscrreg test: ncurses testcurs @@ -800,3 +839,5 @@ show_panel test: demo_panels ncurses top_panel test: cardfile demo_panels ncurses update_panels test: cardfile demo_panels ncurses update_panels_sp - + +-- vile:txtmode diff --git a/test/aclocal.m4 b/test/aclocal.m4 index 86d3ee45d712..423744872bee 100644 --- a/test/aclocal.m4 +++ b/test/aclocal.m4 @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright (c) 2003-2013,2014 Free Software Foundation, Inc. * +dnl Copyright (c) 2003-2019,2020 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * dnl copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ dnl sale, use or other dealings in this Software without prior written * dnl authorization. * dnl*************************************************************************** dnl -dnl $Id: aclocal.m4,v 1.94 2014/02/10 00:43:27 tom Exp $ +dnl $Id: aclocal.m4,v 1.172 2020/01/18 17:30:44 tom Exp $ dnl dnl Author: Thomas E. Dickey dnl @@ -36,11 +36,36 @@ dnl These macros are maintained separately from NCURSES. The copyright on dnl this file applies to the aggregation of macros and does not affect use of dnl these macros in other applications. dnl -dnl See http://invisible-island.net/autoconf/ for additional information. +dnl See these pages for additional information: +dnl https://invisible-island.net/autoconf/ +dnl https://invisible-island.net/autoconf/my-autoconf.html dnl dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- -dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56 +dnl AM_LANGINFO_CODESET version: 4 updated: 2015/04/18 08:56:57 +dnl ------------------- +dnl Inserted as requested by gettext 0.10.40 +dnl File from /usr/share/aclocal +dnl codeset.m4 +dnl ==================== +dnl serial AM1 +dnl +dnl From Bruno Haible. +AC_DEFUN([AM_LANGINFO_CODESET], +[ +AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, + [AC_TRY_LINK([#include ], + [char* cs = nl_langinfo(CODESET);], + am_cv_langinfo_codeset=yes, + am_cv_langinfo_codeset=no) + ]) + if test $am_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have and nl_langinfo(CODESET).]) + fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 dnl ------------------ dnl Conditionally generate script according to whether we're using a given autoconf. dnl @@ -49,7 +74,7 @@ dnl $2 = code to use if AC_ACVERSION is at least as high as $1. dnl $3 = code to use if AC_ACVERSION is older than $1. define([CF_ACVERSION_CHECK], [ -ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl +ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl ifdef([m4_version_compare], [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], [CF_ACVERSION_COMPARE( @@ -66,7 +91,7 @@ define([CF_ACVERSION_COMPARE], [ifelse([$8], , ,[$8])], [ifelse([$9], , ,[$9])])])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42 +dnl CF_ADD_CFLAGS version: 13 updated: 2017/02/25 18:57:40 dnl ------------- dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS dnl The second parameter if given makes this macro verbose. @@ -84,51 +109,51 @@ cf_new_extra_cppflags= for cf_add_cflags in $1 do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags) ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags) ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -137,24 +162,24 @@ done if test -n "$cf_new_cflags" ; then ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) - CFLAGS="$CFLAGS $cf_new_cflags" + CF_APPEND_TEXT(CFLAGS,$cf_new_cflags) fi if test -n "$cf_new_cppflags" ; then ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" + CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags) fi if test -n "$cf_new_extra_cppflags" ; then ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" + CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags) fi AC_SUBST(EXTRA_CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57 +dnl CF_ADD_INCDIR version: 15 updated: 2018/06/20 20:23:13 dnl ------------- dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's dnl redundant. We don't normally need to add -I/usr/local/include for gcc, @@ -185,7 +210,7 @@ if test -n "$1" ; then if test "$GCC" = yes then cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + CF_APPEND_TEXT(CPPFLAGS,-I$cf_add_incdir) AC_TRY_COMPILE([#include ], [printf("Hello")], [], @@ -205,6 +230,8 @@ if test -n "$1" ; then else break fi + else + break fi done done @@ -219,7 +246,7 @@ dnl $1 = library to add, without the "-l" dnl $2 = variable to update (default $LIBS) AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_LIBDIR version: 9 updated: 2010/05/26 16:44:57 +dnl CF_ADD_LIBDIR version: 10 updated: 2015/04/18 08:56:57 dnl ------------- dnl Adds to the library-path dnl @@ -231,37 +258,55 @@ dnl AC_DEFUN([CF_ADD_LIBDIR], [ if test -n "$1" ; then - for cf_add_libdir in $1 - do - if test $cf_add_libdir = /usr/lib ; then - : - elif test -d $cf_add_libdir - then - cf_have_libdir=no - if test -n "$LDFLAGS$LIBS" ; then - # a loop is needed to ensure we can add subdirs of existing dirs - for cf_test_libdir in $LDFLAGS $LIBS ; do - if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then - cf_have_libdir=yes; break - fi - done - fi - if test "$cf_have_libdir" = no ; then - CF_VERBOSE(adding $cf_add_libdir to library-path) - ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])" - fi - fi - done + for cf_add_libdir in $1 + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + CF_VERBOSE(adding $cf_add_libdir to library-path) + ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])" + fi + fi + done fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05 +dnl CF_ADD_LIBS version: 3 updated: 2019/11/02 16:47:33 dnl ----------- -dnl Add one or more libraries, used to enforce consistency. +dnl Add one or more libraries, used to enforce consistency. Libraries are +dnl prepended to an existing list, since their dependencies are assumed to +dnl already exist in the list. dnl dnl $1 = libraries to add, with the "-l", etc. dnl $2 = variable to update (default $LIBS) -AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl +AC_DEFUN([CF_ADD_LIBS],[ +cf_add_libs="[$]ifelse($2,,LIBS,[$2])" +# reverse order +cf_add_0lib= +for cf_add_1lib in $1; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +ifelse($2,,LIBS,[$2])="$cf_add_libs" +])dnl dnl --------------------------------------------------------------------------- dnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22 dnl ---------------- @@ -298,6 +343,16 @@ ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&] } ])dnl dnl --------------------------------------------------------------------------- +dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55 +dnl -------------- +dnl use this macro for appending text without introducing an extra blank at +dnl the beginning +define([CF_APPEND_TEXT], +[ + test -n "[$]$1" && $1="[$]$1 " + $1="[$]{$1}$2" +])dnl +dnl --------------------------------------------------------------------------- dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 dnl -------------- dnl Allow user to disable a normally-on option. @@ -310,7 +365,7 @@ dnl Allow user to enable a normally-off option. AC_DEFUN([CF_ARG_ENABLE], [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl dnl --------------------------------------------------------------------------- -dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42 +dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 dnl ------------- dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus dnl values. @@ -323,37 +378,75 @@ dnl $4 = action if perform if option is default dnl $5 = default option value (either 'yes' or 'no') AC_DEFUN([CF_ARG_OPTION], [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) - if test "$enableval" != "$5" ; then + if test "$enableval" != "$5" ; then ifelse([$3],,[ :]dnl ,[ $3]) ifelse([$4],,,[ - else - $4]) - fi],[enableval=$5 ifelse([$4],,,[ - $4 + else + $4]) + fi],[enableval=$5 ifelse([$4],,,[ + $4 ])dnl - ])])dnl +])])dnl dnl --------------------------------------------------------------------------- -dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49 +dnl CF_CC_ENV_FLAGS version: 9 updated: 2018/07/29 18:03:26 dnl --------------- dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content -dnl into CC. This will not help with broken scripts that wrap the compiler with -dnl options, but eliminates a more common category of user confusion. +dnl into CC. This will not help with broken scripts that wrap the compiler +dnl with options, but eliminates a more common category of user confusion. +dnl +dnl In particular, it addresses the problem of being able to run the C +dnl preprocessor in a consistent manner. +dnl +dnl Caveat: this also disallows blanks in the pathname for the compiler, but +dnl the nuisance of having inconsistent settings for compiler and preprocessor +dnl outweighs that limitation. AC_DEFUN([CF_CC_ENV_FLAGS], [ # This should have been defined by AC_PROG_CC : ${CC:=cc} +AC_MSG_CHECKING(\$CFLAGS variable) +case "x$CFLAGS" in +(*-[[IUD]]*) + AC_MSG_RESULT(broken) + AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options) + cf_flags="$CFLAGS" + CFLAGS= + for cf_arg in $cf_flags + do + CF_ADD_CFLAGS($cf_arg) + done + ;; +(*) + AC_MSG_RESULT(ok) + ;; +esac + AC_MSG_CHECKING(\$CC variable) -case "$CC" in #(vi -*[[\ \ ]]-[[IUD]]*) +case "$CC" in +(*[[\ \ ]]-*) AC_MSG_RESULT(broken) - AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) + AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options) # humor him... - cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'` - CC=`echo "$CC" | sed -e 's/[[ ]].*//'` - CF_ADD_CFLAGS($cf_flags) + cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'` + cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'` + CC="$cf_prog" + for cf_arg in $cf_flags + do + case "x$cf_arg" in + (x-[[IUDfgOW]]*) + CF_ADD_CFLAGS($cf_arg) + ;; + (*) + CC="$CC $cf_arg" + ;; + esac + done + CF_VERBOSE(resulting CC: '$CC') + CF_VERBOSE(resulting CFLAGS: '$CFLAGS') + CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') ;; -*) +(*) AC_MSG_RESULT(ok) ;; esac @@ -394,7 +487,7 @@ if test ".$system_name" != ".$cf_cv_system_name" ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58 +dnl CF_CHECK_CFLAGS version: 3 updated: 2014/07/22 05:32:57 dnl --------------- dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from dnl a build-configuration such as imake. These have the pitfall that they @@ -406,16 +499,73 @@ CF_VERBOSE(checking additions to CFLAGS) cf_check_cflags="$CFLAGS" cf_check_cppflags="$CPPFLAGS" CF_ADD_CFLAGS($1,yes) -if test "$cf_check_cflags" != "$CFLAGS" ; then +if test "x$cf_check_cflags" != "x$CFLAGS" ; then AC_TRY_LINK([#include ],[printf("Hello world");],, [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS) - if test "$cf_check_cppflags" != "$CPPFLAGS" ; then + if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then CF_VERBOSE(but keeping change to \$CPPFLAGS) fi CFLAGS="$cf_check_flags"]) fi ])dnl dnl --------------------------------------------------------------------------- +dnl CF_CHECK_CURSES_LIB version: 2 updated: 2018/01/03 04:47:33 +dnl ------------------- +dnl $1 = nominal library name, used also for header lookup +dnl $2 = suffix to append to library name +dnl $3 = function to check for using AC_CHECK_LIB +dnl $4 = optional parameter list for $3 +AC_DEFUN([CF_CHECK_CURSES_LIB], +[ +AC_REQUIRE([CF_PKG_CONFIG]) + +cf_have_curses_lib=no + +: ${NCURSES_CONFIG_PKG:=none} +if test "x${NCURSES_CONFIG_PKG}" = xnone; then + : +elif test "x${PKG_CONFIG:=none}" != xnone; then + AC_MSG_CHECKING(pkg-config for $1$2) + if "$PKG_CONFIG" --exists $1$2 ; then + AC_MSG_RESULT(yes) + + AC_MSG_CHECKING(if the $1$2 package files work) + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" + + CF_ADD_CFLAGS(`$PKG_CONFIG --cflags $1$2`) + CF_ADD_LIBS(`$PKG_CONFIG --libs $1$2`) + + AC_TRY_LINK([#include <$1.h>], + [(void) $3 ( ]ifelse([$4],,,[[$4]])[ );], + [AC_TRY_RUN([#include <$1.h> + int main(void) + { (void) $3 ( ]ifelse([$4],,,[[$4]])[ ); return 0; }], + [cf_have_curses_lib=yes], + [cf_have_curses_lib=no], + [cf_have_curses_lib=maybe])], + [cf_have_curses_lib=no]) + AC_MSG_RESULT($cf_have_curses_lib) + test "$cf_have_curses_lib" = maybe && cf_have_curses_lib=yes + if test "$cf_have_curses_lib" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + else + CF_UPPER(cf_upper,have_lib$1) + AC_DEFINE_UNQUOTED($cf_upper,1) + fi + fi +fi +if test "$cf_have_curses_lib" = no; then + AC_CHECK_LIB($1$2,$3,[ + CF_UPPER(cf_upper,have_lib$1) + CF_ADD_LIBS(-l$1$2) + AC_DEFINE_UNQUOTED($cf_upper,1)]) +fi +])dnl +dnl --------------------------------------------------------------------------- dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 dnl ----------------- dnl Check if the given compiler is really clang. clang's C driver defines @@ -449,6 +599,66 @@ cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" fi ]) dnl --------------------------------------------------------------------------- +dnl CF_CONST_X_STRING version: 3 updated: 2020/01/11 18:39:22 +dnl ----------------- +dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most +dnl character-strings. +dnl +dnl It is ambiguous because the specification accommodated the pre-ANSI +dnl compilers bundled by more than one vendor in lieu of providing a standard C +dnl compiler other than by costly add-ons. Because of this, the specification +dnl did not take into account the use of const for telling the compiler that +dnl string literals would be in readonly memory. +dnl +dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to +dnl let the compiler decide how to represent Xt's strings which were #define'd. +dnl That does not solve the problem of using the block of Xt's strings which +dnl are compiled into the library (and is less efficient than one might want). +dnl +dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both +dnl when compiling the library and compiling using the library, to tell the +dnl compiler that String is const. +AC_DEFUN([CF_CONST_X_STRING], +[ +AC_REQUIRE([AC_PATH_XTRA]) + +CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING]) + +AC_TRY_COMPILE( +[ +#include +#include +], +[String foo = malloc(1)],[ + +AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ + AC_TRY_COMPILE( + [ +#define _CONST_X_STRING /* X11R7.8 (perhaps) */ +#undef XTSTRINGDEFINES /* X11R5 and later */ +#include +#include + ],[String foo = malloc(1); *foo = 0],[ + cf_cv_const_x_string=no + ],[ + cf_cv_const_x_string=yes + ]) +]) + +CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING]) + +case $cf_cv_const_x_string in +(no) + CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES) + ;; +(*) + CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING) + ;; +esac + +]) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_CURSES_ACS_MAP version: 7 updated: 2012/10/06 16:39:58 dnl ----------------- dnl Check for likely values of acs_map[]: @@ -470,48 +680,60 @@ done test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map,[Define as needed to override ncurses prefix _nc_]) ]) dnl --------------------------------------------------------------------------- -dnl CF_CURSES_CHECK_DATA version: 4 updated: 2011/01/15 16:39:24 +dnl CF_CURSES_CHECK_DATA version: 7 updated: 2018/01/03 04:47:33 dnl -------------------- dnl Check if curses.h defines the given data/variable. dnl Use this after CF_NCURSES_CONFIG or CF_CURSES_CONFIG. +dnl +dnl $1 = data item(s) to check for +dnl $2 = action on success, e.g., "break" to quit checking a series of choices AC_DEFUN([CF_CURSES_CHECK_DATA], [ -AC_MSG_CHECKING(for data $1 declaration in ${cf_cv_ncurses_header:-curses.h}) +for cf_data in $1 +do +AC_MSG_CHECKING(for data $cf_data declaration in ${cf_cv_ncurses_header:-curses.h}) AC_TRY_COMPILE(CF__CURSES_HEAD,[ -void *foo = &($1) -],cf_result=yes,cf_result=no) +void *foo = &($cf_data) +],[cf_result=yes +],[cf_result=no]) AC_MSG_RESULT($cf_result) if test $cf_result = yes ; then - CF_UPPER(cf_result,have_curses_data_$1) + CF_UPPER(cf_result,have_curses_data_$cf_data) AC_DEFINE_UNQUOTED($cf_result) + ifelse($2,,,[$2]) else - AC_MSG_CHECKING(for data $1 in library) + AC_MSG_CHECKING(for data $cf_data in library) # BSD linkers insist on making weak linkage, but resolve at runtime. AC_TRY_RUN(CF__CURSES_HEAD [ -extern char $1; +extern char $cf_data; int main(void) { - void *foo = &($1); + void *foo = &($cf_data); + fprintf(stderr, "testing linkage of $cf_data:%p\n", (void *)foo); ${cf_cv_main_return:-return}(foo == 0); -}],[cf_result=yes],[cf_result=no],[ +}],[cf_result=yes +],[cf_result=no],[ # cross-compiling AC_TRY_LINK(CF__CURSES_HEAD -[extern char $1;],[ +[extern char $cf_data;],[ do { - void *foo = &($1); + void *foo = &($cf_data); + fprintf(stderr, "testing linkage of $cf_data:%p\n", (void *)foo); ${cf_cv_main_return:-return}(foo == 0); } while (0) ],[cf_result=yes],[cf_result=no]) ]) AC_MSG_RESULT($cf_result) if test $cf_result = yes ; then - CF_UPPER(cf_result,decl_curses_data_$1) + CF_UPPER(cf_result,decl_curses_data_$cf_data) AC_DEFINE_UNQUOTED($cf_result) + # do not exit loop here, since we prefer system's declarations fi fi +done ])dnl dnl --------------------------------------------------------------------------- dnl CF_CURSES_CHECK_TYPE version: 4 updated: 2012/10/06 16:39:58 @@ -548,22 +770,22 @@ CF_NCURSES_VERSION CF_CURSES_LIBS ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_CPPFLAGS version: 11 updated: 2011/04/09 14:51:08 +dnl CF_CURSES_CPPFLAGS version: 13 updated: 2018/06/20 20:23:13 dnl ------------------ dnl Look for the curses headers. AC_DEFUN([CF_CURSES_CPPFLAGS],[ AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[ cf_cv_curses_incdir=no -case $host_os in #(vi -hpux10.*) #(vi +case $host_os in +(hpux10.*) if test "x$cf_cv_screen" = "xcurses_colr" then test -d /usr/include/curses_colr && \ cf_cv_curses_incdir="-I/usr/include/curses_colr" fi ;; -sunos3*|sunos4*) +(sunos3*|sunos4*) if test "x$cf_cv_screen" = "xcurses_5lib" then test -d /usr/5lib && \ @@ -573,13 +795,16 @@ sunos3*|sunos4*) ;; esac ]) -test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir" +if test "$cf_cv_curses_incdir" != no +then + CF_APPEND_TEXT(CPPFLAGS,$cf_cv_curses_incdir) +fi CF_CURSES_HEADER CF_TERM_HEADER ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_FUNCS version: 17 updated: 2011/05/14 16:07:29 +dnl CF_CURSES_FUNCS version: 19 updated: 2018/01/03 04:47:33 dnl --------------- dnl Curses-functions are a little complicated, since a lot of them are macros. AC_DEFUN([CF_CURSES_FUNCS], @@ -600,8 +825,9 @@ do [ #ifndef ${cf_func} long foo = (long)(&${cf_func}); -if (foo + 1234 > 5678) - ${cf_cv_main_return:-return}(foo); +fprintf(stderr, "testing linkage of $cf_func:%p\n", (void *)foo); +if (foo + 1234L > 5678L) + ${cf_cv_main_return:-return}(foo != 0); #endif ], [cf_result=yes], @@ -618,7 +844,7 @@ if (foo + 1234 > 5678) done ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45 +dnl CF_CURSES_HEADER version: 5 updated: 2015/04/23 20:35:30 dnl ---------------- dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common dnl variations of ncurses' installs. @@ -627,11 +853,9 @@ dnl $1 = ncurses when looking for ncurses, or is empty AC_DEFUN([CF_CURSES_HEADER],[ AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[ cf_cv_ncurses_header=none -for cf_header in ifelse($1,,,[ \ - $1/ncurses.h \ - $1/curses.h]) \ - ncurses.h \ - curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) +for cf_header in \ + ncurses.h ifelse($1,,,[$1/ncurses.h]) \ + curses.h ifelse($1,,,[$1/curses.h]) ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) do AC_TRY_COMPILE([#include <${cf_header}>], [initscr(); tgoto("?", 0,0)], @@ -647,7 +871,7 @@ fi AC_CHECK_HEADERS($cf_cv_ncurses_header) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_LIBS version: 37 updated: 2013/02/09 17:33:50 +dnl CF_CURSES_LIBS version: 42 updated: 2018/06/20 20:23:13 dnl -------------- dnl Look for the curses libraries. Older curses implementations may require dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. @@ -656,17 +880,17 @@ AC_DEFUN([CF_CURSES_LIBS],[ AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl AC_MSG_CHECKING(if we have identified curses libraries) AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], - [initscr(); tgoto("?", 0,0)], - cf_result=yes, - cf_result=no) + [initscr(); tgoto("?", 0,0)], + cf_result=yes, + cf_result=no) AC_MSG_RESULT($cf_result) if test "$cf_result" = no ; then -case $host_os in #(vi -freebsd*) #(vi - AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)]) - ;; -hpux10.*) #(vi +case $host_os in +(freebsd*) + AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)]) + ;; +(hpux10.*) # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr # next (1998), and xcurses "newer" (2000). There is no header file for # Hcurses; the subdirectory curses_colr has the headers (curses.h and @@ -680,14 +904,14 @@ hpux10.*) #(vi AC_CHECK_LIB(Hcurses,initscr,[ # HP's header uses __HP_CURSES, but user claims _HP_CURSES. CF_ADD_LIBS(-lHcurses) - CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" + CF_APPEND_TEXT(CPPFLAGS,-D__HP_CURSES -D_HP_CURSES) ac_cv_func_initscr=yes ])]) fi ;; -linux*) +(linux*) case `arch 2>/dev/null` in - x86_64) + (x86_64) if test -d /lib64 then CF_ADD_LIBDIR(/lib64) @@ -695,21 +919,21 @@ linux*) CF_ADD_LIBDIR(/lib) fi ;; - *) + (*) CF_ADD_LIBDIR(/lib) ;; esac ;; -sunos3*|sunos4*) +(sunos3*|sunos4*) if test "x$cf_cv_screen" = "xcurses_5lib" then if test -d /usr/5lib ; then CF_ADD_LIBDIR(/usr/5lib) CF_ADD_LIBS(-lcurses -ltermcap) fi - fi - ac_cv_func_initscr=yes - ;; + fi + ac_cv_func_initscr=yes + ;; esac if test ".$ac_cv_func_initscr" != .yes ; then @@ -729,7 +953,10 @@ if test ".$ac_cv_func_initscr" != .yes ; then AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown do - AC_CHECK_LIB($cf_term_lib,tgoto,[break]) + AC_CHECK_LIB($cf_term_lib,tgoto,[ + : ${cf_nculib_root:=$cf_term_lib} + break + ]) done ]) fi @@ -740,42 +967,41 @@ if test ".$ac_cv_func_initscr" != .yes ; then then for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown do - AC_CHECK_LIB($cf_curs_lib,initscr,[break]) + LIBS="-l$cf_curs_lib $cf_save_LIBS" + if test "$cf_term_lib" = unknown || test "$cf_term_lib" = "$cf_curs_lib" ; then + AC_MSG_CHECKING(if we can link with $cf_curs_lib library) + AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], + [initscr()], + [cf_result=yes], + [cf_result=no]) + AC_MSG_RESULT($cf_result) + test $cf_result = yes && break + elif test "$cf_curs_lib" = "$cf_term_lib" ; then + cf_result=no + elif test "$cf_term_lib" != predefined ; then + AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) + AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], + [initscr(); tgoto((char *)0, 0, 0);], + [cf_result=no], + [ + LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" + AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], + [initscr()], + [cf_result=yes], + [cf_result=error]) + ]) + AC_MSG_RESULT($cf_result) + test $cf_result != error && break + fi done fi test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found) - - LIBS="-l$cf_curs_lib $cf_save_LIBS" - if test "$cf_term_lib" = unknown ; then - AC_MSG_CHECKING(if we can link with $cf_curs_lib library) - AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], - [initscr()], - [cf_result=yes], - [cf_result=no]) - AC_MSG_RESULT($cf_result) - test $cf_result = no && AC_MSG_ERROR(Cannot link curses library) - elif test "$cf_curs_lib" = "$cf_term_lib" ; then - : - elif test "$cf_term_lib" != predefined ; then - AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) - AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], - [initscr(); tgoto((char *)0, 0, 0);], - [cf_result=no], - [ - LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" - AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], - [initscr()], - [cf_result=yes], - [cf_result=error]) - ]) - AC_MSG_RESULT($cf_result) - fi fi fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_TERM_H version: 10 updated: 2012/10/06 08:57:51 +dnl CF_CURSES_TERM_H version: 11 updated: 2015/04/15 19:08:48 dnl ---------------- dnl SVr4 curses should have term.h as well (where it puts the definitions of dnl the low-level interface). This may not be true in old/broken implementations, @@ -792,8 +1018,8 @@ AC_CACHE_CHECK(for term.h, cf_cv_term_header,[ cf_header_list="term.h ncurses/term.h ncursesw/term.h" -case ${cf_cv_ncurses_header:-curses.h} in #(vi -*/*) +case ${cf_cv_ncurses_header:-curses.h} in +(*/*) cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h cf_header_list="$cf_header_item $cf_header_list" ;; @@ -810,8 +1036,8 @@ do [cf_cv_term_header=no]) done -case $cf_cv_term_header in #(vi -no) +case $cf_cv_term_header in +(no) # If curses is ncurses, some packagers still mess it up by trying to make # us use GNU termcap. This handles the most common case. for cf_header in ncurses/term.h ncursesw/term.h @@ -832,20 +1058,20 @@ make an error esac ]) -case $cf_cv_term_header in #(vi -term.h) #(vi +case $cf_cv_term_header in +(term.h) AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h]) ;; -ncurses/term.h) #(vi +(ncurses/term.h) AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h]) ;; -ncursesw/term.h) +(ncursesw/term.h) AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h]) ;; esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_UNCTRL_H version: 3 updated: 2013/11/03 06:26:10 +dnl CF_CURSES_UNCTRL_H version: 4 updated: 2015/04/15 19:08:48 dnl ------------------ dnl Any X/Open curses implementation must have unctrl.h, but ncurses packages dnl may put it in a subdirectory (along with ncurses' other headers, of @@ -862,8 +1088,8 @@ AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[ cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h" -case ${cf_cv_ncurses_header:-curses.h} in #(vi -*/*) +case ${cf_cv_ncurses_header:-curses.h} in +(*/*) cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h cf_header_list="$cf_header_item $cf_header_list" ;; @@ -881,20 +1107,20 @@ do done ]) -case $cf_cv_unctrl_header in #(vi -no) +case $cf_cv_unctrl_header in +(no) AC_MSG_WARN(unctrl.h header not found) ;; esac -case $cf_cv_unctrl_header in #(vi -unctrl.h) #(vi +case $cf_cv_unctrl_header in +(unctrl.h) AC_DEFINE(HAVE_UNCTRL_H,1,[Define to 1 if we have unctrl.h]) ;; -ncurses/unctrl.h) #(vi +(ncurses/unctrl.h) AC_DEFINE(HAVE_NCURSES_UNCTRL_H,1,[Define to 1 if we have ncurses/unctrl.h]) ;; -ncursesw/unctrl.h) +(ncursesw/unctrl.h) AC_DEFINE(HAVE_NCURSESW_UNCTRL_H,1,[Define to 1 if we have ncursesw/unctrl.h]) ;; esac @@ -962,7 +1188,7 @@ dnl ---------- dnl "dirname" is not portable, so we fake it with a shell script. AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl dnl --------------------------------------------------------------------------- -dnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28 +dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57 dnl --------------- dnl You can always use "make -n" to see the actual options, but it's hard to dnl pick out/analyze warning messages when the compile-line is long. @@ -979,17 +1205,17 @@ AC_MSG_CHECKING(if you want to see long compiling messages) CF_ARG_DISABLE(echo, [ --disable-echo do not display "compiling" commands], [ - ECHO_LT='--silent' - ECHO_LD='@echo linking [$]@;' - RULE_CC='@echo compiling [$]<' - SHOW_CC='@echo compiling [$]@' - ECHO_CC='@' + ECHO_LT='--silent' + ECHO_LD='@echo linking [$]@;' + RULE_CC='@echo compiling [$]<' + SHOW_CC='@echo compiling [$]@' + ECHO_CC='@' ],[ - ECHO_LT='' - ECHO_LD='' - RULE_CC='' - SHOW_CC='' - ECHO_CC='' + ECHO_LT='' + ECHO_LD='' + RULE_CC='' + SHOW_CC='' + ECHO_CC='' ]) AC_MSG_RESULT($enableval) AC_SUBST(ECHO_LT) @@ -1041,7 +1267,47 @@ if test "$cf_disable_rpath_hack" = no ; then fi ]) dnl --------------------------------------------------------------------------- -dnl CF_ENABLE_WARNINGS version: 4 updated: 2009/07/26 17:53:03 +dnl CF_ENABLE_STRING_HACKS version: 5 updated: 2016/10/08 17:34:11 +dnl ---------------------- +dnl On a few platforms, the compiler and/or loader nags with untruthful +dnl comments stating that "most" uses of strcat/strcpy/sprintf are incorrect, +dnl and implying that most uses of the recommended alternatives are correct. +dnl +dnl Factually speaking, no one has actually counted the number of uses of these +dnl functions versus the total of incorrect uses. Samples of a few thousand +dnl instances are meaningless compared to the hundreds of millions of lines of +dnl existing C code. +dnl +dnl strlcat/strlcpy are (as of 2012) non-standard, and are available on some +dnl platforms, in implementations of varying quality. Likewise, snprintf is +dnl standard - but evolved through phases, and older implementations are likely +dnl to yield surprising results, as documented in manpages on various systems. +AC_DEFUN([CF_ENABLE_STRING_HACKS], +[ +AC_MSG_CHECKING(if you want to work around bogus compiler/loader warnings) +AC_ARG_ENABLE(string-hacks, + [ --enable-string-hacks work around bogus compiler/loader warnings], + [with_string_hacks=$enableval], + [with_string_hacks=no]) +AC_MSG_RESULT($with_string_hacks) + +if test "x$with_string_hacks" = "xyes"; then + AC_DEFINE(USE_STRING_HACKS,1,[Define to 1 to work around bogus compiler/loader warnings]) + AC_MSG_WARN(enabling string-hacks to work around bogus compiler/loader warnings) + AC_CHECK_FUNC(strlcat,[ + AC_DEFINE(HAVE_STRLCAT,1,[Define to 1 if we have strlcat function]) + ],[ + AC_CHECK_LIB(bsd,strlcat,[ + CF_ADD_LIB(bsd) + AC_CHECK_HEADERS(bsd/string.h) + AC_DEFINE(HAVE_STRLCAT,1,[Define to 1 if we have strlcat function]) + ]) + ]) + AC_CHECK_FUNCS( strlcpy snprintf ) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ENABLE_WARNINGS version: 5 updated: 2017/09/29 20:01:16 dnl ------------------ dnl Configure-option to enable gcc warnings AC_DEFUN([CF_ENABLE_WARNINGS],[ @@ -1056,7 +1322,7 @@ AC_MSG_RESULT($with_warnings) if test "$with_warnings" = "yes" then CF_GCC_ATTRIBUTES - CF_GCC_WARNINGS + CF_GCC_WARNINGS($1) fi fi ])dnl @@ -1111,7 +1377,7 @@ fi ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02 +dnl CF_FIND_LINKAGE version: 21 updated: 2018/06/20 20:23:13 dnl --------------- dnl Find a library (specifically the linkage used in the code fragment), dnl searching for it if it is not already in the library path. @@ -1159,73 +1425,74 @@ AC_TRY_LINK([$1],[$2],[ cf_cv_find_linkage_$3=no LIBS="$cf_save_LIBS" - CF_VERBOSE(find linkage for $3 library) - CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)]) - - cf_save_CPPFLAGS="$CPPFLAGS" - cf_test_CPPFLAGS="$CPPFLAGS" - - CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6])) - for cf_cv_header_path_$3 in $cf_search - do - if test -d $cf_cv_header_path_$3 ; then - CF_VERBOSE(... testing $cf_cv_header_path_$3) - CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3" - AC_TRY_COMPILE([$1],[$2],[ - CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3) - cf_cv_find_linkage_$3=maybe - cf_test_CPPFLAGS="$CPPFLAGS" - break],[ - CPPFLAGS="$cf_save_CPPFLAGS" - ]) - fi - done - - if test "$cf_cv_find_linkage_$3" = maybe ; then - - CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)]) - - cf_save_LIBS="$LIBS" - cf_save_LDFLAGS="$LDFLAGS" - - ifelse([$6],,,[ - CPPFLAGS="$cf_test_CPPFLAGS" - LIBS="-l$3 $7 $cf_save_LIBS" - AC_TRY_LINK([$1],[$2],[ - CF_VERBOSE(... found $3 library in system) - cf_cv_find_linkage_$3=yes]) - CPPFLAGS="$cf_save_CPPFLAGS" - LIBS="$cf_save_LIBS" - ]) - - if test "$cf_cv_find_linkage_$3" != yes ; then - CF_LIBRARY_PATH(cf_search,$3) - for cf_cv_library_path_$3 in $cf_search - do - if test -d $cf_cv_library_path_$3 ; then - CF_VERBOSE(... testing $cf_cv_library_path_$3) - CPPFLAGS="$cf_test_CPPFLAGS" - LIBS="-l$3 $7 $cf_save_LIBS" - LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3" - AC_TRY_LINK([$1],[$2],[ - CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3) - cf_cv_find_linkage_$3=yes - cf_cv_library_file_$3="-l$3" - break],[ - CPPFLAGS="$cf_save_CPPFLAGS" - LIBS="$cf_save_LIBS" - LDFLAGS="$cf_save_LDFLAGS" - ]) - fi - done - CPPFLAGS="$cf_save_CPPFLAGS" - LDFLAGS="$cf_save_LDFLAGS" - fi - - else - cf_cv_find_linkage_$3=no - fi - ],$7) + CF_VERBOSE(find linkage for $3 library) + CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)]) + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_test_CPPFLAGS="$CPPFLAGS" + + CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6])) + for cf_cv_header_path_$3 in $cf_search + do + if test -d $cf_cv_header_path_$3 ; then + CF_VERBOSE(... testing $cf_cv_header_path_$3) + CPPFLAGS="$cf_save_CPPFLAGS" + CF_APPEND_TEXT(CPPFLAGS,-I$cf_cv_header_path_$3) + AC_TRY_COMPILE([$1],[$2],[ + CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3) + cf_cv_find_linkage_$3=maybe + cf_test_CPPFLAGS="$CPPFLAGS" + break],[ + CPPFLAGS="$cf_save_CPPFLAGS" + ]) + fi + done + + if test "$cf_cv_find_linkage_$3" = maybe ; then + + CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)]) + + cf_save_LIBS="$LIBS" + cf_save_LDFLAGS="$LDFLAGS" + + ifelse([$6],,,[ + CPPFLAGS="$cf_test_CPPFLAGS" + LIBS="-l$3 $7 $cf_save_LIBS" + AC_TRY_LINK([$1],[$2],[ + CF_VERBOSE(... found $3 library in system) + cf_cv_find_linkage_$3=yes]) + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + ]) + + if test "$cf_cv_find_linkage_$3" != yes ; then + CF_LIBRARY_PATH(cf_search,$3) + for cf_cv_library_path_$3 in $cf_search + do + if test -d $cf_cv_library_path_$3 ; then + CF_VERBOSE(... testing $cf_cv_library_path_$3) + CPPFLAGS="$cf_test_CPPFLAGS" + LIBS="-l$3 $7 $cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3" + AC_TRY_LINK([$1],[$2],[ + CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3) + cf_cv_find_linkage_$3=yes + cf_cv_library_file_$3="-l$3" + break],[ + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS" + ]) + fi + done + CPPFLAGS="$cf_save_CPPFLAGS" + LDFLAGS="$cf_save_LDFLAGS" + fi + + else + cf_cv_find_linkage_$3=no + fi + ],$7) ]) LIBS="$cf_save_LIBS" @@ -1241,7 +1508,7 @@ ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5]) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FUNC_CURSES_VERSION version: 6 updated: 2012/10/06 16:39:58 +dnl CF_FUNC_CURSES_VERSION version: 7 updated: 2017/05/10 18:31:29 dnl ---------------------- dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS. dnl It's a character string "SVR4", not documented. @@ -1250,7 +1517,7 @@ AC_DEFUN([CF_FUNC_CURSES_VERSION], AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[ AC_TRY_RUN([ #include <${cf_cv_ncurses_header:-curses.h}> -int main() +int main(void) { char temp[1024]; sprintf(temp, "%s\n", curses_version()); @@ -1263,7 +1530,35 @@ rm -f core]) test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION,1,[Define to 1 if we have curses_version function]) ]) dnl --------------------------------------------------------------------------- -dnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03 +dnl CF_FUNC_OPENPTY version: 5 updated: 2015/09/12 14:46:50 +dnl --------------- +dnl Check for openpty() function, along with header. It may need the +dnl "util" library as well. +AC_DEFUN([CF_FUNC_OPENPTY], +[ +AC_CHECK_LIB(util,openpty,cf_cv_lib_util=yes,cf_cv_lib_util=no) +AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[ + cf_save_LIBS="$LIBS" + test $cf_cv_lib_util = yes && { CF_ADD_LIB(util) } + for cf_header in pty.h libutil.h util.h + do + AC_TRY_LINK([ +#include <$cf_header> +],[ + int x = openpty((int *)0, (int *)0, (char *)0, + (struct termios *)0, (struct winsize *)0); +],[ + cf_cv_func_openpty=$cf_header + break +],[ + cf_cv_func_openpty=no +]) + done + LIBS="$cf_save_LIBS" +]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_GCC_ATTRIBUTES version: 17 updated: 2015/04/12 15:39:00 dnl ----------------- dnl Test for availability of useful gcc __attribute__ directives to quiet dnl compiler warnings. Though useful, not all are supported -- and contrary @@ -1317,20 +1612,20 @@ EOF cf_directive="__attribute__(($cf_attribute))" echo "checking for $CC $cf_directive" 1>&AC_FD_CC - case $cf_attribute in #(vi - printf) #(vi + case $cf_attribute in + (printf) cf_printf_attribute=yes cat >conftest.h <conftest.h <conftest.h <>confdefs.h - case $cf_attribute in #(vi - noreturn) #(vi + case $cf_attribute in + (noreturn) AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) ;; - printf) #(vi + (printf) cf_value='/* nothing */' if test "$cf_printf_attribute" != no ; then cf_value='__attribute__((format(printf,fmt,var)))' @@ -1352,7 +1647,7 @@ EOF fi AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) ;; - scanf) #(vi + (scanf) cf_value='/* nothing */' if test "$cf_scanf_attribute" != no ; then cf_value='__attribute__((format(scanf,fmt,var)))' @@ -1360,7 +1655,7 @@ EOF fi AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) ;; - unused) #(vi + (unused) AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) ;; esac @@ -1373,9 +1668,10 @@ rm -rf conftest* fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33 +dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36 dnl -------------- -dnl Find version of gcc +dnl Find version of gcc, and (because icc/clang pretend to be gcc without being +dnl compatible), attempt to determine if icc/clang is actually used. AC_DEFUN([CF_GCC_VERSION],[ AC_REQUIRE([AC_PROG_CC]) GCC_VERSION=none @@ -1385,14 +1681,17 @@ if test "$GCC" = yes ; then test -z "$GCC_VERSION" && GCC_VERSION=unknown AC_MSG_RESULT($GCC_VERSION) fi +CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) +CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_WARNINGS version: 31 updated: 2013/11/19 19:23:35 +dnl CF_GCC_WARNINGS version: 37 updated: 2020/01/05 20:04:12 dnl --------------- dnl Check if the compiler supports useful warning options. There's a few that dnl we don't use, simply because they're too noisy: dnl dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) +dnl -Winline (usually not worthwhile) dnl -Wredundant-decls (system headers make this too noisy) dnl -Wtraditional (combines too many unrelated messages, only a few useful) dnl -Wwrite-strings (too noisy, but should review occasionally). This @@ -1409,14 +1708,11 @@ dnl AC_DEFUN([CF_GCC_WARNINGS], [ AC_REQUIRE([CF_GCC_VERSION]) -CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) -CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) - +if test "x$have_x" = xyes; then CF_CONST_X_STRING fi cat > conftest.$ac_ext <],[ -#ifndef _XOPEN_SOURCE -make an error -#endif], - [cf_cv_gnu_source=no], - [cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" - AC_TRY_COMPILE([#include ],[ -#ifdef _XOPEN_SOURCE -make an error -#endif], - [cf_cv_gnu_source=no], - [cf_cv_gnu_source=yes]) - CPPFLAGS="$cf_save" - ]) + #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 + return 0; + #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 + return 0; + #else + # error not GNU C library + #endif], + [cf_cv_gnu_library=yes], + [cf_cv_gnu_library=no]) ]) -test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + +if test x$cf_cv_gnu_library = xyes; then + + # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE + # was changed to help a little. newlib incorporated the change about 4 + # years later. + AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[ + cf_save="$CPPFLAGS" + CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) + AC_TRY_COMPILE([#include ],[ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) + return 0; + #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) + return 0; + #else + # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old + #endif], + [cf_cv_gnu_library_219=yes], + [cf_cv_gnu_library_219=no]) + CPPFLAGS="$cf_save" + ]) + + if test "x$cf_cv_gnu_library_219" = xyes; then + cf_save="$CPPFLAGS" + AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[ + CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source) + AC_TRY_COMPILE([ + #include + #include + ],[ + #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) + return 0; + #else + # error GNU C library is too old + #endif], + [cf_cv_gnu_dftsrc_219=yes], + [cf_cv_gnu_dftsrc_219=no]) + ]) + test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" + else + cf_cv_gnu_dftsrc_219=maybe + fi + + if test "x$cf_cv_gnu_dftsrc_219" != xyes; then + + AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ + AC_TRY_COMPILE([#include ],[ + #ifndef _XOPEN_SOURCE + #error expected _XOPEN_SOURCE to be defined + #endif], + [cf_cv_gnu_source=no], + [cf_save="$CPPFLAGS" + CF_ADD_CFLAGS(-D_GNU_SOURCE) + AC_TRY_COMPILE([#include ],[ + #ifdef _XOPEN_SOURCE + #error expected _XOPEN_SOURCE to be undefined + #endif], + [cf_cv_gnu_source=no], + [cf_cv_gnu_source=yes]) + CPPFLAGS="$cf_save" + ]) + ]) + + if test "$cf_cv_gnu_source" = yes + then + AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ + CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE) + AC_TRY_COMPILE([#include ],[ + #ifdef _DEFAULT_SOURCE + #error expected _DEFAULT_SOURCE to be undefined + #endif], + [cf_cv_default_source=no], + [cf_cv_default_source=yes]) + ]) + if test "$cf_cv_default_source" = yes + then + CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) + fi + fi + fi + +fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40 +dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48 dnl -------------- dnl Construct a search-list of directories for a nonstandard header-file dnl @@ -1577,8 +1953,8 @@ cf_header_path_list="" if test -n "${CFLAGS}${CPPFLAGS}" ; then for cf_header_path in $CPPFLAGS $CFLAGS do - case $cf_header_path in #(vi - -I*) + case $cf_header_path in + (-I*) cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE) cf_header_path_list="$cf_header_path_list [$]$1" @@ -1607,11 +1983,12 @@ test -d "$oldincludedir" && { $1="[$]$1 $cf_header_path_list" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23 +dnl CF_HELP_MESSAGE version: 4 updated: 2019/12/31 08:53:54 dnl --------------- dnl Insert text into the help-message, for readability, from AC_ARG_WITH. AC_DEFUN([CF_HELP_MESSAGE], -[AC_DIVERT_HELP([$1])dnl +[CF_ACVERSION_CHECK(2.53,[],[ +AC_DIVERT_HELP($1)])dnl ])dnl dnl --------------------------------------------------------------------------- dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42 @@ -1622,7 +1999,101 @@ AC_DEFUN([CF_INHERIT_SCRIPT], test -f $1 || ( test -f ../$1 && cp ../$1 ./ ) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_INTEL_COMPILER version: 5 updated: 2013/02/10 10:41:05 +dnl CF_INSTALL_OPTS version: 2 updated: 2018/08/18 12:19:21 +dnl --------------- +dnl prompt for/fill-in useful install-program options +AC_DEFUN([CF_INSTALL_OPTS], +[ +CF_INSTALL_OPT_S +CF_INSTALL_OPT_P +CF_INSTALL_OPT_O +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_INSTALL_OPT_O version: 2 updated: 2015/05/15 19:45:35 +dnl ---------------- +dnl Almost all "install" programs default to the current user's ownership. +dnl Almost - MINIX is an exception. +AC_DEFUN([CF_INSTALL_OPT_O], +[ +AC_MSG_CHECKING(if install needs to be told about ownership) +case `$ac_config_guess` in +(*minix) + with_install_o=yes + ;; +(*) + with_install_o=no + ;; +esac + +AC_MSG_RESULT($with_install_o) +if test "x$with_install_o" = xyes +then + INSTALL_OPT_O=`id root|sed -e 's/uid=[[0-9]]*(/ -o /' -e 's/gid=[[0-9]]*(/ -g /' -e 's/ [[^=[:space:]]][[^=[:space:]]]*=.*/ /' -e 's/)//g'` +else + INSTALL_OPT_O= +fi + +AC_SUBST(INSTALL_OPT_O) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_INSTALL_OPT_P version: 1 updated: 2018/08/18 12:19:21 +dnl ---------------- +dnl Some install-programs accept a "-p" option to preserve file modification +dnl timestamps. That can be useful as an install option, as well as a way to +dnl avoid the need for ranlib after copying a static archive. +AC_DEFUN([CF_INSTALL_OPT_P], +[ +: ${INSTALL:=install} +AC_CACHE_CHECK(if install accepts -p option, cf_cv_install_p,[ + rm -rf conftest* + date >conftest.in + mkdir conftest.out + sleep 3 + if $INSTALL -p conftest.in conftest.out 2>/dev/null + then + if test -f conftest.out/conftest.in + then + test conftest.in -nt conftest.out/conftest.in 2>conftest.err && \ + test conftest.out/conftest.in -nt conftest.in 2>conftest.err + if test -s conftest.err + then + cf_cv_install_p=no + else + cf_cv_install_p=yes + fi + else + cf_cv_install_p=no + fi + else + cf_cv_install_p=no + fi + rm -rf conftest* +]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_INSTALL_OPT_S version: 2 updated: 2018/08/18 12:19:21 +dnl ---------------- +dnl By default, we should strip executables which are installed, but leave the +dnl ability to suppress that for unit-testing. +AC_DEFUN([CF_INSTALL_OPT_S], +[ +AC_MSG_CHECKING(if you want to install stripped executables) +CF_ARG_DISABLE(stripping, + [ --disable-stripping do not strip (debug info) installed executables], + [with_stripping=no], + [with_stripping=yes]) +AC_MSG_RESULT($with_stripping) + +if test "$with_stripping" = yes +then + INSTALL_OPT_S="-s" +else + INSTALL_OPT_S= +fi +AC_SUBST(INSTALL_OPT_S) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00 dnl ----------------- dnl Check if the given compiler is really the Intel compiler for Linux. It dnl tries to imitate gcc, but does not return an error when it finds a mismatch @@ -1641,7 +2112,7 @@ ifelse([$2],,INTEL_COMPILER,[$2])=no if test "$ifelse([$1],,[$1],GCC)" = yes ; then case $host_os in - linux*|gnu*) + (linux*|gnu*) AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" @@ -1651,7 +2122,7 @@ if test "$ifelse([$1],,[$1],GCC)" = yes ; then make an error #endif ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes -cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" +cf_save_CFLAGS="$cf_save_CFLAGS -we147" ],[]) ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) @@ -1660,7 +2131,7 @@ cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41 +dnl CF_LD_RPATH_OPT version: 8 updated: 2018/08/18 16:36:35 dnl --------------- dnl For the given system and compiler, find the compiler flags to pass to the dnl loader to use the "rpath" feature. @@ -1669,52 +2140,55 @@ AC_DEFUN([CF_LD_RPATH_OPT], AC_REQUIRE([CF_CHECK_CACHE]) LD_RPATH_OPT= -AC_MSG_CHECKING(for an rpath option) -case $cf_cv_system_name in #(vi -irix*) #(vi - if test "$GCC" = yes; then +if test "x$cf_cv_enable_rpath" != xno +then + AC_MSG_CHECKING(for an rpath option) + case $cf_cv_system_name in + (irix*) + if test "$GCC" = yes; then + LD_RPATH_OPT="-Wl,-rpath," + else + LD_RPATH_OPT="-rpath " + fi + ;; + (linux*|gnu*|k*bsd*-gnu|freebsd*) LD_RPATH_OPT="-Wl,-rpath," - else + ;; + (openbsd[[2-9]].*|mirbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; + (dragonfly*) LD_RPATH_OPT="-rpath " - fi - ;; -linux*|gnu*|k*bsd*-gnu) #(vi - LD_RPATH_OPT="-Wl,-rpath," - ;; -openbsd[[2-9]].*|mirbsd*) #(vi - LD_RPATH_OPT="-Wl,-rpath," - ;; -dragonfly*|freebsd*) #(vi - LD_RPATH_OPT="-rpath " - ;; -netbsd*) #(vi - LD_RPATH_OPT="-Wl,-rpath," - ;; -osf*|mls+*) #(vi - LD_RPATH_OPT="-rpath " - ;; -solaris2*) #(vi - LD_RPATH_OPT="-R" - ;; -*) - ;; -esac -AC_MSG_RESULT($LD_RPATH_OPT) + ;; + (netbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; + (osf*|mls+*) + LD_RPATH_OPT="-rpath " + ;; + (solaris2*) + LD_RPATH_OPT="-R" + ;; + (*) + ;; + esac + AC_MSG_RESULT($LD_RPATH_OPT) -case "x$LD_RPATH_OPT" in #(vi -x-R*) - AC_MSG_CHECKING(if we need a space after rpath option) - cf_save_LIBS="$LIBS" - CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) - AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) - LIBS="$cf_save_LIBS" - AC_MSG_RESULT($cf_rpath_space) - test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " - ;; -esac + case "x$LD_RPATH_OPT" in + (x-R*) + AC_MSG_CHECKING(if we need a space after rpath option) + cf_save_LIBS="$LIBS" + CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) + AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) + LIBS="$cf_save_LIBS" + AC_MSG_RESULT($cf_rpath_space) + test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " + ;; + esac +fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50 +dnl CF_LIBRARY_PATH version: 10 updated: 2015/04/15 19:08:48 dnl --------------- dnl Construct a search-list of directories for a nonstandard library-file dnl @@ -1728,8 +2202,8 @@ cf_library_path_list="" if test -n "${LDFLAGS}${LIBS}" ; then for cf_library_path in $LDFLAGS $LIBS do - case $cf_library_path in #(vi - -L*) + case $cf_library_path in + (-L*) cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE) cf_library_path_list="$cf_library_path_list [$]$1" @@ -1780,7 +2254,7 @@ AC_SUBST(MAKE_UPPER_TAGS) AC_SUBST(MAKE_LOWER_TAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MATH_LIB version: 8 updated: 2010/05/29 16:31:02 +dnl CF_MATH_LIB version: 9 updated: 2017/01/21 11:06:25 dnl ----------- dnl Checks for libraries. At least one UNIX system, Apple Macintosh dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler @@ -1791,6 +2265,7 @@ AC_CACHE_CHECK(if -lm needed for math functions, cf_cv_need_libm,[ AC_TRY_LINK([ #include + #include #include ], [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)], @@ -1804,7 +2279,7 @@ ifelse($1,,[ fi ]) dnl --------------------------------------------------------------------------- -dnl CF_MIXEDCASE_FILENAMES version: 6 updated: 2013/10/08 17:47:05 +dnl CF_MIXEDCASE_FILENAMES version: 7 updated: 2015/04/12 15:39:00 dnl ---------------------- dnl Check if the file-system supports mixed-case filenames. If we're able to dnl create a lowercase name and see it as uppercase, it doesn't support that. @@ -1812,11 +2287,11 @@ AC_DEFUN([CF_MIXEDCASE_FILENAMES], [ AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ if test "$cross_compiling" = yes ; then - case $target_alias in #(vi - *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi + case $target_alias in + (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) cf_cv_mixedcase=no ;; - *) + (*) cf_cv_mixedcase=yes ;; esac @@ -1875,46 +2350,97 @@ printf("old\n"); ,[$1=no]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_CONFIG version: 10 updated: 2012/10/06 08:57:51 +dnl CF_NCURSES_CONFIG version: 21 updated: 2018/06/20 20:23:13 dnl ----------------- -dnl Tie together the configure-script macros for ncurses. -dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis. -dnl Allow that to be overridden using the $NCURSES_CONFIG environment variable. +dnl Tie together the configure-script macros for ncurses, preferring these in +dnl order: +dnl a) ".pc" files for pkg-config, using $NCURSES_CONFIG_PKG +dnl b) the "-config" script from ncurses, using $NCURSES_CONFIG +dnl c) just plain libraries dnl dnl $1 is the root library name (default: "ncurses") -AC_DEFUN([CF_NCURSES_CONFIG], -[ +AC_DEFUN([CF_NCURSES_CONFIG],[ +AC_REQUIRE([CF_PKG_CONFIG]) cf_ncuconfig_root=ifelse($1,,ncurses,$1) +cf_have_ncuconfig=no -echo "Looking for ${cf_ncuconfig_root}-config" +if test "x${PKG_CONFIG:=none}" != xnone; then + AC_MSG_CHECKING(pkg-config for $cf_ncuconfig_root) + if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then + AC_MSG_RESULT(yes) -CF_ACVERSION_CHECK(2.52, - [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)], - [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)]) + AC_MSG_CHECKING(if the $cf_ncuconfig_root package files work) + cf_have_ncuconfig=unknown + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" + + CF_ADD_CFLAGS(`$PKG_CONFIG --cflags $cf_ncuconfig_root`) + CF_ADD_LIBS(`$PKG_CONFIG --libs $cf_ncuconfig_root`) + + AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], + [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], + [AC_TRY_RUN([#include <${cf_cv_ncurses_header:-curses.h}> + int main(void) + { char *xx = curses_version(); return (xx == 0); }], + [cf_have_ncuconfig=yes], + [cf_have_ncuconfig=no], + [cf_have_ncuconfig=maybe])], + [cf_have_ncuconfig=no]) + AC_MSG_RESULT($cf_have_ncuconfig) + test "$cf_have_ncuconfig" = maybe && cf_have_ncuconfig=yes + if test "$cf_have_ncuconfig" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + NCURSES_CONFIG_PKG=none + else + AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) + NCURSES_CONFIG_PKG=$cf_ncuconfig_root + CF_TERM_HEADER + fi + + else + AC_MSG_RESULT(no) + NCURSES_CONFIG_PKG=none + fi +else + NCURSES_CONFIG_PKG=none +fi -if test "$NCURSES_CONFIG" != none ; then +if test "x$cf_have_ncuconfig" = "xno"; then + cf_ncurses_config="${cf_ncuconfig_root}${NCURSES_CONFIG_SUFFIX}-config"; echo "Looking for ${cf_ncurses_config}" -CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" -CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) + CF_ACVERSION_CHECK(2.52, + [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)], + [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)]) -# even with config script, some packages use no-override for curses.h -CF_CURSES_HEADER(ifelse($1,,ncurses,$1)) + if test "$NCURSES_CONFIG" != none ; then -dnl like CF_NCURSES_CPPFLAGS -AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) + CF_ADD_CFLAGS(`$NCURSES_CONFIG --cflags`) + CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) -dnl like CF_NCURSES_LIBS -CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) -AC_DEFINE_UNQUOTED($cf_nculib_ROOT) + # even with config script, some packages use no-override for curses.h + CF_CURSES_HEADER(ifelse($1,,ncurses,$1)) -dnl like CF_NCURSES_VERSION -cf_cv_ncurses_version=`$NCURSES_CONFIG --version` + dnl like CF_NCURSES_CPPFLAGS + AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) -else + dnl like CF_NCURSES_LIBS + CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) + AC_DEFINE_UNQUOTED($cf_nculib_ROOT) + + dnl like CF_NCURSES_VERSION + cf_cv_ncurses_version=`$NCURSES_CONFIG --version` -CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1)) -CF_NCURSES_LIBS(ifelse($1,,ncurses,$1)) + else + + CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1)) + CF_NCURSES_LIBS(ifelse($1,,ncurses,$1)) + fi +else + NCURSES_CONFIG=none fi ])dnl dnl --------------------------------------------------------------------------- @@ -2004,7 +2530,7 @@ AC_TRY_LINK([ test "$cf_cv_ncurses_ext_funcs" = yes && AC_DEFINE(NCURSES_EXT_FUNCS,1,[Define to 1 if we have ncurses extensions]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_HEADER version: 3 updated: 2012/10/06 08:57:51 +dnl CF_NCURSES_HEADER version: 4 updated: 2015/04/15 19:08:48 dnl ----------------- dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common dnl variations of ncurses' installs. @@ -2053,24 +2579,24 @@ fi # Set definitions to allow ifdef'ing for ncurses.h -case $cf_cv_ncurses_header in # (vi -*ncurses.h) +case $cf_cv_ncurses_header in +(*ncurses.h) AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h]) ;; esac -case $cf_cv_ncurses_header in # (vi -ncurses/curses.h|ncurses/ncurses.h) +case $cf_cv_ncurses_header in +(ncurses/curses.h|ncurses/ncurses.h) AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h]) ;; -ncursesw/curses.h|ncursesw/ncurses.h) +(ncursesw/curses.h|ncursesw/ncurses.h) AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h]) ;; esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_LIBS version: 16 updated: 2010/11/20 17:02:38 +dnl CF_NCURSES_LIBS version: 17 updated: 2015/04/15 19:08:48 dnl --------------- dnl Look for the ncurses library. This is a little complicated on Linux, dnl because it may be linked with the gpm (general purpose mouse) library. @@ -2096,8 +2622,8 @@ AC_CHECK_LIB(gpm,Gpm_Open, [LIBS="$cf_ncurses_SAVE"], [cf_ncurses_LIBS="-lgpm"])]) -case $host_os in #(vi -freebsd*) +case $host_os in +(freebsd*) # This is only necessary if you are linking against an obsolete # version of ncurses (but it should do no harm, since it's static). if test "$cf_nculib_root" = ncurses ; then @@ -2138,7 +2664,22 @@ CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root) AC_DEFINE_UNQUOTED($cf_nculib_ROOT) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51 +dnl CF_NCURSES_PTHREADS version: 2 updated: 2016/04/22 05:07:41 +dnl ------------------- +dnl Use this followup check to ensure that we link with pthreads if ncurses +dnl uses it. +AC_DEFUN([CF_NCURSES_PTHREADS],[ +: ${cf_nculib_root:=ifelse($1,,ncurses,$1)} +AC_CHECK_LIB($cf_nculib_root,_nc_init_pthreads, + cf_cv_ncurses_pthreads=yes, + cf_cv_ncurses_pthreads=no) +if test "$cf_cv_ncurses_pthreads" = yes +then + CF_ADD_LIBS(-lpthread) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_NCURSES_VERSION version: 15 updated: 2017/05/09 19:26:10 dnl ------------------ dnl Check for the version of ncurses, to aid in reporting bugs, etc. dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use @@ -2153,7 +2694,7 @@ AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[ AC_TRY_RUN([ #include <${cf_cv_ncurses_header:-curses.h}> #include -int main() +int main(void) { FILE *fp = fopen("$cf_tempfile", "w"); #ifdef NCURSES_VERSION @@ -2255,7 +2796,7 @@ AC_TRY_COMPILE([ test "$cf_cv_netbsd_menu_h" = yes && AC_DEFINE(HAVE_NETBSD_MENU_H,1,[Define to 1 if we appear to be using NetBSD menu.h]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03 +dnl CF_NO_LEAKS_OPTION version: 6 updated: 2015/04/12 15:39:00 dnl ------------------ dnl see CF_WITH_NO_LEAKS AC_DEFUN([CF_NO_LEAKS_OPTION],[ @@ -2271,12 +2812,12 @@ AC_ARG_WITH($1, [with_$1=]) AC_MSG_RESULT(${with_$1:-no}) -case .$with_cflags in #(vi -.*-g*) - case .$CFLAGS in #(vi - .*-g*) #(vi +case .$with_cflags in +(.*-g*) + case .$CFLAGS in + (.*-g*) ;; - *) + (*) CF_ADD_CFLAGS([-g]) ;; esac @@ -2284,7 +2825,7 @@ case .$with_cflags in #(vi esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54 +dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57 dnl -------------- dnl Check the argument to see that it looks like a pathname. Rewrite it if it dnl begins with one of the prefix/exec_prefix variables, and then again if the @@ -2292,36 +2833,36 @@ dnl result begins with 'NONE'. This is necessary to work around autoconf's dnl delayed evaluation of those symbols. AC_DEFUN([CF_PATH_SYNTAX],[ if test "x$prefix" != xNONE; then - cf_path_syntax="$prefix" + cf_path_syntax="$prefix" else - cf_path_syntax="$ac_default_prefix" -fi - -case ".[$]$1" in #(vi -.\[$]\(*\)*|.\'*\'*) #(vi - ;; -..|./*|.\\*) #(vi - ;; -.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX - ;; -.\[$]{*prefix}*|.\[$]{*dir}*) #(vi - eval $1="[$]$1" - case ".[$]$1" in #(vi - .NONE/*) - $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` - ;; - esac - ;; #(vi -.no|.NONE/*) - $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` - ;; -*) - ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) - ;; + cf_path_syntax="$ac_default_prefix" +fi + +case ".[$]$1" in +(.\[$]\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX + ;; +(.\[$]{*prefix}*|.\[$]{*dir}*) + eval $1="[$]$1" + case ".[$]$1" in + (.NONE/*) + $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) + ;; esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PDCURSES_X11 version: 13 updated: 2012/10/06 16:39:58 +dnl CF_PDCURSES_X11 version: 14 updated: 2018/06/20 20:23:13 dnl --------------- dnl Configure for PDCurses' X11 library AC_DEFUN([CF_PDCURSES_X11],[ @@ -2333,7 +2874,7 @@ CF_ACVERSION_CHECK(2.52, if test "$XCURSES_CONFIG" != none ; then -CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`" +CF_ADD_CFLAGS(`$XCURSES_CONFIG --cflags`) CF_ADD_LIBS(`$XCURSES_CONFIG --libs`) cf_cv_lib_XCurses=yes @@ -2366,7 +2907,7 @@ else fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22 +dnl CF_PKG_CONFIG version: 10 updated: 2015/04/26 18:06:58 dnl ------------- dnl Check for the package-config program, unless disabled by command-line. AC_DEFUN([CF_PKG_CONFIG], @@ -2378,16 +2919,16 @@ AC_ARG_WITH(pkg-config, [cf_pkg_config=yes]) AC_MSG_RESULT($cf_pkg_config) -case $cf_pkg_config in #(vi -no) #(vi +case $cf_pkg_config in +(no) PKG_CONFIG=none ;; -yes) #(vi +(yes) CF_ACVERSION_CHECK(2.52, [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)], [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)]) ;; -*) +(*) PKG_CONFIG=$withval ;; esac @@ -2395,12 +2936,14 @@ esac test -z "$PKG_CONFIG" && PKG_CONFIG=none if test "$PKG_CONFIG" != none ; then CF_PATH_SYNTAX(PKG_CONFIG) +elif test "x$cf_pkg_config" != xno ; then + AC_MSG_WARN(pkg-config is not installed) fi AC_SUBST(PKG_CONFIG) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42 +dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17 dnl ----------------- dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. dnl @@ -2415,7 +2958,10 @@ dnl dnl Parameters: dnl $1 is the nominal value for _POSIX_C_SOURCE AC_DEFUN([CF_POSIX_C_SOURCE], -[ +[AC_REQUIRE([CF_POSIX_VISIBLE])dnl + +if test "$cf_cv_posix_visible" = no; then + cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) cf_save_CFLAGS="$CFLAGS" @@ -2432,15 +2978,15 @@ make an error #endif], [cf_cv_posix_c_source=no], [cf_want_posix_source=no - case .$cf_POSIX_C_SOURCE in #(vi - .[[12]]??*) #(vi + case .$cf_POSIX_C_SOURCE in + (.[[12]]??*) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" ;; - .2) #(vi + (.2) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" cf_want_posix_source=yes ;; - .*) + (.*) cf_want_posix_source=yes ;; esac @@ -2453,7 +2999,8 @@ make an error fi CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) CFLAGS="$cf_trim_CFLAGS" - CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" + CPPFLAGS="$cf_trim_CPPFLAGS" + CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source) CF_MSG_LOG(if the second compile does not leave our definition intact error) AC_TRY_COMPILE([#include ],[ #ifndef _POSIX_C_SOURCE @@ -2471,6 +3018,35 @@ if test "$cf_cv_posix_c_source" != no ; then CF_ADD_CFLAGS($cf_cv_posix_c_source) fi +fi # cf_cv_posix_visible + +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17 +dnl ---------------- +dnl POSIX documents test-macros which an application may set before any system +dnl headers are included to make features available. +dnl +dnl Some BSD platforms (originally FreeBSD, but copied by a few others) +dnl diverged from POSIX in 2002 by setting symbols which make all of the most +dnl recent features visible in the system header files unless the application +dnl overrides the corresponding test-macros. Doing that introduces portability +dnl problems. +dnl +dnl This macro makes a special check for the symbols used for this, to avoid a +dnl conflicting definition. +AC_DEFUN([CF_POSIX_VISIBLE], +[ +AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[ +AC_TRY_COMPILE([#include ],[ +#if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ + && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ + && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ + && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) +#error conflicting symbols found +#endif +],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes]) +]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08 @@ -2497,20 +3073,24 @@ done ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55 +dnl CF_PROG_CC version: 5 updated: 2019/12/31 08:53:54 dnl ---------- dnl standard check for CC, plus followup sanity checks dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name AC_DEFUN([CF_PROG_CC],[ +CF_ACVERSION_CHECK(2.53, + [AC_MSG_WARN(this will incorrectly handle gnatgcc choice) + AC_REQUIRE([AC_PROG_CC])], + []) ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) CF_GCC_VERSION CF_ACVERSION_CHECK(2.52, [AC_PROG_CC_STDC], [CF_ANSI_CC_REQD]) -CF_CC_ENV_FLAGS +CF_CC_ENV_FLAGS ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07 +dnl CF_PROG_INSTALL version: 7 updated: 2015/04/18 08:56:57 dnl --------------- dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the dnl misc/tabset install won't work properly. Usually this happens only when @@ -2518,21 +3098,26 @@ dnl using the fallback mkinstalldirs script AC_DEFUN([CF_PROG_INSTALL], [AC_PROG_INSTALL case $INSTALL in -/*) - ;; -*) - CF_DIRNAME(cf_dir,$INSTALL) - test -z "$cf_dir" && cf_dir=. - INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'` - ;; +(/*) + ;; +(*) + CF_DIRNAME(cf_dir,$INSTALL) + test -z "$cf_dir" && cf_dir=. + INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'` + ;; esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14 +dnl CF_PROG_LINT version: 4 updated: 2019/11/20 18:55:37 dnl ------------ AC_DEFUN([CF_PROG_LINT], [ -AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint) +AC_CHECK_PROGS(LINT, lint cppcheck splint) +case "x$LINT" in +(xcppcheck|x*/cppcheck) + test -z "$LINT_OPTS" && LINT_OPTS="--enable=all" + ;; +esac AC_SUBST(LINT_OPTS) ])dnl dnl --------------------------------------------------------------------------- @@ -2553,6 +3138,17 @@ $1=`echo "$2" | \ -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` ])dnl dnl --------------------------------------------------------------------------- +dnl CF_RESTORE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:47:45 +dnl --------------------- +dnl Restore flags saved in CF_SAVE_XTRA_FLAGS +dnl $1 = name of current macro +define([CF_RESTORE_XTRA_FLAGS], +[ +LIBS="$cf_save_LIBS_$1" +CFLAGS="$cf_save_CFLAGS_$1" +CPPFLAGS="$cf_save_CPPFLAGS_$1" +])dnl +dnl --------------------------------------------------------------------------- dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00 dnl ------------- AC_DEFUN([CF_RPATH_HACK], @@ -2610,7 +3206,7 @@ fi AC_SUBST(EXTRA_LDFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24 +dnl CF_RPATH_HACK_2 version: 7 updated: 2015/04/12 15:39:00 dnl --------------- dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to dnl EXTRA_LDFLAGS for each -L option found. @@ -2626,8 +3222,8 @@ CF_VERBOSE(...checking $1 [$]$1) cf_rpath_dst= for cf_rpath_src in [$]$1 do - case $cf_rpath_src in #(vi - -L*) #(vi + case $cf_rpath_src in + (-L*) # check if this refers to a directory which we will ignore cf_rpath_skip=no @@ -2670,9 +3266,93 @@ CF_VERBOSE(...checked $1 [$]$1) AC_SUBST(EXTRA_LDFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SIG_ATOMIC_T version: 3 updated: 2012/10/04 20:12:20 +dnl CF_SAVE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:46:44 +dnl ------------------ +dnl Use this macro to save CFLAGS/CPPFLAGS/LIBS before checks against X headers +dnl and libraries which do not update those variables. +dnl +dnl $1 = name of current macro +define([CF_SAVE_XTRA_FLAGS], +[ +cf_save_LIBS_$1="$LIBS" +cf_save_CFLAGS_$1="$CFLAGS" +cf_save_CPPFLAGS_$1="$CPPFLAGS" +LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" +for cf_X_CFLAGS in $X_CFLAGS +do + case "x$cf_X_CFLAGS" in + x-[[IUD]]*) + CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS" + ;; + *) + CFLAGS="$CFLAGS $cf_X_CFLAGS" + ;; + esac +done +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SIGWINCH version: 2 updated: 2019/03/23 19:54:44 +dnl ----------- +dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all +dnl programs need this test). +dnl +dnl This is really a Mac OS X 10.4.3 workaround. Defining _POSIX_C_SOURCE +dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct +dnl winsize declaration is left alone - we may revisit this if Apple choose to +dnl break that part of the interface as well. +AC_DEFUN([CF_SIGWINCH], +[ +AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ + AC_TRY_COMPILE([ +#include +#include +],[int x = SIGWINCH], + [cf_cv_define_sigwinch=yes], + [AC_TRY_COMPILE([ +#undef _XOPEN_SOURCE +#undef _POSIX_SOURCE +#undef _POSIX_C_SOURCE +#include +#include +],[int x = SIGWINCH], + [cf_cv_define_sigwinch=maybe], + [cf_cv_define_sigwinch=no]) +]) +]) + +if test "$cf_cv_define_sigwinch" = maybe ; then +AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[ +cf_cv_fixup_sigwinch=unknown +cf_sigwinch=32 +while test $cf_sigwinch != 1 +do + AC_TRY_COMPILE([ +#undef _XOPEN_SOURCE +#undef _POSIX_SOURCE +#undef _POSIX_C_SOURCE +#include +#include +],[ +#if SIGWINCH != $cf_sigwinch +make an error +#endif +int x = SIGWINCH], + [cf_cv_fixup_sigwinch=$cf_sigwinch + break]) + +cf_sigwinch=`expr $cf_sigwinch - 1` +done +]) + + if test "$cf_cv_fixup_sigwinch" != unknown ; then + CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch" + fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SIG_ATOMIC_T version: 4 updated: 2020/01/18 12:30:44 dnl --------------- -dnl signal handler, but there are some gcc depedencies in that recommendation. +dnl signal handler, but there are some gcc dependencies in that recommendation. dnl Try anyway. AC_DEFUN([CF_SIG_ATOMIC_T], [ @@ -2705,7 +3385,7 @@ AC_MSG_RESULT($cf_cv_sig_atomic_t) test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50 +dnl CF_SUBDIR_PATH version: 7 updated: 2014/12/04 04:33:06 dnl -------------- dnl Construct a search-list for a nonstandard header/lib-file dnl $1 = the variable to return as result @@ -2715,14 +3395,21 @@ AC_DEFUN([CF_SUBDIR_PATH], [ $1= -CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix) CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE) -CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix) -CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix) -CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix) + +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + [$]HOME +do + CF_ADD_SUBDIR_PATH($1,$2,$3,$cf_subdir_prefix,$prefix) +done ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SYS_TIME_SELECT version: 5 updated: 2012/10/04 05:24:07 +dnl CF_SYS_TIME_SELECT version: 6 updated: 2015/04/18 08:56:57 dnl ------------------ dnl Check if we can include with ; this breaks on dnl older SCO configurations. @@ -2739,24 +3426,24 @@ AC_TRY_COMPILE([ #include #endif ],[],[cf_cv_sys_time_select=yes], - [cf_cv_sys_time_select=no]) - ]) + [cf_cv_sys_time_select=no]) + ]) AC_MSG_RESULT($cf_cv_sys_time_select) test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT,1,[Define to 1 if we can include with ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_TERM_HEADER version: 3 updated: 2012/10/06 08:57:51 +dnl CF_TERM_HEADER version: 4 updated: 2015/04/15 19:08:48 dnl -------------- dnl Look for term.h, which is part of X/Open curses. It defines the interface dnl to terminfo database. Usually it is in the same include-path as curses.h, dnl but some packagers change this, breaking various applications. AC_DEFUN([CF_TERM_HEADER],[ AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[ -case ${cf_cv_ncurses_header} in #(vi -*/ncurses.h|*/ncursesw.h) #(vi +case ${cf_cv_ncurses_header} in +(*/ncurses.h|*/ncursesw.h) cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'` ;; -*) +(*) cf_term_header=term.h ;; esac @@ -2776,17 +3463,17 @@ done # Set definitions to allow ifdef'ing to accommodate subdirectories -case $cf_cv_term_header in # (vi -*term.h) +case $cf_cv_term_header in +(*term.h) AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h]) ;; esac -case $cf_cv_term_header in # (vi -ncurses/term.h) #(vi +case $cf_cv_term_header in +(ncurses/term.h) AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h]) ;; -ncursesw/term.h) +(ncursesw/term.h) AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h]) ;; esac @@ -2801,7 +3488,7 @@ top_builddir=ifelse($1,,`pwd`,$1) AC_SUBST(top_builddir) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_TPUTS_PROTO version: 2 updated: 2011/04/23 19:25:50 +dnl CF_TPUTS_PROTO version: 3 updated: 2015/04/17 21:26:14 dnl -------------- dnl Check for type of function-pointer passed to tputs. Some old dnl implementations used functions that had different prototypes, making it @@ -2827,7 +3514,7 @@ then static $cf_ret outc($cf_arg value) { $cf_return; } ],[ - tputs("hello", 0, outc); + tputs("hello", 0, outc); ${cf_cv_main_return:-return}(0); ],[ CF_VERBOSE([prototype $cf_ret func($cf_arg value)]) @@ -2845,7 +3532,7 @@ EOF fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_TRIM_X_LIBS version: 2 updated: 2013/07/09 21:27:22 +dnl CF_TRIM_X_LIBS version: 3 updated: 2015/04/12 15:39:00 dnl -------------- dnl Trim extra base X libraries added as a workaround for inconsistent library dnl dependencies returned by "new" pkg-config files. @@ -2853,7 +3540,7 @@ AC_DEFUN([CF_TRIM_X_LIBS],[ for cf_trim_lib in Xmu Xt X11 do case "$LIBS" in - *-l$cf_trim_lib\ *-l$cf_trim_lib*) + (*-l$cf_trim_lib\ *-l$cf_trim_lib*) LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` CF_VERBOSE(..trimmed $LIBS) ;; @@ -2888,7 +3575,7 @@ else fi ]) dnl --------------------------------------------------------------------------- -dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 +dnl CF_TRY_XOPEN_SOURCE version: 2 updated: 2018/06/20 20:23:13 dnl ------------------- dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we dnl can define it successfully. @@ -2904,7 +3591,7 @@ make an error #endif], [cf_cv_xopen_source=no], [cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) AC_TRY_COMPILE([ #include #include @@ -3074,7 +3761,7 @@ if test "$with_dmalloc" = yes ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_NCURSES_ETC version: 2 updated: 2012/01/13 10:49:00 +dnl CF_WITH_NCURSES_ETC version: 5 updated: 2016/02/20 19:23:20 dnl ------------------- dnl Use this macro for programs which use any variant of "curses", e.g., dnl "ncurses", and "PDCurses". Programs that can use curses and some unrelated @@ -3088,6 +3775,10 @@ CF_WITH_CURSES_DIR cf_cv_screen=curses AC_MSG_CHECKING(for specified curses library type) +AC_ARG_WITH(screen, + [ --with-screen=XXX use specified curses-libraries], + [cf_cv_screen=$withval],[ + AC_ARG_WITH(ncursesw, [ --with-ncursesw use wide ncurses-libraries], [cf_cv_screen=ncursesw],[ @@ -3106,26 +3797,31 @@ AC_ARG_WITH(curses-colr, AC_ARG_WITH(curses-5lib, [ --with-curses-5lib compile/link with SunOS 5lib curses], - [cf_cv_screen=curses_5lib])])])])]) + [cf_cv_screen=curses_5lib])])])])])]) AC_MSG_RESULT($cf_cv_screen) -case $cf_cv_screen in #(vi -curses|curses_*) #(vi +case $cf_cv_screen in +(curses|curses_*) CF_CURSES_CONFIG ;; -ncurses) #(vi - CF_NCURSES_CONFIG - ;; -ncursesw) #(vi +(ncursesw*) CF_UTF8_LIB - CF_NCURSES_CONFIG(ncursesw) + CF_NCURSES_CONFIG($cf_cv_screen) + ;; +(ncurses*) + CF_NCURSES_CONFIG($cf_cv_screen) ;; -pdcurses) +(pdcurses) CF_PDCURSES_X11 ;; +(*) + AC_MSG_ERROR(unexpected screen-value: $cf_cv_screen) + ;; esac +CF_NCURSES_PTHREADS($cf_cv_screen) + ])dnl dnl --------------------------------------------------------------------------- dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 @@ -3136,7 +3832,93 @@ CF_NO_LEAKS_OPTION(valgrind, [USE_VALGRIND]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_CURSES version: 11 updated: 2011/01/18 18:15:30 +dnl CF_WITH_X11_RGB version: 2 updated: 2019/12/31 08:53:54 +dnl --------------- +dnl Handle configure option "--with-x11-rgb", setting these shell +dnl variables: +dnl +dnl $RGB_PATH is the option value, used for finding the X11 rgb file. +dnl $no_x11_rgb is a "#" (comment) if "--without-x11-rgb" is given. +dnl +dnl Most Linux's use this: +dnl /usr/share/X11/rgb.txt +dnl Debian uses this: +dnl /etc/X11/rgb.txt +dnl DragonFlyBSD ports uses this: +dnl /usr/pkg/lib/X11/rgb.txt +dnl FreeBSD ports use these: +dnl /usr/local/lib/X11/rgb.txt +dnl /usr/local/share/X11/rgb.txt +dnl Mandriva has these: +dnl /usr/lib/X11/rgb.txt +dnl /usr/lib64/X11/rgb.txt +dnl NetBSD has these +dnl /usr/X11R7/lib/X11/rgb.txt +dnl OpenSolaris uses +dnl 32-bit: +dnl /usr/X11/etc/X11/rgb.txt +dnl /usr/X11/share/X11/rgb.txt +dnl /usr/X11/lib/X11/rgb.txt +dnl OSX uses +dnl /opt/local/share/X11/rgb.txt (MacPorts) +dnl /opt/X11/share/X11/rgb.txt (non-ports) +dnl 64-bit: +dnl /usr/X11/etc/X11/rgb.txt +dnl /usr/X11/share/X11/rgb.txt (perhaps) +dnl /usr/X11/lib/amd64/X11/rgb.txt +dnl Solaris10 uses (in this order): +dnl /usr/openwin/lib/X11/rgb.txt +dnl /usr/X11/lib/X11/rgb.txt +AC_DEFUN([CF_WITH_X11_RGB],[ +AC_MSG_CHECKING(for X11 rgb file) +AC_ARG_WITH(x11-rgb, + [ --with-x11-rgb=FILE file containing X11 rgb information (EPREFIX/lib/X11/rgb.txt)], + [RGB_PATH=$withval], + [RGB_PATH=auto]) + +if test "x[$]RGB_PATH" = xauto +then + RGB_PATH='${exec_prefix}/lib/X11/rgb.txt' + for cf_path in \ + /opt/local/share/X11/rgb.txt \ + /opt/X11/share/X11/rgb.txt \ + /usr/share/X11/rgb.txt \ + /usr/X11/share/X11/rgb.txt \ + /usr/X11/lib/X11/rgb.txt \ + /usr/lib/X11/rgb.txt \ + /etc/X11/rgb.txt \ + /usr/pkg/lib/X11/rgb.txt \ + /usr/X11R7/lib/X11/rgb.txt \ + /usr/X11R6/lib/X11/rgb.txt \ + /usr/X11R5/lib/X11/rgb.txt \ + /usr/X11R4/lib/X11/rgb.txt \ + /usr/local/lib/X11/rgb.txt \ + /usr/local/share/X11/rgb.txt \ + /usr/lib64/X11/rgb.txt + do + if test -f "$cf_path" ; then + RGB_PATH="$cf_path" + break + fi + done +else + cf_path=$RGB_PATH + CF_PATH_SYNTAX(cf_path) +fi + +AC_MSG_RESULT($RGB_PATH) +AC_SUBST(RGB_PATH) +AC_DEFINE_UNQUOTED(RGB_PATH,"$cf_path",[Define to the full pathname of rgb.txt]) + +no_x11_rgb= +if test "$RGB_PATH" = no +then + no_x11_rgb="#" +fi +AC_SUBST(no_x11_rgb) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_XOPEN_CURSES version: 14 updated: 2018/06/20 20:23:13 dnl --------------- dnl Test if we should define X/Open source for curses, needed on Digital Unix dnl 4.x, to see the extended functions, but breaks on IRIX 6.x. @@ -3146,7 +3928,8 @@ dnl as getbegy(). The latter is better design, but the former is standard. AC_DEFUN([CF_XOPEN_CURSES], [ AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl -AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[ +AC_CACHE_CHECK(definition to turn on extended curses functions,cf_cv_need_xopen_extension,[ +cf_cv_need_xopen_extension=unknown AC_TRY_LINK([ #include #include <${cf_cv_ncurses_header:-curses.h}>],[ @@ -3155,14 +3938,6 @@ AC_TRY_LINK([ make an error #endif #endif - long x = winnstr(stdscr, "", 0); - int x1, y1; - getbegyx(stdscr, y1, x1)], - [cf_cv_need_xopen_extension=no], - [AC_TRY_LINK([ -#define _XOPEN_SOURCE_EXTENDED -#include -#include <${cf_cv_ncurses_header:-curses.h}>],[ #ifdef NCURSES_VERSION cchar_t check; int check2 = curs_set((int)sizeof(check)); @@ -3170,12 +3945,35 @@ AC_TRY_LINK([ long x = winnstr(stdscr, "", 0); int x1, y1; getbegyx(stdscr, y1, x1)], - [cf_cv_need_xopen_extension=yes], - [cf_cv_need_xopen_extension=unknown])])]) -test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" + [cf_cv_need_xopen_extension=none], + [ + for cf_try_xopen_extension in _XOPEN_SOURCE_EXTENDED NCURSES_WIDECHAR + do + AC_TRY_LINK([ +#define $cf_try_xopen_extension 1 +#include +#include <${cf_cv_ncurses_header:-curses.h}>],[ +#ifdef NCURSES_VERSION + cchar_t check; + int check2 = curs_set((int)sizeof(check)); +#endif + long x = winnstr(stdscr, "", 0); + int x1, y1; + getbegyx(stdscr, y1, x1)], + [cf_cv_need_xopen_extension=$cf_try_xopen_extension; break]) + done + ]) +]) + +case $cf_cv_need_xopen_extension in +(*_*) + CF_APPEND_TEXT(CPPFLAGS,-D$cf_cv_need_xopen_extension) + ;; +esac + ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 46 updated: 2014/02/09 19:30:15 +dnl CF_XOPEN_SOURCE version: 55 updated: 2018/12/31 20:46:17 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality, @@ -3186,26 +3984,29 @@ dnl $1 is the nominal value for _XOPEN_SOURCE dnl $2 is the nominal value for _POSIX_C_SOURCE AC_DEFUN([CF_XOPEN_SOURCE],[ AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([CF_POSIX_VISIBLE]) + +if test "$cf_cv_posix_visible" = no; then cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) cf_xopen_source= -case $host_os in #(vi -aix[[4-7]]*) #(vi +case $host_os in +(aix[[4-7]]*) cf_xopen_source="-D_ALL_SOURCE" ;; -cygwin|msys) #(vi +(msys) cf_XOPEN_SOURCE=600 ;; -darwin[[0-8]].*) #(vi +(darwin[[0-8]].*) cf_xopen_source="-D_APPLE_C_SOURCE" ;; -darwin*) #(vi +(darwin*) cf_xopen_source="-D_DARWIN_C_SOURCE" cf_XOPEN_SOURCE= ;; -freebsd*|dragonfly*) #(vi +(freebsd*|dragonfly*|midnightbsd*) # 5.x headers associate # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L @@ -3213,56 +4014,63 @@ freebsd*|dragonfly*) #(vi cf_XOPEN_SOURCE=600 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" ;; -hpux11*) #(vi +(hpux11*) cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" ;; -hpux*) #(vi +(hpux*) cf_xopen_source="-D_HPUX_SOURCE" ;; -irix[[56]].*) #(vi +(irix[[56]].*) cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; -linux*|gnu*|mint*|k*bsd*-gnu) #(vi - CF_GNU_SOURCE +(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) + CF_GNU_SOURCE($cf_XOPEN_SOURCE) ;; -mirbsd*) #(vi +(minix*) + cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... + ;; +(mirbsd*) # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types cf_XOPEN_SOURCE= CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) ;; -netbsd*) #(vi +(netbsd*) cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw ;; -openbsd[[4-9]]*) #(vi +(openbsd[[4-9]]*) # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw cf_xopen_source="-D_BSD_SOURCE" cf_XOPEN_SOURCE=600 ;; -openbsd*) #(vi +(openbsd*) # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw ;; -osf[[45]]*) #(vi +(osf[[45]]*) cf_xopen_source="-D_OSF_SOURCE" ;; -nto-qnx*) #(vi +(nto-qnx*) cf_xopen_source="-D_QNX_SOURCE" ;; -sco*) #(vi +(sco*) # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer ;; -solaris2.*) #(vi +(solaris2.*) cf_xopen_source="-D__EXTENSIONS__" cf_cv_xopen_source=broken ;; -*) +(sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) + cf_XOPEN_SOURCE= + cf_POSIX_C_SOURCE= + ;; +(*) CF_TRY_XOPEN_SOURCE CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) ;; esac if test -n "$cf_xopen_source" ; then - CF_ADD_CFLAGS($cf_xopen_source) + CF_ADD_CFLAGS($cf_xopen_source,true) fi dnl In anything but the default case, we may have system-specific setting @@ -3293,9 +4101,10 @@ make an error CF_TRY_XOPEN_SOURCE fi fi +fi # cf_cv_posix_visible ]) dnl --------------------------------------------------------------------------- -dnl CF_X_ATHENA version: 21 updated: 2013/07/06 21:27:06 +dnl CF_X_ATHENA version: 23 updated: 2015/04/12 15:39:00 dnl ----------- dnl Check for Xaw (Athena) libraries dnl @@ -3315,6 +4124,17 @@ else AC_MSG_RESULT(no) fi +AC_MSG_CHECKING(if you want to link with Xaw 3d xft library) +withval= +AC_ARG_WITH(Xaw3dxft, + [ --with-Xaw3dxft link with Xaw 3d xft library]) +if test "$withval" = yes ; then + cf_x_athena=Xaw3dxft + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + AC_MSG_CHECKING(if you want to link with neXT Athena library) withval= AC_ARG_WITH(neXtaw, @@ -3366,10 +4186,10 @@ int check = XmuCompareISOLatin1("big", "small") if test "$cf_cv_xaw_compat" = no then # workaround for broken ".pc" files... - case "$cf_x_athena_lib" in #(vi - *-lXmu*) #(vi + case "$cf_x_athena_lib" in + (*-lXmu*) ;; - *) + (*) CF_VERBOSE(work around broken package) cf_save_xmu="$LIBS" cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'` @@ -3396,12 +4216,13 @@ if test -z "$cf_x_athena_lib" ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30 +dnl CF_X_ATHENA_CPPFLAGS version: 8 updated: 2020/01/16 05:21:56 dnl -------------------- dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. AC_DEFUN([CF_X_ATHENA_CPPFLAGS], [ +AC_REQUIRE([AC_PATH_XTRA]) cf_x_athena_root=ifelse([$1],,Xaw,[$1]) cf_x_athena_inc="" @@ -3412,10 +4233,10 @@ for cf_path in default \ /usr/local do if test -z "$cf_x_athena_inc" ; then - cf_save="$CPPFLAGS" + CF_SAVE_XTRA_FLAGS([CF_X_ATHENA_CPPFLAGS]) cf_test=X11/$cf_x_athena_root/SimpleMenu.h if test $cf_path != default ; then - CPPFLAGS="$cf_save -I$cf_path/include" + CF_APPEND_TEXT(CPPFLAGS,-I$cf_path/include) AC_MSG_CHECKING(for $cf_test in $cf_path) else AC_MSG_CHECKING(for $cf_test) @@ -3426,24 +4247,23 @@ do [cf_result=yes], [cf_result=no]) AC_MSG_RESULT($cf_result) + CF_RESTORE_XTRA_FLAGS([CF_X_ATHENA_CPPFLAGS]) if test "$cf_result" = yes ; then - cf_x_athena_inc=$cf_path + test "$cf_path" = default && cf_x_athena_inc=default + test "$cf_path" != default && cf_x_athena_inc=$cf_path/include break - else - CPPFLAGS="$cf_save" fi fi done if test -z "$cf_x_athena_inc" ; then - AC_MSG_WARN( -[Unable to successfully find Athena header files with test program]) + AC_MSG_WARN([Unable to find Athena header files]) elif test "$cf_x_athena_inc" != default ; then - CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc" + CF_APPEND_TEXT(CPPFLAGS,-I$cf_x_athena_inc) fi ]) dnl --------------------------------------------------------------------------- -dnl CF_X_ATHENA_LIBS version: 12 updated: 2011/07/17 19:55:02 +dnl CF_X_ATHENA_LIBS version: 13 updated: 2020/01/11 18:16:10 dnl ---------------- dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. @@ -3468,29 +4288,26 @@ do "-l$cf_lib -lXpm -lXmu" \ "-l${cf_lib}_s -lXmu_s" do - if test -z "$cf_x_athena_lib" ; then - cf_save="$LIBS" - cf_test=XawSimpleMenuAddGlobalActions - if test $cf_path != default ; then - CF_ADD_LIBS(-L$cf_path/lib $cf_libs) - AC_MSG_CHECKING(for $cf_libs in $cf_path) - else - CF_ADD_LIBS($cf_libs) - AC_MSG_CHECKING(for $cf_test in $cf_libs) - fi - AC_TRY_LINK([ + test -n "$cf_x_athena_lib" && break + + CF_SAVE_XTRA_FLAGS([CF_X_ATHENA_LIBS]) + cf_test=XawSimpleMenuAddGlobalActions + test "$cf_path" != default && cf_libs="-L$cf_path/lib $cf_libs" + CF_ADD_LIBS($cf_libs) + AC_MSG_CHECKING(for $cf_test in $cf_libs) + AC_TRY_LINK([ #include #include ],[ $cf_test((XtAppContext) 0)], - [cf_result=yes], - [cf_result=no]) - AC_MSG_RESULT($cf_result) - if test "$cf_result" = yes ; then - cf_x_athena_lib="$cf_libs" - break - fi - LIBS="$cf_save" + [cf_result=yes], + [cf_result=no]) + AC_MSG_RESULT($cf_result) + CF_RESTORE_XTRA_FLAGS([CF_X_ATHENA_LIBS]) + + if test "$cf_result" = yes ; then + cf_x_athena_lib="$cf_libs" + break fi done # cf_libs test -n "$cf_x_athena_lib" && break @@ -3502,6 +4319,7 @@ if test -z "$cf_x_athena_lib" ; then [Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) fi +CF_ADD_LIBS($cf_x_athena_lib) CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) ]) @@ -3514,23 +4332,36 @@ CF_TRY_PKG_CONFIG(Xext,,[ [CF_ADD_LIB(Xext)])]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_X_TOOLKIT version: 21 updated: 2012/10/04 06:57:36 +dnl CF_X_TOOLKIT version: 24 updated: 2019/03/23 19:54:44 dnl ------------ dnl Check for X Toolkit libraries -dnl AC_DEFUN([CF_X_TOOLKIT], [ AC_REQUIRE([AC_PATH_XTRA]) AC_REQUIRE([CF_CHECK_CACHE]) +# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new) (and +# in some cases has installed dummy files in the former, other cases replaced +# it with a link to the new location). This complicates the configure script. +# Check for that pitfall, and recover using pkg-config +# +# If none of these are set, the configuration is almost certainly broken. +if test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}" +then + CF_TRY_PKG_CONFIG(x11,,[AC_MSG_WARN(unable to find X11 library)]) + CF_TRY_PKG_CONFIG(ice,,[AC_MSG_WARN(unable to find ICE library)]) + CF_TRY_PKG_CONFIG(sm,,[AC_MSG_WARN(unable to find SM library)]) + CF_TRY_PKG_CONFIG(xt,,[AC_MSG_WARN(unable to find Xt library)]) +fi + cf_have_X_LIBS=no CF_TRY_PKG_CONFIG(xt,[ - case "x$LIBS" in #(vi - *-lX11*) #(vi + case "x$LIBS" in + (*-lX11*) ;; - *) + (*) # we have an "xt" package, but it may omit Xt's dependency on X11 AC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[ AC_TRY_LINK([ @@ -3559,12 +4390,12 @@ AC_TRY_LINK([ if test "$cf_cv_xt_ice_compat" = no then # workaround for broken ".pc" files used for X Toolkit. - case "x$X_PRE_LIBS" in #(vi - *-lICE*) - case "x$LIBS" in #(vi - *-lICE*) #(vi + case "x$X_PRE_LIBS" in + (*-lICE*) + case "x$LIBS" in + (*-lICE*) ;; - *) + (*) CF_VERBOSE(work around broken ICE dependency) CF_TRY_PKG_CONFIG(ice, [CF_TRY_PKG_CONFIG(sm)], diff --git a/test/background.c b/test/background.c index 6c5ad996c5ba..0abf99ca47cf 100644 --- a/test/background.c +++ b/test/background.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2003-2012,2014 Free Software Foundation, Inc. * + * Copyright (c) 2003-2017,2018 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,12 +26,13 @@ * authorization. * ****************************************************************************/ /* - * $Id: background.c,v 1.14 2014/02/01 22:10:42 tom Exp $ + * $Id: background.c,v 1.18 2018/11/24 20:28:45 tom Exp $ */ #define NEED_COLOR_CODE 1 #define NEED_COLOR_NAME 1 #include +#include static int default_bg = COLOR_BLACK; static int default_fg = COLOR_WHITE; @@ -48,24 +49,24 @@ test_background(void) } else { printw("pair 0 contains (%d,%d)\n", (int) f, (int) b); } - getch(); + dump_window(stdscr); printw("Initializing pair 1 to red/%s\n", color_name(default_bg)); init_pair(1, COLOR_RED, (NCURSES_COLOR_T) default_bg); bkgdset((chtype) (' ' | COLOR_PAIR(1))); printw("RED/BLACK\n"); - getch(); + dump_window(stdscr); printw("Initializing pair 2 to %s/blue\n", color_name(default_fg)); init_pair(2, (NCURSES_COLOR_T) default_fg, COLOR_BLUE); bkgdset((chtype) (' ' | COLOR_PAIR(2))); printw("This line should be %s/blue\n", color_name(default_fg)); - getch(); + dump_window(stdscr); printw("Initializing pair 3 to %s/cyan (ACS_HLINE)\n", color_name(default_fg)); init_pair(3, (NCURSES_COLOR_T) default_fg, COLOR_CYAN); printw("...and drawing a box which should be followed by lines\n"); - bkgdset(ACS_HLINE | COLOR_PAIR(3)); + bkgdset(ACS_HLINE | (chtype) COLOR_PAIR(3)); /* * Characters from vt100 line-drawing should be mapped to line-drawing, * since A_ALTCHARSET is set in the background, and the character part @@ -80,50 +81,50 @@ test_background(void) row = 7; mvprintw(row++, 10, "l"); for (chr = 0; chr < 32; ++chr) - addch(' '); + AddCh(' '); printw("x\n"); chr = 32; while (chr < 128) { if ((chr % 32) == 0) mvprintw(row++, 10, "x"); - addch((chtype) ((chr == 127) ? ' ' : chr)); + AddCh((chr == 127) ? ' ' : chr); if ((++chr % 32) == 0) printw("x\n"); } mvprintw(row++, 10, "m"); for (chr = 0; chr < 32; ++chr) - addch(' '); + AddCh(' '); printw("j\n"); - getch(); + dump_window(stdscr); bkgdset((chtype) (' ' | COLOR_PAIR(0))); printw("Default Colors\n"); - getch(); + dump_window(stdscr); printw("Resetting colors to pair 1\n"); bkgdset((chtype) (' ' | COLOR_PAIR(1))); printw("This line should be red/%s\n", color_name(default_bg)); - getch(); + dump_window(stdscr); printw("Setting screen to pair 0\n"); bkgd((chtype) (' ' | COLOR_PAIR(0))); - getch(); + dump_window(stdscr); printw("Setting screen to pair 1\n"); bkgd((chtype) (' ' | COLOR_PAIR(1))); - getch(); + dump_window(stdscr); printw("Setting screen to pair 2\n"); bkgd((chtype) (' ' | COLOR_PAIR(2))); - getch(); + dump_window(stdscr); printw("Setting screen to pair 3\n"); bkgd((chtype) (' ' | COLOR_PAIR(3))); - getch(); + dump_window(stdscr); printw("Setting screen to pair 0\n"); bkgd((chtype) (' ' | COLOR_PAIR(0))); - getch(); + dump_window(stdscr); } static void @@ -164,7 +165,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) setlocale(LC_ALL, ""); - while ((n = getopt(argc, argv, "ab:df:")) != -1) { + while ((n = getopt(argc, argv, "ab:df:l:")) != -1) { switch (n) { #if HAVE_ASSUME_DEFAULT_COLORS case 'a': @@ -182,6 +183,10 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) case 'f': default_fg = color_code(optarg); break; + case 'l': + if (!open_dump(optarg)) + usage(); + break; default: usage(); } @@ -230,6 +235,6 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) getch(); } endwin(); - + close_dump(); ExitProgram(EXIT_SUCCESS); } diff --git a/test/blue.c b/test/blue.c index 50d48b1d5b84..0889ff06c228 100644 --- a/test/blue.c +++ b/test/blue.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2017,2019 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,17 +36,17 @@ *****************************************************************************/ /* - * Compile this with the command `cc -O blue.c -lcurses -o blue'. For best - * results, use the ncurses(3) library. On non-Intel machines, SVr4 curses is - * just as good. - * - * $Id: blue.c,v 1.35 2013/04/27 19:46:53 tom Exp $ + * $Id: blue.c,v 1.52 2019/08/17 21:49:19 tom Exp $ */ #include #include +#if HAVE_LANGINFO_CODESET +#include +#endif + #define NOCARD (-1) #define ACE 0 @@ -97,40 +97,38 @@ static chtype ranks[SUIT_LENGTH][2] = {' ', 'K'} }; -/* Please note, that this is a bad example. - Color values should not be or'ed in. This - only works, because the characters used here - are plain and have no color attribute themselves. */ -#ifdef COLOR_PAIR -#define OR_COLORS(value,pair) ((value) | COLOR_PAIR(pair)) -#else -#define OR_COLORS(value,pair) (value) -#endif +static int letters[4] = +{ + 'h', /* hearts */ + 's', /* spades */ + 'd', /* diamonds */ + 'c', /* clubs */ +}; -#define PC_COLORS(value,pair) (OR_COLORS(value,pair) | A_ALTCHARSET) +#if HAVE_LANGINFO_CODESET -static chtype letters[4] = +#if HAVE_TIGETSTR +static int glyphs[] = { - OR_COLORS('h', RED_ON_WHITE), /* hearts */ - OR_COLORS('s', BLACK_ON_WHITE), /* spades */ - OR_COLORS('d', RED_ON_WHITE), /* diamonds */ - OR_COLORS('c', BLACK_ON_WHITE), /* clubs */ + '\003', /* hearts */ + '\006', /* spades */ + '\004', /* diamonds */ + '\005', /* clubs */ }; +#endif -#if defined(__i386__) && defined(A_ALTCHARSET) && HAVE_TIGETSTR -static chtype glyphs[] = +#if USE_WIDEC_SUPPORT +static int uglyphs[] = { - PC_COLORS('\003', RED_ON_WHITE), /* hearts */ - PC_COLORS('\006', BLACK_ON_WHITE), /* spades */ - PC_COLORS('\004', RED_ON_WHITE), /* diamonds */ - PC_COLORS('\005', BLACK_ON_WHITE), /* clubs */ + 0x2665, /* hearts */ + 0x2660, /* spades */ + 0x2666, /* diamonds */ + 0x2663 /* clubs */ }; -#define USE_CP437 1 -#else -#define USE_CP437 0 -#endif /* __i386__ */ +#endif +#endif /* HAVE_LANGINFO_CODESET */ -static chtype *suits = letters; /* this may change to glyphs below */ +static int *suits = letters; /* this may change to glyphs below */ static void die(int onsig) @@ -155,14 +153,14 @@ init_vars(void) static void shuffle(int size) { - int i, j, numswaps, swapnum, temp; + int numswaps, swapnum; numswaps = size * 10; /* an arbitrary figure */ for (swapnum = 0; swapnum < numswaps; swapnum++) { - i = rand() % size; - j = rand() % size; - temp = deck[i]; + int i = rand() % size; + int j = rand() % size; + int temp = deck[i]; deck[i] = deck[j]; deck[j] = temp; } @@ -171,11 +169,11 @@ shuffle(int size) static void deal_cards(void) { - int ptr, card = 0, value, csuit, crank, suit, aces[4]; + int card = 0, value, csuit, crank, suit, aces[4]; memset(aces, 0, sizeof(aces)); for (suit = HEARTS; suit <= CLUBS; suit++) { - ptr = freeptr[suit]; + int ptr = freeptr[suit]; grid[ptr++] = NOCARD; /* 1st card space is blank */ while ((ptr % GRID_WIDTH) != 0) { value = deck[card++]; @@ -198,15 +196,41 @@ deal_cards(void) static void printcard(int value) { - (void) addch(' '); - if (value == NOCARD) + AddCh(' '); + if (value == NOCARD) { (void) addstr(" "); - else { - addch(ranks[value % SUIT_LENGTH][0] | (chtype) COLOR_PAIR(BLUE_ON_WHITE)); - addch(ranks[value % SUIT_LENGTH][1] | (chtype) COLOR_PAIR(BLUE_ON_WHITE)); - addch(suits[value / SUIT_LENGTH]); + } else { + int which = (value / SUIT_LENGTH); + int isuit = (value % SUIT_LENGTH); + chtype color = (chtype) COLOR_PAIR(((which % 2) == 0) + ? RED_ON_WHITE + : BLACK_ON_WHITE); + + AddCh(ranks[isuit][0] | (chtype) COLOR_PAIR(BLUE_ON_WHITE)); + AddCh(ranks[isuit][1] | (chtype) COLOR_PAIR(BLUE_ON_WHITE)); + +#ifdef NCURSES_VERSION + (attron) ((int) color); /* quieter compiler warnings */ +#else + attron(color); /* PDCurses, etc., either no macro or wrong */ +#endif +#if USE_WIDEC_SUPPORT + { + wchar_t values[2]; + values[0] = (wchar_t) suits[which]; + values[1] = 0; + addwstr(values); + } +#else + AddCh(suits[which]); +#endif +#ifdef NCURSES_VERSION + (attroff) ((int) color); +#else + attroff(color); +#endif } - (void) addch(' '); + AddCh(' '); } static void @@ -315,16 +339,16 @@ play_game(void) } else { char buf[BUFSIZ]; - (void) sprintf(buf, - "Type [%s] to move, r to redraw, q or INTR to quit: ", - live); + _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) + "Type [%s] to move, r to redraw, q or INTR to quit: ", + live); do { move(PROMPTROW, 0); (void) addstr(buf); move(PROMPTROW, (int) strlen(buf)); clrtoeol(); - (void) addch(' '); + AddCh(' '); } while (((c = (char) getch()) < 'a' || c > 'd') && (c != 'r') @@ -364,10 +388,10 @@ play_game(void) static int collect_discards(void) { - int row, col, cardno = 0, finish, gridno; + int row, col, cardno = 0, gridno; for (row = HEARTS; row <= CLUBS; row++) { - finish = 0; + int finish = 0; for (col = 1; col < GRID_WIDTH; col++) { gridno = row * GRID_WIDTH + col; @@ -402,41 +426,58 @@ game_finished(int deal) refresh(); } +#if HAVE_LANGINFO_CODESET +/* + * This program first appeared in ncurses in January 1995. At that point, the + * Linux console was able to display CP437 graphic characters, e.g., in the + * range 0-31. As of 2016, most Linux consoles are running with the UTF-8 + * (partial) support. Incidentally, that makes all of the cards diamonds. + */ +static void +use_pc_display(void) +{ + char *check = nl_langinfo(CODESET); + if (!strcmp(check, "UTF-8")) { +#if USE_WIDEC_SUPPORT + suits = uglyphs; +#endif + } else { +#if HAVE_TIGETSTR + if (!strcmp(check, "IBM437") || + !strcmp(check, "CP437") || + !strcmp(check, "IBM850") || + !strcmp(check, "CP850")) { + char *smacs = tigetstr("smacs"); + char *smpch = tigetstr("smpch"); + /* + * The ncurses library makes this check to decide whether to allow + * the alternate character set for the (normally) nonprinting codes. + */ + if (smacs != 0 && smpch != 0 && !strcmp(smacs, smpch)) { + suits = glyphs; + } + } +#endif + } +} +#else +#define use_pc_display() /* nothing */ +#endif /* HAVE_LANGINFO_CODESET */ + int main(int argc, char *argv[]) { - CATCHALL(die); - setlocale(LC_ALL, ""); - initscr(); + use_pc_display(); + + InitAndCatch(initscr(), die); - /* - * We use COLOR_GREEN because COLOR_BLACK is wired to the wrong thing. - */ start_color(); init_pair(RED_ON_WHITE, COLOR_RED, COLOR_WHITE); init_pair(BLUE_ON_WHITE, COLOR_BLUE, COLOR_WHITE); init_pair(BLACK_ON_WHITE, COLOR_BLACK, COLOR_WHITE); -#ifndef COLOR_PAIR - letters[0] = OR_COLORS('h', RED_ON_WHITE); /* hearts */ - letters[1] = OR_COLORS('s', BLACK_ON_WHITE); /* spades */ - letters[2] = OR_COLORS('d', RED_ON_WHITE); /* diamonds */ - letters[3] = OR_COLORS('c', BLACK_ON_WHITE); /* clubs */ -#if USE_CP437 - glyphs[0] = PC_COLORS('\003', RED_ON_WHITE); /* hearts */ - glyphs[1] = PC_COLORS('\006', BLACK_ON_WHITE); /* spades */ - glyphs[2] = PC_COLORS('\004', RED_ON_WHITE); /* diamonds */ - glyphs[3] = PC_COLORS('\005', BLACK_ON_WHITE); /* clubs */ -#endif -#endif - -#if USE_CP437 - if (tigetstr("smpch")) - suits = glyphs; -#endif /* USE_CP437 */ - cbreak(); if (argc == 2) diff --git a/test/bs.c b/test/bs.c index c158cbb07251..4de4dbc7f987 100644 --- a/test/bs.c +++ b/test/bs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,7 +34,7 @@ * v2.0 featuring strict ANSI/POSIX conformance, November 1993. * v2.1 with ncurses mouse support, September 1995 * - * $Id: bs.c,v 1.62 2013/11/16 19:57:56 tom Exp $ + * $Id: bs.c,v 1.74 2019/08/17 21:49:19 tom Exp $ */ #include @@ -64,6 +64,8 @@ static int getcoord(int); #define CTRLC '\003' /* used as terminate command */ #define FF '\014' /* used as redraw command */ +#define is_QUIT(c) ((c) == CTRLC || (c) == QUIT) + /* coordinate handling */ #define BWIDTH 10 #define BDEPTH 10 @@ -114,17 +116,20 @@ static char *your_name; static char dftname[] = "stranger"; /* direction constants */ -#define E 0 -#define SE 1 -#define S 2 -#define SW 3 -#define W 4 -#define NW 5 -#define N 6 -#define NE 7 -static int xincr[8] = +typedef enum { + dir_E = 0 + ,dir_SE + ,dir_S + ,dir_SW + ,dir_W + ,dir_NW + ,dir_N + ,dir_NE + ,dir_MAX +} DIRECTIONS; +static int xincr[dir_MAX + 2] = {1, 1, 0, -1, -1, -1, 0, 1}; -static int yincr[8] = +static int yincr[dir_MAX + 2] = {0, 1, 1, 1, 0, -1, -1, -1}; /* current ship position and direction */ @@ -145,6 +150,7 @@ static bool checkplace(int b, ship_t * ss, int vis); #define SHIPIT(name, symbol, length) { name, 0, symbol, length, 0,0, 0, FALSE } +/* "ply=player", "cpu=computer" */ static ship_t plyship[SHIPTYPES] = { SHIPIT(carrier, 'A', 5), @@ -185,6 +191,7 @@ uninitgame(int sig GCC_UNUSED) (void) reset_shell_mode(); (void) echo(); (void) endwin(); + free(your_name); ExitProgram(sig ? EXIT_FAILURE : EXIT_SUCCESS); } @@ -214,20 +221,19 @@ announceopts(void) static void intro(void) { - char *tmpname; + const char *tmpname; srand((unsigned) (time(0L) + getpid())); /* Kick the random number generator */ - CATCHALL(uninitgame); + InitAndCatch(initscr(), uninitgame); if ((tmpname = getlogin()) != 0 && (your_name = strdup(tmpname)) != 0) { your_name[0] = (char) toupper(UChar(your_name[0])); } else { - your_name = dftname; + your_name = strdup(dftname); } - (void) initscr(); keypad(stdscr, TRUE); (void) def_prog_mode(); (void) nonl(); @@ -306,7 +312,7 @@ placeship(int b, ship_t * ss, int vis) board[b][newx][newy] = ss->symbol; if (vis) { pgoto(newy, newx); - (void) addch((chtype) ss->symbol); + AddCh(ss->symbol); } } ss->hits = 0; @@ -324,9 +330,9 @@ randomplace(int b, ship_t * ss) { do { - ss->dir = rnd(2) ? E : S; - ss->x = rnd(BWIDTH - (ss->dir == E ? ss->length : 0)); - ss->y = rnd(BDEPTH - (ss->dir == S ? ss->length : 0)); + ss->dir = rnd(2) ? dir_E : dir_S; + ss->x = rnd(BWIDTH - (ss->dir == dir_E ? ss->length : 0)); + ss->y = rnd(BDEPTH - (ss->dir == dir_S ? ss->length : 0)); } while (!checkplace(b, ss, FALSE)); } @@ -369,16 +375,16 @@ initgame(void) MvAddCh(PYBASE + i, PXBASE - 3, (chtype) (i + 'A')); #ifdef A_COLOR if (has_colors()) - attron((attr_t) COLOR_PAIR(COLOR_BLUE)); + attron(COLOR_PAIR(COLOR_BLUE)); #endif /* A_COLOR */ - (void) addch(' '); + AddCh(' '); for (j = 0; j < BWIDTH; j++) (void) addstr(" . "); #ifdef A_COLOR (void) attrset(0); #endif /* A_COLOR */ - (void) addch(' '); - (void) addch((chtype) (i + 'A')); + AddCh(' '); + AddCh(i + 'A'); } MvAddStr(PYBASE + BDEPTH, PXBASE - 3, numbers); MvAddStr(CYBASE - 2, CXBASE + 7, "Hit/Miss Board"); @@ -387,16 +393,16 @@ initgame(void) MvAddCh(CYBASE + i, CXBASE - 3, (chtype) (i + 'A')); #ifdef A_COLOR if (has_colors()) - attron((attr_t) COLOR_PAIR(COLOR_BLUE)); + attron(COLOR_PAIR(COLOR_BLUE)); #endif /* A_COLOR */ - (void) addch(' '); + AddCh(' '); for (j = 0; j < BWIDTH; j++) (void) addstr(" . "); #ifdef A_COLOR (void) attrset(0); #endif /* A_COLOR */ - (void) addch(' '); - (void) addch((chtype) (i + 'A')); + AddCh(' '); + AddCh(i + 'A'); } MvAddStr(CYBASE + BDEPTH, CXBASE - 3, numbers); @@ -461,9 +467,11 @@ initgame(void) do { c = (char) getch(); } while - (!(strchr("hjkl8462rR", c) || c == FF)); + (!(strchr("hjkl8462rR", c) || c == FF || is_QUIT(c))); - if (c == FF) { + if (is_QUIT(c)) { + uninitgame(0); + } else if (c == FF) { (void) clearok(stdscr, TRUE); (void) refresh(); } else if (ss == 0) { @@ -490,19 +498,19 @@ initgame(void) switch (c) { case 'k': case '8': - ss->dir = N; + ss->dir = dir_N; break; case 'j': case '2': - ss->dir = S; + ss->dir = dir_S; break; case 'h': case '4': - ss->dir = W; + ss->dir = dir_W; break; case 'l': case '6': - ss->dir = E; + ss->dir = dir_E; break; } @@ -540,14 +548,15 @@ initgame(void) static int getcoord(int atcpu) { - int ny, nx, c; - if (atcpu) cgoto(cury, curx); else pgoto(cury, curx); (void) refresh(); + for (;;) { + int ny, nx, c; + if (atcpu) { MvPrintw(CYBASE + BDEPTH + 1, CXBASE + 11, "(%d, %c)", curx, 'A' + cury); @@ -660,7 +669,7 @@ collidecheck(int b, int y, int x) if (!closepack) { int i; - for (i = 0; i < 8; i++) { + for (i = 0; i < dir_MAX; i++) { int xend, yend; yend = y + yincr[i]; @@ -723,10 +732,9 @@ static int awinna(void) { int i, j; - ship_t *ss; for (i = 0; i < 2; ++i) { - ss = (i) ? cpuship : plyship; + ship_t *ss = (i) ? cpuship : plyship; for (j = 0; j < SHIPTYPES; ++j, ++ss) if (ss->length > ss->hits) break; @@ -753,12 +761,14 @@ hitship(int x, int y) if (++ss->hits < ss->length) /* still afloat? */ return ((ship_t *) NULL); else { /* sunk! */ - int i, j; + int i; + + if (!closepack) { + int j; - if (!closepack) for (j = -1; j <= 1; j++) { - int bx = ss->x + j * xincr[(ss->dir + 2) % 8]; - int by = ss->y + j * yincr[(ss->dir + 2) % 8]; + int bx = ss->x + j * xincr[(ss->dir + 2) % dir_MAX]; + int by = ss->y + j * yincr[(ss->dir + 2) % dir_MAX]; for (i = -1; i <= ss->length; ++i) { int x1, y1; @@ -771,19 +781,20 @@ hitship(int x, int y) cgoto(y1, x1); #ifdef A_COLOR if (has_colors()) - attron((attr_t) COLOR_PAIR(COLOR_GREEN)); + attron(COLOR_PAIR(COLOR_GREEN)); #endif /* A_COLOR */ - (void) addch(MARK_MISS); + AddCh(MARK_MISS); #ifdef A_COLOR (void) attrset(0); #endif /* A_COLOR */ } else { pgoto(y1, x1); - (void) addch(SHOWSPLASH); + AddCh(SHOWSPLASH); } } } } + } for (i = 0; i < ss->length; ++i) { int x1 = ss->x + i * xincr[ss->dir]; @@ -792,14 +803,14 @@ hitship(int x, int y) hits[turn][x1][y1] = ss->symbol; if (turn % 2 == PLAYER) { cgoto(y1, x1); - (void) addch((chtype) (ss->symbol)); + AddCh(ss->symbol); } else { pgoto(y1, x1); #ifdef A_COLOR if (has_colors()) - attron((attr_t) COLOR_PAIR(COLOR_RED)); + attron(COLOR_PAIR(COLOR_RED)); #endif /* A_COLOR */ - (void) addch(SHOWHIT); + AddCh(SHOWHIT); #ifdef A_COLOR (void) attrset(0); #endif /* A_COLOR */ @@ -836,12 +847,12 @@ plyturn(void) #ifdef A_COLOR if (has_colors()) { if (hit) - attron((attr_t) COLOR_PAIR(COLOR_RED)); + attron(COLOR_PAIR(COLOR_RED)); else - attron((attr_t) COLOR_PAIR(COLOR_GREEN)); + attron(COLOR_PAIR(COLOR_GREEN)); } #endif /* A_COLOR */ - (void) addch((chtype) hits[PLAYER][curx][cury]); + AddCh(hits[PLAYER][curx][cury]); #ifdef A_COLOR (void) attrset(0); #endif /* A_COLOR */ @@ -876,20 +887,20 @@ plyturn(void) static int sgetc(const char *s) { - const char *s1; - int ch; - (void) refresh(); + for (;;) { - ch = getch(); + int ch = getch(); + const char *s1; + if (islower(ch)) ch = toupper(ch); - if (ch == CTRLC) + if (is_QUIT(ch)) uninitgame(0); for (s1 = s; *s1 && ch != *s1; ++s1) continue; if (*s1) { - (void) addch((chtype) ch); + AddCh(ch); (void) refresh(); return (ch); } @@ -969,12 +980,12 @@ cpufire(int x, int y) #ifdef A_COLOR if (has_colors()) { if (hit) - attron((attr_t) COLOR_PAIR(COLOR_RED)); + attron(COLOR_PAIR(COLOR_RED)); else - attron((attr_t) COLOR_PAIR(COLOR_GREEN)); + attron(COLOR_PAIR(COLOR_GREEN)); } #endif /* A_COLOR */ - (void) addch((chtype) (hit ? SHOWHIT : SHOWSPLASH)); + AddCh((hit ? SHOWHIT : SHOWSPLASH)); #ifdef A_COLOR (void) attrset(0); #endif /* A_COLOR */ @@ -1002,7 +1013,7 @@ cputurn(void) #define REVERSE_JUMP 4 #define SECOND_PASS 5 static int next = RANDOM_FIRE; - static bool used[4]; + static bool used[5]; static ship_t ts; int navail, x, y, d, n; int hit = S_MISS; @@ -1022,11 +1033,14 @@ cputurn(void) break; case RANDOM_HIT: /* last shot was random and hit */ - used[E / 2] = used[S / 2] = used[W / 2] = used[N / 2] = FALSE; + used[dir_E / 2] = + used[dir_S / 2] = + used[dir_W / 2] = + used[dir_N / 2] = FALSE; /* FALLTHROUGH */ case HUNT_DIRECT: /* last shot hit, we're looking for ship's long axis */ - for (d = navail = 0; d < 4; d++) { + for (d = navail = 0; d < (dir_MAX) / 2; d++) { x = ts.x + xincr[d * 2]; y = ts.y + yincr[d * 2]; if (!used[d] && POSSIBLE(x, y)) @@ -1038,13 +1052,13 @@ cputurn(void) goto refire; /* ...so we must random-fire */ else { n = rnd(navail) + 1; - for (d = 0; used[d]; d++) ; + for (d = 0; d < (dir_MAX) / 2 && used[d]; d++) ; /* used[d] is first that == 0 */ for (; n > 1; n--) - while (used[++d]) ; + while (d < (dir_MAX) / 2 && used[++d]) ; /* used[d] is next that == 0 */ - assert(d < 4); + assert(d < (dir_MAX) / 2); assert(used[d] == FALSE); used[d] = TRUE; @@ -1078,7 +1092,7 @@ cputurn(void) break; case REVERSE_JUMP: /* nail down the ship's other end */ - d = (ts.dir + 4) % 8; + d = (ts.dir + (dir_MAX) / 2) % dir_MAX; x = ts.x + ts.hits * xincr[d]; y = ts.y + ts.hits * yincr[d]; if (POSSIBLE(x, y) && (hit = cpufire(x, y))) { @@ -1127,7 +1141,7 @@ playagain(void) for (ss = cpuship; ss < cpuship + SHIPTYPES; ss++) for (j = 0; j < ss->length; j++) { cgoto(ss->y + j * yincr[ss->dir], ss->x + j * xincr[ss->dir]); - (void) addch((chtype) ss->symbol); + AddCh(ss->symbol); } if (awinna()) @@ -1150,14 +1164,14 @@ playagain(void) static void do_options(int c, char *op[]) { - register int i; - if (c > 1) { + int i; + for (i = 1; i < c; i++) { switch (op[i][0]) { default: case '?': - (void) fprintf(stderr, "Usage: battle [-s | -b] [-c]\n"); + (void) fprintf(stderr, "Usage: bs [-s | -b] [-c]\n"); (void) fprintf(stderr, "\tWhere the options are:\n"); (void) fprintf(stderr, "\t-s : play a salvo game\n"); (void) fprintf(stderr, "\t-b : play a blitz game\n"); diff --git a/test/bulgarian-utf8-tabs.txt b/test/bulgarian-utf8-tabs.txt new file mode 100644 index 000000000000..65e42bb14dc6 --- /dev/null +++ b/test/bulgarian-utf8-tabs.txt @@ -0,0 +1,6 @@ +Показване на помощна информация -- 1 +Създаване на дялове -- 2 +Избор на дял и форматиране -- 3 +Записване в избрания дял -- 4 +Инсталиране на LILO -- 5 +Изход от програмата -- 6 diff --git a/test/cardfile.c b/test/cardfile.c index b75024143c6e..a782342e226b 100644 --- a/test/cardfile.c +++ b/test/cardfile.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1999-2017,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey * - * $Id: cardfile.c,v 1.42 2013/09/28 22:02:17 tom Exp $ + * $Id: cardfile.c,v 1.46 2019/08/17 21:49:40 tom Exp $ * * File format: text beginning in column 1 is a title; other text is content. */ @@ -125,15 +125,19 @@ add_title(const char *title) static void add_content(CARD * card, const char *content) { - size_t total, offset; + size_t total; content = skip(content); if ((total = strlen(content)) != 0) { + size_t offset; + if (card->content != 0 && (offset = strlen(card->content)) != 0) { total += 1 + offset; card->content = typeRealloc(char, total + 1, card->content); - if (card->content) - strcpy(card->content + offset++, " "); + if (card->content) { + _nc_STRCPY(card->content + offset, " ", total + 1 - offset); + offset++; + } } else { offset = 0; if (card->content != 0) @@ -141,7 +145,7 @@ add_content(CARD * card, const char *content) card->content = typeMalloc(char, total + 1); } if (card->content) - strcpy(card->content + offset, content); + _nc_STRCPY(card->content + offset, content, total + 1 - offset); else failed("add_content"); } @@ -171,10 +175,11 @@ static void read_data(char *fname) { FILE *fp; - CARD *card = 0; - char buffer[BUFSIZ]; if ((fp = fopen(fname, "r")) != 0) { + CARD *card = 0; + char buffer[BUFSIZ]; + while (fgets(buffer, sizeof(buffer), fp)) { trim(buffer); if (isspace(UChar(*buffer))) { @@ -195,15 +200,17 @@ static void write_data(const char *fname) { FILE *fp; - CARD *p = 0; - int n; if (!strcmp(fname, default_name)) fname = "cardfile.out"; if ((fp = fopen(fname, "w")) != 0) { + CARD *p = 0; + for (p = all_cards; p != 0; p = p->link) { FIELD **f = form_fields(p->form); + int n; + for (n = 0; f[n] != 0; n++) { char *s = field_buffer(f[n], 0); if (s != 0 @@ -363,7 +370,7 @@ show_legend(void) #if (defined(KEY_RESIZE) && HAVE_WRESIZE) || NO_LEAKS static void -free_form_fields(FIELD ** f) +free_form_fields(FIELD **f) { int n; @@ -389,7 +396,6 @@ cardfile(char *fname) int form_high; int y; int x; - int ch = ERR; int finished = FALSE; show_legend(); @@ -430,6 +436,8 @@ cardfile(char *fname) order_cards(top_card, visible_cards); while (!finished) { + int ch = ERR; + update_panels(); doupdate(); @@ -520,13 +528,11 @@ cardfile(char *fname) } #if NO_LEAKS while (all_cards != 0) { - FIELD **f; - p = all_cards; all_cards = all_cards->link; if (isVisible(p)) { - f = form_fields(p->form); + FIELD **f = form_fields(p->form); unpost_form(p->form); /* ...so we can free it */ free_form(p->form); /* this also disconnects the fields */ @@ -547,7 +553,7 @@ usage(void) { static const char *msg[] = { - "Usage: view [options] file" + "Usage: cardfile [options] file" ,"" ,"Options:" ," -c use color if terminal supports it" diff --git a/test/chgat.c b/test/chgat.c index 919b5c9e3b98..5c82aee366fb 100644 --- a/test/chgat.c +++ b/test/chgat.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2006-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2006-2017,2019 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,12 +26,13 @@ * authorization. * ****************************************************************************/ /* - * $Id: chgat.c,v 1.12 2012/11/18 01:55:35 tom Exp $ + * $Id: chgat.c,v 1.18 2019/08/17 21:49:19 tom Exp $ * * test-driver for chgat/wchgat/mvchgat/mvwchgat */ #include +#include #if HAVE_CHGAT @@ -45,10 +46,10 @@ #endif typedef struct { - unsigned c; - unsigned v; + size_t c; + size_t v; short pair; - unsigned attr; + attr_t attr; int count; int ch; const char *c_msg; @@ -60,7 +61,7 @@ typedef struct { } STATUS; static const char * -color_params(unsigned state, short *pair) +color_params(size_t state, short *pair) { /* *INDENT-OFF* */ static struct { @@ -74,12 +75,13 @@ color_params(unsigned state, short *pair) }; /* *INDENT-ON* */ - static bool first = TRUE; const char *result = 0; if (has_colors()) { + static bool first = TRUE; + if (first) { - unsigned n; + size_t n; start_color(); for (n = 0; n < SIZEOF(table); ++n) { @@ -95,18 +97,18 @@ color_params(unsigned state, short *pair) } static const char * -video_params(unsigned state, unsigned *attr) +video_params(size_t state, attr_t *attr) { /* *INDENT-OFF* */ static struct { - unsigned attr; + attr_t attr; const char *msg; } table[] = { - { A_NORMAL, "normal" }, - { A_BOLD, "bold" }, - { A_REVERSE, "reverse" }, - { A_UNDERLINE, "underline" }, - { A_BLINK, "blink" }, + { WA_NORMAL, "normal" }, + { WA_BOLD, "bold" }, + { WA_REVERSE, "reverse" }, + { WA_UNDERLINE, "underline" }, + { WA_BLINK, "blink" }, }; /* *INDENT-ON* */ @@ -200,7 +202,7 @@ init_status(WINDOW *win, STATUS * sp) static void show_help(WINDOW *win) { - static const char *table[] = + static const char *msgs[] = { "Basic commands:" ,"Use h/j/k/l or arrow keys to move the cursor." @@ -214,19 +216,10 @@ show_help(WINDOW *win) ,"= resets count to zero." ,"- negates count." ,"? shows this help-window" - ,"" - ,"" + ,0 }; - int y_max, x_max; - int row; - - getmaxyx(win, y_max, x_max); - for (row = 0; row < (int) SIZEOF(table) && row < y_max; ++row) { - MvWPrintw(win, row, 0, "%.*s", x_max, table[row]); - } - while (wgetch(win) != 'q') - beep(); + popup_msg(win, msgs); } static void @@ -280,8 +273,8 @@ update_status(WINDOW *win, STATUS * sp) sp->count = -(sp->count); show_status(win, sp); break; - case '?': - do_subwindow(win, sp, show_help); + case HELP_KEY_1: + show_help(win); break; default: if (isdigit(sp->ch)) { diff --git a/test/clip_printw.c b/test/clip_printw.c index 6d6d590241ae..f7689e6f0218 100644 --- a/test/clip_printw.c +++ b/test/clip_printw.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2008-2017,2019 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,12 +26,13 @@ * authorization. * ****************************************************************************/ /* - * $Id: clip_printw.c,v 1.9 2012/11/18 00:39:48 tom Exp $ + * $Id: clip_printw.c,v 1.16 2019/08/17 21:49:40 tom Exp $ * * demonstrate how to use printw without wrapping. */ #include +#include #ifdef HAVE_VW_PRINTW @@ -55,7 +56,7 @@ typedef struct { } STATUS; static int -clip_wprintw(WINDOW *win, NCURSES_CONST char *fmt,...) +clip_wprintw(WINDOW *win, NCURSES_CONST char *fmt, ...) { int y0, x0, y1, x1, width; WINDOW *sub; @@ -102,10 +103,11 @@ color_params(unsigned state, int *pair) }; /* *INDENT-ON* */ - static bool first = TRUE; const char *result = 0; if (has_colors()) { + static bool first = TRUE; + if (first) { unsigned n; @@ -132,11 +134,11 @@ video_params(unsigned state, attr_t *attr) attr_t attr; const char *msg; } table[] = { - { A_NORMAL, "normal" }, - { A_BOLD, "bold" }, - { A_REVERSE, "reverse" }, - { A_UNDERLINE, "underline" }, - { A_BLINK, "blink" }, + { WA_NORMAL, "normal" }, + { WA_BOLD, "bold" }, + { WA_REVERSE, "reverse" }, + { WA_UNDERLINE, "underline" }, + { WA_BLINK, "blink" }, }; /* *INDENT-ON* */ @@ -231,7 +233,7 @@ init_status(WINDOW *win, STATUS * sp) static void show_help(WINDOW *win) { - static const char *table[] = + static const char *msgs[] = { "Basic commands:" ,"Use h/j/k/l or arrow keys to move the cursor." @@ -240,21 +242,13 @@ show_help(WINDOW *win) ,"Other commands:" ,"space toggles through the set of video attributes and colors." ,"t touches (forces repaint) of the current line." - ,". calls clip_wprintw at the current position with the given count." + ,". calls vw_printw at the current position with the given count." ,"= resets count to zero." ,"? shows this help-window" - ,"" + ,0 }; - int y_max, x_max; - int row; - - getmaxyx(win, y_max, x_max); - for (row = 0; row < (int) SIZEOF(table) && row < y_max; ++row) { - MvWPrintw(win, row, 0, "%.*s", x_max, table[row]); - } - while (wgetch(win) != 'q') - beep(); + popup_msg(win, msgs); } static void @@ -304,8 +298,8 @@ update_status(WINDOW *win, STATUS * sp) sp->count = 0; show_status(win, sp); break; - case '?': - do_subwindow(win, sp, show_help); + case HELP_KEY_1: + show_help(win); break; default: if (isdigit(sp->ch)) { @@ -331,13 +325,13 @@ test_clipping(WINDOW *win) do { switch (st.ch) { case '.': /* change from current position */ - (void) wattrset(win, (int) (st.attr | (chtype) COLOR_PAIR(st.pair))); + (void) wattrset(win, AttrArg(COLOR_PAIR(st.pair), st.attr)); if (st.count > 0) { need = (unsigned) st.count + 1; - sprintf(fmt, "%%c%%%ds%%c", st.count); + _nc_SPRINTF(fmt, _nc_SLIMIT(sizeof(fmt)) "%%c%%%ds%%c", st.count); } else { need = (unsigned) getmaxx(win) - 1; - strcpy(fmt, "%c%s%c"); + _nc_STRCPY(fmt, "%c%s%c", sizeof(fmt)); } if ((buffer = typeMalloc(char, need + 1)) != 0) { for (j = 0; j < need; ++j) { diff --git a/test/color_content.c b/test/color_content.c new file mode 100644 index 000000000000..8b11982a2bbc --- /dev/null +++ b/test/color_content.c @@ -0,0 +1,331 @@ +/**************************************************************************** + * Copyright (c) 2018,2019 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: color_content.c,v 1.11 2019/08/17 21:29:13 tom Exp $ + */ + +#define NEED_TIME_H +#include + +#if USE_EXTENDED_COLOR +typedef int my_color_t; +#else +typedef NCURSES_COLOR_T my_color_t; +#endif + +typedef struct { + my_color_t r; + my_color_t g; + my_color_t b; +} MYCOLOR; + +static int f_opt; +static int i_opt; +static int l_opt; +static int n_opt; +static int p_opt; +static int r_opt; +static int s_opt; + +#if USE_EXTENDED_COLOR +static int x_opt; +#endif + +static MYCOLOR *expected; + +#if HAVE_GETTIMEOFDAY +static struct timeval initial_time; +static struct timeval finish_time; +#endif + +static void +failed(const char *msg) +{ + printw("%s", msg); + getch(); + endwin(); + ExitProgram(EXIT_FAILURE); +} + +#if USE_EXTENDED_COLOR +static int +InitColor(int pair, int r, int g, int b) +{ + int rc; + if (x_opt) { + rc = init_extended_color(pair, r, g, b); + } else { + rc = init_color((NCURSES_PAIRS_T) pair, + (NCURSES_COLOR_T) r, + (NCURSES_COLOR_T) g, + (NCURSES_COLOR_T) b); + } + return rc; +} + +static int +ColorContent(int color, int *rp, int *gp, int *bp) +{ + int rc; + if (x_opt) { + rc = extended_color_content(color, rp, gp, bp); + } else { + NCURSES_COLOR_T r, g, b; + if ((rc = color_content((NCURSES_COLOR_T) color, &r, &g, &b)) == OK) { + *rp = r; + *gp = g; + *bp = b; + } + } + return rc; +} +#else +#define InitColor(color,r,g,b) init_color((NCURSES_COLOR_T)color,(NCURSES_COLOR_T)r,(NCURSES_COLOR_T)g,(NCURSES_COLOR_T)b) +#define ColorContent(color,rp,gp,bp) color_content((NCURSES_COLOR_T)color,rp,gp,bp) +#endif + +static my_color_t +random_color(void) +{ + return (my_color_t) (rand() % 1000); +} + +static void +setup_test(void) +{ + initscr(); + cbreak(); + noecho(); + scrollok(stdscr, TRUE); + if (has_colors()) { + start_color(); + if (!can_change_color() && !p_opt) + failed("this terminal cannot initialize colors"); + + if (!f_opt) + f_opt = 0; + if (!l_opt) + l_opt = COLORS; + if (l_opt <= 0) + failed("color limit must be greater than zero"); + + if (!n_opt) { + int color; + size_t need = (size_t) ((l_opt > COLORS) ? l_opt : COLORS) + 1; + + expected = typeCalloc(MYCOLOR, need); + if (s_opt) { + int r; + int g; + int b; + color = f_opt; + for (r = 0; r < 1000; ++r) { + for (g = 0; g < 1000; ++g) { + for (b = 0; b < 1000; ++b) { + if (color < l_opt) { + InitColor(color, r, g, b); + expected[color].r = (my_color_t) r; + expected[color].g = (my_color_t) g; + expected[color].b = (my_color_t) b; + ++color; + } else { + break; + } + } + } + } + } else { + for (color = f_opt; color < l_opt; ++color) { + expected[color].r = random_color(); + expected[color].g = random_color(); + expected[color].b = random_color(); + InitColor(color, + expected[color].r, + expected[color].g, + expected[color].b); + } + } + } + } else { + failed("This demo requires a color terminal"); + } +#if HAVE_GETTIMEOFDAY + gettimeofday(&initial_time, 0); +#endif +} + +static void +run_test(void) +{ + int color; + bool success = TRUE; + for (color = f_opt; color < l_opt; ++color) { + my_color_t r; + my_color_t g; + my_color_t b; + if (ColorContent(color, &r, &g, &b) == OK) { + if (expected != 0) { + if (r != expected[color].r) + success = FALSE; + if (g != expected[color].g) + success = FALSE; + if (b != expected[color].b) + success = FALSE; + } + } + } + if (i_opt) { + addch(success ? '.' : '?'); + refresh(); + } +} + +static void +finish_test(void) +{ + getch(); + endwin(); +} + +#if HAVE_GETTIMEOFDAY +static double +seconds(struct timeval *mark) +{ + double result = (double) mark->tv_sec; + result += ((double) mark->tv_usec / 1e6); + return result; +} +#endif + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: color_content [options]" + ,"" + ,"Options:" + ," -f COLOR first color value to test (default: 0)" + ," -i interactive, showing test-progress" + ," -l COLOR last color value to test (default: max_colors-1)" + ," -n do not initialize color pairs" + ," -p print data for color content instead of testing" + ," -r COUNT repeat for given count" + ," -s initialize pairs sequentially rather than random" +#if USE_EXTENDED_COLOR + ," -x use extended color pairs/values" +#endif + }; + size_t n; + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + int i; + + while ((i = getopt(argc, argv, "f:il:npr:sx")) != -1) { + switch (i) { + case 'f': + if ((f_opt = atoi(optarg)) <= 0) + usage(); + break; + case 'i': + i_opt = 1; + break; + case 'l': + if ((l_opt = atoi(optarg)) <= 0) + usage(); + break; + case 'n': + n_opt = 1; + break; + case 'p': + p_opt = 1; + break; + case 'r': + if ((r_opt = atoi(optarg)) <= 0) + usage(); + break; + case 's': + s_opt = 1; + break; +#if USE_EXTENDED_COLOR + case 'x': + x_opt = 1; + break; +#endif + default: + usage(); + } + } + if (optind < argc) + usage(); + if (r_opt <= 0) + r_opt = 1; + + setup_test(); + if (p_opt) { + endwin(); + for (i = 0; i < COLORS; ++i) { + my_color_t r, g, b; + if (ColorContent(i, &r, &g, &b) == OK) { + printf("%d: %d %d %d\n", i, r, g, b); + } else { + printf("%d: ? ?\n", i); + } + } + } else { + int repeat; + + for (repeat = 0; repeat < r_opt; ++repeat) { + run_test(); + if (i_opt) { + addch('.'); + refresh(); + } + } + + if (i_opt) { + addch('\n'); + } + printw("DONE: "); +#if HAVE_GETTIMEOFDAY + gettimeofday(&finish_time, 0); + printw("%.03f seconds", + seconds(&finish_time) + - seconds(&initial_time)); +#endif + finish_test(); + } + + ExitProgram(EXIT_SUCCESS); +} diff --git a/test/color_name.h b/test/color_name.h index 81a3b3125759..5ec4dcbf990e 100644 --- a/test/color_name.h +++ b/test/color_name.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 2011-2016,2018 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: color_name.h,v 1.4 2012/11/18 01:59:32 tom Exp $ + * $Id: color_name.h,v 1.6 2018/12/29 15:19:30 tom Exp $ */ #ifndef __COLORNAME_H @@ -79,7 +79,7 @@ color_code(const char *color) } return result; } -#endif /* NEED_COLOR_NAME */ +#endif /* NEED_COLOR_CODE */ #ifdef NEED_COLOR_NAME static const char * @@ -89,7 +89,7 @@ color_name(int color) const char *result = 0; if (color >= (int) SIZEOF(the_color_names)) { - sprintf(temp, "%d", color); + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(result)) "%d", color); result = temp; } else if (color < 0) { result = "default"; diff --git a/test/color_set.c b/test/color_set.c index 477d049c8b5e..cfe3755bd7de 100644 --- a/test/color_set.c +++ b/test/color_set.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2003-2012,2014 Free Software Foundation, Inc. * + * Copyright (c) 2003-2014,2019 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: color_set.c,v 1.8 2014/02/01 22:10:42 tom Exp $ + * $Id: color_set.c,v 1.9 2019/08/17 21:49:19 tom Exp $ */ #include @@ -39,13 +39,14 @@ int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { NCURSES_COLOR_T f, b; - int i; initscr(); cbreak(); noecho(); if (has_colors()) { + int i; + start_color(); (void) pair_content(0, &f, &b); diff --git a/test/configure b/test/configure index 3fb46e8f8c84..23502348ba6d 100755 --- a/test/configure +++ b/test/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by Autoconf 2.52.20121002. +# Generated by Autoconf 2.52.20200111. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. @@ -139,6 +139,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' @@ -281,6 +282,15 @@ do | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst \ + | --runs | --run | --ru) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* \ + | --runs=* | --run=* | --ru=*) + runstatedir=$ac_optarg ;; + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) @@ -618,6 +628,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR extra definition of runtime data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -646,30 +657,38 @@ if test -n "$ac_init_help"; then cat <<\EOF -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + General Options: + --disable-stripping do not strip (debug info) installed executables + --enable-string-hacks work around bogus compiler/loader warnings --with-pkg-config{=path} enable/disable use of pkg-config --disable-echo do not display "compiling" commands Curses Version-dependent Options: --with-ncurses-wrap-prefix naming-prefix for ncurses wrapped-variables --disable-widec disable checks for wide-character functions --with-curses-dir=DIR directory in which (n)curses is installed + --with-screen=XXX use specified curses-libraries --with-ncursesw use wide ncurses-libraries --with-ncurses use ncurses-libraries --with-pdcurses compile/link with pdcurses X11 library --with-curses-colr compile/link with HPUX 10.x color-curses --with-curses-5lib compile/link with SunOS 5lib curses --with-Xaw3d link with Xaw 3d library + --with-Xaw3dxft link with Xaw 3d xft library --with-neXtaw link with neXT Athena library --with-XawPlus link with Athena-Plus library --with-x use the X Window System + --with-x11-rgb=FILE file containing X11 rgb information (EPREFIX/lib/X11/rgb.txt) + --disable-panel disable checks for panel functions + --disable-menu disable checks for menu functions + --disable-form disable checks for form functions Testing/development Options: --enable-warnings test: turn on gcc compiler warnings --with-dmalloc test: use Gray Watson's dmalloc library @@ -746,7 +765,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.52.20121002. Invocation command line was +generated by GNU Autoconf 2.52.20200111. Invocation command line was $ $0 $@ @@ -870,7 +889,7 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - { echo "$as_me:873: loading site script $ac_site_file" >&5 + { echo "$as_me:892: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} cat "$ac_site_file" >&5 . "$ac_site_file" @@ -881,7 +900,7 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then - { echo "$as_me:884: loading cache $cache_file" >&5 + { echo "$as_me:903: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; @@ -889,7 +908,7 @@ echo "$as_me: loading cache $cache_file" >&6;} esac fi else - { echo "$as_me:892: creating cache $cache_file" >&5 + { echo "$as_me:911: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -905,21 +924,21 @@ for ac_var in `(set) 2>&1 | eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:908: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 + { echo "$as_me:927: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { echo "$as_me:912: error: \`$ac_var' was not set in the previous run" >&5 + { echo "$as_me:931: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:918: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:937: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:920: former value: $ac_old_val" >&5 + { echo "$as_me:939: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:922: current value: $ac_new_val" >&5 + { echo "$as_me:941: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; @@ -938,9 +957,9 @@ echo "$as_me: current value: $ac_new_val" >&2;} fi done if $ac_cache_corrupted; then - { echo "$as_me:941: error: changes in the environment can compromise the build" >&5 + { echo "$as_me:960: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:943: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 + { { echo "$as_me:962: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi @@ -952,19 +971,19 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return=return -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; +case `echo "testing\c" 2>/dev/null; echo 1,2,3`,`echo -n testing 2>/dev/null; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C= # newlines do not sed ;-) only broken shells would use this case anyway + ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac echo "#! $SHELL" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh -if { (echo "$as_me:964: PATH=\".;.\"; conftest.sh") >&5 +if { (echo "$as_me:983: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? - echo "$as_me:967: \$? = $ac_status" >&5 + echo "$as_me:986: \$? = $ac_status" >&5 (exit $ac_status); }; then ac_path_separator=';' else @@ -996,7 +1015,7 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:999: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 + { { echo "$as_me:1018: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi @@ -1006,11 +1025,11 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:1009: error: cannot run $ac_config_sub" >&5 + { { echo "$as_me:1028: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } -echo "$as_me:1013: checking build system type" >&5 +echo "$as_me:1032: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1019,16 +1038,16 @@ else test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && - { { echo "$as_me:1022: error: cannot guess build type; you must specify one" >&5 + { { echo "$as_me:1041: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:1026: error: $ac_config_sub $ac_cv_build_alias failed." >&5 + { { echo "$as_me:1045: error: $ac_config_sub $ac_cv_build_alias failed." >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:1031: result: $ac_cv_build" >&5 +echo "$as_me:1050: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` @@ -1036,7 +1055,7 @@ build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then - echo "$as_me:1039: checking host system type" >&5 + echo "$as_me:1058: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1045,12 +1064,12 @@ else test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:1048: error: $ac_config_sub $ac_cv_host_alias failed" >&5 + { { echo "$as_me:1067: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:1053: result: $ac_cv_host" >&5 +echo "$as_me:1072: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` @@ -1076,13 +1095,13 @@ else fi test -z "$system_name" && system_name="$cf_cv_system_name" -test -n "$cf_cv_system_name" && echo "$as_me:1079: result: Configuring for $cf_cv_system_name" >&5 +test -n "$cf_cv_system_name" && echo "$as_me:1098: result: Configuring for $cf_cv_system_name" >&5 echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6 if test ".$system_name" != ".$cf_cv_system_name" ; then - echo "$as_me:1083: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 + echo "$as_me:1102: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6 - { { echo "$as_me:1085: error: \"Please remove config.cache and try again.\"" >&5 + { { echo "$as_me:1104: error: \"Please remove config.cache and try again.\"" >&5 echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;} { (exit 1); exit 1; }; } fi @@ -1100,7 +1119,7 @@ _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed -echo "$as_me:1103: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "$as_me:1122: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then @@ -1120,11 +1139,11 @@ fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:1123: result: yes" >&5 + echo "$as_me:1142: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$as_me:1127: result: no" >&5 + echo "$as_me:1146: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi @@ -1138,7 +1157,7 @@ ac_main_return=return if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:1141: checking for $ac_word" >&5 +echo "$as_me:1160: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1153,7 +1172,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}gcc" -echo "$as_me:1156: found $ac_dir/$ac_word" >&5 +echo "$as_me:1175: found $ac_dir/$ac_word" >&5 break done @@ -1161,10 +1180,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1164: result: $CC" >&5 + echo "$as_me:1183: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1167: result: no" >&5 + echo "$as_me:1186: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1173,7 +1192,7 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo "$as_me:1176: checking for $ac_word" >&5 +echo "$as_me:1195: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1188,7 +1207,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="gcc" -echo "$as_me:1191: found $ac_dir/$ac_word" >&5 +echo "$as_me:1210: found $ac_dir/$ac_word" >&5 break done @@ -1196,10 +1215,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1199: result: $ac_ct_CC" >&5 + echo "$as_me:1218: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1202: result: no" >&5 + echo "$as_me:1221: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1212,7 +1231,7 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:1215: checking for $ac_word" >&5 +echo "$as_me:1234: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1227,7 +1246,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}cc" -echo "$as_me:1230: found $ac_dir/$ac_word" >&5 +echo "$as_me:1249: found $ac_dir/$ac_word" >&5 break done @@ -1235,10 +1254,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1238: result: $CC" >&5 + echo "$as_me:1257: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1241: result: no" >&5 + echo "$as_me:1260: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1247,7 +1266,7 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:1250: checking for $ac_word" >&5 +echo "$as_me:1269: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1262,7 +1281,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="cc" -echo "$as_me:1265: found $ac_dir/$ac_word" >&5 +echo "$as_me:1284: found $ac_dir/$ac_word" >&5 break done @@ -1270,10 +1289,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1273: result: $ac_ct_CC" >&5 + echo "$as_me:1292: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1276: result: no" >&5 + echo "$as_me:1295: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1286,7 +1305,7 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:1289: checking for $ac_word" >&5 +echo "$as_me:1308: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1306,7 +1325,7 @@ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then continue fi ac_cv_prog_CC="cc" -echo "$as_me:1309: found $ac_dir/$ac_word" >&5 +echo "$as_me:1328: found $ac_dir/$ac_word" >&5 break done @@ -1328,10 +1347,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1331: result: $CC" >&5 + echo "$as_me:1350: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1334: result: no" >&5 + echo "$as_me:1353: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1342,7 +1361,7 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:1345: checking for $ac_word" >&5 +echo "$as_me:1364: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1357,7 +1376,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="$ac_tool_prefix$ac_prog" -echo "$as_me:1360: found $ac_dir/$ac_word" >&5 +echo "$as_me:1379: found $ac_dir/$ac_word" >&5 break done @@ -1365,10 +1384,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1368: result: $CC" >&5 + echo "$as_me:1387: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1371: result: no" >&5 + echo "$as_me:1390: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1381,7 +1400,7 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:1384: checking for $ac_word" >&5 +echo "$as_me:1403: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1396,7 +1415,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="$ac_prog" -echo "$as_me:1399: found $ac_dir/$ac_word" >&5 +echo "$as_me:1418: found $ac_dir/$ac_word" >&5 break done @@ -1404,10 +1423,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1407: result: $ac_ct_CC" >&5 + echo "$as_me:1426: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1410: result: no" >&5 + echo "$as_me:1429: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1419,36 +1438,36 @@ fi fi -test -z "$CC" && { { echo "$as_me:1422: error: no acceptable cc found in \$PATH" >&5 +test -z "$CC" && { { echo "$as_me:1441: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. -echo "$as_me:1427:" \ +echo "$as_me:1446:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:1430: \"$ac_compiler --version &5\"") >&5 +{ (eval echo "$as_me:1449: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? - echo "$as_me:1433: \$? = $ac_status" >&5 + echo "$as_me:1452: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:1435: \"$ac_compiler -v &5\"") >&5 +{ (eval echo "$as_me:1454: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? - echo "$as_me:1438: \$? = $ac_status" >&5 + echo "$as_me:1457: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:1440: \"$ac_compiler -V &5\"") >&5 +{ (eval echo "$as_me:1459: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? - echo "$as_me:1443: \$? = $ac_status" >&5 + echo "$as_me:1462: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line 1447 "configure" +#line 1466 "configure" #include "confdefs.h" int -main () +main (void) { ; @@ -1460,13 +1479,13 @@ ac_clean_files="$ac_clean_files a.out a.exe" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:1463: checking for C compiler default output" >&5 +echo "$as_me:1482: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:1466: \"$ac_link_default\"") >&5 +if { (eval echo "$as_me:1485: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? - echo "$as_me:1469: \$? = $ac_status" >&5 + echo "$as_me:1488: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last @@ -1489,34 +1508,34 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:1492: error: C compiler cannot create executables" >&5 +{ { echo "$as_me:1511: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext -echo "$as_me:1498: result: $ac_file" >&5 +echo "$as_me:1517: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:1503: checking whether the C compiler works" >&5 +echo "$as_me:1522: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' - { (eval echo "$as_me:1509: \"$ac_try\"") >&5 + { (eval echo "$as_me:1528: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1512: \$? = $ac_status" >&5 + echo "$as_me:1531: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { echo "$as_me:1519: error: cannot run C compiled programs. + { { echo "$as_me:1538: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} @@ -1524,24 +1543,24 @@ If you meant to cross compile, use \`--host'." >&2;} fi fi fi -echo "$as_me:1527: result: yes" >&5 +echo "$as_me:1546: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:1534: checking whether we are cross compiling" >&5 +echo "$as_me:1553: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:1536: result: $cross_compiling" >&5 +echo "$as_me:1555: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 -echo "$as_me:1539: checking for executable suffix" >&5 +echo "$as_me:1558: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 -if { (eval echo "$as_me:1541: \"$ac_link\"") >&5 +if { (eval echo "$as_me:1560: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:1544: \$? = $ac_status" >&5 + echo "$as_me:1563: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will @@ -1557,29 +1576,29 @@ for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do esac done else - { { echo "$as_me:1560: error: cannot compute EXEEXT: cannot compile and link" >&5 + { { echo "$as_me:1579: error: cannot compute EXEEXT: cannot compile and link" >&5 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext -echo "$as_me:1566: result: $ac_cv_exeext" >&5 +echo "$as_me:1585: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -echo "$as_me:1572: checking for object suffix" >&5 +echo "$as_me:1591: checking for object suffix" >&5 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1578 "configure" +#line 1597 "configure" #include "confdefs.h" int -main () +main (void) { ; @@ -1587,10 +1606,10 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (eval echo "$as_me:1590: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1609: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1593: \$? = $ac_status" >&5 + echo "$as_me:1612: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in @@ -1602,28 +1621,28 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:1605: error: cannot compute OBJEXT: cannot compile" >&5 +{ { echo "$as_me:1624: error: cannot compute OBJEXT: cannot compile" >&5 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -echo "$as_me:1612: result: $ac_cv_objext" >&5 +echo "$as_me:1631: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -echo "$as_me:1616: checking whether we are using the GNU C compiler" >&5 +echo "$as_me:1635: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1622 "configure" +#line 1641 "configure" #include "confdefs.h" int -main () +main (void) { #ifndef __GNUC__ choke me @@ -1634,16 +1653,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1637: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1656: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1640: \$? = $ac_status" >&5 + echo "$as_me:1659: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1643: \"$ac_try\"") >&5 + { (eval echo "$as_me:1662: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1646: \$? = $ac_status" >&5 + echo "$as_me:1665: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else @@ -1655,23 +1674,23 @@ rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -echo "$as_me:1658: result: $ac_cv_c_compiler_gnu" >&5 +echo "$as_me:1677: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" -echo "$as_me:1664: checking whether $CC accepts -g" >&5 +echo "$as_me:1683: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1670 "configure" +#line 1689 "configure" #include "confdefs.h" int -main () +main (void) { ; @@ -1679,16 +1698,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1682: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1701: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1685: \$? = $ac_status" >&5 + echo "$as_me:1704: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1688: \"$ac_try\"") >&5 + { (eval echo "$as_me:1707: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1691: \$? = $ac_status" >&5 + echo "$as_me:1710: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else @@ -1698,7 +1717,7 @@ ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:1701: result: $ac_cv_prog_cc_g" >&5 +echo "$as_me:1720: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS @@ -1725,16 +1744,16 @@ cat >conftest.$ac_ext <<_ACEOF #endif _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1728: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1747: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1731: \$? = $ac_status" >&5 + echo "$as_me:1750: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1734: \"$ac_try\"") >&5 + { (eval echo "$as_me:1753: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1737: \$? = $ac_status" >&5 + echo "$as_me:1756: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ @@ -1746,12 +1765,12 @@ if { (eval echo "$as_me:1728: \"$ac_compile\"") >&5 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line 1749 "configure" +#line 1768 "configure" #include "confdefs.h" #include $ac_declaration int -main () +main (void) { exit (42); ; @@ -1759,16 +1778,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1762: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1781: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1765: \$? = $ac_status" >&5 + echo "$as_me:1784: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1768: \"$ac_try\"") >&5 + { (eval echo "$as_me:1787: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1771: \$? = $ac_status" >&5 + echo "$as_me:1790: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -1778,11 +1797,11 @@ continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line 1781 "configure" +#line 1800 "configure" #include "confdefs.h" $ac_declaration int -main () +main (void) { exit (42); ; @@ -1790,16 +1809,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1793: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1812: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1796: \$? = $ac_status" >&5 + echo "$as_me:1815: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1799: \"$ac_try\"") >&5 + { (eval echo "$as_me:1818: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1802: \$? = $ac_status" >&5 + echo "$as_me:1821: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -1829,15 +1848,117 @@ ac_main_return=return GCC_VERSION=none if test "$GCC" = yes ; then - echo "$as_me:1832: checking version of $CC" >&5 + echo "$as_me:1851: checking version of $CC" >&5 echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown - echo "$as_me:1836: result: $GCC_VERSION" >&5 + echo "$as_me:1855: result: $GCC_VERSION" >&5 echo "${ECHO_T}$GCC_VERSION" >&6 fi -echo "$as_me:1840: checking for $CC option to accept ANSI C" >&5 +INTEL_COMPILER=no + +if test "$GCC" = yes ; then + case $host_os in + (linux*|gnu*) + echo "$as_me:1864: checking if this is really Intel C compiler" >&5 +echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 + cf_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -no-gcc" + cat >conftest.$ac_ext <<_ACEOF +#line 1869 "configure" +#include "confdefs.h" + +int +main (void) +{ + +#ifdef __INTEL_COMPILER +#else +make an error +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1886: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1889: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1892: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1895: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + INTEL_COMPILER=yes +cf_save_CFLAGS="$cf_save_CFLAGS -we147" + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + echo "$as_me:1906: result: $INTEL_COMPILER" >&5 +echo "${ECHO_T}$INTEL_COMPILER" >&6 + ;; + esac +fi + +CLANG_COMPILER=no + +if test "$GCC" = yes ; then + echo "$as_me:1915: checking if this is really Clang C compiler" >&5 +echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6 + cf_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Qunused-arguments" + cat >conftest.$ac_ext <<_ACEOF +#line 1920 "configure" +#include "confdefs.h" + +int +main (void) +{ + +#ifdef __clang__ +#else +make an error +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1937: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1940: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1943: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1946: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + CLANG_COMPILER=yes +cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + echo "$as_me:1957: result: $CLANG_COMPILER" >&5 +echo "${ECHO_T}$CLANG_COMPILER" >&6 +fi + +echo "$as_me:1961: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1845,7 +1966,7 @@ else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line 1848 "configure" +#line 1969 "configure" #include "confdefs.h" #include #include @@ -1876,7 +1997,7 @@ int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, i int argc; char **argv; int -main () +main (void) { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; @@ -1894,16 +2015,16 @@ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIO do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext -if { (eval echo "$as_me:1897: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2018: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1900: \$? = $ac_status" >&5 + echo "$as_me:2021: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1903: \"$ac_try\"") >&5 + { (eval echo "$as_me:2024: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1906: \$? = $ac_status" >&5 + echo "$as_me:2027: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break @@ -1920,10 +2041,10 @@ fi case "x$ac_cv_prog_cc_stdc" in x|xno) - echo "$as_me:1923: result: none needed" >&5 + echo "$as_me:2044: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) - echo "$as_me:1926: result: $ac_cv_prog_cc_stdc" >&5 + echo "$as_me:2047: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac @@ -1931,52 +2052,182 @@ esac # This should have been defined by AC_PROG_CC : ${CC:=cc} -echo "$as_me:1934: checking \$CC variable" >&5 +echo "$as_me:2055: checking \$CFLAGS variable" >&5 +echo $ECHO_N "checking \$CFLAGS variable... $ECHO_C" >&6 +case "x$CFLAGS" in +(*-[IUD]*) + echo "$as_me:2059: result: broken" >&5 +echo "${ECHO_T}broken" >&6 + { echo "$as_me:2061: WARNING: your environment uses the CFLAGS variable to hold CPPFLAGS options" >&5 +echo "$as_me: WARNING: your environment uses the CFLAGS variable to hold CPPFLAGS options" >&2;} + cf_flags="$CFLAGS" + CFLAGS= + for cf_arg in $cf_flags + do + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_arg +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + + done + ;; +(*) + echo "$as_me:2169: result: ok" >&5 +echo "${ECHO_T}ok" >&6 + ;; +esac + +echo "$as_me:2174: checking \$CC variable" >&5 echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6 -case "$CC" in #(vi -*[\ \ ]-[IUD]*) - echo "$as_me:1938: result: broken" >&5 +case "$CC" in +(*[\ \ ]-*) + echo "$as_me:2178: result: broken" >&5 echo "${ECHO_T}broken" >&6 - { echo "$as_me:1940: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 -echo "$as_me: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;} + { echo "$as_me:2180: WARNING: your environment uses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 +echo "$as_me: WARNING: your environment uses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;} # humor him... - cf_flags=`echo "$CC" | sed -e 's/^[^ ]*[ ]//'` - CC=`echo "$CC" | sed -e 's/[ ].*//'` + cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[ ]* / /g' -e 's/[ ]*[ ]-[^ ].*//'` + cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", substr($0,1+length(prog))); }'` + CC="$cf_prog" + for cf_arg in $cf_flags + do + case "x$cf_arg" in + (x-[IUDfgOW]*) cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= -for cf_add_cflags in $cf_flags +for cf_add_cflags in $cf_arg do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -1985,21 +2236,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -2008,33 +2267,109 @@ done if test -n "$cf_new_cflags" ; then - CFLAGS="$CFLAGS $cf_new_cflags" + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi if test -n "$cf_new_cppflags" ; then - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + fi if test -n "$cf_new_extra_cppflags" ; then - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + fi + ;; + (*) + CC="$CC $cf_arg" + ;; + esac + done + test -n "$verbose" && echo " resulting CC: '$CC'" 1>&6 + +echo "${as_me:-configure}:2297: testing resulting CC: '$CC' ..." 1>&5 + + test -n "$verbose" && echo " resulting CFLAGS: '$CFLAGS'" 1>&6 + +echo "${as_me:-configure}:2301: testing resulting CFLAGS: '$CFLAGS' ..." 1>&5 + + test -n "$verbose" && echo " resulting CPPFLAGS: '$CPPFLAGS'" 1>&6 + +echo "${as_me:-configure}:2305: testing resulting CPPFLAGS: '$CPPFLAGS' ..." 1>&5 + ;; -*) - echo "$as_me:2026: result: ok" >&5 +(*) + echo "$as_me:2309: result: ok" >&5 echo "${ECHO_T}ok" >&6 ;; esac +echo "$as_me:2314: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat >conftest.$ac_ext <<_ACEOF +#line 2322 "configure" +#include "confdefs.h" +#ifndef __cplusplus +static $ac_kw int static_foo () {return 0; } +$ac_kw int foo () {return 0; } +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2331: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2334: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2337: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2340: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_inline=$ac_kw; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:2351: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 +case $ac_cv_c_inline in + inline | yes) ;; + no) +cat >>confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >>confdefs.h <&5 +echo "$as_me:2372: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then @@ -2055,18 +2390,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 2058 "configure" +#line 2393 "configure" #include "confdefs.h" #include Syntax error _ACEOF -if { (eval echo "$as_me:2063: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2398: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2069: \$? = $ac_status" >&5 + echo "$as_me:2404: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2089,17 +2424,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 2092 "configure" +#line 2427 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:2096: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2431: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2102: \$? = $ac_status" >&5 + echo "$as_me:2437: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2136,7 +2471,7 @@ fi else ac_cv_prog_CPP=$CPP fi -echo "$as_me:2139: result: $CPP" >&5 +echo "$as_me:2474: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -2146,18 +2481,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 2149 "configure" +#line 2484 "configure" #include "confdefs.h" #include Syntax error _ACEOF -if { (eval echo "$as_me:2154: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2489: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2160: \$? = $ac_status" >&5 + echo "$as_me:2495: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2180,17 +2515,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 2183 "configure" +#line 2518 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:2187: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2522: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2193: \$? = $ac_status" >&5 + echo "$as_me:2528: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2218,7 +2553,7 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { echo "$as_me:2221: error: C preprocessor \"$CPP\" fails sanity check" >&5 + { { echo "$as_me:2556: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi @@ -2234,7 +2569,7 @@ for ac_prog in mawk gawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:2237: checking for $ac_word" >&5 +echo "$as_me:2572: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2249,7 +2584,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_AWK="$ac_prog" -echo "$as_me:2252: found $ac_dir/$ac_word" >&5 +echo "$as_me:2587: found $ac_dir/$ac_word" >&5 break done @@ -2257,10 +2592,10 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - echo "$as_me:2260: result: $AWK" >&5 + echo "$as_me:2595: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else - echo "$as_me:2263: result: no" >&5 + echo "$as_me:2598: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2279,7 +2614,7 @@ done # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:2282: checking for a BSD compatible install" >&5 +echo "$as_me:2617: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then @@ -2328,7 +2663,7 @@ fi INSTALL=$ac_install_sh fi fi -echo "$as_me:2331: result: $INSTALL" >&5 +echo "$as_me:2666: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -2340,64 +2675,152 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' case $INSTALL in -/*) - ;; -*) - cf_dir=`echo $INSTALL | sed -e 's%/[^/]*$%%'` - test -z "$cf_dir" && cf_dir=. - INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'` - ;; +(/*) + ;; +(*) + cf_dir=`echo $INSTALL | sed -e 's%/[^/]*$%%'` + test -z "$cf_dir" && cf_dir=. + INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'` + ;; esac -for ac_prog in tdlint lint alint splint lclint -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:2356: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_LINT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$LINT"; then - ac_cv_prog_LINT="$LINT" # Let the user override the test. +echo "$as_me:2687: checking if you want to install stripped executables" >&5 +echo $ECHO_N "checking if you want to install stripped executables... $ECHO_C" >&6 + +# Check whether --enable-stripping or --disable-stripping was given. +if test "${enable_stripping+set}" = set; then + enableval="$enable_stripping" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + with_stripping=no + else + with_stripping=yes + fi else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_LINT="$ac_prog" -echo "$as_me:2371: found $ac_dir/$ac_word" >&5 -break -done + enableval=yes + with_stripping=yes -fi -fi -LINT=$ac_cv_prog_LINT +fi; +echo "$as_me:2704: result: $with_stripping" >&5 +echo "${ECHO_T}$with_stripping" >&6 + +if test "$with_stripping" = yes +then + INSTALL_OPT_S="-s" +else + INSTALL_OPT_S= +fi + +: ${INSTALL:=install} +echo "$as_me:2715: checking if install accepts -p option" >&5 +echo $ECHO_N "checking if install accepts -p option... $ECHO_C" >&6 +if test "${cf_cv_install_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + rm -rf conftest* + date >conftest.in + mkdir conftest.out + sleep 3 + if $INSTALL -p conftest.in conftest.out 2>/dev/null + then + if test -f conftest.out/conftest.in + then + test conftest.in -nt conftest.out/conftest.in 2>conftest.err && \ + test conftest.out/conftest.in -nt conftest.in 2>conftest.err + if test -s conftest.err + then + cf_cv_install_p=no + else + cf_cv_install_p=yes + fi + else + cf_cv_install_p=no + fi + else + cf_cv_install_p=no + fi + rm -rf conftest* + +fi +echo "$as_me:2746: result: $cf_cv_install_p" >&5 +echo "${ECHO_T}$cf_cv_install_p" >&6 + +echo "$as_me:2749: checking if install needs to be told about ownership" >&5 +echo $ECHO_N "checking if install needs to be told about ownership... $ECHO_C" >&6 +case `$ac_config_guess` in +(*minix) + with_install_o=yes + ;; +(*) + with_install_o=no + ;; +esac + +echo "$as_me:2760: result: $with_install_o" >&5 +echo "${ECHO_T}$with_install_o" >&6 +if test "x$with_install_o" = xyes +then + INSTALL_OPT_O=`id root|sed -e 's/uid=[0-9]*(/ -o /' -e 's/gid=[0-9]*(/ -g /' -e 's/ [^=[:space:]][^=[:space:]]*=.*/ /' -e 's/)//g'` +else + INSTALL_OPT_O= +fi + +for ac_prog in lint cppcheck splint +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:2773: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_LINT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$LINT"; then + ac_cv_prog_LINT="$LINT" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_LINT="$ac_prog" +echo "$as_me:2788: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +LINT=$ac_cv_prog_LINT if test -n "$LINT"; then - echo "$as_me:2379: result: $LINT" >&5 + echo "$as_me:2796: result: $LINT" >&5 echo "${ECHO_T}$LINT" >&6 else - echo "$as_me:2382: result: no" >&5 + echo "$as_me:2799: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$LINT" && break done -echo "$as_me:2389: checking if filesystem supports mixed-case filenames" >&5 +case "x$LINT" in +(xcppcheck|x*/cppcheck) + test -z "$LINT_OPTS" && LINT_OPTS="--enable=all" + ;; +esac + +echo "$as_me:2812: checking if filesystem supports mixed-case filenames" >&5 echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6 if test "${cf_cv_mixedcase+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes ; then - case $target_alias in #(vi - *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi + case $target_alias in + (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) cf_cv_mixedcase=no ;; - *) + (*) cf_cv_mixedcase=yes ;; esac @@ -2413,7 +2836,7 @@ else fi fi -echo "$as_me:2416: result: $cf_cv_mixedcase" >&5 +echo "$as_me:2839: result: $cf_cv_mixedcase" >&5 echo "${ECHO_T}$cf_cv_mixedcase" >&6 test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF @@ -2424,7 +2847,7 @@ for ac_prog in exctags ctags do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:2427: checking for $ac_word" >&5 +echo "$as_me:2850: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CTAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2439,7 +2862,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CTAGS="$ac_prog" -echo "$as_me:2442: found $ac_dir/$ac_word" >&5 +echo "$as_me:2865: found $ac_dir/$ac_word" >&5 break done @@ -2447,10 +2870,10 @@ fi fi CTAGS=$ac_cv_prog_CTAGS if test -n "$CTAGS"; then - echo "$as_me:2450: result: $CTAGS" >&5 + echo "$as_me:2873: result: $CTAGS" >&5 echo "${ECHO_T}$CTAGS" >&6 else - echo "$as_me:2453: result: no" >&5 + echo "$as_me:2876: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2461,7 +2884,7 @@ for ac_prog in exetags etags do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:2464: checking for $ac_word" >&5 +echo "$as_me:2887: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ETAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2476,7 +2899,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ETAGS="$ac_prog" -echo "$as_me:2479: found $ac_dir/$ac_word" >&5 +echo "$as_me:2902: found $ac_dir/$ac_word" >&5 break done @@ -2484,10 +2907,10 @@ fi fi ETAGS=$ac_cv_prog_ETAGS if test -n "$ETAGS"; then - echo "$as_me:2487: result: $ETAGS" >&5 + echo "$as_me:2910: result: $ETAGS" >&5 echo "${ECHO_T}$ETAGS" >&6 else - echo "$as_me:2490: result: no" >&5 + echo "$as_me:2913: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2496,7 +2919,7 @@ done # Extract the first word of "${CTAGS:-ctags}", so it can be a program name with args. set dummy ${CTAGS:-ctags}; ac_word=$2 -echo "$as_me:2499: checking for $ac_word" >&5 +echo "$as_me:2922: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2511,7 +2934,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_MAKE_LOWER_TAGS="yes" -echo "$as_me:2514: found $ac_dir/$ac_word" >&5 +echo "$as_me:2937: found $ac_dir/$ac_word" >&5 break done @@ -2520,17 +2943,17 @@ fi fi MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS if test -n "$MAKE_LOWER_TAGS"; then - echo "$as_me:2523: result: $MAKE_LOWER_TAGS" >&5 + echo "$as_me:2946: result: $MAKE_LOWER_TAGS" >&5 echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 else - echo "$as_me:2526: result: no" >&5 + echo "$as_me:2949: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$cf_cv_mixedcase" = yes ; then # Extract the first word of "${ETAGS:-etags}", so it can be a program name with args. set dummy ${ETAGS:-etags}; ac_word=$2 -echo "$as_me:2533: checking for $ac_word" >&5 +echo "$as_me:2956: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2545,7 +2968,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_MAKE_UPPER_TAGS="yes" -echo "$as_me:2548: found $ac_dir/$ac_word" >&5 +echo "$as_me:2971: found $ac_dir/$ac_word" >&5 break done @@ -2554,10 +2977,10 @@ fi fi MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS if test -n "$MAKE_UPPER_TAGS"; then - echo "$as_me:2557: result: $MAKE_UPPER_TAGS" >&5 + echo "$as_me:2980: result: $MAKE_UPPER_TAGS" >&5 echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 else - echo "$as_me:2560: result: no" >&5 + echo "$as_me:2983: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2577,21 +3000,22 @@ else MAKE_LOWER_TAGS="#" fi -echo "$as_me:2580: checking if -lm needed for math functions" >&5 +echo "$as_me:3003: checking if -lm needed for math functions" >&5 echo $ECHO_N "checking if -lm needed for math functions... $ECHO_C" >&6 if test "${cf_cv_need_libm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2587 "configure" +#line 3010 "configure" #include "confdefs.h" #include + #include #include int -main () +main (void) { double x = rand(); printf("result = %g\n", pow(sin(x),x)) ; @@ -2599,16 +3023,16 @@ double x = rand(); printf("result = %g\n", pow(sin(x),x)) } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2602: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3026: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2605: \$? = $ac_status" >&5 + echo "$as_me:3029: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2608: \"$ac_try\"") >&5 + { (eval echo "$as_me:3032: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2611: \$? = $ac_status" >&5 + echo "$as_me:3035: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_need_libm=no else @@ -2618,7 +3042,7 @@ cf_cv_need_libm=yes fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:2621: result: $cf_cv_need_libm" >&5 +echo "$as_me:3045: result: $cf_cv_need_libm" >&5 echo "${ECHO_T}$cf_cv_need_libm" >&6 if test "$cf_cv_need_libm" = yes then @@ -2639,11 +3063,13 @@ LDFLAGS_STATIC="" LD_MODEL="" LD_SHARED_OPTS="" LIBTOOL="" +LIBTOOL_OPTS="" LIB_CLEAN="" LIB_COMPILE="" LIB_LINK='${CC}' LINK_TESTS="" LOCAL_LDFLAGS="" +PACKAGE="ncurses-examples" PTHREAD="-lm" TEST_ARGS="" TEST_DEPS="" @@ -2675,10 +3101,10 @@ cat > conftest.i <&5 + { echo "$as_me:3104: checking for $CC __attribute__ directives..." >&5 echo "$as_me: checking for $CC __attribute__ directives..." >&6;} cat > conftest.$ac_ext <&5 - case $cf_attribute in #(vi - printf) #(vi + case $cf_attribute in + (printf) cf_printf_attribute=yes cat >conftest.h <conftest.h <conftest.h <&5 + if { (eval echo "$as_me:3156: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2733: \$? = $ac_status" >&5 + echo "$as_me:3159: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:2735: result: ... $cf_attribute" >&5 + test -n "$verbose" && echo "$as_me:3161: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h - case $cf_attribute in #(vi - noreturn) #(vi + case $cf_attribute in + (noreturn) cat >>confdefs.h <>confdefs.h <>confdefs.h <>confdefs.h <&5 +echo $ECHO_N "checking if you want to work around bogus compiler/loader warnings... $ECHO_C" >&6 -case $host_os in #(vi -aix[4-7]*) #(vi - cf_xopen_source="-D_ALL_SOURCE" - ;; -cygwin|msys) #(vi - cf_XOPEN_SOURCE=600 - ;; -darwin[0-8].*) #(vi - cf_xopen_source="-D_APPLE_C_SOURCE" - ;; -darwin*) #(vi - cf_xopen_source="-D_DARWIN_C_SOURCE" - cf_XOPEN_SOURCE= - ;; -freebsd*|dragonfly*) #(vi - # 5.x headers associate - # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L - # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L - cf_POSIX_C_SOURCE=200112L - cf_XOPEN_SOURCE=600 - cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" - ;; -hpux11*) #(vi - cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" - ;; -hpux*) #(vi - cf_xopen_source="-D_HPUX_SOURCE" - ;; -irix[56].*) #(vi - cf_xopen_source="-D_SGI_SOURCE" - cf_XOPEN_SOURCE= - ;; -linux*|gnu*|mint*|k*bsd*-gnu) #(vi +# Check whether --enable-string-hacks or --disable-string-hacks was given. +if test "${enable_string_hacks+set}" = set; then + enableval="$enable_string_hacks" + with_string_hacks=$enableval +else + with_string_hacks=no +fi; +echo "$as_me:3230: result: $with_string_hacks" >&5 +echo "${ECHO_T}$with_string_hacks" >&6 -echo "$as_me:2832: checking if we must define _GNU_SOURCE" >&5 -echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 -if test "${cf_cv_gnu_source+set}" = set; then +if test "x$with_string_hacks" = "xyes"; then + +cat >>confdefs.h <<\EOF +#define USE_STRING_HACKS 1 +EOF + + { echo "$as_me:3239: WARNING: enabling string-hacks to work around bogus compiler/loader warnings" >&5 +echo "$as_me: WARNING: enabling string-hacks to work around bogus compiler/loader warnings" >&2;} + echo "$as_me:3241: checking for strlcat" >&5 +echo $ECHO_N "checking for strlcat... $ECHO_C" >&6 +if test "${ac_cv_func_strlcat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - -cat >conftest.$ac_ext <<_ACEOF -#line 2839 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 3247 "configure" #include "confdefs.h" -#include +#define strlcat autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef strlcat + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strlcat (void); + int -main () +main (void) { -#ifndef _XOPEN_SOURCE -make an error +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_strlcat) || defined (__stub___strlcat) +#error found stub for strlcat #endif + + return strlcat (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:2854: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3278: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2857: \$? = $ac_status" >&5 + echo "$as_me:3281: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2860: \"$ac_try\"") >&5 + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3284: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2863: \$? = $ac_status" >&5 + echo "$as_me:3287: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_gnu_source=no + ac_cv_func_strlcat=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" - cat >conftest.$ac_ext <<_ACEOF -#line 2872 "configure" +ac_cv_func_strlcat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:3297: result: $ac_cv_func_strlcat" >&5 +echo "${ECHO_T}$ac_cv_func_strlcat" >&6 +if test $ac_cv_func_strlcat = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_STRLCAT 1 +EOF + +else + + echo "$as_me:3307: checking for strlcat in -lbsd" >&5 +echo $ECHO_N "checking for strlcat in -lbsd... $ECHO_C" >&6 +if test "${ac_cv_lib_bsd_strlcat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbsd $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 3315 "configure" #include "confdefs.h" -#include -int -main () -{ -#ifdef _XOPEN_SOURCE -make an error +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" #endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strlcat (); +int +main (void) +{ +strlcat (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:2887: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3334: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2890: \$? = $ac_status" >&5 + echo "$as_me:3337: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2893: \"$ac_try\"") >&5 + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3340: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2896: \$? = $ac_status" >&5 + echo "$as_me:3343: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_gnu_source=no + ac_cv_lib_bsd_strlcat=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_gnu_source=yes +ac_cv_lib_bsd_strlcat=no fi -rm -f conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$cf_save" - +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:3354: result: $ac_cv_lib_bsd_strlcat" >&5 +echo "${ECHO_T}$ac_cv_lib_bsd_strlcat" >&6 +if test $ac_cv_lib_bsd_strlcat = yes; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lbsd; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" +for ac_header in bsd/string.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:3377: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3383 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:3387: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:3393: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes fi -echo "$as_me:2911: result: $cf_cv_gnu_source" >&5 -echo "${ECHO_T}$cf_cv_gnu_source" >&6 -test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" - - ;; -mirbsd*) #(vi - # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types - cf_XOPEN_SOURCE= +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:3412: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <>confdefs.h <<\EOF +#define HAVE_STRLCAT 1 +EOF -cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ - sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` +fi -cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ - sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` +fi -echo "$as_me:2933: checking if we should define _POSIX_C_SOURCE" >&5 -echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 -if test "${cf_cv_posix_c_source+set}" = set; then +for ac_func in strlcpy snprintf +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:3433: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + cat >conftest.$ac_ext <<_ACEOF +#line 3439 "configure" +#include "confdefs.h" +#define $ac_func autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef $ac_func -echo "${as_me:-configure}:2939: testing if the symbol is already defined go no further ..." 1>&5 +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (void); - cat >conftest.$ac_ext <<_ACEOF -#line 2942 "configure" -#include "confdefs.h" -#include int -main () +main (void) { -#ifndef _POSIX_C_SOURCE -make an error +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#error found stub for $ac_func #endif + + return $ac_func (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:2957: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3470: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2960: \$? = $ac_status" >&5 + echo "$as_me:3473: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2963: \"$ac_try\"") >&5 + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3476: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2966: \$? = $ac_status" >&5 + echo "$as_me:3479: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_posix_c_source=no + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_want_posix_source=no - case .$cf_POSIX_C_SOURCE in #(vi - .[12]??*) #(vi - cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" - ;; - .2) #(vi - cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" - cf_want_posix_source=yes - ;; - .*) - cf_want_posix_source=yes - ;; - esac - if test "$cf_want_posix_source" = yes ; then - cat >conftest.$ac_ext <<_ACEOF -#line 2987 "configure" +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:3489: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if the POSIX test-macros are already defined... $ECHO_C" >&6 +if test "${cf_cv_posix_visible+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 3508 "configure" #include "confdefs.h" -#include +#include int -main () +main (void) { -#ifdef _POSIX_SOURCE -make an error +#if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ + && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ + && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ + && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) +#error conflicting symbols found #endif + ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3002: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3527: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3005: \$? = $ac_status" >&5 + echo "$as_me:3530: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3008: \"$ac_try\"") >&5 + { (eval echo "$as_me:3533: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3011: \$? = $ac_status" >&5 + echo "$as_me:3536: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - : + cf_cv_posix_visible=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" +cf_cv_posix_visible=yes fi rm -f conftest.$ac_objext conftest.$ac_ext - fi -echo "${as_me:-configure}:3022: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 +fi +echo "$as_me:3547: result: $cf_cv_posix_visible" >&5 +echo "${ECHO_T}$cf_cv_posix_visible" >&6 + +if test "$cf_cv_posix_visible" = no; then - CFLAGS="$cf_trim_CFLAGS" - CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" +cf_XOPEN_SOURCE=600 +cf_POSIX_C_SOURCE=199506L +cf_xopen_source= + +case $host_os in +(aix[4-7]*) + cf_xopen_source="-D_ALL_SOURCE" + ;; +(msys) + cf_XOPEN_SOURCE=600 + ;; +(darwin[0-8].*) + cf_xopen_source="-D_APPLE_C_SOURCE" + ;; +(darwin*) + cf_xopen_source="-D_DARWIN_C_SOURCE" + cf_XOPEN_SOURCE= + ;; +(freebsd*|dragonfly*|midnightbsd*) + # 5.x headers associate + # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L + # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L + cf_POSIX_C_SOURCE=200112L + cf_XOPEN_SOURCE=600 + cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + ;; +(hpux11*) + cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" + ;; +(hpux*) + cf_xopen_source="-D_HPUX_SOURCE" + ;; +(irix[56].*) + cf_xopen_source="-D_SGI_SOURCE" + cf_XOPEN_SOURCE= + ;; +(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) -echo "${as_me:-configure}:3027: testing if the second compile does not leave our definition intact error ..." 1>&5 +cf_gnu_xopen_source=$cf_XOPEN_SOURCE - cat >conftest.$ac_ext <<_ACEOF -#line 3030 "configure" +echo "$as_me:3592: checking if this is the GNU C library" >&5 +echo $ECHO_N "checking if this is the GNU C library... $ECHO_C" >&6 +if test "${cf_cv_gnu_library+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 3599 "configure" #include "confdefs.h" #include int -main () +main (void) { -#ifndef _POSIX_C_SOURCE -make an error -#endif + #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 + return 0; + #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 + return 0; + #else + # error not GNU C library + #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3045: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3618: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3048: \$? = $ac_status" >&5 + echo "$as_me:3621: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3051: \"$ac_try\"") >&5 + { (eval echo "$as_me:3624: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3054: \$? = $ac_status" >&5 + echo "$as_me:3627: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - : + cf_cv_gnu_library=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_posix_c_source=no +cf_cv_gnu_library=no fi rm -f conftest.$ac_objext conftest.$ac_ext - CFLAGS="$cf_save_CFLAGS" - CPPFLAGS="$cf_save_CPPFLAGS" +fi +echo "$as_me:3638: result: $cf_cv_gnu_library" >&5 +echo "${ECHO_T}$cf_cv_gnu_library" >&6 + +if test x$cf_cv_gnu_library = xyes; then + + # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE + # was changed to help a little. newlib incorporated the change about 4 + # years later. + echo "$as_me:3646: checking if _DEFAULT_SOURCE can be used as a basis" >&5 +echo $ECHO_N "checking if _DEFAULT_SOURCE can be used as a basis... $ECHO_C" >&6 +if test "${cf_cv_gnu_library_219+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_save="$CPPFLAGS" + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D_DEFAULT_SOURCE" + + cat >conftest.$ac_ext <<_ACEOF +#line 3658 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) + return 0; + #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) + return 0; + #else + # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old + #endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3677: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3680: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3683: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3686: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_gnu_library_219=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_gnu_library_219=no fi rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" fi -echo "$as_me:3070: result: $cf_cv_posix_c_source" >&5 -echo "${ECHO_T}$cf_cv_posix_c_source" >&6 +echo "$as_me:3698: result: $cf_cv_gnu_library_219" >&5 +echo "${ECHO_T}$cf_cv_gnu_library_219" >&6 -if test "$cf_cv_posix_c_source" != no ; then - CFLAGS="$cf_trim_CFLAGS" - CPPFLAGS="$cf_trim_CPPFLAGS" + if test "x$cf_cv_gnu_library_219" = xyes; then + cf_save="$CPPFLAGS" + echo "$as_me:3703: checking if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE" >&5 +echo $ECHO_N "checking if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_gnu_dftsrc_219+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= -for cf_add_cflags in $cf_cv_posix_c_source +for cf_add_cflags in -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -3116,21 +3754,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -3139,184 +3785,154 @@ done if test -n "$cf_new_cflags" ; then - CFLAGS="$CFLAGS $cf_new_cflags" + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi if test -n "$cf_new_cppflags" ; then - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + fi if test -n "$cf_new_extra_cppflags" ; then - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -fi + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi - ;; -netbsd*) #(vi - cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw - ;; -openbsd[4-9]*) #(vi - # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw - cf_xopen_source="-D_BSD_SOURCE" - cf_XOPEN_SOURCE=600 - ;; -openbsd*) #(vi - # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw - ;; -osf[45]*) #(vi - cf_xopen_source="-D_OSF_SOURCE" - ;; -nto-qnx*) #(vi - cf_xopen_source="-D_QNX_SOURCE" - ;; -sco*) #(vi - # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer - ;; -solaris2.*) #(vi - cf_xopen_source="-D__EXTENSIONS__" - cf_cv_xopen_source=broken - ;; -*) - -echo "$as_me:3184: checking if we should define _XOPEN_SOURCE" >&5 -echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 -if test "${cf_cv_xopen_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -#line 3191 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 3808 "configure" #include "confdefs.h" -#include -#include -#include + #include + #include int -main () +main (void) { -#ifndef _XOPEN_SOURCE -make an error -#endif + #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) + return 0; + #else + # error GNU C library is too old + #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3210: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3828: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3213: \$? = $ac_status" >&5 + echo "$as_me:3831: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3216: \"$ac_try\"") >&5 + { (eval echo "$as_me:3834: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3219: \$? = $ac_status" >&5 + echo "$as_me:3837: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_xopen_source=no + cf_cv_gnu_dftsrc_219=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" - cat >conftest.$ac_ext <<_ACEOF -#line 3228 "configure" -#include "confdefs.h" +cf_cv_gnu_dftsrc_219=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext -#include -#include -#include +fi +echo "$as_me:3848: result: $cf_cv_gnu_dftsrc_219" >&5 +echo "${ECHO_T}$cf_cv_gnu_dftsrc_219" >&6 + test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" + else + cf_cv_gnu_dftsrc_219=maybe + fi + + if test "x$cf_cv_gnu_dftsrc_219" != xyes; then + + echo "$as_me:3857: checking if we must define _GNU_SOURCE" >&5 +echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_gnu_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3864 "configure" +#include "confdefs.h" +#include int -main () +main (void) { -#ifdef _XOPEN_SOURCE -make an error -#endif + #ifndef _XOPEN_SOURCE + #error expected _XOPEN_SOURCE to be defined + #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3247: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3879: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3250: \$? = $ac_status" >&5 + echo "$as_me:3882: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3253: \"$ac_try\"") >&5 + { (eval echo "$as_me:3885: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3256: \$? = $ac_status" >&5 + echo "$as_me:3888: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_xopen_source=no + cf_cv_gnu_source=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_xopen_source=$cf_XOPEN_SOURCE -fi -rm -f conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$cf_save" - -fi -rm -f conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:3271: result: $cf_cv_xopen_source" >&5 -echo "${ECHO_T}$cf_cv_xopen_source" >&6 - -if test "$cf_cv_xopen_source" != no ; then - -CFLAGS=`echo "$CFLAGS" | \ - sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` - -CPPFLAGS=`echo "$CPPFLAGS" | \ - sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` - - cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" +cf_save="$CPPFLAGS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= -for cf_add_cflags in $cf_temp_xopen_source +for cf_add_cflags in -D_GNU_SOURCE do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -3325,21 +3941,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -3348,93 +3972,211 @@ done if test -n "$cf_new_cflags" ; then - CFLAGS="$CFLAGS $cf_new_cflags" + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi if test -n "$cf_new_cppflags" ; then - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + fi if test -n "$cf_new_extra_cppflags" ; then - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -fi + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi -cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE - -cf_save_CFLAGS="$CFLAGS" -cf_save_CPPFLAGS="$CPPFLAGS" - -cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ - sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` - -cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ - sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` - -echo "$as_me:3379: checking if we should define _POSIX_C_SOURCE" >&5 -echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 -if test "${cf_cv_posix_c_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -echo "${as_me:-configure}:3385: testing if the symbol is already defined go no further ..." 1>&5 - - cat >conftest.$ac_ext <<_ACEOF -#line 3388 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 3995 "configure" #include "confdefs.h" #include int -main () +main (void) { -#ifndef _POSIX_C_SOURCE -make an error -#endif + #ifdef _XOPEN_SOURCE + #error expected _XOPEN_SOURCE to be undefined + #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3403: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4010: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3406: \$? = $ac_status" >&5 + echo "$as_me:4013: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3409: \"$ac_try\"") >&5 + { (eval echo "$as_me:4016: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3412: \$? = $ac_status" >&5 + echo "$as_me:4019: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_posix_c_source=no + cf_cv_gnu_source=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_want_posix_source=no - case .$cf_POSIX_C_SOURCE in #(vi - .[12]??*) #(vi - cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" - ;; - .2) #(vi - cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" - cf_want_posix_source=yes - ;; - .*) - cf_want_posix_source=yes - ;; - esac - if test "$cf_want_posix_source" = yes ; then - cat >conftest.$ac_ext <<_ACEOF -#line 3433 "configure" -#include "confdefs.h" -#include -int -main () +cf_cv_gnu_source=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:4034: result: $cf_cv_gnu_source" >&5 +echo "${ECHO_T}$cf_cv_gnu_source" >&6 + + if test "$cf_cv_gnu_source" = yes + then + echo "$as_me:4039: checking if we should also define _DEFAULT_SOURCE" >&5 +echo $ECHO_N "checking if we should also define _DEFAULT_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_default_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D_GNU_SOURCE" + + cat >conftest.$ac_ext <<_ACEOF +#line 4049 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + + #ifdef _DEFAULT_SOURCE + #error expected _DEFAULT_SOURCE to be undefined + #endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4064: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4067: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4070: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4073: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_default_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_default_source=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:4084: result: $cf_cv_default_source" >&5 +echo "${ECHO_T}$cf_cv_default_source" >&6 + if test "$cf_cv_default_source" = yes + then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D_DEFAULT_SOURCE" + + fi + fi + fi + +fi + + ;; +(minix*) + cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... + ;; +(mirbsd*) + # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types + cf_XOPEN_SOURCE= + +if test "$cf_cv_posix_visible" = no; then + +cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE + +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" + +cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +echo "$as_me:4121: checking if we should define _POSIX_C_SOURCE" >&5 +echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_posix_c_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +echo "${as_me:-configure}:4127: testing if the symbol is already defined go no further ..." 1>&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 4130 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + +#ifndef _POSIX_C_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4145: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4148: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4151: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4154: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_posix_c_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_want_posix_source=no + case .$cf_POSIX_C_SOURCE in + (.[12]??*) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + ;; + (.2) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + cf_want_posix_source=yes + ;; + (.*) + cf_want_posix_source=yes + ;; + esac + if test "$cf_want_posix_source" = yes ; then + cat >conftest.$ac_ext <<_ACEOF +#line 4175 "configure" +#include "confdefs.h" +#include +int +main (void) { #ifdef _POSIX_SOURCE @@ -3445,16 +4187,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3448: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4190: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3451: \$? = $ac_status" >&5 + echo "$as_me:4193: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3454: \"$ac_try\"") >&5 + { (eval echo "$as_me:4196: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3457: \$? = $ac_status" >&5 + echo "$as_me:4199: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -3465,19 +4207,22 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "${as_me:-configure}:3468: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 +echo "${as_me:-configure}:4210: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" - CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" + CPPFLAGS="$cf_trim_CPPFLAGS" -echo "${as_me:-configure}:3473: testing if the second compile does not leave our definition intact error ..." 1>&5 + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_cv_posix_c_source" + +echo "${as_me:-configure}:4218: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 3476 "configure" +#line 4221 "configure" #include "confdefs.h" #include int -main () +main (void) { #ifndef _POSIX_C_SOURCE @@ -3488,16 +4233,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3491: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4236: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3494: \$? = $ac_status" >&5 + echo "$as_me:4239: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3497: \"$ac_try\"") >&5 + { (eval echo "$as_me:4242: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3500: \$? = $ac_status" >&5 + echo "$as_me:4245: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -3513,7 +4258,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:3516: result: $cf_cv_posix_c_source" >&5 +echo "$as_me:4261: result: $cf_cv_posix_c_source" >&5 echo "${ECHO_T}$cf_cv_posix_c_source" >&6 if test "$cf_cv_posix_c_source" != no ; then @@ -3528,32 +4273,38 @@ cf_new_extra_cppflags= for cf_add_cflags in $cf_cv_posix_c_source do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -3562,21 +4313,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -3585,60 +4344,205 @@ done if test -n "$cf_new_cflags" ; then - CFLAGS="$CFLAGS $cf_new_cflags" + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi if test -n "$cf_new_cppflags" ; then - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + fi if test -n "$cf_new_extra_cppflags" ; then - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + fi fi +fi # cf_cv_posix_visible + ;; -esac +(netbsd*) + cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw + ;; +(openbsd[4-9]*) + # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw + cf_xopen_source="-D_BSD_SOURCE" + cf_XOPEN_SOURCE=600 + ;; +(openbsd*) + # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw + ;; +(osf[45]*) + cf_xopen_source="-D_OSF_SOURCE" + ;; +(nto-qnx*) + cf_xopen_source="-D_QNX_SOURCE" + ;; +(sco*) + # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer + ;; +(solaris2.*) + cf_xopen_source="-D__EXTENSIONS__" + cf_cv_xopen_source=broken + ;; +(sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) + cf_XOPEN_SOURCE= + cf_POSIX_C_SOURCE= + ;; +(*) -if test -n "$cf_xopen_source" ; then +echo "$as_me:4401: checking if we should define _XOPEN_SOURCE" >&5 +echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_xopen_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 4408 "configure" +#include "confdefs.h" + +#include +#include +#include + +int +main (void) +{ + +#ifndef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4427: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4430: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4433: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4436: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_save="$CPPFLAGS" + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + + cat >conftest.$ac_ext <<_ACEOF +#line 4448 "configure" +#include "confdefs.h" + +#include +#include +#include + +int +main (void) +{ + +#ifdef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4467: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4470: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4473: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4476: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xopen_source=$cf_XOPEN_SOURCE +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:4491: result: $cf_cv_xopen_source" >&5 +echo "${ECHO_T}$cf_cv_xopen_source" >&6 + +if test "$cf_cv_xopen_source" != no ; then + +CFLAGS=`echo "$CFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` + + cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= -for cf_add_cflags in $cf_xopen_source +for cf_add_cflags in $cf_temp_xopen_source do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -3647,21 +4551,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -3670,33 +4582,59 @@ done if test -n "$cf_new_cflags" ; then - CFLAGS="$CFLAGS $cf_new_cflags" + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi if test -n "$cf_new_cppflags" ; then - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + fi if test -n "$cf_new_extra_cppflags" ; then - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + fi fi -if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then - echo "$as_me:3689: checking if _XOPEN_SOURCE really is set" >&5 -echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 3692 "configure" +if test "$cf_cv_posix_visible" = no; then + +cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE + +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" + +cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +echo "$as_me:4621: checking if we should define _POSIX_C_SOURCE" >&5 +echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_posix_c_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +echo "${as_me:-configure}:4627: testing if the symbol is already defined go no further ..." 1>&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 4630 "configure" #include "confdefs.h" -#include +#include int -main () +main (void) { -#ifndef _XOPEN_SOURCE +#ifndef _POSIX_C_SOURCE make an error #endif ; @@ -3704,37 +4642,44 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3707: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4645: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3710: \$? = $ac_status" >&5 + echo "$as_me:4648: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3713: \"$ac_try\"") >&5 + { (eval echo "$as_me:4651: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3716: \$? = $ac_status" >&5 + echo "$as_me:4654: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_XOPEN_SOURCE_set=yes + cf_cv_posix_c_source=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_XOPEN_SOURCE_set=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext - echo "$as_me:3725: result: $cf_XOPEN_SOURCE_set" >&5 -echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6 - if test $cf_XOPEN_SOURCE_set = yes - then +cf_want_posix_source=no + case .$cf_POSIX_C_SOURCE in + (.[12]??*) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + ;; + (.2) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + cf_want_posix_source=yes + ;; + (.*) + cf_want_posix_source=yes + ;; + esac + if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF -#line 3730 "configure" +#line 4675 "configure" #include "confdefs.h" -#include +#include int -main () +main (void) { -#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE +#ifdef _POSIX_SOURCE make an error #endif ; @@ -3742,87 +4687,45 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3745: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4690: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3748: \$? = $ac_status" >&5 + echo "$as_me:4693: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3751: \"$ac_try\"") >&5 + { (eval echo "$as_me:4696: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3754: \$? = $ac_status" >&5 + echo "$as_me:4699: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_XOPEN_SOURCE_set_ok=yes + : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_XOPEN_SOURCE_set_ok=no +cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" fi rm -f conftest.$ac_objext conftest.$ac_ext - if test $cf_XOPEN_SOURCE_set_ok = no - then - { echo "$as_me:3765: WARNING: _XOPEN_SOURCE is lower than requested" >&5 -echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} - fi - else + fi -echo "$as_me:3770: checking if we should define _XOPEN_SOURCE" >&5 -echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 -if test "${cf_cv_xopen_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else +echo "${as_me:-configure}:4710: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 - cat >conftest.$ac_ext <<_ACEOF -#line 3777 "configure" -#include "confdefs.h" + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS" -#include -#include -#include + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_cv_posix_c_source" -int -main () -{ +echo "${as_me:-configure}:4718: testing if the second compile does not leave our definition intact error ..." 1>&5 -#ifndef _XOPEN_SOURCE -make an error -#endif - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:3796: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:3799: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3802: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:3805: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_xopen_source=no -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >conftest.$ac_ext <<_ACEOF -#line 3814 "configure" +#line 4721 "configure" #include "confdefs.h" - -#include -#include #include - int -main () +main (void) { -#ifdef _XOPEN_SOURCE +#ifndef _POSIX_C_SOURCE make an error #endif ; @@ -3830,79 +4733,185 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3833: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4736: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3836: \$? = $ac_status" >&5 + echo "$as_me:4739: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3839: \"$ac_try\"") >&5 + { (eval echo "$as_me:4742: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3842: \$? = $ac_status" >&5 + echo "$as_me:4745: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_xopen_source=no + : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_xopen_source=$cf_XOPEN_SOURCE +cf_cv_posix_c_source=no fi rm -f conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$cf_save" + CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:3857: result: $cf_cv_xopen_source" >&5 -echo "${ECHO_T}$cf_cv_xopen_source" >&6 +echo "$as_me:4761: result: $cf_cv_posix_c_source" >&5 +echo "${ECHO_T}$cf_cv_posix_c_source" >&6 -if test "$cf_cv_xopen_source" != no ; then +if test "$cf_cv_posix_c_source" != no ; then + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS" -CFLAGS=`echo "$CFLAGS" | \ - sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_cv_posix_c_source +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ - sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` - cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +fi + +fi # cf_cv_posix_visible + + ;; +esac + +if test -n "$cf_xopen_source" ; then cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= -for cf_add_cflags in $cf_temp_xopen_source +for cf_add_cflags in $cf_xopen_source do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -3911,21 +4920,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -3933,2715 +4950,2314 @@ esac done if test -n "$cf_new_cflags" ; then + test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 + +echo "${as_me:-configure}:4955: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" - CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then + test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 + +echo "${as_me:-configure}:4965: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then + test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -fi +echo "${as_me:-configure}:4975: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 -fi + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" - fi fi -echo "$as_me:3955: checking for signal global datatype" >&5 -echo $ECHO_N "checking for signal global datatype... $ECHO_C" >&6 -if test "${cf_cv_sig_atomic_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else +fi - for cf_type in \ - "volatile sig_atomic_t" \ - "sig_atomic_t" \ - "int" - do +if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then + echo "$as_me:4985: checking if _XOPEN_SOURCE really is set" >&5 +echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line 3967 "configure" +#line 4988 "configure" #include "confdefs.h" - -#include -#include -#include - -extern $cf_type x; -$cf_type x; -static void handler(int sig) -{ - x = 5; -} +#include int -main () +main (void) { -signal(SIGINT, handler); - x = 1 + +#ifndef _XOPEN_SOURCE +make an error +#endif ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3990: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:5003: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3993: \$? = $ac_status" >&5 + echo "$as_me:5006: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3996: \"$ac_try\"") >&5 + { (eval echo "$as_me:5009: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3999: \$? = $ac_status" >&5 + echo "$as_me:5012: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_sig_atomic_t=$cf_type + cf_XOPEN_SOURCE_set=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_sig_atomic_t=no +cf_XOPEN_SOURCE_set=no fi rm -f conftest.$ac_objext conftest.$ac_ext - test "$cf_cv_sig_atomic_t" != no && break - done - -fi + echo "$as_me:5021: result: $cf_XOPEN_SOURCE_set" >&5 +echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6 + if test $cf_XOPEN_SOURCE_set = yes + then + cat >conftest.$ac_ext <<_ACEOF +#line 5026 "configure" +#include "confdefs.h" +#include +int +main (void) +{ -echo "$as_me:4013: result: $cf_cv_sig_atomic_t" >&5 -echo "${ECHO_T}$cf_cv_sig_atomic_t" >&6 -test "$cf_cv_sig_atomic_t" != no && -cat >>confdefs.h <&5 -echo $ECHO_N "checking if you want to use pkg-config... $ECHO_C" >&6 - -# Check whether --with-pkg-config or --without-pkg-config was given. -if test "${with_pkg_config+set}" = set; then - withval="$with_pkg_config" - cf_pkg_config=$withval +#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5041: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5044: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5047: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5050: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_XOPEN_SOURCE_set_ok=yes else - cf_pkg_config=yes -fi; -echo "$as_me:4030: result: $cf_pkg_config" >&5 -echo "${ECHO_T}$cf_pkg_config" >&6 - -case $cf_pkg_config in #(vi -no) #(vi - PKG_CONFIG=none - ;; -yes) #(vi + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_XOPEN_SOURCE_set_ok=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + if test $cf_XOPEN_SOURCE_set_ok = no + then + { echo "$as_me:5061: WARNING: _XOPEN_SOURCE is lower than requested" >&5 +echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} + fi + else -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -echo "$as_me:4042: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_PKG_CONFIG+set}" = set; then +echo "$as_me:5066: checking if we should define _XOPEN_SOURCE" >&5 +echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_xopen_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - if $as_executable_p "$ac_dir/$ac_word"; then - ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" - echo "$as_me:4059: found $ac_dir/$ac_word" >&5 - break -fi -done - - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - echo "$as_me:4070: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 -else - echo "$as_me:4073: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi + cat >conftest.$ac_ext <<_ACEOF +#line 5073 "configure" +#include "confdefs.h" -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -echo "$as_me:4082: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - if $as_executable_p "$ac_dir/$ac_word"; then - ac_cv_path_ac_pt_PKG_CONFIG="$ac_dir/$ac_word" - echo "$as_me:4099: found $ac_dir/$ac_word" >&5 - break -fi -done +#include +#include +#include - test -z "$ac_cv_path_ac_pt_PKG_CONFIG" && ac_cv_path_ac_pt_PKG_CONFIG="none" - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +int +main (void) +{ -if test -n "$ac_pt_PKG_CONFIG"; then - echo "$as_me:4111: result: $ac_pt_PKG_CONFIG" >&5 -echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +#ifndef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5092: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5095: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5098: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5101: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no else - echo "$as_me:4114: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_save="$CPPFLAGS" - PKG_CONFIG=$ac_pt_PKG_CONFIG -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" - ;; -*) - PKG_CONFIG=$withval - ;; -esac + cat >conftest.$ac_ext <<_ACEOF +#line 5113 "configure" +#include "confdefs.h" -test -z "$PKG_CONFIG" && PKG_CONFIG=none -if test "$PKG_CONFIG" != none ; then +#include +#include +#include -if test "x$prefix" != xNONE; then - cf_path_syntax="$prefix" +int +main (void) +{ + +#ifdef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5132: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5135: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5138: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5141: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no else - cf_path_syntax="$ac_default_prefix" + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xopen_source=$cf_XOPEN_SOURCE fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" -case ".$PKG_CONFIG" in #(vi -.\$\(*\)*|.\'*\'*) #(vi - ;; -..|./*|.\\*) #(vi - ;; -.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX - ;; -.\${*prefix}*|.\${*dir}*) #(vi - eval PKG_CONFIG="$PKG_CONFIG" - case ".$PKG_CONFIG" in #(vi - .NONE/*) - PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` - ;; - esac - ;; #(vi -.no|.NONE/*) - PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` - ;; -*) - { { echo "$as_me:4157: error: expected a pathname, not \"$PKG_CONFIG\"" >&5 -echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG\"" >&2;} - { (exit 1); exit 1; }; } - ;; -esac +fi +rm -f conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:5156: result: $cf_cv_xopen_source" >&5 +echo "${ECHO_T}$cf_cv_xopen_source" >&6 -echo "$as_me:4165: checking if you want to see long compiling messages" >&5 -echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 +if test "$cf_cv_xopen_source" != no ; then -# Check whether --enable-echo or --disable-echo was given. -if test "${enable_echo+set}" = set; then - enableval="$enable_echo" - test "$enableval" != no && enableval=yes - if test "$enableval" != "yes" ; then +CFLAGS=`echo "$CFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` - ECHO_LT='--silent' - ECHO_LD='@echo linking $@;' - RULE_CC='@echo compiling $<' - SHOW_CC='@echo compiling $@' - ECHO_CC='@' +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` - else + cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" - ECHO_LT='' - ECHO_LD='' - RULE_CC='' - SHOW_CC='' - ECHO_CC='' +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= - fi -else - enableval=yes +for cf_add_cflags in $cf_temp_xopen_source +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - ECHO_LT='' - ECHO_LD='' - RULE_CC='' - SHOW_CC='' - ECHO_CC='' + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes -fi; -echo "$as_me:4199: result: $enableval" >&5 -echo "${ECHO_T}$enableval" >&6 + if test $cf_fix_cppflags = yes ; then -echo "$as_me:4202: checking for ncurses wrap-prefix" >&5 -echo $ECHO_N "checking for ncurses wrap-prefix... $ECHO_C" >&6 + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" -# Check whether --with-ncurses-wrap-prefix or --without-ncurses-wrap-prefix was given. -if test "${with_ncurses_wrap_prefix+set}" = set; then - withval="$with_ncurses_wrap_prefix" - NCURSES_WRAP_PREFIX=$withval -else - NCURSES_WRAP_PREFIX=_nc_ -fi; -echo "$as_me:4212: result: $NCURSES_WRAP_PREFIX" >&5 -echo "${ECHO_T}$NCURSES_WRAP_PREFIX" >&6 + continue + elif test "${cf_tst_cflags}" = "\"'" ; then -echo "$as_me:4215: checking if you want to check for wide-character functions" >&5 -echo $ECHO_N "checking if you want to check for wide-character functions... $ECHO_C" >&6 + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" -# Check whether --enable-widec or --disable-widec was given. -if test "${enable_widec+set}" = set; then - enableval="$enable_widec" - test "$enableval" != no && enableval=yes - if test "$enableval" != "yes" ; then - cf_enable_widec=no - else - cf_enable_widec=yes - fi -else - enableval=yes - cf_enable_widec=yes + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` -fi; -echo "$as_me:4232: result: $cf_enable_widec" >&5 -echo "${ECHO_T}$cf_enable_widec" >&6 +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -echo "$as_me:4235: checking for specific curses-directory" >&5 -echo $ECHO_N "checking for specific curses-directory... $ECHO_C" >&6 + ;; + esac -# Check whether --with-curses-dir or --without-curses-dir was given. -if test "${with_curses_dir+set}" = set; then - withval="$with_curses_dir" - cf_cv_curses_dir=$withval -else - cf_cv_curses_dir=no -fi; -echo "$as_me:4245: result: $cf_cv_curses_dir" >&5 -echo "${ECHO_T}$cf_cv_curses_dir" >&6 + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" -if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) -then + ;; + esac + ;; + (*) -if test "x$prefix" != xNONE; then - cf_path_syntax="$prefix" -else - cf_path_syntax="$ac_default_prefix" -fi + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" -case ".$withval" in #(vi -.\$\(*\)*|.\'*\'*) #(vi - ;; -..|./*|.\\*) #(vi - ;; -.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX - ;; -.\${*prefix}*|.\${*dir}*) #(vi - eval withval="$withval" - case ".$withval" in #(vi - .NONE/*) - withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` - ;; - esac - ;; #(vi -.no|.NONE/*) - withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` - ;; -*) - { { echo "$as_me:4276: error: expected a pathname, not \"$withval\"" >&5 -echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} - { (exit 1); exit 1; }; } - ;; + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; esac +done - if test -d "$cf_cv_curses_dir" - then +if test -n "$cf_new_cflags" ; then -if test -n "$cf_cv_curses_dir/include" ; then - for cf_add_incdir in $cf_cv_curses_dir/include - do - while test $cf_add_incdir != /usr/include - do - if test -d $cf_add_incdir - then - cf_have_incdir=no - if test -n "$CFLAGS$CPPFLAGS" ; then - # a loop is needed to ensure we can add subdirs of existing dirs - for cf_test_incdir in $CFLAGS $CPPFLAGS ; do - if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then - cf_have_incdir=yes; break - fi - done - fi + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" - if test "$cf_have_incdir" = no ; then - if test "$cf_add_incdir" = /usr/local/include ; then - if test "$GCC" = yes - then - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF -#line 4309 "configure" +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +fi + + fi +fi +fi # cf_cv_posix_visible + +echo "$as_me:5275: checking for signal global datatype" >&5 +echo $ECHO_N "checking for signal global datatype... $ECHO_C" >&6 +if test "${cf_cv_sig_atomic_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + for cf_type in \ + "volatile sig_atomic_t" \ + "sig_atomic_t" \ + "int" + do + cat >conftest.$ac_ext <<_ACEOF +#line 5287 "configure" #include "confdefs.h" + +#include +#include #include + +extern $cf_type x; +$cf_type x; +static void handler(int sig) +{ + x = 5; +} int -main () +main (void) { -printf("Hello") +signal(SIGINT, handler); + x = 1 ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4321: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:5310: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4324: \$? = $ac_status" >&5 + echo "$as_me:5313: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4327: \"$ac_try\"") >&5 + { (eval echo "$as_me:5316: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4330: \$? = $ac_status" >&5 + echo "$as_me:5319: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - : + cf_cv_sig_atomic_t=$cf_type else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_have_incdir=yes +cf_cv_sig_atomic_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext - CPPFLAGS=$cf_save_CPPFLAGS - fi - fi - fi - - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - -echo "${as_me:-configure}:4347: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - - cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` - test "$cf_top_incdir" = "$cf_add_incdir" && break - cf_add_incdir="$cf_top_incdir" - else - break - fi - fi + test "$cf_cv_sig_atomic_t" != no && break done - done -fi - -if test -n "$cf_cv_curses_dir/lib" ; then - for cf_add_libdir in $cf_cv_curses_dir/lib - do - if test $cf_add_libdir = /usr/lib ; then - : - elif test -d $cf_add_libdir - then - cf_have_libdir=no - if test -n "$LDFLAGS$LIBS" ; then - # a loop is needed to ensure we can add subdirs of existing dirs - for cf_test_libdir in $LDFLAGS $LIBS ; do - if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then - cf_have_libdir=yes; break - fi - done - fi - if test "$cf_have_libdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 - -echo "${as_me:-configure}:4381: testing adding $cf_add_libdir to library-path ..." 1>&5 - - LDFLAGS="-L$cf_add_libdir $LDFLAGS" - fi - fi - done -fi - fi fi -cf_cv_screen=curses +echo "$as_me:5333: result: $cf_cv_sig_atomic_t" >&5 +echo "${ECHO_T}$cf_cv_sig_atomic_t" >&6 +test "$cf_cv_sig_atomic_t" != no && +cat >>confdefs.h <&5 -echo $ECHO_N "checking for specified curses library type... $ECHO_C" >&6 +# Work around breakage on OS X -# Check whether --with-ncursesw or --without-ncursesw was given. -if test "${with_ncursesw+set}" = set; then - withval="$with_ncursesw" - cf_cv_screen=ncursesw +echo "$as_me:5342: checking if SIGWINCH is defined" >&5 +echo $ECHO_N "checking if SIGWINCH is defined... $ECHO_C" >&6 +if test "${cf_cv_define_sigwinch+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else -# Check whether --with-ncurses or --without-ncurses was given. -if test "${with_ncurses+set}" = set; then - withval="$with_ncurses" - cf_cv_screen=ncurses -else + cat >conftest.$ac_ext <<_ACEOF +#line 5349 "configure" +#include "confdefs.h" -# Check whether --with-pdcurses or --without-pdcurses was given. -if test "${with_pdcurses+set}" = set; then - withval="$with_pdcurses" - cf_cv_screen=pdcurses -else +#include +#include -# Check whether --with-curses-colr or --without-curses-colr was given. -if test "${with_curses_colr+set}" = set; then - withval="$with_curses_colr" - cf_cv_screen=curses_colr +int +main (void) +{ +int x = SIGWINCH + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5364: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5367: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5370: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5373: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_define_sigwinch=yes else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cat >conftest.$ac_ext <<_ACEOF +#line 5380 "configure" +#include "confdefs.h" -# Check whether --with-curses-5lib or --without-curses-5lib was given. -if test "${with_curses_5lib+set}" = set; then - withval="$with_curses_5lib" - cf_cv_screen=curses_5lib -fi; -fi; -fi; -fi; -fi; - -echo "$as_me:4431: result: $cf_cv_screen" >&5 -echo "${ECHO_T}$cf_cv_screen" >&6 - -case $cf_cv_screen in #(vi -curses|curses_*) #(vi +#undef _XOPEN_SOURCE +#undef _POSIX_SOURCE +#undef _POSIX_C_SOURCE +#include +#include -echo "$as_me:4437: checking for extra include directories" >&5 -echo $ECHO_N "checking for extra include directories... $ECHO_C" >&6 -if test "${cf_cv_curses_incdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +int +main (void) +{ +int x = SIGWINCH + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5398: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5401: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5404: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5407: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_define_sigwinch=maybe else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_define_sigwinch=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext -cf_cv_curses_incdir=no -case $host_os in #(vi -hpux10.*) #(vi - if test "x$cf_cv_screen" = "xcurses_colr" - then - test -d /usr/include/curses_colr && \ - cf_cv_curses_incdir="-I/usr/include/curses_colr" - fi - ;; -sunos3*|sunos4*) - if test "x$cf_cv_screen" = "xcurses_5lib" - then - test -d /usr/5lib && \ - test -d /usr/5include && \ - cf_cv_curses_incdir="-I/usr/5include" - fi - ;; -esac +fi +rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:4463: result: $cf_cv_curses_incdir" >&5 -echo "${ECHO_T}$cf_cv_curses_incdir" >&6 -test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir" +echo "$as_me:5421: result: $cf_cv_define_sigwinch" >&5 +echo "${ECHO_T}$cf_cv_define_sigwinch" >&6 -echo "$as_me:4467: checking if we have identified curses headers" >&5 -echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 -if test "${cf_cv_ncurses_header+set}" = set; then +if test "$cf_cv_define_sigwinch" = maybe ; then +echo "$as_me:5425: checking for actual SIGWINCH definition" >&5 +echo $ECHO_N "checking for actual SIGWINCH definition... $ECHO_C" >&6 +if test "${cf_cv_fixup_sigwinch+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else -cf_cv_ncurses_header=none -for cf_header in \ - ncurses.h \ - curses.h ncurses/ncurses.h ncurses/curses.h +cf_cv_fixup_sigwinch=unknown +cf_sigwinch=32 +while test $cf_sigwinch != 1 do -cat >conftest.$ac_ext <<_ACEOF -#line 4479 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5436 "configure" #include "confdefs.h" -#include <${cf_header}> + +#undef _XOPEN_SOURCE +#undef _POSIX_SOURCE +#undef _POSIX_C_SOURCE +#include +#include + int -main () +main (void) { -initscr(); tgoto("?", 0,0) + +#if SIGWINCH != $cf_sigwinch +make an error +#endif +int x = SIGWINCH ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4491: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:5458: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4494: \$? = $ac_status" >&5 + echo "$as_me:5461: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4497: \"$ac_try\"") >&5 + { (eval echo "$as_me:5464: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4500: \$? = $ac_status" >&5 + echo "$as_me:5467: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_ncurses_header=$cf_header; break + cf_cv_fixup_sigwinch=$cf_sigwinch + break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext + +cf_sigwinch=`expr $cf_sigwinch - 1` done fi -echo "$as_me:4511: result: $cf_cv_ncurses_header" >&5 -echo "${ECHO_T}$cf_cv_ncurses_header" >&6 +echo "$as_me:5481: result: $cf_cv_fixup_sigwinch" >&5 +echo "${ECHO_T}$cf_cv_fixup_sigwinch" >&6 -if test "$cf_cv_ncurses_header" = none ; then - { { echo "$as_me:4515: error: No curses header-files found" >&5 -echo "$as_me: error: No curses header-files found" >&2;} - { (exit 1); exit 1; }; } + if test "$cf_cv_fixup_sigwinch" != unknown ; then + CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch" + fi fi -# cheat, to get the right #define's for HAVE_NCURSES_H, etc. +# Checks for CODESET support. -for ac_header in $cf_cv_ncurses_header -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:4525: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then +echo "$as_me:5491: checking for nl_langinfo and CODESET" >&5 +echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6 +if test "${am_cv_langinfo_codeset+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4531 "configure" -#include "confdefs.h" -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:4535: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:4541: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_ext -fi -echo "$as_me:4560: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 -if test "${cf_cv_term_header+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -case ${cf_cv_ncurses_header} in #(vi -*/ncurses.h|*/ncursesw.h) #(vi - cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` - ;; -*) - cf_term_header=term.h - ;; -esac - -for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" -do -cat >conftest.$ac_ext <<_ACEOF -#line 4588 "configure" +#line 5497 "configure" #include "confdefs.h" -#include -#include <${cf_cv_ncurses_header:-curses.h}> -#include <$cf_test> - +#include int -main () +main (void) { -int x = auto_left_margin +char* cs = nl_langinfo(CODESET); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:4603: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5509: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4606: \$? = $ac_status" >&5 + echo "$as_me:5512: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4609: \"$ac_try\"") >&5 + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5515: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4612: \$? = $ac_status" >&5 + echo "$as_me:5518: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - - cf_cv_term_header="$cf_test" + am_cv_langinfo_codeset=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - - cf_cv_term_header=unknown - +am_cv_langinfo_codeset=no fi -rm -f conftest.$ac_objext conftest.$ac_ext - test "$cf_cv_term_header" != unknown && break -done +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:4628: result: $cf_cv_term_header" >&5 -echo "${ECHO_T}$cf_cv_term_header" >&6 - -# Set definitions to allow ifdef'ing to accommodate subdirectories - -case $cf_cv_term_header in # (vi -*term.h) +echo "$as_me:5529: result: $am_cv_langinfo_codeset" >&5 +echo "${ECHO_T}$am_cv_langinfo_codeset" >&6 + if test $am_cv_langinfo_codeset = yes; then cat >>confdefs.h <<\EOF -#define HAVE_TERM_H 1 +#define HAVE_LANGINFO_CODESET 1 EOF - ;; -esac + fi -case $cf_cv_term_header in # (vi -ncurses/term.h) #(vi +echo "$as_me:5539: checking if you want to use pkg-config" >&5 +echo $ECHO_N "checking if you want to use pkg-config... $ECHO_C" >&6 -cat >>confdefs.h <<\EOF -#define HAVE_NCURSES_TERM_H 1 -EOF +# Check whether --with-pkg-config or --without-pkg-config was given. +if test "${with_pkg_config+set}" = set; then + withval="$with_pkg_config" + cf_pkg_config=$withval +else + cf_pkg_config=yes +fi; +echo "$as_me:5549: result: $cf_pkg_config" >&5 +echo "${ECHO_T}$cf_pkg_config" >&6 +case $cf_pkg_config in +(no) + PKG_CONFIG=none ;; -ncursesw/term.h) +(yes) -cat >>confdefs.h <<\EOF -#define HAVE_NCURSESW_TERM_H 1 -EOF +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +echo "$as_me:5561: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" + echo "$as_me:5578: found $ac_dir/$ac_word" >&5 + break +fi +done - ;; + ;; esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG -echo "$as_me:4660: checking for ncurses version" >&5 -echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 -if test "${cf_cv_ncurses_version+set}" = set; then +if test -n "$PKG_CONFIG"; then + echo "$as_me:5589: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:5592: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:5601: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_ac_pt_PKG_CONFIG="$ac_dir/$ac_word" + echo "$as_me:5618: found $ac_dir/$ac_word" >&5 + break +fi +done - cf_cv_ncurses_version=no - cf_tempfile=out$$ - rm -f $cf_tempfile - if test "$cross_compiling" = yes; then + test -z "$ac_cv_path_ac_pt_PKG_CONFIG" && ac_cv_path_ac_pt_PKG_CONFIG="none" + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG - # This will not work if the preprocessor splits the line after the - # Autoconf token. The 'unproto' program does that. - cat > conftest.$ac_ext < -#undef Autoconf -#ifdef NCURSES_VERSION -Autoconf NCURSES_VERSION -#else -#ifdef __NCURSES_H -Autoconf "old" -#endif -; -#endif -EOF - cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" - { (eval echo "$as_me:4686: \"$cf_try\"") >&5 - (eval $cf_try) 2>&5 - ac_status=$? - echo "$as_me:4689: \$? = $ac_status" >&5 - (exit $ac_status); } - if test -f conftest.out ; then - cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` - test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" - rm -f conftest.out - fi +if test -n "$ac_pt_PKG_CONFIG"; then + echo "$as_me:5630: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +else + echo "$as_me:5633: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + PKG_CONFIG=$ac_pt_PKG_CONFIG else - cat >conftest.$ac_ext <<_ACEOF -#line 4699 "configure" -#include "confdefs.h" + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi -#include <${cf_cv_ncurses_header:-curses.h}> -#include -int main() -{ - FILE *fp = fopen("$cf_tempfile", "w"); -#ifdef NCURSES_VERSION -# ifdef NCURSES_VERSION_PATCH - fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); -# else - fprintf(fp, "%s\n", NCURSES_VERSION); -# endif -#else -# ifdef __NCURSES_H - fprintf(fp, "old\n"); -# else - make an error -# endif -#endif - ${cf_cv_main_return:-return}(0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:4724: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:4727: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:4729: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:4732: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + ;; +(*) + PKG_CONFIG=$withval + ;; +esac - cf_cv_ncurses_version=`cat $cf_tempfile` +test -z "$PKG_CONFIG" && PKG_CONFIG=none +if test "$PKG_CONFIG" != none ; then + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + cf_path_syntax="$ac_default_prefix" fi - rm -f $cf_tempfile +case ".$PKG_CONFIG" in +(.\$\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[a-zA-Z]:[\\/]*) # OS/2 EMX + ;; +(.\${*prefix}*|.\${*dir}*) + eval PKG_CONFIG="$PKG_CONFIG" + case ".$PKG_CONFIG" in + (.NONE/*) + PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + { { echo "$as_me:5676: error: expected a pathname, not \"$PKG_CONFIG\"" >&5 +echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + +elif test "x$cf_pkg_config" != xno ; then + { echo "$as_me:5683: WARNING: pkg-config is not installed" >&5 +echo "$as_me: WARNING: pkg-config is not installed" >&2;} fi -echo "$as_me:4746: result: $cf_cv_ncurses_version" >&5 -echo "${ECHO_T}$cf_cv_ncurses_version" >&6 -test "$cf_cv_ncurses_version" = no || -cat >>confdefs.h <<\EOF -#define NCURSES 1 -EOF -echo "$as_me:4753: checking if we have identified curses libraries" >&5 -echo $ECHO_N "checking if we have identified curses libraries... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line 4756 "configure" -#include "confdefs.h" -#include <${cf_cv_ncurses_header:-curses.h}> -int -main () -{ -initscr(); tgoto("?", 0,0) - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4768: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:4771: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4774: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:4777: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_result=yes +echo "$as_me:5687: checking if you want to see long compiling messages" >&5 +echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 + +# Check whether --enable-echo or --disable-echo was given. +if test "${enable_echo+set}" = set; then + enableval="$enable_echo" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + + ECHO_LT='--silent' + ECHO_LD='@echo linking $@;' + RULE_CC='@echo compiling $<' + SHOW_CC='@echo compiling $@' + ECHO_CC='@' + + else + + ECHO_LT='' + ECHO_LD='' + RULE_CC='' + SHOW_CC='' + ECHO_CC='' + + fi else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_result=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -echo "$as_me:4786: result: $cf_result" >&5 -echo "${ECHO_T}$cf_result" >&6 + enableval=yes -if test "$cf_result" = no ; then -case $host_os in #(vi -freebsd*) #(vi - echo "$as_me:4792: checking for tgoto in -lmytinfo" >&5 -echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 -if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + ECHO_LT='' + ECHO_LD='' + RULE_CC='' + SHOW_CC='' + ECHO_CC='' + +fi; +echo "$as_me:5721: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 + +echo "$as_me:5724: checking for ncurses wrap-prefix" >&5 +echo $ECHO_N "checking for ncurses wrap-prefix... $ECHO_C" >&6 + +# Check whether --with-ncurses-wrap-prefix or --without-ncurses-wrap-prefix was given. +if test "${with_ncurses_wrap_prefix+set}" = set; then + withval="$with_ncurses_wrap_prefix" + NCURSES_WRAP_PREFIX=$withval else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmytinfo $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 4800 "configure" -#include "confdefs.h" + NCURSES_WRAP_PREFIX=_nc_ +fi; +echo "$as_me:5734: result: $NCURSES_WRAP_PREFIX" >&5 +echo "${ECHO_T}$NCURSES_WRAP_PREFIX" >&6 -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char tgoto (); -int -main () -{ -tgoto (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4819: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:4822: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4825: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:4828: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_mytinfo_tgoto=yes +echo "$as_me:5737: checking if you want to check for wide-character functions" >&5 +echo $ECHO_N "checking if you want to check for wide-character functions... $ECHO_C" >&6 + +# Check whether --enable-widec or --disable-widec was given. +if test "${enable_widec+set}" = set; then + enableval="$enable_widec" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + cf_enable_widec=no + else + cf_enable_widec=yes + fi else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_mytinfo_tgoto=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:4839: result: $ac_cv_lib_mytinfo_tgoto" >&5 -echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 -if test $ac_cv_lib_mytinfo_tgoto = yes; then - LIBS="-lmytinfo $LIBS" -fi + enableval=yes + cf_enable_widec=yes - ;; -hpux10.*) #(vi - # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr - # next (1998), and xcurses "newer" (2000). There is no header file for - # Hcurses; the subdirectory curses_colr has the headers (curses.h and - # term.h) for cur_colr - if test "x$cf_cv_screen" = "xcurses_colr" - then - echo "$as_me:4853: checking for initscr in -lcur_colr" >&5 -echo $ECHO_N "checking for initscr in -lcur_colr... $ECHO_C" >&6 -if test "${ac_cv_lib_cur_colr_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +fi; +echo "$as_me:5754: result: $cf_enable_widec" >&5 +echo "${ECHO_T}$cf_enable_widec" >&6 + +echo "$as_me:5757: checking for specific curses-directory" >&5 +echo $ECHO_N "checking for specific curses-directory... $ECHO_C" >&6 + +# Check whether --with-curses-dir or --without-curses-dir was given. +if test "${with_curses_dir+set}" = set; then + withval="$with_curses_dir" + cf_cv_curses_dir=$withval else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcur_colr $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 4861 "configure" -#include "confdefs.h" + cf_cv_curses_dir=no +fi; +echo "$as_me:5767: result: $cf_cv_curses_dir" >&5 +echo "${ECHO_T}$cf_cv_curses_dir" >&6 -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char initscr (); -int -main () -{ -initscr (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4880: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:4883: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4886: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:4889: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_cur_colr_initscr=yes +if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) +then + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_cur_colr_initscr=no + cf_path_syntax="$ac_default_prefix" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:4900: result: $ac_cv_lib_cur_colr_initscr" >&5 -echo "${ECHO_T}$ac_cv_lib_cur_colr_initscr" >&6 -if test $ac_cv_lib_cur_colr_initscr = yes; then - LIBS="-lcur_colr $LIBS" - ac_cv_func_initscr=yes +case ".$withval" in +(.\$\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[a-zA-Z]:[\\/]*) # OS/2 EMX + ;; +(.\${*prefix}*|.\${*dir}*) + eval withval="$withval" + case ".$withval" in + (.NONE/*) + withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + { { echo "$as_me:5798: error: expected a pathname, not \"$withval\"" >&5 +echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac -else + if test -d "$cf_cv_curses_dir" + then - echo "$as_me:4909: checking for initscr in -lHcurses" >&5 -echo $ECHO_N "checking for initscr in -lHcurses... $ECHO_C" >&6 -if test "${ac_cv_lib_Hcurses_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lHcurses $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 4917 "configure" -#include "confdefs.h" +if test -n "$cf_cv_curses_dir/include" ; then + for cf_add_incdir in $cf_cv_curses_dir/include + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char initscr (); + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-I$cf_add_incdir" + + cat >conftest.$ac_ext <<_ACEOF +#line 5834 "configure" +#include "confdefs.h" +#include int -main () +main (void) { -initscr (); +printf("Hello") ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4936: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5846: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4939: \$? = $ac_status" >&5 + echo "$as_me:5849: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4942: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5852: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4945: \$? = $ac_status" >&5 + echo "$as_me:5855: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_Hcurses_initscr=yes + : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -ac_cv_lib_Hcurses_initscr=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +cf_have_incdir=yes fi -echo "$as_me:4956: result: $ac_cv_lib_Hcurses_initscr" >&5 -echo "${ECHO_T}$ac_cv_lib_Hcurses_initscr" >&6 -if test $ac_cv_lib_Hcurses_initscr = yes; then +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi - # HP's header uses __HP_CURSES, but user claims _HP_CURSES. - LIBS="-lHcurses $LIBS" - CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" - ac_cv_func_initscr=yes + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -fi +echo "${as_me:-configure}:5872: testing adding $cf_add_incdir to include-path ..." 1>&5 -fi + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - fi - ;; -linux*) - case `arch 2>/dev/null` in - x86_64) - if test -d /lib64 - then - -if test -n "/lib64" ; then - for cf_add_libdir in /lib64 - do - if test $cf_add_libdir = /usr/lib ; then - : - elif test -d $cf_add_libdir - then - cf_have_libdir=no - if test -n "$LDFLAGS$LIBS" ; then - # a loop is needed to ensure we can add subdirs of existing dirs - for cf_test_libdir in $LDFLAGS $LIBS ; do - if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then - cf_have_libdir=yes; break - fi - done - fi - if test "$cf_have_libdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 - -echo "${as_me:-configure}:4996: testing adding $cf_add_libdir to library-path ..." 1>&5 - - LDFLAGS="-L$cf_add_libdir $LDFLAGS" - fi - fi + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done done fi - else - -if test -n "/lib" ; then - for cf_add_libdir in /lib - do - if test $cf_add_libdir = /usr/lib ; then - : - elif test -d $cf_add_libdir - then - cf_have_libdir=no - if test -n "$LDFLAGS$LIBS" ; then - # a loop is needed to ensure we can add subdirs of existing dirs - for cf_test_libdir in $LDFLAGS $LIBS ; do - if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then - cf_have_libdir=yes; break - fi - done - fi - if test "$cf_have_libdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 +if test -n "$cf_cv_curses_dir/lib" ; then + for cf_add_libdir in $cf_cv_curses_dir/lib + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -echo "${as_me:-configure}:5025: testing adding $cf_add_libdir to library-path ..." 1>&5 +echo "${as_me:-configure}:5908: testing adding $cf_add_libdir to library-path ..." 1>&5 - LDFLAGS="-L$cf_add_libdir $LDFLAGS" - fi - fi - done + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done fi - fi - ;; - *) + fi +fi -if test -n "/lib" ; then - for cf_add_libdir in /lib - do - if test $cf_add_libdir = /usr/lib ; then - : - elif test -d $cf_add_libdir - then - cf_have_libdir=no - if test -n "$LDFLAGS$LIBS" ; then - # a loop is needed to ensure we can add subdirs of existing dirs - for cf_test_libdir in $LDFLAGS $LIBS ; do - if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then - cf_have_libdir=yes; break - fi - done - fi - if test "$cf_have_libdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 +cf_cv_screen=curses -echo "${as_me:-configure}:5056: testing adding $cf_add_libdir to library-path ..." 1>&5 +echo "$as_me:5921: checking for specified curses library type" >&5 +echo $ECHO_N "checking for specified curses library type... $ECHO_C" >&6 - LDFLAGS="-L$cf_add_libdir $LDFLAGS" - fi - fi - done -fi +# Check whether --with-screen or --without-screen was given. +if test "${with_screen+set}" = set; then + withval="$with_screen" + cf_cv_screen=$withval +else - ;; - esac - ;; -sunos3*|sunos4*) - if test "x$cf_cv_screen" = "xcurses_5lib" - then - if test -d /usr/5lib ; then +# Check whether --with-ncursesw or --without-ncursesw was given. +if test "${with_ncursesw+set}" = set; then + withval="$with_ncursesw" + cf_cv_screen=ncursesw +else -if test -n "/usr/5lib" ; then - for cf_add_libdir in /usr/5lib - do - if test $cf_add_libdir = /usr/lib ; then - : - elif test -d $cf_add_libdir - then - cf_have_libdir=no - if test -n "$LDFLAGS$LIBS" ; then - # a loop is needed to ensure we can add subdirs of existing dirs - for cf_test_libdir in $LDFLAGS $LIBS ; do - if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then - cf_have_libdir=yes; break - fi - done - fi - if test "$cf_have_libdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 +# Check whether --with-ncurses or --without-ncurses was given. +if test "${with_ncurses+set}" = set; then + withval="$with_ncurses" + cf_cv_screen=ncurses +else -echo "${as_me:-configure}:5091: testing adding $cf_add_libdir to library-path ..." 1>&5 +# Check whether --with-pdcurses or --without-pdcurses was given. +if test "${with_pdcurses+set}" = set; then + withval="$with_pdcurses" + cf_cv_screen=pdcurses +else - LDFLAGS="-L$cf_add_libdir $LDFLAGS" - fi - fi - done -fi +# Check whether --with-curses-colr or --without-curses-colr was given. +if test "${with_curses_colr+set}" = set; then + withval="$with_curses_colr" + cf_cv_screen=curses_colr +else - LIBS="-lcurses -ltermcap $LIBS" - fi - fi - ac_cv_func_initscr=yes - ;; -esac +# Check whether --with-curses-5lib or --without-curses-5lib was given. +if test "${with_curses_5lib+set}" = set; then + withval="$with_curses_5lib" + cf_cv_screen=curses_5lib +fi; +fi; +fi; +fi; +fi; +fi; -if test ".$ac_cv_func_initscr" != .yes ; then - cf_save_LIBS="$LIBS" +echo "$as_me:5965: result: $cf_cv_screen" >&5 +echo "${ECHO_T}$cf_cv_screen" >&6 - if test ".${cf_cv_ncurses_version:-no}" != .no - then - cf_check_list="ncurses curses cursesX" - else - cf_check_list="cursesX curses ncurses" - fi +case $cf_cv_screen in +(curses|curses_*) - # Check for library containing tgoto. Do this before curses library - # because it may be needed to link the test-case for initscr. - if test "x$cf_term_lib" = x - then - echo "$as_me:5120: checking for tgoto" >&5 -echo $ECHO_N "checking for tgoto... $ECHO_C" >&6 -if test "${ac_cv_func_tgoto+set}" = set; then +echo "$as_me:5971: checking for extra include directories" >&5 +echo $ECHO_N "checking for extra include directories... $ECHO_C" >&6 +if test "${cf_cv_curses_incdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -#line 5126 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char tgoto (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char tgoto (); -char (*f) (); -int -main () -{ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_tgoto) || defined (__stub___tgoto) -choke me -#else -f = tgoto; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -#endif +cf_cv_curses_incdir=no +case $host_os in +(hpux10.*) + if test "x$cf_cv_screen" = "xcurses_colr" + then + test -d /usr/include/curses_colr && \ + cf_cv_curses_incdir="-I/usr/include/curses_colr" + fi + ;; +(sunos3*|sunos4*) + if test "x$cf_cv_screen" = "xcurses_5lib" + then + test -d /usr/5lib && \ + test -d /usr/5include && \ + cf_cv_curses_incdir="-I/usr/5include" + fi + ;; +esac - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5157: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:5160: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5163: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:5166: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_tgoto=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_func_tgoto=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +echo "$as_me:5997: result: $cf_cv_curses_incdir" >&5 +echo "${ECHO_T}$cf_cv_curses_incdir" >&6 +if test "$cf_cv_curses_incdir" != no +then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_cv_curses_incdir" + fi -echo "$as_me:5176: result: $ac_cv_func_tgoto" >&5 -echo "${ECHO_T}$ac_cv_func_tgoto" >&6 -if test $ac_cv_func_tgoto = yes; then - cf_term_lib=predefined -else - for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown - do - as_ac_Lib=`echo "ac_cv_lib_$cf_term_lib''_tgoto" | $as_tr_sh` -echo "$as_me:5185: checking for tgoto in -l$cf_term_lib" >&5 -echo $ECHO_N "checking for tgoto in -l$cf_term_lib... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Lib+set}\" = set"; then +echo "$as_me:6007: checking if we have identified curses headers" >&5 +echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 +if test "${cf_cv_ncurses_header+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$cf_term_lib $LIBS" + +cf_cv_ncurses_header=none +for cf_header in \ + ncurses.h \ + curses.h ncurses/ncurses.h ncurses/curses.h +do cat >conftest.$ac_ext <<_ACEOF -#line 5193 "configure" +#line 6019 "configure" #include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char tgoto (); +#include <${cf_header}> int -main () +main (void) { -tgoto (); +initscr(); tgoto("?", 0,0) ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5212: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6031: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5215: \$? = $ac_status" >&5 + echo "$as_me:6034: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5218: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6037: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5221: \$? = $ac_status" >&5 + echo "$as_me:6040: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_Lib=yes" + cf_cv_ncurses_header=$cf_header; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -eval "$as_ac_Lib=no" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:5232: result: `eval echo '${'$as_ac_Lib'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 -if test `eval echo '${'$as_ac_Lib'}'` = yes; then - break fi +rm -f conftest.$ac_objext conftest.$ac_ext +done - done +fi +echo "$as_me:6051: result: $cf_cv_ncurses_header" >&5 +echo "${ECHO_T}$cf_cv_ncurses_header" >&6 +if test "$cf_cv_ncurses_header" = none ; then + { { echo "$as_me:6055: error: No curses header-files found" >&5 +echo "$as_me: error: No curses header-files found" >&2;} + { (exit 1); exit 1; }; } fi - fi +# cheat, to get the right #define's for HAVE_NCURSES_H, etc. - # Check for library containing initscr - test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" - if test "x$cf_curs_lib" = x - then - for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown - do - as_ac_Lib=`echo "ac_cv_lib_$cf_curs_lib''_initscr" | $as_tr_sh` -echo "$as_me:5251: checking for initscr in -l$cf_curs_lib" >&5 -echo $ECHO_N "checking for initscr in -l$cf_curs_lib... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Lib+set}\" = set"; then +for ac_header in $cf_cv_ncurses_header +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:6065: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$cf_curs_lib $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 5259 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 6071 "configure" #include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char initscr (); -int -main () -{ -initscr (); - ; +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:6075: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:6081: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:6100: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 +if test "${cf_cv_term_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +case ${cf_cv_ncurses_header} in +(*/ncurses.h|*/ncursesw.h) + cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` + ;; +(*) + cf_term_header=term.h + ;; +esac + +for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" +do +cat >conftest.$ac_ext <<_ACEOF +#line 6128 "configure" +#include "confdefs.h" +#include +#include <${cf_cv_ncurses_header:-curses.h}> +#include <$cf_test> + +int +main (void) +{ +int x = auto_left_margin + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5278: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6143: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5281: \$? = $ac_status" >&5 + echo "$as_me:6146: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5284: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6149: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5287: \$? = $ac_status" >&5 + echo "$as_me:6152: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_Lib=yes" + + cf_cv_term_header="$cf_test" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -eval "$as_ac_Lib=no" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + + cf_cv_term_header=unknown + fi -echo "$as_me:5298: result: `eval echo '${'$as_ac_Lib'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 -if test `eval echo '${'$as_ac_Lib'}'` = yes; then - break +rm -f conftest.$ac_objext conftest.$ac_ext + test "$cf_cv_term_header" != unknown && break +done + fi +echo "$as_me:6168: result: $cf_cv_term_header" >&5 +echo "${ECHO_T}$cf_cv_term_header" >&6 - done +# Set definitions to allow ifdef'ing to accommodate subdirectories + +case $cf_cv_term_header in +(*term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_TERM_H 1 +EOF + + ;; +esac + +case $cf_cv_term_header in +(ncurses/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_TERM_H 1 +EOF + + ;; +(ncursesw/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_TERM_H 1 +EOF + + ;; +esac + +echo "$as_me:6200: checking for ncurses version" >&5 +echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 +if test "${cf_cv_ncurses_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_cv_ncurses_version=no + cf_tempfile=out$$ + rm -f $cf_tempfile + if test "$cross_compiling" = yes; then + + # This will not work if the preprocessor splits the line after the + # Autoconf token. The 'unproto' program does that. + cat > conftest.$ac_ext < +#undef Autoconf +#ifdef NCURSES_VERSION +Autoconf NCURSES_VERSION +#else +#ifdef __NCURSES_H +Autoconf "old" +#endif +; +#endif +EOF + cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" + { (eval echo "$as_me:6226: \"$cf_try\"") >&5 + (eval $cf_try) 2>&5 + ac_status=$? + echo "$as_me:6229: \$? = $ac_status" >&5 + (exit $ac_status); } + if test -f conftest.out ; then + cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` + test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" + rm -f conftest.out fi - test $cf_curs_lib = unknown && { { echo "$as_me:5306: error: no curses library found" >&5 -echo "$as_me: error: no curses library found" >&2;} - { (exit 1); exit 1; }; } - LIBS="-l$cf_curs_lib $cf_save_LIBS" - if test "$cf_term_lib" = unknown ; then - echo "$as_me:5312: checking if we can link with $cf_curs_lib library" >&5 -echo $ECHO_N "checking if we can link with $cf_curs_lib library... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 5315 "configure" +else + cat >conftest.$ac_ext <<_ACEOF +#line 6239 "configure" #include "confdefs.h" + #include <${cf_cv_ncurses_header:-curses.h}> -int -main () +#include +int main(void) { -initscr() - ; - return 0; + FILE *fp = fopen("$cf_tempfile", "w"); +#ifdef NCURSES_VERSION +# ifdef NCURSES_VERSION_PATCH + fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); +# else + fprintf(fp, "%s\n", NCURSES_VERSION); +# endif +#else +# ifdef __NCURSES_H + fprintf(fp, "old\n"); +# else + make an error +# endif +#endif + ${cf_cv_main_return:-return}(0); } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5327: \"$ac_link\"") >&5 +rm -f conftest$ac_exeext +if { (eval echo "$as_me:6264: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5330: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5333: \"$ac_try\"") >&5 + echo "$as_me:6267: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:6269: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5336: \$? = $ac_status" >&5 + echo "$as_me:6272: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_result=yes + + cf_cv_ncurses_version=`cat $cf_tempfile` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_result=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - echo "$as_me:5345: result: $cf_result" >&5 -echo "${ECHO_T}$cf_result" >&6 - test $cf_result = no && { { echo "$as_me:5347: error: Cannot link curses library" >&5 -echo "$as_me: error: Cannot link curses library" >&2;} - { (exit 1); exit 1; }; } - elif test "$cf_curs_lib" = "$cf_term_lib" ; then - : - elif test "$cf_term_lib" != predefined ; then - echo "$as_me:5353: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 -echo $ECHO_N "checking if we need both $cf_curs_lib and $cf_term_lib libraries... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 5356 "configure" +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + rm -f $cf_tempfile + +fi +echo "$as_me:6286: result: $cf_cv_ncurses_version" >&5 +echo "${ECHO_T}$cf_cv_ncurses_version" >&6 +test "$cf_cv_ncurses_version" = no || +cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +echo "$as_me:6293: checking if we have identified curses libraries" >&5 +echo $ECHO_N "checking if we have identified curses libraries... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line 6296 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { -initscr(); tgoto((char *)0, 0, 0); +initscr(); tgoto("?", 0,0) ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5368: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6308: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5371: \$? = $ac_status" >&5 + echo "$as_me:6311: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5374: \"$ac_try\"") >&5 + { (eval echo "$as_me:6314: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5377: \$? = $ac_status" >&5 + echo "$as_me:6317: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_result=no + cf_result=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 +cf_result=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +echo "$as_me:6326: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 - LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -#line 5386 "configure" +if test "$cf_result" = no ; then +case $host_os in +(freebsd*) + echo "$as_me:6332: checking for tgoto in -lmytinfo" >&5 +echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 +if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmytinfo $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 6340 "configure" #include "confdefs.h" -#include <${cf_cv_ncurses_header:-curses.h}> + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto (); int -main () +main (void) { -initscr() +tgoto (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5398: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6359: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5401: \$? = $ac_status" >&5 + echo "$as_me:6362: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5404: \"$ac_try\"") >&5 + { (eval echo "$as_me:6365: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5407: \$? = $ac_status" >&5 + echo "$as_me:6368: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_result=yes + ac_cv_lib_mytinfo_tgoto=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_result=error -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - +ac_cv_lib_mytinfo_tgoto=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - echo "$as_me:5419: result: $cf_result" >&5 -echo "${ECHO_T}$cf_result" >&6 - fi -fi +LIBS=$ac_check_lib_save_LIBS fi +echo "$as_me:6379: result: $ac_cv_lib_mytinfo_tgoto" >&5 +echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 +if test $ac_cv_lib_mytinfo_tgoto = yes; then - ;; -ncurses) #(vi - -cf_ncuconfig_root=ncurses +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lmytinfo; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" -echo "Looking for ${cf_ncuconfig_root}-config" +fi -if test -n "$ac_tool_prefix"; then - for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:5437: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$NCURSES_CONFIG"; then - ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog" -echo "$as_me:5452: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG -if test -n "$NCURSES_CONFIG"; then - echo "$as_me:5460: result: $NCURSES_CONFIG" >&5 -echo "${ECHO_T}$NCURSES_CONFIG" >&6 -else - echo "$as_me:5463: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$NCURSES_CONFIG" && break - done -fi -if test -z "$NCURSES_CONFIG"; then - ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG - for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:5476: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_NCURSES_CONFIG"; then - ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog" -echo "$as_me:5491: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG -if test -n "$ac_ct_NCURSES_CONFIG"; then - echo "$as_me:5499: result: $ac_ct_NCURSES_CONFIG" >&5 -echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6 -else - echo "$as_me:5502: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_NCURSES_CONFIG" && break -done -test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none" - - NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG -fi - -if test "$NCURSES_CONFIG" != none ; then - -CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" -LIBS="`$NCURSES_CONFIG --libs` $LIBS" - -# even with config script, some packages use no-override for curses.h - -echo "$as_me:5520: checking if we have identified curses headers" >&5 -echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 -if test "${cf_cv_ncurses_header+set}" = set; then + ;; +(hpux10.*) + # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr + # next (1998), and xcurses "newer" (2000). There is no header file for + # Hcurses; the subdirectory curses_colr has the headers (curses.h and + # term.h) for cur_colr + if test "x$cf_cv_screen" = "xcurses_colr" + then + echo "$as_me:6409: checking for initscr in -lcur_colr" >&5 +echo $ECHO_N "checking for initscr in -lcur_colr... $ECHO_C" >&6 +if test "${ac_cv_lib_cur_colr_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - -cf_cv_ncurses_header=none -for cf_header in \ - ncurses/ncurses.h \ - ncurses/curses.h \ - ncurses.h \ - curses.h -do + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcur_colr $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 5534 "configure" +#line 6417 "configure" #include "confdefs.h" -#include <${cf_header}> + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); int -main () +main (void) { -initscr(); tgoto("?", 0,0) +initscr (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:5546: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6436: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5549: \$? = $ac_status" >&5 + echo "$as_me:6439: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5552: \"$ac_try\"") >&5 + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6442: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5555: \$? = $ac_status" >&5 + echo "$as_me:6445: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_ncurses_header=$cf_header; break + ac_cv_lib_cur_colr_initscr=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 +ac_cv_lib_cur_colr_initscr=no fi -rm -f conftest.$ac_objext conftest.$ac_ext -done - -fi -echo "$as_me:5566: result: $cf_cv_ncurses_header" >&5 -echo "${ECHO_T}$cf_cv_ncurses_header" >&6 - -if test "$cf_cv_ncurses_header" = none ; then - { { echo "$as_me:5570: error: No curses header-files found" >&5 -echo "$as_me: error: No curses header-files found" >&2;} - { (exit 1); exit 1; }; } -fi - -# cheat, to get the right #define's for HAVE_NCURSES_H, etc. - -for ac_header in $cf_cv_ncurses_header -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:5580: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 5586 "configure" -#include "confdefs.h" -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:5590: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:5596: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:5615: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}$ac_cv_lib_cur_colr_initscr" >&6 +if test $ac_cv_lib_cur_colr_initscr = yes; then -fi +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lcur_colr; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" done +LIBS="$cf_add_libs" -cat >>confdefs.h <<\EOF -#define NCURSES 1 -EOF - -cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - -cat >>confdefs.h <conftest.$ac_ext <<_ACEOF -#line 5668 "configure" + echo "$as_me:6480: checking for initscr in -lHcurses" >&5 +echo $ECHO_N "checking for initscr in -lHcurses... $ECHO_C" >&6 +if test "${ac_cv_lib_Hcurses_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lHcurses $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 6488 "configure" #include "confdefs.h" -#include + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); int -main () +main (void) { -printf("Hello") +initscr (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:5680: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6507: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5683: \$? = $ac_status" >&5 + echo "$as_me:6510: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5686: \"$ac_try\"") >&5 + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6513: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5689: \$? = $ac_status" >&5 + echo "$as_me:6516: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - : + ac_cv_lib_Hcurses_initscr=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_have_incdir=yes +ac_cv_lib_Hcurses_initscr=no fi -rm -f conftest.$ac_objext conftest.$ac_ext - CPPFLAGS=$cf_save_CPPFLAGS - fi - fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:6527: result: $ac_cv_lib_Hcurses_initscr" >&5 +echo "${ECHO_T}$ac_cv_lib_Hcurses_initscr" >&6 +if test $ac_cv_lib_Hcurses_initscr = yes; then + + # HP's header uses __HP_CURSES, but user claims _HP_CURSES. + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lHcurses; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D__HP_CURSES -D_HP_CURSES" -echo "${as_me:-configure}:5706: testing adding $cf_add_incdir to include-path ..." 1>&5 + ac_cv_func_initscr=yes - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" +fi - cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` - test "$cf_top_incdir" = "$cf_add_incdir" && break - cf_add_incdir="$cf_top_incdir" - else - break - fi - fi - done - done fi -} - -echo "$as_me:5723: checking for $cf_ncuhdr_root header in include-path" >&5 -echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6 -if test "${cf_cv_ncurses_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else + fi + ;; +(linux*) + case `arch 2>/dev/null` in + (x86_64) + if test -d /lib64 + then - cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" - ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" - for cf_header in $cf_header_list +if test -n "/lib64" ; then + for cf_add_libdir in /lib64 do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 - cat >conftest.$ac_ext <<_ACEOF -#line 5735 "configure" -#include "confdefs.h" - -#include <$cf_header> -int -main () -{ +echo "${as_me:-configure}:6585: testing adding $cf_add_libdir to library-path ..." 1>&5 -#ifdef NCURSES_VERSION + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi -printf("%s\n", NCURSES_VERSION); -#else -#ifdef __NCURSES_H -printf("old\n"); -#else - make an error -#endif -#endif + else - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:5759: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:5762: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5765: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:5768: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_ncurses_h=$cf_header +if test -n "/lib" ; then + for cf_add_libdir in /lib + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_cv_ncurses_h=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext +echo "${as_me:-configure}:6614: testing adding $cf_add_libdir to library-path ..." 1>&5 - test "$cf_cv_ncurses_h" != no && break + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi done - fi -echo "$as_me:5783: result: $cf_cv_ncurses_h" >&5 -echo "${ECHO_T}$cf_cv_ncurses_h" >&6 - -if test "$cf_cv_ncurses_h" != no ; then - cf_cv_ncurses_header=$cf_cv_ncurses_h -else -echo "$as_me:5790: checking for $cf_ncuhdr_root include-path" >&5 -echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6 -if test "${cf_cv_ncurses_h2+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - test -n "$verbose" && echo - -cf_search= + fi + ;; + (*) -# collect the current set of include-directories from compiler flags -cf_header_path_list="" -if test -n "${CFLAGS}${CPPFLAGS}" ; then - for cf_header_path in $CPPFLAGS $CFLAGS +if test -n "/lib" ; then + for cf_add_libdir in /lib do - case $cf_header_path in #(vi - -I*) - cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -test "x$cf_header_path" != "xNONE" && \ -test -d "$cf_header_path" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" - test -d $cf_header_path/include && cf_search="$cf_search $cf_header_path/include" - test -d $cf_header_path/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root" - test -d $cf_header_path/include/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root/include" - test -d $cf_header_path/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include" - test -d $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -} +echo "${as_me:-configure}:6645: testing adding $cf_add_libdir to library-path ..." 1>&5 - cf_header_path_list="$cf_header_path_list $cf_search" - ;; - esac + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi done fi -# add the variations for the package we are looking for - -cf_search= + ;; + esac + ;; +(sunos3*|sunos4*) + if test "x$cf_cv_screen" = "xcurses_5lib" + then + if test -d /usr/5lib ; then -test "x/usr" != "x$prefix" && \ -test -d "/usr" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr" - test -d /usr/include && cf_search="$cf_search /usr/include" - test -d /usr/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/include/$cf_ncuhdr_root" - test -d /usr/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/include/$cf_ncuhdr_root/include" - test -d /usr/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/$cf_ncuhdr_root/include" - test -d /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -} +if test -n "/usr/5lib" ; then + for cf_add_libdir in /usr/5lib + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -test "x$prefix" != "xNONE" && \ -test -d "$prefix" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $prefix" - test -d $prefix/include && cf_search="$cf_search $prefix/include" - test -d $prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root" - test -d $prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include" - test -d $prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include" - test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -} +echo "${as_me:-configure}:6680: testing adding $cf_add_libdir to library-path ..." 1>&5 -test "x/usr/local" != "x$prefix" && \ -test -d "/usr/local" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr/local" - test -d /usr/local/include && cf_search="$cf_search /usr/local/include" - test -d /usr/local/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root" - test -d /usr/local/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root/include" - test -d /usr/local/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include" - test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -} + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi -test "x/opt" != "x$prefix" && \ -test -d "/opt" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /opt" - test -d /opt/include && cf_search="$cf_search /opt/include" - test -d /opt/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/include/$cf_ncuhdr_root" - test -d /opt/include/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/include/$cf_ncuhdr_root/include" - test -d /opt/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/$cf_ncuhdr_root/include" - test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -} +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lcurses -ltermcap; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" -test "x$HOME" != "x$prefix" && \ -test -d "$HOME" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under $HOME" - test -d $HOME/include && cf_search="$cf_search $HOME/include" - test -d $HOME/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root" - test -d $HOME/include/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root/include" - test -d $HOME/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include" - test -d $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -} + fi + fi + ac_cv_func_initscr=yes + ;; +esac -test "$includedir" != NONE && \ -test "$includedir" != "/usr/include" && \ -test -d "$includedir" && { - test -d $includedir && cf_search="$cf_search $includedir" - test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root" -} +if test ".$ac_cv_func_initscr" != .yes ; then + cf_save_LIBS="$LIBS" -test "$oldincludedir" != NONE && \ -test "$oldincludedir" != "/usr/include" && \ -test -d "$oldincludedir" && { - test -d $oldincludedir && cf_search="$cf_search $oldincludedir" - test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root" -} + if test ".${cf_cv_ncurses_version:-no}" != .no + then + cf_check_list="ncurses curses cursesX" + else + cf_check_list="cursesX curses ncurses" + fi -cf_search="$cf_search $cf_header_path_list" + # Check for library containing tgoto. Do this before curses library + # because it may be needed to link the test-case for initscr. + if test "x$cf_term_lib" = x + then + echo "$as_me:6724: checking for tgoto" >&5 +echo $ECHO_N "checking for tgoto... $ECHO_C" >&6 +if test "${ac_cv_func_tgoto+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6730 "configure" +#include "confdefs.h" +#define tgoto autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef tgoto - test -n "$verbose" && echo search path $cf_search - cf_save2_CPPFLAGS="$CPPFLAGS" - for cf_incdir in $cf_search - do +#ifdef __cplusplus +extern "C" +#endif -if test -n "$cf_incdir" ; then - for cf_add_incdir in $cf_incdir - do - while test $cf_add_incdir != /usr/include - do - if test -d $cf_add_incdir - then - cf_have_incdir=no - if test -n "$CFLAGS$CPPFLAGS" ; then - # a loop is needed to ensure we can add subdirs of existing dirs - for cf_test_incdir in $CFLAGS $CPPFLAGS ; do - if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then - cf_have_incdir=yes; break - fi - done - fi +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto (void); - if test "$cf_have_incdir" = no ; then - if test "$cf_add_incdir" = /usr/local/include ; then - if test "$GCC" = yes - then - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF -#line 5930 "configure" -#include "confdefs.h" -#include int -main () +main (void) { -printf("Hello") + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_tgoto) || defined (__stub___tgoto) +#error found stub for tgoto +#endif + + return tgoto (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:5942: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6761: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5945: \$? = $ac_status" >&5 + echo "$as_me:6764: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5948: \"$ac_try\"") >&5 + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6767: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5951: \$? = $ac_status" >&5 + echo "$as_me:6770: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - : + ac_cv_func_tgoto=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_have_incdir=yes +ac_cv_func_tgoto=no fi -rm -f conftest.$ac_objext conftest.$ac_ext - CPPFLAGS=$cf_save_CPPFLAGS - fi - fi - fi - - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - -echo "${as_me:-configure}:5968: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - - cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` - test "$cf_top_incdir" = "$cf_add_incdir" && break - cf_add_incdir="$cf_top_incdir" - else - break - fi - fi - done - done +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi +echo "$as_me:6780: result: $ac_cv_func_tgoto" >&5 +echo "${ECHO_T}$ac_cv_func_tgoto" >&6 +if test $ac_cv_func_tgoto = yes; then + cf_term_lib=predefined +else - for cf_header in \ - ncurses.h \ - curses.h - do - - cat >conftest.$ac_ext <<_ACEOF -#line 5989 "configure" + for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown + do + as_ac_Lib=`echo "ac_cv_lib_$cf_term_lib''_tgoto" | $as_tr_sh` +echo "$as_me:6789: checking for tgoto in -l$cf_term_lib" >&5 +echo $ECHO_N "checking for tgoto in -l$cf_term_lib... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$cf_term_lib $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 6797 "configure" #include "confdefs.h" -#include <$cf_header> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto (); int -main () +main (void) { - -#ifdef NCURSES_VERSION - -printf("%s\n", NCURSES_VERSION); -#else -#ifdef __NCURSES_H -printf("old\n"); -#else - make an error -#endif -#endif - +tgoto (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:6013: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6816: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6016: \$? = $ac_status" >&5 + echo "$as_me:6819: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6019: \"$ac_try\"") >&5 + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6822: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6022: \$? = $ac_status" >&5 + echo "$as_me:6825: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_ncurses_h2=$cf_header - + eval "$as_ac_Lib=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_ncurses_h2=no +eval "$as_ac_Lib=no" fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:6836: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then - if test "$cf_cv_ncurses_h2" != no ; then - cf_cv_ncurses_h2=$cf_incdir/$cf_header - test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&6 - break - fi - test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&6 - done - CPPFLAGS="$cf_save2_CPPFLAGS" - test "$cf_cv_ncurses_h2" != no && break - done - test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:6043: error: not found" >&5 -echo "$as_me: error: not found" >&2;} - { (exit 1); exit 1; }; } + : ${cf_nculib_root:=$cf_term_lib} + break fi -echo "$as_me:6048: result: $cf_cv_ncurses_h2" >&5 -echo "${ECHO_T}$cf_cv_ncurses_h2" >&6 - cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'` - cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` - if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then - cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header - fi + done -if test -n "$cf_1st_incdir" ; then - for cf_add_incdir in $cf_1st_incdir - do - while test $cf_add_incdir != /usr/include - do - if test -d $cf_add_incdir - then - cf_have_incdir=no - if test -n "$CFLAGS$CPPFLAGS" ; then - # a loop is needed to ensure we can add subdirs of existing dirs - for cf_test_incdir in $CFLAGS $CPPFLAGS ; do - if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then - cf_have_incdir=yes; break - fi - done - fi +fi - if test "$cf_have_incdir" = no ; then - if test "$cf_add_incdir" = /usr/local/include ; then - if test "$GCC" = yes - then - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF -#line 6081 "configure" + fi + + # Check for library containing initscr + test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" + if test "x$cf_curs_lib" = x + then + for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown + do + LIBS="-l$cf_curs_lib $cf_save_LIBS" + if test "$cf_term_lib" = unknown || test "$cf_term_lib" = "$cf_curs_lib" ; then + echo "$as_me:6859: checking if we can link with $cf_curs_lib library" >&5 +echo $ECHO_N "checking if we can link with $cf_curs_lib library... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 6862 "configure" #include "confdefs.h" -#include +#include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { -printf("Hello") +initscr() ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:6093: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6874: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6096: \$? = $ac_status" >&5 + echo "$as_me:6877: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6099: \"$ac_try\"") >&5 + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6880: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6102: \$? = $ac_status" >&5 + echo "$as_me:6883: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - : + cf_result=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_have_incdir=yes +cf_result=no fi -rm -f conftest.$ac_objext conftest.$ac_ext - CPPFLAGS=$cf_save_CPPFLAGS - fi - fi - fi - - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - -echo "${as_me:-configure}:6119: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:6892: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + test $cf_result = yes && break + elif test "$cf_curs_lib" = "$cf_term_lib" ; then + cf_result=no + elif test "$cf_term_lib" != predefined ; then + echo "$as_me:6898: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 +echo $ECHO_N "checking if we need both $cf_curs_lib and $cf_term_lib libraries... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 6901 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main (void) +{ +initscr(); tgoto((char *)0, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6913: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6916: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6919: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6922: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 - cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` - test "$cf_top_incdir" = "$cf_add_incdir" && break - cf_add_incdir="$cf_top_incdir" - else - break - fi - fi - done - done + LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 6931 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main (void) +{ +initscr() + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6943: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6946: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6949: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6952: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=error fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi - -# Set definitions to allow ifdef'ing for ncurses.h - -case $cf_cv_ncurses_header in # (vi -*ncurses.h) - -cat >>confdefs.h <<\EOF -#define HAVE_NCURSES_H 1 -EOF - - ;; -esac - -case $cf_cv_ncurses_header in # (vi -ncurses/curses.h|ncurses/ncurses.h) - -cat >>confdefs.h <<\EOF -#define HAVE_NCURSES_NCURSES_H 1 -EOF - - ;; -ncursesw/curses.h|ncursesw/ncurses.h) - -cat >>confdefs.h <<\EOF -#define HAVE_NCURSESW_NCURSES_H 1 -EOF +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:6964: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + test $cf_result != error && break + fi + done + fi + test $cf_curs_lib = unknown && { { echo "$as_me:6970: error: no curses library found" >&5 +echo "$as_me: error: no curses library found" >&2;} + { (exit 1); exit 1; }; } +fi +fi ;; -esac +(ncursesw*) -echo "$as_me:6165: checking for terminfo header" >&5 -echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 -if test "${cf_cv_term_header+set}" = set; then +echo "$as_me:6979: checking for multibyte character support" >&5 +echo $ECHO_N "checking for multibyte character support... $ECHO_C" >&6 +if test "${cf_cv_utf8_lib+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else -case ${cf_cv_ncurses_header} in #(vi -*/ncurses.h|*/ncursesw.h) #(vi - cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` - ;; -*) - cf_term_header=term.h - ;; -esac - -for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" -do -cat >conftest.$ac_ext <<_ACEOF -#line 6183 "configure" + cf_save_LIBS="$LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 6987 "configure" #include "confdefs.h" -#include -#include <${cf_cv_ncurses_header:-curses.h}> -#include <$cf_test> +#include int -main () +main (void) { -int x = auto_left_margin +putwc(0,0); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:6198: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:7000: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6201: \$? = $ac_status" >&5 + echo "$as_me:7003: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6204: \"$ac_try\"") >&5 + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:7006: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6207: \$? = $ac_status" >&5 + echo "$as_me:7009: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - - cf_cv_term_header="$cf_test" + cf_cv_utf8_lib=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - cf_cv_term_header=unknown +# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these +# will be set on completion of the AC_TRY_LINK below. +cf_cv_header_path_utf8= +cf_cv_library_path_utf8= -fi -rm -f conftest.$ac_objext conftest.$ac_ext - test "$cf_cv_term_header" != unknown && break -done - -fi -echo "$as_me:6223: result: $cf_cv_term_header" >&5 -echo "${ECHO_T}$cf_cv_term_header" >&6 - -# Set definitions to allow ifdef'ing to accommodate subdirectories - -case $cf_cv_term_header in # (vi -*term.h) - -cat >>confdefs.h <<\EOF -#define HAVE_TERM_H 1 -EOF - - ;; -esac - -case $cf_cv_term_header in # (vi -ncurses/term.h) #(vi - -cat >>confdefs.h <<\EOF -#define HAVE_NCURSES_TERM_H 1 -EOF - - ;; -ncursesw/term.h) - -cat >>confdefs.h <<\EOF -#define HAVE_NCURSESW_TERM_H 1 -EOF - - ;; -esac - -# some applications need this, but should check for NCURSES_VERSION - -cat >>confdefs.h <<\EOF -#define NCURSES 1 -EOF - -echo "$as_me:6261: checking for ncurses version" >&5 -echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 -if test "${cf_cv_ncurses_version+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else +echo "${as_me:-configure}:7021: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5 - cf_cv_ncurses_version=no - cf_tempfile=out$$ - rm -f $cf_tempfile - if test "$cross_compiling" = yes; then - - # This will not work if the preprocessor splits the line after the - # Autoconf token. The 'unproto' program does that. - cat > conftest.$ac_ext < -#undef Autoconf -#ifdef NCURSES_VERSION -Autoconf NCURSES_VERSION -#else -#ifdef __NCURSES_H -Autoconf "old" -#endif -; -#endif -EOF - cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" - { (eval echo "$as_me:6287: \"$cf_try\"") >&5 - (eval $cf_try) 2>&5 - ac_status=$? - echo "$as_me:6290: \$? = $ac_status" >&5 - (exit $ac_status); } - if test -f conftest.out ; then - cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` - test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" - rm -f conftest.out - fi +cf_save_LIBS="$LIBS" -else - cat >conftest.$ac_ext <<_ACEOF -#line 6300 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 7026 "configure" #include "confdefs.h" -#include <${cf_cv_ncurses_header:-curses.h}> -#include -int main() +#include +int +main (void) { - FILE *fp = fopen("$cf_tempfile", "w"); -#ifdef NCURSES_VERSION -# ifdef NCURSES_VERSION_PATCH - fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); -# else - fprintf(fp, "%s\n", NCURSES_VERSION); -# endif -#else -# ifdef __NCURSES_H - fprintf(fp, "old\n"); -# else - make an error -# endif -#endif - ${cf_cv_main_return:-return}(0); +putwc(0,0); + ; + return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:6325: \"$ac_link\"") >&5 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:7039: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6328: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:6330: \"$ac_try\"") >&5 + echo "$as_me:7042: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:7045: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6333: \$? = $ac_status" >&5 + echo "$as_me:7048: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_ncurses_version=`cat $cf_tempfile` + cf_cv_find_linkage_utf8=yes + cf_cv_header_path_utf8=/usr/include + cf_cv_library_path_utf8=/usr/lib + else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - rm -f $cf_tempfile -fi -echo "$as_me:6347: result: $cf_cv_ncurses_version" >&5 -echo "${ECHO_T}$cf_cv_ncurses_version" >&6 -test "$cf_cv_ncurses_version" = no || -cat >>confdefs.h <<\EOF -#define NCURSES 1 -EOF +LIBS="-lutf8 $cf_save_LIBS" -cf_nculib_root=ncurses - # This works, except for the special case where we find gpm, but - # ncurses is in a nonstandard location via $LIBS, and we really want - # to link gpm. -cf_ncurses_LIBS="" -cf_ncurses_SAVE="$LIBS" -echo "$as_me:6360: checking for Gpm_Open in -lgpm" >&5 -echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 -if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgpm $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 6368 "configure" +#line 7062 "configure" #include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char Gpm_Open (); +#include int -main () +main (void) { -Gpm_Open (); +putwc(0,0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6387: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7075: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6390: \$? = $ac_status" >&5 + echo "$as_me:7078: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6393: \"$ac_try\"") >&5 + { (eval echo "$as_me:7081: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6396: \$? = $ac_status" >&5 + echo "$as_me:7084: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_gpm_Gpm_Open=yes + + cf_cv_find_linkage_utf8=yes + cf_cv_header_path_utf8=/usr/include + cf_cv_library_path_utf8=/usr/lib + cf_cv_library_file_utf8="-lutf8" + else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -ac_cv_lib_gpm_Gpm_Open=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + + cf_cv_find_linkage_utf8=no + LIBS="$cf_save_LIBS" + + test -n "$verbose" && echo " find linkage for utf8 library" 1>&6 + +echo "${as_me:-configure}:7101: testing find linkage for utf8 library ..." 1>&5 + +echo "${as_me:-configure}:7103: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5 + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_test_CPPFLAGS="$CPPFLAGS" + +cf_search= + +# collect the current set of include-directories from compiler flags +cf_header_path_list="" +if test -n "${CFLAGS}${CPPFLAGS}" ; then + for cf_header_path in $CPPFLAGS $CFLAGS + do + case $cf_header_path in + (-I*) + cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` + +test "x$cf_header_path" != "xNONE" && \ +test -d "$cf_header_path" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" + test -d $cf_header_path/include && cf_search="$cf_search $cf_header_path/include" + test -d $cf_header_path/include/utf8 && cf_search="$cf_search $cf_header_path/include/utf8" + test -d $cf_header_path/include/utf8/include && cf_search="$cf_search $cf_header_path/include/utf8/include" + test -d $cf_header_path/utf8/include && cf_search="$cf_search $cf_header_path/utf8/include" + test -d $cf_header_path/utf8/include/utf8 && cf_search="$cf_search $cf_header_path/utf8/include/utf8" +} + + cf_header_path_list="$cf_header_path_list $cf_search" + ;; + esac + done fi -echo "$as_me:6407: result: $ac_cv_lib_gpm_Gpm_Open" >&5 -echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 -if test $ac_cv_lib_gpm_Gpm_Open = yes; then - echo "$as_me:6410: checking for initscr in -lgpm" >&5 -echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6 -if test "${ac_cv_lib_gpm_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgpm $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 6418 "configure" + +# add the variations for the package we are looking for + +cf_search= + +test "x$prefix" != "xNONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $prefix" + test -d $prefix/include && cf_search="$cf_search $prefix/include" + test -d $prefix/include/utf8 && cf_search="$cf_search $prefix/include/utf8" + test -d $prefix/include/utf8/include && cf_search="$cf_search $prefix/include/utf8/include" + test -d $prefix/utf8/include && cf_search="$cf_search $prefix/utf8/include" + test -d $prefix/utf8/include/utf8 && cf_search="$cf_search $prefix/utf8/include/utf8" +} + +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + $HOME +do + +test "x$cf_subdir_prefix" != "x$prefix" && \ +test -d "$cf_subdir_prefix" && \ +(test -z "$prefix" || test x$prefix = xNONE || test "x$cf_subdir_prefix" != "x$prefix") && { + test -n "$verbose" && echo " ... testing for include-directories under $cf_subdir_prefix" + test -d $cf_subdir_prefix/include && cf_search="$cf_search $cf_subdir_prefix/include" + test -d $cf_subdir_prefix/include/utf8 && cf_search="$cf_search $cf_subdir_prefix/include/utf8" + test -d $cf_subdir_prefix/include/utf8/include && cf_search="$cf_search $cf_subdir_prefix/include/utf8/include" + test -d $cf_subdir_prefix/utf8/include && cf_search="$cf_search $cf_subdir_prefix/utf8/include" + test -d $cf_subdir_prefix/utf8/include/utf8 && cf_search="$cf_search $cf_subdir_prefix/utf8/include/utf8" +} + +done + +test "$includedir" != NONE && \ +test "$includedir" != "/usr/include" && \ +test -d "$includedir" && { + test -d $includedir && cf_search="$cf_search $includedir" + test -d $includedir/utf8 && cf_search="$cf_search $includedir/utf8" +} + +test "$oldincludedir" != NONE && \ +test "$oldincludedir" != "/usr/include" && \ +test -d "$oldincludedir" && { + test -d $oldincludedir && cf_search="$cf_search $oldincludedir" + test -d $oldincludedir/utf8 && cf_search="$cf_search $oldincludedir/utf8" +} + +cf_search="$cf_search $cf_header_path_list" + + for cf_cv_header_path_utf8 in $cf_search + do + if test -d $cf_cv_header_path_utf8 ; then + test -n "$verbose" && echo " ... testing $cf_cv_header_path_utf8" 1>&6 + +echo "${as_me:-configure}:7194: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5 + + CPPFLAGS="$cf_save_CPPFLAGS" + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-I$cf_cv_header_path_utf8" + + cat >conftest.$ac_ext <<_ACEOF +#line 7202 "configure" #include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char initscr (); +#include int -main () +main (void) { -initscr (); +putwc(0,0); ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6437: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7215: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6440: \$? = $ac_status" >&5 + echo "$as_me:7218: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6443: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7221: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6446: \$? = $ac_status" >&5 + echo "$as_me:7224: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_gpm_initscr=yes + + test -n "$verbose" && echo " ... found utf8 headers in $cf_cv_header_path_utf8" 1>&6 + +echo "${as_me:-configure}:7229: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5 + + cf_cv_find_linkage_utf8=maybe + cf_test_CPPFLAGS="$CPPFLAGS" + break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -ac_cv_lib_gpm_initscr=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:6457: result: $ac_cv_lib_gpm_initscr" >&5 -echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6 -if test $ac_cv_lib_gpm_initscr = yes; then - LIBS="$cf_ncurses_SAVE" -else - cf_ncurses_LIBS="-lgpm" -fi - -fi -case $host_os in #(vi -freebsd*) - # This is only necessary if you are linking against an obsolete - # version of ncurses (but it should do no harm, since it's static). - if test "$cf_nculib_root" = ncurses ; then - echo "$as_me:6472: checking for tgoto in -lmytinfo" >&5 -echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 -if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmytinfo $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 6480 "configure" -#include "confdefs.h" + CPPFLAGS="$cf_save_CPPFLAGS" -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char tgoto (); -int -main () -{ -tgoto (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6499: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:6502: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6505: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:6508: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_mytinfo_tgoto=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_mytinfo_tgoto=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:6519: result: $ac_cv_lib_mytinfo_tgoto" >&5 -echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 -if test $ac_cv_lib_mytinfo_tgoto = yes; then - cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS" fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + done - fi - ;; -esac - -LIBS="$cf_ncurses_LIBS $LIBS" - -if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) -then - LIBS="-l$cf_nculib_root $LIBS" -else - - eval 'cf_cv_have_lib_'$cf_nculib_root'=no' - cf_libdir="" - echo "$as_me:6538: checking for initscr" >&5 -echo $ECHO_N "checking for initscr... $ECHO_C" >&6 -if test "${ac_cv_func_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 6544 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char initscr (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char initscr (); -char (*f) (); - -int -main () -{ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_initscr) || defined (__stub___initscr) -choke me -#else -f = initscr; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -#endif + if test "$cf_cv_find_linkage_utf8" = maybe ; then - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6575: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:6578: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6581: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:6584: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_initscr=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_func_initscr=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:6594: result: $ac_cv_func_initscr" >&5 -echo "${ECHO_T}$ac_cv_func_initscr" >&6 -if test $ac_cv_func_initscr = yes; then - eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' -else +echo "${as_me:-configure}:7247: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5 cf_save_LIBS="$LIBS" - echo "$as_me:6601: checking for initscr in -l$cf_nculib_root" >&5 -echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6 - LIBS="-l$cf_nculib_root $LIBS" - cat >conftest.$ac_ext <<_ACEOF -#line 6605 "configure" -#include "confdefs.h" -#include <${cf_cv_ncurses_header:-curses.h}> -int -main () -{ -initscr() - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6617: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:6620: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6623: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:6626: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:6628: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' + cf_save_LDFLAGS="$LDFLAGS" -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:6635: result: no" >&5 -echo "${ECHO_T}no" >&6 + if test "$cf_cv_find_linkage_utf8" != yes ; then cf_search= cf_library_path_list="" if test -n "${LDFLAGS}${LIBS}" ; then for cf_library_path in $LDFLAGS $LIBS do - case $cf_library_path in #(vi - -L*) + case $cf_library_path in + (-L*) cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` test "x$cf_library_path" != "xNONE" && \ @@ -6649,10 +7265,10 @@ test -d "$cf_library_path" && \ { test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" - test -d $cf_library_path/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root" - test -d $cf_library_path/lib/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root/lib" - test -d $cf_library_path/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib" - test -d $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root" + test -d $cf_library_path/lib/utf8 && cf_search="$cf_search $cf_library_path/lib/utf8" + test -d $cf_library_path/lib/utf8/lib && cf_search="$cf_search $cf_library_path/lib/utf8/lib" + test -d $cf_library_path/utf8/lib && cf_search="$cf_search $cf_library_path/utf8/lib" + test -d $cf_library_path/utf8/lib/utf8 && cf_search="$cf_search $cf_library_path/utf8/lib/utf8" } cf_library_path_list="$cf_library_path_list $cf_search" @@ -6663,897 +7279,818 @@ fi cf_search= -test "x/usr" != "x$prefix" && \ -test -d "/usr" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr" - test -d /usr/lib && cf_search="$cf_search /usr/lib" - test -d /usr/lib/$cf_nculib_root && cf_search="$cf_search /usr/lib/$cf_nculib_root" - test -d /usr/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/lib/$cf_nculib_root/lib" - test -d /usr/$cf_nculib_root/lib && cf_search="$cf_search /usr/$cf_nculib_root/lib" - test -d /usr/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/$cf_nculib_root/lib/$cf_nculib_root" -} - test "x$prefix" != "xNONE" && \ test -d "$prefix" && \ { test -n "$verbose" && echo " ... testing for lib-directories under $prefix" test -d $prefix/lib && cf_search="$cf_search $prefix/lib" - test -d $prefix/lib/$cf_nculib_root && cf_search="$cf_search $prefix/lib/$cf_nculib_root" - test -d $prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib" - test -d $prefix/$cf_nculib_root/lib && cf_search="$cf_search $prefix/$cf_nculib_root/lib" - test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root" + test -d $prefix/lib/utf8 && cf_search="$cf_search $prefix/lib/utf8" + test -d $prefix/lib/utf8/lib && cf_search="$cf_search $prefix/lib/utf8/lib" + test -d $prefix/utf8/lib && cf_search="$cf_search $prefix/utf8/lib" + test -d $prefix/utf8/lib/utf8 && cf_search="$cf_search $prefix/utf8/lib/utf8" } -test "x/usr/local" != "x$prefix" && \ -test -d "/usr/local" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" - test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" - test -d /usr/local/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/lib/$cf_nculib_root" - test -d /usr/local/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/lib/$cf_nculib_root/lib" - test -d /usr/local/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/$cf_nculib_root/lib" - test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root" -} +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + $HOME +do -test "x/opt" != "x$prefix" && \ -test -d "/opt" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /opt" - test -d /opt/lib && cf_search="$cf_search /opt/lib" - test -d /opt/lib/$cf_nculib_root && cf_search="$cf_search /opt/lib/$cf_nculib_root" - test -d /opt/lib/$cf_nculib_root/lib && cf_search="$cf_search /opt/lib/$cf_nculib_root/lib" - test -d /opt/$cf_nculib_root/lib && cf_search="$cf_search /opt/$cf_nculib_root/lib" - test -d /opt/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root" +test "x$cf_subdir_prefix" != "x$prefix" && \ +test -d "$cf_subdir_prefix" && \ +(test -z "$prefix" || test x$prefix = xNONE || test "x$cf_subdir_prefix" != "x$prefix") && { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_subdir_prefix" + test -d $cf_subdir_prefix/lib && cf_search="$cf_search $cf_subdir_prefix/lib" + test -d $cf_subdir_prefix/lib/utf8 && cf_search="$cf_search $cf_subdir_prefix/lib/utf8" + test -d $cf_subdir_prefix/lib/utf8/lib && cf_search="$cf_search $cf_subdir_prefix/lib/utf8/lib" + test -d $cf_subdir_prefix/utf8/lib && cf_search="$cf_search $cf_subdir_prefix/utf8/lib" + test -d $cf_subdir_prefix/utf8/lib/utf8 && cf_search="$cf_search $cf_subdir_prefix/utf8/lib/utf8" } -test "x$HOME" != "x$prefix" && \ -test -d "$HOME" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under $HOME" - test -d $HOME/lib && cf_search="$cf_search $HOME/lib" - test -d $HOME/lib/$cf_nculib_root && cf_search="$cf_search $HOME/lib/$cf_nculib_root" - test -d $HOME/lib/$cf_nculib_root/lib && cf_search="$cf_search $HOME/lib/$cf_nculib_root/lib" - test -d $HOME/$cf_nculib_root/lib && cf_search="$cf_search $HOME/$cf_nculib_root/lib" - test -d $HOME/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root" -} +done cf_search="$cf_library_path_list $cf_search" - for cf_libdir in $cf_search + for cf_cv_library_path_utf8 in $cf_search do - echo "$as_me:6725: checking for -l$cf_nculib_root in $cf_libdir" >&5 -echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6 - LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -#line 6729 "configure" + if test -d $cf_cv_library_path_utf8 ; then + test -n "$verbose" && echo " ... testing $cf_cv_library_path_utf8" 1>&6 + +echo "${as_me:-configure}:7322: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5 + + CPPFLAGS="$cf_test_CPPFLAGS" + LIBS="-lutf8 $cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_utf8" + cat >conftest.$ac_ext <<_ACEOF +#line 7328 "configure" #include "confdefs.h" -#include <${cf_cv_ncurses_header:-curses.h}> + +#include int -main () +main (void) { -initscr() +putwc(0,0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6741: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7341: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6744: \$? = $ac_status" >&5 + echo "$as_me:7344: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6747: \"$ac_try\"") >&5 + { (eval echo "$as_me:7347: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6750: \$? = $ac_status" >&5 + echo "$as_me:7350: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - echo "$as_me:6752: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' - break + + test -n "$verbose" && echo " ... found utf8 library in $cf_cv_library_path_utf8" 1>&6 + +echo "${as_me:-configure}:7355: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5 + + cf_cv_find_linkage_utf8=yes + cf_cv_library_file_utf8="-lutf8" + break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -echo "$as_me:6759: result: no" >&5 -echo "${ECHO_T}no" >&6 - LIBS="$cf_save_LIBS" + + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS" + fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + fi done + CPPFLAGS="$cf_save_CPPFLAGS" + LDFLAGS="$cf_save_LDFLAGS" + fi + + else + cf_cv_find_linkage_utf8=no + fi fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root +LIBS="$cf_save_LIBS" -if test $cf_found_library = no ; then - { { echo "$as_me:6774: error: Cannot link $cf_nculib_root library" >&5 -echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;} - { (exit 1); exit 1; }; } +if test "$cf_cv_find_linkage_utf8" = yes ; then +cf_cv_utf8_lib=add-on +else +cf_cv_utf8_lib=no fi fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:7397: result: $cf_cv_utf8_lib" >&5 +echo "${ECHO_T}$cf_cv_utf8_lib" >&6 -if test -n "$cf_ncurses_LIBS" ; then - echo "$as_me:6782: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 -echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6 - cf_ncurses_SAVE="$LIBS" - for p in $cf_ncurses_LIBS ; do - q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` - if test "$q" != "$LIBS" ; then - LIBS="$q" +# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between +# ncurses/ncursesw: +if test "$cf_cv_utf8_lib" = "add-on" ; then + +cat >>confdefs.h <<\EOF +#define HAVE_LIBUTF8_H 1 +EOF + +if test -n "$cf_cv_header_path_utf8" ; then + for cf_add_incdir in $cf_cv_header_path_utf8 + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done fi - done - cat >conftest.$ac_ext <<_ACEOF -#line 6792 "configure" + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-I$cf_add_incdir" + + cat >conftest.$ac_ext <<_ACEOF +#line 7435 "configure" #include "confdefs.h" -#include <${cf_cv_ncurses_header:-curses.h}> +#include int -main () +main (void) { -initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); +printf("Hello") ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6804: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7447: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6807: \$? = $ac_status" >&5 + echo "$as_me:7450: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6810: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7453: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6813: \$? = $ac_status" >&5 + echo "$as_me:7456: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - echo "$as_me:6815: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -echo "$as_me:6820: result: no" >&5 -echo "${ECHO_T}no" >&6 - LIBS="$cf_ncurses_SAVE" +cf_have_incdir=yes fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me:-configure}:7473: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done fi -cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` +if test -n "$cf_cv_library_path_utf8" ; then + for cf_add_libdir in $cf_cv_library_path_utf8 + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -cat >>confdefs.h <&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_cv_library_file_utf8; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" fi +cf_ncuconfig_root=$cf_cv_screen +cf_have_ncuconfig=no + +if test "x${PKG_CONFIG:=none}" != xnone; then + echo "$as_me:7539: checking pkg-config for $cf_ncuconfig_root" >&5 +echo $ECHO_N "checking pkg-config for $cf_ncuconfig_root... $ECHO_C" >&6 + if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then + echo "$as_me:7542: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + + echo "$as_me:7545: checking if the $cf_ncuconfig_root package files work" >&5 +echo $ECHO_N "checking if the $cf_ncuconfig_root package files work... $ECHO_C" >&6 + cf_have_ncuconfig=unknown + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in `$PKG_CONFIG --cflags $cf_ncuconfig_root` +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac ;; -ncursesw) #(vi +(yes) -echo "$as_me:6838: checking for multibyte character support" >&5 -echo $ECHO_N "checking for multibyte character support... $ECHO_C" >&6 -if test "${cf_cv_utf8_lib+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" - cf_save_LIBS="$LIBS" - cat >conftest.$ac_ext <<_ACEOF -#line 6846 "configure" -#include "confdefs.h" + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` -#include + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in `$PKG_CONFIG --libs $cf_ncuconfig_root`; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + cat >conftest.$ac_ext <<_ACEOF +#line 7667 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { -putwc(0,0); +initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6859: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7679: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6862: \$? = $ac_status" >&5 + echo "$as_me:7682: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6865: \"$ac_try\"") >&5 + { (eval echo "$as_me:7685: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6868: \$? = $ac_status" >&5 + echo "$as_me:7688: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_utf8_lib=yes + if test "$cross_compiling" = yes; then + cf_have_ncuconfig=maybe else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 - -# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these -# will be set on completion of the AC_TRY_LINK below. -cf_cv_header_path_utf8= -cf_cv_library_path_utf8= - -echo "${as_me:-configure}:6880: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5 - -cf_save_LIBS="$LIBS" - -cat >conftest.$ac_ext <<_ACEOF -#line 6885 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 7694 "configure" #include "confdefs.h" - -#include -int -main () -{ -putwc(0,0); - ; - return 0; -} +#include <${cf_cv_ncurses_header:-curses.h}> + int main(void) + { char *xx = curses_version(); return (xx == 0); } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6898: \"$ac_link\"") >&5 +rm -f conftest$ac_exeext +if { (eval echo "$as_me:7701: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6901: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6904: \"$ac_try\"") >&5 + echo "$as_me:7704: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:7706: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6907: \$? = $ac_status" >&5 + echo "$as_me:7709: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - - cf_cv_find_linkage_utf8=yes - cf_cv_header_path_utf8=/usr/include - cf_cv_library_path_utf8=/usr/lib - + cf_have_ncuconfig=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_ncuconfig=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 +cf_have_ncuconfig=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:7726: result: $cf_have_ncuconfig" >&5 +echo "${ECHO_T}$cf_have_ncuconfig" >&6 + test "$cf_have_ncuconfig" = maybe && cf_have_ncuconfig=yes + if test "$cf_have_ncuconfig" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + NCURSES_CONFIG_PKG=none + else -LIBS="-lutf8 $cf_save_LIBS" +cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + + NCURSES_CONFIG_PKG=$cf_ncuconfig_root + +echo "$as_me:7742: checking for terminfo header" >&5 +echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 +if test "${cf_cv_term_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +case ${cf_cv_ncurses_header} in +(*/ncurses.h|*/ncursesw.h) + cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` + ;; +(*) + cf_term_header=term.h + ;; +esac +for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" +do cat >conftest.$ac_ext <<_ACEOF -#line 6921 "configure" +#line 7760 "configure" #include "confdefs.h" +#include +#include <${cf_cv_ncurses_header:-curses.h}> +#include <$cf_test> -#include int -main () +main (void) { -putwc(0,0); +int x = auto_left_margin ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6934: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7775: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6937: \$? = $ac_status" >&5 + echo "$as_me:7778: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6940: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7781: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6943: \$? = $ac_status" >&5 + echo "$as_me:7784: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_find_linkage_utf8=yes - cf_cv_header_path_utf8=/usr/include - cf_cv_library_path_utf8=/usr/lib - cf_cv_library_file_utf8="-lutf8" - + cf_cv_term_header="$cf_test" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - cf_cv_find_linkage_utf8=no - LIBS="$cf_save_LIBS" + cf_cv_term_header=unknown - test -n "$verbose" && echo " find linkage for utf8 library" 1>&6 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + test "$cf_cv_term_header" != unknown && break +done -echo "${as_me:-configure}:6960: testing find linkage for utf8 library ..." 1>&5 +fi +echo "$as_me:7800: result: $cf_cv_term_header" >&5 +echo "${ECHO_T}$cf_cv_term_header" >&6 -echo "${as_me:-configure}:6962: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5 +# Set definitions to allow ifdef'ing to accommodate subdirectories - cf_save_CPPFLAGS="$CPPFLAGS" - cf_test_CPPFLAGS="$CPPFLAGS" +case $cf_cv_term_header in +(*term.h) -cf_search= +cat >>confdefs.h <<\EOF +#define HAVE_TERM_H 1 +EOF -# collect the current set of include-directories from compiler flags -cf_header_path_list="" -if test -n "${CFLAGS}${CPPFLAGS}" ; then - for cf_header_path in $CPPFLAGS $CFLAGS - do - case $cf_header_path in #(vi - -I*) - cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` + ;; +esac -test "x$cf_header_path" != "xNONE" && \ -test -d "$cf_header_path" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" - test -d $cf_header_path/include && cf_search="$cf_search $cf_header_path/include" - test -d $cf_header_path/include/utf8 && cf_search="$cf_search $cf_header_path/include/utf8" - test -d $cf_header_path/include/utf8/include && cf_search="$cf_search $cf_header_path/include/utf8/include" - test -d $cf_header_path/utf8/include && cf_search="$cf_search $cf_header_path/utf8/include" - test -d $cf_header_path/utf8/include/utf8 && cf_search="$cf_search $cf_header_path/utf8/include/utf8" -} +case $cf_cv_term_header in +(ncurses/term.h) - cf_header_path_list="$cf_header_path_list $cf_search" - ;; - esac - done -fi - -# add the variations for the package we are looking for +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_TERM_H 1 +EOF -cf_search= + ;; +(ncursesw/term.h) -test "x/usr" != "x$prefix" && \ -test -d "/usr" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr" - test -d /usr/include && cf_search="$cf_search /usr/include" - test -d /usr/include/utf8 && cf_search="$cf_search /usr/include/utf8" - test -d /usr/include/utf8/include && cf_search="$cf_search /usr/include/utf8/include" - test -d /usr/utf8/include && cf_search="$cf_search /usr/utf8/include" - test -d /usr/utf8/include/utf8 && cf_search="$cf_search /usr/utf8/include/utf8" -} +cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_TERM_H 1 +EOF -test "x$prefix" != "xNONE" && \ -test -d "$prefix" && \ - { - test -n "$verbose" && echo " ... testing for include-directories under $prefix" - test -d $prefix/include && cf_search="$cf_search $prefix/include" - test -d $prefix/include/utf8 && cf_search="$cf_search $prefix/include/utf8" - test -d $prefix/include/utf8/include && cf_search="$cf_search $prefix/include/utf8/include" - test -d $prefix/utf8/include && cf_search="$cf_search $prefix/utf8/include" - test -d $prefix/utf8/include/utf8 && cf_search="$cf_search $prefix/utf8/include/utf8" -} + ;; +esac -test "x/usr/local" != "x$prefix" && \ -test -d "/usr/local" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr/local" - test -d /usr/local/include && cf_search="$cf_search /usr/local/include" - test -d /usr/local/include/utf8 && cf_search="$cf_search /usr/local/include/utf8" - test -d /usr/local/include/utf8/include && cf_search="$cf_search /usr/local/include/utf8/include" - test -d /usr/local/utf8/include && cf_search="$cf_search /usr/local/utf8/include" - test -d /usr/local/utf8/include/utf8 && cf_search="$cf_search /usr/local/utf8/include/utf8" -} + fi -test "x/opt" != "x$prefix" && \ -test -d "/opt" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /opt" - test -d /opt/include && cf_search="$cf_search /opt/include" - test -d /opt/include/utf8 && cf_search="$cf_search /opt/include/utf8" - test -d /opt/include/utf8/include && cf_search="$cf_search /opt/include/utf8/include" - test -d /opt/utf8/include && cf_search="$cf_search /opt/utf8/include" - test -d /opt/utf8/include/utf8 && cf_search="$cf_search /opt/utf8/include/utf8" -} + else + echo "$as_me:7835: result: no" >&5 +echo "${ECHO_T}no" >&6 + NCURSES_CONFIG_PKG=none + fi +else + NCURSES_CONFIG_PKG=none +fi -test "x$HOME" != "x$prefix" && \ -test -d "$HOME" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under $HOME" - test -d $HOME/include && cf_search="$cf_search $HOME/include" - test -d $HOME/include/utf8 && cf_search="$cf_search $HOME/include/utf8" - test -d $HOME/include/utf8/include && cf_search="$cf_search $HOME/include/utf8/include" - test -d $HOME/utf8/include && cf_search="$cf_search $HOME/utf8/include" - test -d $HOME/utf8/include/utf8 && cf_search="$cf_search $HOME/utf8/include/utf8" -} +if test "x$cf_have_ncuconfig" = "xno"; then + cf_ncurses_config="${cf_ncuconfig_root}${NCURSES_CONFIG_SUFFIX}-config"; echo "Looking for ${cf_ncurses_config}" -test "$includedir" != NONE && \ -test "$includedir" != "/usr/include" && \ -test -d "$includedir" && { - test -d $includedir && cf_search="$cf_search $includedir" - test -d $includedir/utf8 && cf_search="$cf_search $includedir/utf8" -} +if test -n "$ac_tool_prefix"; then + for ac_prog in ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:7851: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NCURSES_CONFIG"; then + ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog" +echo "$as_me:7866: found $ac_dir/$ac_word" >&5 +break +done -test "$oldincludedir" != NONE && \ -test "$oldincludedir" != "/usr/include" && \ -test -d "$oldincludedir" && { - test -d $oldincludedir && cf_search="$cf_search $oldincludedir" - test -d $oldincludedir/utf8 && cf_search="$cf_search $oldincludedir/utf8" -} +fi +fi +NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG +if test -n "$NCURSES_CONFIG"; then + echo "$as_me:7874: result: $NCURSES_CONFIG" >&5 +echo "${ECHO_T}$NCURSES_CONFIG" >&6 +else + echo "$as_me:7877: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi -cf_search="$cf_search $cf_header_path_list" + test -n "$NCURSES_CONFIG" && break + done +fi +if test -z "$NCURSES_CONFIG"; then + ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG + for ac_prog in ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:7890: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_NCURSES_CONFIG"; then + ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog" +echo "$as_me:7905: found $ac_dir/$ac_word" >&5 +break +done - for cf_cv_header_path_utf8 in $cf_search - do - if test -d $cf_cv_header_path_utf8 ; then - test -n "$verbose" && echo " ... testing $cf_cv_header_path_utf8" 1>&6 +fi +fi +ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG +if test -n "$ac_ct_NCURSES_CONFIG"; then + echo "$as_me:7913: result: $ac_ct_NCURSES_CONFIG" >&5 +echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6 +else + echo "$as_me:7916: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi -echo "${as_me:-configure}:7075: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5 + test -n "$ac_ct_NCURSES_CONFIG" && break +done +test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none" - CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_utf8" - cat >conftest.$ac_ext <<_ACEOF -#line 7079 "configure" -#include "confdefs.h" + NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG +fi -#include -int -main () -{ -putwc(0,0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:7092: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:7095: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7098: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7101: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + if test "$NCURSES_CONFIG" != none ; then - test -n "$verbose" && echo " ... found utf8 headers in $cf_cv_header_path_utf8" 1>&6 +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= -echo "${as_me:-configure}:7106: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5 +for cf_add_cflags in `$NCURSES_CONFIG --cflags` +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - cf_cv_find_linkage_utf8=maybe - cf_test_CPPFLAGS="$CPPFLAGS" - break -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes - CPPFLAGS="$cf_save_CPPFLAGS" + if test $cf_fix_cppflags = yes ; then -fi -rm -f conftest.$ac_objext conftest.$ac_ext - fi - done + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" - if test "$cf_cv_find_linkage_utf8" = maybe ; then + continue + elif test "${cf_tst_cflags}" = "\"'" ; then -echo "${as_me:-configure}:7124: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5 + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" - cf_save_LIBS="$LIBS" - cf_save_LDFLAGS="$LDFLAGS" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` - if test "$cf_cv_find_linkage_utf8" != yes ; then +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` -cf_search= -cf_library_path_list="" -if test -n "${LDFLAGS}${LIBS}" ; then - for cf_library_path in $LDFLAGS $LIBS - do - case $cf_library_path in #(vi - -L*) - cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` + ;; + esac -test "x$cf_library_path" != "xNONE" && \ -test -d "$cf_library_path" && \ - { - test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" - test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" - test -d $cf_library_path/lib/utf8 && cf_search="$cf_search $cf_library_path/lib/utf8" - test -d $cf_library_path/lib/utf8/lib && cf_search="$cf_search $cf_library_path/lib/utf8/lib" - test -d $cf_library_path/utf8/lib && cf_search="$cf_search $cf_library_path/utf8/lib" - test -d $cf_library_path/utf8/lib/utf8 && cf_search="$cf_search $cf_library_path/utf8/lib/utf8" -} + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" - cf_library_path_list="$cf_library_path_list $cf_search" ;; esac - done + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi -cf_search= +if test -n "$cf_new_cppflags" ; then -test "x/usr" != "x$prefix" && \ -test -d "/usr" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr" - test -d /usr/lib && cf_search="$cf_search /usr/lib" - test -d /usr/lib/utf8 && cf_search="$cf_search /usr/lib/utf8" - test -d /usr/lib/utf8/lib && cf_search="$cf_search /usr/lib/utf8/lib" - test -d /usr/utf8/lib && cf_search="$cf_search /usr/utf8/lib" - test -d /usr/utf8/lib/utf8 && cf_search="$cf_search /usr/utf8/lib/utf8" -} + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" -test "x$prefix" != "xNONE" && \ -test -d "$prefix" && \ - { - test -n "$verbose" && echo " ... testing for lib-directories under $prefix" - test -d $prefix/lib && cf_search="$cf_search $prefix/lib" - test -d $prefix/lib/utf8 && cf_search="$cf_search $prefix/lib/utf8" - test -d $prefix/lib/utf8/lib && cf_search="$cf_search $prefix/lib/utf8/lib" - test -d $prefix/utf8/lib && cf_search="$cf_search $prefix/utf8/lib" - test -d $prefix/utf8/lib/utf8 && cf_search="$cf_search $prefix/utf8/lib/utf8" -} +fi -test "x/usr/local" != "x$prefix" && \ -test -d "/usr/local" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" - test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" - test -d /usr/local/lib/utf8 && cf_search="$cf_search /usr/local/lib/utf8" - test -d /usr/local/lib/utf8/lib && cf_search="$cf_search /usr/local/lib/utf8/lib" - test -d /usr/local/utf8/lib && cf_search="$cf_search /usr/local/utf8/lib" - test -d /usr/local/utf8/lib/utf8 && cf_search="$cf_search /usr/local/utf8/lib/utf8" -} +if test -n "$cf_new_extra_cppflags" ; then -test "x/opt" != "x$prefix" && \ -test -d "/opt" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /opt" - test -d /opt/lib && cf_search="$cf_search /opt/lib" - test -d /opt/lib/utf8 && cf_search="$cf_search /opt/lib/utf8" - test -d /opt/lib/utf8/lib && cf_search="$cf_search /opt/lib/utf8/lib" - test -d /opt/utf8/lib && cf_search="$cf_search /opt/utf8/lib" - test -d /opt/utf8/lib/utf8 && cf_search="$cf_search /opt/utf8/lib/utf8" -} + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" -test "x$HOME" != "x$prefix" && \ -test -d "$HOME" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under $HOME" - test -d $HOME/lib && cf_search="$cf_search $HOME/lib" - test -d $HOME/lib/utf8 && cf_search="$cf_search $HOME/lib/utf8" - test -d $HOME/lib/utf8/lib && cf_search="$cf_search $HOME/lib/utf8/lib" - test -d $HOME/utf8/lib && cf_search="$cf_search $HOME/utf8/lib" - test -d $HOME/utf8/lib/utf8 && cf_search="$cf_search $HOME/utf8/lib/utf8" -} +fi -cf_search="$cf_library_path_list $cf_search" +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in `$NCURSES_CONFIG --libs`; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" - for cf_cv_library_path_utf8 in $cf_search - do - if test -d $cf_cv_library_path_utf8 ; then - test -n "$verbose" && echo " ... testing $cf_cv_library_path_utf8" 1>&6 + # even with config script, some packages use no-override for curses.h -echo "${as_me:-configure}:7221: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5 +echo "$as_me:8045: checking if we have identified curses headers" >&5 +echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 +if test "${cf_cv_ncurses_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else - CPPFLAGS="$cf_test_CPPFLAGS" - LIBS="-lutf8 $cf_save_LIBS" - LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_utf8" - cat >conftest.$ac_ext <<_ACEOF -#line 7227 "configure" +cf_cv_ncurses_header=none +for cf_header in \ + ncurses.h $cf_cv_screen/ncurses.h \ + curses.h $cf_cv_screen/curses.h +do +cat >conftest.$ac_ext <<_ACEOF +#line 8057 "configure" #include "confdefs.h" - -#include +#include <${cf_header}> int -main () +main (void) { -putwc(0,0); +initscr(); tgoto("?", 0,0) ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7240: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8069: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:7243: \$? = $ac_status" >&5 + echo "$as_me:8072: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7246: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8075: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7249: \$? = $ac_status" >&5 + echo "$as_me:8078: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - - test -n "$verbose" && echo " ... found utf8 library in $cf_cv_library_path_utf8" 1>&6 - -echo "${as_me:-configure}:7254: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5 - - cf_cv_find_linkage_utf8=yes - cf_cv_library_file_utf8="-lutf8" - break + cf_cv_ncurses_header=$cf_header; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - - CPPFLAGS="$cf_save_CPPFLAGS" - LIBS="$cf_save_LIBS" - LDFLAGS="$cf_save_LDFLAGS" - fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi - done - CPPFLAGS="$cf_save_CPPFLAGS" - LDFLAGS="$cf_save_LDFLAGS" - fi - - else - cf_cv_find_linkage_utf8=no - fi +rm -f conftest.$ac_objext conftest.$ac_ext +done fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -LIBS="$cf_save_LIBS" - -if test "$cf_cv_find_linkage_utf8" = yes ; then -cf_cv_utf8_lib=add-on -else -cf_cv_utf8_lib=no -fi - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:7296: result: $cf_cv_utf8_lib" >&5 -echo "${ECHO_T}$cf_cv_utf8_lib" >&6 - -# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between -# ncurses/ncursesw: -if test "$cf_cv_utf8_lib" = "add-on" ; then - -cat >>confdefs.h <<\EOF -#define HAVE_LIBUTF8_H 1 -EOF - -if test -n "$cf_cv_header_path_utf8" ; then - for cf_add_incdir in $cf_cv_header_path_utf8 - do - while test $cf_add_incdir != /usr/include - do - if test -d $cf_add_incdir - then - cf_have_incdir=no - if test -n "$CFLAGS$CPPFLAGS" ; then - # a loop is needed to ensure we can add subdirs of existing dirs - for cf_test_incdir in $CFLAGS $CPPFLAGS ; do - if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then - cf_have_incdir=yes; break - fi - done - fi - - if test "$cf_have_incdir" = no ; then - if test "$cf_add_incdir" = /usr/local/include ; then - if test "$GCC" = yes - then - cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - cat >conftest.$ac_ext <<_ACEOF -#line 7331 "configure" -#include "confdefs.h" -#include -int -main () -{ -printf("Hello") - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:7343: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:7346: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7349: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7352: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_have_incdir=yes -fi -rm -f conftest.$ac_objext conftest.$ac_ext - CPPFLAGS=$cf_save_CPPFLAGS - fi - fi - fi - - if test "$cf_have_incdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 - -echo "${as_me:-configure}:7369: testing adding $cf_add_incdir to include-path ..." 1>&5 - - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" - - cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` - test "$cf_top_incdir" = "$cf_add_incdir" && break - cf_add_incdir="$cf_top_incdir" - else - break - fi - fi - done - done -fi - -if test -n "$cf_cv_library_path_utf8" ; then - for cf_add_libdir in $cf_cv_library_path_utf8 - do - if test $cf_add_libdir = /usr/lib ; then - : - elif test -d $cf_add_libdir - then - cf_have_libdir=no - if test -n "$LDFLAGS$LIBS" ; then - # a loop is needed to ensure we can add subdirs of existing dirs - for cf_test_libdir in $LDFLAGS $LIBS ; do - if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then - cf_have_libdir=yes; break - fi - done - fi - if test "$cf_have_libdir" = no ; then - test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 - -echo "${as_me:-configure}:7403: testing adding $cf_add_libdir to library-path ..." 1>&5 - - LDFLAGS="-L$cf_add_libdir $LDFLAGS" - fi - fi - done -fi - - LIBS="$cf_cv_library_file_utf8 $LIBS" -fi - -cf_ncuconfig_root=ncursesw - -echo "Looking for ${cf_ncuconfig_root}-config" - -if test -n "$ac_tool_prefix"; then - for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:7423: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$NCURSES_CONFIG"; then - ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog" -echo "$as_me:7438: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG -if test -n "$NCURSES_CONFIG"; then - echo "$as_me:7446: result: $NCURSES_CONFIG" >&5 -echo "${ECHO_T}$NCURSES_CONFIG" >&6 -else - echo "$as_me:7449: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$NCURSES_CONFIG" && break - done -fi -if test -z "$NCURSES_CONFIG"; then - ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG - for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:7462: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_NCURSES_CONFIG"; then - ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog" -echo "$as_me:7477: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG -if test -n "$ac_ct_NCURSES_CONFIG"; then - echo "$as_me:7485: result: $ac_ct_NCURSES_CONFIG" >&5 -echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6 -else - echo "$as_me:7488: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_NCURSES_CONFIG" && break -done -test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none" - - NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG -fi - -if test "$NCURSES_CONFIG" != none ; then - -CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" -LIBS="`$NCURSES_CONFIG --libs` $LIBS" - -# even with config script, some packages use no-override for curses.h - -echo "$as_me:7506: checking if we have identified curses headers" >&5 -echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 -if test "${cf_cv_ncurses_header+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -cf_cv_ncurses_header=none -for cf_header in \ - ncursesw/ncurses.h \ - ncursesw/curses.h \ - ncurses.h \ - curses.h -do -cat >conftest.$ac_ext <<_ACEOF -#line 7520 "configure" -#include "confdefs.h" -#include <${cf_header}> -int -main () -{ -initscr(); tgoto("?", 0,0) - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:7532: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:7535: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7538: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7541: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_ncurses_header=$cf_header; break -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest.$ac_ext -done - -fi -echo "$as_me:7552: result: $cf_cv_ncurses_header" >&5 -echo "${ECHO_T}$cf_cv_ncurses_header" >&6 +echo "$as_me:8089: result: $cf_cv_ncurses_header" >&5 +echo "${ECHO_T}$cf_cv_ncurses_header" >&6 if test "$cf_cv_ncurses_header" = none ; then - { { echo "$as_me:7556: error: No curses header-files found" >&5 + { { echo "$as_me:8093: error: No curses header-files found" >&5 echo "$as_me: error: No curses header-files found" >&2;} { (exit 1); exit 1; }; } fi @@ -7563,23 +8100,23 @@ fi for ac_header in $cf_cv_ncurses_header do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:7566: checking for $ac_header" >&5 +echo "$as_me:8103: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7572 "configure" +#line 8109 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:7576: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:8113: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:7582: \$? = $ac_status" >&5 + echo "$as_me:8119: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -7598,7 +8135,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:7601: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:8138: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <>confdefs.h <>confdefs.h <conftest.$ac_ext <<_ACEOF -#line 7654 "configure" +#line 8194 "configure" #include "confdefs.h" #include int -main () +main (void) { printf("Hello") ; @@ -7663,16 +8203,16 @@ printf("Hello") } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:7666: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:8206: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:7669: \$? = $ac_status" >&5 + echo "$as_me:8209: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7672: \"$ac_try\"") >&5 + { (eval echo "$as_me:8212: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7675: \$? = $ac_status" >&5 + echo "$as_me:8215: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -7689,7 +8229,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_have_incdir" = no ; then test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -echo "${as_me:-configure}:7692: testing adding $cf_add_incdir to include-path ..." 1>&5 +echo "${as_me:-configure}:8232: testing adding $cf_add_incdir to include-path ..." 1>&5 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" @@ -7699,6 +8239,8 @@ echo "${as_me:-configure}:7692: testing adding $cf_add_incdir to include-path .. else break fi + else + break fi done done @@ -7706,7 +8248,7 @@ fi } -echo "$as_me:7709: checking for $cf_ncuhdr_root header in include-path" >&5 +echo "$as_me:8251: checking for $cf_ncuhdr_root header in include-path" >&5 echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6 if test "${cf_cv_ncurses_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -7718,24 +8260,16 @@ else do cat >conftest.$ac_ext <<_ACEOF -#line 7721 "configure" +#line 8263 "configure" #include "confdefs.h" -#define _XOPEN_SOURCE_EXTENDED -#undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */ -#define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */ - #include <$cf_header> int -main () +main (void) { #ifdef NCURSES_VERSION -#ifndef WACS_BSSB - make an error -#endif - printf("%s\n", NCURSES_VERSION); #else #ifdef __NCURSES_H @@ -7750,16 +8284,16 @@ printf("old\n"); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:7753: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:8287: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:7756: \$? = $ac_status" >&5 + echo "$as_me:8290: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7759: \"$ac_try\"") >&5 + { (eval echo "$as_me:8293: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7762: \$? = $ac_status" >&5 + echo "$as_me:8296: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_ncurses_h=$cf_header @@ -7774,14 +8308,14 @@ rm -f conftest.$ac_objext conftest.$ac_ext done fi -echo "$as_me:7777: result: $cf_cv_ncurses_h" >&5 +echo "$as_me:8311: result: $cf_cv_ncurses_h" >&5 echo "${ECHO_T}$cf_cv_ncurses_h" >&6 if test "$cf_cv_ncurses_h" != no ; then cf_cv_ncurses_header=$cf_cv_ncurses_h else -echo "$as_me:7784: checking for $cf_ncuhdr_root include-path" >&5 +echo "$as_me:8318: checking for $cf_ncuhdr_root include-path" >&5 echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6 if test "${cf_cv_ncurses_h2+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -7796,8 +8330,8 @@ cf_header_path_list="" if test -n "${CFLAGS}${CPPFLAGS}" ; then for cf_header_path in $CPPFLAGS $CFLAGS do - case $cf_header_path in #(vi - -I*) + case $cf_header_path in + (-I*) cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` test "x$cf_header_path" != "xNONE" && \ @@ -7821,17 +8355,6 @@ fi cf_search= -test "x/usr" != "x$prefix" && \ -test -d "/usr" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr" - test -d /usr/include && cf_search="$cf_search /usr/include" - test -d /usr/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/include/$cf_ncuhdr_root" - test -d /usr/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/include/$cf_ncuhdr_root/include" - test -d /usr/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/$cf_ncuhdr_root/include" - test -d /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -} - test "x$prefix" != "xNONE" && \ test -d "$prefix" && \ { @@ -7843,38 +8366,27 @@ test -d "$prefix" && \ test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" } -test "x/usr/local" != "x$prefix" && \ -test -d "/usr/local" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /usr/local" - test -d /usr/local/include && cf_search="$cf_search /usr/local/include" - test -d /usr/local/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root" - test -d /usr/local/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root/include" - test -d /usr/local/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include" - test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -} +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + $HOME +do -test "x/opt" != "x$prefix" && \ -test -d "/opt" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under /opt" - test -d /opt/include && cf_search="$cf_search /opt/include" - test -d /opt/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/include/$cf_ncuhdr_root" - test -d /opt/include/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/include/$cf_ncuhdr_root/include" - test -d /opt/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/$cf_ncuhdr_root/include" - test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +test "x$cf_subdir_prefix" != "x$prefix" && \ +test -d "$cf_subdir_prefix" && \ +(test -z "$prefix" || test x$prefix = xNONE || test "x$cf_subdir_prefix" != "x$prefix") && { + test -n "$verbose" && echo " ... testing for include-directories under $cf_subdir_prefix" + test -d $cf_subdir_prefix/include && cf_search="$cf_search $cf_subdir_prefix/include" + test -d $cf_subdir_prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_subdir_prefix/include/$cf_ncuhdr_root" + test -d $cf_subdir_prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_subdir_prefix/include/$cf_ncuhdr_root/include" + test -d $cf_subdir_prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_subdir_prefix/$cf_ncuhdr_root/include" + test -d $cf_subdir_prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_subdir_prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" } -test "x$HOME" != "x$prefix" && \ -test -d "$HOME" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for include-directories under $HOME" - test -d $HOME/include && cf_search="$cf_search $HOME/include" - test -d $HOME/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root" - test -d $HOME/include/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root/include" - test -d $HOME/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include" - test -d $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root" -} +done test "$includedir" != NONE && \ test "$includedir" != "/usr/include" && \ @@ -7919,13 +8431,16 @@ if test -n "$cf_incdir" ; then if test "$GCC" = yes then cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF -#line 7924 "configure" +#line 8439 "configure" #include "confdefs.h" #include int -main () +main (void) { printf("Hello") ; @@ -7933,16 +8448,16 @@ printf("Hello") } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:7936: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:8451: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:7939: \$? = $ac_status" >&5 + echo "$as_me:8454: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7942: \"$ac_try\"") >&5 + { (eval echo "$as_me:8457: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7945: \$? = $ac_status" >&5 + echo "$as_me:8460: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -7959,7 +8474,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_have_incdir" = no ; then test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -echo "${as_me:-configure}:7962: testing adding $cf_add_incdir to include-path ..." 1>&5 +echo "${as_me:-configure}:8477: testing adding $cf_add_incdir to include-path ..." 1>&5 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" @@ -7969,6 +8484,8 @@ echo "${as_me:-configure}:7962: testing adding $cf_add_incdir to include-path .. else break fi + else + break fi done done @@ -7980,12 +8497,12 @@ fi do cat >conftest.$ac_ext <<_ACEOF -#line 7983 "configure" +#line 8500 "configure" #include "confdefs.h" #include <$cf_header> int -main () +main (void) { #ifdef NCURSES_VERSION @@ -8004,16 +8521,16 @@ printf("old\n"); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8007: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:8524: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8010: \$? = $ac_status" >&5 + echo "$as_me:8527: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8013: \"$ac_try\"") >&5 + { (eval echo "$as_me:8530: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8016: \$? = $ac_status" >&5 + echo "$as_me:8533: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_ncurses_h2=$cf_header @@ -8034,12 +8551,12 @@ rm -f conftest.$ac_objext conftest.$ac_ext CPPFLAGS="$cf_save2_CPPFLAGS" test "$cf_cv_ncurses_h2" != no && break done - test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:8037: error: not found" >&5 + test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:8554: error: not found" >&5 echo "$as_me: error: not found" >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:8042: result: $cf_cv_ncurses_h2" >&5 +echo "$as_me:8559: result: $cf_cv_ncurses_h2" >&5 echo "${ECHO_T}$cf_cv_ncurses_h2" >&6 cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'` @@ -8070,13 +8587,16 @@ if test -n "$cf_1st_incdir" ; then if test "$GCC" = yes then cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF -#line 8075 "configure" +#line 8595 "configure" #include "confdefs.h" #include int -main () +main (void) { printf("Hello") ; @@ -8084,16 +8604,16 @@ printf("Hello") } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8087: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:8607: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8090: \$? = $ac_status" >&5 + echo "$as_me:8610: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8093: \"$ac_try\"") >&5 + { (eval echo "$as_me:8613: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8096: \$? = $ac_status" >&5 + echo "$as_me:8616: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -8110,7 +8630,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_have_incdir" = no ; then test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -echo "${as_me:-configure}:8113: testing adding $cf_add_incdir to include-path ..." 1>&5 +echo "${as_me:-configure}:8633: testing adding $cf_add_incdir to include-path ..." 1>&5 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" @@ -8120,6 +8640,8 @@ echo "${as_me:-configure}:8113: testing adding $cf_add_incdir to include-path .. else break fi + else + break fi done done @@ -8129,8 +8651,8 @@ fi # Set definitions to allow ifdef'ing for ncurses.h -case $cf_cv_ncurses_header in # (vi -*ncurses.h) +case $cf_cv_ncurses_header in +(*ncurses.h) cat >>confdefs.h <<\EOF #define HAVE_NCURSES_H 1 @@ -8139,15 +8661,15 @@ EOF ;; esac -case $cf_cv_ncurses_header in # (vi -ncurses/curses.h|ncurses/ncurses.h) +case $cf_cv_ncurses_header in +(ncurses/curses.h|ncurses/ncurses.h) cat >>confdefs.h <<\EOF #define HAVE_NCURSES_NCURSES_H 1 EOF ;; -ncursesw/curses.h|ncursesw/ncurses.h) +(ncursesw/curses.h|ncursesw/ncurses.h) cat >>confdefs.h <<\EOF #define HAVE_NCURSESW_NCURSES_H 1 @@ -8156,17 +8678,17 @@ EOF ;; esac -echo "$as_me:8159: checking for terminfo header" >&5 +echo "$as_me:8681: checking for terminfo header" >&5 echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 if test "${cf_cv_term_header+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else -case ${cf_cv_ncurses_header} in #(vi -*/ncurses.h|*/ncursesw.h) #(vi +case ${cf_cv_ncurses_header} in +(*/ncurses.h|*/ncursesw.h) cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` ;; -*) +(*) cf_term_header=term.h ;; esac @@ -8174,14 +8696,14 @@ esac for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" do cat >conftest.$ac_ext <<_ACEOF -#line 8177 "configure" +#line 8699 "configure" #include "confdefs.h" #include #include <${cf_cv_ncurses_header:-curses.h}> #include <$cf_test> int -main () +main (void) { int x = auto_left_margin ; @@ -8189,16 +8711,16 @@ int x = auto_left_margin } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8192: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:8714: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8195: \$? = $ac_status" >&5 + echo "$as_me:8717: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8198: \"$ac_try\"") >&5 + { (eval echo "$as_me:8720: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8201: \$? = $ac_status" >&5 + echo "$as_me:8723: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_term_header="$cf_test" @@ -8214,13 +8736,13 @@ rm -f conftest.$ac_objext conftest.$ac_ext done fi -echo "$as_me:8217: result: $cf_cv_term_header" >&5 +echo "$as_me:8739: result: $cf_cv_term_header" >&5 echo "${ECHO_T}$cf_cv_term_header" >&6 # Set definitions to allow ifdef'ing to accommodate subdirectories -case $cf_cv_term_header in # (vi -*term.h) +case $cf_cv_term_header in +(*term.h) cat >>confdefs.h <<\EOF #define HAVE_TERM_H 1 @@ -8229,15 +8751,15 @@ EOF ;; esac -case $cf_cv_term_header in # (vi -ncurses/term.h) #(vi +case $cf_cv_term_header in +(ncurses/term.h) cat >>confdefs.h <<\EOF #define HAVE_NCURSES_TERM_H 1 EOF ;; -ncursesw/term.h) +(ncursesw/term.h) cat >>confdefs.h <<\EOF #define HAVE_NCURSESW_TERM_H 1 @@ -8252,7 +8774,7 @@ cat >>confdefs.h <<\EOF #define NCURSES 1 EOF -echo "$as_me:8255: checking for ncurses version" >&5 +echo "$as_me:8777: checking for ncurses version" >&5 echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 if test "${cf_cv_ncurses_version+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8278,10 +8800,10 @@ Autoconf "old" #endif EOF cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" - { (eval echo "$as_me:8281: \"$cf_try\"") >&5 + { (eval echo "$as_me:8803: \"$cf_try\"") >&5 (eval $cf_try) 2>&5 ac_status=$? - echo "$as_me:8284: \$? = $ac_status" >&5 + echo "$as_me:8806: \$? = $ac_status" >&5 (exit $ac_status); } if test -f conftest.out ; then cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` @@ -8291,12 +8813,12 @@ EOF else cat >conftest.$ac_ext <<_ACEOF -#line 8294 "configure" +#line 8816 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> #include -int main() +int main(void) { FILE *fp = fopen("$cf_tempfile", "w"); #ifdef NCURSES_VERSION @@ -8316,15 +8838,15 @@ int main() } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:8319: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8841: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8322: \$? = $ac_status" >&5 + echo "$as_me:8844: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:8324: \"$ac_try\"") >&5 + { (eval echo "$as_me:8846: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8327: \$? = $ac_status" >&5 + echo "$as_me:8849: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_ncurses_version=`cat $cf_tempfile` @@ -8338,20 +8860,20 @@ fi rm -f $cf_tempfile fi -echo "$as_me:8341: result: $cf_cv_ncurses_version" >&5 +echo "$as_me:8863: result: $cf_cv_ncurses_version" >&5 echo "${ECHO_T}$cf_cv_ncurses_version" >&6 test "$cf_cv_ncurses_version" = no || cat >>confdefs.h <<\EOF #define NCURSES 1 EOF -cf_nculib_root=ncursesw +cf_nculib_root=$cf_cv_screen # This works, except for the special case where we find gpm, but # ncurses is in a nonstandard location via $LIBS, and we really want # to link gpm. cf_ncurses_LIBS="" cf_ncurses_SAVE="$LIBS" -echo "$as_me:8354: checking for Gpm_Open in -lgpm" >&5 +echo "$as_me:8876: checking for Gpm_Open in -lgpm" >&5 echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8359,7 +8881,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lgpm $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 8362 "configure" +#line 8884 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -8370,7 +8892,7 @@ extern "C" builtin and then its argument prototype would still apply. */ char Gpm_Open (); int -main () +main (void) { Gpm_Open (); ; @@ -8378,16 +8900,16 @@ Gpm_Open (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8381: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8903: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8384: \$? = $ac_status" >&5 + echo "$as_me:8906: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8387: \"$ac_try\"") >&5 + { (eval echo "$as_me:8909: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8390: \$? = $ac_status" >&5 + echo "$as_me:8912: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_gpm_Gpm_Open=yes else @@ -8398,10 +8920,10 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:8401: result: $ac_cv_lib_gpm_Gpm_Open" >&5 +echo "$as_me:8923: result: $ac_cv_lib_gpm_Gpm_Open" >&5 echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 if test $ac_cv_lib_gpm_Gpm_Open = yes; then - echo "$as_me:8404: checking for initscr in -lgpm" >&5 + echo "$as_me:8926: checking for initscr in -lgpm" >&5 echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6 if test "${ac_cv_lib_gpm_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8409,7 +8931,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lgpm $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 8412 "configure" +#line 8934 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -8420,7 +8942,7 @@ extern "C" builtin and then its argument prototype would still apply. */ char initscr (); int -main () +main (void) { initscr (); ; @@ -8428,16 +8950,16 @@ initscr (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8431: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8953: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8434: \$? = $ac_status" >&5 + echo "$as_me:8956: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8437: \"$ac_try\"") >&5 + { (eval echo "$as_me:8959: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8440: \$? = $ac_status" >&5 + echo "$as_me:8962: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_gpm_initscr=yes else @@ -8448,7 +8970,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:8451: result: $ac_cv_lib_gpm_initscr" >&5 +echo "$as_me:8973: result: $ac_cv_lib_gpm_initscr" >&5 echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6 if test $ac_cv_lib_gpm_initscr = yes; then LIBS="$cf_ncurses_SAVE" @@ -8458,12 +8980,12 @@ fi fi -case $host_os in #(vi -freebsd*) +case $host_os in +(freebsd*) # This is only necessary if you are linking against an obsolete # version of ncurses (but it should do no harm, since it's static). if test "$cf_nculib_root" = ncurses ; then - echo "$as_me:8466: checking for tgoto in -lmytinfo" >&5 + echo "$as_me:8988: checking for tgoto in -lmytinfo" >&5 echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8471,7 +8993,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lmytinfo $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 8474 "configure" +#line 8996 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -8482,7 +9004,7 @@ extern "C" builtin and then its argument prototype would still apply. */ char tgoto (); int -main () +main (void) { tgoto (); ; @@ -8490,16 +9012,16 @@ tgoto (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8493: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9015: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8496: \$? = $ac_status" >&5 + echo "$as_me:9018: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8499: \"$ac_try\"") >&5 + { (eval echo "$as_me:9021: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8502: \$? = $ac_status" >&5 + echo "$as_me:9024: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_mytinfo_tgoto=yes else @@ -8510,7 +9032,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:8513: result: $ac_cv_lib_mytinfo_tgoto" >&5 +echo "$as_me:9035: result: $ac_cv_lib_mytinfo_tgoto" >&5 echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 if test $ac_cv_lib_mytinfo_tgoto = yes; then cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS" @@ -8520,62 +9042,92 @@ fi ;; esac -LIBS="$cf_ncurses_LIBS $LIBS" +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_ncurses_LIBS; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) then - LIBS="-l$cf_nculib_root $LIBS" + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -l$cf_nculib_root; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + else eval 'cf_cv_have_lib_'$cf_nculib_root'=no' cf_libdir="" - echo "$as_me:8532: checking for initscr" >&5 + echo "$as_me:9084: checking for initscr" >&5 echo $ECHO_N "checking for initscr... $ECHO_C" >&6 if test "${ac_cv_func_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8538 "configure" +#line 9090 "configure" #include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char initscr (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ +#define initscr autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef initscr + #ifdef __cplusplus extern "C" #endif + /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char initscr (); -char (*f) (); +char initscr (void); int -main () +main (void) { -/* The GNU C library defines this for functions which it implements + +/* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_initscr) || defined (__stub___initscr) -choke me -#else -f = initscr; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#error found stub for initscr #endif + return initscr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8569: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9121: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8572: \$? = $ac_status" >&5 + echo "$as_me:9124: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8575: \"$ac_try\"") >&5 + { (eval echo "$as_me:9127: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8578: \$? = $ac_status" >&5 + echo "$as_me:9130: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_initscr=yes else @@ -8585,22 +9137,22 @@ ac_cv_func_initscr=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:8588: result: $ac_cv_func_initscr" >&5 +echo "$as_me:9140: result: $ac_cv_func_initscr" >&5 echo "${ECHO_T}$ac_cv_func_initscr" >&6 if test $ac_cv_func_initscr = yes; then eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' else cf_save_LIBS="$LIBS" - echo "$as_me:8595: checking for initscr in -l$cf_nculib_root" >&5 + echo "$as_me:9147: checking for initscr in -l$cf_nculib_root" >&5 echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6 LIBS="-l$cf_nculib_root $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 8599 "configure" +#line 9151 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { initscr() ; @@ -8608,25 +9160,25 @@ initscr() } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8611: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9163: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8614: \$? = $ac_status" >&5 + echo "$as_me:9166: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8617: \"$ac_try\"") >&5 + { (eval echo "$as_me:9169: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8620: \$? = $ac_status" >&5 + echo "$as_me:9172: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - echo "$as_me:8622: result: yes" >&5 + echo "$as_me:9174: result: yes" >&5 echo "${ECHO_T}yes" >&6 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -echo "$as_me:8629: result: no" >&5 +echo "$as_me:9181: result: no" >&5 echo "${ECHO_T}no" >&6 cf_search= @@ -8634,8 +9186,8 @@ cf_library_path_list="" if test -n "${LDFLAGS}${LIBS}" ; then for cf_library_path in $LDFLAGS $LIBS do - case $cf_library_path in #(vi - -L*) + case $cf_library_path in + (-L*) cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` test "x$cf_library_path" != "xNONE" && \ @@ -8657,17 +9209,6 @@ fi cf_search= -test "x/usr" != "x$prefix" && \ -test -d "/usr" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/usr" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr" - test -d /usr/lib && cf_search="$cf_search /usr/lib" - test -d /usr/lib/$cf_nculib_root && cf_search="$cf_search /usr/lib/$cf_nculib_root" - test -d /usr/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/lib/$cf_nculib_root/lib" - test -d /usr/$cf_nculib_root/lib && cf_search="$cf_search /usr/$cf_nculib_root/lib" - test -d /usr/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/$cf_nculib_root/lib/$cf_nculib_root" -} - test "x$prefix" != "xNONE" && \ test -d "$prefix" && \ { @@ -8679,52 +9220,41 @@ test -d "$prefix" && \ test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root" } -test "x/usr/local" != "x$prefix" && \ -test -d "/usr/local" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/usr/local" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" - test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" - test -d /usr/local/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/lib/$cf_nculib_root" - test -d /usr/local/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/lib/$cf_nculib_root/lib" - test -d /usr/local/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/$cf_nculib_root/lib" - test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root" -} +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + $HOME +do -test "x/opt" != "x$prefix" && \ -test -d "/opt" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x/opt" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under /opt" - test -d /opt/lib && cf_search="$cf_search /opt/lib" - test -d /opt/lib/$cf_nculib_root && cf_search="$cf_search /opt/lib/$cf_nculib_root" - test -d /opt/lib/$cf_nculib_root/lib && cf_search="$cf_search /opt/lib/$cf_nculib_root/lib" - test -d /opt/$cf_nculib_root/lib && cf_search="$cf_search /opt/$cf_nculib_root/lib" - test -d /opt/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root" +test "x$cf_subdir_prefix" != "x$prefix" && \ +test -d "$cf_subdir_prefix" && \ +(test -z "$prefix" || test x$prefix = xNONE || test "x$cf_subdir_prefix" != "x$prefix") && { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_subdir_prefix" + test -d $cf_subdir_prefix/lib && cf_search="$cf_search $cf_subdir_prefix/lib" + test -d $cf_subdir_prefix/lib/$cf_nculib_root && cf_search="$cf_search $cf_subdir_prefix/lib/$cf_nculib_root" + test -d $cf_subdir_prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $cf_subdir_prefix/lib/$cf_nculib_root/lib" + test -d $cf_subdir_prefix/$cf_nculib_root/lib && cf_search="$cf_search $cf_subdir_prefix/$cf_nculib_root/lib" + test -d $cf_subdir_prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $cf_subdir_prefix/$cf_nculib_root/lib/$cf_nculib_root" } -test "x$HOME" != "x$prefix" && \ -test -d "$HOME" && \ -(test -z "$prefix" || test x$prefix = xNONE || test "x$HOME" != "x$prefix") && { - test -n "$verbose" && echo " ... testing for lib-directories under $HOME" - test -d $HOME/lib && cf_search="$cf_search $HOME/lib" - test -d $HOME/lib/$cf_nculib_root && cf_search="$cf_search $HOME/lib/$cf_nculib_root" - test -d $HOME/lib/$cf_nculib_root/lib && cf_search="$cf_search $HOME/lib/$cf_nculib_root/lib" - test -d $HOME/$cf_nculib_root/lib && cf_search="$cf_search $HOME/$cf_nculib_root/lib" - test -d $HOME/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root" -} +done cf_search="$cf_library_path_list $cf_search" for cf_libdir in $cf_search do - echo "$as_me:8719: checking for -l$cf_nculib_root in $cf_libdir" >&5 + echo "$as_me:9249: checking for -l$cf_nculib_root in $cf_libdir" >&5 echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6 LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 8723 "configure" +#line 9253 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { initscr() ; @@ -8732,25 +9262,25 @@ initscr() } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8735: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9265: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8738: \$? = $ac_status" >&5 + echo "$as_me:9268: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8741: \"$ac_try\"") >&5 + { (eval echo "$as_me:9271: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8744: \$? = $ac_status" >&5 + echo "$as_me:9274: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - echo "$as_me:8746: result: yes" >&5 + echo "$as_me:9276: result: yes" >&5 echo "${ECHO_T}yes" >&6 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -echo "$as_me:8753: result: no" >&5 +echo "$as_me:9283: result: no" >&5 echo "${ECHO_T}no" >&6 LIBS="$cf_save_LIBS" fi @@ -8765,7 +9295,7 @@ fi eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root if test $cf_found_library = no ; then - { { echo "$as_me:8768: error: Cannot link $cf_nculib_root library" >&5 + { { echo "$as_me:9298: error: Cannot link $cf_nculib_root library" >&5 echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;} { (exit 1); exit 1; }; } fi @@ -8773,7 +9303,7 @@ fi fi if test -n "$cf_ncurses_LIBS" ; then - echo "$as_me:8776: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 + echo "$as_me:9306: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6 cf_ncurses_SAVE="$LIBS" for p in $cf_ncurses_LIBS ; do @@ -8783,11 +9313,11 @@ echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS.. fi done cat >conftest.$ac_ext <<_ACEOF -#line 8786 "configure" +#line 9316 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); ; @@ -8795,23 +9325,23 @@ initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8798: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9328: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8801: \$? = $ac_status" >&5 + echo "$as_me:9331: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8804: \"$ac_try\"") >&5 + { (eval echo "$as_me:9334: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8807: \$? = $ac_status" >&5 + echo "$as_me:9337: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - echo "$as_me:8809: result: yes" >&5 + echo "$as_me:9339: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -echo "$as_me:8814: result: no" >&5 +echo "$as_me:9344: result: no" >&5 echo "${ECHO_T}no" >&6 LIBS="$cf_ncurses_SAVE" fi @@ -8824,1167 +9354,4579 @@ cat >>confdefs.h <&5 -echo $ECHO_N "checking for X... $ECHO_C" >&6 +(ncurses*) -# Check whether --with-x or --without-x was given. -if test "${with_x+set}" = set; then - withval="$with_x" +cf_ncuconfig_root=$cf_cv_screen +cf_have_ncuconfig=no -fi; -# $have_x is `yes', `no', `disabled', or empty when we do not yet know. -if test "x$with_x" = xno; then - # The user explicitly disabled X. - have_x=disabled -else - if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then - # Both variables are already set. - have_x=yes - else - if test "${ac_cv_have_x+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # One or both of the vars are not set, and there is no cached value. -ac_x_includes=no ac_x_libraries=no -rm -fr conftest.dir -if mkdir conftest.dir; then - cd conftest.dir - # Make sure to not put "make" in the Imakefile rules, since we grep it out. - cat >Imakefile <<'EOF' -acfindx: - @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' -EOF - if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then - # GNU make sometimes prints "make[1]: Entering...", which would confuse us. - eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` - # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. - for ac_extension in a so sl dylib dll; do - if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && - test -f $ac_im_libdir/libX11.$ac_extension; then - ac_im_usrlibdir=$ac_im_libdir; break - fi - done - # Screen out bogus values from the imake configuration. They are - # bogus both because they are the default anyway, and because - # using them would break gcc on systems where it needs fixed includes. - case $ac_im_incroot in - /usr/include) ;; - *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; - esac - case $ac_im_usrlibdir in - /usr/lib | /lib) ;; - *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; - esac - fi - cd .. - rm -fr conftest.dir -fi +if test "x${PKG_CONFIG:=none}" != xnone; then + echo "$as_me:9369: checking pkg-config for $cf_ncuconfig_root" >&5 +echo $ECHO_N "checking pkg-config for $cf_ncuconfig_root... $ECHO_C" >&6 + if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then + echo "$as_me:9372: result: yes" >&5 +echo "${ECHO_T}yes" >&6 -# Standard set of common directories for X headers. -# Check X11 before X11Rn because it is often a symlink to the current release. -ac_x_header_dirs=' -/usr/X11/include -/usr/X11R6/include -/usr/X11R5/include -/usr/X11R4/include + echo "$as_me:9375: checking if the $cf_ncuconfig_root package files work" >&5 +echo $ECHO_N "checking if the $cf_ncuconfig_root package files work... $ECHO_C" >&6 + cf_have_ncuconfig=unknown -/usr/include/X11 -/usr/include/X11R6 -/usr/include/X11R5 -/usr/include/X11R4 + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" -/usr/local/X11/include -/usr/local/X11R6/include -/usr/local/X11R5/include -/usr/local/X11R4/include +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= -/usr/local/include/X11 -/usr/local/include/X11R6 -/usr/local/include/X11R5 -/usr/local/include/X11R4 +for cf_add_cflags in `$PKG_CONFIG --cflags $cf_ncuconfig_root` +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -/usr/X386/include -/usr/x386/include -/usr/XFree86/include/X11 + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes -/usr/include -/usr/local/include -/usr/unsupported/include -/usr/athena/include -/usr/local/x11r5/include -/usr/lpp/Xamples/include + if test $cf_fix_cppflags = yes ; then -/usr/openwin/include -/usr/openwin/share/include' + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" -if test "$ac_x_includes" = no; then - # Guess where to find include files, by looking for Intrinsic.h. - # First, try using that file with no special directory specified. - cat >conftest.$ac_ext <<_ACEOF -#line 8928 "configure" -#include "confdefs.h" -#include -_ACEOF -if { (eval echo "$as_me:8932: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:8938: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # We can compile using X headers with no special include directory. -ac_x_includes= -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - for ac_dir in $ac_x_header_dirs; do - if test -r "$ac_dir/X11/Intrinsic.h"; then - ac_x_includes=$ac_dir - break - fi + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi -rm -f conftest.err conftest.$ac_ext -fi # $ac_x_includes = no -if test "$ac_x_libraries" = no; then - # Check for the libraries. - # See if we find them without any special options. - # Don't add to $LIBS permanently. - ac_save_LIBS=$LIBS - LIBS="-lXt $LIBS" - cat >conftest.$ac_ext <<_ACEOF -#line 8971 "configure" +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in `$PKG_CONFIG --libs $cf_ncuconfig_root`; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + cat >conftest.$ac_ext <<_ACEOF +#line 9497 "configure" #include "confdefs.h" -#include +#include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { -XtMalloc (0) +initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8983: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9509: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8986: \$? = $ac_status" >&5 + echo "$as_me:9512: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8989: \"$ac_try\"") >&5 + { (eval echo "$as_me:9515: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8992: \$? = $ac_status" >&5 + echo "$as_me:9518: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - LIBS=$ac_save_LIBS -# We can link X programs with no special library path. -ac_x_libraries= + if test "$cross_compiling" = yes; then + cf_have_ncuconfig=maybe +else + cat >conftest.$ac_ext <<_ACEOF +#line 9524 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> + int main(void) + { char *xx = curses_version(); return (xx == 0); } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:9531: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9534: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:9536: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9539: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_have_ncuconfig=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_ncuconfig=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -LIBS=$ac_save_LIBS -for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` -do - # Don't even attempt the hair of trying to link an X program! - for ac_extension in a so sl dylib dll; do - if test -r $ac_dir/libXt.$ac_extension; then - ac_x_libraries=$ac_dir - break 2 - fi - done -done +cf_have_ncuconfig=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi # $ac_x_libraries = no - -if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then - # Didn't find X anywhere. Cache the known absence of X. - ac_cv_have_x="have_x=no" -else - # Record where we found X for the cache. - ac_cv_have_x="have_x=yes \ - ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" -fi -fi - - fi - eval "$ac_cv_have_x" -fi # $with_x != no - -if test "$have_x" != yes; then - echo "$as_me:9030: result: $have_x" >&5 -echo "${ECHO_T}$have_x" >&6 - no_x=yes -else - # If each of the values was on the command line, it overrides each guess. - test "x$x_includes" = xNONE && x_includes=$ac_x_includes - test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries - # Update the cache value to reflect the command line values. - ac_cv_have_x="have_x=yes \ - ac_x_includes=$x_includes ac_x_libraries=$x_libraries" - echo "$as_me:9040: result: libraries $x_libraries, headers $x_includes" >&5 -echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 -fi - -if test "$no_x" = yes; then - # Not all programs may use this symbol, but it does not hurt to define it. + echo "$as_me:9556: result: $cf_have_ncuconfig" >&5 +echo "${ECHO_T}$cf_have_ncuconfig" >&6 + test "$cf_have_ncuconfig" = maybe && cf_have_ncuconfig=yes + if test "$cf_have_ncuconfig" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + NCURSES_CONFIG_PKG=none + else cat >>confdefs.h <<\EOF -#define X_DISPLAY_MISSING 1 +#define NCURSES 1 EOF - X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= + NCURSES_CONFIG_PKG=$cf_ncuconfig_root + +echo "$as_me:9572: checking for terminfo header" >&5 +echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 +if test "${cf_cv_term_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$x_includes"; then - X_CFLAGS="$X_CFLAGS -I$x_includes" - fi - # It would also be nice to do this for all -L options, not just this one. - if test -n "$x_libraries"; then - X_LIBS="$X_LIBS -L$x_libraries" - # For Solaris; some versions of Sun CC require a space after -R and - # others require no space. Words are not sufficient . . . . - case `(uname -sr) 2>/dev/null` in - "SunOS 5"*) - echo "$as_me:9064: checking whether -R must be followed by a space" >&5 -echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 - ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" - cat >conftest.$ac_ext <<_ACEOF -#line 9068 "configure" +case ${cf_cv_ncurses_header} in +(*/ncurses.h|*/ncursesw.h) + cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` + ;; +(*) + cf_term_header=term.h + ;; +esac + +for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" +do +cat >conftest.$ac_ext <<_ACEOF +#line 9590 "configure" #include "confdefs.h" +#include +#include <${cf_cv_ncurses_header:-curses.h}> +#include <$cf_test> int -main () +main (void) { - +int x = auto_left_margin ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9080: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9605: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9083: \$? = $ac_status" >&5 + echo "$as_me:9608: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9086: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9611: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9089: \$? = $ac_status" >&5 + echo "$as_me:9614: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_R_nospace=yes + + cf_cv_term_header="$cf_test" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -ac_R_nospace=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - if test $ac_R_nospace = yes; then - echo "$as_me:9099: result: no" >&5 -echo "${ECHO_T}no" >&6 - X_LIBS="$X_LIBS -R$x_libraries" - else - LIBS="$ac_xsave_LIBS -R $x_libraries" - cat >conftest.$ac_ext <<_ACEOF -#line 9105 "configure" -#include "confdefs.h" -int -main () -{ + cf_cv_term_header=unknown - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9117: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:9120: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9123: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:9126: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_R_space=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_R_space=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - if test $ac_R_space = yes; then - echo "$as_me:9136: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - X_LIBS="$X_LIBS -R $x_libraries" - else - echo "$as_me:9140: result: neither works" >&5 -echo "${ECHO_T}neither works" >&6 - fi - fi - LIBS=$ac_xsave_LIBS - esac - fi +rm -f conftest.$ac_objext conftest.$ac_ext + test "$cf_cv_term_header" != unknown && break +done - # Check for system-dependent libraries X programs must link with. - # Do this before checking for the system-independent R6 libraries - # (-lICE), since we may need -lsocket or whatever for X linking. +fi +echo "$as_me:9630: result: $cf_cv_term_header" >&5 +echo "${ECHO_T}$cf_cv_term_header" >&6 - if test "$ISC" = yes; then - X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" - else - # Martyn Johnson says this is needed for Ultrix, if the X - # libraries were built with DECnet support. And Karl Berry says - # the Alpha needs dnet_stub (dnet does not exist). - ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" - cat >conftest.$ac_ext <<_ACEOF -#line 9160 "configure" -#include "confdefs.h" +# Set definitions to allow ifdef'ing to accommodate subdirectories -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char XOpenDisplay (); -int -main () -{ -XOpenDisplay (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9179: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:9182: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9185: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:9188: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : +case $cf_cv_term_header in +(*term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_TERM_H 1 +EOF + + ;; +esac + +case $cf_cv_term_header in +(ncurses/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_TERM_H 1 +EOF + + ;; +(ncursesw/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_TERM_H 1 +EOF + + ;; +esac + + fi + + else + echo "$as_me:9665: result: no" >&5 +echo "${ECHO_T}no" >&6 + NCURSES_CONFIG_PKG=none + fi else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:9194: checking for dnet_ntoa in -ldnet" >&5 -echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 -if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then + NCURSES_CONFIG_PKG=none +fi + +if test "x$cf_have_ncuconfig" = "xno"; then + cf_ncurses_config="${cf_ncuconfig_root}${NCURSES_CONFIG_SUFFIX}-config"; echo "Looking for ${cf_ncurses_config}" + +if test -n "$ac_tool_prefix"; then + for ac_prog in ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:9681: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldnet $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 9202 "configure" -#include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dnet_ntoa (); -int -main () -{ -dnet_ntoa (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9221: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:9224: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9227: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:9230: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dnet_dnet_ntoa=yes + if test -n "$NCURSES_CONFIG"; then + ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test. else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_dnet_dnet_ntoa=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog" +echo "$as_me:9696: found $ac_dir/$ac_word" >&5 +break +done + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:9241: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 -echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 -if test $ac_cv_lib_dnet_dnet_ntoa = yes; then - X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" +NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG +if test -n "$NCURSES_CONFIG"; then + echo "$as_me:9704: result: $NCURSES_CONFIG" >&5 +echo "${ECHO_T}$NCURSES_CONFIG" >&6 +else + echo "$as_me:9707: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test $ac_cv_lib_dnet_dnet_ntoa = no; then - echo "$as_me:9248: checking for dnet_ntoa in -ldnet_stub" >&5 -echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 -if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then + test -n "$NCURSES_CONFIG" && break + done +fi +if test -z "$NCURSES_CONFIG"; then + ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG + for ac_prog in ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:9720: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldnet_stub $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 9256 "configure" -#include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dnet_ntoa (); -int -main () -{ -dnet_ntoa (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9275: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:9278: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9281: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:9284: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dnet_stub_dnet_ntoa=yes + if test -n "$ac_ct_NCURSES_CONFIG"; then + ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test. else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_dnet_stub_dnet_ntoa=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog" +echo "$as_me:9735: found $ac_dir/$ac_word" >&5 +break +done + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:9295: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 -echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 -if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then - X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" +ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG +if test -n "$ac_ct_NCURSES_CONFIG"; then + echo "$as_me:9743: result: $ac_ct_NCURSES_CONFIG" >&5 +echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6 +else + echo "$as_me:9746: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - fi + test -n "$ac_ct_NCURSES_CONFIG" && break +done +test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none" + + NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS="$ac_xsave_LIBS" - # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, - # to get the SysV transport functions. - # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) - # needs -lnsl. - # The nsl library prevents programs from opening the X display - # on Irix 5.2, according to T.E. Dickey. - # The functions gethostbyname, getservbyname, and inet_addr are - # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. - echo "$as_me:9314: checking for gethostbyname" >&5 -echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 -if test "${ac_cv_func_gethostbyname+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 9320 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gethostbyname (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostbyname (); -char (*f) (); + if test "$NCURSES_CONFIG" != none ; then -int -main () -{ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) -choke me -#else -f = gethostbyname; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -#endif +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in `$NCURSES_CONFIG --cflags` +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9351: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:9354: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9357: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:9360: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_gethostbyname=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_func_gethostbyname=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + fi -echo "$as_me:9370: result: $ac_cv_func_gethostbyname" >&5 -echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 - if test $ac_cv_func_gethostbyname = no; then - echo "$as_me:9374: checking for gethostbyname in -lnsl" >&5 -echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 -if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in `$NCURSES_CONFIG --libs`; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + # even with config script, some packages use no-override for curses.h + +echo "$as_me:9875: checking if we have identified curses headers" >&5 +echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 +if test "${cf_cv_ncurses_header+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" + +cf_cv_ncurses_header=none +for cf_header in \ + ncurses.h $cf_cv_screen/ncurses.h \ + curses.h $cf_cv_screen/curses.h +do cat >conftest.$ac_ext <<_ACEOF -#line 9382 "configure" +#line 9887 "configure" #include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostbyname (); +#include <${cf_header}> int -main () +main (void) { -gethostbyname (); +initscr(); tgoto("?", 0,0) ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9401: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9899: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9404: \$? = $ac_status" >&5 + echo "$as_me:9902: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9407: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9905: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9410: \$? = $ac_status" >&5 + echo "$as_me:9908: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_nsl_gethostbyname=yes + cf_cv_ncurses_header=$cf_header; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -ac_cv_lib_nsl_gethostbyname=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f conftest.$ac_objext conftest.$ac_ext +done + fi -echo "$as_me:9421: result: $ac_cv_lib_nsl_gethostbyname" >&5 -echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 -if test $ac_cv_lib_nsl_gethostbyname = yes; then - X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" +echo "$as_me:9919: result: $cf_cv_ncurses_header" >&5 +echo "${ECHO_T}$cf_cv_ncurses_header" >&6 + +if test "$cf_cv_ncurses_header" = none ; then + { { echo "$as_me:9923: error: No curses header-files found" >&5 +echo "$as_me: error: No curses header-files found" >&2;} + { (exit 1); exit 1; }; } fi - if test $ac_cv_lib_nsl_gethostbyname = no; then - echo "$as_me:9428: checking for gethostbyname in -lbsd" >&5 -echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 -if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then +# cheat, to get the right #define's for HAVE_NCURSES_H, etc. + +for ac_header in $cf_cv_ncurses_header +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:9933: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lbsd $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 9436 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9939 "configure" #include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostbyname (); -int -main () -{ -gethostbyname (); - ; - return 0; -} +#include <$ac_header> _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9455: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (eval echo "$as_me:9943: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - echo "$as_me:9458: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9461: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:9464: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_bsd_gethostbyname=yes + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:9949: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_bsd_gethostbyname=no + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:9475: result: $ac_cv_lib_bsd_gethostbyname" >&5 -echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 -if test $ac_cv_lib_bsd_gethostbyname = yes; then - X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" +echo "$as_me:9968: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <>confdefs.h <<\EOF +#define NCURSES 1 +EOF - # lieder@skyler.mavd.honeywell.com says without -lsocket, - # socket/setsockopt and other routines are undefined under SCO ODT - # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary - # on later versions), says Simon Leinen: it contains gethostby* - # variants that don't use the nameserver (or something). -lsocket - # must be given before -lnsl if both are needed. We assume that - # if connect needs -lnsl, so does gethostbyname. - echo "$as_me:9491: checking for connect" >&5 -echo $ECHO_N "checking for connect... $ECHO_C" >&6 -if test "${ac_cv_func_connect+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 9497 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char connect (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char connect (); -char (*f) (); +cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -int -main () -{ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_connect) || defined (__stub___connect) -choke me -#else -f = connect; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -#endif + cat >>confdefs.h <&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:9531: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9534: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:9537: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_connect=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_func_connect=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:9547: result: $ac_cv_func_connect" >&5 -echo "${ECHO_T}$ac_cv_func_connect" >&6 + cf_cv_ncurses_version=`$NCURSES_CONFIG --version` - if test $ac_cv_func_connect = no; then - echo "$as_me:9551: checking for connect in -lsocket" >&5 -echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 -if test "${ac_cv_lib_socket_connect+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $X_EXTRA_LIBS $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 9559 "configure" -#include "confdefs.h" + else -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char connect (); +cf_ncuhdr_root=$cf_cv_screen + +test -n "$cf_cv_curses_dir" && \ +test "$cf_cv_curses_dir" != "no" && { \ + +if test -n "$cf_cv_curses_dir/include/$cf_ncuhdr_root" ; then + for cf_add_incdir in $cf_cv_curses_dir/include/$cf_ncuhdr_root + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-I$cf_add_incdir" + + cat >conftest.$ac_ext <<_ACEOF +#line 10024 "configure" +#include "confdefs.h" +#include int -main () +main (void) { -connect (); +printf("Hello") ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9578: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10036: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9581: \$? = $ac_status" >&5 + echo "$as_me:10039: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9584: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10042: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9587: \$? = $ac_status" >&5 + echo "$as_me:10045: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_socket_connect=yes + : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -ac_cv_lib_socket_connect=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +cf_have_incdir=yes fi -echo "$as_me:9598: result: $ac_cv_lib_socket_connect" >&5 -echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 -if test $ac_cv_lib_socket_connect = yes; then - X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me:-configure}:10062: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done fi - fi +} - # Guillermo Gomez says -lposix is necessary on A/UX. - echo "$as_me:9607: checking for remove" >&5 -echo $ECHO_N "checking for remove... $ECHO_C" >&6 -if test "${ac_cv_func_remove+set}" = set; then +echo "$as_me:10081: checking for $cf_ncuhdr_root header in include-path" >&5 +echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6 +if test "${cf_cv_ncurses_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -#line 9613 "configure" + + cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" + ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" + for cf_header in $cf_header_list + do + + cat >conftest.$ac_ext <<_ACEOF +#line 10093 "configure" #include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char remove (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char remove (); -char (*f) (); +#include <$cf_header> int -main () +main (void) { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_remove) || defined (__stub___remove) -choke me + +#ifdef NCURSES_VERSION + +printf("%s\n", NCURSES_VERSION); +#else +#ifdef __NCURSES_H +printf("old\n"); #else -f = remove; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; + make an error +#endif #endif ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9644: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10117: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9647: \$? = $ac_status" >&5 + echo "$as_me:10120: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9650: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10123: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9653: \$? = $ac_status" >&5 + echo "$as_me:10126: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_remove=yes + cf_cv_ncurses_h=$cf_header + else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -ac_cv_func_remove=no +cf_cv_ncurses_h=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.$ac_objext conftest.$ac_ext + + test "$cf_cv_ncurses_h" != no && break + done + fi -echo "$as_me:9663: result: $ac_cv_func_remove" >&5 -echo "${ECHO_T}$ac_cv_func_remove" >&6 +echo "$as_me:10141: result: $cf_cv_ncurses_h" >&5 +echo "${ECHO_T}$cf_cv_ncurses_h" >&6 - if test $ac_cv_func_remove = no; then - echo "$as_me:9667: checking for remove in -lposix" >&5 -echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 -if test "${ac_cv_lib_posix_remove+set}" = set; then +if test "$cf_cv_ncurses_h" != no ; then + cf_cv_ncurses_header=$cf_cv_ncurses_h +else + +echo "$as_me:10148: checking for $cf_ncuhdr_root include-path" >&5 +echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6 +if test "${cf_cv_ncurses_h2+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lposix $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 9675 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char remove (); + test -n "$verbose" && echo + +cf_search= + +# collect the current set of include-directories from compiler flags +cf_header_path_list="" +if test -n "${CFLAGS}${CPPFLAGS}" ; then + for cf_header_path in $CPPFLAGS $CFLAGS + do + case $cf_header_path in + (-I*) + cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` + +test "x$cf_header_path" != "xNONE" && \ +test -d "$cf_header_path" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" + test -d $cf_header_path/include && cf_search="$cf_search $cf_header_path/include" + test -d $cf_header_path/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root" + test -d $cf_header_path/include/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root/include" + test -d $cf_header_path/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include" + test -d $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + + cf_header_path_list="$cf_header_path_list $cf_search" + ;; + esac + done +fi + +# add the variations for the package we are looking for + +cf_search= + +test "x$prefix" != "xNONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $prefix" + test -d $prefix/include && cf_search="$cf_search $prefix/include" + test -d $prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root" + test -d $prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include" + test -d $prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include" + test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + $HOME +do + +test "x$cf_subdir_prefix" != "x$prefix" && \ +test -d "$cf_subdir_prefix" && \ +(test -z "$prefix" || test x$prefix = xNONE || test "x$cf_subdir_prefix" != "x$prefix") && { + test -n "$verbose" && echo " ... testing for include-directories under $cf_subdir_prefix" + test -d $cf_subdir_prefix/include && cf_search="$cf_search $cf_subdir_prefix/include" + test -d $cf_subdir_prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_subdir_prefix/include/$cf_ncuhdr_root" + test -d $cf_subdir_prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_subdir_prefix/include/$cf_ncuhdr_root/include" + test -d $cf_subdir_prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_subdir_prefix/$cf_ncuhdr_root/include" + test -d $cf_subdir_prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_subdir_prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + +done + +test "$includedir" != NONE && \ +test "$includedir" != "/usr/include" && \ +test -d "$includedir" && { + test -d $includedir && cf_search="$cf_search $includedir" + test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root" +} + +test "$oldincludedir" != NONE && \ +test "$oldincludedir" != "/usr/include" && \ +test -d "$oldincludedir" && { + test -d $oldincludedir && cf_search="$cf_search $oldincludedir" + test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root" +} + +cf_search="$cf_search $cf_header_path_list" + + test -n "$verbose" && echo search path $cf_search + cf_save2_CPPFLAGS="$CPPFLAGS" + for cf_incdir in $cf_search + do + +if test -n "$cf_incdir" ; then + for cf_add_incdir in $cf_incdir + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-I$cf_add_incdir" + + cat >conftest.$ac_ext <<_ACEOF +#line 10269 "configure" +#include "confdefs.h" +#include int -main () +main (void) { -remove (); +printf("Hello") ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9694: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10281: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9697: \$? = $ac_status" >&5 + echo "$as_me:10284: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9700: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10287: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9703: \$? = $ac_status" >&5 + echo "$as_me:10290: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_posix_remove=yes + : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -ac_cv_lib_posix_remove=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +cf_have_incdir=yes fi -echo "$as_me:9714: result: $ac_cv_lib_posix_remove" >&5 -echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 -if test $ac_cv_lib_posix_remove = yes; then - X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me:-configure}:10307: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done fi - fi + for cf_header in \ + ncurses.h \ + curses.h + do - # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. - echo "$as_me:9723: checking for shmat" >&5 -echo $ECHO_N "checking for shmat... $ECHO_C" >&6 -if test "${ac_cv_func_shmat+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 9729 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 10330 "configure" #include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shmat (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char shmat (); -char (*f) (); +#include <$cf_header> int -main () +main (void) { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_shmat) || defined (__stub___shmat) -choke me + +#ifdef NCURSES_VERSION + +printf("%s\n", NCURSES_VERSION); +#else +#ifdef __NCURSES_H +printf("old\n"); #else -f = shmat; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; + make an error +#endif #endif ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9760: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10354: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9763: \$? = $ac_status" >&5 + echo "$as_me:10357: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9766: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10360: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9769: \$? = $ac_status" >&5 + echo "$as_me:10363: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_shmat=yes + cf_cv_ncurses_h2=$cf_header + else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -ac_cv_func_shmat=no +cf_cv_ncurses_h2=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + + if test "$cf_cv_ncurses_h2" != no ; then + cf_cv_ncurses_h2=$cf_incdir/$cf_header + test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&6 + break + fi + test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&6 + done + CPPFLAGS="$cf_save2_CPPFLAGS" + test "$cf_cv_ncurses_h2" != no && break + done + test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:10384: error: not found" >&5 +echo "$as_me: error: not found" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:10389: result: $cf_cv_ncurses_h2" >&5 +echo "${ECHO_T}$cf_cv_ncurses_h2" >&6 + + cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'` + cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` + if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then + cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header + fi + +if test -n "$cf_1st_incdir" ; then + for cf_add_incdir in $cf_1st_incdir + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-I$cf_add_incdir" + + cat >conftest.$ac_ext <<_ACEOF +#line 10425 "configure" +#include "confdefs.h" +#include +int +main (void) +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10437: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10440: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10443: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10446: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me:-configure}:10463: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done +fi + +fi + +# Set definitions to allow ifdef'ing for ncurses.h + +case $cf_cv_ncurses_header in +(*ncurses.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_H 1 +EOF + + ;; +esac + +case $cf_cv_ncurses_header in +(ncurses/curses.h|ncurses/ncurses.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_NCURSES_H 1 +EOF + + ;; +(ncursesw/curses.h|ncursesw/ncurses.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_NCURSES_H 1 +EOF + + ;; +esac + +echo "$as_me:10511: checking for terminfo header" >&5 +echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 +if test "${cf_cv_term_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +case ${cf_cv_ncurses_header} in +(*/ncurses.h|*/ncursesw.h) + cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` + ;; +(*) + cf_term_header=term.h + ;; +esac + +for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" +do +cat >conftest.$ac_ext <<_ACEOF +#line 10529 "configure" +#include "confdefs.h" +#include +#include <${cf_cv_ncurses_header:-curses.h}> +#include <$cf_test> + +int +main (void) +{ +int x = auto_left_margin + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10544: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10547: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10550: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10553: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_term_header="$cf_test" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cf_cv_term_header=unknown + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + test "$cf_cv_term_header" != unknown && break +done + +fi +echo "$as_me:10569: result: $cf_cv_term_header" >&5 +echo "${ECHO_T}$cf_cv_term_header" >&6 + +# Set definitions to allow ifdef'ing to accommodate subdirectories + +case $cf_cv_term_header in +(*term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_TERM_H 1 +EOF + + ;; +esac + +case $cf_cv_term_header in +(ncurses/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_TERM_H 1 +EOF + + ;; +(ncursesw/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_TERM_H 1 +EOF + + ;; +esac + +# some applications need this, but should check for NCURSES_VERSION + +cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +echo "$as_me:10607: checking for ncurses version" >&5 +echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 +if test "${cf_cv_ncurses_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_cv_ncurses_version=no + cf_tempfile=out$$ + rm -f $cf_tempfile + if test "$cross_compiling" = yes; then + + # This will not work if the preprocessor splits the line after the + # Autoconf token. The 'unproto' program does that. + cat > conftest.$ac_ext < +#undef Autoconf +#ifdef NCURSES_VERSION +Autoconf NCURSES_VERSION +#else +#ifdef __NCURSES_H +Autoconf "old" +#endif +; +#endif +EOF + cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" + { (eval echo "$as_me:10633: \"$cf_try\"") >&5 + (eval $cf_try) 2>&5 + ac_status=$? + echo "$as_me:10636: \$? = $ac_status" >&5 + (exit $ac_status); } + if test -f conftest.out ; then + cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` + test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" + rm -f conftest.out + fi + +else + cat >conftest.$ac_ext <<_ACEOF +#line 10646 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header:-curses.h}> +#include +int main(void) +{ + FILE *fp = fopen("$cf_tempfile", "w"); +#ifdef NCURSES_VERSION +# ifdef NCURSES_VERSION_PATCH + fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); +# else + fprintf(fp, "%s\n", NCURSES_VERSION); +# endif +#else +# ifdef __NCURSES_H + fprintf(fp, "old\n"); +# else + make an error +# endif +#endif + ${cf_cv_main_return:-return}(0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:10671: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10674: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:10676: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10679: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_ncurses_version=`cat $cf_tempfile` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + rm -f $cf_tempfile + +fi +echo "$as_me:10693: result: $cf_cv_ncurses_version" >&5 +echo "${ECHO_T}$cf_cv_ncurses_version" >&6 +test "$cf_cv_ncurses_version" = no || +cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +cf_nculib_root=$cf_cv_screen + # This works, except for the special case where we find gpm, but + # ncurses is in a nonstandard location via $LIBS, and we really want + # to link gpm. +cf_ncurses_LIBS="" +cf_ncurses_SAVE="$LIBS" +echo "$as_me:10706: checking for Gpm_Open in -lgpm" >&5 +echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 +if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgpm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 10714 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char Gpm_Open (); +int +main (void) +{ +Gpm_Open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10733: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10736: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10739: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10742: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gpm_Gpm_Open=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_gpm_Gpm_Open=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:10753: result: $ac_cv_lib_gpm_Gpm_Open" >&5 +echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 +if test $ac_cv_lib_gpm_Gpm_Open = yes; then + echo "$as_me:10756: checking for initscr in -lgpm" >&5 +echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6 +if test "${ac_cv_lib_gpm_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgpm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 10764 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); +int +main (void) +{ +initscr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10783: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10786: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10789: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10792: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gpm_initscr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_gpm_initscr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:10803: result: $ac_cv_lib_gpm_initscr" >&5 +echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6 +if test $ac_cv_lib_gpm_initscr = yes; then + LIBS="$cf_ncurses_SAVE" +else + cf_ncurses_LIBS="-lgpm" +fi + +fi + +case $host_os in +(freebsd*) + # This is only necessary if you are linking against an obsolete + # version of ncurses (but it should do no harm, since it's static). + if test "$cf_nculib_root" = ncurses ; then + echo "$as_me:10818: checking for tgoto in -lmytinfo" >&5 +echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 +if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmytinfo $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 10826 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto (); +int +main (void) +{ +tgoto (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10845: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10848: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10851: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10854: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_mytinfo_tgoto=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_mytinfo_tgoto=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:10865: result: $ac_cv_lib_mytinfo_tgoto" >&5 +echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 +if test $ac_cv_lib_mytinfo_tgoto = yes; then + cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS" +fi + + fi + ;; +esac + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_ncurses_LIBS; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) +then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -l$cf_nculib_root; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +else + + eval 'cf_cv_have_lib_'$cf_nculib_root'=no' + cf_libdir="" + echo "$as_me:10914: checking for initscr" >&5 +echo $ECHO_N "checking for initscr... $ECHO_C" >&6 +if test "${ac_cv_func_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 10920 "configure" +#include "confdefs.h" +#define initscr autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef initscr + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_initscr) || defined (__stub___initscr) +#error found stub for initscr +#endif + + return initscr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10951: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10954: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10957: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10960: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_initscr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_initscr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:10970: result: $ac_cv_func_initscr" >&5 +echo "${ECHO_T}$ac_cv_func_initscr" >&6 +if test $ac_cv_func_initscr = yes; then + eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' +else + + cf_save_LIBS="$LIBS" + echo "$as_me:10977: checking for initscr in -l$cf_nculib_root" >&5 +echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6 + LIBS="-l$cf_nculib_root $LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 10981 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main (void) +{ +initscr() + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10993: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10996: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10999: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11002: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:11004: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:11011: result: no" >&5 +echo "${ECHO_T}no" >&6 + +cf_search= +cf_library_path_list="" +if test -n "${LDFLAGS}${LIBS}" ; then + for cf_library_path in $LDFLAGS $LIBS + do + case $cf_library_path in + (-L*) + cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` + +test "x$cf_library_path" != "xNONE" && \ +test -d "$cf_library_path" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" + test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" + test -d $cf_library_path/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root" + test -d $cf_library_path/lib/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root/lib" + test -d $cf_library_path/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib" + test -d $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root" +} + + cf_library_path_list="$cf_library_path_list $cf_search" + ;; + esac + done +fi + +cf_search= + +test "x$prefix" != "xNONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $prefix" + test -d $prefix/lib && cf_search="$cf_search $prefix/lib" + test -d $prefix/lib/$cf_nculib_root && cf_search="$cf_search $prefix/lib/$cf_nculib_root" + test -d $prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib" + test -d $prefix/$cf_nculib_root/lib && cf_search="$cf_search $prefix/$cf_nculib_root/lib" + test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root" +} + +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + $HOME +do + +test "x$cf_subdir_prefix" != "x$prefix" && \ +test -d "$cf_subdir_prefix" && \ +(test -z "$prefix" || test x$prefix = xNONE || test "x$cf_subdir_prefix" != "x$prefix") && { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_subdir_prefix" + test -d $cf_subdir_prefix/lib && cf_search="$cf_search $cf_subdir_prefix/lib" + test -d $cf_subdir_prefix/lib/$cf_nculib_root && cf_search="$cf_search $cf_subdir_prefix/lib/$cf_nculib_root" + test -d $cf_subdir_prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $cf_subdir_prefix/lib/$cf_nculib_root/lib" + test -d $cf_subdir_prefix/$cf_nculib_root/lib && cf_search="$cf_search $cf_subdir_prefix/$cf_nculib_root/lib" + test -d $cf_subdir_prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $cf_subdir_prefix/$cf_nculib_root/lib/$cf_nculib_root" +} + +done + +cf_search="$cf_library_path_list $cf_search" + + for cf_libdir in $cf_search + do + echo "$as_me:11079: checking for -l$cf_nculib_root in $cf_libdir" >&5 +echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6 + LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 11083 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main (void) +{ +initscr() + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11095: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11098: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11101: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11104: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:11106: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:11113: result: no" >&5 +echo "${ECHO_T}no" >&6 + LIBS="$cf_save_LIBS" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi + +eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root + +if test $cf_found_library = no ; then + { { echo "$as_me:11128: error: Cannot link $cf_nculib_root library" >&5 +echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;} + { (exit 1); exit 1; }; } +fi + +fi + +if test -n "$cf_ncurses_LIBS" ; then + echo "$as_me:11136: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 +echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6 + cf_ncurses_SAVE="$LIBS" + for p in $cf_ncurses_LIBS ; do + q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` + if test "$q" != "$LIBS" ; then + LIBS="$q" + fi + done + cat >conftest.$ac_ext <<_ACEOF +#line 11146 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main (void) +{ +initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11158: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11161: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11164: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11167: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:11169: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:11174: result: no" >&5 +echo "${ECHO_T}no" >&6 + LIBS="$cf_ncurses_SAVE" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi + +cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for X... $ECHO_C" >&6 + +# Check whether --with-x or --without-x was given. +if test "${with_x+set}" = set; then + withval="$with_x" + +fi; +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then + # Both variables are already set. + have_x=yes + else + if test "${ac_cv_have_x+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=no ac_x_libraries=no +rm -fr conftest.dir +if mkdir conftest.dir; then + cd conftest.dir + # Make sure to not put "make" in the Imakefile rules, since we grep it out. + cat >Imakefile <<'EOF' +acfindx: + @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +EOF + if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl dylib dll; do + if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && + test -f $ac_im_libdir/libX11.$ac_extension; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case $ac_im_incroot in + /usr/include) ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; + esac + case $ac_im_usrlibdir in + /usr/lib | /lib) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; + esac + fi + cd .. + rm -fr conftest.dir +fi + +# Standard set of common directories for X headers. +# Check X11 before X11Rn because it is often a symlink to the current release. +ac_x_header_dirs=' +/usr/X11/include +/usr/X11R7/include +/usr/X11R6/include +/usr/X11R5/include +/usr/X11R4/include + +/opt/local/include +/opt/X11/include + +/usr/include/X11 +/usr/include/X11R7 +/usr/include/X11R6 +/usr/include/X11R5 +/usr/include/X11R4 + +/usr/local/X11/include +/usr/local/X11R7/include +/usr/local/X11R6/include +/usr/local/X11R5/include +/usr/local/X11R4/include + +/usr/local/include/X11 +/usr/local/include/X11R7 +/usr/local/include/X11R6 +/usr/local/include/X11R5 +/usr/local/include/X11R4 + +/usr/X386/include +/usr/x386/include +/usr/XFree86/include/X11 + +/usr/include +/usr/local/include +/usr/unsupported/include +/usr/athena/include +/usr/local/x11r5/include +/usr/lpp/Xamples/include + +/usr/openwin/include +/usr/openwin/share/include' + +if test "$ac_x_includes" = no; then + # Guess where to find include files, by looking for Intrinsic.h. + # First, try using that file with no special directory specified. + cat >conftest.$ac_ext <<_ACEOF +#line 11298 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:11302: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:11308: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # We can compile using X headers with no special include directory. +ac_x_includes= +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + for ac_dir in $ac_x_header_dirs; do + if test -r "$ac_dir/X11/Intrinsic.h"; then + ac_x_includes=$ac_dir + break + fi +done +fi +rm -f conftest.err conftest.$ac_ext +fi # $ac_x_includes = no + +if test "$ac_x_libraries" = no; then + # Check for the libraries. + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS=$LIBS + LIBS="-lXt $LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 11341 "configure" +#include "confdefs.h" +#include +int +main (void) +{ +XtMalloc (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11353: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11356: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11359: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11362: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + LIBS=$ac_save_LIBS +# We can link X programs with no special library path. +ac_x_libraries= +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +LIBS=$ac_save_LIBS +for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +do + # Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl dylib dll; do + if test -r $ac_dir/libXt.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi # $ac_x_libraries = no + +if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then + # Didn't find X anywhere. Cache the known absence of X. + ac_cv_have_x="have_x=no" +else + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" +fi +fi + + fi + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + echo "$as_me:11400: result: $have_x" >&5 +echo "${ECHO_T}$have_x" >&6 + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$x_includes ac_x_libraries=$x_libraries" + echo "$as_me:11410: result: libraries $x_libraries, headers $x_includes" >&5 +echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 +fi + +if test "$no_x" = yes; then + # Not all programs may use this symbol, but it does not hurt to define it. + +cat >>confdefs.h <<\EOF +#define X_DISPLAY_MISSING 1 +EOF + + X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= +else + if test -n "$x_includes"; then + X_CFLAGS="$X_CFLAGS -I$x_includes" + fi + + # It would also be nice to do this for all -L options, not just this one. + if test -n "$x_libraries"; then + X_LIBS="$X_LIBS -L$x_libraries" + # For Solaris; some versions of Sun CC require a space after -R and + # others require no space. Words are not sufficient . . . . + case `(uname -sr) 2>/dev/null` in + "SunOS 5"*) + echo "$as_me:11434: checking whether -R must be followed by a space" >&5 +echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 + ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" + cat >conftest.$ac_ext <<_ACEOF +#line 11438 "configure" +#include "confdefs.h" + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11450: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11453: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11456: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11459: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_R_nospace=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_R_nospace=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + if test $ac_R_nospace = yes; then + echo "$as_me:11469: result: no" >&5 +echo "${ECHO_T}no" >&6 + X_LIBS="$X_LIBS -R$x_libraries" + else + LIBS="$ac_xsave_LIBS -R $x_libraries" + cat >conftest.$ac_ext <<_ACEOF +#line 11475 "configure" +#include "confdefs.h" + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11487: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11490: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11493: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11496: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_R_space=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_R_space=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + if test $ac_R_space = yes; then + echo "$as_me:11506: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + X_LIBS="$X_LIBS -R $x_libraries" + else + echo "$as_me:11510: result: neither works" >&5 +echo "${ECHO_T}neither works" >&6 + fi + fi + LIBS=$ac_xsave_LIBS + esac + fi + + # Check for system-dependent libraries X programs must link with. + # Do this before checking for the system-independent R6 libraries + # (-lICE), since we may need -lsocket or whatever for X linking. + + if test "$ISC" = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" + else + # Martyn Johnson says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And Karl Berry says + # the Alpha needs dnet_stub (dnet does not exist). + ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" + cat >conftest.$ac_ext <<_ACEOF +#line 11530 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (); +int +main (void) +{ +XOpenDisplay (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11549: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11552: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11555: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11558: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:11564: checking for dnet_ntoa in -ldnet" >&5 +echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 +if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldnet $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11572 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dnet_ntoa (); +int +main (void) +{ +dnet_ntoa (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11591: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11594: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11597: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11600: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dnet_dnet_ntoa=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dnet_dnet_ntoa=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11611: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 +echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 +if test $ac_cv_lib_dnet_dnet_ntoa = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" +fi + + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + echo "$as_me:11618: checking for dnet_ntoa in -ldnet_stub" >&5 +echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 +if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldnet_stub $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11626 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dnet_ntoa (); +int +main (void) +{ +dnet_ntoa (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11645: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11648: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11651: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11654: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dnet_stub_dnet_ntoa=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dnet_stub_dnet_ntoa=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11665: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 +echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 +if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" +fi + + fi +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LIBS="$ac_xsave_LIBS" + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) + # needs -lnsl. + # The nsl library prevents programs from opening the X display + # on Irix 5.2, according to T.E. Dickey. + # The functions gethostbyname, getservbyname, and inet_addr are + # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. + echo "$as_me:11684: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11690 "configure" +#include "confdefs.h" +#define gethostbyname autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef gethostbyname + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +#error found stub for gethostbyname +#endif + + return gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11721: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11724: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11727: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11730: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:11740: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 + + if test $ac_cv_func_gethostbyname = no; then + echo "$as_me:11744: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11752 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main (void) +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11771: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11774: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11777: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11780: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_nsl_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11791: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" +fi + + if test $ac_cv_lib_nsl_gethostbyname = no; then + echo "$as_me:11798: checking for gethostbyname in -lbsd" >&5 +echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 +if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbsd $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11806 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main (void) +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11825: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11828: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11831: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11834: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_bsd_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_bsd_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11845: result: $ac_cv_lib_bsd_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 +if test $ac_cv_lib_bsd_gethostbyname = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" +fi + + fi + fi + + # lieder@skyler.mavd.honeywell.com says without -lsocket, + # socket/setsockopt and other routines are undefined under SCO ODT + # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary + # on later versions), says Simon Leinen: it contains gethostby* + # variants that don't use the nameserver (or something). -lsocket + # must be given before -lnsl if both are needed. We assume that + # if connect needs -lnsl, so does gethostbyname. + echo "$as_me:11861: checking for connect" >&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11867 "configure" +#include "confdefs.h" +#define connect autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef connect + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_connect) || defined (__stub___connect) +#error found stub for connect +#endif + + return connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11898: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11901: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11904: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11907: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_connect=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:11917: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 + + if test $ac_cv_func_connect = no; then + echo "$as_me:11921: checking for connect in -lsocket" >&5 +echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $X_EXTRA_LIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11929 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +int +main (void) +{ +connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11948: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11951: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11954: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11957: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_connect=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_socket_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11968: result: $ac_cv_lib_socket_connect" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 +if test $ac_cv_lib_socket_connect = yes; then + X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" +fi + + fi + + # Guillermo Gomez says -lposix is necessary on A/UX. + echo "$as_me:11977: checking for remove" >&5 +echo $ECHO_N "checking for remove... $ECHO_C" >&6 +if test "${ac_cv_func_remove+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11983 "configure" +#include "confdefs.h" +#define remove autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef remove + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char remove (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_remove) || defined (__stub___remove) +#error found stub for remove +#endif + + return remove (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12014: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12017: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12020: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12023: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_remove=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_remove=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:12033: result: $ac_cv_func_remove" >&5 +echo "${ECHO_T}$ac_cv_func_remove" >&6 + + if test $ac_cv_func_remove = no; then + echo "$as_me:12037: checking for remove in -lposix" >&5 +echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 +if test "${ac_cv_lib_posix_remove+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 12045 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char remove (); +int +main (void) +{ +remove (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12064: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12067: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12070: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12073: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_posix_remove=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_posix_remove=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:12084: result: $ac_cv_lib_posix_remove" >&5 +echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 +if test $ac_cv_lib_posix_remove = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" +fi + + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + echo "$as_me:12093: checking for shmat" >&5 +echo $ECHO_N "checking for shmat... $ECHO_C" >&6 +if test "${ac_cv_func_shmat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 12099 "configure" +#include "confdefs.h" +#define shmat autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef shmat + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shmat (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shmat) || defined (__stub___shmat) +#error found stub for shmat +#endif + + return shmat (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12130: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12133: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12136: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12139: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shmat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_shmat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:12149: result: $ac_cv_func_shmat" >&5 +echo "${ECHO_T}$ac_cv_func_shmat" >&6 + + if test $ac_cv_func_shmat = no; then + echo "$as_me:12153: checking for shmat in -lipc" >&5 +echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 +if test "${ac_cv_lib_ipc_shmat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lipc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 12161 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shmat (); +int +main (void) +{ +shmat (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12180: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12183: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12186: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12189: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ipc_shmat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_ipc_shmat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:12200: result: $ac_cv_lib_ipc_shmat" >&5 +echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 +if test $ac_cv_lib_ipc_shmat = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" +fi + + fi + fi + + # Check for libraries that X11R6 Xt/Xaw programs need. + ac_save_LDFLAGS=$LDFLAGS + test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" + # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to + # check for ICE first), but we must link in the order -lSM -lICE or + # we get undefined symbols. So assume we have SM if we have ICE. + # These have to be linked with before -lX11, unlike the other + # libraries we check for below, so use a different variable. + # John Interrante, Karl Berry + echo "$as_me:12218: checking for IceConnectionNumber in -lICE" >&5 +echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 +if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lICE $X_EXTRA_LIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 12226 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char IceConnectionNumber (); +int +main (void) +{ +IceConnectionNumber (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12245: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12248: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12251: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12254: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ICE_IceConnectionNumber=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_ICE_IceConnectionNumber=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:12265: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 +echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 +if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then + X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" +fi + + LDFLAGS=$ac_save_LDFLAGS + +fi + +cf_x_athena=${cf_x_athena:-Xaw} + +echo "$as_me:12277: checking if you want to link with Xaw 3d library" >&5 +echo $ECHO_N "checking if you want to link with Xaw 3d library... $ECHO_C" >&6 +withval= + +# Check whether --with-Xaw3d or --without-Xaw3d was given. +if test "${with_Xaw3d+set}" = set; then + withval="$with_Xaw3d" + +fi; +if test "$withval" = yes ; then + cf_x_athena=Xaw3d + echo "$as_me:12288: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:12291: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +echo "$as_me:12295: checking if you want to link with Xaw 3d xft library" >&5 +echo $ECHO_N "checking if you want to link with Xaw 3d xft library... $ECHO_C" >&6 +withval= + +# Check whether --with-Xaw3dxft or --without-Xaw3dxft was given. +if test "${with_Xaw3dxft+set}" = set; then + withval="$with_Xaw3dxft" + +fi; +if test "$withval" = yes ; then + cf_x_athena=Xaw3dxft + echo "$as_me:12306: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:12309: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +echo "$as_me:12313: checking if you want to link with neXT Athena library" >&5 +echo $ECHO_N "checking if you want to link with neXT Athena library... $ECHO_C" >&6 +withval= + +# Check whether --with-neXtaw or --without-neXtaw was given. +if test "${with_neXtaw+set}" = set; then + withval="$with_neXtaw" + +fi; +if test "$withval" = yes ; then + cf_x_athena=neXtaw + echo "$as_me:12324: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:12327: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +echo "$as_me:12331: checking if you want to link with Athena-Plus library" >&5 +echo $ECHO_N "checking if you want to link with Athena-Plus library... $ECHO_C" >&6 +withval= + +# Check whether --with-XawPlus or --without-XawPlus was given. +if test "${with_XawPlus+set}" = set; then + withval="$with_XawPlus" + +fi; +if test "$withval" = yes ; then + cf_x_athena=XawPlus + echo "$as_me:12342: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:12345: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +cf_x_athena_lib="" + +if test "$PKG_CONFIG" != none ; then + cf_athena_list= + test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" + for cf_athena_pkg in \ + $cf_athena_list \ + ${cf_x_athena} \ + ${cf_x_athena}-devel \ + lib${cf_x_athena} \ + lib${cf_x_athena}-devel + do + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $cf_athena_pkg; then + test -n "$verbose" && echo " found package $cf_athena_pkg" 1>&6 + +echo "${as_me:-configure}:12365: testing found package $cf_athena_pkg ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags $cf_athena_pkg 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs $cf_athena_pkg 2>/dev/null`" + test -n "$verbose" && echo " package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:12371: testing package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package $cf_athena_pkg LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:12375: testing package $cf_athena_pkg LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + cf_x_athena_lib="$cf_pkgconfig_libs" + +cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cat >>confdefs.h <&6 + +echo "${as_me:-configure}:12506: testing ..trimmed $LIBS ..." 1>&5 + + ;; + esac + done + +echo "$as_me:12512: checking for usable $cf_x_athena/Xmu package" >&5 +echo $ECHO_N "checking for usable $cf_x_athena/Xmu package... $ECHO_C" >&6 +if test "${cf_cv_xaw_compat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 12519 "configure" +#include "confdefs.h" + +#include + +int +main (void) +{ + +int check = XmuCompareISOLatin1("big", "small") + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12535: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12538: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12541: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12544: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xaw_compat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xaw_compat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:12554: result: $cf_cv_xaw_compat" >&5 +echo "${ECHO_T}$cf_cv_xaw_compat" >&6 + + if test "$cf_cv_xaw_compat" = no + then + # workaround for broken ".pc" files... + case "$cf_x_athena_lib" in + (*-lXmu*) + ;; + (*) + test -n "$verbose" && echo " work around broken package" 1>&6 + +echo "${as_me:-configure}:12566: testing work around broken package ..." 1>&5 + + cf_save_xmu="$LIBS" + cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^ *//' -e 's/ .*//'` + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xmu; then + test -n "$verbose" && echo " found package xmu" 1>&6 + +echo "${as_me:-configure}:12574: testing found package xmu ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags xmu 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs xmu 2>/dev/null`" + test -n "$verbose" && echo " package xmu CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:12580: testing package xmu CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package xmu LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:12584: testing package xmu LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + LIBS="$cf_save_xmu" + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:12704: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%$cf_first_lib %$cf_first_lib $cf_pkgconfig_libs %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:12709: testing ...after $LIBS ..." 1>&5 + +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:12717: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%$cf_first_lib %$cf_first_lib -lXmu %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:12722: testing ...after $LIBS ..." 1>&5 + +fi + + for cf_trim_lib in Xmu Xt X11 + do + case "$LIBS" in + (*-l$cf_trim_lib\ *-l$cf_trim_lib*) + LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` + test -n "$verbose" && echo " ..trimmed $LIBS" 1>&6 + +echo "${as_me:-configure}:12733: testing ..trimmed $LIBS ..." 1>&5 + + ;; + esac + done + + ;; + esac + fi + + break +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + : +fi + + done +fi + +if test -z "$cf_x_athena_lib" ; then + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists Xext; then + test -n "$verbose" && echo " found package Xext" 1>&6 + +echo "${as_me:-configure}:12758: testing found package Xext ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags Xext 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs Xext 2>/dev/null`" + test -n "$verbose" && echo " package Xext CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:12764: testing package Xext CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package Xext LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:12768: testing package Xext LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + + echo "$as_me:12889: checking for XextCreateExtension in -lXext" >&5 +echo $ECHO_N "checking for XextCreateExtension in -lXext... $ECHO_C" >&6 +if test "${ac_cv_lib_Xext_XextCreateExtension+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXext $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 12897 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XextCreateExtension (); +int +main (void) +{ +XextCreateExtension (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12916: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12919: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12922: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12925: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xext_XextCreateExtension=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_Xext_XextCreateExtension=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:12936: result: $ac_cv_lib_Xext_XextCreateExtension" >&5 +echo "${ECHO_T}$ac_cv_lib_Xext_XextCreateExtension" >&6 +if test $ac_cv_lib_Xext_XextCreateExtension = yes; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lXext; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +fi + +fi + +# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new) (and +# in some cases has installed dummy files in the former, other cases replaced +# it with a link to the new location). This complicates the configure script. +# Check for that pitfall, and recover using pkg-config +# +# If none of these are set, the configuration is almost certainly broken. +if test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}" +then + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists x11; then + test -n "$verbose" && echo " found package x11" 1>&6 + +echo "${as_me:-configure}:12972: testing found package x11 ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags x11 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs x11 2>/dev/null`" + test -n "$verbose" && echo " package x11 CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:12978: testing package x11 CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package x11 LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:12982: testing package x11 LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:13102: WARNING: unable to find X11 library" >&5 +echo "$as_me: WARNING: unable to find X11 library" >&2;} +fi + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists ice; then + test -n "$verbose" && echo " found package ice" 1>&6 + +echo "${as_me:-configure}:13109: testing found package ice ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags ice 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs ice 2>/dev/null`" + test -n "$verbose" && echo " package ice CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:13115: testing package ice CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package ice LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:13119: testing package ice LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:13239: WARNING: unable to find ICE library" >&5 +echo "$as_me: WARNING: unable to find ICE library" >&2;} +fi + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists sm; then + test -n "$verbose" && echo " found package sm" 1>&6 + +echo "${as_me:-configure}:13246: testing found package sm ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags sm 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs sm 2>/dev/null`" + test -n "$verbose" && echo " package sm CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:13252: testing package sm CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package sm LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:13256: testing package sm LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:13376: WARNING: unable to find SM library" >&5 +echo "$as_me: WARNING: unable to find SM library" >&2;} +fi + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xt; then + test -n "$verbose" && echo " found package xt" 1>&6 + +echo "${as_me:-configure}:13383: testing found package xt ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags xt 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs xt 2>/dev/null`" + test -n "$verbose" && echo " package xt CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:13389: testing package xt CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package xt LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:13393: testing package xt LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:13513: WARNING: unable to find Xt library" >&5 +echo "$as_me: WARNING: unable to find Xt library" >&2;} +fi + +fi + +cf_have_X_LIBS=no + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xt; then + test -n "$verbose" && echo " found package xt" 1>&6 + +echo "${as_me:-configure}:13524: testing found package xt ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags xt 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs xt 2>/dev/null`" + test -n "$verbose" && echo " package xt CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:13530: testing package xt CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package xt LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:13534: testing package xt LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + fi -echo "$as_me:9779: result: $ac_cv_func_shmat" >&5 -echo "${ECHO_T}$ac_cv_func_shmat" >&6 - if test $ac_cv_func_shmat = no; then - echo "$as_me:9783: checking for shmat in -lipc" >&5 -echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 -if test "${ac_cv_lib_ipc_shmat+set}" = set; then +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + case "x$LIBS" in + (*-lX11*) + ;; + (*) +# we have an "xt" package, but it may omit Xt's dependency on X11 +echo "$as_me:13655: checking for usable X dependency" >&5 +echo $ECHO_N "checking for usable X dependency... $ECHO_C" >&6 +if test "${cf_cv_xt_x11_compat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lipc $LIBS" + cat >conftest.$ac_ext <<_ACEOF -#line 9791 "configure" +#line 13662 "configure" #include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char shmat (); +#include + int -main () +main (void) { -shmat (); + + int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); + int rc2 = XClearWindow((Display*) 0, (Window) 0); + int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); + int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); + ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9810: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13681: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9813: \$? = $ac_status" >&5 + echo "$as_me:13684: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9816: \"$ac_try\"") >&5 + { (eval echo "$as_me:13687: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9819: \$? = $ac_status" >&5 + echo "$as_me:13690: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_ipc_shmat=yes + cf_cv_xt_x11_compat=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -ac_cv_lib_ipc_shmat=no +cf_cv_xt_x11_compat=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:9830: result: $ac_cv_lib_ipc_shmat" >&5 -echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 -if test $ac_cv_lib_ipc_shmat = yes; then - X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" +echo "$as_me:13700: result: $cf_cv_xt_x11_compat" >&5 +echo "${ECHO_T}$cf_cv_xt_x11_compat" >&6 + if test "$cf_cv_xt_x11_compat" = no + then + test -n "$verbose" && echo " work around broken X11 dependency" 1>&6 + +echo "${as_me:-configure}:13706: testing work around broken X11 dependency ..." 1>&5 + + # 2010/11/19 - good enough until a working Xt on Xcb is delivered. + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists x11; then + test -n "$verbose" && echo " found package x11" 1>&6 + +echo "${as_me:-configure}:13713: testing found package x11 ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags x11 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs x11 2>/dev/null`" + test -n "$verbose" && echo " package x11 CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:13719: testing package x11 CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package x11 LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:13723: testing package x11 LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi - fi - fi +if test -n "$cf_new_cppflags" ; then - # Check for libraries that X11R6 Xt/Xaw programs need. - ac_save_LDFLAGS=$LDFLAGS - test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" - # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to - # check for ICE first), but we must link in the order -lSM -lICE or - # we get undefined symbols. So assume we have SM if we have ICE. - # These have to be linked with before -lX11, unlike the other - # libraries we check for below, so use a different variable. - # John Interrante, Karl Berry - echo "$as_me:9848: checking for IceConnectionNumber in -lICE" >&5 -echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 -if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:13846: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXt %-lXt -lX11 %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:13851: testing ...after $LIBS ..." 1>&5 + +fi + + fi + ;; + esac + +echo "$as_me:13859: checking for usable X Toolkit package" >&5 +echo $ECHO_N "checking for usable X Toolkit package... $ECHO_C" >&6 +if test "${cf_cv_xt_ice_compat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lICE $X_EXTRA_LIBS $LIBS" + cat >conftest.$ac_ext <<_ACEOF -#line 9856 "configure" +#line 13866 "configure" #include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char IceConnectionNumber (); +#include + int -main () +main (void) { -IceConnectionNumber (); +int num = IceConnectionNumber(0) + ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9875: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13881: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9878: \$? = $ac_status" >&5 + echo "$as_me:13884: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9881: \"$ac_try\"") >&5 + { (eval echo "$as_me:13887: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9884: \$? = $ac_status" >&5 + echo "$as_me:13890: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_ICE_IceConnectionNumber=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_ICE_IceConnectionNumber=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:9895: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 -echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 -if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then - X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" -fi - - LDFLAGS=$ac_save_LDFLAGS - -fi - -cf_x_athena=${cf_x_athena:-Xaw} - -echo "$as_me:9907: checking if you want to link with Xaw 3d library" >&5 -echo $ECHO_N "checking if you want to link with Xaw 3d library... $ECHO_C" >&6 -withval= - -# Check whether --with-Xaw3d or --without-Xaw3d was given. -if test "${with_Xaw3d+set}" = set; then - withval="$with_Xaw3d" - -fi; -if test "$withval" = yes ; then - cf_x_athena=Xaw3d - echo "$as_me:9918: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:9921: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -echo "$as_me:9925: checking if you want to link with neXT Athena library" >&5 -echo $ECHO_N "checking if you want to link with neXT Athena library... $ECHO_C" >&6 -withval= - -# Check whether --with-neXtaw or --without-neXtaw was given. -if test "${with_neXtaw+set}" = set; then - withval="$with_neXtaw" - -fi; -if test "$withval" = yes ; then - cf_x_athena=neXtaw - echo "$as_me:9936: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:9939: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -echo "$as_me:9943: checking if you want to link with Athena-Plus library" >&5 -echo $ECHO_N "checking if you want to link with Athena-Plus library... $ECHO_C" >&6 -withval= - -# Check whether --with-XawPlus or --without-XawPlus was given. -if test "${with_XawPlus+set}" = set; then - withval="$with_XawPlus" - -fi; -if test "$withval" = yes ; then - cf_x_athena=XawPlus - echo "$as_me:9954: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + cf_cv_xt_ice_compat=yes else - echo "$as_me:9957: result: no" >&5 -echo "${ECHO_T}no" >&6 + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xt_ice_compat=no fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:13900: result: $cf_cv_xt_ice_compat" >&5 +echo "${ECHO_T}$cf_cv_xt_ice_compat" >&6 -cf_x_athena_lib="" + if test "$cf_cv_xt_ice_compat" = no + then + # workaround for broken ".pc" files used for X Toolkit. + case "x$X_PRE_LIBS" in + (*-lICE*) + case "x$LIBS" in + (*-lICE*) + ;; + (*) + test -n "$verbose" && echo " work around broken ICE dependency" 1>&6 -if test "$PKG_CONFIG" != none ; then - cf_athena_list= - test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" - for cf_athena_pkg in \ - $cf_athena_list \ - ${cf_x_athena} \ - ${cf_x_athena}-devel \ - lib${cf_x_athena} \ - lib${cf_x_athena}-devel - do +echo "${as_me:-configure}:13914: testing work around broken ICE dependency ..." 1>&5 -if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $cf_athena_pkg; then - test -n "$verbose" && echo " found package $cf_athena_pkg" 1>&6 +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists ice; then + test -n "$verbose" && echo " found package ice" 1>&6 -echo "${as_me:-configure}:9977: testing found package $cf_athena_pkg ..." 1>&5 +echo "${as_me:-configure}:13919: testing found package ice ..." 1>&5 - cf_pkgconfig_incs="`$PKG_CONFIG --cflags $cf_athena_pkg 2>/dev/null`" - cf_pkgconfig_libs="`$PKG_CONFIG --libs $cf_athena_pkg 2>/dev/null`" - test -n "$verbose" && echo " package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs" 1>&6 + cf_pkgconfig_incs="`$PKG_CONFIG --cflags ice 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs ice 2>/dev/null`" + test -n "$verbose" && echo " package ice CFLAGS: $cf_pkgconfig_incs" 1>&6 -echo "${as_me:-configure}:9983: testing package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs ..." 1>&5 +echo "${as_me:-configure}:13925: testing package ice CFLAGS: $cf_pkgconfig_incs ..." 1>&5 - test -n "$verbose" && echo " package $cf_athena_pkg LIBS: $cf_pkgconfig_libs" 1>&6 + test -n "$verbose" && echo " package ice LIBS: $cf_pkgconfig_libs" 1>&6 -echo "${as_me:-configure}:9987: testing package $cf_athena_pkg LIBS: $cf_pkgconfig_libs ..." 1>&5 +echo "${as_me:-configure}:13929: testing package ice LIBS: $cf_pkgconfig_libs ..." 1>&5 cf_fix_cppflags=no cf_new_cflags= @@ -9994,32 +13936,38 @@ cf_new_extra_cppflags= for cf_add_cflags in $cf_pkgconfig_incs do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -10028,21 +13976,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -10051,115 +14007,55 @@ done if test -n "$cf_new_cflags" ; then - CFLAGS="$CFLAGS $cf_new_cflags" + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi if test -n "$cf_new_cppflags" ; then - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -fi - -if test -n "$cf_new_extra_cppflags" ; then + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi - LIBS="$cf_pkgconfig_libs $LIBS" - - cf_x_athena_lib="$cf_pkgconfig_libs" - -cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - - cat >>confdefs.h <&6 - -echo "${as_me:-configure}:10084: testing ..trimmed $LIBS ..." 1>&5 - - ;; - esac - done - -echo "$as_me:10090: checking for usable $cf_x_athena/Xmu package" >&5 -echo $ECHO_N "checking for usable $cf_x_athena/Xmu package... $ECHO_C" >&6 -if test "${cf_cv_xaw_compat+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -cat >conftest.$ac_ext <<_ACEOF -#line 10097 "configure" -#include "confdefs.h" - -#include - -int -main () -{ +if test -n "$cf_new_extra_cppflags" ; then -int check = XmuCompareISOLatin1("big", "small") + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:10113: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:10116: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:10119: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:10122: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_xaw_compat=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_cv_xaw_compat=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:10132: result: $cf_cv_xaw_compat" >&5 -echo "${ECHO_T}$cf_cv_xaw_compat" >&6 - - if test "$cf_cv_xaw_compat" = no - then - # workaround for broken ".pc" files... - case "$cf_x_athena_lib" in #(vi - *-lXmu*) #(vi - ;; - *) - test -n "$verbose" && echo " work around broken package" 1>&6 - -echo "${as_me:-configure}:10144: testing work around broken package ..." 1>&5 - cf_save_xmu="$LIBS" - cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^ *//' -e 's/ .*//'` +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" -if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xmu; then - test -n "$verbose" && echo " found package xmu" 1>&6 +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists sm; then + test -n "$verbose" && echo " found package sm" 1>&6 -echo "${as_me:-configure}:10152: testing found package xmu ..." 1>&5 +echo "${as_me:-configure}:14048: testing found package sm ..." 1>&5 - cf_pkgconfig_incs="`$PKG_CONFIG --cflags xmu 2>/dev/null`" - cf_pkgconfig_libs="`$PKG_CONFIG --libs xmu 2>/dev/null`" - test -n "$verbose" && echo " package xmu CFLAGS: $cf_pkgconfig_incs" 1>&6 + cf_pkgconfig_incs="`$PKG_CONFIG --cflags sm 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs sm 2>/dev/null`" + test -n "$verbose" && echo " package sm CFLAGS: $cf_pkgconfig_incs" 1>&6 -echo "${as_me:-configure}:10158: testing package xmu CFLAGS: $cf_pkgconfig_incs ..." 1>&5 +echo "${as_me:-configure}:14054: testing package sm CFLAGS: $cf_pkgconfig_incs ..." 1>&5 - test -n "$verbose" && echo " package xmu LIBS: $cf_pkgconfig_libs" 1>&6 + test -n "$verbose" && echo " package sm LIBS: $cf_pkgconfig_libs" 1>&6 -echo "${as_me:-configure}:10162: testing package xmu LIBS: $cf_pkgconfig_libs ..." 1>&5 +echo "${as_me:-configure}:14058: testing package sm LIBS: $cf_pkgconfig_libs ..." 1>&5 cf_fix_cppflags=no cf_new_cflags= @@ -10169,32 +14065,38 @@ cf_new_extra_cppflags= for cf_add_cflags in $cf_pkgconfig_incs do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -10203,21 +14105,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -10226,31 +14136,47 @@ done if test -n "$cf_new_cflags" ; then - CFLAGS="$CFLAGS $cf_new_cflags" + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi if test -n "$cf_new_cppflags" ; then - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -fi - -if test -n "$cf_new_extra_cppflags" ; then + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi - LIBS="$cf_pkgconfig_libs $LIBS" - - LIBS="$cf_save_xmu" +if test -n "$cf_new_extra_cppflags" ; then -test -n "$verbose" && echo " ...before $LIBS" 1>&6 + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" -echo "${as_me:-configure}:10248: testing ...before $LIBS ..." 1>&5 +fi -LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%$cf_first_lib %$cf_first_lib $cf_pkgconfig_libs %" -e 's% % %g'` -test -n "$verbose" && echo " ...after $LIBS" 1>&6 +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" -echo "${as_me:-configure}:10253: testing ...after $LIBS ..." 1>&5 + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + : +fi else cf_pkgconfig_incs= @@ -10258,93 +14184,76 @@ else test -n "$verbose" && echo " ...before $LIBS" 1>&6 -echo "${as_me:-configure}:10261: testing ...before $LIBS ..." 1>&5 +echo "${as_me:-configure}:14187: testing ...before $LIBS ..." 1>&5 -LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%$cf_first_lib %$cf_first_lib -lXmu %" -e 's% % %g'` +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXt %-lXt $X_PRE_LIBS %" -e 's% % %g'` test -n "$verbose" && echo " ...after $LIBS" 1>&6 -echo "${as_me:-configure}:10266: testing ...after $LIBS ..." 1>&5 +echo "${as_me:-configure}:14192: testing ...after $LIBS ..." 1>&5 fi - for cf_trim_lib in Xmu Xt X11 - do - case "$LIBS" in - *-l$cf_trim_lib\ *-l$cf_trim_lib*) - LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` - test -n "$verbose" && echo " ..trimmed $LIBS" 1>&6 - -echo "${as_me:-configure}:10277: testing ..trimmed $LIBS ..." 1>&5 - + ;; + esac ;; esac - done + fi - ;; - esac - fi + cf_have_X_LIBS=yes - break else cf_pkgconfig_incs= cf_pkgconfig_libs= - : -fi - - done -fi - -if test -z "$cf_x_athena_lib" ; then -if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists Xext; then - test -n "$verbose" && echo " found package Xext" 1>&6 - -echo "${as_me:-configure}:10302: testing found package Xext ..." 1>&5 - - cf_pkgconfig_incs="`$PKG_CONFIG --cflags Xext 2>/dev/null`" - cf_pkgconfig_libs="`$PKG_CONFIG --libs Xext 2>/dev/null`" - test -n "$verbose" && echo " package Xext CFLAGS: $cf_pkgconfig_incs" 1>&6 + LDFLAGS="$X_LIBS $LDFLAGS" -echo "${as_me:-configure}:10308: testing package Xext CFLAGS: $cf_pkgconfig_incs ..." 1>&5 +test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 - test -n "$verbose" && echo " package Xext LIBS: $cf_pkgconfig_libs" 1>&6 +echo "${as_me:-configure}:14212: testing checking additions to CFLAGS ..." 1>&5 -echo "${as_me:-configure}:10312: testing package Xext LIBS: $cf_pkgconfig_libs ..." 1>&5 +cf_check_cflags="$CFLAGS" +cf_check_cppflags="$CPPFLAGS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= -for cf_add_cflags in $cf_pkgconfig_incs +for cf_add_cflags in $X_CFLAGS do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -10353,57 +14262,180 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done -if test -n "$cf_new_cflags" ; then +if test -n "$cf_new_cflags" ; then + test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 + +echo "${as_me:-configure}:14297: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 + +echo "${as_me:-configure}:14307: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 + +echo "${as_me:-configure}:14317: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +if test "x$cf_check_cflags" != "x$CFLAGS" ; then +cat >conftest.$ac_ext <<_ACEOF +#line 14326 "configure" +#include "confdefs.h" +#include +int +main (void) +{ +printf("Hello world"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14338: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14341: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14344: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14347: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 + +echo "${as_me:-configure}:14355: testing test-compile failed. Undoing change to \$CFLAGS ..." 1>&5 + + if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then + test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 + +echo "${as_me:-configure}:14360: testing but keeping change to \$CPPFLAGS ..." 1>&5 - CFLAGS="$CFLAGS $cf_new_cflags" + fi + CFLAGS="$cf_check_flags" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -if test -n "$cf_new_cppflags" ; then + echo "$as_me:14368: checking for XOpenDisplay" >&5 +echo $ECHO_N "checking for XOpenDisplay... $ECHO_C" >&6 +if test "${ac_cv_func_XOpenDisplay+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 14374 "configure" +#include "confdefs.h" +#define XOpenDisplay autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef XOpenDisplay - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -fi +#ifdef __cplusplus +extern "C" +#endif -if test -n "$cf_new_extra_cppflags" ; then +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (void); - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -fi +int +main (void) +{ - LIBS="$cf_pkgconfig_libs $LIBS" - : +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_XOpenDisplay) || defined (__stub___XOpenDisplay) +#error found stub for XOpenDisplay +#endif + + return XOpenDisplay (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14405: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14408: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14411: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14414: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_XOpenDisplay=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_XOpenDisplay=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:14424: result: $ac_cv_func_XOpenDisplay" >&5 +echo "${ECHO_T}$ac_cv_func_XOpenDisplay" >&6 +if test $ac_cv_func_XOpenDisplay = yes; then + : else - cf_pkgconfig_incs= - cf_pkgconfig_libs= - echo "$as_me:10398: checking for XextCreateExtension in -lXext" >&5 -echo $ECHO_N "checking for XextCreateExtension in -lXext... $ECHO_C" >&6 -if test "${ac_cv_lib_Xext_XextCreateExtension+set}" = set; then + echo "$as_me:14430: checking for XOpenDisplay in -lX11" >&5 +echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 +if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXext $LIBS" +LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 10406 "configure" +#line 14438 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -10412,250 +14444,553 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char XextCreateExtension (); +char XOpenDisplay (); int -main () +main (void) { -XextCreateExtension (); +XOpenDisplay (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:10425: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14457: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10428: \$? = $ac_status" >&5 + echo "$as_me:14460: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:10431: \"$ac_try\"") >&5 + { (eval echo "$as_me:14463: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10434: \$? = $ac_status" >&5 + echo "$as_me:14466: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_Xext_XextCreateExtension=yes + ac_cv_lib_X11_XOpenDisplay=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -ac_cv_lib_Xext_XextCreateExtension=no +ac_cv_lib_X11_XOpenDisplay=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:10445: result: $ac_cv_lib_Xext_XextCreateExtension" >&5 -echo "${ECHO_T}$ac_cv_lib_Xext_XextCreateExtension" >&6 -if test $ac_cv_lib_Xext_XextCreateExtension = yes; then - LIBS="-lXext $LIBS" +echo "$as_me:14477: result: $ac_cv_lib_X11_XOpenDisplay" >&5 +echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 +if test $ac_cv_lib_X11_XOpenDisplay = yes; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lX11; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + fi fi -cf_have_X_LIBS=no + echo "$as_me:14501: checking for XtAppInitialize" >&5 +echo $ECHO_N "checking for XtAppInitialize... $ECHO_C" >&6 +if test "${ac_cv_func_XtAppInitialize+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 14507 "configure" +#include "confdefs.h" +#define XtAppInitialize autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef XtAppInitialize -if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xt; then - test -n "$verbose" && echo " found package xt" 1>&6 +#ifdef __cplusplus +extern "C" +#endif -echo "${as_me:-configure}:10458: testing found package xt ..." 1>&5 +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XtAppInitialize (void); - cf_pkgconfig_incs="`$PKG_CONFIG --cflags xt 2>/dev/null`" - cf_pkgconfig_libs="`$PKG_CONFIG --libs xt 2>/dev/null`" - test -n "$verbose" && echo " package xt CFLAGS: $cf_pkgconfig_incs" 1>&6 +int +main (void) +{ -echo "${as_me:-configure}:10464: testing package xt CFLAGS: $cf_pkgconfig_incs ..." 1>&5 +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_XtAppInitialize) || defined (__stub___XtAppInitialize) +#error found stub for XtAppInitialize +#endif - test -n "$verbose" && echo " package xt LIBS: $cf_pkgconfig_libs" 1>&6 + return XtAppInitialize (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14538: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14541: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14544: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14547: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_XtAppInitialize=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_XtAppInitialize=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:14557: result: $ac_cv_func_XtAppInitialize" >&5 +echo "${ECHO_T}$ac_cv_func_XtAppInitialize" >&6 +if test $ac_cv_func_XtAppInitialize = yes; then + : +else + + echo "$as_me:14563: checking for XtAppInitialize in -lXt" >&5 +echo $ECHO_N "checking for XtAppInitialize in -lXt... $ECHO_C" >&6 +if test "${ac_cv_lib_Xt_XtAppInitialize+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 14571 "configure" +#include "confdefs.h" -echo "${as_me:-configure}:10468: testing package xt LIBS: $cf_pkgconfig_libs ..." 1>&5 +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XtAppInitialize (); +int +main (void) +{ +XtAppInitialize (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14590: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14593: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14596: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14599: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xt_XtAppInitialize=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_Xt_XtAppInitialize=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:14610: result: $ac_cv_lib_Xt_XtAppInitialize" >&5 +echo "${ECHO_T}$ac_cv_lib_Xt_XtAppInitialize" >&6 +if test $ac_cv_lib_Xt_XtAppInitialize = yes; then -cf_fix_cppflags=no -cf_new_cflags= -cf_new_cppflags= -cf_new_extra_cppflags= +cat >>confdefs.h <<\EOF +#define HAVE_LIBXT 1 +EOF -for cf_add_cflags in $cf_pkgconfig_incs -do -case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi - case $cf_add_cflags in - -D*) - cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + cf_have_X_LIBS=Xt + LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS" +fi - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ - && test -z "${cf_tst_cflags}" \ - && cf_fix_cppflags=yes +fi - if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" - continue - elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" - continue - fi - ;; - esac - case "$CPPFLAGS" in - *$cf_add_cflags) #(vi - ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) - cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` +fi -CPPFLAGS=`echo "$CPPFLAGS" | \ - sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` +if test $cf_have_X_LIBS = no ; then + { echo "$as_me:14627: WARNING: Unable to successfully link X Toolkit library (-lXt) with +test program. You will have to check and add the proper libraries by hand +to makefile." >&5 +echo "$as_me: WARNING: Unable to successfully link X Toolkit library (-lXt) with +test program. You will have to check and add the proper libraries by hand +to makefile." >&2;} +fi - ;; - esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" - ;; - esac +cf_x_athena_root=$cf_x_athena +cf_x_athena_inc="" + +for cf_path in default \ + /usr/contrib/X11R6 \ + /usr/contrib/X11R5 \ + /usr/lib/X11R5 \ + /usr/local +do + if test -z "$cf_x_athena_inc" ; then + +cf_save_LIBS_CF_X_ATHENA_CPPFLAGS="$LIBS" +cf_save_CFLAGS_CF_X_ATHENA_CPPFLAGS="$CFLAGS" +cf_save_CPPFLAGS_CF_X_ATHENA_CPPFLAGS="$CPPFLAGS" +LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" +for cf_X_CFLAGS in $X_CFLAGS +do + case "x$cf_X_CFLAGS" in + x-[IUD]*) + CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS" ;; *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + CFLAGS="$CFLAGS $cf_X_CFLAGS" ;; esac - ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +done + + cf_test=X11/$cf_x_athena_root/SimpleMenu.h + if test $cf_path != default ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-I$cf_path/include" + + echo "$as_me:14668: checking for $cf_test in $cf_path" >&5 +echo $ECHO_N "checking for $cf_test in $cf_path... $ECHO_C" >&6 + else + echo "$as_me:14671: checking for $cf_test" >&5 +echo $ECHO_N "checking for $cf_test... $ECHO_C" >&6 + fi + cat >conftest.$ac_ext <<_ACEOF +#line 14675 "configure" +#include "confdefs.h" + +#include +#include <$cf_test> +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:14689: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:14692: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:14695: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14698: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:14707: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 - cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` +LIBS="$cf_save_LIBS_CF_X_ATHENA_CPPFLAGS" +CFLAGS="$cf_save_CFLAGS_CF_X_ATHENA_CPPFLAGS" +CPPFLAGS="$cf_save_CPPFLAGS_CF_X_ATHENA_CPPFLAGS" - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ - && test -z "${cf_tst_cflags}" \ - && cf_fix_cppflags=no - ;; -esac + if test "$cf_result" = yes ; then + test "$cf_path" = default && cf_x_athena_inc=default + test "$cf_path" != default && cf_x_athena_inc=$cf_path/include + break + fi + fi done -if test -n "$cf_new_cflags" ; then - - CFLAGS="$CFLAGS $cf_new_cflags" -fi +if test -z "$cf_x_athena_inc" ; then + { echo "$as_me:14723: WARNING: Unable to find Athena header files" >&5 +echo "$as_me: WARNING: Unable to find Athena header files" >&2;} +elif test "$cf_x_athena_inc" != default ; then -if test -n "$cf_new_cppflags" ; then + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-I$cf_x_athena_inc" - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi -if test -n "$cf_new_extra_cppflags" ; then - - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -fi +cf_x_athena_root=$cf_x_athena +cf_x_athena_lib="" - LIBS="$cf_pkgconfig_libs $LIBS" +for cf_path in default \ + /usr/contrib/X11R6 \ + /usr/contrib/X11R5 \ + /usr/lib/X11R5 \ + /usr/local +do + for cf_lib in \ + ${cf_x_athena_root} \ + ${cf_x_athena_root}7 \ + ${cf_x_athena_root}6 + do + for cf_libs in \ + "-l$cf_lib -lXmu" \ + "-l$cf_lib -lXpm -lXmu" \ + "-l${cf_lib}_s -lXmu_s" + do + test -n "$cf_x_athena_lib" && break - case "x$LIBS" in #(vi - *-lX11*) #(vi +cf_save_LIBS_CF_X_ATHENA_LIBS="$LIBS" +cf_save_CFLAGS_CF_X_ATHENA_LIBS="$CFLAGS" +cf_save_CPPFLAGS_CF_X_ATHENA_LIBS="$CPPFLAGS" +LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" +for cf_X_CFLAGS in $X_CFLAGS +do + case "x$cf_X_CFLAGS" in + x-[IUD]*) + CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS" ;; *) -# we have an "xt" package, but it may omit Xt's dependency on X11 -echo "$as_me:10555: checking for usable X dependency" >&5 -echo $ECHO_N "checking for usable X dependency... $ECHO_C" >&6 -if test "${cf_cv_xt_x11_compat+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else + CFLAGS="$CFLAGS $cf_X_CFLAGS" + ;; + esac +done -cat >conftest.$ac_ext <<_ACEOF -#line 10562 "configure" + cf_test=XawSimpleMenuAddGlobalActions + test "$cf_path" != default && cf_libs="-L$cf_path/lib $cf_libs" + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + echo "$as_me:14788: checking for $cf_test in $cf_libs" >&5 +echo $ECHO_N "checking for $cf_test in $cf_libs... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 14791 "configure" #include "confdefs.h" -#include +#include +#include int -main () +main (void) { - int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); - int rc2 = XClearWindow((Display*) 0, (Window) 0); - int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); - int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); - +$cf_test((XtAppContext) 0) ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:10581: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14807: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10584: \$? = $ac_status" >&5 + echo "$as_me:14810: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:10587: \"$ac_try\"") >&5 + { (eval echo "$as_me:14813: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10590: \$? = $ac_status" >&5 + echo "$as_me:14816: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_xt_x11_compat=yes + cf_result=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_xt_x11_compat=no +cf_result=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:14825: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + +LIBS="$cf_save_LIBS_CF_X_ATHENA_LIBS" +CFLAGS="$cf_save_CFLAGS_CF_X_ATHENA_LIBS" +CPPFLAGS="$cf_save_CPPFLAGS_CF_X_ATHENA_LIBS" + + if test "$cf_result" = yes ; then + cf_x_athena_lib="$cf_libs" + break + fi + done # cf_libs + test -n "$cf_x_athena_lib" && break + done # cf_lib +done + +if test -z "$cf_x_athena_lib" ; then + { { echo "$as_me:14842: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&5 +echo "$as_me: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&2;} + { (exit 1); exit 1; }; } fi -echo "$as_me:10600: result: $cf_cv_xt_x11_compat" >&5 -echo "${ECHO_T}$cf_cv_xt_x11_compat" >&6 - if test "$cf_cv_xt_x11_compat" = no - then - test -n "$verbose" && echo " work around broken X11 dependency" 1>&6 -echo "${as_me:-configure}:10606: testing work around broken X11 dependency ..." 1>&5 +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_x_athena_lib; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" - # 2010/11/19 - good enough until a working Xt on Xcb is delivered. +cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists x11; then - test -n "$verbose" && echo " found package x11" 1>&6 +cat >>confdefs.h <&5 +fi - cf_pkgconfig_incs="`$PKG_CONFIG --cflags x11 2>/dev/null`" - cf_pkgconfig_libs="`$PKG_CONFIG --libs x11 2>/dev/null`" - test -n "$verbose" && echo " package x11 CFLAGS: $cf_pkgconfig_incs" 1>&6 +if test -n "$ac_tool_prefix"; then + for ac_prog in xcurses-config + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:14876: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_XCURSES_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$XCURSES_CONFIG"; then + ac_cv_prog_XCURSES_CONFIG="$XCURSES_CONFIG" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_XCURSES_CONFIG="$ac_tool_prefix$ac_prog" +echo "$as_me:14891: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +XCURSES_CONFIG=$ac_cv_prog_XCURSES_CONFIG +if test -n "$XCURSES_CONFIG"; then + echo "$as_me:14899: result: $XCURSES_CONFIG" >&5 +echo "${ECHO_T}$XCURSES_CONFIG" >&6 +else + echo "$as_me:14902: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$XCURSES_CONFIG" && break + done +fi +if test -z "$XCURSES_CONFIG"; then + ac_ct_XCURSES_CONFIG=$XCURSES_CONFIG + for ac_prog in xcurses-config +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:14915: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_XCURSES_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_XCURSES_CONFIG"; then + ac_cv_prog_ac_ct_XCURSES_CONFIG="$ac_ct_XCURSES_CONFIG" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_XCURSES_CONFIG="$ac_prog" +echo "$as_me:14930: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_XCURSES_CONFIG=$ac_cv_prog_ac_ct_XCURSES_CONFIG +if test -n "$ac_ct_XCURSES_CONFIG"; then + echo "$as_me:14938: result: $ac_ct_XCURSES_CONFIG" >&5 +echo "${ECHO_T}$ac_ct_XCURSES_CONFIG" >&6 +else + echo "$as_me:14941: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi -echo "${as_me:-configure}:10619: testing package x11 CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + test -n "$ac_ct_XCURSES_CONFIG" && break +done +test -n "$ac_ct_XCURSES_CONFIG" || ac_ct_XCURSES_CONFIG="none" - test -n "$verbose" && echo " package x11 LIBS: $cf_pkgconfig_libs" 1>&6 + XCURSES_CONFIG=$ac_ct_XCURSES_CONFIG +fi -echo "${as_me:-configure}:10623: testing package x11 LIBS: $cf_pkgconfig_libs ..." 1>&5 +if test "$XCURSES_CONFIG" != none ; then cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= -for cf_add_cflags in $cf_pkgconfig_incs +for cf_add_cflags in `$XCURSES_CONFIG --cflags` do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -10664,21 +14999,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -10687,146 +15030,94 @@ done if test -n "$cf_new_cflags" ; then - CFLAGS="$CFLAGS $cf_new_cflags" + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi if test -n "$cf_new_cppflags" ; then - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -fi - -if test -n "$cf_new_extra_cppflags" ; then + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi - LIBS="$cf_pkgconfig_libs $LIBS" - : -else - cf_pkgconfig_incs= - cf_pkgconfig_libs= - -test -n "$verbose" && echo " ...before $LIBS" 1>&6 - -echo "${as_me:-configure}:10711: testing ...before $LIBS ..." 1>&5 - -LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXt %-lXt -lX11 %" -e 's% % %g'` -test -n "$verbose" && echo " ...after $LIBS" 1>&6 +if test -n "$cf_new_extra_cppflags" ; then -echo "${as_me:-configure}:10716: testing ...after $LIBS ..." 1>&5 + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in `$XCURSES_CONFIG --libs`; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break fi - ;; - esac - -echo "$as_me:10724: checking for usable X Toolkit package" >&5 -echo $ECHO_N "checking for usable X Toolkit package... $ECHO_C" >&6 -if test "${cf_cv_xt_ice_compat+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -cat >conftest.$ac_ext <<_ACEOF -#line 10731 "configure" -#include "confdefs.h" - -#include + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" -int -main () -{ -int num = IceConnectionNumber(0) +cf_cv_lib_XCurses=yes - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:10746: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:10749: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:10752: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:10755: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_xt_ice_compat=yes else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_cv_xt_ice_compat=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:10765: result: $cf_cv_xt_ice_compat" >&5 -echo "${ECHO_T}$cf_cv_xt_ice_compat" >&6 - - if test "$cf_cv_xt_ice_compat" = no - then - # workaround for broken ".pc" files used for X Toolkit. - case "x$X_PRE_LIBS" in #(vi - *-lICE*) - case "x$LIBS" in #(vi - *-lICE*) #(vi - ;; - *) - test -n "$verbose" && echo " work around broken ICE dependency" 1>&6 -echo "${as_me:-configure}:10779: testing work around broken ICE dependency ..." 1>&5 - -if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists ice; then - test -n "$verbose" && echo " found package ice" 1>&6 - -echo "${as_me:-configure}:10784: testing found package ice ..." 1>&5 - - cf_pkgconfig_incs="`$PKG_CONFIG --cflags ice 2>/dev/null`" - cf_pkgconfig_libs="`$PKG_CONFIG --libs ice 2>/dev/null`" - test -n "$verbose" && echo " package ice CFLAGS: $cf_pkgconfig_incs" 1>&6 +LDFLAGS="$LDFLAGS $X_LIBS" -echo "${as_me:-configure}:10790: testing package ice CFLAGS: $cf_pkgconfig_incs ..." 1>&5 +test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 - test -n "$verbose" && echo " package ice LIBS: $cf_pkgconfig_libs" 1>&6 +echo "${as_me:-configure}:15076: testing checking additions to CFLAGS ..." 1>&5 -echo "${as_me:-configure}:10794: testing package ice LIBS: $cf_pkgconfig_libs ..." 1>&5 +cf_check_cflags="$CFLAGS" +cf_check_cppflags="$CPPFLAGS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= -for cf_add_cflags in $cf_pkgconfig_incs +for cf_add_cflags in $X_CFLAGS do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -10835,21 +15126,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -10857,193 +15156,557 @@ esac done if test -n "$cf_new_cflags" ; then + test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 + +echo "${as_me:-configure}:15161: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" - CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then + test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 + +echo "${as_me:-configure}:15171: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then + test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 + +echo "${as_me:-configure}:15181: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi - LIBS="$cf_pkgconfig_libs $LIBS" +if test "x$cf_check_cflags" != "x$CFLAGS" ; then +cat >conftest.$ac_ext <<_ACEOF +#line 15190 "configure" +#include "confdefs.h" +#include +int +main (void) +{ +printf("Hello world"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:15202: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15205: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:15208: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15211: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 -if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists sm; then - test -n "$verbose" && echo " found package sm" 1>&6 +echo "${as_me:-configure}:15219: testing test-compile failed. Undoing change to \$CFLAGS ..." 1>&5 -echo "${as_me:-configure}:10879: testing found package sm ..." 1>&5 + if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then + test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 - cf_pkgconfig_incs="`$PKG_CONFIG --cflags sm 2>/dev/null`" - cf_pkgconfig_libs="`$PKG_CONFIG --libs sm 2>/dev/null`" - test -n "$verbose" && echo " package sm CFLAGS: $cf_pkgconfig_incs" 1>&6 +echo "${as_me:-configure}:15224: testing but keeping change to \$CPPFLAGS ..." 1>&5 -echo "${as_me:-configure}:10885: testing package sm CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + fi + CFLAGS="$cf_check_flags" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi - test -n "$verbose" && echo " package sm LIBS: $cf_pkgconfig_libs" 1>&6 +echo "$as_me:15232: checking for XOpenDisplay in -lX11" >&5 +echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 +if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 15240 "configure" +#include "confdefs.h" -echo "${as_me:-configure}:10889: testing package sm LIBS: $cf_pkgconfig_libs ..." 1>&5 +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (); +int +main (void) +{ +XOpenDisplay (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:15259: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15262: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:15265: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15268: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_X11_XOpenDisplay=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_X11_XOpenDisplay=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:15279: result: $ac_cv_lib_X11_XOpenDisplay" >&5 +echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 +if test $ac_cv_lib_X11_XOpenDisplay = yes; then -cf_fix_cppflags=no -cf_new_cflags= -cf_new_cppflags= -cf_new_extra_cppflags= +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lX11; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" -for cf_add_cflags in $cf_pkgconfig_incs -do -case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi - case $cf_add_cflags in - -D*) - cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` +fi - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ - && test -z "${cf_tst_cflags}" \ - && cf_fix_cppflags=yes +echo "$as_me:15301: checking for XCurses library" >&5 +echo $ECHO_N "checking for XCurses library... $ECHO_C" >&6 +if test "${cf_cv_lib_XCurses+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else - if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" - continue - elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" - continue - fi - ;; - esac - case "$CPPFLAGS" in - *$cf_add_cflags) #(vi - ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) - cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lXCurses; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +cat >conftest.$ac_ext <<_ACEOF +#line 15324 "configure" +#include "confdefs.h" + +#include +char *XCursesProgramName = "test"; + +int +main (void) +{ +XCursesExit(); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:15339: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15342: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:15345: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15348: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_lib_XCurses=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_lib_XCurses=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:15359: result: $cf_cv_lib_XCurses" >&5 +echo "${ECHO_T}$cf_cv_lib_XCurses" >&6 + +fi + +if test $cf_cv_lib_XCurses = yes ; then + +cat >>confdefs.h <<\EOF +#define UNIX 1 +EOF + +cat >>confdefs.h <<\EOF +#define XCURSES 1 +EOF + + echo "$as_me:15374: checking for xcurses.h" >&5 +echo $ECHO_N "checking for xcurses.h... $ECHO_C" >&6 +if test "${ac_cv_header_xcurses_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 15380 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:15384: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:15390: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_xcurses_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_xcurses_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:15409: result: $ac_cv_header_xcurses_h" >&5 +echo "${ECHO_T}$ac_cv_header_xcurses_h" >&6 +if test $ac_cv_header_xcurses_h = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_XCURSES 1 +EOF + +fi + +else + { { echo "$as_me:15420: error: Cannot link with XCurses" >&5 +echo "$as_me: error: Cannot link with XCurses" >&2;} + { (exit 1); exit 1; }; } +fi + + ;; +(*) + { { echo "$as_me:15427: error: unexpected screen-value: $cf_cv_screen" >&5 +echo "$as_me: error: unexpected screen-value: $cf_cv_screen" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + +: ${cf_nculib_root:=$cf_cv_screen} +as_ac_Lib=`echo "ac_cv_lib_$cf_nculib_root''__nc_init_pthreads" | $as_tr_sh` +echo "$as_me:15435: checking for _nc_init_pthreads in -l$cf_nculib_root" >&5 +echo $ECHO_N "checking for _nc_init_pthreads in -l$cf_nculib_root... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$cf_nculib_root $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 15443 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char _nc_init_pthreads (); +int +main (void) +{ +_nc_init_pthreads (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:15462: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15465: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:15468: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15471: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Lib=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:15482: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + cf_cv_ncurses_pthreads=yes +else + cf_cv_ncurses_pthreads=no +fi -CPPFLAGS=`echo "$CPPFLAGS" | \ - sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ - -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` +if test "$cf_cv_ncurses_pthreads" = yes +then - ;; - esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" - ;; - esac - ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" - ;; - esac - ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lpthread; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" - cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` +fi - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ - && test -z "${cf_tst_cflags}" \ - && cf_fix_cppflags=no +case $cf_cv_screen in +(ncurses*) + cf_cv_libtype=`echo "$cf_cv_screen" | sed -e 's/^ncurses//'` ;; esac -done -if test -n "$cf_new_cflags" ; then +echo "$as_me:15517: checking for X11 rgb file" >&5 +echo $ECHO_N "checking for X11 rgb file... $ECHO_C" >&6 - CFLAGS="$CFLAGS $cf_new_cflags" -fi +# Check whether --with-x11-rgb or --without-x11-rgb was given. +if test "${with_x11_rgb+set}" = set; then + withval="$with_x11_rgb" + RGB_PATH=$withval +else + RGB_PATH=auto +fi; -if test -n "$cf_new_cppflags" ; then +if test "x$RGB_PATH" = xauto +then + RGB_PATH='${exec_prefix}/lib/X11/rgb.txt' + for cf_path in \ + /opt/local/share/X11/rgb.txt \ + /opt/X11/share/X11/rgb.txt \ + /usr/share/X11/rgb.txt \ + /usr/X11/share/X11/rgb.txt \ + /usr/X11/lib/X11/rgb.txt \ + /usr/lib/X11/rgb.txt \ + /etc/X11/rgb.txt \ + /usr/pkg/lib/X11/rgb.txt \ + /usr/X11R7/lib/X11/rgb.txt \ + /usr/X11R6/lib/X11/rgb.txt \ + /usr/X11R5/lib/X11/rgb.txt \ + /usr/X11R4/lib/X11/rgb.txt \ + /usr/local/lib/X11/rgb.txt \ + /usr/local/share/X11/rgb.txt \ + /usr/lib64/X11/rgb.txt + do + if test -f "$cf_path" ; then + RGB_PATH="$cf_path" + break + fi + done +else + cf_path=$RGB_PATH - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" fi -if test -n "$cf_new_extra_cppflags" ; then - - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -fi +case ".$cf_path" in +(.\$\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[a-zA-Z]:[\\/]*) # OS/2 EMX + ;; +(.\${*prefix}*|.\${*dir}*) + eval cf_path="$cf_path" + case ".$cf_path" in + (.NONE/*) + cf_path=`echo $cf_path | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + cf_path=`echo $cf_path | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + { { echo "$as_me:15581: error: expected a pathname, not \"$cf_path\"" >&5 +echo "$as_me: error: expected a pathname, not \"$cf_path\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac - LIBS="$cf_pkgconfig_libs $LIBS" - : -else - cf_pkgconfig_incs= - cf_pkgconfig_libs= - : fi -else - cf_pkgconfig_incs= - cf_pkgconfig_libs= +echo "$as_me:15589: result: $RGB_PATH" >&5 +echo "${ECHO_T}$RGB_PATH" >&6 -test -n "$verbose" && echo " ...before $LIBS" 1>&6 +cat >>confdefs.h <&5 +no_x11_rgb= +if test "$RGB_PATH" = no +then + no_x11_rgb="#" +fi -LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXt %-lXt $X_PRE_LIBS %" -e 's% % %g'` -test -n "$verbose" && echo " ...after $LIBS" 1>&6 +cf_curses_headers= -echo "${as_me:-configure}:10988: testing ...after $LIBS ..." 1>&5 +case $cf_cv_screen in +(pdcurses) + cf_default_panel=no + cf_default_form=no + cf_default_menu=no + cf_default_tinfo=no + ;; +(xcurses|bsdcurses) + cf_default_panel=no + cf_default_form=no + cf_default_menu=no + cf_default_tinfo=yes + ;; +(*) + cf_default_panel=yes + cf_default_form=yes + cf_default_menu=yes + cf_default_tinfo=yes + case $cf_cv_screen in + (ncurses*) + cf_curses_headers="nc_alloc.h nomacros.h term_entry.h" + ;; + esac + ;; +esac -fi +echo "$as_me:15630: checking if you want to check for panel functions" >&5 +echo $ECHO_N "checking if you want to check for panel functions... $ECHO_C" >&6 - ;; - esac - ;; - esac +# Check whether --enable-panel or --disable-panel was given. +if test "${enable_panel+set}" = set; then + enableval="$enable_panel" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + cf_enable_panel=no + else + cf_enable_panel=$cf_default_panel fi - - cf_have_X_LIBS=yes - else - cf_pkgconfig_incs= - cf_pkgconfig_libs= + enableval=yes + cf_enable_panel=$cf_default_panel - LDFLAGS="$X_LIBS $LDFLAGS" +fi; +echo "$as_me:15647: result: $cf_enable_panel" >&5 +echo "${ECHO_T}$cf_enable_panel" >&6 +if test $cf_enable_panel = yes +then -test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 +cf_have_curses_lib=no + +: ${NCURSES_CONFIG_PKG:=none} +if test "x${NCURSES_CONFIG_PKG}" = xnone; then + : +elif test "x${PKG_CONFIG:=none}" != xnone; then + echo "$as_me:15658: checking pkg-config for panel$cf_cv_libtype" >&5 +echo $ECHO_N "checking pkg-config for panel$cf_cv_libtype... $ECHO_C" >&6 + if "$PKG_CONFIG" --exists panel$cf_cv_libtype ; then + echo "$as_me:15661: result: yes" >&5 +echo "${ECHO_T}yes" >&6 -echo "${as_me:-configure}:11008: testing checking additions to CFLAGS ..." 1>&5 + echo "$as_me:15664: checking if the panel$cf_cv_libtype package files work" >&5 +echo $ECHO_N "checking if the panel$cf_cv_libtype package files work... $ECHO_C" >&6 -cf_check_cflags="$CFLAGS" -cf_check_cppflags="$CPPFLAGS" + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= -for cf_add_cflags in $X_CFLAGS +for cf_add_cflags in `$PKG_CONFIG --cflags panel$cf_cv_libtype` do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -11052,21 +15715,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -11074,621 +15745,343 @@ esac done if test -n "$cf_new_cflags" ; then - test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 -echo "${as_me:-configure}:11079: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" - CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then - test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 - -echo "${as_me:-configure}:11087: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 - - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" -fi - -if test -n "$cf_new_extra_cppflags" ; then - test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 - -echo "${as_me:-configure}:11095: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 - - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" -fi - -if test "$cf_check_cflags" != "$CFLAGS" ; then -cat >conftest.$ac_ext <<_ACEOF -#line 11102 "configure" -#include "confdefs.h" -#include -int -main () -{ -printf("Hello world"); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11114: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:11117: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11120: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:11123: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 - -echo "${as_me:-configure}:11131: testing test-compile failed. Undoing change to \$CFLAGS ..." 1>&5 - - if test "$cf_check_cppflags" != "$CPPFLAGS" ; then - test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 - -echo "${as_me:-configure}:11136: testing but keeping change to \$CPPFLAGS ..." 1>&5 - - fi - CFLAGS="$cf_check_flags" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi - - echo "$as_me:11144: checking for XOpenDisplay" >&5 -echo $ECHO_N "checking for XOpenDisplay... $ECHO_C" >&6 -if test "${ac_cv_func_XOpenDisplay+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 11150 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char XOpenDisplay (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char XOpenDisplay (); -char (*f) (); - -int -main () -{ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_XOpenDisplay) || defined (__stub___XOpenDisplay) -choke me -#else -f = XOpenDisplay; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11181: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:11184: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11187: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:11190: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_XOpenDisplay=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_func_XOpenDisplay=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:11200: result: $ac_cv_func_XOpenDisplay" >&5 -echo "${ECHO_T}$ac_cv_func_XOpenDisplay" >&6 -if test $ac_cv_func_XOpenDisplay = yes; then - : -else - - echo "$as_me:11206: checking for XOpenDisplay in -lX11" >&5 -echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 -if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 11214 "configure" -#include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char XOpenDisplay (); -int -main () -{ -XOpenDisplay (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11233: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:11236: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11239: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:11242: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_X11_XOpenDisplay=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_X11_XOpenDisplay=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:11253: result: $ac_cv_lib_X11_XOpenDisplay" >&5 -echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 -if test $ac_cv_lib_X11_XOpenDisplay = yes; then - LIBS="-lX11 $LIBS" + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + fi +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + fi - echo "$as_me:11261: checking for XtAppInitialize" >&5 -echo $ECHO_N "checking for XtAppInitialize... $ECHO_C" >&6 -if test "${ac_cv_func_XtAppInitialize+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 11267 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char XtAppInitialize (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char XtAppInitialize (); -char (*f) (); +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in `$PKG_CONFIG --libs panel$cf_cv_libtype`; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + cat >conftest.$ac_ext <<_ACEOF +#line 15785 "configure" +#include "confdefs.h" +#include int -main () +main (void) { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_XtAppInitialize) || defined (__stub___XtAppInitialize) -choke me -#else -f = XtAppInitialize; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; -#endif - +(void) new_panel ( 0 ); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11298: \"$ac_link\"") >&5 +if { (eval echo "$as_me:15797: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11301: \$? = $ac_status" >&5 + echo "$as_me:15800: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11304: \"$ac_try\"") >&5 + { (eval echo "$as_me:15803: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11307: \$? = $ac_status" >&5 + echo "$as_me:15806: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_XtAppInitialize=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_func_XtAppInitialize=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:11317: result: $ac_cv_func_XtAppInitialize" >&5 -echo "${ECHO_T}$ac_cv_func_XtAppInitialize" >&6 -if test $ac_cv_func_XtAppInitialize = yes; then - : -else - - echo "$as_me:11323: checking for XtAppInitialize in -lXt" >&5 -echo $ECHO_N "checking for XtAppInitialize in -lXt... $ECHO_C" >&6 -if test "${ac_cv_lib_Xt_XtAppInitialize+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + cf_have_curses_lib=maybe else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 11331 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 15812 "configure" #include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char XtAppInitialize (); -int -main () -{ -XtAppInitialize (); - ; - return 0; -} +#include + int main(void) + { (void) new_panel ( 0 ); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11350: \"$ac_link\"") >&5 +rm -f conftest$ac_exeext +if { (eval echo "$as_me:15819: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11353: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11356: \"$ac_try\"") >&5 + echo "$as_me:15822: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:15824: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11359: \$? = $ac_status" >&5 + echo "$as_me:15827: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_Xt_XtAppInitialize=yes + cf_have_curses_lib=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -ac_cv_lib_Xt_XtAppInitialize=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:11370: result: $ac_cv_lib_Xt_XtAppInitialize" >&5 -echo "${ECHO_T}$ac_cv_lib_Xt_XtAppInitialize" >&6 -if test $ac_cv_lib_Xt_XtAppInitialize = yes; then - -cat >>confdefs.h <<\EOF -#define HAVE_LIBXT 1 -EOF - - cf_have_X_LIBS=Xt - LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS" -fi - -fi - +cf_have_curses_lib=no fi - -if test $cf_have_X_LIBS = no ; then - { echo "$as_me:11387: WARNING: Unable to successfully link X Toolkit library (-lXt) with -test program. You will have to check and add the proper libraries by hand -to makefile." >&5 -echo "$as_me: WARNING: Unable to successfully link X Toolkit library (-lXt) with -test program. You will have to check and add the proper libraries by hand -to makefile." >&2;} +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - -cf_x_athena_root=$cf_x_athena -cf_x_athena_inc="" - -for cf_path in default \ - /usr/contrib/X11R6 \ - /usr/contrib/X11R5 \ - /usr/lib/X11R5 \ - /usr/local -do - if test -z "$cf_x_athena_inc" ; then - cf_save="$CPPFLAGS" - cf_test=X11/$cf_x_athena_root/SimpleMenu.h - if test $cf_path != default ; then - CPPFLAGS="$cf_save -I$cf_path/include" - echo "$as_me:11409: checking for $cf_test in $cf_path" >&5 -echo $ECHO_N "checking for $cf_test in $cf_path... $ECHO_C" >&6 - else - echo "$as_me:11412: checking for $cf_test" >&5 -echo $ECHO_N "checking for $cf_test... $ECHO_C" >&6 - fi - cat >conftest.$ac_ext <<_ACEOF -#line 11416 "configure" -#include "confdefs.h" - -#include -#include <$cf_test> -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:11430: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:11433: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11436: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:11439: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_result=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_result=no +cf_have_curses_lib=no fi -rm -f conftest.$ac_objext conftest.$ac_ext - echo "$as_me:11448: result: $cf_result" >&5 -echo "${ECHO_T}$cf_result" >&6 - if test "$cf_result" = yes ; then - cf_x_athena_inc=$cf_path - break +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:15844: result: $cf_have_curses_lib" >&5 +echo "${ECHO_T}$cf_have_curses_lib" >&6 + test "$cf_have_curses_lib" = maybe && cf_have_curses_lib=yes + if test "$cf_have_curses_lib" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" else - CPPFLAGS="$cf_save" - fi - fi -done -if test -z "$cf_x_athena_inc" ; then - { echo "$as_me:11460: WARNING: Unable to successfully find Athena header files with test program" >&5 -echo "$as_me: WARNING: Unable to successfully find Athena header files with test program" >&2;} -elif test "$cf_x_athena_inc" != default ; then - CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc" -fi +cf_upper=`echo "have_libpanel" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -cf_x_athena_root=$cf_x_athena -cf_x_athena_lib="" + cat >>confdefs.h <&5 -echo $ECHO_N "checking for $cf_libs in $cf_path... $ECHO_C" >&6 - else - LIBS="$cf_libs $LIBS" - echo "$as_me:11494: checking for $cf_test in $cf_libs" >&5 -echo $ECHO_N "checking for $cf_test in $cf_libs... $ECHO_C" >&6 - fi - cat >conftest.$ac_ext <<_ACEOF -#line 11498 "configure" + fi + fi +fi +if test "$cf_have_curses_lib" = no; then + as_ac_Lib=`echo "ac_cv_lib_panel$cf_cv_libtype''_new_panel" | $as_tr_sh` +echo "$as_me:15864: checking for new_panel in -lpanel$cf_cv_libtype" >&5 +echo $ECHO_N "checking for new_panel in -lpanel$cf_cv_libtype... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpanel$cf_cv_libtype $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 15872 "configure" #include "confdefs.h" -#include -#include - +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char new_panel (); int -main () +main (void) { - -$cf_test((XtAppContext) 0) +new_panel (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11514: \"$ac_link\"") >&5 +if { (eval echo "$as_me:15891: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11517: \$? = $ac_status" >&5 + echo "$as_me:15894: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11520: \"$ac_try\"") >&5 + { (eval echo "$as_me:15897: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11523: \$? = $ac_status" >&5 + echo "$as_me:15900: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_result=yes + eval "$as_ac_Lib=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_result=no +eval "$as_ac_Lib=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - echo "$as_me:11532: result: $cf_result" >&5 -echo "${ECHO_T}$cf_result" >&6 - if test "$cf_result" = yes ; then - cf_x_athena_lib="$cf_libs" - break - fi - LIBS="$cf_save" - fi - done # cf_libs - test -n "$cf_x_athena_lib" && break - done # cf_lib -done - -if test -z "$cf_x_athena_lib" ; then - { { echo "$as_me:11546: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&5 -echo "$as_me: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&2;} - { (exit 1); exit 1; }; } +LIBS=$ac_check_lib_save_LIBS fi +echo "$as_me:15911: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then -cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` +cf_upper=`echo "have_libpanel" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lpanel$cf_cv_libtype; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" -cat >>confdefs.h <>confdefs.h <&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_XCURSES_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$XCURSES_CONFIG"; then - ac_cv_prog_XCURSES_CONFIG="$XCURSES_CONFIG" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_XCURSES_CONFIG="$ac_tool_prefix$ac_prog" -echo "$as_me:11579: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -XCURSES_CONFIG=$ac_cv_prog_XCURSES_CONFIG -if test -n "$XCURSES_CONFIG"; then - echo "$as_me:11587: result: $XCURSES_CONFIG" >&5 -echo "${ECHO_T}$XCURSES_CONFIG" >&6 -else - echo "$as_me:11590: result: no" >&5 -echo "${ECHO_T}no" >&6 + fi - test -n "$XCURSES_CONFIG" && break - done + cf_curses_headers="$cf_curses_headers panel.h" fi -if test -z "$XCURSES_CONFIG"; then - ac_ct_XCURSES_CONFIG=$XCURSES_CONFIG - for ac_prog in xcurses-config -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:11603: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_XCURSES_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_XCURSES_CONFIG"; then - ac_cv_prog_ac_ct_XCURSES_CONFIG="$ac_ct_XCURSES_CONFIG" # Let the user override the test. + +echo "$as_me:15944: checking if you want to check for menu functions" >&5 +echo $ECHO_N "checking if you want to check for menu functions... $ECHO_C" >&6 + +# Check whether --enable-menu or --disable-menu was given. +if test "${enable_menu+set}" = set; then + enableval="$enable_menu" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + cf_enable_menu=no + else + cf_enable_menu=$cf_default_menu + fi else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_ac_ct_XCURSES_CONFIG="$ac_prog" -echo "$as_me:11618: found $ac_dir/$ac_word" >&5 -break -done + enableval=yes + cf_enable_menu=$cf_default_menu -fi -fi -ac_ct_XCURSES_CONFIG=$ac_cv_prog_ac_ct_XCURSES_CONFIG -if test -n "$ac_ct_XCURSES_CONFIG"; then - echo "$as_me:11626: result: $ac_ct_XCURSES_CONFIG" >&5 -echo "${ECHO_T}$ac_ct_XCURSES_CONFIG" >&6 +fi; +echo "$as_me:15961: result: $cf_enable_menu" >&5 +echo "${ECHO_T}$cf_enable_menu" >&6 +if test $cf_enable_menu = yes +then + case $cf_cv_screen in + (ncurses*) + ;; + (curses*) + +echo "$as_me:15970: checking for NetBSD menu.h" >&5 +echo $ECHO_N "checking for NetBSD menu.h... $ECHO_C" >&6 +if test "${cf_cv_netbsd_menu_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$as_me:11629: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - test -n "$ac_ct_XCURSES_CONFIG" && break -done -test -n "$ac_ct_XCURSES_CONFIG" || ac_ct_XCURSES_CONFIG="none" +cat >conftest.$ac_ext <<_ACEOF +#line 15977 "configure" +#include "confdefs.h" - XCURSES_CONFIG=$ac_ct_XCURSES_CONFIG -fi +#include <${cf_cv_ncurses_header:-curses.h}> +#include -if test "$XCURSES_CONFIG" != none ; then +int +main (void) +{ -CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`" -LIBS="`$XCURSES_CONFIG --libs` $LIBS" + MENU *menu; + int y = menu->max_item_width; -cf_cv_lib_XCurses=yes + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:15995: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:15998: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:16001: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16004: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_netbsd_menu_h=yes else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_netbsd_menu_h=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext -LDFLAGS="$LDFLAGS $X_LIBS" +fi +echo "$as_me:16016: result: $cf_cv_netbsd_menu_h" >&5 +echo "${ECHO_T}$cf_cv_netbsd_menu_h" >&6 -test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 +test "$cf_cv_netbsd_menu_h" = yes && +cat >>confdefs.h <<\EOF +#define HAVE_NETBSD_MENU_H 1 +EOF -echo "${as_me:-configure}:11653: testing checking additions to CFLAGS ..." 1>&5 + ;; + esac -cf_check_cflags="$CFLAGS" -cf_check_cppflags="$CPPFLAGS" +cf_have_curses_lib=no + +: ${NCURSES_CONFIG_PKG:=none} +if test "x${NCURSES_CONFIG_PKG}" = xnone; then + : +elif test "x${PKG_CONFIG:=none}" != xnone; then + echo "$as_me:16033: checking pkg-config for menu$cf_cv_libtype" >&5 +echo $ECHO_N "checking pkg-config for menu$cf_cv_libtype... $ECHO_C" >&6 + if "$PKG_CONFIG" --exists menu$cf_cv_libtype ; then + echo "$as_me:16036: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + + echo "$as_me:16039: checking if the menu$cf_cv_libtype package files work" >&5 +echo $ECHO_N "checking if the menu$cf_cv_libtype package files work... $ECHO_C" >&6 + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= -for cf_add_cflags in $X_CFLAGS +for cf_add_cflags in `$PKG_CONFIG --cflags menu$cf_cv_libtype` do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -11697,21 +16090,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -11719,256 +16120,243 @@ esac done if test -n "$cf_new_cflags" ; then - test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 -echo "${as_me:-configure}:11724: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" - CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then - test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 -echo "${as_me:-configure}:11732: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then - test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 -echo "${as_me:-configure}:11740: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi -if test "$cf_check_cflags" != "$CFLAGS" ; then -cat >conftest.$ac_ext <<_ACEOF -#line 11747 "configure" +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in `$PKG_CONFIG --libs menu$cf_cv_libtype`; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + cat >conftest.$ac_ext <<_ACEOF +#line 16160 "configure" #include "confdefs.h" -#include +#include int -main () +main (void) { -printf("Hello world"); +(void) menu_driver ( 0,0 ); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11759: \"$ac_link\"") >&5 +if { (eval echo "$as_me:16172: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11762: \$? = $ac_status" >&5 + echo "$as_me:16175: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11765: \"$ac_try\"") >&5 + { (eval echo "$as_me:16178: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11768: \$? = $ac_status" >&5 + echo "$as_me:16181: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 - -echo "${as_me:-configure}:11776: testing test-compile failed. Undoing change to \$CFLAGS ..." 1>&5 - - if test "$cf_check_cppflags" != "$CPPFLAGS" ; then - test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 - -echo "${as_me:-configure}:11781: testing but keeping change to \$CPPFLAGS ..." 1>&5 - - fi - CFLAGS="$cf_check_flags" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi - -echo "$as_me:11789: checking for XOpenDisplay in -lX11" >&5 -echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 -if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + cf_have_curses_lib=maybe else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 11797 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 16187 "configure" #include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char XOpenDisplay (); -int -main () -{ -XOpenDisplay (); - ; - return 0; -} +#include + int main(void) + { (void) menu_driver ( 0,0 ); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11816: \"$ac_link\"") >&5 +rm -f conftest$ac_exeext +if { (eval echo "$as_me:16194: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11819: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11822: \"$ac_try\"") >&5 + echo "$as_me:16197: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:16199: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11825: \$? = $ac_status" >&5 + echo "$as_me:16202: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_X11_XOpenDisplay=yes + cf_have_curses_lib=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -ac_cv_lib_X11_XOpenDisplay=no +cf_have_curses_lib=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:11836: result: $ac_cv_lib_X11_XOpenDisplay" >&5 -echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 -if test $ac_cv_lib_X11_XOpenDisplay = yes; then - LIBS="-lX11 $LIBS" +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - -echo "$as_me:11842: checking for XCurses library" >&5 -echo $ECHO_N "checking for XCurses library... $ECHO_C" >&6 -if test "${cf_cv_lib_XCurses+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -LIBS="-lXCurses $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 11850 "configure" -#include "confdefs.h" - -#include -char *XCursesProgramName = "test"; - -int -main () -{ -XCursesExit(); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11865: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:11868: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11871: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:11874: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_lib_XCurses=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_lib_XCurses=no +cf_have_curses_lib=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:16219: result: $cf_have_curses_lib" >&5 +echo "${ECHO_T}$cf_have_curses_lib" >&6 + test "$cf_have_curses_lib" = maybe && cf_have_curses_lib=yes + if test "$cf_have_curses_lib" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + else -fi -echo "$as_me:11885: result: $cf_cv_lib_XCurses" >&5 -echo "${ECHO_T}$cf_cv_lib_XCurses" >&6 - -fi - -if test $cf_cv_lib_XCurses = yes ; then - -cat >>confdefs.h <<\EOF -#define UNIX 1 -EOF +cf_upper=`echo "have_libmenu" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -cat >>confdefs.h <<\EOF -#define XCURSES 1 + cat >>confdefs.h <&5 -echo $ECHO_N "checking for xcurses.h... $ECHO_C" >&6 -if test "${ac_cv_header_xcurses_h+set}" = set; then + fi + fi +fi +if test "$cf_have_curses_lib" = no; then + as_ac_Lib=`echo "ac_cv_lib_menu$cf_cv_libtype''_menu_driver" | $as_tr_sh` +echo "$as_me:16239: checking for menu_driver in -lmenu$cf_cv_libtype" >&5 +echo $ECHO_N "checking for menu_driver in -lmenu$cf_cv_libtype... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -#line 11906 "configure" + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmenu$cf_cv_libtype $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 16247 "configure" #include "confdefs.h" -#include -_ACEOF -if { (eval echo "$as_me:11910: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:11916: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_cv_header_xcurses_h=yes + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char menu_driver (); +int +main (void) +{ +menu_driver (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16266: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16269: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16272: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16275: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_header_xcurses_h=no +cat conftest.$ac_ext >&5 +eval "$as_ac_Lib=no" fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:11935: result: $ac_cv_header_xcurses_h" >&5 -echo "${ECHO_T}$ac_cv_header_xcurses_h" >&6 -if test $ac_cv_header_xcurses_h = yes; then +echo "$as_me:16286: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then -cat >>confdefs.h <<\EOF -#define HAVE_XCURSES 1 +cf_upper=`echo "have_libmenu" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lmenu$cf_cv_libtype; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + cat >>confdefs.h <&5 -echo "$as_me: error: Cannot link with XCurses" >&2;} - { (exit 1); exit 1; }; } fi - ;; -esac + cf_curses_headers="$cf_curses_headers menu.h" +fi -case $cf_cv_screen in -curses|curses_*) +echo "$as_me:16319: checking if you want to check for form functions" >&5 +echo $ECHO_N "checking if you want to check for form functions... $ECHO_C" >&6 + +# Check whether --enable-form or --disable-form was given. +if test "${enable_form+set}" = set; then + enableval="$enable_form" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + cf_enable_form=no + else + cf_enable_form=$cf_default_form + fi +else + enableval=yes + cf_enable_form=$cf_default_form + +fi; +echo "$as_me:16336: result: $cf_enable_form" >&5 +echo "${ECHO_T}$cf_enable_form" >&6 +if test $cf_enable_form = yes +then + case $cf_cv_screen in + (ncurses*) + ;; + (curses*) -echo "$as_me:11957: checking for NetBSD form.h" >&5 +echo "$as_me:16345: checking for NetBSD form.h" >&5 echo $ECHO_N "checking for NetBSD form.h... $ECHO_C" >&6 if test "${cf_cv_netbsd_form_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11964 "configure" +#line 16352 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> #include int -main () +main (void) { FORM *form; @@ -11980,16 +16368,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11983: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:16371: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11986: \$? = $ac_status" >&5 + echo "$as_me:16374: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11989: \"$ac_try\"") >&5 + { (eval echo "$as_me:16377: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11992: \$? = $ac_status" >&5 + echo "$as_me:16380: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_netbsd_form_h=yes @@ -12001,7 +16389,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:12004: result: $cf_cv_netbsd_form_h" >&5 +echo "$as_me:16392: result: $cf_cv_netbsd_form_h" >&5 echo "${ECHO_T}$cf_cv_netbsd_form_h" >&6 test "$cf_cv_netbsd_form_h" = yes && @@ -12009,203 +16397,230 @@ cat >>confdefs.h <<\EOF #define HAVE_NETBSD_FORM_H 1 EOF -echo "$as_me:12012: checking for NetBSD menu.h" >&5 -echo $ECHO_N "checking for NetBSD menu.h... $ECHO_C" >&6 -if test "${cf_cv_netbsd_menu_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else + ;; + esac -cat >conftest.$ac_ext <<_ACEOF -#line 12019 "configure" -#include "confdefs.h" +cf_have_curses_lib=no -#include <${cf_cv_ncurses_header:-curses.h}> -#include +: ${NCURSES_CONFIG_PKG:=none} +if test "x${NCURSES_CONFIG_PKG}" = xnone; then + : +elif test "x${PKG_CONFIG:=none}" != xnone; then + echo "$as_me:16409: checking pkg-config for form$cf_cv_libtype" >&5 +echo $ECHO_N "checking pkg-config for form$cf_cv_libtype... $ECHO_C" >&6 + if "$PKG_CONFIG" --exists form$cf_cv_libtype ; then + echo "$as_me:16412: result: yes" >&5 +echo "${ECHO_T}yes" >&6 -int -main () -{ + echo "$as_me:16415: checking if the form$cf_cv_libtype package files work" >&5 +echo $ECHO_N "checking if the form$cf_cv_libtype package files work... $ECHO_C" >&6 - MENU *menu; - int y = menu->max_item_width; + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:12037: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:12040: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:12043: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:12046: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_netbsd_menu_h=yes +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_cv_netbsd_menu_h=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext +for cf_add_cflags in `$PKG_CONFIG --cflags form$cf_cv_libtype` +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` -fi -echo "$as_me:12058: result: $cf_cv_netbsd_menu_h" >&5 -echo "${ECHO_T}$cf_cv_netbsd_menu_h" >&6 + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes -test "$cf_cv_netbsd_menu_h" = yes && -cat >>confdefs.h <<\EOF -#define HAVE_NETBSD_MENU_H 1 -EOF + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; + esac ;; -ncursesw) - cf_cv_libtype=w +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no ;; esac +done -case $cf_cv_screen in #(vi -pdcurses) #(vi - ;; -*) - # look for curses-related libraries - : ${cf_panel_lib:=panel} - : ${cf_menu_lib:=menu} - : ${cf_form_lib:=form} - -as_ac_Lib=`echo "ac_cv_lib_$cf_panel_lib$cf_cv_libtype''_new_panel" | $as_tr_sh` -echo "$as_me:12082: checking for new_panel in -l$cf_panel_lib$cf_cv_libtype" >&5 -echo $ECHO_N "checking for new_panel in -l$cf_panel_lib$cf_cv_libtype... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Lib+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$cf_panel_lib$cf_cv_libtype $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 12090 "configure" -#include "confdefs.h" +if test -n "$cf_new_cflags" ; then -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char new_panel (); + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in `$PKG_CONFIG --libs form$cf_cv_libtype`; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + cat >conftest.$ac_ext <<_ACEOF +#line 16536 "configure" +#include "confdefs.h" +#include int -main () +main (void) { -new_panel (); +(void) form_driver ( 0,0 ); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12109: \"$ac_link\"") >&5 +if { (eval echo "$as_me:16548: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12112: \$? = $ac_status" >&5 + echo "$as_me:16551: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12115: \"$ac_try\"") >&5 + { (eval echo "$as_me:16554: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12118: \$? = $ac_status" >&5 + echo "$as_me:16557: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_Lib=yes" -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -eval "$as_ac_Lib=no" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:12129: result: `eval echo '${'$as_ac_Lib'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 -if test `eval echo '${'$as_ac_Lib'}'` = yes; then - cat >>confdefs.h <&5 -echo $ECHO_N "checking for menu_driver in -l$cf_menu_lib$cf_cv_libtype... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Lib+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + cf_have_curses_lib=maybe else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$cf_menu_lib$cf_cv_libtype $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 12149 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 16563 "configure" #include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char menu_driver (); -int -main () -{ -menu_driver (); - ; - return 0; -} +#include + int main(void) + { (void) form_driver ( 0,0 ); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12168: \"$ac_link\"") >&5 +rm -f conftest$ac_exeext +if { (eval echo "$as_me:16570: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12171: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12174: \"$ac_try\"") >&5 + echo "$as_me:16573: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:16575: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12177: \$? = $ac_status" >&5 + echo "$as_me:16578: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_Lib=yes" + cf_have_curses_lib=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_curses_lib=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -eval "$as_ac_Lib=no" +cf_have_curses_lib=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:12188: result: `eval echo '${'$as_ac_Lib'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 -if test `eval echo '${'$as_ac_Lib'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}$cf_have_curses_lib" >&6 + test "$cf_have_curses_lib" = maybe && cf_have_curses_lib=yes + if test "$cf_have_curses_lib" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + else - LIBS="-l$cf_menu_lib$cf_cv_libtype $LIBS" +cf_upper=`echo "have_libform" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -fi + cat >>confdefs.h <&5 -echo $ECHO_N "checking for form_driver in -l$cf_form_lib$cf_cv_libtype... $ECHO_C" >&6 + fi + fi +fi +if test "$cf_have_curses_lib" = no; then + as_ac_Lib=`echo "ac_cv_lib_form$cf_cv_libtype''_form_driver" | $as_tr_sh` +echo "$as_me:16615: checking for form_driver in -lform$cf_cv_libtype" >&5 +echo $ECHO_N "checking for form_driver in -lform$cf_cv_libtype... $ECHO_C" >&6 if eval "test \"\${$as_ac_Lib+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-l$cf_form_lib$cf_cv_libtype $LIBS" +LIBS="-lform$cf_cv_libtype $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 12208 "configure" +#line 16623 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -12216,7 +16631,7 @@ extern "C" builtin and then its argument prototype would still apply. */ char form_driver (); int -main () +main (void) { form_driver (); ; @@ -12224,16 +16639,16 @@ form_driver (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12227: \"$ac_link\"") >&5 +if { (eval echo "$as_me:16642: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12230: \$? = $ac_status" >&5 + echo "$as_me:16645: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12233: \"$ac_try\"") >&5 + { (eval echo "$as_me:16648: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12236: \$? = $ac_status" >&5 + echo "$as_me:16651: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Lib=yes" else @@ -12244,46 +16659,61 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:12247: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "$as_me:16662: result: `eval echo '${'$as_ac_Lib'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 if test `eval echo '${'$as_ac_Lib'}'` = yes; then - cat >>confdefs.h <>confdefs.h <&5 +echo "$as_me:16700: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12276 "configure" +#line 16706 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:12280: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:16710: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:12286: \$? = $ac_status" >&5 + echo "$as_me:16716: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -12302,26 +16732,23 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:12305: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:16735: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:16745: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12324 "configure" +#line 16751 "configure" #include "confdefs.h" #include #include @@ -12329,13 +16756,13 @@ else #include _ACEOF -if { (eval echo "$as_me:12332: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:16759: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:12338: \$? = $ac_status" >&5 + echo "$as_me:16765: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -12357,7 +16784,7 @@ rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line 12360 "configure" +#line 16787 "configure" #include "confdefs.h" #include @@ -12375,7 +16802,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line 12378 "configure" +#line 16805 "configure" #include "confdefs.h" #include @@ -12396,7 +16823,7 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line 12399 "configure" +#line 16826 "configure" #include "confdefs.h" #include #if ((' ' & 0x0FF) == 0x020) @@ -12411,7 +16838,7 @@ else #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int -main () +main (void) { int i; for (i = 0; i < 256; i++) @@ -12422,15 +16849,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:12425: \"$ac_link\"") >&5 +if { (eval echo "$as_me:16852: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12428: \$? = $ac_status" >&5 + echo "$as_me:16855: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:12430: \"$ac_try\"") >&5 + { (eval echo "$as_me:16857: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12433: \$? = $ac_status" >&5 + echo "$as_me:16860: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -12443,7 +16870,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi -echo "$as_me:12446: result: $ac_cv_header_stdc" >&5 +echo "$as_me:16873: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then @@ -12453,20 +16880,20 @@ EOF fi -echo "$as_me:12456: checking whether time.h and sys/time.h may both be included" >&5 +echo "$as_me:16883: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12462 "configure" +#line 16889 "configure" #include "confdefs.h" #include #include #include int -main () +main (void) { if ((struct tm *) 0) return 0; @@ -12475,16 +16902,16 @@ return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:12478: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:16905: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:12481: \$? = $ac_status" >&5 + echo "$as_me:16908: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:12484: \"$ac_try\"") >&5 + { (eval echo "$as_me:16911: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12487: \$? = $ac_status" >&5 + echo "$as_me:16914: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_time=yes else @@ -12494,7 +16921,7 @@ ac_cv_header_time=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:12497: result: $ac_cv_header_time" >&5 +echo "$as_me:16924: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then @@ -12509,6 +16936,7 @@ getopt.h \ locale.h \ math.h \ stdarg.h \ +stdint.h \ sys/ioctl.h \ sys/select.h \ sys/time.h \ @@ -12517,23 +16945,23 @@ unistd.h \ do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:12520: checking for $ac_header" >&5 +echo "$as_me:16948: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12526 "configure" +#line 16954 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:12530: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:16958: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:12536: \$? = $ac_status" >&5 + echo "$as_me:16964: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -12552,7 +16980,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:12555: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:16983: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:16996: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12574 "configure" +#line 17002 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:12578: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:17006: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:12584: \$? = $ac_status" >&5 + echo "$as_me:17012: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -12600,7 +17028,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:12603: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:17031: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:17041: checking for header declaring getopt variables" >&5 echo $ECHO_N "checking for header declaring getopt variables... $ECHO_C" >&6 if test "${cf_cv_getopt_header+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -12620,12 +17048,12 @@ cf_cv_getopt_header=none for cf_header in stdio.h stdlib.h unistd.h getopt.h do cat >conftest.$ac_ext <<_ACEOF -#line 12623 "configure" +#line 17051 "configure" #include "confdefs.h" #include <$cf_header> int -main () +main (void) { int x = optind; char *y = optarg ; @@ -12633,16 +17061,16 @@ int x = optind; char *y = optarg } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:12636: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:17064: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:12639: \$? = $ac_status" >&5 + echo "$as_me:17067: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:12642: \"$ac_try\"") >&5 + { (eval echo "$as_me:17070: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12645: \$? = $ac_status" >&5 + echo "$as_me:17073: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_getopt_header=$cf_header break @@ -12654,7 +17082,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext done fi -echo "$as_me:12657: result: $cf_cv_getopt_header" >&5 +echo "$as_me:17085: result: $cf_cv_getopt_header" >&5 echo "${ECHO_T}$cf_cv_getopt_header" >&6 if test $cf_cv_getopt_header != none ; then @@ -12662,60 +17090,70 @@ cat >>confdefs.h <<\EOF #define HAVE_GETOPT_HEADER 1 EOF +fi +if test $cf_cv_getopt_header = getopt.h ; then + +cat >>confdefs.h <<\EOF +#define NEED_GETOPT_H 1 +EOF + fi for ac_func in \ +getopt \ gettimeofday \ +strstr \ +tsearch \ do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:12672: checking for $ac_func" >&5 +echo "$as_me:17110: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12678 "configure" +#line 17116 "configure" #include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ +#define $ac_func autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef $ac_func + #ifdef __cplusplus extern "C" #endif + /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char $ac_func (); -char (*f) (); +char $ac_func (void); int -main () +main (void) { -/* The GNU C library defines this for functions which it implements + +/* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#error found stub for $ac_func #endif + return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12709: \"$ac_link\"") >&5 +if { (eval echo "$as_me:17147: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12712: \$? = $ac_status" >&5 + echo "$as_me:17150: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12715: \"$ac_try\"") >&5 + { (eval echo "$as_me:17153: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12718: \$? = $ac_status" >&5 + echo "$as_me:17156: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -12725,7 +17163,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:12728: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:17166: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 +echo $ECHO_N "checking if we can use termcap.h... $ECHO_C" >&6 +if test "${cf_cv_have_termcap_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 17184 "configure" +#include "confdefs.h" + +#include +#ifdef NCURSES_VERSION +#undef NCURSES_VERSION +#endif +#include +#ifndef NCURSES_VERSION +#error wrong header +#endif + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:17205: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:17208: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:17211: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:17214: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_termcap_h=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_have_termcap_h=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:17224: result: $cf_cv_have_termcap_h" >&5 +echo "${ECHO_T}$cf_cv_have_termcap_h" >&6 +if test "x$cf_cv_have_termcap_h" = xyes +then + +cat >>confdefs.h <<\EOF +#define HAVE_TERMCAP_H 1 +EOF + +else +echo "$as_me:17234: checking if we can use ncurses/termcap.h" >&5 +echo $ECHO_N "checking if we can use ncurses/termcap.h... $ECHO_C" >&6 +if test "${cf_cv_have_ncurses_termcap_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 17241 "configure" +#include "confdefs.h" + +#include +#ifdef NCURSES_VERSION +#undef NCURSES_VERSION +#endif +#include +#ifndef NCURSES_VERSION +#error wrong header +#endif + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:17262: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:17265: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:17268: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:17271: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_ncurses_termcap_h=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_have_ncurses_termcap_h=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:17281: result: $cf_cv_have_ncurses_termcap_h" >&5 +echo "${ECHO_T}$cf_cv_have_ncurses_termcap_h" >&6 +test "x$cf_cv_have_ncurses_termcap_h" = xyes && +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_TERMCAP_H 1 +EOF + +fi + +if test "x$ac_cv_func_getopt" = xno; then + { { echo "$as_me:17291: error: getopt is required for building programs" >&5 +echo "$as_me: error: getopt is required for building programs" >&2;} + { (exit 1); exit 1; }; } +fi + if test "$cf_enable_widec" = yes; then for ac_func in \ @@ -12749,53 +17307,53 @@ wcstombs \ do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:12752: checking for $ac_func" >&5 +echo "$as_me:17310: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12758 "configure" +#line 17316 "configure" #include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ +#define $ac_func autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef $ac_func + #ifdef __cplusplus extern "C" #endif + /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char $ac_func (); -char (*f) (); +char $ac_func (void); int -main () +main (void) { -/* The GNU C library defines this for functions which it implements + +/* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#error found stub for $ac_func #endif + return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12789: \"$ac_link\"") >&5 +if { (eval echo "$as_me:17347: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12792: \$? = $ac_status" >&5 + echo "$as_me:17350: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12795: \"$ac_try\"") >&5 + { (eval echo "$as_me:17353: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12798: \$? = $ac_status" >&5 + echo "$as_me:17356: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -12805,7 +17363,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:12808: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:17366: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 -echo $ECHO_N "checking if we must define _XOPEN_SOURCE_EXTENDED... $ECHO_C" >&6 +echo "$as_me:17378: checking definition to turn on extended curses functions" >&5 +echo $ECHO_N "checking definition to turn on extended curses functions... $ECHO_C" >&6 if test "${cf_cv_need_xopen_extension+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else +cf_cv_need_xopen_extension=unknown cat >conftest.$ac_ext <<_ACEOF -#line 12827 "configure" +#line 17386 "configure" #include "confdefs.h" #include #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { #if defined(NCURSES_VERSION_PATCH) #if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403) make an error #endif +#endif +#ifdef NCURSES_VERSION + cchar_t check; + int check2 = curs_set((int)sizeof(check)); #endif long x = winnstr(stdscr, "", 0); int x1, y1; @@ -12846,70 +17409,83 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12849: \"$ac_link\"") >&5 +if { (eval echo "$as_me:17412: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12852: \$? = $ac_status" >&5 + echo "$as_me:17415: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12855: \"$ac_try\"") >&5 + { (eval echo "$as_me:17418: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12858: \$? = $ac_status" >&5 + echo "$as_me:17421: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_need_xopen_extension=no + cf_cv_need_xopen_extension=none else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF -#line 12865 "configure" + + for cf_try_xopen_extension in _XOPEN_SOURCE_EXTENDED NCURSES_WIDECHAR + do + cat >conftest.$ac_ext <<_ACEOF +#line 17431 "configure" #include "confdefs.h" -#define _XOPEN_SOURCE_EXTENDED +#define $cf_try_xopen_extension 1 #include #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { #ifdef NCURSES_VERSION - cchar_t check; - int check2 = curs_set((int)sizeof(check)); + cchar_t check; + int check2 = curs_set((int)sizeof(check)); #endif - long x = winnstr(stdscr, "", 0); - int x1, y1; - getbegyx(stdscr, y1, x1) + long x = winnstr(stdscr, "", 0); + int x1, y1; + getbegyx(stdscr, y1, x1) ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12887: \"$ac_link\"") >&5 +if { (eval echo "$as_me:17453: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12890: \$? = $ac_status" >&5 + echo "$as_me:17456: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12893: \"$ac_try\"") >&5 + { (eval echo "$as_me:17459: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12896: \$? = $ac_status" >&5 + echo "$as_me:17462: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_need_xopen_extension=yes + cf_cv_need_xopen_extension=$cf_try_xopen_extension; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_need_xopen_extension=unknown fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done + fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + fi -echo "$as_me:12908: result: $cf_cv_need_xopen_extension" >&5 +echo "$as_me:17476: result: $cf_cv_need_xopen_extension" >&5 echo "${ECHO_T}$cf_cv_need_xopen_extension" >&6 -test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" -echo "$as_me:12912: checking for term.h" >&5 +case $cf_cv_need_xopen_extension in +(*_*) + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D$cf_cv_need_xopen_extension" + + ;; +esac + +echo "$as_me:17488: checking for term.h" >&5 echo $ECHO_N "checking for term.h... $ECHO_C" >&6 if test "${cf_cv_term_header+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -12920,8 +17496,8 @@ else cf_header_list="term.h ncurses/term.h ncursesw/term.h" -case ${cf_cv_ncurses_header:-curses.h} in #(vi -*/*) +case ${cf_cv_ncurses_header:-curses.h} in +(*/*) cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h cf_header_list="$cf_header_item $cf_header_list" ;; @@ -12930,13 +17506,13 @@ esac for cf_header in $cf_header_list do cat >conftest.$ac_ext <<_ACEOF -#line 12933 "configure" +#line 17509 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> #include <${cf_header}> int -main () +main (void) { WINDOW *x ; @@ -12944,16 +17520,16 @@ WINDOW *x } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:12947: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:17523: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:12950: \$? = $ac_status" >&5 + echo "$as_me:17526: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:12953: \"$ac_try\"") >&5 + { (eval echo "$as_me:17529: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12956: \$? = $ac_status" >&5 + echo "$as_me:17532: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_term_header=$cf_header break @@ -12965,14 +17541,14 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext done -case $cf_cv_term_header in #(vi -no) +case $cf_cv_term_header in +(no) # If curses is ncurses, some packagers still mess it up by trying to make # us use GNU termcap. This handles the most common case. for cf_header in ncurses/term.h ncursesw/term.h do cat >conftest.$ac_ext <<_ACEOF -#line 12975 "configure" +#line 17551 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> @@ -12982,7 +17558,7 @@ no) make an error #endif int -main () +main (void) { WINDOW *x ; @@ -12990,16 +17566,16 @@ WINDOW *x } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:12993: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:17569: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:12996: \$? = $ac_status" >&5 + echo "$as_me:17572: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:12999: \"$ac_try\"") >&5 + { (eval echo "$as_me:17575: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13002: \$? = $ac_status" >&5 + echo "$as_me:17578: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_term_header=$cf_header break @@ -13014,25 +17590,25 @@ rm -f conftest.$ac_objext conftest.$ac_ext esac fi -echo "$as_me:13017: result: $cf_cv_term_header" >&5 +echo "$as_me:17593: result: $cf_cv_term_header" >&5 echo "${ECHO_T}$cf_cv_term_header" >&6 -case $cf_cv_term_header in #(vi -term.h) #(vi +case $cf_cv_term_header in +(term.h) cat >>confdefs.h <<\EOF #define HAVE_TERM_H 1 EOF ;; -ncurses/term.h) #(vi +(ncurses/term.h) cat >>confdefs.h <<\EOF #define HAVE_NCURSES_TERM_H 1 EOF ;; -ncursesw/term.h) +(ncursesw/term.h) cat >>confdefs.h <<\EOF #define HAVE_NCURSESW_TERM_H 1 @@ -13041,7 +17617,7 @@ EOF ;; esac -echo "$as_me:13044: checking for unctrl.h" >&5 +echo "$as_me:17620: checking for unctrl.h" >&5 echo $ECHO_N "checking for unctrl.h... $ECHO_C" >&6 if test "${cf_cv_unctrl_header+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -13052,8 +17628,8 @@ else cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h" -case ${cf_cv_ncurses_header:-curses.h} in #(vi -*/*) +case ${cf_cv_ncurses_header:-curses.h} in +(*/*) cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h cf_header_list="$cf_header_item $cf_header_list" ;; @@ -13062,13 +17638,13 @@ esac for cf_header in $cf_header_list do cat >conftest.$ac_ext <<_ACEOF -#line 13065 "configure" +#line 17641 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> #include <${cf_header}> int -main () +main (void) { WINDOW *x ; @@ -13076,16 +17652,16 @@ WINDOW *x } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13079: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:17655: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13082: \$? = $ac_status" >&5 + echo "$as_me:17658: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13085: \"$ac_try\"") >&5 + { (eval echo "$as_me:17661: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13088: \$? = $ac_status" >&5 + echo "$as_me:17664: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_unctrl_header=$cf_header break @@ -13098,32 +17674,32 @@ rm -f conftest.$ac_objext conftest.$ac_ext done fi -echo "$as_me:13101: result: $cf_cv_unctrl_header" >&5 +echo "$as_me:17677: result: $cf_cv_unctrl_header" >&5 echo "${ECHO_T}$cf_cv_unctrl_header" >&6 -case $cf_cv_unctrl_header in #(vi -no) - { echo "$as_me:13106: WARNING: unctrl.h header not found" >&5 +case $cf_cv_unctrl_header in +(no) + { echo "$as_me:17682: WARNING: unctrl.h header not found" >&5 echo "$as_me: WARNING: unctrl.h header not found" >&2;} ;; esac -case $cf_cv_unctrl_header in #(vi -unctrl.h) #(vi +case $cf_cv_unctrl_header in +(unctrl.h) cat >>confdefs.h <<\EOF #define HAVE_UNCTRL_H 1 EOF ;; -ncurses/unctrl.h) #(vi +(ncurses/unctrl.h) cat >>confdefs.h <<\EOF #define HAVE_NCURSES_UNCTRL_H 1 EOF ;; -ncursesw/unctrl.h) +(ncursesw/unctrl.h) cat >>confdefs.h <<\EOF #define HAVE_NCURSESW_UNCTRL_H 1 @@ -13133,9 +17709,14 @@ EOF esac for cf_func in \ +alloc_pair \ assume_default_colors \ chgat \ +color_content \ color_set \ +copywin \ +delscreen \ +dupwin \ filter \ getbegx \ getcurx \ @@ -13143,12 +17724,19 @@ getmaxx \ getnstr \ getparx \ getwin \ +halfdelay \ +init_extended_color \ +mvderwin \ mvvline \ +mvwin \ mvwvline \ napms \ +newpad \ putwin \ +reset_color_pairs \ resize_term \ resizeterm \ +restartterm \ ripoffline \ scr_dump \ setupterm \ @@ -13158,25 +17746,32 @@ termattrs \ tgetent \ tigetnum \ tigetstr \ +tputs_sp \ typeahead \ use_default_colors \ +use_env \ +use_extended_names \ use_screen \ use_window \ +vid_puts \ +vidputs \ vsscanf \ vw_printw \ wchgat \ +winsdelln \ winsstr \ wresize \ wsyncdown \ +_tracef \ do cf_tr_func=`echo "$cf_func" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - echo "$as_me:13176: checking for ${cf_func}" >&5 + echo "$as_me:17771: checking for ${cf_func}" >&5 echo $ECHO_N "checking for ${cf_func}... $ECHO_C" >&6 -echo "${as_me:-configure}:13179: testing ${cf_func} ..." 1>&5 +echo "${as_me:-configure}:17774: testing ${cf_func} ..." 1>&5 if eval "test \"\${cf_cv_func_$cf_func+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -13185,7 +17780,7 @@ else eval cf_result='$ac_cv_func_'$cf_func if test ".$cf_result" != ".no"; then cat >conftest.$ac_ext <<_ACEOF -#line 13188 "configure" +#line 17783 "configure" #include "confdefs.h" #ifdef HAVE_XCURSES @@ -13203,13 +17798,14 @@ char * XCursesProgramName = "test"; #endif int -main () +main (void) { #ifndef ${cf_func} long foo = (long)(&${cf_func}); -if (foo + 1234 > 5678) - ${cf_cv_main_return:-return}(foo); +fprintf(stderr, "testing linkage of $cf_func:%p\n", (void *)foo); +if (foo + 1234L > 5678L) + ${cf_cv_main_return:-return}(foo != 0); #endif ; @@ -13217,16 +17813,16 @@ if (foo + 1234 > 5678) } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13220: \"$ac_link\"") >&5 +if { (eval echo "$as_me:17816: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13223: \$? = $ac_status" >&5 + echo "$as_me:17819: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13226: \"$ac_try\"") >&5 + { (eval echo "$as_me:17822: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13229: \$? = $ac_status" >&5 + echo "$as_me:17825: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=yes else @@ -13242,7 +17838,7 @@ fi # use the computed/retrieved cache-value: eval 'cf_result=$cf_cv_func_'$cf_func - echo "$as_me:13245: result: $cf_result" >&5 + echo "$as_me:17841: result: $cf_result" >&5 echo "${ECHO_T}$cf_result" >&6 if test $cf_result != no; then cat >>confdefs.h <&5 + echo "$as_me:17856: checking for ${cf_func}" >&5 echo $ECHO_N "checking for ${cf_func}... $ECHO_C" >&6 -echo "${as_me:-configure}:13263: testing ${cf_func} ..." 1>&5 +echo "${as_me:-configure}:17859: testing ${cf_func} ..." 1>&5 if eval "test \"\${cf_cv_func_$cf_func+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -13269,7 +17865,7 @@ else eval cf_result='$ac_cv_func_'$cf_func if test ".$cf_result" != ".no"; then cat >conftest.$ac_ext <<_ACEOF -#line 13272 "configure" +#line 17868 "configure" #include "confdefs.h" #ifdef HAVE_XCURSES @@ -13287,13 +17883,14 @@ char * XCursesProgramName = "test"; #endif int -main () +main (void) { #ifndef ${cf_func} long foo = (long)(&${cf_func}); -if (foo + 1234 > 5678) - ${cf_cv_main_return:-return}(foo); +fprintf(stderr, "testing linkage of $cf_func:%p\n", (void *)foo); +if (foo + 1234L > 5678L) + ${cf_cv_main_return:-return}(foo != 0); #endif ; @@ -13301,16 +17898,16 @@ if (foo + 1234 > 5678) } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13304: \"$ac_link\"") >&5 +if { (eval echo "$as_me:17901: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13307: \$? = $ac_status" >&5 + echo "$as_me:17904: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13310: \"$ac_try\"") >&5 + { (eval echo "$as_me:17907: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13313: \$? = $ac_status" >&5 + echo "$as_me:17910: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=yes else @@ -13326,7 +17923,7 @@ fi # use the computed/retrieved cache-value: eval 'cf_result=$cf_cv_func_'$cf_func - echo "$as_me:13329: result: $cf_result" >&5 + echo "$as_me:17926: result: $cf_result" >&5 echo "${ECHO_T}$cf_result" >&6 if test $cf_result != no; then cat >>confdefs.h <conftest.$ac_ext <<_ACEOF -#line 13353 "configure" +#line 17950 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> @@ -13359,7 +17956,7 @@ then static $cf_ret outc($cf_arg value) { $cf_return; } int -main () +main (void) { tputs("hello", 0, outc); @@ -13370,21 +17967,21 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13373: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:17970: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13376: \$? = $ac_status" >&5 + echo "$as_me:17973: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13379: \"$ac_try\"") >&5 + { (eval echo "$as_me:17976: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13382: \$? = $ac_status" >&5 + echo "$as_me:17979: \$? = $ac_status" >&5 (exit $ac_status); }; }; then test -n "$verbose" && echo " prototype $cf_ret func($cf_arg value)" 1>&6 -echo "${as_me:-configure}:13387: testing prototype $cf_ret func($cf_arg value) ..." 1>&5 +echo "${as_me:-configure}:17984: testing prototype $cf_ret func($cf_arg value) ..." 1>&5 cat >>confdefs.h <&5 +echo "$as_me:18004: checking for ncurses extended functions" >&5 echo $ECHO_N "checking for ncurses extended functions... $ECHO_C" >&6 if test "${cf_cv_ncurses_ext_funcs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 13414 "configure" +#line 18011 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { int x = NCURSES_EXT_FUNCS @@ -13426,16 +18023,16 @@ int x = NCURSES_EXT_FUNCS } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13429: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:18026: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13432: \$? = $ac_status" >&5 + echo "$as_me:18029: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13435: \"$ac_try\"") >&5 + { (eval echo "$as_me:18032: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13438: \$? = $ac_status" >&5 + echo "$as_me:18035: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_ncurses_ext_funcs=defined else @@ -13443,12 +18040,12 @@ else cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 13446 "configure" +#line 18043 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { (void) assume_default_colors (0, 0); @@ -13468,16 +18065,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13471: \"$ac_link\"") >&5 +if { (eval echo "$as_me:18068: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13474: \$? = $ac_status" >&5 + echo "$as_me:18071: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13477: \"$ac_try\"") >&5 + { (eval echo "$as_me:18074: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13480: \$? = $ac_status" >&5 + echo "$as_me:18077: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_ncurses_ext_funcs=yes else @@ -13491,7 +18088,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:13494: result: $cf_cv_ncurses_ext_funcs" >&5 +echo "$as_me:18091: result: $cf_cv_ncurses_ext_funcs" >&5 echo "${ECHO_T}$cf_cv_ncurses_ext_funcs" >&6 test "$cf_cv_ncurses_ext_funcs" = yes && cat >>confdefs.h <<\EOF @@ -13505,16 +18102,16 @@ then if test -n "$cf_cv_ncurses_version" && test "x$cf_cv_ncurses_version" != xno then cf_define_xpg5=no - echo "$as_me:13508: checking if _XPG5 should be defined to enable wide-characters" >&5 + echo "$as_me:18105: checking if _XPG5 should be defined to enable wide-characters" >&5 echo $ECHO_N "checking if _XPG5 should be defined to enable wide-characters... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line 13512 "configure" +#line 18109 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { int x = _XPG5 ; @@ -13522,16 +18119,16 @@ int x = _XPG5 } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13525: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:18122: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13528: \$? = $ac_status" >&5 + echo "$as_me:18125: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13531: \"$ac_try\"") >&5 + { (eval echo "$as_me:18128: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13534: \$? = $ac_status" >&5 + echo "$as_me:18131: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -13540,12 +18137,12 @@ cat conftest.$ac_ext >&5 cf_save_cppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_XPG5" cat >conftest.$ac_ext <<_ACEOF -#line 13543 "configure" +#line 18140 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { int x = _XPG5 ; @@ -13553,16 +18150,16 @@ int x = _XPG5 } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13556: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:18153: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13559: \$? = $ac_status" >&5 + echo "$as_me:18156: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13562: \"$ac_try\"") >&5 + { (eval echo "$as_me:18159: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13565: \$? = $ac_status" >&5 + echo "$as_me:18162: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_define_xpg5=yes else @@ -13573,7 +18170,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext CPPFLAGS="$cf_save_cppflags" fi rm -f conftest.$ac_objext conftest.$ac_ext - echo "$as_me:13576: result: $cf_define_xpg5" >&5 + echo "$as_me:18173: result: $cf_define_xpg5" >&5 echo "${ECHO_T}$cf_define_xpg5" >&6 if test "$cf_define_xpg5" = yes @@ -13582,127 +18179,341 @@ echo "${ECHO_T}$cf_define_xpg5" >&6 fi fi - echo "$as_me:13585: checking for wide-character functions" >&5 + echo "$as_me:18182: checking for wide-character functions" >&5 echo $ECHO_N "checking for wide-character functions... $ECHO_C" >&6 if test "${cf_cv_widechar_funcs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 13592 "configure" +#line 18189 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header:-curses.h}> +int +main (void) +{ + + static wchar_t src_wchar[2]; + static cchar_t dst_cchar; + setcchar(&dst_cchar, src_wchar, A_NORMAL, 0, (void *) 0); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:18206: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:18209: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:18212: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:18215: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_widechar_funcs=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_widechar_funcs=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:18226: result: $cf_cv_widechar_funcs" >&5 +echo "${ECHO_T}$cf_cv_widechar_funcs" >&6 + if test "$cf_cv_widechar_funcs" != no ; then + +cat >>confdefs.h <<\EOF +#define USE_WIDEC_SUPPORT 1 +EOF + + else + cat >>confdefs.h <<\EOF +#define USE_WIDEC_SUPPORT 0 +EOF + + fi +else + cat >>confdefs.h <<\EOF +#define USE_WIDEC_SUPPORT 0 +EOF + +fi + +echo "$as_me:18247: checking if $cf_cv_screen library uses pthreads" >&5 +echo $ECHO_N "checking if $cf_cv_screen library uses pthreads... $ECHO_C" >&6 +if test "${cf_cv_use_pthreads+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 18254 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header:-curses.h}> +extern void _nc_init_pthreads(void); + +int +main (void) +{ + + initscr(); + _nc_init_pthreads(); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:18272: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:18275: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:18278: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:18281: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_use_pthreads=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_use_pthreads=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:18292: result: $cf_cv_use_pthreads" >&5 +echo "${ECHO_T}$cf_cv_use_pthreads" >&6 +test $cf_cv_use_pthreads = yes && +cat >>confdefs.h <<\EOF +#define USE_PTHREADS 1 +EOF + +echo "$as_me:18299: checking if sys/time.h works with sys/select.h" >&5 +echo $ECHO_N "checking if sys/time.h works with sys/select.h... $ECHO_C" >&6 +if test "${cf_cv_sys_time_select+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 18306 "configure" +#include "confdefs.h" + +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:18326: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:18329: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:18332: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:18335: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_sys_time_select=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_sys_time_select=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi + +echo "$as_me:18347: result: $cf_cv_sys_time_select" >&5 +echo "${ECHO_T}$cf_cv_sys_time_select" >&6 +test "$cf_cv_sys_time_select" = yes && +cat >>confdefs.h <<\EOF +#define HAVE_SYS_TIME_SELECT 1 +EOF + +# special check for test/ditto.c + +echo "$as_me:18356: checking for openpty in -lutil" >&5 +echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6 +if test "${ac_cv_lib_util_openpty+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lutil $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 18364 "configure" #include "confdefs.h" -#include <${cf_cv_ncurses_header:-curses.h}> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char openpty (); int -main () +main (void) { - - static wchar_t src_wchar[2]; - static cchar_t dst_cchar; - setcchar(&dst_cchar, src_wchar, A_NORMAL, 0, (void *) 0); - +openpty (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13609: \"$ac_link\"") >&5 +if { (eval echo "$as_me:18383: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13612: \$? = $ac_status" >&5 + echo "$as_me:18386: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13615: \"$ac_try\"") >&5 + { (eval echo "$as_me:18389: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13618: \$? = $ac_status" >&5 + echo "$as_me:18392: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_widechar_funcs=yes + ac_cv_lib_util_openpty=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_widechar_funcs=no +ac_cv_lib_util_openpty=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - +LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:13629: result: $cf_cv_widechar_funcs" >&5 -echo "${ECHO_T}$cf_cv_widechar_funcs" >&6 - if test "$cf_cv_widechar_funcs" != no ; then - -cat >>confdefs.h <<\EOF -#define USE_WIDEC_SUPPORT 1 -EOF - - else - cat >>confdefs.h <<\EOF -#define USE_WIDEC_SUPPORT 0 -EOF - - fi +echo "$as_me:18403: result: $ac_cv_lib_util_openpty" >&5 +echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6 +if test $ac_cv_lib_util_openpty = yes; then + cf_cv_lib_util=yes else - cat >>confdefs.h <<\EOF -#define USE_WIDEC_SUPPORT 0 -EOF - + cf_cv_lib_util=no fi -echo "$as_me:13650: checking if sys/time.h works with sys/select.h" >&5 -echo $ECHO_N "checking if sys/time.h works with sys/select.h... $ECHO_C" >&6 -if test "${cf_cv_sys_time_select+set}" = set; then +echo "$as_me:18411: checking for openpty header" >&5 +echo $ECHO_N "checking for openpty header... $ECHO_C" >&6 +if test "${cf_cv_func_openpty+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else -cat >conftest.$ac_ext <<_ACEOF -#line 13657 "configure" + cf_save_LIBS="$LIBS" + test $cf_cv_lib_util = yes && { +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lutil; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + } + for cf_header in pty.h libutil.h util.h + do + cat >conftest.$ac_ext <<_ACEOF +#line 18438 "configure" #include "confdefs.h" -#include -#ifdef HAVE_SYS_TIME_H -#include -#endif -#ifdef HAVE_SYS_SELECT_H -#include -#endif +#include <$cf_header> int -main () +main (void) { + int x = openpty((int *)0, (int *)0, (char *)0, + (struct termios *)0, (struct winsize *)0); + ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:13677: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:18455: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13680: \$? = $ac_status" >&5 + echo "$as_me:18458: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13683: \"$ac_try\"") >&5 + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:18461: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13686: \$? = $ac_status" >&5 + echo "$as_me:18464: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_sys_time_select=yes + + cf_cv_func_openpty=$cf_header + break + else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_sys_time_select=no + + cf_cv_func_openpty=no + fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done + LIBS="$cf_save_LIBS" fi +echo "$as_me:18482: result: $cf_cv_func_openpty" >&5 +echo "${ECHO_T}$cf_cv_func_openpty" >&6 + +if test "$cf_cv_func_openpty" != no ; then + +cat >>confdefs.h < +EOF -echo "$as_me:13698: result: $cf_cv_sys_time_select" >&5 -echo "${ECHO_T}$cf_cv_sys_time_select" >&6 -test "$cf_cv_sys_time_select" = yes && cat >>confdefs.h <<\EOF -#define HAVE_SYS_TIME_SELECT 1 +#define USE_XTERM_PTY 1 EOF -echo "$as_me:13705: checking for function curses_version" >&5 + if test "x$cf_cv_lib_util" = xyes ; then + +cf_add_libs="$TEST_LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lutil; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +TEST_LIBS="$cf_add_libs" + + fi +fi + +echo "$as_me:18516: checking for function curses_version" >&5 echo $ECHO_N "checking for function curses_version... $ECHO_C" >&6 if test "${cf_cv_func_curses_version+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -13712,11 +18523,11 @@ if test "$cross_compiling" = yes; then cf_cv_func_curses_version=unknown else cat >conftest.$ac_ext <<_ACEOF -#line 13715 "configure" +#line 18526 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> -int main() +int main(void) { char temp[1024]; sprintf(temp, "%s\n", curses_version()); @@ -13725,15 +18536,15 @@ int main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:13728: \"$ac_link\"") >&5 +if { (eval echo "$as_me:18539: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13731: \$? = $ac_status" >&5 + echo "$as_me:18542: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:13733: \"$ac_try\"") >&5 + { (eval echo "$as_me:18544: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13736: \$? = $ac_status" >&5 + echo "$as_me:18547: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_func_curses_version=yes @@ -13748,14 +18559,14 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f core fi -echo "$as_me:13751: result: $cf_cv_func_curses_version" >&5 +echo "$as_me:18562: result: $cf_cv_func_curses_version" >&5 echo "${ECHO_T}$cf_cv_func_curses_version" >&6 test "$cf_cv_func_curses_version" = yes && cat >>confdefs.h <<\EOF #define HAVE_CURSES_VERSION 1 EOF -echo "$as_me:13758: checking for alternate character set array" >&5 +echo "$as_me:18569: checking for alternate character set array" >&5 echo $ECHO_N "checking for alternate character set array... $ECHO_C" >&6 if test "${cf_cv_curses_acs_map+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -13765,13 +18576,13 @@ cf_cv_curses_acs_map=unknown for name in acs_map _acs_map __acs_map ${NCURSES_WRAP_PREFIX}acs_map do cat >conftest.$ac_ext <<_ACEOF -#line 13768 "configure" +#line 18579 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { $name['k'] = ACS_PLUS @@ -13781,16 +18592,16 @@ $name['k'] = ACS_PLUS } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13784: \"$ac_link\"") >&5 +if { (eval echo "$as_me:18595: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13787: \$? = $ac_status" >&5 + echo "$as_me:18598: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13790: \"$ac_try\"") >&5 + { (eval echo "$as_me:18601: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13793: \$? = $ac_status" >&5 + echo "$as_me:18604: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_curses_acs_map=$name; break else @@ -13801,7 +18612,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext done fi -echo "$as_me:13804: result: $cf_cv_curses_acs_map" >&5 +echo "$as_me:18615: result: $cf_cv_curses_acs_map" >&5 echo "${ECHO_T}$cf_cv_curses_acs_map" >&6 test "$cf_cv_curses_acs_map" != unknown && @@ -13811,7 +18622,7 @@ EOF if test "$cf_enable_widec" = yes; then -echo "$as_me:13814: checking for wide alternate character set array" >&5 +echo "$as_me:18625: checking for wide alternate character set array" >&5 echo $ECHO_N "checking for wide alternate character set array... $ECHO_C" >&6 if test "${cf_cv_curses_wacs_map+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -13821,7 +18632,7 @@ else for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char do cat >conftest.$ac_ext <<_ACEOF -#line 13824 "configure" +#line 18635 "configure" #include "confdefs.h" #ifndef _XOPEN_SOURCE_EXTENDED @@ -13829,7 +18640,7 @@ else #endif #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { void *foo = &($name['k']) ; @@ -13837,16 +18648,16 @@ void *foo = &($name['k']) } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13840: \"$ac_link\"") >&5 +if { (eval echo "$as_me:18651: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13843: \$? = $ac_status" >&5 + echo "$as_me:18654: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13846: \"$ac_try\"") >&5 + { (eval echo "$as_me:18657: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13849: \$? = $ac_status" >&5 + echo "$as_me:18660: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_curses_wacs_map=$name break @@ -13857,7 +18668,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext done fi -echo "$as_me:13860: result: $cf_cv_curses_wacs_map" >&5 +echo "$as_me:18671: result: $cf_cv_curses_wacs_map" >&5 echo "${ECHO_T}$cf_cv_curses_wacs_map" >&6 test "$cf_cv_curses_wacs_map" != unknown && @@ -13865,7 +18676,7 @@ cat >>confdefs.h <&5 +echo "$as_me:18679: checking for wide alternate character constants" >&5 echo $ECHO_N "checking for wide alternate character constants... $ECHO_C" >&6 if test "${cf_cv_curses_wacs_symbols+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -13875,7 +18686,7 @@ cf_cv_curses_wacs_symbols=no if test "$cf_cv_curses_wacs_map" != unknown then cat >conftest.$ac_ext <<_ACEOF -#line 13878 "configure" +#line 18689 "configure" #include "confdefs.h" #ifndef _XOPEN_SOURCE_EXTENDED @@ -13883,7 +18694,7 @@ then #endif #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { cchar_t *foo = WACS_PLUS; $cf_cv_curses_wacs_map['k'] = *WACS_PLUS @@ -13892,16 +18703,16 @@ cchar_t *foo = WACS_PLUS; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13895: \"$ac_link\"") >&5 +if { (eval echo "$as_me:18706: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13898: \$? = $ac_status" >&5 + echo "$as_me:18709: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13901: \"$ac_try\"") >&5 + { (eval echo "$as_me:18712: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13904: \$? = $ac_status" >&5 + echo "$as_me:18715: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_curses_wacs_symbols=yes else @@ -13911,7 +18722,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF -#line 13914 "configure" +#line 18725 "configure" #include "confdefs.h" #ifndef _XOPEN_SOURCE_EXTENDED @@ -13919,7 +18730,7 @@ else #endif #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { cchar_t *foo = WACS_PLUS ; @@ -13927,16 +18738,16 @@ cchar_t *foo = WACS_PLUS } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13930: \"$ac_link\"") >&5 +if { (eval echo "$as_me:18741: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13933: \$? = $ac_status" >&5 + echo "$as_me:18744: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13936: \"$ac_try\"") >&5 + { (eval echo "$as_me:18747: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13939: \$? = $ac_status" >&5 + echo "$as_me:18750: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_curses_wacs_symbols=yes else @@ -13947,7 +18758,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi fi -echo "$as_me:13950: result: $cf_cv_curses_wacs_symbols" >&5 +echo "$as_me:18761: result: $cf_cv_curses_wacs_symbols" >&5 echo "${ECHO_T}$cf_cv_curses_wacs_symbols" >&6 test "$cf_cv_curses_wacs_symbols" != no && @@ -13957,10 +18768,10 @@ EOF fi -echo "$as_me:13960: checking for type attr_t in ${cf_cv_ncurses_header:-curses.h}" >&5 +echo "$as_me:18771: checking for type attr_t in ${cf_cv_ncurses_header:-curses.h}" >&5 echo $ECHO_N "checking for type attr_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line 13963 "configure" +#line 18774 "configure" #include "confdefs.h" #ifndef _XOPEN_SOURCE_EXTENDED @@ -13968,7 +18779,7 @@ cat >conftest.$ac_ext <<_ACEOF #endif #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { attr_t foo @@ -13978,16 +18789,16 @@ attr_t foo } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13981: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:18792: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13984: \$? = $ac_status" >&5 + echo "$as_me:18795: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13987: \"$ac_try\"") >&5 + { (eval echo "$as_me:18798: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13990: \$? = $ac_status" >&5 + echo "$as_me:18801: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=yes else @@ -13996,7 +18807,7 @@ cat conftest.$ac_ext >&5 cf_result=no fi rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:13999: result: $cf_result" >&5 +echo "$as_me:18810: result: $cf_result" >&5 echo "${ECHO_T}$cf_result" >&6 if test $cf_result = yes ; then @@ -14017,14 +18828,14 @@ fi if test "$cf_enable_widec" = yes; then # This is needed on Tru64 5.0 to declare mbstate_t -echo "$as_me:14020: checking if we must include wchar.h to declare mbstate_t" >&5 +echo "$as_me:18831: checking if we must include wchar.h to declare mbstate_t" >&5 echo $ECHO_N "checking if we must include wchar.h to declare mbstate_t... $ECHO_C" >&6 if test "${cf_cv_mbstate_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 14027 "configure" +#line 18838 "configure" #include "confdefs.h" #include @@ -14034,7 +18845,7 @@ cat >conftest.$ac_ext <<_ACEOF #include #endif int -main () +main (void) { mbstate_t state ; @@ -14042,23 +18853,23 @@ mbstate_t state } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14045: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:18856: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14048: \$? = $ac_status" >&5 + echo "$as_me:18859: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14051: \"$ac_try\"") >&5 + { (eval echo "$as_me:18862: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14054: \$? = $ac_status" >&5 + echo "$as_me:18865: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_mbstate_t=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 14061 "configure" +#line 18872 "configure" #include "confdefs.h" #include @@ -14069,7 +18880,7 @@ cat >conftest.$ac_ext <<_ACEOF #include #endif int -main () +main (void) { mbstate_t value ; @@ -14077,16 +18888,16 @@ mbstate_t value } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14080: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:18891: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14083: \$? = $ac_status" >&5 + echo "$as_me:18894: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14086: \"$ac_try\"") >&5 + { (eval echo "$as_me:18897: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14089: \$? = $ac_status" >&5 + echo "$as_me:18900: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_mbstate_t=yes else @@ -14098,7 +18909,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:14101: result: $cf_cv_mbstate_t" >&5 +echo "$as_me:18912: result: $cf_cv_mbstate_t" >&5 echo "${ECHO_T}$cf_cv_mbstate_t" >&6 if test "$cf_cv_mbstate_t" = yes ; then @@ -14121,14 +18932,14 @@ if test "$cf_cv_mbstate_t" != unknown ; then fi # This is needed on Tru64 5.0 to declare wchar_t -echo "$as_me:14124: checking if we must include wchar.h to declare wchar_t" >&5 +echo "$as_me:18935: checking if we must include wchar.h to declare wchar_t" >&5 echo $ECHO_N "checking if we must include wchar.h to declare wchar_t... $ECHO_C" >&6 if test "${cf_cv_wchar_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 14131 "configure" +#line 18942 "configure" #include "confdefs.h" #include @@ -14138,7 +18949,7 @@ cat >conftest.$ac_ext <<_ACEOF #include #endif int -main () +main (void) { wchar_t state ; @@ -14146,23 +18957,23 @@ wchar_t state } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14149: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:18960: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14152: \$? = $ac_status" >&5 + echo "$as_me:18963: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14155: \"$ac_try\"") >&5 + { (eval echo "$as_me:18966: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14158: \$? = $ac_status" >&5 + echo "$as_me:18969: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_wchar_t=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 14165 "configure" +#line 18976 "configure" #include "confdefs.h" #include @@ -14173,7 +18984,7 @@ cat >conftest.$ac_ext <<_ACEOF #include #endif int -main () +main (void) { wchar_t value ; @@ -14181,16 +18992,16 @@ wchar_t value } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14184: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:18995: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14187: \$? = $ac_status" >&5 + echo "$as_me:18998: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14190: \"$ac_try\"") >&5 + { (eval echo "$as_me:19001: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14193: \$? = $ac_status" >&5 + echo "$as_me:19004: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_wchar_t=yes else @@ -14202,7 +19013,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:14205: result: $cf_cv_wchar_t" >&5 +echo "$as_me:19016: result: $cf_cv_wchar_t" >&5 echo "${ECHO_T}$cf_cv_wchar_t" >&6 if test "$cf_cv_wchar_t" = yes ; then @@ -14225,14 +19036,14 @@ if test "$cf_cv_wchar_t" != unknown ; then fi # This is needed on Tru64 5.0 to declare wint_t -echo "$as_me:14228: checking if we must include wchar.h to declare wint_t" >&5 +echo "$as_me:19039: checking if we must include wchar.h to declare wint_t" >&5 echo $ECHO_N "checking if we must include wchar.h to declare wint_t... $ECHO_C" >&6 if test "${cf_cv_wint_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 14235 "configure" +#line 19046 "configure" #include "confdefs.h" #include @@ -14242,7 +19053,7 @@ cat >conftest.$ac_ext <<_ACEOF #include #endif int -main () +main (void) { wint_t state ; @@ -14250,23 +19061,23 @@ wint_t state } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14253: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:19064: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14256: \$? = $ac_status" >&5 + echo "$as_me:19067: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14259: \"$ac_try\"") >&5 + { (eval echo "$as_me:19070: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14262: \$? = $ac_status" >&5 + echo "$as_me:19073: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_wint_t=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 14269 "configure" +#line 19080 "configure" #include "confdefs.h" #include @@ -14277,7 +19088,7 @@ cat >conftest.$ac_ext <<_ACEOF #include #endif int -main () +main (void) { wint_t value ; @@ -14285,16 +19096,16 @@ wint_t value } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14288: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:19099: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14291: \$? = $ac_status" >&5 + echo "$as_me:19102: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14294: \"$ac_try\"") >&5 + { (eval echo "$as_me:19105: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14297: \$? = $ac_status" >&5 + echo "$as_me:19108: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_wint_t=yes else @@ -14306,7 +19117,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:14309: result: $cf_cv_wint_t" >&5 +echo "$as_me:19120: result: $cf_cv_wint_t" >&5 echo "${ECHO_T}$cf_cv_wint_t" >&6 if test "$cf_cv_wint_t" = yes ; then @@ -14330,10 +19141,10 @@ fi if test "$NCURSES_OK_MBSTATE_T" = 0 ; then -echo "$as_me:14333: checking for type mbstate_t in ${cf_cv_ncurses_header:-curses.h}" >&5 +echo "$as_me:19144: checking for type mbstate_t in ${cf_cv_ncurses_header:-curses.h}" >&5 echo $ECHO_N "checking for type mbstate_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line 14336 "configure" +#line 19147 "configure" #include "confdefs.h" #ifndef _XOPEN_SOURCE_EXTENDED @@ -14341,7 +19152,7 @@ cat >conftest.$ac_ext <<_ACEOF #endif #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { mbstate_t foo @@ -14351,16 +19162,16 @@ mbstate_t foo } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14354: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:19165: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14357: \$? = $ac_status" >&5 + echo "$as_me:19168: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14360: \"$ac_try\"") >&5 + { (eval echo "$as_me:19171: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14363: \$? = $ac_status" >&5 + echo "$as_me:19174: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=yes else @@ -14369,7 +19180,7 @@ cat conftest.$ac_ext >&5 cf_result=no fi rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:14372: result: $cf_result" >&5 +echo "$as_me:19183: result: $cf_result" >&5 echo "${ECHO_T}$cf_result" >&6 if test $cf_result = yes ; then @@ -14391,10 +19202,10 @@ fi if test "$NCURSES_OK_WCHAR_T" = 0 ; then -echo "$as_me:14394: checking for type wchar_t in ${cf_cv_ncurses_header:-curses.h}" >&5 +echo "$as_me:19205: checking for type wchar_t in ${cf_cv_ncurses_header:-curses.h}" >&5 echo $ECHO_N "checking for type wchar_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line 14397 "configure" +#line 19208 "configure" #include "confdefs.h" #ifndef _XOPEN_SOURCE_EXTENDED @@ -14402,7 +19213,7 @@ cat >conftest.$ac_ext <<_ACEOF #endif #include <${cf_cv_ncurses_header:-curses.h}> int -main () +main (void) { wchar_t foo @@ -14411,218 +19222,17 @@ wchar_t foo return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:14415: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:14418: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14421: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:14424: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_result=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_result=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:14433: result: $cf_result" >&5 -echo "${ECHO_T}$cf_result" >&6 -if test $cf_result = yes ; then - -cf_result=`echo "have_type_wchar_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - -cat >>confdefs.h <>confdefs.h <&5 -echo $ECHO_N "checking for type wint_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line 14458 "configure" -#include "confdefs.h" - -#ifndef _XOPEN_SOURCE_EXTENDED -#define _XOPEN_SOURCE_EXTENDED -#endif -#include <${cf_cv_ncurses_header:-curses.h}> -int -main () -{ - -wint_t foo - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:14476: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:14479: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14482: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:14485: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_result=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_result=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:14494: result: $cf_result" >&5 -echo "${ECHO_T}$cf_result" >&6 -if test $cf_result = yes ; then - -cf_result=`echo "have_type_wint_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - -cat >>confdefs.h <>confdefs.h <&5 -echo $ECHO_N "checking for data boolnames declaration in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 - -cat >conftest.$ac_ext <<_ACEOF -#line 14519 "configure" -#include "confdefs.h" - -#ifdef HAVE_XCURSES -#include -char * XCursesProgramName = "test"; -#else -#include <${cf_cv_ncurses_header:-curses.h}> -#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) -#include -#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) -#include -#elif defined(HAVE_TERM_H) -#include -#endif -#endif - -int -main () -{ - -void *foo = &(boolnames) - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:14547: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:14550: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14553: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:14556: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_result=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_result=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:14565: result: $cf_result" >&5 -echo "${ECHO_T}$cf_result" >&6 - -if test $cf_result = yes ; then - -cf_result=`echo "have_curses_data_boolnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - - cat >>confdefs.h <&5 -echo $ECHO_N "checking for data boolnames in library... $ECHO_C" >&6 - # BSD linkers insist on making weak linkage, but resolve at runtime. - if test "$cross_compiling" = yes; then - - # cross-compiling - cat >conftest.$ac_ext <<_ACEOF -#line 14584 "configure" -#include "confdefs.h" - -#ifdef HAVE_XCURSES -#include -char * XCursesProgramName = "test"; -#else -#include <${cf_cv_ncurses_header:-curses.h}> -#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) -#include -#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) -#include -#elif defined(HAVE_TERM_H) -#include -#endif -#endif - -extern char boolnames; -int -main () -{ - - do { - void *foo = &(boolnames); - ${cf_cv_main_return:-return}(foo == 0); - } while (0) - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:14616: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:19226: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14619: \$? = $ac_status" >&5 + echo "$as_me:19229: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:14622: \"$ac_try\"") >&5 + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:19232: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14625: \$? = $ac_status" >&5 + echo "$as_me:19235: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=yes else @@ -14630,72 +19240,102 @@ else cat conftest.$ac_ext >&5 cf_result=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:19244: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 +if test $cf_result = yes ; then + +cf_result=`echo "have_type_wchar_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cat >>confdefs.h <conftest.$ac_ext <<_ACEOF -#line 14637 "configure" + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for type wint_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line 19269 "configure" #include "confdefs.h" -#ifdef HAVE_XCURSES -#include -char * XCursesProgramName = "test"; -#else -#include <${cf_cv_ncurses_header:-curses.h}> -#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) -#include -#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) -#include -#elif defined(HAVE_TERM_H) -#include -#endif +#ifndef _XOPEN_SOURCE_EXTENDED +#define _XOPEN_SOURCE_EXTENDED #endif - -extern char boolnames; -int main(void) +#include <${cf_cv_ncurses_header:-curses.h}> +int +main (void) { - void *foo = &(boolnames); - ${cf_cv_main_return:-return}(foo == 0); + +wint_t foo + + ; + return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:14662: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:19287: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14665: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:14667: \"$ac_try\"") >&5 + echo "$as_me:19290: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:19293: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14670: \$? = $ac_status" >&5 + echo "$as_me:19296: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_result=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - echo "$as_me:14681: result: $cf_result" >&5 +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:19305: result: $cf_result" >&5 echo "${ECHO_T}$cf_result" >&6 - if test $cf_result = yes ; then +if test $cf_result = yes ; then -cf_result=`echo "decl_curses_data_boolnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` +cf_result=`echo "have_type_wint_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - cat >>confdefs.h <>confdefs.h <>confdefs.h <&5 -echo $ECHO_N "checking for data boolfnames declaration in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 +for cf_data in \ +TABSIZE \ +curscr \ +ospeed \ +boolnames \ +boolfnames \ +ttytype +do +echo "$as_me:19334: checking for data $cf_data declaration in ${cf_cv_ncurses_header:-curses.h}" >&5 +echo $ECHO_N "checking for data $cf_data declaration in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line 14698 "configure" +#line 19338 "configure" #include "confdefs.h" #ifdef HAVE_XCURSES @@ -14713,54 +19353,55 @@ char * XCursesProgramName = "test"; #endif int -main () +main (void) { -void *foo = &(boolfnames) +void *foo = &($cf_data) ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14726: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:19366: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14729: \$? = $ac_status" >&5 + echo "$as_me:19369: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14732: \"$ac_try\"") >&5 + { (eval echo "$as_me:19372: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14735: \$? = $ac_status" >&5 + echo "$as_me:19375: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=yes + else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_result=no fi rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:14744: result: $cf_result" >&5 +echo "$as_me:19385: result: $cf_result" >&5 echo "${ECHO_T}$cf_result" >&6 if test $cf_result = yes ; then -cf_result=`echo "have_curses_data_boolfnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` +cf_result=`echo "have_curses_data_$cf_data" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` cat >>confdefs.h <&5 -echo $ECHO_N "checking for data boolfnames in library... $ECHO_C" >&6 + echo "$as_me:19397: checking for data $cf_data in library" >&5 +echo $ECHO_N "checking for data $cf_data in library... $ECHO_C" >&6 # BSD linkers insist on making weak linkage, but resolve at runtime. if test "$cross_compiling" = yes; then # cross-compiling cat >conftest.$ac_ext <<_ACEOF -#line 14763 "configure" +#line 19404 "configure" #include "confdefs.h" #ifdef HAVE_XCURSES @@ -14777,13 +19418,14 @@ char * XCursesProgramName = "test"; #endif #endif -extern char boolfnames; +extern char $cf_data; int -main () +main (void) { do { - void *foo = &(boolfnames); + void *foo = &($cf_data); + fprintf(stderr, "testing linkage of $cf_data:%p\n", (void *)foo); ${cf_cv_main_return:-return}(foo == 0); } while (0) @@ -14792,16 +19434,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:14795: \"$ac_link\"") >&5 +if { (eval echo "$as_me:19437: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14798: \$? = $ac_status" >&5 + echo "$as_me:19440: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:14801: \"$ac_try\"") >&5 + { (eval echo "$as_me:19443: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14804: \$? = $ac_status" >&5 + echo "$as_me:19446: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=yes else @@ -14813,7 +19455,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF -#line 14816 "configure" +#line 19458 "configure" #include "confdefs.h" #ifdef HAVE_XCURSES @@ -14830,25 +19472,27 @@ char * XCursesProgramName = "test"; #endif #endif -extern char boolfnames; +extern char $cf_data; int main(void) { - void *foo = &(boolfnames); + void *foo = &($cf_data); + fprintf(stderr, "testing linkage of $cf_data:%p\n", (void *)foo); ${cf_cv_main_return:-return}(foo == 0); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:14841: \"$ac_link\"") >&5 +if { (eval echo "$as_me:19484: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14844: \$? = $ac_status" >&5 + echo "$as_me:19487: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:14846: \"$ac_try\"") >&5 + { (eval echo "$as_me:19489: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14849: \$? = $ac_status" >&5 + echo "$as_me:19492: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=yes + else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 @@ -14857,39 +19501,41 @@ cf_result=no fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:14860: result: $cf_result" >&5 + echo "$as_me:19504: result: $cf_result" >&5 echo "${ECHO_T}$cf_result" >&6 if test $cf_result = yes ; then -cf_result=`echo "decl_curses_data_boolfnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` +cf_result=`echo "decl_curses_data_$cf_data" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` cat >>confdefs.h <&5 +echo "$as_me:19521: checking if you want to turn on gcc warnings" >&5 echo $ECHO_N "checking if you want to turn on gcc warnings... $ECHO_C" >&6 # Check whether --enable-warnings or --disable-warnings was given. if test "${enable_warnings+set}" = set; then enableval="$enable_warnings" test "$enableval" != yes && enableval=no - if test "$enableval" != "no" ; then + if test "$enableval" != "no" ; then with_warnings=yes - else - with_warnings=no - fi + else + with_warnings=no + fi else enableval=no - with_warnings=no + with_warnings=no fi; -echo "$as_me:14892: result: $with_warnings" >&5 +echo "$as_me:19538: result: $with_warnings" >&5 echo "${ECHO_T}$with_warnings" >&6 if test "$with_warnings" = "yes" then @@ -14912,10 +19558,10 @@ cat > conftest.i <&5 + { echo "$as_me:19561: checking for $CC __attribute__ directives..." >&5 echo "$as_me: checking for $CC __attribute__ directives..." >&6;} cat > conftest.$ac_ext <&5 - case $cf_attribute in #(vi - printf) #(vi + case $cf_attribute in + (printf) cf_printf_attribute=yes cat >conftest.h <conftest.h <conftest.h <&5 + if { (eval echo "$as_me:19613: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14970: \$? = $ac_status" >&5 + echo "$as_me:19616: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:14972: result: ... $cf_attribute" >&5 + test -n "$verbose" && echo "$as_me:19618: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h - case $cf_attribute in #(vi - noreturn) #(vi + case $cf_attribute in + (noreturn) cat >>confdefs.h <>confdefs.h <>confdefs.h <>confdefs.h <&5 -echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 - cf_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -no-gcc" - cat >conftest.$ac_ext <<_ACEOF -#line 15041 "configure" +cf_save_LIBS_CF_CONST_X_STRING="$LIBS" +cf_save_CFLAGS_CF_CONST_X_STRING="$CFLAGS" +cf_save_CPPFLAGS_CF_CONST_X_STRING="$CPPFLAGS" +LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" +for cf_X_CFLAGS in $X_CFLAGS +do + case "x$cf_X_CFLAGS" in + x-[IUD]*) + CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS" + ;; + *) + CFLAGS="$CFLAGS $cf_X_CFLAGS" + ;; + esac +done + +cat >conftest.$ac_ext <<_ACEOF +#line 19696 "configure" #include "confdefs.h" +#include +#include + int -main () +main (void) { - -#ifdef __INTEL_COMPILER -#else -make an error -#endif - +String foo = malloc(1) ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:15058: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:19711: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:15061: \$? = $ac_status" >&5 + echo "$as_me:19714: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:15064: \"$ac_try\"") >&5 + { (eval echo "$as_me:19717: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:15067: \$? = $ac_status" >&5 + echo "$as_me:19720: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - INTEL_COMPILER=yes -cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" +echo "$as_me:19723: checking for X11/Xt const-feature" >&5 +echo $ECHO_N "checking for X11/Xt const-feature... $ECHO_C" >&6 +if test "${cf_cv_const_x_string+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest.$ac_ext - CFLAGS="$cf_save_CFLAGS" - echo "$as_me:15078: result: $INTEL_COMPILER" >&5 -echo "${ECHO_T}$INTEL_COMPILER" >&6 - ;; - esac -fi - -CLANG_COMPILER=no -if test "$GCC" = yes ; then - echo "$as_me:15087: checking if this is really Clang C compiler" >&5 -echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6 - cf_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Qunused-arguments" cat >conftest.$ac_ext <<_ACEOF -#line 15092 "configure" +#line 19730 "configure" #include "confdefs.h" +#define _CONST_X_STRING /* X11R7.8 (perhaps) */ +#undef XTSTRINGDEFINES /* X11R5 and later */ +#include +#include + int -main () +main (void) { - -#ifdef __clang__ -#else -make an error -#endif - +String foo = malloc(1); *foo = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:15109: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:19747: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:15112: \$? = $ac_status" >&5 + echo "$as_me:19750: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:15115: \"$ac_try\"") >&5 + { (eval echo "$as_me:19753: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:15118: \$? = $ac_status" >&5 + echo "$as_me:19756: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - CLANG_COMPILER=yes -cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" + + cf_cv_const_x_string=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 + + cf_cv_const_x_string=yes + fi rm -f conftest.$ac_objext conftest.$ac_ext - CFLAGS="$cf_save_CFLAGS" - echo "$as_me:15129: result: $CLANG_COMPILER" >&5 -echo "${ECHO_T}$CLANG_COMPILER" >&6 + fi +echo "$as_me:19771: result: $cf_cv_const_x_string" >&5 +echo "${ECHO_T}$cf_cv_const_x_string" >&6 + +LIBS="$cf_save_LIBS_CF_CONST_X_STRING" +CFLAGS="$cf_save_CFLAGS_CF_CONST_X_STRING" +CPPFLAGS="$cf_save_CPPFLAGS_CF_CONST_X_STRING" + +case $cf_cv_const_x_string in +(no) + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-DXTSTRINGDEFINES" + + ;; +(*) + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D_CONST_X_STRING" + ;; +esac + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi cat > conftest.$ac_ext <&5 + { echo "$as_me:19816: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-Wall" @@ -15164,21 +19829,20 @@ echo "$as_me: checking for $CC warning options..." >&6;} wd981 do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo "$as_me:15167: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:19832: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:15170: \$? = $ac_status" >&5 + echo "$as_me:19835: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:15172: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:19837: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi done CFLAGS="$cf_save_CFLAGS" - -elif test "$GCC" = yes +elif test "$GCC" = yes && test "$GCC_VERSION" != "unknown" then - { echo "$as_me:15181: checking for $CC warning options..." >&5 + { echo "$as_me:19845: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS= @@ -15199,36 +19863,33 @@ echo "$as_me: checking for $CC warning options..." >&6;} Wpointer-arith \ Wshadow \ Wstrict-prototypes \ - Wundef $cf_gcc_warnings $cf_warn_CONST + Wundef Wno-inline $cf_gcc_warnings $cf_warn_CONST Wno-unknown-pragmas do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo "$as_me:15205: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:19869: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:15208: \$? = $ac_status" >&5 + echo "$as_me:19872: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:15210: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:19874: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 - case $cf_opt in #(vi - Wcast-qual) #(vi - CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" - ;; - Winline) #(vi + case $cf_opt in + (Winline) case $GCC_VERSION in - [34].*) + ([34].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -echo "${as_me:-configure}:15221: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:19882: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac ;; - Wpointer-arith) #(vi + (Wpointer-arith) case $GCC_VERSION in - [12].*) + ([12].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -echo "${as_me:-configure}:15231: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:19892: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -15244,7 +19905,7 @@ rm -rf conftest* fi fi -echo "$as_me:15247: checking if you want to use dmalloc for testing" >&5 +echo "$as_me:19908: checking if you want to use dmalloc for testing" >&5 echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6 # Check whether --with-dmalloc or --without-dmalloc was given. @@ -15261,15 +19922,15 @@ EOF else with_dmalloc= fi; -echo "$as_me:15264: result: ${with_dmalloc:-no}" >&5 +echo "$as_me:19925: result: ${with_dmalloc:-no}" >&5 echo "${ECHO_T}${with_dmalloc:-no}" >&6 -case .$with_cflags in #(vi -.*-g*) - case .$CFLAGS in #(vi - .*-g*) #(vi +case .$with_cflags in +(.*-g*) + case .$CFLAGS in + (.*-g*) ;; - *) + (*) cf_fix_cppflags=no cf_new_cflags= @@ -15279,32 +19940,38 @@ cf_new_extra_cppflags= for cf_add_cflags in -g do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -15313,21 +19980,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -15336,17 +20011,23 @@ done if test -n "$cf_new_cflags" ; then - CFLAGS="$CFLAGS $cf_new_cflags" + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi if test -n "$cf_new_cppflags" ; then - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + fi if test -n "$cf_new_extra_cppflags" ; then - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + fi ;; @@ -15355,23 +20036,23 @@ fi esac if test "$with_dmalloc" = yes ; then - echo "$as_me:15358: checking for dmalloc.h" >&5 + echo "$as_me:20039: checking for dmalloc.h" >&5 echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6 if test "${ac_cv_header_dmalloc_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 15364 "configure" +#line 20045 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:15368: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:20049: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:15374: \$? = $ac_status" >&5 + echo "$as_me:20055: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -15390,11 +20071,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:15393: result: $ac_cv_header_dmalloc_h" >&5 +echo "$as_me:20074: result: $ac_cv_header_dmalloc_h" >&5 echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6 if test $ac_cv_header_dmalloc_h = yes; then -echo "$as_me:15397: checking for dmalloc_debug in -ldmalloc" >&5 +echo "$as_me:20078: checking for dmalloc_debug in -ldmalloc" >&5 echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -15402,7 +20083,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 15405 "configure" +#line 20086 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -15413,7 +20094,7 @@ extern "C" builtin and then its argument prototype would still apply. */ char dmalloc_debug (); int -main () +main (void) { dmalloc_debug (); ; @@ -15421,16 +20102,16 @@ dmalloc_debug (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:15424: \"$ac_link\"") >&5 +if { (eval echo "$as_me:20105: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:15427: \$? = $ac_status" >&5 + echo "$as_me:20108: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:15430: \"$ac_try\"") >&5 + { (eval echo "$as_me:20111: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:15433: \$? = $ac_status" >&5 + echo "$as_me:20114: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dmalloc_dmalloc_debug=yes else @@ -15441,7 +20122,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:15444: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 +echo "$as_me:20125: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then cat >>confdefs.h <&5 +echo "$as_me:20140: checking if you want to use dbmalloc for testing" >&5 echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6 # Check whether --with-dbmalloc or --without-dbmalloc was given. @@ -15473,15 +20154,15 @@ EOF else with_dbmalloc= fi; -echo "$as_me:15476: result: ${with_dbmalloc:-no}" >&5 +echo "$as_me:20157: result: ${with_dbmalloc:-no}" >&5 echo "${ECHO_T}${with_dbmalloc:-no}" >&6 -case .$with_cflags in #(vi -.*-g*) - case .$CFLAGS in #(vi - .*-g*) #(vi +case .$with_cflags in +(.*-g*) + case .$CFLAGS in + (.*-g*) ;; - *) + (*) cf_fix_cppflags=no cf_new_cflags= @@ -15491,32 +20172,38 @@ cf_new_extra_cppflags= for cf_add_cflags in -g do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -15525,21 +20212,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -15548,17 +20243,23 @@ done if test -n "$cf_new_cflags" ; then - CFLAGS="$CFLAGS $cf_new_cflags" + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi if test -n "$cf_new_cppflags" ; then - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + fi if test -n "$cf_new_extra_cppflags" ; then - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + fi ;; @@ -15567,23 +20268,23 @@ fi esac if test "$with_dbmalloc" = yes ; then - echo "$as_me:15570: checking for dbmalloc.h" >&5 + echo "$as_me:20271: checking for dbmalloc.h" >&5 echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6 if test "${ac_cv_header_dbmalloc_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 15576 "configure" +#line 20277 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:15580: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:20281: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:15586: \$? = $ac_status" >&5 + echo "$as_me:20287: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -15602,11 +20303,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:15605: result: $ac_cv_header_dbmalloc_h" >&5 +echo "$as_me:20306: result: $ac_cv_header_dbmalloc_h" >&5 echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6 if test $ac_cv_header_dbmalloc_h = yes; then -echo "$as_me:15609: checking for debug_malloc in -ldbmalloc" >&5 +echo "$as_me:20310: checking for debug_malloc in -ldbmalloc" >&5 echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -15614,7 +20315,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldbmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 15617 "configure" +#line 20318 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -15625,7 +20326,7 @@ extern "C" builtin and then its argument prototype would still apply. */ char debug_malloc (); int -main () +main (void) { debug_malloc (); ; @@ -15633,16 +20334,16 @@ debug_malloc (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:15636: \"$ac_link\"") >&5 +if { (eval echo "$as_me:20337: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:15639: \$? = $ac_status" >&5 + echo "$as_me:20340: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:15642: \"$ac_try\"") >&5 + { (eval echo "$as_me:20343: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:15645: \$? = $ac_status" >&5 + echo "$as_me:20346: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dbmalloc_debug_malloc=yes else @@ -15653,7 +20354,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:15656: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 +echo "$as_me:20357: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6 if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then cat >>confdefs.h <&5 +echo "$as_me:20372: checking if you want to use valgrind for testing" >&5 echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6 # Check whether --with-valgrind or --without-valgrind was given. @@ -15685,15 +20386,15 @@ EOF else with_valgrind= fi; -echo "$as_me:15688: result: ${with_valgrind:-no}" >&5 +echo "$as_me:20389: result: ${with_valgrind:-no}" >&5 echo "${ECHO_T}${with_valgrind:-no}" >&6 -case .$with_cflags in #(vi -.*-g*) - case .$CFLAGS in #(vi - .*-g*) #(vi +case .$with_cflags in +(.*-g*) + case .$CFLAGS in + (.*-g*) ;; - *) + (*) cf_fix_cppflags=no cf_new_cflags= @@ -15703,32 +20404,38 @@ cf_new_extra_cppflags= for cf_add_cflags in -g do case $cf_fix_cppflags in -no) - case $cf_add_cflags in #(vi - -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case $cf_add_cflags in - -D*) + (-D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue elif test "${cf_tst_cflags}" = "\"'" ; then - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + continue fi ;; esac case "$CPPFLAGS" in - *$cf_add_cflags) #(vi + (*$cf_add_cflags) ;; - *) #(vi - case $cf_add_cflags in #(vi - -D*) + (*) + case $cf_add_cflags in + (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ @@ -15737,21 +20444,29 @@ CPPFLAGS=`echo "$CPPFLAGS" | \ ;; esac - cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + ;; esac ;; - *) - cf_new_cflags="$cf_new_cflags $cf_add_cflags" + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + ;; esac ;; -yes) - cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -15760,17 +20475,23 @@ done if test -n "$cf_new_cflags" ; then - CFLAGS="$CFLAGS $cf_new_cflags" + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + fi if test -n "$cf_new_cppflags" ; then - CPPFLAGS="$CPPFLAGS $cf_new_cppflags" + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + fi if test -n "$cf_new_extra_cppflags" ; then - EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + fi ;; @@ -15778,7 +20499,7 @@ fi ;; esac -echo "$as_me:15781: checking if you want to perform memory-leak testing" >&5 +echo "$as_me:20502: checking if you want to perform memory-leak testing" >&5 echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6 # Check whether --enable-leaks or --disable-leaks was given. @@ -15788,7 +20509,7 @@ if test "${enable_leaks+set}" = set; then else : ${with_no_leaks:=no} fi; -echo "$as_me:15791: result: $with_no_leaks" >&5 +echo "$as_me:20512: result: $with_no_leaks" >&5 echo "${ECHO_T}$with_no_leaks" >&6 if test "$with_no_leaks" = yes ; then @@ -15804,52 +20525,70 @@ EOF fi LD_RPATH_OPT= -echo "$as_me:15807: checking for an rpath option" >&5 +if test "x$cf_cv_enable_rpath" != xno +then + echo "$as_me:20530: checking for an rpath option" >&5 echo $ECHO_N "checking for an rpath option... $ECHO_C" >&6 -case $cf_cv_system_name in #(vi -irix*) #(vi - if test "$GCC" = yes; then + case $cf_cv_system_name in + (irix*) + if test "$GCC" = yes; then + LD_RPATH_OPT="-Wl,-rpath," + else + LD_RPATH_OPT="-rpath " + fi + ;; + (linux*|gnu*|k*bsd*-gnu|freebsd*) LD_RPATH_OPT="-Wl,-rpath," - else + ;; + (openbsd[2-9].*|mirbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; + (dragonfly*) LD_RPATH_OPT="-rpath " - fi - ;; -linux*|gnu*|k*bsd*-gnu) #(vi - LD_RPATH_OPT="-Wl,-rpath," - ;; -openbsd[2-9].*|mirbsd*) #(vi - LD_RPATH_OPT="-Wl,-rpath," - ;; -dragonfly*|freebsd*) #(vi - LD_RPATH_OPT="-rpath " - ;; -netbsd*) #(vi - LD_RPATH_OPT="-Wl,-rpath," - ;; -osf*|mls+*) #(vi - LD_RPATH_OPT="-rpath " - ;; -solaris2*) #(vi - LD_RPATH_OPT="-R" - ;; -*) - ;; -esac -echo "$as_me:15838: result: $LD_RPATH_OPT" >&5 + ;; + (netbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; + (osf*|mls+*) + LD_RPATH_OPT="-rpath " + ;; + (solaris2*) + LD_RPATH_OPT="-R" + ;; + (*) + ;; + esac + echo "$as_me:20561: result: $LD_RPATH_OPT" >&5 echo "${ECHO_T}$LD_RPATH_OPT" >&6 -case "x$LD_RPATH_OPT" in #(vi -x-R*) - echo "$as_me:15843: checking if we need a space after rpath option" >&5 + case "x$LD_RPATH_OPT" in + (x-R*) + echo "$as_me:20566: checking if we need a space after rpath option" >&5 echo $ECHO_N "checking if we need a space after rpath option... $ECHO_C" >&6 - cf_save_LIBS="$LIBS" - LIBS="${LD_RPATH_OPT}$libdir $LIBS" - cat >conftest.$ac_ext <<_ACEOF -#line 15848 "configure" + cf_save_LIBS="$LIBS" + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in ${LD_RPATH_OPT}$libdir; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + cat >conftest.$ac_ext <<_ACEOF +#line 20587 "configure" #include "confdefs.h" int -main () +main (void) { ; @@ -15857,16 +20596,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:15860: \"$ac_link\"") >&5 +if { (eval echo "$as_me:20599: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:15863: \$? = $ac_status" >&5 + echo "$as_me:20602: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:15866: \"$ac_try\"") >&5 + { (eval echo "$as_me:20605: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:15869: \$? = $ac_status" >&5 + echo "$as_me:20608: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_rpath_space=no else @@ -15875,45 +20614,46 @@ cat conftest.$ac_ext >&5 cf_rpath_space=yes fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS="$cf_save_LIBS" - echo "$as_me:15879: result: $cf_rpath_space" >&5 + LIBS="$cf_save_LIBS" + echo "$as_me:20618: result: $cf_rpath_space" >&5 echo "${ECHO_T}$cf_rpath_space" >&6 - test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " - ;; -esac + test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " + ;; + esac +fi -echo "$as_me:15885: checking if rpath-hack should be disabled" >&5 +echo "$as_me:20625: checking if rpath-hack should be disabled" >&5 echo $ECHO_N "checking if rpath-hack should be disabled... $ECHO_C" >&6 # Check whether --enable-rpath-hack or --disable-rpath-hack was given. if test "${enable_rpath_hack+set}" = set; then enableval="$enable_rpath_hack" test "$enableval" != no && enableval=yes - if test "$enableval" != "yes" ; then + if test "$enableval" != "yes" ; then cf_disable_rpath_hack=yes - else - cf_disable_rpath_hack=no - fi + else + cf_disable_rpath_hack=no + fi else enableval=yes - cf_disable_rpath_hack=no + cf_disable_rpath_hack=no fi; -echo "$as_me:15902: result: $cf_disable_rpath_hack" >&5 +echo "$as_me:20642: result: $cf_disable_rpath_hack" >&5 echo "${ECHO_T}$cf_disable_rpath_hack" >&6 if test "$cf_disable_rpath_hack" = no ; then -echo "$as_me:15906: checking for updated LDFLAGS" >&5 +echo "$as_me:20646: checking for updated LDFLAGS" >&5 echo $ECHO_N "checking for updated LDFLAGS... $ECHO_C" >&6 if test -n "$LD_RPATH_OPT" ; then - echo "$as_me:15909: result: maybe" >&5 + echo "$as_me:20649: result: maybe" >&5 echo "${ECHO_T}maybe" >&6 for ac_prog in ldd do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:15916: checking for $ac_word" >&5 +echo "$as_me:20656: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_cf_ldd_prog+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -15928,7 +20668,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_cf_ldd_prog="$ac_prog" -echo "$as_me:15931: found $ac_dir/$ac_word" >&5 +echo "$as_me:20671: found $ac_dir/$ac_word" >&5 break done @@ -15936,10 +20676,10 @@ fi fi cf_ldd_prog=$ac_cv_prog_cf_ldd_prog if test -n "$cf_ldd_prog"; then - echo "$as_me:15939: result: $cf_ldd_prog" >&5 + echo "$as_me:20679: result: $cf_ldd_prog" >&5 echo "${ECHO_T}$cf_ldd_prog" >&6 else - echo "$as_me:15942: result: no" >&5 + echo "$as_me:20682: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -15953,11 +20693,11 @@ test -n "$cf_ldd_prog" || cf_ldd_prog="no" cf_rpath_oops= cat >conftest.$ac_ext <<_ACEOF -#line 15956 "configure" +#line 20696 "configure" #include "confdefs.h" #include int -main () +main (void) { printf("Hello"); ; @@ -15965,16 +20705,16 @@ printf("Hello"); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:15968: \"$ac_link\"") >&5 +if { (eval echo "$as_me:20708: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:15971: \$? = $ac_status" >&5 + echo "$as_me:20711: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:15974: \"$ac_try\"") >&5 + { (eval echo "$as_me:20714: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:15977: \$? = $ac_status" >&5 + echo "$as_me:20717: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq` cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[ ]/%/%' -e 's%/[^/][^/]*$%%' |sort | uniq` @@ -16002,7 +20742,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext then test -n "$verbose" && echo " ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src" 1>&6 -echo "${as_me:-configure}:16005: testing ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src ..." 1>&5 +echo "${as_me:-configure}:20745: testing ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src ..." 1>&5 LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" break @@ -16014,17 +20754,17 @@ echo "${as_me:-configure}:16005: testing ...adding -L$cf_rpath_dir/lib to LDFLAG test -n "$verbose" && echo " ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 -echo "${as_me:-configure}:16017: testing ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 +echo "${as_me:-configure}:20757: testing ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 test -n "$verbose" && echo " ...checking LDFLAGS $LDFLAGS" 1>&6 -echo "${as_me:-configure}:16021: testing ...checking LDFLAGS $LDFLAGS ..." 1>&5 +echo "${as_me:-configure}:20761: testing ...checking LDFLAGS $LDFLAGS ..." 1>&5 cf_rpath_dst= for cf_rpath_src in $LDFLAGS do - case $cf_rpath_src in #(vi - -L*) #(vi + case $cf_rpath_src in + (-L*) # check if this refers to a directory which we will ignore cf_rpath_skip=no @@ -16055,7 +20795,7 @@ do then test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 -echo "${as_me:-configure}:16058: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 +echo "${as_me:-configure}:20798: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" fi @@ -16068,17 +20808,17 @@ LDFLAGS=$cf_rpath_dst test -n "$verbose" && echo " ...checked LDFLAGS $LDFLAGS" 1>&6 -echo "${as_me:-configure}:16071: testing ...checked LDFLAGS $LDFLAGS ..." 1>&5 +echo "${as_me:-configure}:20811: testing ...checked LDFLAGS $LDFLAGS ..." 1>&5 test -n "$verbose" && echo " ...checking LIBS $LIBS" 1>&6 -echo "${as_me:-configure}:16075: testing ...checking LIBS $LIBS ..." 1>&5 +echo "${as_me:-configure}:20815: testing ...checking LIBS $LIBS ..." 1>&5 cf_rpath_dst= for cf_rpath_src in $LIBS do - case $cf_rpath_src in #(vi - -L*) #(vi + case $cf_rpath_src in + (-L*) # check if this refers to a directory which we will ignore cf_rpath_skip=no @@ -16109,7 +20849,7 @@ do then test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 -echo "${as_me:-configure}:16112: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 +echo "${as_me:-configure}:20852: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" fi @@ -16122,14 +20862,14 @@ LIBS=$cf_rpath_dst test -n "$verbose" && echo " ...checked LIBS $LIBS" 1>&6 -echo "${as_me:-configure}:16125: testing ...checked LIBS $LIBS ..." 1>&5 +echo "${as_me:-configure}:20865: testing ...checked LIBS $LIBS ..." 1>&5 test -n "$verbose" && echo " ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 -echo "${as_me:-configure}:16129: testing ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 +echo "${as_me:-configure}:20869: testing ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 else - echo "$as_me:16132: result: no" >&5 + echo "$as_me:20872: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -16219,7 +20959,7 @@ DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:16222: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:20962: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -16351,7 +21091,7 @@ EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:16398: error: ambiguous option: $1 + { { echo "$as_me:21138: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} @@ -16414,7 +21154,7 @@ Try \`$0 --help' for more information." >&2;} ac_need_defaults=false;; # This is an error. - -*) { { echo "$as_me:16417: error: unrecognized option: $1 + -*) { { echo "$as_me:21157: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} @@ -16433,7 +21173,7 @@ cat >&5 << _ACEOF ## Running config.status. ## ## ----------------------- ## -This file was extended by $as_me 2.52.20121002, executed with +This file was extended by $as_me 2.52.20200111, executed with CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS @@ -16464,7 +21204,7 @@ do "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; "ncurses_cfg.h" ) CONFIG_HEADERS="$CONFIG_HEADERS ncurses_cfg.h:ncurses_tst.hin" ;; - *) { { echo "$as_me:16467: error: invalid argument: $ac_config_target" >&5 + *) { { echo "$as_me:21207: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -16528,6 +21268,7 @@ s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t +s,@runstatedir@,$runstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t @@ -16569,6 +21310,8 @@ s,@AWK@,$AWK,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@INSTALL_OPT_S@,$INSTALL_OPT_S,;t t +s,@INSTALL_OPT_O@,$INSTALL_OPT_O,;t t s,@LINT@,$LINT,;t t s,@LINT_OPTS@,$LINT_OPTS,;t t s,@CTAGS@,$CTAGS,;t t @@ -16588,11 +21331,13 @@ s,@LDFLAGS_STATIC@,$LDFLAGS_STATIC,;t t s,@LD_MODEL@,$LD_MODEL,;t t s,@LD_SHARED_OPTS@,$LD_SHARED_OPTS,;t t s,@LIBTOOL@,$LIBTOOL,;t t +s,@LIBTOOL_OPTS@,$LIBTOOL_OPTS,;t t s,@LIB_CLEAN@,$LIB_CLEAN,;t t s,@LIB_COMPILE@,$LIB_COMPILE,;t t s,@LIB_LINK@,$LIB_LINK,;t t s,@LINK_TESTS@,$LINK_TESTS,;t t s,@LOCAL_LDFLAGS@,$LOCAL_LDFLAGS,;t t +s,@PACKAGE@,$PACKAGE,;t t s,@PTHREAD@,$PTHREAD,;t t s,@TEST_ARGS@,$TEST_ARGS,;t t s,@TEST_DEPS@,$TEST_DEPS,;t t @@ -16618,6 +21363,8 @@ s,@X_LIBS@,$X_LIBS,;t t s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t s,@XCURSES_CONFIG@,$XCURSES_CONFIG,;t t s,@ac_ct_XCURSES_CONFIG@,$ac_ct_XCURSES_CONFIG,;t t +s,@RGB_PATH@,$RGB_PATH,;t t +s,@no_x11_rgb@,$no_x11_rgb,;t t s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t s,@cf_ldd_prog@,$cf_ldd_prog,;t t s,@EXTRA_LDFLAGS@,$EXTRA_LDFLAGS,;t t @@ -16649,10 +21396,28 @@ EOF # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + # It is possible to make a multiline substitution using escaped newlines. + # Ensure that we do not split the substitution between script fragments. + ac_BEG=$ac_end + ac_END=`expr $ac_end + $ac_max_sed_lines` + sed "1,${ac_BEG}d; ${ac_END}p; q" $tmp/subs.sed >$tmp/subs.next + if test -s $tmp/subs.next; then + grep '^s,@[^@,][^@,]*@,.*\\$' $tmp/subs.next >$tmp/subs.edit + if test ! -s $tmp/subs.edit; then + grep "^s,@[^@,][^@,]*@,.*,;t t$" $tmp/subs.next >$tmp/subs.edit + if test ! -s $tmp/subs.edit; then + if test $ac_beg -gt 1; then + ac_end=`expr $ac_end - 1` + continue + fi + fi + fi + fi + if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end @@ -16735,7 +21500,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:16738: creating $ac_file" >&5 + { echo "$as_me:21503: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -16753,7 +21518,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:16756: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:21521: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -16766,7 +21531,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:16769: error: cannot find input file: $f" >&5 + { { echo "$as_me:21534: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -16782,7 +21547,7 @@ cat >>$CONFIG_STATUS <<\EOF if test -n "$ac_seen"; then ac_used=`grep '@datarootdir@' $ac_item` if test -z "$ac_used"; then - { echo "$as_me:16785: WARNING: datarootdir was used implicitly but not set: + { echo "$as_me:21550: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&2;} @@ -16791,7 +21556,7 @@ $ac_seen" >&2;} fi ac_seen=`grep '${datarootdir}' $ac_item` if test -n "$ac_seen"; then - { echo "$as_me:16794: WARNING: datarootdir was used explicitly but not set: + { echo "$as_me:21559: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&2;} @@ -16828,7 +21593,7 @@ s,@INSTALL@,$ac_INSTALL,;t t ac_init=`egrep '[ ]*'$ac_name'[ ]*=' $ac_file` if test -z "$ac_init"; then ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'` - { echo "$as_me:16831: WARNING: Variable $ac_name is used but was not set: + { echo "$as_me:21596: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&5 echo "$as_me: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&2;} @@ -16839,7 +21604,7 @@ $ac_seen" >&2;} egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out if test -s $tmp/out; then ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out` - { echo "$as_me:16842: WARNING: Some variables may not be substituted: + { echo "$as_me:21607: WARNING: Some variables may not be substituted: $ac_seen" >&5 echo "$as_me: WARNING: Some variables may not be substituted: $ac_seen" >&2;} @@ -16888,7 +21653,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:16891: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:21656: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -16899,7 +21664,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:16902: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:21667: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -16912,7 +21677,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:16915: error: cannot find input file: $f" >&5 + { { echo "$as_me:21680: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -16970,7 +21735,7 @@ cat >>$CONFIG_STATUS <<\EOF rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then - { echo "$as_me:16973: $ac_file is unchanged" >&5 + { echo "$as_me:21738: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ @@ -17047,7 +21812,7 @@ do \$(srcdir)/test.priv.h \\ ncurses_cfg.h $SHOW_CC - $ECHO_CC\$(CC) -c \$(CFLAGS_DEFAULT) \$(srcdir)/$N.c + $ECHO_CC\$(CC) -c \$(CFLAGS_DEFAULT) -DMODULE_NAME="$N" \$(srcdir)/$N.c TEST_EOF done diff --git a/test/configure.in b/test/configure.in index c9938372e959..fcfc9a289cae 100644 --- a/test/configure.in +++ b/test/configure.in @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * +dnl Copyright (c) 1998-2019,2020 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * dnl copy of this software and associated documentation files (the * @@ -26,9 +26,9 @@ dnl sale, use or other dealings in this Software without prior written * dnl authorization. * dnl*************************************************************************** dnl -dnl Author: Thomas E. Dickey 1996, etc. +dnl Author: Thomas E. Dickey 1996-on dnl -dnl $Id: configure.in,v 1.113 2013/10/19 21:03:17 tom Exp $ +dnl $Id: configure.in,v 1.156 2020/01/12 00:00:16 tom Exp $ dnl This is a simple configuration-script for the ncurses test programs that dnl allows the test-directory to be separately configured against a reference dnl system (i.e., sysvr4 curses) @@ -36,9 +36,12 @@ dnl dnl If you're configuring ncurses, you shouldn't need to use this script. dnl It's only for testing purposes. dnl -dnl See http://invisible-island.net/autoconf/ for additional information. +dnl For additional information, see +dnl https://invisible-island.net/autoconf/ +dnl https://invisible-island.net/autoconf/my-autoconf.html +dnl https://invisible-island.net/ncurses/ncurses-examples.html dnl --------------------------------------------------------------------------- -AC_PREREQ(2.52.20030208) +AC_PREREQ(2.52.20200111) AC_INIT(ncurses.c) AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin) @@ -48,11 +51,15 @@ CF_CHECK_CACHE AC_ARG_PROGRAM +CF_HELP_MESSAGE(General Options:) + AC_PROG_MAKE_SET CF_PROG_CC +AC_C_INLINE AC_PROG_CPP AC_PROG_AWK CF_PROG_INSTALL +CF_INSTALL_OPTS CF_PROG_LINT CF_MAKE_TAGS @@ -73,11 +80,13 @@ LDFLAGS_STATIC="" AC_SUBST(LDFLAGS_STATIC) LD_MODEL="" AC_SUBST(LD_MODEL) LD_SHARED_OPTS="" AC_SUBST(LD_SHARED_OPTS) LIBTOOL="" AC_SUBST(LIBTOOL) +LIBTOOL_OPTS="" AC_SUBST(LIBTOOL_OPTS) LIB_CLEAN="" AC_SUBST(LIB_CLEAN) LIB_COMPILE="" AC_SUBST(LIB_COMPILE) LIB_LINK='${CC}' AC_SUBST(LIB_LINK) LINK_TESTS="" AC_SUBST(LINK_TESTS) LOCAL_LDFLAGS="" AC_SUBST(LOCAL_LDFLAGS) +PACKAGE="ncurses-examples" AC_SUBST(PACKAGE) PTHREAD="-lm" AC_SUBST(PTHREAD) TEST_ARGS="" AC_SUBST(TEST_ARGS) TEST_DEPS="" AC_SUBST(TEST_DEPS) @@ -95,11 +104,17 @@ AC_EXEEXT AC_OBJEXT CF_GCC_ATTRIBUTES -CF_XOPEN_SOURCE +CF_ENABLE_STRING_HACKS +CF_XOPEN_SOURCE(600) CF_SIG_ATOMIC_T +# Work around breakage on OS X +CF_SIGWINCH + +# Checks for CODESET support. +AM_LANGINFO_CODESET + dnl --------------------------------------------------------------------------- -CF_HELP_MESSAGE(General Options:) CF_PKG_CONFIG CF_DISABLE_ECHO @@ -120,44 +135,102 @@ CF_HELP_MESSAGE(Curses Version-dependent Options:) CF_WITH_NCURSES_ETC case $cf_cv_screen in -curses|curses_*) - CF_NETBSD_FORM_H - CF_NETBSD_MENU_H - ;; -ncursesw) - cf_cv_libtype=w +(ncurses*) + cf_cv_libtype=`echo "$cf_cv_screen" | sed -e 's/^ncurses//'` ;; esac +CF_WITH_X11_RGB + dnl If we've not specified a library, assume we're using sysvr4 libraries dnl installed conventionally (e.g., SunOS 5.x - solaris). dnl Autoconf builds up the $LIBS in reverse order -case $cf_cv_screen in #(vi -pdcurses) #(vi +cf_curses_headers= + +case $cf_cv_screen in +(pdcurses) + cf_default_panel=no + cf_default_form=no + cf_default_menu=no + cf_default_tinfo=no ;; -*) - # look for curses-related libraries - : ${cf_panel_lib:=panel} - : ${cf_menu_lib:=menu} - : ${cf_form_lib:=form} - AC_CHECK_LIB($cf_panel_lib$cf_cv_libtype,new_panel) - AC_CHECK_LIB($cf_menu_lib$cf_cv_libtype,menu_driver) - AC_CHECK_LIB($cf_form_lib$cf_cv_libtype,form_driver) - - # look for curses-related headers - AC_CHECK_HEADERS( \ - nc_alloc.h \ - nomacros.h \ - form.h \ - menu.h \ - panel.h \ - term_entry.h \ - ) +(xcurses|bsdcurses) + cf_default_panel=no + cf_default_form=no + cf_default_menu=no + cf_default_tinfo=yes + ;; +(*) + cf_default_panel=yes + cf_default_form=yes + cf_default_menu=yes + cf_default_tinfo=yes + case $cf_cv_screen in + (ncurses*) + cf_curses_headers="nc_alloc.h nomacros.h term_entry.h" + ;; + esac ;; esac +AC_MSG_CHECKING(if you want to check for panel functions) +CF_ARG_DISABLE(panel, + [ --disable-panel disable checks for panel functions], + cf_enable_panel=no, + cf_enable_panel=$cf_default_panel, + yes) +AC_MSG_RESULT($cf_enable_panel) +if test $cf_enable_panel = yes +then + CF_CHECK_CURSES_LIB(panel,$cf_cv_libtype,new_panel,0) + cf_curses_headers="$cf_curses_headers panel.h" +fi + +AC_MSG_CHECKING(if you want to check for menu functions) +CF_ARG_DISABLE(menu, + [ --disable-menu disable checks for menu functions], + cf_enable_menu=no, + cf_enable_menu=$cf_default_menu, + yes) +AC_MSG_RESULT($cf_enable_menu) +if test $cf_enable_menu = yes +then + case $cf_cv_screen in + (ncurses*) + ;; + (curses*) + CF_NETBSD_MENU_H + ;; + esac + CF_CHECK_CURSES_LIB(menu,$cf_cv_libtype,menu_driver,[0,0]) + cf_curses_headers="$cf_curses_headers menu.h" +fi + +AC_MSG_CHECKING(if you want to check for form functions) +CF_ARG_DISABLE(form, + [ --disable-form disable checks for form functions], + cf_enable_form=no, + cf_enable_form=$cf_default_form, + yes) +AC_MSG_RESULT($cf_enable_form) +if test $cf_enable_form = yes +then + case $cf_cv_screen in + (ncurses*) + ;; + (curses*) + CF_NETBSD_FORM_H + ;; + esac + CF_CHECK_CURSES_LIB(form,$cf_cv_libtype,form_driver,[0,0]) + cf_curses_headers="$cf_curses_headers form.h" +fi + +# look for curses-related headers +AC_CHECK_HEADERS( $cf_curses_headers ) + AC_STDC_HEADERS AC_HEADER_TIME AC_CHECK_HEADERS( \ @@ -165,6 +238,7 @@ getopt.h \ locale.h \ math.h \ stdarg.h \ +stdint.h \ sys/ioctl.h \ sys/select.h \ sys/time.h \ @@ -175,9 +249,52 @@ unistd.h \ CF_GETOPT_HEADER AC_CHECK_FUNCS( \ +getopt \ gettimeofday \ +strstr \ +tsearch \ ) +# use a compile-check to work with ncurses*-config and subdirectory includes +AC_CACHE_CHECK(if we can use termcap.h,cf_cv_have_termcap_h,[ + AC_TRY_COMPILE([ +#include +#ifdef NCURSES_VERSION +#undef NCURSES_VERSION +#endif +#include +#ifndef NCURSES_VERSION +#error wrong header +#endif +], + [return 0;], + [cf_cv_have_termcap_h=yes], + [cf_cv_have_termcap_h=no])]) +if test "x$cf_cv_have_termcap_h" = xyes +then + AC_DEFINE(HAVE_TERMCAP_H,1,[Define to 1 if we can use termcap.h]) +else +AC_CACHE_CHECK(if we can use ncurses/termcap.h,cf_cv_have_ncurses_termcap_h,[ + AC_TRY_COMPILE([ +#include +#ifdef NCURSES_VERSION +#undef NCURSES_VERSION +#endif +#include +#ifndef NCURSES_VERSION +#error wrong header +#endif +], + [return 0;], + [cf_cv_have_ncurses_termcap_h=yes], + [cf_cv_have_ncurses_termcap_h=no])]) +test "x$cf_cv_have_ncurses_termcap_h" = xyes && AC_DEFINE(HAVE_NCURSES_TERMCAP_H,1,[Define to 1 if we can use ncurses/termcap.h]) +fi + +if test "x$ac_cv_func_getopt" = xno; then + AC_MSG_ERROR(getopt is required for building programs) +fi + if test "$cf_enable_widec" = yes; then AC_CHECK_FUNCS( \ mblen \ @@ -192,9 +309,14 @@ wcstombs \ fi CF_CURSES_FUNCS( \ +alloc_pair \ assume_default_colors \ chgat \ +color_content \ color_set \ +copywin \ +delscreen \ +dupwin \ filter \ getbegx \ getcurx \ @@ -202,12 +324,19 @@ getmaxx \ getnstr \ getparx \ getwin \ +halfdelay \ +init_extended_color \ +mvderwin \ mvvline \ +mvwin \ mvwvline \ napms \ +newpad \ putwin \ +reset_color_pairs \ resize_term \ resizeterm \ +restartterm \ ripoffline \ scr_dump \ setupterm \ @@ -217,16 +346,23 @@ termattrs \ tgetent \ tigetnum \ tigetstr \ +tputs_sp \ typeahead \ use_default_colors \ +use_env \ +use_extended_names \ use_screen \ use_window \ +vid_puts \ +vidputs \ vsscanf \ vw_printw \ wchgat \ +winsdelln \ winsstr \ wresize \ wsyncdown \ +_tracef \ ) CF_TPUTS_PROTO @@ -279,7 +415,32 @@ else AC_DEFINE(USE_WIDEC_SUPPORT,0) fi +AC_CACHE_CHECK(if $cf_cv_screen library uses pthreads,cf_cv_use_pthreads,[ +AC_TRY_LINK([ +#include <${cf_cv_ncurses_header:-curses.h}> +extern void _nc_init_pthreads(void); +], +[ + initscr(); + _nc_init_pthreads(); + ], + [cf_cv_use_pthreads=yes], + [cf_cv_use_pthreads=no]) +]) +test $cf_cv_use_pthreads = yes && AC_DEFINE(USE_PTHREADS,1,[Define to 1 if $cf_cv_screen library uses pthreads]) + CF_SYS_TIME_SELECT + +# special check for test/ditto.c +CF_FUNC_OPENPTY +if test "$cf_cv_func_openpty" != no ; then + AC_DEFINE_UNQUOTED(USE_OPENPTY_HEADER,<$cf_cv_func_openpty>,[Define to actual header for openpty function]) + AC_DEFINE(USE_XTERM_PTY,1,[Define to 1 if we should assume xterm pseudoterminal interface]) + if test "x$cf_cv_lib_util" = xyes ; then + CF_ADD_LIB(util,TEST_LIBS) + fi +fi + CF_FUNC_CURSES_VERSION CF_CURSES_ACS_MAP @@ -308,12 +469,17 @@ if test "$cf_enable_widec" = yes; then fi fi -CF_CURSES_CHECK_DATA(boolnames) -CF_CURSES_CHECK_DATA(boolfnames) +CF_CURSES_CHECK_DATA(\ +TABSIZE \ +curscr \ +ospeed \ +boolnames \ +boolfnames \ +ttytype) dnl --------------------------------------------------------------------------- CF_HELP_MESSAGE(Testing/development Options:) -CF_ENABLE_WARNINGS +CF_ENABLE_WARNINGS(Wno-unknown-pragmas) CF_DISABLE_LEAKS CF_DISABLE_RPATH_HACK @@ -340,7 +506,7 @@ do \$(srcdir)/test.priv.h \\ ncurses_cfg.h $SHOW_CC - $ECHO_CC\$(CC) -c \$(CFLAGS_DEFAULT) \$(srcdir)/$N.c + $ECHO_CC\$(CC) -c \$(CFLAGS_DEFAULT) -DMODULE_NAME="$N" \$(srcdir)/$N.c TEST_EOF done diff --git a/test/demo_altkeys.c b/test/demo_altkeys.c index f2b07b1c8c90..d85bac48bce2 100644 --- a/test/demo_altkeys.c +++ b/test/demo_altkeys.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2005-2006,2008 Free Software Foundation, Inc. * + * Copyright (c) 2005-2018,2019 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,27 +26,17 @@ * authorization. * ****************************************************************************/ /* - * $Id: demo_altkeys.c,v 1.9 2010/11/14 00:59:26 tom Exp $ + * $Id: demo_altkeys.c,v 1.13 2019/08/17 21:49:40 tom Exp $ * * Demonstrate the define_key() function. * Thomas Dickey - 2005/10/22 */ +#define NEED_TIME_H #include #if defined(NCURSES_VERSION) && NCURSES_EXT_FUNCS -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - #define MY_LOGFILE "demo_altkeys.log" #define MY_KEYS (KEY_MAX + 1) @@ -57,11 +47,12 @@ static void log_last_line(WINDOW *win) { FILE *fp; - int y, x, n; - char temp[256]; if ((fp = fopen(MY_LOGFILE, "a")) != 0) { + char temp[256]; + int y, x, n; int need = sizeof(temp) - 1; + if (need > COLS) need = COLS; getyx(win, y, x); @@ -85,13 +76,15 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) int n; int ch; #if HAVE_GETTIMEOFDAY - int secs, msecs; - struct timeval current, previous; + struct timeval previous; #endif unlink(MY_LOGFILE); - newterm(0, stdout, stdin); + if (newterm(0, stdout, stdin) == 0) { + fprintf(stderr, "Cannot initialize terminal\n"); + ExitProgram(EXIT_FAILURE); + } (void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) noecho(); /* don't echo input */ @@ -104,14 +97,15 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) */ for (n = 0; n < 255; ++n) { char temp[10]; - sprintf(temp, "\033%c", n); + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "\033%c", n); define_key(temp, n + MY_KEYS); } for (n = KEY_MIN; n < KEY_MAX; ++n) { char *value; if ((value = keybound(n, 0)) != 0) { - char *temp = typeMalloc(char, strlen(value) + 2); - sprintf(temp, "\033%s", value); + size_t need = strlen(value) + 2; + char *temp = typeMalloc(char, need); + _nc_SPRINTF(temp, _nc_SLIMIT(need) "\033%s", value); define_key(temp, n + MY_KEYS); free(temp); free(value); @@ -125,8 +119,10 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) while ((ch = getch()) != ERR) { bool escaped = (ch >= MY_KEYS); const char *name = keyname(escaped ? (ch - MY_KEYS) : ch); - #if HAVE_GETTIMEOFDAY + int secs, msecs; + struct timeval current; + gettimeofday(¤t, 0); secs = (int) (current.tv_sec - previous.tv_sec); msecs = (int) ((current.tv_usec - previous.tv_usec) / 1000); diff --git a/test/demo_defkey.c b/test/demo_defkey.c index 045c2c7bd3e8..e5bb9c2680e0 100644 --- a/test/demo_defkey.c +++ b/test/demo_defkey.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 2002-2018,2019 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: demo_defkey.c,v 1.22 2013/09/28 22:02:17 tom Exp $ + * $Id: demo_defkey.c,v 1.29 2019/08/17 21:49:19 tom Exp $ * * Demonstrate the define_key() function. * Thomas Dickey - 2002/11/23 @@ -45,10 +45,10 @@ static void log_last_line(WINDOW *win) { FILE *fp; - int y, x, n; - char temp[256]; if ((fp = fopen(MY_LOGFILE, "a")) != 0) { + char temp[256]; + int y, x, n; int need = sizeof(temp) - 1; if (need > COLS) need = COLS; @@ -78,15 +78,15 @@ visichar(int ch) ch = UChar(ch); assert(ch >= 0 && ch < 256); if (ch == '\\') { - strcpy(temp, "\\\\"); + _nc_STRCPY(temp, "\\\\", sizeof(temp)); } else if (ch == '\033') { - strcpy(temp, "\\E"); + _nc_STRCPY(temp, "\\E", sizeof(temp)); } else if (ch < ' ') { - sprintf(temp, "\\%03o", ch); + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "\\%03o", ch); } else if (ch >= 127) { - sprintf(temp, "\\%03o", ch); + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "\\%03o", ch); } else { - sprintf(temp, "%c", ch); + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "%c", ch); } return temp; } @@ -98,19 +98,21 @@ static char * visible(const char *string) { char *result = 0; - size_t need = 1; - int pass; - int n; if (string != 0 && *string != '\0') { + int pass; + int n; + size_t need = 1; + for (pass = 0; pass < 2; ++pass) { for (n = 0; string[n] != '\0'; ++n) { char temp[80]; - strncpy(temp, visichar(string[n]), sizeof(temp) - 2); - if (pass) - strcat(result, temp); - else + _nc_STRNCPY(temp, visichar(string[n]), sizeof(temp) - 2); + if (pass) { + _nc_STRCAT(result, temp, need); + } else { need += strlen(temp); + } } if (!pass) result = typeCalloc(char, need); @@ -131,7 +133,7 @@ really_define_key(WINDOW *win, const char *new_string, int code) char temp[80]; if (code_name == 0) { - sprintf(temp, "Keycode %d", code); + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "Keycode %d", code); code_name = temp; } @@ -184,15 +186,16 @@ duplicate(WINDOW *win, NCURSES_CONST char *name, int code) if (value != 0) { const char *prefix = 0; - char temp[BUFSIZ]; - if (!strncmp(value, "\033[", (size_t) 2)) { + if (!(strncmp) (value, "\033[", (size_t) 2)) { prefix = "\033O"; - } else if (!strncmp(value, "\033O", (size_t) 2)) { + } else if (!(strncmp) (value, "\033O", (size_t) 2)) { prefix = "\033["; } if (prefix != 0) { - sprintf(temp, "%s%s", prefix, value + 2); + char temp[BUFSIZ]; + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "%s%s", prefix, value + 2); really_define_key(win, temp, code); } } @@ -239,7 +242,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) */ for (n = 0; n < 12; ++n) { char name[10]; - sprintf(name, "kf%d", n + 1); + _nc_SPRINTF(name, _nc_SLIMIT(sizeof(name)) "kf%d", n + 1); fkeys[n] = tigetstr(name); } for (n = 0; n < 12; ++n) { @@ -270,7 +273,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) break; } endwin(); - ExitProgram(EXIT_FAILURE); + ExitProgram(EXIT_SUCCESS); } #else int diff --git a/test/demo_forms.c b/test/demo_forms.c index 1e6806d2e523..ccfb86e311fe 100644 --- a/test/demo_forms.c +++ b/test/demo_forms.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2003-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 2003-2018,2019 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,14 +26,12 @@ * authorization. * ****************************************************************************/ /* - * $Id: demo_forms.c,v 1.46 2013/09/28 21:55:54 tom Exp $ + * $Id: demo_forms.c,v 1.56 2019/08/17 21:49:19 tom Exp $ * * Demonstrate a variety of functions from the form library. * Thomas Dickey - 2003/4/26 */ /* -TYPE_ENUM - -TYPE_REGEXP - dup_field - field_init - field_just - @@ -149,8 +147,8 @@ read_data(const char *filename) char *value = typeRealloc(char, need, prior); if (value == 0) failed("realloc"); - strcat(value, "\n"); - strcat(value, buffer); + _nc_STRCAT(value, "\n", need); + _nc_STRCAT(value, buffer, need); my_data[more - 1].value = value; } else { more = 0; @@ -172,6 +170,7 @@ read_data(const char *filename) failed("expected a colon"); } } + fclose(fp); } else { failed(filename); } @@ -208,7 +207,7 @@ make_field(const char *label, int frow, int fcol, int rows, int cols) if (d_option) { if (has_colors()) { set_field_fore(f, (chtype) COLOR_PAIR(2)); - set_field_back(f, A_UNDERLINE | COLOR_PAIR(3)); + set_field_back(f, (A_UNDERLINE | (chtype) COLOR_PAIR(3))); } else { set_field_fore(f, A_BOLD); } @@ -226,7 +225,7 @@ make_field(const char *label, int frow, int fcol, int rows, int cols) } static void -display_form(FORM * f) +display_form(FORM *f) { WINDOW *w; int rows, cols; @@ -249,7 +248,7 @@ display_form(FORM * f) } static void -erase_form(FORM * f) +erase_form(FORM *f) { WINDOW *w = form_win(f); WINDOW *s = form_sub(f); @@ -272,7 +271,7 @@ show_insert_mode(bool insert_mode) #define O_SELECTABLE (O_ACTIVE | O_VISIBLE) static FIELD * -another_field(FORM * form, FIELD * field) +another_field(FORM *form, FIELD *field) { FIELD **f = form_fields(form); FIELD *result = 0; @@ -289,7 +288,7 @@ another_field(FORM * form, FIELD * field) } static int -my_form_driver(FORM * form, int c) +my_form_driver(FORM *form, int c) { static bool insert_mode = TRUE; FIELD *field; @@ -336,12 +335,9 @@ my_form_driver(FORM * form, int c) } static void -show_current_field(WINDOW *win, FORM * form) +show_current_field(WINDOW *win, FORM *form) { FIELD *field; - FIELDTYPE *type; - char *buffer; - int nbuf; int field_rows, field_cols, field_max; int currow, curcol; @@ -356,7 +352,11 @@ show_current_field(WINDOW *win, FORM * form) if (data_behind(form)) waddstr(win, " behind"); waddch(win, '\n'); + if ((field = current_field(form)) != 0) { + FIELDTYPE *type; + int nbuf; + wprintw(win, "Page %d%s, Field %d/%d%s:", form_page(form), new_page(field) ? "*" : "", @@ -398,13 +398,13 @@ show_current_field(WINDOW *win, FORM * form) } waddch(win, ' '); - (void) wattrset(win, (int) field_fore(field)); + (void) wattrset(win, AttrArg(field_fore(field), 0)); waddstr(win, "fore"); wattroff(win, (int) field_fore(field)); waddch(win, '/'); - (void) wattrset(win, (int) field_back(field)); + (void) wattrset(win, AttrArg(field_back(field), 0)); waddstr(win, "back"); wattroff(win, (int) field_back(field)); @@ -412,6 +412,7 @@ show_current_field(WINDOW *win, FORM * form) waddstr(win, "\n"); for (nbuf = 0; nbuf <= 2; ++nbuf) { + char *buffer; if ((buffer = field_buffer(field, nbuf)) != 0) { wprintw(win, "buffer %d:", nbuf); (void) wattrset(win, A_REVERSE); @@ -431,14 +432,14 @@ show_current_field(WINDOW *win, FORM * form) static void demo_forms(void) { - WINDOW *w; FORM *form; FIELD *f[100]; /* will memset to zero */ - int finished = 0, c; + int c; unsigned n = 0; int pg; - WINDOW *also; const char *fname; + static const char *my_enum[] = + {"first", "second", "third", 0}; #ifdef NCURSES_MOUSE_VERSION mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0); @@ -455,7 +456,8 @@ demo_forms(void) memset(f, 0, sizeof(f)); for (pg = 0; pg < 4; ++pg) { char label[80]; - sprintf(label, "Sample Form Page %d", pg + 1); + _nc_SPRINTF(label, _nc_SLIMIT(sizeof(label)) + "Sample Form Page %d", pg + 1); f[n++] = make_label(label, 0, 15); set_new_page(f[n - 1], TRUE); @@ -476,23 +478,30 @@ demo_forms(void) f[n++] = make_field(fname, 3, 34, 1, 12); set_field_type(f[n - 1], TYPE_ALPHA, 1); break; + case 1: fname = "Last Name"; f[n++] = make_label(fname, 2, 0); - f[n++] = make_field(fname, 3, 0, 1, 18); + f[n++] = make_field(fname, 3, 0, 1, 12); set_field_type(f[n - 1], TYPE_ALPHA, 1); fname = "First Name"; - f[n++] = make_label(fname, 2, 20); - f[n++] = make_field(fname, 3, 20, 1, 12); + f[n++] = make_label(fname, 2, 14); + f[n++] = make_field(fname, 3, 14, 1, 12); set_field_type(f[n - 1], TYPE_ALPHA, 1); fname = "MI"; - f[n++] = make_label(fname, 2, 34); - f[n++] = make_field(fname, 3, 34, 1, 1); + f[n++] = make_label(fname, 2, 28); + f[n++] = make_field(fname, 3, 28, 1, 1); set_field_pad(f[n - 1], '?'); set_field_type(f[n - 1], TYPE_ALPHA, 1); + + fname = "First/Second/Third"; + f[n++] = make_label(fname, 2, 32); + f[n++] = make_field(fname, 3, 32, 1, 12); + set_field_type(f[n - 1], TYPE_ENUM, my_enum, 0, 0); break; + case 2: fname = "Host Name"; f[n++] = make_label(fname, 2, 0); @@ -505,20 +514,24 @@ demo_forms(void) f[n++] = make_field(fname, 3, 26, 1, 16); set_field_type(f[n - 1], TYPE_IPV4, 1); #endif - break; case 3: fname = "Four digits"; f[n++] = make_label(fname, 2, 0); - f[n++] = make_field(fname, 3, 0, 1, 18); + f[n++] = make_field(fname, 3, 0, 1, 10); set_field_type(f[n - 1], TYPE_INTEGER, 4, 0, 0); fname = "Numeric"; - f[n++] = make_label(fname, 2, 20); - f[n++] = make_field(fname, 3, 20, 1, 12); + f[n++] = make_label(fname, 2, 13); + f[n++] = make_field(fname, 3, 13, 1, 12); set_field_type(f[n - 1], TYPE_NUMERIC, 3, -10000.0, 100000000.0); + fname = "Phone number"; + f[n++] = make_label(fname, 2, 27); + f[n++] = make_field(fname, 3, 27, 1, 16); + set_field_type(f[n - 1], TYPE_REGEXP, + "^([0-9]-)?[0-9]{3}-[0-9]{3}-[0-9]{4} *$");; break; } @@ -531,6 +544,9 @@ demo_forms(void) f[n] = (FIELD *) 0; if ((form = new_form(f)) != 0) { + WINDOW *w; + WINDOW *also; + int finished = 0; display_form(form); @@ -557,8 +573,7 @@ demo_forms(void) free_form(form); } for (c = 0; f[c] != 0; c++) { - void *ptr = field_userptr(f[c]); - free(ptr); + free_edit_field(f[c]); free_field(f[c]); } noraw(); diff --git a/test/demo_keyok.c b/test/demo_keyok.c index 8724d9819ea0..ea9604efe8d2 100644 --- a/test/demo_keyok.c +++ b/test/demo_keyok.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002-2003,2006 Free Software Foundation, Inc. * + * Copyright (c) 2002-2006,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: demo_keyok.c,v 1.5 2006/11/04 20:09:51 tom Exp $ + * $Id: demo_keyok.c,v 1.6 2017/04/10 00:37:08 tom Exp $ * * Demonstrate the keyok() function. * Thomas Dickey - 2002/11/23 @@ -39,6 +39,7 @@ int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { int lastch = ERR; + int prior = ERR; int ch; WINDOW *win; @@ -57,6 +58,9 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) while ((ch = wgetch(win)) != ERR) { const char *name = keyname(ch); + if (ch == ESCAPE && prior == ch) + break; + prior = ch; wprintw(win, "Keycode %d, name %s\n", ch, name != 0 ? name : ""); diff --git a/test/demo_menus.c b/test/demo_menus.c index c742223f0375..765732338122 100644 --- a/test/demo_menus.c +++ b/test/demo_menus.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2005-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 2005-2017,2019 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: demo_menus.c,v 1.52 2013/09/28 21:55:02 tom Exp $ + * $Id: demo_menus.c,v 1.70 2019/12/07 18:06:12 tom Exp $ * * Demonstrate a variety of functions from the menu library. * Thomas Dickey - 2005/4/9 @@ -75,11 +75,8 @@ top_row - #ifdef NCURSES_VERSION #ifdef TRACE static unsigned save_trace = TRACE_ORDINARY | TRACE_CALLS; -extern unsigned _nc_tracing; static MENU *mpTrace; #endif -#else -#undef TRACE #endif typedef enum { @@ -97,7 +94,7 @@ typedef enum { #define MENU_Y 1 typedef struct { - const char *name; + NCURSES_CONST char *name; void (*func) (int); unsigned mask; } MENU_DATA; @@ -112,6 +109,20 @@ static WINDOW *status; static bool loaded_file = FALSE; +static char empty[1]; + +#ifdef TRACE +static void failed(const char *s) GCC_NORETURN; + +static void +failed(const char *s) +{ + perror(s); + endwin(); + ExitProgram(EXIT_FAILURE); +} +#endif + /* Common function to allow ^T to toggle trace-mode in the middle of a test * so that trace-files can be made smaller. */ @@ -128,7 +139,7 @@ wGetchar(WINDOW *win) } else { _nc_tracing = save_trace; } - trace(_nc_tracing); + curses_trace(_nc_tracing); if (_nc_tracing) Trace(("TOGGLE-TRACING ON")); } @@ -184,9 +195,9 @@ menu_offset(MenuNo number) int result = 0; if (okMenuNo(number)) { - int spc_desc, spc_rows, spc_cols; - + int spc_rows; #ifdef NCURSES_VERSION + int spc_desc, spc_cols; menu_spacing(mpBanner, &spc_desc, &spc_rows, &spc_cols); #else spc_rows = 0; @@ -268,13 +279,6 @@ menu_create(ITEM ** items, int count, int ncols, MenuNo number) if (mcols + (2 * margin + x) >= COLS) mcols = COLS - (2 * margin + x); -#ifdef TRACE - if (number == eTrace) - menu_opts_off(result, O_ONEVALUE); - else - menu_opts_on(result, O_ONEVALUE); -#endif - menuwin = newwin(mrows + (2 * margin), mcols + (2 * margin), y, x); set_menu_win(result, menuwin); keypad(menuwin, TRUE); @@ -283,6 +287,16 @@ menu_create(ITEM ** items, int count, int ncols, MenuNo number) set_menu_sub(result, derwin(menuwin, mrows, mcols, margin, margin)); +#ifdef TRACE + if (number == eTrace) + menu_opts_off(result, O_ONEVALUE); + else + menu_opts_on(result, O_ONEVALUE); +#endif +#if defined(NCURSES_MOUSE_VERSION) && defined(O_MOUSE_MENU) + menu_opts_on(result, O_MOUSE_MENU); +#endif + post_menu(result); set_menu_init(result, my_menu_init); @@ -295,12 +309,11 @@ menu_create(ITEM ** items, int count, int ncols, MenuNo number) static void menu_destroy(MENU * m) { - int count; - Trace(("menu_destroy %p", (void *) m)); if (m != 0) { ITEM **items = menu_items(m); const char *blob = 0; + int count; count = item_count(m); Trace(("menu_destroy %p count %d", (void *) m, count)); @@ -315,7 +328,7 @@ menu_destroy(MENU * m) if ((count > 0) && (m == mpSelect)) { if (blob && loaded_file) { Trace(("freeing blob %p", blob)); - free((char *) blob); + free((void *) blob); } free(items); items = 0; @@ -356,8 +369,8 @@ build_file_menu(MenuNo number) int n; for (n = 0; table[n].name != 0; ++n) { - *ip = new_item(table[n].name, ""); - set_item_userptr(*ip, &table[n]); + *ip = new_item(table[n].name, empty); + set_item_userptr(*ip, (void *) &table[n]); ++ip; } *ip = (ITEM *) 0; @@ -415,7 +428,6 @@ build_select_menu(MenuNo number, char *filename) && (sb.st_mode & S_IFMT) == S_IFREG && sb.st_size != 0) { size_t size = (size_t) sb.st_size; - unsigned j, k; char *blob = typeMalloc(char, size + 1); MENU_DATA *list = typeCalloc(MENU_DATA, size + 1); @@ -428,6 +440,7 @@ build_select_menu(MenuNo number, char *filename) if (fp != 0) { if (fread(blob, sizeof(char), size, fp) == size) { bool mark = TRUE; + unsigned j, k; for (j = k = 0; j < size; ++j) { if (mark) { list[k++].name = blob + j; @@ -464,8 +477,8 @@ build_select_menu(MenuNo number, char *filename) for (i = 0; ap[i].name != 0; ++i) { ap[i].func = call_select; ap[i].mask = (unsigned) i; - *ip = new_item(ap[i].name, ""); - set_item_userptr(*ip, &table[i]); + *ip = new_item(ap[i].name, empty); + set_item_userptr(*ip, (void *) &table[i]); ++ip; } *ip = 0; @@ -526,8 +539,8 @@ build_trace_menu(MenuNo number) int n; for (n = 0; t_tbl[n].name != 0; n++) { - *ip = new_item(t_tbl[n].name, ""); - set_item_userptr(*ip, &t_tbl[n]); + *ip = new_item(t_tbl[n].name, empty); + set_item_userptr(*ip, (void *) &t_tbl[n]); ++ip; } *ip = (ITEM *) 0; @@ -539,27 +552,31 @@ static char * tracetrace(unsigned tlevel) { static char *buf; + static size_t need = 12; int n; if (buf == 0) { - size_t need = 12; for (n = 0; t_tbl[n].name != 0; n++) need += strlen(t_tbl[n].name) + 2; buf = typeMalloc(char, need); + if (!buf) + failed("tracetrace"); } - sprintf(buf, "0x%02x = {", tlevel); + _nc_SPRINTF(buf, _nc_SLIMIT(need) "0x%02x = {", tlevel); if (tlevel == 0) { - sprintf(buf + strlen(buf), "%s, ", t_tbl[0].name); + _nc_STRCAT(buf, t_tbl[0].name, need); + _nc_STRCAT(buf, ", ", need); } else { for (n = 1; t_tbl[n].name != 0; n++) if ((tlevel & t_tbl[n].mask) == t_tbl[n].mask) { - strcat(buf, t_tbl[n].name); - strcat(buf, ", "); + _nc_STRCAT(buf, t_tbl[n].name, need); + _nc_STRCAT(buf, ", ", need); } } if (buf[strlen(buf) - 2] == ',') buf[strlen(buf) - 2] = '\0'; - return (strcat(buf, "}")); + _nc_STRCAT(buf, "}", need); + return buf; } /* fake a dynamically reconfigurable menu using the 0th entry to deselect @@ -569,13 +586,14 @@ static bool update_trace_menu(MENU * m) { ITEM **items; - ITEM *i, **p; + ITEM *i; bool changed = FALSE; items = menu_items(m); i = current_item(m); if (i == items[0]) { if (item_value(i)) { + ITEM **p; for (p = items + 1; *p != 0; p++) if (item_value(*p)) { set_item_value(*p, FALSE); @@ -591,7 +609,6 @@ perform_trace_menu(int cmd) /* interactively set the trace level */ { ITEM **ip; - unsigned newtrace; int result; for (ip = menu_items(mpTrace); *ip; ip++) { @@ -607,14 +624,14 @@ perform_trace_menu(int cmd) if (result == E_OK) { if (update_trace_menu(mpTrace) || cmd == REQ_TOGGLE_ITEM) { - newtrace = 0; + unsigned newtrace = 0; for (ip = menu_items(mpTrace); *ip; ip++) { if (item_value(*ip)) { MENU_DATA *td = (MENU_DATA *) item_userptr(*ip); newtrace |= td->mask; } } - trace(newtrace); + curses_trace(newtrace); Trace(("trace level interactively set to %s", tracetrace(_nc_tracing))); MvWPrintw(status, 1, 0, @@ -683,8 +700,8 @@ build_menus(char *filename) int n; for (n = 0; table[n].name != 0; ++n) { - *ip = new_item(table[n].name, ""); - set_item_userptr(*ip, &table[n]); + *ip = new_item(table[n].name, empty); + set_item_userptr(*ip, (void *) &table[n]); ++ip; } *ip = (ITEM *) 0; @@ -749,6 +766,36 @@ move_menus(MENU * current, int by_y, int by_x) } } +#if defined(KEY_RESIZE) && NCURSES_EXT_FUNCS +static void +resize_menu(MENU ** menu) +{ +#if 0 + WINDOW *win = menu_win(*menu); + WINDOW *sub = menu_sub(*menu); +#endif + (void) menu; +} + +static void +resize_menus(MENU * current) +{ + (void) current; + + werase(status); + wnoutrefresh(status); + wresize(status, 1, COLS); + mvwin(status, LINES - 1, 0); + + resize_menu(&mpBanner); + resize_menu(&mpFile); + resize_menu(&mpSelect); +#ifdef TRACE + resize_menu(&mpTrace); +#endif +} +#endif /* defined(KEY_RESIZE) && NCURSES_EXT_FUNCS */ + static void show_status(int ch, MENU * menu) { @@ -772,7 +819,7 @@ perform_menus(void) int ch = ERR; #ifdef NCURSES_MOUSE_VERSION - mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0); + mousemask(BUTTON1_CLICKED, (mmask_t *) 0); #endif menu_display(last_menu); @@ -801,6 +848,11 @@ perform_menus(void) case KEY_SRIGHT: move_menus(last_menu, 0, 1); continue; +#if defined(KEY_RESIZE) && NCURSES_EXT_FUNCS + case KEY_RESIZE: + resize_menus(last_menu); + continue; +#endif } cmd = menu_virtualize(ch); @@ -834,9 +886,17 @@ perform_menus(void) #endif } +#if defined(NCURSES_MOUSE_VERSION) && defined(O_MOUSE_MENU) if ((code == E_REQUEST_DENIED) && (cmd == KEY_MOUSE)) { + (void) menu_getc(mpBanner); code = menu_driver(mpBanner, cmd); + if (code == E_REQUEST_DENIED) { + MEVENT event; + if (menu_getc(mpBanner) == KEY_MOUSE) + getmouse(&event); /* give up */ + } } +#endif break; } @@ -866,10 +926,6 @@ perform_menus(void) beep(); continue; } - -#ifdef NCURSES_MOUSE_VERSION - mousemask(0, (mmask_t *) 0); -#endif } static void @@ -948,7 +1004,7 @@ main(int argc, char *argv[]) setlocale(LC_ALL, ""); - while ((c = getopt(argc, argv, "a:de:fhmp:s:t:")) != -1) { + while ((c = getopt(argc, argv, "fht:")) != -1) { switch (c) { #if HAVE_RIPOFFLINE case 'f': @@ -960,7 +1016,7 @@ main(int argc, char *argv[]) #endif /* HAVE_RIPOFFLINE */ #ifdef TRACE case 't': - trace((unsigned) strtoul(optarg, 0, 0)); + curses_trace((unsigned) strtoul(optarg, 0, 0)); break; #endif default: diff --git a/test/demo_new_pair.c b/test/demo_new_pair.c new file mode 100644 index 000000000000..c5ec9d3946e7 --- /dev/null +++ b/test/demo_new_pair.c @@ -0,0 +1,355 @@ +/**************************************************************************** + * Copyright (c) 2017-2018,2019 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: demo_new_pair.c,v 1.20 2019/12/14 23:26:09 tom Exp $ + * + * Demonstrate the alloc_pair() function. + */ + +#include +#include +#include + +#if HAVE_ALLOC_PAIR && USE_WIDEC_SUPPORT + +#include +#include +#include + +#define MAX_BITS 8 /* all but A_ALTCHARSET */ +#define MAX_ATTR ((1< 0) { + if (now < COLOR_PAIRS) { + int fg, bg; + our_content(now, &fg, &bg); + if (init_pair((short) now, (short) fg, (short) bg) != OK) + now = ERR; + } else { + now %= COLOR_PAIRS; + } + result = now; + } + return result; +} + +static time_t +now(void) +{ + return time((time_t *) 0); +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: demo_new_pair [options]", + "", + "Repeatedly print using all possible color combinations.", + "", + "Options:", + " -i use init_pair rather than alloc_pair", + " -p start in paged-mode", + " -s start in single-step mode", + " -w print a wide-character cell", + }; + unsigned n; + for (n = 0; n < SIZEOF(msg); ++n) { + fprintf(stderr, "%s\n", msg[n]); + } + ExitProgram(EXIT_FAILURE); +} + +#define use_pages() \ + paged_mode = TRUE, single_mode = TRUE + +#define use_single() \ + paged_mode = FALSE, single_mode = TRUE + +#define update_modes() \ + scrollok(stdscr, !paged_mode); \ + nodelay(stdscr, !single_mode || paged_mode) + +int +main(int argc, char *argv[]) +{ + static const char *help[] = + { + "This program iterates over the possible color combinations,", + "allocating or initializing color pairs. For best results,", + "choose screen-width dividing evenly into the number of colors,", + "e.g.,", + "", + " 32x64,32x128 256 colors", + " 24x44,24x88 88 colors", + " 32x64,24x128 16 colors", + "", + "Keys:", + " c toggle between coloring and de-coloring cells", + " p show one page at a time", + " s show one character at a time", + " display char/page without pausing", + " v/V cycle through video attributes", + " w toggle between \"#\" and a double-width equivalent", + " ? print this screen (exit on any character).", + "", + "To exit this program, press ^Q, ^[ or \"q\".", + 0 + }; + + bool done = FALSE; + bool clobber = FALSE; + bool hascolor = FALSE; + bool use_init = FALSE; + bool use_wide = FALSE; + bool paged_mode = FALSE; + bool single_mode = FALSE; + int video_mode = 0; + int current; + int ch; + wchar_t wch[2]; + time_t start = now(); + long total_cells = 0; + FILE *output = 0; + + setlocale(LC_ALL, ""); + + while ((ch = getopt(argc, argv, "ipsw")) != -1) { + switch (ch) { + case 'i': + use_init = TRUE; + break; + case 'p': + use_pages(); + break; + case 's': + use_single(); + break; + case 'w': + use_wide = TRUE; + break; + default: + usage(); + break; + } + } + + if (isatty(fileno(stderr))) { + output = stderr; + } else if ((ch = open("/dev/tty", O_WRONLY)) >= 0) { + output = fdopen(ch, "w"); + } else { + fprintf(stderr, "cannot open terminal for output\n"); + ExitProgram(EXIT_FAILURE); + } + if (newterm(NULL, output, stdin) == 0) { + fprintf(stderr, "Cannot initialize terminal\n"); + fclose(output); + ExitProgram(EXIT_FAILURE); + } + (void) cbreak(); /* read chars without wait for \n */ + (void) noecho(); /* don't echo input */ + update_modes(); + curs_set(0); + + keypad(stdscr, TRUE); + + if ((hascolor = has_colors())) { + start_color(); + current = 1; + } else { + current = 0; + } + + /* + * Repeatedly cycle through all colors, initializing pairs as needed. + * Provide for single-stepping, or page-at-a-time, as well as quitting. + */ + while (!done) { + cchar_t temp; + attr_t my_attrs; + int my_pair; + + switch (getch()) { + case HELP_KEY_1: + popup_msg(stdscr, help); + break; + case 'p': + /* step-by-page */ + use_pages(); + update_modes(); + break; + case 's': + /* step-by-char */ + use_single(); + update_modes(); + break; + case ' ': + single_mode = FALSE; + update_modes(); + break; + case QUIT: + case ESCAPE: + case 'q': + done = TRUE; + continue; + case 'c': + clobber = !clobber; + continue; + case 'v': + if (--video_mode < 0) + video_mode = MAX_ATTR; + continue; + case 'V': + if (video_mode > MAX_ATTR) + video_mode = 0; + continue; + case 'w': + use_wide = !use_wide; + continue; + case ERR: + break; + default: + beep(); + break; + } + if (hascolor) { + my_attrs = next_attr(video_mode); + if (clobber) { + int fg, bg; + our_content(current, &fg, &bg); + my_pair = find_pair(fg, bg); + if (my_pair > 0) { + free_pair(my_pair); + } + my_pair = 0; + } else { + my_pair = (use_init + ? next_color(current) + : make_color(current)); + } + } else { + my_attrs = next_attr(current); + my_pair = 0; + } + if (my_pair < 0) + break; + wch[0] = use_wide ? 0xff03 : '#'; + wch[1] = 0; + setcchar(&temp, wch, my_attrs, + (short) my_pair, + (use_init ? NULL : (void *) &my_pair)); + /* + * At the end of a page, move the cursor to the home position. + */ + if ((add_wch(&temp) == ERR) && paged_mode) { + nodelay(stdscr, !single_mode); + move(0, 0); + } + total_cells += 1 + (use_wide ? 1 : 0); + ++current; + } + stop_curses(); + fclose(output); + + printf("%.1f cells/second\n", + (double) (total_cells) / (double) (now() - start)); + + ExitProgram(EXIT_SUCCESS); +} + +#else +int +main(void) +{ + printf("This program requires the ncurses alloc_pair function\n"); + ExitProgram(EXIT_FAILURE); +} +#endif diff --git a/test/demo_panels.c b/test/demo_panels.c index ce6beb703ce2..ac3b43186011 100644 --- a/test/demo_panels.c +++ b/test/demo_panels.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007-2008,2010 Free Software Foundation, Inc. * + * Copyright (c) 2007-2018,2019 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: demo_panels.c,v 1.37 2010/05/01 22:19:02 tom Exp $ + * $Id: demo_panels.c,v 1.44 2019/08/31 23:24:11 tom Exp $ * * Demonstrate a variety of functions from the panel library. */ @@ -204,7 +204,7 @@ mkpanel(short color, int rows, int cols, int tly, int tlx) { WINDOW *win; PANEL *pan = 0; - char *userdata = typeMalloc(char, 3); + char *userdata = typeMalloc(char, 6); if ((win = newwin(rows, cols, tly, tlx)) != 0) { keypad(win, TRUE); @@ -222,13 +222,13 @@ mkpanel(short color, int rows, int cols, int tly, int tlx) wbkgdset(win, A_BOLD | ' '); } } - sprintf(userdata, "p%d", color % 8); + _nc_SPRINTF(userdata, _nc_SLIMIT(4) "p%d", color % 8); set_panel_userptr(pan, (NCURSES_CONST void *) userdata); return pan; } static void -my_remove_panel(PANEL ** pans, int which) +my_remove_panel(PANEL **pans, int which) { if (pans[which] != 0) { PANEL *pan = pans[which]; @@ -248,9 +248,8 @@ my_remove_panel(PANEL ** pans, int which) #define ABS(a) ((a) < 0 ? -(a) : (a)) static void -my_create_panel(PANEL ** pans, int which, FillPanel myFill) +my_create_panel(PANEL **pans, int which, FillPanel myFill) { - PANEL *pan = 0; int code; short pair = (short) which; short fg = (short) ((pair == COLOR_BLUE) ? COLOR_WHITE : COLOR_BLACK); @@ -271,7 +270,7 @@ my_create_panel(PANEL ** pans, int which, FillPanel myFill) if (code > 0) { char also[80]; - sprintf(also, " (first %d,%d)", y0, x0); + _nc_SPRINTF(also, _nc_SLIMIT(sizeof(also)) " (first %d,%d)", y0, x0); /* get the position of the opposite corner */ while ((code = get_position("Opposite corner", also, which, &x1, &y1)) == 0) { @@ -281,7 +280,10 @@ my_create_panel(PANEL ** pans, int which, FillPanel myFill) if (code > 0) { int tly = MIN(y0, y1); int tlx = MIN(x0, x1); - pan = mkpanel(pair, ABS(y1 - y0) + 1, ABS(x1 - x0) + 1, tly, tlx); + PANEL *pan = mkpanel(pair, + ABS(y1 - y0) + 1, + ABS(x1 - x0) + 1, + tly, tlx); /* finish */ myFill(pan); pans[which] = pan; @@ -292,7 +294,7 @@ my_create_panel(PANEL ** pans, int which, FillPanel myFill) } static void -my_move_panel(PANEL ** pans, int which, bool continuous) +my_move_panel(PANEL **pans, int which, bool continuous) { if (pans[which] != 0) { int code; @@ -302,7 +304,7 @@ my_move_panel(PANEL ** pans, int which, bool continuous) char also[80]; getbegyx(win, y0, x0); - sprintf(also, " (start %d,%d)", y0, x0); + _nc_SPRINTF(also, _nc_SLIMIT(sizeof(also)) " (start %d,%d)", y0, x0); wmove(stdscr, y0, x0); while ((code = get_position("Move panel", also, which, &x1, &y1)) == 0) { if (continuous) { @@ -317,7 +319,7 @@ my_move_panel(PANEL ** pans, int which, bool continuous) } static void -my_resize_panel(PANEL ** pans, int which, FillPanel myFill) +my_resize_panel(PANEL **pans, int which, FillPanel myFill) { if (pans[which] != 0) { int code; @@ -327,7 +329,7 @@ my_resize_panel(PANEL ** pans, int which, FillPanel myFill) char also[80]; getbegyx(win, y0, x0); - sprintf(also, " (start %d,%d)", y0, x0); + _nc_SPRINTF(also, _nc_SLIMIT(sizeof(also)) " (start %d,%d)", y0, x0); wmove(stdscr, y0, x0); while ((code = get_position("Resize panel", also, which, &x1, &y1)) == 0) { @@ -365,7 +367,7 @@ init_panel(void) } static void -fill_panel(PANEL * pan) +fill_panel(PANEL *pan) { WINDOW *win = panel_window(pan); const char *userptr = (const char *) panel_userptr(pan); @@ -385,7 +387,7 @@ fill_panel(PANEL * pan) } static void -fill_unboxed(PANEL * pan) +fill_unboxed(PANEL *pan) { WINDOW *win = panel_window(pan); const char *userptr = (const char *) panel_userptr(pan); @@ -406,7 +408,7 @@ make_fullwidth_digit(cchar_t *target, int digit) { wchar_t source[2]; - source[0] = digit + 0xff10; + source[0] = (wchar_t) (digit + 0xff10); source[1] = 0; setcchar(target, source, A_NORMAL, 0, 0); } @@ -428,7 +430,7 @@ init_wide_panel(void) } static void -fill_wide_panel(PANEL * pan) +fill_wide_panel(PANEL *pan) { WINDOW *win = panel_window(pan); int num = ((const char *) panel_userptr(pan))[1]; @@ -450,7 +452,7 @@ fill_wide_panel(PANEL * pan) #define MAX_PANELS 5 static int -which_panel(PANEL * px[MAX_PANELS + 1], PANEL * pan) +which_panel(PANEL *px[MAX_PANELS + 1], PANEL *pan) { int result = 0; int j; @@ -465,7 +467,7 @@ which_panel(PANEL * px[MAX_PANELS + 1], PANEL * pan) } static void -show_panels(PANEL * px[MAX_PANELS + 1]) +show_help(WINDOW *win) { static const char *help[] = { @@ -479,9 +481,19 @@ show_panels(PANEL * px[MAX_PANELS + 1]) " m - move the panel (M for continuous move)", " r - resize the panel", " s - show the panel", - " b - put the panel on the top of the stack" + " t - put the panel on the top of the stack" }; + int j; + + for (j = 0; j < (int) SIZEOF(help); ++j) { + if (wprintw(win, "%s\n", help[j]) == ERR) + break; + } +} +static void +show_panels(PANEL *px[MAX_PANELS + 1]) +{ struct { bool valid; bool hidden; @@ -490,7 +502,6 @@ show_panels(PANEL * px[MAX_PANELS + 1]) } table[MAX_PANELS + 1]; WINDOW *win; - PANEL *pan; int j; memset(table, 0, sizeof(table)); @@ -504,6 +515,8 @@ show_panels(PANEL * px[MAX_PANELS + 1]) } if ((win = newwin(LINES - 1, COLS, 0, 0)) != 0) { + PANEL *pan; + keypad(win, TRUE); if ((pan = new_panel(win)) != 0) { werase(win); @@ -527,10 +540,7 @@ show_panels(PANEL * px[MAX_PANELS + 1]) waddch(win, '\n'); } } - for (j = 0; j < (int) SIZEOF(help); ++j) { - if (wprintw(win, "%s\n", help[j]) == ERR) - break; - } + show_help(win); wgetch(win); del_panel(pan); pflush(); @@ -556,7 +566,7 @@ wrapper(top_panel) /* *INDENT-ON* */ static void -do_panel(PANEL * px[MAX_PANELS + 1], +do_panel(PANEL *px[MAX_PANELS + 1], NCURSES_CONST char *cmd, FillPanel myFill) { @@ -622,11 +632,10 @@ ok_digit(int ch) * End the command with a newline. Reject other characters. */ static bool -get_command(PANEL * px[MAX_PANELS + 1], char *buffer, int limit) +get_command(PANEL *px[MAX_PANELS + 1], char *buffer, int limit) { int length = 0; int y0, x0; - int c0, ch; WINDOW *win; getyx(stdscr, y0, x0); @@ -645,9 +654,9 @@ get_command(PANEL * px[MAX_PANELS + 1], char *buffer, int limit) } (void) wgetch(win); } else { - c0 = 0; + int c0 = 0; for (;;) { - ch = wgetch(win); + int ch = wgetch(win); if (ch == ERR || ch == QUIT || ch == ESCAPE) { buffer[0] = '\0'; break; @@ -655,7 +664,7 @@ get_command(PANEL * px[MAX_PANELS + 1], char *buffer, int limit) wrefresh(curscr); } else if (ch == '\n' || ch == KEY_ENTER) { break; - } else if (ch == '?') { + } else if (ch == HELP_KEY_1) { show_panels(px); } else if (length + 3 < limit) { if (ch >= KEY_MIN) { diff --git a/test/demo_tabs.c b/test/demo_tabs.c new file mode 100644 index 000000000000..51850e4cb992 --- /dev/null +++ b/test/demo_tabs.c @@ -0,0 +1,119 @@ +/**************************************************************************** + * Copyright (c) 2019 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. * + ****************************************************************************/ + +/* + * Author: Thomas E. Dickey + * + * $Id: demo_tabs.c,v 1.4 2019/02/24 00:38:13 tom Exp $ + * + * A simple demo of tabs in curses. + */ +#define USE_TINFO +#include "test.priv.h" + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: demo_tabs [options]", + "", + "Print a grid to test tab-stops with the curses interface", + "", + "Options:", + " -l COUNT total number of lines to show", + " -t NUM set TABSIZE variable to the given value", + }; + unsigned n; + for (n = 0; n < SIZEOF(msg); ++n) { + fprintf(stderr, "%s\n", msg[n]); + } + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc, char *argv[]) +{ + int tabstop; + int n, col, row, step; + int line_limit = -1; + int curses_stops = -1; + + while ((n = getopt(argc, argv, "l:t:")) != -1) { + switch (n) { + case 'l': + line_limit = atoi(optarg); + break; + case 't': + curses_stops = atoi(optarg); + break; + default: + usage(); + break; + } + } + + initscr(); + noecho(); + cbreak(); + if (curses_stops > 0) + set_tabsize(curses_stops); +#if HAVE_TIGETNUM + tabstop = tigetnum("it"); + if (tabstop <= 0) +#endif + tabstop = 8; + for (row = 0; row < LINES; ++row) { + move(row, 0); + for (col = step = 0; col < COLS - 1; ++col) { + if (row == 0) { + chtype ch = '-'; + if ((col % tabstop) == 0) + ch = '+'; + addch(ch); + } else if (col + 1 < row) { + addch('*'); + } else { + printw("%x", step); + col = (row + (tabstop * ++step)); + col /= tabstop; + col *= tabstop; + col -= 1; + if ((col + tabstop) < COLS) + addch('\t'); + refresh(); + } + } + addch('\n'); + if (line_limit > 0 && row >= line_limit) + break; + } + getch(); + endwin(); + ExitProgram(EXIT_SUCCESS); +} diff --git a/test/demo_termcap.c b/test/demo_termcap.c index 6f35c17a63af..666f7a2e697b 100644 --- a/test/demo_termcap.c +++ b/test/demo_termcap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2005-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 2005-2017,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,12 +29,39 @@ /* * Author: Thomas E. Dickey * - * $Id: demo_termcap.c,v 1.24 2013/06/08 16:58:49 tom Exp $ + * $Id: demo_termcap.c,v 1.58 2019/08/24 21:47:19 tom Exp $ * * A simple demo of the termcap interface. */ #define USE_TINFO #include +#include + +#if NCURSES_XNAMES +#if HAVE_TERM_ENTRY_H +#include +#else +#undef NCURSES_XNAMES +#define NCURSES_XNAMES 0 +#endif +#endif + +#if defined(NCURSES_VERSION) +#if HAVE_NCURSES_TERMCAP_H +#include +#elif HAVE_TERMCAP_H +#include +#endif +#endif + +static void failed(const char *) GCC_NORETURN; + +static void +failed(const char *msg) +{ + fprintf(stderr, "%s\n", msg); + ExitProgram(EXIT_FAILURE); +} #if HAVE_TGETENT @@ -47,11 +74,13 @@ #define FCOLS 8 #define FNAME(type) "%s %-*s = ", #type, FCOLS -#if USE_CODE_LISTS static bool b_opt = FALSE; static bool n_opt = FALSE; -static bool q_opt = FALSE; static bool s_opt = FALSE; +static bool q_opt = FALSE; +#ifdef NCURSES_VERSION +static bool x_opt = FALSE; +static bool y_opt = FALSE; #endif static char *d_opt; @@ -59,15 +88,27 @@ static char *e_opt; static char **db_list; static int db_item; +static char *my_blob; +static char **my_boolcodes; +static char **my_numcodes; +static char **my_numvalues; +static char **my_strcodes; +static char **my_strvalues; + static long total_values; +static long total_b_values; +static long total_n_values; +static long total_s_values; -#define isCapName(c) (isgraph(c) && strchr("^#=:\\", c) == 0) +#define isCapName(c) (isgraph(c) && strchr("^=:\\", c) == 0) +#define EachCapName(n) n = 33; n < 127; ++n static char * make_dbitem(char *p, char *q) { - char *result = malloc(strlen(e_opt) + 2 + (size_t) (p - q)); - sprintf(result, "%s=%.*s", e_opt, (int) (p - q), q); + size_t need = strlen(e_opt) + 2 + (size_t) (p - q); + char *result = malloc(need); + _nc_SPRINTF(result, _nc_SLIMIT(need) "%s=%.*s", e_opt, (int) (p - q), q); return result; } @@ -118,10 +159,12 @@ next_dbitem(void) db_item++; } } - printf("** %s\n", result); + if (result != 0) + printf("** %s\n", result); return result; } +#if NO_LEAKS static void free_dblist(void) { @@ -133,6 +176,73 @@ free_dblist(void) db_list = 0; } } +#endif /* NO_LEAKS */ + +static void +show_string(const char *name, const char *value) +{ + printf(FNAME(str), name); + if (value == ((char *) -1)) { + printf("CANCELLED"); + } else if (value == ((char *) 0)) { + printf("ABSENT"); + } else { + while (*value != 0) { + int ch = UChar(*value++); + switch (ch) { + case '\177': + fputs("^?", stdout); + break; + case '\033': + fputs("\\E", stdout); + break; + case '\b': + fputs("\\b", stdout); + break; + case '\f': + fputs("\\f", stdout); + break; + case '\n': + fputs("\\n", stdout); + break; + case '\r': + fputs("\\r", stdout); + break; + case ' ': + fputs("\\s", stdout); + break; + case '\t': + fputs("\\t", stdout); + break; + case '^': + fputs("\\^", stdout); + break; + case ':': + fputs("\\072", stdout); + break; + case '\\': + fputs("\\\\", stdout); + break; + default: + if (isgraph(ch)) + fputc(ch, stdout); + else if (ch < 32) + printf("^%c", ch + '@'); + else + printf("\\%03o", ch); + break; + } + } + } + printf("\n"); +} + +static void +show_number(const char *name, int value) +{ + printf(FNAME(num), name); + printf(" %d\n", value); +} static void dumpit(NCURSES_CONST char *cap) @@ -150,68 +260,23 @@ dumpit(NCURSES_CONST char *cap) if ((str = tgetstr(cap, &ap)) != 0) { total_values++; + total_s_values++; if (!q_opt) { /* * Note that the strings returned are mostly terminfo format, since * ncurses does not convert except for a handful of special cases. */ - printf(FNAME(str), cap); - while (*str != 0) { - int ch = UChar(*str++); - switch (ch) { - case '\177': - fputs("^?", stdout); - break; - case '\033': - fputs("\\E", stdout); - break; - case '\b': - fputs("\\b", stdout); - break; - case '\f': - fputs("\\f", stdout); - break; - case '\n': - fputs("\\n", stdout); - break; - case '\r': - fputs("\\r", stdout); - break; - case ' ': - fputs("\\s", stdout); - break; - case '\t': - fputs("\\t", stdout); - break; - case '^': - fputs("\\^", stdout); - break; - case ':': - fputs("\\072", stdout); - break; - case '\\': - fputs("\\\\", stdout); - break; - default: - if (isgraph(ch)) - fputc(ch, stdout); - else if (ch < 32) - printf("^%c", ch + '@'); - else - printf("\\%03o", ch); - break; - } - } - printf("\n"); + show_string(cap, str); } } else if ((num = tgetnum(cap)) >= 0) { total_values++; + total_n_values++; if (!q_opt) { - printf(FNAME(num), cap); - printf(" %d\n", num); + show_number(cap, num); } } else if (tgetflag(cap) > 0) { - ++total_values; + total_values++; + total_b_values++; if (!q_opt) { printf(FNAME(flg), cap); printf("%s\n", "true"); @@ -230,16 +295,17 @@ brute_force(const char *name) if (db_list) { putenv(next_dbitem()); } - printf("Terminal type %s\n", name); + if (!q_opt) + printf("Terminal type \"%s\"\n", name); if (tgetent(buffer, name) >= 0) { char cap[3]; int c1, c2; cap[2] = 0; - for (c1 = 0; c1 < 256; ++c1) { + for (EachCapName(c1)) { cap[0] = (char) c1; if (isCapName(c1)) { - for (c2 = 0; c2 < 256; ++c2) { + for (EachCapName(c2)) { cap[1] = (char) c2; if (isCapName(c2)) { dumpit(cap); @@ -250,23 +316,32 @@ brute_force(const char *name) } } -#if USE_CODE_LISTS +#if NCURSES_XNAMES +static void +dump_xname(NCURSES_CONST char *cap) +{ + if (strlen(cap) == 2) + dumpit(cap); +} +#endif + static void demo_termcap(NCURSES_CONST char *name) { - unsigned n; - NCURSES_CONST char *cap; char buffer[1024]; if (db_list) { putenv(next_dbitem()); } - printf("Terminal type \"%s\"\n", name); + if (!q_opt) + printf("Terminal type \"%s\"\n", name); if (tgetent(buffer, name) >= 0) { + NCURSES_CONST char *cap; + unsigned n; if (b_opt) { for (n = 0;; ++n) { - cap = boolcodes[n]; + cap = my_boolcodes[n]; if (cap == 0) break; dumpit(cap); @@ -275,7 +350,7 @@ demo_termcap(NCURSES_CONST char *name) if (n_opt) { for (n = 0;; ++n) { - cap = numcodes[n]; + cap = my_numcodes[n]; if (cap == 0) break; dumpit(cap); @@ -284,15 +359,383 @@ demo_termcap(NCURSES_CONST char *name) if (s_opt) { for (n = 0;; ++n) { - cap = strcodes[n]; + cap = my_strcodes[n]; if (cap == 0) break; dumpit(cap); } } +#ifdef NCURSES_VERSION + if (x_opt && (my_blob == 0) && y_opt) { +#if NCURSES_XNAMES + TERMTYPE *term = (TERMTYPE *) cur_term; + if (term != 0 + && ((NUM_BOOLEANS(term) != BOOLCOUNT) + || (NUM_NUMBERS(term) != NUMCOUNT) + || (NUM_STRINGS(term) != STRCOUNT))) { + for (n = BOOLCOUNT; n < NUM_BOOLEANS(term); ++n) { + dump_xname(ExtBoolname(term, (int) n, boolnames)); + } + for (n = NUMCOUNT; n < NUM_NUMBERS(term); ++n) { + dump_xname(ExtNumname(term, (int) n, numnames)); + } + for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) { + dump_xname(ExtStrname(term, (int) n, strnames)); + } + } +#endif + } +#endif } } +typedef enum { + pDefault = 0 + ,pComment + ,pDescription + ,pEscaped + ,pNewline + ,pName + ,pNumber + ,pString +} STATE; + +static void +parse_description(const char *input_name) +{ + static char empty[1]; + + FILE *fp; + struct stat sb; + size_t count_bools = 0; + size_t count_nums = 0; + size_t count_strs = 0; + size_t len; + size_t j, k; + STATE state; + + if (stat(input_name, &sb) != 0 + || (sb.st_mode & S_IFMT) != S_IFREG) { + failed("input is not a file"); + } + + if (sb.st_size == 0) { + failed("input is empty"); + } + + /* + * None of the arrays could be larger than the input-file, and since it + * is small, just allocate the maximum for simplicity. + */ + if ((my_blob = malloc((size_t) sb.st_size + 1)) == 0 || + (my_boolcodes = typeCalloc(char *, sb.st_size)) == 0 || + (my_numcodes = typeCalloc(char *, sb.st_size)) == 0 || + (my_numvalues = typeCalloc(char *, sb.st_size)) == 0 || + (my_strcodes = typeCalloc(char *, sb.st_size)) == 0 || + (my_strvalues = typeCalloc(char *, sb.st_size)) == 0) { + failed("cannot allocate memory for input-file"); + } + + if ((fp = fopen(input_name, "r")) == 0) + failed("cannot open input-file"); + len = fread(my_blob, sizeof(char), (size_t) sb.st_size, fp); + my_blob[sb.st_size] = '\0'; + fclose(fp); + + /* + * First, get rid of comments and escaped newlines, as well as repeated + * colons to construct a canonical entry. + * + * FIXME: actually this should make an additional pass just to strip + * comment-lines and escaped newlines. But it is workable for infocmp + * output. + */ + state = pNewline; + for (j = k = 0; j < len; ++j) { + int ch = my_blob[j]; + if (ch == '\t') { + ch = ' '; + } + switch (state) { + case pNewline: + if (ch == ' ') { + continue; + } + if (ch == '#') { + state = pComment; + continue; + } + state = pDefault; + /* FALLTHRU */ + case pDefault: + switch (ch) { + case '|': + state = pDescription; + continue; + case '\\': + state = pEscaped; + continue; + case '\n': + state = pNewline; + continue; + case ' ': + case ':': + break; + default: + state = pName; + break; + } + my_blob[k++] = (char) ch; + break; + case pComment: + if (ch == '\n') + state = pNewline; + break; + case pDescription: + switch (ch) { + case ':': + state = pDefault; + break; + case '\n': + state = pNewline; + break; + } + break; + case pEscaped: + if (ch != '\n') { + my_blob[k++] = (char) ch; + state = pDefault; + } else { + state = pNewline; + } + break; + case pName: + switch (ch) { + case '\n': + state = pNewline; + continue; + case ' ': + case ':': + state = pDefault; + break; + case '#': + state = pNumber; + break; + case '|': + state = pDescription; + continue; + } + my_blob[k++] = (char) ch; + break; + case pNumber: + switch (ch) { + case '\n': + state = pNewline; + continue; + case ':': + state = pDefault; + break; + case ' ': + state = pDefault; + continue; + } + my_blob[k++] = (char) ch; + break; + case pString: + switch (ch) { + case '\\': + if (my_blob[j + 1] == '\0') { + state = pDefault; + continue; + } + break; + case '\n': + state = pNewline; + continue; + case ':': + state = pDefault; + break; + } + my_blob[k++] = (char) ch; + break; + default: + /* not used */ + break; + } + } + my_blob[k] = '\0'; + + /* + * Then, parse what's left, making indexes of the names and values. + */ + state = pDefault; + for (j = 0; my_blob[j] != '\0'; ++j) { + switch (state) { + case pDefault: + switch (my_blob[j]) { + case '\\': + state = pEscaped; + break; + case ':': + my_blob[j] = '\0'; + if (my_blob[j + 1] != '\0' && my_blob[j + 1] != ':') + state = pName; + break; + case ' ': + break; + default: + break; + } + case pEscaped: + break; + case pName: + state = pDefault; + /* + * Commented-out capabilities might be accessible (they are in + * ncurses). + */ + if (my_blob[j] == '.' && my_blob[j + 1] == '.') { + j += 2; + } + if (my_blob[j + 1] != '\0') { + switch (my_blob[j + 2]) { + case '#': + my_numvalues[count_nums] = &my_blob[j + 3]; + my_numcodes[count_nums++] = &my_blob[j]; + my_blob[j + 2] = '\0'; + state = pNumber; + j += 2; + break; + case '=': + my_strvalues[count_strs] = &my_blob[j + 3]; + my_strcodes[count_strs++] = &my_blob[j]; + my_blob[j + 2] = '\0'; + state = pString; + j += 2; + break; + default: + if (my_blob[j + 2] == '@') { + /* + * We cannot get the type for a cancelled item + * directly, but can infer it assuming the input + * came from infocmp, which puts the data in a + * known order. + */ + if (count_strs) { + my_strvalues[count_strs] = empty; + my_strcodes[count_strs++] = &my_blob[j]; + } else if (count_nums) { + my_numvalues[count_nums] = empty; + my_numcodes[count_nums++] = &my_blob[j]; + } else { + my_boolcodes[count_bools++] = &my_blob[j]; + } + } else { + my_boolcodes[count_bools++] = &my_blob[j]; + } + j++; + break; + } + } + break; + case pNumber: + if (!isdigit(UChar(my_blob[j]))) { + --j; + state = pDefault; + } + break; + case pString: + switch (my_blob[j]) { + case '\\': + if (my_blob[j + 1] == '\0') { + state = pDefault; + continue; + } else { + ++j; + } + break; + case '\n': + state = pNewline; + continue; + case ':': + --j; + state = pDefault; + break; + } + break; + case pNewline: + case pComment: + case pDescription: + default: + break; + } + } + my_boolcodes[count_bools] = 0; + my_numcodes[count_nums] = 0; + my_numvalues[count_nums] = 0; + my_strcodes[count_strs] = 0; + my_strvalues[count_strs] = 0; + +#if 0 + printf("bools:%d\n", (int) count_bools); + for (j = 0; my_boolcodes[j]; ++j) + printf("%5d:%s\n", (int) j, my_boolcodes[j]); + + printf("numbers:%d\n", (int) count_nums); + for (j = 0; my_numcodes[j]; ++j) + printf("%5d:%s(%s)\n", (int) j, my_numcodes[j], my_numvalues[j]); + + printf("strings:%d\n", (int) count_strs); + for (j = 0; my_strcodes[j]; ++j) + printf("%5d:%s(%s)\n", (int) j, my_strcodes[j], my_strvalues[j]); +#endif +} + +#if USE_CODE_LISTS +static char ** +copy_code_list(NCURSES_CONST char *const *list) +{ + int pass; + size_t count; + size_t length = 1; + char **result = 0; + char *unused = 0; + + for (pass = 0; pass < 2; ++pass) { + for (count = 0; list[count] != 0; ++count) { + size_t chunk = strlen(list[count]) + 1; + if (pass == 0) { + length += chunk; + } else { + result[count] = unused; + _nc_STRCPY(unused, list[count], length); + unused += chunk; + } + } + if (pass == 0) { + char *blob = malloc(length); + result = typeCalloc(char *, count + 1); + unused = blob; + if (blob == 0 || result == 0) + failed("copy_code_list failed"); + } + } + + return result; +} + +#if NO_LEAKS +static void +free_code_list(char **list) +{ + if (list) { + free(list[0]); + free(list); + } +} +#endif /* NO_LEAKS */ +#endif /* USE_CODE_LISTS */ + static void usage(void) { @@ -308,12 +751,14 @@ usage(void) " -b print boolean-capabilities", " -d LIST colon-separated list of databases to use", " -e NAME environment variable to set with -d option", + " -i NAME terminal description to use as names for \"-a\" option, etc.", " -n print numeric-capabilities", " -q quiet (prints only counts)", " -r COUNT repeat for given count", " -s print string-capabilities", + " -v print termcap-variables", #ifdef NCURSES_VERSION - " -y disable extended capabilities", + " -x print extended capabilities", #endif }; unsigned n; @@ -322,7 +767,6 @@ usage(void) } ExitProgram(EXIT_FAILURE); } -#endif int main(int argc, char *argv[]) @@ -330,12 +774,15 @@ main(int argc, char *argv[]) int n; char *name; bool a_opt = FALSE; +#if defined(NCURSES_VERSION) || defined(HAVE_CURSES_DATA_OSPEED) + bool v_opt = FALSE; +#endif + char *input_name = 0; -#if USE_CODE_LISTS int repeat; int r_opt = 1; - while ((n = getopt(argc, argv, "abd:e:nqr:sy")) != -1) { + while ((n = getopt(argc, argv, "abd:e:i:nqr:svxy")) != -1) { switch (n) { case 'a': a_opt = TRUE; @@ -349,6 +796,9 @@ main(int argc, char *argv[]) case 'e': e_opt = optarg; break; + case 'i': + input_name = optarg; + break; case 'n': n_opt = TRUE; break; @@ -362,10 +812,21 @@ main(int argc, char *argv[]) case 's': s_opt = TRUE; break; +#if defined(NCURSES_VERSION) || defined(HAVE_CURSES_DATA_OSPEED) + case 'v': + v_opt = TRUE; + break; +#endif +#ifdef NCURSES_VERSION #if NCURSES_XNAMES + case 'x': + x_opt = TRUE; + break; case 'y': - use_extended_names(FALSE); + y_opt = TRUE; + x_opt = TRUE; break; +#endif #endif default: usage(); @@ -373,31 +834,46 @@ main(int argc, char *argv[]) } } +#if HAVE_USE_EXTENDED_NAMES + use_extended_names(x_opt); +#endif + if (!(b_opt || n_opt || s_opt)) { b_opt = TRUE; n_opt = TRUE; s_opt = TRUE; } -#else - a_opt = TRUE; -#endif make_dblist(); if (a_opt) { - if (optind < argc) { - for (n = optind; n < argc; ++n) { - brute_force(argv[n]); + for (repeat = 0; repeat < r_opt; ++repeat) { + if (optind < argc) { + for (n = optind; n < argc; ++n) { + brute_force(argv[n]); + } + } else if ((name = getenv("TERM")) != 0) { + brute_force(name); + } else { + static char dumb[] = "dumb"; + brute_force(dumb); } - } else if ((name = getenv("TERM")) != 0) { - brute_force(name); - } else { - static char dumb[] = "dumb"; - brute_force(dumb); } - } + } else { + if (input_name != 0) { + parse_description(input_name); + } #if USE_CODE_LISTS - else { + else { + my_boolcodes = copy_code_list(boolcodes); + my_numcodes = copy_code_list(numcodes); + my_strcodes = copy_code_list(strcodes); + } +#else + else { + failed("no capability-lists available (use -i option)"); + } +#endif /* USE_CODE_LISTS */ for (repeat = 0; repeat < r_opt; ++repeat) { if (optind < argc) { for (n = optind; n < argc; ++n) { @@ -411,11 +887,27 @@ main(int argc, char *argv[]) } } } -#endif /* USE_CODE_LISTS */ - printf("%ld values\n", total_values); + printf("%ld values (%ld booleans, %ld numbers, %ld strings)\n", + total_values, total_b_values, total_n_values, total_s_values); +#if defined(NCURSES_VERSION) || defined(HAVE_CURSES_DATA_OSPEED) + if (v_opt) { + show_number("PC", PC); + show_string("UP", UP); + show_string("BC", BC); + show_number("ospeed", (int) ospeed); + } +#endif + +#if NO_LEAKS free_dblist(); +#if USE_CODE_LISTS + free_code_list(my_boolcodes); + free_code_list(my_numcodes); + free_code_list(my_strcodes); +#endif +#endif /* NO_LEAKS */ ExitProgram(EXIT_SUCCESS); } @@ -425,7 +917,6 @@ int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - printf("This program requires termcap\n"); - ExitProgram(EXIT_FAILURE); + failed("This program requires termcap"); } #endif diff --git a/test/demo_terminfo.c b/test/demo_terminfo.c index 239739a47a8f..6e52e990b5e8 100644 --- a/test/demo_terminfo.c +++ b/test/demo_terminfo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2009-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 2009-2017,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,12 +29,13 @@ /* * Author: Thomas E. Dickey * - * $Id: demo_terminfo.c,v 1.19 2013/09/28 21:50:01 tom Exp $ + * $Id: demo_terminfo.c,v 1.49 2019/08/24 23:11:01 tom Exp $ * * A simple demo of the terminfo interface. */ #define USE_TINFO #include +#include #if NCURSES_XNAMES #if HAVE_TERM_ENTRY_H @@ -45,31 +46,60 @@ #endif #endif +static void failed(const char *) GCC_NORETURN; + +static void +failed(const char *msg) +{ + fprintf(stderr, "%s\n", msg); + ExitProgram(EXIT_FAILURE); +} + #if HAVE_TIGETSTR + #if defined(HAVE_CURSES_DATA_BOOLNAMES) || defined(DECL_CURSES_DATA_BOOLNAMES) +#define USE_CODE_LISTS 1 +#else +#define USE_CODE_LISTS 0 +#endif +static bool a_opt = FALSE; static bool b_opt = FALSE; static bool f_opt = FALSE; static bool n_opt = FALSE; static bool q_opt = FALSE; static bool s_opt = FALSE; +#ifdef NCURSES_VERSION static bool x_opt = FALSE; +static bool y_opt = FALSE; +#endif static char *d_opt; static char *e_opt; static char **db_list; static int db_item; +static char *my_blob; +static char **my_boolcodes; +static char **my_numcodes; +static char **my_numvalues; +static char **my_strcodes; +static char **my_strvalues; + static long total_values; +static long total_b_values; +static long total_n_values; +static long total_s_values; #define FCOLS 8 -#define FNAME(type) "%s %-*s = ", #type, FCOLS +#define FNAME(type) "%s %-*s = ", #type, f_opt ? 24 : FCOLS static char * make_dbitem(char *p, char *q) { - char *result = malloc(strlen(e_opt) + 2 + (size_t) (p - q)); - sprintf(result, "%s=%.*s", e_opt, (int) (p - q), q); + size_t need = strlen(e_opt) + 2 + (size_t) (p - q); + char *result = malloc(need); + _nc_SPRINTF(result, _nc_SLIMIT(need) "%s=%.*s", e_opt, (int) (p - q), q); return result; } @@ -120,10 +150,12 @@ next_dbitem(void) db_item++; } } - printf("** %s\n", result); + if (result != 0) + printf("** %s\n", result); return result; } +#if NO_LEAKS static void free_dblist(void) { @@ -135,27 +167,19 @@ free_dblist(void) db_list = 0; } } +#endif + static void -dumpit(NCURSES_CONST char *cap) +dumpit(NCURSES_CONST char *cap, const char *show) { - /* - * One of the limitations of the termcap interface is that the library - * cannot determine the size of the buffer passed via tgetstr(), nor the - * amount of space remaining. This demo simply reuses the whole buffer - * for each call; a normal termcap application would try to use the buffer - * to hold all of the strings extracted from the terminal entry. - */ const char *str; int num; if ((str = tigetstr(cap)) != 0 && (str != (char *) -1)) { total_values++; + total_s_values++; if (!q_opt) { - /* - * Note that the strings returned are mostly terminfo format, since - * ncurses does not convert except for a handful of special cases. - */ - printf(FNAME(str), cap); + printf(FNAME(str), show ? show : cap); while (*str != 0) { int ch = UChar(*str++); switch (ch) { @@ -206,14 +230,16 @@ dumpit(NCURSES_CONST char *cap) } } else if ((num = tigetnum(cap)) >= 0) { total_values++; + total_n_values++; if (!q_opt) { - printf(FNAME(num), cap); + printf(FNAME(num), show ? show : cap); printf(" %d\n", num); } } else if ((num = tigetflag(cap)) >= 0) { total_values++; + total_b_values++; if (!q_opt) { - printf(FNAME(flg), cap); + printf(FNAME(flg), show ? show : cap); printf("%s\n", num ? "true" : "false"); } } @@ -222,6 +248,80 @@ dumpit(NCURSES_CONST char *cap) fflush(stdout); } +#define isCapName(c) (isalnum(UChar(c)) || ((c) == '_')) +#define LegalItem(c,n) (n) + +static void +brute_force(const char *name) +{ +#define MAX_FORCE 5 /* omit "colors", since CPU-time is a problem */ + static const char legal[] = "\ +0123456789\ +ABCDEFGHIJKLMNOPQRSTUVWXYZ\ +abcdefghijklmnopqrstuvwxyz_"; + int length; + int j, k; + bool carry; + bool changed; + char cap[MAX_FORCE + 1]; + int item[MAX_FORCE + 1]; + + if (db_list) { + putenv(next_dbitem()); + } + if (!q_opt) + printf("Terminal type \"%s\"\n", name); + setupterm((NCURSES_CONST char *) name, 1, (int *) 0); + if (!q_opt) { + if (strcmp(name, ttytype)) + printf("... actual \"%s\"\n", ttytype); + } + + for (length = 1; length <= MAX_FORCE; ++length) { + /* set all digits to zeros */ + for (j = 0; j < length; ++j) { + item[j] = LegalItem(j, 0); + } + + do { + changed = FALSE; + /* copy digits to cap-name */ + for (j = 0; j < length; ++j) { + cap[j] = legal[item[j]]; + } + cap[length] = '\0'; + dumpit(cap, NULL); + + k = length - 1; + do { + carry = FALSE; + for (; k >= 0; --k) { + item[k] += 1; + if (legal[item[k]]) { + changed = TRUE; + break; + } + if (k > 0 && + legal[item[k - 1] + 1]) { + for (j = k; j < length; ++j) { + item[j] = LegalItem(j, 0); + } + carry = TRUE; + changed = TRUE; + } + } + } while (carry); + } while (changed); + } + del_curterm(cur_term); +} + +#if USE_CODE_LISTS +#define fullname(type,n) f_opt ? type##fnames[n] : cap +#else +#define fullname(type,n) cap +#endif + static void demo_terminfo(char *name) { @@ -231,53 +331,53 @@ demo_terminfo(char *name) if (db_list) { putenv(next_dbitem()); } - printf("Terminal type \"%s\"\n", name); + if (!q_opt) + printf("Terminal type \"%s\"\n", name); setupterm(name, 1, (int *) 0); if (b_opt) { for (n = 0;; ++n) { - cap = f_opt ? boolfnames[n] : boolnames[n]; + cap = my_boolcodes[n]; if (cap == 0) break; - dumpit(cap); + dumpit(cap, fullname(bool, n)); } } if (n_opt) { for (n = 0;; ++n) { - cap = f_opt ? numfnames[n] : numnames[n]; + cap = my_numcodes[n]; if (cap == 0) break; - dumpit(cap); + dumpit(cap, fullname(num, n)); } } if (s_opt) { for (n = 0;; ++n) { - cap = f_opt ? strfnames[n] : strnames[n]; + cap = my_strcodes[n]; if (cap == 0) break; - dumpit(cap); + dumpit(cap, fullname(str, n)); } } #ifdef NCURSES_VERSION - if (x_opt) { - int mod; - if (f_opt) { + if (x_opt && (my_blob == 0)) { + if (y_opt) { #if NCURSES_XNAMES - TERMTYPE *term = &(cur_term->type); + TERMTYPE *term = (TERMTYPE *) cur_term; if (term != 0 && ((NUM_BOOLEANS(term) != BOOLCOUNT) || (NUM_NUMBERS(term) != NUMCOUNT) || (NUM_STRINGS(term) != STRCOUNT))) { for (n = BOOLCOUNT; n < NUM_BOOLEANS(term); ++n) { - dumpit(ExtBoolname(term, (int) n, boolnames)); + dumpit(ExtBoolname(term, (int) n, boolnames), NULL); } for (n = NUMCOUNT; n < NUM_NUMBERS(term); ++n) { - dumpit(ExtNumname(term, (int) n, numnames)); + dumpit(ExtNumname(term, (int) n, numnames), NULL); } for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) { - dumpit(ExtStrname(term, (int) n, strnames)); + dumpit(ExtStrname(term, (int) n, strnames), NULL); } } #endif @@ -289,20 +389,383 @@ demo_terminfo(char *name) "kLFT", "kNXT", "kPRV", "kRIT", "kUP", }; for (n = 0; n < SIZEOF(xterm_keys); ++n) { + int mod; for (mod = 0; mod < 8; ++mod) { - if (mod == 0) - sprintf(temp, "%.*s", 8, xterm_keys[n]); - else - sprintf(temp, "%.*s%d", 8, xterm_keys[n], mod); - dumpit(temp); + if (mod == 0) { + /* these happen to be standard - avoid duplicates */ + if (!strcmp(xterm_keys[n], "kDC") || + !strcmp(xterm_keys[n], "kEND") || + !strcmp(xterm_keys[n], "kHOM") || + !strcmp(xterm_keys[n], "kLFT") || + !strcmp(xterm_keys[n], "kRIT")) { + continue; + } + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "%.*s", 8, xterm_keys[n]); + } else { + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "%.*s%d", 8, xterm_keys[n], mod); + } + dumpit(temp, NULL); } } } } #endif + del_curterm(cur_term); +} +typedef enum { + pDefault = 0 + ,pComment + ,pDescription + ,pEscaped + ,pNewline + ,pName + ,pNumber + ,pString +} STATE; + +static void +parse_description(const char *input_name) +{ + static char empty[1]; + + FILE *fp; + struct stat sb; + size_t count_bools = 0; + size_t count_nums = 0; + size_t count_strs = 0; + size_t len; + size_t j, k, jl; + STATE state; + + if (stat(input_name, &sb) != 0 + || (sb.st_mode & S_IFMT) != S_IFREG) { + failed("input is not a file"); + } + + if (sb.st_size == 0) { + failed("input is empty"); + } + + /* + * None of the arrays could be larger than the input-file, and since it + * is small, just allocate the maximum for simplicity. + */ + if ((my_blob = malloc((size_t) sb.st_size + 1)) == 0 || + (my_boolcodes = typeCalloc(char *, sb.st_size)) == 0 || + (my_numcodes = typeCalloc(char *, sb.st_size)) == 0 || + (my_numvalues = typeCalloc(char *, sb.st_size)) == 0 || + (my_strcodes = typeCalloc(char *, sb.st_size)) == 0 || + (my_strvalues = typeCalloc(char *, sb.st_size)) == 0) { + failed("cannot allocate memory for input-file"); + } + + if ((fp = fopen(input_name, "r")) == 0) + failed("cannot open input-file"); + len = fread(my_blob, sizeof(char), (size_t) sb.st_size, fp); + my_blob[sb.st_size] = '\0'; + fclose(fp); + + /* + * First, get rid of comments and escaped newlines, as well as repeated + * colons to construct a canonical entry. + */ + state = pNewline; + for (j = k = 0; j < len; ++j) { + int ch = my_blob[j]; + if (ch == '\t') { + ch = ' '; + } + switch (state) { + case pNewline: + if (ch == ' ') { + continue; + } + if (ch == '#') { + state = pComment; + continue; + } + state = pDefault; + /* FALLTHRU */ + case pDefault: + switch (ch) { + case '|': + state = pDescription; + continue; + case '\\': + state = pEscaped; + continue; + case '\n': + state = pNewline; + continue; + case ' ': + break; + case ',': + my_blob[k++] = (char) ch; + break; + default: + if (isalpha(UChar(ch))) + state = pName; + else + fprintf(stderr, "OOPS @%d:%.20s\n", __LINE__, my_blob + j); + my_blob[k++] = (char) ch; + break; + } + break; + case pComment: + if (ch == '\n') + state = pNewline; + break; + case pDescription: + switch (ch) { + case ',': + state = pDefault; + break; + case '\n': + state = pNewline; + break; + } + break; + case pEscaped: + if (ch != '\n') { + my_blob[k++] = (char) ch; + state = pDefault; + } else { + state = pNewline; + } + break; + case pName: + switch (ch) { + case '\n': + state = pNewline; + continue; + case ' ': + case ',': + state = pDefault; + break; + case '#': + state = pNumber; + break; + case '=': + state = pString; + break; + case '|': + state = pDescription; + continue; + } + my_blob[k++] = (char) ch; + break; + case pNumber: + switch (ch) { + case '\n': + state = pNewline; + continue; + case ',': + state = pDefault; + break; + case ' ': + state = pDefault; + continue; + } + my_blob[k++] = (char) ch; + break; + case pString: + switch (ch) { + case '\n': + state = pNewline; + break; + case ',': + state = pDefault; + my_blob[k++] = (char) ch; + break; + default: + my_blob[k++] = (char) ch; + break; + } + break; + default: + /* not used */ + break; + } + } + my_blob[k] = '\0'; + + /* + * Then, parse what's left, making indexes of the names and values. + */ + state = pDefault; + for (j = 0; my_blob[j] != '\0'; ++j) { + switch (state) { + case pDefault: + switch (my_blob[j]) { + case '\\': + state = pEscaped; + break; + case ',': + my_blob[j] = '\0'; + if (my_blob[j + 1] != '\0' && my_blob[j + 1] != ',') + state = pName; + break; + case ' ': + break; + default: + break; + } + case pEscaped: + break; + case pName: + state = pDefault; + if (isalpha(UChar(my_blob[j]))) { + for (jl = 1; isalnum(UChar(my_blob[j + jl])); ++jl) { + ; + } + } else { + jl = 0; + } + if (jl != 0) { + switch (my_blob[j + jl]) { + case '#': + my_numvalues[count_nums] = &my_blob[j + jl + 1]; + my_numcodes[count_nums++] = &my_blob[j]; + my_blob[j + jl] = '\0'; + state = pNumber; + j += jl; + break; + case '=': + my_strvalues[count_strs] = &my_blob[j + jl + 1]; + my_strcodes[count_strs++] = &my_blob[j]; + my_blob[j + jl] = '\0'; + state = pString; + j += jl; + break; + default: + if (my_blob[j + jl] == '@') { + /* + * We cannot get the type for a cancelled item + * directly, but can infer it assuming the input + * came from infocmp, which puts the data in a + * known order. + */ + if (count_strs) { + my_strvalues[count_strs] = empty; + my_strcodes[count_strs++] = &my_blob[j]; + } else if (count_nums) { + my_numvalues[count_nums] = empty; + my_numcodes[count_nums++] = &my_blob[j]; + } else { + my_boolcodes[count_bools++] = &my_blob[j]; + } + my_blob[j + jl] = '\0'; + j += jl + 1; + } else { + my_boolcodes[count_bools++] = &my_blob[j]; + my_blob[j + jl] = '\0'; + j += jl; + } + state = (isCapName(my_blob[j + 1]) + ? pName + : pDefault); + break; + } + } + break; + case pNumber: + if (!isdigit(UChar(my_blob[j]))) { + --j; + state = pDefault; + } + break; + case pString: + switch (my_blob[j]) { + case '\\': + if (my_blob[j + 1] != '\0') { + ++j; + } else { + --j; + state = pDefault; + } + break; + case ',': + --j; + state = pDefault; + break; + } + break; + case pNewline: + case pComment: + case pDescription: + default: + break; + } + } + my_boolcodes[count_bools] = 0; + my_numcodes[count_nums] = 0; + my_numvalues[count_nums] = 0; + my_strcodes[count_strs] = 0; + my_strvalues[count_strs] = 0; + +#if 0 + printf("# bools:%d\n", (int) count_bools); + for (j = 0; my_boolcodes[j]; ++j) + printf("\t%s,\n", my_boolcodes[j]); + + printf("# numbers:%d\n", (int) count_nums); + for (j = 0; my_numcodes[j]; ++j) + printf("\t%s#%s,\n", my_numcodes[j], my_numvalues[j]); + + printf("# strings:%d\n", (int) count_strs); + for (j = 0; my_strcodes[j]; ++j) + printf("\t%s=%s,\n", my_strcodes[j], my_strvalues[j]); +#endif } +#if USE_CODE_LISTS +static char ** +copy_code_list(NCURSES_CONST char *const *list) +{ + int pass; + size_t count; + size_t length = 1; + char **result = 0; + char *unused = 0; + + for (pass = 0; pass < 2; ++pass) { + for (count = 0; list[count] != 0; ++count) { + size_t chunk = strlen(list[count]) + 1; + if (pass == 0) { + length += chunk; + } else { + result[count] = unused; + _nc_STRCPY(unused, list[count], length); + unused += chunk; + } + } + if (pass == 0) { + char *blob = malloc(length); + result = typeCalloc(char *, count + 1); + unused = blob; + if (blob == 0 || result == 0) + failed("copy_code_list failed"); + } + } + + return result; +} + +#if NO_LEAKS +static void +free_code_list(char **list) +{ + if (list) { + free(list[0]); + free(list); + } +} +#endif +#endif /* USE_CODE_LISTS */ + static void usage(void) { @@ -314,17 +777,19 @@ usage(void) "capabilities for the given terminal, using short names.", "", "Options:", + " -a try all names, print capabilities found", " -b print boolean-capabilities", " -d LIST colon-separated list of databases to use", " -e NAME environment variable to set with -d option", " -f print full names", + " -i NAME terminal description to use as names for \"-a\" option", " -n print numeric-capabilities", " -q quiet (prints only counts)", " -r COUNT repeat for given count", " -s print string-capabilities", #ifdef NCURSES_VERSION " -x print extended capabilities", - " -y disable extended capabilities", + " -y direct-lookup names of extended capabilities", #endif }; unsigned n; @@ -341,12 +806,13 @@ main(int argc, char *argv[]) int repeat; char *name; int r_opt = 1; -#ifdef NCURSES_VERSION - bool xy_opt = TRUE; /* by default, use_extended_names is true */ -#endif + char *input_name = 0; - while ((n = getopt(argc, argv, "bd:e:fnqr:sxy")) != -1) { + while ((n = getopt(argc, argv, "abd:e:fi:nqr:sxy")) != -1) { switch (n) { + case 'a': + a_opt = TRUE; + break; case 'b': b_opt = TRUE; break; @@ -359,6 +825,9 @@ main(int argc, char *argv[]) case 'f': f_opt = TRUE; break; + case 'i': + input_name = optarg; + break; case 'n': n_opt = TRUE; break; @@ -375,10 +844,10 @@ main(int argc, char *argv[]) #ifdef NCURSES_VERSION case 'x': x_opt = TRUE; - xy_opt = TRUE; break; case 'y': - xy_opt = FALSE; + y_opt = TRUE; + x_opt = TRUE; break; #endif default: @@ -387,11 +856,11 @@ main(int argc, char *argv[]) } } -#if NCURSES_XNAMES - use_extended_names(xy_opt); +#if HAVE_USE_EXTENDED_NAMES + use_extended_names(x_opt); #endif - if (!(b_opt || n_opt || s_opt || x_opt)) { + if (!(b_opt || n_opt || s_opt)) { b_opt = TRUE; n_opt = TRUE; s_opt = TRUE; @@ -399,39 +868,84 @@ main(int argc, char *argv[]) make_dblist(); - for (repeat = 0; repeat < r_opt; ++repeat) { - if (optind < argc) { - for (n = optind; n < argc; ++n) { - demo_terminfo(argv[n]); + if (a_opt) { + for (repeat = 0; repeat < r_opt; ++repeat) { + if (optind < argc) { + for (n = optind; n < argc; ++n) { + brute_force(argv[n]); + } + } else if ((name = getenv("TERM")) != 0) { + brute_force(name); + } else { + static char dumb[] = "dumb"; + brute_force(dumb); + } + } + } else { + if (input_name != 0) { + parse_description(input_name); + } +#if USE_CODE_LISTS + else { + my_boolcodes = copy_code_list(boolnames); + my_numcodes = copy_code_list(numnames); + my_strcodes = copy_code_list(strnames); + } +#else + else { + failed("no capability-lists available (use -i option)"); + } +#endif /* USE_CODE_LISTS */ + for (repeat = 0; repeat < r_opt; ++repeat) { + if (optind < argc) { + for (n = optind; n < argc; ++n) { + demo_terminfo(argv[n]); + } + } else if ((name = getenv("TERM")) != 0) { + demo_terminfo(name); + } else { + static char dumb[] = "dumb"; + demo_terminfo(dumb); } - } else if ((name = getenv("TERM")) != 0) { - demo_terminfo(name); - } else { - static char dumb[] = "dumb"; - demo_terminfo(dumb); } } - printf("%ld values\n", total_values); +#define PLURAL(n) n, (n != 1) ? "s" : "" + printf("%ld value%s (%ld boolean%s, %ld number%s, %ld string%s)\n", + PLURAL(total_values), + PLURAL(total_b_values), + PLURAL(total_n_values), + PLURAL(total_s_values)); +#if NO_LEAKS free_dblist(); + if (input_name != 0) { + if (my_blob != 0) { + free(my_blob); + free(my_boolcodes); + free(my_numcodes); + free(my_numvalues); + free(my_strcodes); + free(my_strvalues); + } + } +#if USE_CODE_LISTS + else { + free_code_list(my_boolcodes); + free_code_list(my_numcodes); + free_code_list(my_strcodes); + } +#endif +#endif /* NO_LEAKS */ ExitProgram(EXIT_SUCCESS); } -#else -int -main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) -{ - printf("This program requires the terminfo arrays\n"); - ExitProgram(EXIT_FAILURE); -} -#endif #else /* !HAVE_TIGETSTR */ int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - printf("This program requires the terminfo functions such as tigetstr\n"); + failed("This program requires the terminfo functions such as tigetstr"); ExitProgram(EXIT_FAILURE); } #endif /* HAVE_TIGETSTR */ diff --git a/test/ditto.c b/test/ditto.c index 921f216bb561..a6b8ac3f813d 100644 --- a/test/ditto.c +++ b/test/ditto.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey (1998-on) * - * $Id: ditto.c,v 1.42 2012/11/24 20:16:18 tom Exp $ + * $Id: ditto.c,v 1.48 2018/05/20 19:19:10 tom Exp $ * * The program illustrates how to set up multiple screens from a single * program. @@ -44,6 +44,8 @@ #include #include +#if HAVE_DELSCREEN + #ifdef USE_PTHREADS #include #endif @@ -112,7 +114,7 @@ failed(const char *s) static void usage(void) { - fprintf(stderr, "usage: ditto [terminal1 ...]\n"); + fprintf(stderr, "Usage: ditto [terminal1 ...]\n"); ExitProgram(EXIT_FAILURE); } @@ -155,6 +157,10 @@ open_tty(char *path) int aslave; char slave_name[1024]; char s_option[sizeof(slave_name) + 80]; + const char *xterm_prog = 0; + + if ((xterm_prog = getenv("XTERM_PROG")) == 0) + xterm_prog = "xterm"; if (openpty(&amaster, &aslave, slave_name, 0, 0) != 0 || strlen(slave_name) > sizeof(slave_name) - 1) @@ -163,9 +169,10 @@ open_tty(char *path) errno = EISDIR; failed(slave_name); } - sprintf(s_option, "-S%s/%d", slave_name, aslave); + _nc_SPRINTF(s_option, _nc_SLIMIT(sizeof(s_option)) + "-S%s/%d", slave_name, aslave); if (fork()) { - execlp("xterm", "xterm", s_option, "-title", path, (char *) 0); + execlp(xterm_prog, xterm_prog, s_option, "-title", path, (char *) 0); _exit(0); } fp = fdopen(amaster, "r+"); @@ -189,7 +196,7 @@ open_tty(char *path) return fp; } -static void +static int init_screen( #if HAVE_USE_WINDOW SCREEN *sp GCC_UNUSED, @@ -229,6 +236,7 @@ init_screen( target->windows[k] = inner; } doupdate(); + return TRUE; } static void @@ -445,3 +453,11 @@ main(int argc, char *argv[]) } ExitProgram(EXIT_SUCCESS); } +#else +int +main(void) +{ + printf("This program requires the curses delscreen function\n"); + ExitProgram(EXIT_FAILURE); +} +#endif diff --git a/test/dots.c b/test/dots.c index 474d8805179e..bd3c30bb71d4 100644 --- a/test/dots.c +++ b/test/dots.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999-2011,2013 Free Software Foundation, Inc. * + * Copyright (c) 1999-2017,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey 1999 * - * $Id: dots.c,v 1.25 2013/09/28 22:12:09 tom Exp $ + * $Id: dots.c,v 1.35 2019/08/24 21:49:50 tom Exp $ * * A simple demo of the terminfo interface. */ @@ -40,8 +40,6 @@ #include -#define valid(s) ((s != 0) && s != (char *)-1) - static bool interrupted = FALSE; static long total_chars = 0; static time_t started; @@ -64,7 +62,7 @@ TPUTS_PROTO(outc, c) static bool outs(const char *s) { - if (valid(s)) { + if (VALID_STRING(s)) { tputs(s, 1, outc); return TRUE; } @@ -80,7 +78,7 @@ cleanup(void) outs(clear_screen); outs(cursor_normal); - printf("\n\n%ld total chars, rate %.2f/sec\n", + printf("\n\n%ld total cells, rate %.2f/sec\n", total_chars, ((double) (total_chars) / (double) (time((time_t *) 0) - started))); } @@ -98,54 +96,125 @@ ranf(void) return ((double) r / 32768.); } +static int +get_number(NCURSES_CONST char *cap, int map) +{ + int result = map; + if (cap != 0) { + int check = tigetnum(cap); + if (check > 0) + result = check; + } + return result; +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: dots [options]" + ,"" + ,"Options:" + ," -T TERM override $TERM" +#if HAVE_USE_ENV + ," -e allow environment $LINES / $COLUMNS" +#endif + ," -f use tigetnum rather than mapping" + ," -m SIZE set margin (default: 2)" + ," -s MSECS delay 1% of the time (default: 1 msecs)" + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(EXIT_FAILURE); +} + int -main(int argc GCC_UNUSED, - char *argv[]GCC_UNUSED) +main(int argc, + char *argv[]) { - int x, y, z, p; + int ch; double r; double c; int my_colors; + int f_option = 0; + int m_option = 2; + int s_option = 1; + size_t need; + char *my_env; + + while ((ch = getopt(argc, argv, "T:efm:s:")) != -1) { + switch (ch) { + case 'T': + need = 6 + strlen(optarg); + my_env = malloc(need); + _nc_SPRINTF(my_env, _nc_SLIMIT(need) "TERM=%s", optarg); + putenv(my_env); + break; +#if HAVE_USE_ENV + case 'e': + use_env(TRUE); + break; +#endif + case 'f': + f_option = 1; + break; + case 'm': + m_option = atoi(optarg); + break; + case 's': + s_option = atoi(optarg); + break; + default: + usage(); + break; + } + } - CATCHALL(onsig); + InitAndCatch(setupterm((char *) 0, 1, (int *) 0), onsig); srand((unsigned) time(0)); - setupterm((char *) 0, 1, (int *) 0); + outs(clear_screen); outs(cursor_invisible); - my_colors = max_colors; + +#define GetNumber(ln,sn) get_number(f_option ? #sn : 0, ln) + my_colors = GetNumber(max_colors, colors); if (my_colors > 1) { - if (!valid(set_a_foreground) - || !valid(set_a_background) - || (!valid(orig_colors) && !valid(orig_pair))) + if (!VALID_STRING(set_a_foreground) + || !VALID_STRING(set_a_background) + || (!VALID_STRING(orig_colors) && !VALID_STRING(orig_pair))) my_colors = -1; } - r = (double) (lines - 4); - c = (double) (columns - 4); + r = (double) (GetNumber(lines, lines) - (m_option * 2)); + c = (double) (GetNumber(columns, cols) - (m_option * 2)); started = time((time_t *) 0); while (!interrupted) { - x = (int) (c * ranf()) + 2; - y = (int) (r * ranf()) + 2; - p = (ranf() > 0.9) ? '*' : ' '; + int x = (int) (c * ranf()) + m_option; + int y = (int) (r * ranf()) + m_option; + int p = (ranf() > 0.9) ? '*' : ' '; tputs(tparm3(cursor_address, y, x), 1, outc); if (my_colors > 0) { - z = (int) (ranf() * my_colors); + int z = (int) (ranf() * my_colors); if (ranf() > 0.01) { tputs(tparm2(set_a_foreground, z), 1, outc); } else { tputs(tparm2(set_a_background, z), 1, outc); - napms(1); + napms(s_option); } - } else if (valid(exit_attribute_mode) - && valid(enter_reverse_mode)) { + } else if (VALID_STRING(exit_attribute_mode) + && VALID_STRING(enter_reverse_mode)) { if (ranf() <= 0.01) { outs((ranf() > 0.6) ? enter_reverse_mode : exit_attribute_mode); - napms(1); + napms(s_option); } } outc(p); diff --git a/test/dots_curses.c b/test/dots_curses.c new file mode 100644 index 000000000000..6c2a06e644ee --- /dev/null +++ b/test/dots_curses.c @@ -0,0 +1,218 @@ +/**************************************************************************** + * Copyright (c) 2014-2018,2019 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. * + ****************************************************************************/ + +/* + * Author: Thomas E. Dickey + * + * $Id: dots_curses.c,v 1.15 2019/08/24 21:50:35 tom Exp $ + * + * A simple demo of the curses interface used for comparison with termcap. + */ +#include + +#if !defined(_WIN32) +#include +#endif + +#include + +static bool interrupted = FALSE; +static long total_chars = 0; +static time_t started; + +static void +cleanup(void) +{ + endwin(); + + printf("\n\n%ld total cells, rate %.2f/sec\n", + total_chars, + ((double) (total_chars) / (double) (time((time_t *) 0) - started))); +} + +static void +onsig(int n GCC_UNUSED) +{ + interrupted = TRUE; +} + +static double +ranf(void) +{ + long r = (rand() & 077777); + return ((double) r / 32768.); +} + +static int +mypair(int fg, int bg) +{ + int pair = (fg * COLORS) + bg; + return (pair >= COLOR_PAIRS) ? -1 : pair; +} + +static void +set_colors(int fg, int bg) +{ + int pair = mypair(fg, bg); + if (pair > 0) { + attron(COLOR_PAIR(mypair(fg, bg))); + } +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: dots_curses [options]" + ,"" + ,"Options:" + ," -T TERM override $TERM" +#if HAVE_USE_DEFAULT_COLORS + ," -d invoke use_default_colors()" +#endif +#if HAVE_USE_ENV + ," -e allow environment $LINES / $COLUMNS" +#endif + ," -m SIZE set margin (default: 2)" + ," -s MSECS delay 1% of the time (default: 1 msecs)" + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc, char *argv[]) +{ + int ch; + int fg, bg; + double r; + double c; +#if HAVE_USE_DEFAULT_COLORS + bool d_option = FALSE; +#endif + int m_option = 2; + int s_option = 1; + size_t need; + char *my_env; + + while ((ch = getopt(argc, argv, "T:dem:s:")) != -1) { + switch (ch) { + case 'T': + need = 6 + strlen(optarg); + my_env = malloc(need); + _nc_SPRINTF(my_env, _nc_SLIMIT(need) "TERM=%s", optarg); + putenv(my_env); + break; +#if HAVE_USE_DEFAULT_COLORS + case 'd': + d_option = TRUE; + break; +#endif +#if HAVE_USE_ENV + case 'e': + use_env(TRUE); + break; +#endif + case 'm': + m_option = atoi(optarg); + break; + case 's': + s_option = atoi(optarg); + break; + default: + usage(); + break; + } + } + + srand((unsigned) time(0)); + + InitAndCatch(initscr(), onsig); + if (has_colors()) { + start_color(); +#if HAVE_USE_DEFAULT_COLORS + if (d_option) + use_default_colors(); +#endif + for (fg = 0; fg < COLORS; fg++) { + for (bg = 0; bg < COLORS; bg++) { + int pair; + if (interrupted) { + cleanup(); + ExitProgram(EXIT_FAILURE); + } + pair = mypair(fg, bg); + if (pair > 0) + init_pair((short) pair, (short) fg, (short) bg); + } + } + } + + r = (double) (LINES - (m_option * 2)); + c = (double) (COLS - (m_option * 2)); + started = time((time_t *) 0); + + fg = COLOR_WHITE; + bg = COLOR_BLACK; + while (!interrupted) { + int x = (int) (c * ranf()) + m_option; + int y = (int) (r * ranf()) + m_option; + int p = (ranf() > 0.9) ? '*' : ' '; + + move(y, x); + if (has_colors()) { + int z = (int) (ranf() * COLORS); + if (ranf() > 0.01) { + set_colors(fg = z, bg); + attron(COLOR_PAIR(mypair(fg, bg))); + } else { + set_colors(fg, bg = z); + napms(s_option); + } + } else { + if (ranf() <= 0.01) { + if (ranf() > 0.6) { + attron(A_REVERSE); + } else { + attroff(A_REVERSE); + } + napms(s_option); + } + } + AddCh(p); + refresh(); + ++total_chars; + } + cleanup(); + ExitProgram(EXIT_SUCCESS); +} diff --git a/test/dots_mvcur.c b/test/dots_mvcur.c index 90b9c4e5b17b..16d5ca5ecf75 100644 --- a/test/dots_mvcur.c +++ b/test/dots_mvcur.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007-2009,2013 Free Software Foundation, Inc. * + * Copyright (c) 2007-2017,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey - 2007 * - * $Id: dots_mvcur.c,v 1.10 2013/09/28 22:44:18 tom Exp $ + * $Id: dots_mvcur.c,v 1.21 2019/08/24 22:19:28 tom Exp $ * * A simple demo of the terminfo interface, and mvcur. */ @@ -40,8 +40,6 @@ #include -#define valid(s) ((s != 0) && s != (char *)-1) - static bool interrupted = FALSE; static long total_chars = 0; static time_t started; @@ -65,7 +63,7 @@ TPUTS_PROTO(outc, c) static bool outs(const char *s) { - if (valid(s)) { + if (VALID_STRING(s)) { tputs(s, 1, outc); return TRUE; } @@ -81,7 +79,7 @@ cleanup(void) outs(clear_screen); outs(cursor_normal); - printf("\n\n%ld total chars, rate %.2f/sec\n", + printf("\n\n%ld total cells, rate %.2f/sec\n", total_chars, ((double) (total_chars) / (double) (time((time_t *) 0) - started))); } @@ -99,40 +97,117 @@ ranf(void) return ((double) r / 32768.); } +static int +get_number(NCURSES_CONST char *cap, int map) +{ + int result = map; + if (cap != 0) { + int check = tigetnum(cap); + if (check > 0) + result = check; + } + return result; +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: dots_termcap [options]" + ,"" + ,"Options:" + ," -T TERM override $TERM" +#if HAVE_USE_ENV + ," -e allow environment $LINES / $COLUMNS" +#endif + ," -f use tigetnum rather than mapping" + ," -m SIZE set margin (default: 2)" + ," -s MSECS delay 1% of the time (default: 1 msecs)" + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(EXIT_FAILURE); +} + int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { int x0 = 1, y0 = 1; - int x, y, z, p; + int ch; double r; double c; SCREEN *sp; int my_colors; + int f_option = 0; + int m_option = 2; + int s_option = 1; + size_t need; + char *my_env; + + while ((ch = getopt(argc, argv, "T:efm:s:")) != -1) { + switch (ch) { + case 'T': + need = 6 + strlen(optarg); + my_env = malloc(need); + _nc_SPRINTF(my_env, _nc_SLIMIT(need) "TERM=%s", optarg); + putenv(my_env); + break; +#if HAVE_USE_ENV + case 'e': + use_env(TRUE); + break; +#endif + case 'f': + f_option = 1; + break; + case 'm': + m_option = atoi(optarg); + break; + case 's': + s_option = atoi(optarg); + break; + default: + usage(); + break; + } + } - CATCHALL(onsig); + InitAndCatch((sp = newterm((char *) 0, stdout, stdin)), onsig); + refresh(); /* needed with Solaris curses to cancel endwin */ + + if (sp == 0) { + fprintf(stderr, "Cannot initialize terminal\n"); + ExitProgram(EXIT_FAILURE); + } srand((unsigned) time(0)); - sp = newterm((char *) 0, stdout, stdin); + outs(clear_screen); outs(cursor_home); outs(cursor_invisible); - my_colors = max_colors; + +#define GetNumber(ln,sn) get_number(f_option ? #sn : 0, ln) + my_colors = GetNumber(max_colors, colors); if (my_colors > 1) { - if (!valid(set_a_foreground) - || !valid(set_a_background) - || (!valid(orig_colors) && !valid(orig_pair))) + if (!VALID_STRING(set_a_foreground) + || !VALID_STRING(set_a_background) + || (!VALID_STRING(orig_colors) && !VALID_STRING(orig_pair))) my_colors = -1; } - r = (double) (lines - 4); - c = (double) (columns - 4); + r = (double) (GetNumber(lines, lines) - (m_option * 2)); + c = (double) (GetNumber(columns, cols) - (m_option * 2)); started = time((time_t *) 0); while (!interrupted) { - x = (int) (c * ranf()) + 2; - y = (int) (r * ranf()) + 2; - p = (ranf() > 0.9) ? '*' : ' '; + int x = (int) (c * ranf()) + m_option; + int y = (int) (r * ranf()) + m_option; + int p = (ranf() > 0.9) ? '*' : ' '; if (mvcur(y0, x0, y, x) != ERR) { x0 = x; @@ -140,20 +215,20 @@ main(int argc GCC_UNUSED, } if (my_colors > 0) { - z = (int) (ranf() * my_colors); + int z = (int) (ranf() * my_colors); if (ranf() > 0.01) { tputs(tparm2(set_a_foreground, z), 1, outc); } else { tputs(tparm2(set_a_background, z), 1, outc); - napms(1); + napms(s_option); } - } else if (valid(exit_attribute_mode) - && valid(enter_reverse_mode)) { + } else if (VALID_STRING(exit_attribute_mode) + && VALID_STRING(enter_reverse_mode)) { if (ranf() <= 0.01) { outs((ranf() > 0.6) ? enter_reverse_mode : exit_attribute_mode); - napms(1); + napms(s_option); } } outc(p); diff --git a/test/dots_termcap.c b/test/dots_termcap.c index 4c1d62d9f9ff..21b9adb24719 100644 --- a/test/dots_termcap.c +++ b/test/dots_termcap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2013 Free Software Foundation, Inc. * + * Copyright (c) 2013-2018,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,14 +29,14 @@ /* * Author: Thomas E. Dickey * - * $Id: dots_termcap.c,v 1.7 2013/09/28 21:50:35 tom Exp $ + * $Id: dots_termcap.c,v 1.19 2019/08/24 22:25:55 tom Exp $ * * A simple demo of the termcap interface. */ #define USE_TINFO #include -#if !defined(__MINGW32__) +#if !defined(_WIN32) #include #endif @@ -44,8 +44,6 @@ #include -#define valid(s) ((s != 0) && s != (char *)-1) - static bool interrupted = FALSE; static long total_chars = 0; static time_t started; @@ -62,7 +60,7 @@ static char *t_ve; static char *t_vi; static struct { - const char *name; + NCURSES_CONST char *name; char **value; } my_caps[] = { @@ -116,7 +114,7 @@ TPUTS_PROTO(outc, c) static bool outs(char *s) { - if (valid(s)) { + if (VALID_STRING(s)) { tputs(s, 1, outc); return TRUE; } @@ -132,7 +130,7 @@ cleanup(void) outs(t_cl); outs(t_ve); - printf("\n\n%ld total chars, rate %.2f/sec\n", + printf("\n\n%ld total cells, rate %.2f/sec\n", total_chars, ((double) (total_chars) / (double) (time((time_t *) 0) - started))); } @@ -153,38 +151,103 @@ ranf(void) static void my_napms(int ms) { -#if defined(__MINGW32__) || !HAVE_GETTIMEOFDAY - Sleep(ms); + if (ms > 0) { +#if defined(_WIN32) || !HAVE_GETTIMEOFDAY + Sleep((DWORD) ms); #else - struct timeval data; - data.tv_sec = 0; - data.tv_usec = ms * 1000; - select(0, NULL, NULL, NULL, &data); + struct timeval data; + data.tv_sec = 0; + data.tv_usec = ms * 1000; + select(0, NULL, NULL, NULL, &data); #endif + } +} + +static int +get_number(NCURSES_CONST char *cap, const char *env) +{ + int result = tgetnum(cap); + char *value = env ? getenv(env) : 0; + if (value != 0 && *value != 0) { + char *next = 0; + long check = strtol(value, &next, 10); + if (check > 0 && *next == '\0') + result = (int) check; + } + return result; +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: dots_termcap [options]" + ,"" + ,"Options:" + ," -T TERM override $TERM" + ," -e allow environment $LINES / $COLUMNS" + ," -m SIZE set margin (default: 2)" + ," -s MSECS delay 1% of the time (default: 1 msecs)" + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(EXIT_FAILURE); } int -main(int argc GCC_UNUSED, - char *argv[]GCC_UNUSED) +main(int argc, char *argv[]) { - int x, y, z, p; + int ch; int num_colors; int num_lines; int num_columns; + int e_option = 0; + int m_option = 2; + int s_option = 1; double r; double c; char buffer[1024]; char area[1024]; char *name; + size_t need; + char *my_env; - CATCHALL(onsig); - - srand((unsigned) time(0)); + while ((ch = getopt(argc, argv, "T:em:s:")) != -1) { + switch (ch) { + case 'T': + need = 6 + strlen(optarg); + my_env = malloc(need); + _nc_SPRINTF(my_env, _nc_SLIMIT(need) "TERM=%s", optarg); + putenv(my_env); + break; + case 'e': + e_option = 1; + break; + case 'm': + m_option = atoi(optarg); + break; + case 's': + s_option = atoi(optarg); + break; + default: + usage(); + break; + } + } if ((name = getenv("TERM")) == 0) { fprintf(stderr, "TERM is not set\n"); ExitProgram(EXIT_FAILURE); - } else if (tgetent(buffer, name) < 0) { + } + + srand((unsigned) time(0)); + + InitAndCatch(ch = tgetent(buffer, name), onsig); + if (ch < 0) { fprintf(stderr, "terminal description not found\n"); ExitProgram(EXIT_FAILURE); } else { @@ -197,43 +260,44 @@ main(int argc GCC_UNUSED, } num_colors = tgetnum("Co"); - num_lines = tgetnum("li"); - num_columns = tgetnum("co"); +#define GetNumber(cap,env) get_number(cap, e_option ? env : 0) + num_lines = GetNumber("li", "LINES"); + num_columns = GetNumber("co", "COLUMNS"); outs(t_cl); outs(t_vi); if (num_colors > 1) { - if (!valid(t_AF) - || !valid(t_AB) - || (!valid(t_oc) && !valid(t_op))) + if (!VALID_STRING(t_AF) + || !VALID_STRING(t_AB) + || (!VALID_STRING(t_oc) && !VALID_STRING(t_op))) num_colors = -1; } - r = (double) (num_lines - 4); - c = (double) (num_columns - 4); + r = (double) (num_lines - (2 * m_option)); + c = (double) (num_columns - (2 * m_option)); started = time((time_t *) 0); while (!interrupted) { - x = (int) (c * ranf()) + 2; - y = (int) (r * ranf()) + 2; - p = (ranf() > 0.9) ? '*' : ' '; + int x = (int) (c * ranf()) + m_option; + int y = (int) (r * ranf()) + m_option; + int p = (ranf() > 0.9) ? '*' : ' '; tputs(tgoto(t_cm, x, y), 1, outc); if (num_colors > 0) { - z = (int) (ranf() * num_colors); + int z = (int) (ranf() * num_colors); if (ranf() > 0.01) { tputs(tgoto(t_AF, 0, z), 1, outc); } else { tputs(tgoto(t_AB, 0, z), 1, outc); - my_napms(1); + my_napms(s_option); } - } else if (valid(t_me) - && valid(t_mr)) { + } else if (VALID_STRING(t_me) + && VALID_STRING(t_mr)) { if (ranf() <= 0.01) { outs((ranf() > 0.6) ? t_mr : t_me); - my_napms(1); + my_napms(s_option); } } outc(p); diff --git a/test/dots_xcurses.c b/test/dots_xcurses.c new file mode 100644 index 000000000000..2eb4d63ace53 --- /dev/null +++ b/test/dots_xcurses.c @@ -0,0 +1,267 @@ +/**************************************************************************** + * Copyright (c) 2017-2018,2019 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. * + ****************************************************************************/ + +/* + * Author: Thomas E. Dickey + * + * $Id: dots_xcurses.c,v 1.18 2019/08/24 22:31:43 tom Exp $ + * + * A simple demo of the wide-curses interface used for comparison with termcap. + */ +#include + +#if !defined(_WIN32) +#include +#endif + +#include + +#if USE_WIDEC_SUPPORT + +#if HAVE_ALLOC_PAIR +#define NewPair(n) x_option ? ((void *)&(n)) : NULL +#else +#define NewPair(n) NULL +#endif + +#define InitPair(p,fg,bg) init_pair((short) (p), (short) (fg), (short) (bg)) + +static bool interrupted = FALSE; +static long total_chars = 0; +static time_t started; + +#if HAVE_ALLOC_PAIR +static bool x_option = FALSE; +#endif + +static void +cleanup(void) +{ + endwin(); + + printf("\n\n%ld total cells, rate %.2f/sec\n", + total_chars, + ((double) (total_chars) / (double) (time((time_t *) 0) - started))); +} + +static void +onsig(int n GCC_UNUSED) +{ + interrupted = TRUE; +} + +static double +ranf(void) +{ + long r = (rand() & 077777); + return ((double) r / 32768.); +} + +static int +mypair(int fg, int bg) +{ + int result; +#if HAVE_ALLOC_PAIR + if (x_option) { + result = alloc_pair(fg, bg); + } else +#endif + { + int pair = (fg * COLORS) + bg; + result = (pair >= COLOR_PAIRS) ? -1 : pair; + } + return result; +} + +static void +set_colors(int fg, int bg) +{ + int pair = mypair(fg, bg); + if (pair > 0) { + (void) color_set((short) pair, NewPair(pair)); + } +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: dots_xcurses [options]" + ,"" + ,"Options:" + ," -T TERM override $TERM" +#if HAVE_USE_DEFAULT_COLORS + ," -d invoke use_default_colors()" +#endif +#if HAVE_USE_ENV + ," -e allow environment $LINES / $COLUMNS" +#endif + ," -m SIZE set margin (default: 2)" + ," -s MSECS delay 1% of the time (default: 1 msecs)" +#if HAVE_ALLOC_PAIR + ," -x use alloc_pair() rather than init_pair()" +#endif + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc, char *argv[]) +{ + int fg, bg, ch; + wchar_t wch[2]; + double r; + double c; +#if HAVE_USE_DEFAULT_COLORS + bool d_option = FALSE; +#endif + int m_option = 2; + int s_option = 1; + size_t need; + char *my_env; + + while ((ch = getopt(argc, argv, "T:dem:s:x")) != -1) { + switch (ch) { + case 'T': + need = 6 + strlen(optarg); + my_env = malloc(need); + _nc_SPRINTF(my_env, _nc_SLIMIT(need) "TERM=%s", optarg); + putenv(my_env); + break; +#if HAVE_USE_DEFAULT_COLORS + case 'd': + d_option = TRUE; + break; +#endif +#if HAVE_USE_ENV + case 'e': + use_env(TRUE); + break; +#endif + case 'm': + m_option = atoi(optarg); + break; + case 's': + s_option = atoi(optarg); + break; +#if HAVE_ALLOC_PAIR + case 'x': + x_option = TRUE; + break; +#endif + default: + usage(); + break; + } + } + + srand((unsigned) time(0)); + + InitAndCatch(initscr(), onsig); + if (has_colors()) { + start_color(); +#if HAVE_USE_DEFAULT_COLORS + if (d_option) + use_default_colors(); +#endif +#if HAVE_ALLOC_PAIR + if (x_option) { + ; /* nothing */ + } else +#endif + { + for (fg = 0; fg < COLORS; fg++) { + for (bg = 0; bg < COLORS; bg++) { + int pair; + if (interrupted) { + cleanup(); + ExitProgram(EXIT_FAILURE); + } + pair = mypair(fg, bg); + if (pair > 0) { + InitPair(pair, fg, bg); + } + } + } + } + } + + r = (double) (LINES - (2 * m_option)); + c = (double) (COLS - (2 * m_option)); + started = time((time_t *) 0); + + fg = COLOR_WHITE; + bg = COLOR_BLACK; + wch[1] = 0; + while (!interrupted) { + int x = (int) (c * ranf()) + m_option; + int y = (int) (r * ranf()) + m_option; + int p = (ranf() > 0.9) ? '*' : ' '; + + move(y, x); + if (has_colors()) { + int z = (int) (ranf() * COLORS); + if (ranf() > 0.01) { + set_colors(fg = z, bg); + } else { + set_colors(fg, bg = z); + napms(s_option); + } + } else { + if (ranf() <= 0.01) { + if (ranf() > 0.6) { + attr_on(WA_REVERSE, NULL); + } else { + attr_off(WA_REVERSE, NULL); + } + napms(s_option); + } + } + wch[0] = (wchar_t) p; + addnwstr(wch, 1); + refresh(); + ++total_chars; + } + cleanup(); + ExitProgram(EXIT_SUCCESS); +} + +#else +int +main(void) +{ + printf("This program requires the wide-ncurses library\n"); + ExitProgram(EXIT_FAILURE); +} +#endif diff --git a/test/dump_window.c b/test/dump_window.c new file mode 100644 index 000000000000..4893c48fabb9 --- /dev/null +++ b/test/dump_window.c @@ -0,0 +1,179 @@ +/**************************************************************************** + * Copyright (c) 2018 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: dump_window.c,v 1.3 2018/11/24 23:41:15 tom Exp $ + */ +#include + +static FILE *dumpfp; + +int +open_dump(const char *fn) +{ + int result = 0; + close_dump(); + if ((dumpfp = fopen(fn, "a")) != 0) + result = 1; + return result; +} + +void +close_dump(void) +{ + if (dumpfp != 0) { + fclose(dumpfp); + dumpfp = 0; + } +} + +void +dump_window(WINDOW *w) +{ + wgetch(w); + if (dumpfp != 0) { + int y, x; + int oldy, oldx; + int maxy, maxx; + int pass; + char *cvec = 0; + char *avec = 0; + char *pvec = 0; + int ccnt = 0; + int acnt = 0; + int pcnt = 0; + int endy = -1; + int endx = -1; + + fprintf(dumpfp, "Window %p\n", (void *) w); + + getyx(w, oldy, oldx); + getmaxyx(w, maxy, maxx); + fprintf(dumpfp, "size (%dx%d)\n", maxy, maxx); + getbegyx(w, y, x); + fprintf(dumpfp, "begin (%dx%d)\n", maxy, maxx); + getyx(w, y, x); + fprintf(dumpfp, "position (%d,%d)\n", y, x); + + if (maxy > 0 && maxx > 0) { + for (pass = 0; pass < 2; ++pass) { + for (y = 0; y < maxy; ++y) { + + if (cvec) + memset(cvec, 0, (size_t) maxx + 1); + if (avec) + memset(avec, 0, (size_t) maxx + 1); + if (pvec) + memset(pvec, 0, (size_t) maxx + 1); + + for (x = 0; x < maxx; ++x) { + chtype data = mvwinch(w, y, x); + chtype temp; + char cc = (char) ((data & 0xff) ? (data & 0xff) : ' '); + char aa; + char pp; + + temp = ((data & A_ATTRIBUTES) & (~A_COLOR)); + if (temp) { + if (temp & A_ALTCHARSET) { + aa = (temp & A_BOLD) ? 'A' : 'a'; + } else if (temp & A_STANDOUT) { + aa = (temp & A_BOLD) ? 'S' : 's'; + } else if (temp & A_REVERSE) { + aa = (temp & A_BOLD) ? 'R' : 'r'; + } else if (temp & A_UNDERLINE) { + aa = (temp & A_BOLD) ? 'U' : 'u'; + } else { + aa = (temp & A_BOLD) ? 'b' : '?'; + } + } else { + aa = ' '; + } + if (data & A_COLOR) { + if (PAIR_NUMBER((int) data) < 8) { + pp = (char) ('0' + PAIR_NUMBER((int) data)); + } else { + pp = '*'; + } + } else { + pp = ' '; + } + + if (pass) { + if (cvec) + cvec[x] = cc; + if (avec) + avec[x] = aa; + if (pvec) + pvec[x] = pp; + } else { + if (cc != ' ' || aa != ' ' || pp != ' ') { + if (endx < x) + endx = x; + if (endy < y) + endy = y; + } + ccnt += (cc != ' '); + acnt += (aa != ' '); + pcnt += (pp != ' '); + } + } + if (pass) { + fprintf(dumpfp, "%3d", y + 1); + if (cvec) + fprintf(dumpfp, "\tc|%.*s|\n", maxx, cvec); + if (avec) + fprintf(dumpfp, "\ta|%.*s|\n", maxx, avec); + if (pvec) + fprintf(dumpfp, "\tp|%.*s|\n", maxx, pvec); + } + } + if (pass) { + free(cvec); + free(avec); + free(pvec); + } else { + fprintf(dumpfp, "%d cells with characters\n", ccnt); + fprintf(dumpfp, "%d cells with video-attributes\n", acnt); + fprintf(dumpfp, "%d cells with color-attributes\n", pcnt); + if (endy < 0 || endx < 0) + break; + /* reduce the dump a little, ignore really blank cells */ + maxx = endx + 1; + maxy = endy + 1; + if (ccnt) + cvec = malloc((size_t) maxx + 1); + if (acnt) + avec = malloc((size_t) maxx + 1); + if (pcnt) + pvec = malloc((size_t) maxx + 1); + } + } + } + wmove(w, oldy, oldx); + } +} diff --git a/test/dump_window.h b/test/dump_window.h new file mode 100644 index 000000000000..1834be12de31 --- /dev/null +++ b/test/dump_window.h @@ -0,0 +1,40 @@ +/**************************************************************************** + * Copyright (c) 2018 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: dump_window.h,v 1.1 2018/11/24 18:13:53 tom Exp $ + */ +#ifndef DUMP_WINDOW_H_incl +#define DUMP_WINDOW_H_incl 1 + +#include + +extern int open_dump(const char *fn); +extern void close_dump(void); +extern void dump_window(WINDOW *w); + +#endif /* DUMP_WINDOW_H_incl */ diff --git a/test/echochar.c b/test/echochar.c index 8cb0833aa023..93a4644213af 100644 --- a/test/echochar.c +++ b/test/echochar.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2006-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2006-2017,2019 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: echochar.c,v 1.9 2012/06/09 20:30:32 tom Exp $ + * $Id: echochar.c,v 1.20 2019/12/14 23:25:29 tom Exp $ * * Demonstrate the echochar function (compare to dots.c). * Thomas Dickey - 2006/11/4 @@ -36,8 +36,6 @@ #include -#define valid(s) ((s != 0) && s != (char *)-1) - static bool interrupted = FALSE; static long total_chars = 0; static time_t started; @@ -45,9 +43,9 @@ static time_t started; static void cleanup(void) { - endwin(); + stop_curses(); - printf("\n\n%ld total chars, rate %.2f/sec\n", + printf("\n\n%ld total cells, rate %.2f/sec\n", total_chars, ((double) (total_chars) / (double) (time((time_t *) 0) - started))); } @@ -69,19 +67,21 @@ static void set_color(char *my_pairs, int fg, int bg) { int pair = (fg * COLORS) + bg; - if (!my_pairs[pair]) { - init_pair((short) pair, - (short) fg, - (short) bg); + if (pair < COLOR_PAIRS) { + if (!my_pairs[pair]) { + init_pair((short) pair, + (short) fg, + (short) bg); + } + attron(COLOR_PAIR(pair)); } - attron((attr_t) COLOR_PAIR(pair)); } int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - int ch, x, y, z, p; + int ch; double r; double c; bool use_colors; @@ -96,13 +96,12 @@ main(int argc GCC_UNUSED, opt_r = TRUE; break; default: - fprintf(stderr, "usage: echochar [-r]\n"); + fprintf(stderr, "Usage: echochar [-r]\n"); ExitProgram(EXIT_FAILURE); } } - CATCHALL(onsig); - initscr(); + InitAndCatch(initscr(), onsig); use_colors = has_colors(); if (use_colors) { @@ -122,13 +121,13 @@ main(int argc GCC_UNUSED, started = time((time_t *) 0); while (!interrupted) { - x = (int) (c * ranf()) + 2; - y = (int) (r * ranf()) + 2; - p = (ranf() > 0.9) ? '*' : ' '; + int x = (int) (c * ranf()) + 2; + int y = (int) (r * ranf()) + 2; + int p = (ranf() > 0.9) ? '*' : ' '; move(y, x); if (use_colors > 0) { - z = (int) (ranf() * COLORS); + int z = (int) (ranf() * COLORS); if (ranf() > 0.01) { set_color(my_pairs, z, last_bg); last_fg = z; @@ -147,7 +146,7 @@ main(int argc GCC_UNUSED, } } if (opt_r) { - addch(UChar(p)); + AddCh(UChar(p)); refresh(); } else { echochar(UChar(p)); @@ -155,5 +154,6 @@ main(int argc GCC_UNUSED, ++total_chars; } cleanup(); + free(my_pairs); ExitProgram(EXIT_SUCCESS); } diff --git a/test/edit_field.c b/test/edit_field.c index 506d08ae0396..db917de175ef 100644 --- a/test/edit_field.c +++ b/test/edit_field.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2003-2011,2013 Free Software Foundation, Inc. * + * Copyright (c) 2003-2017,2019 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: edit_field.c,v 1.22 2013/09/28 22:02:17 tom Exp $ + * $Id: edit_field.c,v 1.30 2019/01/21 20:18:18 tom Exp $ * * A wrapper for form_driver() which keeps track of the user's editing changes * for each field, and makes the resulting length available as a @@ -40,6 +40,7 @@ #if USE_LIBFORM #include +#include static struct { int code; @@ -169,151 +170,71 @@ static struct { } }; -static WINDOW *old_window; - -static void -begin_popup(void) -{ - doupdate(); - old_window = dupwin(curscr); -} - -static void -end_popup(void) -{ - touchwin(old_window); - wnoutrefresh(old_window); - doupdate(); - delwin(old_window); -} - /* * Display a temporary window listing the keystroke-commands we recognize. */ void help_edit_field(void) { - int x0 = 4; - int y0 = 2; - int y1 = 0; - int y2 = 0; - int wide = COLS - ((x0 + 1) * 2); - int high = LINES - ((y0 + 1) * 2); - WINDOW *help = newwin(high, wide, y0, x0); - WINDOW *data = newpad(2 + SIZEOF(commands), wide - 4); + int used = 0; unsigned n; - int ch = ERR; + char **msgs = typeCalloc(char *, 3 + SIZEOF(commands)); - begin_popup(); - - keypad(help, TRUE); - keypad(data, TRUE); - waddstr(data, "Defined form edit/traversal keys:\n"); + msgs[used++] = strdup("Defined form edit/traversal keys:"); for (n = 0; n < SIZEOF(commands); ++n) { + char *msg; const char *name; + const char *code = keyname(commands[n].code); + size_t need = 5; #ifdef NCURSES_VERSION if ((name = form_request_name(commands[n].result)) == 0) #endif name = commands[n].help; - wprintw(data, "%s -- %s\n", - keyname(commands[n].code), - name != 0 ? name : commands[n].help); + need = 5 + strlen(code) + strlen(name); + msg = typeMalloc(char, need); + _nc_SPRINTF(msg, _nc_SLIMIT(need) "%s -- %s", code, name); + msgs[used++] = msg; } - waddstr(data, "Arrow keys move within a field as you would expect."); - y2 = getcury(data); - - do { - switch (ch) { - case KEY_HOME: - y1 = 0; - break; - case KEY_END: - y1 = y2; - break; - case KEY_PREVIOUS: - case KEY_PPAGE: - if (y1 > 0) { - y1 -= high / 2; - if (y1 < 0) - y1 = 0; - } else { - beep(); - } - break; - case KEY_NEXT: - case KEY_NPAGE: - if (y1 < y2) { - y1 += high / 2; - if (y1 >= y2) - y1 = y2; - } else { - beep(); - } - break; - case CTRL('P'): - case KEY_UP: - if (y1 > 0) - --y1; - else - beep(); - break; - case CTRL('N'): - case KEY_DOWN: - if (y1 < y2) - ++y1; - else - beep(); - break; - default: - beep(); - break; - case ERR: - break; - } - werase(help); - box(help, 0, 0); - wnoutrefresh(help); - pnoutrefresh(data, y1, 0, y0 + 1, x0 + 1, high, wide); - doupdate(); - } while ((ch = wgetch(data)) != ERR && ch != QUIT && ch != ESCAPE); - werase(help); - wrefresh(help); - delwin(help); - delwin(data); - - end_popup(); + msgs[used++] = + strdup("Arrow keys move within a field as you would expect."); + msgs[used] = 0; + popup_msg2(stdscr, msgs); + for (n = 0; msgs[n] != 0; ++n) { + free(msgs[n]); + } + free(msgs); } static int -offset_in_field(FORM * form) +offset_in_field(FORM *form) { FIELD *field = current_field(form); int currow, curcol; form_getyx(form, currow, curcol); - return curcol + currow * field->dcols; + return curcol + currow * (int) field->dcols; } static void -inactive_field(FIELD * f) +inactive_field(FIELD *f) { set_field_back(f, field_attrs(f)->background); } FieldAttrs * -field_attrs(FIELD * f) +field_attrs(FIELD *f) { return (FieldAttrs *) field_userptr(f); } static int -buffer_length(FIELD * f) +buffer_length(FIELD *f) { return field_attrs(f)->row_lengths[0]; } static void -set_buffer_length(FIELD * f, int length) +set_buffer_length(FIELD *f, int length) { field_attrs(f)->row_lengths[0] = length; } @@ -323,8 +244,9 @@ set_buffer_length(FIELD * f, int length) * keeping track of the actual lengths of lines in a multiline field. */ void -init_edit_field(FIELD * f, char *value) +init_edit_field(FIELD *f, char *value) { + char empty[1]; FieldAttrs *ptr = field_attrs(f); if (ptr == 0) { int rows, cols, frow, fcol, nrow, nbuf; @@ -336,6 +258,10 @@ init_edit_field(FIELD * f, char *value) ptr->row_lengths = typeCalloc(int, (size_t) nrow + 1); } } + if (value == 0) { + value = empty; + *value = '\0'; + } set_field_userptr(f, (void *) ptr); set_field_buffer(f, 0, value); /* will be formatted */ set_field_buffer(f, 1, value); /* will be unformatted */ @@ -343,7 +269,7 @@ init_edit_field(FIELD * f, char *value) } int -edit_field(FORM * form, int *result) +edit_field(FORM *form, int *result) { int ch = wgetch(form_win(form)); int status; @@ -384,7 +310,7 @@ edit_field(FORM * form, int *result) length = before_off; break; case REQ_CLR_EOL: - if (before_row + 1 == before->rows) + if ((int) (before_row + 1) == (int) (before->rows)) length = before_off; break; case REQ_CLR_FIELD: @@ -399,12 +325,12 @@ edit_field(FORM * form, int *result) if (before_col > 0) { --length; } else if (before_row > 0) { - length -= before->cols + before_col; + length -= (int) before->cols + before_col; } } break; case REQ_NEW_LINE: - length += before->cols; + length += (int) before->cols; break; #if 0 /* FIXME: finish these */ @@ -489,6 +415,16 @@ edit_field(FORM * form, int *result) inactive_field(before); return status; } + +void +free_edit_field(FIELD *f) +{ + FieldAttrs *ptr = field_attrs(f); + if (ptr != 0) { + free(ptr->row_lengths); + free(ptr); + } +} #else extern void no_edit_field(void); diff --git a/test/edit_field.h b/test/edit_field.h index 3c5b80ec12ea..f0c8315619c0 100644 --- a/test/edit_field.h +++ b/test/edit_field.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2003-2008,2013 Free Software Foundation, Inc. * + * Copyright (c) 2003-2013,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: edit_field.h,v 1.9 2013/06/08 15:46:01 tom Exp $ + * $Id: edit_field.h,v 1.10 2017/04/10 00:28:55 tom Exp $ * * Interface of edit_field.c */ @@ -49,9 +49,10 @@ typedef struct { int *row_lengths; } FieldAttrs; -extern FieldAttrs *field_attrs(FIELD * field); -extern void init_edit_field(FIELD * field, char *value); +extern FieldAttrs *field_attrs(FIELD *field); +extern void init_edit_field(FIELD *field, char *value); extern void help_edit_field(void); -extern int edit_field(FORM * form, int *result); +extern int edit_field(FORM *form, int *result); +extern void free_edit_field(FIELD *field); #endif /* EDIT_FORM_H_incl */ diff --git a/test/escherknot.xbm b/test/escherknot.xbm new file mode 100644 index 000000000000..80bc471b2906 --- /dev/null +++ b/test/escherknot.xbm @@ -0,0 +1,473 @@ +#define escherknot_width 216 +#define escherknot_height 208 + +static char escherknot_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xf0, 0x6f, 0xf6, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0xff, 0x3a, 0x13, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0d, 0x02, 0x51, 0x71, 0x0e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x2f, 0x20, 0xd9, 0x88, + 0x9b, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x82, + 0xac, 0x44, 0x4e, 0x1c, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x1e, 0x40, 0x02, 0x44, 0x60, 0xe2, 0xfc, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x25, 0x09, 0x90, 0x22, 0x13, 0xb7, 0x9a, 0x1e, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x40, 0x10, 0x89, + 0x18, 0xe3, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x04, 0x08, + 0x01, 0x10, 0xc8, 0xa8, 0xd5, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x83, 0x80, 0x20, 0x40, 0x82, 0x00, 0x66, 0x9c, 0xec, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x08, 0x08, 0x24, 0x12, 0x93, 0x5b, + 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x12, 0x80, 0x04, 0x01, 0x00, 0x80, + 0x19, 0x33, 0xfa, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x80, 0x80, 0x00, + 0x20, 0x08, 0x12, 0xc4, 0x68, 0x26, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x02, 0x04, 0x24, 0x00, 0x01, 0x40, 0x24, 0x8c, 0xcd, 0x3f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x80, 0x49, 0x10, 0x90, 0x00, 0x21, 0x20, 0x08, 0x11, 0x43, 0xd9, + 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, + 0xff, 0xff, 0x0b, 0x00, 0x60, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x30, 0xb9, 0xf2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc0, 0x97, 0x04, 0x08, 0xfe, 0x05, 0x30, 0x10, 0x12, 0x20, 0x20, + 0x04, 0x00, 0x80, 0x48, 0x0c, 0xa3, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3e, 0x92, 0x20, 0x49, 0x40, 0x3e, 0x0e, 0x82, + 0x00, 0x84, 0x25, 0x01, 0x80, 0x00, 0x80, 0xc8, 0x34, 0xed, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x25, 0x01, 0x04, 0x01, 0x08, + 0xd0, 0x17, 0x00, 0x80, 0x25, 0x01, 0xad, 0x04, 0x12, 0x20, 0x23, 0x4c, + 0x6a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x02, 0x48, + 0x92, 0x20, 0x41, 0x92, 0x9e, 0x80, 0x24, 0x24, 0x29, 0x00, 0x04, 0x00, + 0x10, 0x98, 0xcc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x4f, 0x10, 0x01, 0x90, 0x24, 0x40, 0x12, 0xf0, 0x00, 0x24, 0x41, 0x0b, + 0xa9, 0x10, 0x00, 0x00, 0x04, 0xd9, 0x96, 0x0e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xe0, 0x00, 0x92, 0x48, 0x02, 0x04, 0x09, 0xc0, 0x84, 0x8f, + 0x29, 0x2d, 0xf8, 0xa9, 0x02, 0x00, 0x00, 0x20, 0x90, 0xf4, 0x1e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x24, 0x91, 0x04, 0x50, 0x22, 0x24, + 0x1b, 0x12, 0x7a, 0x48, 0xca, 0x03, 0x21, 0x10, 0x00, 0x00, 0x48, 0x93, + 0xff, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x24, 0x92, 0x20, + 0x81, 0xda, 0x24, 0xc8, 0x16, 0xd0, 0xe7, 0x50, 0xd2, 0xbf, 0x03, 0x00, + 0x80, 0x00, 0x30, 0x29, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, + 0x20, 0x80, 0x24, 0x41, 0x12, 0x2a, 0x41, 0xb2, 0x80, 0x33, 0x0e, 0x7e, + 0x88, 0x1c, 0x01, 0x00, 0xa0, 0x24, 0x69, 0x75, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x82, 0x44, 0x11, 0x24, 0x09, 0x90, 0xa4, 0x4d, 0xd2, 0x92, + 0x9e, 0xd3, 0x83, 0x6b, 0x62, 0x00, 0x00, 0x10, 0x22, 0xff, 0x7f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x30, 0x42, 0x04, 0x92, 0x24, 0x6b, 0x53, 0x32, + 0x59, 0x90, 0x16, 0xfa, 0xb4, 0xf4, 0xff, 0x0f, 0x01, 0x00, 0x90, 0x68, + 0x4a, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x90, 0x24, 0x11, 0x24, + 0x49, 0xda, 0x82, 0xc5, 0x92, 0xd2, 0xd0, 0x9e, 0x1e, 0x00, 0x78, 0x0a, + 0x00, 0x00, 0x05, 0xd2, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x02, + 0x44, 0xb2, 0x65, 0xea, 0x49, 0x9e, 0x2c, 0x4b, 0x1a, 0xd2, 0xeb, 0xe3, + 0xff, 0xc7, 0x09, 0x00, 0x20, 0x68, 0xff, 0xd6, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x0b, 0x90, 0x40, 0x92, 0x24, 0x09, 0x5f, 0xd2, 0x64, 0x59, 0x72, + 0x56, 0x7f, 0xfd, 0xdf, 0x1f, 0x12, 0x00, 0x20, 0x49, 0x92, 0xde, 0x01, + 0x00, 0x00, 0x00, 0x80, 0x41, 0x92, 0x4c, 0x92, 0x24, 0x25, 0xc9, 0x8b, + 0x2e, 0xcb, 0x92, 0x4b, 0x5a, 0x2f, 0x75, 0xf4, 0x04, 0x00, 0x00, 0x41, + 0xf6, 0x74, 0x01, 0x00, 0x00, 0x00, 0x40, 0x49, 0x02, 0x00, 0xba, 0xb6, + 0xfd, 0x49, 0xf8, 0x74, 0x6d, 0x4b, 0x72, 0xed, 0xdb, 0xff, 0xcf, 0x53, + 0x00, 0x00, 0x48, 0xb6, 0xd7, 0x03, 0x00, 0x00, 0x00, 0x60, 0x48, 0x10, + 0xc9, 0x93, 0x24, 0x00, 0x7b, 0xc3, 0xa6, 0x69, 0x58, 0x5a, 0xfb, 0xfa, + 0xa5, 0xbe, 0x16, 0x00, 0x00, 0x92, 0xa4, 0xfd, 0x03, 0x00, 0x00, 0x00, + 0x30, 0x01, 0x20, 0x5d, 0xa2, 0xfe, 0x7f, 0x01, 0x4f, 0x1a, 0xcd, 0x6b, + 0x6a, 0xa9, 0x5f, 0xff, 0xf3, 0x24, 0x01, 0x40, 0xc0, 0xb4, 0xf4, 0x03, + 0x00, 0x00, 0x00, 0x2c, 0x88, 0x84, 0x89, 0xb6, 0x00, 0x24, 0x7d, 0x69, + 0xf2, 0x34, 0xad, 0x99, 0x2d, 0xf7, 0xff, 0x9f, 0x4b, 0x00, 0x00, 0x92, + 0xa6, 0xad, 0x07, 0x00, 0x00, 0x00, 0x06, 0x91, 0x24, 0xe9, 0xa4, 0xfd, + 0xa5, 0xa9, 0x4b, 0x93, 0xe7, 0x34, 0x63, 0xf9, 0xfc, 0xd5, 0xef, 0x16, + 0x00, 0x40, 0x90, 0xb4, 0xbd, 0x07, 0x00, 0x00, 0x00, 0x6a, 0x80, 0x4c, + 0x96, 0xbe, 0x2d, 0xfd, 0x2f, 0x7c, 0x5e, 0x9c, 0x67, 0xad, 0xa5, 0xfd, + 0xff, 0xbf, 0x29, 0x00, 0x00, 0x92, 0x76, 0xed, 0x06, 0x00, 0x00, 0x00, + 0x05, 0x12, 0x48, 0x53, 0x25, 0x65, 0x25, 0xf4, 0xe5, 0xd3, 0x72, 0x9c, + 0x35, 0xdf, 0xf6, 0x7f, 0xf5, 0x56, 0x00, 0x00, 0x92, 0xa4, 0xed, 0x0f, + 0x00, 0x00, 0x80, 0x49, 0x20, 0x59, 0x38, 0xec, 0xff, 0xff, 0xad, 0x2f, + 0x5d, 0xd3, 0x33, 0xe6, 0x24, 0xed, 0xff, 0xdf, 0x2d, 0x01, 0x40, 0x80, + 0x24, 0xbd, 0x07, 0x00, 0x00, 0xc0, 0x48, 0x24, 0x49, 0x87, 0x37, 0x21, + 0xa0, 0xbd, 0xf4, 0x79, 0x4f, 0xc7, 0x9c, 0xde, 0xf6, 0xff, 0xff, 0x5b, + 0x08, 0x00, 0x92, 0xfc, 0xe9, 0x0e, 0x00, 0x00, 0x20, 0x89, 0x40, 0xd3, + 0xf4, 0x49, 0xff, 0xff, 0xe7, 0x2f, 0xcf, 0x79, 0x9c, 0x53, 0xb2, 0x35, + 0xff, 0xff, 0x37, 0x00, 0x40, 0x90, 0x24, 0xef, 0x0e, 0x00, 0x00, 0x30, + 0x91, 0x49, 0x32, 0x2d, 0xff, 0x6b, 0xb7, 0xbd, 0xbc, 0x3c, 0xef, 0x79, + 0xce, 0xde, 0xd6, 0xfd, 0xff, 0x9f, 0x00, 0x00, 0x92, 0xa6, 0xad, 0x0b, + 0x00, 0x00, 0x30, 0x11, 0x89, 0x8c, 0xcb, 0x5b, 0xba, 0xaf, 0xf6, 0xd7, + 0xe7, 0x35, 0xe7, 0x59, 0xb3, 0xfb, 0xff, 0xff, 0x7f, 0x04, 0x40, 0x80, + 0xe4, 0xb9, 0x1f, 0x00, 0x00, 0x48, 0x22, 0x91, 0x66, 0x79, 0xeb, 0xff, + 0xff, 0xdf, 0xbe, 0xbe, 0xe7, 0x8c, 0x75, 0x6b, 0x4a, 0xfa, 0xbf, 0x7f, + 0x00, 0x00, 0x82, 0x24, 0xef, 0x0e, 0x00, 0x00, 0x4c, 0x22, 0xb2, 0x79, + 0x5e, 0xfa, 0x5b, 0xa9, 0xfd, 0xeb, 0xf5, 0x9c, 0x3d, 0xc6, 0xcc, 0xee, + 0xed, 0x01, 0xf8, 0x00, 0x40, 0x82, 0xb6, 0xa9, 0x1b, 0x00, 0x00, 0x94, + 0x64, 0x66, 0x8e, 0xd3, 0x97, 0xfe, 0xff, 0xd7, 0xdf, 0x9f, 0x7b, 0xf3, + 0x3c, 0x35, 0x59, 0x6b, 0x00, 0x70, 0x00, 0x00, 0x40, 0xe4, 0xed, 0x1e, + 0x00, 0x00, 0x92, 0xc4, 0x34, 0xf3, 0xfc, 0xfd, 0x5f, 0xad, 0x7d, 0xfa, + 0x7a, 0xce, 0x8e, 0xb3, 0x76, 0x2f, 0xfd, 0x00, 0xe0, 0x04, 0x00, 0x9a, + 0x26, 0xaf, 0x1e, 0x00, 0x00, 0x13, 0x88, 0xcc, 0xb5, 0x3f, 0xbf, 0xff, + 0xff, 0xd7, 0xef, 0xef, 0xbd, 0x79, 0x6a, 0xde, 0xec, 0xab, 0x01, 0xc0, + 0x00, 0x00, 0x40, 0xb6, 0xbd, 0x1b, 0x00, 0x00, 0x05, 0x91, 0xeb, 0x5c, + 0xeb, 0xeb, 0xff, 0xff, 0xff, 0x7e, 0xef, 0x6b, 0xef, 0xcd, 0x99, 0xb3, + 0xe4, 0x07, 0x80, 0x00, 0x40, 0x49, 0xb2, 0xe5, 0x1a, 0x00, 0x80, 0x20, + 0x32, 0xb1, 0xe7, 0x79, 0x7f, 0xf7, 0xff, 0xfd, 0xeb, 0xbd, 0xfe, 0x2c, + 0x3d, 0x6b, 0xb6, 0xaf, 0x06, 0x80, 0x00, 0x00, 0x41, 0x96, 0xfe, 0x1e, + 0x00, 0x80, 0x44, 0xb2, 0x9b, 0xf9, 0xde, 0xff, 0xff, 0xff, 0x7f, 0xbf, + 0xf7, 0xbb, 0xb3, 0x77, 0xce, 0xce, 0xb6, 0x0d, 0x80, 0x01, 0x00, 0x49, + 0xf2, 0x94, 0x1f, 0x00, 0x40, 0x49, 0x44, 0xe6, 0x9e, 0x77, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xbf, 0xf7, 0x7e, 0xd6, 0xbc, 0xd9, 0xba, 0x3b, 0x80, + 0x00, 0x00, 0x64, 0x93, 0xf7, 0x1b, 0x00, 0x40, 0x89, 0xec, 0x7e, 0x67, + 0xbd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xce, 0xdb, 0x99, 0x33, 0x37, + 0xd3, 0x36, 0x80, 0x01, 0x80, 0x24, 0xda, 0xd6, 0x1e, 0x00, 0x20, 0x90, + 0x99, 0x99, 0x7b, 0xef, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbd, 0x37, + 0x63, 0xf3, 0x66, 0xdb, 0x7a, 0x80, 0x00, 0x00, 0x24, 0x59, 0xde, 0x1f, + 0x00, 0x60, 0x12, 0xb3, 0xf7, 0xdd, 0xfb, 0xfe, 0xff, 0xff, 0xff, 0xff, + 0xbf, 0xf7, 0xfe, 0x6e, 0xce, 0xdd, 0x6d, 0xd7, 0x80, 0x00, 0x80, 0x20, + 0xcb, 0xfb, 0x1f, 0x00, 0x10, 0x20, 0x6e, 0x66, 0x76, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xef, 0xde, 0xdb, 0x9b, 0x99, 0xb3, 0x5d, 0x6b, 0x81, + 0x00, 0x40, 0x96, 0x59, 0x6a, 0x1f, 0x00, 0x98, 0xc4, 0xe4, 0xdf, 0xff, + 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7b, 0x6f, 0x7b, 0x37, 0x7f, + 0xb3, 0xdd, 0x83, 0x00, 0x00, 0xb0, 0xed, 0xef, 0x1d, 0x00, 0x10, 0x88, + 0x9e, 0xdd, 0xcd, 0xbd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xed, + 0x6c, 0xe6, 0xcc, 0x76, 0x6d, 0xc1, 0x00, 0x40, 0x91, 0x24, 0x7b, 0x1f, + 0x00, 0x08, 0xd1, 0xf1, 0x66, 0x76, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xdf, 0xbd, 0xbf, 0xd9, 0xdd, 0xdd, 0xb6, 0x47, 0x00, 0x00, 0xd8, + 0xb4, 0xad, 0x1f, 0x00, 0x24, 0x24, 0x6f, 0xf6, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0xb7, 0x9d, 0x33, 0xd9, 0x96, 0x4e, + 0x00, 0x20, 0x49, 0xf7, 0xfd, 0x1e, 0x00, 0x48, 0xe4, 0xac, 0xb9, 0xdd, + 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xdd, 0x76, 0xb6, + 0xb7, 0xfd, 0x7a, 0x00, 0x00, 0x44, 0x96, 0xb7, 0x1f, 0x00, 0x02, 0x9a, + 0xbe, 0x6f, 0x77, 0xff, 0xff, 0x7f, 0x61, 0xd9, 0xff, 0xff, 0xff, 0xfd, + 0xdd, 0x66, 0xed, 0x66, 0x5b, 0x37, 0x00, 0x90, 0x64, 0xb9, 0xf6, 0x1f, + 0x00, 0x02, 0xc9, 0xf3, 0xee, 0xfd, 0xff, 0xff, 0x2f, 0x24, 0x4f, 0xfe, + 0xff, 0xff, 0x7f, 0x37, 0xdb, 0xcd, 0x7c, 0xff, 0x3a, 0x00, 0x88, 0x24, + 0xdb, 0xde, 0x1a, 0x00, 0x13, 0x31, 0x6f, 0xbb, 0xdf, 0xff, 0xff, 0x21, + 0xa0, 0x64, 0xf3, 0xff, 0xff, 0xe7, 0xff, 0x96, 0xbb, 0x9b, 0xa5, 0x1d, + 0x00, 0x60, 0x32, 0xe9, 0xdb, 0x0f, 0x00, 0x65, 0xe6, 0x3c, 0xfb, 0xf6, + 0xff, 0x7f, 0x10, 0xa4, 0xb5, 0x9d, 0xfe, 0xdf, 0xdf, 0xdd, 0x6d, 0x32, + 0xb3, 0x7d, 0x0d, 0x00, 0x0b, 0x93, 0x7c, 0x7b, 0x0f, 0x00, 0x89, 0xdc, + 0xb3, 0xed, 0xfb, 0xff, 0x1f, 0x10, 0x90, 0x92, 0xd9, 0xfe, 0x7f, 0xff, + 0x77, 0xdb, 0xee, 0x6e, 0xdb, 0x0e, 0x00, 0x20, 0xdd, 0x66, 0x6f, 0x0f, + 0x80, 0x91, 0x5a, 0xfb, 0xbe, 0xef, 0xff, 0x0f, 0x10, 0xda, 0x92, 0xee, + 0xff, 0xff, 0xff, 0xf7, 0xb7, 0xcd, 0xee, 0xde, 0x07, 0x00, 0x24, 0x49, + 0xb6, 0xed, 0x0f, 0x00, 0x12, 0x6b, 0xcd, 0xf3, 0xbe, 0xff, 0x07, 0x08, + 0x48, 0xda, 0x76, 0xb7, 0xff, 0xff, 0xdd, 0x6e, 0xba, 0x99, 0x65, 0x03, + 0x40, 0x92, 0xe4, 0xba, 0xbd, 0x0e, 0x80, 0x62, 0xed, 0x7d, 0x5f, 0xf7, + 0xff, 0x01, 0x08, 0x28, 0xc9, 0x26, 0xbb, 0xff, 0xff, 0xff, 0x99, 0xb7, + 0xbb, 0x7d, 0x03, 0x00, 0x89, 0x64, 0xdb, 0xf6, 0x07, 0x40, 0x0c, 0x35, + 0xe7, 0x79, 0xdd, 0xff, 0x01, 0x84, 0xa5, 0x7d, 0xba, 0xdd, 0xfe, 0x7f, + 0xbf, 0xbf, 0x6d, 0x76, 0xdb, 0x01, 0x00, 0x48, 0x36, 0xdb, 0xd6, 0x07, + 0xc0, 0x88, 0xb4, 0xb6, 0xbf, 0xff, 0x7f, 0x00, 0x0c, 0x24, 0x44, 0xdb, + 0xed, 0xff, 0xdf, 0xef, 0x6e, 0xdb, 0x6e, 0xb7, 0x00, 0x80, 0x44, 0x93, + 0xed, 0x5b, 0x07, 0x40, 0x91, 0xd2, 0xfa, 0xfc, 0xf6, 0x7f, 0x00, 0x02, + 0xb4, 0x35, 0xd9, 0xef, 0xff, 0xff, 0xfb, 0xef, 0xb6, 0xc9, 0xe4, 0x00, + 0x10, 0x24, 0xd9, 0x6d, 0xfb, 0x03, 0x00, 0x27, 0xfe, 0xd3, 0xd6, 0xdb, + 0x3f, 0x00, 0xa2, 0x94, 0xb4, 0xdb, 0x7c, 0xff, 0xff, 0xbf, 0xd9, 0xad, + 0xdb, 0x7d, 0x00, 0x40, 0x32, 0xd9, 0xb6, 0xef, 0x03, 0x60, 0xe4, 0x5a, + 0x5f, 0x5f, 0xff, 0x1f, 0x00, 0x02, 0x52, 0x92, 0xec, 0xb6, 0xff, 0xff, + 0xef, 0xff, 0x6d, 0xb6, 0x3b, 0x00, 0x28, 0x90, 0xcc, 0xbe, 0xfd, 0x03, + 0xa0, 0x88, 0xeb, 0xf9, 0xfd, 0xf5, 0x1f, 0x00, 0x82, 0x53, 0xbb, 0x6d, + 0xf7, 0xff, 0xf9, 0xff, 0x6f, 0xdb, 0x6d, 0x1b, 0x00, 0x04, 0xc9, 0x66, + 0xdb, 0x57, 0x03, 0xa0, 0x52, 0xaf, 0xa7, 0x97, 0xff, 0x0f, 0x00, 0x51, + 0x48, 0xda, 0x66, 0xdb, 0xff, 0xf8, 0xdf, 0xed, 0xbe, 0xed, 0x0e, 0x00, + 0x92, 0x64, 0x32, 0xeb, 0xf6, 0x01, 0x20, 0x63, 0xbd, 0xbc, 0xfc, 0xfa, + 0x0f, 0x00, 0x09, 0x20, 0x89, 0x3e, 0xff, 0xff, 0xe0, 0x7f, 0xdf, 0x6f, + 0xdb, 0x07, 0x00, 0x01, 0x24, 0xbb, 0xed, 0xfe, 0x01, 0xa0, 0xce, 0xf5, + 0xf6, 0xdb, 0xdf, 0x07, 0x00, 0x41, 0xad, 0x5f, 0xf2, 0xed, 0xff, 0xc0, + 0xff, 0xbf, 0xdd, 0x92, 0x03, 0x00, 0x44, 0xb2, 0xd9, 0x7d, 0xfb, 0x01, + 0xe0, 0xaa, 0xdf, 0x9b, 0x7f, 0xfb, 0x07, 0x80, 0x28, 0x21, 0x64, 0xbb, + 0x7f, 0x7f, 0x80, 0xff, 0xf6, 0xbb, 0xee, 0x03, 0x80, 0x22, 0x99, 0xed, + 0xb6, 0xff, 0x00, 0x90, 0xb8, 0x5e, 0x5b, 0x6b, 0xed, 0x03, 0x00, 0x01, + 0xa6, 0x6d, 0xdb, 0xf6, 0x7f, 0x00, 0xff, 0xff, 0xf6, 0xcd, 0x00, 0x40, + 0x10, 0xc9, 0x6c, 0xff, 0xf7, 0x00, 0xa0, 0xe3, 0x72, 0xeb, 0xef, 0xff, + 0x03, 0x80, 0xe0, 0x90, 0x24, 0xdb, 0xbd, 0x3f, 0x00, 0xfe, 0xdb, 0x6f, + 0xfb, 0x00, 0x00, 0x89, 0x4c, 0xb6, 0xd9, 0x7e, 0x00, 0x70, 0xaf, 0xaf, + 0x6f, 0xb5, 0xde, 0x03, 0x80, 0x94, 0x92, 0xb6, 0xf9, 0xf6, 0x3f, 0x00, + 0xfc, 0xbf, 0xdd, 0x7b, 0x00, 0x10, 0x48, 0x26, 0xb3, 0xdf, 0x7f, 0x00, + 0x70, 0xd8, 0xae, 0xfd, 0xff, 0xf7, 0x03, 0x80, 0x00, 0xd2, 0x36, 0xcf, + 0xdf, 0x3f, 0x00, 0xb8, 0x6d, 0xdf, 0x16, 0x00, 0x48, 0x44, 0xb2, 0xfb, + 0x6c, 0x3f, 0x00, 0x50, 0x75, 0xfd, 0xa5, 0xd5, 0xfe, 0x01, 0x40, 0xd1, + 0x12, 0xa2, 0x7d, 0xfb, 0x1f, 0x00, 0xf0, 0xff, 0xbf, 0x0d, 0x00, 0x20, + 0x12, 0x9b, 0xcd, 0xf6, 0x3f, 0x00, 0x90, 0xd5, 0xa7, 0xfd, 0x77, 0xab, + 0x03, 0x40, 0x1c, 0xc8, 0xbe, 0x6d, 0xfb, 0x1f, 0x00, 0xe0, 0xff, 0xee, + 0x07, 0x00, 0x04, 0x91, 0xc9, 0x7e, 0xbf, 0x1f, 0x00, 0x30, 0x57, 0xbf, + 0xa6, 0xde, 0xfd, 0x01, 0x40, 0x40, 0x6b, 0xd3, 0x6e, 0xef, 0x0f, 0x00, + 0xc0, 0xeb, 0x7d, 0x03, 0x00, 0x90, 0xc8, 0x6c, 0x76, 0xfb, 0x0f, 0x00, + 0x70, 0x5c, 0xe5, 0xf7, 0xfa, 0xeb, 0x01, 0x40, 0x50, 0x49, 0x92, 0xf4, + 0xfd, 0x0f, 0x00, 0xc0, 0xff, 0xdb, 0x01, 0x80, 0x44, 0x44, 0x66, 0xbb, + 0x6f, 0x0f, 0x00, 0xd0, 0xf1, 0x95, 0xf6, 0x6f, 0xad, 0x01, 0x40, 0x08, + 0x78, 0xdb, 0xb6, 0xef, 0x0f, 0x00, 0x00, 0xdf, 0xd6, 0x00, 0x00, 0x20, + 0x32, 0xb3, 0xdb, 0xfd, 0x0f, 0x00, 0x10, 0xd7, 0xf7, 0xb6, 0xd8, 0xeb, + 0x03, 0x20, 0x43, 0x27, 0xd9, 0xb6, 0xfd, 0x0f, 0x00, 0x00, 0xff, 0x7e, + 0x00, 0x40, 0x12, 0x93, 0xd9, 0xec, 0xb6, 0x07, 0x00, 0x70, 0x55, 0xdd, + 0xf6, 0x6f, 0xbb, 0x01, 0x40, 0x28, 0xa1, 0x6f, 0xb6, 0xb7, 0x0f, 0x00, + 0x00, 0xde, 0x1f, 0x00, 0x80, 0x88, 0xd8, 0xcc, 0x66, 0xff, 0x03, 0x00, + 0x70, 0xf4, 0xf5, 0xdb, 0xaa, 0xee, 0x01, 0x60, 0x28, 0x2d, 0x49, 0xf7, + 0xf6, 0x07, 0x00, 0x00, 0x7c, 0x0f, 0x00, 0x08, 0x48, 0x66, 0x6e, 0xfb, + 0xef, 0x03, 0x00, 0xd0, 0xd5, 0xdf, 0x52, 0xff, 0xda, 0x03, 0x20, 0xa3, + 0xa5, 0xd9, 0xb2, 0xff, 0x07, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x20, 0x22, + 0x33, 0x37, 0xbf, 0xfd, 0x01, 0x00, 0x70, 0x5f, 0xf7, 0xfe, 0xab, 0x6b, + 0x02, 0xa0, 0xa8, 0xb4, 0x6d, 0xdf, 0xf6, 0x07, 0x00, 0x00, 0xf8, 0x01, + 0x00, 0x12, 0x33, 0x11, 0xd9, 0xdd, 0xff, 0x01, 0x00, 0x70, 0x75, 0xd5, + 0x52, 0xea, 0x8a, 0x03, 0x20, 0x84, 0x36, 0x69, 0xba, 0xdb, 0x07, 0x00, + 0x00, 0xf0, 0x01, 0x00, 0x81, 0xc8, 0xcc, 0xdd, 0xed, 0xff, 0x00, 0x00, + 0x60, 0xd5, 0xdf, 0xf6, 0xae, 0x6b, 0x03, 0x00, 0xa1, 0xa4, 0x6d, 0xdf, + 0xfe, 0x07, 0x00, 0x00, 0x60, 0x00, 0x40, 0x44, 0xc6, 0xcc, 0x64, 0xb7, + 0xfd, 0x00, 0x00, 0xe0, 0x55, 0xf7, 0xd6, 0xea, 0xba, 0x07, 0x20, 0x94, + 0x94, 0x6d, 0xfb, 0xdb, 0x07, 0x00, 0x00, 0x20, 0x00, 0x20, 0x20, 0x32, + 0x76, 0x77, 0xff, 0x7f, 0x00, 0x00, 0x60, 0x7d, 0xd5, 0xb6, 0x3f, 0xaf, + 0x06, 0xa0, 0xa4, 0x95, 0x6c, 0x9b, 0xee, 0x07, 0x00, 0x00, 0x18, 0x00, + 0x10, 0x92, 0x15, 0x73, 0xbb, 0xd9, 0x3f, 0x00, 0x00, 0xe0, 0xf5, 0xff, + 0xf7, 0x6a, 0xa9, 0x06, 0x80, 0xa2, 0xb4, 0x6d, 0xfb, 0xfb, 0x07, 0x00, + 0x00, 0x04, 0x00, 0x84, 0x88, 0xc8, 0x99, 0xdd, 0xff, 0x3f, 0x00, 0x00, + 0xe0, 0x8b, 0xff, 0x96, 0x6a, 0xb6, 0x0a, 0xa0, 0x94, 0x96, 0x64, 0xdb, + 0xee, 0x07, 0x00, 0x00, 0x03, 0x08, 0x20, 0x60, 0x66, 0xec, 0xee, 0xb6, + 0x1d, 0x00, 0x00, 0xc0, 0x7e, 0xa5, 0xf4, 0xab, 0x55, 0x0d, 0x20, 0xe7, + 0xd4, 0x6d, 0xdb, 0xfb, 0x07, 0x00, 0x80, 0x00, 0x00, 0x09, 0x12, 0x33, + 0x67, 0x77, 0xff, 0x0f, 0x00, 0x00, 0xc0, 0xfa, 0xff, 0xb7, 0x7a, 0x55, + 0x19, 0x90, 0x91, 0xd4, 0x64, 0xdb, 0xee, 0x07, 0x00, 0x40, 0x00, 0x81, + 0x04, 0x88, 0x91, 0x3b, 0xbb, 0xfd, 0x0f, 0x00, 0x00, 0xc0, 0xab, 0xbf, + 0xed, 0x4e, 0xbb, 0x32, 0x20, 0x94, 0x96, 0x6c, 0xff, 0xfa, 0x03, 0x00, + 0x30, 0x40, 0x20, 0x20, 0x64, 0xcc, 0xdc, 0xdd, 0xff, 0x07, 0x00, 0x00, + 0xc0, 0xeb, 0xea, 0xfd, 0xd5, 0xaa, 0x2a, 0x20, 0xd7, 0xb0, 0x6d, 0x93, + 0xef, 0x07, 0x00, 0x08, 0x00, 0x08, 0x01, 0x23, 0xee, 0xee, 0xee, 0xfb, + 0x03, 0x00, 0x00, 0xc0, 0xfe, 0xff, 0x2d, 0xdd, 0x6a, 0x49, 0xd0, 0x90, + 0x9a, 0x64, 0xdf, 0xea, 0x07, 0x00, 0x03, 0x80, 0x40, 0x8c, 0x98, 0x33, + 0xb3, 0xbb, 0xff, 0x01, 0x00, 0x00, 0xc0, 0xa5, 0x7b, 0x6d, 0xa7, 0x56, + 0xc5, 0xa0, 0x94, 0x94, 0x6f, 0xd3, 0xbb, 0x07, 0x80, 0x10, 0x0c, 0x12, + 0x40, 0xc6, 0xb9, 0xdb, 0xfb, 0xfd, 0x01, 0x00, 0x00, 0x80, 0x97, 0xee, + 0xdf, 0xba, 0x54, 0x1a, 0xa1, 0xe5, 0xd2, 0x64, 0x7e, 0xee, 0x07, 0x60, + 0x02, 0x80, 0x00, 0x31, 0x62, 0xcc, 0xdc, 0xee, 0x7f, 0x00, 0x00, 0x00, + 0x80, 0xff, 0xff, 0xdb, 0xaa, 0xb5, 0x8a, 0x86, 0x98, 0x96, 0x6d, 0x9b, + 0xea, 0x07, 0x98, 0x00, 0x22, 0x44, 0x88, 0x39, 0x77, 0x77, 0xff, 0x7f, + 0x00, 0x00, 0x00, 0x80, 0x7d, 0x77, 0xba, 0x7b, 0x2d, 0x55, 0x3c, 0xa6, + 0xb4, 0x6c, 0xf6, 0xaf, 0x07, 0x07, 0x90, 0x88, 0x20, 0x42, 0x9c, 0xbb, + 0xbb, 0xbb, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x4b, 0xbd, 0xbf, 0x55, 0x53, + 0xa5, 0xb2, 0xa1, 0xb4, 0xc9, 0x9f, 0xda, 0xcf, 0x28, 0x24, 0x42, 0x08, + 0x31, 0xe6, 0xcc, 0xdd, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xef, + 0xb7, 0xbd, 0xde, 0x12, 0xd1, 0xac, 0x95, 0x4d, 0xf2, 0x56, 0x9f, 0x88, + 0x80, 0x10, 0xc2, 0x9c, 0x73, 0x77, 0xef, 0xfe, 0x7f, 0x00, 0x00, 0x00, + 0x00, 0xbf, 0xfb, 0xed, 0xeb, 0x35, 0x95, 0x72, 0xa2, 0x35, 0xcd, 0xb6, + 0xd6, 0x2f, 0x21, 0x24, 0x04, 0x31, 0xc6, 0x98, 0x33, 0xf7, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0x7f, 0x5b, 0xab, 0x2d, 0x28, 0x23, + 0x65, 0xd9, 0xb6, 0x55, 0x5f, 0x88, 0x08, 0x43, 0x0c, 0x61, 0xde, 0xdd, + 0xfb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x76, 0xff, 0x4d, 0xd7, 0x4d, + 0x4a, 0xa5, 0x29, 0x2d, 0xdb, 0xbe, 0x55, 0x1f, 0x22, 0x42, 0x28, 0xc2, + 0x39, 0xe7, 0xee, 0xee, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x7f, + 0xfb, 0xb6, 0xb6, 0x95, 0x70, 0x2e, 0xa5, 0xd9, 0x24, 0x5d, 0x5f, 0x8a, + 0x28, 0x88, 0x31, 0x9e, 0x39, 0x73, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0xec, 0xb7, 0xdf, 0x6c, 0xb5, 0x65, 0x26, 0xa3, 0x39, 0x9b, 0xfc, + 0x85, 0x5d, 0x21, 0x04, 0x63, 0x1c, 0xe6, 0xdd, 0xbd, 0xfb, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0xb8, 0xfa, 0xb6, 0x6f, 0x4d, 0x9a, 0x28, 0x59, + 0x4d, 0xd3, 0x2f, 0xf5, 0x3f, 0x8c, 0xd1, 0x18, 0xc6, 0x31, 0xf6, 0xdd, + 0xfe, 0xff, 0xfe, 0x01, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xef, 0xb9, 0xb6, + 0x25, 0xe1, 0x4d, 0x69, 0xba, 0x6c, 0xad, 0x3c, 0x41, 0x14, 0x84, 0xe9, + 0x9e, 0x37, 0xf7, 0xff, 0xff, 0xfb, 0x03, 0x00, 0x00, 0x00, 0x70, 0x5d, + 0x3d, 0x9f, 0x3d, 0x6d, 0x26, 0x52, 0x59, 0xb6, 0x6d, 0xab, 0x7f, 0x14, + 0x82, 0xe1, 0x39, 0xe6, 0xdd, 0xfb, 0xff, 0xbf, 0xff, 0x01, 0x00, 0x00, + 0x00, 0xf0, 0xf6, 0x6f, 0x77, 0xcd, 0x92, 0xd0, 0x52, 0x4b, 0xb3, 0x49, + 0x0b, 0x3a, 0x41, 0x61, 0x38, 0x9e, 0x73, 0xee, 0xdc, 0xff, 0xff, 0xfd, + 0x03, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xd7, 0x65, 0xda, 0x66, 0x63, 0x9d, + 0xf2, 0x36, 0x7b, 0x6a, 0x7f, 0x14, 0x18, 0x8e, 0xe7, 0xd9, 0x7b, 0xff, + 0xff, 0xef, 0xff, 0x03, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xdd, 0xb6, + 0xc9, 0x4c, 0x46, 0x9a, 0x64, 0xcb, 0x5b, 0xed, 0x06, 0xc6, 0xe3, 0x71, + 0xde, 0xbd, 0xff, 0xff, 0x7f, 0xff, 0x07, 0x00, 0x00, 0x00, 0xc0, 0x7f, + 0x7f, 0xff, 0x59, 0x37, 0x75, 0xbb, 0x96, 0x66, 0xdb, 0x56, 0xf7, 0xe0, + 0xf2, 0x74, 0x9e, 0x77, 0xef, 0xfd, 0xff, 0xeb, 0xed, 0x03, 0x00, 0x00, + 0x00, 0xc0, 0xea, 0xdf, 0xb3, 0xdb, 0xde, 0xc6, 0x81, 0xb0, 0x6c, 0xba, + 0xb4, 0xf6, 0x38, 0x18, 0x3c, 0xe7, 0x9c, 0xfb, 0xff, 0x7f, 0xff, 0xff, + 0x07, 0x00, 0x00, 0x00, 0x80, 0xff, 0xf7, 0x6e, 0x66, 0xd9, 0x99, 0xac, + 0xa4, 0xcd, 0x96, 0xa5, 0xea, 0x03, 0xa7, 0xcf, 0x79, 0xef, 0xfd, 0xff, + 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfd, 0xef, 0xdf, + 0x6f, 0xef, 0x72, 0x65, 0xd9, 0xb6, 0xad, 0xe8, 0xc1, 0xe1, 0xf1, 0xbe, + 0x7b, 0xef, 0xff, 0xdf, 0x7a, 0xfb, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfe, + 0x5f, 0xdd, 0x9d, 0xac, 0x99, 0x84, 0x29, 0xcd, 0x3c, 0x4f, 0x9d, 0x7d, + 0x3c, 0x9e, 0xe7, 0xbe, 0xff, 0xff, 0xff, 0xff, 0xef, 0x0f, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0xff, 0x77, 0x7b, 0x33, 0xe7, 0x5a, 0x49, 0x9b, 0x65, + 0x59, 0x75, 0x07, 0x97, 0xf7, 0xbb, 0xef, 0xff, 0xff, 0xdb, 0xfe, 0xff, + 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf7, 0x3f, 0xe7, 0xcf, 0x9c, 0x51, + 0x4d, 0xb0, 0x6d, 0x4b, 0xc9, 0xd3, 0xf5, 0x79, 0xfe, 0xfb, 0xff, 0xff, + 0xdb, 0xda, 0xfe, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xef, 0xde, + 0xdd, 0xf3, 0x4d, 0x52, 0x36, 0xcb, 0xd2, 0x3a, 0x7e, 0x3c, 0xde, 0xe7, + 0xbe, 0xff, 0x7f, 0xda, 0xff, 0xdf, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf8, + 0xff, 0xfb, 0xdd, 0x73, 0x8f, 0xa5, 0x9a, 0xe6, 0xd9, 0xb6, 0xe2, 0x4e, + 0xc7, 0xf7, 0xfd, 0xff, 0xff, 0xff, 0xf7, 0xf6, 0xff, 0x0f, 0x00, 0x00, + 0x00, 0x00, 0xe0, 0xff, 0xff, 0x7f, 0xee, 0x79, 0xb2, 0xb2, 0x2c, 0x9f, + 0xb6, 0x54, 0xfe, 0xfb, 0x79, 0xbf, 0xff, 0xff, 0x5f, 0xda, 0xff, 0xfa, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xf7, 0xbf, 0xe7, 0x4b, + 0xb4, 0x69, 0xd3, 0x2c, 0x25, 0xbd, 0xbc, 0xcf, 0xf7, 0xfd, 0xff, 0xd7, + 0xf6, 0xfe, 0xdf, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xbf, 0x9d, + 0xf1, 0x3e, 0x57, 0x25, 0xcb, 0xb6, 0x6d, 0xa9, 0xb5, 0xef, 0xfb, 0xff, + 0xff, 0xff, 0xd5, 0xda, 0xd6, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x80, + 0xff, 0xff, 0xfb, 0xcf, 0xf5, 0x25, 0x65, 0xd9, 0x66, 0x5b, 0x4a, 0xfa, + 0xf9, 0x7e, 0xff, 0xff, 0xff, 0xf6, 0xd6, 0xdf, 0xfa, 0x0f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xfe, 0xff, 0xef, 0x3e, 0xf7, 0x9f, 0x5b, 0x92, 0x6c, + 0xdb, 0x52, 0xe5, 0xbe, 0xdf, 0xff, 0xff, 0xbf, 0x51, 0xda, 0xfa, 0x7f, + 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7b, 0x9f, 0xe7, + 0x4c, 0xb3, 0x4d, 0xd3, 0x54, 0xd9, 0xe7, 0xfb, 0xff, 0xff, 0x5f, 0xdc, + 0xfa, 0xdf, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x7f, + 0xe7, 0xf9, 0x3a, 0xd3, 0xa6, 0xe9, 0xb6, 0xa5, 0xca, 0xf9, 0xfd, 0xff, + 0xff, 0x83, 0x42, 0xd2, 0xff, 0xfb, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xf0, 0xff, 0xfd, 0xbf, 0xef, 0x4f, 0xd5, 0x64, 0xdb, 0x26, 0x4d, 0x30, + 0x7f, 0xff, 0xff, 0xff, 0x91, 0xda, 0xdb, 0xda, 0xdf, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe0, 0xff, 0xbf, 0xff, 0x7d, 0xbe, 0xb5, 0x6d, 0x97, + 0x6d, 0x93, 0x56, 0xdf, 0xff, 0xff, 0x7f, 0x81, 0x4a, 0xda, 0x7f, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xef, 0xeb, 0xbb, + 0xa6, 0x4d, 0x73, 0xcd, 0x92, 0xaa, 0xfe, 0xff, 0xff, 0x1f, 0x01, 0x6a, + 0x5b, 0xfb, 0xfb, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xfd, 0xbf, 0x5f, 0x3b, 0xdb, 0x36, 0xbb, 0x26, 0x4c, 0xf9, 0xff, 0xff, + 0x0f, 0xa3, 0x2a, 0xe9, 0x7f, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xee, 0xff, 0xff, 0xfe, 0xfe, 0xcc, 0x91, 0xec, 0x93, 0x6d, 0x93, + 0xf2, 0xff, 0xff, 0x03, 0x00, 0x6a, 0x6d, 0x6f, 0xff, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xf7, 0x6f, 0x76, 0xb6, 0xcd, + 0x76, 0xc9, 0x2a, 0xe9, 0xff, 0xff, 0x00, 0x02, 0x24, 0xed, 0xf9, 0xed, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xdf, 0xff, + 0xd9, 0x66, 0x9b, 0x6c, 0x93, 0x54, 0xc5, 0xff, 0x3f, 0x00, 0x01, 0x95, + 0xb5, 0xaf, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, + 0xff, 0xff, 0xfd, 0xae, 0x7d, 0xde, 0x6d, 0xf6, 0xa1, 0x8a, 0xff, 0x0f, + 0x00, 0x81, 0x90, 0xb4, 0xfd, 0xfd, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xcd, 0xb2, 0xdb, 0x2c, 0xcb, + 0x54, 0xfe, 0x01, 0x00, 0x01, 0xd2, 0xb6, 0xb7, 0xff, 0x0f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x39, 0xdb, 0x76, + 0xb3, 0x4b, 0xb6, 0x0a, 0xfe, 0x00, 0x00, 0x01, 0x48, 0xda, 0xfe, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, + 0xcf, 0xb9, 0x6d, 0xb6, 0xd9, 0xa5, 0x75, 0x1c, 0x00, 0x80, 0x80, 0x20, + 0xdb, 0xda, 0xbe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, + 0xff, 0xff, 0xff, 0x77, 0x96, 0xd9, 0x26, 0xb3, 0x4d, 0x82, 0x11, 0x00, + 0x80, 0x80, 0x24, 0x6d, 0xff, 0xf7, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xbb, 0x67, 0xdb, 0xdd, 0x36, 0xd9, + 0x54, 0x60, 0x00, 0xc0, 0x00, 0x92, 0x65, 0x6b, 0xff, 0x0f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x4f, 0x7d, 0x96, + 0xd9, 0x6c, 0x36, 0xad, 0xc2, 0x00, 0x60, 0x00, 0xc8, 0xb6, 0x6d, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, + 0xff, 0xc8, 0x76, 0xbb, 0xcb, 0x64, 0x52, 0x02, 0x03, 0x10, 0x00, 0x64, + 0xda, 0xff, 0xfb, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0xff, 0xff, 0x5f, 0xd7, 0x4d, 0x33, 0x99, 0xdd, 0x96, 0x04, 0x2c, + 0x1c, 0x40, 0x22, 0xdb, 0xb6, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xdf, 0xb5, 0xed, 0xe6, 0x36, 0x9b, + 0x6c, 0x29, 0xf0, 0x03, 0x00, 0x99, 0x6c, 0xfb, 0xfd, 0x07, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x35, 0xbb, + 0xec, 0x76, 0x33, 0x91, 0x02, 0x00, 0x00, 0x00, 0x64, 0x67, 0xdf, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xbf, 0x6f, 0x9b, 0x9d, 0xc9, 0xce, 0x36, 0x49, 0x00, 0x00, 0x00, 0x93, + 0xb1, 0xdd, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x40, 0xff, 0x6a, 0x76, 0xbb, 0xdd, 0xd9, 0x64, 0x12, 0x01, + 0x00, 0x40, 0x98, 0xdd, 0x6d, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, 0x66, 0x73, 0x33, 0xbb, + 0x9d, 0x4d, 0x00, 0x00, 0x00, 0x63, 0xe6, 0xf6, 0xff, 0x07, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xed, 0xfd, + 0xee, 0xee, 0x36, 0x73, 0x2b, 0x04, 0x00, 0xa0, 0x38, 0x75, 0xbf, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x7f, 0xd9, 0xec, 0xce, 0x66, 0x66, 0x66, 0x22, 0x04, 0x00, 0xc6, + 0x99, 0xbb, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5e, 0xb3, 0xdb, 0xb9, 0xcd, 0xc9, 0x88, 0x89, + 0x00, 0x68, 0x31, 0xee, 0xdd, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xbe, 0xbb, 0x9b, 0x3f, + 0xbb, 0x33, 0x23, 0x04, 0x00, 0x8c, 0xf3, 0xee, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x67, + 0x76, 0x77, 0xb2, 0x66, 0xce, 0x0c, 0xd1, 0xd6, 0xe3, 0x79, 0xf7, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf8, 0xfd, 0xef, 0xe6, 0xee, 0xce, 0x9c, 0x31, 0x16, 0x00, 0x3c, + 0x9e, 0xfb, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x78, 0x9f, 0xdb, 0xdc, 0x9d, 0x99, 0x33, 0xc6, + 0xc1, 0xff, 0x8f, 0xe7, 0xbb, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf7, 0xbd, 0xbb, 0x33, + 0x7b, 0xee, 0x18, 0x1e, 0x50, 0xf0, 0xf9, 0xfe, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7b, + 0xf7, 0x77, 0xf7, 0xe6, 0x9c, 0xe3, 0xf0, 0x4d, 0xff, 0x7c, 0xef, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc0, 0xdf, 0x76, 0x7f, 0xcf, 0x9e, 0x73, 0x8f, 0x07, 0xff, 0x0b, + 0xdf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0xee, 0xcd, 0xdd, 0x9d, 0x7b, 0xf7, 0x7c, + 0x7a, 0x00, 0xf0, 0xe7, 0xfd, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7f, 0xbf, 0xdd, 0x7b, + 0x6b, 0x9e, 0xf3, 0xe1, 0xff, 0xff, 0x7d, 0xff, 0x7f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, + 0xb7, 0xbb, 0x7b, 0xee, 0x79, 0x8f, 0x0f, 0xfa, 0x2f, 0xff, 0xf7, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7e, 0xff, 0x77, 0xef, 0xdd, 0x77, 0x7c, 0xfe, 0x02, 0xe8, + 0xcf, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xef, 0xee, 0xdd, 0xb3, 0xcf, 0xf3, + 0xf1, 0xff, 0xff, 0xf9, 0xfe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfb, 0xff, 0xbf, + 0xef, 0xbe, 0xcf, 0x8f, 0xfe, 0x5f, 0xfe, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, + 0xbf, 0xbb, 0xf7, 0xde, 0x79, 0x3e, 0xff, 0x52, 0xd2, 0xdf, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xe0, 0xef, 0xef, 0xef, 0x3c, 0xef, 0xf9, 0xf8, 0xff, 0xff, + 0xf7, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xee, 0xdc, 0xf7, 0xfe, 0xe7, + 0x97, 0xfe, 0xff, 0xfe, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbf, + 0xef, 0xbf, 0x3e, 0xff, 0xda, 0xf6, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xfe, 0xbf, 0xf7, 0xfe, 0xf7, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xfe, 0xff, 0xde, 0xbd, 0xef, 0xfb, 0xd7, 0xff, 0xbf, + 0xfd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xf7, 0x7d, 0xbf, + 0xff, 0xd2, 0xf6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xbf, + 0xef, 0xfb, 0xfd, 0xfd, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc0, 0xff, 0xef, 0xbe, 0xf7, 0xef, 0xef, 0xff, 0xff, 0xff, 0x3f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfb, 0xdf, 0xbf, 0xff, 0xff, 0xff, + 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, + 0xfe, 0xff, 0xfb, 0xf7, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf0, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xfd, 0xff, 0xff, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xfc, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, + 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; diff --git a/test/extended_color.c b/test/extended_color.c new file mode 100644 index 000000000000..d588284de544 --- /dev/null +++ b/test/extended_color.c @@ -0,0 +1,251 @@ +/**************************************************************************** + * Copyright (c) 2017-2018,2019 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: extended_color.c,v 1.14 2019/08/24 23:09:18 tom Exp $ + */ + +#include + +#if USE_EXTENDED_COLOR + +#define SHOW(n) ((n) == ERR ? "ERR" : "OK") + +#if USE_SP_FUNCS +static bool opt_s = FALSE; +#define if_opt_s(a,b) (opt_s ? (a) : (b)) +#else +#define if_opt_s(a,b) (b) +#endif + +static void +failed(const char *name) +{ + printw("...%s failed", name); + getch(); + endwin(); + ExitProgram(EXIT_FAILURE); +} + +static void +do_pair_content(SCREEN *sp, int pair) +{ + int i, f, b; + + (void) sp; + i = if_opt_s(extended_pair_content_sp(sp, pair, &f, &b), + extended_pair_content(0, &f, &b)); + if (i != OK) + failed("pair_content"); + printw("pair %d contains (%d,%d)\n", pair, f, b); + getch(); +} + +static void +do_init_pair(SCREEN *sp, int pair, int fg, int bg) +{ + int i; + + (void) sp; + i = if_opt_s(init_extended_pair_sp(sp, pair, fg, bg), + init_extended_pair(pair, fg, bg)); + if (i != OK) + failed("init_pair"); +} + +static void +do_init_color(SCREEN *sp, int color, int adjust) +{ + int r, g, b; + int i; + + (void) sp; + i = if_opt_s(extended_color_content_sp(sp, color, &r, &g, &b), + extended_color_content(color, &r, &g, &b)); + if (i != OK) + failed("color_content"); + + r = (adjust + 1000 + r) % 1000; + g = (adjust + 1000 + g) % 1000; + b = (adjust + 1000 + b) % 1000; + + i = if_opt_s(init_extended_color_sp(sp, color, r, g, b), + init_extended_color(color, r, g, b)); + if (i != OK) + failed("init_color"); +} + +static void +do_color_set(const char *expected, int pair) +{ + int i = color_set((short) pair, (void *) &pair); + printw("%s (%s)\n", expected, SHOW(i)); + if (i != OK) + failed("color_set"); + getch(); +} + +static void +show_1_rgb(SCREEN *sp, const char *name, int color, int y, int x) +{ + int r, g, b; + int i; + + (void) sp; + i = if_opt_s(extended_color_content_sp(sp, color, &r, &g, &b), + extended_color_content(color, &r, &g, &b)); + wmove(stdscr, y, x); + if (i == OK) { + printw("%-8s %3d/%3d/%3d", name, r, g, b); + } else { + printw("%-8s %s", name, SHOW(i)); + } +} + +static void +show_rgb(SCREEN *sp) +{ + int y, x; + getyx(stdscr, y, x); + show_1_rgb(sp, "RED", COLOR_RED, y + 1, x); + show_1_rgb(sp, "GREEN", COLOR_GREEN, y + 2, x); + show_1_rgb(sp, "BLUE", COLOR_BLUE, y + 3, x); + wmove(stdscr, y, x); +} + +static void +usage(void) +{ + static const char *tbl[] = + { + "Usage: extended_color", + "", + "Options:", + " -s use sp-funcs", + NULL + }; + size_t n; + for (n = 0; n < SIZEOF(tbl); ++n) { + fprintf(stderr, "%s\n", tbl[n]); + } + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + int i; + SCREEN *sp; + + while ((i = getopt(argc, argv, "s")) != -1) { + switch (i) { +#if USE_SP_FUNCS + case 's': + opt_s = TRUE; + break; +#endif + default: + usage(); + /* NOTREACHED */ + } + } + + slk_init(1); + sp = newterm(NULL, stdout, stdin); + cbreak(); + noecho(); + + if (!has_colors()) { + endwin(); + fprintf(stderr, "This demo requires a color terminal\n"); + ExitProgram(EXIT_FAILURE); + } + + start_color(); + + do_pair_content(sp, 0); + + printw("Initializing pair 1 to red/black\n"); + do_init_pair(sp, 1, COLOR_RED, COLOR_BLACK); + do_color_set("RED/BLACK", 1); + + printw("Initializing pair 2 to white/blue\n"); + do_init_pair(sp, 2, COLOR_WHITE, COLOR_BLUE); + do_color_set("WHITE/BLUE", 2); + + printw("Initializing pair 3 to green/black\n"); + do_init_pair(sp, 3, COLOR_GREEN, COLOR_BLACK); + do_color_set("GREEN/BLACK", 3); + + printw("Resetting colors to pair 0\n"); + do_color_set("Default Colors", 0); + + printw("Resetting colors to pair 1\n"); + do_color_set("RED/BLACK", 1); + + printw("Drawing soft-key tabs with pair 2\n"); + slk_attrset(A_BOLD); /* reverse-video is hard to see */ + (void) if_opt_s(extended_slk_color_sp(sp, 2), + extended_slk_color(2)); + for (i = 1; i <= 8; ++i) { + char temp[80]; + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "(SLK-%d)", i); + slk_set(i, temp, 0); + } + slk_touch(); + slk_noutrefresh(); + + i = if_opt_s(can_change_color_sp(sp), + can_change_color()); + if (i) { + do_color_set("Default Colors", 0); + printw("Press any key to stop...\n"); + nodelay(stdscr, TRUE); + while (getch() == ERR) { + show_rgb(sp); + do_init_color(sp, COLOR_RED, 1); + do_init_color(sp, COLOR_BLUE, -1); + napms(50); + } + printw("...done"); + nodelay(stdscr, FALSE); + getch(); + } + + endwin(); + + ExitProgram(EXIT_SUCCESS); +} + +#else +int +main(void) +{ + printf("This program requires the ncurses extended color/pair functions\n"); + ExitProgram(EXIT_FAILURE); +} +#endif diff --git a/test/filter.c b/test/filter.c index b90012fe6b34..e9c0ee99b732 100644 --- a/test/filter.c +++ b/test/filter.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2017,2019 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 * @@ -27,15 +27,10 @@ ****************************************************************************/ /* - * Author: Thomas E. Dickey 1998 + * Author: Thomas E. Dickey 1998 + * + * $Id: filter.c,v 1.33 2019/08/24 23:11:01 tom Exp $ * - * $Id: filter.c,v 1.15 2012/06/09 20:30:32 tom Exp $ - */ -#include - -#if HAVE_FILTER - -/* * An example of the 'filter()' function in ncurses, this program prompts * for commands and executes them (like a command shell). It illustrates * how ncurses can be used to implement programs that are not full-screen. @@ -46,38 +41,261 @@ * reset_shell_mode() and reset_prog_mode() functions, we could invoke endwin() * and refresh(), but that does not work any better. */ +#include + +#if HAVE_FILTER + +#include static int -new_command(char *buffer, int length, attr_t underline) +show_prompt(int underline, bool clocked) { - int code; + int limit = COLS; + + move(0, 0); + attrset(A_NORMAL); + clrtoeol(); + attrset(A_BOLD); + addstr("Command: "); - attron(A_BOLD); - printw("Command: "); + limit -= getcurx(stdscr); + + if (clocked) { + if (limit >= 3) { + time_t now = time((time_t *) 0); + struct tm *my = localtime(&now); + char buffer[80]; + int skip, y, x; + int margin; + + _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) "%02d:%02d:%02d", + my->tm_hour, + my->tm_min, + my->tm_sec); + + if (limit > 9) { + skip = 0; + } else if (limit > 6) { + skip = 3; + } else { + skip = 6; + } + /* + * Write the clock message on the right-margin so we can show the + * results of resizing the screen. + */ + getyx(stdscr, y, x); + margin = (int) strlen(buffer) - skip; + limit -= margin; + move(0, COLS - margin); + addstr(buffer); + move(y, x); + } + } attron(underline); - code = getnstr(buffer, length); - /* - * If this returns anything except ERR/OK, it would be one of ncurses's - * extensions. Fill the buffer with something harmless that the shell - * will execute as a comment. - */ + return limit; +} + +static int +new_command(char *buffer, int length, int underline, bool clocked, bool polled) +{ + int code = OK; + + if (polled) { + bool done = FALSE; + bool first = TRUE; + int y = 0, x = 0; + int n; + int mark = 0; + int used = 0; + const int gap = 2; + + timeout(20); /* no one types 50CPS... */ + while (!done) { + int limit; + int ch = getch(); + + buffer[used] = '\0'; + + limit = show_prompt(underline, clocked); + if (first) { + getyx(stdscr, y, x); + first = FALSE; + } else { + int left = 0; + + /* + * if the screen is too narrow to show the whole buffer, + * shift the editing point left/right as needed. + */ + move(y, x); + if ((used + gap) > limit) { + while ((mark - left + gap) > limit) { + left += limit / 2; + } + } + printw("%.*s", limit, buffer + left); + move(y, x + mark - left); + } + + switch (ch) { + case ERR: + continue; + case '\004': + code = ERR; + done = TRUE; + break; + case KEY_ENTER: + case '\n': + done = TRUE; + break; + case KEY_BACKSPACE: + case '\b': + if (used) { + if (mark < used) { + /* getnstr does not do this */ + if (mark > 0) { + --mark; + for (n = mark; n < used; ++n) { + buffer[n] = buffer[n + 1]; + } + } else { + flash(); + } + } else { + /* getnstr does this */ + mark = --used; + buffer[used] = '\0'; + } + } else { + flash(); + } + break; + /* + * Unlike getnstr, this function can move the cursor into the + * middle of the buffer and insert/delete at that point. + */ + case KEY_HOME: + mark = 0; + break; + case KEY_END: + mark = used; + break; + case KEY_LEFT: + if (mark > 0) { + mark--; + } else { + flash(); + } + break; + case KEY_RIGHT: + if (mark < used) { + mark++; + } else { + flash(); + } + break; #ifdef KEY_EVENT - if (code == KEY_EVENT) - strcpy(buffer, "# event!"); + case KEY_EVENT: + continue; #endif #ifdef KEY_RESIZE - if (code == KEY_RESIZE) { - strcpy(buffer, "# resize!"); - getch(); - } + case KEY_RESIZE: + /* + * Unlike getnstr, this function "knows" what the whole screen + * is supposed to look like, and can handle resize events. + */ + continue; #endif + case '\t': + ch = ' '; + /* FALLTHRU */ + default: + if (ch >= KEY_MIN) { + flash(); + continue; + } + if (mark < used) { + /* getnstr does not do this... */ + for (n = used + 1; n > mark; --n) { + buffer[n] = buffer[n - 1]; + } + buffer[mark] = (char) ch; + used++; + mark++; + } else { + /* getnstr does this part */ + buffer[used] = (char) ch; + mark = ++used; + } + break; + } + } + } else { + show_prompt(underline, clocked); + + code = getnstr(buffer, length); + /* + * If this returns anything except ERR/OK, it would be one of ncurses's + * extensions. Fill the buffer with something harmless that the shell + * will execute as a comment. + */ +#ifdef KEY_EVENT + if (code == KEY_EVENT) + _nc_STRCPY(buffer, "# event!", length); +#endif +#ifdef KEY_RESIZE + if (code == KEY_RESIZE) { + _nc_STRCPY(buffer, "# resize!", length); + getch(); + } +#endif + } attroff(underline); attroff(A_BOLD); - printw("\n"); + refresh(); return code; } +#ifdef NCURSES_VERSION +/* + * Cancel xterm's alternate-screen mode (from dialog -TD) + */ +#define isprivate(s) ((s) != 0 && strstr(s, "\033[?") != 0) +static void +cancel_altscreen(void) +{ + if (isatty(fileno(stdout)) + && key_mouse != 0 /* xterm and kindred */ + && isprivate(enter_ca_mode) + && isprivate(exit_ca_mode)) { + /* + * initscr() or newterm() already wrote enter_ca_mode as a side effect + * of initializing the screen. It would be nice to not even do that, + * but we do not really have access to the correct copy of the + * terminfo description until those functions have been invoked. + */ + (void) refresh(); + (void) putp(exit_ca_mode); + (void) fflush(stdout); + /* + * Prevent ncurses from switching "back" to the normal screen when + * exiting from this program. That would move the cursor to the + * original location saved in xterm. Normally curses sets the cursor + * position to the first line after the display, but the alternate + * screen switching is done after that point. + * + * Cancelling the strings altogether also works around the buggy + * implementation of alternate-screen in rxvt, etc., which clear more + * of the display than they should. + */ + enter_ca_mode = 0; + exit_ca_mode = 0; + } +} +#endif + static void usage(void) { @@ -86,7 +304,15 @@ usage(void) "Usage: filter [options]" ,"" ,"Options:" +#ifdef NCURSES_VERSION + ," -a suppress xterm alternate-screen by amending smcup/rmcup" +#endif + ," -c show current time on prompt line with \"Command\"" +#if HAVE_USE_DEFAULT_COLORS + ," -d invoke use_default_colors" +#endif ," -i use initscr() rather than newterm()" + ," -p poll for individual characters rather than using getnstr" }; unsigned n; for (n = 0; n < SIZEOF(msg); n++) @@ -99,16 +325,40 @@ main(int argc, char *argv[]) { int ch; char buffer[80]; - attr_t underline; + int underline; +#ifdef NCURSES_VERSION + bool a_option = FALSE; +#endif + bool c_option = FALSE; +#if HAVE_USE_DEFAULT_COLORS + bool d_option = FALSE; +#endif bool i_option = FALSE; + bool p_option = FALSE; setlocale(LC_ALL, ""); - while ((ch = getopt(argc, argv, "i")) != -1) { + while ((ch = getopt(argc, argv, "adcip")) != -1) { switch (ch) { +#ifdef NCURSES_VERSION + case 'a': + a_option = TRUE; + break; +#endif + case 'c': + c_option = TRUE; + break; +#if HAVE_USE_DEFAULT_COLORS + case 'd': + d_option = TRUE; + break; +#endif case 'i': i_option = TRUE; break; + case 'p': + p_option = TRUE; + break; default: usage(); } @@ -120,8 +370,16 @@ main(int argc, char *argv[]) if (i_option) { initscr(); } else { - (void) newterm((char *) 0, stdout, stdin); + if (newterm((char *) 0, stdout, stdin) == 0) { + fprintf(stderr, "cannot initialize terminal\n"); + ExitProgram(EXIT_FAILURE); + } } +#ifdef NCURSES_VERSION + if (a_option) { + cancel_altscreen(); + } +#endif cbreak(); keypad(stdscr, TRUE); @@ -129,17 +387,20 @@ main(int argc, char *argv[]) int background = COLOR_BLACK; start_color(); #if HAVE_USE_DEFAULT_COLORS - if (use_default_colors() != ERR) + if (d_option && (use_default_colors() != ERR)) background = -1; #endif init_pair(1, COLOR_CYAN, (short) background); - underline = (attr_t) COLOR_PAIR(1); + underline = COLOR_PAIR(1); } else { underline = A_UNDERLINE; } - while (new_command(buffer, sizeof(buffer) - 1, underline) != ERR - && strlen(buffer) != 0) { + for (;;) { + int code = new_command(buffer, sizeof(buffer) - 1, + underline, c_option, p_option); + if (code == ERR || *buffer == '\0') + break; reset_shell_mode(); printf("\n"); fflush(stdout); @@ -149,7 +410,7 @@ main(int argc, char *argv[]) erase(); refresh(); } - printw("done"); + clear(); refresh(); endwin(); ExitProgram(EXIT_SUCCESS); diff --git a/test/firework.c b/test/firework.c index 27d8fdfa8668..b7c560b41cc1 100644 --- a/test/firework.c +++ b/test/firework.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2017,2019 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: firework.c,v 1.29 2013/04/27 19:46:53 tom Exp $ + * $Id: firework.c,v 1.36 2019/12/14 23:26:09 tom Exp $ */ #include @@ -37,8 +37,7 @@ static short my_bg = COLOR_BLACK; static void cleanup(void) { - curs_set(1); - endwin(); + stop_curses(); } static void @@ -94,14 +93,14 @@ explode(int row, int col) showit(); init_pair(1, get_colour(&bold), my_bg); - (void) attrset((chtype) COLOR_PAIR(1) | bold); + (void) attrset(AttrArg(COLOR_PAIR(1), bold)); MvPrintw(row - 1, col - 1, " - "); MvPrintw(row + 0, col - 1, "-+-"); MvPrintw(row + 1, col - 1, " - "); showit(); init_pair(1, get_colour(&bold), my_bg); - (void) attrset((chtype) COLOR_PAIR(1) | bold); + (void) attrset(AttrArg(COLOR_PAIR(1), bold)); MvPrintw(row - 2, col - 2, " --- "); MvPrintw(row - 1, col - 2, "-+++-"); MvPrintw(row + 0, col - 2, "-+#+-"); @@ -110,7 +109,7 @@ explode(int row, int col) showit(); init_pair(1, get_colour(&bold), my_bg); - (void) attrset((chtype) COLOR_PAIR(1) | bold); + (void) attrset(AttrArg(COLOR_PAIR(1), bold)); MvPrintw(row - 2, col - 2, " +++ "); MvPrintw(row - 1, col - 2, "++#++"); MvPrintw(row + 0, col - 2, "+# #+"); @@ -119,7 +118,7 @@ explode(int row, int col) showit(); init_pair(1, get_colour(&bold), my_bg); - (void) attrset((chtype) COLOR_PAIR(1) | bold); + (void) attrset(AttrArg(COLOR_PAIR(1), bold)); MvPrintw(row - 2, col - 2, " # "); MvPrintw(row - 1, col - 2, "## ##"); MvPrintw(row + 0, col - 2, "# #"); @@ -128,7 +127,7 @@ explode(int row, int col) showit(); init_pair(1, get_colour(&bold), my_bg); - (void) attrset((chtype) COLOR_PAIR(1) | bold); + (void) attrset(AttrArg(COLOR_PAIR(1), bold)); MvPrintw(row - 2, col - 2, " # # "); MvPrintw(row - 1, col - 2, "# #"); MvPrintw(row + 0, col - 2, " "); @@ -137,17 +136,54 @@ explode(int row, int col) showit(); } +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: firework [options]" + ,"" + ,"Options:" +#if HAVE_USE_DEFAULT_COLORS + ," -d invoke use_default_colors, repeat to use in init_pair" +#endif + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(EXIT_FAILURE); +} + int -main( - int argc GCC_UNUSED, - char *argv[]GCC_UNUSED) +main(int argc, char *argv[]) { - int start, end, row, diff, flag = 0, direction; + int ch; + int start, end; + int row, diff; + int flag = 0; + int direction; unsigned seed; +#if HAVE_USE_DEFAULT_COLORS + bool d_option = FALSE; +#endif - CATCHALL(onsig); + while ((ch = getopt(argc, argv, "d")) != -1) { + switch (ch) { +#if HAVE_USE_DEFAULT_COLORS + case 'd': + d_option = TRUE; + break; +#endif + default: + usage(); + } + } + if (optind < argc) + usage(); - initscr(); + InitAndCatch(initscr(), onsig); noecho(); cbreak(); keypad(stdscr, TRUE); @@ -156,7 +192,7 @@ main( if (has_colors()) { start_color(); #if HAVE_USE_DEFAULT_COLORS - if (use_default_colors() == OK) + if (d_option && (use_default_colors() == OK)) my_bg = -1; #endif } @@ -173,8 +209,8 @@ main( direction = (start > end) ? -1 : 1; diff = abs(start - end); } while (diff < 2 || diff >= LINES - 2); - (void) attrset(A_NORMAL); - for (row = 0; row < diff; row++) { + (void) attrset(AttrArg(0, A_NORMAL)); + for (row = 1; row < diff; row++) { MvPrintw(LINES - row, start + (row * direction), (direction < 0) ? "\\" : "/"); if (flag++) { diff --git a/test/firstlast.c b/test/firstlast.c index f5328c722cfc..fb09cb27c7a7 100644 --- a/test/firstlast.c +++ b/test/firstlast.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ * This test was written by Alexander V. Lukyanov to demonstrate difference * between ncurses 4.1 and SVR4 curses * - * $Id: firstlast.c,v 1.7 2010/05/01 19:11:55 tom Exp $ + * $Id: firstlast.c,v 1.8 2017/09/06 01:07:39 tom Exp $ */ #include @@ -40,6 +40,11 @@ fill(WINDOW *w, const char *str) const char *s; int x0 = -1, y0 = -1; int x1, y1; + int maxx, maxy, limit; + + getmaxyx(w, maxy, maxx); + wmove(w, 0, 0); + limit = maxy * maxx; for (;;) { for (s = str; *s; s++) { @@ -49,6 +54,16 @@ fill(WINDOW *w, const char *str) wmove(w, 0, 0); return; } + /* waddch() should return ERR at the lower-right corner */ + if (--limit < 0) { + beep(); + if (*str == '?') + return; + napms(500); + wmove(w, maxy - 1, 0); + str = "?"; + limit = maxx + 1; + } x0 = x1; y0 = y1; } diff --git a/test/foldkeys.c b/test/foldkeys.c index a5e25e30bb82..98e72b0450a5 100644 --- a/test/foldkeys.c +++ b/test/foldkeys.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2006 Free Software Foundation, Inc. * + * Copyright (c) 2006-2018,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey, 2006 * - * $Id: foldkeys.c,v 1.4 2010/11/14 01:00:53 tom Exp $ + * $Id: foldkeys.c,v 1.8 2019/08/24 23:11:01 tom Exp $ * * Demonstrate a method for altering key definitions at runtime. * @@ -38,21 +38,11 @@ * merging only for the keys which are defined in the terminal description. */ +#define NEED_TIME_H #include #if defined(NCURSES_VERSION) && NCURSES_EXT_FUNCS -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - #define MY_LOGFILE "demo_foldkeys.log" #define MY_KEYS (KEY_MAX + 1) @@ -63,10 +53,10 @@ static void log_last_line(WINDOW *win) { FILE *fp; - int y, x, n; - char temp[256]; if ((fp = fopen(MY_LOGFILE, "a")) != 0) { + char temp[256]; + int y, x, n; int need = sizeof(temp) - 1; if (need > COLS) need = COLS; @@ -155,6 +145,7 @@ demo_foldkeys(void) int first, second; char final[2]; char *value; + size_t need = 0; if (info[j].state == 0 && sscanf(info[j].value, "\033[%d;%d%c", @@ -162,8 +153,9 @@ demo_foldkeys(void) &second, final) == 3 && *final != ';' + && (need = strlen(info[j].value)) != 0 && (value = strdup(info[j].value)) != 0) { - sprintf(value, "\033[%d%c", first, *final); + _nc_SPRINTF(value, _nc_SLIMIT(need) "\033[%d%c", first, *final); for (k = 0; k < info_len; ++k) { if (info[k].state == 0 && !strcmp(info[k].value, value)) { @@ -172,7 +164,7 @@ demo_foldkeys(void) } } if (info[j].state == 0) { - sprintf(value, "\033O%c", *final); + _nc_SPRINTF(value, _nc_SLIMIT(need) "\033O%c", *final); for (k = 0; k < info_len; ++k) { if (info[k].state == 0 && !strcmp(info[k].value, value)) { @@ -203,13 +195,16 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { int ch; #if HAVE_GETTIMEOFDAY - int secs, msecs; - struct timeval current, previous; + struct timeval previous; #endif + if (newterm(0, stdout, stdin) == 0) { + fprintf(stderr, "Cannot initialize terminal\n"); + ExitProgram(EXIT_FAILURE); + } + unlink(MY_LOGFILE); - newterm(0, stdout, stdin); (void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) noecho(); /* don't echo input */ @@ -228,6 +223,9 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) const char *name = keyname(escaped ? (ch - MY_KEYS) : ch); #if HAVE_GETTIMEOFDAY + int secs, msecs; + struct timeval current; + gettimeofday(¤t, 0); secs = (int) (current.tv_sec - previous.tv_sec); msecs = (int) ((current.tv_usec - previous.tv_usec) / 1000); diff --git a/test/form_driver_w.c b/test/form_driver_w.c index 141f517f1f8d..868ca7029122 100644 --- a/test/form_driver_w.c +++ b/test/form_driver_w.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2013,2014 Free Software Foundation, Inc. * + * Copyright (c) 2013-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,26 +31,38 @@ ****************************************************************************/ /* - * $Id: form_driver_w.c,v 1.11 2014/02/09 22:20:27 tom Exp $ + * $Id: form_driver_w.c,v 1.15 2017/04/15 20:41:35 tom Exp $ * * Test form_driver_w (int, int, wchar_t), a wide char aware * replacement of form_driver. */ -#include - #include +#include -#if USE_WIDEC_SUPPORT && USE_LIBFORM +#if USE_WIDEC_SUPPORT && USE_LIBFORM && (defined(NCURSES_VERSION_PATCH) && NCURSES_VERSION_PATCH >= 20131207) #include int main(void) { - FIELD *field[3]; + static const char *help[] = + { + "Commands:", + " ^D,^Q,ESC - quit program", + " , - move to next field", + " , - move to previous field", + 0 + }; + +#define NUM_FIELDS 3 +#define MyRow(n) (4 + (n) * 2) +#define MyCol(n) 10 + FIELD *field[NUM_FIELDS + 1]; FORM *my_form; bool done = FALSE; + int n; setlocale(LC_ALL, ""); @@ -61,32 +73,34 @@ main(void) keypad(stdscr, TRUE); /* Initialize the fields */ - field[0] = new_field(1, 10, 4, 18, 0, 0); - field[1] = new_field(1, 10, 6, 18, 0, 0); - field[2] = NULL; - - /* Set field options */ - set_field_back(field[0], A_UNDERLINE); /* Print a line for the option */ - field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */ - /* Field is filled up */ - set_field_back(field[1], A_UNDERLINE); - field_opts_off(field[1], O_AUTOSKIP); + for (n = 0; n < NUM_FIELDS; ++n) { + field[n] = new_field(1, 10, MyRow(n), 18, 0, 0); + set_field_back(field[n], A_UNDERLINE); + /* Print a line for the option */ + field_opts_off(field[n], O_AUTOSKIP); + /* Don't go to next field when this is filled */ + } + field[n] = NULL; /* Create the form and post it */ my_form = new_form(field); post_form(my_form); refresh(); - mvprintw(4, 10, "Value 1:"); - mvprintw(6, 10, "Value 2:"); - refresh(); + for (n = 0; n < NUM_FIELDS; ++n) { + mvprintw(MyRow(n), MyCol(n), "Value %d:", n + 1); + } /* Loop through to get user requests */ while (!done) { wint_t ch; int ret = get_wch(&ch); - mvprintw(8, 10, "Got %d (%#x), type: %s", (int) ch, (int) ch, + mvprintw(MyRow(NUM_FIELDS), + MyCol(NUM_FIELDS), + "Got %d (%#x), type: %s", + (int) ch, + (int) ch, (ret == KEY_CODE_YES) ? "KEY_CODE_YES" : ((ret == OK) @@ -106,6 +120,7 @@ main(void) /* Leaves nicely at the last character */ form_driver_w(my_form, KEY_CODE_YES, REQ_END_LINE); break; + case KEY_BTAB: case KEY_UP: /* Go to previous field */ form_driver_w(my_form, KEY_CODE_YES, REQ_PREV_FIELD); @@ -122,8 +137,15 @@ main(void) case ESCAPE: done = TRUE; break; + case '\t': + form_driver_w(my_form, KEY_CODE_YES, REQ_NEXT_FIELD); + form_driver_w(my_form, KEY_CODE_YES, REQ_END_LINE); + break; + case HELP_KEY_1: + popup_msg(form_win(my_form), help); + break; default: - form_driver_w(my_form, OK, ch); + form_driver_w(my_form, OK, (wchar_t) ch); break; } break; @@ -133,8 +155,9 @@ main(void) /* Un post form and free the memory */ unpost_form(my_form); free_form(my_form); - free_field(field[0]); - free_field(field[1]); + for (n = 0; n < NUM_FIELDS; ++n) { + free_field(field[n]); + } endwin(); ExitProgram(EXIT_SUCCESS); diff --git a/test/gdc.6 b/test/gdc.6 index ed3a4f103ff1..a8d57a9cd991 100644 --- a/test/gdc.6 +++ b/test/gdc.6 @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2003,2006 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2006,2017 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,16 +26,12 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: gdc.6,v 1.3 2006/04/22 23:02:15 tom Exp $ +.\" $Id: gdc.6,v 1.4 2017/09/09 20:04:09 tom Exp $ .TH GDC 6 .SH NAME gdc \- grand digital clock (curses) .SH SYNOPSIS -.B gdc -[-n] [ -[-s] [ -.I n -] +.B gdc \fP[\fIoptions\fP] [\fIn\fP] .SH DESCRIPTION .I Gdc runs a digital clock made of reverse-video blanks on a terminal screen. @@ -44,14 +40,20 @@ You can make the clock stop, pause or resume by pressing a ``q'', ``s'' or space, respectively. .SH OPTIONS .TP -.B -n +.B \-d +use terminal's default colors for the background. +.TP +.B \-n redirects input to /dev/null, making it ignore the stop/pause commands. You can still stop it by pressing the interrupt key. .TP -.B -s +.B \-s makes digits scroll as they change. When running on a fast display, the program breaks up the scrolling into subsecond repaints, making the operation appear smooth. +.TP +.B \-t \fIhh:mm:ss\fP +specify starting time (default is ``now''). .PP With an optional numeric argument .I num @@ -61,4 +63,5 @@ seconds. Normally it runs "forever" (counting down from 2 billion seconds). .SH AUTHOR Amos Shapir, modified for curses by John Lupien. +.br Improvements for ncurses by Thomas Dickey. diff --git a/test/gdc.c b/test/gdc.c index a2263245d95e..6a6603d095fd 100644 --- a/test/gdc.c +++ b/test/gdc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * + * Copyright (c) 1998-2017,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -33,7 +33,7 @@ * modified 10-18-89 for curses (jrl) * 10-18-89 added signal handling * - * $Id: gdc.c,v 1.40 2014/02/15 17:34:36 tom Exp $ + * $Id: gdc.c,v 1.53 2019/12/14 23:25:29 tom Exp $ */ #include @@ -66,7 +66,7 @@ sighndl(int signo) signal(signo, sighndl); sigtermed = signo; if (redirected) { - endwin(); + stop_curses(); ExitProgram(EXIT_FAILURE); } } @@ -76,7 +76,7 @@ check_term(void) { if (sigtermed) { (void) standend(); - endwin(); + stop_curses(); fprintf(stderr, "gdc terminated by signal %d\n", sigtermed); ExitProgram(EXIT_FAILURE); } @@ -86,10 +86,9 @@ static void drawbox(bool scrolling) { chtype bottom[XLENGTH + 1]; - int n; if (hascolor) - (void) attrset((attr_t) COLOR_PAIR(PAIR_FRAMES)); + (void) attrset(AttrArg(COLOR_PAIR(PAIR_FRAMES), 0)); MvAddCh(YBASE - 1, XBASE - 1, ACS_ULCORNER); hline(ACS_HLINE, XLENGTH); @@ -97,6 +96,7 @@ drawbox(bool scrolling) MvAddCh(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER); if ((mvinchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH)) != ERR) { + int n; for (n = 0; n < XLENGTH; n++) { if (!scrolling) bottom[n] &= ~A_COLOR; @@ -113,7 +113,7 @@ drawbox(bool scrolling) vline(ACS_VLINE, YDEPTH); if (hascolor) - (void) attrset((attr_t) COLOR_PAIR(PAIR_OTHERS)); + (void) attrset(AttrArg(COLOR_PAIR(PAIR_OTHERS), 0)); } static void @@ -121,13 +121,13 @@ standt(int on) { if (on) { if (hascolor) { - attron((attr_t) COLOR_PAIR(PAIR_DIGITS)); + attron(COLOR_PAIR(PAIR_DIGITS)); } else { attron(A_STANDOUT); } } else { if (hascolor) { - attron((attr_t) COLOR_PAIR(PAIR_OTHERS)); + attron(COLOR_PAIR(PAIR_OTHERS)); } else { attroff(A_STANDOUT); } @@ -156,8 +156,11 @@ usage(void) "Usage: gdc [options] [count]" ,"" ,"Options:" - ," -n redirect input to /dev/null" - ," -s scroll each number into place, rather than flipping" +#if HAVE_USE_DEFAULT_COLORS + ," -d invoke use_default_colors" +#endif + ," -n redirect input to /dev/null" + ," -s scroll each number into place, rather than flipping" ," -t hh:mm:ss specify starting time (default is ``now'')" ,"" ,"If you specify a count, gdc runs for that number of seconds" @@ -218,13 +221,19 @@ main(int argc, char *argv[]) bool smooth = FALSE; bool stages = FALSE; time_t starts = 0; +#if HAVE_USE_DEFAULT_COLORS + bool d_option = FALSE; +#endif setlocale(LC_ALL, ""); - CATCHALL(sighndl); - - while ((k = getopt(argc, argv, "nst:")) != -1) { + while ((k = getopt(argc, argv, "dnst:")) != -1) { switch (k) { +#if HAVE_USE_DEFAULT_COLORS + case 'd': + d_option = TRUE; + break; +#endif case 'n': ifp = fopen("/dev/null", "r"); redirected = TRUE; @@ -242,21 +251,24 @@ main(int argc, char *argv[]) if (optind < argc) { count = atoi(argv[optind++]); assert(count >= 0); + if (optind < argc) + usage(); } - if (optind < argc) - usage(); - if (redirected) { - char *name = getenv("TERM"); - if (name == 0 - || newterm(name, ofp, ifp) == 0) { - fprintf(stderr, "cannot open terminal\n"); - ExitProgram(EXIT_FAILURE); + InitAndCatch({ + if (redirected) { + char *name = getenv("TERM"); + if (name == 0 + || newterm(name, ofp, ifp) == 0) { + fprintf(stderr, "cannot open terminal\n"); + ExitProgram(EXIT_FAILURE); + } + } else { + initscr(); } - - } else { - initscr(); } + ,sighndl); + cbreak(); noecho(); nodelay(stdscr, 1); @@ -268,13 +280,13 @@ main(int argc, char *argv[]) short bg = COLOR_BLACK; start_color(); #if HAVE_USE_DEFAULT_COLORS - if (use_default_colors() == OK) + if (d_option && (use_default_colors() == OK)) bg = -1; #endif init_pair(PAIR_DIGITS, COLOR_BLACK, COLOR_RED); init_pair(PAIR_OTHERS, COLOR_RED, bg); init_pair(PAIR_FRAMES, COLOR_WHITE, bg); - (void) attrset((attr_t) COLOR_PAIR(PAIR_OTHERS)); + (void) attrset(AttrArg(COLOR_PAIR(PAIR_OTHERS), 0)); } restart: @@ -379,8 +391,12 @@ main(int argc, char *argv[]) } /* this depends on the detailed format of ctime(3) */ - (void) strncpy(buf, ctime(&now), (size_t) 30); - (void) strcpy(buf + 10, buf + 19); + _nc_STRNCPY(buf, ctime(&now), (size_t) 30); + { + char *d2 = buf + 10; + char *s2 = buf + 19; + while ((*d2++ = *s2++) != '\0') ; + } MvAddStr(16, 30, buf); move(6, 0); @@ -431,6 +447,6 @@ main(int argc, char *argv[]) } } while (--count); (void) standend(); - endwin(); + stop_curses(); ExitProgram(EXIT_SUCCESS); } diff --git a/test/hanoi.c b/test/hanoi.c index 2262a5203bd0..16b826fc7b7d 100644 --- a/test/hanoi.c +++ b/test/hanoi.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2017,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -41,7 +41,7 @@ * * Date: 05.Nov.90 * - * $Id: hanoi.c,v 1.35 2013/09/28 22:02:17 tom Exp $ + * $Id: hanoi.c,v 1.40 2019/12/14 23:26:09 tom Exp $ */ #include @@ -89,104 +89,6 @@ static int NTiles = 0; static int NMoves = 0; static bool AutoFlag = FALSE; -static void InitTiles(void); -static void DisplayTiles(void); -static void MakeMove(int From, int To); -static void AutoMove(int From, int To, int Num); -static void Usage(void); -static int Solved(int NumTiles); -static int GetMove(int *From, int *To); -static int InvalidMove(int From, int To); - -int -main(int argc, char **argv) -{ - int FromCol, ToCol; - - setlocale(LC_ALL, ""); - - switch (argc) { - case 1: - NTiles = DEFAULTTILES; - break; - case 2: - NTiles = atoi(argv[1]); - if (NTiles > MAXTILES || NTiles < MINTILES) { - fprintf(stderr, "Range %d to %d\n", MINTILES, MAXTILES); - ExitProgram(EXIT_FAILURE); - } - break; - case 3: - if (strcmp(argv[2], "a")) { - Usage(); - ExitProgram(EXIT_FAILURE); - } - NTiles = atoi(argv[1]); - if (NTiles > MAXTILES || NTiles < MINTILES) { - fprintf(stderr, "Range %d to %d\n", MINTILES, MAXTILES); - ExitProgram(EXIT_FAILURE); - } - AutoFlag = TRUE; - break; - default: - Usage(); - ExitProgram(EXIT_FAILURE); - } - initscr(); - if (has_colors()) { - int i; - short bg = COLOR_BLACK; - start_color(); -#if HAVE_USE_DEFAULT_COLORS - if (use_default_colors() == OK) - bg = -1; -#endif - for (i = 0; i < 9; i++) - init_pair((short) (i + 1), bg, TileColour[i]); - } - cbreak(); - if (LINES < 24) { - endwin(); - fprintf(stderr, "Min screen length 24 lines\n"); - ExitProgram(EXIT_FAILURE); - } - if (AutoFlag) { - curs_set(0); - leaveok(stdscr, TRUE); /* Attempt to remove cursor */ - } - InitTiles(); - DisplayTiles(); - if (AutoFlag) { - do { - noecho(); - AutoMove(0, 2, NTiles); - } while (!Solved(NTiles)); - sleep(2); - } else { - echo(); - for (;;) { - if (GetMove(&FromCol, &ToCol)) - break; - if (InvalidMove(FromCol, ToCol)) { - MvAddStr(STATUSLINE, 0, "Invalid Move !!"); - refresh(); - beep(); - continue; - } - MakeMove(FromCol, ToCol); - if (Solved(NTiles)) { - MvPrintw(STATUSLINE, 0, - "Well Done !! You did it in %d moves", NMoves); - refresh(); - sleep(5); - break; - } - } - } - endwin(); - ExitProgram(EXIT_SUCCESS); -} - static int InvalidMove(int From, int To) { @@ -254,7 +156,7 @@ DisplayTiles(void) memset(TileBuf, ' ', len); TileBuf[len] = '\0'; if (has_colors()) - (void) attrset((attr_t) COLOR_PAIR(LENTOIND(len))); + (void) attrset(AttrArg(COLOR_PAIR(LENTOIND(len)), 0)); else (void) attrset(A_REVERSE); MvAddStr(BASELINE - (SlotNo + 1), @@ -329,9 +231,129 @@ Solved(int NumTiles) } static void -Usage(void) +usage(void) +{ + static const char *msg[] = + { + "Usage: hanoi [options] [[] [a]]" + ,"" + ,"Options:" +#if HAVE_USE_DEFAULT_COLORS + ," -d invoke use_default_colors" +#endif + ," -n NUM set number of tiles (positional param is deprecated)" + ," -X solve automatically (positional \"a\" is deprecated)" + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc, char **argv) { - fprintf(stderr, "Usage: hanoi [] [a]\n"); - fprintf(stderr, - "The 'a' option causes the tower to be solved automatically\n"); + int ch, FromCol, ToCol; + +#if HAVE_USE_DEFAULT_COLORS + bool d_option = FALSE; +#endif + + NTiles = DEFAULTTILES; + while ((ch = getopt(argc, argv, "dn:X")) != -1) { + switch (ch) { +#if HAVE_USE_DEFAULT_COLORS + case 'd': + d_option = TRUE; + break; +#endif + case 'n': + NTiles = atoi(optarg); + break; + case 'X': + AutoFlag = TRUE; + break; + default: + usage(); + /* NOTREACHED */ + } + } + setlocale(LC_ALL, ""); + + switch (ch = (argc - optind)) { + case 2: + if (strcmp(argv[optind + 1], "a")) { + usage(); + } + AutoFlag = TRUE; + /* FALLTHRU */ + case 1: + NTiles = atoi(argv[optind]); + /* FALLTHRU */ + case 0: + break; + default: + usage(); + } + + if (NTiles > MAXTILES || NTiles < MINTILES) { + fprintf(stderr, "Range %d to %d\n", MINTILES, MAXTILES); + usage(); + } + + initscr(); + if (has_colors()) { + int i; + short bg = COLOR_BLACK; + start_color(); +#if HAVE_USE_DEFAULT_COLORS + if (d_option && (use_default_colors() == OK)) + bg = -1; +#endif + for (i = 0; i < 9; i++) + init_pair((short) (i + 1), bg, TileColour[i]); + } + cbreak(); + if (LINES < 24) { + endwin(); + fprintf(stderr, "Min screen length 24 lines\n"); + ExitProgram(EXIT_FAILURE); + } + if (AutoFlag) { + curs_set(0); + leaveok(stdscr, TRUE); /* Attempt to remove cursor */ + } + InitTiles(); + DisplayTiles(); + if (AutoFlag) { + do { + noecho(); + AutoMove(0, 2, NTiles); + } while (!Solved(NTiles)); + sleep(2); + } else { + echo(); + for (;;) { + if (GetMove(&FromCol, &ToCol)) + break; + if (InvalidMove(FromCol, ToCol)) { + MvAddStr(STATUSLINE, 0, "Invalid Move !!"); + refresh(); + beep(); + continue; + } + MakeMove(FromCol, ToCol); + if (Solved(NTiles)) { + MvPrintw(STATUSLINE, 0, + "Well Done !! You did it in %d moves", NMoves); + refresh(); + sleep(5); + break; + } + } + } + stop_curses(); + ExitProgram(EXIT_SUCCESS); } diff --git a/test/hashtest.c b/test/hashtest.c index 849922173c8f..e11348d8aadc 100644 --- a/test/hashtest.c +++ b/test/hashtest.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2017,2019 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 @@ * * Generate timing statistics for vertical-motion optimization. * - * $Id: hashtest.c,v 1.32 2013/04/27 19:50:17 tom Exp $ + * $Id: hashtest.c,v 1.35 2019/12/07 18:07:04 tom Exp $ */ #include @@ -82,7 +82,7 @@ genlines(int base) move(0, 0); for (i = 0; i < head_lines; i++) for (j = 0; j < COLS; j++) - addch(UChar((j % 8 == 0) ? ('A' + j / 8) : '-')); + AddCh(UChar((j % 8 == 0) ? ('A' + j / 8) : '-')); move(head_lines, 0); for (i = head_lines; i < LINES - foot_lines; i++) { @@ -90,13 +90,13 @@ genlines(int base) + LO_CHAR); int hi = (extend_corner || (i < LINES - 1)) ? COLS : COLS - 1; for (j = 0; j < hi; j++) - addch(c); + AddCh(c); } for (i = LINES - foot_lines; i < LINES; i++) { move(i, 0); for (j = 0; j < (extend_corner ? COLS : COLS - 1); j++) - addch(UChar((j % 8 == 0) ? ('A' + j / 8) : '-')); + AddCh(UChar((j % 8 == 0) ? ('A' + j / 8) : '-')); } scrollok(stdscr, TRUE); @@ -222,12 +222,10 @@ main(int argc, char *argv[]) test_optimize = TRUE; } #if USE_TRACE - trace(TRACE_TIMES); + curses_trace(TRACE_TIMES); #endif - CATCHALL(finish); /* arrange interrupts to terminate */ - - (void) initscr(); /* initialize the curses library */ + InitAndCatch(initscr(), finish); keypad(stdscr, TRUE); /* enable keyboard mapping */ (void) nonl(); /* tell curses not to do NL->CR/NL on output */ (void) cbreak(); /* take input chars one at a time, no wait for \n */ diff --git a/test/inch_wide.c b/test/inch_wide.c index 3d31f1787fa2..6a46cd084ee4 100644 --- a/test/inch_wide.c +++ b/test/inch_wide.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007,2010 Free Software Foundation, Inc. * + * Copyright (c) 2007-2017,2019 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: inch_wide.c,v 1.7 2010/05/01 19:13:46 tom Exp $ + * $Id: inch_wide.c,v 1.10 2019/08/24 23:11:01 tom Exp $ */ /* int in_wch(cchar_t *wcval); @@ -44,6 +44,7 @@ */ #include +#include #if USE_WIDEC_SUPPORT @@ -59,13 +60,24 @@ Quit(int ch) static int test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) { + static const char *help[] = + { + "Test input from screen using inch(), etc., in a moveable viewport.", + "", + "Commands:", + " ESC/^Q - quit", + " h,j,k,l (and arrow-keys) - move viewport", + " w - recur to new window", + " for next input file", + 0 + }; + WINDOW *txtbox = 0; WINDOW *txtwin = 0; FILE *fp; int j; int txt_x = 0, txt_y = 0; int base_y; - int limit; cchar_t ch; cchar_t text[MAX_COLS]; @@ -109,6 +121,8 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) } while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) { + int limit; + switch (j) { case KEY_DOWN: case 'j': @@ -148,6 +162,9 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) wnoutrefresh(txtwin); } break; + case HELP_KEY_1: + popup_msg(txtwin, help); + break; default: beep(); break; @@ -251,7 +268,7 @@ main(int argc, char *argv[]) setlocale(LC_ALL, ""); if (argc < 2) { - fprintf(stderr, "usage: %s file\n", argv[0]); + fprintf(stderr, "usage: %s file1 [file2 [...]]\n", argv[0]); return EXIT_FAILURE; } diff --git a/test/inchs.c b/test/inchs.c index be3aab86f578..e9d53702f790 100644 --- a/test/inchs.c +++ b/test/inchs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2007-2017,2019 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: inchs.c,v 1.12 2012/11/18 01:58:15 tom Exp $ + * $Id: inchs.c,v 1.17 2019/08/24 23:11:01 tom Exp $ * * Author: Thomas E Dickey */ @@ -46,6 +46,7 @@ */ #include +#include #define BASE_Y 7 #define MAX_COLS 1024 @@ -69,13 +70,23 @@ Quit(int ch) static int test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) { + static const char *help[] = + { + "Test input from screen using inch(), etc., in a moveable viewport.", + "", + "Commands:", + " ESC/^Q - quit", + " h,j,k,l (and arrow-keys) - move viewport", + " w - recur to new window", + " for next input file", + 0 + }; WINDOW *txtbox = 0; WINDOW *txtwin = 0; FILE *fp; int ch, j; int txt_x = 0, txt_y = 0; int base_y; - int limit; chtype text[MAX_COLS]; if (argv[level] == 0) { @@ -120,6 +131,8 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) } while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) { + int limit; + switch (j) { case KEY_DOWN: case 'j': @@ -159,6 +172,9 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) wnoutrefresh(txtwin); } break; + case HELP_KEY_1: + popup_msg(txtwin, help); + break; default: beep(); break; @@ -264,7 +280,7 @@ main(int argc, char *argv[]) setlocale(LC_ALL, ""); if (argc < 2) { - fprintf(stderr, "usage: %s file\n", argv[0]); + fprintf(stderr, "usage: %s file1 [file2 [...]]\n", argv[0]); return EXIT_FAILURE; } diff --git a/test/ins_wide.c b/test/ins_wide.c index a168dc112fcb..72047a20cc97 100644 --- a/test/ins_wide.c +++ b/test/ins_wide.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2002-2016,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: ins_wide.c,v 1.20 2012/12/16 00:51:02 tom Exp $ + * $Id: ins_wide.c,v 1.24 2017/10/18 23:03:57 tom Exp $ * * Demonstrate the wins_wstr() and wins_wch functions. * Thomas Dickey - 2002/11/23 @@ -132,7 +132,7 @@ ColOf(wchar_t *buffer, int length, int margin) result += 2; break; default: - result += wcwidth(ch); + result += wcwidth((wchar_t) ch); if (ch < 32) ++result; break; @@ -236,7 +236,8 @@ test_inserts(int level) static char cmd[80]; setlocale(LC_ALL, ""); - putenv(strcpy(cmd, "TABSIZE=8")); + _nc_STRCPY(cmd, "TABSIZE=8", sizeof(cmd)); + putenv(cmd); initscr(); (void) cbreak(); /* take input chars one at a time, no wait for \n */ @@ -390,7 +391,9 @@ test_inserts(int level) } break; default: - buffer[length++] = ch; + if (length >= BUFSIZ - 2) + break; + buffer[length++] = (wchar_t) ch; buffer[length] = '\0'; /* put the string in, one character at a time */ @@ -455,7 +458,7 @@ usage(void) { static const char *tbl[] = { - "Usage: inserts [options]" + "Usage: ins_wide [options]" ,"" ,"Options:" ," -f FILE read data from given file" diff --git a/test/insdelln.c b/test/insdelln.c index 758f0887f2ba..95fd2bed318c 100644 --- a/test/insdelln.c +++ b/test/insdelln.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2008-2017,2019 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,17 @@ * authorization. * ****************************************************************************/ /* - * $Id: insdelln.c,v 1.7 2012/11/18 00:37:58 tom Exp $ + * $Id: insdelln.c,v 1.13 2019/08/24 23:11:01 tom Exp $ * * test-driver for deleteln, wdeleteln, insdelln, winsdelln, insertln, winsertln */ #include +#if HAVE_WINSDELLN + +#include + #define SHOW(n) ((n) == ERR ? "ERR" : "OK") #define COLOR_DEFAULT (-1) @@ -66,10 +70,10 @@ color_params(unsigned state, int *pair) }; /* *INDENT-ON* */ - static bool first = TRUE; const char *result = 0; if (has_colors()) { + static bool first = TRUE; if (first) { unsigned n; @@ -217,19 +221,10 @@ show_help(WINDOW *win) ,"q quit" ,"= resets count to zero." ,"? shows this help-window" - ,"" - ,"" + ,0 }; - int y_max, x_max; - int row; - - getmaxyx(win, y_max, x_max); - for (row = 0; row < (int) SIZEOF(table) && row < y_max; ++row) { - MvWPrintw(win, row, 0, "%.*s", x_max, table[row]); - } - while (wgetch(win) != 'q') - beep(); + popup_msg(win, table); } static void @@ -279,8 +274,8 @@ update_status(WINDOW *win, STATUS * sp) sp->count = 0; show_status(win, sp); break; - case '?': - do_subwindow(win, sp, show_help); + case HELP_KEY_1: + show_help(win); break; default: if (isdigit(sp->ch)) { @@ -302,7 +297,7 @@ test_winsdelln(WINDOW *win) init_status(win, &st); do { - (void) wattrset(win, (int) (st.attr | (attr_t) COLOR_PAIR(st.pair))); + (void) wattrset(win, AttrArg(COLOR_PAIR(st.pair), st.attr)); switch (st.ch) { case 'i': for (n = 0; n < st.count; ++n) @@ -343,7 +338,7 @@ test_insdelln(void) init_status(stdscr, &st); do { - (void) attrset(st.attr | (attr_t) COLOR_PAIR(st.pair)); + (void) attrset(AttrArg(COLOR_PAIR(st.pair), st.attr)); switch (st.ch) { case 'i': for (n = 0; n < st.count; ++n) @@ -387,3 +382,12 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) ExitProgram(EXIT_SUCCESS); } + +#else +int +main(void) +{ + printf("This program requires the curses winsdelln function\n"); + ExitProgram(EXIT_FAILURE); +} +#endif diff --git a/test/inserts.c b/test/inserts.c index ae38fa217521..9ba373f23fbd 100644 --- a/test/inserts.c +++ b/test/inserts.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2002-2016,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: inserts.c,v 1.27 2012/12/16 00:35:27 tom Exp $ + * $Id: inserts.c,v 1.29 2017/04/08 22:20:46 tom Exp $ * * Demonstrate the winsstr() and winsch functions. * Thomas Dickey - 2002/10/19 @@ -161,7 +161,8 @@ test_inserts(int level) static char cmd[80]; setlocale(LC_ALL, ""); - putenv(strcpy(cmd, "TABSIZE=8")); + _nc_STRCPY(cmd, "TABSIZE=8", sizeof(cmd)); + putenv(cmd); initscr(); (void) cbreak(); /* take input chars one at a time, no wait for \n */ @@ -319,6 +320,8 @@ test_inserts(int level) beep(); break; } + if (length >= BUFSIZ - 2) + break; buffer[length++] = (char) ch; buffer[length] = '\0'; diff --git a/test/key_names.c b/test/key_names.c index ba45656d50a8..074a1f0ab758 100644 --- a/test/key_names.c +++ b/test/key_names.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 2007-2014,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: key_names.c,v 1.4 2008/10/11 20:22:37 tom Exp $ + * $Id: key_names.c,v 1.7 2017/12/09 21:05:01 tom Exp $ */ #include @@ -77,7 +77,8 @@ main(int argc, char *argv[]) endwin(); } for (n = -1; n < KEY_MAX + 512; n++) { - const char *result = key_name(n); + int check = wcwidth((wchar_t) n); + const char *result = check >= 0 ? key_name((wchar_t) n) : "?"; if (result != 0) printf("%d(%5o):%s\n", n, n, result); } diff --git a/test/knight.c b/test/knight.c index ae9d223441bf..dc04944acd73 100644 --- a/test/knight.c +++ b/test/knight.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -33,25 +33,26 @@ * Eric S. Raymond July 22 1995. Mouse support * added September 20th 1995. * - * $Id: knight.c,v 1.36 2013/02/16 19:53:08 tom Exp $ + * $Id: knight.c,v 1.46 2019/08/24 22:40:52 tom Exp $ */ #include /* board size */ -#define BDEPTH 8 -#define BWIDTH 8 +#define YLIMIT 8 +#define XLIMIT 8 +#define MAXMOVES (ylimit * xlimit) /* where to start the instructions */ -#define INSTRY 2 -#define INSTRX 35 +#define INSTRY 2 +#define INSTRX 35 /* corner of board */ -#define BOARDY 2 -#define BOARDX 0 +#define BOARDY 2 +#define BOARDX 0 /* notification line */ -#define NOTIFYY 21 +#define NOTIFYY 21 /* virtual color values */ #define TRAIL_COLOR 1 @@ -65,20 +66,30 @@ #define CYINV(y) (((y) - 2) / 2) typedef struct { - short x, y; -} cell; + int x, y; +} HISTORY; + +typedef int SQUARES[YLIMIT][XLIMIT]; static WINDOW *boardwin; /* the board window */ static WINDOW *helpwin; /* the help window */ static WINDOW *msgwin; /* the message window */ -static cell history[BDEPTH * BWIDTH + 1]; /* choice history */ + +#if HAVE_USE_DEFAULT_COLORS +static bool d_option; +#endif + static chtype minus = '-'; /* possible-move character */ static chtype oldch; static chtype plus = '+'; /* cursor hot-spot character */ static chtype trail = '#'; /* trail character */ -static int movecount; /* count of moves so far */ -static int trialcount; /* count of trials so far */ -static short board[BDEPTH][BWIDTH]; /* the squares */ + +static int ylimit = YLIMIT; +static int xlimit = XLIMIT; +static int maxmoves = (YLIMIT * XLIMIT); + +static int count_tries; /* count of trials so far */ +static int test_test; /* FIXME */ /* *INDENT-OFF* */ static const struct { int y; @@ -93,6 +104,7 @@ static const struct { { 1, -2 }, { 2, -1 }, }; +#define MAX_OFFSET (unsigned)SIZEOF(offsets) /* *INDENT-ON* */ static void @@ -104,9 +116,12 @@ init_program(void) initscr(); cbreak(); /* immediate char return */ noecho(); /* no immediate echo */ - boardwin = newwin(BDEPTH * 2 + 1, BWIDTH * 4 + 1, BOARDY, BOARDX); + + maxmoves = MAXMOVES; + boardwin = newwin(ylimit * 2 + 1, xlimit * 4 + 1, BOARDY, BOARDX); helpwin = newwin(0, 0, INSTRY, INSTRX); msgwin = newwin(1, INSTRX - 1, NOTIFYY, 0); + scrollok(msgwin, TRUE); keypad(boardwin, TRUE); @@ -115,7 +130,7 @@ init_program(void) start_color(); #if HAVE_USE_DEFAULT_COLORS - if (use_default_colors() == OK) + if (d_option && (use_default_colors() == OK)) bg = -1; #endif @@ -178,7 +193,11 @@ help2(void) (void) waddstr(helpwin, "r -- redraw screen \\|/ \\|/ \n"); (void) waddstr(helpwin, "bksp -- undo move h-+-l 4-+-6\n"); (void) waddstr(helpwin, "a -- autojump /|\\ /|\\ \n"); - (void) waddstr(helpwin, " b j n 1 2 3\n"); + if (ylimit <= 6) { + (void) waddstr(helpwin, "R -- solve (slow) b j n 1 2 3\n"); + } else { + (void) waddstr(helpwin, " b j n 1 2 3\n"); + } (void) waddstr(helpwin, "\nYou can place your knight on the selected\n"); (void) waddstr(helpwin, "square with spacebar, Enter, or the keypad\n"); @@ -202,30 +221,33 @@ show_help(bool * keyhelp) wrefresh(helpwin); } -static bool -chksqr(int r1, int c1) +static inline bool +isValidYX(int y, int x) { - if ((r1 < 0) || (r1 > BDEPTH - 1)) - return (FALSE); - if ((c1 < 0) || (c1 > BWIDTH - 1)) - return (FALSE); - return ((!board[r1][c1]) ? TRUE : FALSE); + return (y >= 0 && y < ylimit && x >= 0 && x < xlimit) ? TRUE : FALSE; +} + +static inline bool +isUnusedYX(SQUARES squares, int y, int x) +{ + return (isValidYX(y, x) && (!squares[y][x]) ? TRUE : FALSE); } static bool -chkmoves(int rw, int col) -/* check to see if valid moves are available */ +boardIsFilled(SQUARES squares, int y, int x) { unsigned n; - for (n = 0; n < SIZEOF(offsets); n++) - if (chksqr(rw + offsets[n].y, col + offsets[n].x)) - return (TRUE); - return (FALSE); + for (n = 0; n < MAX_OFFSET; n++) { + if (isUnusedYX(squares, y + offsets[n].y, x + offsets[n].x)) { + return FALSE; + } + } + return TRUE; } static void -dosquares(void) +drawBoard(void) { int i, j; @@ -233,7 +255,7 @@ dosquares(void) move(BOARDY, BOARDX); waddch(boardwin, ACS_ULCORNER); - for (j = 0; j < 7; j++) { + for (j = 0; j < (ylimit - 1); j++) { waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_HLINE); @@ -244,10 +266,10 @@ dosquares(void) waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_URCORNER); - for (i = 1; i < BDEPTH; i++) { + for (i = 1; i < ylimit; i++) { move(BOARDY + i * 2 - 1, BOARDX); waddch(boardwin, ACS_VLINE); - for (j = 0; j < BWIDTH; j++) { + for (j = 0; j < xlimit; j++) { waddch(boardwin, ' '); waddch(boardwin, ' '); waddch(boardwin, ' '); @@ -255,7 +277,7 @@ dosquares(void) } move(BOARDY + i * 2, BOARDX); waddch(boardwin, ACS_LTEE); - for (j = 0; j < BWIDTH - 1; j++) { + for (j = 0; j < xlimit - 1; j++) { waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_HLINE); @@ -269,7 +291,7 @@ dosquares(void) move(BOARDY + i * 2 - 1, BOARDX); waddch(boardwin, ACS_VLINE); - for (j = 0; j < BWIDTH; j++) { + for (j = 0; j < xlimit; j++) { waddch(boardwin, ' '); waddch(boardwin, ' '); waddch(boardwin, ' '); @@ -278,7 +300,7 @@ dosquares(void) move(BOARDY + i * 2, BOARDX); waddch(boardwin, ACS_LLCORNER); - for (j = 0; j < BWIDTH - 1; j++) { + for (j = 0; j < xlimit - 1; j++) { waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_HLINE); @@ -291,37 +313,36 @@ dosquares(void) } static void -mark_possibles(int prow, int pcol, chtype mark) +mark_possibles(SQUARES squares, int y, int x, chtype mark) { unsigned n; - for (n = 0; n < SIZEOF(offsets); n++) { - if (chksqr(prow + offsets[n].y, pcol + offsets[n].x)) { - cellmove(prow + offsets[n].y, pcol + offsets[n].x); + for (n = 0; n < MAX_OFFSET; n++) { + if (isUnusedYX(squares, y + offsets[n].y, x + offsets[n].x)) { + cellmove(y + offsets[n].y, x + offsets[n].x); waddch(boardwin, mark); } } } static bool -find_next_move(int *y, int *x) +find_next_move(SQUARES squares, HISTORY * doneData, int doneSize, int *y, int *x) { - unsigned j, k; - int found = -1; - int first = -1; - int next = -1; - int oldy, oldx; - int newy, newx; bool result = FALSE; - if (movecount > 1) { - oldy = history[movecount - 1].y; - oldx = history[movecount - 1].x; - for (j = 0; j < SIZEOF(offsets) * 2; j++) { - k = j % SIZEOF(offsets); - newy = oldy + offsets[k].y; - newx = oldx + offsets[k].x; - if (chksqr(newy, newx)) { + if (doneSize > 1) { + unsigned j; + int oldy = doneData[doneSize - 1].y; + int oldx = doneData[doneSize - 1].x; + int found = -1; + int first = -1; + int next = -1; + + for (j = 0; j < MAX_OFFSET * 2; j++) { + unsigned k = j % MAX_OFFSET; + int newy = oldy + offsets[k].y; + int newx = oldx + offsets[k].x; + if (isUnusedYX(squares, newy, newx)) { if (first < 0) first = (int) k; if (newy == *y @@ -345,16 +366,16 @@ find_next_move(int *y, int *x) } static void -count_next_moves(int y, int x) +count_next_moves(SQUARES squares, int count_moves, int y, int x) { int count = 0; unsigned j; - wprintw(msgwin, "\nMove %d", movecount); - for (j = 0; j < SIZEOF(offsets); j++) { + wprintw(msgwin, "\nMove %d", count_moves); + for (j = 0; j < MAX_OFFSET; j++) { int newy = y + offsets[j].y; int newx = x + offsets[j].x; - if (chksqr(newy, newx)) { + if (isUnusedYX(squares, newy, newx)) { ++count; } } @@ -383,37 +404,38 @@ markcell(chtype tchar, int row, int column) } static void -drawmove(chtype tchar, int oldy, int oldx, int row, int column) +drawMove(SQUARES squares, int count_moves, chtype tchar, int oldy, int oldx, int + row, int column) /* place the stars, update board & currents */ { - if (movecount <= 1) { + if (count_moves <= 1) { int i, j; - for (i = 0; i < BDEPTH; i++) { - for (j = 0; j < BWIDTH; j++) { - if (movecount == 0) { + for (i = 0; i < ylimit; i++) { + for (j = 0; j < xlimit; j++) { + if (count_moves == 0) { unmarkcell(i, j); } else { cellmove(i, j); if (winch(boardwin) == minus) - waddch(boardwin, movecount ? ' ' : minus); + waddch(boardwin, ' '); } } } } else { markcell(tchar, oldy, oldx); - mark_possibles(oldy, oldx, ' '); + mark_possibles(squares, oldy, oldx, ' '); } if (row >= 0 && column >= 0) { markcell(trail, row, column); - mark_possibles(row, column, minus); - board[row][column] = TRUE; + mark_possibles(squares, row, column, minus); + squares[row][column] = TRUE; } - wprintw(msgwin, "\nMove %d", movecount); - if (trialcount != movecount) - wprintw(msgwin, " (%d tries)", trialcount); + wprintw(msgwin, "\nMove %d", count_moves); + if (count_tries != count_moves) + wprintw(msgwin, " (%d tries)", count_tries); wclrtoeol(msgwin); } @@ -427,17 +449,16 @@ iabs(int num) } static bool -evalmove(int row, int column) -/* evaluate move */ +evaluate_move(SQUARES squares, HISTORY * doneData, int doneSize, int row, int column) { - if (movecount == 1) + if (doneSize <= 1) return (TRUE); - else if (board[row][column] == TRUE) { + else if (squares[row][column] == TRUE) { waddstr(msgwin, "\nYou've already been there."); return (FALSE); } else { - int rdif = iabs(row - history[movecount - 1].y); - int cdif = iabs(column - history[movecount - 1].x); + int rdif = iabs(row - doneData[doneSize - 1].y); + int cdif = iabs(column - doneData[doneSize - 1].x); if (!((rdif == 1) && (cdif == 2)) && !((rdif == 2) && (cdif == 1))) { waddstr(msgwin, "\nThat's not a legal knight's move."); @@ -449,15 +470,18 @@ evalmove(int row, int column) } static int -completed(void) +completed(SQUARES squares) { int i, j, count = 0; - for (i = 0; i < BDEPTH; i++) - for (j = 0; j < BWIDTH; j++) - if (board[i][j] != 0) + for (i = 0; i < ylimit; i++) { + for (j = 0; j < xlimit; j++) { + if (squares[i][j] != 0) { count += 1; - return (count == (BWIDTH * BDEPTH) ? -1 : count); + } + } + } + return ((count == maxmoves) ? -1 : count); } static void @@ -467,6 +491,103 @@ no_previous_move(void) beep(); } +/* Recursively try all possible moves, starting from (y,x) */ +static int +recurBack(SQUARES squares, int y, int x, int total) +{ + int longest = total; + int best_x = x; + int best_y = y; + int result; + + if (total < maxmoves) { + unsigned k; + + for (k = 0; k < MAX_OFFSET; k++) { + int try_x = x + offsets[k].x; + int try_y = y + offsets[k].y; + if (isUnusedYX(squares, try_y, try_x)) { + ++test_test; + squares[try_y][try_x] = total + 1; + result = recurBack(squares, try_y, try_x, total + 1); + if (result > longest) { + longest = result; + best_x = try_x; + best_y = try_y; + } + if (result >= maxmoves) + break; + squares[try_y][try_x] = 0; /* allow retry... */ + } + } + } + + result = total; + if (longest > total) { + result = longest; + squares[best_y][best_x] = total + 1; + (void) recurBack(squares, best_y, best_x, total + 1); + if (result < maxmoves) + squares[best_y][best_x] = 0; + } + + return result; +} + +/* + * Solve the Knight Tour problem using backtracking, returning the length of + * the resulting solution. If this is invoked from a point where the remaining + * choices cannot complete the tour, the result will fall short. + */ +static int +useBacktracking(SQUARES result, HISTORY * doneData, int doneSize) +{ + int y = 0, x = 0, n; + SQUARES squares; + int total; + int actual = doneSize - 1; + + memset(squares, 0, sizeof(squares)); + for (n = 1; n <= actual; ++n) { + y = doneData[n].y; + x = doneData[n].x; + squares[y][x] = n; + } + + total = recurBack(squares, y, x, actual); + if (total > actual) { + for (y = 0; y < ylimit; ++y) { + for (x = 0; x < xlimit; ++x) { + result[y][x] = squares[y][x]; + if ((n = squares[y][x]) != 0) { + doneData[n].y = y; + doneData[n].x = x; + } + } + } + } + return total; +} + +static int +reviewHistory(HISTORY * history, int count_moves, int review, int *ny, int *nx) +{ + if (review < 0) { + beep(); + review = 0; + } else if (review > count_moves - 2) { + beep(); + review = count_moves - 2; + } else { + *ny = history[count_moves - review - 1].y; + *nx = history[count_moves - review - 1].x; + wprintw(msgwin, "\nReview %d:%d.", count_moves - review - 1, + count_moves - 1); + wrefresh(msgwin); + } + return review; +} + static void play(void) /* play the game */ @@ -477,14 +598,19 @@ play(void) int lastrow = 0; int ny = 0, nx = 0; int review = 0; /* review history */ + int test_size; int rw = 0, col = 0; /* current row and column */ do { + SQUARES squares; + HISTORY history[(YLIMIT * XLIMIT) + 1]; + int count_moves = 0; /* count of moves so far */ + /* clear screen and draw board */ werase(boardwin); werase(helpwin); werase(msgwin); - dosquares(); + drawBoard(); help1(); wnoutrefresh(stdscr); wnoutrefresh(helpwin); @@ -492,10 +618,9 @@ play(void) wnoutrefresh(boardwin); doupdate(); - movecount = 0; - for (i = 0; i < BDEPTH; i++) { - for (j = 0; j < BWIDTH; j++) { - board[i][j] = FALSE; + for (i = 0; i < ylimit; i++) { + for (j = 0; j < xlimit; j++) { + squares[i][j] = FALSE; unmarkcell(i, j); } } @@ -503,8 +628,8 @@ play(void) history[0].y = history[0].x = -1; history[1].y = history[1].x = -1; lastrow = lastcol = -2; - movecount = 1; - trialcount = 1; + count_moves = 1; + count_tries = 1; keyhelp = FALSE; show_help(&keyhelp); @@ -512,7 +637,7 @@ play(void) if (rw != lastrow || col != lastcol) { if (lastrow >= 0 && lastcol >= 0) { cellmove(lastrow, lastcol); - if (board[lastrow][lastcol]) + if (squares[lastrow][lastcol]) waddch(boardwin, trail); else waddch(boardwin, oldch); @@ -534,7 +659,7 @@ play(void) case 'k': case '8': case KEY_UP: - ny = rw + BDEPTH - 1; + ny = rw + ylimit - 1; nx = col; break; case 'j': @@ -547,7 +672,7 @@ play(void) case '4': case KEY_LEFT: ny = rw; - nx = col + BWIDTH - 1; + nx = col + xlimit - 1; break; case 'l': case '6': @@ -558,19 +683,19 @@ play(void) case 'y': case '7': case KEY_A1: - ny = rw + BDEPTH - 1; - nx = col + BWIDTH - 1; + ny = rw + ylimit - 1; + nx = col + xlimit - 1; break; case 'b': case '1': case KEY_C1: ny = rw + 1; - nx = col + BWIDTH - 1; + nx = col + xlimit - 1; break; case 'u': case '9': case KEY_A3: - ny = rw + BDEPTH - 1; + ny = rw + ylimit - 1; nx = col + 1; break; case 'n': @@ -587,8 +712,8 @@ play(void) MEVENT myevent; getmouse(&myevent); - if (myevent.y >= CY(0) && myevent.y <= CY(BDEPTH) - && myevent.x >= CX(0) && myevent.x <= CX(BWIDTH)) { + if (myevent.y >= CY(0) && myevent.y <= CY(ylimit) + && myevent.x >= CX(0) && myevent.x <= CX(xlimit)) { nx = CXINV(myevent.x); ny = CYINV(myevent.y); ungetch('\n'); @@ -605,8 +730,8 @@ play(void) request_mouse_pos(); test_y = MOUSE_Y_POS + 0; test_x = MOUSE_X_POS + 1; - if (test_y >= CY(0) && test_y <= CY(BDEPTH) - && test_x >= CX(0) && test_x <= CX(BWIDTH)) { + if (test_y >= CY(0) && test_y <= CY(ylimit) + && test_x >= CX(0) && test_x <= CX(xlimit)) { ny = CYINV(test_y); nx = CXINV(test_x); wmove(helpwin, 0, 0); @@ -622,18 +747,20 @@ play(void) case '\n': case ' ': review = 0; - if (evalmove(rw, col)) { - drawmove(trail, - history[movecount - 1].y, - history[movecount - 1].x, + if (evaluate_move(squares, history, count_moves, rw, col)) { + drawMove(squares, + count_moves, + trail, + history[count_moves - 1].y, + history[count_moves - 1].x, rw, col); - history[movecount].y = (short) rw; - history[movecount].x = (short) col; - movecount++; - trialcount++; + history[count_moves].y = (short) rw; + history[count_moves].x = (short) col; + count_moves++; + count_tries++; - if (!chkmoves(rw, col)) { - if (completed() < 0) { + if (boardIsFilled(squares, rw, col)) { + if (completed(squares) < 0) { waddstr(msgwin, "\nYou won."); } else { waddstr(msgwin, @@ -649,40 +776,40 @@ play(void) case KEY_BACKSPACE: case '\b': review = 0; - if (movecount <= 0) { + if (count_moves <= 0) { no_previous_move(); - } else if (movecount <= 1) { - ny = history[movecount].y; - nx = history[movecount].x; + } else if (count_moves <= 1) { + ny = history[count_moves].y; + nx = history[count_moves].x; if (nx < 0 || ny < 0) { ny = (lastrow >= 0) ? lastrow : 0; nx = (lastcol >= 0) ? lastcol : 0; } - movecount = 0; - board[ny][nx] = FALSE; + count_moves = 0; + squares[ny][nx] = FALSE; oldch = minus; - drawmove(' ', ny, nx, -1, -1); - movecount = 1; - trialcount = 1; + drawMove(squares, count_moves, ' ', ny, nx, -1, -1); + count_moves = 1; + count_tries = 1; no_previous_move(); } else { - int oldy = history[movecount - 1].y; - int oldx = history[movecount - 1].x; + int oldy = history[count_moves - 1].y; + int oldx = history[count_moves - 1].x; - if (!board[rw][col]) { + if (!squares[rw][col]) { cellmove(rw, col); waddch(boardwin, ' '); } - board[oldy][oldx] = FALSE; - --movecount; - ny = history[movecount - 1].y; - nx = history[movecount - 1].x; + squares[oldy][oldx] = FALSE; + --count_moves; + ny = history[count_moves - 1].y; + nx = history[count_moves - 1].x; if (nx < 0 || ny < 0) { ny = oldy; nx = oldx; } - drawmove(' ', oldy, oldx, ny, nx); + drawMove(squares, count_moves, ' ', oldy, oldx, ny, nx); /* avoid problems if we just changed the current cell */ cellmove(lastrow, lastcol); @@ -693,32 +820,44 @@ play(void) case 'a': nx = col; ny = rw; - if (find_next_move(&ny, &nx)) - count_next_moves(ny, nx); + if (find_next_move(squares, history, count_moves, &ny, &nx)) + count_next_moves(squares, count_moves, ny, nx); else beep(); break; case 'F': - if (review > 0) { - review--; - ny = history[movecount - review - 1].y; - nx = history[movecount - review - 1].x; - } else { - beep(); - } + review = reviewHistory(history, count_moves, review - 1, + &ny, &nx); break; case 'B': - if (review < movecount - 2) { - review++; - ny = history[movecount - review - 1].y; - nx = history[movecount - review - 1].x; + review = reviewHistory(history, count_moves, review + 1, + &ny, &nx); + break; + + case 'R': + if (ylimit <= 6) { + wprintw(msgwin, "\nworking..."); + wrefresh(msgwin); + test_test = 0; + test_size = useBacktracking(squares, history, count_moves); + wprintw(msgwin, "\nOk %d:%d (%d tests)", + test_size, maxmoves, test_test); + review = 0; + while (count_moves <= test_size) { + markcell(trail, + ny = history[count_moves].y, + nx = history[count_moves].x); + count_moves++; + } } else { - beep(); + wprintw(msgwin, "\nBoard is too large."); } + wrefresh(msgwin); break; +#if HAVE_CURSCR case KEY_REDO: case '\f': case 'r': @@ -729,12 +868,13 @@ play(void) wnoutrefresh(helpwin); doupdate(); break; +#endif case 'q': case 'x': goto dropout; - case '?': + case HELP_KEY_1: show_help(&keyhelp); break; @@ -743,12 +883,12 @@ play(void) break; } - col = nx % BWIDTH; - rw = ny % BDEPTH; + col = nx % xlimit; + rw = ny % ylimit; } dropout: - if ((count = completed()) < 0) + if ((count = completed(squares)) < 0) wprintw(msgwin, "\nYou won. Care to try again? "); else wprintw(msgwin, "\n%d squares filled. Try again? ", count); @@ -757,9 +897,55 @@ play(void) (tolower(wgetch(msgwin)) == 'y'); } +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: knight [options]" + ,"" + ,"Options:" +#if HAVE_USE_DEFAULT_COLORS + ," -d invoke use_default_colors" +#endif + ," -n NUM set board-size to NUM*NUM (default 8x8)" + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(EXIT_FAILURE); +} + int -main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +main(int argc, char *argv[]) { + int ch; + + while ((ch = getopt(argc, argv, "dn:")) != -1) { + switch (ch) { +#if HAVE_USE_DEFAULT_COLORS + case 'd': + d_option = TRUE; + break; +#endif + case 'n': + ch = atoi(optarg); + if (ch < 3 || ch > 8) { + fprintf(stderr, "board size %d is outside [3..8]\n", ch); + usage(); + } + xlimit = ylimit = ch; + break; + default: + usage(); + /* NOTREACHED */ + } + } + if (optind < argc) + usage(); + init_program(); play(); @@ -767,5 +953,3 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) endwin(); ExitProgram(EXIT_SUCCESS); } - -/* knight.c ends here */ diff --git a/test/linedata.h b/test/linedata.h index 751bc6b5db27..b97f1c97bdd5 100644 --- a/test/linedata.h +++ b/test/linedata.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2009-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2009-2012,2018 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,6 +26,16 @@ * authorization. * ****************************************************************************/ +/* + * $Id: linedata.h,v 1.7 2018/02/03 22:51:43 tom Exp $ + * + * Utility functions for reading a line of text from a file. + */ +#ifndef LINEDATA_H_incl +#define LINEDATA_H_incl 1 + +#include + #define isQUIT(c) ((c) == QUIT || (c) == ESCAPE) #define key_RECUR CTRL('W') @@ -96,3 +106,5 @@ read_linedata(WINDOW *work) } return result; } + +#endif /* LINEDATA_H_incl */ diff --git a/test/list_keys.c b/test/list_keys.c new file mode 100644 index 000000000000..506f2e845f4c --- /dev/null +++ b/test/list_keys.c @@ -0,0 +1,511 @@ +/**************************************************************************** + * Copyright (c) 2016-2018,2019 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: list_keys.c,v 1.25 2019/08/24 23:11:01 tom Exp $ + * + * Author: Thomas E Dickey + * + * List function keys for one or more terminals. + */ + +#define USE_TINFO +#include + +#if NCURSES_XNAMES +#if HAVE_TERM_ENTRY_H +#include +#else +#undef NCURSES_XNAMES +#define NCURSES_XNAMES 0 +#endif +#endif + +#if HAVE_TIGETSTR +#if defined(HAVE_CURSES_DATA_BOOLNAMES) || defined(DECL_CURSES_DATA_BOOLNAMES) + +static bool f_opt = FALSE; +static bool m_opt = FALSE; +static bool t_opt = FALSE; +static bool x_opt = FALSE; + +typedef enum { + ktCursor + ,ktFunction + ,ktOther +#if HAVE_USE_EXTENDED_NAMES + ,ktExtended +#endif +} KEYTYPE; + +typedef struct { + KEYTYPE type; + const char *name; +} KEYNAMES; + +#define Type(n) list[n].type +#define Name(n) list[n].name + +static const char * +full_name(const char *name) +{ + const char *result = name; + int n; + for (n = 0; strnames[n] != 0; ++n) { + if (!strcmp(name, strnames[n])) { + result = strfnames[n]; + break; + } + } + return result; +} + +static int +show_key(const char *name, bool show) +{ + int width = 0; + NCURSES_CONST char *value = tigetstr((NCURSES_CONST char *) name); + + if (show && t_opt) + fputc('"', stdout); + + if (value != 0 && value != (char *) -1) { + while (*value != 0) { + char buffer[10]; + int ch = UChar(*value++); + switch (ch) { + case '\177': + _nc_STRCPY(buffer, "^?", sizeof(buffer)); + break; + case '\033': + _nc_STRCPY(buffer, "\\E", sizeof(buffer)); + break; + case '\b': + _nc_STRCPY(buffer, "\\b", sizeof(buffer)); + break; + case '\f': + _nc_STRCPY(buffer, "\\f", sizeof(buffer)); + break; + case '\n': + _nc_STRCPY(buffer, "\\n", sizeof(buffer)); + break; + case '\r': + _nc_STRCPY(buffer, "\\r", sizeof(buffer)); + break; + case ' ': + _nc_STRCPY(buffer, "\\s", sizeof(buffer)); + break; + case '\t': + _nc_STRCPY(buffer, "\\t", sizeof(buffer)); + break; + case '^': + _nc_STRCPY(buffer, "\\^", sizeof(buffer)); + break; + case ':': + _nc_STRCPY(buffer, "\\072", sizeof(buffer)); + break; + case '\\': + _nc_STRCPY(buffer, "\\\\", sizeof(buffer)); + break; + default: + if (t_opt && ch == '"') { + _nc_STRCPY(buffer, "\"\"", sizeof(buffer)); + } else if (isgraph(ch)) { + _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) + "%c", ch); + } else if (ch < 32) { + _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) + "^%c", ch + '@'); + } else { + _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) + "\\%03o", ch); + } + break; + } + width += (int) strlen(buffer); + if (show) + fputs(buffer, stdout); + } + } + + if (show && t_opt) + fputc('"', stdout); + + return width; +} + +static bool +valid_key(const char *name, TERMINAL **terms, int count) +{ + bool result = FALSE; + if (*name == 'k') { + int k; + for (k = 0; k < count; ++k) { + set_curterm(terms[k]); + if (show_key(name, FALSE)) { + result = TRUE; + break; + } + } + } + return result; +} + +static int +compare_keys(const void *a, const void *b) +{ + const KEYNAMES *p = (const KEYNAMES *) a; + const KEYNAMES *q = (const KEYNAMES *) b; + int result = (int) (p->type - q->type); + int pn, qn; + if (result == 0) { + if (p->type == ktFunction && + sscanf(p->name, "kf%d", &pn) == 1 && + sscanf(q->name, "kf%d", &qn) == 1) { + result = (pn - qn); + } else { + result = strcmp(p->name, q->name); + } + } + return result; +} + +static void +draw_line(int width) +{ + if (!t_opt) { + int j; + for (j = 0; j < width; ++j) { + printf("-"); + } + printf("\n"); + } +} + +static const char * +modified_key(const char *name) +{ + static char result[100]; + char buffer[sizeof(result) - 10]; + int value; + char chr; + static const char *modifiers[][2] = + { + {"", ""}, + {"s-", "shift-"}, + {"a-", "alt-"}, + {"as-", "alt-shift-"}, + {"c-", "ctrl-"}, + {"sc-", "ctrl-shift-"}, + {"ac-", "alt-ctrl-"}, + {"acs-" "alt-ctrl-shift-"}, + }; + + if (strlen(name) > (sizeof(result) - 3)) { + *result = '\0'; + } else if (sscanf(name, "kf%d%c", &value, &chr) == 1 && + value >= 1 && + value <= 63) { + /* map 1,2,3,4,5,6,7 to 1,2,5,... */ + int map = ((value - 1) / 12); + int key = ((value - 1) % 12); + int bit1 = (map & 2); + int bit2 = (map & 4); + map &= ~6; + map |= (bit1 << 1) | (bit2 >> 1); + _nc_SPRINTF(result, _nc_SLIMIT(sizeof(result)) + "%sF%d", modifiers[map][(unsigned) f_opt], 1 + key); + } else if (sscanf(name, "k%[A-Z]%d%c", buffer, &value, &chr) == 2 && + (value > 1 && + value <= 8) && + (!strcmp(buffer, "UP") || + !strcmp(buffer, "DN") || + !strcmp(buffer, "LFT") || + !strcmp(buffer, "RIT") || + !strcmp(buffer, "IC") || + !strcmp(buffer, "DC") || + !strcmp(buffer, "HOM") || + !strcmp(buffer, "END") || + !strcmp(buffer, "NXT") || + !strcmp(buffer, "PRV"))) { + _nc_SPRINTF(result, _nc_SLIMIT(sizeof(result)) + "%sk%s", modifiers[value - 1][(unsigned) f_opt], buffer); + } else if (sscanf(name, "k%[A-Z]%c", buffer, &chr) == 1 && + (!strcmp(buffer, "UP") || + !strcmp(buffer, "DN"))) { + _nc_SPRINTF(result, _nc_SLIMIT(sizeof(result)) + "%sk%s", modifiers[1][(unsigned) f_opt], buffer); + } else { + *result = '\0'; + } + return result; +} + +static void +list_keys(TERMINAL **terms, int count) +{ + int j, k; + int widths0 = 0; + int widths1 = 0; + int widths2 = 0; + int widthsx; + int check; + size_t total = 0; + size_t actual = 0; + const char *name = f_opt ? "strfname" : "strname"; + const char *modifier = "extended"; + KEYNAMES *list; + + for (total = 0; strnames[total]; ++total) { + ; + } +#if NCURSES_XNAMES + if (x_opt) { + for (k = 0; k < count; ++k) { + TERMTYPE *term; + set_curterm(terms[k]); + term = (TERMTYPE *) cur_term; + total += (size_t) (NUM_STRINGS(term) - STRCOUNT); + } + } +#endif + list = typeCalloc(KEYNAMES, total + 1); + for (j = 0; strnames[j]; ++j) { + Type(j) = ktOther; + if (sscanf(strnames[j], "kf%d", &k) == 1) { + Type(j) = ktFunction; + } else if (!(strncmp) (strnames[j], "kcu", 3)) { + Type(j) = ktCursor; + } + Name(j) = strnames[j]; + } +#if NCURSES_XNAMES + if (x_opt) { + int m, n; + + for (k = 0; k < count; ++k) { + TERMTYPE *term; + + set_curterm(terms[k]); + term = (TERMTYPE *) cur_term; + for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) { + bool found = FALSE; + const char *estr = ExtStrname(term, (int) n, strnames); + for (m = STRCOUNT; m < j; ++m) { + if (!strcmp(estr, Name(m))) { + found = TRUE; + break; + } + } + if (!found) { + Type(j) = ktExtended; + Name(j++) = estr; + } + } + } + } +#endif + actual = (size_t) j; + qsort(list, actual, sizeof(KEYNAMES), compare_keys); + + widths0 = (int) strlen(name); + if (m_opt) + widths1 = (int) strlen(modifier); + + for (k = 0; k < count; ++k) { + set_curterm(terms[k]); + check = (int) strlen(termname()); + if (widths2 < check) + widths2 = check; + } + for (j = 0; Name(j) != 0; ++j) { + if (valid_key(Name(j), terms, count)) { + const char *label = f_opt ? full_name(Name(j)) : Name(j); + check = (int) strlen(label); + if (widths0 < check) + widths0 = check; + for (k = 0; k < count; ++k) { + set_curterm(terms[k]); + check = show_key(Name(j), FALSE) + 1; + if (widths2 < check) + widths2 = check; + if (m_opt) { + check = (int) strlen(modified_key(Name(j))); + if (widths1 < check) + widths1 = check; + } + } + } + } + + if (t_opt) { + printf("\"%s\"", name); + if (m_opt) + printf(",\"%s\"", modifier); + } else { + printf("%-*s", widths0, name); + if (m_opt) + printf(" %-*s", widths1, modifier); + } + for (k = 0; k < count; ++k) { + set_curterm(terms[k]); + if (t_opt) { + printf(",\"%s\"", termname()); + } else if (k + 1 >= count) { + printf(" %s", termname()); + } else { + printf(" %-*s", widths2, termname()); + } + } + printf("\n"); + + widthsx = widths0 + ((count + 1) * widths2); + + for (j = 0; Name(j) != 0; ++j) { + if (j == 0 || (Type(j) != Type(j - 1))) + draw_line(widthsx); + if (valid_key(Name(j), terms, count)) { + const char *label = f_opt ? full_name(Name(j)) : Name(j); + if (t_opt) { + printf("\"%s\"", label); + if (m_opt) + printf(",\"%s\"", modified_key(Name(j))); + } else { + printf("%-*s", widths0, label); + if (m_opt) + printf(" %-*s", widths1, modified_key(Name(j))); + } + for (k = 0; k < count; ++k) { + printf(t_opt ? "," : " "); + set_curterm(terms[k]); + check = show_key(Name(j), TRUE); + if (!t_opt) { + if (k + 1 < count) { + printf("%*s", widths2 - check, " "); + } + } + } + printf("\n"); + } + } + free(list); +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: list_keys [options] [terminal [terminal2 [...]]]", + "", + "Print capabilities for terminal special keys.", + "", + "Options:", + " -f print full names", + " -m print modifier-column for shift/control keys", + " -t print result as CSV table", +#ifdef NCURSES_VERSION + " -x print extended capabilities", +#endif + }; + unsigned n; + for (n = 0; n < SIZEOF(msg); ++n) { + fprintf(stderr, "%s\n", msg[n]); + } + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc, char *argv[]) +{ + int n; + TERMINAL **terms = typeCalloc(TERMINAL *, argc + 1); + + while ((n = getopt(argc, argv, "fmtx")) != -1) { + switch (n) { + case 'f': + f_opt = TRUE; + break; + case 'm': + m_opt = TRUE; + break; + case 't': + t_opt = TRUE; + break; +#ifdef NCURSES_VERSION + case 'x': + x_opt = TRUE; + break; +#endif + default: + usage(); + break; + } + } + +#if HAVE_USE_EXTENDED_NAMES + use_extended_names(x_opt); +#endif + + if (optind < argc) { + int found = 0; + int status; + for (n = optind; n < argc; ++n) { + setupterm((NCURSES_CONST char *) argv[n], 1, &status); + if (status > 0 && cur_term != 0) { + terms[found++] = cur_term; + } + } + if (found) + list_keys(terms, found); + } else { + setupterm(NULL, 1, (int *) 0); + terms[0] = cur_term; + list_keys(terms, 1); + } + + free(terms); + + ExitProgram(EXIT_SUCCESS); +} + +#else +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + printf("This program requires the terminfo arrays\n"); + ExitProgram(EXIT_FAILURE); +} +#endif +#else /* !HAVE_TIGETSTR */ +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + printf("This program requires the terminfo functions such as tigetstr\n"); + ExitProgram(EXIT_FAILURE); +} +#endif /* HAVE_TIGETSTR */ diff --git a/test/lrtest.c b/test/lrtest.c index da12034ce083..ee510cc4af1d 100644 --- a/test/lrtest.c +++ b/test/lrtest.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2017,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,7 +34,7 @@ * This can't be part of the ncurses test-program, because ncurses rips off the * bottom line to do labels. * - * $Id: lrtest.c,v 1.22 2010/05/01 19:11:55 tom Exp $ + * $Id: lrtest.c,v 1.26 2019/12/14 23:25:29 tom Exp $ */ #include @@ -148,9 +148,9 @@ main( nodelay(stdscr, TRUE); #ifdef TRACE else if (ch == 'T') - trace(0); + curses_trace(0); else if (ch == 't') - trace(TRACE_CALLS | TRACE_ICALLS | TRACE_UPDATE); + curses_trace(TRACE_CALLS | TRACE_ICALLS | TRACE_UPDATE); #endif #ifdef KEY_RESIZE else if (ch == KEY_RESIZE) { @@ -174,8 +174,7 @@ main( refresh(); } - curs_set(1); - endwin(); + stop_curses(); ExitProgram(EXIT_SUCCESS); } diff --git a/test/make-tar.sh b/test/make-tar.sh index a71e1e1e0f97..bfafa11a041b 100755 --- a/test/make-tar.sh +++ b/test/make-tar.sh @@ -1,7 +1,7 @@ #!/bin/sh -# $Id: make-tar.sh,v 1.12 2013/10/26 23:11:43 tom Exp $ +# $Id: make-tar.sh,v 1.15 2019/03/02 22:51:42 tom Exp $ ############################################################################## -# Copyright (c) 2010-2011,2013 Free Software Foundation, Inc. # +# Copyright (c) 2010-2017,2019 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"), # @@ -66,7 +66,7 @@ edit_specfile() { make_changelog() { test -f $1 && chmod u+w $1 cat >$1 < c #FF5C00", +", c #FF3000", +"' c #FF4500", +") c #FF2000", +"! c #FF0300", +"~ c #FF1600", +"{ c #FF5D00", +"] c #FF3800", +"^ c #FF0200", +"/ c #FF0900", +"( c #FF2B00", +"_ c #FF3300", +": c #FF1A00", +"< c #FF1300", +"[ c #FF1200", +"} c #FF5700", +"| c #4577BA", +"1 c #874E78", +"2 c #887577", +"3 c #887E77", +"4 c #887977", +"5 c #875078", +"6 c #566CA9", +"7 c #5E70A1", +"8 c #884E77", +"9 c #887677", +"0 c #7C5B83", +"a c #795686", +"b c #008DFE", +"c c #0012F3", +"d c #000BF2", +"e c #008FFE", +"f c #006CFA", +"g c #0000F1", +"h c #0001F1", +"i c #0020F4", +"j c #0040F6", +"k c #0959F0", +"l c #1158E8", +"m c #1159E8", +"n c #0058F9", +"o c #001DF4", +"p c #0023F4", +"q c #005BFA", +"r c #0060FA", +"s c #0E58EB", +"t c #0651F3", +"u c #0033F5", +"v c #000EF2", +"w c #006EFA", +"x c #0092FF", +"y c #001FF4", +"z c #000FF2", +"A c #0C51EC", +"B c #326AC9", +"C c #7A6583", +"D c #CA6234", +"E c #FC5F03", +"F c #FF5800", +"G c #FF0800", +"H c #F4060B", +"I c #007CFB", +"J c #0013F3", +"K c #007EFB", +"L c #FF1800", +"M c #F3590C", +"N c #AB6152", +"O c #4F4EAD", +"P c #175CE4", +"Q c #0036F5", +"R c #0022F4", +"S c #0095FD", +"T c #0084FD", +"U c #0004F1", +"V c #0051F8", +"W c #345AC7", +"X c #E61519", +"Y c #FF5900", +"Z c #FF4600", +"` c #FF0100", +" . c #446EB9", +".. c #0034F6", +"+. c #0032F5", +"@. c #FF2200", +"#. c #006FFA", +"$. c #002DF5", +"%. c #0086FD", +"&. c #0046F7", +"*. c #0015F3", +"=. c #0076FC", +"-. c #FF0400", +";. c #FF2300", +">. c #FF2900", +",. c #9E3E61", +"'. c #0039F6", +"). c #FF2A00", +"!. c #FF4300", +"~. c #0071FB", +"{. c #005EF9", +"]. c #004DF7", +"^. c #008CFE", +"/. c #0008F2", +"(. c #001DF3", +"_. c #007DFB", +":. c #FF4100", +"<. c #FF5B00", +"[. c #A3425C", +"}. c #994C66", +"|. c #FF1100", +"1. c #0072FB", +"2. c #000AF2", +"3. c #006EFC", +"4. c #0017F3", +"5. c #007FFB", +"6. c #FF0600", +"7. c #FF5600", +"8. c #A56A5A", +"9. c #A53B5A", +"0. c #FF4F00", +"a. c #0076FB", +"b. c #0076FA", +"c. c #0093FF", +"d. c #007DFC", +"e. c #FF1C00", +"f. c #A5765A", +"g. c #A55D5A", +"h. c #006FFB", +"i. c #002CF5", +"j. c #008AFD", +"k. c #006BF9", +"l. c #FF3A00", +"m. c #FF5000", +"n. c #007BFB", +"o. c #008BFD", +"p. c #A5755A", +"q. c #9A5565", +"r. c #A43A5B", +"s. c #FF4D00", +"t. c #80507F", +"u. c #FF0F00", +"v. c #7A5485", +"w. c #A5555A", +"x. c #FF0A00", +"y. c #A53D5A", +"z. c #A4515B", +"A. c #A5685A", +"B. c #A5735A", +"C. c #FF0700", +"D. c #FF2E00", +"E. c #FF1500", +"F. c #A3705C", +"G. c #FF0500", +"H. c #9A4965", +"I. c #FF0E00", +"J. c #FF3B00", +"K. c #FF2D00", +"L. c #A13C5E", +"M. c #FF4C00", +"N. c #62649D", +"O. c #FF0B00", +"P. c #FF4700", +"Q. c #FF1D00", +"R. c #A56D5A", +"S. c #FF2C00", +"T. c #A4465B", +"U. c #FF1400", +"V. c #A03E61", +"W. c #FF3100", +"X. c #FF1B00", +"Y. c #FF1000", +"Z. c #0029F5", +"`. c #0027F4", +" + c #4571BA", +".+ c #FF3900", +"++ c #FF3200", +"@+ c #008EFD", +"#+ c #0019F3", +"$+ c #0090FD", +"%+ c #FF0D00", +"&+ c #FF1E00", +"*+ c #FF4E00", +"=+ c #0088FC", +"-+ c #0087FC", +";+ c #FF1900", +">+ c #0036F6", +",+ c #FF2100", +"'+ c #0073FB", +")+ c #0062FA", +"!+ c #001AF3", +"~+ c #2463D8", +"{+ c #3E58BE", +"]+ c #2A7FD3", +"^+ c #807B7F", +"/+ c #008EFB", +"(+ c #006AFA", +"_+ c #004CF8", +":+ c #717B8D", +"<+ c #EE0B11", +"[+ c #F73E08", +"}+ c #FF1F00", +"|+ c #FF5500", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ . . # @ @ @ @ @ @ @ @ @ @ @ @ $ . ", +" . % & & & * @ @ @ @ @ = & & & & & . . - & & & & & ; @ > & & & & , . ", +" . . . . . . * @ @ @ @ ; . . . . . . . . . . . . . ' @ ) . . . . . . ", +" ! ~ { @ @ @ @ ] ^ / ( @ $ . ", +" ^ _ @ @ @ @ @ : ! < [ > } ^ . ", +" | 1 2 3 3 3 3 4 5 6 7 8 9 3 0 a ", +" b c d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d c e ", +" f g g g g g g h i j k l m n o g g g g g g p q r s t u v g g g g g g g w ", +" x y g g g g z A B C D E F G H I c g g g g J K L / M N O P Q h g g g g R S ", +" T g g g U V W X Y @ @ @ @ Z ` ...g g g g +. ` ' @ @.. #.$.g g g g %. ", +" &.g g *.=. -.;.@ @ @ @ @ >.,.'.g g g g '. / ).@ !.. ~.{.U g g ]. ", +" ^./.g (._. ` :.@ @ @ @ <.[.'.g g g g '.}.|.<.} ^ . 1.2.g d e ", +" 3.g 4.5. 6.7.@ @ @ @ 8.'.g g g g '.9.0.@ [ . a./.g b. ", +" c.R /.d. -.e.@ @ @ @ f.'.g g g g '.g.@ - . h.h i. ", +" j.k.%. ^ l.@ @ @ f.'.g g g g '.f.m.` n.f o. ", +" ! * @ @ f.'.g g g g '.p.G . ", +" ! ~ { @ f.'.g g g g '.q.. ", +" ^ _ @ f.'.g g g g '.r. ", +" ^ s.f.'.g g g g '.t. ", +" ^ u.p.'.g g g g '.v. ", +" ^ w.'.g g g g '.r. ", +" x.y.'.g g g g '.z.^ ", +" ` A.'.g g g g '.B.x.. ", +" C.D.f.'.g g g g '.f.# ` ", +" < E.{ F.'.g g g g '.f.@ ( ^ ", +" : G.; @ H.'.g g g g '.f.@ <.I.^ ", +" -.J.@ K.L.'.g g g g '.f.@ @ s.` ", +" I.) @ M.. N.'.g g g g '.f.@ @ @ _ ^ ", +" L O.F <.6.. '.g g g g '.f.@ @ @ { E.! ", +" ^ P.@ Q.. '.g g g g '.R.@ @ @ @ * ! ", +" G S.@ % . '.g g g g '.T.{ @ @ @ @ l.^ ", +" < U.> 7.^ ..g g g g u V.W.@ @ @ @ @ e.! ", +" X.-.m.@ Y.. Z.g g g g `. +` M.@ @ @ @ 7.6. ", +" -..+@ ++. @+#+g g g g #+$+^ %+<.@ @ @ @ :.` ", +" I.&+@ *+. =+h g g g g h -+ ! >.@ @ @ @ @ ;.^ ", +" ;+x.} > C.. >+g g g g g g >+ ` Z @ @ @ @ Y / . ", +" ` ' @ ,+. %.1.'+)+!+g g g g g g g g #+)+~+{+]+^+@ @ @ P.` ", +" / ).@ !.. /+(+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+(+:+@ @ @ @ ).^ ", +" I.[ > F . . <+[+@ @ @ @ <.I.` ", +" . . . . . . 0.@ }+. . . . . . . . . . . . . |+@ @ @ @ s.. . . . . . ", +" O.@ @ @ @ @ @ @ @ @ @ @ @ @ ^ ! $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ . ", +" . & & & & & & & & & & & & & . . , & & & & & & & & & & & & & & & , . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" "}; diff --git a/test/mk-test.awk b/test/mk-test.awk index df560ebfa64a..a438580f3de0 100644 --- a/test/mk-test.awk +++ b/test/mk-test.awk @@ -1,6 +1,6 @@ -# $Id: mk-test.awk,v 1.12 2010/11/06 23:06:48 tom Exp $ +# $Id: mk-test.awk,v 1.22 2019/01/06 00:35:28 tom Exp $ ############################################################################## -# Copyright (c) 2006-2007,2010 Free Software Foundation, Inc. # +# Copyright (c) 2006-2018,2019 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"), # @@ -67,11 +67,21 @@ END { } print ""; } + print "SCRIPTS = \\" + print " $(srcdir)/savescreen.sh \\" + print " $(srcdir)/tput-colorcube \\" + print " $(srcdir)/tput-initc \\" + print " $(srcdir)/tracemunch" + print "DATAFILES = \\" + print " $(srcdir)/*.x* \\" + print " $(srcdir)/*.dat" print "" print "all: $(TESTS)" print "" print "sources:" print "" + print "check:" + print " @ echo The test-programs are interactive" print "tags:" print " $(CTAGS) *.[ch]" print "" @@ -83,18 +93,43 @@ END { if (INSTALL == "yes") { print "# we might install the test-programs" print "install \\" - print "install.test: $(BINDIR) $(TESTS)" - print " $(SHELL) -c 'for src in $(TESTS); do \\" + print "install.test: $(BINDIR) $(DATADIR) $(TESTS)" + + print " @$(SHELL) -c 'for src in $(TESTS); do \\" print " dst=`echo $$src | $(TRANSFORM)`; \\" + print " echo \"installing $$src -> $(BINDIR)/$$dst\"; \\" print " $(INSTALL_PROG) $$src $(BINDIR)/$$dst; \\" print " done'" + + print " @$(SHELL) -c 'for src in $(SCRIPTS); do \\" + print " dst=`echo $$src | sed -e 's,^.*/,,' | $(TRANSFORM)`; \\" + print " echo \"installing $$src -> $(BINDIR)/$$dst\"; \\" + print " $(INSTALL_SCRIPT) $$src $(BINDIR)/$$dst; \\" + print " done'" + + print " @$(SHELL) -c 'for src in $(DATAFILES); do \\" + print " dst=`echo $$src | sed -e 's,^.*/,,'`; \\" + print " echo \"installing $$src -> $(DATADIR)/$$dst\"; \\" + print " $(INSTALL_DATA) $$src $(DATADIR)/$$dst; \\" + print " done'" print "" print "uninstall \\" print "uninstall.test:" - print " $(SHELL) -c 'for src in $(TESTS); do \\" + + print " @$(SHELL) -c 'for src in $(TESTS); do \\" print " dst=`echo $$src | $(TRANSFORM)`; \\" print " rm -f $(BINDIR)/$$dst; \\" print " done'" + + print " @$(SHELL) -c 'for src in $(SCRIPTS); do \\" + print " dst=`echo $$src | sed -e 's,^.*/,,' | $(TRANSFORM)`; \\" + print " rm -f $(BINDIR)/$$dst; \\" + print " done'" + + print " @$(SHELL) -c 'for src in $(DATAFILES); do \\" + print " dst=`echo $$src | sed -e 's,^.*/,,'`; \\" + print " rm -f $(DATADIR)/$$dst; \\" + print " done'" } else { print "install \\" print "install.test \\" @@ -107,7 +142,7 @@ END { print "" print "clean :: mostlyclean" print " -$(SHELL) -c \"if test -n '$x' ; then $(MAKE) clean x=''; fi\"" - print " -rm -rf *$o screendump *.lis $(TESTS) .libs" + print " -rm -rf *$o screendump *.lis $(TESTS) .libs *.dSYM" print "" print "distclean :: clean" print " -rm -f Makefile ncurses_cfg.h config.status config.log" @@ -116,7 +151,7 @@ END { print "" print "lint:" print " $(SHELL) -c 'for N in $(TESTS); do echo LINT:$$N; $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/$$N.c $(LINT_LIBS); done'" - print "$(BINDIR) :" + print "$(BINDIR) $(DATADIR) :" print " mkdir -p $@" diff --git a/test/modules b/test/modules index 628335a914ec..40a0c09b9689 100644 --- a/test/modules +++ b/test/modules @@ -1,6 +1,6 @@ -# $Id: modules,v 1.50 2013/12/07 18:06:01 tom Exp $ +# $Id: modules,v 1.70 2019/02/16 19:35:47 tom Exp $ ############################################################################## -# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. # +# Copyright (c) 1998-2018,2019 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"), # @@ -36,47 +36,60 @@ background progs $(srcdir) $(HEADER_DEPS) blue progs $(srcdir) $(HEADER_DEPS) bs progs $(srcdir) $(HEADER_DEPS) cardfile progs $(srcdir) $(HEADER_DEPS) ../include/panel.h ../include/form.h -chgat progs $(srcdir) $(HEADER_DEPS) -clip_printw progs $(srcdir) $(HEADER_DEPS) +chgat progs $(srcdir) $(HEADER_DEPS) $(srcdir)/popup_msg.h +clip_printw progs $(srcdir) $(HEADER_DEPS) $(srcdir)/popup_msg.h +color_content progs $(srcdir) $(HEADER_DEPS) color_set progs $(srcdir) $(HEADER_DEPS) demo_altkeys progs $(srcdir) $(HEADER_DEPS) demo_defkey progs $(srcdir) $(HEADER_DEPS) demo_forms progs $(srcdir) $(HEADER_DEPS) $(srcdir)/edit_field.h demo_keyok progs $(srcdir) $(HEADER_DEPS) demo_menus progs $(srcdir) $(HEADER_DEPS) ../include/menu.h +demo_new_pair progs $(srcdir) $(HEADER_DEPS) $(srcdir)/popup_msg.h demo_panels progs $(srcdir) $(HEADER_DEPS) ../include/panel.h +demo_tabs progs $(srcdir) $(HEADER_DEPS) demo_termcap progs $(srcdir) $(HEADER_DEPS) demo_terminfo progs $(srcdir) $(HEADER_DEPS) ditto progs $(srcdir) $(HEADER_DEPS) dots progs $(srcdir) $(HEADER_DEPS) +dots_curses progs $(srcdir) $(HEADER_DEPS) dots_mvcur progs $(srcdir) $(HEADER_DEPS) dots_termcap progs $(srcdir) $(HEADER_DEPS) +dots_xcurses progs $(srcdir) $(HEADER_DEPS) +dump_window progs $(srcdir) $(HEADER_DEPS) $(srcdir)/dump_window.h echochar progs $(srcdir) $(HEADER_DEPS) -edit_field progs $(srcdir) $(HEADER_DEPS) $(srcdir)/edit_field.h +edit_field progs $(srcdir) $(HEADER_DEPS) $(srcdir)/edit_field.h $(srcdir)/popup_msg.h +extended_color progs $(srcdir) $(HEADER_DEPS) filter progs $(srcdir) $(HEADER_DEPS) firework progs $(srcdir) $(HEADER_DEPS) firstlast progs $(srcdir) $(HEADER_DEPS) foldkeys progs $(srcdir) $(HEADER_DEPS) -form_driver_w progs $(srcdir) $(HEADER_DEPS) +form_driver_w progs $(srcdir) $(HEADER_DEPS) $(srcdir)/popup_msg.h gdc progs $(srcdir) $(HEADER_DEPS) hanoi progs $(srcdir) $(HEADER_DEPS) hashtest progs $(srcdir) $(HEADER_DEPS) -inch_wide progs $(srcdir) $(HEADER_DEPS) -inchs progs $(srcdir) $(HEADER_DEPS) +inch_wide progs $(srcdir) $(HEADER_DEPS) $(srcdir)/popup_msg.h +inchs progs $(srcdir) $(HEADER_DEPS) $(srcdir)/popup_msg.h ins_wide progs $(srcdir) $(HEADER_DEPS) $(srcdir)/linedata.h -insdelln progs $(srcdir) $(HEADER_DEPS) +insdelln progs $(srcdir) $(HEADER_DEPS) $(srcdir)/popup_msg.h inserts progs $(srcdir) $(HEADER_DEPS) $(srcdir)/linedata.h key_names progs $(srcdir) $(HEADER_DEPS) keynames progs $(srcdir) $(HEADER_DEPS) knight progs $(srcdir) $(HEADER_DEPS) +list_keys progs $(srcdir) $(HEADER_DEPS) lrtest progs $(srcdir) $(HEADER_DEPS) -movewindow progs $(srcdir) $(HEADER_DEPS) +movewindow progs $(srcdir) $(HEADER_DEPS) $(srcdir)/popup_msg.h ncurses progs $(srcdir) $(HEADER_DEPS) ../include/panel.h ../include/menu.h ../include/form.h newdemo progs $(srcdir) $(HEADER_DEPS) +padview progs $(srcdir) $(HEADER_DEPS) $(srcdir)/widechars.h $(srcdir)/popup_msg.h +pair_content progs $(srcdir) $(HEADER_DEPS) +picsmap progs $(srcdir) $(HEADER_DEPS) +popup_msg progs $(srcdir) $(HEADER_DEPS) $(srcdir)/popup_msg.h railroad progs $(srcdir) $(HEADER_DEPS) -rain progs $(srcdir) $(HEADER_DEPS) -redraw progs $(srcdir) $(HEADER_DEPS) -savescreen progs $(srcdir) $(HEADER_DEPS) +rain progs $(srcdir) $(HEADER_DEPS) $(srcdir)/popup_msg.h +redraw progs $(srcdir) $(HEADER_DEPS) $(srcdir)/popup_msg.h +savescreen progs $(srcdir) $(HEADER_DEPS) $(srcdir)/popup_msg.h $(srcdir)/parse_rgb.h +sp_tinfo progs $(srcdir) $(HEADER_DEPS) tclock progs $(srcdir) $(HEADER_DEPS) test_add_wchstr progs $(srcdir) $(HEADER_DEPS) $(srcdir)/linedata.h test_addchstr progs $(srcdir) $(HEADER_DEPS) $(srcdir)/linedata.h @@ -88,12 +101,15 @@ test_getstr progs $(srcdir) $(HEADER_DEPS) test_instr progs $(srcdir) $(HEADER_DEPS) test_inwstr progs $(srcdir) $(HEADER_DEPS) test_opaque progs $(srcdir) $(HEADER_DEPS) +test_setupterm progs $(srcdir) $(HEADER_DEPS) +test_sgr progs $(srcdir) $(HEADER_DEPS) +test_termattrs progs $(srcdir) $(HEADER_DEPS) test_vid_puts progs $(srcdir) $(HEADER_DEPS) test_vidputs progs $(srcdir) $(HEADER_DEPS) testaddch progs $(srcdir) $(HEADER_DEPS) testcurs progs $(srcdir) $(HEADER_DEPS) testscanw progs $(srcdir) $(HEADER_DEPS) -view progs $(srcdir) $(HEADER_DEPS) $(srcdir)/widechars.h +view progs $(srcdir) $(HEADER_DEPS) $(srcdir)/widechars.h $(srcdir)/popup_msg.h worm progs $(srcdir) $(HEADER_DEPS) xmas progs $(srcdir) $(HEADER_DEPS) diff --git a/test/movewindow.c b/test/movewindow.c index 9effda41a4da..0ce107ca0355 100644 --- a/test/movewindow.c +++ b/test/movewindow.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2006-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 2006-2018,2019 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: movewindow.c,v 1.39 2013/05/04 19:41:02 tom Exp $ + * $Id: movewindow.c,v 1.50 2019/01/21 20:11:22 tom Exp $ * * Demonstrate move functions for windows and derived windows from the curses * library. @@ -45,13 +45,18 @@ TODO: */ #include -#include + +#if HAVE_MVDERWIN && HAVE_MVWIN + +#include #ifdef HAVE_XCURSES #undef derwin #endif -#ifdef NCURSES_VERSION +#if defined(NCURSES_CONST) +#define CONST_FMT NCURSES_CONST +#elif defined(PDCURSES) #define CONST_FMT const #else #define CONST_FMT /* nothing */ @@ -73,8 +78,8 @@ typedef struct { WINDOW *child; /* the actual value */ } FRAME; -static void head_line(CONST_FMT char *fmt,...) GCC_PRINTFLIKE(1, 2); -static void tail_line(CONST_FMT char *fmt,...) GCC_PRINTFLIKE(1, 2); +static void head_line(CONST_FMT char *fmt, ...) GCC_PRINTFLIKE(1, 2); +static void tail_line(CONST_FMT char *fmt, ...) GCC_PRINTFLIKE(1, 2); static unsigned num_windows; static FRAME *all_windows; @@ -102,6 +107,8 @@ message(int lineno, CONST_FMT char *fmt, va_list argp) vsprintf(buffer, fmt, argp); addstr(buffer); } +#elif defined(HAVE_VW_PRINTW) + vw_printw(stdscr, fmt, argp); #else vwprintw(stdscr, fmt, argp); #endif @@ -111,7 +118,7 @@ message(int lineno, CONST_FMT char *fmt, va_list argp) } static void -head_line(CONST_FMT char *fmt,...) +head_line(CONST_FMT char *fmt, ...) { va_list argp; @@ -121,7 +128,7 @@ head_line(CONST_FMT char *fmt,...) } static void -tail_line(CONST_FMT char *fmt,...) +tail_line(CONST_FMT char *fmt, ...) { va_list argp; @@ -190,6 +197,7 @@ selectcell(WINDOW *parent, moved = TRUE; break; case QUIT: + /* FALLTHRU */ case ESCAPE: return ((PAIR *) 0); #ifdef NCURSES_MOUSE_VERSION @@ -211,8 +219,8 @@ selectcell(WINDOW *parent, break; } } - /* FALLTHRU */ #endif + /* FALLTHRU */ default: res.y = uli + i; res.x = ulj + j; @@ -637,7 +645,7 @@ show_help(WINDOW *current) int key; CONST_FMT char * msg; } help[] = { - { '?', "Show this screen" }, + { HELP_KEY_1, "Show this screen" }, { 'b', "Draw a box inside the current window" }, { 'c', "Create a new window" }, { 'd', "Create a new derived window" }, @@ -654,20 +662,20 @@ show_help(WINDOW *current) }; /* *INDENT-ON* */ - WINDOW *mywin = newwin(LINES, COLS, 0, 0); - int row; + char **msgs = typeCalloc(char *, SIZEOF(help) + 1); + size_t n; - for (row = 0; row < LINES - 2 && row < (int) SIZEOF(help); ++row) { - wmove(mywin, row + 1, 1); - wprintw(mywin, "%s", keyname(help[row].key)); - wmove(mywin, row + 1, 20); - wprintw(mywin, "%s", help[row].msg); + for (n = 0; n < SIZEOF(help); ++n) { + size_t need = (21 + strlen(help[n].msg)); + msgs[n] = typeMalloc(char, need); + _nc_SPRINTF(msgs[n], _nc_SLIMIT(need) + "%-20s%s", keyname(help[n].key), help[n].msg); + } + popup_msg2(current, msgs); + for (n = 0; n < SIZEOF(help); ++n) { + free(msgs[n]); } - box_inside(mywin); - wmove(mywin, 1, 1); - wgetch(mywin); - delwin(mywin); - refresh_all(current); + free(msgs); } int @@ -695,7 +703,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) getyx(current_win, y, x); switch (ch) { - case '?': + case HELP_KEY_1: show_help(current_win); break; case 'b': @@ -762,5 +770,16 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) wmove(current_win, 0, 0); } endwin(); +#if NO_LEAKS + free(all_windows); +#endif ExitProgram(EXIT_SUCCESS); } +#else +int +main(void) +{ + printf("This program requires the curses mvderwin and mvwin functions\n"); + ExitProgram(EXIT_FAILURE); +} +#endif diff --git a/test/ncurses.c b/test/ncurses.c index 40d8ac465136..3959b56b2047 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * + * Copyright (c) 1998-2018,2019 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,7 +40,7 @@ AUTHOR Author: Eric S. Raymond 1993 Thomas E. Dickey (beginning revision 1.27 in 1996). -$Id: ncurses.c,v 1.397 2014/02/01 22:29:37 tom Exp $ +$Id: ncurses.c,v 1.521 2019/12/14 23:25:29 tom Exp $ ***************************************************************************/ @@ -77,7 +77,6 @@ $Id: ncurses.c,v 1.397 2014/02/01 22:29:37 tom Exp $ #ifdef TRACE static unsigned save_trace = TRACE_ORDINARY | TRACE_ICALLS | TRACE_CALLS; -extern unsigned _nc_tracing; #endif #else @@ -142,20 +141,20 @@ extern unsigned _nc_tracing; #define state_unused #endif -#define ToggleAcs(temp,real) temp = ((temp == real) ? 0 : real) +#define ToggleAcs(temp,real) temp = ((temp == real) ? NULL : real) #define P(string) printw("%s\n", string) #define BLANK ' ' /* this is the background character */ -#undef max_colors -static int max_colors; /* the actual number of colors we'll use */ -static int min_colors; /* the minimum color code */ -static bool use_colors; /* true if we use colors */ +static int MaxColors; /* the actual number of colors we'll use */ +static int MinColors; /* the minimum color code */ +static bool UseColors; /* true if we use colors */ #undef max_pairs static int max_pairs; /* ...and the number of color pairs */ +#if HAVE_COLOR_CONTENT typedef struct { NCURSES_COLOR_T red; NCURSES_COLOR_T green; @@ -163,8 +162,10 @@ typedef struct { } RGB_DATA; static RGB_DATA *all_colors; +#endif static void main_menu(bool); +static void failed(const char *s) GCC_NORETURN; static void failed(const char *s) @@ -174,35 +175,22 @@ failed(const char *s) ExitProgram(EXIT_FAILURE); } -/* The behavior of mvhline, mvvline for negative/zero length is unspecified, - * though we can rely on negative x/y values to stop the macro. - */ -static void -do_h_line(int y, int x, chtype c, int to) -{ - if ((to) > (x)) - MvHLine(y, x, c, (to) - (x)); -} - -static void -do_v_line(int y, int x, chtype c, int to) -{ - if ((to) > (y)) - MvVLine(y, x, c, (to) - (y)); -} - static void Repaint(void) { touchwin(stdscr); +#if HAVE_CURSCR touchwin(curscr); wrefresh(curscr); +#else + wrefresh(stdscr); +#endif } static bool -isQuit(int c) +isQuit(int c, bool escape) { - return ((c) == QUIT || (c) == ESCAPE); + return ((c) == QUIT || (escape && ((c) == ESCAPE))); } #define case_QUIT QUIT: case ESCAPE @@ -222,7 +210,7 @@ wGetchar(WINDOW *win) } else { _nc_tracing = save_trace; } - trace(_nc_tracing); + curses_trace(_nc_tracing); if (_nc_tracing) Trace(("TOGGLE-TRACING ON")); } @@ -233,11 +221,12 @@ wGetchar(WINDOW *win) } #define Getchar() wGetchar(stdscr) +#if USE_SOFTKEYS /* replaces wgetnstr(), since we want to be able to edit values */ static void wGetstring(WINDOW *win, char *buffer, int limit) { - int y0, x0, x, ch; + int y0, x0, x; bool done = FALSE; echo(); @@ -246,6 +235,7 @@ wGetstring(WINDOW *win, char *buffer, int limit) x = (int) strlen(buffer); while (!done) { + int ch; if (x > (int) strlen(buffer)) x = (int) strlen(buffer); wmove(win, y0, x0); @@ -300,12 +290,13 @@ wGetstring(WINDOW *win, char *buffer, int limit) wmove(win, y0, x0); noecho(); } +#endif #if USE_WIDEC_SUPPORT static wchar_t -fullwidth_of(int ch) +fullwidth_digit(int ch) { - return (ch + 0xff10 - '0'); + return (wchar_t) (ch + 0xff10 - '0'); } static void @@ -313,7 +304,7 @@ make_fullwidth_text(wchar_t *target, const char *source) { int ch; while ((ch = *source++) != 0) { - *target++ = fullwidth_of(ch); + *target++ = fullwidth_digit(ch); } *target = 0; } @@ -323,7 +314,7 @@ make_narrow_text(wchar_t *target, const char *source) { int ch; while ((ch = *source++) != 0) { - *target++ = ch; + *target++ = (wchar_t) ch; } *target = 0; } @@ -334,7 +325,7 @@ make_fullwidth_digit(cchar_t *target, int digit) { wchar_t source[2]; - source[0] = fullwidth_of(digit + '0'); + source[0] = fullwidth_digit(digit + '0'); source[1] = 0; setcchar(target, source, A_NORMAL, 0, 0); } @@ -353,7 +344,7 @@ wGet_wchar(WINDOW *win, wint_t *result) } else { _nc_tracing = save_trace; } - trace(_nc_tracing); + curses_trace(_nc_tracing); if (_nc_tracing) Trace(("TOGGLE-TRACING ON")); } @@ -365,6 +356,7 @@ wGet_wchar(WINDOW *win, wint_t *result) #define Get_wchar(result) wGet_wchar(stdscr, result) /* replaces wgetn_wstr(), since we want to be able to edit values */ +#if USE_SOFTKEYS static void wGet_wstring(WINDOW *win, wchar_t *buffer, int limit) { @@ -470,8 +462,9 @@ wGet_wstring(WINDOW *win, wchar_t *buffer, int limit) wmove(win, y0, x0); noecho(); } +#endif /* USE_SOFTKEYS */ -#endif +#endif /* USE_WIDEC_SUPPORT */ static void Pause(void) @@ -486,6 +479,7 @@ Cannot(const char *what) { printw("\nThis %s terminal %s\n\n", getenv("TERM"), what); Pause(); + endwin(); } static void @@ -495,7 +489,7 @@ ShellOut(bool message) addstr("Shelling out..."); def_prog_mode(); endwin(); -#ifdef __MINGW32__ +#ifdef _WIN32 system("cmd.exe"); #else IGNORE_RC(system("sh")); @@ -515,10 +509,15 @@ mouse_decode(MEVENT const *ep) { static char buf[80 + (5 * 10) + (32 * 15)]; - (void) sprintf(buf, "id %2d at (%2d, %2d, %d) state %4lx = {", - ep->id, ep->x, ep->y, ep->z, (unsigned long) ep->bstate); + (void) _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) + "id %2d at (%2d, %2d, %d) state %4lx = {", + ep->id, ep->x, ep->y, ep->z, (unsigned long) ep->bstate); -#define SHOW(m, s) if ((ep->bstate & m)==m) {strcat(buf,s); strcat(buf, ", ");} +#define SHOW(m, s) \ + if ((ep->bstate & m)==m) { \ + _nc_STRCAT(buf, s, sizeof(buf)); \ + _nc_STRCAT(buf, ", ", sizeof(buf)); \ + } SHOW(BUTTON1_RELEASED, "release-1"); SHOW(BUTTON1_PRESSED, "press-1"); @@ -574,14 +573,13 @@ mouse_decode(MEVENT const *ep) if (buf[strlen(buf) - 1] == ' ') buf[strlen(buf) - 2] = '\0'; - (void) strcat(buf, "}"); + _nc_STRCAT(buf, "}", sizeof(buf)); return (buf); } static void show_mouse(WINDOW *win) { - int y, x; MEVENT event; bool outside; bool show_loc; @@ -604,6 +602,7 @@ show_mouse(WINDOW *win) show_loc = wmouse_trafo(win, &event.y, &event.x, FALSE); if (show_loc) { + int y, x; getyx(win, y, x); wmove(win, event.y, event.x); waddch(win, '*'); @@ -636,15 +635,24 @@ setup_getch(WINDOW *win, GetchFlags flags) } static void -init_getch(WINDOW *win, GetchFlags flags) +init_getch(WINDOW *win, GetchFlags flags, int delay) { memset(flags, FALSE, NUM_GETCH_FLAGS); flags[UChar('k')] = (win == stdscr); flags[UChar('m')] = TRUE; + flags[UChar('t')] = (delay != 0); setup_getch(win, flags); } +static bool +blocking_getch(GetchFlags flags, int delay) +{ + return ((delay < 0) && flags['t']); +} + +#define ExitOnEscape() (flags[UChar('k')] && flags[UChar('t')]) + static void wgetch_help(WINDOW *win, GetchFlags flags) { @@ -655,7 +663,8 @@ wgetch_help(WINDOW *win, GetchFlags flags) ,"k -- toggle keypad/literal mode" ,"m -- toggle meta (7-bit/8-bit) mode" ,"^q -- quit" - ,"s -- shell out\n" + ,"s -- shell out" + ,"t -- toggle timeout" ,"w -- create a new window" #ifdef SIGTSTP ,"z -- suspend this process" @@ -670,13 +679,16 @@ wgetch_help(WINDOW *win, GetchFlags flags) printw("Type any key to see its %s value. Also:\n", flags['k'] ? "keypad" : "literal"); for (n = 0; n < SIZEOF(help); ++n) { + const char *msg = help[n]; int row = 1 + (int) (n % chk); int col = (n >= chk) ? COLS / 2 : 0; - int flg = ((strstr(help[n], "toggle") != 0) - && (flags[UChar(*help[n])] != FALSE)); + int flg = ((strstr(msg, "toggle") != 0) + && (flags[UChar(*msg)] != FALSE)); + if (*msg == '^' && ExitOnEscape()) + msg = "^[,^q -- quit"; if (flg) (void) standout(); - MvPrintw(row, col, "%s", help[n]); + MvPrintw(row, col, "%s", msg); if (col == 0) clrtoeol(); if (flg) @@ -807,12 +819,11 @@ wgetch_test(unsigned level, WINDOW *win, int delay) { char buf[BUFSIZ]; int first_y, first_x; - int c; int incount = 0; GetchFlags flags; - bool blocking = (delay < 0); - init_getch(win, flags); + init_getch(win, flags, delay); + notimeout(win, FALSE); wtimeout(win, delay); getyx(win, first_y, first_x); @@ -821,9 +832,11 @@ wgetch_test(unsigned level, WINDOW *win, int delay) scrollok(win, TRUE); for (;;) { + int c; + while ((c = wGetchar(win)) == ERR) { incount++; - if (blocking) { + if (blocking_getch(flags, delay)) { (void) wprintw(win, "%05d: input error", incount); break; } else { @@ -831,10 +844,10 @@ wgetch_test(unsigned level, WINDOW *win, int delay) } wgetch_wrap(win, first_y); } - if (c == ERR && blocking) { + if (c == ERR && blocking_getch(flags, delay)) { wprintw(win, "ERR"); wgetch_wrap(win, first_y); - } else if (isQuit(c)) { + } else if (isQuit(c, ExitOnEscape())) { break; } else if (c == 'e') { flags[UChar('e')] = !flags[UChar('e')]; @@ -860,6 +873,10 @@ wgetch_test(unsigned level, WINDOW *win, int delay) wgetch_help(win, flags); } else if (c == 's') { ShellOut(TRUE); + } else if (c == 't') { + notimeout(win, flags[UChar('t')]); + flags[UChar('t')] = !flags[UChar('t')]; + wgetch_help(win, flags); } else if (c == 'w') { int high = getmaxy(win) - 1 - first_y + 1; int wide = getmaxx(win) - first_x; @@ -931,7 +948,7 @@ wgetch_test(unsigned level, WINDOW *win, int delay) wtimeout(win, -1); if (!level) - init_getch(win, flags); + init_getch(win, flags, delay); } static int @@ -943,7 +960,7 @@ begin_getch_test(void) refresh(); #ifdef NCURSES_MOUSE_VERSION - mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0); + mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, (mmask_t *) 0); #endif (void) printw("Delay in 10ths of a second ( for blocking input)? "); @@ -958,7 +975,7 @@ begin_getch_test(void) delay = -1; } raw(); - move(5, 0); + move(6, 0); return delay; } @@ -974,8 +991,8 @@ finish_getch_test(void) endwin(); } -static void -getch_test(void) +static int +getch_test(bool recur GCC_UNUSED) { int delay = begin_getch_test(); @@ -984,6 +1001,7 @@ getch_test(void) forget_boxes(); finish_getch_test(); slk_clear(); + return OK; } #if USE_WIDEC_SUPPORT @@ -1060,11 +1078,10 @@ wget_wch_test(unsigned level, WINDOW *win, int delay) wint_t c; int incount = 0; GetchFlags flags; - bool blocking = (delay < 0); - int code; char *temp; - init_getch(win, flags); + init_getch(win, flags, delay); + notimeout(win, FALSE); wtimeout(win, delay); getyx(win, first_y, first_x); @@ -1073,9 +1090,11 @@ wget_wch_test(unsigned level, WINDOW *win, int delay) scrollok(win, TRUE); for (;;) { + int code; + while ((code = wGet_wchar(win, &c)) == ERR) { incount++; - if (blocking) { + if (blocking_getch(flags, delay)) { (void) wprintw(win, "%05d: input error", incount); break; } else { @@ -1083,10 +1102,10 @@ wget_wch_test(unsigned level, WINDOW *win, int delay) } wgetch_wrap(win, first_y); } - if (code == ERR && blocking) { + if (code == ERR && blocking_getch(flags, delay)) { wprintw(win, "ERR"); wgetch_wrap(win, first_y); - } else if (isQuit((int) c)) { + } else if (isQuit((int) c, ExitOnEscape())) { break; } else if (c == 'e') { flags[UChar('e')] = !flags[UChar('e')]; @@ -1125,6 +1144,10 @@ wget_wch_test(unsigned level, WINDOW *win, int delay) wgetch_help(win, flags); } else if (c == 's') { ShellOut(TRUE); + } else if (c == 't') { + notimeout(win, flags[UChar('t')]); + flags[UChar('t')] = !flags[UChar('t')]; + wgetch_help(win, flags); } else if (c == 'w') { int high = getmaxy(win) - 1 - first_y + 1; int wide = getmaxx(win) - first_x; @@ -1184,11 +1207,11 @@ wget_wch_test(unsigned level, WINDOW *win, int delay) wtimeout(win, -1); if (!level) - init_getch(win, flags); + init_getch(win, flags, delay); } -static void -get_wch_test(void) +static int +x_getch_test(bool recur GCC_UNUSED) { int delay = begin_getch_test(); @@ -1197,6 +1220,7 @@ get_wch_test(void) forget_boxes(); finish_getch_test(); slk_clear(); + return OK; } #endif @@ -1252,8 +1276,14 @@ my_termattrs(void) #define termattrs() my_termattrs() #endif -#define MAX_ATTRSTRING 31 -#define LEN_ATTRSTRING 26 +#define ATTRSTRING_1ST 32 /* ' ' */ +#define ATTRSTRING_END 126 /* '~' */ + +#define COLS_PRE_ATTRS 5 +#define COLS_AFT_ATTRS 15 +#define COL_ATTRSTRING (COLS_PRE_ATTRS + 17) +#define LEN_ATTRSTRING (COLS - (COL_ATTRSTRING + COLS_AFT_ATTRS)) +#define MAX_ATTRSTRING (ATTRSTRING_END + 1 - ATTRSTRING_1ST) static char attr_test_string[MAX_ATTRSTRING + 1]; @@ -1277,9 +1307,9 @@ attr_legend(WINDOW *helpwin) ++row; MvWPrintw(helpwin, row++, col, "Toggles:"); - if (use_colors) { + if (UseColors) { MvWPrintw(helpwin, row++, col, - " f/F/b/F toggle foreground/background background color"); + " f/F/b/B toggle foreground/background background color"); MvWPrintw(helpwin, row++, col, " t/T toggle text/background color attribute"); } @@ -1287,12 +1317,16 @@ attr_legend(WINDOW *helpwin) " a/A toggle ACS (alternate character set) mapping"); MvWPrintw(helpwin, row, col, " v/V toggle video attribute to combine with each line"); +#if USE_WIDEC_SUPPORT + MvWPrintw(helpwin, row, col, + " w/W toggle normal/wide (double-width) test-characters"); +#endif } static void show_color_attr(int fg, int bg, int tx) { - if (use_colors) { + if (UseColors) { printw(" Colors (fg %d, bg %d", fg, bg); if (tx >= 0) printw(", text %d", tx); @@ -1305,7 +1339,7 @@ cycle_color_attr(int ch, NCURSES_COLOR_T *fg, NCURSES_COLOR_T *bg, NCURSES_COLOR { bool error = FALSE; - if (use_colors) { + if (UseColors) { switch (ch) { case 'f': *fg = (NCURSES_COLOR_T) (*fg + 1); @@ -1331,12 +1365,12 @@ cycle_color_attr(int ch, NCURSES_COLOR_T *fg, NCURSES_COLOR_T *bg, NCURSES_COLOR break; } if (*fg >= COLORS) - *fg = (NCURSES_COLOR_T) min_colors; - if (*fg < min_colors) + *fg = (NCURSES_COLOR_T) MinColors; + if (*fg < MinColors) *fg = (NCURSES_COLOR_T) (COLORS - 1); if (*bg >= COLORS) - *bg = (NCURSES_COLOR_T) min_colors; - if (*bg < min_colors) + *bg = (NCURSES_COLOR_T) MinColors; + if (*bg < MinColors) *bg = (NCURSES_COLOR_T) (COLORS - 1); if (*tx >= COLORS) *tx = -1; @@ -1352,12 +1386,15 @@ cycle_color_attr(int ch, NCURSES_COLOR_T *fg, NCURSES_COLOR_T *bg, NCURSES_COLOR static void adjust_attr_string(int adjust) { - int first = ((int) UChar(attr_test_string[0])) + adjust; - int last = first + LEN_ATTRSTRING; + char save = attr_test_string[0]; + int first = ((int) UChar(save)) + adjust; - if (first >= ' ' && last <= '~') { /* 32..126 */ + if (first >= ATTRSTRING_1ST) { int j, k; - for (j = 0, k = first; j < MAX_ATTRSTRING && k <= last; ++j, ++k) { + + for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) { + if (k > ATTRSTRING_END) + break; attr_test_string[j] = (char) k; if (((k + 1 - first) % 5) == 0) { if (++j >= MAX_ATTRSTRING) @@ -1365,31 +1402,48 @@ adjust_attr_string(int adjust) attr_test_string[j] = ' '; } } - while (j < MAX_ATTRSTRING) - attr_test_string[j++] = ' '; - attr_test_string[j] = '\0'; - } else { - beep(); + if ((LEN_ATTRSTRING - j) > 5) { + attr_test_string[0] = save; + adjust_attr_string(adjust - 1); + } else { + while (j < MAX_ATTRSTRING) + attr_test_string[j++] = ' '; + attr_test_string[j] = '\0'; + } } } +/* + * Prefer the right-end of the string for starting, since that maps to the + * VT100 line-drawing. + */ +static int +default_attr_string(void) +{ + int result = (ATTRSTRING_END - LEN_ATTRSTRING); + result += (LEN_ATTRSTRING / 5); + if (result < ATTRSTRING_1ST) + result = ATTRSTRING_1ST; + return result; +} + static void init_attr_string(void) { - attr_test_string[0] = 'a'; + attr_test_string[0] = (char) default_attr_string(); adjust_attr_string(0); } static int -show_attr(int row, int skip, bool arrow, chtype attr, const char *name) +show_attr(WINDOW *win, int row, int skip, bool arrow, chtype attr, const char *name) { int ncv = get_ncv(); - chtype test = attr & (chtype) (~A_ALTCHARSET); + chtype test = attr & (chtype) (~(A_ALTCHARSET | A_CHARTEXT)); if (arrow) - MvPrintw(row, 5, "-->"); - MvPrintw(row, 8, "%s mode:", name); - MvPrintw(row, 24, "|"); + MvPrintw(row, COLS_PRE_ATTRS - 3, "-->"); + MvPrintw(row, COLS_PRE_ATTRS, "%s mode:", name); + MvPrintw(row, COL_ATTRSTRING - 1, "|"); if (skip) printw("%*s", skip, " "); /* @@ -1397,22 +1451,23 @@ show_attr(int row, int skip, bool arrow, chtype attr, const char *name) * character at a time (to pass its rendition directly), and use the * string operation for the other attributes. */ + wmove(win, 0, 0); + werase(win); if (attr & A_ALTCHARSET) { const char *s; - chtype ch; for (s = attr_test_string; *s != '\0'; ++s) { - ch = UChar(*s); - addch(ch | attr); + chtype ch = UChar(*s); + (void) waddch(win, ch | attr); } } else { - (void) attrset(attr); - addstr(attr_test_string); - attroff(attr); + (void) wattrset(win, AttrArg(attr, 0)); + (void) waddstr(win, attr_test_string); + (void) wattroff(win, (int) attr); } if (skip) printw("%*s", skip, " "); - printw("|"); + MvPrintw(row, COL_ATTRSTRING + LEN_ATTRSTRING, "|"); if (test != A_NORMAL) { if (!(termattrs() & test)) { printw(" (N/A)"); @@ -1447,15 +1502,16 @@ show_attr(int row, int skip, bool arrow, chtype attr, const char *name) if (found) printw(" (NCV)"); } - if ((termattrs() & test) != test) + if ((termattrs() & test) != test) { printw(" (Part)"); + } } } return row + 2; } typedef struct { - attr_t attr; + chtype attr; NCURSES_CONST char *name; } ATTR_TBL; /* *INDENT-OFF* */ @@ -1492,6 +1548,46 @@ init_attr_list(ATTR_TBL * target, attr_t attrs) return result; } +#if USE_WIDEC_SUPPORT +typedef struct { + attr_t attr; + NCURSES_CONST char *name; +} W_ATTR_TBL; +/* *INDENT-OFF* */ +static const W_ATTR_TBL w_attrs_to_test[] = { + { WA_STANDOUT, "STANDOUT" }, + { WA_REVERSE, "REVERSE" }, + { WA_BOLD, "BOLD" }, + { WA_UNDERLINE, "UNDERLINE" }, + { WA_DIM, "DIM" }, + { WA_BLINK, "BLINK" }, + { WA_PROTECT, "PROTECT" }, +#ifdef WA_INVIS + { WA_INVIS, "INVISIBLE" }, +#endif +#ifdef WA_ITALIC + { WA_ITALIC, "ITALIC" }, +#endif + { WA_NORMAL, "NORMAL" }, +}; +/* *INDENT-ON* */ + +static unsigned +init_w_attr_list(W_ATTR_TBL * target, attr_t attrs) +{ + unsigned result = 0; + size_t n; + + for (n = 0; n < SIZEOF(w_attrs_to_test); ++n) { + attr_t test = w_attrs_to_test[n].attr; + if (test == WA_NORMAL || (test & attrs) != 0) { + target[result++] = w_attrs_to_test[n]; + } + } + return result; +} +#endif + static bool attr_getc(int *skip, NCURSES_COLOR_T *fg, @@ -1516,7 +1612,7 @@ attr_getc(int *skip, case CTRL('L'): Repaint(); break; - case '?': + case HELP_KEY_1: if ((helpwin = newwin(LINES - 1, COLS - 2, 0, 0)) != 0) { box(helpwin, 0, 0); attr_legend(helpwin); @@ -1559,8 +1655,8 @@ attr_getc(int *skip, return result; } -static void -attr_test(void) +static int +attr_test(bool recur GCC_UNUSED) /* test text attributes */ { int n; @@ -1569,11 +1665,20 @@ attr_test(void) NCURSES_COLOR_T bg = COLOR_BLACK; NCURSES_COLOR_T tx = -1; int ac = 0; - unsigned j, k; + WINDOW *my_wins[SIZEOF(attrs_to_test)]; ATTR_TBL my_list[SIZEOF(attrs_to_test)]; unsigned my_size = init_attr_list(my_list, termattrs()); if (my_size > 1) { + unsigned j, k; + + for (j = 0; j < my_size; ++j) { + my_wins[j] = subwin(stdscr, + 1, LEN_ATTRSTRING, + 2 + (int) (2 * j), COL_ATTRSTRING); + scrollok(my_wins[j], FALSE); + } + if (skip < 0) skip = 0; @@ -1586,7 +1691,7 @@ attr_test(void) chtype normal = A_NORMAL | BLANK; chtype extras = (chtype) ac; - if (use_colors) { + if (UseColors) { NCURSES_PAIRS_T pair = 0; if ((fg != COLOR_BLACK) || (bg != COLOR_BLACK)) { pair = 1; @@ -1602,6 +1707,7 @@ attr_test(void) beep(); } else { extras |= (chtype) COLOR_PAIR(pair); + normal &= ~A_COLOR; } } } @@ -1614,17 +1720,18 @@ attr_test(void) for (j = 0; j < my_size; ++j) { bool arrow = (j == k); - row = show_attr(row, n, arrow, + row = show_attr(my_wins[j], row, n, arrow, + normal | extras | my_list[j].attr | my_list[k].attr, my_list[j].name); } - MvPrintw(row, 8, + MvPrintw(row, COLS_PRE_ATTRS, "This terminal does %shave the magic-cookie glitch", get_xmc() > -1 ? "" : "not "); - MvPrintw(row + 1, 8, "Enter '?' for help."); + MvPrintw(row + 1, COLS_PRE_ATTRS, "Enter '?' for help."); show_color_attr(fg, bg, tx); printw(" ACS (%d)", ac != 0); @@ -1634,42 +1741,90 @@ attr_test(void) bkgdset(A_NORMAL | BLANK); erase(); endwin(); + return OK; } else { Cannot("does not support video attributes."); + return ERR; } } #if USE_WIDEC_SUPPORT +static bool use_fullwidth; static wchar_t wide_attr_test_string[MAX_ATTRSTRING + 1]; +#define FULL_LO 0xff00 +#define FULL_HI 0xff5e +#define HALF_LO 0x20 + +#define isFullWidth(ch) ((int)(ch) >= FULL_LO && (int)(ch) <= FULL_HI) +#define ToNormalWidth(ch) (wchar_t) (((int)(ch) - FULL_LO) + HALF_LO) +#define ToFullWidth(ch) (wchar_t) (((int)(ch) - HALF_LO) + FULL_LO) + +/* + * Returns an ASCII code in [32..126] + */ +static wchar_t +normal_wchar(int ch) +{ + wchar_t result = (wchar_t) ch; + if (isFullWidth(ch)) + result = ToNormalWidth(ch); + return result; +} + +/* + * Returns either an ASCII code in in [32..126] or full-width in + * [0xff00..0xff5e], according to use_fullwidth setting. + */ +static wchar_t +target_wchar(int ch) +{ + wchar_t result = (wchar_t) ch; + if (use_fullwidth) { + if (!isFullWidth(ch)) + result = ToFullWidth(ch); + } else { + if (isFullWidth(ch)) + result = ToNormalWidth(ch); + } + return result; +} + static void wide_adjust_attr_string(int adjust) { - int first = ((int) UChar(wide_attr_test_string[0])) + adjust; - int last = first + LEN_ATTRSTRING; + wchar_t save = wide_attr_test_string[0]; + int first = ((int) normal_wchar(save)) + adjust; - if (first >= ' ' && last <= '~') { /* 32..126 */ + if (first >= ATTRSTRING_1ST) { int j, k; - for (j = 0, k = first; j < MAX_ATTRSTRING && k <= last; ++j, ++k) { - wide_attr_test_string[j] = k; + + for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) { + if (k > ATTRSTRING_END) + break; + wide_attr_test_string[j] = target_wchar(k); if (((k + 1 - first) % 5) == 0) { if (++j >= MAX_ATTRSTRING) break; wide_attr_test_string[j] = ' '; } } - while (j < MAX_ATTRSTRING) - wide_attr_test_string[j++] = ' '; - wide_attr_test_string[j] = '\0'; - } else { - beep(); + if ((LEN_ATTRSTRING - j) > 5) { + wide_attr_test_string[0] = save; + wide_adjust_attr_string(adjust - 1); + } else { + while (j < MAX_ATTRSTRING) + wide_attr_test_string[j++] = ' '; + wide_attr_test_string[j] = '\0'; + } } } static void wide_init_attr_string(void) { - wide_attr_test_string[0] = 'a'; + use_fullwidth = FALSE; + wide_attr_test_string[0] = (wchar_t) default_attr_string(); wide_adjust_attr_string(0); } @@ -1689,14 +1844,15 @@ set_wide_background(NCURSES_PAIRS_T pair) static attr_t get_wide_background(void) { - attr_t result = A_NORMAL; + attr_t result = WA_NORMAL; attr_t attr; cchar_t ch; NCURSES_PAIRS_T pair; - wchar_t wch[10]; memset(&ch, 0, sizeof(ch)); if (getbkgrnd(&ch) != ERR) { + wchar_t wch[CCHARW_MAX]; + if (getcchar(&ch, wch, &attr, &pair, 0) != ERR) { result = attr; } @@ -1705,20 +1861,21 @@ get_wide_background(void) } static int -wide_show_attr(int row, +wide_show_attr(WINDOW *win, + int row, int skip, bool arrow, - chtype attr, + attr_t attr, NCURSES_PAIRS_T pair, const char *name) { int ncv = get_ncv(); - chtype test = attr & ~WA_ALTCHARSET; + attr_t test = attr & ~WA_ALTCHARSET; if (arrow) - MvPrintw(row, 5, "-->"); - MvPrintw(row, 8, "%s mode:", name); - MvPrintw(row, 24, "|"); + MvPrintw(row, COLS_PRE_ATTRS - 3, "-->"); + MvPrintw(row, COLS_PRE_ATTRS, "%s mode:", name); + MvPrintw(row, COL_ATTRSTRING - 1, "|"); if (skip) printw("%*s", skip, " "); @@ -1727,6 +1884,8 @@ wide_show_attr(int row, * character at a time (to pass its rendition directly), and use the * string operation for the other attributes. */ + wmove(win, 0, 0); + werase(win); if (attr & WA_ALTCHARSET) { const wchar_t *s; cchar_t ch; @@ -1736,20 +1895,20 @@ wide_show_attr(int row, fill[0] = *s; fill[1] = L'\0'; setcchar(&ch, fill, attr, pair, 0); - add_wch(&ch); + (void) wadd_wch(win, &ch); } } else { attr_t old_attr = 0; NCURSES_PAIRS_T old_pair = 0; - (void) (attr_get) (&old_attr, &old_pair, 0); - (void) attr_set(attr, pair, 0); - addwstr(wide_attr_test_string); - (void) attr_set(old_attr, old_pair, 0); + (void) (wattr_get) (win, &old_attr, &old_pair, 0); + (void) wattr_set(win, attr, pair, 0); + (void) waddwstr(win, wide_attr_test_string); + (void) wattr_set(win, old_attr, old_pair, 0); } if (skip) printw("%*s", skip, " "); - printw("|"); + MvPrintw(row, COL_ATTRSTRING + LEN_ATTRSTRING, "|"); if (test != A_NORMAL) { if (!(term_attrs() & test)) { printw(" (N/A)"); @@ -1779,8 +1938,9 @@ wide_show_attr(int row, if (found) printw(" (NCV)"); } - if ((term_attrs() & test) != test) + if ((term_attrs() & test) != test) { printw(" (Part)"); + } } } return row + 2; @@ -1807,7 +1967,7 @@ wide_attr_getc(int *skip, case CTRL('L'): Repaint(); break; - case '?': + case HELP_KEY_1: if ((helpwin = newwin(LINES - 1, COLS - 2, 0, 0)) != 0) { box_set(helpwin, 0, 0); attr_legend(helpwin); @@ -1832,6 +1992,14 @@ wide_attr_getc(int *skip, if (*kc >= limit) *kc = 0; break; + case 'w': + use_fullwidth = FALSE; + wide_adjust_attr_string(0); + break; + case 'W': + use_fullwidth = TRUE; + wide_adjust_attr_string(0); + break; case '<': wide_adjust_attr_string(-1); break; @@ -1850,8 +2018,8 @@ wide_attr_getc(int *skip, return result; } -static void -wide_attr_test(void) +static int +x_attr_test(bool recur GCC_UNUSED) /* test text attributes using wide-character calls */ { int n; @@ -1860,11 +2028,20 @@ wide_attr_test(void) NCURSES_COLOR_T bg = COLOR_BLACK; NCURSES_COLOR_T tx = -1; int ac = 0; - unsigned j, k; - ATTR_TBL my_list[SIZEOF(attrs_to_test)]; - unsigned my_size = init_attr_list(my_list, term_attrs()); + W_ATTR_TBL my_list[SIZEOF(w_attrs_to_test)]; + WINDOW *my_wins[SIZEOF(w_attrs_to_test)]; + unsigned my_size = init_w_attr_list(my_list, term_attrs()); if (my_size > 1) { + unsigned j, k; + + for (j = 0; j < my_size; ++j) { + my_wins[j] = subwin(stdscr, + 1, LEN_ATTRSTRING, + 2 + (int) (2 * j), COL_ATTRSTRING); + scrollok(my_wins[j], FALSE); + } + if (skip < 0) skip = 0; @@ -1877,7 +2054,7 @@ wide_attr_test(void) NCURSES_PAIRS_T pair = 0; NCURSES_PAIRS_T extras = 0; - if (use_colors) { + if (UseColors) { pair = (NCURSES_PAIRS_T) (fg != COLOR_BLACK || bg != COLOR_BLACK); if (pair != 0) { pair = 1; @@ -1900,7 +2077,7 @@ wide_attr_test(void) MvAddStr(0, 20, "Character attribute test display"); for (j = 0; j < my_size; ++j) { - row = wide_show_attr(row, n, j == k, + row = wide_show_attr(my_wins[j], row, n, (j == k), ((attr_t) ac | my_list[j].attr | my_list[k].attr), @@ -1908,10 +2085,10 @@ wide_attr_test(void) my_list[j].name); } - MvPrintw(row, 8, + MvPrintw(row, COLS_PRE_ATTRS, "This terminal does %shave the magic-cookie glitch", get_xmc() > -1 ? "" : "not "); - MvPrintw(row + 1, 8, "Enter '?' for help."); + MvPrintw(row + 1, COLS_PRE_ATTRS, "Enter '?' for help."); show_color_attr(fg, bg, tx); printw(" ACS (%d)", ac != 0); @@ -1921,8 +2098,10 @@ wide_attr_test(void) set_wide_background(0); erase(); endwin(); + return OK; } else { Cannot("does not support extended video attributes."); + return ERR; } } #endif @@ -1954,21 +2133,32 @@ static NCURSES_CONST char *the_color_names[] = }; static void -show_color_name(int y, int x, int color, bool wide) +show_color_name(int y, int x, int color, bool wide, int zoom) { if (move(y, x) != ERR) { char temp[80]; int width = 8; - if (wide) { - sprintf(temp, "%02d", color); - width = 4; + if (wide || zoom) { + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "%02d", color); + if (wide) + width = 4; + if ((int) strlen(temp) >= width) { + int pwr2 = 0; + while ((1 << pwr2) < color) + ++pwr2; + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + width > 4 ? "2^%d" : "^%d", pwr2); + } } else if (color >= 8) { - sprintf(temp, "[%02d]", color); + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "[%02d]", color); } else if (color < 0) { - strcpy(temp, "default"); + _nc_STRCPY(temp, "default", sizeof(temp)); } else { - sprintf(temp, "%.*s", 16, the_color_names[color]); + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "%.*s", 16, the_color_names[color]); } printw("%-*.*s", width, width, temp); } @@ -1998,12 +2188,18 @@ color_legend(WINDOW *helpwin, bool wide) " a/A toggle altcharset off/on"); MvWPrintw(helpwin, row++, col, " b/B toggle bold off/on"); + if (has_colors()) { + MvWPrintw(helpwin, row++, col, + " c/C cycle used-colors through 8,16,...,COLORS"); + } MvWPrintw(helpwin, row++, col, " n/N toggle text/number on/off"); MvWPrintw(helpwin, row++, col, " r/R toggle reverse on/off"); MvWPrintw(helpwin, row++, col, - " w/W toggle width between 8/16 colors"); + " w/W switch width between 4/8 columns"); + MvWPrintw(helpwin, row++, col, + " z/Z zoom out (or in)"); #if USE_WIDEC_SUPPORT if (wide) { MvWPrintw(helpwin, row++, col, @@ -2018,19 +2214,50 @@ color_legend(WINDOW *helpwin, bool wide) #define set_color_test(name, value) if (name != value) { name = value; base_row = 0; } +static int +color_cycle(int current, int step) +{ + int result = current; + if (step < 0) { + if (current <= 8) { + result = COLORS; + } else { + result = 8; + if ((result * 2) > COLORS) { + result = COLORS; + } else { + while ((result * 2) < current) { + result *= 2; + } + } + } + } else { + if (current >= COLORS) { + result = 8; + } else { + result *= 2; + } + if (result > COLORS) + result = COLORS; + } + return result; +} + /* generate a color test pattern */ -static void -color_test(void) +static int +color_test(bool recur GCC_UNUSED) { NCURSES_PAIRS_T i; int top = 0, width; int base_row = 0; int grid_top = top + 3; int page_size = (LINES - grid_top); - int pairs_max = PAIR_NUMBER(A_COLOR) + 1; + int pairs_max; + int colors_max = COLORS; + int col_limit; int row_limit; int per_row; - char numbered[80]; + char *numbered = 0; const char *hello; bool done = FALSE; bool opt_acsc = FALSE; @@ -2038,38 +2265,64 @@ color_test(void) bool opt_revs = FALSE; bool opt_nums = FALSE; bool opt_wide = FALSE; + int opt_zoom = 0; WINDOW *helpwin; - if (COLORS * COLORS == COLOR_PAIRS) { - int limit = (COLORS - min_colors) * (COLORS - min_colors); - if (pairs_max > limit) - pairs_max = limit; - } else { - if (pairs_max > COLOR_PAIRS) - pairs_max = COLOR_PAIRS; + if (!UseColors) { + Cannot("does not support color."); + return ERR; } + numbered = typeCalloc(char, COLS + 1); + done = ((COLS < 16) || (numbered == 0)); + + /* + * Because the number of colors is usually a power of two, we also use + * a power of two for the number of colors shown per line (to be tidy). + */ + for (col_limit = 1; col_limit * 2 < COLS; col_limit *= 2) ; + + reloop: while (!done) { int shown = 0; + int zoom_size = (1 << opt_zoom); + int colors_max1 = colors_max / zoom_size; + double colors_max2 = (double) colors_max1 * (double) colors_max1; + + pairs_max = PAIR_NUMBER(A_COLOR) + 1; + if (colors_max2 <= COLOR_PAIRS) { + int limit = (colors_max1 - MinColors) * (colors_max1 - MinColors); + if (pairs_max > limit) + pairs_max = limit; + } + if (pairs_max > COLOR_PAIRS) + pairs_max = COLOR_PAIRS; + if (pairs_max < colors_max1) + pairs_max = colors_max1; /* this assumes an 80-column line */ if (opt_wide) { width = 4; hello = "Test"; - per_row = (COLORS > 8) ? 16 : 8; + per_row = (col_limit / ((colors_max1 > 8) ? width : 8)); } else { width = 8; hello = "Hello"; - per_row = 8; + per_row = (col_limit / width); } - per_row -= min_colors; + per_row -= MinColors; row_limit = (pairs_max + per_row - 1) / per_row; move(0, 0); - (void) printw("There are %d color pairs and %d colors%s\n", - pairs_max, COLORS, - min_colors ? " besides 'default'" : ""); + (void) printw("There are %d color pairs and %d colors", + pairs_max, COLORS); + if (colors_max1 != COLORS) + (void) printw(" (using %d colors)", colors_max1); + if (MinColors) + (void) addstr(" besides 'default'"); + if (opt_zoom) + (void) printw(" zoom:%d", opt_zoom); clrtobot(); MvPrintw(top + 1, 0, @@ -2079,8 +2332,13 @@ color_test(void) opt_bold ? "on" : "off"); /* show color names/numbers across the top */ - for (i = 0; i < per_row; i++) - show_color_name(top + 2, (i + 1) * width, i + min_colors, opt_wide); + for (i = 0; i < per_row; i++) { + show_color_name(top + 2, + (i + 1) * width, + (int) i * zoom_size + MinColors, + opt_wide, + opt_zoom); + } /* show a grid of colors, with color names/ numbers on the left */ for (i = (NCURSES_PAIRS_T) (base_row * per_row); i < pairs_max; i++) { @@ -2088,30 +2346,37 @@ color_test(void) int col = (i % per_row + 1) * width; NCURSES_PAIRS_T pair = i; -#define InxToFG(i) (NCURSES_COLOR_T) ((i % (COLORS - min_colors)) + min_colors) -#define InxToBG(i) (NCURSES_COLOR_T) ((i / (COLORS - min_colors)) + min_colors) + if ((i / per_row) > row_limit) + break; + +#define InxToFG(i) (int)((((unsigned long)(i) * (unsigned long)zoom_size) % (unsigned long)(colors_max1 - MinColors)) + (unsigned long)MinColors) +#define InxToBG(i) (int)((((unsigned long)(i) * (unsigned long)zoom_size) / (unsigned long)(colors_max1 - MinColors)) + (unsigned long)MinColors) if (row >= 0 && move(row, col) != ERR) { - NCURSES_COLOR_T fg = InxToFG(i); - NCURSES_COLOR_T bg = InxToBG(i); + NCURSES_COLOR_T fg = (NCURSES_COLOR_T) InxToFG(i); + NCURSES_COLOR_T bg = (NCURSES_COLOR_T) InxToBG(i); init_pair(pair, fg, bg); - attron((attr_t) COLOR_PAIR(pair)); + attron(COLOR_PAIR(pair)); if (opt_acsc) - attron((attr_t) A_ALTCHARSET); + attron(A_ALTCHARSET); if (opt_bold) - attron((attr_t) A_BOLD); + attron(A_BOLD); if (opt_revs) - attron((attr_t) A_REVERSE); + attron(A_REVERSE); if (opt_nums) { - sprintf(numbered, "{%02X}", (int) i); + _nc_SPRINTF(numbered, _nc_SLIMIT((size_t) (COLS + 1)) + "{%02X}", (int) i); hello = numbered; } printw("%-*.*s", width, width, hello); (void) attrset(A_NORMAL); - if ((i % per_row) == 0 && InxToFG(i) == min_colors) { - show_color_name(row, 0, InxToBG(i), opt_wide); + if ((i % per_row) == 0 && InxToFG(i) == MinColors) { + show_color_name(row, 0, + InxToBG(i), + opt_wide, + opt_zoom); } ++shown; } else if (shown) { @@ -2132,6 +2397,12 @@ color_test(void) case 'B': opt_bold = TRUE; break; + case 'c': + colors_max = color_cycle(colors_max, -1); + break; + case 'C': + colors_max = color_cycle(colors_max, 1); + break; case 'n': opt_nums = FALSE; break; @@ -2153,6 +2424,22 @@ color_test(void) case 'W': set_color_test(opt_wide, TRUE); break; + case 'z': + if (opt_zoom <= 0) { + beep(); + } else { + --opt_zoom; + goto reloop; + } + break; + case 'Z': + if ((1 << opt_zoom) >= colors_max) { + beep(); + } else { + ++opt_zoom; + goto reloop; + } + break; case CTRL('p'): case KEY_UP: if (base_row <= 0) { @@ -2192,7 +2479,7 @@ color_test(void) } } break; - case '?': + case HELP_KEY_1: if ((helpwin = newwin(LINES - 1, COLS - 2, 0, 0)) != 0) { box(helpwin, 0, 0); color_legend(helpwin, FALSE); @@ -2208,22 +2495,38 @@ color_test(void) erase(); endwin(); + + free(numbered); + return OK; } #if USE_WIDEC_SUPPORT + +#if USE_EXTENDED_COLOR +#define InitExtendedPair(p,f,g) init_extended_pair((p),(f),(g)) +#define ExtendedColorSet(p) color_set((NCURSES_PAIRS_T) (p), &(p)) +#define EXTENDED_PAIRS_T int +#else +#define InitExtendedPair(p,f,g) init_pair((NCURSES_PAIRS_T) (p),(NCURSES_COLOR_T)(f),(NCURSES_COLOR_T)(g)) +#define ExtendedColorSet(p) color_set((NCURSES_PAIRS_T) (p), NULL) +#define EXTENDED_PAIRS_T NCURSES_PAIRS_T +#endif + /* generate a color test pattern */ -static void -wide_color_test(void) +static int +x_color_test(bool recur GCC_UNUSED) { - int i; + long i; int top = 0, width; int base_row = 0; int grid_top = top + 3; int page_size = (LINES - grid_top); - int pairs_max = (unsigned short) (-1); + int pairs_max; + int colors_max = COLORS; + int col_limit; int row_limit; int per_row; - char numbered[80]; + char *numbered = 0; const char *hello; bool done = FALSE; bool opt_acsc = FALSE; @@ -2232,32 +2535,52 @@ wide_color_test(void) bool opt_wide = FALSE; bool opt_nums = FALSE; bool opt_xchr = FALSE; - wchar_t buffer[80]; + int opt_zoom = 0; + wchar_t *buffer = 0; WINDOW *helpwin; - if (COLORS * COLORS == COLOR_PAIRS) { - int limit = (COLORS - min_colors) * (COLORS - min_colors); - if (pairs_max > limit) - pairs_max = limit; - } else { - if (pairs_max > COLOR_PAIRS) - pairs_max = COLOR_PAIRS; + if (!UseColors) { + Cannot("does not support color."); + return ERR; } + numbered = typeCalloc(char, COLS + 1); + buffer = typeCalloc(wchar_t, COLS + 1); + done = ((COLS < 16) || (numbered == 0) || (buffer == 0)); + + /* + * Because the number of colors is usually a power of two, we also use + * a power of two for the number of colors shown per line (to be tidy). + */ + for (col_limit = 1; col_limit * 2 < COLS; col_limit *= 2) ; + reloop: while (!done) { int shown = 0; + int zoom_size = (1 << opt_zoom); + int colors_max1 = colors_max / zoom_size; + double colors_max2 = (double) colors_max1 * (double) colors_max1; + + pairs_max = ((unsigned) (-1)) / 2; + if (colors_max2 <= COLOR_PAIRS) { + int limit = (colors_max1 - MinColors) * (colors_max1 - MinColors); + if (pairs_max > limit) + pairs_max = limit; + } + if (pairs_max > COLOR_PAIRS) + pairs_max = COLOR_PAIRS; + if (pairs_max < colors_max1) + pairs_max = colors_max1; - /* this assumes an 80-column line */ if (opt_wide) { width = 4; hello = "Test"; - per_row = (COLORS > 8) ? 16 : 8; + per_row = (col_limit / ((colors_max1 > 8) ? width : 8)); } else { width = 8; hello = "Hello"; - per_row = 8; + per_row = (col_limit / width); } - per_row -= min_colors; + per_row -= MinColors; if (opt_xchr) { make_fullwidth_text(buffer, hello); @@ -2270,9 +2593,14 @@ wide_color_test(void) row_limit = (pairs_max + per_row - 1) / per_row; move(0, 0); - (void) printw("There are %d color pairs and %d colors%s\n", - pairs_max, COLORS, - min_colors ? " besides 'default'" : ""); + (void) printw("There are %d color pairs and %d colors", + pairs_max, COLORS); + if (colors_max1 != COLORS) + (void) printw(" (using %d colors)", colors_max1); + if (MinColors) + (void) addstr(" besides 'default'"); + if (opt_zoom) + (void) printw(" zoom:%d", opt_zoom); clrtobot(); MvPrintw(top + 1, 0, @@ -2282,27 +2610,37 @@ wide_color_test(void) opt_bold ? "on" : "off"); /* show color names/numbers across the top */ - for (i = 0; i < per_row; i++) - show_color_name(top + 2, (i + 1) * width, i + min_colors, opt_wide); + for (i = 0; i < per_row; i++) { + show_color_name(top + 2, + ((int) i + 1) * width, + (int) i * zoom_size + MinColors, + opt_wide, + opt_zoom); + } /* show a grid of colors, with color names/ numbers on the left */ for (i = (base_row * per_row); i < pairs_max; i++) { - int row = grid_top + (i / per_row) - base_row; - int col = (i % per_row + 1) * width; - NCURSES_PAIRS_T pair = (NCURSES_PAIRS_T) i; + int row = grid_top + ((int) i / per_row) - base_row; + int col = ((int) i % per_row + 1) * width; + int pair = (int) i; + + if ((i / per_row) > row_limit) + break; if (row >= 0 && move(row, col) != ERR) { - init_pair(pair, InxToFG(i), InxToBG(i)); - (void) color_set(pair, NULL); + InitExtendedPair(pair, InxToFG(i), InxToBG(i)); + (void) ExtendedColorSet(pair); if (opt_acsc) - attr_on((attr_t) A_ALTCHARSET, NULL); + attr_on(WA_ALTCHARSET, NULL); if (opt_bold) - attr_on((attr_t) A_BOLD, NULL); + attr_on(WA_BOLD, NULL); if (opt_revs) - attr_on((attr_t) A_REVERSE, NULL); + attr_on(WA_REVERSE, NULL); if (opt_nums) { - sprintf(numbered, "{%02X}", i); + _nc_SPRINTF(numbered, + _nc_SLIMIT((size_t) (COLS + 1) * sizeof(wchar_t)) + "{%02X}", (unsigned) i); if (opt_xchr) { make_fullwidth_text(buffer, numbered); } else { @@ -2312,8 +2650,11 @@ wide_color_test(void) addnwstr(buffer, width); (void) attr_set(A_NORMAL, 0, NULL); - if ((i % per_row) == 0 && InxToFG(i) == min_colors) { - show_color_name(row, 0, InxToBG(i), opt_wide); + if ((i % per_row) == 0 && InxToFG(i) == MinColors) { + show_color_name(row, 0, + InxToBG(i), + opt_wide, + opt_zoom); } ++shown; } else if (shown) { @@ -2334,6 +2675,12 @@ wide_color_test(void) case 'B': opt_bold = TRUE; break; + case 'c': + colors_max = color_cycle(colors_max, -1); + break; + case 'C': + colors_max = color_cycle(colors_max, 1); + break; case 'n': opt_nums = FALSE; break; @@ -2361,6 +2708,22 @@ wide_color_test(void) case 'X': opt_xchr = TRUE; break; + case 'z': + if (opt_zoom <= 0) { + beep(); + } else { + --opt_zoom; + goto reloop; + } + break; + case 'Z': + if ((1 << opt_zoom) >= colors_max) { + beep(); + } else { + ++opt_zoom; + goto reloop; + } + break; case CTRL('p'): case KEY_UP: if (base_row <= 0) { @@ -2400,7 +2763,7 @@ wide_color_test(void) } } break; - case '?': + case HELP_KEY_1: if ((helpwin = newwin(LINES - 1, COLS - 2, 0, 0)) != 0) { box(helpwin, 0, 0); color_legend(helpwin, TRUE); @@ -2416,9 +2779,14 @@ wide_color_test(void) erase(); endwin(); + + free(numbered); + free(buffer); + return OK; } #endif /* USE_WIDEC_SUPPORT */ +#if HAVE_COLOR_CONTENT static void change_color(NCURSES_PAIRS_T current, int field, int value, int usebase) { @@ -2443,7 +2811,7 @@ change_color(NCURSES_PAIRS_T current, int field, int value, int usebase) } static void -init_all_colors(void) +reset_all_colors(void) { NCURSES_PAIRS_T c; @@ -2454,23 +2822,122 @@ init_all_colors(void) all_colors[c].blue); } -#define scaled_rgb(n) ((255 * (n)) / 1000) +#define okCOLOR(n) ((n) >= 0 && (n) < MaxColors) +#define okRGB(n) ((n) >= 0 && (n) <= 1000) +#define DecodeRGB(n) (NCURSES_COLOR_T) ((n * 1000) / 0xffff) static void -color_edit(void) +init_all_colors(bool xterm_colors, char *palette_file) +{ + NCURSES_PAIRS_T cp; + all_colors = typeMalloc(RGB_DATA, (unsigned) MaxColors); + if (!all_colors) + failed("all_colors"); + for (cp = 0; cp < MaxColors; ++cp) { + color_content(cp, + &all_colors[cp].red, + &all_colors[cp].green, + &all_colors[cp].blue); + } + /* xterm and compatible terminals can read results of an OSC string + * asking for the current color palette. + */ + if (xterm_colors) { + int n; + char result[BUFSIZ]; + int check_n; + unsigned check_r, check_g, check_b; + + raw(); + noecho(); + + for (n = 0; n < MaxColors; ++n) { + int got; + + fprintf(stderr, "\033]4;%d;?\007", n); + got = (int) read(0, result, sizeof(result) - 1); + if (got < 0) + break; + result[got] = '\0'; + if (sscanf(result, "\033]4;%d;rgb:%x/%x/%x\007", + &check_n, + &check_r, + &check_g, + &check_b) == 4 && + check_n == n) { + all_colors[n].red = DecodeRGB(check_r); + all_colors[n].green = DecodeRGB(check_g); + all_colors[n].blue = DecodeRGB(check_b); + } else { + break; + } + } + reset_prog_mode(); + } + if (palette_file != 0) { + FILE *fp = fopen(palette_file, "r"); + if (fp != 0) { + char buffer[BUFSIZ]; + int red, green, blue; + int scale = 1000; + int c; + while (fgets(buffer, sizeof(buffer), fp) != 0) { + if (sscanf(buffer, "scale:%d", &c) == 1) { + scale = c; + } else if (sscanf(buffer, "%d:%d %d %d", + &c, + &red, + &green, + &blue) == 4 + && okCOLOR(c) + && okRGB(red) + && okRGB(green) + && okRGB(blue)) { +#define Scaled(n) (NCURSES_COLOR_T) (((n) * 1000) / scale) + all_colors[c].red = Scaled(red); + all_colors[c].green = Scaled(green); + all_colors[c].blue = Scaled(blue); + } + } + fclose(fp); + } + } +} + +#define scaled_rgb(n) ((255 * (n)) / 1000) + +static int +color_edit(bool recur GCC_UNUSED) /* display the color test pattern, without trying to edit colors */ { int i; - int current = 0; - int this_c = 0, value = 0, field = 0; + int current; + int this_c, value, field; int last_c; - int top_color = 0; - int page_size = (LINES - 6); + int top_color; + int page_size; + + if (!UseColors) { + Cannot("does not support color."); + return ERR; + } else if (!can_change_color()) { + Cannot("has hardwired color values."); + return ERR; + } - init_all_colors(); - refresh(); + reset_all_colors(); +#ifdef KEY_RESIZE + retry: +#endif + current = 0; + this_c = 0; + value = 0; + field = 0; + top_color = 0; + page_size = (LINES - 6); + erase(); - for (i = 0; i < max_colors; i++) + for (i = 0; i < MaxColors; i++) init_pair((NCURSES_PAIRS_T) i, (NCURSES_COLOR_T) COLOR_WHITE, (NCURSES_COLOR_T) i); @@ -2486,15 +2953,15 @@ color_edit(void) for (i = (NCURSES_COLOR_T) top_color; (i - top_color < page_size) - && (i < max_colors); i++) { + && (i < MaxColors); i++) { char numeric[80]; - sprintf(numeric, "[%d]", i); + _nc_SPRINTF(numeric, _nc_SLIMIT(sizeof(numeric)) "[%d]", i); MvPrintw(2 + i - top_color, 0, "%c %-8s:", (i == current ? '>' : ' '), (i < (int) SIZEOF(the_color_names) ? the_color_names[i] : numeric)); - (void) attrset((attr_t) COLOR_PAIR(i)); + (void) attrset(AttrArg(COLOR_PAIR(i), 0)); addstr(" "); (void) attrset(A_NORMAL); @@ -2537,6 +3004,21 @@ color_edit(void) value = 0; switch (this_c) { +#ifdef KEY_RESIZE + case KEY_RESIZE: + move(0, 0); + goto retry; +#endif + case '!': + ShellOut(FALSE); + /* FALLTHRU */ + case CTRL('r'): + endwin(); + refresh(); + break; + case CTRL('l'): + refresh(); + break; case CTRL('b'): case KEY_PPAGE: if (current > 0) @@ -2547,7 +3029,7 @@ color_edit(void) case CTRL('f'): case KEY_NPAGE: - if (current < (max_colors - 1)) + if (current < (MaxColors - 1)) current += (page_size - 1); else beep(); @@ -2555,18 +3037,20 @@ color_edit(void) case CTRL('p'): case KEY_UP: - current = (current == 0 ? (max_colors - 1) : current - 1); + current = (current == 0 ? (MaxColors - 1) : current - 1); break; case CTRL('n'): case KEY_DOWN: - current = (current == (max_colors - 1) ? 0 : current + 1); + current = (current == (MaxColors - 1) ? 0 : current + 1); break; + case '\t': case KEY_RIGHT: field = (field == 2 ? 0 : field + 1); break; + case KEY_BTAB: case KEY_LEFT: field = (field == 0 ? 2 : field - 1); break; @@ -2596,7 +3080,7 @@ color_edit(void) change_color((NCURSES_PAIRS_T) current, field, value, 0); break; - case '?': + case HELP_KEY_1: erase(); P(" RGB Value Editing Help"); P(""); @@ -2609,6 +3093,8 @@ color_edit(void) P("To increment or decrement a value, use the same procedure, but finish"); P("with a `+' or `-'."); P(""); + P("Use `!' to shell-out, ^R or ^L to repaint the screen."); + P(""); P("Press 'm' to invoke the top-level menu with the current color settings."); P("To quit, do ESC"); @@ -2619,7 +3105,7 @@ color_edit(void) case 'm': endwin(); main_menu(FALSE); - for (i = 0; i < max_colors; i++) + for (i = 0; i < MaxColors; i++) init_pair((NCURSES_PAIRS_T) i, (NCURSES_COLOR_T) COLOR_WHITE, (NCURSES_COLOR_T) i); @@ -2636,8 +3122,8 @@ color_edit(void) if (current < 0) current = 0; - if (current >= max_colors) - current = max_colors - 1; + if (current >= MaxColors) + current = MaxColors - 1; if (current < top_color) top_color = current; if (current - top_color >= page_size) @@ -2646,17 +3132,19 @@ color_edit(void) MvPrintw(LINES - 1, 0, "Number: %d", value); clrtoeol(); } while - (!isQuit(this_c)); + (!isQuit(this_c, TRUE)); erase(); /* * ncurses does not reset each color individually when calling endwin(). */ - init_all_colors(); + reset_all_colors(); endwin(); + return OK; } +#endif /* HAVE_COLOR_CONTENT */ /**************************************************************************** * @@ -2688,12 +3176,39 @@ cycle_attr(int ch, unsigned *at_code, chtype *attr, ATTR_TBL * list, unsigned li return result; } +#if USE_WIDEC_SUPPORT static bool -cycle_colors(int ch, int *fg, int *bg, NCURSES_PAIRS_T *pair) +cycle_w_attr(int ch, unsigned *at_code, attr_t *attr, W_ATTR_TBL * list, unsigned limit) +{ + bool result = TRUE; + + switch (ch) { + case 'v': + if ((*at_code += 1) >= limit) + *at_code = 0; + break; + case 'V': + if (*at_code == 0) + *at_code = limit - 1; + else + *at_code -= 1; + break; + default: + result = FALSE; + break; + } + if (result) + *attr = list[*at_code].attr; + return result; +} +#endif + +static bool +cycle_colors(int ch, int *fg, int *bg, NCURSES_PAIRS_T *pair) { bool result = FALSE; - if (use_colors) { + if (UseColors) { result = TRUE; switch (ch) { case 'F': @@ -2791,8 +3306,8 @@ call_slk_color(int fg, int bg) } #endif -static void -slk_test(void) +static int +slk_test(bool recur GCC_UNUSED) /* exercise the soft keys */ { int c, fmt = 1; @@ -2810,7 +3325,7 @@ slk_test(void) c = CTRL('l'); #if HAVE_SLK_COLOR - if (use_colors) { + if (UseColors) { call_slk_color(fg, bg); } #endif @@ -2838,7 +3353,7 @@ slk_test(void) case 's': MvPrintw(SLK_WORK, 0, "Press Q to stop the scrolling-test: "); while ((c = Getchar()) != 'Q' && (c != ERR)) - addch((chtype) c); + AddCh(c); break; case 'd': @@ -2866,9 +3381,9 @@ slk_test(void) case '7': case '8': MvAddStr(SLK_WORK, 0, "Please enter the label value: "); - strcpy(buf, ""); + _nc_STRCPY(buf, "", sizeof(buf)); if ((s = slk_label(c - '0')) != 0) { - strncpy(buf, s, (size_t) 8); + _nc_STRNCPY(buf, s, (size_t) 8); } wGetstring(stdscr, buf, 8); slk_set((c - '0'), buf, fmt); @@ -2895,7 +3410,7 @@ slk_test(void) } #if HAVE_SLK_COLOR if (cycle_colors(c, &fg, &bg, &pair)) { - if (use_colors) { + if (UseColors) { call_slk_color(fg, bg); } else { beep(); @@ -2906,33 +3421,34 @@ slk_test(void) beep(); break; } - } while (!isQuit(c = Getchar())); + } while (!isQuit(c = Getchar(), TRUE)); done: slk_clear(); erase(); endwin(); + return OK; } #if USE_WIDEC_SUPPORT #define SLKLEN 8 -static void -wide_slk_test(void) +static int +x_slk_test(bool recur GCC_UNUSED) /* exercise the soft keys */ { int c, fmt = 1; wchar_t buf[SLKLEN + 1]; char *s; - chtype attr = A_NORMAL; + attr_t attr = WA_NORMAL; unsigned at_code = 0; int fg = COLOR_BLACK; int bg = COLOR_WHITE; NCURSES_PAIRS_T pair = 0; - ATTR_TBL my_list[SIZEOF(attrs_to_test)]; - unsigned my_size = init_attr_list(my_list, term_attrs()); + W_ATTR_TBL my_list[SIZEOF(w_attrs_to_test)]; + unsigned my_size = init_w_attr_list(my_list, term_attrs()); c = CTRL('l'); - if (use_colors) { + if (UseColors) { call_slk_color(fg, bg); } do { @@ -2958,7 +3474,7 @@ wide_slk_test(void) case 's': MvPrintw(SLK_WORK, 0, "Press Q to stop the scrolling-test: "); while ((c = Getchar()) != 'Q' && (c != ERR)) - addch((chtype) c); + AddCh(c); break; case 'd': @@ -2991,14 +3507,15 @@ wide_slk_test(void) char *temp = strdup(s); size_t used = strlen(temp); size_t want = SLKLEN; - size_t test; #ifndef state_unused mbstate_t state; #endif buf[0] = L'\0'; while (want > 0 && used != 0) { + size_t test; const char *base = s; + reset_mbytes(state); test = count_mbytes(base, 0, &state); if (test == (size_t) -1) { @@ -3024,13 +3541,13 @@ wide_slk_test(void) goto done; case 'F': - if (use_colors) { + if (UseColors) { fg = (NCURSES_COLOR_T) ((fg + 1) % COLORS); call_slk_color(fg, bg); } break; case 'B': - if (use_colors) { + if (UseColors) { bg = (NCURSES_COLOR_T) ((bg + 1) % COLORS); call_slk_color(fg, bg); } @@ -3041,7 +3558,7 @@ wide_slk_test(void) break; #endif default: - if (cycle_attr(c, &at_code, &attr, my_list, my_size)) { + if (cycle_w_attr(c, &at_code, &attr, my_list, my_size)) { slk_attr_set(attr, (NCURSES_COLOR_T) (fg || bg), NULL); slk_touch(); slk_noutrefresh(); @@ -3049,7 +3566,7 @@ wide_slk_test(void) } #if HAVE_SLK_COLOR if (cycle_colors(c, &fg, &bg, &pair)) { - if (use_colors) { + if (UseColors) { call_slk_color(fg, bg); } else { beep(); @@ -3060,12 +3577,13 @@ wide_slk_test(void) beep(); break; } - } while (!isQuit(c = Getchar())); + } while (!isQuit(c = Getchar(), TRUE)); done: slk_clear(); erase(); endwin(); + return OK; } #endif #endif /* SLK_INIT */ @@ -3090,7 +3608,7 @@ show_256_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) int col = (int) (5 * (code % 16)); IGNORE_RC(mvaddch(row, col, colored_chtype(code, attr, pair))); for (count = 1; count < repeat; ++count) { - addch(colored_chtype(code, attr, pair)); + AddCh(colored_chtype(code, attr, pair)); } } @@ -3124,7 +3642,7 @@ show_upper_chars(int base, int pagesize, int repeat, attr_t attr, NCURSES_PAIRS_ int row = 2 + ((int) (code - first) % (pagesize / 2)); int col = ((int) (code - first) / (pagesize / 2)) * COLS / 2; char tmp[80]; - sprintf(tmp, "%3u (0x%x)", code, code); + _nc_SPRINTF(tmp, _nc_SLIMIT(sizeof(tmp)) "%3u (0x%x)", code, code); MvPrintw(row, col, "%*s: ", COLS / 4, tmp); do { @@ -3134,7 +3652,7 @@ show_upper_chars(int base, int pagesize, int repeat, attr_t attr, NCURSES_PAIRS_ if (C1) { /* (yes, this _is_ crude) */ while ((reply = Getchar()) != ERR) { - addch(UChar(reply)); + AddCh(UChar(reply)); napms(10); } nodelay(stdscr, FALSE); @@ -3179,7 +3697,7 @@ show_pc_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) */ break; default: - addch(colored_chtype(code, A_ALTCHARSET | attr, pair)); + AddCh(colored_chtype(code, A_ALTCHARSET | attr, pair)); break; } } while (--count > 0); @@ -3216,7 +3734,6 @@ show_box_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) MvAddCh(LINES / 2, 0, colored_chtype(ACS_LTEE, attr, pair)); MvAddCh(LINES / 2, COLS - 1, colored_chtype(ACS_RTEE, attr, pair)); /* *INDENT-ON* */ - } static int @@ -3228,7 +3745,7 @@ show_1_acs(int n, int repeat, const char *name, chtype code) MvPrintw(row, col, "%*s : ", COLS / 4, name); do { - addch(code); + AddCh(code); } while (--repeat > 0); return n + 1; } @@ -3290,10 +3807,11 @@ show_acs_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) n = show_1_acs(n, repeat, BOTH(ACS_S7)); (void) show_1_acs(n, repeat, BOTH(ACS_S9)); #endif +#undef BOTH } -static void -acs_display(void) +static int +acs_test(bool recur GCC_UNUSED) { int c = 'a'; int pagesize = 32; @@ -3389,7 +3907,7 @@ acs_display(void) MvPrintw(LINES - 2, 0, "Select: a=ACS, w=all x=box, %s0=C1, 1-3,+/- non-ASCII, repeat, ESC=quit", pch_kludge); - if (use_colors) { + if (UseColors) { MvPrintw(LINES - 1, 0, "v/V, f/F, b/B cycle through video attributes (%s) and color %d/%d.", my_list[at_code].name, @@ -3400,26 +3918,26 @@ acs_display(void) my_list[at_code].name); } refresh(); - } while (!isQuit(c = Getchar())); + } while (!isQuit(c = Getchar(), TRUE)); Pause(); erase(); endwin(); + return OK; } #if USE_WIDEC_SUPPORT static cchar_t * merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, NCURSES_PAIRS_T pair) { - int count; *dst = *src; do { + int count; TEST_CCHAR(src, count, { attr |= (test_attrs & A_ALTCHARSET); setcchar(dst, test_wch, attr, pair, NULL); - } - , { + }, { ; }); } while (0); @@ -3433,15 +3951,15 @@ merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, NCURSES_PAIRS_T p * into account, use 256 characters for the page. */ static void -show_paged_widechars(int base, - int pagesize, +show_paged_widechars(unsigned base, + unsigned pagesize, int repeat, int space, attr_t attr, NCURSES_PAIRS_T pair) { - int first = base * pagesize; - int last = first + pagesize - 1; + unsigned first = base * pagesize; + unsigned last = first + pagesize - 1; int per_line = 16; cchar_t temp; wchar_t code; @@ -3452,8 +3970,8 @@ show_paged_widechars(int base, MvPrintw(0, 20, "Display of Character Codes %#x to %#x", first, last); attroff(A_BOLD); - for (code = first; (int) code <= last; code++) { - int row = (2 + ((int) code - first) / per_line); + for (code = (wchar_t) first; code <= (wchar_t) last; code++) { + int row = (2 + (int) (code - (wchar_t) first) / per_line); int col = 5 * ((int) code % per_line); int count; @@ -3462,7 +3980,7 @@ show_paged_widechars(int base, setcchar(&temp, codes, attr, pair, 0); move(row, col); if (wcwidth(code) == 0 && code != 0) { - addch((chtype) space | + AddCh((chtype) space | (A_REVERSE ^ attr) | (attr_t) COLOR_PAIR(pair)); } @@ -3474,26 +3992,26 @@ show_paged_widechars(int base, } static void -show_upper_widechars(int first, int repeat, int space, attr_t attr, NCURSES_PAIRS_T pair) +show_upper_widechars(unsigned first, int repeat, int space, attr_t attr, NCURSES_PAIRS_T pair) { cchar_t temp; wchar_t code; - int last = first + 31; + unsigned last = first + 31; erase(); attron(A_BOLD); MvPrintw(0, 20, "Display of Character Codes %d to %d", first, last); attroff(A_BOLD); - for (code = first; (int) code <= last; code++) { - int row = 2 + ((code - first) % 16); - int col = ((code - first) / 16) * COLS / 2; + for (code = (wchar_t) first; code <= (wchar_t) last; code++) { + int row = 2 + ((int) (code - (wchar_t) first) % 16); + int col = ((int) (code - (wchar_t) first) / 16) * COLS / 2; wchar_t codes[10]; char tmp[80]; int count = repeat; - int y, x; - sprintf(tmp, "%3ld (0x%lx)", (long) code, (long) code); + _nc_SPRINTF(tmp, _nc_SLIMIT(sizeof(tmp)) + "%3ld (0x%lx)", (long) code, (long) code); MvPrintw(row, col, "%*s: ", COLS / 4, tmp); memset(&codes, 0, sizeof(codes)); @@ -3501,6 +4019,8 @@ show_upper_widechars(int first, int repeat, int space, attr_t attr, NCURSES_PAIR setcchar(&temp, codes, attr, pair, 0); do { + int y, x; + /* * Give non-spacing characters something to combine with. If we * don't, they'll bunch up in a heap on the space after the ":". @@ -3508,7 +4028,7 @@ show_upper_widechars(int first, int repeat, int space, attr_t attr, NCURSES_PAIR * the display. */ if (wcwidth(code) == 0) { - addch((chtype) space | + AddCh((chtype) space | (A_REVERSE ^ attr) | (attr_t) COLOR_PAIR(pair)); } @@ -3649,7 +4169,7 @@ show_wacs_chars_double(int repeat, attr_t attr, NCURSES_PAIRS_T pair) n = show_1_wacs(n, repeat, BOTH2(WACS_DEGREE)); n = show_1_wacs(n, repeat, BOTH2(WACS_DIAMOND)); n = show_1_wacs(n, repeat, BOTH2(WACS_PLMINUS)); - n = show_1_wacs(n, repeat, BOTH2(WACS_PLUS)); + n = show_1_wacs(n, repeat, BOTH2(WACS_D_PLUS)); #ifdef CURSES_WACS_ARRAY n = show_1_wacs(n, repeat, BOTH2(WACS_GEQUAL)); @@ -3710,7 +4230,7 @@ show_wacs_chars_thick(int repeat, attr_t attr, NCURSES_PAIRS_T pair) n = show_1_wacs(n, repeat, BOTH2(WACS_DEGREE)); n = show_1_wacs(n, repeat, BOTH2(WACS_DIAMOND)); n = show_1_wacs(n, repeat, BOTH2(WACS_PLMINUS)); - n = show_1_wacs(n, repeat, BOTH2(WACS_PLUS)); + n = show_1_wacs(n, repeat, BOTH2(WACS_T_PLUS)); #ifdef CURSES_WACS_ARRAY n = show_1_wacs(n, repeat, BOTH2(WACS_GEQUAL)); @@ -3761,7 +4281,6 @@ show_wbox_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) (void) mvadd_wch(LINES / 2, 0, MERGE_ATTR(0, WACS_LTEE)); (void) mvadd_wch(LINES / 2, COLS - 1, MERGE_ATTR(0, WACS_RTEE)); /* *INDENT-ON* */ - } #undef MERGE_ATTR @@ -3776,7 +4295,8 @@ show_2_wacs(int n, const char *name, const char *code, attr_t attr, NCURSES_PAIR MvPrintw(row, col, "%*s : ", COLS / 4, name); (void) attr_set(attr, pair, 0); - addstr(strncpy(temp, code, 20)); + _nc_STRNCPY(temp, code, 20); + addstr(temp); (void) attr_set(A_NORMAL, 0, 0); return n + 1; } @@ -3833,27 +4353,29 @@ show_utf8_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) n = SHOW_UTF8(n, "WACS_S7", "\342\216\274"); (void) SHOW_UTF8(n, "WACS_S9", "\342\216\275"); /* *INDENT-ON* */ - } /* display the wide-ACS character set */ -static void -wide_acs_display(void) +static int +x_acs_test(bool recur GCC_UNUSED) { int c = 'a'; - int digit = 0; + unsigned digit = 0; int repeat = 1; int space = ' '; - int pagesize = 32; - chtype attr = A_NORMAL; + unsigned pagesize = 32; + attr_t attr = WA_NORMAL; int fg = COLOR_BLACK; int bg = COLOR_BLACK; unsigned at_code = 0; NCURSES_PAIRS_T pair = 0; void (*last_show_wacs) (int, attr_t, NCURSES_PAIRS_T) = 0; - ATTR_TBL my_list[SIZEOF(attrs_to_test)]; - unsigned my_size = init_attr_list(my_list, term_attrs()); + W_ATTR_TBL my_list[SIZEOF(w_attrs_to_test)]; + unsigned my_size = init_w_attr_list(my_list, term_attrs()); + char at_page[20]; + bool pending_code = FALSE; + at_page[0] = '\0'; do { switch (c) { case CTRL('L'): @@ -3885,15 +4407,40 @@ wide_acs_display(void) case 'u': ToggleAcs(last_show_wacs, show_utf8_chars); break; + case '@': + pending_code = !pending_code; + if (pending_code) { + _nc_SPRINTF(at_page, _nc_SLIMIT(sizeof(at_page)) "%02x", digit); + } else if (at_page[0] != '\0') { + _nc_SPRINTF(at_page, _nc_SLIMIT(sizeof(at_page)) "%x", digit); + } + break; default: - if (c < 256 && isdigit(c)) { - digit = (c - '0'); + if (pending_code && isxdigit(c)) { + size_t len = strlen(at_page); + if (len && at_page[0] == '0') { + memmove(at_page, at_page + 1, len--); + } + if (len < sizeof(at_page) - 1) { + at_page[len++] = (char) c; + at_page[len] = '\0'; + } + } else if (pending_code + && (c == '\b' || c == KEY_BACKSPACE || c == KEY_DC)) { + size_t len = strlen(at_page); + if (len) + at_page[--len] = '\0'; + } else if (c < 256 && isdigit(c)) { + digit = (unsigned) (c - '0'); last_show_wacs = 0; } else if (c == '+') { ++digit; + _nc_SPRINTF(at_page, _nc_SLIMIT(sizeof(at_page)) "%02x", digit); last_show_wacs = 0; } else if (c == '-' && digit > 0) { --digit; + _nc_SPRINTF(at_page, _nc_SLIMIT(sizeof(at_page)) "%02x", + UChar(digit)); last_show_wacs = 0; } else if (c == '>' && repeat < (COLS / 4)) { ++repeat; @@ -3902,7 +4449,7 @@ wide_acs_display(void) } else if (c == '_') { space = (space == ' ') ? '_' : ' '; last_show_wacs = 0; - } else if (cycle_attr(c, &at_code, &attr, my_list, my_size) + } else if (cycle_w_attr(c, &at_code, &attr, my_list, my_size) || cycle_colors(c, &fg, &bg, &pair)) { if (last_show_wacs != 0) break; @@ -3921,10 +4468,14 @@ wide_acs_display(void) } MvPrintw(LINES - 4, 0, - "Select: a/d/t WACS, w=all x=box, u UTF-8, ^L repaint"); + "Select: a/d/t WACS, w=%d/page, @", + pagesize); + printw("%s", + pending_code ? at_page : "page"); + addstr(", x=box, u UTF-8, ^L repaint"); MvPrintw(LINES - 3, 2, "0-9,+/- non-ASCII, repeat, _ space, ESC=quit"); - if (use_colors) { + if (UseColors) { MvPrintw(LINES - 2, 2, "v/V, f/F, b/B cycle through video attributes (%s) and color %d/%d.", my_list[at_code].name, @@ -3935,11 +4486,12 @@ wide_acs_display(void) my_list[at_code].name); } refresh(); - } while (!isQuit(c = Getchar())); + } while (!isQuit(c = Getchar(), TRUE)); Pause(); erase(); endwin(); + return OK; } #endif @@ -3947,8 +4499,8 @@ wide_acs_display(void) /* * Graphic-rendition test (adapted from vttest) */ -static void -test_sgr_attributes(void) +static int +sgr_attr_test(bool recur GCC_UNUSED) { int pass; @@ -3956,7 +4508,7 @@ test_sgr_attributes(void) chtype normal = ((pass == 0 ? A_NORMAL : A_REVERSE)) | BLANK; /* Use non-default colors if possible to exercise bce a little */ - if (use_colors) { + if (UseColors) { init_pair(1, COLOR_WHITE, COLOR_BLUE); normal |= (chtype) COLOR_PAIR(1); } @@ -4022,6 +4574,7 @@ test_sgr_attributes(void) bkgdset(A_NORMAL | BLANK); erase(); endwin(); + return OK; } /**************************************************************************** @@ -4045,13 +4598,10 @@ FRAME WINDOW *wind; }; -#if defined(NCURSES_VERSION) -#if (NCURSES_VERSION_PATCH < 20070331) && NCURSES_EXT_FUNCS +#if defined(NCURSES_VERSION) && NCURSES_EXT_FUNCS +#if (NCURSES_VERSION_PATCH < 20070331) #define is_keypad(win) (win)->_use_keypad #define is_scrollok(win) (win)->_scroll -#elif !defined(is_keypad) -#define is_keypad(win) FALSE -#define is_scrollok(win) FALSE #endif #else #define is_keypad(win) FALSE @@ -4087,66 +4637,51 @@ HaveScroll(FRAME * curp) static void newwin_legend(FRAME * curp) { +#define DATA(num, name) { name, num } static const struct { const char *msg; int code; } legend[] = { - { - "^C = create window", 0 - }, - { - "^N = next window", 0 - }, - { - "^P = previous window", 0 - }, - { - "^F = scroll forward", 0 - }, - { - "^B = scroll backward", 0 - }, - { - "^K = keypad(%s)", 1 - }, - { - "^S = scrollok(%s)", 2 - }, - { - "^W = save window to file", 0 - }, - { - "^R = restore window", 0 - }, + DATA(0, "^C = create window"), + DATA(0, "^N = next window"), + DATA(0, "^P = previous window"), + DATA(0, "^F = scroll forward"), + DATA(0, "^B = scroll backward"), + DATA(1, "^K = keypad(%s)"), + DATA(2, "^S = scrollok(%s)"), + DATA(0, "^W = save window"), + DATA(0, "^R = restore window"), #if HAVE_WRESIZE - { - "^X = resize", 0 - }, + DATA(0, "^X = resize"), #endif - { - "^Q%s = exit", 3 - } + DATA(3, "^Q%s = exit") }; +#undef DATA size_t n; - int x; bool do_keypad = HaveKeypad(curp); bool do_scroll = HaveScroll(curp); char buf[BUFSIZ]; move(LINES - 4, 0); + for (n = 0; n < SIZEOF(legend); n++) { + int x; + switch (legend[n].code) { default: - strcpy(buf, legend[n].msg); + _nc_STRCPY(buf, legend[n].msg, sizeof(buf)); break; case 1: - sprintf(buf, legend[n].msg, do_keypad ? "yes" : "no"); + _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) + legend[n].msg, do_keypad ? "yes" : "no"); break; case 2: - sprintf(buf, legend[n].msg, do_scroll ? "yes" : "no"); + _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) + legend[n].msg, do_scroll ? "yes" : "no"); break; case 3: - sprintf(buf, legend[n].msg, do_keypad ? "/ESC" : ""); + _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) + legend[n].msg, do_keypad ? "/ESC" : ""); break; } x = getcurx(stdscr); @@ -4235,8 +4770,8 @@ selectcell(int uli, int ulj, int lri, int lrj) break; } } - /* FALLTHRU */ #endif + /* FALLTHRU */ default: res.y = uli + i; res.x = ulj + j; @@ -4337,14 +4872,14 @@ delete_framed(FRAME * fp, bool showit) } delwin(fp->wind); - np = (fp == fp->next) ? 0 : fp->next; + np = (fp == fp->next) ? NULL : fp->next; free(fp); } return np; } -static void -acs_and_scroll(void) +static int +scroll_test(bool recur GCC_UNUSED) /* Demonstrate windows */ { int c; @@ -4366,11 +4901,11 @@ acs_and_scroll(void) switch (c) { case CTRL('C'): if ((neww = typeCalloc(FRAME, (size_t) 1)) == 0) { - failed("acs_and_scroll"); + failed("scroll_test"); goto breakout; } if ((neww->wind = getwindow()) == (WINDOW *) 0) { - failed("acs_and_scroll"); + failed("scroll_test"); free(neww); goto breakout; } @@ -4436,10 +4971,14 @@ acs_and_scroll(void) } else if ((fp = fopen(DUMPFILE, "w")) == (FILE *) 0) { transient(current, "Can't open screen dump file"); } else { - (void) putwin(frame_win(current), fp); + int rc = putwin(frame_win(current), fp); (void) fclose(fp); - current = delete_framed(current, TRUE); + if (rc == OK) { + current = delete_framed(current, TRUE); + } else { + transient(current, "Can't write screen dump file"); + } } break; @@ -4460,7 +4999,7 @@ acs_and_scroll(void) wrefresh(neww->wind); } else { - failed("acs_and_scroll"); + failed("scroll_test"); } (void) fclose(fp); } @@ -4471,7 +5010,7 @@ acs_and_scroll(void) case CTRL('X'): /* resize window */ if (current) { pair *tmp, ul, lr; - int i, mx, my; + int mx, my; move(0, 0); clrtoeol(); @@ -4500,11 +5039,13 @@ acs_and_scroll(void) wclrtobot(current->wind); wmove(current->wind, lr.y, lr.x); } - if (mx > tmp->x - ul.x) + if (mx > tmp->x - ul.x) { + int i; for (i = 0; i < my; i++) { wmove(current->wind, i, tmp->x - ul.x + 1); wclrtoeol(current->wind); } + } wnoutrefresh(current->wind); memcpy(&lr, tmp, sizeof(pair)); @@ -4525,12 +5066,6 @@ acs_and_scroll(void) break; #endif /* HAVE_WRESIZE */ - case KEY_F(10): /* undocumented --- use this to test area clears */ - selectcell(0, 0, LINES - 1, COLS - 1); - clrtobot(); - refresh(); - break; - case KEY_UP: newwin_move(current, -1, 0); break; @@ -4574,7 +5109,7 @@ acs_and_scroll(void) usescr = frame_win(current); wrefresh(usescr); } while - (!isQuit(c = wGetchar(usescr)) + (!isQuit(c = wGetchar(usescr), TRUE) && (c != ERR)); breakout: @@ -4588,6 +5123,7 @@ acs_and_scroll(void) noraw(); erase(); endwin(); + return OK; } /**************************************************************************** @@ -4657,7 +5193,7 @@ mkpanel(NCURSES_COLOR_T color, int rows, int cols, int tly, int tlx) if ((win = newwin(rows, cols, tly, tlx)) != 0) { if ((pan = new_panel(win)) == 0) { delwin(win); - } else if (use_colors) { + } else if (UseColors) { NCURSES_COLOR_T fg = (NCURSES_COLOR_T) ((color == COLOR_BLUE) ? COLOR_WHITE : COLOR_BLACK); @@ -4676,7 +5212,7 @@ mkpanel(NCURSES_COLOR_T color, int rows, int cols, int tly, int tlx) rmpanel(pan) --------------------------------------------------------------------------*/ static void -rmpanel(PANEL * pan) +rmpanel(PANEL *pan) { WINDOW *win = panel_window(pan); del_panel(pan); @@ -4697,18 +5233,18 @@ pflush(void) fill_panel(win) --------------------------------------------------------------------------*/ static void -init_panel(void) +init_panel(WINDOW *win) { register int y, x; for (y = 0; y < LINES - 1; y++) { for (x = 0; x < COLS; x++) - wprintw(stdscr, "%d", (y + x) % 10); + wprintw(win, "%d", (y + x) % 10); } } static void -fill_panel(PANEL * pan) +fill_panel(PANEL *pan) { WINDOW *win = panel_window(pan); const char *userptr = (const char *) panel_userptr(pan); @@ -4729,7 +5265,7 @@ fill_panel(PANEL * pan) #if USE_WIDEC_SUPPORT static void -init_wide_panel(void) +init_wide_panel(WINDOW *win) { int digit; cchar_t temp[10]; @@ -4741,11 +5277,11 @@ init_wide_panel(void) int y, x; getyx(stdscr, y, x); digit = (y + x / 2) % 10; - } while (add_wch(&temp[digit]) != ERR); + } while (wadd_wch(win, &temp[digit]) != ERR); } static void -fill_wide_panel(PANEL * pan) +fill_wide_panel(PANEL *pan) { WINDOW *win = panel_window(pan); const char *userptr = (const char *) panel_userptr(pan); @@ -4768,7 +5304,7 @@ fill_wide_panel(PANEL * pan) #define MAX_PANELS 5 static void -canned_panel(PANEL * px[MAX_PANELS + 1], NCURSES_CONST char *cmd) +canned_panel(PANEL *px[MAX_PANELS + 1], NCURSES_CONST char *cmd) { int which = cmd[1] - '0'; @@ -4794,8 +5330,8 @@ canned_panel(PANEL * px[MAX_PANELS + 1], NCURSES_CONST char *cmd) wait_a_while(nap_msec); } -static void -demo_panels(void (*InitPanel) (void), void (*FillPanel) (PANEL *)) +static int +demo_panels(void (*InitPanel) (WINDOW *), void (*FillPanel) (PANEL *)) { int count; int itmp; @@ -4804,7 +5340,7 @@ demo_panels(void (*InitPanel) (void), void (*FillPanel) (PANEL *)) scrollok(stdscr, FALSE); /* we don't want stdscr to scroll! */ refresh(); - InitPanel(); + InitPanel(stdscr); for (count = 0; count < 5; count++) { px[1] = mkpanel(COLOR_RED, LINES / 2 - 2, @@ -4933,7 +5469,24 @@ demo_panels(void (*InitPanel) (void), void (*FillPanel) (PANEL *)) erase(); endwin(); + return OK; +} + +#if USE_LIBPANEL +static int +panel_test(bool recur GCC_UNUSED) +{ + return demo_panels(init_panel, fill_panel); } +#endif + +#if USE_WIDEC_SUPPORT && USE_LIBPANEL +static int +x_panel_test(bool recur GCC_UNUSED) +{ + return demo_panels(init_wide_panel, fill_wide_panel); +} +#endif #endif /* USE_LIBPANEL */ /**************************************************************************** @@ -4942,6 +5495,25 @@ demo_panels(void (*InitPanel) (void), void (*FillPanel) (PANEL *)) * ****************************************************************************/ +#if HAVE_NEWPAD + +/* The behavior of mvhline, mvvline for negative/zero length is unspecified, + * though we can rely on negative x/y values to stop the macro. + */ +static void +do_h_line(int y, int x, chtype c, int to) +{ + if ((to) > (x)) + MvHLine(y, x, c, (to) - (x)); +} + +static void +do_v_line(int y, int x, chtype c, int to) +{ + if ((to) > (y)) + MvVLine(y, x, c, (to) - (y)); +} + #define GRIDSIZE 3 static bool pending_pan = FALSE; @@ -4984,10 +5556,15 @@ panner_v_cleanup(int from_y, int from_x, int to_y) } static void -fill_pad(WINDOW *panpad, bool pan_lines) +fill_pad(WINDOW *panpad, bool pan_lines, bool colored) { int y, x; unsigned gridcount = 0; + chtype fill = 0; +#ifdef A_COLOR + if (colored) + fill = (chtype) COLOR_PAIR(1); +#endif wmove(panpad, 0, 0); for (y = 0; y < getmaxy(panpad); y++) { @@ -5001,7 +5578,7 @@ fill_pad(WINDOW *panpad, bool pan_lines) waddch(panpad, pan_lines ? ACS_LTEE : '+'); else waddch(panpad, (chtype) ((pan_lines ? 'a' : 'A') + - (int) (gridcount++ % 26))); + (int) (gridcount++ % 26)) | fill); } else if (y % GRIDSIZE == 0) waddch(panpad, pan_lines ? ACS_HLINE : '-'); else if (x % GRIDSIZE == 0) @@ -5015,7 +5592,8 @@ fill_pad(WINDOW *panpad, bool pan_lines) static void panner(WINDOW *pad, int top_x, int top_y, int porty, int portx, - int (*pgetc) (WINDOW *)) + int (*pgetc) (WINDOW *), + bool colored) { #if HAVE_GETTIMEOFDAY struct timeval before, after; @@ -5052,8 +5630,8 @@ panner(WINDOW *pad, erase(); /* FALLTHRU */ - case '?': - if (c == '?') + case HELP_KEY_1: + if (c == HELP_KEY_1) show_panner_legend = !show_panner_legend; panner_legend(LINES - 4); panner_legend(LINES - 3); @@ -5062,7 +5640,7 @@ panner(WINDOW *pad, break; case 'a': pan_lines = !pan_lines; - fill_pad(pad, pan_lines); + fill_pad(pad, pan_lines, colored); pending_pan = FALSE; break; @@ -5281,13 +5859,13 @@ padgetch(WINDOW *win) { static int count; static int last; - int c; if ((pending_pan = (count > 0)) != FALSE) { count--; pending_pan = (count != 0); } else { for (;;) { + int c; switch (c = wGetchar(win)) { case '!': ShellOut(FALSE); @@ -5348,18 +5926,24 @@ padgetch(WINDOW *win) #define PAD_HIGH 200 #define PAD_WIDE 200 -static void -demo_pad(void) +static int +pad_test(bool recur GCC_UNUSED) /* Demonstrate pads. */ { WINDOW *panpad = newpad(PAD_HIGH, PAD_WIDE); if (panpad == 0) { Cannot("cannot create requested pad"); - return; + return ERR; } - - fill_pad(panpad, FALSE); +#ifdef A_COLOR + if (UseColors) { + init_pair(1, COLOR_BLACK, COLOR_GREEN); + init_pair(2, COLOR_CYAN, COLOR_BLUE); + wbkgd(panpad, (chtype) (COLOR_PAIR(2) | ' ')); + } +#endif + fill_pad(panpad, FALSE, TRUE); panner_legend(LINES - 4); panner_legend(LINES - 3); @@ -5372,12 +5956,14 @@ demo_pad(void) * We'll still be able to widen it during a test, since that's required * for testing boundaries. */ - panner(panpad, 2, 2, LINES - 5, COLS - 15, padgetch); + panner(panpad, 2, 2, LINES - 5, COLS - 15, padgetch, TRUE); delwin(panpad); endwin(); erase(); + return OK; } +#endif /* HAVE_NEWPAD */ /**************************************************************************** * @@ -5395,10 +5981,11 @@ Continue(WINDOW *win) wGetchar(win); } -static void -flushinp_test(WINDOW *win) +static int +flushinp_test(bool recur GCC_UNUSED) /* Input test, adapted from John Burnell's PDCurses tester */ { + WINDOW *win = stdscr; int w, h, bx, by, sw, sh, i; WINDOW *subWin; @@ -5409,10 +5996,10 @@ flushinp_test(WINDOW *win) sw = w / 3; sh = h / 3; if ((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == 0) - return; + return ERR; #ifdef A_COLOR - if (use_colors) { + if (UseColors) { init_pair(2, COLOR_CYAN, COLOR_BLUE); wbkgd(subWin, (chtype) (COLOR_PAIR(2) | ' ')); } @@ -5476,6 +6063,7 @@ flushinp_test(WINDOW *win) Continue(win); cbreak(); + return OK; } /**************************************************************************** @@ -5533,8 +6121,8 @@ static CONST_MENUS char *animals[] = (char *) 0 }; -static void -menu_test(void) +static int +menu_test(bool recur GCC_UNUSED) { MENU *m; ITEM *items[SIZEOF(animals)]; @@ -5596,6 +6184,7 @@ menu_test(void) #ifdef NCURSES_MOUSE_VERSION mousemask(0, (mmask_t *) 0); #endif + return OK; } #ifdef TRACE @@ -5630,29 +6219,31 @@ static char * tracetrace(unsigned tlevel) { static char *buf; + static size_t need = 12; int n; if (buf == 0) { - size_t need = 12; for (n = 0; t_tbl[n].name != 0; n++) need += strlen(t_tbl[n].name) + 2; buf = typeMalloc(char, need); if (!buf) failed("tracetrace"); } - sprintf(buf, "0x%02x = {", tlevel); + _nc_SPRINTF(buf, _nc_SLIMIT(need) "0x%02x = {", tlevel); if (tlevel == 0) { - sprintf(buf + strlen(buf), "%s, ", t_tbl[0].name); + _nc_STRCAT(buf, t_tbl[0].name, need); + _nc_STRCAT(buf, ", ", need); } else { for (n = 1; t_tbl[n].name != 0; n++) if ((tlevel & t_tbl[n].mask) == t_tbl[n].mask) { - strcat(buf, t_tbl[n].name); - strcat(buf, ", "); + _nc_STRCAT(buf, t_tbl[n].name, need); + _nc_STRCAT(buf, ", ", need); } } if (buf[strlen(buf) - 2] == ',') buf[strlen(buf) - 2] = '\0'; - return (strcat(buf, "}")); + _nc_STRCAT(buf, "}", need); + return buf; } /* fake a dynamically reconfigurable menu using the 0th entry to deselect @@ -5694,8 +6285,8 @@ run_trace_menu(MENU * m) } } -static void -trace_set(void) +static int +trace_set(bool recur GCC_UNUSED) /* interactively set the trace level */ { MENU *m; @@ -5751,7 +6342,7 @@ trace_set(void) for (ip = menu_items(m); *ip; ip++) if (item_value(*ip)) newtrace |= t_tbl[item_index(*ip)].mask; - trace(newtrace); + curses_trace(newtrace); Trace(("trace level interactively set to %s", tracetrace(_nc_tracing))); MvPrintw(LINES - 2, 0, @@ -5765,6 +6356,8 @@ trace_set(void) free_menu(m); for (ip = items; *ip; ip++) free_item(*ip); + + return OK; } #endif /* TRACE */ #endif /* USE_LIBMENU */ @@ -5800,7 +6393,7 @@ make_field(int frow, int fcol, int rows, int cols, bool secure) } static void -display_form(FORM * f) +display_form(FORM *f) { WINDOW *w; int rows, cols; @@ -5818,7 +6411,7 @@ display_form(FORM * f) } static void -erase_form(FORM * f) +erase_form(FORM *f) { WINDOW *w = form_win(f); WINDOW *s = form_sub(f); @@ -5831,7 +6424,7 @@ erase_form(FORM * f) } static int -edit_secure(FIELD * me, int c) +edit_secure(FIELD *me, int c) { int rows, cols, frow, fcol, nrow, nbuf; @@ -5841,10 +6434,10 @@ edit_secure(FIELD * me, int c) size_t have = (source ? strlen(source) : 0) + 1; size_t need = 80 + have; char *temp = malloc(need); - size_t len; if (temp != 0) { - strncpy(temp, source ? source : "", have + 1); + size_t len; + _nc_STRNCPY(temp, source ? source : "", have + 1); len = (size_t) (char *) field_userptr(me); if (c <= KEY_MAX) { if (isgraph(c) && (len + 1) < sizeof(temp)) { @@ -5897,7 +6490,7 @@ edit_secure(FIELD * me, int c) } static int -form_virtualize(FORM * f, WINDOW *w) +form_virtualize(FORM *f, WINDOW *w) { /* *INDENT-OFF* */ static const struct { @@ -5946,7 +6539,6 @@ form_virtualize(FORM * f, WINDOW *w) static int mode = REQ_INS_MODE; int c = wGetchar(w); - unsigned n; FIELD *me = current_field(f); bool current = TRUE; @@ -5958,6 +6550,7 @@ form_virtualize(FORM * f, WINDOW *w) } c = mode; } else { + unsigned n; for (n = 0; n < SIZEOF(lookup); n++) { if (lookup[n].code == c) { c = lookup[n].result; @@ -6004,7 +6597,7 @@ form_virtualize(FORM * f, WINDOW *w) } static int -my_form_driver(FORM * form, int c) +my_form_driver(FORM *form, int c) { if (c == (MAX_FORM_COMMAND + 1) && form_driver(form, REQ_VALIDATION) == E_OK) @@ -6089,15 +6682,14 @@ CHAR_CHECK_CB(pw_char_check) return (isgraph(ch) ? TRUE : FALSE); } -static void -demo_forms(void) +static int +form_test(bool recur GCC_UNUSED) { - WINDOW *w; FORM *form; FIELD *f[12], *secure; FIELDTYPE *fty_middle = new_fieldtype(mi_field_check, mi_char_check); FIELDTYPE *fty_passwd = new_fieldtype(pw_field_check, pw_char_check); - int finished = 0, c; + int c; unsigned n = 0; #ifdef NCURSES_MOUSE_VERSION @@ -6147,6 +6739,8 @@ demo_forms(void) f[n] = (FIELD *) 0; if ((form = new_form(f)) != 0) { + WINDOW *w; + int finished = 0; display_form(form); @@ -6183,6 +6777,7 @@ demo_forms(void) #ifdef NCURSES_MOUSE_VERSION mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0); #endif + return OK; } #endif /* USE_LIBFORM */ @@ -6192,6 +6787,75 @@ demo_forms(void) * ****************************************************************************/ +#if HAVE_COPYWIN /* ...and overlay, overwrite */ + +static const int overlap_HEAD = 1; +static const int overlap_FOOT = 6; + +static WINDOW * +make_overlap(int n) +{ + WINDOW *result; + int y, x; + + getmaxyx(stdscr, y, x); + if (y < 23 || x < 80) { + Cannot("The screen is too small for this test"); + result = 0; + } else { + int ymax = y - (overlap_HEAD + overlap_FOOT); + int high = ymax / 5; /* equal-sized parts for cross */ + int xmax = x - 2; /* margin */ + int wide = (xmax / 5) & ~1; + int lmar, tmar; + + if (high > 8) + high = 8; + + if (wide > 8) + wide = 8; + + tmar = (ymax - (5 * high)) / 2 + overlap_HEAD; + lmar = (xmax - (5 * wide)) / 2; + + if (n == 0) { + result = newwin(3 * high, 3 * wide, tmar, lmar); + } else { + result = newwin(3 * high, 3 * wide, tmar + 2 * high, lmar + 2 * wide); + } + } + return result; +} + +static void +clear_overlap(void) +{ + int row; + + for (row = overlap_HEAD; row < LINES - overlap_FOOT; ++row) { + move(row, 0); + clrtoeol(); + } +} + +static int +move_overlap(int shift, WINDOW *win1) +{ + int ymax = getmaxy(stdscr) - (overlap_HEAD + overlap_FOOT); + int high = ymax / 5; /* equal-sized parts for cross */ + int tmar; + int xmax1 = getmaxx(win1) + 1; + int lmar1 = (COLS - (5 * (xmax1) / 3)) / 2; + int rc = ERR; + + if (high > 8) + high = 8; + tmar = (ymax - (5 * high)) / 2 + overlap_HEAD; + + rc = mvwin(win1, tmar, lmar1 + shift); + return rc; +} + static void fillwin(WINDOW *win, char ch) { @@ -6206,24 +6870,107 @@ fillwin(WINDOW *win, char ch) } } +#define InCross(x,y, x1,y1) \ + (((x > (x1 - 1) / 3) && (x <= (2 * (x1 - 1)) / 3)) \ + || (((y > (y1 - 1) / 3) && (y <= (2 * (y1 - 1)) / 3)))) + static void crosswin(WINDOW *win, char ch) { int y, x; int y1, x1; + int xw = 1; getmaxyx(win, y1, x1); for (y = 0; y < y1; y++) { - for (x = 0; x < x1; x++) - if (((x > (x1 - 1) / 3) && (x <= (2 * (x1 - 1)) / 3)) - || (((y > (y1 - 1) / 3) && (y <= (2 * (y1 - 1)) / 3)))) { + for (x = 0; x < x1; x += xw) { + if (InCross(x, y, x1, y1)) { wmove(win, y, x); waddch(win, UChar(ch)); } + } } } -#define OVERLAP_FLAVORS 5 +/* + * Match "crosswin()", but using line-drawing characters. This could be done + * a little simpler using box(), but the reason for this example is to test + * hline/vline and addch with line-drawing vs the copy/overlay functions. + */ +static void +crossbox(WINDOW *win) +{ + int y1, x1; + int ymax, xmax; + + getmaxyx(win, y1, x1); + + ymax = (y1 + 1); + xmax = (x1 + 1); + + mvwhline(win, 0, (xmax / 3), ACS_HLINE, (xmax / 3)); + mvwhline(win, ymax / 3, 0, ACS_HLINE, xmax); + mvwhline(win, ((2 * ymax) / 3) - 1, 0, ACS_HLINE, xmax); + mvwhline(win, y1 - 1, (xmax / 3), ACS_HLINE, (xmax / 3)); + + mvwvline(win, (ymax / 3), 0, ACS_VLINE, (ymax / 3)); + mvwvline(win, 0, xmax / 3, ACS_VLINE, ymax); + mvwvline(win, 0, ((2 * xmax) / 3) - 1, ACS_VLINE, ymax); + mvwvline(win, (ymax / 3), x1 - 1, ACS_VLINE, (ymax / 3)); + + mvwaddch(win, 0, (xmax / 3), ACS_ULCORNER); + mvwaddch(win, 0, ((2 * xmax) / 3) - 1, ACS_URCORNER); + mvwaddch(win, y1 - 1, (xmax / 3), ACS_LLCORNER); + mvwaddch(win, y1 - 1, ((2 * xmax) / 3) - 1, ACS_LRCORNER); + + mvwaddch(win, (ymax / 3), 0, ACS_ULCORNER); + mvwaddch(win, ((2 * ymax) / 3) - 1, 0, ACS_LLCORNER); + mvwaddch(win, (ymax / 3), x1 - 1, ACS_URCORNER); + mvwaddch(win, ((2 * ymax) / 3) - 1, x1 - 1, ACS_LRCORNER); + + mvwaddch(win, (ymax / 3), (xmax / 3), ACS_PLUS); + mvwaddch(win, (ymax / 3), ((2 * xmax) / 3) - 1, ACS_PLUS); + mvwaddch(win, ((2 * ymax) / 3) - 1, ((2 * xmax) / 3) - 1, ACS_PLUS); + mvwaddch(win, ((2 * ymax) / 3) - 1, (xmax / 3), ACS_PLUS); +} + +typedef enum { + otBASE_refresh = 0 + ,otBASE_fill + ,otBASE_draw + ,otBASE_clear + ,otBASE_copy +} otBASE; + +#define OVERLAP_FLAVORS 6 + +typedef enum { + otFILL_normal = 0 + ,otFILL_bold + ,otFILL_color + ,otFILL_bright +} otFILL; + +#define LimitFILL() UseColors ? 4 : 2 + +typedef enum { + otDRAW_text_cross = 0 + ,otDRAW_line_box + ,otDRAW_line_cross + ,otDRAW_set_bg + ,otDRAW_reset_bg +} otDRAW; + +#define LimitDRAW() UseColors ? 5 : 3 + +typedef enum { + otCOPY_overwrite = 0 + ,otCOPY_merge + ,otCOPY_force + ,otCOPY_overlay +} otCOPY; + +#define LimitCOPY() 4 static void overlap_helpitem(int state, int item, char *message) @@ -6241,20 +6988,20 @@ overlap_test_1_attr(WINDOW *win, int flavor, int col) { NCURSES_PAIRS_T cpair = (NCURSES_PAIRS_T) (1 + (flavor * 2) + col); - switch (flavor) { - case 0: + switch ((otFILL) flavor) { + case otFILL_normal: (void) wattrset(win, A_NORMAL); break; - case 1: + case otFILL_bold: (void) wattrset(win, A_BOLD); break; - case 2: + case otFILL_color: init_pair(cpair, COLOR_BLUE, COLOR_WHITE); - (void) wattrset(win, (int) (COLOR_PAIR(cpair) | A_NORMAL)); + (void) wattrset(win, AttrArg(COLOR_PAIR(cpair), A_NORMAL)); break; - case 3: + case otFILL_bright: init_pair(cpair, COLOR_WHITE, COLOR_BLUE); - (void) wattrset(win, (int) (COLOR_PAIR(cpair) | A_BOLD)); + (void) wattrset(win, AttrArg(COLOR_PAIR(cpair), A_BOLD)); break; } } @@ -6264,18 +7011,21 @@ overlap_test_2_attr(WINDOW *win, int flavor, int col) { NCURSES_PAIRS_T cpair = (NCURSES_PAIRS_T) (9 + (flavor * 2) + col); - switch (flavor) { - case 0: + switch ((otDRAW) flavor) { + case otDRAW_text_cross: /* no effect */ break; - case 1: + case otDRAW_line_box: /* no effect */ break; - case 2: + case otDRAW_line_cross: + /* no effect */ + break; + case otDRAW_set_bg: init_pair(cpair, COLOR_RED, COLOR_GREEN); wbkgdset(win, colored_chtype(' ', A_BLINK, cpair)); break; - case 3: + case otDRAW_reset_bg: wbkgdset(win, ' ' | A_NORMAL); break; } @@ -6284,10 +7034,8 @@ overlap_test_2_attr(WINDOW *win, int flavor, int col) static int overlap_help(int state, int flavors[OVERLAP_FLAVORS]) { - int row; - int col; int item; - const char *ths, *tht; + int limit[OVERLAP_FLAVORS]; char msg[80]; if (state < 0) @@ -6296,64 +7044,76 @@ overlap_help(int state, int flavors[OVERLAP_FLAVORS]) assert(state >= 0 && state < OVERLAP_FLAVORS); for (item = 0; item < (2 * OVERLAP_FLAVORS); ++item) { - row = item / 2; - col = item % 2; - ths = col ? "B" : "A"; - tht = col ? "A" : "B"; - - switch (row) { - case 0: + int row = item / 2; + int col = item % 2; + const char *ths = col ? "B" : "A"; + const char *tht = col ? "A" : "B"; + + switch ((otBASE) row) { + case otBASE_refresh: + limit[row] = 1; flavors[row] = 0; - sprintf(msg, "refresh %s, then %s, then doupdate.", ths, tht); + _nc_SPRINTF(msg, _nc_SLIMIT(sizeof(msg)) + "refresh %s, then %s, then doupdate.", ths, tht); break; - case 1: - if (use_colors) { - flavors[row] %= 4; - } else { - flavors[row] %= 2; - } + case otBASE_fill: + limit[row] = LimitFILL(); + flavors[row] %= limit[row]; overlap_test_1_attr(stdscr, flavors[row], col); - sprintf(msg, "fill window %s with letter %s.", ths, ths); - break; - case 2: - if (use_colors) { - flavors[row] %= 4; - } else { - flavors[row] %= 2; - } - switch (flavors[row]) { - case 0: - sprintf(msg, "cross pattern in window %s.", ths); + _nc_SPRINTF(msg, _nc_SLIMIT(sizeof(msg)) + "fill window %s with letter %s.", ths, ths); + break; + case otBASE_draw: + limit[row] = LimitDRAW(); + flavors[row] %= limit[row]; + switch ((otDRAW) flavors[row]) { + case otDRAW_text_cross: + _nc_SPRINTF(msg, _nc_SLIMIT(sizeof(msg)) + "cross text-pattern in window %s.", ths); break; - case 1: - sprintf(msg, "draw box in window %s.", ths); + case otDRAW_line_box: + _nc_SPRINTF(msg, _nc_SLIMIT(sizeof(msg)) + "draw line-box in window %s.", ths); break; - case 2: - sprintf(msg, "set background of window %s.", ths); + case otDRAW_line_cross: + _nc_SPRINTF(msg, _nc_SLIMIT(sizeof(msg)) + "draw line-cross in window %s.", ths); break; - case 3: - sprintf(msg, "reset background of window %s.", ths); + case otDRAW_set_bg: + _nc_SPRINTF(msg, _nc_SLIMIT(sizeof(msg)) + "set background of window %s.", ths); + break; + case otDRAW_reset_bg: + _nc_SPRINTF(msg, _nc_SLIMIT(sizeof(msg)) + "reset background of window %s.", ths); break; } break; - case 3: + case otBASE_clear: + limit[row] = 1; flavors[row] = 0; - sprintf(msg, "clear window %s.", ths); - break; - case 4: - flavors[row] %= 4; - switch (flavors[row]) { - case 0: - sprintf(msg, "overwrite %s onto %s.", ths, tht); + _nc_SPRINTF(msg, _nc_SLIMIT(sizeof(msg)) + "clear window %s.", ths); + break; + case otBASE_copy: + limit[row] = LimitCOPY(); + flavors[row] %= limit[row]; + switch ((otCOPY) flavors[row]) { + case otCOPY_overwrite: + _nc_SPRINTF(msg, _nc_SLIMIT(sizeof(msg)) + "overwrite %s onto %s.", ths, tht); break; - case 1: - sprintf(msg, "copywin(FALSE) %s onto %s.", ths, tht); + case otCOPY_merge: + _nc_SPRINTF(msg, _nc_SLIMIT(sizeof(msg)) + "copywin(FALSE) %s onto %s.", ths, tht); break; - case 2: - sprintf(msg, "copywin(TRUE) %s onto %s.", ths, tht); + case otCOPY_force: + _nc_SPRINTF(msg, _nc_SLIMIT(sizeof(msg)) + "copywin(TRUE) %s onto %s.", ths, tht); break; - case 3: - sprintf(msg, "overlay %s onto %s.", ths, tht); + case otCOPY_overlay: + _nc_SPRINTF(msg, _nc_SLIMIT(sizeof(msg)) + "overlay %s onto %s.", ths, tht); break; } break; @@ -6363,8 +7123,12 @@ overlap_help(int state, int flavors[OVERLAP_FLAVORS]) wbkgdset(stdscr, ' ' | A_NORMAL); } move(LINES - 1, 0); - printw("^Q/ESC = terminate test. Up/down/space select test variations (%d %d).", - state, flavors[state]); + printw("^Q/ESC = terminate test. shift. Up/down/space select (row %d", + state + 1); + if (limit[state] > 1) + printw(" test %d:%d", 1 + flavors[state], limit[state]); + printw(")."); + clrtoeol(); return state; } @@ -6391,17 +7155,20 @@ static void overlap_test_2(int flavor, int col, WINDOW *a, char fill) { overlap_test_2_attr(a, flavor, col); - switch (flavor) { - case 0: + switch ((otDRAW) flavor) { + case otDRAW_text_cross: crosswin(a, fill); break; - case 1: + case otDRAW_line_box: box(a, 0, 0); break; - case 2: + case otDRAW_line_cross: + crossbox(a); + break; + case otDRAW_set_bg: /* done in overlap_test_2_attr */ break; - case 3: + case otDRAW_reset_bg: /* done in overlap_test_2_attr */ break; } @@ -6417,44 +7184,48 @@ overlap_test_3(WINDOW *a) static void overlap_test_4(int flavor, WINDOW *a, WINDOW *b) { - switch (flavor) { - case 0: + switch ((otCOPY) flavor) { + case otCOPY_overwrite: overwrite(a, b); break; - case 1: + case otCOPY_merge: copywin(a, b, 0, 0, 0, 0, getmaxy(b), getmaxx(b), FALSE); break; - case 2: + case otCOPY_force: copywin(a, b, 0, 0, 0, 0, getmaxy(b), getmaxx(b), TRUE); break; - case 3: + case otCOPY_overlay: overlay(a, b); break; } } /* test effects of overlapping windows */ -static void -overlap_test(void) +static int +overlap_test(bool recur GCC_UNUSED) { + WINDOW *win1, *win2; int ch; + int shift = 0, last_refresh = -1; int state, flavor[OVERLAP_FLAVORS]; - WINDOW *win1 = newwin(9, 20, 3, 3); - WINDOW *win2 = newwin(9, 20, 9, 16); + if ((win1 = make_overlap(0)) == 0) { + return ERR; + } else if ((win2 = make_overlap(1)) == 0) { + delwin(win1); + return ERR; + } curs_set(0); raw(); refresh(); move(0, 0); - printw("This test shows the behavior of wnoutrefresh() with respect to\n"); - printw("the shared region of two overlapping windows A and B. The cross\n"); - printw("pattern in each window does not overlap the other.\n"); + printw("Test wnoutrefresh() for two overlapping windows:"); memset(flavor, 0, sizeof(flavor)); state = overlap_help(0, flavor); - while (!isQuit(ch = Getchar())) + while (!isQuit(ch = Getchar(), TRUE)) { switch (ch) { case 'a': /* refresh window A first, then B */ overlap_test_0(win1, win2); @@ -6465,19 +7236,19 @@ overlap_test(void) break; case 'c': /* fill window A so it's visible */ - overlap_test_1(flavor[1], 0, win1, 'A'); + overlap_test_1(flavor[otBASE_fill], 0, win1, 'A'); break; case 'd': /* fill window B so it's visible */ - overlap_test_1(flavor[1], 1, win2, 'B'); + overlap_test_1(flavor[otBASE_fill], 1, win2, 'B'); break; case 'e': /* cross test pattern in window A */ - overlap_test_2(flavor[2], 0, win1, 'A'); + overlap_test_2(flavor[otBASE_draw], 0, win1, 'A'); break; case 'f': /* cross test pattern in window A */ - overlap_test_2(flavor[2], 1, win2, 'B'); + overlap_test_2(flavor[otBASE_draw], 1, win2, 'B'); break; case 'g': /* clear window A */ @@ -6489,11 +7260,11 @@ overlap_test(void) break; case 'i': /* overwrite A onto B */ - overlap_test_4(flavor[4], win1, win2); + overlap_test_4(flavor[otBASE_copy], win1, win2); break; case 'j': /* overwrite B onto A */ - overlap_test_4(flavor[4], win2, win1); + overlap_test_4(flavor[otBASE_copy], win2, win1); break; case CTRL('n'): @@ -6511,160 +7282,353 @@ overlap_test(void) state = overlap_help(state, flavor); break; - case '?': + case HELP_KEY_1: state = overlap_help(state, flavor); break; + case '<': + /* FALLTHRU */ + case '>': + /* see below */ + break; + default: beep(); break; } + switch (ch) { + case 'a': + /* FALLTHRU */ + case 'b': + last_refresh = ch; + break; + case '<': + shift -= 2; + /* FALLTHRU */ + case '>': + shift += 1; + if (move_overlap(shift, win1) != OK) { + flash(); + shift += (ch == '>') ? -1 : 1; + } else if (last_refresh > 0) { + clear_overlap(); + wnoutrefresh(stdscr); + if (last_refresh == 'a') + overlap_test_0(win1, win2); + else + overlap_test_0(win2, win1); + } + break; + default: + last_refresh = -1; + break; + } + } + delwin(win2); delwin(win1); erase(); - curs_set(1); - endwin(); + stop_curses(); + return OK; } -/**************************************************************************** - * - * Main sequence - * - ****************************************************************************/ - -static bool -do_single_test(const char c) -/* perform a single specified test */ +#if USE_WIDEC_SUPPORT +static void +x_fillwin(WINDOW *win, wchar_t ch) { - switch (c) { - case 'a': - getch_test(); - break; + int y, x; + int y1, x1; -#if USE_WIDEC_SUPPORT - case 'A': - get_wch_test(); - break; -#endif + getmaxyx(win, y1, x1); + x1 /= 2; + for (y = 0; y < y1; y++) { + wmove(win, y, 0); + for (x = 0; x < x1; x++) + waddnwstr(win, &ch, 1); + } +} - case 'b': - attr_test(); - break; +static void +x_crosswin(WINDOW *win, wchar_t ch) +{ + int y, x; + int y1, x1; + int xw = 2; -#if USE_WIDEC_SUPPORT - case 'B': - wide_attr_test(); - break; -#endif + getmaxyx(win, y1, x1); + for (y = 0; y < y1; y++) { + for (x = 0; x < x1; x += xw) { + if (InCross(x, y, x1, y1)) { + wmove(win, y, x); + waddnwstr(win, &ch, 1); + } + } + } +} - case 'c': - if (!use_colors) - Cannot("does not support color."); - else - color_test(); - break; +static void +x_overlap_test_1(int flavor, int col, WINDOW *a, wchar_t fill) +{ + overlap_test_1_attr(a, flavor, col); + x_fillwin(a, fill); + (void) wattrset(a, A_NORMAL); +} -#if USE_WIDEC_SUPPORT - case 'C': - if (!use_colors) - Cannot("does not support color."); - else - wide_color_test(); +static void +x_overlap_test_2(int flavor, int col, WINDOW *a, wchar_t fill) +{ + overlap_test_2_attr(a, flavor, col); + switch ((otDRAW) flavor) { + case otDRAW_text_cross: + x_crosswin(a, fill); break; -#endif - - case 'd': - if (!use_colors) - Cannot("does not support color."); - else if (!can_change_color()) - Cannot("has hardwired color values."); - else - color_edit(); + case otDRAW_line_box: + box(a, 0, 0); break; - -#if USE_SOFTKEYS - case 'e': - slk_test(); + case otDRAW_line_cross: + crossbox(a); break; - -#if USE_WIDEC_SUPPORT - case 'E': - wide_slk_test(); + case otDRAW_set_bg: + /* done in overlap_test_2_attr */ break; -#endif -#endif - - case 'f': - acs_display(); + case otDRAW_reset_bg: + /* done in overlap_test_2_attr */ break; + } +} -#if USE_WIDEC_SUPPORT - case 'F': - wide_acs_display(); - break; -#endif +/* test effects of overlapping windows */ +static int +x_overlap_test(bool recur GCC_UNUSED) +{ + const wchar_t WIDE_A = 0xff21; + const wchar_t WIDE_B = 0xff22; + WINDOW *win1, *win2; + int ch; + int shift = 0, last_refresh = -1; + int state, flavor[OVERLAP_FLAVORS]; -#if USE_LIBPANEL - case 'o': - demo_panels(init_panel, fill_panel); - break; -#endif + if ((win1 = make_overlap(0)) == 0) { + return ERR; + } else if ((win2 = make_overlap(1)) == 0) { + delwin(win1); + return ERR; + } -#if USE_WIDEC_SUPPORT && USE_LIBPANEL - case 'O': - demo_panels(init_wide_panel, fill_wide_panel); - break; -#endif + curs_set(0); + raw(); + refresh(); + move(0, 0); + printw("Test wnoutrefresh() for overlapping windows with double-cell characters:"); - case 'g': - acs_and_scroll(); - break; + memset(flavor, 0, sizeof(flavor)); + state = overlap_help(0, flavor); - case 'i': - flushinp_test(stdscr); - break; + while (!isQuit(ch = Getchar(), TRUE)) { + switch (ch) { + case 'a': /* refresh window A first, then B */ + overlap_test_0(win1, win2); + break; - case 'k': - test_sgr_attributes(); - break; + case 'b': /* refresh window B first, then A */ + overlap_test_0(win2, win1); + break; -#if USE_LIBMENU - case 'm': - menu_test(); - break; -#endif + case 'c': /* fill window A so it's visible */ + x_overlap_test_1(flavor[otBASE_fill], 0, win1, WIDE_A); + break; - case 'p': - demo_pad(); - break; + case 'd': /* fill window B so it's visible */ + x_overlap_test_1(flavor[otBASE_fill], 1, win2, WIDE_B); + break; -#if USE_LIBFORM - case 'r': - demo_forms(); - break; -#endif + case 'e': /* cross test pattern in window A */ + x_overlap_test_2(flavor[otBASE_draw], 0, win1, WIDE_A); + break; - case 's': - overlap_test(); - break; + case 'f': /* cross test pattern in window A */ + x_overlap_test_2(flavor[otBASE_draw], 1, win2, WIDE_B); + break; -#if USE_LIBMENU && defined(TRACE) - case 't': - trace_set(); - break; -#endif + case 'g': /* clear window A */ + overlap_test_3(win1); + break; - case '?': - break; + case 'h': /* clear window B */ + overlap_test_3(win2); + break; - default: - return FALSE; + case 'i': /* overwrite A onto B */ + overlap_test_4(flavor[otBASE_copy], win1, win2); + break; + + case 'j': /* overwrite B onto A */ + overlap_test_4(flavor[otBASE_copy], win2, win1); + break; + + case CTRL('n'): + case KEY_DOWN: + state = overlap_help(state + 1, flavor); + break; + + case CTRL('p'): + case KEY_UP: + state = overlap_help(state - 1, flavor); + break; + + case ' ': + flavor[state] += 1; + state = overlap_help(state, flavor); + break; + + case HELP_KEY_1: + state = overlap_help(state, flavor); + break; + + case '<': + /* FALLTHRU */ + case '>': + /* see below */ + break; + + default: + beep(); + break; + } + + switch (ch) { + case 'a': + /* FALLTHRU */ + case 'b': + last_refresh = ch; + break; + case '<': + shift -= 2; + /* FALLTHRU */ + case '>': + shift += 1; + if (move_overlap(shift, win1) != OK) { + flash(); + shift += (ch == '>') ? -1 : 1; + } else if (last_refresh > 0) { + clear_overlap(); + wnoutrefresh(stdscr); + if (last_refresh == 'a') + overlap_test_0(win1, win2); + else + overlap_test_0(win2, win1); + } + break; + default: + last_refresh = -1; + break; + } } - return TRUE; + delwin(win2); + delwin(win1); + erase(); + stop_curses(); + return OK; +} +#endif /* USE_WIDEC_SUPPORT */ + +#endif /* HAVE_COPYWIN */ + +static void +show_setting_name(const char *name) +{ + printw("%-25s ", name); +} + +static void +show_string_setting(const char *name, const char *value) +{ + show_setting_name(name); + if (value) { + printw("\"%s\"", value); + } else { + attron(A_REVERSE); + addstr(""); + attroff(A_REVERSE); + } + AddCh('\n'); +} + +static void +show_number_setting(const char *name, int value) +{ + show_setting_name(name); + if (value >= 0) { + printw("%d", value); + } else { + attron(A_REVERSE); + printw("%d", value); + attroff(A_REVERSE); + } + AddCh('\n'); } +static void +show_boolean_setting(const char *name, int value) +{ + show_setting_name(name); + if (value >= 0) { + printw("%s", value ? "TRUE" : "FALSE"); + } else { + attron(A_REVERSE); + printw("%d", value); + attroff(A_REVERSE); + } + AddCh('\n'); +} + +static int +settings_test(bool recur GCC_UNUSED) +{ +#if USE_WIDEC_SUPPORT + wchar_t ch; +#endif + + move(0, 0); + show_string_setting("termname", termname()); + show_string_setting("longname", longname()); + show_number_setting("baudrate", baudrate()); + if (erasechar() > 0) { + show_string_setting("unctrl(erasechar)", unctrl((chtype) erasechar())); + show_string_setting("keyname(erasechar)", keyname(erasechar())); + } + if (killchar() > 0) { + show_string_setting("unctrl(killchar)", unctrl((chtype) killchar())); + show_string_setting("keyname(killchar)", keyname(killchar())); + } +#if USE_WIDEC_SUPPORT + if (erasewchar(&ch) == OK) { + show_string_setting("key_name(erasewchar)", key_name(ch)); + } + if (killwchar(&ch) == OK) { + show_string_setting("key_name(killwchar)", key_name(ch)); + } +#endif + show_boolean_setting("has_ic", has_ic()); + show_boolean_setting("has_il", has_il()); + show_boolean_setting("has_colors", has_colors()); +#if HAVE_COLOR_CONTENT + show_boolean_setting("can_change_color", can_change_color()); +#endif + Pause(); + erase(); + stop_curses(); + return OK; +} + +/**************************************************************************** + * + * Main sequence + * + ****************************************************************************/ + static void usage(void) { @@ -6677,7 +7641,9 @@ usage(void) ," -a f,b set default-colors (assumed white-on-black)" ," -d use default-colors if terminal supports them" #endif +#if HAVE_USE_ENV ," -E call use_env(FALSE) to ignore $LINES and $COLUMNS" +#endif #if USE_SOFTKEYS ," -e fmt specify format for soft-keys test (e)" #endif @@ -6686,15 +7652,20 @@ usage(void) ," -h rip-off header line (can repeat)" #endif ," -m do not use colors" +#if HAVE_COLOR_CONTENT ," -p file rgb values to use in 'd' rather than ncurses's builtin" +#endif #if USE_LIBPANEL ," -s msec specify nominal time for panel-demo (default: 1, to hold)" #endif -#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) +#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) && !defined(_WIN32) ," -T call use_tioctl(TRUE) to allow SIGWINCH to override environment" #endif #ifdef TRACE ," -t mask specify default trace-level (may toggle with ^T)" +#endif +#if HAVE_COLOR_CONTENT + ," -x use xterm-compatible control for reading color palette" #endif }; size_t n; @@ -6749,56 +7720,85 @@ rip_header(WINDOW *win, int cols) static void main_menu(bool top) { - char command; - - do { - (void) puts("This is the ncurses main menu"); - (void) puts("a = keyboard and mouse input test"); #if USE_WIDEC_SUPPORT - (void) puts("A = wide-character keyboard and mouse input test"); -#endif - (void) puts("b = character attribute test"); -#if USE_WIDEC_SUPPORT - (void) puts("B = wide-character attribute test"); + typedef struct { + bool recur; + int (*narrow_func) (bool); + int (*wide_func) (bool); + int code; + const char *help; + } MyCmds; +#define BOTH(a) a, x_ ## a +#define ONLY(a) a, NULL +#define CMDS(recur, funcs,code,help) { recur, funcs, code, help } +#else + typedef struct { + bool recur; + int (*narrow_func) (bool); + int code; + const char *help; + } MyCmds; +#define BOTH(a) a +#define ONLY(a) a +#define CMDS(recur, funcs,code,help) { recur, funcs, code, help } #endif - (void) puts("c = color test pattern"); -#if USE_WIDEC_SUPPORT - (void) puts("C = color test pattern using wide-character calls"); + /* *INDENT-OFF* */ + static MyCmds cmds[] = + { + CMDS(TRUE, BOTH(getch_test), 'a', "keyboard and mouse input test"), + CMDS(TRUE, BOTH(attr_test), 'b', "character attribute test"), + CMDS(TRUE, BOTH(color_test), 'c', "color test pattern"), +#if HAVE_COLOR_CONTENT + CMDS(FALSE, ONLY(color_edit), 'd', "edit RGB color values"), #endif - if (top) - (void) puts("d = edit RGB color values"); #if USE_SOFTKEYS - (void) puts("e = exercise soft keys"); -#if USE_WIDEC_SUPPORT - (void) puts("E = exercise soft keys using wide-characters"); -#endif + CMDS(TRUE, BOTH(slk_test), 'e', "exercise soft keys"), #endif - (void) puts("f = display ACS characters"); -#if USE_WIDEC_SUPPORT - (void) puts("F = display Wide-ACS characters"); -#endif - (void) puts("g = display windows and scrolling"); - (void) puts("i = test of flushinp()"); - (void) puts("k = display character attributes"); + CMDS(TRUE, BOTH(acs_test), 'f', "display ACS characters"), + CMDS(TRUE, ONLY(scroll_test), 'g', "display windows and scrolling"), + CMDS(TRUE, ONLY(flushinp_test), 'i', "test flushinp()"), + CMDS(TRUE, ONLY(sgr_attr_test), 'k', "display character attributes"), #if USE_LIBMENU - (void) puts("m = menu code test"); + CMDS(TRUE, ONLY(menu_test), 'm', "exercise menu library"), #endif #if USE_LIBPANEL - (void) puts("o = exercise panels library"); -#if USE_WIDEC_SUPPORT - (void) puts("O = exercise panels with wide-characters"); + CMDS(TRUE, BOTH(panel_test), 'o', "exercise panel library"), #endif +#if HAVE_NEWPAD + CMDS(TRUE, ONLY(pad_test), 'p', "exercise pad features"), #endif - (void) puts("p = exercise pad features"); - (void) puts("q = quit"); -#if USE_LIBFORM - (void) puts("r = exercise forms code"); + CMDS(TRUE, ONLY(NULL), 'q', "quit"), +#if USE_LIBMENU + CMDS(TRUE, ONLY(form_test), 'r', "exercise form library"), +#endif +#if HAVE_COPYWIN + CMDS(TRUE, BOTH(overlap_test), 's', "overlapping-refresh test"), #endif - (void) puts("s = overlapping-refresh test"); #if USE_LIBMENU && defined(TRACE) - (void) puts("t = set trace level"); + CMDS(TRUE, ONLY(trace_set), 't', "set trace level"), #endif - (void) puts("? = repeat this command summary"); + CMDS(TRUE, ONLY(settings_test), 'v', "show terminal name and settings"), + CMDS(FALSE, ONLY(NULL), '?', "repeat this command summary") + }; + /* *INDENT-ON* */ + + int (*doit) (bool); + char command; + unsigned n; + + do { + printf("This is the ncurses main menu (uppercase for wide-characters)\n"); + for (n = 0; n < SIZEOF(cmds); ++n) { + if (top || cmds[n].recur) { + putchar(' '); +#if USE_WIDEC_SUPPORT + if (cmds[n].wide_func) { + printf("%c,", toupper(cmds[n].code)); + } +#endif + printf("%c\t= %s\n", cmds[n].code, cmds[n].help); + } + } (void) fputs("> ", stdout); (void) fflush(stdout); /* necessary under SVr4 curses */ @@ -6812,8 +7812,14 @@ main_menu(bool top) for (;;) { char ch = '\0'; if (read(fileno(stdin), &ch, (size_t) 1) <= 0) { - if (command == 0) + int save_err = errno; + perror("\nOOPS"); + if (save_err == EINTR) { + clearerr(stdin); + continue; + } else if (command == 0) { command = 'q'; + } break; } else if (command == 0 && !isspace(UChar(ch))) { command = ch; @@ -6829,7 +7835,21 @@ main_menu(bool top) } } - if (do_single_test(command)) { + doit = NULL; + for (n = 0; n < SIZEOF(cmds); ++n) { + if (cmds[n].code == command) { + doit = cmds[n].narrow_func; + break; + } +#if USE_WIDEC_SUPPORT + if (toupper(cmds[n].code) == command) { + doit = cmds[n].wide_func; + break; + } +#endif + } + + if (doit != NULL && doit(FALSE) == OK) { /* * This may be overkill; it's intended to reset everything back * to the initial terminal modes so that tests don't get in @@ -6860,28 +7880,34 @@ main_menu(bool top) main(argc,argv) --------------------------------------------------------------------------*/ -#define okCOLOR(n) ((n) >= 0 && (n) < max_colors) -#define okRGB(n) ((n) >= 0 && (n) <= 1000) - int main(int argc, char *argv[]) { int c; int my_e_param = 1; -#ifdef NCURSES_VERSION +#ifdef NCURSES_VERSION_PATCH +#if HAVE_USE_DEFAULT_COLORS int default_fg = COLOR_WHITE; int default_bg = COLOR_BLACK; - bool assumed_colors = FALSE; bool default_colors = FALSE; +#if HAVE_ASSUME_DEFAULT_COLORS + bool assumed_colors = FALSE; +#endif +#endif #endif - char *palette_file = 0; bool monochrome = FALSE; +#if HAVE_COLOR_CONTENT + bool xterm_colors = FALSE; + char *palette_file = 0; +#endif setlocale(LC_ALL, ""); - while ((c = getopt(argc, argv, "a:dEe:fhmp:s:Tt:")) != -1) { + while ((c = getopt(argc, argv, "a:dEe:fhmp:s:Tt:x")) != -1) { switch (c) { -#ifdef NCURSES_VERSION +#ifdef NCURSES_VERSION_PATCH +#if HAVE_USE_DEFAULT_COLORS +#if HAVE_ASSUME_DEFAULT_COLORS case 'a': assumed_colors = TRUE; switch (sscanf(optarg, "%d,%d", &default_fg, &default_bg)) { @@ -6893,13 +7919,17 @@ main(int argc, char *argv[]) break; } break; +#endif case 'd': default_colors = TRUE; break; #endif +#endif +#if HAVE_USE_ENV case 'E': use_env(FALSE); break; +#endif case 'e': my_e_param = atoi(optarg); #ifdef NCURSES_VERSION @@ -6921,15 +7951,17 @@ main(int argc, char *argv[]) case 'm': monochrome = TRUE; break; +#if HAVE_COLOR_CONTENT case 'p': palette_file = optarg; break; +#endif #if USE_LIBPANEL case 's': nap_msec = (int) atol(optarg); break; #endif -#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) +#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) && !defined(_WIN32) case 'T': use_tioctl(TRUE); break; @@ -6938,6 +7970,11 @@ main(int argc, char *argv[]) case 't': save_trace = (unsigned) strtol(optarg, 0, 0); break; +#endif +#if HAVE_COLOR_CONTENT + case 'x': + xterm_colors = TRUE; + break; #endif default: usage(); @@ -6952,10 +7989,10 @@ main(int argc, char *argv[]) #ifdef TRACE /* enable debugging */ #if !USE_LIBMENU - trace(save_trace); + curses_trace(save_trace); #else if (!isatty(fileno(stdin))) - trace(save_trace); + curses_trace(save_trace); #endif /* USE_LIBMENU */ #endif /* TRACE */ @@ -6973,17 +8010,20 @@ main(int argc, char *argv[]) initscr(); bkgdset(BLANK); + set_terminal_modes(); + def_prog_mode(); + /* tests, in general, will want these modes */ - use_colors = (bool) (monochrome ? FALSE : has_colors()); + UseColors = (bool) (monochrome ? FALSE : has_colors()); - if (use_colors) { + if (UseColors) { start_color(); #ifdef NCURSES_VERSION_PATCH - max_colors = COLORS; /* was > 16 ? 16 : COLORS */ + MaxColors = COLORS; /* was > 16 ? 16 : COLORS */ #if HAVE_USE_DEFAULT_COLORS if (default_colors) { use_default_colors(); - min_colors = -1; + MinColors = -1; } #if HAVE_ASSUME_DEFAULT_COLORS if (assumed_colors) @@ -6991,52 +8031,16 @@ main(int argc, char *argv[]) #endif #endif #else /* normal SVr4 curses */ - max_colors = COLORS; /* was > 8 ? 8 : COLORS */ + MaxColors = COLORS; /* was > 8 ? 8 : COLORS */ #endif max_pairs = COLOR_PAIRS; /* was > 256 ? 256 : COLOR_PAIRS */ +#if HAVE_COLOR_CONTENT if (can_change_color()) { - NCURSES_PAIRS_T cp; - all_colors = typeMalloc(RGB_DATA, (unsigned) max_colors); - if (!all_colors) - failed("all_colors"); - for (cp = 0; cp < max_colors; ++cp) { - color_content(cp, - &all_colors[cp].red, - &all_colors[cp].green, - &all_colors[cp].blue); - } - if (palette_file != 0) { - FILE *fp = fopen(palette_file, "r"); - if (fp != 0) { - char buffer[BUFSIZ]; - int red, green, blue; - int scale = 1000; - while (fgets(buffer, sizeof(buffer), fp) != 0) { - if (sscanf(buffer, "scale:%d", &c) == 1) { - scale = c; - } else if (sscanf(buffer, "%d:%d %d %d", - &c, - &red, - &green, - &blue) == 4 - && okCOLOR(c) - && okRGB(red) - && okRGB(green) - && okRGB(blue)) { -#define Scaled(n) (NCURSES_COLOR_T) (((n) * 1000) / scale) - all_colors[c].red = Scaled(red); - all_colors[c].green = Scaled(green); - all_colors[c].blue = Scaled(blue); - } - } - fclose(fp); - } - } + init_all_colors(xterm_colors, palette_file); } +#endif } - set_terminal_modes(); - def_prog_mode(); /* * Return to terminal mode, so we're guaranteed of being able to diff --git a/test/newdemo.c b/test/newdemo.c index fef092f2470c..d76523ab6ffd 100644 --- a/test/newdemo.c +++ b/test/newdemo.c @@ -2,7 +2,7 @@ * newdemo.c - A demo program using PDCurses. The program illustrate * the use of colours for text output. * - * $Id: newdemo.c,v 1.40 2013/04/27 19:46:53 tom Exp $ + * $Id: newdemo.c,v 1.47 2019/12/14 23:25:29 tom Exp $ */ #include @@ -50,7 +50,7 @@ static const char *messages[] = static void trap(int sig GCC_UNUSED) { - endwin(); + stop_curses(); ExitProgram(EXIT_FAILURE); } @@ -61,11 +61,12 @@ static int WaitForUser(WINDOW *win) { time_t t; - chtype key; nodelay(win, TRUE); t = time((time_t *) 0); + while (1) { + chtype key; if ((int) (key = (chtype) wgetch(win)) != ERR) { if (key == 'q' || key == 'Q') return 1; @@ -84,7 +85,7 @@ set_colors(WINDOW *win, int pair, int foreground, int background) if (pair > COLOR_PAIRS) pair = COLOR_PAIRS; init_pair((short) pair, (short) foreground, (short) background); - (void) wattrset(win, (int) COLOR_PAIR(pair)); + (void) wattrset(win, AttrArg(COLOR_PAIR(pair), 0)); } } @@ -96,7 +97,7 @@ use_colors(WINDOW *win, int pair, chtype attrs) pair = COLOR_PAIRS; attrs |= (chtype) COLOR_PAIR(pair); } - (void) wattrset(win, (int) attrs); + (void) wattrset(win, AttrArg(attrs, 0)); return attrs; } @@ -221,18 +222,14 @@ int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { WINDOW *win; - int w, x, y, i, j, k; + int x, y, i, k; char buffer[SIZEOF(messages) * 80]; - const char *message; int width, height; chtype save[80]; - chtype c; setlocale(LC_ALL, ""); - CATCHALL(trap); - - initscr(); + InitAndCatch(initscr(), trap); if (has_colors()) start_color(); cbreak(); @@ -241,11 +238,16 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) height = 14; /* Create a drawing window */ win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2); if (win == NULL) { - endwin(); + stop_curses(); ExitProgram(EXIT_FAILURE); } while (1) { + int w; + int j; + chtype c; + const char *message; + set_colors(win, 1, COLOR_WHITE, COLOR_BLUE); werase(win); @@ -299,11 +301,11 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) message = messages[j = 0]; i = 1; w = width - 2; - strcpy(buffer, message); + _nc_STRCPY(buffer, message, sizeof(buffer)); while (j < NMESSAGES) { while ((int) strlen(buffer) < w) { - strcat(buffer, " ... "); - strcat(buffer, messages[++j % NMESSAGES]); + _nc_STRCAT(buffer, " ... ", sizeof(buffer)); + _nc_STRCAT(buffer, messages[++j % NMESSAGES], sizeof(buffer)); } if (i < w) @@ -360,6 +362,6 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) if (WaitForUser(win) == 1) break; } - endwin(); + stop_curses(); ExitProgram(EXIT_SUCCESS); } diff --git a/test/package/debian-mingw/compat b/test/package/debian-mingw/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/test/package/debian-mingw/compat @@ -0,0 +1 @@ +9 diff --git a/test/package/debian-mingw/control b/test/package/debian-mingw/control new file mode 100644 index 000000000000..64bd01b1832d --- /dev/null +++ b/test/package/debian-mingw/control @@ -0,0 +1,18 @@ +Source: ncurses-examples +Maintainer: Thomas E. Dickey +Section: misc +Priority: optional +Standards-Version: 3.8.4 +Build-Depends: debhelper (>= 5) +Homepage: https://invisible-island.net/ncurses/ncurses-examples.html + +Package: mingw32-ncurses-examples +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: example/test programs from ncurses + These are the example/test programs from the ncurses distribution. + . + This package is used for testing ABI 6 with the MinGW 32-bit port. + . + This package installs in "bin/ncurses-examples" to avoid conflict with other + packages. diff --git a/test/package/debian-mingw/copyright b/test/package/debian-mingw/copyright new file mode 100644 index 000000000000..9b2b7aad1b4f --- /dev/null +++ b/test/package/debian-mingw/copyright @@ -0,0 +1,78 @@ +Upstream source https://invisible-island.net/ncurses/ncurses-examples.html + +Current ncurses maintainer: Thomas Dickey + +------------------------------------------------------------------------------- +Files: * +Copyright: 1998-2019,2020 Free Software Foundation, Inc. +Licence: X11 + +Files: aclocal.m4 package +Copyright: 2003-2019,2020 by Thomas E. Dickey +Licence: X11 + + 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. + +------------------------------------------------------------------------------- +Files: install-sh +Copyright: 1994 X Consortium +Licence: X11 + + 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, 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 + X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- + TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name of the X Consortium shall not + be used in advertising or otherwise to promote the sale, use or other deal- + ings in this Software without prior written authorization from the X Consor- + tium. + + FSF changes to this file are in the public domain. + + Calling this script install-sh is preferred over install.sh, to prevent + `make' implicit rules from creating a file called install from it + when there is no Makefile. + + This script is compatible with the BSD install script, but was written + from scratch. It can only install one file at a time, a restriction + shared with many OS's install programs. + +On Debian systems, the complete text of the GNU General +Public License can be found in '/usr/share/common-licenses/GPL-2' + +-- vile: txtmode file-encoding=utf-8 diff --git a/test/package/debian-mingw/docs b/test/package/debian-mingw/docs new file mode 100644 index 000000000000..e845566c06f9 --- /dev/null +++ b/test/package/debian-mingw/docs @@ -0,0 +1 @@ +README diff --git a/test/package/debian-mingw/rules b/test/package/debian-mingw/rules new file mode 100755 index 000000000000..e61cf71a3fa3 --- /dev/null +++ b/test/package/debian-mingw/rules @@ -0,0 +1,101 @@ +#!/usr/bin/make -f +# Made with the aid of dh_make, by Craig Small +# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. +# Some lines taken from debmake, by Cristoph Lameter. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion +CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic + +NCURSES_PKG = ncurses-examples + +TARGET = i686-w64-mingw32 +MINGW_BIN = /usr/bin +MINGW_TOP = /usr/$(TARGET) +MINGW_TMP = $(CURDIR)/debian/mingw32-ncurses-examples + +CFLAGS = $(CC_NORMAL) + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + + +configure: configure-stamp +configure-stamp: + dh_testdir + + CFLAGS="$(CFLAGS)" ./configure \ + --host=$(TARGET) \ + --target=$(TARGET) \ + --prefix=$(MINGW_TOP) \ + --bindir=\$${prefix}/bin/$(NCURSES_PKG) \ + --datadir=\$${prefix}/share/$(NCURSES_PKG) \ + --with-screen=ncursesw6 \ + --with-pkg-config-libdir=/usr/$(TARGET)/lib/pkgconfig + + touch configure-stamp + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + + [ ! -f makefile ] || $(MAKE) distclean + + rm -f configure-stamp build-stamp install-stamp + + dh_clean + +install: install-stamp +install-stamp: build-stamp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + $(MAKE) install DESTDIR=$(MINGW_TMP) + + touch install-stamp + +# Build architecture-independent files here. +binary-indep: build install +# No binary-indep target. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installchangelogs NEWS + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install install-stamp diff --git a/test/package/debian-mingw/source/format b/test/package/debian-mingw/source/format new file mode 100644 index 000000000000..89ae9db8f88b --- /dev/null +++ b/test/package/debian-mingw/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/test/package/debian-mingw/watch b/test/package/debian-mingw/watch new file mode 100644 index 000000000000..ec075b189b01 --- /dev/null +++ b/test/package/debian-mingw/watch @@ -0,0 +1,4 @@ +version=3 + +opts=passive ftp://ftp.invisible-island.net/ncurses-examples/ncurses-examples-([\d.]+)\.tgz \ + debian uupdate diff --git a/test/package/debian-mingw64/compat b/test/package/debian-mingw64/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/test/package/debian-mingw64/compat @@ -0,0 +1 @@ +9 diff --git a/test/package/debian-mingw64/control b/test/package/debian-mingw64/control new file mode 100644 index 000000000000..c22f262a8bf9 --- /dev/null +++ b/test/package/debian-mingw64/control @@ -0,0 +1,18 @@ +Source: ncurses-examples +Maintainer: Thomas E. Dickey +Section: misc +Priority: optional +Standards-Version: 3.8.4 +Build-Depends: debhelper (>= 5) +Homepage: https://invisible-island.net/ncurses/ncurses-examples.html + +Package: mingw64-ncurses-examples +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: example/test programs from ncurses + These are the example/test programs from the ncurses distribution. + . + This package is used for testing ABI 6 with the MinGW 64-bit port. + . + This package installs in "bin/ncurses-examples" to avoid conflict with other + packages. diff --git a/test/package/debian-mingw64/copyright b/test/package/debian-mingw64/copyright new file mode 100644 index 000000000000..9b2b7aad1b4f --- /dev/null +++ b/test/package/debian-mingw64/copyright @@ -0,0 +1,78 @@ +Upstream source https://invisible-island.net/ncurses/ncurses-examples.html + +Current ncurses maintainer: Thomas Dickey + +------------------------------------------------------------------------------- +Files: * +Copyright: 1998-2019,2020 Free Software Foundation, Inc. +Licence: X11 + +Files: aclocal.m4 package +Copyright: 2003-2019,2020 by Thomas E. Dickey +Licence: X11 + + 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. + +------------------------------------------------------------------------------- +Files: install-sh +Copyright: 1994 X Consortium +Licence: X11 + + 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, 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 + X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- + TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name of the X Consortium shall not + be used in advertising or otherwise to promote the sale, use or other deal- + ings in this Software without prior written authorization from the X Consor- + tium. + + FSF changes to this file are in the public domain. + + Calling this script install-sh is preferred over install.sh, to prevent + `make' implicit rules from creating a file called install from it + when there is no Makefile. + + This script is compatible with the BSD install script, but was written + from scratch. It can only install one file at a time, a restriction + shared with many OS's install programs. + +On Debian systems, the complete text of the GNU General +Public License can be found in '/usr/share/common-licenses/GPL-2' + +-- vile: txtmode file-encoding=utf-8 diff --git a/test/package/debian-mingw64/docs b/test/package/debian-mingw64/docs new file mode 100644 index 000000000000..e845566c06f9 --- /dev/null +++ b/test/package/debian-mingw64/docs @@ -0,0 +1 @@ +README diff --git a/test/package/debian-mingw64/rules b/test/package/debian-mingw64/rules new file mode 100755 index 000000000000..7db9c5acef1a --- /dev/null +++ b/test/package/debian-mingw64/rules @@ -0,0 +1,101 @@ +#!/usr/bin/make -f +# Made with the aid of dh_make, by Craig Small +# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. +# Some lines taken from debmake, by Cristoph Lameter. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion +CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic + +NCURSES_PKG = ncurses-examples + +TARGET = x86_64-w64-mingw32 +MINGW_BIN = /usr/bin +MINGW_TOP = /usr/$(TARGET) +MINGW_TMP = $(CURDIR)/debian/mingw64-ncurses-examples + +CFLAGS = $(CC_NORMAL) + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + + +configure: configure-stamp +configure-stamp: + dh_testdir + + CFLAGS="$(CFLAGS)" ./configure \ + --host=$(TARGET) \ + --target=$(TARGET) \ + --prefix=$(MINGW_TOP) \ + --bindir=\$${prefix}/bin/$(NCURSES_PKG) \ + --datadir=\$${prefix}/share/$(NCURSES_PKG) \ + --with-screen=ncursesw6 \ + --with-pkg-config-libdir=/usr/$(TARGET)/lib/pkgconfig + + touch configure-stamp + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + + [ ! -f makefile ] || $(MAKE) distclean + + rm -f configure-stamp build-stamp install-stamp + + dh_clean + +install: install-stamp +install-stamp: build-stamp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + $(MAKE) install DESTDIR=$(MINGW_TMP) + + touch install-stamp + +# Build architecture-independent files here. +binary-indep: build install +# No binary-indep target. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installchangelogs NEWS + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install install-stamp diff --git a/test/package/debian-mingw64/source/format b/test/package/debian-mingw64/source/format new file mode 100644 index 000000000000..89ae9db8f88b --- /dev/null +++ b/test/package/debian-mingw64/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/test/package/debian-mingw64/watch b/test/package/debian-mingw64/watch new file mode 100644 index 000000000000..ec075b189b01 --- /dev/null +++ b/test/package/debian-mingw64/watch @@ -0,0 +1,4 @@ +version=3 + +opts=passive ftp://ftp.invisible-island.net/ncurses-examples/ncurses-examples-([\d.]+)\.tgz \ + debian uupdate diff --git a/test/package/debian/compat b/test/package/debian/compat index 7ed6ff82de6b..ec635144f600 100644 --- a/test/package/debian/compat +++ b/test/package/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/test/package/debian/control b/test/package/debian/control index 520ad422ee93..d7647b3fdb8b 100644 --- a/test/package/debian/control +++ b/test/package/debian/control @@ -4,13 +4,23 @@ Section: misc Priority: optional Standards-Version: 3.8.4 Build-Depends: debhelper (>= 5) -Homepage: http://invisible-island.net/ncurses/ncurses-examples.html +Homepage: https://invisible-island.net/ncurses/ncurses-examples.html Package: ncurses-examples Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} -Description: ncurses-examples - example/test programs from ncurses +Description: example/test programs from ncurses These are the example/test programs from the ncurses distribution. . This package installs in "bin/ncurses-examples" to avoid conflict with other packages. + +Package: ncursest-examples +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: example/test programs from ncurses + These are the example/test programs from the ncurses distribution, using + the thread configuration. + . + This package installs in "bin/ncursest-examples" to avoid conflict with other + packages. diff --git a/test/package/debian/copyright b/test/package/debian/copyright index e681a6bd58af..9b2b7aad1b4f 100644 --- a/test/package/debian/copyright +++ b/test/package/debian/copyright @@ -1,9 +1,15 @@ -Upstream source http://invisible-island.net/ncurses/ncurses-examples.html +Upstream source https://invisible-island.net/ncurses/ncurses-examples.html Current ncurses maintainer: Thomas Dickey ------------------------------------------------------------------------------- - Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. +Files: * +Copyright: 1998-2019,2020 Free Software Foundation, Inc. +Licence: X11 + +Files: aclocal.m4 package +Copyright: 2003-2019,2020 by Thomas E. Dickey +Licence: X11 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -28,11 +34,12 @@ Current ncurses maintainer: Thomas Dickey holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. -------------------------------------------------------------------------------- +------------------------------------------------------------------------------- Files: install-sh Copyright: 1994 X Consortium -Licence: other-BSD +Licence: X11 + 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 @@ -67,3 +74,5 @@ Licence: other-BSD On Debian systems, the complete text of the GNU General Public License can be found in '/usr/share/common-licenses/GPL-2' + +-- vile: txtmode file-encoding=utf-8 diff --git a/test/package/debian/rules b/test/package/debian/rules index 4d4146b8c98f..4e6d570ecc88 100755 --- a/test/package/debian/rules +++ b/test/package/debian/rules @@ -1,17 +1,26 @@ #!/usr/bin/make -f -# MAde with the aid of dh_make, by Craig Small +# Made with the aid of dh_make, by Craig Small # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. # Some lines taken from debmake, by Cristoph Lameter. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +# packages +NCURSES_PKG = ncurses-examples +NCURSEST_PKG = ncursest-examples + +PACKAGES.indep = # ncurses-examples-docs +PACKAGES.arch = $(NCURSES_PKG) $(NCURSEST_PKG) + # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -CFLAGS = +CFLAGS = $(shell dpkg-buildflags --get CFLAGS) +CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) +LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 @@ -22,69 +31,134 @@ ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif +verbose = # -v -configure: configure-stamp -configure-stamp: - dh_testdir - - CFLAGS="$(CFLAGS)" ./configure \ +configure = \ + CFLAGS="$(CFLAGS)" \ + CPPFLAGS="$(CPPFLAGS)" \ + LDFLAGS="$(LDFLAGS)" ../../configure \ --host=$(DEB_HOST_GNU_TYPE) \ --build=$(DEB_BUILD_GNU_TYPE) \ - --bindir=\$${prefix}/bin/ncurses-examples \ --prefix=/usr \ - --with-ncursesw \ --disable-rpath-hack - touch configure-stamp +.PHONY: all config build install binary clean config-indep config-arch \ + build-indep build-arch install-indep install-arch binary-indep \ + binary-arch + +all: build -build: build-stamp -build-stamp: configure-stamp +config: config-indep config-arch +build: build-indep build-arch +install: install-indep install-arch +binary: binary-indep binary-arch +clean: dh_testdir + dh_testroot + dh_clean $(verbose) + rm -rf t - $(MAKE) +config-indep: $(PACKAGES.indep:%=config-%-stamp) +config-arch: $(PACKAGES.arch:%=config-%-stamp) - touch build-stamp +build-indep: $(PACKAGES.indep:%=build-%-stamp) +build-arch: $(PACKAGES.arch:%=build-%-stamp) -clean: +install-indep: $(PACKAGES.indep:%=install-%-stamp) +install-arch: $(PACKAGES.arch:%=install-%-stamp) + +config-$(NCURSES_PKG)-stamp: dh_testdir - dh_testroot - [ ! -f makefile ] || $(MAKE) distclean + rm -rf t/ncurses6 + mkdir -p t/ncurses6 - rm -f configure-stamp build-stamp install-stamp + cd t/ncurses6; $(configure) \ + --bindir=\$${prefix}/bin/$(NCURSES_PKG) \ + --datadir=\$${prefix}/share/$(NCURSES_PKG) \ + --with-screen=ncursesw6 - dh_clean + touch $@ -install: install-stamp -install-stamp: build-stamp +config-$(NCURSEST_PKG)-stamp: + dh_testdir + + rm -rf t/ncursest6 + mkdir -p t/ncursest6 + + cd t/ncursest6; $(configure) \ + --bindir=\$${prefix}/bin/$(NCURSEST_PKG) \ + --datadir=\$${prefix}/share/$(NCURSEST_PKG) \ + --with-screen=ncursestw6 + + touch $@ + +build-$(NCURSES_PKG)-stamp: config-$(NCURSES_PKG)-stamp + dh_testdir + + $(MAKE) -C t/ncurses6 + + touch $@ + +build-$(NCURSEST_PKG)-stamp: config-$(NCURSEST_PKG)-stamp + dh_testdir + + $(MAKE) -C t/ncursest6 + + touch $@ + +install-$(NCURSES_PKG)-stamp: build-$(NCURSES_PKG)-stamp dh_testdir dh_testroot - dh_clean -k - dh_installdirs + dh_installdirs $(verbose) + dh_prep $(verbose) -p$(NCURSES_PKG) + + $(MAKE) -C t/ncurses6 install DESTDIR=$(CURDIR)/debian/$(NCURSES_PKG) - $(MAKE) install DESTDIR=$(CURDIR)/debian/ncurses-examples + touch $@ - touch install-stamp +install-$(NCURSEST_PKG)-stamp: build-$(NCURSEST_PKG)-stamp + dh_testdir + dh_testroot + dh_installdirs $(verbose) + dh_prep $(verbose) -p$(NCURSEST_PKG) + + $(MAKE) -C t/ncursest6 install DESTDIR=$(CURDIR)/debian/$(NCURSEST_PKG) + + touch $@ # Build architecture-independent files here. -binary-indep: build install -# No binary-indep target. +binary-indep: install-indep +ifneq ($(PACKAGES.indep),) + rm -f $(PACKAGES.indep:%=install-%-stamp) + dh_testdir + dh_testroot + dh_installdocs $(verbose) $(PACKAGES.indep:%=-p%) + dh_installman $(verbose) $(PACKAGES.indep:%=-p%) + dh_installexamples $(verbose) $(PACKAGES.indep:%=-p%) + dh_installchangelogs $(verbose) $(PACKAGES.indep:%=-p%) NEWS + dh_compress $(verbose) $(PACKAGES.indep:%=-p%) + dh_fixperms $(verbose) $(PACKAGES.indep:%=-p%) + dh_installdeb $(verbose) $(PACKAGES.indep:%=-p%) + dh_gencontrol $(verbose) $(PACKAGES.indep:%=-p%) + dh_md5sums $(verbose) $(PACKAGES.indep:%=-p%) + dh_builddeb $(verbose) $(PACKAGES.indep:%=-p%) +endif # Build architecture-dependent files here. -binary-arch: build install +binary-arch: install-arch +ifneq ($(PACKAGES.arch),) + rm -f $(PACKAGES.arch:%=install-%-stamp) dh_testdir dh_testroot - dh_installdocs - dh_installexamples - dh_installchangelogs NEWS - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install install-stamp + dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%) NEWS + dh_strip $(verbose) $(PACKAGES.arch:%=-p%) + dh_compress $(verbose) $(PACKAGES.arch:%=-p%) + dh_fixperms $(verbose) $(PACKAGES.arch:%=-p%) + dh_installdeb $(verbose) $(PACKAGES.arch:%=-p%) + dh_makeshlibs $(verbose) $(PACKAGES.arch:%=-p%) + dh_shlibdeps $(verbose) $(PACKAGES.arch:%=-p%) + dh_gencontrol $(verbose) $(PACKAGES.arch:%=-p%) + dh_md5sums $(verbose) $(PACKAGES.arch:%=-p%) + dh_builddeb $(verbose) $(PACKAGES.arch:%=-p%) +endif diff --git a/test/package/debian/watch b/test/package/debian/watch index 1d080986dafe..ec075b189b01 100644 --- a/test/package/debian/watch +++ b/test/package/debian/watch @@ -1,4 +1,4 @@ version=3 -opts=passive ftp://invisible-island.net/ncurses-examples/ncurses-examples-([\d.]+)\.tgz \ +opts=passive ftp://ftp.invisible-island.net/ncurses-examples/ncurses-examples-([\d.]+)\.tgz \ debian uupdate diff --git a/test/package/mingw-ncurses-examples.spec b/test/package/mingw-ncurses-examples.spec index fdc2a69fac7c..5758c29097a5 100644 --- a/test/package/mingw-ncurses-examples.spec +++ b/test/package/mingw-ncurses-examples.spec @@ -1,17 +1,17 @@ Summary: ncurses-examples - example/test programs from ncurses %?mingw_package_header -%define AppProgram ncurses-examples -%define AppVersion MAJOR.MINOR -%define AppRelease YYYYMMDD -# $Id: mingw-ncurses-examples.spec,v 1.3 2013/10/26 23:30:21 tom Exp $ +%global AppProgram ncurses-examples +%global AppVersion MAJOR.MINOR +%global AppRelease YYYYMMDD +# $Id: mingw-ncurses-examples.spec,v 1.9 2019/11/23 21:13:52 tom Exp $ Name: mingw32-ncurses6-examples Version: %{AppVersion} Release: %{AppRelease} License: X11 Group: Development/Libraries Source: ncurses-examples-%{release}.tgz -# URL: http://invisible-island.net/ncurses/ +# URL: https://invisible-island.net/ncurses/ BuildRequires: mingw32-ncurses6 @@ -53,10 +53,14 @@ This package is used for testing ABI 6 with cross-compiles to MinGW. %global mingw32_bindir %{mingw32_exec_prefix}/bin/%{AppProgram} %global mingw64_bindir %{mingw64_exec_prefix}/bin/%{AppProgram} +%global mingw32_datadir %{mingw32_datadir}/%{AppProgram} +%global mingw64_datadir %{mingw64_datadir}/%{AppProgram} + %define CFG_OPTS \\\ - --disable-echo \\\ - --enable-warnings \\\ - --verbose + --enable-echo \\\ + --enable-warnings \\\ + --verbose \\\ + --with-screen=ncursesw6 %define debug_package %{nil} %setup -q -n ncurses-examples-%{release} @@ -66,8 +70,9 @@ mkdir BUILD-W32 pushd BUILD-W32 CFLAGS="%{CC_NORMAL}" \ CC=%{mingw32_cc} \ -%mingw32_configure %{CFG_OPTS} -cp config.status /tmp/ming32-config.status +NCURSES_CONFIG_SUFFIX=dev \ +%mingw32_configure %{CFG_OPTS} \ + --datadir=%{mingw32_datadir} make popd @@ -75,8 +80,8 @@ mkdir BUILD-W64 pushd BUILD-W64 CFLAGS="%{CC_NORMAL}" \ CC=%{mingw64_cc} \ -%mingw64_configure %{CFG_OPTS} -cp config.status /tmp/ming64-config.status +%mingw64_configure %{CFG_OPTS} \ + --datadir=%{mingw32_datadir} make popd @@ -92,18 +97,27 @@ pushd BUILD-W64 popd %clean -rm -rf $RPM_BUILD_ROOT +if rm -rf $RPM_BUILD_ROOT; then + echo OK +else + find $RPM_BUILD_ROOT -type f | grep -F -v /.nfs && exit 1 +fi +exit 0 -%files %defattr(-,root,root,-) %files -n mingw32-ncurses6-examples %{mingw32_bindir}/* +%{mingw32_datadir}/* %files -n mingw64-ncurses6-examples %{mingw64_bindir}/* +%{mingw64_datadir}/* %changelog +* Sat Nov 16 2019 Thomas Dickey +- modify clean-rule to work around Fedora NFS bugs. + * Sat Oct 19 2013 Thomas E. Dickey - initial version diff --git a/test/package/ncurses-examples.spec b/test/package/ncurses-examples.spec index 8a016780800d..d2b5a84e7e8b 100644 --- a/test/package/ncurses-examples.spec +++ b/test/package/ncurses-examples.spec @@ -1,14 +1,15 @@ -Summary: ncurses-examples - example/test programs from ncurses -%define AppProgram ncurses-examples -%define AppVersion MAJOR.MINOR -%define AppRelease YYYYMMDD -# $Id: ncurses-examples.spec,v 1.3 2013/10/05 23:44:19 tom Exp $ +Summary: example/test programs from ncurses +%global AppProgram ncurses-examples +%global AltProgram ncursest-examples +%global AppVersion MAJOR.MINOR +%global AppRelease YYYYMMDD +# $Id: ncurses-examples.spec,v 1.16 2019/11/23 21:11:34 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: %{AppRelease} License: MIT Group: Applications/Development -URL: ftp://invisible-island.net/%{AppProgram} +URL: ftp://ftp.invisible-island.net/%{AppProgram} Source0: %{AppProgram}-%{AppRelease}.tgz Packager: Thomas Dickey @@ -16,40 +17,102 @@ Packager: Thomas Dickey These are the example/test programs from the ncurses MAJOR.MINOR distribution, for patch-date YYYYMMDD. -This package installs in "bin/ncurses-examples" to avoid conflict with other +This package installs in "bin/%{AppProgram}" to avoid conflict with other packages. + +%package -n %{AltProgram} +Summary: examples/test programs from ncurses with POSIX thread support + +%description -n %{AltProgram} +These are the example/test programs from the ncurses MAJOR.MINOR distribution, +for patch-date YYYYMMDD, using the "ncurseswt" library to demonstrate the +use of POSIX threads, e.g., in ditto, rain, and worm. + +This package installs in "bin/%{AltProgram}" to avoid conflict with other +packages. + %prep %setup -q -n %{AppProgram}-%{AppRelease} +%define debug_package %{nil} + %build +%global _configure ../configure +%define my_srcdir .. + +mkdir BUILD-%{AppProgram} +pushd BUILD-%{AppProgram} INSTALL_PROGRAM='${INSTALL}' \ - ./configure \ - --target %{_target_platform} \ - --prefix=%{_prefix} \ - --bindir=%{_bindir}/%{AppProgram} \ - --with-ncursesw \ - --disable-rpath-hack +NCURSES_CONFIG_SUFFIX=dev \ +CONFIGURE_TOP=%{my_srcdir} \ +%configure \ + --target %{_target_platform} \ + --prefix=%{_prefix} \ + --bindir=%{_bindir}/%{AppProgram} \ + --datadir=%{_datadir}/%{AppProgram} \ + --with-screen=ncursesw6dev \ + --disable-rpath-hack make +popd + +mkdir BUILD-%{AltProgram} +pushd BUILD-%{AltProgram} +INSTALL_PROGRAM='${INSTALL}' \ +NCURSES_CONFIG_SUFFIX=dev \ +CONFIGURE_TOP=%{my_srcdir} \ +%configure \ + --target %{_target_platform} \ + --prefix=%{_prefix} \ + --bindir=%{_bindir}/%{AltProgram} \ + --datadir=%{_datadir}/%{AltProgram} \ + --with-screen=ncursestw6dev \ + --disable-rpath-hack + +make +popd %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT +pushd BUILD-%{AppProgram} +make install DESTDIR=$RPM_BUILD_ROOT +popd -strip $RPM_BUILD_ROOT%{_bindir}/%{AppProgram}/* +pushd BUILD-%{AltProgram} +make install DESTDIR=$RPM_BUILD_ROOT +popd %clean -[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT +if rm -rf $RPM_BUILD_ROOT; then + echo OK +else + find $RPM_BUILD_ROOT -type f | grep -F -v /.nfs && exit 1 +fi +exit 0 -%files +%files -n %{AppProgram} %defattr(-,root,root) %{_bindir}/%{AppProgram}/* +%{_datadir}/%{AppProgram}/* + +%files -n %{AltProgram} +%defattr(-,root,root) +%{_bindir}/%{AltProgram}/* +%{_datadir}/%{AltProgram}/* %changelog # each patch should add its ChangeLog entries here +* Sat Nov 16 2019 Thomas Dickey +- modify clean-rule to work around Fedora NFS bugs. + +* Sat Nov 11 2017 Thomas Dickey +- add example data-files +- use rpm built-in "configure" +- suppress debug-package + * Thu Mar 25 2010 Thomas Dickey - initial version diff --git a/test/padview.c b/test/padview.c new file mode 100644 index 000000000000..60f800ffac75 --- /dev/null +++ b/test/padview.c @@ -0,0 +1,528 @@ +/**************************************************************************** + * Copyright (c) 2017,2019 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. * + ****************************************************************************/ +/* + * clone of view.c, using pads + * + * $Id: padview.c,v 1.15 2019/12/07 18:06:12 tom Exp $ + */ + +#include +#include +#include + +#include +#include + +#if HAVE_NEWPAD + +static void finish(int sig) GCC_NORETURN; + +#define my_pair 1 + +static int shift = 0; +static bool try_color = FALSE; + +static char *fname; +static int num_lines; + +#if USE_WIDEC_SUPPORT +static bool n_option = FALSE; +#endif + +static void usage(void) GCC_NORETURN; + +static void +failed(const char *msg) +{ + endwin(); + fprintf(stderr, "%s\n", msg); + ExitProgram(EXIT_FAILURE); +} + +static void +finish(int sig) +{ + endwin(); + ExitProgram(sig != 0 ? EXIT_FAILURE : EXIT_SUCCESS); +} + +static void +show_all(const char *tag, WINDOW *my_pad, int my_row) +{ + int i; + int digits; + char temp[BUFSIZ]; + time_t this_time; + + for (digits = 1, i = num_lines; i > 0; i /= 10) { + ++digits; + } + + wattrset(stdscr, COLOR_PAIR(my_pair)); + clear(); + + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "view %.*s", (int) strlen(tag), tag); + i = (int) strlen(temp); + _nc_SPRINTF(temp + i, _nc_SLIMIT(sizeof(temp) - (size_t) i) + " %.*s", (int) sizeof(temp) - i - 2, fname); + mvprintw(0, 0, "%.*s", COLS, temp); + this_time = time((time_t *) 0); + _nc_STRNCPY(temp, ctime(&this_time), (size_t) 30); + if ((i = (int) strlen(temp)) != 0) { + temp[--i] = 0; + mvprintw(0, COLS - i - 2, " %s", temp); + } + + for (i = 1; i < LINES; i++) { + int actual = my_row + i; + if (actual > num_lines) { + break; + } + mvprintw(i, 0, "%*d:", digits, actual); + } + wnoutrefresh(stdscr); + pnoutrefresh(my_pad, my_row, shift, 1, digits + 1, LINES - 1, COLS - 1); + doupdate(); +} + +static WINDOW * +read_file(const char *filename) +{ + FILE *fp; + int pass; + int k; + int height, width; + size_t j; + size_t len; + struct stat sb; + char *my_blob; + char **my_vec = 0; + WINDOW *my_pad; + + if (stat(filename, &sb) != 0 + || (sb.st_mode & S_IFMT) != S_IFREG) { + failed("input is not a file"); + } + + if (sb.st_size == 0) { + failed("input is empty"); + } + + if ((fp = fopen(filename, "r")) == 0) { + failed("cannot open input-file"); + } + + if ((my_blob = malloc((size_t) sb.st_size + 1)) == 0) { + failed("cannot allocate memory for input-file"); + } + + len = fread(my_blob, sizeof(char), (size_t) sb.st_size, fp); + my_blob[sb.st_size] = '\0'; + fclose(fp); + + for (pass = 0; pass < 2; ++pass) { + char *base = my_blob; + k = 0; + for (j = 0; j < len; ++j) { + if (my_blob[j] == '\n') { + if (pass) { + my_vec[k] = base; + my_blob[j] = '\0'; + } + base = my_blob + j + 1; + ++k; + } + } + num_lines = k; + if (base != (my_blob + j)) + ++num_lines; + if (!pass && + ((my_vec = typeCalloc(char *, (size_t) k + 2)) == 0)) { + failed("cannot allocate line-vector #1"); + } + } + +#if USE_WIDEC_SUPPORT + if (!memcmp("\357\273\277", my_blob, 3)) { + char *s = my_blob + 3; + char *d = my_blob; + Trace(("trim BOM")); + do { + } while ((*d++ = *s++) != '\0'); + } +#endif + + height = num_lines; + width = (int) strlen(my_vec[0]); + for (k = 1; my_vec[k]; ++k) { + int check = (int) (my_vec[k] - my_vec[k - 1]); + if (width < check) + width = check; + } + width = (width + 1) * 5; + my_pad = newpad(height, width); + if (my_pad == 0) + failed("cannot allocate pad workspace"); + if (try_color) { + wattrset(my_pad, COLOR_PAIR(my_pair)); + wbkgd(my_pad, (chtype) (' ' | COLOR_PAIR(my_pair))); + } + + /* + * Use the curses library for rendering, including tab-conversion. + */ + Trace(("slurp the file")); + for (k = 0; my_vec[k]; ++k) { + char *s; +#if USE_WIDEC_SUPPORT + char *last = my_vec[k] + (int) strlen(my_vec[k]); + wchar_t wch[2]; + size_t rc; +#ifndef state_unused + mbstate_t state; +#endif +#endif /* USE_WIDEC_SUPPORT */ + + wmove(my_pad, k, 0); +#if USE_WIDEC_SUPPORT + wch[1] = 0; + reset_mbytes(state); +#endif + for (s = my_vec[k]; *s != '\0'; ++s) { +#if USE_WIDEC_SUPPORT + if (!n_option) { + rc = (size_t) check_mbytes(wch[0], s, (size_t) (last - s), state); + if ((long) rc == -1 || (long) rc == -2) { + break; + } + s += rc - 1; + waddwstr(my_pad, wch); + } else +#endif + waddch(my_pad, *s & 0xff); + } + } + + free(my_vec); + free(my_blob); + + return my_pad; +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: view [options] file" + ,"" + ,"Options:" + ," -c use color if terminal supports it" + ," -i ignore INT, QUIT, TERM signals" +#if USE_WIDEC_SUPPORT + ," -n use waddch (bytes) rather then wadd_wch (wide-chars)" +#endif + ," -s start in single-step mode, waiting for input" +#ifdef TRACE + ," -t trace screen updates" + ," -T NUM specify trace mask" +#endif + }; + size_t n; + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc, char *argv[]) +{ + static const char *help[] = + { + "Commands:", + " q,^Q,ESC - quit this program", + "", + " p, - scroll the viewport up by one row", + " n, - scroll the viewport down by one row", + " l, - scroll the viewport left by one column", + " r, - scroll the viewport right by one column", + " <,> - scroll the viewport left/right by 8 columns", + "", + " h, - scroll the viewport to top of file", + " ^F, - scroll to the next page", + " ^B, - scroll to the previous page", + " e, - scroll the viewport to end of file", + "", + " ^L - repaint using redrawwin()", + "", + " 0 through 9 - enter digits for count", + " s - use entered count for halfdelay() parameter", + " - if no entered count, stop nodelay()", + " - begin nodelay()", + 0 + }; + + int i; + int my_delay = 0; + WINDOW *my_pad; + int my_row = 0; + int value = 0; + bool done = FALSE; + bool got_number = FALSE; + bool ignore_sigs = FALSE; + bool single_step = FALSE; + const char *my_label = "Input"; + + setlocale(LC_ALL, ""); + + while ((i = getopt(argc, argv, "cinstT:")) != -1) { + switch (i) { + case 'c': + try_color = TRUE; + break; + case 'i': + ignore_sigs = TRUE; + break; +#if USE_WIDEC_SUPPORT + case 'n': + n_option = TRUE; + break; +#endif + case 's': + single_step = TRUE; + break; +#ifdef TRACE + case 'T': + { + char *next = 0; + int tvalue = (int) strtol(optarg, &next, 0); + if (tvalue < 0 || (next != 0 && *next != 0)) + usage(); + curses_trace((unsigned) tvalue); + } + break; + case 't': + curses_trace(TRACE_CALLS); + break; +#endif + default: + usage(); + } + } + if (optind + 1 != argc) + usage(); + + InitAndCatch(initscr(), ignore_sigs ? SIG_IGN : finish); + keypad(stdscr, TRUE); /* enable keyboard mapping */ + (void) nonl(); /* tell curses not to do NL->CR/NL on output */ + (void) cbreak(); /* take input chars one at a time, no wait for \n */ + (void) noecho(); /* don't echo input */ + if (!single_step) + nodelay(stdscr, TRUE); + idlok(stdscr, TRUE); /* allow use of insert/delete line */ + + if (try_color) { + if (has_colors()) { + start_color(); + init_pair(my_pair, COLOR_WHITE, COLOR_BLUE); + bkgd((chtype) (' ' | COLOR_PAIR(my_pair))); + } else { + try_color = FALSE; + } + } + + /* + * Do this after starting color, otherwise the pad's background will be + * uncolored after the ncurses 6.1.20181208 fixes. + */ + my_pad = read_file(fname = argv[optind]); + + my_row = 0; + while (!done) { + int n, c; + + if (!got_number) + show_all(my_label, my_pad, my_row); + + for (;;) { + c = getch(); + if ((c < 127) && isdigit(c)) { + if (!got_number) { + MvPrintw(0, 0, "Count: "); + clrtoeol(); + } + addch(UChar(c)); + value = 10 * value + (c - '0'); + got_number = TRUE; + } else + break; + } + if (got_number && value) { + n = value; + } else { + n = 1; + } + + if (c != ERR) + my_label = keyname(c); + switch (c) { + case KEY_DOWN: + case 'n': + for (i = 0; i < n; i++) + if (my_row < (num_lines - LINES + 1)) + my_row++; + else + break; + break; + + case KEY_UP: + case 'p': + for (i = 0; i < n; i++) + if (my_row > 0) + my_row--; + else + break; + break; + + case 'h': + /* FALLTHRU */ + case KEY_HOME: + my_row = 0; + break; + + case '<': + if ((shift -= 8) < 0) + shift = 0; + break; + case '>': + shift += 8; + break; + + case 'e': + /* FALLTHRU */ + case KEY_END: + if (num_lines > LINES) + my_row = (num_lines - LINES + 1); + else + my_row = (num_lines - 2); + break; + + case CTRL('F'): + /* FALLTHRU */ + case KEY_NPAGE: + for (i = 0; i < n; i++) { + if (my_row < (num_lines - 5)) + my_row += (LINES - 1); + else + my_row = (num_lines - 2); + } + break; + + case CTRL('B'): + /* FALLTHRU */ + case KEY_PPAGE: + for (i = 0; i < n; i++) { + if (my_row >= LINES) + my_row -= (LINES - 1); + else + my_row = 0; + } + break; + + case 'r': + case KEY_RIGHT: + shift += n; + break; + + case 'l': + case KEY_LEFT: + shift -= n; + if (shift < 0) { + shift = 0; + beep(); + } + break; + + case 'q': + case QUIT: + case ESCAPE: + done = TRUE; + break; + +#ifdef KEY_RESIZE + case KEY_RESIZE: /* ignore this; ncurses will repaint */ + break; +#endif + case 's': +#if HAVE_HALFDELAY + if (got_number) { + halfdelay(my_delay = n); + } else { + nodelay(stdscr, FALSE); + my_delay = -1; + } +#else + nodelay(stdscr, FALSE); + my_delay = -1; +#endif + break; + case ' ': + nodelay(stdscr, TRUE); + my_delay = 0; + break; + case CTRL('L'): + redrawwin(stdscr); + break; + case ERR: + if (!my_delay) + napms(50); + break; + case HELP_KEY_1: + popup_msg(stdscr, help); + break; + default: + beep(); + break; + } + if (c >= KEY_MIN || (c > 0 && !isdigit(c))) { + got_number = FALSE; + value = 0; + } + } + + finish(0); /* we're done */ +} +#else +int +main(void) +{ + printf("This program requires the curses pad functions\n"); + ExitProgram(EXIT_FAILURE); +} +#endif diff --git a/test/pair_content.c b/test/pair_content.c new file mode 100644 index 000000000000..2b39a7bc0ef1 --- /dev/null +++ b/test/pair_content.c @@ -0,0 +1,317 @@ +/**************************************************************************** + * Copyright (c) 2018,2019 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: pair_content.c,v 1.13 2019/08/24 23:02:49 tom Exp $ + */ + +#define NEED_TIME_H +#include + +#if USE_EXTENDED_COLOR +typedef int my_color_t; +#else +typedef NCURSES_COLOR_T my_color_t; +#endif + +typedef struct { + my_color_t fg; + my_color_t bg; +} MYPAIR; + +static int f_opt; +static int i_opt; +static int l_opt; +static int n_opt; +static int p_opt; +static int r_opt; +static int s_opt; + +#if USE_EXTENDED_COLOR +static int x_opt; +#endif + +static MYPAIR *expected; + +#if HAVE_GETTIMEOFDAY +static struct timeval initial_time; +static struct timeval finish_time; +#endif + +static void +failed(const char *msg) +{ + printw("%s", msg); + getch(); + endwin(); + ExitProgram(EXIT_FAILURE); +} + +#if USE_EXTENDED_COLOR +static int +InitPair(int pair, int fg, int bg) +{ + int rc; + if (x_opt) { + rc = init_extended_pair(pair, fg, bg); + } else { + rc = init_pair((NCURSES_PAIRS_T) pair, + (NCURSES_COLOR_T) fg, + (NCURSES_COLOR_T) bg); + } + return rc; +} + +static int +PairContent(int pair, int *fgp, int *bgp) +{ + int rc; + if (x_opt) { + rc = extended_pair_content(pair, fgp, bgp); + } else { + short fg, bg; + if ((rc = pair_content((short) pair, &fg, &bg)) == OK) { + *fgp = fg; + *bgp = bg; + } + } + return rc; +} +#else +#define InitPair(pair,fg,bg) init_pair((NCURSES_COLOR_T)pair,(NCURSES_COLOR_T)fg,(NCURSES_COLOR_T)bg) +#define PairContent(pair,fgp,bgp) pair_content((NCURSES_PAIRS_T)pair,fgp,bgp) +#endif + +static my_color_t +random_color(void) +{ + return (my_color_t) (rand() % COLORS); +} + +static void +setup_test(void) +{ + initscr(); + cbreak(); + noecho(); + scrollok(stdscr, TRUE); + if (has_colors()) { + start_color(); + + if (!f_opt) + f_opt = 1; + if (!l_opt) + l_opt = COLOR_PAIRS; + if (l_opt <= 1) + failed("color-pair limit must be greater than one"); + + if (!n_opt) { + int pair; + size_t need = (size_t) ((l_opt > COLOR_PAIRS) + ? l_opt + : COLOR_PAIRS) + 1; + + expected = typeCalloc(MYPAIR, need); + if (s_opt) { + my_color_t fg; + my_color_t bg; + pair = f_opt; + for (fg = 0; fg < COLORS; ++fg) { + for (bg = 0; bg < COLORS; ++bg) { + if (pair < l_opt) { + InitPair(pair, fg, bg); + expected[pair].fg = (my_color_t) fg; + expected[pair].bg = (my_color_t) bg; + ++pair; + } else { + break; + } + } + } + } else { + for (pair = f_opt; pair < l_opt; ++pair) { + expected[pair].fg = random_color(); + expected[pair].bg = random_color(); + InitPair(pair, expected[pair].fg, expected[pair].bg); + } + } + } + } else { + failed("This demo requires a color terminal"); + } +#if HAVE_GETTIMEOFDAY + gettimeofday(&initial_time, 0); +#endif +} + +static void +run_test(void) +{ + int pair; + bool success = TRUE; + for (pair = 1; pair < l_opt; ++pair) { + my_color_t fg; + my_color_t bg; + if (PairContent(pair, &fg, &bg) == OK) { + if (expected != 0) { + if (fg != expected[pair].fg) + success = FALSE; + if (bg != expected[pair].bg) + success = FALSE; + } + } + } + if (i_opt) { + addch(success ? '.' : '?'); + refresh(); + } +} + +static void +finish_test(void) +{ + getch(); + endwin(); +} + +#if HAVE_GETTIMEOFDAY +static double +seconds(struct timeval *mark) +{ + double result = (double) mark->tv_sec; + result += ((double) mark->tv_usec / 1e6); + return result; +} +#endif + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: pair_content [options]" + ,"" + ,"Options:" + ," -f PAIR first color pair to test (default: 1)" + ," -i interactive, showing test-progress" + ," -l PAIR last color pair to test (default: max_pairs-1)" + ," -n do not initialize color pairs" + ," -p print data for color pairs instead of testing" + ," -r COUNT repeat for given count" + ," -s initialize pairs sequentially rather than random" +#if USE_EXTENDED_COLOR + ," -x use extended color pairs/values" +#endif + }; + size_t n; + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + int i; + + while ((i = getopt(argc, argv, "f:il:npr:sx")) != -1) { + switch (i) { + case 'f': + if ((f_opt = atoi(optarg)) <= 0) + usage(); + break; + case 'i': + i_opt = 1; + break; + case 'l': + if ((l_opt = atoi(optarg)) <= 0) + usage(); + break; + case 'n': + n_opt = 1; + break; + case 'p': + p_opt = 1; + break; + case 'r': + if ((r_opt = atoi(optarg)) <= 0) + usage(); + break; + case 's': + s_opt = 1; + break; +#if USE_EXTENDED_COLOR + case 'x': + x_opt = 1; + break; +#endif + default: + usage(); + } + } + if (optind < argc) + usage(); + if (r_opt <= 0) + r_opt = 1; + + setup_test(); + if (p_opt) { + endwin(); + for (i = f_opt; i < l_opt; ++i) { + my_color_t fg, bg; + if (PairContent(i, &fg, &bg) == OK) { + printf("%d: %d %d\n", i, fg, bg); + } else { + printf("%d: ? ?\n", i); + } + } + } else { + int repeat; + + for (repeat = 0; repeat < r_opt; ++repeat) { + run_test(); + if (i_opt) { + addch('.'); + refresh(); + } + } + + if (i_opt) { + addch('\n'); + } + printw("DONE: "); +#if HAVE_GETTIMEOFDAY + gettimeofday(&finish_time, 0); + printw("%.03f seconds", + seconds(&finish_time) + - seconds(&initial_time)); +#endif + finish_test(); + } + + ExitProgram(EXIT_SUCCESS); +} diff --git a/test/parse_rgb.h b/test/parse_rgb.h new file mode 100644 index 000000000000..a0d093fe85bb --- /dev/null +++ b/test/parse_rgb.h @@ -0,0 +1,98 @@ +/**************************************************************************** + * Copyright (c) 2018 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: parse_rgb.h,v 1.4 2018/02/03 23:40:53 tom Exp $ + * + * Sample implementation of ncurses RGB extension from user_caps(5). + */ +#ifndef PARSE_RBG_H_incl +#define PARSE_RBG_H_incl 1 + +#include + +#if HAVE_TIGETSTR && USE_WIDEC_SUPPORT +static int +parse_rgb(int *r_max, int *g_max, int *b_max) +{ + int colors = tigetnum("colors"); + int result = ERR; + + *r_max = *g_max = *b_max = 0; + + if (colors > 0) { + int max_bits; + int bits; + int pwr2; + int r = 0, g = 0, b = 0; + char *data; + char ch; + + for (max_bits = 0, pwr2 = 1; + pwr2 < colors; + ++max_bits, pwr2 <<= 1) { + ; + } + + if (tigetflag("RGB") > 0) { + result = OK; + r = g = b = (max_bits + 2) / 3; + } else if ((bits = tigetnum("RGB")) > 0) { + result = OK; + r = g = b = bits; + } else if ((data = tigetstr("RGB")) != ABSENT_STRING + && data != CANCELLED_STRING + && sscanf(data, "%d/%d/%d%c", &r, &g, &b, &ch) == 3) { + result = OK; + } + + if ((r + g + b) < max_bits) { + result = ERR; + } else if (result == 0) { + if (r > max_bits) { + r = max_bits; + g = b = 0; + } + *r_max = r; + if (g > (max_bits -= r)) { + g = max_bits; + b = 0; + } + *g_max = g; + if (b > (max_bits -= g)) { + b = max_bits; + } + *b_max = b; + } + } + return result; +} +#else +#define parse_rgb(r,g,b) (ERR) +#endif + +#endif /* PARSE_RBG_H_incl */ diff --git a/test/picsmap.c b/test/picsmap.c new file mode 100644 index 000000000000..624eda889590 --- /dev/null +++ b/test/picsmap.c @@ -0,0 +1,1762 @@ +/**************************************************************************** + * Copyright (c) 2017-2018,2019 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: picsmap.c,v 1.131 2019/12/14 23:51:39 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 improve use of rgb-names using tsearch. + * + * TODO add option to dump picture in non-optimized mode, e.g., like tput. + * TODO write cells/second to stderr (or log) + * TODO write picture left-to-right/top-to-bottom + * TODO write picture randomly + * TODO add one-shot option vs repeat-count before exiting + * TODO add option "-xc" for init_color vs init_extended_color + * TODO add option "-xa" for init_pair vs alloc_pair + * TODO use pad to allow pictures larger than screen + * TODO add option to just use convert (which can scale) vs builtin xbm/xpm. + * TODO add scr_dump and scr_restore calls + * TODO add option for assume_default_colors + */ +#include + +#include +#include + +#if HAVE_STDINT_H +#include +#define my_intptr_t intptr_t +#else +#define my_intptr_t long +#endif + +#if HAVE_TSEARCH +#include +#endif + +#undef CUR /* use only the curses interface */ + +#define L_BLOCK '[' +#define R_BLOCK ']' + +#define L_CURLY '{' +#define R_CURLY '}' + +#define MaxSCALE 1000 /* input curses ranges 0..1000 */ +#define MaxRGB 255 /* output color ranges 0..255 */ +#define okCOLOR(n) ((n) >= 0 && (n) < COLORS) +#define okSCALE(n) ((n) >= 0 && (n) <= MaxSCALE) +#define Scaled256(n) (NCURSES_COLOR_T) (int)(((double)(n) * MaxSCALE) / 255) +#define ScaledColor(n) (NCURSES_COLOR_T) (int)(((double)(n) * MaxSCALE) / scale) + +#ifndef RGB_PATH +#define RGB_PATH "/etc/X11/rgb.txt" +#endif + +#include + +typedef struct { + size_t file; + size_t name; + size_t list; + size_t data; + size_t head; + size_t pair; + size_t cell; +} HOW_MUCH; + +#undef MAX +#define MAX(a,b) ((a)>(b)?(a):(b)) + +/* + * tfind will return null on failure, so we map subscripts starting at one. + */ +#define P2I(n) (((int)(my_intptr_t)(n)) - 1) +#define I2P(n) (void *)(my_intptr_t)((n) + 1) + +#define pause_curses() if (in_curses) stop_curses() + +#define debugmsg if (debugging) logmsg +#define debugmsg2 if (debugging) logmsg2 + +static void cleanup(int) GCC_NORETURN; +static void giveup(const char *fmt, ...) GCC_PRINTFLIKE(1, 2); +static void logmsg(const char *fmt, ...) GCC_PRINTFLIKE(1, 2); +static void logmsg2(const char *fmt, ...) GCC_PRINTFLIKE(1, 2); +static void warning(const char *fmt, ...) GCC_PRINTFLIKE(1, 2); +static int gather_c_values(int); + +static FILE *logfp = 0; +static double aspect_ratio = 0.6; +static bool in_curses = FALSE; +static bool debugging = FALSE; +static bool quiet = FALSE; +static int slow_time = -1; +static RGB_NAME *rgb_table; +static RGB_DATA *all_colors; +static HOW_MUCH how_much; + +static int reading_last; +static int reading_size; +static FG_NODE *reading_ncols; + +#if HAVE_TSEARCH +static void *reading_ntree; +#endif + +#if HAVE_ALLOC_PAIR && USE_EXTENDED_COLOR +#define USE_EXTENDED_COLORS 1 +static bool use_extended_pairs = FALSE; +static bool use_extended_colors = FALSE; +#else +#define USE_EXTENDED_COLORS 0 +#endif + +static void +logmsg(const char *fmt, ...) +{ + if (logfp != 0) { + va_list ap; + va_start(ap, fmt); + vfprintf(logfp, fmt, ap); + va_end(ap); + fputc('\n', logfp); + fflush(logfp); + } +} + +static void +logmsg2(const char *fmt, ...) +{ + if (logfp != 0) { + va_list ap; + va_start(ap, fmt); + vfprintf(logfp, fmt, ap); + va_end(ap); + fflush(logfp); + } +} + +static void +close_log(void) +{ + if (logfp != 0) { + logmsg("Allocations:"); + logmsg("%8ld file", (long) how_much.file); + logmsg("%8ld name", (long) how_much.name); + logmsg("%8ld list", (long) how_much.list); + logmsg("%8ld data", (long) how_much.data); + logmsg("%8ld head", (long) how_much.head); + logmsg("%8ld pair", (long) how_much.pair); + logmsg("%8ld cell", (long) how_much.cell); + logmsg("%8ld window", LINES * COLS * (long) sizeof(NCURSES_CH_T)); + fclose(logfp); + logfp = 0; + } +} + +static void +cleanup(int code) +{ + pause_curses(); + close_log(); + ExitProgram(code); + /* NOTREACHED */ +} + +static void +failed(const char *msg) +{ + int save = errno; + perror(msg); + logmsg("failed with %s", strerror(save)); + cleanup(EXIT_FAILURE); +} + +static void +warning(const char *fmt, ...) +{ + if (logfp != 0) { + va_list ap; + va_start(ap, fmt); + vfprintf(logfp, fmt, ap); + va_end(ap); + fputc('\n', logfp); + fflush(logfp); + } else { + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fputc('\n', stderr); + cleanup(EXIT_FAILURE); + } +} + +static void +free_data(char **data) +{ + if (data != 0) { + free(data[0]); + free(data); + } +} + +static PICS_HEAD * +free_pics_head(PICS_HEAD * pics) +{ + if (pics != 0) { + free(pics->fgcol); + free(pics->cells); + free(pics->name); + free(pics); + pics = 0; + } + return pics; +} + +static void +begin_c_values(int size) +{ + reading_last = 0; + reading_size = size; + reading_ncols = typeCalloc(FG_NODE, size + 1); + how_much.pair += (sizeof(FG_NODE) * (size_t) size); + /* black is always the first slot, to work around P2I/I2P logic */ + gather_c_values(0); +} + +#if HAVE_TSEARCH +static int +compare_c_values(const void *p, const void *q) +{ + const int a = P2I(p); + const int b = P2I(q); + return (reading_ncols[a].fgcol - reading_ncols[b].fgcol); +} + +#ifdef DEBUG_TSEARCH +static void +check_c_values(int ln) +{ + static int oops = 5; + FG_NODE **ft; + int n; + for (n = 0; n < reading_last; ++n) { + ft = tfind(I2P(n), &reading_ntree, compare_c_values); + if (ft != 0) { + int q = P2I(*ft); + if (reading_ncols[q].fgcol != reading_ncols[n].fgcol) { + logmsg("@%d, %d:%d (%d) %d %d fgcol %06X %06X", ln, n, + reading_last - 1, + reading_size, + q, n, + reading_ncols[n].fgcol, + reading_ncols[q].fgcol); + } + } else { + logmsg("@%d, %d:%d (%d) ? %d null %06X", ln, n, + reading_last - 1, + reading_size, + n, + reading_ncols[n].fgcol); + if (oops-- <= 0) + return; + } + } +} +#else +#define check_c_values(n) /* nothing */ +#endif +#endif + +static int +gather_c_values(int fg) +{ + int found = -1; +#if HAVE_TSEARCH + FG_NODE **ft; + int next = reading_last; + + reading_ncols[next].fgcol = fg; + reading_ncols[next].count = 0; + + check_c_values(__LINE__); + if ((ft = tfind(I2P(next), &reading_ntree, compare_c_values)) != 0) { + found = P2I(*ft); + } else { + if (reading_last + 2 >= reading_size) { + int more = ((MAX(reading_last, reading_size) + 2) * 3) / 2; + int last = reading_last + 1; + FG_NODE *p = typeRealloc(FG_NODE, more, reading_ncols); + if (p == 0) + goto done; + + reading_size = more; + reading_ncols = p; + memset(reading_ncols + last, 0, + sizeof(FG_NODE) * (size_t) (more - last)); + check_c_values(__LINE__); + } + ++reading_last; + how_much.pair += sizeof(FG_NODE); + if ((ft = tsearch(I2P(next), &reading_ntree, compare_c_values)) != 0) { + found = P2I(*ft); + if (found != next) + logmsg("OOPS expected slot %d, got %d", next, found); + debugmsg("allocated color #%d as #%06X", next, fg); + check_c_values(__LINE__); + } + } +#else + int n; + + for (n = 0; n < reading_last; ++n) { + if (reading_ncols[n].fgcol == fg) { + found = n; + break; + } + } + if (found < 0) { + if (reading_last + 2 >= reading_size) { + int more = ((reading_last + 2) * 3) / 2; + FG_NODE *p = typeRealloc(FG_NODE, more, reading_ncols); + if (p == 0) + goto done; + + how_much.pair -= (sizeof(FG_NODE) * (size_t) reading_size); + how_much.pair += (sizeof(FG_NODE) * (size_t) more); + reading_size = more; + reading_ncols = p; + memset(reading_ncols + reading_last, 0, + sizeof(FG_NODE) * (size_t) (more - reading_last)); + } + reading_ncols[reading_last].fgcol = fg; + found = reading_last++; + } +#endif + done: + return found; +} + +static void +finish_c_values(PICS_HEAD * head) +{ + head->colors = reading_last; + head->fgcol = reading_ncols; + + reading_last = 0; + reading_size = 0; + reading_ncols = 0; +} + +static void +dispose_c_values(void) +{ +#if HAVE_TSEARCH + if (reading_ntree != 0) { + int n; + for (n = 0; n < reading_last; ++n) { + tdelete(I2P(n), &reading_ntree, compare_c_values); + } + reading_ntree = 0; + } +#endif + if (reading_ncols != 0) { + free(reading_ncols); + reading_ncols = 0; + } + reading_last = 0; + reading_size = 0; +} + +static int +is_file(const char *filename, struct stat *sb) +{ + int result = 0; + if (stat(filename, sb) == 0 + && (sb->st_mode & S_IFMT) == S_IFREG + && sb->st_size != 0) { + result = 1; + } + debugmsg("is_file(%s) %d", filename, result); + return result; +} + +/* + * Simplify reading xbm/xpm files by first making an array of lines. Blank + * lines are filtered out. + */ +static char ** +read_file(const char *filename) +{ + char **result = 0; + struct stat sb; + + if (!quiet) { + pause_curses(); + printf("** %s\n", filename); + } + + if (is_file(filename, &sb)) { + size_t size = (size_t) sb.st_size; + char *blob = typeCalloc(char, size + 1); + bool binary = FALSE; + unsigned k = 0; + + result = typeCalloc(char *, size + 1); + how_much.file += ((size + 1) * 2); + + if (blob != 0 && result != 0) { + FILE *fp = fopen(filename, "r"); + if (fp != 0) { + logmsg("opened %s", filename); + + if (fread(blob, sizeof(char), size, fp) == size) { + bool had_line = TRUE; + unsigned j; + + for (j = 0; (size_t) j < size; ++j) { + if (blob[j] == '\0' || + (UChar(blob[j]) < 32 && + !isspace(UChar(blob[j]))) || + (UChar(blob[j]) >= 128 && UChar(blob[j]) < 160)) { + binary = TRUE; + } + if (blob[j] == '\n') { + blob[j] = '\0'; + if (k && !binary) { + debugmsg2("[%5d] %s\n", k, result[k - 1]); + } + had_line = TRUE; + } else if (had_line) { + had_line = FALSE; + result[k++] = blob + j; + } + } + result[k] = 0; + if (k && !binary) { + debugmsg2("[%5d] %s\n", k, result[k - 1]); + } + } + fclose(fp); + } else { + logmsg("cannot open %s", filename); + } + } + if (k == 0) { + debugmsg("...file is empty"); + free(blob); + free(result); + result = 0; + } else if (binary) { + debugmsg("...file is non-text"); + } + } + return result; +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: picsmap [options] [imagefile [...]]" + ,"Read/display one or more xbm/xpm files (possibly use \"convert\")" + ,"" + ,"Options:" + ," -a ratio aspect-ratio correction for ImageMagick" +#if HAVE_USE_DEFAULT_COLORS + ," -d invoke use_default_colors" +#endif + ," -L add debugging information to logfile" + ," -l logfile write informational messages to logfile" + ," -p palette color-palette file (default \"$TERM.dat\")" + ," -q less verbose" + ," -r rgb-path xpm uses X rgb color-names (default \"" RGB_PATH "\")" + ," -s SECS pause for SECS seconds after display vs getch" +#if USE_EXTENDED_COLORS + ," -x [pc] use extension (p=extended-pairs, c=extended-colors)" + ," Either/both extension may be given" +#endif + }; + size_t n; + + pause_curses(); + + fflush(stdout); + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + cleanup(EXIT_FAILURE); +} + +static void +giveup(const char *fmt, ...) +{ + va_list ap; + + pause_curses(); + fflush(stdout); + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + fputc('\n', stderr); + va_end(ap); + + if (logfp) { + va_start(ap, fmt); + vfprintf(logfp, fmt, ap); + fputc('\n', logfp); + va_end(ap); + fflush(logfp); + } + + usage(); +} + +/* + * Palette files are named for $TERM values. However, there are fewer palette + * files than $TERM's. Although there are known problems (some cannot even get + * black and white correct), for the purpose of comparison, pretending that + * those map into "xterm" is useful. + */ +static char ** +read_palette(const char *filename) +{ + static const char *data_dir = DATA_DIR; + char **result = 0; + size_t last = strlen(filename); + size_t need = (strlen(data_dir) + 20 + last); + char *full_name = malloc(need); + char *s; + struct stat sb; + + if (full_name != 0) { + int tries; + for (tries = 0; tries < 8; ++tries) { + + *(s = full_name) = '\0'; + if (tries & 1) { + if (strchr(filename, '/') == 0) { + _nc_SPRINTF(full_name, _nc_SLIMIT(need) "%s/", data_dir); + } else { + continue; + } + } + s += strlen(s); + if (((size_t) (s - full_name) + last + 1) >= need) + continue; + + _nc_STRCAT(full_name, filename, need); + if (tries & 4) { + char *t = s; + char *tc; + int num; + char chr; + int found = 0; + while (*t != '\0') { + if (*t == '-') { + if (sscanf(t, "-%d%c", &num, &chr) == 2 && + chr == 'c' && + (tc = strchr(t, chr)) != 0 && + !(strncmp) (tc, "color", 5)) { + found = 1; + } + break; + } + ++t; + } + if (found && (t != s) + && (strncmp) (s, "xterm", (size_t) (t - s))) { + _nc_SPRINTF(s, _nc_SLIMIT(need - (size_t) (s - full_name)) + "xterm%s", filename + (t - s)); + } else { + continue; + } + } + s += strlen(s); + + if (tries & 2) { + int len = (int) strlen(filename); + if (len <= 4 || strcmp(filename + len - 4, ".dat")) { + _nc_STRCAT(full_name, ".dat", need); + } else { + continue; + } + } + if (is_file(full_name, &sb)) + goto ok; + } + goto failed; + ok: + result = read_file(full_name); + failed: + free(full_name); + } + return result; +} + +static void +init_palette(const char *palette_file) +{ + if (palette_file != 0) { + char **data = read_palette(palette_file); + + all_colors = typeMalloc(RGB_DATA, (unsigned) COLORS); + how_much.data += (sizeof(RGB_DATA) * (unsigned) COLORS); + +#if HAVE_COLOR_CONTENT + { + int cp; + for (cp = 0; cp < COLORS; ++cp) { + color_content((short) cp, + &all_colors[cp].red, + &all_colors[cp].green, + &all_colors[cp].blue); + } + } +#else + memset(all_colors, 0, sizeof(RGB_DATA) * (size_t) COLORS); +#endif + if (data != 0) { + int n; + int red, green, blue; + int scale = MaxSCALE; + int c; + for (n = 0; data[n] != 0; ++n) { + if (sscanf(data[n], "scale:%d", &c) == 1) { + scale = c; + } else if (sscanf(data[n], "%d:%d %d %d", + &c, + &red, + &green, + &blue) == 4 + && okCOLOR(c) + && okSCALE(red) + && okSCALE(green) + && okSCALE(blue)) { + /* *INDENT-EQLS* */ + all_colors[c].red = ScaledColor(red); + all_colors[c].green = ScaledColor(green); + all_colors[c].blue = ScaledColor(blue); + } + } + } + free_data(data); + /* *INDENT-EQLS* */ + } else if (COLORS > 1) { + int power2 = 1; + int shift = 0; + + while (power2 < COLORS) { + ++shift; + power2 <<= 1; + } + + if ((power2 != COLORS) || ((shift % 3) != 0)) { + if (all_colors == 0) { + init_palette(getenv("TERM")); + if (all_colors == 0) { + giveup("With %d colors, you need a palette-file", COLORS); + } + } + } + } +} + +/* + * Map the 24-bit RGB value to a color index if using a palette, otherwise to a + * direct color value. + */ +static int +map_color(int value) +{ + int result = value; + + if (result < 0) { + result = -1; + } else { + /* *INDENT-EQLS* */ + int red = (value & 0xff0000) >> 16; + int green = (value & 0x00ff00) >> 8; + int blue = (value & 0x0000ff) >> 0; + + if (all_colors != 0) { +#define Diff2(n,m) ((m) - all_colors[n].m) * ((m) - all_colors[n].m) +#define Diff2S(n) Diff2(n,red) + Diff2(n,green) + Diff2(n,blue) + int d2 = Diff2S(0); + int n; + + /* *INDENT-EQLS* */ + red = Scaled256(red); + green = Scaled256(green); + blue = Scaled256(blue); + + for (result = 0, n = 1; n < COLORS; ++n) { + int d = Diff2(n, red) + Diff2(n, green) + Diff2(n, blue); + if (d < d2) { + d2 = d; + result = n; + } + } + } else { /* direct color */ + int power2 = 1; + int shifts = 8; + + while (power2 < COLORS) { + power2 <<= 3; + shifts--; + } + + if (shifts > 0) { + /* TODO: round up */ + red >>= shifts; + green >>= shifts; + blue >>= shifts; + result = ((red << (2 * (8 - shifts))) + + (green << (8 - shifts)) + + blue); + } + } + } + return result; +} + +static int +bytes_of(int value) +{ + if (value & 7) { + value |= 7; + value++; + } + return value; +} + +static int match_c(const char *, const char *, ...) GCC_SCANFLIKE(2,3); + +static char * +skip_s(char *s) +{ + while (isspace(UChar(*s))) + s++; + return s; +} + +static const char * +skip_cs(const char *s) +{ + while (isspace(UChar(*s))) + s++; + return s; +} + +static char * +skip_word(char *s) +{ + s = skip_s(s); + while (isgraph(UChar(*s))) + s++; + return s; +} + +static int +match_c(const char *source, const char *pattern, ...) +{ + int limit = (int) strlen(source); + const char *last_s = source + limit; + va_list ap; + int ch; + int *ip; + char *cp; + long lv; + + va_start(ap, pattern); + + limit = -1; + while (*pattern != '\0') { + ch = UChar(*pattern++); + /* blank in the pattern matches zero-or-more blanks in source */ + if (isspace(ch)) { + source = skip_cs(source); + continue; + } + /* %c, %d, %s are like sscanf except for special treatment of blanks */ + if (ch == '%' && *pattern != '\0' && strchr("cdnsx", *pattern)) { + bool found = FALSE; + ch = *pattern++; + switch (ch) { + case 'c': + cp = va_arg(ap, char *); + do { + *cp++ = *source++; + } while (--limit > 0); + break; + case 'd': + case 'x': + limit = -1; + ip = va_arg(ap, int *); + lv = strtol(source, &cp, ch == 'd' ? 10 : 16); + if (cp != 0 && cp != source) { + *ip = (int) lv; + source = cp; + } else { + goto finish; + } + break; + case 'n': + /* not really sscanf... */ + limit = *va_arg(ap, int *); + break; + case 's': + limit = -1; + cp = va_arg(ap, char *); + while (*source != '\0') { + ch = UChar(*source); + if (isspace(ch)) { + break; + } else if (found && (ch == *skip_cs(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 int +match_colors(const char *source, int cpp, char *arg1, char *arg2, char *arg3) +{ + int result = 0; + + /* most files use a quasi-fixed format */ + if (match_c(source, " \"%n%c %s %s \" , ", &cpp, arg1, arg2, arg3)) { + arg1[cpp] = '\0'; + result = 1; + } else { + const char *s = skip_cs(source); + size_t have = strlen(source); + + if (*s++ == '"' && have > ((size_t) cpp + 2)) { + memcpy(arg1, s, (size_t) cpp); + s += cpp; + while (*s++ == '\t') { + char *t; + for (t = arg2; (*s != '\0') && strchr("\t\"", *s) == 0;) { + if (*s == ' ') { + s = skip_cs(s); + break; + } + *t++ = *s++; + *t = '\0'; + } + for (t = arg3; (*s != '\0') && strchr("\t\"", *s) == 0;) { + *t++ = *s++; + *t = '\0'; + } + if (!strcmp(arg2, "c")) { + result = 1; + break; + } + } + } + } + return result; +} + +static RGB_NAME * +parse_rgb(char **data) +{ + char buf[BUFSIZ]; + int n; + unsigned long r, g, b; + char *s, *t; + size_t item = 0; + size_t need; + RGB_NAME *result = 0; + + for (need = 0; data[need] != 0; ++need) ; + + result = typeCalloc(RGB_NAME, need + 2); + how_much.name += (sizeof(RGB_NAME) * (need + 2)); + + for (n = 0; data[n] != 0; ++n) { + if (strlen(t = data[n]) >= sizeof(buf) - 1) + continue; + if (*(s = skip_s(t)) == '!') + continue; + + r = strtoul(s, &t, 10); + s = skip_s(t); + g = strtoul(s, &t, 10); + s = skip_s(t); + b = strtoul(s, &t, 10); + s = skip_s(t); + + result[item].name = s; + t = s + strlen(s); + while (t-- != s && isspace(UChar(*t))) { + *t = '\0'; + } + result[item].value = (int) ((r & 0xff) << 16 | + (g & 0xff) << 8 | + (b & 0xff)); + ++item; + } + + result[item].name = "none"; + result[item].value = -1; + + return result; +} + +static RGB_NAME * +lookup_rgb(const char *name) +{ + RGB_NAME *result = 0; + if (rgb_table != 0) { + int n; + for (n = 0; rgb_table[n].name != 0; ++n) { + if (!strcasecmp(name, rgb_table[n].name)) { + result = &rgb_table[n]; + break; + } + } + } + return result; +} + +static PICS_HEAD * +parse_xbm(char **data) +{ + int n; + int state = 0; + char buf[BUFSIZ]; + int num; + char ch; + char *s; + char *t; + PICS_HEAD *result; + size_t which = 0; + size_t cells = 0; + + debugmsg("called parse_xbm"); + + result = typeCalloc(PICS_HEAD, 1); + how_much.head += sizeof(PICS_HEAD); + + begin_c_values(2); + gather_c_values(0); + gather_c_values(0xffffff); + + for (n = 0; data[n] != 0; ++n) { + if (strlen(s = data[n]) >= sizeof(buf) - 1) + continue; + switch (state) { + case 0: + case 1: + case 2: + if (sscanf(s, "#define %s %d%c", buf, &num, &ch) >= 2) { + if ((t = strstr(buf, "_width")) != 0) { + state |= 1; + result->wide = (short) bytes_of(num); + } else if ((t = strstr(buf, "_height")) != 0) { + state |= 2; + result->high = (short) num; + } else { + break; + } + *t = '\0'; + if (result->name) { + if (strcmp(result->name, buf)) { + goto finish; + } + } else { + result->name = strdup(buf); + } + } + break; + case 3: + if (sscanf(s, "static char %[^_ ]_bits[]%c", buf, &ch) >= 1) { + if (strcmp(result->name, buf)) { + goto finish; + } + state = 4; + cells = (size_t) (result->wide * result->high); + + result->cells = typeCalloc(PICS_CELL, cells); + how_much.cell += (sizeof(PICS_CELL) * cells); + + if ((s = strchr(s, L_CURLY)) == 0) + break; + ++s; + } else { + break; + } + case 4: + while (*s != '\0') { + while (isspace(UChar(*s))) { + ++s; + } + if (isdigit(UChar(*s))) { + long value = strtol(s, &t, 0); + int b; + if (t != s || value > MaxRGB || value < 0) { + s = t; + } else { + state = -1; + goto finish; + } + for (b = 0; b < 8; ++b) { + if (((1L << b) & value) != 0) { + result->cells[which].ch = '*'; + result->cells[which].fg = 1; + reading_ncols[1].count++; + } else { + result->cells[which].ch = ' '; + result->cells[which].fg = 0; + reading_ncols[0].count++; + } + if (++which > cells) { + state = -1; + goto finish; + } + } + } + if (*s == R_CURLY) { + state = 5; + goto finish; + } else if (*s == ',') { + ++s; + } + } + break; + default: + break; + } + } + finish: + if (state < 4) { + debugmsg("...state was only %d", state); + if (result) { + result = free_pics_head(result); + } + } else { + finish_c_values(result); + } + return result; +} + +static PICS_HEAD * +parse_xpm(char **data) +{ + int state = 0; + PICS_HEAD *result; + RGB_NAME *by_name; + int n; + int cells = 0; + int cpp = 1; /* chars per pixel */ + int num[6]; + int found; + int which = 0; + int num_colors = 0; + char ch; + const char *cs; + char *s; + char buf[BUFSIZ]; + char arg1[BUFSIZ]; + char arg2[BUFSIZ]; + char arg3[BUFSIZ]; + char **list = 0; + + debugmsg("called parse_xpm"); + + result = typeCalloc(PICS_HEAD, 1); + how_much.head += sizeof(PICS_HEAD); + + 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_CURLY) { + 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 = (short) num[0]; + result->high = (short) num[1]; + result->colors = num[2]; + + begin_c_values(num[2]); + + cells = (result->wide * result->high); + + result->cells = typeCalloc(PICS_CELL, cells); + how_much.cell += sizeof(PICS_CELL) * (size_t) cells; + + list = typeCalloc(char *, result->colors + 1); + how_much.list += sizeof(char *) * (size_t) (result->colors + 1); + + cpp = num[3]; + state = 3; + } + break; + case 3: + if (!match_colors(s, cpp, arg1, arg2, arg3)) { + break; + } + num_colors++; + free(list[reading_last]); + list[reading_last] = strdup(arg1); + if ((by_name = lookup_rgb(arg3)) != 0) { + found = gather_c_values(by_name->value); + } else if (*arg3 == '#') { + char *rgb = arg3 + 1; + unsigned long value = strtoul(rgb, &s, 16); + switch ((int) strlen(rgb)) { + case 6: + break; + case 12: + value = (((value >> 24) & 0xff0000L) + | ((value >> 16) & 0xff00L) + | ((value >> 8) & 0xffL)); + break; + default: + warning("unexpected rgb value %s", rgb); + break; + } + found = gather_c_values((int) value); + } else { + found = gather_c_values(0); /* actually an error */ + } + debugmsg(" [%d:%d] %06X", num_colors, result->colors, + reading_ncols[(found >= 0) ? found : 0].fgcol); + if (num_colors >= result->colors) { + finish_c_values(result); + state = 4; + if (list[0] == 0) + list[0] = strdup("\033"); + } + break; + case 4: + if (*(cs = skip_cs(s)) == '"') { + ++cs; + while (*cs != '\0' && *cs != '"') { + int c; + + /* FIXME - factor out */ + for (c = 0; c < result->colors; ++c) { + if (list[c] == 0) { + /* should not happen... */ + continue; + } + if (!(strncmp) (cs, list[c], (size_t) cpp)) { + result->cells[which].ch = list[c][0]; + result->cells[which].fg = c; + result->fgcol[c].count++; + 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) { + if (*cs == '\0') + break; + } + } + } + break; + } + } + + if (result && list) { + for (n = 0; n < result->colors; ++n) + free(list[n]); + free(list); + } + + if (state < 5) { + debugmsg("...state was only %d", state); + result = free_pics_head(result); + } + + if (result) { + debugmsg("...allocated %d colors", result->colors); + } + + return result; +} + +/* + * The obscurely-named "convert" is provided by ImageMagick + */ +static PICS_HEAD * +parse_img(const char *filename) +{ + size_t need = strlen(filename) + 256; + char *cmd = malloc(need); + FILE *pp; + char buffer[BUFSIZ]; + char dummy[BUFSIZ]; + bool okay = TRUE; + PICS_HEAD *result; + int pic_x = 0; + int pic_y = 0; + int width = in_curses ? COLS : 80; + + _nc_SPRINTF(cmd, _nc_SLIMIT(need) "identify \"%s\"", filename); + if (quiet) + _nc_STRCAT(cmd, " 2>/dev/null", need); + + logmsg("...opening pipe to %s", cmd); + + result = typeCalloc(PICS_HEAD, 1); + how_much.head += sizeof(PICS_HEAD); + + if ((pp = popen(cmd, "r")) != 0) { + if (fgets(buffer, sizeof(buffer), pp) != 0) { + size_t n = strlen(filename); + debugmsg2("...read %s", buffer); + if (strlen(buffer) > n && + !(strncmp) (buffer, filename, n) && + isspace(UChar(buffer[n])) && + sscanf(skip_word(buffer + n), " %dx%d ", &pic_x, &pic_y) == 2) { + /* distort image to make it show normally on terminal */ + pic_x = (int) ((double) pic_x / aspect_ratio); + } else { + pic_x = pic_y = 0; + } + } + pclose(pp); + } + if (pic_x <= 0 || pic_y <= 0) + goto finish; + + _nc_SPRINTF(cmd, _nc_SLIMIT(need) + "convert " "-resize %dx%d\\! " "-thumbnail %dx \"%s\" " + "-define txt:compliance=SVG txt:-", + pic_x, pic_y, width, filename); + if (quiet) + _nc_STRCAT(cmd, " 2>/dev/null", need); + + logmsg("...opening pipe to %s", cmd); + if ((pp = popen(cmd, "r")) != 0) { + int count = 0; + int col = 0; + int row = 0; + int len = 0; + while (fgets(buffer, sizeof(buffer), pp) != 0) { + debugmsg2("[%5d] %s", count + 1, buffer); + if (strlen(buffer) > 160) { /* 80 columns would be enough */ + okay = FALSE; + break; + } + if (count++ == 0) { + if (match_c(buffer, + "# ImageMagick pixel enumeration: %d,%d,%d,%s ", + &col, &row, &len, dummy)) { + result->name = strdup(filename); + result->wide = (short) col; + result->high = (short) row; + + begin_c_values(256); + + result->cells = typeCalloc(PICS_CELL, (size_t) (col * row)); + how_much.cell += (sizeof(PICS_CELL) * (size_t) (col * row)); + } else { + okay = FALSE; + break; + } + } else { + /* subsequent lines begin "col,row: (r,g,b,a) #RGB" */ + int r, g, b, nocolor; + unsigned check; + char *t; + char *s = t = strchr(buffer, '#'); + + if (s != 0) { + /* after the "#RGB", there are differences - just ignore */ + while (*s != '\0' && !isspace(UChar(*s))) + ++s; + *++s = '\0'; + } + if (match_c(buffer, + "%d,%d: (%d,%d,%d,%d) #%x ", + &col, &row, + &r, &g, &b, &nocolor, + &check)) { + int which, c; + + if ((s - t) > 8) /* 6 hex digits vs 8 */ + check /= 256; + if (r > MaxRGB || + g > MaxRGB || + b > MaxRGB || + check != (unsigned) ((r << 16) | (g << 8) | b)) { + okay = FALSE; + break; + } + c = gather_c_values((int) check); + which = col + (row * result->wide); + result->cells[which].ch = ((in_curses || + check == 0xffffff) + ? ' ' + : '#'); + if (c >= 0 && c < reading_last) { + result->cells[which].fg = c; + reading_ncols[c].count++; + } else { + result->cells[which].fg = -1; + } + } else { + okay = FALSE; + break; + } + } + } + finish_c_values(result); + pclose(pp); + if (okay) { + /* FIXME - is this trimming needed? */ + for (len = result->colors; len > 3; len--) { + if (result->fgcol[len - 1].fgcol == 0) { + result->colors = len - 1; + } else { + break; + } + } + } + } + finish: + free(cmd); + + if (!okay) { + result = free_pics_head(result); + } + + return result; +} + +static PICS_HEAD * +read_picture(const char *filename, char **data) +{ + PICS_HEAD *pics; + if ((pics = parse_xbm(data)) == 0) { + dispose_c_values(); + if ((pics = parse_xpm(data)) == 0) { + dispose_c_values(); + if ((pics = parse_img(filename)) == 0) { + dispose_c_values(); + free_data(data); + warning("unexpected file-format for \"%s\"", filename); + } else if (pics->high == 0 || pics->wide == 0) { + dispose_c_values(); + free_data(data); + pics = free_pics_head(pics); + warning("no picture found in \"%s\"", filename); + } + } + } + return pics; +} + +#define fg_color(pics,n) (pics->fgcol[n].fgcol) + +static void +dump_picture(PICS_HEAD * pics) +{ + int y, x; + + 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 (fg_color(pics, y) < 0) { + printf(" %3d: %d\n", y, fg_color(pics, y)); + } else { + printf(" %3d: #%06x\n", y, fg_color(pics, y)); + } + } + for (y = 0; y < pics->high; ++y) { + for (x = 0; x < pics->wide; ++x) { + putchar(pics->cells[y * pics->wide + x].ch); + } + putchar('\n'); + } +} + +#ifndef USE_DISPLAY_DRIVER +static void +init_display(const char *palette_path, int opt_d) +{ + (void) opt_d; + if (isatty(fileno(stdout))) { + in_curses = TRUE; + initscr(); + cbreak(); + noecho(); + curs_set(0); + if (has_colors()) { + start_color(); +#if HAVE_USE_DEFAULT_COLORS + if (opt_d) + use_default_colors(); +#endif + init_palette(palette_path); + } + scrollok(stdscr, FALSE); + stop_curses(); + } +} + +static void +show_picture(PICS_HEAD * pics) +{ + int y, x; + int n; + + debugmsg("called show_picture"); + logmsg("...using %dx%d screen", LINES, COLS); +#if HAVE_RESET_COLOR_PAIRS + reset_color_pairs(); +#elif HAVE_CURSCR + wclear(curscr); + clear(); +#endif + if (has_colors()) { + logmsg("...using %d colors", pics->colors); + for (n = 0; n < pics->colors; ++n) { + int my_pair = (n + 1); + int my_color = map_color(fg_color(pics, n)); +#if USE_EXTENDED_COLORS + if (use_extended_pairs) { + init_extended_pair(my_pair, my_color, my_color); + } else +#endif + { + my_pair &= 0x7fff; + my_color &= 0x7fff; + init_pair((short) my_pair, (short) my_color, (short) my_color); + } + } + attrset(COLOR_PAIR(1)); + erase(); + } + for (y = 0; y < pics->high; ++y) { + if (y >= LINES) + break; + move(y, 0); + + for (x = 0; x < pics->wide; ++x) { + int my_pair; + + if (x >= COLS) + break; + n = (y * pics->wide + x); + my_pair = pics->cells[n].fg + 1; +#if USE_EXTENDED_COLORS + if (use_extended_pairs) { + cchar_t temp; + wchar_t wch[2]; + wch[0] = (wchar_t) pics->cells[n].ch; + wch[1] = 0; + setcchar(&temp, wch, A_NORMAL, (short) my_pair, &my_pair); + add_wch(&temp); + } else +#endif + { + attrset(COLOR_PAIR(my_pair)); + addch((chtype) pics->cells[n].ch); + } + } + } + if (slow_time >= 0) { + refresh(); + if (slow_time > 0) { +#ifdef NCURSES_VERSION + napms(1000 * slow_time); +#else + sleep((unsigned) slow_time); +#endif + } + } else { + wmove(stdscr, 0, 0); + getch(); + } + if (!quiet) + endwin(); +} +#endif + +static int +compare_fg_counts(const void *a, const void *b) +{ + const FG_NODE *p = (const FG_NODE *) a; + const FG_NODE *q = (const FG_NODE *) b; + return (q->count - p->count); +} + +static void +report_colors(PICS_HEAD * pics) +{ + int accum; + double level; + int j; + int shift; + int total; + char buffer[256]; + + if (logfp == 0) + return; + + qsort(pics->fgcol, (size_t) pics->colors, sizeof(FG_NODE), compare_fg_counts); + /* + * For debugging, show a (short) list of the colors used. + */ + if (debugging && (pics->colors < 1000)) { + int digits = 0; + int high; + int wide = 4; + for (j = pics->colors; j != 0; j /= 10) { + ++digits; + if (j < 10) + ++digits; + } + if (digits > 8) + digits = 8; + logmsg("These colors were used:"); + high = (pics->colors + wide - 1) / wide; + for (j = 0; j < high && j < pics->colors; ++j) { + int k; + char *s = buffer; + *s = '\0'; + for (k = 0; k < wide; ++k) { + int n = j + (k * high); + size_t want = (sizeof(buffer) - (size_t) (s - buffer)); + if (want < 100) + break; + if (n >= pics->colors) + break; + if (k) { + *s++ = ' '; + if (digits < 8) { + _nc_SPRINTF(s, _nc_SLIMIT(want) "%*s", 8 - digits, + " "); + s += strlen(s); + } + } + if (pics->fgcol[n].fgcol >= 0) { + _nc_SPRINTF(s, _nc_SLIMIT(want) "%3d #%06X %*d", n, + pics->fgcol[n].fgcol, + digits, pics->fgcol[n].count); + } else { + _nc_SPRINTF(s, _nc_SLIMIT(want) "%3d (empty) %*d", n, + digits, pics->fgcol[n].count); + } + s += strlen(s); + if ((s - buffer) > 100) + break; + } + logmsg("%s", buffer); + } + } + + /* + * Given the list of colors sorted by the number of times they are used, + * log a short report showing the number of colors for 90%, 99%, 99.9%, + * etc. + */ + logmsg("Number of colors versus number of cells"); + total = pics->high * pics->wide; + accum = 0; + level = 0.1; + shift = 1; + for (j = 0; j < pics->colors; ++j) { + accum += pics->fgcol[j].count; + if (accum >= (total * (1.0 - level))) { + int after = (shift > 2) ? shift - 2 : 0; + logmsg("%8d colors (%.1f%%) in %d cells (%.*f%%)", + j + 1, + (100.0 * (j + 1)) / pics->colors, + accum, + after, (100.0 * accum) / total); + if (accum >= total) + break; + level /= 10.0; + shift++; + } + } +} + +int +main(int argc, char *argv[]) +{ + int n; + int opt_d = FALSE; + char ignore_ch; + const char *palette_path = 0; + const char *rgb_path = RGB_PATH; + + while ((n = getopt(argc, argv, "a:dLl:p:qr:s:x:")) != -1) { + switch (n) { + case 'a': + if (sscanf(optarg, "%lf%c", &aspect_ratio, &ignore_ch) != 1 + || aspect_ratio < 0.1 + || aspect_ratio > 10.) { + fprintf(stderr, "Expected a number in [0.1 to 10.]: %s\n", optarg); + usage(); + } + break; +#if HAVE_USE_DEFAULT_COLORS + case 'd': + opt_d = TRUE; + break; +#endif + case 'L': + debugging = TRUE; + break; + case 'l': + if ((logfp = fopen(optarg, "a")) == 0) + failed(optarg); + break; + case 'p': + palette_path = optarg; + break; + case 'q': + quiet = TRUE; + break; + case 'r': + rgb_path = optarg; + break; + case 's': + slow_time = atoi(optarg); + break; +#if USE_EXTENDED_COLORS + case 'x': + { + char *s = optarg; + while (*s) { + switch (*s++) { + case 'p': + use_extended_pairs = TRUE; + break; + case 'c': + use_extended_colors = TRUE; + break; + default: + usage(); + break; + } + } + } + break; +#endif + default: + usage(); + break; + } + } + + if (optind < argc) { + char **rgb_data = read_file(rgb_path); + + if (rgb_data) + rgb_table = parse_rgb(rgb_data); + + init_display(palette_path, opt_d); + if (optind >= argc) + giveup("expected at least one image filename"); + + for (n = optind; n < argc; ++n) { + PICS_HEAD *pics; + char **data = read_file(argv[n]); + + if (data == 0) { + warning("cannot read \"%s\"", argv[n]); + continue; + } + if ((pics = read_picture(argv[n], data)) != 0) { + if (in_curses) { + show_picture(pics); + } else { + dump_picture(pics); + } + report_colors(pics); + dispose_c_values(); + free_data(data); + free_pics_head(pics); + } + } + free_data(rgb_data); + free(rgb_table); + free(all_colors); + } else { + usage(); + } + + cleanup(EXIT_SUCCESS); +} diff --git a/test/picsmap.h b/test/picsmap.h new file mode 100644 index 000000000000..511ae7aa9991 --- /dev/null +++ b/test/picsmap.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * Copyright (c) 2017 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. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas E. Dickey * + ****************************************************************************/ +/* $Id: picsmap.h,v 1.3 2017/11/18 22:37:00 tom Exp $ */ + +#ifndef PICSMAP_H_INCL +#define PICSMAP_H_INCL 1 + +typedef int NUM_COLOR; +typedef unsigned short NUM_COUNT; + +typedef struct { + char ch; /* nominal character to display */ + NUM_COLOR fg; /* foreground color */ +} PICS_CELL; + +typedef struct { + NUM_COLOR fgcol; + NUM_COUNT count; +} FG_NODE; + +typedef struct { + char *name; + short high; + short wide; + int colors; + FG_NODE *fgcol; + PICS_CELL *cells; +} PICS_HEAD; + +typedef struct { + const char *name; + int value; +} RGB_NAME; + +typedef struct { + short red; + short green; + short blue; +} RGB_DATA; + +static void init_display(const char *, int); + +static void show_picture(PICS_HEAD * pics); + +#endif /* PICSMAP_H_INCL */ diff --git a/test/popup_msg.c b/test/popup_msg.c new file mode 100644 index 000000000000..4acfe851d4b5 --- /dev/null +++ b/test/popup_msg.c @@ -0,0 +1,183 @@ +/**************************************************************************** + * Copyright (c) 2017,2018 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: popup_msg.c,v 1.9 2018/05/12 15:08:45 tom Exp $ + * + * Show a multi-line message in a window which may extend beyond the screen. + * + * Thomas Dickey - 2017/4/15. + */ + +#include + +#include + +#if HAVE_NEWPAD + +static WINDOW *old_window; + +static void +begin_popup(void) +{ + doupdate(); + old_window = dupwin(curscr); +} + +static void +end_popup(void) +{ + touchwin(old_window); + wnoutrefresh(old_window); + doupdate(); + delwin(old_window); +} + +/* + * Display a temporary window, e.g., to display a help-message. + */ +void +popup_msg(WINDOW *parent, const char *const *msg) +{ + int x0 = 4; + int y0 = 2; + int y1 = 0; + int y2 = 0; + int wide = getmaxx(parent) - ((x0 + 1) * 2); + int high = getmaxy(parent) - ((y0 + 1) * 2); + WINDOW *help; + WINDOW *data; + int n; + int width = 0; + int length; + int last_y; + int ch = ERR; + + for (n = 0; msg[n] != 0; ++n) { + int check = (int) strlen(msg[n]); + if (width < check) + width = check; + } + length = n; + + if ((help = newwin(high, wide, y0, x0)) == 0) + return; + if ((data = newpad(length + 1, width)) == 0) { + delwin(help); + return; + } + + begin_popup(); + + keypad(data, TRUE); + + for (n = 0; n < length; ++n) { + waddstr(data, msg[n]); + if ((n + 1) < length) { + waddch(data, '\n'); + } + } + y2 = getcury(data); + last_y = (y2 - (high - 3)); + + do { + switch (ch) { + case KEY_HOME: + y1 = 0; + break; + case KEY_END: + y1 = last_y; + break; + case KEY_PREVIOUS: + case KEY_PPAGE: + if (y1 > 0) { + y1 -= high / 2; + if (y1 < 0) + y1 = 0; + } else { + beep(); + } + break; + case KEY_NEXT: + case KEY_NPAGE: + if (y1 < last_y) { + y1 += high / 2; + if (y1 > last_y) + y1 = last_y; + } else { + beep(); + } + break; + case CTRL('P'): + case KEY_UP: + if (y1 > 0) + --y1; + else + beep(); + break; + case CTRL('N'): + case KEY_DOWN: + if (y1 < last_y) + ++y1; + else + beep(); + break; + default: + beep(); + break; + case ERR: + break; + } + werase(help); + box(help, 0, 0); + wnoutrefresh(help); + pnoutrefresh(data, y1, 0, y0 + 1, x0 + 1, high, wide); + doupdate(); + } while ((ch = wgetch(data)) != ERR && ch != QUIT && ch != ESCAPE); + werase(help); + wrefresh(help); + delwin(help); + delwin(data); + + end_popup(); +} + +void +popup_msg2(WINDOW *parent, char **msg) +{ + popup_msg(parent, (const char *const *) msg); +} + +#else +void +popup_msg(WINDOW *parent, const char *const *msg) +{ + (void) parent; + (void) msg; + beep(); +} +#endif diff --git a/test/popup_msg.h b/test/popup_msg.h new file mode 100644 index 000000000000..b728f21bde3f --- /dev/null +++ b/test/popup_msg.h @@ -0,0 +1,42 @@ +/**************************************************************************** + * Copyright (c) 2003-2017,2018 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: popup_msg.h,v 1.4 2018/02/03 21:07:55 tom Exp $ + * + * Utility functions for a popup-message or help-screen. + */ + +#ifndef POPUP_MSG_H_incl +#define POPUP_MSG_H_incl 1 + +#include + +extern void popup_msg(WINDOW *parent, const char *const *msg); +extern void popup_msg2(WINDOW *parent, char **msg); + +#endif /* POPUP_MSG_H_incl */ diff --git a/test/programs b/test/programs index f307cc72f6d7..e1266b862ab4 100644 --- a/test/programs +++ b/test/programs @@ -1,6 +1,6 @@ -# $Id: programs,v 1.24 2013/12/07 18:06:24 tom Exp $ +# $Id: programs,v 1.44 2019/02/16 21:38:16 tom Exp $ ############################################################################## -# Copyright (c) 2006-2009,2013 Free Software Foundation, Inc. # +# Copyright (c) 2006-2018,2019 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"), # @@ -30,67 +30,81 @@ # Author: Thomas E. Dickey # # programs used for ncurses tests -background $(LDFLAGS_CURSES) $(LOCAL_LIBS) background +background $(LDFLAGS_CURSES) $(LOCAL_LIBS) background dump_window blue $(LDFLAGS_CURSES) $(LOCAL_LIBS) blue bs $(LDFLAGS_CURSES) $(LOCAL_LIBS) bs cardfile $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) cardfile -chgat $(LDFLAGS_CURSES) $(LOCAL_LIBS) chgat -clip_printw $(LDFLAGS_CURSES) $(LOCAL_LIBS) clip_printw +chgat $(LDFLAGS_CURSES) $(LOCAL_LIBS) chgat popup_msg +clip_printw $(LDFLAGS_CURSES) $(LOCAL_LIBS) clip_printw popup_msg +color_content $(LDFLAGS_CURSES) $(LOCAL_LIBS) color_content color_set $(LDFLAGS_CURSES) $(LOCAL_LIBS) color_set demo_altkeys $(LDFLAGS_CURSES) $(LOCAL_LIBS) demo_altkeys demo_defkey $(LDFLAGS_CURSES) $(LOCAL_LIBS) demo_defkey -demo_forms $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) demo_forms edit_field +demo_forms $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) demo_forms edit_field popup_msg demo_keyok $(LDFLAGS_CURSES) $(LOCAL_LIBS) demo_keyok demo_menus $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) demo_menus +demo_new_pair $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) demo_new_pair popup_msg demo_panels $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) demo_panels +demo_tabs $(LDFLAGS_CURSES) $(LOCAL_LIBS) demo_tabs demo_termcap $(LDFLAGS_TINFO) $(LOCAL_LIBS) demo_termcap demo_terminfo $(LDFLAGS_TINFO) $(LOCAL_LIBS) demo_terminfo ditto $(LDFLAGS_THREADS) $(LOCAL_LIBS) ditto dots $(LDFLAGS_TINFO) $(LOCAL_LIBS) dots +dots_curses $(LDFLAGS_CURSES) $(LOCAL_LIBS) dots_curses dots_mvcur $(LDFLAGS_CURSES) $(LOCAL_LIBS) dots_mvcur dots_termcap $(LDFLAGS_TINFO) $(LOCAL_LIBS) dots_termcap +dots_xcurses $(LDFLAGS_CURSES) $(LOCAL_LIBS) dots_xcurses echochar $(LDFLAGS_CURSES) $(LOCAL_LIBS) echochar +extended_color $(LDFLAGS_CURSES) $(LOCAL_LIBS) extended_color filter $(LDFLAGS_CURSES) $(LOCAL_LIBS) filter firework $(LDFLAGS_CURSES) $(LOCAL_LIBS) firework firstlast $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) firstlast foldkeys $(LDFLAGS_CURSES) $(LOCAL_LIBS) foldkeys -form_driver_w $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) form_driver_w +form_driver_w $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) form_driver_w popup_msg gdc $(LDFLAGS_CURSES) $(LOCAL_LIBS) gdc hanoi $(LDFLAGS_CURSES) $(LOCAL_LIBS) hanoi hashtest $(LDFLAGS_CURSES) $(LOCAL_LIBS) hashtest -inch_wide $(LDFLAGS_CURSES) $(LOCAL_LIBS) inch_wide -inchs $(LDFLAGS_CURSES) $(LOCAL_LIBS) inchs +inch_wide $(LDFLAGS_CURSES) $(LOCAL_LIBS) inch_wide popup_msg +inchs $(LDFLAGS_CURSES) $(LOCAL_LIBS) inchs popup_msg ins_wide $(LDFLAGS_CURSES) $(LOCAL_LIBS) ins_wide -insdelln $(LDFLAGS_CURSES) $(LOCAL_LIBS) insdelln +insdelln $(LDFLAGS_CURSES) $(LOCAL_LIBS) insdelln popup_msg inserts $(LDFLAGS_CURSES) $(LOCAL_LIBS) inserts key_names $(LDFLAGS_CURSES) $(LOCAL_LIBS) key_names keynames $(LDFLAGS_CURSES) $(LOCAL_LIBS) keynames knight $(LDFLAGS_CURSES) $(LOCAL_LIBS) knight +list_keys $(LDFLAGS_TINFO) $(LOCAL_LIBS) list_keys lrtest $(LDFLAGS_CURSES) $(LOCAL_LIBS) lrtest -movewindow $(LDFLAGS_CURSES) $(LOCAL_LIBS) movewindow +movewindow $(LDFLAGS_CURSES) $(LOCAL_LIBS) movewindow popup_msg ncurses $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) ncurses newdemo $(LDFLAGS_CURSES) $(LOCAL_LIBS) newdemo +padview $(LDFLAGS_CURSES) $(LOCAL_LIBS) padview popup_msg +pair_content $(LDFLAGS_CURSES) $(LOCAL_LIBS) pair_content +picsmap $(LDFLAGS_CURSES) $(LOCAL_LIBS) picsmap railroad $(LDFLAGS_TINFO) $(LOCAL_LIBS) railroad -rain $(LDFLAGS_THREADS) $(LOCAL_LIBS) rain -redraw $(LDFLAGS_CURSES) $(LOCAL_LIBS) redraw -savescreen $(LDFLAGS_CURSES) $(LOCAL_LIBS) savescreen +rain $(LDFLAGS_THREADS) $(LOCAL_LIBS) rain popup_msg +redraw $(LDFLAGS_CURSES) $(LOCAL_LIBS) redraw popup_msg +savescreen $(LDFLAGS_CURSES) $(LOCAL_LIBS) savescreen popup_msg +sp_tinfo $(LDFLAGS_TINFO) $(LOCAL_LIBS) sp_tinfo tclock $(LDFLAGS_CURSES) $(LOCAL_LIBS) tclock test_add_wchstr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_add_wchstr test_addchstr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_addchstr test_addstr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_addstr test_addwstr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_addwstr test_arrays $(LDFLAGS_TINFO) $(LOCAL_LIBS) test_arrays -test_get_wstr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_get_wstr -test_getstr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_getstr +test_get_wstr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_get_wstr popup_msg +test_getstr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_getstr popup_msg test_instr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_instr test_inwstr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_inwstr test_opaque $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_opaque +test_setupterm $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_setupterm +test_sgr $(LDFLAGS_TINFO) $(LOCAL_LIBS) test_sgr +test_termattrs $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_termattrs test_vid_puts $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_vid_puts test_vidputs $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_vidputs testaddch $(LDFLAGS_CURSES) $(LOCAL_LIBS) testaddch testcurs $(LDFLAGS_CURSES) $(LOCAL_LIBS) testcurs testscanw $(LDFLAGS_CURSES) $(LOCAL_LIBS) testscanw -view $(LDFLAGS_CURSES) $(LOCAL_LIBS) view +view $(LDFLAGS_CURSES) $(LOCAL_LIBS) view popup_msg worm $(LDFLAGS_THREADS) $(LOCAL_LIBS) worm xmas $(LDFLAGS_CURSES) $(LOCAL_LIBS) xmas diff --git a/test/railroad.c b/test/railroad.c index 33dc46f1dd1c..246dc0d4afa9 100644 --- a/test/railroad.c +++ b/test/railroad.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2000-2011,2013 Free Software Foundation, Inc. * + * Copyright (c) 2000-2017,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey - 2000 * - * $Id: railroad.c,v 1.21 2013/09/28 22:02:17 tom Exp $ + * $Id: railroad.c,v 1.23 2019/08/24 23:11:01 tom Exp $ * * A simple demo of the termcap interface. */ @@ -113,7 +113,7 @@ static void ShowSign(char *string) { char *base = string; - int ch, first, last; + int first, last; if (moveit != 0) { tputs(tgoto(moveit, 0, height - 1), 1, outc); @@ -121,7 +121,7 @@ ShowSign(char *string) } while (*string != 0) { - ch = *string; + int ch = *string; if (ch != ' ') { if (moveit != 0) { for (first = length - 2; first >= (string - base); first--) { @@ -187,10 +187,13 @@ railroad(char **args) NCURSES_CONST char *name = getenv("TERM"); char buffer[1024]; char area[1024], *ap = area; + int z; if (name == 0) name = "dumb"; - if (tgetent(buffer, name) >= 0) { + + InitAndCatch(z = tgetent(buffer, name), onsig); + if (z >= 0) { wipeit = tgetstr("ce", &ap); height = tgetnum("li"); @@ -220,8 +223,6 @@ railroad(char **args) MyShowCursor(0); - CATCHALL(onsig); - while (*args) { ShowSign(*args++); } diff --git a/test/rain.c b/test/rain.c index 471a88d61cdb..407eb09cb055 100644 --- a/test/rain.c +++ b/test/rain.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2018,2019 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,9 +26,10 @@ * authorization. * ****************************************************************************/ /* - * $Id: rain.c,v 1.40 2012/01/21 23:54:47 tom Exp $ + * $Id: rain.c,v 1.50 2019/12/14 23:26:09 tom Exp $ */ #include +#include /* rain 11/3/1980 EPS/CITHEP */ @@ -66,11 +67,18 @@ typedef struct { static STATS drop_threads[MAX_THREADS]; #endif +#if HAVE_USE_WINDOW +static int +safe_wgetch(WINDOW *w, void *data GCC_UNUSED) +{ + return wgetch(w); +} +#endif + static void onsig(int n GCC_UNUSED) { - curs_set(1); - endwin(); + stop_curses(); ExitProgram(EXIT_FAILURE); } @@ -102,10 +110,7 @@ next_j(int j) --j; if (has_colors()) { int z = (int) (3 * ranf()); - chtype color = (chtype) COLOR_PAIR(z); - if (z) - color |= A_BOLD; - (void) attrset(color); + (void) attrset(AttrArg(COLOR_PAIR(z), (z ? A_BOLD : A_NORMAL))); } return j; } @@ -222,7 +227,7 @@ draw_drop(void *arg) * Find myself in the list of threads so we can count the number of loops. */ for (mystats = 0; mystats < MAX_THREADS; ++mystats) { -#if defined(__MINGW32__) && !defined(__WINPTHREADS_VERSION) +#if defined(_WIN32) && !defined(__WINPTHREADS_VERSION) if (drop_threads[mystats].myself.p == pthread_self().p) #else if (drop_threads[mystats].myself == pthread_self()) @@ -288,30 +293,76 @@ start_drop(DATA * data) static int get_input(void) { - return USING_WINDOW(stdscr, wgetch); + return USING_WINDOW1(stdscr, wgetch, safe_wgetch); +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: rain [options]" + ,"" + ,"Options:" +#if HAVE_USE_DEFAULT_COLORS + ," -d invoke use_default_colors" +#endif + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(EXIT_FAILURE); } int -main(int argc GCC_UNUSED, - char *argv[]GCC_UNUSED) +main(int argc, char *argv[]) { + static const char *help[] = + { + "Commands:", + " q/Q exit the program", + " s do single-step", + " undo single-step", + "", + 0 + }; + bool done = FALSE; DATA drop; #ifndef USE_PTHREADS DATA last[MAX_DROP]; #endif int j = 0; + int ch; +#if HAVE_USE_DEFAULT_COLORS + bool d_option = FALSE; +#endif - setlocale(LC_ALL, ""); + while ((ch = getopt(argc, argv, "d")) != -1) { + switch (ch) { +#if HAVE_USE_DEFAULT_COLORS + case 'd': + d_option = TRUE; + break; +#endif + default: + usage(); + /* NOTREACHED */ + } + } + if (optind < argc) + usage(); - CATCHALL(onsig); + setlocale(LC_ALL, ""); - initscr(); + InitAndCatch(initscr(), onsig); if (has_colors()) { int bg = COLOR_BLACK; start_color(); #if HAVE_USE_DEFAULT_COLORS - if (use_default_colors() == OK) + if (d_option && (use_default_colors() == OK)) bg = -1; #endif init_pair(1, COLOR_BLUE, (short) bg); @@ -376,11 +427,17 @@ main(int argc GCC_UNUSED, case (KEY_RESIZE): break; #endif + case HELP_KEY_1: + popup_msg(stdscr, help); + break; + case ERR: + break; + default: + beep(); } napms(50); } - curs_set(1); - endwin(); + stop_curses(); #ifdef USE_PTHREADS printf("Counts per thread:\n"); for (j = 0; j < MAX_THREADS; ++j) diff --git a/test/redraw.c b/test/redraw.c index 9cb0de95a809..7d06cad8aca3 100644 --- a/test/redraw.c +++ b/test/redraw.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2006-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 2006-2012,2017 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,14 @@ * authorization. * ****************************************************************************/ /* - * $Id: redraw.c,v 1.8 2012/12/08 20:46:02 tom Exp $ + * $Id: redraw.c,v 1.10 2017/06/24 14:04:57 tom Exp $ * * Demonstrate the redrawwin() and wredrawln() functions. * Thomas Dickey - 2006/11/4 */ #include +#include static void trash(int beg_x, int max_x, int cur_x) @@ -53,11 +54,30 @@ trash(int beg_x, int max_x, int cur_x) for (x = max_x; x > cur_x; --x) { putchar('\b'); } + fflush(stdout); } static void test_redraw(WINDOW *win) { + static const char *help[] = + { + "Commands:", + " ^Q/ESC/q - quit", + " w - recur in a new window", + " ! - overwrite current line using stdio outside curses.", +#ifdef NCURSES_VERSION + " @ - run \"date\" command, to put its output on screen.", +#endif + " ^L - call redrawwin() for current window.", + " ^W - call wredrawln() for current line/current window.", + " arrow-keys - move cursor on the screen", + "", + "Other control characters are added to the screen in printable form.", + "Other printable characters are added to the screen as is.", + 0 + }; + WINDOW *win1; WINDOW *win2; bool done = FALSE; @@ -77,6 +97,7 @@ test_redraw(WINDOW *win) switch (ch) { case 'q': /* FALLTHRU */ + case QUIT: case ESCAPE: done = TRUE; break; @@ -146,9 +167,14 @@ test_redraw(WINDOW *win) wmove(win, y, x + 1); break; + case HELP_KEY_1: + popup_msg(win, help); + break; + default: if (ch > KEY_MIN) { waddstr(win, keyname(ch)); + waddch(win, '\n'); } else { waddstr(win, unctrl(UChar(ch))); } @@ -159,10 +185,52 @@ test_redraw(WINDOW *win) } } +static void +usage(void) +{ + static const char *tbl[] = + { + "Usage: redraw [options]" + ,"" + ,"Options:" + ," -e use stderr (default stdout)" + ," -n do not initialize terminal" + }; + unsigned n; + for (n = 0; n < SIZEOF(tbl); ++n) + fprintf(stderr, "%s\n", tbl[n]); + ExitProgram(EXIT_FAILURE); +} + int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - initscr(); + int ch; + bool no_init = FALSE; + FILE *my_fp = stdout; + + while ((ch = getopt(argc, argv, "en")) != -1) { + switch (ch) { + case 'e': + my_fp = stderr; + break; + case 'n': + no_init = TRUE; + break; + default: + usage(); + break; + } + } + if (optind < argc) + usage(); + + if (no_init) { + START_TRACE(); + } else { + newterm((char *) 0, my_fp, stdin); + } + raw(); noecho(); test_redraw(stdscr); diff --git a/test/savescreen.c b/test/savescreen.c index 111882d0b558..8aa82eff3f73 100644 --- a/test/savescreen.c +++ b/test/savescreen.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 2007-2018,2019 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,31 +26,47 @@ * authorization. * ****************************************************************************/ /* - * $Id: savescreen.c,v 1.15 2011/01/15 18:15:11 tom Exp $ + * $Id: savescreen.c,v 1.56 2019/12/14 23:25:29 tom Exp $ * * Demonstrate save/restore functions from the curses library. * Thomas Dickey - 2007/7/14 */ +#define NEED_TIME_H #include +#include +#include #if HAVE_SCR_DUMP #include #include -#if TIME_WITH_SYS_TIME -# include -# include +#if defined(__hpux) +#define MyMarker 'X' #else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif +#define MyMarker ACS_DIAMOND #endif +#define MAX_ANSI 8 + static bool use_init = FALSE; +static bool keep_dumps = FALSE; + +#if USE_WIDEC_SUPPORT +/* In HPUX curses, cchar_t is opaque; other implementations are not */ +static wchar_t +BaseChar(cchar_t data) +{ + wchar_t my_wchar[CCHARW_MAX]; + wchar_t result = 0; + attr_t my_attr; + short my_pair; + if (getcchar(&data, my_wchar, &my_attr, &my_pair, NULL) == OK) + result = my_wchar[0]; + return result; +} +#endif static int fexists(const char *name) @@ -71,8 +87,10 @@ cleanup(char *files[]) { int n; - for (n = 0; files[n] != 0; ++n) { - unlink(files[n]); + if (!keep_dumps) { + for (n = 0; files[n] != 0; ++n) { + unlink(files[n]); + } } } @@ -103,15 +121,27 @@ after_load(void) } static void -show_what(int which, int last) +show_what(int color, int which, int last) { - int y, x; - time_t now = time((time_t *) 0); + int y, x, n; + time_t now; + char *mytime; getyx(stdscr, y, x); move(0, 0); - printw("Saved %d of %d - %s", which, last + 1, ctime(&now)); + printw("Color %d. Saved %d of %d (? for help)", color, which, last + 1); + + now = time((time_t *) 0); + mytime = ctime(&now); + for (n = (int) strlen(mytime) - 1; n >= 0; --n) { + if (isspace(UChar(mytime[n]))) { + mytime[n] = '\0'; + } else { + break; + } + } + mvprintw(0, (COLS - n - 2), " %s", mytime); move(y, x); @@ -119,20 +149,109 @@ show_what(int which, int last) } static int -get_command(int which, int last) +get_command(int color, int which, int last) { int ch; - timeout(100); + timeout(50); do { - show_what(which, last); + show_what(color, which, last); ch = getch(); } while (ch == ERR); return ch; } +static int +dump_screen(char **files, int color, int which, int last, bool use_colors) +{ +#if USE_WIDEC_SUPPORT + cchar_t mycc; + int myxx; +#endif + char *filename = files[which]; + bool dumped = FALSE; + + if (filename != 0) { + dumped = TRUE; + show_what(color, ++which, last); + if (scr_dump(filename) == ERR) { + endwin(); + printf("Cannot write screen-dump %s\n", filename); + cleanup(files); + ExitProgram(EXIT_SUCCESS); + } + if (use_colors) { + int cx, cy; + int pair = 1 + (which % MAX_ANSI); + /* + * Change the background color, to make it more obvious. But that + * changes the existing text-color. Copy the old values from the + * currently displayed screen. + */ + bkgd((chtype) COLOR_PAIR(pair)); + for (cy = 1; cy < LINES; ++cy) { + for (cx = 0; cx < COLS; ++cx) { + wmove(curscr, cy, cx); + wmove(stdscr, cy, cx); +#if USE_WIDEC_SUPPORT + if (win_wch(curscr, &mycc) != ERR) { + myxx = wcwidth(BaseChar(mycc)); + if (myxx > 0) { + wadd_wchnstr(stdscr, &mycc, 1); + cx += (myxx - 1); + } + } +#else + waddch(stdscr, winch(curscr)); +#endif + } + } + } + } + return dumped; +} + +static void +editor_help(void) +{ + static const char *msgs[] = + { + "You are now in the screen-editor, which allows you to make some", + "lines on the screen, as well as save copies of the screen to a", + "temporary file", + "", + "Keys:", + " q quit", + " n run the screen-loader to show the saved screens", + " dump a screen", + "", + " a toggle between '#' and graphic symbol for drawing", + " c change color drawn by line to next in palette", + " h,j,k,l or arrows to move around the screen, drawing", + 0 + }; + popup_msg(stdscr, msgs); +} + +static void +replay_help(void) +{ + static const char *msgs[] = + { + "You are now in the screen-loader, which allows you to view", + "the dumped/restored screens.", + "", + "Keys:", + " q quit", + " load the next screen", + " load the previous screen", + 0 + }; + popup_msg(stdscr, msgs); +} + static void usage(void) { @@ -141,8 +260,10 @@ usage(void) "Usage: savescreen [-r] files", "", "Options:", - " -i use scr_init/scr_restore rather than scr_set", - " -r replay the screen-dump files" + " -f file fill/initialize screen using text from this file", + " -i use scr_init/scr_restore rather than scr_set", + " -k keep the restored dump-files rather than removing them", + " -r replay the screen-dump files" }; unsigned n; for (n = 0; n < SIZEOF(msg); ++n) { @@ -157,15 +278,35 @@ main(int argc, char *argv[]) int ch; int which = 0; int last; + bool use_colors = FALSE; bool replaying = FALSE; bool done = FALSE; char **files; + char *fill_by = 0; +#if USE_WIDEC_SUPPORT + int r, g, b; + int cube = 0; + int cube0 = 16; + int cube1; + cchar_t mycc; + static const wchar_t mywc[2] = + {L'#', 0}; + bool using_rgb = FALSE; +#endif + + setlocale(LC_ALL, ""); - while ((ch = getopt(argc, argv, "ir")) != -1) { + while ((ch = getopt(argc, argv, "f:ikr")) != -1) { switch (ch) { + case 'f': + fill_by = optarg; + break; case 'i': use_init = TRUE; break; + case 'k': + keep_dumps = TRUE; + break; case 'r': replaying = TRUE; break; @@ -188,11 +329,175 @@ main(int argc, char *argv[]) noecho(); keypad(stdscr, TRUE); curs_set(0); - if (has_colors()) { - start_color(); - for (ch = 0; ch < COLOR_PAIRS; ++ch) { - short pair = (short) (ch % COLOR_PAIRS); - init_pair(pair, COLOR_WHITE, (short) (ch % COLORS)); + + if (has_colors() && (start_color() == OK) && COLORS >= MAX_ANSI) { + static const struct { + int fg, bg; + } table[MAX_ANSI] = { +#define DATA(fg,bg) { COLOR_##fg, COLOR_##bg } + DATA(RED, WHITE), + DATA(GREEN, WHITE), + DATA(YELLOW, BLACK), + DATA(BLUE, WHITE), + DATA(MAGENTA, WHITE), + DATA(MAGENTA, BLACK), + DATA(CYAN, WHITE), + DATA(CYAN, BLACK), +#undef DATA + }; + int n; + int pair = 1; + + use_colors = TRUE; + /* + * Discounting color-pair 0 (no color), make the next 8 color pairs + * useful for leaving a visually distinct trail of characters on the + * screen. + */ + for (n = 0; n < MAX_ANSI; ++n) { + init_pair((short) pair++, (short) table[n].fg, (short) table[n].bg); + } + /* + * After that, use color pairs for constructing a test-pattern, e.g., + * imitating xterm's scripts. + */ + if (fill_by == 0) { + if (COLORS <= 256) { + for (n = 0; n < COLORS; ++n) + init_pair((short) (n + MAX_ANSI), (short) n, (short) n); + } +#if HAVE_TIGETSTR && USE_WIDEC_SUPPORT + else { + int r_max, g_max, b_max; + + if (parse_rgb(&r_max, &g_max, &b_max) > 0) { + int rows = LINES - 1; + int cols = COLS - 1; + int b_delta = (b_max / rows); + int r_delta = (r_max / cols); + int g_delta = (g_max / cols); + int row = 0; + + b = 0; + using_rgb = TRUE; + while (row++ < rows) { + int col = 0; + r = 0; + g = g_max; + while (col++ < cols) { + int color = (((r * (g_max + 1)) + g) * (b_max + 1) + + b + MAX_ANSI); +#if USE_EXTENDED_COLOR + init_extended_pair(pair, color, color); +#else + init_pair(pair, color, color); +#endif + pair++; + r += r_delta; + g -= g_delta; + } + b += b_delta; + } + } + } +#endif + } + if ((fill_by == 0) && !replaying) { + /* + * Originally (before wide-characters) ncurses supported 16 colors. + */ + if (COLORS >= 16 && COLORS <= 256) { + mvprintw(2, 0, "System colors:\n"); + for (n = 0; n < 16; ++n) { + pair = n + MAX_ANSI; + addch((chtype) (' ' | COLOR_PAIR(pair))); + addch((chtype) (' ' | COLOR_PAIR(pair))); + if (((n + 1) % 8) == 0) + addch('\n'); + } + } + /* + * Even with ncurses, you need wide-character support to have more + * than 16 colors. + */ +#if USE_WIDEC_SUPPORT + if (COLORS == 88) { + cube = 4; + } else if (COLORS == 256) { + cube = 6; + } + if (cube != 0) { + cube0 = 16; + cube1 = cube0 + (cube * cube * cube); + + addch('\n'); + printw("Color cube, %dx%dx%d:\n", cube, cube, cube); + for (g = 0; g < cube; g++) { + for (r = 0; r < cube; r++) { + for (b = 0; b < cube; b++) { + pair = MAX_ANSI + + 16 + + (r * cube * cube) + (g * cube) + b; + setcchar(&mycc, mywc, 0, (short) pair, NULL); + add_wch(&mycc); + add_wch(&mycc); + } + addch(' '); + } + addch('\n'); + } + addch('\n'); + printw("Grayscale ramp:\n"); + for (n = cube1; n < COLORS; ++n) { + pair = n + MAX_ANSI; + setcchar(&mycc, mywc, 0, (short) pair, NULL); + add_wch(&mycc); + add_wch(&mycc); + } + } else if ((COLORS > 256) && using_rgb) { + int rows = LINES - 1; + int cols = COLS - 1; + int row = 0; + + b = 0; + pair = MAX_ANSI; + while (row++ < rows) { + int col = 0; + while (col++ < cols) { + setcchar(&mycc, mywc, 0, (short) pair, &pair); + add_wch(&mycc); + ++pair; + } + addch('\n'); + } + addch('\n'); + } +#endif + } + } + + if (fill_by != 0) { + FILE *fp = fopen(fill_by, "r"); + if (fp != 0) { + bool filled = FALSE; + move(1, 0); + while ((ch = fgetc(fp)) != EOF) { + if (addch(UChar(ch)) == ERR) { + filled = TRUE; + break; + } + } + fclose(fp); + if (!filled) { + while (addch(' ') != ERR) { + ; + } + } + move(0, 0); + } else { + stop_curses(); + fprintf(stderr, "Cannot open \"%s\"\n", fill_by); + ExitProgram(EXIT_FAILURE); } } @@ -202,14 +507,14 @@ main(int argc, char *argv[]) * Use the last file as the initial/current screen. */ if (last < 0) { - endwin(); + stop_curses(); printf("No screen-dumps given\n"); ExitProgram(EXIT_FAILURE); } which = last; if (load_screen(files[which]) == ERR) { - endwin(); + stop_curses(); printf("Cannot load screen-dump %s\n", files[which]); ExitProgram(EXIT_FAILURE); } @@ -227,7 +532,6 @@ main(int argc, char *argv[]) done = TRUE; break; case 'q': - endwin(); cleanup(files); done = TRUE; break; @@ -240,6 +544,9 @@ main(int argc, char *argv[]) if (++which > last) which = 0; break; + case HELP_KEY_1: + replay_help(); + break; default: beep(); continue; @@ -256,46 +563,34 @@ main(int argc, char *argv[]) wrefresh(curscr); } } + endwin(); } else { - int y; - int x; - - move(2, 0); - printw("Use h,j,k,l or arrows to move around the screen\n"); - printw("Press 'q' to quit, ' ' to dump a screen\n"); - printw("When the last screen has been dumped, press 'n' to run the\n"); - printw("screen-loader. That allows only 'q', backspace and ' ' for\n"); - printw("stepping through the dumped/restored screens.\n"); - getyx(stdscr, y, x); + int y = 0; + int x = 0; + int color = 0; + int altchars = 0; + bool dirty = use_colors || (fill_by != 0); while (!done) { - switch (get_command(which, last)) { + switch (get_command(color, which, last)) { case 'n': + if (dirty && files[which]) { + dump_screen(files, color, which, last, use_colors); + } setup_next(); done = TRUE; break; case 'q': - endwin(); cleanup(files); done = TRUE; break; case ' ': - if (files[which] != 0) { - show_what(which + 1, last); - if (scr_dump(files[which]) == ERR) { - endwin(); - printf("Cannot write screen-dump %s\n", files[which]); - cleanup(files); - done = TRUE; - break; - } - ++which; - if (has_colors()) { - short pair = (short) (which % COLOR_PAIRS); - bkgd((chtype) COLOR_PAIR(pair)); - } + if (dump_screen(files, color, which, last, use_colors)) { + which = (which + 1) % MAX_ANSI; + dirty = FALSE; } else { - beep(); + setup_next(); + done = TRUE; } break; case KEY_LEFT: @@ -318,23 +613,41 @@ main(int argc, char *argv[]) if (++x >= COLS) x = 0; break; + case 'a': + altchars = !altchars; + break; + case 'c': + if (use_colors) { + color = (color + 1) % MAX_ANSI; + } + break; + case HELP_KEY_1: + editor_help(); + break; + default: + beep(); + continue; } if (!done) { - time_t now = time((time_t *) 0); - - move(0, 0); - addstr(ctime(&now)); + chtype attr = A_REVERSE; + chtype ch2 = (altchars ? MyMarker : '#'); + if (use_colors) { + attr |= (chtype) COLOR_PAIR(color); + } move(y, x); - addch('#' | A_REVERSE); + AddCh(ch2 | attr); move(y, x); + dirty = TRUE; } } + endwin(); } ExitProgram(EXIT_SUCCESS); } + #else int -main(int argc, char *argv[]) +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { printf("This program requires the screen-dump functions\n"); ExitProgram(EXIT_FAILURE); diff --git a/test/savescreen.sh b/test/savescreen.sh index e49aa1735061..56570e7e3cc4 100755 --- a/test/savescreen.sh +++ b/test/savescreen.sh @@ -1,6 +1,6 @@ #!/bin/sh ############################################################################## -# Copyright (c) 2007,2009 Free Software Foundation, Inc. # +# Copyright (c) 2007-2009,2018 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"), # @@ -26,14 +26,23 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: savescreen.sh,v 1.4 2009/10/10 17:08:45 tom Exp $ +# $Id: savescreen.sh,v 1.5 2018/01/06 00:04:14 tom Exp $ # # Use this script to exercise "savescreen". # It starts by generating a series of temporary-filenames, which are passed # to the test-program. Loop as long as the first file named exists. + +: ${TMPDIR:=/tmp} + +# "mktemp -d" would be preferable, but is not standard. +MY_DIR=$TMPDIR/savescreen$$ +trap "rm -rf $MY_DIR" EXIT INT QUIT HUP +umask 077 +mkdir $MY_DIR || exit 1 + PARAMS= NFILES=4 -PREFIX=savescreen-$$ +PREFIX=$MY_DIR/savescreen n=0 BEGINS=$PREFIX-$n.tmp while test $n != $NFILES @@ -43,12 +52,12 @@ do n=`expr $n + 1` done -./savescreen $PARAMS +${0%.sh} $PARAMS if test -f $BEGINS then while test -f $BEGINS do - ./savescreen -r $PARAMS + ${0%.sh} -r $PARAMS test $? != 0 && break done else diff --git a/test/sp_tinfo.c b/test/sp_tinfo.c new file mode 100644 index 000000000000..c0a67137c7cb --- /dev/null +++ b/test/sp_tinfo.c @@ -0,0 +1,351 @@ +/**************************************************************************** + * Copyright (c) 2017,2019 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: sp_tinfo.c,v 1.22 2019/04/06 20:42:57 tom Exp $ + * + * TOTO: add option for non-sp-funcs interface + */ + +#define USE_TINFO +#include + +#if HAVE_TPUTS_SP +/* + * The higher-level curses library stores a TERMINAL* inside SCREEN, but the + * latter is opaque. This structure helps us keep the two associated. + */ +typedef struct { + const char *name; + FILE *fp; + SCREEN *sp; + TERMINAL *term; + int (*outc) (SCREEN *, int); +} MYDATA; + +static bool opt_n = FALSE; /* true to suppress new_prescr */ +static bool opt_t = FALSE; /* true to use termcap */ + +static int +my_outc(SCREEN *sp, int ch) +{ + (void) sp; + return fputc(ch, stdout); +} + +static int +my_errc(SCREEN *sp, int ch) +{ + (void) sp; + return fputc(ch, stderr); +} + +static MYDATA * +initialize(const char *name, FILE *output) +{ + MYDATA *result = typeCalloc(MYDATA, 1); + int error; + + result->fp = output; + result->name = name; + result->outc = (fileno(output) == 1) ? my_outc : my_errc; + result->sp = opt_n ? NULL : new_prescr(); + + if (opt_t) { + char *temp = strdup(name); + tgetent_sp(result->sp, temp, name); + free(temp); + } else { + setupterm((NCURSES_CONST char *) name, fileno(output), &error); + } + result->term = cur_term; + + return result; +} + +static void +show_flag(MYDATA * data, const char *name, int value) +{ + if (value < 0) { + fprintf(data->fp, " %s = (unknown)\n", name); + } else if (value == 0) { + fprintf(data->fp, " %s = false\n", name); + } else { + fprintf(data->fp, " %s = true\n", name); + } +} + +#define TC_PARMS data->sp, (NCURSES_CONST char *)tc +#define TI_PARMS data->sp, (NCURSES_CONST char *)ti + +static void +show_cap_flag(MYDATA * data, const char *ti, const char *tc) +{ + const char *name = (opt_t ? tc : ti); + show_flag(data, name, (opt_t + ? tgetflag_sp(TC_PARMS) + : tigetflag_sp(TI_PARMS))); +} + +static void +show_number(MYDATA * data, const char *name, int value) +{ + if (value <= -2) { + fprintf(data->fp, " %s = (unknown)\n", name); + } else if (value <= -1) { + fprintf(data->fp, " %s = (missing)\n", name); + } else { + fprintf(data->fp, " %s = %d\n", name, value); + } +} + +static void +show_cap_number(MYDATA * data, const char *ti, const char *tc) +{ + const char *name = (opt_t ? tc : ti); + show_number(data, name, (opt_t + ? tgetnum_sp(TC_PARMS) + : tigetnum_sp(TI_PARMS))); +} + +static void +show_string(MYDATA * data, const char *name, const char *value) +{ + fprintf(data->fp, " %s = ", name); + if (value == 0) { + fprintf(data->fp, "(missing)"); + } else if (value == (char *) -1) { + fprintf(data->fp, "(canceled)"); + } else { + int ch; + while ((ch = UChar(*value++)) != '\0') { + if (ch < 32) { + fprintf(data->fp, "^%c", ch | '@'); + } else if (ch == 127) { + fprintf(data->fp, "^?"); + } else if (ch > 127) { + fprintf(data->fp, "\\%03o", ch); + } else { + fprintf(data->fp, "%c", ch); + } + } + } + fprintf(data->fp, "\n"); +} + +static void +show_cap_string(MYDATA * data, const char *ti, const char *tc) +{ + const char *name = (opt_t ? tc : ti); + char tcapjunk[1024]; + char *tcap_ptr = tcapjunk; + show_string(data, name, (opt_t + ? tgetstr_sp(TC_PARMS, &tcap_ptr) + : tigetstr_sp(TI_PARMS))); +} + +static void +show_char(MYDATA * data, const char *name, int value) +{ + if (value < 0) { + show_string(data, name, "(missing)"); + } else { + char temp[2]; + temp[0] = (char) value; + temp[1] = '\0'; + show_string(data, name, temp); + } +} + +static void +do_stuff(MYDATA * data) +{ + SCREEN *sp = data->sp; +#if NCURSES_EXT_FUNCS + char *s; + int my_code = 1234; + const char *my_text = "\033[?m"; +#endif + + set_curterm_sp(sp, data->term); + + /* putp always goes to standard output */ + putp_sp(sp, "Hello "); + putp_sp(sp, data->name); + putp_sp(sp, "!\n"); + + fprintf(data->fp, "Term: %s\n", termname_sp(sp)); + fprintf(data->fp, "Long: %s\n", longname_sp(sp)); + show_cap_flag(data, "am", "am"); + show_cap_number(data, "lines", "li"); + show_cap_string(data, "clear", "cl"); + show_cap_string(data, "tbc", "ct"); + show_flag(data, "has_ic", has_ic_sp(sp)); + show_flag(data, "has_il", has_il_sp(sp)); + show_number(data, "baudrate", baudrate_sp(sp)); + show_char(data, "erase ch", erasechar_sp(sp)); + show_char(data, "kill ch", killchar_sp(sp)); + show_string(data, "unctrl", unctrl_sp(sp, 033)); + fflush(data->fp); + +#if NCURSES_EXT_FUNCS + define_key_sp(sp, my_text, my_code); + has_key_sp(sp, 0); + key_defined_sp(sp, my_text); + if ((s = keybound_sp(sp, my_code, 0)) != 0) + free(s); +#endif + keyname_sp(sp, '?'); +#if NCURSES_EXT_FUNCS + keyok_sp(sp, my_code, FALSE); + keyok_sp(sp, my_code, TRUE); +#endif + + savetty_sp(sp); + + def_shell_mode_sp(sp); + + /* + * These functions are low-level settings for ncurses. + */ +#if NCURSES_EXT_FUNCS + set_tabsize_sp(sp, 5); /* waddch */ +#endif + typeahead_sp(sp, FALSE); /* waddch */ + use_env_sp(sp, FALSE); /* newterm */ + use_tioctl_sp(sp, FALSE); /* newterm */ + intrflush_sp(sp, 0, 0); /* wgetch */ + flushinp_sp(sp); /* waddch */ + halfdelay_sp(sp, 5); /* wgetch */ + + /* + * These manipulate the terminal modes, mainly for wgetch. + */ + cbreak_sp(sp); + raw_sp(sp); + def_prog_mode_sp(sp); + + delay_output_sp(sp, 200); + + napms_sp(sp, 10); + + nocbreak_sp(sp); + noqiflush_sp(sp); + noraw_sp(sp); + qiflush_sp(sp); + + resetty_sp(sp); + + tputs_sp(sp, "{reset-mode}\n", 0, data->outc); + + reset_prog_mode_sp(sp); + + curs_set_sp(sp, 0); + tputs_sp(sp, "{prog-mode}\n", 0, data->outc); + + reset_shell_mode_sp(sp); + + tputs_sp(sp, "{shell-mode}\n", 0, data->outc); +} + +static void +cleanup(MYDATA * data) +{ + set_curterm(data->term); + del_curterm(data->term); +#if !NO_LEAKS + free(data->sp); /* cannot use delscreen in tinfo */ +#endif + free(data); +} + +static void +usage(void) +{ + static const char *tbl[] = + { + "Usage: sp_tinfo [output] [error]", + "", + "Options:", + " -n suppress call to new_prescr()", + " -t use termcap functions rather than terminfo", + NULL + }; + size_t n; + for (n = 0; n < SIZEOF(tbl); ++n) { + fprintf(stderr, "%s\n", tbl[n]); + } + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc, char *argv[]) +{ + MYDATA *my_out; + MYDATA *my_err; + int n; + + while ((n = getopt(argc, argv, "nt")) != -1) { + switch (n) { + case 'n': + opt_n = TRUE; + break; + case 't': + opt_t = TRUE; + break; + default: + usage(); + /* NOTREACHED */ + } + } + argv += (optind - 1); + argc -= (optind - 1); + + if (argc > 3) + usage(); + + my_out = initialize((argc > 1) ? argv[1] : "vt100", stdout); + my_err = initialize((argc > 2) ? argv[2] : "ansi", stderr); + + do_stuff(my_out); + do_stuff(my_err); + + cleanup(my_out); + cleanup(my_err); + + ExitProgram(EXIT_SUCCESS); +} +#else +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + fprintf(stderr, + "This program requires the low-level ncurses sp-funcs tputs_sp\n"); + ExitProgram(EXIT_FAILURE); +} +#endif diff --git a/test/tclock.c b/test/tclock.c index 24f33827b449..6460c3147c75 100644 --- a/test/tclock.c +++ b/test/tclock.c @@ -1,22 +1,12 @@ -/* $Id: tclock.c,v 1.33 2013/09/28 21:52:34 tom Exp $ */ +/* $Id: tclock.c,v 1.41 2020/01/18 16:46:35 tom Exp $ */ +#define NEED_TIME_H #include #if HAVE_MATH_H #include -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - /* tclock - analog/digital clock for curses. If it gives you joy, then @@ -58,7 +48,7 @@ plot(int x, int y, int col) MvAddCh(y, x, (chtype) col); } -/* Draw a diagonal(arbitrary) line using Bresenham's alogrithm. */ +/* Draw a diagonal(arbitrary) line using Bresenham's algorithm. */ static void dline(int pair, int from_x, int from_y, int x2, int y2, int ch) { @@ -69,7 +59,7 @@ dline(int pair, int from_x, int from_y, int x2, int y2, int ch) int d; if (has_colors()) - (void) attrset((attr_t) COLOR_PAIR(pair)); + (void) attrset(AttrArg(COLOR_PAIR(pair), 0)); dx = x2 - from_x; dy = y2 - from_y; @@ -116,8 +106,28 @@ dline(int pair, int from_x, int from_y, int x2, int y2, int ch) } } +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: tclock [options]" + ,"" + ,"Options:" +#if HAVE_USE_DEFAULT_COLORS + ," -d invoke use_default_colors" +#endif + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(EXIT_FAILURE); +} + int -main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +main(int argc, char *argv[]) { int i, cx, cy; double cr, mradius, hradius, mangle, hangle; @@ -137,6 +147,24 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) struct timeval current; #endif double fraction = 0.0; +#if HAVE_USE_DEFAULT_COLORS + bool d_option = FALSE; +#endif + + while ((ch = getopt(argc, argv, "d")) != -1) { + switch (ch) { +#if HAVE_USE_DEFAULT_COLORS + case 'd': + d_option = TRUE; + break; +#endif + default: + usage(); + /* NOTREACHED */ + } + } + if (optind < argc) + usage(); setlocale(LC_ALL, ""); @@ -149,7 +177,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) if (has_colors()) { start_color(); #if HAVE_USE_DEFAULT_COLORS - if (use_default_colors() == OK) + if (d_option && (use_default_colors() == OK)) my_bg = -1; #endif init_pair(1, COLOR_RED, my_bg); @@ -175,7 +203,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) sangle = (i + 1) * (2.0 * PI) / 12.0; sdx = A2X(sangle, sradius); sdy = A2Y(sangle, sradius); - sprintf(szChar, "%d", i + 1); + _nc_SPRINTF(szChar, _nc_SLIMIT(sizeof(szChar)) "%d", i + 1); MvAddStr(cy - sdy, cx + sdx, szChar); } @@ -216,12 +244,12 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) attroff(A_REVERSE); if (has_colors()) - (void) attrset((attr_t) COLOR_PAIR(1)); + (void) attrset(AttrArg(COLOR_PAIR(1), 0)); dline(1, cx, cy, cx + sdx, cy - sdy, 'O'); if (has_colors()) - (void) attrset((attr_t) COLOR_PAIR(0)); + (void) attrset(AttrArg(COLOR_PAIR(0), 0)); text = ctime(&tim); MvPrintw(2, 0, "%.*s", (int) (strlen(text) - 1), text); @@ -254,8 +282,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) } - curs_set(1); - endwin(); + stop_curses(); ExitProgram(EXIT_SUCCESS); } #else diff --git a/test/terminal.xbm b/test/terminal.xbm new file mode 100644 index 000000000000..b8d9204bd687 --- /dev/null +++ b/test/terminal.xbm @@ -0,0 +1,52 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** name of Evans & Sutherland not be used in advertising or publi- **/ +/** city pertaining to distribution of the software without specif- **/ +/** ic, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND DISCLAIMS ALL WARRANTIES WITH REGARD TO **/ +/** THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILI- **/ +/** TY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND BE LIABLE **/ +/** FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAM- **/ +/** AGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, **/ +/** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS **/ +/** ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PER- **/ +/** FORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + +#define xterm_width 48 +#define xterm_height 48 +static char xterm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x03, 0x20, 0xfe, 0xff, 0xff, 0x1f, 0x05, + 0x20, 0x01, 0x00, 0x00, 0x20, 0x09, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x11, + 0xa0, 0xfc, 0xff, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, + 0xa0, 0xfc, 0x01, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, + 0xa0, 0xfc, 0xff, 0x3f, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, + 0xa0, 0xfc, 0x03, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, + 0xa0, 0xfc, 0xff, 0x01, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, + 0xa0, 0xfc, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, + 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, + 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, + 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, + 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x11, + 0xa0, 0x00, 0x00, 0x00, 0x40, 0x11, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x09, + 0xa0, 0x00, 0x00, 0x00, 0x40, 0x09, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x05, + 0x20, 0x01, 0x00, 0x00, 0x20, 0x05, 0x20, 0xfe, 0xff, 0xff, 0x1f, 0x03, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x00, 0x00, 0x00, 0x00, 0x03, + 0xa0, 0xaa, 0xaa, 0xaa, 0x2a, 0x03, 0x10, 0x00, 0x00, 0x00, 0x80, 0x02, + 0x50, 0x55, 0x55, 0x55, 0x95, 0x02, 0x08, 0x00, 0x00, 0x00, 0x40, 0x02, + 0xa8, 0xaa, 0xaa, 0xaa, 0x4a, 0x02, 0x04, 0x00, 0x00, 0x00, 0x20, 0x01, + 0xb4, 0xff, 0xff, 0xff, 0xad, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, + 0xfe, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/test/test.priv.h b/test/test.priv.h index d3915fba61b3..7a884fe32faf 100644 --- a/test/test.priv.h +++ b/test/test.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * + * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: test.priv.h,v 1.123 2014/02/01 22:09:27 tom Exp $ */ +/* $Id: test.priv.h,v 1.184 2019/12/14 23:25:29 tom Exp $ */ #ifndef __TEST_PRIV_H #define __TEST_PRIV_H 1 @@ -58,22 +58,50 @@ /* * Fallback definitions to accommodate broken compilers. */ +#ifndef HAVE_ALLOC_PAIR +#define HAVE_ALLOC_PAIR 0 +#endif + #ifndef HAVE_ASSUME_DEFAULT_COLORS #define HAVE_ASSUME_DEFAULT_COLORS 0 #endif +#ifndef HAVE_BSD_STRING_H +#define HAVE_BSD_STRING_H 0 +#endif + #ifndef HAVE_CURSES_VERSION #define HAVE_CURSES_VERSION 0 #endif +#ifndef HAVE_CURSCR +#define HAVE_CURSCR 0 +#endif + #ifndef HAVE_CHGAT #define HAVE_CHGAT 0 #endif +#ifndef HAVE_COLOR_CONTENT +#define HAVE_COLOR_CONTENT 0 +#endif + +#ifndef HAVE_COPYWIN +#define HAVE_COPYWIN 0 +#endif + #ifndef HAVE_COLOR_SET #define HAVE_COLOR_SET 0 #endif +#ifndef HAVE_DELSCREEN +#define HAVE_DELSCREEN 0 +#endif + +#ifndef HAVE_DUPWIN +#define HAVE_DUPWIN 0 +#endif + #ifndef HAVE_FILTER #define HAVE_FILTER 0 #endif @@ -106,6 +134,14 @@ #define HAVE_GETWIN 0 #endif +#ifndef HAVE_HALFDELAY +#define HAVE_HALFDELAY 0 +#endif + +#ifndef HAVE_INIT_EXTENDED_COLOR +#define HAVE_INIT_EXTENDED_COLOR 0 +#endif + #ifndef HAVE_LIBFORM #define HAVE_LIBFORM 0 #endif @@ -118,6 +154,10 @@ #define HAVE_LIBPANEL 0 #endif +#ifndef HAVE_LANGINFO_CODESET +#define HAVE_LANGINFO_CODESET 0 +#endif + #ifndef HAVE_LOCALE_H #define HAVE_LOCALE_H 0 #endif @@ -130,10 +170,18 @@ #define HAVE_MENU_H 0 #endif +#ifndef HAVE_MVDERWIN +#define HAVE_MVDERWIN 0 +#endif + #ifndef HAVE_MVVLINE #define HAVE_MVVLINE 0 #endif +#ifndef HAVE_MVWIN +#define HAVE_MVWIN 0 +#endif + #ifndef HAVE_MVWVLINE #define HAVE_MVWVLINE 0 #endif @@ -146,6 +194,10 @@ #define HAVE_NC_ALLOC_H 0 #endif +#ifndef HAVE_NEWPAD +#define HAVE_NEWPAD 0 +#endif + #ifndef HAVE_PANEL_H #define HAVE_PANEL_H 0 #endif @@ -154,10 +206,18 @@ #define HAVE_PUTWIN 0 #endif +#ifndef HAVE_RESET_COLOR_PAIRS +#define HAVE_RESET_COLOR_PAIRS 0 +#endif + #ifndef HAVE_RESIZE_TERM #define HAVE_RESIZE_TERM 0 #endif +#ifndef HAVE_RESTARTTERM +#define HAVE_RESTARTTERM 0 +#endif + #ifndef HAVE_RIPOFFLINE #define HAVE_RIPOFFLINE 0 #endif @@ -178,6 +238,14 @@ #define HAVE_SLK_INIT 0 #endif +#ifndef HAVE_STDINT_H +#define HAVE_STDINT_H 0 +#endif + +#ifndef HAVE_STRSTR +#define HAVE_STRSTR 0 +#endif + #ifndef HAVE_SYS_IOCTL_H #define HAVE_SYS_IOCTL_H 0 #endif @@ -214,6 +282,14 @@ #define HAVE_TIGETSTR 0 #endif +#ifndef HAVE_TPUTS_SP +#define HAVE_TPUTS_SP 0 +#endif + +#ifndef HAVE_TSEARCH +#define HAVE_TSEARCH 0 +#endif + #ifndef HAVE_TYPEAHEAD #define HAVE_TYPEAHEAD 0 #endif @@ -226,6 +302,14 @@ #define HAVE_USE_DEFAULT_COLORS 0 #endif +#ifndef HAVE_USE_ENV +#define HAVE_USE_ENV 0 +#endif + +#ifndef HAVE_USE_EXTENDED_NAMES +#define HAVE_USE_EXTENDED_NAMES 0 +#endif + #ifndef HAVE_USE_SCREEN #define HAVE_USE_SCREEN 0 #endif @@ -234,10 +318,26 @@ #define HAVE_USE_WINDOW 0 #endif +#ifndef HAVE_VIDPUTS +#define HAVE_VIDPUTS 0 +#endif + +#ifndef HAVE_VID_PUTS +#define HAVE_VID_PUTS 0 +#endif + +#ifndef HAVE_WINSDELLN +#define HAVE_WINSDELLN 0 +#endif + #ifndef HAVE_WRESIZE #define HAVE_WRESIZE 0 #endif +#ifndef HAVE__TRACEF +#define HAVE__TRACEF 0 +#endif + #ifndef NCURSES_EXT_FUNCS #define NCURSES_EXT_FUNCS 0 #endif @@ -342,6 +442,9 @@ extern int optind; #ifndef GCC_PRINTFLIKE #define GCC_PRINTFLIKE(a,b) /* nothing */ #endif +#ifndef GCC_SCANFLIKE +#define GCC_SCANFLIKE(a,b) /* nothing */ +#endif #ifndef GCC_UNUSED #define GCC_UNUSED /* nothing */ #endif @@ -350,6 +453,12 @@ extern int optind; #define getnstr(s,n) getstr(s) #endif +#if HAVE_INIT_EXTENDED_COLOR +#define USE_EXTENDED_COLOR 1 +#else +#define USE_EXTENDED_COLOR 0 +#endif + #ifndef USE_SOFTKEYS #if HAVE_SLK_INIT #define USE_SOFTKEYS 1 @@ -364,6 +473,24 @@ extern int optind; #define slk_clear() /* nothing */ #endif +#ifndef HAVE_CURSES_DATA_TABSIZE +#define HAVE_CURSES_DATA_TABSIZE 0 +#endif + +#if !NCURSES_EXT_FUNCS +#if HAVE_CURSES_DATA_TABSIZE +#define set_tabsize(n) TABSIZE = (n) +#else +#define set_tabsize(n) /* nothing */ +#endif +#endif + +#if HAVE_TPUTS_SP +#define USE_SP_FUNCS 1 +#else +#define USE_SP_FUNCS 0 +#endif + #ifndef HAVE_WSYNCDOWN #define wsyncdown(win) /* nothing */ #endif @@ -399,9 +526,9 @@ extern int optind; /* workaround, to build against NetBSD's variant of the form library */ #ifdef HAVE_NETBSD_FORM_H -#define form_getyx(form, y, x) y = current_field(form)->cursor_ypos, x = current_field(form)->cursor_xpos +#define form_getyx(form, y, x) y = (int)current_field(form)->cursor_ypos, x = (int)current_field(form)->cursor_xpos #else -#define form_getyx(form, y, x) y = (form)->currow, x = (form)->curcol +#define form_getyx(form, y, x) y = (int)(form)->currow, x = (int)(form)->curcol #endif /* workaround, to build against NetBSD's variant of the form library */ @@ -432,10 +559,6 @@ extern int optind; #define NCURSES_PAIRS_T short #endif -#ifndef NCURSES_OPAQUE -#define NCURSES_OPAQUE 0 -#endif - #ifndef CCHARW_MAX #define CCHARW_MAX 5 #endif @@ -479,38 +602,62 @@ extern int optind; #undef WACS_NEQUAL #undef WACS_STERLING -#define WACS_RARROW &(CURSES_WACS_ARRAY['+']) -#define WACS_LARROW &(CURSES_WACS_ARRAY[',']) -#define WACS_UARROW &(CURSES_WACS_ARRAY['-']) -#define WACS_DARROW &(CURSES_WACS_ARRAY['.']) -#define WACS_BLOCK &(CURSES_WACS_ARRAY['0']) -#define WACS_DIAMOND &(CURSES_WACS_ARRAY['`']) -#define WACS_CKBOARD &(CURSES_WACS_ARRAY['a']) -#define WACS_DEGREE &(CURSES_WACS_ARRAY['f']) -#define WACS_PLMINUS &(CURSES_WACS_ARRAY['g']) -#define WACS_BOARD &(CURSES_WACS_ARRAY['h']) -#define WACS_LANTERN &(CURSES_WACS_ARRAY['i']) -#define WACS_LRCORNER &(CURSES_WACS_ARRAY['j']) -#define WACS_URCORNER &(CURSES_WACS_ARRAY['k']) -#define WACS_ULCORNER &(CURSES_WACS_ARRAY['l']) -#define WACS_LLCORNER &(CURSES_WACS_ARRAY['m']) -#define WACS_PLUS &(CURSES_WACS_ARRAY['n']) -#define WACS_HLINE &(CURSES_WACS_ARRAY['q']) -#define WACS_S1 &(CURSES_WACS_ARRAY['o']) -#define WACS_S9 &(CURSES_WACS_ARRAY['s']) -#define WACS_LTEE &(CURSES_WACS_ARRAY['t']) -#define WACS_RTEE &(CURSES_WACS_ARRAY['u']) -#define WACS_BTEE &(CURSES_WACS_ARRAY['v']) -#define WACS_TTEE &(CURSES_WACS_ARRAY['w']) -#define WACS_VLINE &(CURSES_WACS_ARRAY['x']) -#define WACS_BULLET &(CURSES_WACS_ARRAY['~']) -#define WACS_S3 &(CURSES_WACS_ARRAY['p']) -#define WACS_S7 &(CURSES_WACS_ARRAY['r']) -#define WACS_LEQUAL &(CURSES_WACS_ARRAY['y']) -#define WACS_GEQUAL &(CURSES_WACS_ARRAY['z']) -#define WACS_PI &(CURSES_WACS_ARRAY['{']) -#define WACS_NEQUAL &(CURSES_WACS_ARRAY['|']) -#define WACS_STERLING &(CURSES_WACS_ARRAY['}']) +#define WACS_RARROW &(CURSES_WACS_ARRAY['+']) +#define WACS_LARROW &(CURSES_WACS_ARRAY[',']) +#define WACS_UARROW &(CURSES_WACS_ARRAY['-']) +#define WACS_DARROW &(CURSES_WACS_ARRAY['.']) +#define WACS_BLOCK &(CURSES_WACS_ARRAY['0']) +#define WACS_DIAMOND &(CURSES_WACS_ARRAY['`']) +#define WACS_CKBOARD &(CURSES_WACS_ARRAY['a']) +#define WACS_DEGREE &(CURSES_WACS_ARRAY['f']) +#define WACS_PLMINUS &(CURSES_WACS_ARRAY['g']) +#define WACS_BOARD &(CURSES_WACS_ARRAY['h']) +#define WACS_LANTERN &(CURSES_WACS_ARRAY['i']) +#define WACS_LRCORNER &(CURSES_WACS_ARRAY['j']) +#define WACS_URCORNER &(CURSES_WACS_ARRAY['k']) +#define WACS_ULCORNER &(CURSES_WACS_ARRAY['l']) +#define WACS_LLCORNER &(CURSES_WACS_ARRAY['m']) +#define WACS_PLUS &(CURSES_WACS_ARRAY['n']) +#define WACS_HLINE &(CURSES_WACS_ARRAY['q']) +#define WACS_S1 &(CURSES_WACS_ARRAY['o']) +#define WACS_S9 &(CURSES_WACS_ARRAY['s']) +#define WACS_LTEE &(CURSES_WACS_ARRAY['t']) +#define WACS_RTEE &(CURSES_WACS_ARRAY['u']) +#define WACS_BTEE &(CURSES_WACS_ARRAY['v']) +#define WACS_TTEE &(CURSES_WACS_ARRAY['w']) +#define WACS_VLINE &(CURSES_WACS_ARRAY['x']) +#define WACS_BULLET &(CURSES_WACS_ARRAY['~']) +#define WACS_S3 &(CURSES_WACS_ARRAY['p']) +#define WACS_S7 &(CURSES_WACS_ARRAY['r']) +#define WACS_LEQUAL &(CURSES_WACS_ARRAY['y']) +#define WACS_GEQUAL &(CURSES_WACS_ARRAY['z']) +#define WACS_PI &(CURSES_WACS_ARRAY['{']) +#define WACS_NEQUAL &(CURSES_WACS_ARRAY['|']) +#define WACS_STERLING &(CURSES_WACS_ARRAY['}']) +#endif + +#ifndef WA_NORMAL +#define WA_NORMAL A_NORMAL +#endif +#ifndef WA_BOLD +#define WA_BOLD A_BOLD +#endif +#ifndef WA_REVERSE +#define WA_REVERSE A_REVERSE +#endif +#ifndef WA_UNDERLINE +#define WA_UNDERLINE A_UNDERLINE +#endif +#ifndef WA_BLINK +#define WA_BLINK A_BLINK +#endif + +#ifndef OK +#define OK (0) +#endif + +#ifndef ERR +#define ERR (-1) #endif #undef CTRL @@ -523,12 +670,112 @@ extern int optind; #define KEY_MIN 256 /* not defined in Solaris 8 */ #endif +#define HELP_KEY_1 '?' +#define HELP_KEY_2 KEY_F(1) + +/* from nc_string.h, to make this stand alone */ +#if HAVE_BSD_STRING_H +#include +#endif + +#ifdef __cplusplus +#define NCURSES_VOID /* nothing */ +#else +#define NCURSES_VOID (void) +#endif + +#ifndef HAVE_STRLCAT +#define HAVE_STRLCAT 0 +#endif + +#ifndef HAVE_STRLCPY +#define HAVE_STRLCPY 0 +#endif + +#ifndef HAVE_SNPRINTF +#define HAVE_SNPRINTF 0 +#endif + +#ifndef USE_STRING_HACKS +#define USE_STRING_HACKS 0 +#endif + +#ifndef NCURSES_CAST +#ifdef __cplusplus +extern "C" { +#define NCURSES_CAST(type,value) static_cast(value) +#else +#define NCURSES_CAST(type,value) (type)(value) +#endif +#endif + +#if USE_STRING_HACKS && HAVE_STRLCAT +#define _nc_STRCAT(d,s,n) NCURSES_VOID strlcat((d),(s),NCURSES_CAST(size_t,n)) +#define _nc_STRNCAT(d,s,m,n) NCURSES_VOID strlcat((d),(s),NCURSES_CAST(size_t,m)) +#else +#define _nc_STRCAT(d,s,n) NCURSES_VOID strcat((d),(s)) +#define _nc_STRNCAT(d,s,m,n) NCURSES_VOID strncat((d),(s),(n)) +#endif + +#if USE_STRING_HACKS && HAVE_STRLCPY +#define _nc_STRCPY(d,s,n) NCURSES_VOID strlcpy((d),(s),NCURSES_CAST(size_t,n)) +#define _nc_STRNCPY(d,s,n) NCURSES_VOID strlcpy((d),(s),NCURSES_CAST(size_t,n)) +#else +#define _nc_STRCPY(d,s,n) NCURSES_VOID strcpy((d),(s)) +#define _nc_STRNCPY(d,s,n) NCURSES_VOID strncpy((d),(s),(n)) +#endif + +#if USE_STRING_HACKS && HAVE_SNPRINTF +#define _nc_SPRINTF NCURSES_VOID snprintf +#define _nc_SLIMIT(n) NCURSES_CAST(size_t,n), +#else +#define _nc_SPRINTF NCURSES_VOID sprintf +#define _nc_SLIMIT(n) /* nothing */ +#endif + +/* + * X/Open Curses does not define the arrays of terminfo/termcap names as SVr4 + * curses did, and some implementations provide them anyway, but undeclared. + */ #ifdef DECL_CURSES_DATA_BOOLNAMES extern char *boolnames[], *boolcodes[], *boolfnames[]; extern char *numnames[], *numcodes[], *numfnames[]; extern char *strnames[], *strcodes[], *strfnames[]; #endif +/* + * Again, an SVr4 curses feature latent in the libraries but not in headers. + */ +#ifndef DECL_CURSES_DATA_TABSIZE +#define DECL_CURSES_DATA_TABSIZE 0 +#endif + +#if DECL_CURSES_DATA_TABSIZE +extern int TABSIZE; +#undef HAVE_CURSES_DATA_TABSIZE +#define HAVE_CURSES_DATA_TABSIZE 1 +#endif + +#ifndef HAVE_CURSES_DATA_TABSIZE +#define HAVE_CURSES_DATA_TABSIZE 0 +#endif + +/* + * X/Open Curses provides termname(), whose return value is analogous to the + * SVr4 curses variable ttytype[]. + */ +#ifndef HAVE_CURSES_DATA_TTYTYPE +#define HAVE_CURSES_DATA_TTYTYPE 0 +#endif + +#ifndef DECL_CURSES_DATA_TTYTYPE +#define DECL_CURSES_DATA_TTYTYPE 0 +#endif + +#if !defined(ttytype) && (!HAVE_CURSES_DATA_TTYTYPE || DECL_CURSES_DATA_TTYTYPE) +#define ttytype termname() +#endif + #define colored_chtype(ch, attr, pair) \ ((chtype) (ch) | (chtype) (attr) | (chtype) COLOR_PAIR(pair)) @@ -569,18 +816,18 @@ extern char *strnames[], *strcodes[], *strfnames[]; * These usually are implemented as macros, but may be functions. */ #if !defined(getcurx) && !HAVE_GETCURX -#define getcurx(win) ((win)?(win)->_curx:ERR) -#define getcury(win) ((win)?(win)->_cury:ERR) +#define getcurx(win) ((win) ? ((int)(win)->_curx) : ERR) +#define getcury(win) ((win) ? ((int)(win)->_cury) : ERR) #endif #if !defined(getbegx) && !HAVE_GETBEGX -#define getbegx(win) ((win)?(win)->_begx:ERR) -#define getbegy(win) ((win)?(win)->_begy:ERR) +#define getbegx(win) ((win) ? ((int)(win)->_begx) : ERR) +#define getbegy(win) ((win) ? ((int)(win)->_begy) : ERR) #endif #if !defined(getmaxx) && !HAVE_GETMAXX -#define getmaxx(win) ((win)?((win)->_maxx + 1):ERR) -#define getmaxy(win) ((win)?((win)->_maxy + 1):ERR) +#define getmaxx(win) ((win) ? ((int)(win)->_maxx + 1) : ERR) +#define getmaxy(win) ((win) ? ((int)(win)->_maxy + 1) : ERR) #endif /* @@ -634,6 +881,15 @@ extern char *strnames[], *strcodes[], *strfnames[]; #define NCURSES_XNAMES 0 #endif +/* + * ncurses restores the cursor in endwin(). Other libraries may not. + */ +#ifdef NCURSES_VERSION +#define stop_curses() endwin() +#else +#define stop_curses() do { endwin(); curs_set(1); } while (0) +#endif + /* ncurses implements tparm() with varargs, X/Open with a fixed-parameter list * (which is incompatible with legacy usage, doesn't solve any problems). */ @@ -648,12 +904,12 @@ extern char *strnames[], *strcodes[], *strfnames[]; #include #if HAVE_NC_FREEALL && defined(USE_TINFO) #undef ExitProgram -#define ExitProgram(code) _nc_free_tinfo(code) +#define ExitProgram(code) exit_terminfo(code) #endif #else -#define typeMalloc(type,n) (type *) malloc((n) * sizeof(type)) -#define typeCalloc(type,elts) (type *) calloc((elts), sizeof(type)) -#define typeRealloc(type,n,p) (type *) realloc(p, (n) * sizeof(type)) +#define typeMalloc(type,n) (type *) malloc((size_t)(n) * sizeof(type)) +#define typeCalloc(type,elts) (type *) calloc((size_t)(elts), sizeof(type)) +#define typeRealloc(type,n,p) (type *) realloc(p, (size_t)(n) * sizeof(type)) #endif #ifndef ExitProgram @@ -667,7 +923,7 @@ extern char *strnames[], *strcodes[], *strfnames[]; #define EXIT_FAILURE 1 #endif -#if defined(__MINGW32__) +#if defined(_WIN32) || defined(USE_WIN32CON_DRIVER) #if defined(PDCURSES) #ifdef WINVER @@ -699,13 +955,42 @@ extern char *strnames[], *strcodes[], *strfnames[]; #endif +#ifdef NEED_TIME_H +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif +#endif + +/* + * Ultrix 3.1 + */ +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif + +#if !HAVE_STRSTR +extern char *_nc_strstr(const char *, const char *); +#define strstr(a,b) _nc_strstr((a),(b)) +#endif /* !HAVE_STRSTR */ + /* Use this to quiet gcc's -Wwrite-strings warnings, but accommodate SVr4 * curses which doesn't have const parameters declared (so far) in the places * that XSI shows. */ #ifndef NCURSES_CONST +#ifdef PDCURSES +#define NCURSES_CONST const /* close enough */ +#else #define NCURSES_CONST /* nothing */ #endif +#endif /* out-of-band values for representing absent capabilities */ #define ABSENT_BOOLEAN ((signed char)-1) /* 255 */ @@ -723,12 +1008,18 @@ extern char *strnames[], *strcodes[], *strfnames[]; #define VT_ACSC "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~" -#define CATCHALL(handler) { \ +#define CATCHALL(handler) do { \ int nsig; \ for (nsig = SIGHUP; nsig < SIGTERM; ++nsig) \ if (nsig != SIGKILL) \ signal(nsig, handler); \ - } + } while(0) + +#ifdef NCURSES_VERSION +#define InitAndCatch(init,handler) do { CATCHALL(handler); init; } while (0) +#else +#define InitAndCatch(init,handler) do { init; CATCHALL(handler); } while (0) +#endif /* * Workaround for clean(er) compile with Solaris's legacy curses. @@ -783,9 +1074,25 @@ extern char *tgoto(char *, int, int); /* available, but not prototyped */ #endif /* - * ncurses uses const in some places where X/Open does (or did) not allow. + * ncurses provides a termcap interface; a few packagers replace or displace + * its header file with an incompatible one. The demo_termcap program uses + * the ncurses file, if available. */ #ifdef NCURSES_VERSION +#ifndef HAVE_NCURSES_TERMCAP_H +#define HAVE_NCURSES_TERMCAP_H 0 +#endif +#ifndef HAVE_TERMCAP_H +#define HAVE_TERMCAP_H 0 +#endif +#endif + +/* + * ncurses uses const in some places where X/Open does (or did) not allow. + */ +#if defined(NCURSES_CONST) +#define CONST_MENUS NCURSES_CONST +#elif defined(PDCURSES) #define CONST_MENUS const #else #define CONST_MENUS /* nothing */ @@ -797,10 +1104,12 @@ extern char *tgoto(char *, int, int); /* available, but not prototyped */ #if HAVE_USE_WINDOW #define USING_WINDOW(w,func) use_window(w, (NCURSES_WINDOW_CB) func, w) +#define USING_WINDOW1(w,func,safe) use_window(w, (NCURSES_WINDOW_CB) safe, NULL) #define USING_WINDOW2(w,func,data) use_window(w, (NCURSES_WINDOW_CB) func, data) #define WANT_USE_WINDOW() extern void _nc_want_use_window(void) #else -#define USING_WINDOW(w,func) func(w) +#define USING_WINDOW(w,func) func(w, NULL) +#define USING_WINDOW1(w,func,safe) func(w) #define USING_WINDOW2(w,func,data) func(w,data) #define WANT_USE_WINDOW() extern void _nc_want_use_window(void) #endif @@ -813,27 +1122,48 @@ extern char *tgoto(char *, int, int); /* available, but not prototyped */ #define WANT_USE_SCREEN() extern void _nc_want_use_screen(void) #endif -#ifdef TRACE +#if defined(TRACE) && HAVE__TRACEF #define Trace(p) _tracef p #define USE_TRACE 1 +#define START_TRACE() \ + if ((_nc_tracing & TRACE_MAXIMUM) == 0) { \ + int t = _nc_getenv_num("NCURSES_TRACE"); \ + if (t >= 0) \ + curses_trace((unsigned) t); \ + } +extern unsigned _nc_tracing; +extern int _nc_getenv_num(const char *); #else +#undef TRACE #define Trace(p) /* nothing */ #define USE_TRACE 0 +#define START_TRACE() /* nothing */ #endif #define Trace2(p) /* nothing */ -#define MvAddCh (void) mvaddch -#define MvWAddCh (void) mvwaddch -#define MvAddStr (void) mvaddstr -#define MvWAddStr (void) mvwaddstr -#define MvWAddChStr (void) mvwaddchstr -#define MvPrintw (void) mvprintw -#define MvWPrintw (void) mvwprintw -#define MvHLine (void) mvhline -#define MvWHLine (void) mvwhline -#define MvVLine (void) mvvline -#define MvWVLine (void) mvwvline +#define AddCh(c) (void) addch((chtype)(c)) +#define WAddCh(w,c) (void) waddch((w),(chtype)(c)) +#define MvAddCh(y,x,c) (void) mvaddch((y),(x),(chtype)(c)) +#define MvWAddCh(w,y,x,c) (void) mvwaddch((w),(y),(x),(chtype)(c)) +#define MvAddStr(y,x,s) (void) mvaddstr((y),(x),(s)) +#define MvWAddStr(w,y,x,s) (void) mvwaddstr((w),(y),(x),(s)) +#define MvWAddChStr(w,y,x,s) (void) mvwaddchstr((w),(y),(x),(s)) +#define MvPrintw (void) mvprintw +#define MvWPrintw (void) mvwprintw +#define MvHLine (void) mvhline +#define MvWHLine (void) mvwhline +#define MvVLine (void) mvvline +#define MvWVLine (void) mvwvline + +/* + * The macro likely uses unsigned values, while X/Open prototype uses int. + */ +#if defined(wattrset) || defined(PDCURSES) +#define AttrArg(p,a) (chtype) ((chtype)(p) | (chtype)(a)) +#else +#define AttrArg(p,a) (int) ((chtype)(p) | (chtype)(a)) +#endif /* * Workaround for defective implementation of gcc attribute warn_unused_result diff --git a/test/test_add_wchstr.c b/test/test_add_wchstr.c index c509f0035ac5..3e7f1bafcd80 100644 --- a/test/test_add_wchstr.c +++ b/test/test_add_wchstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2010-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 2009-2016,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_add_wchstr.c,v 1.20 2012/12/16 00:12:04 tom Exp $ + * $Id: test_add_wchstr.c,v 1.26 2017/04/15 15:15:25 tom Exp $ * * Demonstrate the waddwchstr() and wadd_wch functions. * Thomas Dickey - 2009/9/12 @@ -48,18 +48,24 @@ #define WIDE_LINEDATA #include +#undef AddCh #undef MvAddCh #undef MvAddStr #undef MvWAddCh +#undef MvWAddChStr #undef MvWAddStr +#undef WAddCh -/* definitions to make it simpler to compare with test_addstr.c */ +/* + * redefinitions to simplify comparison between test_*str programs + */ #define AddNStr add_wchnstr #define AddStr add_wchstr #define MvAddNStr (void) mvadd_wchnstr #define MvAddStr (void) mvadd_wchstr #define MvWAddNStr (void) mvwadd_wchnstr #define MvWAddStr (void) mvwadd_wchstr +#define MvWAddChStr(w,y,x,s) (void) mvwadd_wchstr((w),(y),(x),(s)) #define WAddNStr wadd_wchnstr #define WAddStr wadd_wchstr @@ -103,7 +109,7 @@ static size_t temp_length; && (temp = unctrl((chtype) have[0])) != 0 \ && strlen(temp) > 1) { \ while (*temp != '\0') { \ - have[0] = *temp++; \ + have[0] = (wchar_t) *temp++; \ setcchar(&temp_buffer[n++], have, A_NORMAL, 0, NULL); \ } \ } else { \ @@ -210,7 +216,7 @@ ColOf(wchar_t *buffer, int length, int margin) result += 2; break; default: - result += wcwidth(ch); + result += wcwidth((wchar_t) ch); if (ch < 32) ++result; break; @@ -291,7 +297,7 @@ AddCh(chtype ch) #define LEN(n) ((length - (n) > n_opt) ? n_opt : (length - (n))) static void -test_add_wchstr(int level) +recursive_test(int level) { static bool first = TRUE; @@ -306,14 +312,19 @@ test_add_wchstr(int level) WINDOW *work = 0; WINDOW *show = 0; int margin = (2 * MY_TABSIZE) - 1; - Options option = ((m_opt ? oMove : oDefault) - | ((w_opt || (level > 0)) ? oWindow : oDefault)); + Options option = (Options) ((unsigned) (m_opt + ? oMove + : oDefault) + | (unsigned) ((w_opt || (level > 0)) + ? oWindow + : oDefault)); if (first) { static char cmd[80]; setlocale(LC_ALL, ""); - putenv(strcpy(cmd, "TABSIZE=8")); + _nc_STRCPY(cmd, "TABSIZE=8", sizeof(cmd)); + putenv(cmd); initscr(); (void) cbreak(); /* take input chars one at a time, no wait for \n */ @@ -351,8 +362,8 @@ test_add_wchstr(int level) MvWVLine(work, row, margin + 1, ACS_VLINE, limit - 2); limit /= 2; - (void) mvwadd_wchstr(work, 1, 2, ChStr("String")); - (void) mvwadd_wchstr(work, limit + 1, 2, ChStr("Chars")); + MvWAddChStr(work, 1, 2, ChStr("String")); + MvWAddChStr(work, limit + 1, 2, ChStr("Chars")); wnoutrefresh(work); buffer[length = 0] = '\0'; @@ -369,7 +380,7 @@ test_add_wchstr(int level) wmove(work, row, margin + 1); switch (ch) { case key_RECUR: - test_add_wchstr(level + 1); + recursive_test(level + 1); if (look) touchwin(look); @@ -468,7 +479,7 @@ test_add_wchstr(int level) } break; default: - buffer[length++] = ch; + buffer[length++] = (wchar_t) ch; buffer[length] = '\0'; /* put the string in, one character at a time */ @@ -582,8 +593,11 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) if (optind < argc) usage(); - test_add_wchstr(0); + recursive_test(0); endwin(); +#if NO_LEAKS + free(temp_buffer); +#endif ExitProgram(EXIT_SUCCESS); } #else diff --git a/test/test_addchstr.c b/test/test_addchstr.c index 2aae844e7651..2158d147982e 100644 --- a/test/test_addchstr.c +++ b/test/test_addchstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2009-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2009-2016,2017 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,16 +26,18 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_addchstr.c,v 1.18 2012/12/16 00:36:27 tom Exp $ + * $Id: test_addchstr.c,v 1.24 2017/09/28 23:10:29 tom Exp $ * * Demonstrate the waddchstr() and waddch functions. * Thomas Dickey - 2009/9/12 */ #include - #include +/* + * redefinitions to simplify comparison between test_*str programs + */ #undef MvAddStr #undef MvWAddStr @@ -48,9 +50,6 @@ #define WAddNStr waddchnstr #define WAddStr waddchstr -#define AddCh addch -#define WAddCh waddch - #define MY_TABSIZE 8 typedef enum { @@ -65,7 +64,7 @@ static bool pass_ctls = FALSE; static bool w_opt = FALSE; static int n_opt = -1; -static attr_t show_attr; +static chtype show_attr; static chtype *temp_buffer; static size_t temp_length; @@ -207,7 +206,7 @@ ColOf(char *buffer, int length, int margin) #define LEN(n) ((length - (n) > n_opt) ? n_opt : (length - (n))) static void -test_adds(int level) +recursive_test(int level) { static bool first = TRUE; @@ -233,7 +232,8 @@ test_adds(int level) static char cmd[80]; setlocale(LC_ALL, ""); - putenv(strcpy(cmd, "TABSIZE=8")); + _nc_STRCPY(cmd, "TABSIZE=8", sizeof(cmd)); + putenv(cmd); initscr(); (void) cbreak(); /* take input chars one at a time, no wait for \n */ @@ -282,7 +282,7 @@ test_adds(int level) doupdate(); if (has_colors()) { - show_attr = (attr_t) COLOR_PAIR(1); + show_attr = (chtype) COLOR_PAIR(1); wbkgdset(work, show_attr | ' '); } else { show_attr = A_STANDOUT; @@ -292,7 +292,7 @@ test_adds(int level) wmove(work, row, margin + 1); switch (ch) { case key_RECUR: - test_adds(level + 1); + recursive_test(level + 1); if (look) touchwin(look); @@ -512,7 +512,10 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) if (optind < argc) usage(); - test_adds(0); + recursive_test(0); endwin(); +#if NO_LEAKS + free(temp_buffer); +#endif ExitProgram(EXIT_SUCCESS); } diff --git a/test/test_addstr.c b/test/test_addstr.c index a14cdedcc9e0..2bb1d02f6b18 100644 --- a/test/test_addstr.c +++ b/test/test_addstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2009-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2009-2016,2017 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,16 +26,18 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_addstr.c,v 1.10 2012/12/16 00:14:10 tom Exp $ + * $Id: test_addstr.c,v 1.15 2017/09/06 09:27:34 tom Exp $ * * Demonstrate the waddstr() and waddch functions. * Thomas Dickey - 2009/9/12 */ #include - #include +/* + * redefinitions to simplify comparison between test_*str programs + */ #define AddNStr addnstr #define AddStr addstr #define MvAddNStr (void) mvaddnstr @@ -43,9 +45,6 @@ #define WAddNStr waddnstr #define WAddStr waddstr -#define AddCh addch -#define WAddCh waddch - #define MY_TABSIZE 8 typedef enum { @@ -129,7 +128,7 @@ ColOf(char *buffer, int length, int margin) #define LEN(n) ((length - (n) > n_opt) ? n_opt : (length - (n))) static void -test_adds(int level) +recursive_test(int level) { static bool first = TRUE; @@ -155,7 +154,8 @@ test_adds(int level) static char cmd[80]; setlocale(LC_ALL, ""); - putenv(strcpy(cmd, "TABSIZE=8")); + _nc_STRCPY(cmd, "TABSIZE=8", sizeof(cmd)); + putenv(cmd); initscr(); (void) cbreak(); /* take input chars one at a time, no wait for \n */ @@ -211,7 +211,7 @@ test_adds(int level) wmove(work, row, margin + 1); switch (ch) { case key_RECUR: - test_adds(level + 1); + recursive_test(level + 1); if (look) touchwin(look); @@ -423,7 +423,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) if (optind < argc) usage(); - test_adds(0); + recursive_test(0); endwin(); ExitProgram(EXIT_SUCCESS); } diff --git a/test/test_addwstr.c b/test/test_addwstr.c index cb057faf955a..75a100dd0266 100644 --- a/test/test_addwstr.c +++ b/test/test_addwstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2009-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2009-2016,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_addwstr.c,v 1.11 2012/12/16 00:11:18 tom Exp $ + * $Id: test_addwstr.c,v 1.16 2017/04/15 15:08:03 tom Exp $ * * Demonstrate the waddwstr() and wadd_wch functions. * Thomas Dickey - 2009/9/12 @@ -48,12 +48,16 @@ #define WIDE_LINEDATA #include +#undef AddCh #undef MvAddCh #undef MvAddStr #undef MvWAddCh #undef MvWAddStr +#undef WAddCh -/* definitions to make it simpler to compare with inserts.c */ +/* + * redefinitions to simplify comparison between test_*str programs + */ #define AddNStr addnwstr #define AddStr addwstr #define MvAddNStr (void) mvaddnwstr @@ -103,8 +107,7 @@ legend(WINDOW *win, int level, Options state, wchar_t *buffer, int length) wprintw(win, "down-arrow or ^N to repeat on next line, ^W for inner window, ESC to exit.\n"); wclrtoeol(win); - wprintw(win, "Level %d,%s inserted %d characters <", level, - showstate, length); + wprintw(win, "Level %d,%s added %d characters <", level, showstate, length); waddwstr(win, buffer); waddstr(win, ">"); } @@ -137,7 +140,7 @@ ColOf(wchar_t *buffer, int length, int margin) result += 2; break; default: - result += wcwidth(ch); + result += wcwidth((wchar_t) ch); if (ch < 32) ++result; break; @@ -218,7 +221,7 @@ AddCh(chtype ch) #define LEN(n) ((length - (n) > n_opt) ? n_opt : (length - (n))) static void -test_inserts(int level) +recursive_test(int level) { static bool first = TRUE; @@ -233,15 +236,19 @@ test_inserts(int level) WINDOW *work = 0; WINDOW *show = 0; int margin = (2 * MY_TABSIZE) - 1; - Options option = (Options) ((int) (m_opt ? oMove : oDefault) - | (int) ((w_opt || (level > 0)) - ? oWindow : oDefault)); + Options option = (Options) ((unsigned) (m_opt + ? oMove + : oDefault) + | (unsigned) ((w_opt || (level > 0)) + ? oWindow + : oDefault)); if (first) { static char cmd[80]; setlocale(LC_ALL, ""); - putenv(strcpy(cmd, "TABSIZE=8")); + _nc_STRCPY(cmd, "TABSIZE=8", sizeof(cmd)); + putenv(cmd); initscr(); (void) cbreak(); /* take input chars one at a time, no wait for \n */ @@ -249,7 +256,7 @@ test_inserts(int level) keypad(stdscr, TRUE); /* - * Show the characters inserted in color, to distinguish from those that + * Show the characters added in color, to distinguish from those that * are shifted. */ if (has_colors()) { @@ -297,7 +304,7 @@ test_inserts(int level) wmove(work, row, margin + 1); switch (ch) { case key_RECUR: - test_inserts(level + 1); + recursive_test(level + 1); if (look) touchwin(look); @@ -367,7 +374,7 @@ test_inserts(int level) break; } - /* do the corresponding single-character insertion */ + /* do the corresponding single-character add */ row2 = limit + row; for (col = 0; col < length; ++col) { col2 = ColOf(buffer, col, margin); @@ -398,7 +405,7 @@ test_inserts(int level) ch = '\b'; /* FALLTHRU */ default: - buffer[length++] = ch; + buffer[length++] = (wchar_t) ch; buffer[length] = '\0'; /* put the string in, one character at a time */ @@ -422,7 +429,7 @@ test_inserts(int level) break; } - /* do the corresponding single-character insertion */ + /* do the corresponding single-character add */ switch (option) { case oDefault: if (move(limit + row, col) != ERR) { @@ -463,12 +470,12 @@ usage(void) { static const char *tbl[] = { - "Usage: inserts [options]" + "Usage: test_addwstr [options]" ,"" ,"Options:" ," -f FILE read data from given file" - ," -n NUM limit string-inserts to NUM bytes on ^N replay" - ," -m perform wmove/move separately from insert-functions" + ," -n NUM limit string-adds to NUM bytes on ^N replay" + ," -m perform wmove/move separately from add-functions" ," -w use window-parameter even when stdscr would be implied" }; unsigned n; @@ -508,7 +515,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) if (optind < argc) usage(); - test_inserts(0); + recursive_test(0); endwin(); ExitProgram(EXIT_SUCCESS); } diff --git a/test/test_arrays.c b/test/test_arrays.c index e4b9fb1d391a..f051a815d875 100644 --- a/test/test_arrays.c +++ b/test/test_arrays.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 2007-2010,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_arrays.c,v 1.5 2010/11/13 19:57:57 tom Exp $ + * $Id: test_arrays.c,v 1.8 2017/10/07 23:55:21 tom Exp $ * * Author: Thomas E Dickey * @@ -50,7 +50,14 @@ extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[]; #if HAVE_TIGETSTR #if defined(HAVE_CURSES_DATA_BOOLNAMES) || defined(DECL_CURSES_DATA_BOOLNAMES) -#define DUMP(name) dump_array(#name, name) +static bool opt_C; +static bool opt_T; +static bool opt_c; +static bool opt_f; +static bool opt_n; +static bool opt_t; + +#define PLAIN(opts, name) if (opts) dump_array(#name, name) static void dump_array(const char *name, NCURSES_CONST char *const *list) @@ -63,20 +70,139 @@ dump_array(const char *name, NCURSES_CONST char *const *list) } } +static void +dump_plain(void) +{ + PLAIN(opt_T && opt_n, boolnames); + PLAIN(opt_C && opt_c, boolcodes); + PLAIN(opt_T && opt_f, boolfnames); + + PLAIN(opt_T && opt_n, numnames); + PLAIN(opt_C && opt_c, numcodes); + PLAIN(opt_T && opt_f, numfnames); + + PLAIN(opt_T && opt_n, strnames); + PLAIN(opt_C && opt_c, strcodes); + PLAIN(opt_T && opt_f, strfnames); +} + +#define STRING(opts, name) if (opts) { printf("%s\"%s\"", c++ ? "," : "", name); } +#define NUMBER(opts, value) if (opts) { printf("%s%d", c++ ? "," : "", value); } + +static void +dump_table(void) +{ + int c = 0; + int r; + + STRING(opt_t, "Index"); + STRING(opt_t, "Type"); + STRING(opt_n, "Name"); + STRING(opt_c, "Code"); + STRING(opt_f, "FName"); + printf("\n"); + + for (r = 0; boolnames[r]; ++r) { + c = 0; + NUMBER(opt_t, r); + STRING(opt_t, "bool"); + STRING(opt_T && opt_n, boolnames[r]); + STRING(opt_C && opt_c, boolcodes[r]); + STRING(opt_T && opt_f, boolfnames[r]); + printf("\n"); + } + + for (r = 0; numnames[r]; ++r) { + c = 0; + NUMBER(opt_t, r); + STRING(opt_t, "num"); + STRING(opt_T && opt_n, numnames[r]); + STRING(opt_C && opt_c, numcodes[r]); + STRING(opt_T && opt_f, numfnames[r]); + printf("\n"); + } + + for (r = 0; strnames[r]; ++r) { + c = 0; + NUMBER(opt_t, r); + STRING(opt_t, "str"); + STRING(opt_T && opt_n, strnames[r]); + STRING(opt_C && opt_c, strcodes[r]); + STRING(opt_T && opt_f, strfnames[r]); + printf("\n"); + } +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: test_arrays [options]", + "", + "If no options are given, print all (boolean, numeric, string)", + "capability names showing their index within the tables.", + "", + "Options:", + " -C print termcap names", + " -T print terminfo names", + " -c print termcap names", + " -f print full terminfo names", + " -n print short terminfo names", + " -t print the result as CSV table", + }; + unsigned n; + for (n = 0; n < SIZEOF(msg); ++n) { + fprintf(stderr, "%s\n", msg[n]); + } + ExitProgram(EXIT_FAILURE); +} + int -main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +main(int argc, char *argv[]) { - DUMP(boolnames); - DUMP(boolcodes); - DUMP(boolfnames); + int n; + + while ((n = getopt(argc, argv, "CTcfnt")) != -1) { + switch (n) { + case 'C': + opt_C = TRUE; + break; + case 'T': + opt_T = TRUE; + break; + case 'c': + opt_c = TRUE; + break; + case 'f': + opt_f = TRUE; + break; + case 'n': + opt_n = TRUE; + break; + case 't': + opt_t = TRUE; + break; + default: + usage(); + /* NOTREACHED */ + } + } + if (optind < argc) + usage(); - DUMP(numnames); - DUMP(numcodes); - DUMP(numfnames); + if (!(opt_T || opt_C)) { + opt_T = opt_C = TRUE; + } + if (!(opt_c || opt_f || opt_n)) { + opt_c = opt_f = opt_n = TRUE; + } - DUMP(strnames); - DUMP(strcodes); - DUMP(strfnames); + if (opt_t) { + dump_table(); + } else { + dump_plain(); + } ExitProgram(EXIT_SUCCESS); } diff --git a/test/test_get_wstr.c b/test/test_get_wstr.c index dc01b0e69c07..f07c2e05d1ef 100644 --- a/test/test_get_wstr.c +++ b/test/test_get_wstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007-2009,2011 Free Software Foundation, Inc. * + * Copyright (c) 2007-2011,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_get_wstr.c,v 1.8 2011/01/15 18:15:11 tom Exp $ + * $Id: test_get_wstr.c,v 1.11 2017/09/28 23:10:54 tom Exp $ * * Author: Thomas E Dickey * @@ -43,6 +43,7 @@ */ #include +#include #if HAVE_CHGAT /* NetBSD curses wchgat */ @@ -79,14 +80,14 @@ Remainder(WINDOW *txtwin) static void ShowPrompt(WINDOW *txtwin, int limit) { - wchgat(txtwin, limit, A_REVERSE, 0, NULL); + wchgat(txtwin, limit, WA_REVERSE, 0, NULL); wnoutrefresh(txtwin); } static void MovePrompt(WINDOW *txtwin, int limit, int y, int x) { - wchgat(txtwin, Remainder(txtwin), A_NORMAL, 0, NULL); + wchgat(txtwin, Remainder(txtwin), WA_NORMAL, 0, NULL); wmove(txtwin, y, x); ShowPrompt(txtwin, limit); } @@ -134,8 +135,30 @@ ShowFlavor(WINDOW *strwin, WINDOW *txtwin, int flavor, int limit) } static int -test_get_wstr(int level, char **argv, WINDOW *strwin) +recursive_test(int level, char **argv, WINDOW *strwin) { + static const char *help[] = + { + "Commands:", + " q,^Q,ESC - quit this program", + " ^Q,ESC - quit help-screen", + "", + " p, - move beginning of prompt one up row", + " j, - move beginning of prompt one down row", + " h, - move beginning of prompt one left column", + " l, - move beginning of prompt one right column", + "", + " - - reduce getnstr buffer-size one column", + " + - increase getnstr buffer-size one column", + " : - prompt for input-text", + "", + " < - scroll \"left\" through getstr-functions", + " > - scroll \"right\" through getstr-functions", + "", + " w - recur to subwindow", + " ?, - show help-screen", + 0 + }; WINDOW *txtbox = 0; WINDOW *txtwin = 0; FILE *fp; @@ -225,7 +248,7 @@ test_get_wstr(int level, char **argv, WINDOW *strwin) break; case 'w': - test_get_wstr(level + 1, argv, strwin); + recursive_test(level + 1, argv, strwin); if (txtbox != 0) { touchwin(txtbox); wnoutrefresh(txtbox); @@ -311,10 +334,13 @@ test_get_wstr(int level, char **argv, WINDOW *strwin) } noecho(); (void) wattrset(txtwin, A_NORMAL); - wprintw(strwin, "%d", rc); + wprintw(strwin, "%s:", (rc == OK) ? "OK" : "ERR"); (void) waddwstr(strwin, (wchar_t *) buffer); wnoutrefresh(strwin); break; + case HELP_KEY_1: + popup_msg(stdscr, help); + break; default: beep(); break; @@ -349,7 +375,7 @@ main(int argc, char *argv[]) strwin = derwin(chrbox, 4, COLS - 2, 1, 1); - test_get_wstr(1, argv, strwin); + recursive_test(1, argv, strwin); endwin(); ExitProgram(EXIT_SUCCESS); diff --git a/test/test_getstr.c b/test/test_getstr.c index 3f64c77b4858..227394b1ef92 100644 --- a/test/test_getstr.c +++ b/test/test_getstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007-2009,2012 Free Software Foundation, Inc. * + * Copyright (c) 2007-2012,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_getstr.c,v 1.10 2012/07/07 18:22:49 tom Exp $ + * $Id: test_getstr.c,v 1.13 2017/09/28 23:11:12 tom Exp $ * * Author: Thomas E Dickey * @@ -43,6 +43,7 @@ */ #include +#include #if HAVE_CHGAT /* Solaris SVr4 curses lacks wchgat, mvgetnstr, mvwgetnstr */ @@ -86,14 +87,14 @@ Remainder(WINDOW *txtwin) static void ShowPrompt(WINDOW *txtwin, int limit) { - wchgat(txtwin, limit, A_REVERSE, 0, NULL); + wchgat(txtwin, limit, WA_REVERSE, 0, NULL); wnoutrefresh(txtwin); } static void MovePrompt(WINDOW *txtwin, int limit, int y, int x) { - wchgat(txtwin, Remainder(txtwin), A_NORMAL, 0, NULL); + wchgat(txtwin, Remainder(txtwin), WA_NORMAL, 0, NULL); wmove(txtwin, y, x); ShowPrompt(txtwin, limit); } @@ -141,8 +142,30 @@ ShowFlavor(WINDOW *strwin, WINDOW *txtwin, int flavor, int limit) } static int -test_getstr(int level, char **argv, WINDOW *strwin) +recursive_test(int level, char **argv, WINDOW *strwin) { + static const char *help[] = + { + "Commands:", + " q,^Q,ESC - quit this program", + " ^Q,ESC - quit help-screen", + "", + " p, - move beginning of prompt one up row", + " j, - move beginning of prompt one down row", + " h, - move beginning of prompt one left column", + " l, - move beginning of prompt one right column", + "", + " - - reduce getnstr buffer-size one column", + " + - increase getnstr buffer-size one column", + " : - prompt for input-text", + "", + " < - scroll \"left\" through getstr-functions", + " > - scroll \"right\" through getstr-functions", + "", + " w - recur to subwindow", + " ?, - show help-screen", + 0 + }; WINDOW *txtbox = 0; WINDOW *txtwin = 0; FILE *fp; @@ -233,7 +256,7 @@ test_getstr(int level, char **argv, WINDOW *strwin) break; case 'w': - test_getstr(level + 1, argv, strwin); + recursive_test(level + 1, argv, strwin); if (txtbox != 0) { touchwin(txtbox); wnoutrefresh(txtbox); @@ -322,6 +345,9 @@ test_getstr(int level, char **argv, WINDOW *strwin) wprintw(strwin, "%s:%s", ok_keyname(rc), buffer); wnoutrefresh(strwin); break; + case HELP_KEY_1: + popup_msg(stdscr, help); + break; default: beep(); break; @@ -356,7 +382,7 @@ main(int argc, char *argv[]) strwin = derwin(chrbox, 4, COLS - 2, 1, 1); - test_getstr(1, argv, strwin); + recursive_test(1, argv, strwin); endwin(); ExitProgram(EXIT_SUCCESS); diff --git a/test/test_instr.c b/test/test_instr.c index 627db08e2f3a..6dd16eb31abb 100644 --- a/test/test_instr.c +++ b/test/test_instr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007,2010 Free Software Foundation, Inc. * + * Copyright (c) 2007-2010,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_instr.c,v 1.5 2010/05/01 19:13:46 tom Exp $ + * $Id: test_instr.c,v 1.9 2017/09/06 09:27:45 tom Exp $ * * Author: Thomas E Dickey * @@ -68,7 +68,7 @@ showmore(WINDOW *win, int line, char *buffer) } static int -test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) +recursive_test(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) { WINDOW *txtbox = 0; WINDOW *txtwin = 0; @@ -85,6 +85,7 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) return FALSE; } + *buffer = '\0'; if (level > 1) { txtbox = newwin(LINES - BASE_Y, COLS - level, BASE_Y, level); box(txtbox, 0, 0); @@ -150,7 +151,7 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) beep(); break; case 'w': - test_inchs(level + 1, argv, chrwin, strwin); + recursive_test(level + 1, argv, chrwin, strwin); if (txtbox != 0) { touchwin(txtbox); wnoutrefresh(txtbox); @@ -253,7 +254,7 @@ main(int argc, char *argv[]) chrwin = derwin(chrbox, 2, COLS - 2, 1, 1); strwin = derwin(chrbox, 2, COLS - 2, 3, 1); - test_inchs(1, argv, chrwin, strwin); + recursive_test(1, argv, chrwin, strwin); endwin(); ExitProgram(EXIT_SUCCESS); diff --git a/test/test_inwstr.c b/test/test_inwstr.c index 3d2656f3aeae..5bd46c9a310f 100644 --- a/test/test_inwstr.c +++ b/test/test_inwstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007,2010 Free Software Foundation, Inc. * + * Copyright (c) 2007-2010,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_inwstr.c,v 1.4 2010/05/01 19:13:46 tom Exp $ + * $Id: test_inwstr.c,v 1.5 2017/04/15 14:14:48 tom Exp $ * * Author: Thomas E Dickey * @@ -70,7 +70,7 @@ showmore(WINDOW *win, int line, wchar_t *buffer) } static int -test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) +recursive_test(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) { WINDOW *txtbox = 0; WINDOW *txtwin = 0; @@ -151,7 +151,7 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) beep(); break; case 'w': - test_inchs(level + 1, argv, chrwin, strwin); + recursive_test(level + 1, argv, chrwin, strwin); if (txtbox != 0) { touchwin(txtbox); wnoutrefresh(txtbox); @@ -254,7 +254,7 @@ main(int argc, char *argv[]) chrwin = derwin(chrbox, 2, COLS - 2, 1, 1); strwin = derwin(chrbox, 2, COLS - 2, 3, 1); - test_inchs(1, argv, chrwin, strwin); + recursive_test(1, argv, chrwin, strwin); endwin(); ExitProgram(EXIT_SUCCESS); diff --git a/test/test_setupterm.c b/test/test_setupterm.c new file mode 100644 index 000000000000..bdf144823798 --- /dev/null +++ b/test/test_setupterm.c @@ -0,0 +1,215 @@ +/**************************************************************************** + * Copyright (c) 2015,2016 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. * + ****************************************************************************/ + +/* + * Author: Thomas E. Dickey + * + * $Id: test_setupterm.c,v 1.9 2016/06/18 23:54:35 tom Exp $ + * + * A simple demo of setupterm/restartterm. + */ +#include + +#if HAVE_TIGETSTR + +static bool a_opt = FALSE; +static bool f_opt = FALSE; +static bool n_opt = FALSE; +static bool r_opt = FALSE; + +static void +test_rc(NCURSES_CONST char *name, int actual_rc, int actual_err) +{ + int expect_rc = -1; + int expect_err = -1; + + if (name == 0) + name = getenv("TERM"); + if (name == 0) + name = "?"; + + switch (*name) { + case 'v': /* vt100 is normal */ + case 'd': /* dumb has no special flags */ + expect_rc = 0; + expect_err = 1; + break; + case 'l': /* lpr is hardcopy */ + expect_err = 1; + break; + case 'u': /* unknown is generic */ + expect_err = 0; + break; + default: + break; + } + if (n_opt) { + expect_rc = -1; + expect_err = -1; + } + printf("%s", + ((actual_rc == expect_rc && actual_err == expect_err) + ? "OK" + : "ERR")); + printf(" '%s'", name); + if (actual_rc == expect_rc) { + printf(" rc=%d", actual_rc); + } else { + printf(" rc=%d (%d)", actual_rc, expect_rc); + } + if (actual_err == expect_err) { + printf(" err=%d", actual_err); + } else { + printf(" err=%d (%d)", actual_err, expect_err); + } + printf("\n"); +} + +static void +test_setupterm(NCURSES_CONST char *name) +{ + int rc; + int err = -99; + +#if HAVE_RESTARTTERM + if (r_opt) + rc = restartterm(name, 0, f_opt ? NULL : &err); + else +#endif + rc = setupterm(name, 0, f_opt ? NULL : &err); + test_rc(name, rc, err); +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: test_setupterm [options] [terminal]", + "", + "Demonstrate error-checking for setupterm and restartterm.", + "", + "Options:", + " -a automatic test for each success/error code", + " -f treat errors as fatal", + " -n set environment to disable terminfo database, assuming", + " the compiled-in paths for database also fail", +#if HAVE_RESTARTTERM + " -r test restartterm rather than setupterm", +#endif + }; + unsigned n; + for (n = 0; n < SIZEOF(msg); ++n) { + fprintf(stderr, "%s\n", msg[n]); + } + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc, char *argv[]) +{ + int n; + + while ((n = getopt(argc, argv, "afnr")) != -1) { + switch (n) { + case 'a': + a_opt = TRUE; + break; + case 'f': + f_opt = TRUE; + break; + case 'n': + n_opt = TRUE; + break; +#if HAVE_RESTARTTERM + case 'r': + r_opt = TRUE; + break; +#endif + default: + usage(); + break; + } + } + + if (n_opt) { + static char none[][25] = + { + "HOME=/GUI", + "TERMINFO=/GUI", + "TERMINFO_DIRS=/GUI" + }; + /* + * We can turn this off, but not on again, because ncurses caches the + * directory locations. + */ + printf("** without database\n"); + for (n = 0; n < 3; ++n) + putenv(none[n]); + } else { + printf("** with database\n"); + } + + /* + * The restartterm relies on an existing screen, so we make one here. + */ + if (r_opt) { + newterm("ansi", stdout, stdin); + reset_shell_mode(); + } + + if (a_opt) { + static char predef[][9] = + {"vt100", "dumb", "lpr", "unknown", "none-such"}; + if (optind < argc) { + usage(); + } + for (n = 0; n < 4; ++n) { + test_setupterm(predef[n]); + } + } else { + if (optind < argc) { + for (n = optind; n < argc; ++n) { + test_setupterm(argv[n]); + } + } else { + test_setupterm(NULL); + } + } + + ExitProgram(EXIT_SUCCESS); +} + +#else /* !HAVE_TIGETSTR */ +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + printf("This program requires the terminfo functions such as tigetstr\n"); + ExitProgram(EXIT_FAILURE); +} +#endif /* HAVE_TIGETSTR */ diff --git a/test/test_sgr.c b/test/test_sgr.c new file mode 100644 index 000000000000..71811140f635 --- /dev/null +++ b/test/test_sgr.c @@ -0,0 +1,383 @@ +/**************************************************************************** + * Copyright (c) 2015-2017,2019 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. * + ****************************************************************************/ + +/* + * Author: Thomas E. Dickey + * + * $Id: test_sgr.c,v 1.14 2019/08/17 21:36:44 tom Exp $ + * + * A simple demo of the sgr/sgr0 terminal capabilities. + */ +#define USE_TINFO +#include + +#if !HAVE_TIGETSTR +static void failed(const char *) GCC_NORETURN; + +static void +failed(const char *msg) +{ + fprintf(stderr, "%s\n", msg); + ExitProgram(EXIT_FAILURE); +} +#endif + +#if HAVE_TIGETSTR + +static bool no_init = FALSE; +static bool q_opt = FALSE; + +static char *d_opt; +static char *e_opt; +static char **db_list; +static int db_item; + +static long total_values; + +static char * +make_dbitem(char *p, char *q) +{ + size_t need = strlen(e_opt) + 2 + (size_t) (p - q); + char *result = malloc(need); + _nc_SPRINTF(result, _nc_SLIMIT(need) "%s=%.*s", e_opt, (int) (p - q), q); + return result; +} + +static void +make_dblist(void) +{ + if (d_opt && e_opt) { + int pass; + + for (pass = 0; pass < 2; ++pass) { + char *p, *q; + size_t count = 0; + + for (p = q = d_opt; *p != '\0'; ++p) { + if (*p == ':') { + if (p != q + 1) { + if (pass) { + db_list[count] = make_dbitem(p, q); + } + count++; + } + q = p + 1; + } + } + if (p != q + 1) { + if (pass) { + db_list[count] = make_dbitem(p, q); + } + count++; + } + if (!pass) { + db_list = typeCalloc(char *, count + 1); + } + } + } +} + +static char * +next_dbitem(void) +{ + char *result = 0; + + if (db_list) { + if ((result = db_list[db_item]) == 0) { + db_item = 0; + result = db_list[0]; + } else { + db_item++; + } + } + printf("** %s\n", result); + return result; +} + +#if NO_LEAKS +static void +free_dblist(void) +{ + if (db_list) { + int n; + for (n = 0; db_list[n]; ++n) + free(db_list[n]); + free(db_list); + db_list = 0; + } +} +#endif + +#define MAXPAR 9 +#define MAXSGR (1 << MAXPAR) +#define BITS2P(n) (count & (1 << (n - 1))) +#define MASK_SMSO (1 << 0) +#define MASK_BOLD (1 << 5) +#define MASK_REV (1 << 2) + +static void +dumpit(unsigned bits, unsigned ignore, const char *sgr, const char *sgr0) +{ + static const char sample[] = "abcdefghijklm"; + static char params[] = "SURBDBIPA"; + unsigned n; + + printf("%4u ", bits); + bits &= ~ignore; + for (n = 0; n < MAXPAR; ++n) { + putchar((int) ((bits & (unsigned) (1 << n)) ? params[n] : '-')); + } + putchar(' '); + putp(sgr); + putp(sample); + putp(sgr0); + putchar('\n'); +} + +static bool +one_bit(unsigned a, unsigned b) +{ + unsigned c = (a ^ b); + bool result = FALSE; + if (c) { + while (!(c & 1)) { + c >>= 1; + } + result = (c == 1); + } + return result; +} + +static void +brute_force(const char *name) +{ + unsigned count; + char *my_sgr; + char *my_sgr0; + char *my_bold; + char *my_revs; + char *my_smso; + char *my_name = strdup(name); + + if (db_list) { + putenv(next_dbitem()); + } + + if (!q_opt) + printf("Terminal type \"%s\"\n", my_name); + + if (no_init) { + START_TRACE(); + } else { + setupterm((NCURSES_CONST char *) my_name, 1, (int *) 0); + } + + if (!q_opt) { + if (strcmp(my_name, ttytype)) + printf("... actual \"%s\"\n", ttytype); + } + + my_sgr = tigetstr("sgr"); + my_sgr0 = tigetstr("sgr0"); + my_bold = tigetstr("bold"); + my_revs = tigetstr("rev"); + my_smso = tigetstr("smso"); + + if (!VALID_STRING(my_sgr)) { + fprintf(stderr, "no \"sgr\" capability found\n"); + } else if (!VALID_STRING(my_sgr0)) { + fprintf(stderr, "no \"sgr0\" capability found\n"); + } else { + char *values[MAXSGR + MAXPAR]; + unsigned j; + unsigned ignore = 0; + unsigned reason = 0; + unsigned repeat = 0; + for (count = 0; count < MAXSGR; ++count) { + values[count] = tparm(my_sgr, + BITS2P(1), + BITS2P(2), + BITS2P(3), + BITS2P(4), + BITS2P(5), + BITS2P(6), + BITS2P(7), + BITS2P(8), + BITS2P(9)); + if (values[count] != 0) { + values[count] = strdup(values[count]); + } + } + for (count = 0; count < MAXSGR; ++count) { + if (values[count] != 0) { + for (j = count + 1; j < MAXSGR; ++j) { + if (values[j] == 0) + continue; + if (strcmp(values[count], values[j])) + continue; + if (one_bit(count, j)) { + free(values[j]); + values[j] = 0; + } + } + } + } + for (j = 0; j < MAXPAR; ++j) { + unsigned mask = (unsigned) (1 << j); + for (count = 0; count < MAXSGR; ++count) { + if ((count & mask) != 0) + continue; + if (values[count] != 0 && values[count + mask] != 0) { + mask = 0; + break; + } + } + ignore |= mask; + } + /* smso is tested first, but often duplicates bold or reverse. */ + if (VALID_STRING(my_smso)) { + if (VALID_STRING(my_bold) && !strcmp(my_bold, my_smso)) { + repeat |= MASK_SMSO; + reason = MASK_BOLD; + } + if (VALID_STRING(my_revs) && !strcmp(my_revs, my_smso)) { + repeat |= MASK_SMSO; + reason = MASK_REV; + } + } + for (count = 0; count < MAXSGR; ++count) { + if (values[count] != 0) { + bool found = FALSE; + if ((repeat & MASK_SMSO) != 0 + && (count & MASK_SMSO) != 0) { + found = TRUE; + } else { + for (j = 0; j < count; ++j) { + if (values[j] != 0 && !strcmp(values[j], values[count])) { + if ((repeat & MASK_SMSO) != 0 + && (j & MASK_SMSO) != 0 + && (count & reason) != 0) { + continue; + } + found = TRUE; + break; + } + } + } + if (!found) { + dumpit(count, ignore, values[count], my_sgr0); + ++total_values; + } + } + } + for (count = 0; count < MAXSGR; ++count) { + free(values[count]); + } + } + free(my_name); + del_curterm(cur_term); +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: test_sgr [options] [terminal]", + "", + "Print all distinct combinations of sgr capability.", + "", + "Options:", + " -d LIST colon-separated list of databases to use", + " -e NAME environment variable to set with -d option", + " -n do not initialize terminal, to test error-checking", + " -q quiet (prints only counts)", + }; + unsigned n; + for (n = 0; n < SIZEOF(msg); ++n) { + fprintf(stderr, "%s\n", msg[n]); + } + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc, char *argv[]) +{ + int n; + char *name; + + while ((n = getopt(argc, argv, "d:e:nq")) != -1) { + switch (n) { + case 'd': + d_opt = optarg; + break; + case 'e': + e_opt = optarg; + break; + case 'n': + no_init = TRUE; + break; + case 'q': + q_opt = TRUE; + break; + default: + usage(); + break; + } + } + + make_dblist(); + + if (optind < argc) { + for (n = optind; n < argc; ++n) { + brute_force(argv[n]); + } + } else if ((name = getenv("TERM")) != 0) { + brute_force(name); + } else { + static char dumb[] = "dumb"; + brute_force(dumb); + } + + printf("%ld distinct values\n", total_values); + +#if NO_LEAKS + free_dblist(); +#endif + + ExitProgram(EXIT_SUCCESS); +} + +#else /* !HAVE_TIGETSTR */ +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + failed("This program requires the terminfo functions such as tigetstr"); + ExitProgram(EXIT_FAILURE); +} +#endif /* HAVE_TIGETSTR */ diff --git a/test/test_termattrs.c b/test/test_termattrs.c new file mode 100644 index 000000000000..398bbcd86c9f --- /dev/null +++ b/test/test_termattrs.c @@ -0,0 +1,199 @@ +/**************************************************************************** + * Copyright (c) 2017 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: test_termattrs.c,v 1.2 2017/10/11 08:16:02 tom Exp $ + * + * Demonstrate the termattrs and term_attrs functions. + */ + +#define USE_TINFO +#include + +#if HAVE_SETUPTERM + +static FILE *my_fp; + +static void +test_termattrs(unsigned long value) +{ +#define DATA(name) { name, #name } + static struct { + unsigned long code; + const char *name; + } table[] = { +#ifdef A_ATTRIBUTES + DATA(A_ATTRIBUTES), +#endif +#ifdef A_CHARTEXT + DATA(A_CHARTEXT), +#endif +#ifdef A_COLOR + DATA(A_COLOR), +#endif +#ifdef A_STANDOUT + DATA(A_STANDOUT), +#endif +#ifdef A_UNDERLINE + DATA(A_UNDERLINE), +#endif +#ifdef A_REVERSE + DATA(A_REVERSE), +#endif +#ifdef A_BLINK + DATA(A_BLINK), +#endif +#ifdef A_DIM + DATA(A_DIM), +#endif +#ifdef A_BOLD + DATA(A_BOLD), +#endif +#ifdef A_ALTCHARSET + DATA(A_ALTCHARSET), +#endif +#ifdef A_INVIS + DATA(A_INVIS), +#endif +#ifdef A_PROTECT + DATA(A_PROTECT), +#endif +#ifdef A_HORIZONTAL + DATA(A_HORIZONTAL), +#endif +#ifdef A_LEFT + DATA(A_LEFT), +#endif +#ifdef A_LOW + DATA(A_LOW), +#endif +#ifdef A_RIGHT + DATA(A_RIGHT), +#endif +#ifdef A_TOP + DATA(A_TOP), +#endif +#ifdef A_VERTICAL + DATA(A_VERTICAL), +#endif +#ifdef A_ITALIC + DATA(A_ITALIC), +#endif + }; + size_t n; + fprintf(my_fp, "Result: %08lX\r\n", value); + for (n = 0; n < SIZEOF(table); ++n) { + if ((value & table[n].code) != 0) { + fprintf(my_fp, "%08lX %08lX %s\r\n", + table[n].code, value & table[n].code, table[n].name); + } + }; + fputs("\r\n", my_fp); +} + +static void +usage(void) +{ + static const char *tbl[] = + { + "Usage: test_termattrs [options]" + ,"" + ,"Options:" + ," -e use stderr (default stdout)" + ," -n do not initialize terminal" + ," -s use setupterm rather than newterm" +#if USE_WIDEC_SUPPORT + ," -w use term_attrs rather than termattrs" +#endif + }; + unsigned n; + for (n = 0; n < SIZEOF(tbl); ++n) + fprintf(stderr, "%s\n", tbl[n]); + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + int ch; + bool no_init = FALSE; + bool s_opt = FALSE; +#if USE_WIDEC_SUPPORT + bool w_opt = FALSE; +#endif + + my_fp = stdout; + + while ((ch = getopt(argc, argv, "ensw")) != -1) { + switch (ch) { + case 'e': + my_fp = stderr; + break; + case 'n': + no_init = TRUE; + break; + case 's': + s_opt = TRUE; + break; +#if USE_WIDEC_SUPPORT + case 'w': + w_opt = TRUE; + break; +#endif + default: + usage(); + break; + } + } + if (optind < argc) + usage(); + + if (no_init) { + START_TRACE(); + } else if (s_opt) { + setupterm((char *) 0, fileno(my_fp), (int *) 0); + } else { + newterm((char *) 0, my_fp, stdin); + } +#if USE_WIDEC_SUPPORT + if (w_opt) + test_termattrs((unsigned long) term_attrs()); + else +#endif + test_termattrs((unsigned long) termattrs()); + ExitProgram(EXIT_SUCCESS); +} + +#else +int +main(int argc GCC_UNUSED, + char *argv[]GCC_UNUSED) +{ + fprintf(stderr, "This program requires terminfo\n"); + exit(EXIT_FAILURE); +} +#endif diff --git a/test/test_vid_puts.c b/test/test_vid_puts.c index 6c8bc36a7886..463e59576ba6 100644 --- a/test/test_vid_puts.c +++ b/test/test_vid_puts.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2013 Free Software Foundation, Inc. * + * Copyright (c) 2013-2014,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_vid_puts.c,v 1.5 2013/09/28 22:42:29 tom Exp $ + * $Id: test_vid_puts.c,v 1.10 2017/10/11 08:16:24 tom Exp $ * * Demonstrate the vid_puts and vid_attr functions. * Thomas Dickey - 2013/01/12 @@ -35,9 +35,7 @@ #define USE_TINFO #include -#if USE_WIDEC_SUPPORT && HAVE_SETUPTERM - -#define valid(s) ((s != 0) && s != (char *)-1) +#if USE_WIDEC_SUPPORT && HAVE_SETUPTERM && HAVE_VID_PUTS static FILE *my_fp; static bool p_opt = FALSE; @@ -54,7 +52,7 @@ TPUTS_PROTO(outc, c) static bool outs(const char *s) { - if (valid(s)) { + if (VALID_STRING(s)) { tputs(s, 1, outc); return TRUE; } @@ -64,10 +62,12 @@ outs(const char *s) static void cleanup(void) { - outs(exit_attribute_mode); - if (!outs(orig_colors)) - outs(orig_pair); - outs(cursor_normal); + if (cur_term != 0) { + outs(exit_attribute_mode); + if (!outs(orig_colors)) + outs(orig_pair); + outs(cursor_normal); + } } static void @@ -101,6 +101,7 @@ usage(void) ,"" ,"Options:" ," -e use stderr (default stdout)" + ," -n do not initialize terminal" ," -p use vid_puts (default vid_attr)" }; unsigned n; @@ -113,14 +114,18 @@ int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { int ch; + bool no_init = FALSE; my_fp = stdout; - while ((ch = getopt(argc, argv, "ep")) != -1) { + while ((ch = getopt(argc, argv, "enp")) != -1) { switch (ch) { case 'e': my_fp = stderr; break; + case 'n': + no_init = TRUE; + break; case 'p': p_opt = TRUE; break; @@ -132,7 +137,11 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) if (optind < argc) usage(); - setupterm((char *) 0, 1, (int *) 0); + if (no_init) { + START_TRACE(); + } else { + setupterm((char *) 0, fileno(my_fp), (int *) 0); + } test_vid_puts(); cleanup(); ExitProgram(EXIT_SUCCESS); diff --git a/test/test_vidputs.c b/test/test_vidputs.c index 2215fa91a38f..3cf004768bba 100644 --- a/test/test_vidputs.c +++ b/test/test_vidputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2013 Free Software Foundation, Inc. * + * Copyright (c) 2013-2014,2017 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,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_vidputs.c,v 1.4 2013/09/28 22:45:21 tom Exp $ + * $Id: test_vidputs.c,v 1.9 2017/10/11 08:17:07 tom Exp $ * * Demonstrate the vidputs and vidattr functions. * Thomas Dickey - 2013/01/12 @@ -35,9 +35,7 @@ #define USE_TINFO #include -#if HAVE_SETUPTERM - -#define valid(s) ((s != 0) && s != (char *)-1) +#if HAVE_SETUPTERM && HAVE_VIDPUTS static FILE *my_fp; static bool p_opt = FALSE; @@ -54,7 +52,7 @@ TPUTS_PROTO(outc, c) static bool outs(const char *s) { - if (valid(s)) { + if (VALID_STRING(s)) { tputs(s, 1, outc); return TRUE; } @@ -64,10 +62,12 @@ outs(const char *s) static void cleanup(void) { - outs(exit_attribute_mode); - if (!outs(orig_colors)) - outs(orig_pair); - outs(cursor_normal); + if (cur_term != 0) { + outs(exit_attribute_mode); + if (!outs(orig_colors)) + outs(orig_pair); + outs(cursor_normal); + } } static void @@ -101,6 +101,7 @@ usage(void) ,"" ,"Options:" ," -e use stderr (default stdout)" + ," -n do not initialize terminal" ," -p use vidputs (default vidattr)" }; unsigned n; @@ -113,14 +114,18 @@ int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { int ch; + bool no_init = FALSE; my_fp = stdout; - while ((ch = getopt(argc, argv, "ep")) != -1) { + while ((ch = getopt(argc, argv, "enp")) != -1) { switch (ch) { case 'e': my_fp = stderr; break; + case 'n': + no_init = TRUE; + break; case 'p': p_opt = TRUE; break; @@ -132,11 +137,16 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) if (optind < argc) usage(); - setupterm((char *) 0, 1, (int *) 0); + if (no_init) { + START_TRACE(); + } else { + setupterm((char *) 0, fileno(my_fp), (int *) 0); + } test_vidputs(); cleanup(); ExitProgram(EXIT_SUCCESS); } + #else int main(int argc GCC_UNUSED, diff --git a/test/testaddch.c b/test/testaddch.c index f0a476e10e41..ccadab80f4a1 100644 --- a/test/testaddch.c +++ b/test/testaddch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ * This is an example written by Alexander V. Lukyanov , * to demonstrate an inconsistency between ncurses and SVr4 curses. * - * $Id: testaddch.c,v 1.9 2013/01/13 01:02:41 tom Exp $ + * $Id: testaddch.c,v 1.12 2014/08/02 23:11:20 tom Exp $ */ #include @@ -66,18 +66,18 @@ main( attr = (chtype) ((i & 4) ? COLOR_PAIR(4) : 0); bkgdset(back); - (void) attrset(set); + (void) attrset(AttrArg(set, 0)); attr_addstr("Test string with spaces -> <-\n", attr); } addch('\n'); for (i = 0; i < 8; i++) { - back = (i & 1) ? (A_BOLD | 'B' | COLOR_PAIR(1)) : ' '; - set = (i & 2) ? (A_REVERSE | COLOR_PAIR(2)) : 0; - attr = (chtype) ((i & 4) ? COLOR_PAIR(4) : 0); + back = (i & 1) ? (A_BOLD | 'B' | (chtype) COLOR_PAIR(1)) : ' '; + set = (i & 2) ? (A_REVERSE | (chtype) COLOR_PAIR(2)) : 0; + attr = (chtype) ((i & 4) ? (chtype) COLOR_PAIR(4) : 0); bkgdset(back); - (void) attrset(set); + (void) attrset(AttrArg(set, 0)); attr_addstr("Test string with spaces -> <-\n", attr); } diff --git a/test/testcurs.c b/test/testcurs.c index c1268981e051..f9762b0b328a 100644 --- a/test/testcurs.c +++ b/test/testcurs.c @@ -6,13 +6,13 @@ * wrs(5/28/93) -- modified to be consistent (perform identically) with either * PDCurses or under Unix System V, R4 * - * $Id: testcurs.c,v 1.48 2013/05/18 22:05:06 tom Exp $ + * $Id: testcurs.c,v 1.55 2019/12/14 23:25:29 tom Exp $ */ #include #if defined(XCURSES) -char *XCursesProgramName = "testcurs"; +const char *XCursesProgramName = "testcurs"; #endif static int initTest(WINDOW **); @@ -20,127 +20,16 @@ static void display_menu(int, int); static void inputTest(WINDOW *); static void introTest(WINDOW *); static void outputTest(WINDOW *); +#if HAVE_NEWPAD static void padTest(WINDOW *); +#endif static void scrollTest(WINDOW *); #if defined(PDCURSES) && !defined(XCURSES) static void resizeTest(WINDOW *); #endif -struct commands { - NCURSES_CONST char *text; - void (*function) (WINDOW *); -}; -typedef struct commands COMMAND; - -static const COMMAND command[] = -{ - {"General Test", introTest}, - {"Pad Test", padTest}, -#if defined(PDCURSES) && !defined(XCURSES) - {"Resize Test", resizeTest}, -#endif - {"Scroll Test", scrollTest}, - {"Input Test", inputTest}, - {"Output Test", outputTest} -}; -#define MAX_OPTIONS (int) SIZEOF(command) - static int width, height; -int -main( - int argc GCC_UNUSED, - char *argv[]GCC_UNUSED) -{ - WINDOW *win; - int key; - int old_option = (-1); - int new_option = 0; - bool quit = FALSE; - int n; - - setlocale(LC_ALL, ""); - -#ifdef PDCDEBUG - PDC_debug("testcurs started\n"); -#endif - if (!initTest(&win)) - ExitProgram(EXIT_FAILURE); - - erase(); - display_menu(old_option, new_option); - for (;;) { -#ifdef A_COLOR - if (has_colors()) { - init_pair(1, COLOR_WHITE, COLOR_BLUE); - wbkgd(win, (chtype) COLOR_PAIR(1)); - } else - wbkgd(win, A_REVERSE); -#else - wbkgd(win, A_REVERSE); -#endif - werase(win); - - noecho(); - keypad(stdscr, TRUE); - raw(); - key = getch(); - if (key < KEY_MIN && key > 0 && isalpha(key)) { - if (islower(key)) - key = toupper(key); - for (n = 0; n < MAX_OPTIONS; ++n) { - if (key == command[n].text[0]) { - display_menu(old_option, new_option = n); - key = ' '; - break; - } - } - } - switch (key) { - case 10: - case 13: - case KEY_ENTER: - erase(); - refresh(); - (*command[new_option].function) (win); - erase(); - display_menu(old_option, new_option); - break; - case KEY_UP: - new_option = ((new_option == 0) - ? new_option - : new_option - 1); - display_menu(old_option, new_option); - break; - case KEY_DOWN: - new_option = ((new_option == (MAX_OPTIONS - 1)) - ? new_option - : new_option + 1); - display_menu(old_option, new_option); - break; - case 'Q': - case 'q': - quit = TRUE; - break; - default: - beep(); - break; - case ' ': - break; - } - if (quit == TRUE) - break; - } - - delwin(win); - - endwin(); -#ifdef XCURSES - XCursesExit(); -#endif - ExitProgram(EXIT_SUCCESS); -} - static void Continue(WINDOW *win) { @@ -170,7 +59,7 @@ initTest(WINDOW **win) PDC_debug("initTest called\n"); #endif #ifdef TRACE - trace(TRACE_MAXIMUM); + curses_trace(TRACE_MAXIMUM); #endif initscr(); #ifdef PDCDEBUG @@ -184,7 +73,7 @@ initTest(WINDOW **win) height = 13; /* Create a drawing window */ *win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2); if (*win == NULL) { - endwin(); + stop_curses(); return 0; } return 1; @@ -286,7 +175,7 @@ inputTest(WINDOW *win) #ifdef A_COLOR if (has_colors()) { init_pair(2, COLOR_WHITE, COLOR_RED); - wbkgd(subWin, COLOR_PAIR(2) | A_BOLD); + wbkgd(subWin, (chtype) COLOR_PAIR(2) | A_BOLD); } else wbkgd(subWin, A_BOLD); #else @@ -437,7 +326,7 @@ inputTest(WINDOW *win) "%d %[][a-zA-Z]s", "%d %[^0-9]" }; - const char *format = fmt[(unsigned) repeat % SIZEOF(fmt)]; + char *format = strdup(fmt[(unsigned) repeat % SIZEOF(fmt)]); wclear(win); MvWAddStr(win, 3, 2, "The window should have moved"); @@ -453,12 +342,13 @@ inputTest(WINDOW *win) noraw(); num = 0; *buffer = 0; - answered = mvwscanw(win, 7, 6, strdup(format), &num, buffer); + answered = mvwscanw(win, 7, 6, format, &num, buffer); MvWPrintw(win, 8, 6, "String: %s Number: %d (%d values read)", buffer, num, answered); Continue(win); ++repeat; + free(format); } while (answered > 0); } @@ -667,7 +557,7 @@ resizeTest(WINDOW *dummy GCC_UNUSED) win1 = newwin(10, 50, 14, 25); if (win1 == NULL) { - endwin(); + stop_curses(); return; } #ifdef A_COLOR @@ -695,6 +585,7 @@ resizeTest(WINDOW *dummy GCC_UNUSED) } #endif +#if HAVE_NEWPAD static void padTest(WINDOW *dummy GCC_UNUSED) { @@ -735,6 +626,28 @@ padTest(WINDOW *dummy GCC_UNUSED) delwin(pad); } } +#endif /* HAVE_NEWPAD */ + +struct commands { + NCURSES_CONST char *text; + void (*function) (WINDOW *); +}; +typedef struct commands COMMAND; + +static const COMMAND command[] = +{ + {"General Test", introTest}, +#if HAVE_NEWPAD + {"Pad Test", padTest}, +#endif +#if defined(PDCURSES) && !defined(XCURSES) + {"Resize Test", resizeTest}, +#endif + {"Scroll Test", scrollTest}, + {"Input Test", inputTest}, + {"Output Test", outputTest} +}; +#define MAX_OPTIONS (int) SIZEOF(command) static void display_menu(int old_option, int new_option) @@ -759,3 +672,97 @@ display_menu(int old_option, int new_option) "Use Up and Down Arrows to select - Enter to run - Q to quit"); refresh(); } + +int +main( + int argc GCC_UNUSED, + char *argv[]GCC_UNUSED) +{ + WINDOW *win; + int key; + int old_option = (-1); + int new_option = 0; + bool quit = FALSE; + int n; + + setlocale(LC_ALL, ""); + +#ifdef PDCDEBUG + PDC_debug("testcurs started\n"); +#endif + if (!initTest(&win)) + ExitProgram(EXIT_FAILURE); + + erase(); + display_menu(old_option, new_option); + for (;;) { +#ifdef A_COLOR + if (has_colors()) { + init_pair(1, COLOR_WHITE, COLOR_BLUE); + wbkgd(win, (chtype) COLOR_PAIR(1)); + } else + wbkgd(win, A_REVERSE); +#else + wbkgd(win, A_REVERSE); +#endif + werase(win); + + noecho(); + keypad(stdscr, TRUE); + raw(); + key = getch(); + if (key < KEY_MIN && key > 0 && isalpha(key)) { + if (islower(key)) + key = toupper(key); + for (n = 0; n < MAX_OPTIONS; ++n) { + if (key == command[n].text[0]) { + display_menu(old_option, new_option = n); + key = ' '; + break; + } + } + } + switch (key) { + case 10: + case 13: + case KEY_ENTER: + erase(); + refresh(); + (*command[new_option].function) (win); + erase(); + display_menu(old_option, new_option); + break; + case KEY_UP: + new_option = ((new_option == 0) + ? new_option + : new_option - 1); + display_menu(old_option, new_option); + break; + case KEY_DOWN: + new_option = ((new_option == (MAX_OPTIONS - 1)) + ? new_option + : new_option + 1); + display_menu(old_option, new_option); + break; + case 'Q': + case 'q': + quit = TRUE; + break; + default: + beep(); + break; + case ' ': + break; + } + if (quit == TRUE) + break; + } + + delwin(win); + + stop_curses(); +#ifdef XCURSES + XCursesExit(); +#endif + ExitProgram(EXIT_SUCCESS); +} diff --git a/test/testscanw.c b/test/testscanw.c index 79589c20386d..96758f14e2fd 100644 --- a/test/testscanw.c +++ b/test/testscanw.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. * + * Copyright (c) 1998-2006,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ * Date: 1997/03/17 * From: bayern@morpheus.cis.yale.edu * - * $Id: testscanw.c,v 1.11 2006/04/01 19:08:03 tom Exp $ + * $Id: testscanw.c,v 1.12 2019/12/07 18:07:04 tom Exp $ */ #include @@ -47,7 +47,7 @@ main(int argc, char *argv[]) echo(); #if 0 - trace(TRACE_UPDATE | TRACE_CALLS); + curses_trace(TRACE_UPDATE | TRACE_CALLS); #endif while (argc > 1) { if (isdigit(UChar(*argv[1]))) diff --git a/test/tput-colorcube b/test/tput-colorcube new file mode 100755 index 000000000000..480ff92ee77e --- /dev/null +++ b/test/tput-colorcube @@ -0,0 +1,130 @@ +#!/bin/sh +############################################################################## +# Copyright (c) 2016 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: tput-colorcube,v 1.1 2016/12/17 23:37:37 tom Exp $ +# Use this script to print an xterm-style color cube, e.g., as done in +# the xterm 88colors2.pl and 256colors2.pl scripts. + +failed() { + printf "?? $*\n" >&2 + exit 1 +} + +newline() { + tput op + printf "\n" +} + +if [ $# = 1 ] +then + myterm=$1 +elif [ $# = 0 ] +then + myterm=$TERM +else + failed "expected one parameter or none" +fi + +colors=$(tput -T $myterm colors 2>/dev/null) +if [ ${colors:-0} -le 0 ] +then + myterm=${myterm%%-color} + colors=$(tput -T $myterm colors 2>/dev/null) +fi +if [ ${colors:-0} -le 0 ] +then + failed "terminal $myterm does not support color" +fi + +printf "System colors:\n" + +color=0 +inrow=$colors +to_do=$colors +[ $colors -gt 256 ] && colors=256 +[ $inrow -gt 8 ] && inrow=8 +[ $to_do -gt 16 ] && to_do=16 +while [ $color -lt $to_do ] +do + [ $color = $inrow ] && newline + tput setab $color + printf ' ' + color=$(expr $color + 1) +done +newline + +[ $colors -le 16 ] && exit + +if [ $colors = 256 ] +then + cube=6 + ramp=232 +elif [ $colors -ge 88 ] +then + cube=4 + ramp=80 +else + exit +fi + +printf "\n" +printf "Color cube, ${cube}x${cube}x${cube}:\n" +g=0 +cube2=$(expr $cube \* $cube) +while [ $g -lt $cube ] +do + r=0 + while [ $r -lt $cube ] + do + b=0 + while [ $b -lt $cube ] + do + color=$(expr 16 + \( $r \* $cube2 \) + \( $g \* $cube \) + $b) + tput setab $color + printf ' ' + b=$(expr $b + 1) + done + tput op + printf ' ' + r=$(expr $r + 1) + done + newline + g=$(expr $g + 1) +done + +printf "\n" +printf "Grayscale ramp:\n" +color=$ramp +while [ $color -lt $colors ] +do + tput setab $color + printf ' ' + color=$(expr $color + 1) +done +newline +# vi:ts=4 sw=4 diff --git a/test/tput-initc b/test/tput-initc new file mode 100755 index 000000000000..d4dfddc0afdc --- /dev/null +++ b/test/tput-initc @@ -0,0 +1,155 @@ +#!/bin/sh +############################################################################## +# Copyright (c) 2016 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: tput-initc,v 1.5 2016/12/17 22:35:05 tom Exp $ +# Some of the ".dat" files in ncurses' test-directory give r/g/b numbers for +# default palettes of xterm and Linux console. This script reads the numbers +# and (assuming the same or compatible terminal) uses tput to (re)initialize +# the palette using those numbers. + +failed() { + printf "?? $*\n" >&2 + exit 1 +} + +usage() { + cat >&2 <<-EOF + usage: $0 [-r] [-s] [palette-data] + + Use this script with a palette data-file to (re)initialize colors with + tput. This script assumes arrangements for 16-, 88- and 256-colors + like the xterm 88colors2.pl and 256colors2.pl scripts. + + Options: + -r reverse palette + -s reverse system colors (first 16 if more than 16 colors) +EOF + exit 1 +} + +opt_r=no +opt_s=no + +while getopts "rs" option "$@" +do + case $option in + (r) + opt_r=yes + ;; + (s) + opt_s=yes + ;; + (*) + usage + ;; + esac +done +shift $(expr $OPTIND - 1) + +if [ $# = 1 ] +then + file=$1 +elif [ $# = 0 ] +then + file=$TERM.dat +else + failed "expected one parameter or none" +fi + +if [ ! -f "$file" ] +then + if [ -f "$file.dat" ] + then + file="$file.dat" + else + failed "no such file: $file" + fi +fi + +myterm=${file%%.dat} +colors=$(tput -T $myterm colors 2>/dev/null) +if [ ${colors:-0} -le 0 ] +then + myterm=${myterm%%-color} + colors=$(tput -T $myterm colors 2>/dev/null) +fi +if [ ${colors:-0} -le 0 ] +then + failed "terminal $myterm does not support color" +fi + +cat $file |\ +awk -v opt_r=$opt_r \ + -v opt_s=$opt_s \ + -v colors=$colors \ + -v myterm=$myterm ' +BEGIN { + limit = 1000; + range = -1; + cramp = -1; + if ( colors == 88 ) { + cramp = 80; + } else if ( colors = 256 ) { + cramp = 232; + } +} +function scaled(n) { + return (n * 1000)/limit; +} + +/^scale:[0-9]+/{ + sub("^scale:","",$0); + limit = $0; +} + +/^[0-9]+:/{ + sub(":","",$1); + item = $1 + 0; + if (range < item) { + range = item; + } + params[$1] = sprintf ("%d %d %d", scaled($2),scaled($3),scaled($4)); +} +END { + for (n = 0; n <= range; ++n) { + m = n; + if ( opt_r == "yes" ) { + if ( colors <= 16 ) { + m = range - n; + } else if ( ( opt_s == "yes" ) && ( n < 16 ) ) { + m = 15 - n; + } else if ( n >= cramp ) { + m = cramp + colors - 1 - n; + } else { + m = 16 + cramp - 1 - n; + } + } + printf "tput -T%s initc %d %s\n", myterm, m, params[n]; + } +} +' |sh - diff --git a/test/tracemunch b/test/tracemunch index 1ea6f4b69022..cc33852dc5cc 100755 --- a/test/tracemunch +++ b/test/tracemunch @@ -1,7 +1,7 @@ -#!/usr/bin/perl -w -# $Id: tracemunch,v 1.6 2005/03/12 21:48:23 tom Exp $ +#!/usr/bin/env perl +# $Id: tracemunch,v 1.26 2019/12/21 22:33:35 tom Exp $ ############################################################################## -# Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. # +# Copyright (c) 1998-2018,2019 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"), # @@ -32,130 +32,557 @@ # The error logs produced by ncurses with tracing enabled can be very tedious # to wade through. This script helps by compacting runs of log lines that # can be conveniently expressed as higher-level operations. + use strict; +use warnings; + +our $putattr = + 'PutAttrChar\(\{\{ ' . "'(.)'" + . ' = 0[0-7]+ \}\}\) at \(([0-9]+), ([0-9]+)\)'; +our $waddnstr = + 'waddnstr\(0x([[:xdigit:]]+),"([^\"]+)",[0-9]+\) called \{A_NORMAL\}'; -our $putattr="PutAttrChar\\({{ '(.)' = 0[0-7]+ }}\\) at \\(([0-9]+), ([0-9]+)\\)"; -our $waddnstr="waddnstr\\(0x([0-9a-f]+),\"([^\"]+)\",[0-9]+\\) called {A_NORMAL}"; +# If the trace is complete, we can infer addresses using the return value from +# newwin, etc. But if it is incomplete, we can still check for special cases +# such as SCREEN* and WINDOW* parameters. In this table, the type for the +# first parameter is encoded, relying upon an ncurses programming convention: +# 1 = SCREEN* +# 2 = WINDOW* +# 4 = TERMINAL* +our %known_p1 = qw( + TransformLine 1 + _nc_freewin 2 + _nc_initscr 1 + _nc_makenew 1 + _nc_mingw_console_read 1 + _nc_reset_colors 1 + _nc_scroll_optimize 1 + _nc_tinfo 1 + _nc_tinfo_mvcur 1 + _nc_wgetch 2 + adjust_window 2 + assume_default_colors 1 + attr_get 2 + baudrate 1 + beep 1 + border_set 2 + box 2 + box_set 2 + can_change_color 1 + cbreak 1 + clearok 2 + color_content 1 + copywin 2 + curs_set 1 + decrease_size 1 + def_prog_mode 1 + def_shell_mode 1 + define_key 1 + del_curterm 1 + delay_output 1 + delscreen 1 + delwin 2 + derwin 2 + doupdate 1 + dupwin 2 + echo 1 + endwin 1 + erasechar 1 + filter 1 + flash 1 + flushinp 1 + getattrs 2 + getbegx 2 + getbegy 2 + getbkgd 2 + getcurx 2 + getcury 2 + getmaxx 2 + getmaxy 2 + getmouse 1 + getparx 2 + getpary 2 + halfdelay 1 + has_ic 1 + has_il 1 + has_key 1 + idcok 2 + idlok 2 + immedok 2 + increase_size 1 + init_color 1 + init_pair 1 + intrflush 1 + is_cleared 2 + is_idcok 2 + is_idlok 2 + is_immedok 2 + is_keypad 2 + is_leaveok 2 + is_linetouched 2 + is_nodelay 2 + is_notimeout 2 + is_pad 2 + is_scrollok 2 + is_subwin 2 + is_syncok 2 + is_term_resized 1 + is_wintouched 2 + key_defined 1 + keybound 1 + keyok 1 + keypad 2 + killchar 1 + leaveok 2 + longname 1 + meta 2 + mouseinterval 1 + mousemask 1 + mvcur 1 + mvderwin 2 + mvwadd_wch 2 + mvwadd_wchnstr 2 + mvwadd_wchstr 2 + mvwaddch 2 + mvwaddchnstr 2 + mvwaddchstr 2 + mvwaddnstr 2 + mvwaddnwstr 2 + mvwaddstr 2 + mvwaddwstr 2 + mvwchgat 2 + mvwdelch 2 + mvwget_wch 2 + mvwget_wstr 2 + mvwgetch 2 + mvwgetn_wstr 2 + mvwgetnstr 2 + mvwgetstr 2 + mvwhline 2 + mvwhline_set 2 + mvwin 2 + mvwin_wch 2 + mvwin_wchnstr 2 + mvwin_wchstr 2 + mvwinch 2 + mvwinchnstr 2 + mvwinchstr 2 + mvwins_nwstr 2 + mvwins_wch 2 + mvwins_wstr 2 + mvwinsch 2 + mvwinsnstr 2 + mvwinsstr 2 + mvwinstr 2 + mvwinwstr 2 + mvwvline 2 + mvwvline_set 2 + newpad 1 + newterm 1 + newwin 1 + nl 1 + nocbreak 1 + nodelay 2 + noecho 1 + nofilter 1 + nonl 1 + noqiflush 1 + noraw 1 + notimeout 2 + overlap 2 + overlay 2 + overwrite 2 + pair_content 1 + pecho_wchar 2 + pechochar 2 + pnoutrefresh 2 + putwin 2 + qiflush 1 + raw 1 + redrawwin 2 + reset_prog_mode 1 + reset_shell_mode 1 + resetty 1 + resize_term 1 + resizeterm 1 + restartterm 1 + ripoffline 1 + savetty 1 + scr_init 1 + scr_restore 1 + scr_set 1 + scroll 2 + scrollok 2 + set_curterm 4 + set_term 1 + slk_attr 1 + slk_attr_set 1 + slk_attroff 1 + slk_attron 1 + slk_attrset 1 + slk_clear 1 + slk_color 1 + slk_init 1 + slk_label 1 + slk_noutrefresh 1 + slk_refresh 1 + slk_restore 1 + slk_set 1 + slk_touch 1 + start_color 1 + subwin 2 + syncok 2 + termattrs 1 + termname 1 + tgetflag 1 + tgetnum 1 + tigetflag 1 + tigetnum 1 + tigetstr 1 + tinfo 1 + touchline 2 + touchwin 2 + typeahead 1 + unget_wch 1 + ungetch 1 + ungetmouse 1 + untouchwin 2 + use_default_colors 1 + use_env 1 + use_legacy_coding 1 + use_screen 1 + use_tioctl 1 + use_window 2 + vidattr 1 + vidputs 1 + vw_printw 2 + vwprintw 2 + wadd_wch 2 + wadd_wchnstr 2 + wadd_wchstr 2 + waddch 2 + waddchnstr 2 + waddchstr 2 + waddnstr 2 + waddnwstr 2 + waddstr 2 + waddwstr 2 + wattr_get 2 + wattr_off 2 + wattr_on 2 + wattr_set 2 + wattroff 2 + wattron 2 + wattrset 2 + wbkgd 2 + wbkgdset 2 + wborder 2 + wborder_set 2 + wchgat 2 + wclear 2 + wclrtobot 2 + wclrtoeol 2 + wcolor_set 2 + wcursyncup 2 + wdelch 2 + wdeleteln 2 + wechochar 2 + wenclose 2 + werase 2 + wget_wch 2 + wget_wstr 2 + wgetbkgrnd 2 + wgetch 2 + wgetch_events 2 + wgetdelay 2 + wgetn_wstr 2 + wgetnstr 2 + wgetparent 2 + wgetscrreg 2 + wgetstr 2 + whline 2 + whline_set 2 + win_wch 2 + win_wchnstr 2 + win_wchstr 2 + winch 2 + winchnstr 2 + winchstr 2 + winnstr 2 + winnwstr 2 + wins_nwstr 2 + wins_wch 2 + wins_wstr 2 + winsch 2 + winsdelln 2 + winsertln 2 + winsnstr 2 + winsstr 2 + winstr 2 + winwstr 2 + wmouse_trafo 2 + wmove 2 + wnoutrefresh 2 + wprintw 2 + wredrawln 2 + wrefresh 2 + wresize 2 + wscrl 2 + wsetscrreg 2 + wstandend 2 + wstandout 2 + wsyncdown 2 + wsyncup 2 + wtimeout 2 + wtouchln 2 + wvline 2 +); -our $win_nums=0; -our $curscr=""; -our $newscr=""; -our $stdscr=""; -our @win_addr; +our $scr_nums = 0; +our $thr_nums = 0; +our $trm_nums = 0; +our $try_nums = 0; +our $win_nums = 0; +our $curscr = ""; +our $newscr = ""; +our $stdscr = ""; +our %scr_addr; +our %thr_addr; +our %trm_addr; +our %try_addr; +our %win_addr; + +sub has_addr($) { + my $value = shift; + my $result = 0; + $result = 1 if ( $value =~ /\b0x[[:xdigit:]]+\b/i ); + return $result; +} -sub transaddr -{ +sub transaddr($) { + my $arg = shift; my $n; - my $arg = $_[0]; - $arg =~ s/$curscr/curscr/g if ($curscr); - $arg =~ s/$newscr/newscr/g if ($newscr); - $arg =~ s/$stdscr/stdscr/g if ($stdscr); - for $n (0..$#win_addr) { - $arg =~ s/$win_addr[$n]/window$n/g if $win_addr[$n]; + $arg =~ s/\b$curscr\b/curscr/g if ($curscr); + $arg =~ s/\b$newscr\b/newscr/g if ($newscr); + $arg =~ s/\b$stdscr\b/stdscr/g if ($stdscr); + if ( &has_addr($arg) ) { + foreach my $addr ( keys %scr_addr ) { + $n = $scr_addr{$addr}; + $arg =~ s/\b$addr\b/screen$n/g if ( defined $n ); + } + } + if ( &has_addr($arg) ) { + foreach my $addr ( keys %thr_addr ) { + $n = $thr_addr{$addr}; + $arg =~ s/\b$addr\b/thread$n/g if ( defined $n ); + } + } + if ( &has_addr($arg) ) { + foreach my $addr ( keys %trm_addr ) { + $n = $trm_addr{$addr}; + $arg =~ s/\b$addr\b/terminal$n/g if ( defined $n ); + } + } + if ( &has_addr($arg) ) { + foreach my $addr ( keys %try_addr ) { + $n = $try_addr{$addr}; + $arg =~ s/\b$addr\b/tries_$n/g if ( defined $n ); + } + } + if ( &has_addr($arg) ) { + foreach my $addr ( keys %win_addr ) { + $n = $win_addr{$addr}; + $arg =~ s/\b$addr\b/window$n/g if ( defined $n ); + } + } + if ( &has_addr($arg) ) { + if ( $arg =~ /add_wch\((window\d+,)?0x[[:xdigit:]]+\)/i ) { + $arg =~ s/(0x[[:xdigit:]]+)[)]/\&wch)/i; + } + elsif ( + $arg =~ /color_content\((screen\d+,)?\d+(,0x[[:xdigit:]]+){3}/i ) + { + $arg =~ s/(,0x[[:xdigit:]]+){3}[)]/,\&r,\&g,\&b)/i; + } + elsif ( $arg =~ /pair_content\((screen\d+,)?\d+(,0x[[:xdigit:]]+){2}/i ) + { + $arg =~ s/(,0x[[:xdigit:]]+){2}[)]/,\&fg,\&bg)/i; + } + } + if ( &has_addr($arg) and $arg =~ /called\s+\{/ ) { + my $func = $arg; + chomp $func; + $func =~ s/^.*called\s+\{([[:alnum:]_]+)\(.*$/$1/; + if ( defined $known_p1{$func} ) { + my $addr = $arg; + my $type = $known_p1{$func}; + chomp $addr; + $addr =~ s/^[^(]+\((0x[[:xdigit:]]+).*/$1/i; + if ( $type == 1 ) { + $scr_addr{$addr} = ++$scr_nums; + $arg = &transaddr($arg); + } + elsif ( $type == 2 ) { + $win_addr{$addr} = ++$win_nums; + $arg = &transaddr($arg); + } + elsif ( $type == 4 ) { + $trm_addr{$addr} = ++$trm_nums; + $arg = &transaddr($arg); + } + } } return $arg; } -while () -{ - my $addr; - my $n; - my $awaiting; - -CLASSIFY: { - # Transform window pointer addresses so it's easier to compare logs - $awaiting = "curscr" if ($_ =~ /creating curscr/); - $awaiting = "newscr" if ($_ =~ /creating newscr/); - $awaiting = "stdscr" if ($_ =~ /creating stdscr/); - if ($_ =~ /^create :window 0x([0-9a-f]+)/) { - $addr = "0x$1"; - if ($awaiting eq "curscr") { - $curscr = $addr; - } elsif ($awaiting eq "newscr") { - $newscr = $addr; - } elsif ($awaiting eq "stdscr") { - $stdscr = $addr; - } else { - $win_addr[$win_nums] = $addr; - $win_nums = $win_nums + 1; - } - $awaiting = ""; - } elsif ($_ =~ /^\.\.\.deleted win=0x([0-9a-f]+)/) { - $addr = "0x$1"; - $_ = &transaddr($_); - if ($addr eq $curscr) { - $curscr = ""; - } elsif ($addr eq $newscr) { - $newscr = ""; - } elsif ($addr eq $stdscr) { - $stdscr = ""; - } else { - for $n (0..$#win_addr) { - if ($win_addr[$n] eq $addr) { - $win_addr[$n] = ""; - } - } - } - } - - # Compactify runs of PutAttrChar calls (TR_CHARPUT) - if ($_ =~ /$putattr/) - { - my $putattr_chars = $1; - my $starty = $2; - my $startx = $3; - while () - { - if ($_ =~ /$putattr/) { - $putattr_chars .= $1; - } else { - last; - } - } - print "RUN of PutAttrChar()s: \"$putattr_chars\" from ${starty}, ${startx}\n"; - redo CLASSIFY; - } - - # Compactify runs of waddnstr calls (TR_CALLS) - if ($_ =~ /$waddnstr/) - { - my $waddnstr_chars = $2; - my $winaddr = $1; - while () - { - if ($_ =~ /$waddnstr/ && $1 eq $winaddr) { - $waddnstr_chars .= $2; - } else { - last; - } - } - my $winaddstr = &transaddr($winaddr); - print "RUN of waddnstr()s: $winaddr, \"$waddnstr_chars\"\n"; - redo CLASSIFY; - } - - # More transformations can go here - - # Repeated runs of anything - my $anyline = &transaddr($_); - my $repeatcount = 1; - while () { - if (&transaddr($_) eq $anyline) { - $repeatcount++; - } else { - last; - } - } - if ($repeatcount > 1) { - print "${repeatcount} REPEATS OF $anyline"; - } else { - print $anyline - } - redo CLASSIFY if $_; - - } # :CLASSIFY +sub muncher($) { + my $STDIN = shift; + + while (<$STDIN>) { + my $addr; + my $n; + my $awaiting = ""; + + CLASSIFY: { + + # just in case someone tries a file with cr/lf line-endings: + $_ =~ s/\r\n/\n/g; + $_ =~ s/\r/\n/g; + + my $thread = ""; + if ( $_ =~ /^(0x[[:xdigit:]]+):/ ) { + $thr_addr{$1} = ++$thr_nums unless defined $thr_addr{$1}; + $thread = "thread" . $thr_addr{$1} . ":"; + $_ =~ s/^[^:]*://; + } + + # Transform window pointer addresses so it's easier to compare logs + $awaiting = "curscr" if ( $_ =~ /creating curscr/ ); + $awaiting = "newscr" if ( $_ =~ /creating newscr/ ); + $awaiting = "stdscr" if ( $_ =~ /creating stdscr/ ); + $awaiting = "screen" if ( $_ =~ /^(\+ )*called \{new_prescr\(\)/ ); + if ( $_ =~ /^create :window 0x([[:xdigit:]]+)/ ) { + $addr = "0x$1"; + if ( $awaiting eq "curscr" ) { + $curscr = $addr; + } + elsif ( $awaiting eq "newscr" ) { + $newscr = $addr; + } + elsif ( $awaiting eq "stdscr" ) { + $stdscr = $addr; + } + else { + $win_addr{$addr} = $win_nums++; + } + $awaiting = ""; + } + elsif ( $_ =~ /^(\+ )*called \{set_curterm\((0x[[:xdigit:]]+)\)/ ) { + $trm_addr{$2} = ++$trm_nums unless defined $trm_addr{$2}; + } + elsif ( $_ =~ /^(\+ )*called \{_nc_add_to_try\((0x[[:xdigit:]]+),/ ) + { + $try_addr{$2} = ++$try_nums unless defined $try_addr{$2}; + } + elsif ( $_ =~ /^(\+ )*_nc_alloc_screen_sp 0x([[:xdigit:]]+)/ ) { + $addr = "0x$2"; + $scr_addr{$addr} = ++$scr_nums unless ( $scr_addr{$addr} ); + $awaiting = ""; + } + elsif ( $_ =~ /^(\+ )*return }0x([[:xdigit:]]+)/ ) { + $addr = "0x$2"; + if ( $awaiting eq "screen" ) { + $scr_addr{$addr} = ++$scr_nums unless ( $scr_addr{$addr} ); + } + } + elsif ( $_ =~ /^\.\.\.deleted win=0x([[:xdigit:]]+)/ ) { + $addr = "0x$1"; + $_ = &transaddr($_); + if ( $addr eq $curscr ) { + $curscr = ""; + } + elsif ( $addr eq $newscr ) { + $newscr = ""; + } + elsif ( $addr eq $stdscr ) { + $stdscr = ""; + } + else { + undef $win_addr{$addr}; + } + } + + # Compactify runs of PutAttrChar calls (TR_CHARPUT) + if ( $_ =~ /$putattr/ ) { + my $putattr_chars = $1; + my $starty = $2; + my $startx = $3; + while (<$STDIN>) { + if ( $_ =~ /$putattr/ ) { + $putattr_chars .= $1; + } + else { + last; + } + } + print +"RUN of PutAttrChar()s: \"$putattr_chars\" from ${starty}, ${startx}\n"; + redo CLASSIFY; + } + + # Compactify runs of waddnstr calls (TR_CALLS) + if ( $_ =~ /$waddnstr/ ) { + my $waddnstr_chars = $2; + my $winaddr = $1; + while (<$STDIN>) { + if ( $_ =~ /$waddnstr/ && $1 eq $winaddr ) { + $waddnstr_chars .= $2; + } + else { + last; + } + } + my $winaddstr = &transaddr($winaddr); + print "RUN of waddnstr()s: $winaddr, \"$waddnstr_chars\"\n"; + redo CLASSIFY; + } + + # More transformations can go here + + # Repeated runs of anything + my $anyline = &transaddr($_); + my $repeatcount = 1; + while (<$STDIN>) { + if ( &transaddr($_) eq $anyline ) { + $repeatcount++; + } + else { + last; + } + } + if ( $repeatcount > 1 ) { + print "${repeatcount} REPEATS OF $anyline"; + } + else { + print $thread . $anyline; + } + redo CLASSIFY if $_; + + } # :CLASSIFY + } +} + +if ( $#ARGV >= 0 ) { + while ( $#ARGV >= 0 ) { + my $file = shift @ARGV; + open my $ifh, "<", $file or die $!; + &muncher($ifh); + } +} +else { + &muncher( \*STDIN ); } # tracemunch ends here diff --git a/test/view.c b/test/view.c index 4782d8509748..eb7786e1a36d 100644 --- a/test/view.c +++ b/test/view.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2017,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -33,7 +33,8 @@ * * modified by Thomas Dickey July 1995 to demonstrate * the use of 'resizeterm()', and May 2000 to illustrate wide-character - * handling. + * handling. This program intentionally does not use pads, to allow testing + * with less-capable implementations of curses. * * Takes a filename argument. It's a simple file-viewer with various * scroll-up and scroll-down commands. @@ -50,55 +51,19 @@ * scroll operation worked, and the refresh() code only had to do a * partial repaint. * - * $Id: view.c,v 1.94 2013/09/28 21:58:42 tom Exp $ + * $Id: view.c,v 1.137 2019/12/07 19:03:07 tom Exp $ */ #include #include +#include +#include #include -#undef CTRL /* conflict on AIX 5.2 with */ - -#if HAVE_TERMIOS_H -# include -#else -#if !defined(__MINGW32__) -# include -#endif -#endif - -#if !defined(sun) || !HAVE_TERMIOS_H -# if HAVE_SYS_IOCTL_H -# include -# endif -#endif - -#define my_pair 1 - -/* This is needed to compile 'struct winsize' */ -#if NEED_PTEM_H -#include -#include -#endif - -#undef CTRL -#define CTRL(x) ((x) & 0x1f) - static void finish(int sig) GCC_NORETURN; -static void show_all(const char *tag); - -#if defined(SIGWINCH) && defined(TIOCGWINSZ) && HAVE_RESIZE_TERM -#define CAN_RESIZE 1 -#else -#define CAN_RESIZE 0 -#endif -#if CAN_RESIZE -static void adjust(int sig); -static int interrupted; -static bool waiting = FALSE; -#endif +#define my_pair 1 static int shift = 0; static bool try_color = FALSE; @@ -108,36 +73,22 @@ static NCURSES_CH_T **vec_lines; static NCURSES_CH_T **lptr; static int num_lines; +#if USE_WIDEC_SUPPORT +static bool n_option = FALSE; +#endif + static void usage(void) GCC_NORETURN; static void -usage(void) +failed(const char *msg) { - static const char *msg[] = - { - "Usage: view [options] file" - ,"" - ,"Options:" - ," -c use color if terminal supports it" - ," -i ignore INT, QUIT, TERM signals" - ," -n NUM specify maximum number of lines (default 1000)" -#if defined(KEY_RESIZE) - ," -r use old-style sigwinch handler rather than KEY_RESIZE" -#endif - ," -s start in single-step mode, waiting for input" -#ifdef TRACE - ," -t trace screen updates" - ," -T NUM specify trace mask" -#endif - }; - size_t n; - for (n = 0; n < SIZEOF(msg); n++) - fprintf(stderr, "%s\n", msg[n]); + endwin(); + fprintf(stderr, "%s\n", msg); ExitProgram(EXIT_FAILURE); } static int -ch_len(NCURSES_CH_T * src) +ch_len(NCURSES_CH_T *src) { int result = 0; #if USE_WIDEC_SUPPORT @@ -147,7 +98,8 @@ ch_len(NCURSES_CH_T * src) #if USE_WIDEC_SUPPORT for (;;) { TEST_CCHAR(src, count, { - ++result; + int len = wcwidth(test_wch[0]); + result += (len > 0) ? len : 1; ++src; } , { @@ -161,110 +113,334 @@ ch_len(NCURSES_CH_T * src) return result; } -/* - * Allocate a string into an array of chtype's. If UTF-8 mode is - * active, translate the string accordingly. - */ -static NCURSES_CH_T * -ch_dup(char *src) +static void +finish(int sig) +{ + endwin(); +#if NO_LEAKS + if (vec_lines != 0) { + int n; + for (n = 0; n < num_lines; ++n) { + free(vec_lines[n]); + } + free(vec_lines); + } +#endif + ExitProgram(sig != 0 ? EXIT_FAILURE : EXIT_SUCCESS); +} + +static void +show_all(const char *tag) { - unsigned len = (unsigned) strlen(src); - NCURSES_CH_T *dst = typeMalloc(NCURSES_CH_T, len + 1); - size_t j, k; + int i; + int digits; + char temp[BUFSIZ]; + NCURSES_CH_T *s; + time_t this_time; + + for (digits = 1, i = num_lines; i > 0; i /= 10) { + ++digits; + } + + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "view %.*s", (int) strlen(tag), tag); + i = (int) strlen(temp); + _nc_SPRINTF(temp + i, _nc_SLIMIT(sizeof(temp) - (size_t) i) + " %.*s", (int) sizeof(temp) - i - 2, fname); + move(0, 0); + printw("%.*s", COLS, temp); + clrtoeol(); + this_time = time((time_t *) 0); + _nc_STRNCPY(temp, ctime(&this_time), (size_t) 30); + if ((i = (int) strlen(temp)) != 0) { + temp[--i] = 0; + if (move(0, COLS - i - 2) != ERR) + printw(" %s", temp); + } + + scrollok(stdscr, FALSE); /* prevent screen from moving */ + for (i = 1; i < LINES; i++) { + int len; + int actual = (int) (lptr + i - vec_lines); + if (actual > num_lines) { + if (i < LINES - 1) { + int y, x; + getyx(stdscr, y, x); + move(i, 0); + clrtobot(); + move(y, x); + } + break; + } + move(i, 0); + printw("%*d:", digits, actual); + clrtoeol(); + if ((s = lptr[i - 1]) == 0) { + continue; + } + len = ch_len(s); + if (len > shift) { #if USE_WIDEC_SUPPORT - wchar_t wstr[CCHARW_MAX + 1]; - wchar_t wch; - int l = 0; - size_t rc; + /* + * An index into an array of cchar_t's is not necessarily the same + * as the column-offset. A pad would do this directly. Here we + * must translate (or compute a table of offsets). + */ + { + int j; + int width = 1, count; + for (j = actual = 0; j < shift; ++j) { + TEST_CCHAR(s + j, count, { + width = wcwidth(test_wch[0]); + } + , { + width = 1; + }); + actual += width; + if (actual > shift) { + break; + } else if (actual == shift) { + ++j; + break; + } + } + if (actual < len) { + if (actual > shift) + addch('<'); + add_wchstr(s + j + (actual > shift)); + } + } +#else + addchstr(s + shift); +#endif + } +#if defined(NCURSES_VERSION) || defined(HAVE_WCHGAT) + if (try_color) + wchgat(stdscr, -1, WA_NORMAL, my_pair, NULL); +#endif + } + setscrreg(1, LINES - 1); + scrollok(stdscr, TRUE); + refresh(); +} + +static void +read_file(const char *filename) +{ + FILE *fp; + int pass; + int k; int width; + size_t j; + size_t len; + struct stat sb; + char *my_blob; + char **my_vec = 0; + WINDOW *my_win; + + if (stat(filename, &sb) != 0 + || (sb.st_mode & S_IFMT) != S_IFREG) { + failed("input is not a file"); + } + + if (sb.st_size == 0) { + failed("input is empty"); + } + + if ((fp = fopen(filename, "r")) == 0) { + failed("cannot open input-file"); + } + + if ((my_blob = malloc((size_t) sb.st_size + 1)) == 0) { + failed("cannot allocate memory for input-file"); + } + + len = fread(my_blob, sizeof(char), (size_t) sb.st_size, fp); + my_blob[sb.st_size] = '\0'; + fclose(fp); + + for (pass = 0; pass < 2; ++pass) { + char *base = my_blob; + k = 0; + for (j = 0; j < len; ++j) { + if (my_blob[j] == '\n') { + if (pass) { + my_vec[k] = base; + my_blob[j] = '\0'; + } + base = my_blob + j + 1; + ++k; + } + } + num_lines = k; + if (base != (my_blob + j)) + ++num_lines; + if (!pass && + ((my_vec = typeCalloc(char *, (size_t) k + 2)) == 0)) { + failed("cannot allocate line-vector #1"); + } + } + +#if USE_WIDEC_SUPPORT + if (!memcmp("\357\273\277", my_blob, 3)) { + char *s = my_blob + 3; + char *d = my_blob; + Trace(("trim BOM")); + do { + } while ((*d++ = *s++) != '\0'); + } +#endif + + width = (int) strlen(my_vec[0]); + for (k = 1; my_vec[k]; ++k) { + int check = (int) (my_vec[k] - my_vec[k - 1]); + if (width < check) + width = check; + } + width = (width + 1) * 5; + my_win = newwin(2, width, 0, 0); + if (my_win == 0) { + failed("cannot allocate temporary window"); + } + + if ((vec_lines = typeCalloc(NCURSES_CH_T *, (size_t) num_lines + 2)) == 0) { + failed("cannot allocate line-vector #2"); + } + + /* + * Use the curses library for rendering, including tab-conversion. This + * will not make the resulting array's indices correspond to column for + * lines containing double-width cells because the "in_wch" functions will + * ignore the skipped cells. Use pads for that sort of thing. + */ + Trace(("slurp the file")); + for (k = 0; my_vec[k]; ++k) { + char *s; + int y, x; +#if USE_WIDEC_SUPPORT + char *last = my_vec[k] + (int) strlen(my_vec[k]); + wchar_t wch[2]; + size_t rc; #ifndef state_unused - mbstate_t state; + mbstate_t state; #endif #endif /* USE_WIDEC_SUPPORT */ + werase(my_win); + wmove(my_win, 0, 0); #if USE_WIDEC_SUPPORT - reset_mbytes(state); + wch[1] = 0; + reset_mbytes(state); #endif - for (j = k = 0; j < len; j++) { + for (s = my_vec[k]; *s != '\0'; ++s) { #if USE_WIDEC_SUPPORT - rc = (size_t) check_mbytes(wch, src + j, len - j, state); - if (rc == (size_t) -1 || rc == (size_t) -2) - break; - j += rc - 1; - if ((width = wcwidth(wch)) < 0) - break; - if ((width > 0 && l > 0) || l == CCHARW_MAX) { - wstr[l] = L'\0'; - l = 0; - if (setcchar(dst + k, wstr, 0, 0, NULL) != OK) - break; - ++k; + if (!n_option) { + rc = (size_t) check_mbytes(wch[0], s, (size_t) (last - s), state); + if ((long) rc == -1 || (long) rc == -2) { + break; + } + s += rc - 1; + waddwstr(my_win, wch); + } else +#endif + waddch(my_win, *s & 0xff); + } + getyx(my_win, y, x); + if (y) + x = width - 1; + wmove(my_win, 0, 0); + /* "x + 1" works with standard curses; some implementations are buggy */ + if ((vec_lines[k] = typeCalloc(NCURSES_CH_T, x + width + 1)) == 0) { + failed("cannot allocate line-vector #3"); } - if (width == 0 && l == 0) - wstr[l++] = L' '; - wstr[l++] = wch; +#if USE_WIDEC_SUPPORT + win_wchnstr(my_win, vec_lines[k], x); #else - dst[k++] = (chtype) UChar(src[j]); + winchnstr(my_win, vec_lines[k], x); #endif } + + delwin(my_win); + free(my_vec); + free(my_blob); +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: view [options] file" + ,"" + ,"Options:" + ," -c use color if terminal supports it" + ," -i ignore INT, QUIT, TERM signals" #if USE_WIDEC_SUPPORT - if (l > 0) { - wstr[l] = L'\0'; - if (setcchar(dst + k, wstr, 0, 0, NULL) == OK) - ++k; - } - wstr[0] = L'\0'; - setcchar(dst + k, wstr, 0, 0, NULL); -#else - dst[k] = 0; + ," -n use waddch (bytes) rather then wadd_wch (wide-chars)" #endif - return dst; + ," -s start in single-step mode, waiting for input" +#ifdef TRACE + ," -t trace screen updates" + ," -T NUM specify trace mask" +#endif + }; + size_t n; + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + ExitProgram(EXIT_FAILURE); } int main(int argc, char *argv[]) { - int MAXLINES = 1000; - FILE *fp; - char buf[BUFSIZ]; + static const char *help[] = + { + "Commands:", + " q,^Q,ESC - quit this program", + "", + " p, - scroll the viewport up by one row", + " n, - scroll the viewport down by one row", + " l, - scroll the viewport left by one column", + " r, - scroll the viewport right by one column", + " <,> - scroll the viewport left/right by 8 columns", + "", + " h, - scroll the viewport to top of file", + " ^F, - scroll to the next page", + " ^B, - scroll to the previous page", + " e, - scroll the viewport to end of file", + "", + " ^L - repaint using redrawwin()", + "", + " 0 through 9 - enter digits for count", + " s - use entered count for halfdelay() parameter", + " - if no entered count, stop nodelay()", + " - begin nodelay()", + 0 + }; + int i; int my_delay = 0; NCURSES_CH_T **olptr; int value = 0; bool done = FALSE; bool got_number = FALSE; + bool ignore_sigs = FALSE; bool single_step = FALSE; -#if CAN_RESIZE - bool nonposix_resize = FALSE; -#endif const char *my_label = "Input"; setlocale(LC_ALL, ""); -#ifndef NCURSES_VERSION - /* - * We know ncurses will catch SIGINT if we don't establish our own handler. - * Other versions of curses may/may not catch it. - */ - (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ -#endif - - while ((i = getopt(argc, argv, "cin:rstT:")) != -1) { + while ((i = getopt(argc, argv, "cinstT:")) != -1) { switch (i) { case 'c': try_color = TRUE; break; case 'i': - CATCHALL(SIG_IGN); + ignore_sigs = TRUE; break; +#if USE_WIDEC_SUPPORT case 'n': - if ((MAXLINES = atoi(optarg)) < 1 || - (MAXLINES + 2) <= 1) - usage(); - break; -#if CAN_RESIZE - case 'r': - nonposix_resize = TRUE; + n_option = TRUE; break; #endif case 's': @@ -277,11 +453,11 @@ main(int argc, char *argv[]) int tvalue = (int) strtol(optarg, &next, 0); if (tvalue < 0 || (next != 0 && *next != 0)) usage(); - trace((unsigned) tvalue); + curses_trace((unsigned) tvalue); } break; case 't': - trace(TRACE_CALLS); + curses_trace(TRACE_CALLS); break; #endif default: @@ -291,76 +467,7 @@ main(int argc, char *argv[]) if (optind + 1 != argc) usage(); - if ((vec_lines = typeCalloc(NCURSES_CH_T *, (size_t) MAXLINES + 2)) == 0) - usage(); - - assert(vec_lines != 0); - - fname = argv[optind]; - if ((fp = fopen(fname, "r")) == 0) { - perror(fname); - ExitProgram(EXIT_FAILURE); - } -#if CAN_RESIZE - if (nonposix_resize) - (void) signal(SIGWINCH, adjust); /* arrange interrupts to resize */ -#endif - - Trace(("slurp the file")); - for (lptr = &vec_lines[0]; (lptr - vec_lines) < MAXLINES; lptr++) { - char temp[BUFSIZ], *s, *d; - int col; - - if (fgets(buf, sizeof(buf), fp) == 0) - break; - -#if USE_WIDEC_SUPPORT - if (lptr == vec_lines) { - if (!memcmp("", buf, 3)) { - Trace(("trim BOM")); - s = buf + 3; - d = buf; - do { - } while ((*d++ = *s++) != '\0'); - } - } -#endif - - /* convert tabs and nonprinting chars so that shift will work properly */ - for (s = buf, d = temp, col = 0; (*d = *s) != '\0'; s++) { - if (*d == '\r') { - if (s[1] == '\n') - continue; - else - break; - } - if (*d == '\n') { - *d = '\0'; - break; - } else if (*d == '\t') { - col = (col | 7) + 1; - while ((d - temp) != col) - *d++ = ' '; - } else -#if USE_WIDEC_SUPPORT - col++, d++; -#else - if (isprint(UChar(*d))) { - col++; - d++; - } else { - sprintf(d, "\\%03o", UChar(*s)); - d += strlen(d); - col = (int) (d - temp); - } -#endif - } - *lptr = ch_dup(temp); - } - (void) fclose(fp); - num_lines = (int) (lptr - vec_lines); - - (void) initscr(); /* initialize the curses library */ + InitAndCatch(initscr(), ignore_sigs ? SIG_IGN : finish); keypad(stdscr, TRUE); /* enable keyboard mapping */ (void) nonl(); /* tell curses not to do NL->CR/NL on output */ (void) cbreak(); /* take input chars one at a time, no wait for \n */ @@ -369,6 +476,8 @@ main(int argc, char *argv[]) nodelay(stdscr, TRUE); idlok(stdscr, TRUE); /* allow use of insert/delete line */ + read_file(fname = argv[optind]); + if (try_color) { if (has_colors()) { start_color(); @@ -387,17 +496,7 @@ main(int argc, char *argv[]) show_all(my_label); for (;;) { -#if CAN_RESIZE - if (interrupted) { - adjust(0); - my_label = "interrupt"; - } - waiting = TRUE; - c = getch(); - waiting = FALSE; -#else c = getch(); -#endif if ((c < 127) && isdigit(c)) { if (!got_number) { MvPrintw(0, 0, "Count: "); @@ -441,16 +540,48 @@ main(int argc, char *argv[]) break; case 'h': + /* FALLTHRU */ case KEY_HOME: lptr = vec_lines; break; + case '<': + if ((shift -= 8) < 0) + shift = 0; + break; + case '>': + shift += 8; + break; + case 'e': + /* FALLTHRU */ case KEY_END: if (num_lines > LINES) - lptr = vec_lines + num_lines - LINES + 1; + lptr = (vec_lines + num_lines - LINES + 1); else - lptr = vec_lines; + lptr = (vec_lines + (num_lines - 2)); + break; + + case CTRL('F'): + /* FALLTHRU */ + case KEY_NPAGE: + for (i = 0; i < n; i++) { + if ((lptr - vec_lines) < (num_lines - 5)) + lptr += (LINES - 1); + else + lptr = (vec_lines + num_lines - 2); + } + break; + + case CTRL('B'): + /* FALLTHRU */ + case KEY_PPAGE: + for (i = 0; i < n; i++) { + if ((lptr - vec_lines) >= LINES) + lptr -= (LINES - 1); + else + lptr = vec_lines; + } break; case 'r': @@ -468,6 +599,8 @@ main(int argc, char *argv[]) break; case 'q': + case QUIT: + case ESCAPE: done = TRUE; break; @@ -476,12 +609,17 @@ main(int argc, char *argv[]) break; #endif case 's': +#if HAVE_HALFDELAY if (got_number) { halfdelay(my_delay = n); } else { nodelay(stdscr, FALSE); my_delay = -1; } +#else + nodelay(stdscr, FALSE); + my_delay = -1; +#endif break; case ' ': nodelay(stdscr, TRUE); @@ -494,6 +632,9 @@ main(int argc, char *argv[]) if (!my_delay) napms(50); break; + case HELP_KEY_1: + popup_msg(stdscr, help); + break; default: beep(); break; @@ -506,105 +647,3 @@ main(int argc, char *argv[]) finish(0); /* we're done */ } - -static void -finish(int sig) -{ - endwin(); -#if NO_LEAKS - if (vec_lines != 0) { - int n; - for (n = 0; n < num_lines; ++n) { - free(vec_lines[n]); - } - free(vec_lines); - } -#endif - ExitProgram(sig != 0 ? EXIT_FAILURE : EXIT_SUCCESS); -} - -#if CAN_RESIZE -/* - * This uses functions that are "unsafe", but it seems to work on SunOS. - * Usually: the "unsafe" refers to the functions that POSIX lists which may be - * called from a signal handler. Those do not include buffered I/O, which is - * used for instance in wrefresh(). To be really portable, you should use the - * KEY_RESIZE return (which relies on ncurses' sigwinch handler). - * - * The 'wrefresh(curscr)' is needed to force the refresh to start from the top - * of the screen -- some xterms mangle the bitmap while resizing. - */ -static void -adjust(int sig) -{ - if (waiting || sig == 0) { - struct winsize size; - - if (ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) { - resize_term(size.ws_row, size.ws_col); - wrefresh(curscr); - show_all(sig ? "SIGWINCH" : "interrupt"); - } - interrupted = FALSE; - } else { - interrupted = TRUE; - } - (void) signal(SIGWINCH, adjust); /* some systems need this */ -} -#endif /* CAN_RESIZE */ - -static void -show_all(const char *tag) -{ - int i; - char temp[BUFSIZ]; - NCURSES_CH_T *s; - time_t this_time; - -#if CAN_RESIZE - sprintf(temp, "%.20s (%3dx%3d) col %d ", tag, LINES, COLS, shift); - i = (int) strlen(temp); - if ((i + 7) < (int) sizeof(temp)) { - sprintf(temp + i, "view %.*s", - (int) (sizeof(temp) - 7 - (size_t) i), - fname); - } -#else - (void) tag; - sprintf(temp, "view %.*s", (int) sizeof(temp) - 7, fname); -#endif - move(0, 0); - printw("%.*s", COLS, temp); - clrtoeol(); - this_time = time((time_t *) 0); - strncpy(temp, ctime(&this_time), (size_t) 30); - if ((i = (int) strlen(temp)) != 0) { - temp[--i] = 0; - if (move(0, COLS - i - 2) != ERR) - printw(" %s", temp); - } - - scrollok(stdscr, FALSE); /* prevent screen from moving */ - for (i = 1; i < LINES; i++) { - move(i, 0); - printw("%3ld:", (long) (lptr + i - vec_lines)); - clrtoeol(); - if ((s = lptr[i - 1]) != 0) { - int len = ch_len(s); - if (len > shift) { -#if USE_WIDEC_SUPPORT - add_wchstr(s + shift); -#else - addchstr(s + shift); -#endif - } -#if defined(NCURSES_VERSION) || defined(HAVE_WCHGAT) - if (try_color) - wchgat(stdscr, -1, A_NORMAL, my_pair, NULL); -#endif - } - } - setscrreg(1, LINES - 1); - scrollok(stdscr, TRUE); - refresh(); -} diff --git a/test/widechars-utf8-tabs.txt b/test/widechars-utf8-tabs.txt new file mode 100644 index 000000000000..ca605a1db751 --- /dev/null +++ b/test/widechars-utf8-tabs.txt @@ -0,0 +1,15 @@ +APPLE -- It's an APPLE. +DOG -- No, that's not my DOG. +ORANGE -- Yeah, that's JUICY. +CHICKEN -- Normally not a PET. +CAT -- No, never put a DOG and a CAT together! +FISH -- Cats like FISH. +LEMON -- You KNOW how it TASTES. +----+----1----+----2----+----3----+----4 +APPLE -- It's an APPLE. + APPLE -- It's an APPLE. + APPLE -- It's an APPLE. + APPLE -- It's an APPLE. + APPLE -- It's an APPLE. + APPLE -- It's an APPLE. +----+----1----+----2----+----3----+----4 diff --git a/test/widechars.h b/test/widechars.h index e7897bae6ca7..f196edb7ade0 100644 --- a/test/widechars.h +++ b/test/widechars.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2012 Free Software Foundation, Inc. * + * Copyright (c) 2012,2018 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -33,7 +33,7 @@ #if USE_WIDEC_SUPPORT -#if defined(__MINGW32__) +#if defined(_WIN32) /* * MinGW has wide-character functions, but they do not work correctly. */ @@ -45,7 +45,7 @@ extern int __MINGW_NOTHROW _nc_mbtowc(wchar_t *pwc, const char *s, size_t n); extern int __MINGW_NOTHROW _nc_mblen(const char *, size_t); #define mblen(s,n) _nc_mblen(s, n) -#endif /* __MINGW32__ */ +#endif /* _WIN32 */ #if HAVE_MBTOWC && HAVE_MBLEN #define reset_mbytes(state) IGNORE_RC(mblen(NULL, 0)), IGNORE_RC(mbtowc(NULL, NULL, 0)) diff --git a/test/worm.c b/test/worm.c index c3fc0da822ef..c7b04aa81445 100644 --- a/test/worm.c +++ b/test/worm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2018,2019 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 * @@ -47,25 +47,20 @@ July 1995 (esr): worms is now in living color! :-) -Options: - -f fill screen with copies of 'WORM' at start. - -l set worm length - -n set number of worms - -t make worms leave droppings - -T set trace interval - -S set single-stepping during trace interval - -N suppress cursor-movement optimization - This program makes a good torture-test for the ncurses cursor-optimization code. You can use -T to set the worm move interval over which movement traces will be dumped. The program stops and waits for one character of input at the beginning and end of the interval. - $Id: worm.c,v 1.65 2013/06/22 20:01:41 tom Exp $ + $Id: worm.c,v 1.81 2019/12/14 23:25:29 tom Exp $ */ #include +#ifndef NCURSES_VERSION +#undef TRACE +#endif + #ifdef USE_PTHREADS #include #endif @@ -102,6 +97,7 @@ static unsigned long sequence = 0; static bool quitting = FALSE; static WORM worm[MAX_WORMS]; +static int max_refs; static int **refs; static int last_x, last_y; @@ -201,20 +197,34 @@ static const struct options { }; /* *INDENT-ON* */ +#if HAVE_USE_WINDOW +static int +safe_wgetch(WINDOW *w, void *data GCC_UNUSED) +{ + return wgetch(w); +} +static int +safe_wrefresh(WINDOW *w, void *data GCC_UNUSED) +{ + return wrefresh(w); +} +#endif + +#ifdef KEY_RESIZE static void failed(const char *s) { perror(s); - endwin(); + stop_curses(); ExitProgram(EXIT_FAILURE); } +#endif static void cleanup(void) { - USING_WINDOW(stdscr, wrefresh); - curs_set(1); - endwin(); + USING_WINDOW1(stdscr, wrefresh, safe_wrefresh); + stop_curses(); } static void @@ -294,6 +304,7 @@ draw_worm(WINDOW *win, void *data) switch (op->nopts) { case 0: done = TRUE; + Trace(("done - draw_worm")); break; case 1: w->orientation = op->opts[0]; @@ -324,9 +335,9 @@ draw_worm(WINDOW *win, void *data) static bool quit_worm(int bitnum) { - pending |= (1 << bitnum); + pending = (pending | (unsigned) (1 << bitnum)); napms(10); /* let the other thread(s) have a chance */ - pending &= ~(1 << bitnum); + pending = (pending & (unsigned) ~(1 << bitnum)); return quitting; } @@ -335,7 +346,7 @@ start_worm(void *arg) { unsigned long compare = 0; Trace(("start_worm")); - while (!quit_worm(((struct worm *) arg) - worm)) { + while (!quit_worm((int) (((struct worm *) arg) - worm))) { while (compare < sequence) { ++compare; #if HAVE_USE_WINDOW @@ -384,17 +395,18 @@ static int get_input(void) { int ch; - ch = USING_WINDOW(stdscr, wgetch); + ch = USING_WINDOW1(stdscr, wgetch, safe_wgetch); return ch; } #ifdef KEY_RESIZE static int -update_refs(WINDOW *win) +update_refs(WINDOW *win, void *data) { int x, y; (void) win; + (void) data; if (last_x != COLS - 1) { for (y = 0; y <= last_y; y++) { refs[y] = typeRealloc(int, (size_t) COLS, refs[y]); @@ -408,6 +420,7 @@ update_refs(WINDOW *win) if (last_y != LINES - 1) { for (y = LINES; y <= last_y; y++) free(refs[y]); + max_refs = LINES; refs = typeRealloc(int *, (size_t) LINES, refs); for (y = last_y + 1; y < LINES; y++) { refs[y] = typeMalloc(int, (size_t) COLS); @@ -422,41 +435,69 @@ update_refs(WINDOW *win) } #endif +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: worm [options]" + ,"" + ,"Options:" +#if HAVE_USE_DEFAULT_COLORS + ," -d invoke use_default_colors" +#endif + ," -f fill screen with copies of \"WORM\" at start" + ," -l set length of worms" + ," -n set number of worms" + ," -t leave trail of \".\"" +#ifdef TRACE + ," -T , set trace interval" + ," -N suppress cursor-movement optimization" +#endif + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(EXIT_FAILURE); +} + int main(int argc, char *argv[]) { + int ch; int x, y; int n; struct worm *w; int *ip; bool done = FALSE; - int max_refs; +#if HAVE_USE_DEFAULT_COLORS + bool opt_d = FALSE; +#endif setlocale(LC_ALL, ""); - for (x = 1; x < argc; x++) { - char *p; - p = argv[x]; - if (*p == '-') - p++; - switch (*p) { + while ((ch = getopt(argc, argv, "dfl:n:tT:N")) != -1) { + switch (ch) { +#if HAVE_USE_DEFAULT_COLORS + case 'd': + opt_d = TRUE; + break; +#endif case 'f': field = "WORM"; break; case 'l': - if (++x == argc) - goto usage; - if ((length = atoi(argv[x])) < 2 || length > MAX_LENGTH) { + if ((length = atoi(optarg)) < 2 || length > MAX_LENGTH) { fprintf(stderr, "%s: Invalid length\n", *argv); - ExitProgram(EXIT_FAILURE); + usage(); } break; case 'n': - if (++x == argc) - goto usage; - if ((number = atoi(argv[x])) < 1 || number > MAX_WORMS) { + if ((number = atoi(optarg)) < 1 || number > MAX_WORMS) { fprintf(stderr, "%s: Invalid number of worms\n", *argv); - ExitProgram(EXIT_FAILURE); + usage(); } break; case 't': @@ -464,20 +505,20 @@ main(int argc, char *argv[]) break; #ifdef TRACE case 'T': - trace_start = atoi(argv[++x]); - trace_end = atoi(argv[++x]); + if (sscanf(optarg, "%d,%d", &trace_start, &trace_end) != 2) + usage(); break; case 'N': _nc_optimize_enable ^= OPTIMIZE_ALL; /* declared by ncurses */ break; #endif /* TRACE */ default: - usage: - fprintf(stderr, - "usage: %s [-field] [-length #] [-number #] [-trail]\n", *argv); - ExitProgram(EXIT_FAILURE); + usage(); + /* NOTREACHED */ } } + if (optind < argc) + usage(); signal(SIGINT, onsig); initscr(); @@ -495,7 +536,7 @@ main(int argc, char *argv[]) int bg = COLOR_BLACK; start_color(); #if HAVE_USE_DEFAULT_COLORS - if (use_default_colors() == OK) + if (opt_d && (use_default_colors() == OK)) bg = -1; #endif @@ -558,21 +599,19 @@ main(int argc, char *argv[]) } } } - USING_WINDOW(stdscr, wrefresh); + USING_WINDOW1(stdscr, wrefresh, safe_wrefresh); nodelay(stdscr, TRUE); while (!done) { - int ch; - ++sequence; if ((ch = get_input()) > 0) { #ifdef TRACE if (trace_start || trace_end) { if (generation == trace_start) { - trace(TRACE_CALLS); + curses_trace(TRACE_CALLS); get_input(); } else if (generation == trace_end) { - trace(0); + curses_trace(0); get_input(); } @@ -593,6 +632,7 @@ main(int argc, char *argv[]) if (ch == 'q') { quitting = TRUE; done = TRUE; + Trace(("done - quitting")); continue; } else if (ch == 's') { nodelay(stdscr, FALSE); @@ -603,12 +643,12 @@ main(int argc, char *argv[]) done = draw_all_worms(); napms(10); - USING_WINDOW(stdscr, wrefresh); + USING_WINDOW1(stdscr, wrefresh, safe_wrefresh); } Trace(("Cleanup")); cleanup(); -#ifdef NO_LEAKS +#if NO_LEAKS for (y = 0; y < max_refs; y++) { free(refs[y]); } diff --git a/test/xmas.c b/test/xmas.c index 087fcd9d81d1..78b187c20a3e 100644 --- a/test/xmas.c +++ b/test/xmas.c @@ -92,7 +92,7 @@ /******************************************************************************/ /* - * $Id: xmas.c,v 1.28 2013/04/27 19:46:53 tom Exp $ + * $Id: xmas.c,v 1.34 2019/12/14 23:25:29 tom Exp $ */ #include @@ -133,21 +133,6 @@ static WINDOW *w_holiday; static WINDOW *w_del_msg; static bool *my_pairs; -static int boxit(void); -static int seas(void); -static int greet(void); -static int fromwho(void); -static int tree(void); -static int balls(void); -static int star(void); -static int strng1(void); -static int strng2(void); -static int strng3(void); -static int strng4(void); -static int strng5(void); -static int reindeer(void); -static int blinkit(void); - static void done(int sig) GCC_NORETURN; static void @@ -183,980 +168,1007 @@ look_out(int msecs) } } -int -main(int argc GCC_UNUSED, char **argv GCC_UNUSED) +static int +boxit(void) { - int loopy; + int x = 0; - setlocale(LC_ALL, ""); + while (x < 20) { + MvAddCh(x, 7, '|'); + ++x; + } - initscr(); - noecho(); - nonl(); - refresh(); + x = 8; + + while (x < 80) { + MvAddCh(19, x, '_'); + ++x; + } - CATCHALL(done); + x = 0; - if (has_colors()) { - start_color(); -#if HAVE_USE_DEFAULT_COLORS - if (use_default_colors() == OK) - my_bg = -1; -#endif + while (x < 80) { + MvAddCh(22, x, '_'); + ++x; } - curs_set(0); - if ((treescrn = newwin(16, 27, 3, 53)) == 0 || - (treescrn2 = newwin(16, 27, 3, 53)) == 0 || - (treescrn3 = newwin(16, 27, 3, 53)) == 0 || - (treescrn4 = newwin(16, 27, 3, 53)) == 0 || - (treescrn5 = newwin(16, 27, 3, 53)) == 0 || - (treescrn6 = newwin(16, 27, 3, 53)) == 0 || - (treescrn7 = newwin(16, 27, 3, 53)) == 0 || - (treescrn8 = newwin(16, 27, 3, 53)) == 0 || + return (0); +} - (dotdeer0 = newwin(3, 71, 0, 8)) == 0 || +static int +seas(void) +{ + MvAddCh(4, 1, 'S'); + MvAddCh(6, 1, 'E'); + MvAddCh(8, 1, 'A'); + MvAddCh(10, 1, 'S'); + MvAddCh(12, 1, 'O'); + MvAddCh(14, 1, 'N'); + MvAddCh(16, 1, '`'); + MvAddCh(18, 1, 'S'); - (stardeer0 = newwin(4, 56, 0, 8)) == 0 || + return (0); +} - (lildeer0 = newwin(7, 53, 0, 8)) == 0 || - (lildeer1 = newwin(2, 4, 0, 0)) == 0 || - (lildeer2 = newwin(2, 4, 0, 0)) == 0 || - (lildeer3 = newwin(2, 4, 0, 0)) == 0 || +static int +greet(void) +{ + MvAddCh(3, 5, 'G'); + MvAddCh(5, 5, 'R'); + MvAddCh(7, 5, 'E'); + MvAddCh(9, 5, 'E'); + MvAddCh(11, 5, 'T'); + MvAddCh(13, 5, 'I'); + MvAddCh(15, 5, 'N'); + MvAddCh(17, 5, 'G'); + MvAddCh(19, 5, 'S'); - (middeer0 = newwin(15, 42, 0, 8)) == 0 || - (middeer1 = newwin(3, 7, 0, 0)) == 0 || - (middeer2 = newwin(3, 7, 0, 0)) == 0 || - (middeer3 = newwin(3, 7, 0, 0)) == 0 || + return (0); +} - (bigdeer0 = newwin(10, 23, 0, 0)) == 0 || - (bigdeer1 = newwin(10, 23, 0, 0)) == 0 || - (bigdeer2 = newwin(10, 23, 0, 0)) == 0 || - (bigdeer3 = newwin(10, 23, 0, 0)) == 0 || - (bigdeer4 = newwin(10, 23, 0, 0)) == 0 || +static int +fromwho(void) +{ + MvAddStr(21, 13, FROMWHO); + return (0); +} - (lookdeer0 = newwin(10, 25, 0, 0)) == 0 || - (lookdeer1 = newwin(10, 25, 0, 0)) == 0 || - (lookdeer2 = newwin(10, 25, 0, 0)) == 0 || - (lookdeer3 = newwin(10, 25, 0, 0)) == 0 || - (lookdeer4 = newwin(10, 25, 0, 0)) == 0 || +static int +tree(void) +{ + set_color(treescrn, COLOR_GREEN); + MvWAddCh(treescrn, 1, 11, (chtype) '/'); + MvWAddCh(treescrn, 2, 11, (chtype) '/'); + MvWAddCh(treescrn, 3, 10, (chtype) '/'); + MvWAddCh(treescrn, 4, 9, (chtype) '/'); + MvWAddCh(treescrn, 5, 9, (chtype) '/'); + MvWAddCh(treescrn, 6, 8, (chtype) '/'); + MvWAddCh(treescrn, 7, 7, (chtype) '/'); + MvWAddCh(treescrn, 8, 6, (chtype) '/'); + MvWAddCh(treescrn, 9, 6, (chtype) '/'); + MvWAddCh(treescrn, 10, 5, (chtype) '/'); + MvWAddCh(treescrn, 11, 3, (chtype) '/'); + MvWAddCh(treescrn, 12, 2, (chtype) '/'); - (w_holiday = newwin(1, 26, 3, 27)) == 0 || + MvWAddCh(treescrn, 1, 13, (chtype) '\\'); + MvWAddCh(treescrn, 2, 13, (chtype) '\\'); + MvWAddCh(treescrn, 3, 14, (chtype) '\\'); + MvWAddCh(treescrn, 4, 15, (chtype) '\\'); + MvWAddCh(treescrn, 5, 15, (chtype) '\\'); + MvWAddCh(treescrn, 6, 16, (chtype) '\\'); + MvWAddCh(treescrn, 7, 17, (chtype) '\\'); + MvWAddCh(treescrn, 8, 18, (chtype) '\\'); + MvWAddCh(treescrn, 9, 18, (chtype) '\\'); + MvWAddCh(treescrn, 10, 19, (chtype) '\\'); + MvWAddCh(treescrn, 11, 21, (chtype) '\\'); + MvWAddCh(treescrn, 12, 22, (chtype) '\\'); - (w_del_msg = newwin(1, 19, 23, 60)) == 0) { - endwin(); - fprintf(stderr, "Cannot create windows - screen too small\n"); - ExitProgram(EXIT_FAILURE); - } + MvWAddCh(treescrn, 4, 10, (chtype) '_'); + MvWAddCh(treescrn, 4, 14, (chtype) '_'); + MvWAddCh(treescrn, 8, 7, (chtype) '_'); + MvWAddCh(treescrn, 8, 17, (chtype) '_'); - MvWAddStr(w_del_msg, 0, 0, "Hit any key to quit"); + MvWAddStr(treescrn, 13, 0, "//////////// \\\\\\\\\\\\\\\\\\\\\\\\"); - MvWAddStr(w_holiday, 0, 0, "H A P P Y H O L I D A Y S"); + MvWAddStr(treescrn, 14, 11, "| |"); + MvWAddStr(treescrn, 15, 11, "|_|"); - /* set up the windows for our various reindeer */ + unset_color(treescrn); + wrefresh(treescrn); + wrefresh(w_del_msg); - /* lildeer1 */ - MvWAddCh(lildeer1, 0, 0, (chtype) 'V'); - MvWAddCh(lildeer1, 1, 0, (chtype) '@'); - MvWAddCh(lildeer1, 1, 1, (chtype) '<'); - MvWAddCh(lildeer1, 1, 2, (chtype) '>'); - MvWAddCh(lildeer1, 1, 3, (chtype) '~'); + return (0); +} - /* lildeer2 */ - MvWAddCh(lildeer2, 0, 0, (chtype) 'V'); - MvWAddCh(lildeer2, 1, 0, (chtype) '@'); - MvWAddCh(lildeer2, 1, 1, (chtype) '|'); - MvWAddCh(lildeer2, 1, 2, (chtype) '|'); - MvWAddCh(lildeer2, 1, 3, (chtype) '~'); +static int +balls(void) +{ + overlay(treescrn, treescrn2); - /* lildeer3 */ - MvWAddCh(lildeer3, 0, 0, (chtype) 'V'); - MvWAddCh(lildeer3, 1, 0, (chtype) '@'); - MvWAddCh(lildeer3, 1, 1, (chtype) '>'); - MvWAddCh(lildeer3, 1, 2, (chtype) '<'); - MvWAddCh(lildeer2, 1, 3, (chtype) '~'); + set_color(treescrn2, COLOR_BLUE); + MvWAddCh(treescrn2, 3, 9, (chtype) '@'); + MvWAddCh(treescrn2, 3, 15, (chtype) '@'); + MvWAddCh(treescrn2, 4, 8, (chtype) '@'); + MvWAddCh(treescrn2, 4, 16, (chtype) '@'); + MvWAddCh(treescrn2, 5, 7, (chtype) '@'); + MvWAddCh(treescrn2, 5, 17, (chtype) '@'); + MvWAddCh(treescrn2, 7, 6, (chtype) '@'); + MvWAddCh(treescrn2, 7, 18, (chtype) '@'); + MvWAddCh(treescrn2, 8, 5, (chtype) '@'); + MvWAddCh(treescrn2, 8, 19, (chtype) '@'); + MvWAddCh(treescrn2, 10, 4, (chtype) '@'); + MvWAddCh(treescrn2, 10, 20, (chtype) '@'); + MvWAddCh(treescrn2, 11, 2, (chtype) '@'); + MvWAddCh(treescrn2, 11, 22, (chtype) '@'); + MvWAddCh(treescrn2, 12, 1, (chtype) '@'); + MvWAddCh(treescrn2, 12, 23, (chtype) '@'); - /* middeer1 */ - MvWAddCh(middeer1, 0, 2, (chtype) 'y'); - MvWAddCh(middeer1, 0, 3, (chtype) 'y'); - MvWAddCh(middeer1, 1, 2, (chtype) '0'); - MvWAddCh(middeer1, 1, 3, (chtype) '('); - MvWAddCh(middeer1, 1, 4, (chtype) '='); - MvWAddCh(middeer1, 1, 5, (chtype) ')'); - MvWAddCh(middeer1, 1, 6, (chtype) '~'); - MvWAddCh(middeer1, 2, 3, (chtype) '\\'); - MvWAddCh(middeer1, 2, 4, (chtype) '/'); + unset_color(treescrn2); + wrefresh(treescrn2); + wrefresh(w_del_msg); + return (0); +} - /* middeer2 */ - MvWAddCh(middeer2, 0, 2, (chtype) 'y'); - MvWAddCh(middeer2, 0, 3, (chtype) 'y'); - MvWAddCh(middeer2, 1, 2, (chtype) '0'); - MvWAddCh(middeer2, 1, 3, (chtype) '('); - MvWAddCh(middeer2, 1, 4, (chtype) '='); - MvWAddCh(middeer2, 1, 5, (chtype) ')'); - MvWAddCh(middeer2, 1, 6, (chtype) '~'); - MvWAddCh(middeer2, 2, 3, (chtype) '|'); - MvWAddCh(middeer2, 2, 5, (chtype) '|'); +static int +star(void) +{ + (void) wattrset(treescrn2, A_BOLD | A_BLINK); + set_color(treescrn2, COLOR_YELLOW); - /* middeer3 */ - MvWAddCh(middeer3, 0, 2, (chtype) 'y'); - MvWAddCh(middeer3, 0, 3, (chtype) 'y'); - MvWAddCh(middeer3, 1, 2, (chtype) '0'); - MvWAddCh(middeer3, 1, 3, (chtype) '('); - MvWAddCh(middeer3, 1, 4, (chtype) '='); - MvWAddCh(middeer3, 1, 5, (chtype) ')'); - MvWAddCh(middeer3, 1, 6, (chtype) '~'); - MvWAddCh(middeer3, 2, 2, (chtype) '/'); - MvWAddCh(middeer3, 2, 6, (chtype) '\\'); + MvWAddCh(treescrn2, 0, 12, (chtype) '*'); + (void) wstandend(treescrn2); - /* bigdeer1 */ - MvWAddCh(bigdeer1, 0, 17, (chtype) '\\'); - MvWAddCh(bigdeer1, 0, 18, (chtype) '/'); - MvWAddCh(bigdeer1, 0, 20, (chtype) '\\'); - MvWAddCh(bigdeer1, 0, 21, (chtype) '/'); - MvWAddCh(bigdeer1, 1, 18, (chtype) '\\'); - MvWAddCh(bigdeer1, 1, 20, (chtype) '/'); - MvWAddCh(bigdeer1, 2, 19, (chtype) '|'); - MvWAddCh(bigdeer1, 2, 20, (chtype) '_'); - MvWAddCh(bigdeer1, 3, 18, (chtype) '/'); - MvWAddCh(bigdeer1, 3, 19, (chtype) '^'); - MvWAddCh(bigdeer1, 3, 20, (chtype) '0'); - MvWAddCh(bigdeer1, 3, 21, (chtype) '\\'); - MvWAddCh(bigdeer1, 4, 17, (chtype) '/'); - MvWAddCh(bigdeer1, 4, 18, (chtype) '/'); - MvWAddCh(bigdeer1, 4, 19, (chtype) '\\'); - MvWAddCh(bigdeer1, 4, 22, (chtype) '\\'); - MvWAddStr(bigdeer1, 5, 7, "^~~~~~~~~// ~~U"); - MvWAddStr(bigdeer1, 6, 7, "( \\_____( /"); - MvWAddStr(bigdeer1, 7, 8, "( ) /"); - MvWAddStr(bigdeer1, 8, 9, "\\\\ /"); - MvWAddStr(bigdeer1, 9, 11, "\\>/>"); + unset_color(treescrn2); + wrefresh(treescrn2); + wrefresh(w_del_msg); + return (0); +} - /* bigdeer2 */ - MvWAddCh(bigdeer2, 0, 17, (chtype) '\\'); - MvWAddCh(bigdeer2, 0, 18, (chtype) '/'); - MvWAddCh(bigdeer2, 0, 20, (chtype) '\\'); - MvWAddCh(bigdeer2, 0, 21, (chtype) '/'); - MvWAddCh(bigdeer2, 1, 18, (chtype) '\\'); - MvWAddCh(bigdeer2, 1, 20, (chtype) '/'); - MvWAddCh(bigdeer2, 2, 19, (chtype) '|'); - MvWAddCh(bigdeer2, 2, 20, (chtype) '_'); - MvWAddCh(bigdeer2, 3, 18, (chtype) '/'); - MvWAddCh(bigdeer2, 3, 19, (chtype) '^'); - MvWAddCh(bigdeer2, 3, 20, (chtype) '0'); - MvWAddCh(bigdeer2, 3, 21, (chtype) '\\'); - MvWAddCh(bigdeer2, 4, 17, (chtype) '/'); - MvWAddCh(bigdeer2, 4, 18, (chtype) '/'); - MvWAddCh(bigdeer2, 4, 19, (chtype) '\\'); - MvWAddCh(bigdeer2, 4, 22, (chtype) '\\'); - MvWAddStr(bigdeer2, 5, 7, "^~~~~~~~~// ~~U"); - MvWAddStr(bigdeer2, 6, 7, "(( )____( /"); - MvWAddStr(bigdeer2, 7, 7, "( / |"); - MvWAddStr(bigdeer2, 8, 8, "\\/ |"); - MvWAddStr(bigdeer2, 9, 9, "|> |>"); +static int +strng1(void) +{ + (void) wattrset(treescrn2, A_BOLD | A_BLINK); + set_color(treescrn2, COLOR_WHITE); - /* bigdeer3 */ - MvWAddCh(bigdeer3, 0, 17, (chtype) '\\'); - MvWAddCh(bigdeer3, 0, 18, (chtype) '/'); - MvWAddCh(bigdeer3, 0, 20, (chtype) '\\'); - MvWAddCh(bigdeer3, 0, 21, (chtype) '/'); - MvWAddCh(bigdeer3, 1, 18, (chtype) '\\'); - MvWAddCh(bigdeer3, 1, 20, (chtype) '/'); - MvWAddCh(bigdeer3, 2, 19, (chtype) '|'); - MvWAddCh(bigdeer3, 2, 20, (chtype) '_'); - MvWAddCh(bigdeer3, 3, 18, (chtype) '/'); - MvWAddCh(bigdeer3, 3, 19, (chtype) '^'); - MvWAddCh(bigdeer3, 3, 20, (chtype) '0'); - MvWAddCh(bigdeer3, 3, 21, (chtype) '\\'); - MvWAddCh(bigdeer3, 4, 17, (chtype) '/'); - MvWAddCh(bigdeer3, 4, 18, (chtype) '/'); - MvWAddCh(bigdeer3, 4, 19, (chtype) '\\'); - MvWAddCh(bigdeer3, 4, 22, (chtype) '\\'); - MvWAddStr(bigdeer3, 5, 7, "^~~~~~~~~// ~~U"); - MvWAddStr(bigdeer3, 6, 6, "( ()_____( /"); - MvWAddStr(bigdeer3, 7, 6, "/ / /"); - MvWAddStr(bigdeer3, 8, 5, "|/ \\"); - MvWAddStr(bigdeer3, 9, 5, "/> \\>"); + MvWAddCh(treescrn2, 3, 13, (chtype) '\''); + MvWAddCh(treescrn2, 3, 12, (chtype) ':'); + MvWAddCh(treescrn2, 3, 11, (chtype) '.'); - /* bigdeer4 */ - MvWAddCh(bigdeer4, 0, 17, (chtype) '\\'); - MvWAddCh(bigdeer4, 0, 18, (chtype) '/'); - MvWAddCh(bigdeer4, 0, 20, (chtype) '\\'); - MvWAddCh(bigdeer4, 0, 21, (chtype) '/'); - MvWAddCh(bigdeer4, 1, 18, (chtype) '\\'); - MvWAddCh(bigdeer4, 1, 20, (chtype) '/'); - MvWAddCh(bigdeer4, 2, 19, (chtype) '|'); - MvWAddCh(bigdeer4, 2, 20, (chtype) '_'); - MvWAddCh(bigdeer4, 3, 18, (chtype) '/'); - MvWAddCh(bigdeer4, 3, 19, (chtype) '^'); - MvWAddCh(bigdeer4, 3, 20, (chtype) '0'); - MvWAddCh(bigdeer4, 3, 21, (chtype) '\\'); - MvWAddCh(bigdeer4, 4, 17, (chtype) '/'); - MvWAddCh(bigdeer4, 4, 18, (chtype) '/'); - MvWAddCh(bigdeer4, 4, 19, (chtype) '\\'); - MvWAddCh(bigdeer4, 4, 22, (chtype) '\\'); - MvWAddStr(bigdeer4, 5, 7, "^~~~~~~~~// ~~U"); - MvWAddStr(bigdeer4, 6, 6, "( )______( /"); - MvWAddStr(bigdeer4, 7, 5, "(/ \\"); - MvWAddStr(bigdeer4, 8, 0, "v___= ----^"); + wattroff(treescrn2, A_BOLD | A_BLINK); + unset_color(treescrn2); - /* lookdeer1 */ - MvWAddStr(lookdeer1, 0, 16, "\\/ \\/"); - MvWAddStr(lookdeer1, 1, 17, "\\Y/ \\Y/"); - MvWAddStr(lookdeer1, 2, 19, "\\=/"); - MvWAddStr(lookdeer1, 3, 17, "^\\o o/^"); - MvWAddStr(lookdeer1, 4, 17, "//( )"); - MvWAddStr(lookdeer1, 5, 7, "^~~~~~~~~// \\O/"); - MvWAddStr(lookdeer1, 6, 7, "( \\_____( /"); - MvWAddStr(lookdeer1, 7, 8, "( ) /"); - MvWAddStr(lookdeer1, 8, 9, "\\\\ /"); - MvWAddStr(lookdeer1, 9, 11, "\\>/>"); + wrefresh(treescrn2); + wrefresh(w_del_msg); + return (0); +} - /* lookdeer2 */ - MvWAddStr(lookdeer2, 0, 16, "\\/ \\/"); - MvWAddStr(lookdeer2, 1, 17, "\\Y/ \\Y/"); - MvWAddStr(lookdeer2, 2, 19, "\\=/"); - MvWAddStr(lookdeer2, 3, 17, "^\\o o/^"); - MvWAddStr(lookdeer2, 4, 17, "//( )"); - MvWAddStr(lookdeer2, 5, 7, "^~~~~~~~~// \\O/"); - MvWAddStr(lookdeer2, 6, 7, "(( )____( /"); - MvWAddStr(lookdeer2, 7, 7, "( / |"); - MvWAddStr(lookdeer2, 8, 8, "\\/ |"); - MvWAddStr(lookdeer2, 9, 9, "|> |>"); +static int +strng2(void) +{ + (void) wattrset(treescrn2, A_BOLD | A_BLINK); + set_color(treescrn2, COLOR_WHITE); - /* lookdeer3 */ - MvWAddStr(lookdeer3, 0, 16, "\\/ \\/"); - MvWAddStr(lookdeer3, 1, 17, "\\Y/ \\Y/"); - MvWAddStr(lookdeer3, 2, 19, "\\=/"); - MvWAddStr(lookdeer3, 3, 17, "^\\o o/^"); - MvWAddStr(lookdeer3, 4, 17, "//( )"); - MvWAddStr(lookdeer3, 5, 7, "^~~~~~~~~// \\O/"); - MvWAddStr(lookdeer3, 6, 6, "( ()_____( /"); - MvWAddStr(lookdeer3, 7, 6, "/ / /"); - MvWAddStr(lookdeer3, 8, 5, "|/ \\"); - MvWAddStr(lookdeer3, 9, 5, "/> \\>"); + MvWAddCh(treescrn2, 5, 14, (chtype) '\''); + MvWAddCh(treescrn2, 5, 13, (chtype) ':'); + MvWAddCh(treescrn2, 5, 12, (chtype) '.'); + MvWAddCh(treescrn2, 5, 11, (chtype) ','); + MvWAddCh(treescrn2, 6, 10, (chtype) '\''); + MvWAddCh(treescrn2, 6, 9, (chtype) ':'); - /* lookdeer4 */ - MvWAddStr(lookdeer4, 0, 16, "\\/ \\/"); - MvWAddStr(lookdeer4, 1, 17, "\\Y/ \\Y/"); - MvWAddStr(lookdeer4, 2, 19, "\\=/"); - MvWAddStr(lookdeer4, 3, 17, "^\\o o/^"); - MvWAddStr(lookdeer4, 4, 17, "//( )"); - MvWAddStr(lookdeer4, 5, 7, "^~~~~~~~~// \\O/"); - MvWAddStr(lookdeer4, 6, 6, "( )______( /"); - MvWAddStr(lookdeer4, 7, 5, "(/ \\"); - MvWAddStr(lookdeer4, 8, 0, "v___= ----^"); + wattroff(treescrn2, A_BOLD | A_BLINK); + unset_color(treescrn2); - /***********************************************/ - cbreak(); - nodelay(stdscr, TRUE); - for (;;) { - clear(); - werase(treescrn); - touchwin(w_del_msg); - touchwin(treescrn); - werase(treescrn2); - touchwin(treescrn2); - werase(treescrn8); - touchwin(treescrn8); - refresh(); - look_out(150); - boxit(); - refresh(); - look_out(150); - seas(); - refresh(); - look_out(150); - greet(); - refresh(); - look_out(150); - fromwho(); - refresh(); - look_out(150); - tree(); - look_out(150); - balls(); - look_out(150); - star(); - look_out(150); - strng1(); - strng2(); - strng3(); - strng4(); - strng5(); + wrefresh(treescrn2); + wrefresh(w_del_msg); + return (0); +} - /* set up the windows for our blinking trees */ - /* **************************************** */ - /* treescrn3 */ +static int +strng3(void) +{ + (void) wattrset(treescrn2, A_BOLD | A_BLINK); + set_color(treescrn2, COLOR_WHITE); - overlay(treescrn, treescrn3); + MvWAddCh(treescrn2, 7, 16, (chtype) '\''); + MvWAddCh(treescrn2, 7, 15, (chtype) ':'); + MvWAddCh(treescrn2, 7, 14, (chtype) '.'); + MvWAddCh(treescrn2, 7, 13, (chtype) ','); + MvWAddCh(treescrn2, 8, 12, (chtype) '\''); + MvWAddCh(treescrn2, 8, 11, (chtype) ':'); + MvWAddCh(treescrn2, 8, 10, (chtype) '.'); + MvWAddCh(treescrn2, 8, 9, (chtype) ','); - /*balls */ - MvWAddCh(treescrn3, 4, 18, ' '); - MvWAddCh(treescrn3, 7, 6, ' '); - MvWAddCh(treescrn3, 8, 19, ' '); - MvWAddCh(treescrn3, 11, 22, ' '); + wattroff(treescrn2, A_BOLD | A_BLINK); + unset_color(treescrn2); - /*star */ - MvWAddCh(treescrn3, 0, 12, '*'); + wrefresh(treescrn2); + wrefresh(w_del_msg); + return (0); +} - /*strng1 */ - MvWAddCh(treescrn3, 3, 11, ' '); +static int +strng4(void) +{ + (void) wattrset(treescrn2, A_BOLD | A_BLINK); + set_color(treescrn2, COLOR_WHITE); - /*strng2 */ - MvWAddCh(treescrn3, 5, 13, ' '); - MvWAddCh(treescrn3, 6, 10, ' '); + MvWAddCh(treescrn2, 9, 17, (chtype) '\''); + MvWAddCh(treescrn2, 9, 16, (chtype) ':'); + MvWAddCh(treescrn2, 9, 15, (chtype) '.'); + MvWAddCh(treescrn2, 9, 14, (chtype) ','); + MvWAddCh(treescrn2, 10, 13, (chtype) '\''); + MvWAddCh(treescrn2, 10, 12, (chtype) ':'); + MvWAddCh(treescrn2, 10, 11, (chtype) '.'); + MvWAddCh(treescrn2, 10, 10, (chtype) ','); + MvWAddCh(treescrn2, 11, 9, (chtype) '\''); + MvWAddCh(treescrn2, 11, 8, (chtype) ':'); + MvWAddCh(treescrn2, 11, 7, (chtype) '.'); + MvWAddCh(treescrn2, 11, 6, (chtype) ','); + MvWAddCh(treescrn2, 12, 5, (chtype) '\''); - /*strng3 */ - MvWAddCh(treescrn3, 7, 16, ' '); - MvWAddCh(treescrn3, 7, 14, ' '); + wattroff(treescrn2, A_BOLD | A_BLINK); + unset_color(treescrn2); - /*strng4 */ - MvWAddCh(treescrn3, 10, 13, ' '); - MvWAddCh(treescrn3, 10, 10, ' '); - MvWAddCh(treescrn3, 11, 8, ' '); + wrefresh(treescrn2); + wrefresh(w_del_msg); + return (0); +} - /*strng5 */ - MvWAddCh(treescrn3, 11, 18, ' '); - MvWAddCh(treescrn3, 12, 13, ' '); +static int +strng5(void) +{ + (void) wattrset(treescrn2, A_BOLD | A_BLINK); + set_color(treescrn2, COLOR_WHITE); - /* treescrn4 */ + MvWAddCh(treescrn2, 11, 19, (chtype) '\''); + MvWAddCh(treescrn2, 11, 18, (chtype) ':'); + MvWAddCh(treescrn2, 11, 17, (chtype) '.'); + MvWAddCh(treescrn2, 11, 16, (chtype) ','); + MvWAddCh(treescrn2, 12, 15, (chtype) '\''); + MvWAddCh(treescrn2, 12, 14, (chtype) ':'); + MvWAddCh(treescrn2, 12, 13, (chtype) '.'); + MvWAddCh(treescrn2, 12, 12, (chtype) ','); - overlay(treescrn, treescrn4); + wattroff(treescrn2, A_BOLD | A_BLINK); + unset_color(treescrn2); - /*balls */ - MvWAddCh(treescrn4, 3, 9, ' '); - MvWAddCh(treescrn4, 4, 16, ' '); - MvWAddCh(treescrn4, 7, 6, ' '); - MvWAddCh(treescrn4, 8, 19, ' '); - MvWAddCh(treescrn4, 11, 2, ' '); - MvWAddCh(treescrn4, 12, 23, ' '); + /* save a fully lit tree */ + overlay(treescrn2, treescrn); - /*star */ - (void) wstandout(treescrn4); - MvWAddCh(treescrn4, 0, 12, '*'); - (void) wstandend(treescrn4); + wrefresh(treescrn2); + wrefresh(w_del_msg); + return (0); +} - /*strng1 */ - MvWAddCh(treescrn4, 3, 13, ' '); +static int +blinkit(void) +{ + static int cycle; - /*strng2 */ + if (cycle > 4) { + cycle = 0; + } - /*strng3 */ - MvWAddCh(treescrn4, 7, 15, ' '); - MvWAddCh(treescrn4, 8, 11, ' '); + touchwin(treescrn8); - /*strng4 */ - MvWAddCh(treescrn4, 9, 16, ' '); - MvWAddCh(treescrn4, 10, 12, ' '); - MvWAddCh(treescrn4, 11, 8, ' '); + switch (cycle) { + case 0: + overlay(treescrn3, treescrn8); + break; + case 1: + overlay(treescrn4, treescrn8); + break; + case 2: + overlay(treescrn5, treescrn8); + break; + case 3: + overlay(treescrn6, treescrn8); + break; + case 4: + overlay(treescrn7, treescrn8); + break; + } + touchwin(treescrn8); + wrefresh(treescrn8); + wrefresh(w_del_msg); + look_out(50); - /*strng5 */ - MvWAddCh(treescrn4, 11, 18, ' '); - MvWAddCh(treescrn4, 12, 14, ' '); + /*ALL ON************************************************** */ - /* treescrn5 */ + overlay(treescrn, treescrn8); + wrefresh(treescrn8); + wrefresh(w_del_msg); + look_out(50); - overlay(treescrn, treescrn5); + ++cycle; + return (0); +} - /*balls */ - MvWAddCh(treescrn5, 3, 15, ' '); - MvWAddCh(treescrn5, 10, 20, ' '); - MvWAddCh(treescrn5, 12, 1, ' '); +static void +deer_step(WINDOW *win, int y, int x) +{ + mvwin(win, y, x); + wrefresh(win); + wrefresh(w_del_msg); + look_out(5); +} - /*star */ - MvWAddCh(treescrn5, 0, 12, '*'); +static int +reindeer(void) +{ + int looper; + y_pos = 0; - /*strng1 */ - MvWAddCh(treescrn5, 3, 11, ' '); + for (x_pos = 70; x_pos > 62; x_pos--) { + if (x_pos < 62) { + y_pos = 1; + } + for (looper = 0; looper < 4; looper++) { + MvWAddCh(dotdeer0, y_pos, x_pos, (chtype) '.'); + wrefresh(dotdeer0); + wrefresh(w_del_msg); + werase(dotdeer0); + wrefresh(dotdeer0); + wrefresh(w_del_msg); + look_out(50); + } + } - /*strng2 */ - MvWAddCh(treescrn5, 5, 12, ' '); + y_pos = 2; - /*strng3 */ - MvWAddCh(treescrn5, 7, 14, ' '); - MvWAddCh(treescrn5, 8, 10, ' '); + for (; x_pos > 50; x_pos--) { + for (looper = 0; looper < 4; looper++) { - /*strng4 */ - MvWAddCh(treescrn5, 9, 15, ' '); - MvWAddCh(treescrn5, 10, 11, ' '); - MvWAddCh(treescrn5, 11, 7, ' '); + if (x_pos < 56) { + y_pos = 3; - /*strng5 */ - MvWAddCh(treescrn5, 11, 17, ' '); - MvWAddCh(treescrn5, 12, 13, ' '); + MvWAddCh(stardeer0, y_pos, x_pos, (chtype) '*'); + wrefresh(stardeer0); + wrefresh(w_del_msg); + werase(stardeer0); + wrefresh(stardeer0); + wrefresh(w_del_msg); + } else { + MvWAddCh(dotdeer0, y_pos, x_pos, (chtype) '*'); + wrefresh(dotdeer0); + wrefresh(w_del_msg); + werase(dotdeer0); + wrefresh(dotdeer0); + wrefresh(w_del_msg); + } + } + } - /* treescrn6 */ + x_pos = 58; - overlay(treescrn, treescrn6); + for (y_pos = 2; y_pos < 5; y_pos++) { - /*balls */ - MvWAddCh(treescrn6, 6, 7, ' '); - MvWAddCh(treescrn6, 7, 18, ' '); - MvWAddCh(treescrn6, 10, 4, ' '); - MvWAddCh(treescrn6, 11, 23, ' '); + touchwin(lildeer0); + wrefresh(lildeer0); + wrefresh(w_del_msg); - /*star */ - (void) wstandout(treescrn6); - MvWAddCh(treescrn6, 0, 12, '*'); - (void) wstandend(treescrn6); + for (looper = 0; looper < 4; looper++) { + deer_step(lildeer3, y_pos, x_pos); + deer_step(lildeer2, y_pos, x_pos); + deer_step(lildeer1, y_pos, x_pos); + deer_step(lildeer2, y_pos, x_pos); + deer_step(lildeer3, y_pos, x_pos); - /*strng1 */ + touchwin(lildeer0); + wrefresh(lildeer0); + wrefresh(w_del_msg); - /*strng2 */ - MvWAddCh(treescrn6, 5, 11, ' '); + x_pos -= 2; + } + } - /*strng3 */ - MvWAddCh(treescrn6, 7, 13, ' '); - MvWAddCh(treescrn6, 8, 9, ' '); + x_pos = 35; - /*strng4 */ - MvWAddCh(treescrn6, 9, 14, ' '); - MvWAddCh(treescrn6, 10, 10, ' '); - MvWAddCh(treescrn6, 11, 6, ' '); + for (y_pos = 5; y_pos < 10; y_pos++) { - /*strng5 */ - MvWAddCh(treescrn6, 11, 16, ' '); - MvWAddCh(treescrn6, 12, 12, ' '); + touchwin(middeer0); + wrefresh(middeer0); + wrefresh(w_del_msg); - /* treescrn7 */ + for (looper = 0; looper < 2; looper++) { + deer_step(middeer3, y_pos, x_pos); + deer_step(middeer2, y_pos, x_pos); + deer_step(middeer1, y_pos, x_pos); + deer_step(middeer2, y_pos, x_pos); + deer_step(middeer3, y_pos, x_pos); - overlay(treescrn, treescrn7); + touchwin(middeer0); + wrefresh(middeer0); + wrefresh(w_del_msg); - /*balls */ - MvWAddCh(treescrn7, 3, 15, ' '); - MvWAddCh(treescrn7, 6, 7, ' '); - MvWAddCh(treescrn7, 7, 18, ' '); - MvWAddCh(treescrn7, 10, 4, ' '); - MvWAddCh(treescrn7, 11, 22, ' '); + x_pos -= 3; + } + } - /*star */ - MvWAddCh(treescrn7, 0, 12, '*'); + look_out(300); - /*strng1 */ - MvWAddCh(treescrn7, 3, 12, ' '); + y_pos = 1; - /*strng2 */ - MvWAddCh(treescrn7, 5, 13, ' '); - MvWAddCh(treescrn7, 6, 9, ' '); + for (x_pos = 8; x_pos < 16; x_pos++) { + deer_step(bigdeer4, y_pos, x_pos); + deer_step(bigdeer3, y_pos, x_pos); + deer_step(bigdeer2, y_pos, x_pos); + deer_step(bigdeer1, y_pos, x_pos); + deer_step(bigdeer2, y_pos, x_pos); + deer_step(bigdeer3, y_pos, x_pos); + deer_step(bigdeer4, y_pos, x_pos); + deer_step(bigdeer0, y_pos, x_pos); + } - /*strng3 */ - MvWAddCh(treescrn7, 7, 15, ' '); - MvWAddCh(treescrn7, 8, 11, ' '); + --x_pos; - /*strng4 */ - MvWAddCh(treescrn7, 9, 16, ' '); - MvWAddCh(treescrn7, 10, 12, ' '); - MvWAddCh(treescrn7, 11, 8, ' '); + for (looper = 0; looper < 6; looper++) { + deer_step(lookdeer4, y_pos, x_pos); + deer_step(lookdeer3, y_pos, x_pos); + deer_step(lookdeer2, y_pos, x_pos); + deer_step(lookdeer1, y_pos, x_pos); + deer_step(lookdeer2, y_pos, x_pos); + deer_step(lookdeer3, y_pos, x_pos); + deer_step(lookdeer4, y_pos, x_pos); + } - /*strng5 */ - MvWAddCh(treescrn7, 11, 18, ' '); - MvWAddCh(treescrn7, 12, 14, ' '); + deer_step(lookdeer0, y_pos, x_pos); - look_out(150); - reindeer(); + for (; y_pos < 10; y_pos++) { + for (looper = 0; looper < 2; looper++) { + deer_step(bigdeer4, y_pos, x_pos); + deer_step(bigdeer3, y_pos, x_pos); + deer_step(bigdeer2, y_pos, x_pos); + deer_step(bigdeer1, y_pos, x_pos); + deer_step(bigdeer2, y_pos, x_pos); + deer_step(bigdeer3, y_pos, x_pos); + deer_step(bigdeer4, y_pos, x_pos); + } + deer_step(bigdeer0, y_pos, x_pos); + } - touchwin(w_holiday); - wrefresh(w_holiday); - wrefresh(w_del_msg); - - look_out(500); - for (loopy = 0; loopy < 100; loopy++) { - blinkit(); - } - -#ifdef NOLOOP - done(0); -#endif - } - /*NOTREACHED */ -} - -static int -boxit(void) -{ - int x = 0; - - while (x < 20) { - MvAddCh(x, 7, '|'); - ++x; - } - - x = 8; - - while (x < 80) { - MvAddCh(19, x, '_'); - ++x; - } - - x = 0; - - while (x < 80) { - MvAddCh(22, x, '_'); - ++x; - } + --y_pos; + deer_step(lookdeer3, y_pos, x_pos); return (0); } -static int -seas(void) +static void +done(int sig GCC_UNUSED) { - MvAddCh(4, 1, 'S'); - MvAddCh(6, 1, 'E'); - MvAddCh(8, 1, 'A'); - MvAddCh(10, 1, 'S'); - MvAddCh(12, 1, 'O'); - MvAddCh(14, 1, 'N'); - MvAddCh(16, 1, '`'); - MvAddCh(18, 1, 'S'); + move(LINES - 1, 0); + refresh(); + stop_curses(); - return (0); +#if NO_LEAKS + if (my_pairs != 0) + free(my_pairs); +#endif + + ExitProgram(EXIT_SUCCESS); } -static int -greet(void) +static void +usage(void) { - MvAddCh(3, 5, 'G'); - MvAddCh(5, 5, 'R'); - MvAddCh(7, 5, 'E'); - MvAddCh(9, 5, 'E'); - MvAddCh(11, 5, 'T'); - MvAddCh(13, 5, 'I'); - MvAddCh(15, 5, 'N'); - MvAddCh(17, 5, 'G'); - MvAddCh(19, 5, 'S'); + static const char *msg[] = + { + "Usage: xmas [options]" + ,"" + ,"Options:" +#if HAVE_USE_DEFAULT_COLORS + ," -d invoke use_default_colors" +#endif + ," -q execute once, then quit" + }; + size_t n; - return (0); -} + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); -static int -fromwho(void) -{ - MvAddStr(21, 13, FROMWHO); - return (0); + ExitProgram(EXIT_FAILURE); } -static int -tree(void) +int +main(int argc, char *argv[]) { - set_color(treescrn, COLOR_GREEN); - MvWAddCh(treescrn, 1, 11, (chtype) '/'); - MvWAddCh(treescrn, 2, 11, (chtype) '/'); - MvWAddCh(treescrn, 3, 10, (chtype) '/'); - MvWAddCh(treescrn, 4, 9, (chtype) '/'); - MvWAddCh(treescrn, 5, 9, (chtype) '/'); - MvWAddCh(treescrn, 6, 8, (chtype) '/'); - MvWAddCh(treescrn, 7, 7, (chtype) '/'); - MvWAddCh(treescrn, 8, 6, (chtype) '/'); - MvWAddCh(treescrn, 9, 6, (chtype) '/'); - MvWAddCh(treescrn, 10, 5, (chtype) '/'); - MvWAddCh(treescrn, 11, 3, (chtype) '/'); - MvWAddCh(treescrn, 12, 2, (chtype) '/'); + int ch; + int loopy; +#if HAVE_USE_DEFAULT_COLORS + bool opt_d = FALSE; +#endif + bool opt_q = FALSE; - MvWAddCh(treescrn, 1, 13, (chtype) '\\'); - MvWAddCh(treescrn, 2, 13, (chtype) '\\'); - MvWAddCh(treescrn, 3, 14, (chtype) '\\'); - MvWAddCh(treescrn, 4, 15, (chtype) '\\'); - MvWAddCh(treescrn, 5, 15, (chtype) '\\'); - MvWAddCh(treescrn, 6, 16, (chtype) '\\'); - MvWAddCh(treescrn, 7, 17, (chtype) '\\'); - MvWAddCh(treescrn, 8, 18, (chtype) '\\'); - MvWAddCh(treescrn, 9, 18, (chtype) '\\'); - MvWAddCh(treescrn, 10, 19, (chtype) '\\'); - MvWAddCh(treescrn, 11, 21, (chtype) '\\'); - MvWAddCh(treescrn, 12, 22, (chtype) '\\'); + while ((ch = getopt(argc, argv, "dq")) != -1) { + switch (ch) { +#if HAVE_USE_DEFAULT_COLORS + case 'd': + opt_d = TRUE; + break; +#endif + case 'q': + opt_q = TRUE; + break; + default: + usage(); + /* NOTREACHED */ + } + } - MvWAddCh(treescrn, 4, 10, (chtype) '_'); - MvWAddCh(treescrn, 4, 14, (chtype) '_'); - MvWAddCh(treescrn, 8, 7, (chtype) '_'); - MvWAddCh(treescrn, 8, 17, (chtype) '_'); + setlocale(LC_ALL, ""); - MvWAddStr(treescrn, 13, 0, "//////////// \\\\\\\\\\\\\\\\\\\\\\\\"); + InitAndCatch(initscr(), done); + noecho(); + nonl(); + refresh(); - MvWAddStr(treescrn, 14, 11, "| |"); - MvWAddStr(treescrn, 15, 11, "|_|"); + if (has_colors()) { + start_color(); +#if HAVE_USE_DEFAULT_COLORS + if (opt_d && (use_default_colors() == OK)) + my_bg = -1; +#endif + } + curs_set(0); - unset_color(treescrn); - wrefresh(treescrn); - wrefresh(w_del_msg); + if ((treescrn = newwin(16, 27, 3, 53)) == 0 || + (treescrn2 = newwin(16, 27, 3, 53)) == 0 || + (treescrn3 = newwin(16, 27, 3, 53)) == 0 || + (treescrn4 = newwin(16, 27, 3, 53)) == 0 || + (treescrn5 = newwin(16, 27, 3, 53)) == 0 || + (treescrn6 = newwin(16, 27, 3, 53)) == 0 || + (treescrn7 = newwin(16, 27, 3, 53)) == 0 || + (treescrn8 = newwin(16, 27, 3, 53)) == 0 || - return (0); -} + (dotdeer0 = newwin(3, 71, 0, 8)) == 0 || -static int -balls(void) -{ - overlay(treescrn, treescrn2); + (stardeer0 = newwin(4, 56, 0, 8)) == 0 || - set_color(treescrn2, COLOR_BLUE); - MvWAddCh(treescrn2, 3, 9, (chtype) '@'); - MvWAddCh(treescrn2, 3, 15, (chtype) '@'); - MvWAddCh(treescrn2, 4, 8, (chtype) '@'); - MvWAddCh(treescrn2, 4, 16, (chtype) '@'); - MvWAddCh(treescrn2, 5, 7, (chtype) '@'); - MvWAddCh(treescrn2, 5, 17, (chtype) '@'); - MvWAddCh(treescrn2, 7, 6, (chtype) '@'); - MvWAddCh(treescrn2, 7, 18, (chtype) '@'); - MvWAddCh(treescrn2, 8, 5, (chtype) '@'); - MvWAddCh(treescrn2, 8, 19, (chtype) '@'); - MvWAddCh(treescrn2, 10, 4, (chtype) '@'); - MvWAddCh(treescrn2, 10, 20, (chtype) '@'); - MvWAddCh(treescrn2, 11, 2, (chtype) '@'); - MvWAddCh(treescrn2, 11, 22, (chtype) '@'); - MvWAddCh(treescrn2, 12, 1, (chtype) '@'); - MvWAddCh(treescrn2, 12, 23, (chtype) '@'); + (lildeer0 = newwin(7, 53, 0, 8)) == 0 || + (lildeer1 = newwin(2, 4, 0, 0)) == 0 || + (lildeer2 = newwin(2, 4, 0, 0)) == 0 || + (lildeer3 = newwin(2, 4, 0, 0)) == 0 || - unset_color(treescrn2); - wrefresh(treescrn2); - wrefresh(w_del_msg); - return (0); -} + (middeer0 = newwin(15, 42, 0, 8)) == 0 || + (middeer1 = newwin(3, 7, 0, 0)) == 0 || + (middeer2 = newwin(3, 7, 0, 0)) == 0 || + (middeer3 = newwin(3, 7, 0, 0)) == 0 || -static int -star(void) -{ - (void) wattrset(treescrn2, A_BOLD | A_BLINK); - set_color(treescrn2, COLOR_YELLOW); + (bigdeer0 = newwin(10, 23, 0, 0)) == 0 || + (bigdeer1 = newwin(10, 23, 0, 0)) == 0 || + (bigdeer2 = newwin(10, 23, 0, 0)) == 0 || + (bigdeer3 = newwin(10, 23, 0, 0)) == 0 || + (bigdeer4 = newwin(10, 23, 0, 0)) == 0 || - MvWAddCh(treescrn2, 0, 12, (chtype) '*'); - (void) wstandend(treescrn2); + (lookdeer0 = newwin(10, 25, 0, 0)) == 0 || + (lookdeer1 = newwin(10, 25, 0, 0)) == 0 || + (lookdeer2 = newwin(10, 25, 0, 0)) == 0 || + (lookdeer3 = newwin(10, 25, 0, 0)) == 0 || + (lookdeer4 = newwin(10, 25, 0, 0)) == 0 || - unset_color(treescrn2); - wrefresh(treescrn2); - wrefresh(w_del_msg); - return (0); -} + (w_holiday = newwin(1, 26, 3, 27)) == 0 || -static int -strng1(void) -{ - (void) wattrset(treescrn2, A_BOLD | A_BLINK); - set_color(treescrn2, COLOR_WHITE); + (w_del_msg = newwin(1, 19, 23, 60)) == 0) { + stop_curses(); + fprintf(stderr, "Cannot create windows - screen too small\n"); + ExitProgram(EXIT_FAILURE); + } - MvWAddCh(treescrn2, 3, 13, (chtype) '\''); - MvWAddCh(treescrn2, 3, 12, (chtype) ':'); - MvWAddCh(treescrn2, 3, 11, (chtype) '.'); + MvWAddStr(w_del_msg, 0, 0, "Hit any key to quit"); - wattroff(treescrn2, A_BOLD | A_BLINK); - unset_color(treescrn2); + MvWAddStr(w_holiday, 0, 0, "H A P P Y H O L I D A Y S"); - wrefresh(treescrn2); - wrefresh(w_del_msg); - return (0); -} + /* set up the windows for our various reindeer */ -static int -strng2(void) -{ - (void) wattrset(treescrn2, A_BOLD | A_BLINK); - set_color(treescrn2, COLOR_WHITE); + /* lildeer1 */ + MvWAddCh(lildeer1, 0, 0, (chtype) 'V'); + MvWAddCh(lildeer1, 1, 0, (chtype) '@'); + MvWAddCh(lildeer1, 1, 1, (chtype) '<'); + MvWAddCh(lildeer1, 1, 2, (chtype) '>'); + MvWAddCh(lildeer1, 1, 3, (chtype) '~'); - MvWAddCh(treescrn2, 5, 14, (chtype) '\''); - MvWAddCh(treescrn2, 5, 13, (chtype) ':'); - MvWAddCh(treescrn2, 5, 12, (chtype) '.'); - MvWAddCh(treescrn2, 5, 11, (chtype) ','); - MvWAddCh(treescrn2, 6, 10, (chtype) '\''); - MvWAddCh(treescrn2, 6, 9, (chtype) ':'); + /* lildeer2 */ + MvWAddCh(lildeer2, 0, 0, (chtype) 'V'); + MvWAddCh(lildeer2, 1, 0, (chtype) '@'); + MvWAddCh(lildeer2, 1, 1, (chtype) '|'); + MvWAddCh(lildeer2, 1, 2, (chtype) '|'); + MvWAddCh(lildeer2, 1, 3, (chtype) '~'); - wattroff(treescrn2, A_BOLD | A_BLINK); - unset_color(treescrn2); + /* lildeer3 */ + MvWAddCh(lildeer3, 0, 0, (chtype) 'V'); + MvWAddCh(lildeer3, 1, 0, (chtype) '@'); + MvWAddCh(lildeer3, 1, 1, (chtype) '>'); + MvWAddCh(lildeer3, 1, 2, (chtype) '<'); + MvWAddCh(lildeer2, 1, 3, (chtype) '~'); - wrefresh(treescrn2); - wrefresh(w_del_msg); - return (0); -} + /* middeer1 */ + MvWAddCh(middeer1, 0, 2, (chtype) 'y'); + MvWAddCh(middeer1, 0, 3, (chtype) 'y'); + MvWAddCh(middeer1, 1, 2, (chtype) '0'); + MvWAddCh(middeer1, 1, 3, (chtype) '('); + MvWAddCh(middeer1, 1, 4, (chtype) '='); + MvWAddCh(middeer1, 1, 5, (chtype) ')'); + MvWAddCh(middeer1, 1, 6, (chtype) '~'); + MvWAddCh(middeer1, 2, 3, (chtype) '\\'); + MvWAddCh(middeer1, 2, 4, (chtype) '/'); -static int -strng3(void) -{ - (void) wattrset(treescrn2, A_BOLD | A_BLINK); - set_color(treescrn2, COLOR_WHITE); + /* middeer2 */ + MvWAddCh(middeer2, 0, 2, (chtype) 'y'); + MvWAddCh(middeer2, 0, 3, (chtype) 'y'); + MvWAddCh(middeer2, 1, 2, (chtype) '0'); + MvWAddCh(middeer2, 1, 3, (chtype) '('); + MvWAddCh(middeer2, 1, 4, (chtype) '='); + MvWAddCh(middeer2, 1, 5, (chtype) ')'); + MvWAddCh(middeer2, 1, 6, (chtype) '~'); + MvWAddCh(middeer2, 2, 3, (chtype) '|'); + MvWAddCh(middeer2, 2, 5, (chtype) '|'); - MvWAddCh(treescrn2, 7, 16, (chtype) '\''); - MvWAddCh(treescrn2, 7, 15, (chtype) ':'); - MvWAddCh(treescrn2, 7, 14, (chtype) '.'); - MvWAddCh(treescrn2, 7, 13, (chtype) ','); - MvWAddCh(treescrn2, 8, 12, (chtype) '\''); - MvWAddCh(treescrn2, 8, 11, (chtype) ':'); - MvWAddCh(treescrn2, 8, 10, (chtype) '.'); - MvWAddCh(treescrn2, 8, 9, (chtype) ','); + /* middeer3 */ + MvWAddCh(middeer3, 0, 2, (chtype) 'y'); + MvWAddCh(middeer3, 0, 3, (chtype) 'y'); + MvWAddCh(middeer3, 1, 2, (chtype) '0'); + MvWAddCh(middeer3, 1, 3, (chtype) '('); + MvWAddCh(middeer3, 1, 4, (chtype) '='); + MvWAddCh(middeer3, 1, 5, (chtype) ')'); + MvWAddCh(middeer3, 1, 6, (chtype) '~'); + MvWAddCh(middeer3, 2, 2, (chtype) '/'); + MvWAddCh(middeer3, 2, 6, (chtype) '\\'); - wattroff(treescrn2, A_BOLD | A_BLINK); - unset_color(treescrn2); + /* bigdeer1 */ + MvWAddCh(bigdeer1, 0, 17, (chtype) '\\'); + MvWAddCh(bigdeer1, 0, 18, (chtype) '/'); + MvWAddCh(bigdeer1, 0, 20, (chtype) '\\'); + MvWAddCh(bigdeer1, 0, 21, (chtype) '/'); + MvWAddCh(bigdeer1, 1, 18, (chtype) '\\'); + MvWAddCh(bigdeer1, 1, 20, (chtype) '/'); + MvWAddCh(bigdeer1, 2, 19, (chtype) '|'); + MvWAddCh(bigdeer1, 2, 20, (chtype) '_'); + MvWAddCh(bigdeer1, 3, 18, (chtype) '/'); + MvWAddCh(bigdeer1, 3, 19, (chtype) '^'); + MvWAddCh(bigdeer1, 3, 20, (chtype) '0'); + MvWAddCh(bigdeer1, 3, 21, (chtype) '\\'); + MvWAddCh(bigdeer1, 4, 17, (chtype) '/'); + MvWAddCh(bigdeer1, 4, 18, (chtype) '/'); + MvWAddCh(bigdeer1, 4, 19, (chtype) '\\'); + MvWAddCh(bigdeer1, 4, 22, (chtype) '\\'); + MvWAddStr(bigdeer1, 5, 7, "^~~~~~~~~// ~~U"); + MvWAddStr(bigdeer1, 6, 7, "( \\_____( /"); + MvWAddStr(bigdeer1, 7, 8, "( ) /"); + MvWAddStr(bigdeer1, 8, 9, "\\\\ /"); + MvWAddStr(bigdeer1, 9, 11, "\\>/>"); - wrefresh(treescrn2); - wrefresh(w_del_msg); - return (0); -} + /* bigdeer2 */ + MvWAddCh(bigdeer2, 0, 17, (chtype) '\\'); + MvWAddCh(bigdeer2, 0, 18, (chtype) '/'); + MvWAddCh(bigdeer2, 0, 20, (chtype) '\\'); + MvWAddCh(bigdeer2, 0, 21, (chtype) '/'); + MvWAddCh(bigdeer2, 1, 18, (chtype) '\\'); + MvWAddCh(bigdeer2, 1, 20, (chtype) '/'); + MvWAddCh(bigdeer2, 2, 19, (chtype) '|'); + MvWAddCh(bigdeer2, 2, 20, (chtype) '_'); + MvWAddCh(bigdeer2, 3, 18, (chtype) '/'); + MvWAddCh(bigdeer2, 3, 19, (chtype) '^'); + MvWAddCh(bigdeer2, 3, 20, (chtype) '0'); + MvWAddCh(bigdeer2, 3, 21, (chtype) '\\'); + MvWAddCh(bigdeer2, 4, 17, (chtype) '/'); + MvWAddCh(bigdeer2, 4, 18, (chtype) '/'); + MvWAddCh(bigdeer2, 4, 19, (chtype) '\\'); + MvWAddCh(bigdeer2, 4, 22, (chtype) '\\'); + MvWAddStr(bigdeer2, 5, 7, "^~~~~~~~~// ~~U"); + MvWAddStr(bigdeer2, 6, 7, "(( )____( /"); + MvWAddStr(bigdeer2, 7, 7, "( / |"); + MvWAddStr(bigdeer2, 8, 8, "\\/ |"); + MvWAddStr(bigdeer2, 9, 9, "|> |>"); -static int -strng4(void) -{ - (void) wattrset(treescrn2, A_BOLD | A_BLINK); - set_color(treescrn2, COLOR_WHITE); + /* bigdeer3 */ + MvWAddCh(bigdeer3, 0, 17, (chtype) '\\'); + MvWAddCh(bigdeer3, 0, 18, (chtype) '/'); + MvWAddCh(bigdeer3, 0, 20, (chtype) '\\'); + MvWAddCh(bigdeer3, 0, 21, (chtype) '/'); + MvWAddCh(bigdeer3, 1, 18, (chtype) '\\'); + MvWAddCh(bigdeer3, 1, 20, (chtype) '/'); + MvWAddCh(bigdeer3, 2, 19, (chtype) '|'); + MvWAddCh(bigdeer3, 2, 20, (chtype) '_'); + MvWAddCh(bigdeer3, 3, 18, (chtype) '/'); + MvWAddCh(bigdeer3, 3, 19, (chtype) '^'); + MvWAddCh(bigdeer3, 3, 20, (chtype) '0'); + MvWAddCh(bigdeer3, 3, 21, (chtype) '\\'); + MvWAddCh(bigdeer3, 4, 17, (chtype) '/'); + MvWAddCh(bigdeer3, 4, 18, (chtype) '/'); + MvWAddCh(bigdeer3, 4, 19, (chtype) '\\'); + MvWAddCh(bigdeer3, 4, 22, (chtype) '\\'); + MvWAddStr(bigdeer3, 5, 7, "^~~~~~~~~// ~~U"); + MvWAddStr(bigdeer3, 6, 6, "( ()_____( /"); + MvWAddStr(bigdeer3, 7, 6, "/ / /"); + MvWAddStr(bigdeer3, 8, 5, "|/ \\"); + MvWAddStr(bigdeer3, 9, 5, "/> \\>"); - MvWAddCh(treescrn2, 9, 17, (chtype) '\''); - MvWAddCh(treescrn2, 9, 16, (chtype) ':'); - MvWAddCh(treescrn2, 9, 15, (chtype) '.'); - MvWAddCh(treescrn2, 9, 14, (chtype) ','); - MvWAddCh(treescrn2, 10, 13, (chtype) '\''); - MvWAddCh(treescrn2, 10, 12, (chtype) ':'); - MvWAddCh(treescrn2, 10, 11, (chtype) '.'); - MvWAddCh(treescrn2, 10, 10, (chtype) ','); - MvWAddCh(treescrn2, 11, 9, (chtype) '\''); - MvWAddCh(treescrn2, 11, 8, (chtype) ':'); - MvWAddCh(treescrn2, 11, 7, (chtype) '.'); - MvWAddCh(treescrn2, 11, 6, (chtype) ','); - MvWAddCh(treescrn2, 12, 5, (chtype) '\''); + /* bigdeer4 */ + MvWAddCh(bigdeer4, 0, 17, (chtype) '\\'); + MvWAddCh(bigdeer4, 0, 18, (chtype) '/'); + MvWAddCh(bigdeer4, 0, 20, (chtype) '\\'); + MvWAddCh(bigdeer4, 0, 21, (chtype) '/'); + MvWAddCh(bigdeer4, 1, 18, (chtype) '\\'); + MvWAddCh(bigdeer4, 1, 20, (chtype) '/'); + MvWAddCh(bigdeer4, 2, 19, (chtype) '|'); + MvWAddCh(bigdeer4, 2, 20, (chtype) '_'); + MvWAddCh(bigdeer4, 3, 18, (chtype) '/'); + MvWAddCh(bigdeer4, 3, 19, (chtype) '^'); + MvWAddCh(bigdeer4, 3, 20, (chtype) '0'); + MvWAddCh(bigdeer4, 3, 21, (chtype) '\\'); + MvWAddCh(bigdeer4, 4, 17, (chtype) '/'); + MvWAddCh(bigdeer4, 4, 18, (chtype) '/'); + MvWAddCh(bigdeer4, 4, 19, (chtype) '\\'); + MvWAddCh(bigdeer4, 4, 22, (chtype) '\\'); + MvWAddStr(bigdeer4, 5, 7, "^~~~~~~~~// ~~U"); + MvWAddStr(bigdeer4, 6, 6, "( )______( /"); + MvWAddStr(bigdeer4, 7, 5, "(/ \\"); + MvWAddStr(bigdeer4, 8, 0, "v___= ----^"); - wattroff(treescrn2, A_BOLD | A_BLINK); - unset_color(treescrn2); + /* lookdeer1 */ + MvWAddStr(lookdeer1, 0, 16, "\\/ \\/"); + MvWAddStr(lookdeer1, 1, 17, "\\Y/ \\Y/"); + MvWAddStr(lookdeer1, 2, 19, "\\=/"); + MvWAddStr(lookdeer1, 3, 17, "^\\o o/^"); + MvWAddStr(lookdeer1, 4, 17, "//( )"); + MvWAddStr(lookdeer1, 5, 7, "^~~~~~~~~// \\O/"); + MvWAddStr(lookdeer1, 6, 7, "( \\_____( /"); + MvWAddStr(lookdeer1, 7, 8, "( ) /"); + MvWAddStr(lookdeer1, 8, 9, "\\\\ /"); + MvWAddStr(lookdeer1, 9, 11, "\\>/>"); - wrefresh(treescrn2); - wrefresh(w_del_msg); - return (0); -} + /* lookdeer2 */ + MvWAddStr(lookdeer2, 0, 16, "\\/ \\/"); + MvWAddStr(lookdeer2, 1, 17, "\\Y/ \\Y/"); + MvWAddStr(lookdeer2, 2, 19, "\\=/"); + MvWAddStr(lookdeer2, 3, 17, "^\\o o/^"); + MvWAddStr(lookdeer2, 4, 17, "//( )"); + MvWAddStr(lookdeer2, 5, 7, "^~~~~~~~~// \\O/"); + MvWAddStr(lookdeer2, 6, 7, "(( )____( /"); + MvWAddStr(lookdeer2, 7, 7, "( / |"); + MvWAddStr(lookdeer2, 8, 8, "\\/ |"); + MvWAddStr(lookdeer2, 9, 9, "|> |>"); -static int -strng5(void) -{ - (void) wattrset(treescrn2, A_BOLD | A_BLINK); - set_color(treescrn2, COLOR_WHITE); + /* lookdeer3 */ + MvWAddStr(lookdeer3, 0, 16, "\\/ \\/"); + MvWAddStr(lookdeer3, 1, 17, "\\Y/ \\Y/"); + MvWAddStr(lookdeer3, 2, 19, "\\=/"); + MvWAddStr(lookdeer3, 3, 17, "^\\o o/^"); + MvWAddStr(lookdeer3, 4, 17, "//( )"); + MvWAddStr(lookdeer3, 5, 7, "^~~~~~~~~// \\O/"); + MvWAddStr(lookdeer3, 6, 6, "( ()_____( /"); + MvWAddStr(lookdeer3, 7, 6, "/ / /"); + MvWAddStr(lookdeer3, 8, 5, "|/ \\"); + MvWAddStr(lookdeer3, 9, 5, "/> \\>"); - MvWAddCh(treescrn2, 11, 19, (chtype) '\''); - MvWAddCh(treescrn2, 11, 18, (chtype) ':'); - MvWAddCh(treescrn2, 11, 17, (chtype) '.'); - MvWAddCh(treescrn2, 11, 16, (chtype) ','); - MvWAddCh(treescrn2, 12, 15, (chtype) '\''); - MvWAddCh(treescrn2, 12, 14, (chtype) ':'); - MvWAddCh(treescrn2, 12, 13, (chtype) '.'); - MvWAddCh(treescrn2, 12, 12, (chtype) ','); + /* lookdeer4 */ + MvWAddStr(lookdeer4, 0, 16, "\\/ \\/"); + MvWAddStr(lookdeer4, 1, 17, "\\Y/ \\Y/"); + MvWAddStr(lookdeer4, 2, 19, "\\=/"); + MvWAddStr(lookdeer4, 3, 17, "^\\o o/^"); + MvWAddStr(lookdeer4, 4, 17, "//( )"); + MvWAddStr(lookdeer4, 5, 7, "^~~~~~~~~// \\O/"); + MvWAddStr(lookdeer4, 6, 6, "( )______( /"); + MvWAddStr(lookdeer4, 7, 5, "(/ \\"); + MvWAddStr(lookdeer4, 8, 0, "v___= ----^"); - wattroff(treescrn2, A_BOLD | A_BLINK); - unset_color(treescrn2); + /***********************************************/ + cbreak(); + nodelay(stdscr, TRUE); + do { + clear(); + werase(treescrn); + touchwin(w_del_msg); + touchwin(treescrn); + werase(treescrn2); + touchwin(treescrn2); + werase(treescrn8); + touchwin(treescrn8); + refresh(); + look_out(150); + boxit(); + refresh(); + look_out(150); + seas(); + refresh(); + look_out(150); + greet(); + refresh(); + look_out(150); + fromwho(); + refresh(); + look_out(150); + tree(); + look_out(150); + balls(); + look_out(150); + star(); + look_out(150); + strng1(); + strng2(); + strng3(); + strng4(); + strng5(); - /* save a fully lit tree */ - overlay(treescrn2, treescrn); + /* set up the windows for our blinking trees */ + /* **************************************** */ + /* treescrn3 */ - wrefresh(treescrn2); - wrefresh(w_del_msg); - return (0); -} + overlay(treescrn, treescrn3); -static int -blinkit(void) -{ - static int cycle; + /*balls */ + MvWAddCh(treescrn3, 4, 18, ' '); + MvWAddCh(treescrn3, 7, 6, ' '); + MvWAddCh(treescrn3, 8, 19, ' '); + MvWAddCh(treescrn3, 11, 22, ' '); - if (cycle > 4) { - cycle = 0; - } + /*star */ + MvWAddCh(treescrn3, 0, 12, '*'); - touchwin(treescrn8); + /*strng1 */ + MvWAddCh(treescrn3, 3, 11, ' '); - switch (cycle) { - case 0: - overlay(treescrn3, treescrn8); - wrefresh(treescrn8); - wrefresh(w_del_msg); - break; - case 1: - overlay(treescrn4, treescrn8); - wrefresh(treescrn8); - wrefresh(w_del_msg); - break; - case 2: - overlay(treescrn5, treescrn8); - wrefresh(treescrn8); - wrefresh(w_del_msg); - break; - case 3: - overlay(treescrn6, treescrn8); - wrefresh(treescrn8); - wrefresh(w_del_msg); - break; - case 4: - overlay(treescrn7, treescrn8); - wrefresh(treescrn8); - wrefresh(w_del_msg); - break; - } - touchwin(treescrn8); + /*strng2 */ + MvWAddCh(treescrn3, 5, 13, ' '); + MvWAddCh(treescrn3, 6, 10, ' '); + + /*strng3 */ + MvWAddCh(treescrn3, 7, 16, ' '); + MvWAddCh(treescrn3, 7, 14, ' '); + + /*strng4 */ + MvWAddCh(treescrn3, 10, 13, ' '); + MvWAddCh(treescrn3, 10, 10, ' '); + MvWAddCh(treescrn3, 11, 8, ' '); - /*ALL ON************************************************** */ + /*strng5 */ + MvWAddCh(treescrn3, 11, 18, ' '); + MvWAddCh(treescrn3, 12, 13, ' '); - overlay(treescrn, treescrn8); - wrefresh(treescrn8); - wrefresh(w_del_msg); + /* treescrn4 */ - ++cycle; - return (0); -} + overlay(treescrn, treescrn4); -static void -deer_step(WINDOW *win, int y, int x) -{ - mvwin(win, y, x); - wrefresh(win); - wrefresh(w_del_msg); - look_out(5); -} + /*balls */ + MvWAddCh(treescrn4, 3, 9, ' '); + MvWAddCh(treescrn4, 4, 16, ' '); + MvWAddCh(treescrn4, 7, 6, ' '); + MvWAddCh(treescrn4, 8, 19, ' '); + MvWAddCh(treescrn4, 11, 2, ' '); + MvWAddCh(treescrn4, 12, 23, ' '); -static int -reindeer(void) -{ - int looper; - y_pos = 0; + /*star */ + (void) wstandout(treescrn4); + MvWAddCh(treescrn4, 0, 12, '*'); + (void) wstandend(treescrn4); - for (x_pos = 70; x_pos > 62; x_pos--) { - if (x_pos < 62) { - y_pos = 1; - } - for (looper = 0; looper < 4; looper++) { - MvWAddCh(dotdeer0, y_pos, x_pos, (chtype) '.'); - wrefresh(dotdeer0); - wrefresh(w_del_msg); - werase(dotdeer0); - wrefresh(dotdeer0); - wrefresh(w_del_msg); - look_out(50); - } - } + /*strng1 */ + MvWAddCh(treescrn4, 3, 13, ' '); - y_pos = 2; + /*strng2 */ - for (; x_pos > 50; x_pos--) { - for (looper = 0; looper < 4; looper++) { + /*strng3 */ + MvWAddCh(treescrn4, 7, 15, ' '); + MvWAddCh(treescrn4, 8, 11, ' '); - if (x_pos < 56) { - y_pos = 3; + /*strng4 */ + MvWAddCh(treescrn4, 9, 16, ' '); + MvWAddCh(treescrn4, 10, 12, ' '); + MvWAddCh(treescrn4, 11, 8, ' '); - MvWAddCh(stardeer0, y_pos, x_pos, (chtype) '*'); - wrefresh(stardeer0); - wrefresh(w_del_msg); - werase(stardeer0); - wrefresh(stardeer0); - wrefresh(w_del_msg); - } else { - MvWAddCh(dotdeer0, y_pos, x_pos, (chtype) '*'); - wrefresh(dotdeer0); - wrefresh(w_del_msg); - werase(dotdeer0); - wrefresh(dotdeer0); - wrefresh(w_del_msg); - } - } - } + /*strng5 */ + MvWAddCh(treescrn4, 11, 18, ' '); + MvWAddCh(treescrn4, 12, 14, ' '); - x_pos = 58; + /* treescrn5 */ - for (y_pos = 2; y_pos < 5; y_pos++) { + overlay(treescrn, treescrn5); - touchwin(lildeer0); - wrefresh(lildeer0); - wrefresh(w_del_msg); + /*balls */ + MvWAddCh(treescrn5, 3, 15, ' '); + MvWAddCh(treescrn5, 10, 20, ' '); + MvWAddCh(treescrn5, 12, 1, ' '); - for (looper = 0; looper < 4; looper++) { - deer_step(lildeer3, y_pos, x_pos); - deer_step(lildeer2, y_pos, x_pos); - deer_step(lildeer1, y_pos, x_pos); - deer_step(lildeer2, y_pos, x_pos); - deer_step(lildeer3, y_pos, x_pos); + /*star */ + MvWAddCh(treescrn5, 0, 12, '*'); - touchwin(lildeer0); - wrefresh(lildeer0); - wrefresh(w_del_msg); + /*strng1 */ + MvWAddCh(treescrn5, 3, 11, ' '); - x_pos -= 2; - } - } + /*strng2 */ + MvWAddCh(treescrn5, 5, 12, ' '); - x_pos = 35; + /*strng3 */ + MvWAddCh(treescrn5, 7, 14, ' '); + MvWAddCh(treescrn5, 8, 10, ' '); - for (y_pos = 5; y_pos < 10; y_pos++) { + /*strng4 */ + MvWAddCh(treescrn5, 9, 15, ' '); + MvWAddCh(treescrn5, 10, 11, ' '); + MvWAddCh(treescrn5, 11, 7, ' '); - touchwin(middeer0); - wrefresh(middeer0); - wrefresh(w_del_msg); + /*strng5 */ + MvWAddCh(treescrn5, 11, 17, ' '); + MvWAddCh(treescrn5, 12, 13, ' '); - for (looper = 0; looper < 2; looper++) { - deer_step(middeer3, y_pos, x_pos); - deer_step(middeer2, y_pos, x_pos); - deer_step(middeer1, y_pos, x_pos); - deer_step(middeer2, y_pos, x_pos); - deer_step(middeer3, y_pos, x_pos); + /* treescrn6 */ - touchwin(middeer0); - wrefresh(middeer0); - wrefresh(w_del_msg); + overlay(treescrn, treescrn6); - x_pos -= 3; - } - } + /*balls */ + MvWAddCh(treescrn6, 6, 7, ' '); + MvWAddCh(treescrn6, 7, 18, ' '); + MvWAddCh(treescrn6, 10, 4, ' '); + MvWAddCh(treescrn6, 11, 23, ' '); - look_out(300); + /*star */ + (void) wstandout(treescrn6); + MvWAddCh(treescrn6, 0, 12, '*'); + (void) wstandend(treescrn6); - y_pos = 1; + /*strng1 */ - for (x_pos = 8; x_pos < 16; x_pos++) { - deer_step(bigdeer4, y_pos, x_pos); - deer_step(bigdeer3, y_pos, x_pos); - deer_step(bigdeer2, y_pos, x_pos); - deer_step(bigdeer1, y_pos, x_pos); - deer_step(bigdeer2, y_pos, x_pos); - deer_step(bigdeer3, y_pos, x_pos); - deer_step(bigdeer4, y_pos, x_pos); - deer_step(bigdeer0, y_pos, x_pos); - } + /*strng2 */ + MvWAddCh(treescrn6, 5, 11, ' '); - --x_pos; + /*strng3 */ + MvWAddCh(treescrn6, 7, 13, ' '); + MvWAddCh(treescrn6, 8, 9, ' '); - for (looper = 0; looper < 6; looper++) { - deer_step(lookdeer4, y_pos, x_pos); - deer_step(lookdeer3, y_pos, x_pos); - deer_step(lookdeer2, y_pos, x_pos); - deer_step(lookdeer1, y_pos, x_pos); - deer_step(lookdeer2, y_pos, x_pos); - deer_step(lookdeer3, y_pos, x_pos); - deer_step(lookdeer4, y_pos, x_pos); - } + /*strng4 */ + MvWAddCh(treescrn6, 9, 14, ' '); + MvWAddCh(treescrn6, 10, 10, ' '); + MvWAddCh(treescrn6, 11, 6, ' '); - deer_step(lookdeer0, y_pos, x_pos); + /*strng5 */ + MvWAddCh(treescrn6, 11, 16, ' '); + MvWAddCh(treescrn6, 12, 12, ' '); - for (; y_pos < 10; y_pos++) { - for (looper = 0; looper < 2; looper++) { - deer_step(bigdeer4, y_pos, x_pos); - deer_step(bigdeer3, y_pos, x_pos); - deer_step(bigdeer2, y_pos, x_pos); - deer_step(bigdeer1, y_pos, x_pos); - deer_step(bigdeer2, y_pos, x_pos); - deer_step(bigdeer3, y_pos, x_pos); - deer_step(bigdeer4, y_pos, x_pos); - } - deer_step(bigdeer0, y_pos, x_pos); - } + /* treescrn7 */ - --y_pos; + overlay(treescrn, treescrn7); - deer_step(lookdeer3, y_pos, x_pos); - return (0); -} + /*balls */ + MvWAddCh(treescrn7, 3, 15, ' '); + MvWAddCh(treescrn7, 6, 7, ' '); + MvWAddCh(treescrn7, 7, 18, ' '); + MvWAddCh(treescrn7, 10, 4, ' '); + MvWAddCh(treescrn7, 11, 22, ' '); -static void -done(int sig GCC_UNUSED) -{ - CATCHALL(done); + /*star */ + MvWAddCh(treescrn7, 0, 12, '*'); - move(LINES - 1, 0); - refresh(); - endwin(); - curs_set(1); + /*strng1 */ + MvWAddCh(treescrn7, 3, 12, ' '); -#if NO_LEAKS - if (my_pairs != 0) - free(my_pairs); -#endif + /*strng2 */ + MvWAddCh(treescrn7, 5, 13, ' '); + MvWAddCh(treescrn7, 6, 9, ' '); - ExitProgram(EXIT_SUCCESS); + /*strng3 */ + MvWAddCh(treescrn7, 7, 15, ' '); + MvWAddCh(treescrn7, 8, 11, ' '); + + /*strng4 */ + MvWAddCh(treescrn7, 9, 16, ' '); + MvWAddCh(treescrn7, 10, 12, ' '); + MvWAddCh(treescrn7, 11, 8, ' '); + + /*strng5 */ + MvWAddCh(treescrn7, 11, 18, ' '); + MvWAddCh(treescrn7, 12, 14, ' '); + + look_out(150); + reindeer(); + + touchwin(w_holiday); + wrefresh(w_holiday); + wrefresh(w_del_msg); + + look_out(500); + for (loopy = 0; loopy < 100; loopy++) { + blinkit(); + } + } while (!opt_q); + done(0); } diff --git a/test/xterm-16color.dat b/test/xterm-16color.dat index 6d47d93cb755..dde12d38c6a3 100644 --- a/test/xterm-16color.dat +++ b/test/xterm-16color.dat @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2004,2006 Free Software Foundation, Inc. # +# Copyright (c) 2004-2006,2016 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"), # @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: xterm-16color.dat,v 1.2 2006/04/22 21:40:00 tom Exp $ +# $Id: xterm-16color.dat,v 1.3 2016/12/10 22:34:58 tom Exp $ # This illustrates the predefined colors for XFree86 xterm's "xterm-16color". # If you set $TERM to "xterm-88color" (and have xterm compiled to support the # 88-color or 256-color feature), you can use the ncurses 'd' screen to @@ -33,13 +33,13 @@ # the first 16 colors, and xterm happens to use the same first 16 colors in # the extended color models that support initc. # -# The colors shown are for xterm patch #189. +# The colors shown are for xterm patch #192. scale:255 0: 0 0 0 black 1: 205 0 0 red3 2: 0 205 0 green3 3: 205 205 0 yellow3 -4: 30 144 255 DodgerBlue1 +4: 0 0 238 blue2 5: 205 0 205 magenta3 6: 0 205 205 cyan3 7: 229 229 229 gray90 @@ -47,7 +47,7 @@ scale:255 9: 255 0 0 red 10: 0 255 0 green 11: 255 255 0 yellow -12: 99 184 255 SteelBlue1 +12: 92 92 255 customblue 13: 255 0 255 magenta 14: 0 255 255 cyan 15: 255 255 255 white diff --git a/test/xterm-256color.dat b/test/xterm-256color.dat index 3dcaabdf28bb..ddce6c2969ce 100644 --- a/test/xterm-256color.dat +++ b/test/xterm-256color.dat @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2009 Free Software Foundation, Inc. # +# Copyright (c) 2009,2016 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"), # @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: xterm-256color.dat,v 1.1 2009/10/30 22:33:40 tom Exp $ +# $Id: xterm-256color.dat,v 1.2 2016/12/10 22:39:28 tom Exp $ # This illustrates the predefined colors for xterm's "xterm-256color" feature. # If you set $TERM to "xterm-256color" (and have xterm compiled to support the # 256-color feature), you can use the ncurses 'd' screen to @@ -33,13 +33,13 @@ # the first 16 colors, and xterm happens to use the same first 16 colors in # the extended color models that support initc. # -# The colors shown are for xterm patch #189. +# The colors shown are for xterm patch #192. scale:255 0: 0 0 0 black 1: 205 0 0 red3 2: 0 205 0 green3 3: 205 205 0 yellow3 -4: 30 144 255 DodgerBlue1 +4: 0 0 238 blue2 5: 205 0 205 magenta3 6: 0 205 205 cyan3 7: 229 229 229 gray90 @@ -47,7 +47,7 @@ scale:255 9: 255 0 0 red 10: 0 255 0 green 11: 255 255 0 yellow -12: 99 184 255 SteelBlue1 +12: 92 92 255 customblue 13: 255 0 255 magenta 14: 0 255 255 cyan 15: 255 255 255 white diff --git a/test/xterm-88color.dat b/test/xterm-88color.dat index 95a753cdcec2..0a3d790941d9 100644 --- a/test/xterm-88color.dat +++ b/test/xterm-88color.dat @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2005-2006,2009 Free Software Foundation, Inc. # +# Copyright (c) 2005-2009,2016 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"), # @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: xterm-88color.dat,v 1.3 2009/10/30 22:33:56 tom Exp $ +# $Id: xterm-88color.dat,v 1.4 2016/12/10 23:06:43 tom Exp $ # This illustrates the predefined colors for xterm's "xterm-88color" feature. # If you set $TERM to "xterm-88color" (and have xterm compiled to support the # 88-color or 256-color feature), you can use the ncurses 'd' screen to @@ -33,13 +33,13 @@ # the first 16 colors, and xterm happens to use the same first 16 colors in # the extended color models that support initc. # -# The colors shown are for xterm patch #189. +# The colors shown are for xterm patch #192. scale:255 0: 0 0 0 black 1: 205 0 0 red3 2: 0 205 0 green3 3: 205 205 0 yellow3 -4: 30 144 255 DodgerBlue1 +4: 0 0 238 blue2 5: 205 0 205 magenta3 6: 0 205 205 cyan3 7: 229 229 229 gray90 @@ -47,7 +47,7 @@ scale:255 9: 255 0 0 red 10: 0 255 0 green 11: 255 255 0 yellow -12: 99 184 255 SteelBlue1 +12: 92 92 255 customblue 13: 255 0 255 magenta 14: 0 255 255 cyan 15: 255 255 255 white diff --git a/test/xterm-color_48x48.xpm b/test/xterm-color_48x48.xpm new file mode 100644 index 000000000000..d8a501f5df42 --- /dev/null +++ b/test/xterm-color_48x48.xpm @@ -0,0 +1,61 @@ +/* XPM */ +static char * xterm_color_48x48_xpm[] = { +"48 48 10 1", +". c None", +" c #555500", +"+ c #000000", +"@ c #FFFFFF", +"# c #FF0000", +"$ c #070700", +"% c #0B0B00", +"& c #FF8400", +"* c #49FF00", +"= c #60B7FF", +"................................................", +"......++++++++++++++++++++++++++++++++++........", +".....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++......", +".....+@@@++++++++++++++++++++++++++++@@@+@+.....", +".....+@@++++++++++++++++++++++++++++++@@+@@+....", +".....+@++++++++++++++++++++++++++++++++@+@@@+...", +".....+@++###++++###++++++++++++++++++++@+@@@@+..", +".....+@+++##++++##+++++++++++++++++++++@+@@@@+..", +".....+@++++##++##++++++++++++++++++++++@+@@@@+..", +".....+@++++##++##++++++++++++++++++++++@+@@@@+..", +".....+@+++++####+++++++++++++++++++++++@+@@@@+..", +".....+@+++++####+++++++++++++++++++++++@+@@@@+..", +".....+@++++++##++++++++++++++++++++++++@+@@@@+..", +".....+@+++++####+++++++++++++++++++++++@+@@@@+..", +".....+@+++++####+++++++++++++++++++++++@+@@@@+..", +".....+@++++##++##++++++++++++++++++++++@+@@@@+..", +".....+@++++##++##++++++++++++++++++++++@+@@@@+..", +".....+@+++##++++##+++++++++++++++++++++@+@@@@+..", +".....+@++###++++###++++++++++++++++++++@+@@@@+..", +".....+@++++++++++++++++++++++++++++++++@+@@@@+..", +".....+@$+++++++++++++++++++++++++++++++@+@@@@+..", +".....+@%@@@@@@@+&&&&&++****+++==+++==++@+@@@@+..", +".....+@++++@++++&++++++*+++*++==+++==++@+@@@@+..", +".....+@++++@++++&++++++*+++*++=+=+=+=++@+@@@@+..", +".....+@++++@++++&&&&+++****+++=+=+=+=++@+@@@@+..", +".....+@++++@++++&++++++*+*++++=++=++=++@+@@@+...", +".....+@++++@++++&++++++*++*+++=++=++=++@+@@@+...", +".....+@++++@++++&&&&&++*+++*++=+++++=++@+@@+....", +".....+@++++++++++++++++++++++++++++++++@+@@+....", +".....+@++++++++++++++++++++++++++++++++@+@+.....", +".....+@@++++++++++++++++++++++++++++++@@+@+.....", +".....+@@@++++++++++++++++++++++++++++@@@++......", +".....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++......", +"......++++++++++++++++++++++++++++++++++........", +"................................................", +"................................................", +"......++++++++++++++++++++++++++++++++++++......", +".....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++......", +".....+@+@+@+@+@+@+@+@+@+@+@+@+@+@+@+@+@@++......", +"....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@+......", +"....+@+@+@+@+@+@+@+@+@+@+@+@+@+@+@+@+@@+@+......", +"...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+......", +"...+@+@+@+@+@+@+@+@+@+@+@+@+@+@+@+@+@@+@@+......", +"..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+.......", +"..+@++@++++++++++++++++++++++++++@++@+@+........", +".+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@+.........", +".+++++++++++++++++++++++++++++++++++++..........", +"................................................"}; -- cgit v1.2.3