ncurses-5.9-20140118/ 0000755 0001751 0000144 00000000000 12266612755 012502 5 ustar tom users ncurses-5.9-20140118/config.guess 0000755 0001751 0000144 00000130361 12212666516 015021 0 ustar tom users #! /bin/sh
# Attempt to guess a canonical system name.
# Copyright 1992-2013 Free Software Foundation, Inc.
timestamp='2013-06-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see .
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
# Originally written by Per Bothner.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
#
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Operation modes:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to ."
version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright 1992-2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help" >&2
exit 1 ;;
* )
break ;;
esac
done
if test $# != 0; then
echo "$me: too many arguments$help" >&2
exit 1
fi
trap 'exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team.
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
for c in cc gcc c89 c99 ; do
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
CC_FOR_BUILD="$c"; break ;
fi ;
done ;
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac ; set_cc_for_build= ;'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_SYSTEM}" in
Linux|GNU|GNU/*)
# If the system lacks a compiler, then just pick glibc.
# We could probably try harder.
LIBC=gnu
eval $set_cc_for_build
cat <<-EOF > $dummy.c
#include
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
#else
LIBC=gnu
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
;;
esac
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
# compatibility and a consistent mechanism for selecting the
# object file format.
#
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
case "${UNAME_MACHINE_ARCH}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
os=netbsd
else
os=netbsdelf
fi
;;
*)
os=netbsd
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
case "${UNAME_VERSION}" in
Debian*)
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
*:SolidBSD:*:*)
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
exit ;;
macppc:MirBSD:*:*)
echo powerpc-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
UNAME_MACHINE="alpha" ;;
"EV4.5 (21064)")
UNAME_MACHINE="alpha" ;;
"LCA4 (21066/21068)")
UNAME_MACHINE="alpha" ;;
"EV5 (21164)")
UNAME_MACHINE="alphaev5" ;;
"EV5.6 (21164A)")
UNAME_MACHINE="alphaev56" ;;
"EV5.6 (21164PC)")
UNAME_MACHINE="alphapca56" ;;
"EV5.7 (21164PC)")
UNAME_MACHINE="alphapca57" ;;
"EV6 (21264)")
UNAME_MACHINE="alphaev6" ;;
"EV6.7 (21264A)")
UNAME_MACHINE="alphaev67" ;;
"EV6.8CB (21264C)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8AL (21264B)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8CX (21264D)")
UNAME_MACHINE="alphaev68" ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE="alphaev69" ;;
"EV7 (21364)")
UNAME_MACHINE="alphaev7" ;;
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
exit $exitcode ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
exit ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
exit ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit ;;
*:[Mm]orph[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-morphos
exit ;;
*:OS/390:*:*)
echo i370-ibm-openedition
exit ;;
*:z/VM:*:*)
echo s390-ibm-zvmoe
exit ;;
*:OS400:*:*)
echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
exit ;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
s390x:SunOS:*:*)
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-auroraux${UNAME_RELEASE}
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH="x86_64"
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
;;
sun4)
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
exit ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
#include /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c &&
dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
SYSTEM_NAME=`$dummy $dummyarg` &&
{ echo "$SYSTEM_NAME"; exit; }
echo mips-mips-riscos${UNAME_RELEASE}
exit ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
exit ;;
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
exit ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
echo powerpc-harris-powermax
exit ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
[ ${TARGET_BINARY_INTERFACE}x = x ]
then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
echo i386-ibm-aix
exit ;;
ia64:AIX:*:*)
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
exit ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
then
echo "$SYSTEM_NAME"
else
echo rs6000-ibm-aix3.2.5
fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit ;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
esac ;;
esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE
#include
#include
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
then
eval $set_cc_for_build
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
# generating 64-bit code. GNU and HP use different nomenclature:
#
# $ CC_FOR_BUILD=cc ./config.guess
# => hppa2.0w-hp-hpux11.23
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
HP_ARCH="hppa2.0w"
else
HP_ARCH="hppa64"
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit ;;
ia64:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ia64-hp-hpux${HPUX_REV}
exit ;;
3050*:HI-UX:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
exit ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit ;;
i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
exit ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
*:UNICOS/mp:*:*)
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
*:MINGW64*:*)
echo ${UNAME_MACHINE}-pc-mingw64
exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
*:Interix*:*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
exit ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
cris:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:Linux:*:*)
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef ${UNAME_MACHINE}
#undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
or1k:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
or32:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-${LIBC}
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-${LIBC}
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
*) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-${LIBC}
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-${LIBC}
exit ;;
ppc64le:Linux:*:*)
echo powerpc64le-unknown-linux-${LIBC}
exit ;;
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
echo i386-sequent-sysv4
exit ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit ;;
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
exit ;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
exit ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit ;;
paragon:*:*:*)
echo i860-intel-osf1
exit ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit ;;
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
exit ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
exit ;;
M68*:*:R3V[5678]*:*)
test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit ;;
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
exit ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says
echo i586-unisys-sysv4
exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes .
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit ;;
i*86:VOS:*:*)
# From Paul.Green@stratus.com.
echo ${UNAME_MACHINE}-stratus-vos
exit ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos
exit ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit ;;
news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
exit ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
x86_64:Haiku:*:*)
echo x86_64-unknown-haiku
exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit ;;
SX-7:SUPER-UX:*:*)
echo sx7-nec-superux${UNAME_RELEASE}
exit ;;
SX-8:SUPER-UX:*:*)
echo sx8-nec-superux${UNAME_RELEASE}
exit ;;
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
eval $set_cc_for_build
if test "$UNAME_PROCESSOR" = unknown ; then
UNAME_PROCESSOR=powerpc
fi
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
exit ;;
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
exit ;;
BS2000:POSIX*:*:*)
echo bs2000-siemens-sysv
exit ;;
DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
exit ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
if test "$cputype" = "386"; then
UNAME_MACHINE=i386
else
UNAME_MACHINE="$cputype"
fi
echo ${UNAME_MACHINE}-unknown-plan9
exit ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
exit ;;
*:TENEX:*:*)
echo pdp10-unknown-tenex
exit ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
echo pdp10-dec-tops20
exit ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
echo pdp10-xkl-tops20
exit ;;
*:TOPS-20:*:*)
echo pdp10-unknown-tops20
exit ;;
*:ITS:*:*)
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
V*) echo vax-dec-vms ; exit ;;
esac ;;
*:XENIX:*:SysV)
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
esac
eval $set_cc_for_build
cat >$dummy.c <
# include
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
# if !defined (ultrix)
# include
# if defined (BSD)
# if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
# else
# if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# endif
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# else
printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
c34*)
echo c34-convex-bsd
exit ;;
c38*)
echo c38-convex-bsd
exit ;;
c4*)
echo c4-convex-bsd
exit ;;
esac
fi
cat >&2 < in order to provide the needed
information to handle your system.
config.guess timestamp = $timestamp
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
hostinfo = `(hostinfo) 2>/dev/null`
/bin/universe = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
UNAME_MACHINE = ${UNAME_MACHINE}
UNAME_RELEASE = ${UNAME_RELEASE}
UNAME_SYSTEM = ${UNAME_SYSTEM}
UNAME_VERSION = ${UNAME_VERSION}
EOF
exit 1
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
ncurses-5.9-20140118/mk-2nd.awk 0000644 0001751 0000144 00000012245 10174477614 014301 0 ustar tom users # $Id: mk-2nd.awk,v 1.19 2005/01/22 16:30:04 tom Exp $
##############################################################################
# Copyright (c) 1998-2004,2005 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
#
# Generate compile-rules for the modules that we are using in libraries or
# programs. We are listing them explicitly because we have turned off the
# suffix rules (to force compilation with the appropriate flags). We could use
# make-recursion but that would result in makefiles that are useless for
# development.
#
# Variables:
# model directory into which objects are compiled.
# MODEL (uppercase version of "model"; toupper is not portable)
# echo (yes iff we will show the $(CC) lines)
# subset ("none", "base", "base+ext_funcs" or "termlib")
# crenames ("yes" or "no", flag to control whether -c & -o options are used)
# cxxrenames ("yes" or "no", flag to control whether -c & -o options are used)
# traces ("all" or "DEBUG", to control whether tracing is compiled in)
# srcdir is expanded when "configure --srcdir" was used
#
# Fields in src/modules:
# $1 = module name
# $2 = progs|lib|c++
# $3 = source-directory
#
# Fields in src/modules past $3 are dependencies
#
BEGIN {
found = 0
using = 0
}
/^@/ {
using = 0
if (subset == "none") {
using = 1
} else if (index(subset,$2) > 0) {
if (using == 0) {
if (found == 0) {
print ""
print "# generated by mk-2nd.awk"
printf "# model: %s\n", model
printf "# MODEL: %s\n", MODEL
printf "# echo: %s\n", echo
printf "# subset: %s\n", subset
printf "# crenames: %s\n", crenames
printf "# cxxrenames: %s\n", cxxrenames
printf "# traces: %s\n", traces
printf "# srcdir: %s\n", srcdir
}
using = 1
}
}
}
/^[@#]/ {
next
}
$1 ~ /trace/ {
if (traces != "all" && traces != MODEL && $1 != "lib_trace")
next
}
{
if ($0 != "" \
&& using != 0) {
found = 1
if ( $1 != "" ) {
print ""
if ( $2 == "c++" ) {
compile="CXX"
suffix=".cc"
use_c_o=cxxrenames
} else {
compile="CC"
suffix=".c"
use_c_o=crenames
}
printf "../%s/%s$o :\t%s/%s%s", model, $1, $3, $1, suffix
for (n = 4; n <= NF; n++) printf " \\\n\t\t\t%s", $n
print ""
if ( echo == "yes" )
atsign=""
else {
atsign="@"
printf "\t@echo 'compiling %s (%s)'\n", $1, model
}
printf "\t%s", atsign;
if ( use_c_o != "yes" ) {
printf "cd ../%s; ", model;
}
# The choice here is between
# base+ext_funcs and
# termlib+ext_tinfo
# but they may appear in the same value.
if ( subset ~ /base/ ) {
mycflags=""
} else if ( subset ~ /termlib/ ) {
mycflags=" -DUSE_TERMLIB"
}
printf "$(LIBTOOL_COMPILE) $(%s) $(CFLAGS_%s)%s -c ", compile, MODEL, mycflags
if ( $3 == "." || srcdir == "." ) {
dir = $3 "/"
sub("^\\$\\(srcdir\\)/","",dir);
sub("^\\./","",dir);
printf "../%s/%s%s%s", name, dir, $1, suffix
} else {
printf "%s/%s%s", $3, $1, suffix
}
if ( use_c_o == "yes" ) {
printf " -o ../%s/%s$o", model, $1
}
} else {
printf "%s", $1
for (n = 2; n <= NF; n++) printf " %s", $n
}
print ""
}
}
END {
print ""
}
ncurses-5.9-20140118/test/ 0000755 0001751 0000144 00000000000 12250703252 013443 5 ustar tom users ncurses-5.9-20140118/test/hanoi.c 0000644 0001751 0000144 00000021131 12221650751 014706 0 ustar tom users /****************************************************************************
* Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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. *
****************************************************************************/
/*
* Name: Towers of Hanoi.
*
* Desc:
* This is a playable copy of towers of hanoi.
* Its sole purpose is to demonstrate my Amiga Curses package.
* This program should compile on any system that has Curses.
* 'hanoi' will give a manual game with 7 playing pieces.
* 'hanoi n' will give a manual game with n playing pieces.
* 'hanoi n a' will give an auto solved game with n playing pieces.
*
* Author: Simon J Raybould (sie@fulcrum.bt.co.uk).
* (This version has been slightly modified by the ncurses maintainers.)
*
* Date: 05.Nov.90
*
* $Id: hanoi.c,v 1.35 2013/09/28 22:02:17 tom Exp $
*/
#include
#include
#define NPEGS 3 /* This is not configurable !! */
#define MINTILES 3
#define MAXTILES 9
#define DEFAULTTILES 7
#define TOPLINE 6
#define BASELINE 16
#define STATUSLINE (LINES-3)
#define LEFTPEG 19
#define MIDPEG 39
#define RIGHTPEG 59
#define LENTOIND(x) (((int)(x)-1)/2)
#define OTHER(a,b) (3-((a)+(b)))
struct Peg {
size_t Length[MAXTILES];
int Count;
};
static struct Peg Pegs[NPEGS];
static int PegPos[] =
{
LEFTPEG,
MIDPEG,
RIGHTPEG
};
static short TileColour[] =
{
COLOR_GREEN, /* Length 3 */
COLOR_MAGENTA, /* Length 5 */
COLOR_RED, /* Length 7 */
COLOR_BLUE, /* Length 9 */
COLOR_CYAN, /* Length 11 */
COLOR_YELLOW, /* Length 13 */
COLOR_GREEN, /* Length 15 */
COLOR_MAGENTA, /* Length 17 */
COLOR_RED, /* Length 19 */
};
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)
{
if (From >= NPEGS)
return TRUE;
if (From < 0)
return TRUE;
if (To >= NPEGS)
return TRUE;
if (To < 0)
return TRUE;
if (From == To)
return TRUE;
if (!Pegs[From].Count)
return TRUE;
if (Pegs[To].Count &&
Pegs[From].Length[Pegs[From].Count - 1] >
Pegs[To].Length[Pegs[To].Count - 1])
return TRUE;
return FALSE;
}
static void
InitTiles(void)
{
int Size, SlotNo;
for (Size = NTiles * 2 + 1, SlotNo = 0; Size >= 3; Size -= 2)
Pegs[0].Length[SlotNo++] = (size_t) Size;
Pegs[0].Count = NTiles;
Pegs[1].Count = 0;
Pegs[2].Count = 0;
}
static void
DisplayTiles(void)
{
int Line, peg, SlotNo;
char TileBuf[BUFSIZ];
erase();
MvAddStr(1, 24, "T O W E R S O F H A N O I");
MvAddStr(3, 34, "SJR 1990");
MvPrintw(19, 5, "Moves : %d of %.0f", NMoves, pow(2.0, (float) NTiles) - 1);
(void) attrset(A_REVERSE);
MvAddStr(BASELINE, 8,
" ");
for (Line = TOPLINE; Line < BASELINE; Line++) {
MvAddCh(Line, LEFTPEG, ' ');
MvAddCh(Line, MIDPEG, ' ');
MvAddCh(Line, RIGHTPEG, ' ');
}
MvAddCh(BASELINE, LEFTPEG, '1');
MvAddCh(BASELINE, MIDPEG, '2');
MvAddCh(BASELINE, RIGHTPEG, '3');
(void) attrset(A_NORMAL);
/* Draw tiles */
for (peg = 0; peg < NPEGS; peg++) {
for (SlotNo = 0; SlotNo < Pegs[peg].Count; SlotNo++) {
size_t len = Pegs[peg].Length[SlotNo];
if (len < sizeof(TileBuf) - 1 && len < (size_t) PegPos[peg]) {
memset(TileBuf, ' ', len);
TileBuf[len] = '\0';
if (has_colors())
(void) attrset((attr_t) COLOR_PAIR(LENTOIND(len)));
else
(void) attrset(A_REVERSE);
MvAddStr(BASELINE - (SlotNo + 1),
(PegPos[peg] - (int) len / 2),
TileBuf);
}
}
}
(void) attrset(A_NORMAL);
refresh();
}
static int
GetMove(int *From, int *To)
{
MvAddStr(STATUSLINE, 0, "Next move ('q' to quit) from ");
clrtoeol();
refresh();
if ((*From = getch()) == 'q')
return TRUE;
*From -= ('0' + 1);
addstr(" to ");
clrtoeol();
refresh();
if ((*To = getch()) == 'q')
return TRUE;
*To -= ('0' + 1);
refresh();
if (!AutoFlag)
napms(500);
move(STATUSLINE, 0);
clrtoeol();
refresh();
return FALSE;
}
static void
MakeMove(int From, int To)
{
Pegs[From].Count--;
Pegs[To].Length[Pegs[To].Count] = Pegs[From].Length[Pegs[From].Count];
Pegs[To].Count++;
NMoves++;
DisplayTiles();
}
static void
AutoMove(int From, int To, int Num)
{
if (Num == 1) {
MakeMove(From, To);
napms(500);
} else {
AutoMove(From, OTHER(From, To), Num - 1);
MakeMove(From, To);
napms(500);
AutoMove(OTHER(From, To), To, Num - 1);
}
}
static int
Solved(int NumTiles)
{
int i;
for (i = 1; i < NPEGS; i++)
if (Pegs[i].Count == NumTiles)
return TRUE;
return FALSE;
}
static void
Usage(void)
{
fprintf(stderr, "Usage: hanoi [] [a]\n");
fprintf(stderr,
"The 'a' option causes the tower to be solved automatically\n");
}
ncurses-5.9-20140118/test/dots.c 0000644 0001751 0000144 00000011122 12221652071 014555 0 ustar tom users /****************************************************************************
* Copyright (c) 1999-2011,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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 1999
*
* $Id: dots.c,v 1.25 2013/09/28 22:12:09 tom Exp $
*
* A simple demo of the terminfo interface.
*/
#define USE_TINFO
#include
#if HAVE_SETUPTERM
#include
#define valid(s) ((s != 0) && s != (char *)-1)
static bool interrupted = FALSE;
static long total_chars = 0;
static time_t started;
static
TPUTS_PROTO(outc, c)
{
int rc = c;
if (interrupted) {
char tmp = (char) c;
if (write(STDOUT_FILENO, &tmp, (size_t) 1) == -1)
rc = EOF;
} else {
rc = putc(c, stdout);
}
TPUTS_RETURN(rc);
}
static bool
outs(const char *s)
{
if (valid(s)) {
tputs(s, 1, outc);
return TRUE;
}
return FALSE;
}
static void
cleanup(void)
{
outs(exit_attribute_mode);
if (!outs(orig_colors))
outs(orig_pair);
outs(clear_screen);
outs(cursor_normal);
printf("\n\n%ld total chars, 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.);
}
int
main(int argc GCC_UNUSED,
char *argv[]GCC_UNUSED)
{
int x, y, z, p;
double r;
double c;
int my_colors;
CATCHALL(onsig);
srand((unsigned) time(0));
setupterm((char *) 0, 1, (int *) 0);
outs(clear_screen);
outs(cursor_invisible);
my_colors = max_colors;
if (my_colors > 1) {
if (!valid(set_a_foreground)
|| !valid(set_a_background)
|| (!valid(orig_colors) && !valid(orig_pair)))
my_colors = -1;
}
r = (double) (lines - 4);
c = (double) (columns - 4);
started = time((time_t *) 0);
while (!interrupted) {
x = (int) (c * ranf()) + 2;
y = (int) (r * ranf()) + 2;
p = (ranf() > 0.9) ? '*' : ' ';
tputs(tparm3(cursor_address, y, x), 1, outc);
if (my_colors > 0) {
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);
}
} else if (valid(exit_attribute_mode)
&& valid(enter_reverse_mode)) {
if (ranf() <= 0.01) {
outs((ranf() > 0.6)
? enter_reverse_mode
: exit_attribute_mode);
napms(1);
}
}
outc(p);
fflush(stdout);
++total_chars;
}
cleanup();
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
ncurses-5.9-20140118/test/cardfile.c 0000644 0001751 0000144 00000032431 12221650751 015366 0 ustar tom users /****************************************************************************
* Copyright (c) 1999-2012,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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: cardfile.c,v 1.42 2013/09/28 22:02:17 tom Exp $
*
* File format: text beginning in column 1 is a title; other text is content.
*/
#include
#if USE_LIBFORM && USE_LIBPANEL
#include
#include
#define VISIBLE_CARDS 10
#define OFFSET_CARD 2
#define pair_1 1
#define pair_2 2
#define isVisible(cardp) ((cardp)->panel != 0)
enum {
MY_CTRL_x = MAX_FORM_COMMAND
,MY_CTRL_N
,MY_CTRL_P
,MY_CTRL_Q
,MY_CTRL_W
};
typedef struct _card {
struct _card *link;
PANEL *panel;
FORM *form;
char *title;
char *content;
} CARD;
static CARD *all_cards;
static bool try_color = FALSE;
static char default_name[] = "cardfile.dat";
static void
failed(const char *s)
{
perror(s);
endwin();
ExitProgram(EXIT_FAILURE);
}
static const char *
skip(const char *buffer)
{
while (isspace(UChar(*buffer)))
buffer++;
return buffer;
}
static void
trim(char *buffer)
{
size_t n = strlen(buffer);
while (n-- && isspace(UChar(buffer[n])))
buffer[n] = 0;
}
/*******************************************************************************/
static CARD *
add_title(const char *title)
{
CARD *card, *p, *q;
for (p = all_cards, q = 0; p != 0; q = p, p = p->link) {
int cmp = strcmp(p->title, title);
if (cmp == 0)
return p;
if (cmp > 0)
break;
}
card = typeCalloc(CARD, (size_t) 1);
card->title = strdup(title);
card->content = strdup("");
if (q == 0) {
card->link = all_cards;
all_cards = card;
} else {
card->link = q->link;
q->link = card;
}
return card;
}
static void
add_content(CARD * card, const char *content)
{
size_t total, offset;
content = skip(content);
if ((total = strlen(content)) != 0) {
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++, " ");
} else {
offset = 0;
if (card->content != 0)
free(card->content);
card->content = typeMalloc(char, total + 1);
}
if (card->content)
strcpy(card->content + offset, content);
else
failed("add_content");
}
}
static CARD *
new_card(void)
{
CARD *card = add_title("");
add_content(card, "");
return card;
}
static CARD *
find_card(char *title)
{
CARD *card;
for (card = all_cards; card != 0; card = card->link)
if (!strcmp(card->title, title))
break;
return card;
}
static void
read_data(char *fname)
{
FILE *fp;
CARD *card = 0;
char buffer[BUFSIZ];
if ((fp = fopen(fname, "r")) != 0) {
while (fgets(buffer, sizeof(buffer), fp)) {
trim(buffer);
if (isspace(UChar(*buffer))) {
if (card == 0)
card = add_title("");
add_content(card, buffer);
} else if ((card = find_card(buffer)) == 0) {
card = add_title(buffer);
}
}
fclose(fp);
}
}
/*******************************************************************************/
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) {
for (p = all_cards; p != 0; p = p->link) {
FIELD **f = form_fields(p->form);
for (n = 0; f[n] != 0; n++) {
char *s = field_buffer(f[n], 0);
if (s != 0
&& (s = strdup(s)) != 0) {
trim(s);
fprintf(fp, "%s%s\n", n ? "\t" : "", s);
free(s);
}
}
}
fclose(fp);
}
}
/*******************************************************************************/
/*
* Count the cards
*/
static int
count_cards(void)
{
CARD *p;
int count = 0;
for (p = all_cards; p != 0; p = p->link)
count++;
return count;
}
/*
* Shuffle the panels to keep them in a natural hierarchy.
*/
static void
order_cards(CARD * first, int depth)
{
if (first) {
if (depth && first->link)
order_cards(first->link, depth - 1);
if (isVisible(first))
top_panel(first->panel);
}
}
/*
* Return the next card in the list
*/
static CARD *
next_card(CARD * now)
{
if (now->link != 0) {
CARD *tst = now->link;
if (isVisible(tst))
now = tst;
else
(void) next_card(tst);
}
return now;
}
/*
* Return the previous card in the list
*/
static CARD *
prev_card(CARD * now)
{
CARD *p;
for (p = all_cards; p != 0; p = p->link) {
if (p->link == now) {
if (!isVisible(p))
p = prev_card(p);
return p;
}
}
return now;
}
/*
* Returns the first card in the list that we will display.
*/
static CARD *
first_card(CARD * now)
{
if (!isVisible(now))
now = next_card(now);
return now;
}
/*******************************************************************************/
static int
form_virtualize(WINDOW *w)
{
int c = wgetch(w);
switch (c) {
case CTRL('W'):
return (MY_CTRL_W);
case CTRL('N'):
return (MY_CTRL_N);
case CTRL('P'):
return (MY_CTRL_P);
case QUIT:
case ESCAPE:
return (MY_CTRL_Q);
case KEY_BACKSPACE:
return (REQ_DEL_PREV);
case KEY_DC:
return (REQ_DEL_CHAR);
case KEY_LEFT:
return (REQ_LEFT_CHAR);
case KEY_RIGHT:
return (REQ_RIGHT_CHAR);
case KEY_DOWN:
case KEY_NEXT:
return (REQ_NEXT_FIELD);
case KEY_UP:
case KEY_PREVIOUS:
return (REQ_PREV_FIELD);
default:
return (c);
}
}
static FIELD **
make_fields(CARD * p, int form_high, int form_wide)
{
FIELD **f = typeCalloc(FIELD *, (size_t) 3);
f[0] = new_field(1, form_wide, 0, 0, 0, 0);
set_field_back(f[0], A_REVERSE);
set_field_buffer(f[0], 0, p->title);
field_opts_off(f[0], O_BLANK);
f[1] = new_field(form_high - 1, form_wide, 1, 0, 0, 0);
set_field_buffer(f[1], 0, p->content);
set_field_just(f[1], JUSTIFY_LEFT);
field_opts_off(f[1], O_BLANK);
f[2] = 0;
return f;
}
static void
show_legend(void)
{
erase();
move(LINES - 3, 0);
addstr("^Q/ESC -- exit form ^W -- writes data to file\n");
addstr("^N -- go to next card ^P -- go to previous card\n");
addstr("Arrow keys move left/right within a field, up/down between fields");
}
#if (defined(KEY_RESIZE) && HAVE_WRESIZE) || NO_LEAKS
static void
free_form_fields(FIELD ** f)
{
int n;
for (n = 0; f[n] != 0; ++n) {
free_field(f[n]);
}
free(f);
}
#endif
/*******************************************************************************/
static void
cardfile(char *fname)
{
WINDOW *win;
CARD *p;
CARD *top_card;
int visible_cards;
int panel_wide;
int panel_high;
int form_wide;
int form_high;
int y;
int x;
int ch = ERR;
int finished = FALSE;
show_legend();
/* decide how many cards we can display */
visible_cards = count_cards();
while (
(panel_wide = COLS - (visible_cards * OFFSET_CARD)) < 10 ||
(panel_high = LINES - (visible_cards * OFFSET_CARD) - 5) < 5) {
--visible_cards;
}
form_wide = panel_wide - 2;
form_high = panel_high - 2;
y = (visible_cards - 1) * OFFSET_CARD;
x = 0;
/* make a panel for each CARD */
for (p = all_cards; p != 0; p = p->link) {
if ((win = newwin(panel_high, panel_wide, y, x)) == 0)
break;
wbkgd(win, (chtype) COLOR_PAIR(pair_2));
keypad(win, TRUE);
p->panel = new_panel(win);
box(win, 0, 0);
p->form = new_form(make_fields(p, form_high, form_wide));
set_form_win(p->form, win);
set_form_sub(p->form, derwin(win, form_high, form_wide, 1, 1));
post_form(p->form);
y -= OFFSET_CARD;
x += OFFSET_CARD;
}
top_card = first_card(all_cards);
order_cards(top_card, visible_cards);
while (!finished) {
update_panels();
doupdate();
ch = form_virtualize(panel_window(top_card->panel));
switch (form_driver(top_card->form, ch)) {
case E_OK:
break;
case E_UNKNOWN_COMMAND:
switch (ch) {
case MY_CTRL_Q:
finished = TRUE;
break;
case MY_CTRL_P:
top_card = prev_card(top_card);
order_cards(top_card, visible_cards);
break;
case MY_CTRL_N:
top_card = next_card(top_card);
order_cards(top_card, visible_cards);
break;
case MY_CTRL_W:
form_driver(top_card->form, REQ_VALIDATION);
write_data(fname);
break;
#if defined(KEY_RESIZE) && HAVE_WRESIZE
case KEY_RESIZE:
/* resizeterm already did "something" reasonable, but it cannot
* know much about layout. So let's make it nicer.
*/
panel_wide = COLS - (visible_cards * OFFSET_CARD);
panel_high = LINES - (visible_cards * OFFSET_CARD) - 5;
form_wide = panel_wide - 2;
form_high = panel_high - 2;
y = (visible_cards - 1) * OFFSET_CARD;
x = 0;
show_legend();
for (p = all_cards; p != 0; p = p->link) {
FIELD **oldf = form_fields(p->form);
WINDOW *olds = form_sub(p->form);
if (!isVisible(p))
continue;
win = form_win(p->form);
/* move and resize the card as needed
* FIXME: if the windows are shrunk too much, this won't do
*/
mvwin(win, y, x);
wresize(win, panel_high, panel_wide);
/* reconstruct each form. Forms are not resizable, and
* there appears to be no good way to reload the text in
* a resized window.
*/
werase(win);
unpost_form(p->form);
free_form(p->form);
p->form = new_form(make_fields(p, form_high, form_wide));
set_form_win(p->form, win);
set_form_sub(p->form, derwin(win, form_high, form_wide,
1, 1));
post_form(p->form);
free_form_fields(oldf);
delwin(olds);
box(win, 0, 0);
y -= OFFSET_CARD;
x += OFFSET_CARD;
}
break;
#endif
default:
beep();
break;
}
break;
default:
flash();
break;
}
}
#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);
unpost_form(p->form); /* ...so we can free it */
free_form(p->form); /* this also disconnects the fields */
free_form_fields(f);
del_panel(p->panel);
}
free(p->title);
free(p->content);
free(p);
}
#endif
}
static void
usage(void)
{
static const char *msg[] =
{
"Usage: view [options] file"
,""
,"Options:"
," -c use color if terminal supports it"
};
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 n;
setlocale(LC_ALL, "");
while ((n = getopt(argc, argv, "c")) != -1) {
switch (n) {
case 'c':
try_color = TRUE;
break;
default:
usage();
}
}
initscr();
cbreak();
noecho();
if (try_color) {
if (has_colors()) {
start_color();
init_pair(pair_1, COLOR_WHITE, COLOR_BLUE);
init_pair(pair_2, COLOR_WHITE, COLOR_CYAN);
bkgd((chtype) COLOR_PAIR(pair_1));
} else {
try_color = FALSE;
}
}
if (optind + 1 == argc) {
for (n = 1; n < argc; n++)
read_data(argv[n]);
if (count_cards() == 0)
new_card();
cardfile(argv[1]);
} else {
read_data(default_name);
if (count_cards() == 0)
new_card();
cardfile(default_name);
}
endwin();
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(void)
{
printf("This program requires the curses form and panel libraries\n");
ExitProgram(EXIT_FAILURE);
}
#endif
ncurses-5.9-20140118/test/inchs.c 0000644 0001751 0000144 00000016227 12052040267 014723 0 ustar tom users /****************************************************************************
* Copyright (c) 2007-2010,2012 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: inchs.c,v 1.12 2012/11/18 01:58:15 tom Exp $
*
* Author: Thomas E Dickey
*/
/*
chtype inch(void);
chtype winch(WINDOW *win);
chtype mvinch(int y, int x);
chtype mvwinch(WINDOW *win, int y, int x);
int inchstr(chtype *chstr);
int inchnstr(chtype *chstr, int n);
int winchstr(WINDOW *win, chtype *chstr);
int winchnstr(WINDOW *win, chtype *chstr, int n);
int mvinchstr(int y, int x, chtype *chstr);
int mvinchnstr(int y, int x, chtype *chstr, int n);
int mvwinchstr(WINDOW *win, int y, int x, chtype *chstr);
int mvwinchnstr(WINDOW *win, int y, int x, chtype *chstr, int n);
*/
#include
#define BASE_Y 7
#define MAX_COLS 1024
static void
failed(const char *s)
{
int save = errno;
endwin();
errno = save;
perror(s);
ExitProgram(EXIT_FAILURE);
}
static bool
Quit(int ch)
{
return (ch == ERR || ch == 'q' || ch == QUIT || ch == ESCAPE);
}
static int
test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin)
{
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) {
beep();
return FALSE;
}
if (level > 1) {
txtbox = newwin(LINES - BASE_Y, COLS - level, BASE_Y, level);
box(txtbox, 0, 0);
wnoutrefresh(txtbox);
txtwin = derwin(txtbox,
getmaxy(txtbox) - 2,
getmaxx(txtbox) - 2,
1, 1);
base_y = 0;
} else {
txtwin = stdscr;
base_y = BASE_Y;
}
if (txtwin == 0)
failed("cannot create txtwin");
keypad(txtwin, TRUE); /* enable keyboard mapping */
(void) cbreak(); /* take input chars one at a time, no wait for \n */
(void) noecho(); /* don't echo input */
txt_y = base_y;
txt_x = 0;
wmove(txtwin, txt_y, txt_x);
if ((fp = fopen(argv[level], "r")) != 0) {
while ((j = fgetc(fp)) != EOF) {
if (waddch(txtwin, UChar(j)) != OK) {
break;
}
}
fclose(fp);
} else {
wprintw(txtwin, "Cannot open:\n%s", argv[1]);
}
while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) {
switch (j) {
case KEY_DOWN:
case 'j':
if (txt_y < getmaxy(txtwin) - 1)
txt_y++;
else
beep();
break;
case KEY_UP:
case 'k':
if (txt_y > base_y)
txt_y--;
else
beep();
break;
case KEY_LEFT:
case 'h':
if (txt_x > 0)
txt_x--;
else
beep();
break;
case KEY_RIGHT:
case 'l':
if (txt_x < getmaxx(txtwin) - 1)
txt_x++;
else
beep();
break;
case 'w':
test_inchs(level + 1, argv, chrwin, strwin);
if (txtbox != 0) {
touchwin(txtbox);
wnoutrefresh(txtbox);
} else {
touchwin(txtwin);
wnoutrefresh(txtwin);
}
break;
default:
beep();
break;
}
MvWPrintw(chrwin, 0, 0, "char:");
wclrtoeol(chrwin);
if (txtwin != stdscr) {
wmove(txtwin, txt_y, txt_x);
if ((ch = (int) winch(txtwin)) != ERR) {
if (waddch(chrwin, (chtype) ch) != ERR) {
for (j = txt_x + 1; j < getmaxx(txtwin); ++j) {
if ((ch = (int) mvwinch(txtwin, txt_y, j)) != ERR) {
if (waddch(chrwin, (chtype) ch) == ERR) {
break;
}
} else {
break;
}
}
}
}
} else {
move(txt_y, txt_x);
if ((ch = (int) inch()) != ERR) {
if (waddch(chrwin, (chtype) ch) != ERR) {
for (j = txt_x + 1; j < getmaxx(txtwin); ++j) {
if ((ch = (int) mvinch(txt_y, j)) != ERR) {
if (waddch(chrwin, (chtype) ch) == ERR) {
break;
}
} else {
break;
}
}
}
}
}
wnoutrefresh(chrwin);
MvWPrintw(strwin, 0, 0, "text:");
wclrtobot(strwin);
limit = getmaxx(strwin) - 5;
if (txtwin != stdscr) {
wmove(txtwin, txt_y, txt_x);
if (winchstr(txtwin, text) != ERR) {
MvWAddChStr(strwin, 0, 5, text);
}
wmove(txtwin, txt_y, txt_x);
if (winchnstr(txtwin, text, limit) != ERR) {
MvWAddChStr(strwin, 1, 5, text);
}
if (mvwinchstr(txtwin, txt_y, txt_x, text) != ERR) {
MvWAddChStr(strwin, 2, 5, text);
}
if (mvwinchnstr(txtwin, txt_y, txt_x, text, limit) != ERR) {
MvWAddChStr(strwin, 3, 5, text);
}
} else {
move(txt_y, txt_x);
if (inchstr(text) != ERR) {
MvWAddChStr(strwin, 0, 5, text);
}
move(txt_y, txt_x);
if (inchnstr(text, limit) != ERR) {
MvWAddChStr(strwin, 1, 5, text);
}
if (mvinchstr(txt_y, txt_x, text) != ERR) {
MvWAddChStr(strwin, 2, 5, text);
}
if (mvinchnstr(txt_y, txt_x, text, limit) != ERR) {
MvWAddChStr(strwin, 3, 5, text);
}
}
wnoutrefresh(strwin);
}
if (level > 1) {
delwin(txtwin);
delwin(txtbox);
}
return TRUE;
}
int
main(int argc, char *argv[])
{
WINDOW *chrbox;
WINDOW *chrwin;
WINDOW *strwin;
setlocale(LC_ALL, "");
if (argc < 2) {
fprintf(stderr, "usage: %s file\n", argv[0]);
return EXIT_FAILURE;
}
initscr();
chrbox = derwin(stdscr, BASE_Y, COLS, 0, 0);
box(chrbox, 0, 0);
wnoutrefresh(chrbox);
chrwin = derwin(chrbox, 1, COLS - 2, 1, 1);
strwin = derwin(chrbox, 4, COLS - 2, 2, 1);
test_inchs(1, argv, chrwin, strwin);
endwin();
ExitProgram(EXIT_SUCCESS);
}
ncurses-5.9-20140118/test/knight.c 0000644 0001751 0000144 00000045047 12107761644 015117 0 ustar tom users /****************************************************************************
* Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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. *
****************************************************************************/
/*
* Knight's Tour - a brain game
*
* The original of this game was anonymous. It had an unbelievably bogus
* interface, you actually had to enter square coordinates! Redesign by
* 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 $
*/
#include
/* board size */
#define BDEPTH 8
#define BWIDTH 8
/* where to start the instructions */
#define INSTRY 2
#define INSTRX 35
/* corner of board */
#define BOARDY 2
#define BOARDX 0
/* notification line */
#define NOTIFYY 21
/* virtual color values */
#define TRAIL_COLOR 1
#define PLUS_COLOR 2
#define MINUS_COLOR 3
#define CX(x) (2 + 4 * (x))
#define CY(y) (1 + 2 * (y))
#define cellmove(y, x) wmove(boardwin, CY(y), CX(x))
#define CXINV(x) (((x) - 1) / 4)
#define CYINV(y) (((y) - 2) / 2)
typedef struct {
short x, y;
} cell;
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 */
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 */
/* *INDENT-OFF* */
static const struct {
int y;
int x;
} offsets[] = {
{ 2, 1 },
{ 1, 2 },
{ -1, 2 },
{ -2, 1 },
{ -2, -1 },
{ -1, -2 },
{ 1, -2 },
{ 2, -1 },
};
/* *INDENT-ON* */
static void
init_program(void)
{
setlocale(LC_ALL, "");
srand((unsigned) getpid());
initscr();
cbreak(); /* immediate char return */
noecho(); /* no immediate echo */
boardwin = newwin(BDEPTH * 2 + 1, BWIDTH * 4 + 1, BOARDY, BOARDX);
helpwin = newwin(0, 0, INSTRY, INSTRX);
msgwin = newwin(1, INSTRX - 1, NOTIFYY, 0);
scrollok(msgwin, TRUE);
keypad(boardwin, TRUE);
if (has_colors()) {
int bg = COLOR_BLACK;
start_color();
#if HAVE_USE_DEFAULT_COLORS
if (use_default_colors() == OK)
bg = -1;
#endif
(void) init_pair(TRAIL_COLOR, (short) COLOR_CYAN, (short) bg);
(void) init_pair(PLUS_COLOR, (short) COLOR_RED, (short) bg);
(void) init_pair(MINUS_COLOR, (short) COLOR_GREEN, (short) bg);
trail |= (chtype) COLOR_PAIR(TRAIL_COLOR);
plus |= (chtype) COLOR_PAIR(PLUS_COLOR);
minus |= (chtype) COLOR_PAIR(MINUS_COLOR);
}
#ifdef NCURSES_MOUSE_VERSION
(void) mousemask(BUTTON1_CLICKED, (mmask_t *) NULL);
#endif /* NCURSES_MOUSE_VERSION */
#if defined(PDCURSES)
mouse_set(BUTTON1_RELEASED);
#endif
oldch = minus;
}
static void
help1(void)
/* game explanation -- initial help screen */
{
(void) waddstr(helpwin, "Knight's move is a solitaire puzzle. Your\n");
(void) waddstr(helpwin, "objective is to visit each square of the \n");
(void) waddstr(helpwin, "chessboard exactly once by making knight's\n");
(void) waddstr(helpwin, "moves (one square right or left followed \n");
(void) waddstr(helpwin, "by two squares up or down, or two squares \n");
(void) waddstr(helpwin, "right or left followed by one square up or\n");
(void) waddstr(helpwin, "down). You may start anywhere.\n\n");
(void) waddstr(helpwin, "Use arrow keys to move the cursor around.\n");
(void) waddstr(helpwin, "When you want to move your knight to the \n");
(void) waddstr(helpwin, "cursor location, press or Enter.\n");
(void) waddstr(helpwin, "Illegal moves will be rejected with an \n");
(void) waddstr(helpwin, "audible beep.\n\n");
(void) waddstr(helpwin, "The program will detect if you solve the\n");
(void) waddstr(helpwin, "puzzle; also inform you when you run out\n");
(void) waddstr(helpwin, "of legal moves.\n\n");
MvWAddStr(helpwin, NOTIFYY - INSTRY, 0,
"Press `?' to go to keystroke help.");
}
static void
help2(void)
/* keystroke help screen */
{
(void) waddstr(helpwin, "Possible moves are shown with `-'.\n\n");
(void) waddstr(helpwin, "You can move around with the arrow keys or\n");
(void) waddstr(helpwin, "with the rogue/hack movement keys. Other\n");
(void) waddstr(helpwin, "commands allow you to undo moves or redraw.\n");
(void) waddstr(helpwin, "Your mouse may work; try left-button to\n");
(void) waddstr(helpwin, "move to the square under the pointer.\n\n");
(void) waddstr(helpwin, "x,q -- exit y k u 7 8 9\n");
(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");
(void) waddstr(helpwin, "\nYou can place your knight on the selected\n");
(void) waddstr(helpwin, "square with spacebar, Enter, or the keypad\n");
(void) waddstr(helpwin, "center key. Use F/B to review the path.\n");
MvWAddStr(helpwin, NOTIFYY - INSTRY, 0,
"Press `?' to go to game explanation");
}
static void
show_help(bool * keyhelp)
{
werase(helpwin);
if (*keyhelp) {
help1();
*keyhelp = FALSE;
} else {
help2();
*keyhelp = TRUE;
}
wrefresh(helpwin);
}
static bool
chksqr(int r1, int c1)
{
if ((r1 < 0) || (r1 > BDEPTH - 1))
return (FALSE);
if ((c1 < 0) || (c1 > BWIDTH - 1))
return (FALSE);
return ((!board[r1][c1]) ? TRUE : FALSE);
}
static bool
chkmoves(int rw, int col)
/* check to see if valid moves are available */
{
unsigned n;
for (n = 0; n < SIZEOF(offsets); n++)
if (chksqr(rw + offsets[n].y, col + offsets[n].x))
return (TRUE);
return (FALSE);
}
static void
dosquares(void)
{
int i, j;
MvAddStr(0, 20, "KNIGHT'S MOVE -- a logical solitaire");
move(BOARDY, BOARDX);
waddch(boardwin, ACS_ULCORNER);
for (j = 0; j < 7; j++) {
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_TTEE);
}
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_URCORNER);
for (i = 1; i < BDEPTH; i++) {
move(BOARDY + i * 2 - 1, BOARDX);
waddch(boardwin, ACS_VLINE);
for (j = 0; j < BWIDTH; j++) {
waddch(boardwin, ' ');
waddch(boardwin, ' ');
waddch(boardwin, ' ');
waddch(boardwin, ACS_VLINE);
}
move(BOARDY + i * 2, BOARDX);
waddch(boardwin, ACS_LTEE);
for (j = 0; j < BWIDTH - 1; j++) {
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_PLUS);
}
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_RTEE);
}
move(BOARDY + i * 2 - 1, BOARDX);
waddch(boardwin, ACS_VLINE);
for (j = 0; j < BWIDTH; j++) {
waddch(boardwin, ' ');
waddch(boardwin, ' ');
waddch(boardwin, ' ');
waddch(boardwin, ACS_VLINE);
}
move(BOARDY + i * 2, BOARDX);
waddch(boardwin, ACS_LLCORNER);
for (j = 0; j < BWIDTH - 1; j++) {
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_BTEE);
}
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_HLINE);
waddch(boardwin, ACS_LRCORNER);
}
static void
mark_possibles(int prow, int pcol, 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);
waddch(boardwin, mark);
}
}
}
static bool
find_next_move(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 (first < 0)
first = (int) k;
if (newy == *y
&& newx == *x) {
found = (int) k;
} else if (found >= 0) {
next = (int) k;
break;
}
}
}
if (found < 0)
next = first;
if (next >= 0) {
*y = oldy + offsets[next].y;
*x = oldx + offsets[next].x;
}
result = TRUE;
}
return result;
}
static void
count_next_moves(int y, int x)
{
int count = 0;
unsigned j;
wprintw(msgwin, "\nMove %d", movecount);
for (j = 0; j < SIZEOF(offsets); j++) {
int newy = y + offsets[j].y;
int newx = x + offsets[j].x;
if (chksqr(newy, newx)) {
++count;
}
}
wprintw(msgwin, ", gives %d choices", count);
wclrtoeol(msgwin);
}
static void
unmarkcell(int row, int column)
{
cellmove(row, column);
waddch(boardwin, '\b');
waddch(boardwin, ' ');
waddch(boardwin, minus);
waddch(boardwin, ' ');
}
static void
markcell(chtype tchar, int row, int column)
{
cellmove(row, column);
waddch(boardwin, '\b');
waddch(boardwin, tchar);
waddch(boardwin, tchar);
waddch(boardwin, tchar);
}
static void
drawmove(chtype tchar, int oldy, int oldx, int row, int column)
/* place the stars, update board & currents */
{
if (movecount <= 1) {
int i, j;
for (i = 0; i < BDEPTH; i++) {
for (j = 0; j < BWIDTH; j++) {
if (movecount == 0) {
unmarkcell(i, j);
} else {
cellmove(i, j);
if (winch(boardwin) == minus)
waddch(boardwin, movecount ? ' ' : minus);
}
}
}
} else {
markcell(tchar, oldy, oldx);
mark_possibles(oldy, oldx, ' ');
}
if (row >= 0 && column >= 0) {
markcell(trail, row, column);
mark_possibles(row, column, minus);
board[row][column] = TRUE;
}
wprintw(msgwin, "\nMove %d", movecount);
if (trialcount != movecount)
wprintw(msgwin, " (%d tries)", trialcount);
wclrtoeol(msgwin);
}
static int
iabs(int num)
{
if (num < 0)
return (-num);
else
return (num);
}
static bool
evalmove(int row, int column)
/* evaluate move */
{
if (movecount == 1)
return (TRUE);
else if (board[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);
if (!((rdif == 1) && (cdif == 2)) && !((rdif == 2) && (cdif == 1))) {
waddstr(msgwin, "\nThat's not a legal knight's move.");
return (FALSE);
}
}
return (TRUE);
}
static int
completed(void)
{
int i, j, count = 0;
for (i = 0; i < BDEPTH; i++)
for (j = 0; j < BWIDTH; j++)
if (board[i][j] != 0)
count += 1;
return (count == (BWIDTH * BDEPTH) ? -1 : count);
}
static void
no_previous_move(void)
{
waddstr(msgwin, "\nNo previous move.");
beep();
}
static void
play(void)
/* play the game */
{
bool keyhelp; /* TRUE if keystroke help is up */
int i, j, count;
int lastcol = 0; /* last location visited */
int lastrow = 0;
int ny = 0, nx = 0;
int review = 0; /* review history */
int rw = 0, col = 0; /* current row and column */
do {
/* clear screen and draw board */
werase(boardwin);
werase(helpwin);
werase(msgwin);
dosquares();
help1();
wnoutrefresh(stdscr);
wnoutrefresh(helpwin);
wnoutrefresh(msgwin);
wnoutrefresh(boardwin);
doupdate();
movecount = 0;
for (i = 0; i < BDEPTH; i++) {
for (j = 0; j < BWIDTH; j++) {
board[i][j] = FALSE;
unmarkcell(i, j);
}
}
memset(history, 0, sizeof(history));
history[0].y = history[0].x = -1;
history[1].y = history[1].x = -1;
lastrow = lastcol = -2;
movecount = 1;
trialcount = 1;
keyhelp = FALSE;
show_help(&keyhelp);
for (;;) {
if (rw != lastrow || col != lastcol) {
if (lastrow >= 0 && lastcol >= 0) {
cellmove(lastrow, lastcol);
if (board[lastrow][lastcol])
waddch(boardwin, trail);
else
waddch(boardwin, oldch);
}
cellmove(rw, col);
oldch = winch(boardwin);
lastrow = rw;
lastcol = col;
}
cellmove(rw, col);
waddch(boardwin, plus);
cellmove(rw, col);
wrefresh(msgwin);
switch (wgetch(boardwin)) {
case 'k':
case '8':
case KEY_UP:
ny = rw + BDEPTH - 1;
nx = col;
break;
case 'j':
case '2':
case KEY_DOWN:
ny = rw + 1;
nx = col;
break;
case 'h':
case '4':
case KEY_LEFT:
ny = rw;
nx = col + BWIDTH - 1;
break;
case 'l':
case '6':
case KEY_RIGHT:
ny = rw;
nx = col + 1;
break;
case 'y':
case '7':
case KEY_A1:
ny = rw + BDEPTH - 1;
nx = col + BWIDTH - 1;
break;
case 'b':
case '1':
case KEY_C1:
ny = rw + 1;
nx = col + BWIDTH - 1;
break;
case 'u':
case '9':
case KEY_A3:
ny = rw + BDEPTH - 1;
nx = col + 1;
break;
case 'n':
case '3':
case KEY_C3:
ny = rw + 1;
nx = col + 1;
break;
#ifdef KEY_MOUSE
case KEY_MOUSE:
#ifdef NCURSES_MOUSE_VERSION
{
MEVENT myevent;
getmouse(&myevent);
if (myevent.y >= CY(0) && myevent.y <= CY(BDEPTH)
&& myevent.x >= CX(0) && myevent.x <= CX(BWIDTH)) {
nx = CXINV(myevent.x);
ny = CYINV(myevent.y);
ungetch('\n');
break;
} else {
beep();
continue;
}
}
#endif /* NCURSES_MOUSE_VERSION */
#ifdef PDCURSES
{
int test_y, test_x;
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)) {
ny = CYINV(test_y);
nx = CXINV(test_x);
wmove(helpwin, 0, 0);
wrefresh(helpwin);
ungetch('\n');
}
break;
}
#endif /* PDCURSES */
#endif /* KEY_MOUSE */
case KEY_B2:
case '\n':
case ' ':
review = 0;
if (evalmove(rw, col)) {
drawmove(trail,
history[movecount - 1].y,
history[movecount - 1].x,
rw, col);
history[movecount].y = (short) rw;
history[movecount].x = (short) col;
movecount++;
trialcount++;
if (!chkmoves(rw, col)) {
if (completed() < 0) {
waddstr(msgwin, "\nYou won.");
} else {
waddstr(msgwin,
"\nNo further moves are possible.");
}
}
} else {
beep();
}
break;
case KEY_UNDO:
case KEY_BACKSPACE:
case '\b':
review = 0;
if (movecount <= 0) {
no_previous_move();
} else if (movecount <= 1) {
ny = history[movecount].y;
nx = history[movecount].x;
if (nx < 0 || ny < 0) {
ny = (lastrow >= 0) ? lastrow : 0;
nx = (lastcol >= 0) ? lastcol : 0;
}
movecount = 0;
board[ny][nx] = FALSE;
oldch = minus;
drawmove(' ', ny, nx, -1, -1);
movecount = 1;
trialcount = 1;
no_previous_move();
} else {
int oldy = history[movecount - 1].y;
int oldx = history[movecount - 1].x;
if (!board[rw][col]) {
cellmove(rw, col);
waddch(boardwin, ' ');
}
board[oldy][oldx] = FALSE;
--movecount;
ny = history[movecount - 1].y;
nx = history[movecount - 1].x;
if (nx < 0 || ny < 0) {
ny = oldy;
nx = oldx;
}
drawmove(' ', oldy, oldx, ny, nx);
/* avoid problems if we just changed the current cell */
cellmove(lastrow, lastcol);
oldch = winch(boardwin);
}
break;
case 'a':
nx = col;
ny = rw;
if (find_next_move(&ny, &nx))
count_next_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();
}
break;
case 'B':
if (review < movecount - 2) {
review++;
ny = history[movecount - review - 1].y;
nx = history[movecount - review - 1].x;
} else {
beep();
}
break;
case KEY_REDO:
case '\f':
case 'r':
clearok(curscr, TRUE);
wnoutrefresh(stdscr);
wnoutrefresh(boardwin);
wnoutrefresh(msgwin);
wnoutrefresh(helpwin);
doupdate();
break;
case 'q':
case 'x':
goto dropout;
case '?':
show_help(&keyhelp);
break;
default:
beep();
break;
}
col = nx % BWIDTH;
rw = ny % BDEPTH;
}
dropout:
if ((count = completed()) < 0)
wprintw(msgwin, "\nYou won. Care to try again? ");
else
wprintw(msgwin, "\n%d squares filled. Try again? ", count);
wclrtoeol(msgwin);
} while
(tolower(wgetch(msgwin)) == 'y');
}
int
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
init_program();
play();
endwin();
ExitProgram(EXIT_SUCCESS);
}
/* knight.c ends here */
ncurses-5.9-20140118/test/test_vidputs.c 0000644 0001751 0000144 00000007663 12221656001 016355 0 ustar tom users /****************************************************************************
* Copyright (c) 2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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_vidputs.c,v 1.4 2013/09/28 22:45:21 tom Exp $
*
* Demonstrate the vidputs and vidattr functions.
* Thomas Dickey - 2013/01/12
*/
#define USE_TINFO
#include
#if HAVE_SETUPTERM
#define valid(s) ((s != 0) && s != (char *)-1)
static FILE *my_fp;
static bool p_opt = FALSE;
static
TPUTS_PROTO(outc, c)
{
int rc = c;
rc = putc(c, my_fp);
TPUTS_RETURN(rc);
}
static bool
outs(const char *s)
{
if (valid(s)) {
tputs(s, 1, outc);
return TRUE;
}
return FALSE;
}
static void
cleanup(void)
{
outs(exit_attribute_mode);
if (!outs(orig_colors))
outs(orig_pair);
outs(cursor_normal);
}
static void
change_attr(chtype attr)
{
if (p_opt) {
vidputs(attr, outc);
} else {
vidattr(attr);
}
}
static void
test_vidputs(void)
{
fprintf(my_fp, "Name: ");
change_attr(A_BOLD);
fputs("Bold", my_fp);
change_attr(A_REVERSE);
fputs(" Reverse", my_fp);
change_attr(A_NORMAL);
fputs("\n", my_fp);
}
static void
usage(void)
{
static const char *tbl[] =
{
"Usage: test_vidputs [options]"
,""
,"Options:"
," -e use stderr (default stdout)"
," -p use vidputs (default vidattr)"
};
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;
my_fp = stdout;
while ((ch = getopt(argc, argv, "ep")) != -1) {
switch (ch) {
case 'e':
my_fp = stderr;
break;
case 'p':
p_opt = TRUE;
break;
default:
usage();
break;
}
}
if (optind < argc)
usage();
setupterm((char *) 0, 1, (int *) 0);
test_vidputs();
cleanup();
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
ncurses-5.9-20140118/test/railroad.c 0000644 0001751 0000144 00000013251 12221650751 015411 0 ustar tom users /****************************************************************************
* Copyright (c) 2000-2011,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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 - 2000
*
* $Id: railroad.c,v 1.21 2013/09/28 22:02:17 tom Exp $
*
* A simple demo of the termcap interface.
*/
#define USE_TINFO
#include
#if HAVE_TGETENT
static char *wipeit;
static char *moveit;
static int length;
static int height;
static char *finisC;
static char *finisS;
static char *finisU;
static char *startC;
static char *startS;
static char *startU;
static char *backup;
static bool interrupted = FALSE;
static
TPUTS_PROTO(outc, c)
{
int rc = OK;
if (interrupted) {
char tmp = (char) c;
if (write(STDOUT_FILENO, &tmp, (size_t) 1) == -1)
rc = ERR;
} else {
if (putc(c, stdout) == EOF)
rc = ERR;
}
TPUTS_RETURN(rc);
}
static void
PutChar(int ch)
{
putchar(ch);
fflush(stdout);
napms(moveit ? 10 : 50); /* not really termcap... */
}
static void
Backup(void)
{
tputs(backup != 0 ? backup : "\b", 1, outc);
}
static void
MyShowCursor(int flag)
{
if (startC != 0 && finisC != 0) {
tputs(flag ? startC : finisC, 1, outc);
}
}
static void
StandOut(int flag)
{
if (startS != 0 && finisS != 0) {
tputs(flag ? startS : finisS, 1, outc);
}
}
static void
Underline(int flag)
{
if (startU != 0 && finisU != 0) {
tputs(flag ? startU : finisU, 1, outc);
}
}
static void
ShowSign(char *string)
{
char *base = string;
int ch, first, last;
if (moveit != 0) {
tputs(tgoto(moveit, 0, height - 1), 1, outc);
tputs(wipeit, 1, outc);
}
while (*string != 0) {
ch = *string;
if (ch != ' ') {
if (moveit != 0) {
for (first = length - 2; first >= (string - base); first--) {
if (first < length - 1) {
tputs(tgoto(moveit, first + 1, height - 1), 1, outc);
PutChar(' ');
}
tputs(tgoto(moveit, first, height - 1), 1, outc);
PutChar(ch);
}
} else {
last = ch;
if (isalpha(ch)) {
first = isupper(ch) ? 'A' : 'a';
} else if (isdigit(ch)) {
first = '0';
} else {
first = ch;
}
if (first < last) {
Underline(1);
while (first < last) {
PutChar(first);
Backup();
first++;
}
Underline(0);
}
}
if (moveit != 0)
Backup();
}
StandOut(1);
PutChar(ch);
StandOut(0);
fflush(stdout);
string++;
}
if (moveit != 0)
tputs(wipeit, 1, outc);
putchar('\n');
}
static void
cleanup(void)
{
Underline(0);
StandOut(0);
MyShowCursor(1);
}
static void
onsig(int n GCC_UNUSED)
{
interrupted = TRUE;
cleanup();
ExitProgram(EXIT_FAILURE);
}
static void
railroad(char **args)
{
NCURSES_CONST char *name = getenv("TERM");
char buffer[1024];
char area[1024], *ap = area;
if (name == 0)
name = "dumb";
if (tgetent(buffer, name) >= 0) {
wipeit = tgetstr("ce", &ap);
height = tgetnum("li");
length = tgetnum("co");
moveit = tgetstr("cm", &ap);
if (wipeit == 0
|| moveit == 0
|| height <= 0
|| length <= 0) {
wipeit = 0;
moveit = 0;
height = 0;
length = 0;
}
startS = tgetstr("so", &ap);
finisS = tgetstr("se", &ap);
startU = tgetstr("us", &ap);
finisU = tgetstr("ue", &ap);
backup = tgetstr("le", &ap);
startC = tgetstr("ve", &ap);
finisC = tgetstr("vi", &ap);
MyShowCursor(0);
CATCHALL(onsig);
while (*args) {
ShowSign(*args++);
}
MyShowCursor(1);
}
}
int
main(int argc, char *argv[])
{
if (argc > 1) {
railroad(argv + 1);
} else {
static char world[] = "Hello World";
static char *hello[] =
{world, 0};
railroad(hello);
}
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(int argc GCC_UNUSED,
char *argv[]GCC_UNUSED)
{
printf("This program requires termcap\n");
exit(EXIT_FAILURE);
}
#endif
ncurses-5.9-20140118/test/insdelln.c 0000644 0001751 0000144 00000022243 12052026746 015430 0 ustar tom users /****************************************************************************
* Copyright (c) 2008-2010,2012 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: insdelln.c,v 1.7 2012/11/18 00:37:58 tom Exp $
*
* test-driver for deleteln, wdeleteln, insdelln, winsdelln, insertln, winsertln
*/
#include
#define SHOW(n) ((n) == ERR ? "ERR" : "OK")
#define COLOR_DEFAULT (-1)
typedef struct {
unsigned c;
unsigned v;
int pair;
unsigned attr;
int count;
int ch;
const char *c_msg;
const char *v_msg;
int y_val;
int x_val;
int y_beg, x_beg;
int y_max, x_max;
} STATUS;
static const char *
color_params(unsigned state, int *pair)
{
/* *INDENT-OFF* */
static struct {
short pair;
short fg, bg;
const char *msg;
} table[] = {
{ 0, COLOR_DEFAULT, COLOR_DEFAULT, "default" },
{ 1, COLOR_RED, COLOR_BLACK, "red/black" },
{ 2, COLOR_WHITE, COLOR_BLUE, "white/blue" },
};
/* *INDENT-ON* */
static bool first = TRUE;
const char *result = 0;
if (has_colors()) {
if (first) {
unsigned n;
start_color();
for (n = 0; n < SIZEOF(table); ++n) {
init_pair(table[n].pair, table[n].fg, table[n].bg);
}
}
if (state < SIZEOF(table)) {
*pair = table[state].pair;
result = table[state].msg;
}
}
return result;
}
static const char *
video_params(unsigned state, unsigned *attr)
{
/* *INDENT-OFF* */
static struct {
unsigned attr;
const char *msg;
} table[] = {
{ A_NORMAL, "normal" },
{ A_BOLD, "bold" },
{ A_REVERSE, "reverse" },
{ A_UNDERLINE, "underline" },
{ A_BLINK, "blink" },
};
/* *INDENT-ON* */
const char *result = 0;
if (state < SIZEOF(table)) {
*attr = table[state].attr;
result = table[state].msg;
}
return result;
}
/* fill the window with a test-pattern */
static void
fill_window(WINDOW *win)
{
int y, x;
int y0 = -1, x0 = -1;
getyx(win, y, x);
wmove(win, 0, 0);
while (waddstr(win, "0123456789 abcdefghijklmnopqrstuvwxyz ") != ERR) {
int y1, x1;
getyx(win, y1, x1);
if (y1 == y0 && x1 == x0)
break;
x0 = x1;
y0 = y1;
}
wmove(win, y, x);
}
static void
show_status(WINDOW *win, STATUS * sp)
{
int y, x;
getyx(win, y, x);
wmove(win, 0, 0);
wprintw(win, "Count %d", sp->count);
if (sp->v_msg != 0)
wprintw(win, " Video %s", sp->v_msg);
if (sp->c_msg != 0)
wprintw(win, " Color %s", sp->c_msg);
wclrtoeol(win);
wmove(win, y, x);
}
static void
reshow_status(WINDOW *win, STATUS * sp)
{
fill_window(win);
show_status(win, sp);
}
static void
do_subwindow(WINDOW *win, STATUS * sp, void func(WINDOW *))
{
WINDOW *win1 = newwin(sp->y_max - 2, sp->x_max - 2,
sp->y_beg + 1, sp->x_beg + 1);
if (win1 != 0 && sp->y_max > 4 && sp->x_max > 4) {
WINDOW *win2 = derwin(win1, sp->y_max - 4, sp->x_max - 4, 1, 1);
if (win2 != 0) {
box(win1, 0, 0);
wrefresh(win1);
func(win2);
delwin(win2);
} else {
beep();
}
delwin(win1);
touchwin(win);
} else {
if (win1)
delwin(win1);
beep();
}
}
static void
init_status(WINDOW *win, STATUS * sp)
{
memset(sp, 0, sizeof(*sp));
sp->c = 99;
sp->v = 99;
sp->ch = ' ';
keypad(win, TRUE);
fill_window(win);
getbegyx(win, sp->y_beg, sp->x_beg);
getmaxyx(win, sp->y_max, sp->x_max);
}
static void
show_help(WINDOW *win)
{
static const char *table[] =
{
"Basic commands:"
,"Use h/j/k/l or arrow keys to move the cursor."
,"Set the count parameter for insert/delete by entering digits 0-9."
,""
,"Other commands:"
,"space toggles through the set of video attributes and colors."
,"t touches (forces repaint) of the current line."
,"i calls insertln at the current position with the given count."
,"d calls deleteln at the window beginning with the given count."
,"I calls insdelln at the window beginning with the given count."
,"D calls insdelln at the window beginning with the given -count."
,"f refills the window with test-pattern using current attributes."
,"w recur to test windows other than stdscr"
,"q quit"
,"= resets count to zero."
,"? shows this help-window"
,""
,""
};
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();
}
static void
update_status(WINDOW *win, STATUS * sp)
{
switch (sp->ch) {
case ' ': /* next test-iteration */
if (has_colors()) {
if ((sp->c_msg = color_params(++(sp->c), &(sp->pair))) == 0) {
sp->c_msg = color_params(sp->c = 0, &(sp->pair));
if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == 0) {
sp->v_msg = video_params(sp->v = 0, &(sp->attr));
}
}
} else {
if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == 0) {
sp->v_msg = video_params(sp->v = 0, &(sp->attr));
}
}
sp->count = 0;
show_status(win, sp);
break;
case KEY_LEFT:
case 'h':
if (sp->x_val > 0)
wmove(win, sp->y_val, --(sp->x_val));
break;
case KEY_DOWN:
case 'j':
if (sp->y_val < sp->y_max)
wmove(win, ++(sp->y_val), sp->x_val);
break;
case KEY_UP:
case 'k':
if (sp->y_val > 0)
wmove(win, --(sp->y_val), sp->x_val);
break;
case KEY_RIGHT:
case 'l':
if (sp->x_val < sp->x_max)
wmove(win, sp->y_val, ++(sp->x_val));
break;
case 't':
touchline(win, sp->y_val, 1);
break;
case '=':
sp->count = 0;
show_status(win, sp);
break;
case '?':
do_subwindow(win, sp, show_help);
break;
default:
if (isdigit(sp->ch)) {
sp->count = (sp->count * 10) + (sp->ch - '0');
show_status(win, sp);
} else {
beep();
}
break;
}
}
static void
test_winsdelln(WINDOW *win)
{
STATUS st;
int n;
init_status(win, &st);
do {
(void) wattrset(win, (int) (st.attr | (attr_t) COLOR_PAIR(st.pair)));
switch (st.ch) {
case 'i':
for (n = 0; n < st.count; ++n)
winsertln(win);
break;
case 'd':
for (n = 0; n < st.count; ++n)
wdeleteln(win);
break;
case 'I':
winsdelln(win, st.count);
break;
case 'D':
winsdelln(win, -st.count);
break;
case 'f':
fill_window(win);
reshow_status(win, &st);
break;
case 'w':
do_subwindow(win, &st, test_winsdelln);
break;
case 'q':
return;
default:
update_status(win, &st);
break;
}
} while ((st.ch = wgetch(win)) != ERR);
}
static void
test_insdelln(void)
{
STATUS st;
int n;
init_status(stdscr, &st);
do {
(void) attrset(st.attr | (attr_t) COLOR_PAIR(st.pair));
switch (st.ch) {
case 'i':
for (n = 0; n < st.count; ++n)
insertln();
break;
case 'd':
for (n = 0; n < st.count; ++n)
deleteln();
break;
case 'I':
insdelln(st.count);
break;
case 'D':
insdelln(-st.count);
break;
case 'f':
fill_window(stdscr);
reshow_status(stdscr, &st);
break;
case 'w':
do_subwindow(stdscr, &st, test_winsdelln);
break;
case 'q':
return;
default:
update_status(stdscr, &st);
break;
}
} while ((st.ch = getch()) != ERR);
}
int
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
initscr();
cbreak();
noecho();
test_insdelln();
endwin();
ExitProgram(EXIT_SUCCESS);
}
ncurses-5.9-20140118/test/demo_forms.c 0000644 0001751 0000144 00000036072 12221650152 015747 0 ustar tom users /****************************************************************************
* Copyright (c) 2003-2012,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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_forms.c,v 1.46 2013/09/28 21:55:54 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 -
field_term -
form_init -
form_opts -
form_opts_off -
form_opts_on -
form_request_by_name -
form_term -
form_userptr -
free_fieldtype -
link_field -
link_fieldtype -
move_field -
new_page -
pos_form_cursor -
set_field_init -
set_field_term -
set_fieldtype_arg -
set_fieldtype_choice -
set_form_fields -
set_form_init -
set_form_opts -
set_form_page -
set_form_term -
set_form_userptr -
set_max_field -
*/
#include
#if USE_LIBFORM
#include
typedef struct {
char *name;
char *value;
} MY_DATA;
static MY_DATA *my_data;
static int d_option = 0;
static int j_value = 0;
static int m_value = 0;
static int o_value = 0;
static char *t_value = 0;
static void
failed(const char *s)
{
perror(s);
ExitProgram(EXIT_FAILURE);
}
static void
chomp(char *value)
{
size_t have = strlen(value);
while (have != 0 && (value[have - 1] == '\n' || value[have - 1] == '\r')) {
value[--have] = '\0';
}
}
static int
trimmed(const char *value)
{
int result = (int) strlen(value);
while (result > 0 && isspace(UChar(value[result - 1]))) {
--result;
}
return result;
}
static char *
get_data(const char *name)
{
char *result = t_value;
if (my_data != 0) {
int n;
for (n = 0; my_data[n].name != 0; ++n) {
if (!strcmp(name, my_data[n].name)) {
result = my_data[n].value;
break;
}
}
}
return result;
}
/*
* Read (possibly) multi-line data with name+value pairs.
*/
static void
read_data(const char *filename)
{
FILE *fp = fopen(filename, "r");
if (fp != 0) {
char buffer[BUFSIZ];
char *colon;
int more = 0;
int item = 0;
my_data = typeCalloc(MY_DATA, (size_t) 100); /* FIXME */
while (fgets(buffer, sizeof(buffer), fp) != 0) {
chomp(buffer);
if (more) {
if (strcmp(buffer, ".")) {
char *prior = my_data[more - 1].value;
size_t need = strlen(buffer) + 2 + strlen(prior);
char *value = typeRealloc(char, need, prior);
if (value == 0)
failed("realloc");
strcat(value, "\n");
strcat(value, buffer);
my_data[more - 1].value = value;
} else {
more = 0;
}
} else if (*buffer == '#') {
continue;
} else if ((colon = strchr(buffer, ':')) != 0) {
char *name;
char *value;
*colon++ = '\0';
name = strdup(buffer);
value = strdup(colon);
if (name == 0 || value == 0)
failed("strdup");
my_data[item].name = name;
my_data[item].value = value;
more = ++item;
} else {
failed("expected a colon");
}
}
} else {
failed(filename);
}
}
static FIELD *
make_label(const char *label, int frow, int fcol)
{
FIELD *f = new_field(1, (int) strlen(label), frow, fcol, 0, 0);
if (f) {
set_field_buffer(f, 0, label);
set_field_opts(f, (int) ((unsigned) field_opts(f) & ~O_ACTIVE));
}
return (f);
}
/*
* Define each field with an extra one, for reflecting "actual" text.
*/
static FIELD *
make_field(const char *label, int frow, int fcol, int rows, int cols)
{
FIELD *f = new_field(rows, cols, frow, fcol, o_value, 1);
if (f) {
set_field_back(f, A_UNDERLINE);
/*
* If -j and -d options are combined, -j loses. It is documented in
* "Character User Interface Programming", page 12-15 that setting
* O_STATIC off makes the form library ignore justification.
*/
set_field_just(f, j_value);
if (d_option) {
if (has_colors()) {
set_field_fore(f, (chtype) COLOR_PAIR(2));
set_field_back(f, A_UNDERLINE | COLOR_PAIR(3));
} else {
set_field_fore(f, A_BOLD);
}
/*
* The field_opts_off() call dumps core with Solaris curses,
* but that is a known bug in Solaris' form library -TD
*/
field_opts_off(f, O_STATIC);
set_max_field(f, m_value);
}
init_edit_field(f, get_data(label));
}
return (f);
}
static void
display_form(FORM * f)
{
WINDOW *w;
int rows, cols;
scale_form(f, &rows, &cols);
/*
* Put the form at the upper-left corner of the display, with just a box
* around it.
*/
if ((w = newwin(rows + 2, cols + 4, 0, 0)) != (WINDOW *) 0) {
set_form_win(f, w);
set_form_sub(f, derwin(w, rows, cols, 1, 2));
box(w, 0, 0);
keypad(w, TRUE);
if (post_form(f) != E_OK)
wrefresh(w);
}
}
static void
erase_form(FORM * f)
{
WINDOW *w = form_win(f);
WINDOW *s = form_sub(f);
unpost_form(f);
werase(w);
wrefresh(w);
delwin(s);
delwin(w);
}
static void
show_insert_mode(bool insert_mode)
{
MvAddStr(5, 57, (insert_mode
? "form_status: insert "
: "form_status: overlay"));
}
#define O_SELECTABLE (O_ACTIVE | O_VISIBLE)
static FIELD *
another_field(FORM * form, FIELD * field)
{
FIELD **f = form_fields(form);
FIELD *result = 0;
int n;
for (n = 0; f[n] != 0; ++n) {
if (f[n] != field) {
result = f[n];
field_opts_on(result, O_SELECTABLE);
break;
}
}
return result;
}
static int
my_form_driver(FORM * form, int c)
{
static bool insert_mode = TRUE;
FIELD *field;
switch (c) {
case MY_QUIT:
if (form_driver(form, REQ_VALIDATION) == E_OK)
return (TRUE);
break;
case MY_HELP:
help_edit_field();
break;
case MY_EDT_MODE:
if ((field = current_field(form)) != 0) {
set_current_field(form, another_field(form, field));
if ((unsigned) field_opts(field) & O_EDIT) {
field_opts_off(field, O_EDIT);
set_field_status(field, 0);
} else {
field_opts_on(field, O_EDIT);
}
set_current_field(form, field);
}
break;
case MY_INS_MODE:
/* there should be a form_status() function, but there is none */
if (!insert_mode) {
if (form_driver(form, REQ_INS_MODE) == E_OK) {
insert_mode = TRUE;
}
} else {
if (form_driver(form, REQ_OVL_MODE) == E_OK) {
insert_mode = FALSE;
}
}
show_insert_mode(insert_mode);
refresh();
break;
default:
beep();
break;
}
return (FALSE);
}
static void
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;
if (has_colors()) {
wbkgd(win, (chtype) COLOR_PAIR(1));
}
werase(win);
form_getyx(form, currow, curcol);
wprintw(win, "Cursor: %d,%d", currow, curcol);
if (data_ahead(form))
waddstr(win, " ahead");
if (data_behind(form))
waddstr(win, " behind");
waddch(win, '\n');
if ((field = current_field(form)) != 0) {
wprintw(win, "Page %d%s, Field %d/%d%s:",
form_page(form),
new_page(field) ? "*" : "",
field_index(field), field_count(form),
field_arg(field) ? "(arg)" : "");
if ((type = field_type(field)) != 0) {
if (type == TYPE_ALNUM)
waddstr(win, "ALNUM");
else if (type == TYPE_ALPHA)
waddstr(win, "ALPHA");
else if (type == TYPE_ENUM)
waddstr(win, "ENUM");
else if (type == TYPE_INTEGER)
waddstr(win, "INTEGER");
#ifdef NCURSES_VERSION
else if (type == TYPE_IPV4)
waddstr(win, "IPV4");
#endif
else if (type == TYPE_NUMERIC)
waddstr(win, "NUMERIC");
else if (type == TYPE_REGEXP)
waddstr(win, "REGEXP");
else
waddstr(win, "other");
}
if ((unsigned) field_opts(field) & O_EDIT)
waddstr(win, " editable");
else
waddstr(win, " readonly");
if (field_status(field))
waddstr(win, " modified");
if (dynamic_field_info(field, &field_rows, &field_cols, &field_max)
!= ERR) {
wprintw(win, " size %dx%d (max %d)",
field_rows, field_cols, field_max);
}
waddch(win, ' ');
(void) wattrset(win, (int) field_fore(field));
waddstr(win, "fore");
wattroff(win, (int) field_fore(field));
waddch(win, '/');
(void) wattrset(win, (int) field_back(field));
waddstr(win, "back");
wattroff(win, (int) field_back(field));
wprintw(win, ", pad '%c'", field_pad(field));
waddstr(win, "\n");
for (nbuf = 0; nbuf <= 2; ++nbuf) {
if ((buffer = field_buffer(field, nbuf)) != 0) {
wprintw(win, "buffer %d:", nbuf);
(void) wattrset(win, A_REVERSE);
if (nbuf) {
waddnstr(win, buffer, trimmed(buffer));
} else {
waddstr(win, buffer);
}
wattroff(win, A_REVERSE);
waddstr(win, "\n");
}
}
}
wrefresh(win);
}
static void
demo_forms(void)
{
WINDOW *w;
FORM *form;
FIELD *f[100]; /* will memset to zero */
int finished = 0, c;
unsigned n = 0;
int pg;
WINDOW *also;
const char *fname;
#ifdef NCURSES_MOUSE_VERSION
mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0);
#endif
help_edit_field();
MvAddStr(4, 57, "Forms Entry Test");
show_insert_mode(TRUE);
refresh();
/* describe the form */
memset(f, 0, sizeof(f));
for (pg = 0; pg < 4; ++pg) {
char label[80];
sprintf(label, "Sample Form Page %d", pg + 1);
f[n++] = make_label(label, 0, 15);
set_new_page(f[n - 1], TRUE);
switch (pg) {
default:
fname = "Last Name";
f[n++] = make_label(fname, 2, 0);
f[n++] = make_field(fname, 3, 0, 1, 18);
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);
set_field_type(f[n - 1], TYPE_ALPHA, 1);
fname = "Middle Name";
f[n++] = make_label(fname, 2, 34);
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);
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);
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);
set_field_pad(f[n - 1], '?');
set_field_type(f[n - 1], TYPE_ALPHA, 1);
break;
case 2:
fname = "Host Name";
f[n++] = make_label(fname, 2, 0);
f[n++] = make_field(fname, 3, 0, 1, 24);
set_field_type(f[n - 1], TYPE_ALNUM, 1);
#ifdef NCURSES_VERSION
fname = "IP Address";
f[n++] = make_label(fname, 2, 26);
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);
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);
set_field_type(f[n - 1], TYPE_NUMERIC, 3, -10000.0, 100000000.0);
break;
}
fname = "Comments";
f[n++] = make_label(fname, 5, 0);
f[n++] = make_field(fname, 6, 0, 4, 46);
init_edit_field(f[n - 1], get_data(fname));
}
f[n] = (FIELD *) 0;
if ((form = new_form(f)) != 0) {
display_form(form);
w = form_win(form);
also = newwin(getmaxy(stdscr) - getmaxy(w), COLS, getmaxy(w), 0);
show_current_field(also, form);
while (!finished) {
switch (edit_field(form, &c)) {
case E_OK:
break;
case E_UNKNOWN_COMMAND:
finished = my_form_driver(form, c);
break;
default:
beep();
break;
}
show_current_field(also, form);
}
erase_form(form);
free_form(form);
}
for (c = 0; f[c] != 0; c++) {
void *ptr = field_userptr(f[c]);
free(ptr);
free_field(f[c]);
}
noraw();
nl();
#ifdef NCURSES_MOUSE_VERSION
mousemask(0, (mmask_t *) 0);
#endif
}
static void
usage(void)
{
static const char *tbl[] =
{
"Usage: demo_forms [options] [data file]"
,""
," -d make fields dynamic"
," -j value justify (1=left, 2=center, 3=right)"
," -m value set maximum size of dynamic fields"
," -o value specify number of offscreen rows in new_field()"
," -t value specify text to fill fields initially"
};
unsigned int j;
for (j = 0; j < SIZEOF(tbl); ++j)
fprintf(stderr, "%s\n", tbl[j]);
exit(EXIT_FAILURE);
}
int
main(int argc, char *argv[])
{
int ch;
setlocale(LC_ALL, "");
while ((ch = getopt(argc, argv, "dj:m:o:t:")) != -1) {
switch (ch) {
case 'd':
d_option = TRUE;
break;
case 'j':
j_value = atoi(optarg);
if (j_value < NO_JUSTIFICATION
|| j_value > JUSTIFY_RIGHT)
usage();
break;
case 'm':
m_value = atoi(optarg);
break;
case 'o':
o_value = atoi(optarg);
break;
case 't':
t_value = optarg;
break;
default:
usage();
}
}
while (optind < argc) {
read_data(argv[optind++]);
}
initscr();
cbreak();
noecho();
raw();
nonl(); /* lets us read ^M's */
intrflush(stdscr, FALSE);
keypad(stdscr, TRUE);
if (has_colors()) {
start_color();
init_pair(1, COLOR_WHITE, COLOR_BLUE);
init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_pair(3, COLOR_CYAN, COLOR_BLACK);
bkgd((chtype) COLOR_PAIR(1));
refresh();
}
demo_forms();
endwin();
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(void)
{
printf("This program requires the curses form library\n");
ExitProgram(EXIT_FAILURE);
}
#endif
ncurses-5.9-20140118/test/README 0000644 0001751 0000144 00000107616 12076610176 014346 0 ustar tom users -------------------------------------------------------------------------------
-- Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "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: README,v 1.48 2013/01/19 21:30:38 tom Exp $
-------------------------------------------------------------------------------
The programs in this directory are designed to test your newest toy :-)
Check the sources for any further details.
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
The bs and knight games demonstrate processing of mouse events under xterm.
This directory also contains:
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
TYPE_ALPHA test: demo_forms ncurses
TYPE_ENUM test: demo_forms
TYPE_INTEGER test: demo_forms
TYPE_IPV4 test: demo_forms
TYPE_NUMERIC test: demo_forms
TYPE_REGEXP test: demo_forms
current_field test: demo_forms edit_field ncurses
data_ahead test: demo_forms
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_count test: demo_forms
field_fore test: demo_forms
field_index test: demo_forms
field_info test: ncurses
field_init -
field_just -
field_opts test: demo_forms ncurses
field_opts_off test: cardfile demo_forms
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
form_driver test: cardfile demo_forms edit_field ncurses
form_fields test: cardfile demo_forms
form_init -
form_opts -
form_opts_off -
form_opts_on -
form_page test: demo_forms
form_request_by_name -
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
free_fieldtype test: ncurses
free_form test: cardfile demo_forms ncurses
link_field -
link_fieldtype -
move_field -
new_field test: cardfile demo_forms ncurses
new_fieldtype test: ncurses
new_form test: cardfile demo_forms ncurses
new_form_sp -
new_page test: demo_forms
pos_form_cursor -
post_form test: cardfile demo_forms 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_buffer test: cardfile demo_forms edit_field ncurses
set_field_fore test: demo_forms
set_field_init -
set_field_just test: cardfile demo_forms
set_field_opts test: demo_forms ncurses
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_fieldtype_arg -
set_fieldtype_choice -
set_form_fields -
set_form_init -
set_form_opts -
set_form_page -
set_form_sub test: cardfile demo_forms ncurses
set_form_term -
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
libmenu:
-------
current_item test: demo_menus ncurses
free_item test: ncurses
free_menu test: demo_menus ncurses
item_count test: demo_menus
item_description -
item_index test: demo_menus ncurses
item_init -
item_name test: demo_menus ncurses
item_opts -
item_opts_off -
item_opts_on -
item_term -
item_userptr -
item_value test: demo_menus ncurses
item_visible -
menu_back -
menu_driver test: demo_menus ncurses
menu_fore -
menu_format -
menu_grey -
menu_init -
menu_items test: demo_menus ncurses
menu_mark test: demo_menus
menu_opts -
menu_opts_off test: demo_menus ncurses
menu_opts_on test: demo_menus
menu_pad -
menu_pattern test: demo_menus
menu_request_by_name -
menu_request_name -
menu_spacing test: demo_menus
menu_sub test: demo_menus
menu_term -
menu_userptr -
menu_win test: demo_menus ncurses
new_item test: demo_menus ncurses
new_menu test: demo_menus ncurses
new_menu_sp -
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_opts -
set_item_term -
set_item_userptr -
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_items -
set_menu_mark test: demo_menus
set_menu_opts -
set_menu_pad -
set_menu_pattern -
set_menu_spacing -
set_menu_sub test: demo_menus ncurses
set_menu_term -
set_menu_userptr -
set_menu_win test: demo_menus ncurses
set_top_row -
top_row -
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
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
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
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
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
assume_default_colors test: background ncurses
assume_default_colors_sp -
attr_get test: ncurses
attr_off test: ncurses
attr_on test: 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
beep_sp lib: ncurses
bkgd test: background cardfile demo_forms ncurses savescreen tclock view
bkgdset test: background ncurses testaddch
bkgrnd test: ncurses
bkgrndset test: ncurses
boolcodes test: demo_termcap test_arrays progs: dump_entry
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_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
chgat test: chgat
clear test: blue bs gdc ncurses 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
color_content_sp -
color_set test: color_set 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
def_prog_mode test: bs ncurses
def_prog_mode_sp lib: ncurses
def_shell_mode -
def_shell_mode_sp lib: ncurses
define_key test: demo_altkeys demo_defkey foldkeys
define_key_sp -
del_curterm lib: ncurses
del_curterm_sp lib: ncurses
delay_output test: newdemo
delay_output_sp -
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
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_sp lib: ncurses
dupwin test: edit_field
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_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 -
filter test: filter
filter_sp -
flash test: cardfile lrtest movewindow ncurses tclock testcurs
flash_sp -
flushinp test: ncurses newdemo testcurs
flushinp_sp lib: ncurses
get_escdelay -
get_escdelay_sp -
get_wch -
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
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
getmouse_sp -
getn_wstr test: test_get_wstr
getnstr test: filter ncurses test_getstr
getparx test: movewindow
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
has_colors_sp lib: ncurses
has_ic test: lrtest
has_ic_sp lib: ncurses
has_il -
has_il_sp lib: ncurses
has_key -
has_key_sp lib: ncurses
has_mouse -
has_mouse_sp -
hline test: gdc ncurses
hline_set -
idcok test: test_opaque
idlok test: ncurses test_opaque testscanw view
immedok test: test_opaque
in_wch test: inch_wide
in_wchnstr test: inch_wide
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_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
innstr test: test_instr
innwstr test: test_inwstr
ins_nwstr test: ins_wide
ins_wch test: ins_wide
ins_wstr test: ins_wide
insch test: ins_wide inserts
insdelln test: insdelln
insertln test: insdelln
insnstr test: inserts
insstr test: inserts
instr test: test_instr
intrflush test: demo_forms movewindow
intrflush_sp -
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_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_subwin -
is_syncok test: test_opaque
is_term_resized -
is_term_resized_sp -
is_wintouched lib: ncurses
isendwin -
isendwin_sp -
key_defined test: demo_defkey foldkeys
key_defined_sp lib: ncurses
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
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 -
leaveok test: hanoi test_opaque
longname test: testcurs progs: tput
mcprint -
mcprint_sp -
meta test: key_names keynames ncurses
mouse_trafo -
mouseinterval -
mouseinterval_sp -
mousemask test: bs demo_forms demo_menus knight movewindow ncurses
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
mvadd_wch test: ncurses test_add_wchstr test_addwstr
mvadd_wchnstr test: test_add_wchstr
mvadd_wchstr test: test_add_wchstr
mvaddch test: bs gdc hanoi lrtest ncurses rain tclock test_add_wchstr test_addchstr test_addstr test_addwstr xmas
mvaddchnstr test: gdc test_addchstr
mvaddchstr test: test_addchstr
mvaddnstr test: test_addstr
mvaddnwstr test: test_addwstr
mvaddstr test: bs demo_forms gdc hanoi knight ncurses rain tclock test_addstr testcurs xmas
mvaddwstr test: test_addwstr
mvchgat test: chgat
mvcur test: dots_mvcur redraw
mvcur_sp -
mvdelch -
mvderwin test: movewindow
mvget_wch -
mvget_wstr test: test_get_wstr
mvgetch -
mvgetn_wstr test: test_get_wstr
mvgetnstr test: test_getstr
mvgetstr test: test_getstr
mvhline test: ncurses
mvhline_set test: ncurses
mvin_wch test: inch_wide
mvin_wchnstr test: inch_wide
mvin_wchstr test: inch_wide
mvinch test: inchs
mvinchnstr test: gdc inchs
mvinchstr test: inchs
mvinnstr test: test_instr
mvinnwstr test: test_inwstr
mvins_nwstr test: ins_wide
mvins_wch test: ins_wide
mvins_wstr test: ins_wide
mvinsch test: ins_wide inserts
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
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
mvwaddchnstr test: test_addchstr
mvwaddchstr test: inchs test_addchstr
mvwaddnstr test: newdemo test_addstr testcurs
mvwaddnwstr test: test_addwstr
mvwaddstr test: ditto firstlast ins_wide inserts knight ncurses newdemo test_addstr test_addwstr test_instr testcurs xmas
mvwaddwstr test: test_addwstr test_inwstr
mvwchgat test: chgat
mvwdelch test: ncurses
mvwget_wch -
mvwget_wstr test: test_get_wstr
mvwgetch test: inch_wide inchs test_get_wstr test_getstr test_instr test_inwstr test_opaque
mvwgetn_wstr test: test_get_wstr
mvwgetnstr test: test_getstr
mvwgetstr test: test_getstr
mvwhline test: movewindow
mvwhline_set -
mvwin test: cardfile demo_menus movewindow testcurs xmas
mvwin_wch test: inch_wide
mvwin_wchnstr test: inch_wide
mvwin_wchstr test: inch_wide
mvwinch test: inchs newdemo testcurs
mvwinchnstr test: inchs
mvwinchstr test: inchs
mvwinnstr test: test_instr testcurs
mvwinnwstr test: test_inwstr
mvwins_nwstr test: ins_wide
mvwins_wch test: ins_wide
mvwins_wstr test: ins_wide
mvwinsch test: ins_wide inserts
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
mvwscanw test: testcurs
mvwvline test: ins_wide inserts movewindow 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
newpad_sp lib: ncurses
newscr lib: ncurses
newterm test: demo_altkeys ditto dots_mvcur filter foldkeys gdc key_names keynames
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_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
noecho_sp lib: ncurses
nofilter -
nofilter_sp -
nonl test: bs demo_forms hashtest movewindow ncurses view worm xmas
nonl_sp lib: ncurses
noqiflush -
noqiflush_sp -
noraw test: demo_forms demo_menus ncurses testcurs
noraw_sp lib: ncurses
notimeout test: 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
overlay test: ncurses testcurs xmas
overwrite test: ncurses savescreen
pair_content test: background color_set
pair_content_sp lib: ncurses
pecho_wchar -
pechochar -
pnoutrefresh test: edit_field ncurses
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 -
putwin test: ncurses
qiflush -
qiflush_sp -
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
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
resetty -
resetty_sp -
resize_term test: view
resize_term_sp -
resizeterm -
resizeterm_sp lib: ncurses
restartterm -
restartterm_sp -
ripoffline test: demo_menus ncurses
ripoffline_sp -
savetty -
savetty_sp -
scanw test: testcurs testscanw
scr_dump test: savescreen
scr_init test: savescreen
scr_init_sp -
scr_restore test: savescreen
scr_restore_sp -
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 -
set_escdelay test: test_opaque
set_escdelay_sp lib: ncurses
set_tabsize test: test_opaque
set_tabsize_sp -
set_term lib: ncurses
setcchar test: demo_panels ins_wide ncurses test_add_wchstr test_addwstr view
setscrreg test: view
setupterm test: demo_termcap demo_terminfo dots test_vid_puts test_vidputs progs: clear tabs tput tset
slk_attr -
slk_attr_off -
slk_attr_on -
slk_attr_set test: ncurses
slk_attr_set_sp -
slk_attr_sp -
slk_attroff lib: ncurses
slk_attroff_sp -
slk_attron lib: ncurses
slk_attron_sp -
slk_attrset test: ncurses
slk_attrset_sp -
slk_clear test: ncurses
slk_clear_sp -
slk_color test: ncurses
slk_color_sp -
slk_init test: ncurses
slk_init_sp -
slk_label test: ncurses
slk_label_sp -
slk_noutrefresh test: 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_sp -
slk_touch test: 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_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
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
subpad test: testcurs
subwin test: movewindow ncurses newdemo testcurs
syncok test: test_opaque
term_attrs test: ncurses
term_attrs_sp -
termattrs test: ncurses testcurs
termattrs_sp lib: ncurses
termname test: testcurs
termname_sp lib: ncurses
tgetent test: demo_termcap railroad
tgetent_sp -
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
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
typeahead test: testcurs
typeahead_sp lib: ncurses
unctrl test: ncurses redraw test_add_wchstr test_addchstr testcurs
unctrl_sp lib: ncurses
unget_wch -
unget_wch_sp -
ungetch test: bs knight
ungetch_sp lib: ncurses
ungetmouse -
ungetmouse_sp -
untouchwin lib: form
use_default_colors test: background filter firework gdc hanoi knight ncurses 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_legacy_coding -
use_legacy_coding_sp -
use_screen test: ditto
use_tioctl test: ncurses
use_tioctl_sp -
use_window test: rain worm
vid_attr test: test_vid_puts
vid_attr_sp -
vid_puts test: test_vid_puts
vid_puts_sp -
vidattr test: test_vidputs
vidattr_sp -
vidputs test: test_vidputs
vidputs_sp lib: ncurses
vline test: gdc ncurses
vline_set -
vw_printw test: clip_printw
vw_scanw -
vwprintw test: movewindow
vwscanw lib: ncurses
wadd_wch test: inch_wide test_add_wchstr test_addwstr
wadd_wchnstr test: 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
waddchnstr test: test_addchstr
waddchstr test: test_addchstr
waddnstr test: 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 -
wattr_off lib: ncurses
wattr_on lib: ncurses
wattr_set -
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
wbkgdset test: demo_panels ins_wide inserts ncurses test_add_wchstr test_addchstr test_addstr test_addwstr
wbkgrnd lib: ncurses
wbkgrndset lib: ncurses
wborder test: ncurses
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
wcolor_set lib: ncurses
wcursyncup lib: form
wdelch test: ncurses testcurs
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
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
wgetn_wstr test: ncurses test_get_wstr
wgetnstr test: ncurses test_getstr
wgetparent test: test_opaque
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_wchstr test: inch_wide
winch test: inchs knight testcurs
winchnstr test: inchs
winchstr test: inchs
winnstr test: demo_altkeys demo_defkey foldkeys test_instr
winnwstr test: test_inwstr
wins_nwstr test: ins_wide
wins_wch test: ins_wide
wins_wstr test: ins_wide
winsch test: ins_wide inserts testcurs
winsdelln test: insdelln
winsertln test: insdelln testcurs
winsnstr test: inserts
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
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
wscanw test: testcurs
wscrl test: ncurses testcurs
wsetscrreg test: ncurses testcurs
wstandend test: ncurses test_opaque xmas
wstandout test: ncurses test_opaque xmas
wsyncdown test: movewindow
wsyncup lib: form
wtimeout test: ncurses
wtouchln lib: ncurses
wunctrl lib: ncurses
wunctrl_sp -
wvline test: testcurs
wvline_set lib: ncurses
libpanel:
--------
bottom_panel test: demo_panels ncurses
ceiling_panel -
del_panel test: demo_panels ncurses
ground_panel -
hide_panel test: demo_panels ncurses
move_panel test: demo_panels ncurses
new_panel test: cardfile demo_panels ncurses
panel_above test: demo_panels
panel_below test: demo_panels
panel_hidden test: demo_panels
panel_userptr test: demo_panels ncurses
panel_window test: cardfile demo_panels ncurses
replace_panel test: demo_panels
set_panel_userptr test: demo_panels ncurses
show_panel test: demo_panels ncurses
top_panel test: cardfile demo_panels ncurses
update_panels test: cardfile demo_panels ncurses
update_panels_sp -
ncurses-5.9-20140118/test/firework.c 0000644 0001751 0000144 00000013041 12137025455 015444 0 ustar tom users /****************************************************************************
* Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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: firework.c,v 1.29 2013/04/27 19:46:53 tom Exp $
*/
#include
#include
static short my_bg = COLOR_BLACK;
static void
cleanup(void)
{
curs_set(1);
endwin();
}
static void
onsig(int n GCC_UNUSED)
{
cleanup();
ExitProgram(EXIT_FAILURE);
}
static void
showit(void)
{
int ch;
napms(120);
if ((ch = getch()) != ERR) {
#ifdef KEY_RESIZE
if (ch == KEY_RESIZE) {
erase();
} else
#endif
if (ch == 'q') {
cleanup();
ExitProgram(EXIT_SUCCESS);
} else if (ch == 's') {
nodelay(stdscr, FALSE);
} else if (ch == ' ') {
nodelay(stdscr, TRUE);
}
}
}
static short
get_colour(chtype *bold)
{
int attr;
attr = (rand() % 16) + 1;
*bold = A_NORMAL;
if (attr > 8) {
*bold = A_BOLD;
attr &= 7;
}
return (short) (attr);
}
static
void
explode(int row, int col)
{
chtype bold;
erase();
MvPrintw(row, col, "-");
showit();
init_pair(1, get_colour(&bold), my_bg);
(void) attrset((chtype) 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);
MvPrintw(row - 2, col - 2, " --- ");
MvPrintw(row - 1, col - 2, "-+++-");
MvPrintw(row + 0, col - 2, "-+#+-");
MvPrintw(row + 1, col - 2, "-+++-");
MvPrintw(row + 2, col - 2, " --- ");
showit();
init_pair(1, get_colour(&bold), my_bg);
(void) attrset((chtype) COLOR_PAIR(1) | bold);
MvPrintw(row - 2, col - 2, " +++ ");
MvPrintw(row - 1, col - 2, "++#++");
MvPrintw(row + 0, col - 2, "+# #+");
MvPrintw(row + 1, col - 2, "++#++");
MvPrintw(row + 2, col - 2, " +++ ");
showit();
init_pair(1, get_colour(&bold), my_bg);
(void) attrset((chtype) COLOR_PAIR(1) | bold);
MvPrintw(row - 2, col - 2, " # ");
MvPrintw(row - 1, col - 2, "## ##");
MvPrintw(row + 0, col - 2, "# #");
MvPrintw(row + 1, col - 2, "## ##");
MvPrintw(row + 2, col - 2, " # ");
showit();
init_pair(1, get_colour(&bold), my_bg);
(void) attrset((chtype) COLOR_PAIR(1) | bold);
MvPrintw(row - 2, col - 2, " # # ");
MvPrintw(row - 1, col - 2, "# #");
MvPrintw(row + 0, col - 2, " ");
MvPrintw(row + 1, col - 2, "# #");
MvPrintw(row + 2, col - 2, " # # ");
showit();
}
int
main(
int argc GCC_UNUSED,
char *argv[]GCC_UNUSED)
{
int start, end, row, diff, flag = 0, direction;
unsigned seed;
CATCHALL(onsig);
initscr();
noecho();
cbreak();
keypad(stdscr, TRUE);
nodelay(stdscr, TRUE);
if (has_colors()) {
start_color();
#if HAVE_USE_DEFAULT_COLORS
if (use_default_colors() == OK)
my_bg = -1;
#endif
}
curs_set(0);
seed = (unsigned) time((time_t *) 0);
srand(seed);
for (;;) {
do {
start = rand() % (COLS - 3);
end = rand() % (COLS - 3);
start = (start < 2) ? 2 : start;
end = (end < 2) ? 2 : end;
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++) {
MvPrintw(LINES - row, start + (row * direction),
(direction < 0) ? "\\" : "/");
if (flag++) {
showit();
erase();
flag = 0;
}
}
if (flag++) {
showit();
flag = 0;
}
seed = (unsigned) time((time_t *) 0);
srand(seed);
explode(LINES - row, start + (diff * direction));
erase();
showit();
}
}
ncurses-5.9-20140118/test/form_driver_w.c 0000644 0001751 0000144 00000011451 12250703252 016455 0 ustar tom users /****************************************************************************
* Copyright (c) 2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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: Gaute Hope, 2013 *
****************************************************************************/
/*
* $Id: form_driver_w.c,v 1.9 2013/12/07 20:35:54 tom Exp $
*
* Test form_driver_w (int, int, wchar_t), a wide char aware
* replacement of form_driver.
*/
#include
#include
#if USE_WIDEC_SUPPORT && USE_LIBFORM
#include
int
main(void)
{
FIELD *field[3];
FORM *my_form;
bool done = FALSE;
setlocale(LC_ALL, "");
/* Initialize curses */
initscr();
cbreak();
noecho();
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);
/* 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();
/* Loop through to get user requests */
while (!done) {
wint_t ch;
int ret = get_wch(&ch);
mvprintw(8, 10, "Got %d (%#x), type: %s", ch, ch,
(ret == KEY_CODE_YES)
? "KEY_CODE_YES"
: ((ret == OK)
? "OK"
: ((ret == ERR)
? "ERR"
: "?")));
clrtoeol();
switch (ret) {
case KEY_CODE_YES:
switch (ch) {
case KEY_DOWN:
/* Go to next field */
form_driver(my_form, REQ_NEXT_FIELD);
/* Go to the end of the present buffer */
/* Leaves nicely at the last character */
form_driver(my_form, REQ_END_LINE);
break;
case KEY_UP:
/* Go to previous field */
form_driver(my_form, REQ_PREV_FIELD);
form_driver(my_form, REQ_END_LINE);
break;
default:
#if 0
/* If this is a normal character, it gets printed */
form_driver(my_form, ch);
wadd_wch(my_form->current->working, ch);
#endif
break;
}
break;
case OK:
switch (ch) {
case CTRL('D'):
case QUIT:
case ESCAPE:
done = TRUE;
break;
default:
form_driver_w(my_form, OK, ch);
break;
}
break;
}
}
/* Un post form and free the memory */
unpost_form(my_form);
free_form(my_form);
free_field(field[0]);
free_field(field[1]);
endwin();
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(void)
{
printf("This program requires the wide-ncurses and forms library\n");
ExitProgram(EXIT_FAILURE);
}
#endif /* USE_WIDEC_SUPPORT */
ncurses-5.9-20140118/test/hashtest.c 0000644 0001751 0000144 00000015123 12137025771 015443 0 ustar tom users /****************************************************************************
* Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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. *
****************************************************************************/
/*
* hashtest.c -- test hash mapping
*
* Generate timing statistics for vertical-motion optimization.
*
* $Id: hashtest.c,v 1.32 2013/04/27 19:50:17 tom Exp $
*/
#include
#define LO_CHAR ' '
#define HI_CHAR '~'
static bool continuous = FALSE;
static bool reverse_loops = FALSE;
static bool single_step = FALSE;
static bool extend_corner = FALSE;
static int foot_lines = 0;
static int head_lines = 0;
static void
cleanup(void)
{
move(LINES - 1, 0);
clrtoeol();
refresh();
endwin();
}
static void
finish(int sig GCC_UNUSED)
{
cleanup();
ExitProgram(EXIT_FAILURE);
}
static void
genlines(int base)
{
int i, j;
#if USE_TRACE
if (base == 'a')
Trace(("Resetting screen"));
else
Trace(("Painting `%c' screen", base));
#endif
/* Do this so writes to lower-right corner don't cause a spurious
* scrolling operation. This _shouldn't_ break the scrolling
* optimization, since that's computed in the refresh() call.
*/
scrollok(stdscr, FALSE);
move(0, 0);
for (i = 0; i < head_lines; i++)
for (j = 0; j < COLS; j++)
addch(UChar((j % 8 == 0) ? ('A' + j / 8) : '-'));
move(head_lines, 0);
for (i = head_lines; i < LINES - foot_lines; i++) {
chtype c = (chtype) ((base - LO_CHAR + i) % (HI_CHAR - LO_CHAR + 1)
+ LO_CHAR);
int hi = (extend_corner || (i < LINES - 1)) ? COLS : COLS - 1;
for (j = 0; j < hi; j++)
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) : '-'));
}
scrollok(stdscr, TRUE);
if (single_step) {
move(LINES - 1, 0);
getch();
} else
refresh();
}
static void
one_cycle(int ch)
{
if (continuous) {
genlines(ch);
} else if (ch != 'a') {
genlines('a');
genlines(ch);
}
}
static void
run_test(bool optimized GCC_UNUSED)
{
char ch;
int lo = continuous ? LO_CHAR : 'a' - LINES;
int hi = continuous ? HI_CHAR : 'a' + LINES;
if (lo < LO_CHAR)
lo = LO_CHAR;
if (hi > HI_CHAR)
hi = HI_CHAR;
#if defined(TRACE) || defined(NCURSES_TEST)
if (optimized) {
Trace(("With hash mapping"));
_nc_optimize_enable |= OPTIMIZE_HASHMAP;
} else {
Trace(("Without hash mapping"));
_nc_optimize_enable &= ~OPTIMIZE_HASHMAP;
}
#endif
if (reverse_loops)
for (ch = (char) hi; ch >= lo; ch--)
one_cycle(ch);
else
for (ch = (char) lo; ch <= hi; ch++)
one_cycle(ch);
}
static void
usage(void)
{
static const char *const tbl[] =
{
"Usage: hashtest [options]"
,""
,"Options:"
," -c continuous (don't reset between refresh's)"
," -f num leave 'num' lines constant for footer"
," -h num leave 'num' lines constant for header"
," -l num repeat test 'num' times"
," -n test the normal optimizer"
," -o test the hashed optimizer"
," -r reverse the loops"
," -s single-step"
," -x assume lower-right corner extension"
};
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[])
{
int c;
int test_loops = 1;
int test_normal = FALSE;
int test_optimize = FALSE;
setlocale(LC_ALL, "");
while ((c = getopt(argc, argv, "cf:h:l:norsx")) != -1) {
switch (c) {
case 'c':
continuous = TRUE;
break;
case 'f':
foot_lines = atoi(optarg);
break;
case 'h':
head_lines = atoi(optarg);
break;
case 'l':
test_loops = atoi(optarg);
assert(test_loops >= 0);
break;
case 'n':
test_normal = TRUE;
break;
case 'o':
test_optimize = TRUE;
break;
case 'r':
reverse_loops = TRUE;
break;
case 's':
single_step = TRUE;
break;
case 'x':
extend_corner = TRUE;
break;
default:
usage();
}
}
if (!test_normal && !test_optimize) {
test_normal = TRUE;
test_optimize = TRUE;
}
#if USE_TRACE
trace(TRACE_TIMES);
#endif
CATCHALL(finish); /* arrange interrupts to terminate */
(void) initscr(); /* initialize the curses library */
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 */
scrollok(stdscr, TRUE);
while (test_loops-- > 0) {
if (test_normal)
run_test(FALSE);
if (test_optimize)
run_test(TRUE);
}
cleanup(); /* we're done */
ExitProgram(EXIT_SUCCESS);
}
/* hashtest.c ends here */
ncurses-5.9-20140118/test/firstlast.c 0000644 0001751 0000144 00000007346 11367076373 015653 0 ustar tom users /****************************************************************************
* Copyright (c) 1998-2009,2010 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. *
****************************************************************************/
/*
* 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 $
*/
#include
static void
fill(WINDOW *w, const char *str)
{
const char *s;
int x0 = -1, y0 = -1;
int x1, y1;
for (;;) {
for (s = str; *s; s++) {
getyx(w, y1, x1);
if (waddch(w, UChar(*s)) == ERR
|| (x1 == x0 && y1 == y0)) {
wmove(w, 0, 0);
return;
}
x0 = x1;
y0 = y1;
}
}
}
int
main(int argc GCC_UNUSED,
char *argv[]GCC_UNUSED)
{
WINDOW *large, *small;
initscr();
noecho();
large = newwin(20, 60, 2, 10);
small = newwin(10, 30, 7, 25);
/* test 1 - addch */
fill(large, "LargeWindow");
refresh();
wrefresh(large);
wrefresh(small);
MvWAddStr(small, 5, 5, " Test String ");
wrefresh(small);
getch();
touchwin(large);
wrefresh(large);
MvWAddStr(small, 5, 5, " Test <***************> String ");
wrefresh(small);
/* DIFFERENCE! */
getch();
/* test 2: erase */
erase();
refresh();
getch();
/* test 3: clrtoeol */
werase(small);
wrefresh(small);
touchwin(large);
wrefresh(large);
wmove(small, 5, 0);
waddstr(small, " clrtoeol>");
wclrtoeol(small);
wrefresh(small);
/* DIFFERENCE! */ ;
getch();
/* test 4: clrtobot */
werase(small);
wrefresh(small);
touchwin(large);
wrefresh(large);
wmove(small, 5, 3);
waddstr(small, " clrtobot>");
wclrtobot(small);
wrefresh(small);
/* DIFFERENCE! */
getch();
endwin();
ExitProgram(EXIT_SUCCESS);
}
ncurses-5.9-20140118/test/widechars-utf8.txt 0000644 0001751 0000144 00000000605 10346602127 017045 0 ustar tom users 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.
ncurses-5.9-20140118/test/movewindow.c 0000644 0001751 0000144 00000040701 12141262116 016005 0 ustar tom users /****************************************************************************
* Copyright (c) 2006-2012,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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: movewindow.c,v 1.39 2013/05/04 19:41:02 tom Exp $
*
* Demonstrate move functions for windows and derived windows from the curses
* library.
*
* Author: Thomas E. Dickey
*/
/*
derwin
mvderwin
subwin
mvwin
TODO:
add command to reset subwindow's origin to coincide with parent.
add command to delete subwindow (check if it has subwindows though)
*/
#include
#include
#ifdef HAVE_XCURSES
#undef derwin
#endif
#ifdef NCURSES_VERSION
#define CONST_FMT const
#else
#define CONST_FMT /* nothing */
#endif
#undef LINE_MAX
#define LINE_MIN 2
#define LINE_MAX (LINES - 2)
#define COL_MIN 2
#define COL_MAX (COLS - 2)
typedef struct {
int y, x;
} PAIR;
typedef struct {
WINDOW *parent; /* need this since WINDOW->_parent is not portable */
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 unsigned num_windows;
static FRAME *all_windows;
static void
failed(const char *s)
{
perror(s);
endwin();
ExitProgram(EXIT_FAILURE);
}
static void
message(int lineno, CONST_FMT char *fmt, va_list argp)
{
int y, x;
getyx(stdscr, y, x);
move(lineno, 0);
clrtoeol();
#ifdef HAVE_XCURSES
{
char buffer[1024];
vsprintf(buffer, fmt, argp);
addstr(buffer);
}
#else
vwprintw(stdscr, fmt, argp);
#endif
move(y, x);
refresh();
}
static void
head_line(CONST_FMT char *fmt,...)
{
va_list argp;
va_start(argp, fmt);
message(0, fmt, argp);
va_end(argp);
}
static void
tail_line(CONST_FMT char *fmt,...)
{
va_list argp;
va_start(argp, fmt);
message(LINES - 1, fmt, argp);
va_end(argp);
}
/*
* Arrow keys move cursor, return location at current on non-arrow key.
*/
static PAIR *
selectcell(WINDOW *parent,
WINDOW *child,
int uli, int ulj,
int lri, int lrj,
bool relative,
bool * more)
{
static PAIR res; /* result cell */
int si = lri - uli + 1; /* depth of the select area */
int sj = lrj - ulj + 1; /* width of the select area */
int i = 0, j = 0; /* offsets into the select area */
res.y = uli;
res.x = ulj;
if (child != 0) {
if (relative) {
getparyx(child, i, j);
} else {
getbegyx(child, i, j);
i -= uli + getbegy(parent);
j -= ulj + getbegx(parent);
}
}
if (more)
*more = FALSE;
for (;;) {
bool moved = FALSE;
tail_line("Upper left [%2d,%2d] Lower right [%2d,%2d] -> %d,%d -> %d,%d",
uli, ulj,
lri, lrj,
i, j,
uli + i, ulj + j);
wmove(parent, uli + i, ulj + j);
switch (wgetch(parent)) {
case KEY_UP:
i += si - 1;
moved = TRUE;
break;
case KEY_DOWN:
i++;
moved = TRUE;
break;
case KEY_LEFT:
j += sj - 1;
moved = TRUE;
break;
case KEY_RIGHT:
j++;
moved = TRUE;
break;
case QUIT:
case ESCAPE:
return ((PAIR *) 0);
#ifdef NCURSES_MOUSE_VERSION
case KEY_MOUSE:
{
MEVENT event;
getmouse(&event);
if (event.y > uli && event.x > ulj) {
if (parent != stdscr) {
i = event.y - getbegy(parent) - uli;
j = event.x - getbegx(parent) - ulj;
} else {
i = event.y - uli;
j = event.x - ulj;
}
} else {
beep();
break;
}
}
/* FALLTHRU */
#endif
default:
res.y = uli + i;
res.x = ulj + j;
return (&res);
}
if (si <= 0)
i = 0;
else
i %= si;
if (sj <= 0)
j = 0;
else
j %= sj;
/*
* If the caller can handle continuous movement, return the result.
*/
if (moved && more) {
*more = TRUE;
res.y = uli + i;
res.x = ulj + j;
return (&res);
}
}
}
/*
* Ask user for a window definition.
*/
static bool
getwindow(WINDOW *parent, PAIR * ul, PAIR * lr)
{
int min_col = (parent == stdscr) ? COL_MIN : 0;
int max_col = (parent == stdscr) ? COL_MAX : getmaxx(parent);
int min_line = (parent == stdscr) ? LINE_MIN : 0;
int max_line = (parent == stdscr) ? LINE_MAX : getmaxy(parent);
PAIR *tmp;
bool result = FALSE;
head_line("Use arrows to move cursor, anything else to mark corner 1");
if ((tmp = selectcell(parent, 0,
min_line, min_col,
max_line, max_col,
FALSE,
(bool *) 0)) != 0) {
*ul = *tmp;
MvWAddCh(parent, ul->y, ul->x, '*');
head_line("Use arrows to move cursor, anything else to mark corner 2");
if ((tmp = selectcell(parent, 0,
ul->y, ul->x,
max_line, max_col,
FALSE,
(bool *) 0)) != 0) {
*lr = *tmp;
MvWAddCh(parent, lr->y, lr->x, '*');
wmove(parent, lr->y, lr->x);
wsyncdown(parent);
wrefresh(parent);
result = (lr->y != ul->y && lr->x != ul->x);
}
}
head_line("done");
return result;
}
/*
* Draw a box inside the given window.
*/
static void
box_inside(WINDOW *win)
{
int y0, x0;
int y1, x1;
getyx(win, y0, x0);
getmaxyx(win, y1, x1);
MvWHLine(win, 0, 0, ACS_HLINE, x1);
MvWHLine(win, y1 - 1, 0, ACS_HLINE, x1);
MvWVLine(win, 0, 0, ACS_VLINE, y1);
MvWVLine(win, 0, x1 - 1, ACS_VLINE, y1);
MvWAddCh(win, 0, 0, ACS_ULCORNER);
MvWAddCh(win, y1 - 1, 0, ACS_LLCORNER);
MvWAddCh(win, 0, x1 - 1, ACS_URCORNER);
MvWAddCh(win, y1 - 1, x1 - 1, ACS_LRCORNER);
wsyncdown(win);
wmove(win, y0, x0);
wrefresh(win);
}
/*
* Add a window to our list.
*/
static void
add_window(WINDOW *parent, WINDOW *child)
{
static unsigned have = 0;
unsigned need = ((num_windows + 1) | 31) + 1;
keypad(child, TRUE);
if (need > have) {
all_windows = typeRealloc(FRAME, need, all_windows);
if (!all_windows)
failed("add_window");
}
all_windows[num_windows].parent = parent;
all_windows[num_windows].child = child;
num_windows++;
}
static int
window2num(WINDOW *win)
{
int n;
int result = -1;
for (n = 0; n < (int) num_windows; ++n) {
if (win == all_windows[n].child) {
result = n;
break;
}
}
return result;
}
static WINDOW *
parent_of(WINDOW *win)
{
WINDOW *result = 0;
int n = window2num(win);
if (n >= 0)
result = all_windows[n].parent;
return result;
}
static void
repaint_one(WINDOW *win)
{
touchwin(win);
wnoutrefresh(win);
}
static void
refresh_all(WINDOW *win)
{
unsigned n;
for (n = 0; n < num_windows; ++n) {
if (all_windows[n].child != win) {
repaint_one(all_windows[n].child);
}
}
repaint_one(win);
doupdate();
}
static WINDOW *
next_window(WINDOW *win)
{
WINDOW *result = win;
int n = window2num(win);
if (n++ >= 0) {
result = all_windows[(unsigned) n % num_windows].child;
wmove(result, 0, 0);
wrefresh(result);
}
return result;
}
static WINDOW *
prev_window(WINDOW *win)
{
WINDOW *result = win;
int n = window2num(win);
if (n-- >= 0) {
if (n < 0)
n = (int) (num_windows - 1);
result = all_windows[(unsigned) n % num_windows].child;
wmove(result, 0, 0);
wrefresh(result);
}
return result;
}
static void
recur_move_window(WINDOW *parent, int dy, int dx)
{
unsigned n;
for (n = 0; n < num_windows; ++n) {
if (all_windows[n].parent == parent) {
mvwin(all_windows[n].child, dy, dx);
recur_move_window(all_windows[n].child, dy, dx);
}
}
}
/*
* test mvwin().
*/
static bool
move_window(WINDOW *win, bool recur)
{
WINDOW *parent = parent_of(win);
bool result = FALSE;
if (parent != 0) {
bool top = (parent == stdscr);
int min_col = top ? COL_MIN : 0;
int max_col = top ? COL_MAX : getmaxx(parent);
int min_line = top ? LINE_MIN : 0;
int max_line = top ? LINE_MAX : getmaxy(parent);
PAIR *tmp;
bool more;
head_line("Select new position for %swindow", top ? "" : "sub");
while ((tmp = selectcell(parent,
win,
min_line, min_col,
max_line, max_col,
FALSE,
&more)) != 0) {
int y0, x0;
getbegyx(parent, y0, x0);
/*
* Moving a subwindow has the effect of moving a viewport around
* the screen. The parent window retains the contents of the
* subwindow in the original location, but the viewport will show
* the contents (again) at the new location. So it will look odd
* when testing.
*/
if (mvwin(win, y0 + tmp->y, x0 + tmp->x) != ERR) {
if (recur) {
recur_move_window(win, tmp->y, tmp->x);
}
refresh_all(win);
doupdate();
result = TRUE;
} else {
result = FALSE;
}
if (!more)
break;
}
}
head_line("done");
return result;
}
static void
show_derwin(WINDOW *win)
{
int pary, parx, maxy, maxx;
getmaxyx(win, maxy, maxx);
getparyx(win, pary, parx);
head_line("Select new position for derived window at %d,%d (%d,%d)",
pary, parx, maxy, maxx);
}
/*
* test mvderwin().
*/
static bool
move_derwin(WINDOW *win)
{
WINDOW *parent = parent_of(win);
bool result = FALSE;
if (parent != 0) {
bool top = (parent == stdscr);
int min_col = top ? COL_MIN : 0;
int max_col = top ? COL_MAX : getmaxx(parent);
int min_line = top ? LINE_MIN : 0;
int max_line = top ? LINE_MAX : getmaxy(parent);
PAIR *tmp;
bool more;
show_derwin(win);
while ((tmp = selectcell(parent,
win,
min_line, min_col,
max_line, max_col,
TRUE,
&more)) != 0) {
if (mvderwin(win, tmp->y, tmp->x) != ERR) {
refresh_all(win);
doupdate();
repaint_one(win);
doupdate();
result = TRUE;
show_derwin(win);
} else {
flash();
}
if (!more)
break;
}
}
head_line("done");
return result;
}
static void
fill_window(WINDOW *win, chtype ch)
{
int y, x;
int y0, x0;
int y1, x1;
getyx(win, y0, x0);
getmaxyx(win, y1, x1);
for (y = 0; y < y1; ++y) {
for (x = 0; x < x1; ++x) {
MvWAddCh(win, y, x, ch);
}
}
wsyncdown(win);
wmove(win, y0, x0);
wrefresh(win);
}
static void
fill_with_pattern(WINDOW *win)
{
int y, x;
int y0, x0;
int y1, x1;
int ch = 'a';
getyx(win, y0, x0);
getmaxyx(win, y1, x1);
for (y = 0; y < y1; ++y) {
for (x = 0; x < x1; ++x) {
MvWAddCh(win, y, x, (chtype) ch);
if (++ch > 'z')
ch = 'a';
}
}
wsyncdown(win);
wmove(win, y0, x0);
wrefresh(win);
}
#define lines_of(ul,lr) (lr.y - ul.y + 1)
#define cols_of(ul,lr) (lr.x - ul.x + 1)
#define pair_of(ul) ul.y, ul.x
static WINDOW *
create_my_window(WINDOW *current)
{
PAIR ul, lr;
WINDOW *result = 0;
if (getwindow(stdscr, &ul, &lr)) {
result = newwin(lines_of(ul, lr), cols_of(ul, lr), pair_of(ul));
if (result != 0) {
fill_window(result, 'c');
add_window(stdscr, result);
}
}
if (result == 0)
result = current;
return result;
}
static WINDOW *
create_my_derwin(WINDOW *parent)
{
PAIR ul, lr;
WINDOW *result = 0;
if (getwindow(parent, &ul, &lr)) {
result = derwin(parent, lines_of(ul, lr), cols_of(ul, lr), pair_of(ul));
if (result != 0) {
fill_window(result, 'd');
add_window(parent, result);
}
}
if (result == 0)
result = parent;
return result;
}
static WINDOW *
create_my_subwin(WINDOW *parent)
{
PAIR ul, lr;
WINDOW *result = 0;
if (getwindow(parent, &ul, &lr)) {
result = subwin(parent,
lines_of(ul, lr),
cols_of(ul, lr),
ul.y + getbegy(parent),
ul.x + getbegx(parent));
if (result != 0) {
fill_window(result, 's');
add_window(parent, result);
}
}
if (result == 0)
result = parent;
return result;
}
static void
show_help(WINDOW *current)
{
/* *INDENT-OFF* */
static struct {
int key;
CONST_FMT char * msg;
} help[] = {
{ '?', "Show this screen" },
{ 'b', "Draw a box inside the current window" },
{ 'c', "Create a new window" },
{ 'd', "Create a new derived window" },
{ 'D', "Move derived window (moves viewport)" },
{ 'f', "Fill the current window with the next character" },
{ 'F', "Fill the current window with a pattern" },
{ 'm', "Move the current window" },
{ 'M', "Move the current window (and its children)" },
{ 'q', "Quit" },
{ 's', "Create a new subwindow" },
{ CTRL('L'), "Repaint all windows, doing current one last" },
{ CTRL('N'), "Cursor to next window" },
{ CTRL('P'), "Cursor to previous window" },
};
/* *INDENT-ON* */
WINDOW *mywin = newwin(LINES, COLS, 0, 0);
int row;
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);
}
box_inside(mywin);
wmove(mywin, 1, 1);
wgetch(mywin);
delwin(mywin);
refresh_all(current);
}
int
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
WINDOW *current_win;
int ch;
bool done = FALSE;
initscr();
cbreak();
noecho();
nonl();
intrflush(stdscr, FALSE);
add_window(0, current_win = stdscr);
#ifdef NCURSES_MOUSE_VERSION
(void) mousemask(BUTTON1_CLICKED, (mmask_t *) NULL);
#endif /* NCURSES_MOUSE_VERSION */
while (!done && (ch = wgetch(current_win)) != ERR) {
int y, x;
getyx(current_win, y, x);
switch (ch) {
case '?':
show_help(current_win);
break;
case 'b':
box_inside(current_win);
break;
case 'c':
current_win = create_my_window(current_win);
break;
case 'd':
current_win = create_my_derwin(current_win);
break;
case 'D':
if (!move_derwin(current_win)) {
tail_line("error");
continue;
}
break;
case 'f':
fill_window(current_win, (chtype) wgetch(current_win));
break;
case 'F':
fill_with_pattern(current_win);
break;
case 'm':
case 'M':
if (!move_window(current_win, (ch == 'M'))) {
tail_line("error");
continue;
}
break;
case 'q':
done = TRUE;
break;
case 's':
current_win = create_my_subwin(current_win);
break;
case CTRL('L'):
refresh_all(current_win);
break;
case CTRL('N'):
current_win = next_window(current_win);
break;
case CTRL('P'):
current_win = prev_window(current_win);
break;
#if 0
/* want to allow cursor to move around the current window too */
/* want to test the resizing of windows and subwindows too */
/* want to allow deleting a window also */
#endif
default:
wmove(current_win, y, x);
tail_line("unrecognized key (use '?' for help)");
beep();
continue;
}
tail_line("size [%d,%d] begin [%d,%d] parent [%d,%d]",
getmaxy(current_win),
getmaxx(current_win),
getbegy(current_win),
getbegx(current_win),
getpary(current_win),
getparx(current_win));
wmove(current_win, 0, 0);
}
endwin();
ExitProgram(EXIT_SUCCESS);
}
ncurses-5.9-20140118/test/xterm-256color.dat 0000644 0001751 0000144 00000015603 11272664704 016665 0 ustar tom users ##############################################################################
# Copyright (c) 2009 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: xterm-256color.dat,v 1.1 2009/10/30 22:33:40 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
# manipulate the colors shown in the screen. The 'd' screen is limited to
# 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.
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
5: 205 0 205 magenta3
6: 0 205 205 cyan3
7: 229 229 229 gray90
8: 127 127 127 gray50
9: 255 0 0 red
10: 0 255 0 green
11: 255 255 0 yellow
12: 99 184 255 SteelBlue1
13: 255 0 255 magenta
14: 0 255 255 cyan
15: 255 255 255 white
16: 0 0 0
17: 0 0 95
18: 0 0 135
19: 0 0 175
20: 0 0 215
21: 0 0 255
22: 0 95 0
23: 0 95 95
24: 0 95 135
25: 0 95 175
26: 0 95 215
27: 0 95 255
28: 0 135 0
29: 0 135 95
30: 0 135 135
31: 0 135 175
32: 0 135 215
33: 0 135 255
34: 0 175 0
35: 0 175 95
36: 0 175 135
37: 0 175 175
38: 0 175 215
39: 0 175 255
40: 0 215 0
41: 0 215 95
42: 0 215 135
43: 0 215 175
44: 0 215 215
45: 0 215 255
46: 0 255 0
47: 0 255 95
48: 0 255 135
49: 0 255 175
50: 0 255 215
51: 0 255 255
52: 95 0 0
53: 95 0 95
54: 95 0 135
55: 95 0 175
56: 95 0 215
57: 95 0 255
58: 95 95 0
59: 95 95 95
60: 95 95 135
61: 95 95 175
62: 95 95 215
63: 95 95 255
64: 95 135 0
65: 95 135 95
66: 95 135 135
67: 95 135 175
68: 95 135 215
69: 95 135 255
70: 95 175 0
71: 95 175 95
72: 95 175 135
73: 95 175 175
74: 95 175 215
75: 95 175 255
76: 95 215 0
77: 95 215 95
78: 95 215 135
79: 95 215 175
80: 95 215 215
81: 95 215 255
82: 95 255 0
83: 95 255 95
84: 95 255 135
85: 95 255 175
86: 95 255 215
87: 95 255 255
88: 135 0 0
89: 135 0 95
90: 135 0 135
91: 135 0 175
92: 135 0 215
93: 135 0 255
94: 135 95 0
95: 135 95 95
96: 135 95 135
97: 135 95 175
98: 135 95 215
99: 135 95 255
100: 135 135 0
101: 135 135 95
102: 135 135 135
103: 135 135 175
104: 135 135 215
105: 135 135 255
106: 135 175 0
107: 135 175 95
108: 135 175 135
109: 135 175 175
110: 135 175 215
111: 135 175 255
112: 135 215 0
113: 135 215 95
114: 135 215 135
115: 135 215 175
116: 135 215 215
117: 135 215 255
118: 135 255 0
119: 135 255 95
120: 135 255 135
121: 135 255 175
122: 135 255 215
123: 135 255 255
124: 175 0 0
125: 175 0 95
126: 175 0 135
127: 175 0 175
128: 175 0 215
129: 175 0 255
130: 175 95 0
131: 175 95 95
132: 175 95 135
133: 175 95 175
134: 175 95 215
135: 175 95 255
136: 175 135 0
137: 175 135 95
138: 175 135 135
139: 175 135 175
140: 175 135 215
141: 175 135 255
142: 175 175 0
143: 175 175 95
144: 175 175 135
145: 175 175 175
146: 175 175 215
147: 175 175 255
148: 175 215 0
149: 175 215 95
150: 175 215 135
151: 175 215 175
152: 175 215 215
153: 175 215 255
154: 175 255 0
155: 175 255 95
156: 175 255 135
157: 175 255 175
158: 175 255 215
159: 175 255 255
160: 215 0 0
161: 215 0 95
162: 215 0 135
163: 215 0 175
164: 215 0 215
165: 215 0 255
166: 215 95 0
167: 215 95 95
168: 215 95 135
169: 215 95 175
170: 215 95 215
171: 215 95 255
172: 215 135 0
173: 215 135 95
174: 215 135 135
175: 215 135 175
176: 215 135 215
177: 215 135 255
178: 215 175 0
179: 215 175 95
180: 215 175 135
181: 215 175 175
182: 215 175 215
183: 215 175 255
184: 215 215 0
185: 215 215 95
186: 215 215 135
187: 215 215 175
188: 215 215 215
189: 215 215 255
190: 215 255 0
191: 215 255 95
192: 215 255 135
193: 215 255 175
194: 215 255 215
195: 215 255 255
196: 255 0 0
197: 255 0 95
198: 255 0 135
199: 255 0 175
200: 255 0 215
201: 255 0 255
202: 255 95 0
203: 255 95 95
204: 255 95 135
205: 255 95 175
206: 255 95 215
207: 255 95 255
208: 255 135 0
209: 255 135 95
210: 255 135 135
211: 255 135 175
212: 255 135 215
213: 255 135 255
214: 255 175 0
215: 255 175 95
216: 255 175 135
217: 255 175 175
218: 255 175 215
219: 255 175 255
220: 255 215 0
221: 255 215 95
222: 255 215 135
223: 255 215 175
224: 255 215 215
225: 255 215 255
226: 255 255 0
227: 255 255 95
228: 255 255 135
229: 255 255 175
230: 255 255 215
231: 255 255 255
232: 8 8 8
233: 18 18 18
234: 28 28 28
235: 38 38 38
236: 48 48 48
237: 58 58 58
238: 68 68 68
239: 78 78 78
240: 88 88 88
241: 98 98 98
242: 108 108 108
243: 118 118 118
244: 128 128 128
245: 138 138 138
246: 148 148 148
247: 158 158 158
248: 168 168 168
249: 178 178 178
250: 188 188 188
251: 198 198 198
252: 208 208 208
253: 218 218 218
254: 228 228 228
255: 238 238 238
ncurses-5.9-20140118/test/mk-test.awk 0000644 0001751 0000144 00000010662 11465357610 015552 0 ustar tom users # $Id: mk-test.awk,v 1.12 2010/11/06 23:06:48 tom Exp $
##############################################################################
# Copyright (c) 2006-2007,2010 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
#
# generate Makefile for ncurses tests.
BEGIN {
first = 1;
count = 0;
}
/^#/ {
next;
}
/^$/ {
next;
}
{
if (first) {
print "# generated by mk-test.awk\n";
first = 0;
}
progs[count] = $1;
flags[count] = $2;
using[count] = $3;
files[count] = "";
for (n = 4; n <= NF; ++n) {
files[count] = sprintf("%s $(MODEL)/%s$o", files[count], $n);
}
count = count + 1;
}
END {
for (n = 0; n < count; ++n) {
if (n == 0) {
printf "TESTS\t= ";
} else {
printf "\t ";
}
printf "$(destdir)%s$x", progs[n];
if (n < count - 1) {
printf " \\";
}
print "";
}
print ""
print "all: $(TESTS)"
print ""
print "sources:"
print ""
print "tags:"
print " $(CTAGS) *.[ch]"
print ""
print "# no libraries here"
print "libs \\"
print "install.libs \\"
print "uninstall.libs:"
print ""
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 " dst=`echo $$src | $(TRANSFORM)`; \\"
print " $(INSTALL_PROG) $$src $(BINDIR)/$$dst; \\"
print " done'"
print ""
print "uninstall \\"
print "uninstall.test:"
print " $(SHELL) -c 'for src in $(TESTS); do \\"
print " dst=`echo $$src | $(TRANSFORM)`; \\"
print " rm -f $(BINDIR)/$$dst; \\"
print " done'"
} else {
print "install \\"
print "install.test \\"
print "uninstall \\"
print "uninstall.test:"
}
print ""
print "mostlyclean ::"
print " -rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace"
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 ""
print "distclean :: clean"
print " -rm -f Makefile ncurses_cfg.h config.status config.log"
print ""
print "realclean :: distclean"
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 " mkdir -p $@"
if (ECHO_LINK != "") {
ECHO_LINK="@ echo linking $@ ... ;"
}
for (n = 0; n < count; ++n) {
print "";
printf "$(destdir)%s$x:%s %s\n", progs[n], files[n], using[n];
printf "\t%s$(LINK) -o $@%s %s\n", ECHO_LINK, files[n], flags[n];
}
}
ncurses-5.9-20140118/test/xmas.c 0000644 0001751 0000144 00000102746 12137025455 014577 0 ustar tom users /******************************************************************************/
/* asciixmas */
/* December 1989 Larry Bartz Indianapolis, IN */
/* */
/* */
/* I'm dreaming of an ascii character-based monochrome Christmas, */
/* Just like the one's I used to know! */
/* Via a full duplex communications channel, */
/* At 9600 bits per second, */
/* Even though it's kinda slow. */
/* */
/* I'm dreaming of an ascii character-based monochrome Christmas, */
/* With ev'ry C program I write! */
/* May your screen be merry and bright! */
/* And may all your Christmases be amber or green, */
/* (for reduced eyestrain and improved visibility)! */
/* */
/* */
/* */
/* */
/* */
/* IMPLEMENTATION */
/* */
/* Feel free to modify the defined string FROMWHO to reflect you, your */
/* organization, your site, whatever. */
/* */
/* This really looks a lot better if you can turn off your cursor before */
/* execution. I wanted to do that here but very few termcap entries or */
/* terminfo definitions have the appropriate string defined. If you know */
/* the string(s) for the terminal(s) you use or which your site supports, */
/* you could call asciixmas from within a shell in which you issue the */
/* string to the terminal. The cursor is distracting but it doesn't really */
/* ruin the show. */
/* */
/* At our site, we invoke this for our users just after login and the */
/* determination of terminal type. */
/* */
/* */
/* PORTABILITY */
/* */
/* I wrote this using only the very simplest curses functions so that it */
/* might be the most portable. I was personally able to test on five */
/* different cpu/UNIX combinations. */
/* */
/* */
/* COMPILE */
/* */
/* usually this: */
/* */
/* cc -O asciixmas.c -lcurses -o asciixmas -s */
/* */
/* */
/* Zilog S8000 models 11, 21, 31, etc with ZEUS variant of SYSTEM III */
/* maybe other SYSTEM III also: */
/* */
/* cc asciixmas.c -lcurses -ltermlib -o asciixmas -s */
/* */
/* as above with optional "peephole optimizer" installed: */
/* */
/* cc -O asciixmas.c -lcurses -ltermlib -o asciixmas -s */
/* */
/* */
/* Zilog S8000 models 32, 130 with WE32100 chip and SYS V, REL2 */
/* maybe 3B2 also? */
/* */
/* cc -f -O -K sd asciixmas.c -lcurses -o asciixmas -s */
/* */
/* */
/* Pyramid, Sequent, any other "dual universe" types compile and execute */
/* under either universe. The compile line for the ucb universe (as you */
/* might expect) is the same as for SYS III UNIX: */
/* */
/* cc -O asciixmas.c -lcurses -ltermlib -o asciixmas -s */
/* */
/* The above compile will also hold true for other BSD systems. (I hope) */
/* */
/* */
/* */
/* */
/* For the Scrooges out there among you who don't want this thing to loop */
/* forever (or until the user hits a key), insert this into your compile */
/* line just after "cc" : */
/* */
/* -DNOLOOP */
/* */
/* like so: */
/* */
/* cc -DNOLOOP -O asciixmas.c -lcurses -o asciixmas -s */
/* */
/* */
/* */
/******************************************************************************/
/*
* $Id: xmas.c,v 1.28 2013/04/27 19:46:53 tom Exp $
*/
#include
#define FROMWHO "Mark Hessling - (M.Hessling@gu.edu.au)"
static int my_bg = COLOR_BLACK;
static int y_pos, x_pos;
static WINDOW *treescrn;
static WINDOW *treescrn2;
static WINDOW *treescrn3;
static WINDOW *treescrn4;
static WINDOW *treescrn5;
static WINDOW *treescrn6;
static WINDOW *treescrn7;
static WINDOW *treescrn8;
static WINDOW *dotdeer0;
static WINDOW *stardeer0;
static WINDOW *lildeer0;
static WINDOW *lildeer1;
static WINDOW *lildeer2;
static WINDOW *lildeer3;
static WINDOW *middeer0;
static WINDOW *middeer1;
static WINDOW *middeer2;
static WINDOW *middeer3;
static WINDOW *bigdeer0;
static WINDOW *bigdeer1;
static WINDOW *bigdeer2;
static WINDOW *bigdeer3;
static WINDOW *bigdeer4;
static WINDOW *lookdeer0;
static WINDOW *lookdeer1;
static WINDOW *lookdeer2;
static WINDOW *lookdeer3;
static WINDOW *lookdeer4;
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
set_color(WINDOW *win, chtype color)
{
if (has_colors()) {
int n = (int) (color + 1);
if (my_pairs == 0)
my_pairs = typeCalloc(bool, (size_t) (COLORS + 1));
if (!my_pairs[n]) {
init_pair((short) n, (short) color, (short) my_bg);
my_pairs[n] = TRUE;
}
wattroff(win, A_COLOR);
wattron(win, COLOR_PAIR(n));
}
}
static void
unset_color(WINDOW *win)
{
if (has_colors())
(void) wattrset(win, COLOR_PAIR(0));
}
static void
look_out(int msecs)
{
napms(msecs);
if (getch() != ERR) {
beep();
done(0);
}
}
int
main(int argc GCC_UNUSED, char **argv GCC_UNUSED)
{
int loopy;
setlocale(LC_ALL, "");
initscr();
noecho();
nonl();
refresh();
CATCHALL(done);
if (has_colors()) {
start_color();
#if HAVE_USE_DEFAULT_COLORS
if (use_default_colors() == OK)
my_bg = -1;
#endif
}
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 ||
(dotdeer0 = newwin(3, 71, 0, 8)) == 0 ||
(stardeer0 = newwin(4, 56, 0, 8)) == 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 ||
(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 ||
(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 ||
(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 ||
(w_holiday = newwin(1, 26, 3, 27)) == 0 ||
(w_del_msg = newwin(1, 19, 23, 60)) == 0) {
endwin();
fprintf(stderr, "Cannot create windows - screen too small\n");
ExitProgram(EXIT_FAILURE);
}
MvWAddStr(w_del_msg, 0, 0, "Hit any key to quit");
MvWAddStr(w_holiday, 0, 0, "H A P P Y H O L I D A Y S");
/* set up the windows for our various reindeer */
/* 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) '~');
/* 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) '~');
/* 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) '~');
/* 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) '/');
/* 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) '|');
/* 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) '\\');
/* 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, "\\>/>");
/* 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, "|> |>");
/* 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, "/> \\>");
/* 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___= ----^");
/* 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, "\\>/>");
/* 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, "|> |>");
/* 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, "/> \\>");
/* 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___= ----^");
/***********************************************/
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();
/* set up the windows for our blinking trees */
/* **************************************** */
/* treescrn3 */
overlay(treescrn, treescrn3);
/*balls */
MvWAddCh(treescrn3, 4, 18, ' ');
MvWAddCh(treescrn3, 7, 6, ' ');
MvWAddCh(treescrn3, 8, 19, ' ');
MvWAddCh(treescrn3, 11, 22, ' ');
/*star */
MvWAddCh(treescrn3, 0, 12, '*');
/*strng1 */
MvWAddCh(treescrn3, 3, 11, ' ');
/*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, ' ');
/*strng5 */
MvWAddCh(treescrn3, 11, 18, ' ');
MvWAddCh(treescrn3, 12, 13, ' ');
/* treescrn4 */
overlay(treescrn, treescrn4);
/*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, ' ');
/*star */
(void) wstandout(treescrn4);
MvWAddCh(treescrn4, 0, 12, '*');
(void) wstandend(treescrn4);
/*strng1 */
MvWAddCh(treescrn4, 3, 13, ' ');
/*strng2 */
/*strng3 */
MvWAddCh(treescrn4, 7, 15, ' ');
MvWAddCh(treescrn4, 8, 11, ' ');
/*strng4 */
MvWAddCh(treescrn4, 9, 16, ' ');
MvWAddCh(treescrn4, 10, 12, ' ');
MvWAddCh(treescrn4, 11, 8, ' ');
/*strng5 */
MvWAddCh(treescrn4, 11, 18, ' ');
MvWAddCh(treescrn4, 12, 14, ' ');
/* treescrn5 */
overlay(treescrn, treescrn5);
/*balls */
MvWAddCh(treescrn5, 3, 15, ' ');
MvWAddCh(treescrn5, 10, 20, ' ');
MvWAddCh(treescrn5, 12, 1, ' ');
/*star */
MvWAddCh(treescrn5, 0, 12, '*');
/*strng1 */
MvWAddCh(treescrn5, 3, 11, ' ');
/*strng2 */
MvWAddCh(treescrn5, 5, 12, ' ');
/*strng3 */
MvWAddCh(treescrn5, 7, 14, ' ');
MvWAddCh(treescrn5, 8, 10, ' ');
/*strng4 */
MvWAddCh(treescrn5, 9, 15, ' ');
MvWAddCh(treescrn5, 10, 11, ' ');
MvWAddCh(treescrn5, 11, 7, ' ');
/*strng5 */
MvWAddCh(treescrn5, 11, 17, ' ');
MvWAddCh(treescrn5, 12, 13, ' ');
/* treescrn6 */
overlay(treescrn, treescrn6);
/*balls */
MvWAddCh(treescrn6, 6, 7, ' ');
MvWAddCh(treescrn6, 7, 18, ' ');
MvWAddCh(treescrn6, 10, 4, ' ');
MvWAddCh(treescrn6, 11, 23, ' ');
/*star */
(void) wstandout(treescrn6);
MvWAddCh(treescrn6, 0, 12, '*');
(void) wstandend(treescrn6);
/*strng1 */
/*strng2 */
MvWAddCh(treescrn6, 5, 11, ' ');
/*strng3 */
MvWAddCh(treescrn6, 7, 13, ' ');
MvWAddCh(treescrn6, 8, 9, ' ');
/*strng4 */
MvWAddCh(treescrn6, 9, 14, ' ');
MvWAddCh(treescrn6, 10, 10, ' ');
MvWAddCh(treescrn6, 11, 6, ' ');
/*strng5 */
MvWAddCh(treescrn6, 11, 16, ' ');
MvWAddCh(treescrn6, 12, 12, ' ');
/* treescrn7 */
overlay(treescrn, treescrn7);
/*balls */
MvWAddCh(treescrn7, 3, 15, ' ');
MvWAddCh(treescrn7, 6, 7, ' ');
MvWAddCh(treescrn7, 7, 18, ' ');
MvWAddCh(treescrn7, 10, 4, ' ');
MvWAddCh(treescrn7, 11, 22, ' ');
/*star */
MvWAddCh(treescrn7, 0, 12, '*');
/*strng1 */
MvWAddCh(treescrn7, 3, 12, ' ');
/*strng2 */
MvWAddCh(treescrn7, 5, 13, ' ');
MvWAddCh(treescrn7, 6, 9, ' ');
/*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();
}
#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;
}
return (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');
return (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');
return (0);
}
static int
fromwho(void)
{
MvAddStr(21, 13, FROMWHO);
return (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) '/');
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) '\\');
MvWAddCh(treescrn, 4, 10, (chtype) '_');
MvWAddCh(treescrn, 4, 14, (chtype) '_');
MvWAddCh(treescrn, 8, 7, (chtype) '_');
MvWAddCh(treescrn, 8, 17, (chtype) '_');
MvWAddStr(treescrn, 13, 0, "//////////// \\\\\\\\\\\\\\\\\\\\\\\\");
MvWAddStr(treescrn, 14, 11, "| |");
MvWAddStr(treescrn, 15, 11, "|_|");
unset_color(treescrn);
wrefresh(treescrn);
wrefresh(w_del_msg);
return (0);
}
static int
balls(void)
{
overlay(treescrn, treescrn2);
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) '@');
unset_color(treescrn2);
wrefresh(treescrn2);
wrefresh(w_del_msg);
return (0);
}
static int
star(void)
{
(void) wattrset(treescrn2, A_BOLD | A_BLINK);
set_color(treescrn2, COLOR_YELLOW);
MvWAddCh(treescrn2, 0, 12, (chtype) '*');
(void) wstandend(treescrn2);
unset_color(treescrn2);
wrefresh(treescrn2);
wrefresh(w_del_msg);
return (0);
}
static int
strng1(void)
{
(void) wattrset(treescrn2, A_BOLD | A_BLINK);
set_color(treescrn2, COLOR_WHITE);
MvWAddCh(treescrn2, 3, 13, (chtype) '\'');
MvWAddCh(treescrn2, 3, 12, (chtype) ':');
MvWAddCh(treescrn2, 3, 11, (chtype) '.');
wattroff(treescrn2, A_BOLD | A_BLINK);
unset_color(treescrn2);
wrefresh(treescrn2);
wrefresh(w_del_msg);
return (0);
}
static int
strng2(void)
{
(void) wattrset(treescrn2, A_BOLD | A_BLINK);
set_color(treescrn2, COLOR_WHITE);
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) ':');
wattroff(treescrn2, A_BOLD | A_BLINK);
unset_color(treescrn2);
wrefresh(treescrn2);
wrefresh(w_del_msg);
return (0);
}
static int
strng3(void)
{
(void) wattrset(treescrn2, A_BOLD | A_BLINK);
set_color(treescrn2, COLOR_WHITE);
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) ',');
wattroff(treescrn2, A_BOLD | A_BLINK);
unset_color(treescrn2);
wrefresh(treescrn2);
wrefresh(w_del_msg);
return (0);
}
static int
strng4(void)
{
(void) wattrset(treescrn2, A_BOLD | A_BLINK);
set_color(treescrn2, COLOR_WHITE);
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) '\'');
wattroff(treescrn2, A_BOLD | A_BLINK);
unset_color(treescrn2);
wrefresh(treescrn2);
wrefresh(w_del_msg);
return (0);
}
static int
strng5(void)
{
(void) wattrset(treescrn2, A_BOLD | A_BLINK);
set_color(treescrn2, COLOR_WHITE);
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) ',');
wattroff(treescrn2, A_BOLD | A_BLINK);
unset_color(treescrn2);
/* save a fully lit tree */
overlay(treescrn2, treescrn);
wrefresh(treescrn2);
wrefresh(w_del_msg);
return (0);
}
static int
blinkit(void)
{
static int cycle;
if (cycle > 4) {
cycle = 0;
}
touchwin(treescrn8);
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);
/*ALL ON************************************************** */
overlay(treescrn, treescrn8);
wrefresh(treescrn8);
wrefresh(w_del_msg);
++cycle;
return (0);
}
static void
deer_step(WINDOW *win, int y, int x)
{
mvwin(win, y, x);
wrefresh(win);
wrefresh(w_del_msg);
look_out(5);
}
static int
reindeer(void)
{
int looper;
y_pos = 0;
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);
}
}
y_pos = 2;
for (; x_pos > 50; x_pos--) {
for (looper = 0; looper < 4; looper++) {
if (x_pos < 56) {
y_pos = 3;
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);
}
}
}
x_pos = 58;
for (y_pos = 2; y_pos < 5; y_pos++) {
touchwin(lildeer0);
wrefresh(lildeer0);
wrefresh(w_del_msg);
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);
touchwin(lildeer0);
wrefresh(lildeer0);
wrefresh(w_del_msg);
x_pos -= 2;
}
}
x_pos = 35;
for (y_pos = 5; y_pos < 10; y_pos++) {
touchwin(middeer0);
wrefresh(middeer0);
wrefresh(w_del_msg);
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);
touchwin(middeer0);
wrefresh(middeer0);
wrefresh(w_del_msg);
x_pos -= 3;
}
}
look_out(300);
y_pos = 1;
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);
}
--x_pos;
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);
}
deer_step(lookdeer0, y_pos, x_pos);
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);
}
--y_pos;
deer_step(lookdeer3, y_pos, x_pos);
return (0);
}
static void
done(int sig GCC_UNUSED)
{
CATCHALL(done);
move(LINES - 1, 0);
refresh();
endwin();
curs_set(1);
#if NO_LEAKS
if (my_pairs != 0)
free(my_pairs);
#endif
ExitProgram(EXIT_SUCCESS);
}
ncurses-5.9-20140118/test/dots_termcap.c 0000644 0001751 0000144 00000013325 12221647453 016307 0 ustar tom users /****************************************************************************
* Copyright (c) 2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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_termcap.c,v 1.7 2013/09/28 21:50:35 tom Exp $
*
* A simple demo of the termcap interface.
*/
#define USE_TINFO
#include
#if !defined(__MINGW32__)
#include
#endif
#if HAVE_TGETENT
#include
#define valid(s) ((s != 0) && s != (char *)-1)
static bool interrupted = FALSE;
static long total_chars = 0;
static time_t started;
static char *t_AB;
static char *t_AF;
static char *t_cl;
static char *t_cm;
static char *t_me;
static char *t_mr;
static char *t_oc;
static char *t_op;
static char *t_ve;
static char *t_vi;
static struct {
const char *name;
char **value;
} my_caps[] = {
{
"AB", &t_AB
},
{
"AF", &t_AF
},
{
"cl", &t_cl
},
{
"cm", &t_cm
},
{
"me", &t_me
},
{
"mr", &t_mr
},
{
"oc", &t_oc
},
{
"op", &t_op
},
{
"ve", &t_ve
},
{
"vi", &t_vi
},
};
static
TPUTS_PROTO(outc, c)
{
int rc = c;
if (interrupted) {
char tmp = (char) c;
if (write(STDOUT_FILENO, &tmp, (size_t) 1) == -1)
rc = EOF;
} else {
rc = putc(c, stdout);
}
TPUTS_RETURN(rc);
}
static bool
outs(char *s)
{
if (valid(s)) {
tputs(s, 1, outc);
return TRUE;
}
return FALSE;
}
static void
cleanup(void)
{
outs(t_me);
if (!outs(t_oc))
outs(t_op);
outs(t_cl);
outs(t_ve);
printf("\n\n%ld total chars, 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 void
my_napms(int ms)
{
#if defined(__MINGW32__) || !HAVE_GETTIMEOFDAY
Sleep(ms);
#else
struct timeval data;
data.tv_sec = 0;
data.tv_usec = ms * 1000;
select(0, NULL, NULL, NULL, &data);
#endif
}
int
main(int argc GCC_UNUSED,
char *argv[]GCC_UNUSED)
{
int x, y, z, p;
int num_colors;
int num_lines;
int num_columns;
double r;
double c;
char buffer[1024];
char area[1024];
char *name;
CATCHALL(onsig);
srand((unsigned) time(0));
if ((name = getenv("TERM")) == 0) {
fprintf(stderr, "TERM is not set\n");
ExitProgram(EXIT_FAILURE);
} else if (tgetent(buffer, name) < 0) {
fprintf(stderr, "terminal description not found\n");
ExitProgram(EXIT_FAILURE);
} else {
size_t t;
char *ap = area;
for (t = 0; t < SIZEOF(my_caps); ++t) {
*(my_caps[t].value) = tgetstr((NCURSES_CONST char *)
my_caps[t].name, &ap);
}
}
num_colors = tgetnum("Co");
num_lines = tgetnum("li");
num_columns = tgetnum("co");
outs(t_cl);
outs(t_vi);
if (num_colors > 1) {
if (!valid(t_AF)
|| !valid(t_AB)
|| (!valid(t_oc) && !valid(t_op)))
num_colors = -1;
}
r = (double) (num_lines - 4);
c = (double) (num_columns - 4);
started = time((time_t *) 0);
while (!interrupted) {
x = (int) (c * ranf()) + 2;
y = (int) (r * ranf()) + 2;
p = (ranf() > 0.9) ? '*' : ' ';
tputs(tgoto(t_cm, x, y), 1, outc);
if (num_colors > 0) {
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);
}
} else if (valid(t_me)
&& valid(t_mr)) {
if (ranf() <= 0.01) {
outs((ranf() > 0.6)
? t_mr
: t_me);
my_napms(1);
}
}
outc(p);
fflush(stdout);
++total_chars;
}
cleanup();
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(int argc GCC_UNUSED,
char *argv[]GCC_UNUSED)
{
fprintf(stderr, "This program requires termcap\n");
exit(EXIT_FAILURE);
}
#endif
ncurses-5.9-20140118/test/xterm-88color.dat 0000644 0001751 0000144 00000010160 11272664724 016603 0 ustar tom users ##############################################################################
# Copyright (c) 2005-2006,2009 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: xterm-88color.dat,v 1.3 2009/10/30 22:33:56 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
# manipulate the colors shown in the screen. The 'd' screen is limited to
# 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.
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
5: 205 0 205 magenta3
6: 0 205 205 cyan3
7: 229 229 229 gray90
8: 127 127 127 gray50
9: 255 0 0 red
10: 0 255 0 green
11: 255 255 0 yellow
12: 99 184 255 SteelBlue1
13: 255 0 255 magenta
14: 0 255 255 cyan
15: 255 255 255 white
16: 0 0 0
17: 0 0 139
18: 0 0 205
19: 0 0 255
20: 0 139 0
21: 0 139 139
22: 0 139 205
23: 0 139 255
24: 0 205 0
25: 0 205 139
26: 0 205 205
27: 0 205 255
28: 0 255 0
29: 0 255 139
30: 0 255 205
31: 0 255 255
32: 139 0 0
33: 139 0 139
34: 139 0 205
35: 139 0 255
36: 139 139 0
37: 139 139 139
38: 139 139 205
39: 139 139 255
40: 139 205 0
41: 139 205 139
42: 139 205 205
43: 139 205 255
44: 139 255 0
45: 139 255 139
46: 139 255 205
47: 139 255 255
48: 205 0 0
49: 205 0 139
50: 205 0 205
51: 205 0 255
52: 205 139 0
53: 205 139 139
54: 205 139 205
55: 205 139 255
56: 205 205 0
57: 205 205 139
58: 205 205 205
59: 205 205 255
60: 205 255 0
61: 205 255 139
62: 205 255 205
63: 205 255 255
64: 255 0 0
65: 255 0 139
66: 255 0 205
67: 255 0 255
68: 255 139 0
69: 255 139 139
70: 255 139 205
71: 255 139 255
72: 255 205 0
73: 255 205 139
74: 255 205 205
75: 255 205 255
76: 255 255 0
77: 255 255 139
78: 255 255 205
79: 255 255 255
80: 46 46 46
81: 92 92 92
82: 113 113 113
83: 139 139 139
84: 162 162 162
85: 185 185 185
86: 208 208 208
87: 231 231 231
ncurses-5.9-20140118/test/chgat.c 0000644 0001751 0000144 00000022035 12052040027 014671 0 ustar tom users /****************************************************************************
* Copyright (c) 2006-2010,2012 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: chgat.c,v 1.12 2012/11/18 01:55:35 tom Exp $
*
* test-driver for chgat/wchgat/mvchgat/mvwchgat
*/
#include
#if HAVE_CHGAT
#define SHOW(n) ((n) == ERR ? "ERR" : "OK")
#define COLOR_DEFAULT (-1)
#if defined(NCURSES_VERSION_PATCH) && NCURSES_VERSION_PATCH < 20060715
#define touch_if_needed(win, row) touchline(win, row, 1)
#else
#define touch_if_needed(win, row) /* nothing */
#endif
typedef struct {
unsigned c;
unsigned v;
short pair;
unsigned attr;
int count;
int ch;
const char *c_msg;
const char *v_msg;
int y_val;
int x_val;
int y_beg, x_beg;
int y_max, x_max;
} STATUS;
static const char *
color_params(unsigned state, short *pair)
{
/* *INDENT-OFF* */
static struct {
short pair;
short fg, bg;
const char *msg;
} table[] = {
{ 0, COLOR_DEFAULT, COLOR_DEFAULT, "default" },
{ 1, COLOR_RED, COLOR_BLACK, "red/black" },
{ 2, COLOR_WHITE, COLOR_BLUE, "white/blue" },
};
/* *INDENT-ON* */
static bool first = TRUE;
const char *result = 0;
if (has_colors()) {
if (first) {
unsigned n;
start_color();
for (n = 0; n < SIZEOF(table); ++n) {
init_pair(table[n].pair, table[n].fg, table[n].bg);
}
}
if (state < SIZEOF(table)) {
*pair = table[state].pair;
result = table[state].msg;
}
}
return result;
}
static const char *
video_params(unsigned state, unsigned *attr)
{
/* *INDENT-OFF* */
static struct {
unsigned attr;
const char *msg;
} table[] = {
{ A_NORMAL, "normal" },
{ A_BOLD, "bold" },
{ A_REVERSE, "reverse" },
{ A_UNDERLINE, "underline" },
{ A_BLINK, "blink" },
};
/* *INDENT-ON* */
const char *result = 0;
if (state < SIZEOF(table)) {
*attr = table[state].attr;
result = table[state].msg;
}
return result;
}
/* fill the window with a test-pattern */
static void
fill_window(WINDOW *win)
{
int y, x;
int y0 = -1, x0 = -1;
getyx(win, y, x);
wmove(win, 0, 0);
while (waddstr(win, "0123456789 abcdefghijklmnopqrstuvwxyz ") != ERR) {
int y1, x1;
getyx(win, y1, x1);
if (y1 == y0 && x1 == x0)
break;
x0 = x1;
y0 = y1;
}
wmove(win, y, x);
}
static void
show_status(WINDOW *win, STATUS * sp)
{
int y, x;
getyx(win, y, x);
wmove(win, 0, 0);
wprintw(win, "Count %d", sp->count);
if (sp->v_msg != 0)
wprintw(win, " Video %s", sp->v_msg);
if (sp->c_msg != 0)
wprintw(win, " Color %s", sp->c_msg);
wclrtoeol(win);
wmove(win, y, x);
}
static void
do_subwindow(WINDOW *win, STATUS * sp, void func(WINDOW *))
{
WINDOW *win1 = newwin(sp->y_max - 2, sp->x_max - 2,
sp->y_beg + 1, sp->x_beg + 1);
if (win1 != 0 && sp->y_max > 4 && sp->x_max > 4) {
WINDOW *win2 = derwin(win1, sp->y_max - 4, sp->x_max - 4, 1, 1);
if (win2 != 0) {
box(win1, 0, 0);
wrefresh(win1);
func(win2);
delwin(win2);
} else {
beep();
}
delwin(win1);
touchwin(win);
} else {
if (win1 != 0)
delwin(win1);
beep();
}
}
static void
init_status(WINDOW *win, STATUS * sp)
{
memset(sp, 0, sizeof(*sp));
sp->c = 99;
sp->v = 99;
sp->ch = ' ';
keypad(win, TRUE);
fill_window(win);
getbegyx(win, sp->y_beg, sp->x_beg);
getmaxyx(win, sp->y_max, sp->x_max);
}
static void
show_help(WINDOW *win)
{
static const char *table[] =
{
"Basic commands:"
,"Use h/j/k/l or arrow keys to move the cursor."
,"Set the count parameter for chgat by entering digits 0-9."
,""
,"Other commands:"
,"space toggles through the set of video attributes and colors."
,"t touches (forces repaint) of the current line."
,". calls *chgat at the current position with the given count."
,", calls *chgat at the window beginning with the given count."
,"= resets count to zero."
,"- negates count."
,"? shows this help-window"
,""
,""
};
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();
}
static void
update_status(WINDOW *win, STATUS * sp)
{
switch (sp->ch) {
case ' ': /* next test-iteration */
if (has_colors()) {
if ((sp->c_msg = color_params(++(sp->c), &(sp->pair))) == 0) {
sp->c_msg = color_params(sp->c = 0, &(sp->pair));
if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == 0) {
sp->v_msg = video_params(sp->v = 0, &(sp->attr));
}
}
} else {
if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == 0) {
sp->v_msg = video_params(sp->v = 0, &(sp->attr));
}
}
sp->count = 0;
show_status(win, sp);
break;
case KEY_LEFT:
case 'h':
if (sp->x_val > 0)
wmove(win, sp->y_val, --(sp->x_val));
break;
case KEY_DOWN:
case 'j':
if (sp->y_val < sp->y_max)
wmove(win, ++(sp->y_val), sp->x_val);
break;
case KEY_UP:
case 'k':
if (sp->y_val > 0)
wmove(win, --(sp->y_val), sp->x_val);
break;
case KEY_RIGHT:
case 'l':
if (sp->x_val < sp->x_max)
wmove(win, sp->y_val, ++(sp->x_val));
break;
case 't':
touchline(win, sp->y_val, 1);
break;
case '=':
sp->count = 0;
show_status(win, sp);
break;
case '-':
sp->count = -(sp->count);
show_status(win, sp);
break;
case '?':
do_subwindow(win, sp, show_help);
break;
default:
if (isdigit(sp->ch)) {
sp->count = (sp->count * 10) + (sp->ch - '0');
show_status(win, sp);
} else {
beep();
}
break;
}
}
static void
test_wchgat(WINDOW *win)
{
STATUS st;
init_status(win, &st);
do {
switch (st.ch) {
case '.': /* change from current position */
wchgat(win, st.count, st.attr, st.pair, (void *) 0);
touch_if_needed(win, st.y_val);
break;
case ',': /* change from beginning of window */
mvwchgat(win, 0, 0, st.count, st.attr, st.pair, (void *) 0);
touch_if_needed(win, 0);
wmove(win, st.y_val, st.x_val);
break;
case 'w':
do_subwindow(win, &st, test_wchgat);
break;
case 'q':
return;
default:
update_status(win, &st);
break;
}
} while ((st.ch = wgetch(win)) != ERR);
}
static void
test_chgat(void)
{
STATUS st;
init_status(stdscr, &st);
do {
switch (st.ch) {
case '.': /* change from current position */
chgat(st.count, st.attr, st.pair, (void *) 0);
touch_if_needed(stdscr, st.y_val);
break;
case ',': /* change from beginning of window */
mvchgat(0, 0, st.count, st.attr, st.pair, (void *) 0);
touch_if_needed(stdscr, 0);
move(st.y_val, st.x_val);
break;
case 'w':
do_subwindow(stdscr, &st, test_wchgat);
break;
case 'q':
return;
default:
update_status(stdscr, &st);
break;
}
} while ((st.ch = getch()) != ERR);
}
int
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
initscr();
cbreak();
noecho();
test_chgat();
endwin();
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(void)
{
printf("This program requires the curses chgat function\n");
ExitProgram(EXIT_FAILURE);
}
#endif
ncurses-5.9-20140118/test/newdemo.c 0000644 0001751 0000144 00000016604 12137025455 015262 0 ustar tom users /*
* 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 $
*/
#include
#include
/*
* The Australian map
*/
static CONST_MENUS char *AusMap[16] =
{
" A A ",
" N.T. AAAAA AAAA ",
" AAAAAAAAAAA AAAAAAAA ",
" AAAAAAAAAAAAAAAAAAAAAAAAA Qld.",
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAA ",
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ",
" AAAAAAAAAAAAAAAAAAAAAAAAAAAA ",
" AAAAAAAAAAAAAAAAAAAAAAAAA N.S.W.",
"W.A. AAAAAAAAA AAAAAA Vic.",
" AAA S.A. AA",
" A Tas.",
""
};
/*
* Funny messages
*/
#define NMESSAGES 6
static const char *messages[] =
{
"Hello from the Land Down Under",
"The Land of crocs. and a big Red Rock",
"Where the sunflower runs along the highways",
"the dusty red roads lead one to loneliness",
"Blue sky in the morning and",
"freezing nights and twinkling stars",
""
};
/*
* Trap interrupt
*/
static void
trap(int sig GCC_UNUSED)
{
endwin();
ExitProgram(EXIT_FAILURE);
}
/*
* Wait for user
*/
static int
WaitForUser(WINDOW *win)
{
time_t t;
chtype key;
nodelay(win, TRUE);
t = time((time_t *) 0);
while (1) {
if ((int) (key = (chtype) wgetch(win)) != ERR) {
if (key == 'q' || key == 'Q')
return 1;
else
return 0;
}
if (time((time_t *) 0) - t > 5)
return 0;
}
}
static void
set_colors(WINDOW *win, int pair, int foreground, int background)
{
if (has_colors()) {
if (pair > COLOR_PAIRS)
pair = COLOR_PAIRS;
init_pair((short) pair, (short) foreground, (short) background);
(void) wattrset(win, (int) COLOR_PAIR(pair));
}
}
static chtype
use_colors(WINDOW *win, int pair, chtype attrs)
{
if (has_colors()) {
if (pair > COLOR_PAIRS)
pair = COLOR_PAIRS;
attrs |= (chtype) COLOR_PAIR(pair);
}
(void) wattrset(win, (int) attrs);
return attrs;
}
/*
* Test sub windows
*/
static int
SubWinTest(WINDOW *win)
{
int w, h, sw, sh, bx, by;
WINDOW *swin1, *swin2, *swin3;
getmaxyx(win, h, w);
getbegyx(win, by, bx);
sw = w / 3;
sh = h / 3;
if ((swin1 = subwin(win, sh, sw, by + 3, bx + 5)) == NULL) {
return 1;
}
if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL) {
delwin(swin1);
return 1;
}
if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL) {
delwin(swin1);
delwin(swin2);
return 1;
}
set_colors(swin1, 8, COLOR_RED, COLOR_BLUE);
werase(swin1);
MvWAddStr(swin1, 0, 3, "Sub-window 1");
wrefresh(swin1);
set_colors(swin2, 9, COLOR_CYAN, COLOR_MAGENTA);
werase(swin2);
MvWAddStr(swin2, 0, 3, "Sub-window 2");
wrefresh(swin2);
set_colors(swin3, 10, COLOR_YELLOW, COLOR_GREEN);
werase(swin3);
MvWAddStr(swin3, 0, 3, "Sub-window 3");
wrefresh(swin3);
delwin(swin1);
delwin(swin2);
delwin(swin3);
WaitForUser(win);
return 0;
}
static int
bounce(int n, int *dir, int len)
{
if (*dir > 0)
++n;
else
--n;
if (n <= 1 || n >= len - 2)
*dir = *dir ? 0 : 1;
return n;
}
/*
* Bouncing balls
*/
static int
BouncingBalls(WINDOW *win)
{
int w, h;
int x1, y1, xd1, yd1;
int x2, y2, xd2, yd2;
int x3, y3, xd3, yd3;
getmaxyx(win, h, w);
x1 = 2 + rand() % (w - 4);
y1 = 2 + rand() % (h - 4);
x2 = 2 + rand() % (w - 4);
y2 = 2 + rand() % (h - 4);
x3 = 2 + rand() % (w - 4);
y3 = 2 + rand() % (h - 4);
xd1 = 1;
yd1 = 1;
xd2 = 1;
yd2 = 0;
xd3 = 0;
yd3 = 1;
nodelay(win, TRUE);
while (wgetch(win) == ERR) {
x1 = bounce(x1, &xd1, w);
y1 = bounce(y1, &yd1, h);
x2 = bounce(x2, &xd2, w);
y2 = bounce(y2, &yd2, h);
x3 = bounce(x3, &xd3, w);
y3 = bounce(y3, &yd3, h);
set_colors(win, 11, COLOR_RED, COLOR_BLUE);
MvWAddCh(win, y1, x1, 'O');
set_colors(win, 12, COLOR_BLUE, COLOR_RED);
MvWAddCh(win, y2, x2, '*');
set_colors(win, 13, COLOR_YELLOW, COLOR_WHITE);
MvWAddCh(win, y3, x3, '@');
wmove(win, 0, 0);
wrefresh(win);
delay_output(100);
}
return 0;
}
/*
* Main driver
*/
int
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
WINDOW *win;
int w, x, y, i, j, k;
char buffer[SIZEOF(messages) * 80];
const char *message;
int width, height;
chtype save[80];
chtype c;
setlocale(LC_ALL, "");
CATCHALL(trap);
initscr();
if (has_colors())
start_color();
cbreak();
curs_set(0);
width = 48;
height = 14; /* Create a drawing window */
win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2);
if (win == NULL) {
endwin();
ExitProgram(EXIT_FAILURE);
}
while (1) {
set_colors(win, 1, COLOR_WHITE, COLOR_BLUE);
werase(win);
set_colors(win, 2, COLOR_RED, COLOR_RED);
box(win, ACS_VLINE, ACS_HLINE);
wrefresh(win);
/* Do ramdom output of a character */
use_colors(win, 1, A_NORMAL);
c = 'a';
for (i = 0; i < 5000; ++i) {
x = rand() % (width - 2) + 1;
y = rand() % (height - 2) + 1;
MvWAddCh(win, y, x, c);
wrefresh(win);
nodelay(win, TRUE);
if (wgetch(win) != ERR)
break;
if (i == 2000) {
c = 'b';
set_colors(win, 3, COLOR_CYAN, COLOR_YELLOW);
}
}
SubWinTest(win);
/* Erase and draw green window */
set_colors(win, 4, COLOR_YELLOW, COLOR_GREEN);
wbkgd(win, use_colors(win, 4, A_BOLD));
werase(win);
wrefresh(win);
/* Draw RED bounding box */
use_colors(win, 2, A_NORMAL);
box(win, ' ', ' ');
wrefresh(win);
/* Display Australia map */
use_colors(win, 4, A_BOLD);
i = 0;
while (*AusMap[i]) {
MvWAddStr(win, i + 1, 8, AusMap[i]);
wrefresh(win);
delay_output(50);
++i;
}
set_colors(win, 5, COLOR_BLUE, COLOR_WHITE);
use_colors(win, 5, A_BLINK);
MvWAddStr(win, height - 2, 6, " PDCurses 2.1 for DOS, OS/2 and Unix");
wrefresh(win);
/* Draw running messages */
set_colors(win, 6, COLOR_YELLOW, COLOR_WHITE);
message = messages[j = 0];
i = 1;
w = width - 2;
strcpy(buffer, message);
while (j < NMESSAGES) {
while ((int) strlen(buffer) < w) {
strcat(buffer, " ... ");
strcat(buffer, messages[++j % NMESSAGES]);
}
if (i < w)
(void) mvwaddnstr(win, height / 2, w - i, buffer, i);
else
(void) mvwaddnstr(win, height / 2, 1, buffer, w);
wrefresh(win);
nodelay(win, TRUE);
if (wgetch(win) != ERR) {
flushinp();
break;
}
if (i++ >= w) {
for (k = 0; (buffer[k] = buffer[k + 1]) != '\0'; k++) ;
}
delay_output(100);
}
j = 0;
/* Draw running As across in RED */
set_colors(win, 7, COLOR_RED, COLOR_GREEN);
memset(save, ' ', sizeof(save));
for (i = 2; i < width - 4; ++i) {
k = (int) mvwinch(win, 4, i);
if (k == ERR)
break;
save[j++] = c = (chtype) k;
c &= A_CHARTEXT;
MvWAddCh(win, 4, i, c);
}
wrefresh(win);
/* Put a message up wait for a key */
i = height - 2;
use_colors(win, 5, A_NORMAL);
MvWAddStr(win, i, 5, " Type a key to continue or 'Q' to quit ");
wrefresh(win);
if (WaitForUser(win) == 1)
break;
j = 0; /* Restore the old line */
for (i = 2; i < width - 4; ++i)
MvWAddCh(win, 4, i, save[j++]);
wrefresh(win);
BouncingBalls(win);
/* Put a message up wait for a key */
i = height - 2;
use_colors(win, 5, A_NORMAL);
MvWAddStr(win, i, 5, " Type a key to continue or 'Q' to quit ");
wrefresh(win);
if (WaitForUser(win) == 1)
break;
}
endwin();
ExitProgram(EXIT_SUCCESS);
}
ncurses-5.9-20140118/test/test_arrays.c 0000644 0001751 0000144 00000007515 11467566705 016202 0 ustar tom users /****************************************************************************
* Copyright (c) 2007,2008 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_arrays.c,v 1.5 2010/11/13 19:57:57 tom Exp $
*
* Author: Thomas E Dickey
*
* Demonstrate the public arrays from the terminfo library.
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];
*/
#define USE_TINFO
#include
#if HAVE_TIGETSTR
#if defined(HAVE_CURSES_DATA_BOOLNAMES) || defined(DECL_CURSES_DATA_BOOLNAMES)
#define DUMP(name) dump_array(#name, name)
static void
dump_array(const char *name, NCURSES_CONST char *const *list)
{
int n;
printf("%s:\n", name);
for (n = 0; list[n] != 0; ++n) {
printf("%5d:%s\n", n, list[n]);
}
}
int
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
DUMP(boolnames);
DUMP(boolcodes);
DUMP(boolfnames);
DUMP(numnames);
DUMP(numcodes);
DUMP(numfnames);
DUMP(strnames);
DUMP(strcodes);
DUMP(strfnames);
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 */
ncurses-5.9-20140118/test/Makefile.in 0000644 0001751 0000144 00000011776 12224122302 015514 0 ustar tom users # $Id: Makefile.in,v 1.111 2013/10/05 23:46:10 tom Exp $
##############################################################################
# Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "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 1996-on
#
# Makefile for ncurses tests.
# turn off _all_ suffix rules; we'll generate our own
.SUFFIXES:
SHELL = /bin/sh
VPATH = @srcdir@
@SET_MAKE@
destdir =
x = @EXEEXT@
o = .@OBJEXT@
MODEL = ../@DFT_OBJ_SUBDIR@
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
includesubdir = @includesubdir@
BINDIR = $(DESTDIR)$(bindir)
LIBDIR = $(DESTDIR)$(libdir)
INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir)
LIBTOOL = @LIBTOOL@
LIBTOOL_CLEAN = @LIB_CLEAN@
LIBTOOL_COMPILE = @LIB_COMPILE@
LIBTOOL_LINK = @LIB_LINK@
INSTALL = @INSTALL@
INSTALL_PROG = @INSTALL_PROGRAM@
transform = @program_transform_name@
TRANSFORM = sed 's/$x$$//'|sed '$(transform)'|sed 's/$$/$x/'
CTAGS = @CTAGS@
ETAGS = @ETAGS@
CC = @CC@
CPP = @CPP@
CFLAGS = @CFLAGS@ @EXTRA_CFLAGS@
CPPFLAGS = -I. -I$(srcdir) -I../test -DHAVE_CONFIG_H @CPPFLAGS@
CCFLAGS = $(CPPFLAGS) $(CFLAGS)
CFLAGS_LIBTOOL = $(CCFLAGS)
CFLAGS_NORMAL = $(CCFLAGS)
CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE
CFLAGS_PROFILE = $(CCFLAGS) -pg
CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@
CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@)
REL_VERSION = @cf_cv_rel_version@
ABI_VERSION = @cf_cv_abi_version@
LOCAL_LIBDIR = @top_builddir@/lib
LOCAL_LIBS = @TEST_DEPS@
MATH_LIB = @MATH_LIB@
TEST_LIBS = @TEST_LIBS@
LD = @LD@
LINK = @LINK_TESTS@ $(LIBTOOL_LINK) $(CFLAGS)
LDFLAGS = @LD_MODEL@ @LOCAL_LDFLAGS@ @LDFLAGS@
LDFLAGS_LIBTOOL = $(LDFLAGS) $(CFLAGS_LIBTOOL)
LDFLAGS_NORMAL = $(LDFLAGS) $(CFLAGS_NORMAL)
LDFLAGS_DEBUG = $(LDFLAGS) $(CFLAGS_DEBUG)
LDFLAGS_PROFILE = $(LDFLAGS) $(CFLAGS_PROFILE)
LDFLAGS_SHARED = $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@
TEST_ARGS = @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@
# use these for linking with all of the libraries
LIBS_DEFAULT = $(TEST_ARGS) @LIBS@ $(TEST_LIBS) $(MATH_LIB)
LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_DEFAULT)
# use these for linking with the (n)curses library and possibly pthreads
LIBS_THREADS = `echo "$(TEST_ARGS) @LIBS@" | sed -e 's/-lform.*-lpanel[^ ]*//'` $(TEST_LIBS) $(MATH_LIB) @PTHREAD@
LDFLAGS_THREADS = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_THREADS)
# use these for linking with the (n)curses library
LIBS_CURSES = `echo "$(TEST_ARGS) @LIBS@" | sed -e 's/-lform.*-lpanel[^ ]*//'` $(TEST_LIBS) $(MATH_LIB)
LDFLAGS_CURSES = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_CURSES)
# use these for linking with the tinfo library if we have it, or curses library if not
LIBS_TINFO = @LDFLAGS_STATIC@ @TINFO_LIBS@ @LDFLAGS_SHARED@ @LIBS@ $(TEST_LIBS) $(MATH_LIB)
LDFLAGS_TINFO = @TINFO_LDFLAGS@ $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO)
LINT = @LINT@
LINT_OPTS = @LINT_OPTS@
LINT_LIBS = -lform -lmenu -lpanel -lncurses @LIBS@
HEADER_DEPS = \
../include/curses.h \
../include/term.h
# The rest is generated from the "programs" and "modules" files...
ncurses-5.9-20140118/test/clip_printw.c 0000644 0001751 0000144 00000022142 12052027124 016137 0 ustar tom users /****************************************************************************
* Copyright (c) 2008-2010,2012 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: clip_printw.c,v 1.9 2012/11/18 00:39:48 tom Exp $
*
* demonstrate how to use printw without wrapping.
*/
#include
#ifdef HAVE_VW_PRINTW
#define SHOW(n) ((n) == ERR ? "ERR" : "OK")
#define COLOR_DEFAULT (-1)
typedef struct {
unsigned c;
unsigned v;
int status;
int pair;
attr_t attr;
int count;
int ch;
const char *c_msg;
const char *v_msg;
int y_val;
int x_val;
int y_beg, x_beg;
int y_max, x_max;
} STATUS;
static int
clip_wprintw(WINDOW *win, NCURSES_CONST char *fmt,...)
{
int y0, x0, y1, x1, width;
WINDOW *sub;
va_list ap;
int rc;
/*
* Allocate a single-line derived window extending from the current
* cursor position to the end of the current line in the given window.
* Disable scrolling in the derived window.
*/
getyx(win, y0, x0);
width = getmaxx(win) - x0;
sub = derwin(win, 1, width, y0, x0);
scrollok(sub, FALSE);
/*
* Print the text.
*/
va_start(ap, fmt);
rc = vw_printw(sub, fmt, ap);
va_end(ap);
getyx(sub, y1, x1);
delwin(sub);
wmove(win, y1 + y0, x1 + x0);
return rc;
}
static const char *
color_params(unsigned state, int *pair)
{
/* *INDENT-OFF* */
static struct {
int pair;
int fg, bg;
const char *msg;
} table[] = {
{ 0, COLOR_DEFAULT, COLOR_DEFAULT, "default" },
{ 1, COLOR_RED, COLOR_BLACK, "red/black" },
{ 2, COLOR_WHITE, COLOR_BLUE, "white/blue" },
};
/* *INDENT-ON* */
static bool first = TRUE;
const char *result = 0;
if (has_colors()) {
if (first) {
unsigned n;
start_color();
for (n = 0; n < SIZEOF(table); ++n) {
init_pair((short) table[n].pair,
(short) table[n].fg,
(short) table[n].bg);
}
}
if (state < SIZEOF(table)) {
*pair = table[state].pair;
result = table[state].msg;
}
}
return result;
}
static const char *
video_params(unsigned state, attr_t *attr)
{
/* *INDENT-OFF* */
static struct {
attr_t attr;
const char *msg;
} table[] = {
{ A_NORMAL, "normal" },
{ A_BOLD, "bold" },
{ A_REVERSE, "reverse" },
{ A_UNDERLINE, "underline" },
{ A_BLINK, "blink" },
};
/* *INDENT-ON* */
const char *result = 0;
if (state < SIZEOF(table)) {
*attr = table[state].attr;
result = table[state].msg;
}
return result;
}
/* fill the window with a test-pattern */
static void
fill_window(WINDOW *win)
{
int y, x;
int y0 = -1, x0 = -1;
getyx(win, y, x);
wmove(win, 0, 0);
while (waddstr(win, "0123456789 abcdefghijklmnopqrstuvwxyz ") != ERR) {
int y1, x1;
getyx(win, y1, x1);
if (y1 == y0 && x1 == x0)
break;
x0 = x1;
y0 = y1;
}
wmove(win, y, x);
}
static void
show_status(WINDOW *win, STATUS * sp)
{
int y, x;
getyx(win, y, x);
wmove(win, 0, 0);
wprintw(win, "Count %d", sp->count);
if (sp->v_msg != 0)
wprintw(win, " Video %s", sp->v_msg);
if (sp->c_msg != 0)
wprintw(win, " Color %s", sp->c_msg);
wprintw(win, " (%d)", sp->status);
wclrtoeol(win);
wmove(win, y, x);
}
static void
do_subwindow(WINDOW *win, STATUS * sp, void func(WINDOW *))
{
WINDOW *win1 = newwin(sp->y_max - 2, sp->x_max - 2,
sp->y_beg + 1, sp->x_beg + 1);
if (win1 != 0 && sp->y_max > 4 && sp->x_max > 4) {
WINDOW *win2 = derwin(win1, sp->y_max - 4, sp->x_max - 4, 1, 1);
if (win2 != 0) {
box(win1, 0, 0);
wrefresh(win1);
func(win2);
delwin(win2);
} else {
beep();
}
delwin(win1);
touchwin(win);
} else {
if (win1)
delwin(win1);
beep();
}
}
static void
init_status(WINDOW *win, STATUS * sp)
{
memset(sp, 0, sizeof(*sp));
sp->c = 99;
sp->v = 99;
sp->ch = ' ';
keypad(win, TRUE);
fill_window(win);
getbegyx(win, sp->y_beg, sp->x_beg);
getmaxyx(win, sp->y_max, sp->x_max);
}
static void
show_help(WINDOW *win)
{
static const char *table[] =
{
"Basic commands:"
,"Use h/j/k/l or arrow keys to move the cursor."
,"Set the count parameter for clip_wprintw by entering digits 0-9."
,""
,"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."
,"= resets count to zero."
,"? shows this help-window"
,""
};
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();
}
static void
update_status(WINDOW *win, STATUS * sp)
{
switch (sp->ch) {
case ' ': /* next test-iteration */
if (has_colors()) {
if ((sp->c_msg = color_params(++(sp->c), &(sp->pair))) == 0) {
sp->c_msg = color_params(sp->c = 0, &(sp->pair));
if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == 0) {
sp->v_msg = video_params(sp->v = 0, &(sp->attr));
}
}
} else {
if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == 0) {
sp->v_msg = video_params(sp->v = 0, &(sp->attr));
}
}
sp->count = 0;
show_status(win, sp);
break;
case KEY_LEFT:
case 'h':
if (sp->x_val > 0)
wmove(win, sp->y_val, --(sp->x_val));
break;
case KEY_DOWN:
case 'j':
if (sp->y_val < sp->y_max)
wmove(win, ++(sp->y_val), sp->x_val);
break;
case KEY_UP:
case 'k':
if (sp->y_val > 0)
wmove(win, --(sp->y_val), sp->x_val);
break;
case KEY_RIGHT:
case 'l':
if (sp->x_val < sp->x_max)
wmove(win, sp->y_val, ++(sp->x_val));
break;
case 't':
touchline(win, sp->y_val, 1);
break;
case '=':
sp->count = 0;
show_status(win, sp);
break;
case '?':
do_subwindow(win, sp, show_help);
break;
default:
if (isdigit(sp->ch)) {
sp->count = (sp->count * 10) + (sp->ch - '0');
show_status(win, sp);
} else {
beep();
}
break;
}
}
static void
test_clipping(WINDOW *win)
{
STATUS st;
char fmt[80];
char *buffer;
unsigned j, need;
init_status(win, &st);
do {
switch (st.ch) {
case '.': /* change from current position */
(void) wattrset(win, (int) (st.attr | (chtype) COLOR_PAIR(st.pair)));
if (st.count > 0) {
need = (unsigned) st.count + 1;
sprintf(fmt, "%%c%%%ds%%c", st.count);
} else {
need = (unsigned) getmaxx(win) - 1;
strcpy(fmt, "%c%s%c");
}
if ((buffer = typeMalloc(char, need + 1)) != 0) {
for (j = 0; j < need; ++j) {
buffer[j] = (char) ('A' + (j % 26));
}
buffer[need - 1] = '\0';
st.status = clip_wprintw(win, fmt, '[', buffer, ']');
free(buffer);
}
break;
case 'w':
do_subwindow(win, &st, test_clipping);
break;
case 'q':
return;
default:
update_status(win, &st);
break;
}
} while ((st.ch = wgetch(win)) != ERR);
}
int
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
initscr();
cbreak();
noecho();
test_clipping(stdscr);
endwin();
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(void)
{
printf("This program requires the curses vw_printw function\n");
ExitProgram(EXIT_FAILURE);
}
#endif
ncurses-5.9-20140118/test/demo_terminfo.c 0000644 0001751 0000144 00000023763 12221647411 016453 0 ustar tom users /****************************************************************************
* Copyright (c) 2009-2012,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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_terminfo.c,v 1.19 2013/09/28 21:50:01 tom Exp $
*
* A simple demo of the terminfo interface.
*/
#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 b_opt = FALSE;
static bool f_opt = FALSE;
static bool n_opt = FALSE;
static bool q_opt = FALSE;
static bool s_opt = FALSE;
static bool x_opt = FALSE;
static char *d_opt;
static char *e_opt;
static char **db_list;
static int db_item;
static long total_values;
#define FCOLS 8
#define FNAME(type) "%s %-*s = ", #type, 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);
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;
}
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;
}
}
static void
dumpit(NCURSES_CONST char *cap)
{
/*
* 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++;
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");
}
} else if ((num = tigetnum(cap)) >= 0) {
total_values++;
if (!q_opt) {
printf(FNAME(num), cap);
printf(" %d\n", num);
}
} else if ((num = tigetflag(cap)) >= 0) {
total_values++;
if (!q_opt) {
printf(FNAME(flg), cap);
printf("%s\n", num ? "true" : "false");
}
}
if (!q_opt)
fflush(stdout);
}
static void
demo_terminfo(char *name)
{
unsigned n;
NCURSES_CONST char *cap;
if (db_list) {
putenv(next_dbitem());
}
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];
if (cap == 0)
break;
dumpit(cap);
}
}
if (n_opt) {
for (n = 0;; ++n) {
cap = f_opt ? numfnames[n] : numnames[n];
if (cap == 0)
break;
dumpit(cap);
}
}
if (s_opt) {
for (n = 0;; ++n) {
cap = f_opt ? strfnames[n] : strnames[n];
if (cap == 0)
break;
dumpit(cap);
}
}
#ifdef NCURSES_VERSION
if (x_opt) {
int mod;
if (f_opt) {
#if NCURSES_XNAMES
TERMTYPE *term = &(cur_term->type);
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));
}
for (n = NUMCOUNT; n < NUM_NUMBERS(term); ++n) {
dumpit(ExtNumname(term, (int) n, numnames));
}
for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) {
dumpit(ExtStrname(term, (int) n, strnames));
}
}
#endif
} else {
char temp[80];
static const char *xterm_keys[] =
{
"kDC", "kDN", "kEND", "kHOM", "kIC",
"kLFT", "kNXT", "kPRV", "kRIT", "kUP",
};
for (n = 0; n < SIZEOF(xterm_keys); ++n) {
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);
}
}
}
}
#endif
}
static void
usage(void)
{
static const char *msg[] =
{
"Usage: demo_terminfo [options] [terminal]",
"",
"If no options are given, print all (boolean, numeric, string)",
"capabilities for the given terminal, using short names.",
"",
"Options:",
" -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",
" -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",
#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;
int repeat;
char *name;
int r_opt = 1;
#ifdef NCURSES_VERSION
bool xy_opt = TRUE; /* by default, use_extended_names is true */
#endif
while ((n = getopt(argc, argv, "bd:e:fnqr:sxy")) != -1) {
switch (n) {
case 'b':
b_opt = TRUE;
break;
case 'd':
d_opt = optarg;
break;
case 'e':
e_opt = optarg;
break;
case 'f':
f_opt = TRUE;
break;
case 'n':
n_opt = TRUE;
break;
case 'q':
q_opt = TRUE;
break;
case 'r':
if ((r_opt = atoi(optarg)) <= 0)
usage();
break;
case 's':
s_opt = TRUE;
break;
#ifdef NCURSES_VERSION
case 'x':
x_opt = TRUE;
xy_opt = TRUE;
break;
case 'y':
xy_opt = FALSE;
break;
#endif
default:
usage();
break;
}
}
#if NCURSES_XNAMES
use_extended_names(xy_opt);
#endif
if (!(b_opt || n_opt || s_opt || x_opt)) {
b_opt = TRUE;
n_opt = TRUE;
s_opt = TRUE;
}
make_dblist();
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);
}
}
printf("%ld values\n", total_values);
free_dblist();
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 */
ncurses-5.9-20140118/test/aclocal.m4 0000644 0001751 0000144 00000333612 12244172056 015320 0 ustar tom users dnl***************************************************************************
dnl Copyright (c) 2003-2012,2013 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 *
dnl "Software"), to deal in the Software without restriction, including *
dnl without limitation the rights to use, copy, modify, merge, publish, *
dnl distribute, distribute with modifications, sublicense, and/or sell *
dnl copies of the Software, and to permit persons to whom the Software is *
dnl furnished to do so, subject to the following conditions: *
dnl *
dnl The above copyright notice and this permission notice shall be included *
dnl in all copies or substantial portions of the Software. *
dnl *
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
dnl *
dnl Except as contained in this notice, the name(s) of the above copyright *
dnl holders shall not be used in advertising or otherwise to promote the *
dnl sale, use or other dealings in this Software without prior written *
dnl authorization. *
dnl***************************************************************************
dnl
dnl $Id: aclocal.m4,v 1.93 2013/11/23 18:30:06 tom Exp $
dnl
dnl Author: Thomas E. Dickey
dnl
dnl Macros used in NCURSES test programs auto-configuration script.
dnl
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
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56
dnl ------------------
dnl Conditionally generate script according to whether we're using a given autoconf.
dnl
dnl $1 = version to compare against
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([m4_version_compare],
[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
[CF_ACVERSION_COMPARE(
AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
dnl --------------------
dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
dnl MAJOR2, MINOR2, TERNARY2,
dnl PRINTABLE2, not FOUND, FOUND)
define([CF_ACVERSION_COMPARE],
[ifelse(builtin([eval], [$2 < $5]), 1,
[ifelse([$8], , ,[$8])],
[ifelse([$9], , ,[$9])])])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42
dnl -------------
dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
dnl The second parameter if given makes this macro verbose.
dnl
dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
dnl confused by the quotes (which require backslashes to keep them usable).
AC_DEFUN([CF_ADD_CFLAGS],
[
cf_fix_cppflags=no
cf_new_cflags=
cf_new_cppflags=
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
case $cf_add_cflags in
-D*)
cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
test "${cf_add_cflags}" != "${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"
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_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
;;
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_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
test "${cf_add_cflags}" != "${cf_tst_cflags}" \
&& test -z "${cf_tst_cflags}" \
&& cf_fix_cppflags=no
;;
esac
done
if test -n "$cf_new_cflags" ; then
ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
CFLAGS="$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"
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"
fi
AC_SUBST(EXTRA_CPPFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57
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,
dnl but old versions (and some misinstalled ones) need that. To make things
dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
dnl the include-path).
AC_DEFUN([CF_ADD_INCDIR],
[
if test -n "$1" ; then
for cf_add_incdir in $1
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"
AC_TRY_COMPILE([#include ],
[printf("Hello")],
[],
[cf_have_incdir=yes])
CPPFLAGS=$cf_save_CPPFLAGS
fi
fi
fi
if test "$cf_have_incdir" = no ; then
CF_VERBOSE(adding $cf_add_incdir to include-path)
ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -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
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
dnl ----------
dnl Add a library, used to enforce consistency.
dnl
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 -------------
dnl Adds to the library-path
dnl
dnl Some machines have trouble with multiple -L options.
dnl
dnl $1 is the (list of) directory(s) to add
dnl $2 is the optional name of the variable to update (default LDFLAGS)
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
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05
dnl -----------
dnl Add one or more libraries, used to enforce consistency.
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
dnl ---------------------------------------------------------------------------
dnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22
dnl ----------------
dnl Add a given library after another, e.g., following the one it satisfies a
dnl dependency for.
dnl
dnl $1 = the first library
dnl $2 = its dependency
AC_DEFUN([CF_ADD_LIB_AFTER],[
CF_VERBOSE(...before $LIBS)
LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s%$1 %$1 $2 %" -e 's% % %g'`
CF_VERBOSE(...after $LIBS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05
dnl ------------------
dnl Append to a search-list for a nonstandard header/lib-file
dnl $1 = the variable to return as result
dnl $2 = the package name
dnl $3 = the subdirectory, e.g., bin, include or lib
dnl $4 = the directory under which we will test for subdirectories
dnl $5 = a directory that we do not want $4 to match
AC_DEFUN([CF_ADD_SUBDIR_PATH],
[
test "x$4" != "x$5" && \
test -d "$4" && \
ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) {
test -n "$verbose" && echo " ... testing for $3-directories under $4"
test -d $4/$3 && $1="[$]$1 $4/$3"
test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$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.
AC_DEFUN([CF_ARG_DISABLE],
[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
dnl -------------
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 -------------
dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
dnl values.
dnl
dnl Parameters:
dnl $1 = option name
dnl $2 = help-string
dnl $3 = action to perform if option is not default
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
ifelse([$3],,[ :]dnl
,[ $3]) ifelse([$4],,,[
else
$4])
fi],[enableval=$5 ifelse([$4],,,[
$4
])dnl
])])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49
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.
AC_DEFUN([CF_CC_ENV_FLAGS],
[
# This should have been defined by AC_PROG_CC
: ${CC:=cc}
AC_MSG_CHECKING(\$CC variable)
case "$CC" in #(vi
*[[\ \ ]]-[[IUD]]*)
AC_MSG_RESULT(broken)
AC_MSG_WARN(your environment misuses 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)
;;
*)
AC_MSG_RESULT(ok)
;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
dnl --------------
dnl Check if we're accidentally using a cache from a different machine.
dnl Derive the system name, as a check for reusing the autoconf cache.
dnl
dnl If we've packaged config.guess and config.sub, run that (since it does a
dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
dnl which is useful in cross-compiles.
dnl
dnl Note: we would use $ac_config_sub, but that is one of the places where
dnl autoconf 2.5x broke compatibility with autoconf 2.13
AC_DEFUN([CF_CHECK_CACHE],
[
if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
ifelse([$1],,[AC_CANONICAL_HOST],[$1])
system_name="$host_os"
else
system_name="`(uname -s -r) 2>/dev/null`"
if test -z "$system_name" ; then
system_name="`(hostname) 2>/dev/null`"
fi
fi
test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
test -z "$system_name" && system_name="$cf_cv_system_name"
test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
if test ".$system_name" != ".$cf_cv_system_name" ; then
AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
AC_MSG_ERROR("Please remove config.cache and try again.")
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58
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
dnl often contain compiler-specific options which we cannot use, mixed with
dnl preprocessor options that we usually can.
AC_DEFUN([CF_CHECK_CFLAGS],
[
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
AC_TRY_LINK([#include ],[printf("Hello world");],,
[CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS)
if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
CF_VERBOSE(but keeping change to \$CPPFLAGS)
fi
CFLAGS="$cf_check_flags"])
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
dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
dnl not ignore some gcc options.
dnl
dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
dnl the wrappers for gcc and g++ warnings.
dnl
dnl $1 = GCC (default) or GXX
dnl $2 = CLANG_COMPILER (default)
dnl $3 = CFLAGS (default) or CXXFLAGS
AC_DEFUN([CF_CLANG_COMPILER],[
ifelse([$2],,CLANG_COMPILER,[$2])=no
if test "$ifelse([$1],,[$1],GCC)" = yes ; then
AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
AC_TRY_COMPILE([],[
#ifdef __clang__
#else
make an error
#endif
],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
],[])
ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
fi
])
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_ACS_MAP version: 7 updated: 2012/10/06 16:39:58
dnl -----------------
dnl Check for likely values of acs_map[]:
AC_DEFUN([CF_CURSES_ACS_MAP],
[
AC_REQUIRE([CF_NCURSES_WRAP_PREFIX])dnl
AC_CACHE_CHECK(for alternate character set array, cf_cv_curses_acs_map,[
cf_cv_curses_acs_map=unknown
for name in acs_map _acs_map __acs_map ${NCURSES_WRAP_PREFIX}acs_map
do
AC_TRY_LINK([
#include <${cf_cv_ncurses_header:-curses.h}>
],[
$name['k'] = ACS_PLUS
],[cf_cv_curses_acs_map=$name; break])
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 --------------------
dnl Check if curses.h defines the given data/variable.
dnl Use this after CF_NCURSES_CONFIG or CF_CURSES_CONFIG.
AC_DEFUN([CF_CURSES_CHECK_DATA],
[
AC_MSG_CHECKING(for data $1 declaration in ${cf_cv_ncurses_header:-curses.h})
AC_TRY_COMPILE(CF__CURSES_HEAD,[
void *foo = &($1)
],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)
AC_DEFINE_UNQUOTED($cf_result)
else
AC_MSG_CHECKING(for data $1 in library)
# BSD linkers insist on making weak linkage, but resolve at runtime.
AC_TRY_RUN(CF__CURSES_HEAD
[
extern char $1;
int main(void)
{
void *foo = &($1);
${cf_cv_main_return:-return}(foo == 0);
}],[cf_result=yes],[cf_result=no],[
# cross-compiling
AC_TRY_LINK(CF__CURSES_HEAD
[extern char $1;],[
do {
void *foo = &($1);
${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)
AC_DEFINE_UNQUOTED($cf_result)
fi
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_CHECK_TYPE version: 4 updated: 2012/10/06 16:39:58
dnl --------------------
dnl Check if curses.h defines the given type
AC_DEFUN([CF_CURSES_CHECK_TYPE],
[
AC_MSG_CHECKING(for type $1 in ${cf_cv_ncurses_header:-curses.h})
AC_TRY_COMPILE([
#ifndef _XOPEN_SOURCE_EXTENDED
#define _XOPEN_SOURCE_EXTENDED
#endif
#include <${cf_cv_ncurses_header:-curses.h}>],[
$1 foo
],cf_result=yes,cf_result=no)
AC_MSG_RESULT($cf_result)
if test $cf_result = yes ; then
CF_UPPER(cf_result,have_type_$1)
AC_DEFINE_UNQUOTED($cf_result,1,[Define to 1 if we have type $1])
else
AC_DEFINE_UNQUOTED($1,$2,[Define to appropriate type if $1 is not declared])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27
dnl ----------------
dnl Tie together the configure-script macros for curses. It may be ncurses,
dnl but unless asked, we do not make a special search for ncurses. However,
dnl still check for the ncurses version number, for use in other macros.
AC_DEFUN([CF_CURSES_CONFIG],
[
CF_CURSES_CPPFLAGS
CF_NCURSES_VERSION
CF_CURSES_LIBS
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_CPPFLAGS version: 11 updated: 2011/04/09 14:51:08
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
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
])
test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
CF_CURSES_HEADER
CF_TERM_HEADER
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_FUNCS version: 17 updated: 2011/05/14 16:07:29
dnl ---------------
dnl Curses-functions are a little complicated, since a lot of them are macros.
AC_DEFUN([CF_CURSES_FUNCS],
[
AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
AC_REQUIRE([CF_XOPEN_CURSES])
AC_REQUIRE([CF_CURSES_TERM_H])
AC_REQUIRE([CF_CURSES_UNCTRL_H])
for cf_func in $1
do
CF_UPPER(cf_tr_func,$cf_func)
AC_MSG_CHECKING(for ${cf_func})
CF_MSG_LOG(${cf_func})
AC_CACHE_VAL(cf_cv_func_$cf_func,[
eval cf_result='$ac_cv_func_'$cf_func
if test ".$cf_result" != ".no"; then
AC_TRY_LINK(CF__CURSES_HEAD,
[
#ifndef ${cf_func}
long foo = (long)(&${cf_func});
if (foo + 1234 > 5678)
${cf_cv_main_return:-return}(foo);
#endif
],
[cf_result=yes],
[cf_result=no])
fi
eval 'cf_cv_func_'$cf_func'=$cf_result'
])
# use the computed/retrieved cache-value:
eval 'cf_result=$cf_cv_func_'$cf_func
AC_MSG_RESULT($cf_result)
if test $cf_result != no; then
AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func})
fi
done
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45
dnl ----------------
dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
dnl variations of ncurses' installs.
dnl
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])
do
AC_TRY_COMPILE([#include <${cf_header}>],
[initscr(); tgoto("?", 0,0)],
[cf_cv_ncurses_header=$cf_header; break],[])
done
])
if test "$cf_cv_ncurses_header" = none ; then
AC_MSG_ERROR(No curses header-files found)
fi
# cheat, to get the right #define's for HAVE_NCURSES_H, etc.
AC_CHECK_HEADERS($cf_cv_ncurses_header)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_LIBS version: 37 updated: 2013/02/09 17:33:50
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.
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)
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
# 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
AC_CHECK_LIB(cur_colr,initscr,[
CF_ADD_LIBS(-lcur_colr)
ac_cv_func_initscr=yes
],[
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"
ac_cv_func_initscr=yes
])])
fi
;;
linux*)
case `arch 2>/dev/null` in
x86_64)
if test -d /lib64
then
CF_ADD_LIBDIR(/lib64)
else
CF_ADD_LIBDIR(/lib)
fi
;;
*)
CF_ADD_LIBDIR(/lib)
;;
esac
;;
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
;;
esac
if test ".$ac_cv_func_initscr" != .yes ; then
cf_save_LIBS="$LIBS"
if test ".${cf_cv_ncurses_version:-no}" != .no
then
cf_check_list="ncurses curses cursesX"
else
cf_check_list="cursesX curses ncurses"
fi
# 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
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])
done
])
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
AC_CHECK_LIB($cf_curs_lib,initscr,[break])
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 ----------------
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,
dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4
dnl running with Solaris 2.5.1).
AC_DEFUN([CF_CURSES_TERM_H],
[
AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
# If we found , look for , but always look
# for if we do not find the variant.
cf_header_list="term.h ncurses/term.h ncursesw/term.h"
case ${cf_cv_ncurses_header:-curses.h} in #(vi
*/*)
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"
;;
esac
for cf_header in $cf_header_list
do
AC_TRY_COMPILE([
#include <${cf_cv_ncurses_header:-curses.h}>
#include <${cf_header}>],
[WINDOW *x],
[cf_cv_term_header=$cf_header
break],
[cf_cv_term_header=no])
done
case $cf_cv_term_header in #(vi
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
AC_TRY_COMPILE([
#include <${cf_cv_ncurses_header:-curses.h}>
#ifdef NCURSES_VERSION
#include <${cf_header}>
#else
make an error
#endif],
[WINDOW *x],
[cf_cv_term_header=$cf_header
break],
[cf_cv_term_header=no])
done
;;
esac
])
case $cf_cv_term_header in #(vi
term.h) #(vi
AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
;;
ncurses/term.h) #(vi
AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/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 ------------------
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
dnl course). Packages which put the headers in inconsistent locations are
dnl broken).
AC_DEFUN([CF_CURSES_UNCTRL_H],
[
AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[
# If we found , look for , but always look
# for if we do not find the variant.
cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h"
case ${cf_cv_ncurses_header:-curses.h} in #(vi
*/*)
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"
;;
esac
for cf_header in $cf_header_list
do
AC_TRY_COMPILE([
#include <${cf_cv_ncurses_header:-curses.h}>
#include <${cf_header}>],
[WINDOW *x],
[cf_cv_unctrl_header=$cf_header
break],
[cf_cv_unctrl_header=no])
done
])
case $cf_cv_unctrl_header in #(vi
no)
AC_MSG_WARN(unctrl.h header not found)
;;
esac
case $cf_cv_unctrl_header in #(vi
unctrl.h) #(vi
AC_DEFINE(HAVE_UNCTRL_H,1,[Define to 1 if we have unctrl.h])
;;
ncurses/unctrl.h) #(vi
AC_DEFINE(HAVE_NCURSES_UNCTRL_H,1,[Define to 1 if we have ncurses/unctrl.h])
;;
ncursesw/unctrl.h)
AC_DEFINE(HAVE_NCURSESW_UNCTRL_H,1,[Define to 1 if we have ncursesw/unctrl.h])
;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_WACS_MAP version: 6 updated: 2012/10/06 08:57:51
dnl ------------------
dnl Check for likely values of wacs_map[].
AC_DEFUN([CF_CURSES_WACS_MAP],
[
AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
cf_cv_curses_wacs_map=unknown
for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char
do
AC_TRY_LINK([
#ifndef _XOPEN_SOURCE_EXTENDED
#define _XOPEN_SOURCE_EXTENDED
#endif
#include <${cf_cv_ncurses_header:-curses.h}>],
[void *foo = &($name['k'])],
[cf_cv_curses_wacs_map=$name
break])
done])
test "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map,[Define to name of (n)curses wide-character array])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_WACS_SYMBOLS version: 2 updated: 2012/10/06 08:57:51
dnl ----------------------
dnl Do a check to see if the WACS_xxx constants are defined compatibly with
dnl X/Open Curses. In particular, NetBSD's implementation of the WACS_xxx
dnl constants is broken since those constants do not point to cchar_t's.
AC_DEFUN([CF_CURSES_WACS_SYMBOLS],
[
AC_REQUIRE([CF_CURSES_WACS_MAP])
AC_CACHE_CHECK(for wide alternate character constants, cf_cv_curses_wacs_symbols,[
cf_cv_curses_wacs_symbols=no
if test "$cf_cv_curses_wacs_map" != unknown
then
AC_TRY_LINK([
#ifndef _XOPEN_SOURCE_EXTENDED
#define _XOPEN_SOURCE_EXTENDED
#endif
#include <${cf_cv_ncurses_header:-curses.h}>],
[cchar_t *foo = WACS_PLUS;
$cf_cv_curses_wacs_map['k'] = *WACS_PLUS],
[cf_cv_curses_wacs_symbols=yes])
else
AC_TRY_LINK([
#ifndef _XOPEN_SOURCE_EXTENDED
#define _XOPEN_SOURCE_EXTENDED
#endif
#include <${cf_cv_ncurses_header:-curses.h}>],
[cchar_t *foo = WACS_PLUS],
[cf_cv_curses_wacs_symbols=yes])
fi
])
test "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS,1,[Define to 1 if (n)curses supports wide-character WACS_ symbols])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
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 ---------------
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.
dnl
dnl Sets:
dnl ECHO_LT - symbol to control if libtool is verbose
dnl ECHO_LD - symbol to prefix "cc -o" lines
dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
dnl SHOW_CC - symbol to put before explicit "cc -c" lines
dnl ECHO_CC - symbol to put before any "cc" line
dnl
AC_DEFUN([CF_DISABLE_ECHO],[
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=''
ECHO_LD=''
RULE_CC=''
SHOW_CC=''
ECHO_CC=''
])
AC_MSG_RESULT($enableval)
AC_SUBST(ECHO_LT)
AC_SUBST(ECHO_LD)
AC_SUBST(RULE_CC)
AC_SUBST(SHOW_CC)
AC_SUBST(ECHO_CC)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03
dnl ----------------
dnl Combine no-leak checks with the libraries or tools that are used for the
dnl checks.
AC_DEFUN([CF_DISABLE_LEAKS],[
AC_REQUIRE([CF_WITH_DMALLOC])
AC_REQUIRE([CF_WITH_DBMALLOC])
AC_REQUIRE([CF_WITH_VALGRIND])
AC_MSG_CHECKING(if you want to perform memory-leak testing)
AC_ARG_ENABLE(leaks,
[ --disable-leaks test: free permanent memory, analyze leaks],
[if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi],
: ${with_no_leaks:=no})
AC_MSG_RESULT($with_no_leaks)
if test "$with_no_leaks" = yes ; then
AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33
dnl ---------------------
dnl The rpath-hack makes it simpler to build programs, particularly with the
dnl *BSD ports which may have essential libraries in unusual places. But it
dnl can interfere with building an executable for the base system. Use this
dnl option in that case.
AC_DEFUN([CF_DISABLE_RPATH_HACK],
[
AC_MSG_CHECKING(if rpath-hack should be disabled)
CF_ARG_DISABLE(rpath-hack,
[ --disable-rpath-hack don't add rpath options for additional libraries],
[cf_disable_rpath_hack=yes],
[cf_disable_rpath_hack=no])
AC_MSG_RESULT($cf_disable_rpath_hack)
if test "$cf_disable_rpath_hack" = no ; then
CF_RPATH_HACK
fi
])
dnl ---------------------------------------------------------------------------
dnl CF_ENABLE_WARNINGS version: 4 updated: 2009/07/26 17:53:03
dnl ------------------
dnl Configure-option to enable gcc warnings
AC_DEFUN([CF_ENABLE_WARNINGS],[
if ( test "$GCC" = yes || test "$GXX" = yes )
then
AC_MSG_CHECKING(if you want to turn on gcc warnings)
CF_ARG_ENABLE(warnings,
[ --enable-warnings test: turn on gcc compiler warnings],
[with_warnings=yes],
[with_warnings=no])
AC_MSG_RESULT($with_warnings)
if test "$with_warnings" = "yes"
then
CF_GCC_ATTRIBUTES
CF_GCC_WARNINGS
fi
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
dnl ---------------
dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
dnl prefer a standard location, and use -L options only if we do not find the
dnl library in the standard library location(s).
dnl $1 = library name
dnl $2 = library class, usually the same as library name
dnl $3 = includes
dnl $4 = code fragment to compile/link
dnl $5 = corresponding function-name
dnl $6 = flag, nonnull if failure should not cause an error-exit
dnl
dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
dnl to use a -L option.
AC_DEFUN([CF_FIND_LIBRARY],
[
eval 'cf_cv_have_lib_'$1'=no'
cf_libdir=""
AC_CHECK_FUNC($5,
eval 'cf_cv_have_lib_'$1'=yes',[
cf_save_LIBS="$LIBS"
AC_MSG_CHECKING(for $5 in -l$1)
LIBS="-l$1 $LIBS"
AC_TRY_LINK([$3],[$4],
[AC_MSG_RESULT(yes)
eval 'cf_cv_have_lib_'$1'=yes'
],
[AC_MSG_RESULT(no)
CF_LIBRARY_PATH(cf_search,$2)
for cf_libdir in $cf_search
do
AC_MSG_CHECKING(for -l$1 in $cf_libdir)
LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
AC_TRY_LINK([$3],[$4],
[AC_MSG_RESULT(yes)
eval 'cf_cv_have_lib_'$1'=yes'
break],
[AC_MSG_RESULT(no)
LIBS="$cf_save_LIBS"])
done
])
])
eval 'cf_found_library=[$]cf_cv_have_lib_'$1
ifelse($6,,[
if test $cf_found_library = no ; then
AC_MSG_ERROR(Cannot link $1 library)
fi
])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02
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.
dnl See also CF_ADD_SEARCHPATH.
dnl
dnl Parameters (4-on are optional):
dnl $1 = headers for library entrypoint
dnl $2 = code fragment for library entrypoint
dnl $3 = the library name without the "-l" option or ".so" suffix.
dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
dnl $5 = action to perform if not successful
dnl $6 = module name, if not the same as the library name
dnl $7 = extra libraries
dnl
dnl Sets these variables:
dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
dnl $cf_cv_header_path_$3 - include-directory if needed
dnl $cf_cv_library_path_$3 - library-directory if needed
dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
AC_DEFUN([CF_FIND_LINKAGE],[
# 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_$3=
cf_cv_library_path_$3=
CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
cf_save_LIBS="$LIBS"
AC_TRY_LINK([$1],[$2],[
cf_cv_find_linkage_$3=yes
cf_cv_header_path_$3=/usr/include
cf_cv_library_path_$3=/usr/lib
],[
LIBS="-l$3 $7 $cf_save_LIBS"
AC_TRY_LINK([$1],[$2],[
cf_cv_find_linkage_$3=yes
cf_cv_header_path_$3=/usr/include
cf_cv_library_path_$3=/usr/lib
cf_cv_library_file_$3="-l$3"
],[
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)
])
LIBS="$cf_save_LIBS"
if test "$cf_cv_find_linkage_$3" = yes ; then
ifelse([$4],,[
CF_ADD_INCDIR($cf_cv_header_path_$3)
CF_ADD_LIBDIR($cf_cv_library_path_$3)
CF_ADD_LIB($3)
],[$4])
else
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 ----------------------
dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
dnl It's a character string "SVR4", not documented.
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()
{
char temp[1024];
sprintf(temp, "%s\n", curses_version());
${cf_cv_main_return:-return}(0);
}]
,[cf_cv_func_curses_version=yes]
,[cf_cv_func_curses_version=no]
,[cf_cv_func_curses_version=unknown])
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 -----------------
dnl Test for availability of useful gcc __attribute__ directives to quiet
dnl compiler warnings. Though useful, not all are supported -- and contrary
dnl to documentation, unrecognized directives cause older compilers to barf.
AC_DEFUN([CF_GCC_ATTRIBUTES],
[
if test "$GCC" = yes
then
cat > conftest.i < conftest.$ac_ext <&AC_FD_CC
case $cf_attribute in #(vi
printf) #(vi
cf_printf_attribute=yes
cat >conftest.h <conftest.h <conftest.h <>confdefs.h
case $cf_attribute in #(vi
noreturn) #(vi
AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
;;
printf) #(vi
cf_value='/* nothing */'
if test "$cf_printf_attribute" != no ; then
cf_value='__attribute__((format(printf,fmt,var)))'
AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
fi
AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
;;
scanf) #(vi
cf_value='/* nothing */'
if test "$cf_scanf_attribute" != no ; then
cf_value='__attribute__((format(scanf,fmt,var)))'
AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
fi
AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
;;
unused) #(vi
AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
;;
esac
fi
done
else
fgrep define conftest.i >>confdefs.h
fi
rm -rf conftest*
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
dnl --------------
dnl Find version of gcc
AC_DEFUN([CF_GCC_VERSION],[
AC_REQUIRE([AC_PROG_CC])
GCC_VERSION=none
if test "$GCC" = yes ; then
AC_MSG_CHECKING(version of $CC)
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
AC_MSG_RESULT($GCC_VERSION)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GCC_WARNINGS version: 31 updated: 2013/11/19 19:23:35
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 -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
dnl is enabled for ncurses using "--enable-const".
dnl -pedantic
dnl
dnl Parameter:
dnl $1 is an optional list of gcc warning flags that a particular
dnl application might want to use, e.g., "no-unused" for
dnl -Wno-unused
dnl Special:
dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
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)
cat > conftest.$ac_ext <],
[int x = optind; char *y = optarg],
[cf_cv_getopt_header=$cf_header
break])
done
])
if test $cf_cv_getopt_header != none ; then
AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if we need to include getopt.h])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
dnl -------------
dnl Check if we must define _GNU_SOURCE to get a reasonable value for
dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
dnl (or misfeature) of glibc2, which breaks portability of many applications,
dnl since it is interwoven with GNU extensions.
dnl
dnl Well, yes we could work around it...
AC_DEFUN([CF_GNU_SOURCE],
[
AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
AC_TRY_COMPILE([#include ],[
#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"
])
])
test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40
dnl --------------
dnl Construct a search-list of directories for a nonstandard header-file
dnl
dnl Parameters
dnl $1 = the variable to return as result
dnl $2 = the package name
AC_DEFUN([CF_HEADER_PATH],
[
$1=
# 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$,,'`
CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
cf_header_path_list="$cf_header_path_list [$]$1"
;;
esac
done
fi
# add the variations for the package we are looking for
CF_SUBDIR_PATH($1,$2,include)
test "$includedir" != NONE && \
test "$includedir" != "/usr/include" && \
test -d "$includedir" && {
test -d $includedir && $1="[$]$1 $includedir"
test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
}
test "$oldincludedir" != NONE && \
test "$oldincludedir" != "/usr/include" && \
test -d "$oldincludedir" && {
test -d $oldincludedir && $1="[$]$1 $oldincludedir"
test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
}
$1="[$]$1 $cf_header_path_list"
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
dnl ---------------
dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
AC_DEFUN([CF_HELP_MESSAGE],
[AC_DIVERT_HELP([$1])dnl
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42
dnl -----------------
dnl If we do not have a given script, look for it in the parent directory.
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 -----------------
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
dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
dnl
dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
dnl the wrappers for gcc and g++ warnings.
dnl
dnl $1 = GCC (default) or GXX
dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
dnl $3 = CFLAGS (default) or CXXFLAGS
AC_DEFUN([CF_INTEL_COMPILER],[
AC_REQUIRE([AC_CANONICAL_HOST])
ifelse([$2],,INTEL_COMPILER,[$2])=no
if test "$ifelse([$1],,[$1],GCC)" = yes ; then
case $host_os in
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"
AC_TRY_COMPILE([],[
#ifdef __INTEL_COMPILER
#else
make an error
#endif
],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
],[])
ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
;;
esac
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41
dnl ---------------
dnl For the given system and compiler, find the compiler flags to pass to the
dnl loader to use the "rpath" feature.
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
LD_RPATH_OPT="-Wl,-rpath,"
else
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)
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
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
dnl ---------------
dnl Construct a search-list of directories for a nonstandard library-file
dnl
dnl Parameters
dnl $1 = the variable to return as result
dnl $2 = the package name
AC_DEFUN([CF_LIBRARY_PATH],
[
$1=
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$,,'`
CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
cf_library_path_list="$cf_library_path_list [$]$1"
;;
esac
done
fi
CF_SUBDIR_PATH($1,$2,lib)
$1="$cf_library_path_list [$]$1"
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
dnl ------------
dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
dnl a monocase filesystem.
AC_DEFUN([CF_MAKE_TAGS],[
AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
AC_CHECK_PROGS(CTAGS, exctags ctags)
AC_CHECK_PROGS(ETAGS, exetags etags)
AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
if test "$cf_cv_mixedcase" = yes ; then
AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
else
MAKE_UPPER_TAGS=no
fi
if test "$MAKE_UPPER_TAGS" = yes ; then
MAKE_UPPER_TAGS=
else
MAKE_UPPER_TAGS="#"
fi
if test "$MAKE_LOWER_TAGS" = yes ; then
MAKE_LOWER_TAGS=
else
MAKE_LOWER_TAGS="#"
fi
AC_SUBST(CTAGS)
AC_SUBST(ETAGS)
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 -----------
dnl Checks for libraries. At least one UNIX system, Apple Macintosh
dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
dnl AC_CHECK_LIB(m,sin), because that fails for C++.
AC_DEFUN([CF_MATH_LIB],
[
AC_CACHE_CHECK(if -lm needed for math functions,
cf_cv_need_libm,[
AC_TRY_LINK([
#include
#include
],
[double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)],
[cf_cv_need_libm=no],
[cf_cv_need_libm=yes])])
if test "$cf_cv_need_libm" = yes
then
ifelse($1,,[
CF_ADD_LIB(m)
],[$1=-lm])
fi
])
dnl ---------------------------------------------------------------------------
dnl CF_MIXEDCASE_FILENAMES version: 6 updated: 2013/10/08 17:47:05
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.
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
cf_cv_mixedcase=no
;;
*)
cf_cv_mixedcase=yes
;;
esac
else
rm -f conftest CONFTEST
echo test >conftest
if test -f CONFTEST ; then
cf_cv_mixedcase=no
else
cf_cv_mixedcase=yes
fi
rm -f conftest CONFTEST
fi
])
test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
dnl ----------
dnl Write a debug message to config.log, along with the line number in the
dnl configure script.
AC_DEFUN([CF_MSG_LOG],[
echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
dnl -------------------
dnl Check if we can compile with ncurses' header file
dnl $1 is the cache variable to set
dnl $2 is the header-file to include
dnl $3 is the root name (ncurses or ncursesw)
AC_DEFUN([CF_NCURSES_CC_CHECK],[
AC_TRY_COMPILE([
]ifelse($3,ncursesw,[
#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 <$2>],[
#ifdef NCURSES_VERSION
]ifelse($3,ncursesw,[
#ifndef WACS_BSSB
make an error
#endif
])[
printf("%s\n", NCURSES_VERSION);
#else
#ifdef __NCURSES_H
printf("old\n");
#else
make an error
#endif
#endif
]
,[$1=$2]
,[$1=no])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_NCURSES_CONFIG version: 10 updated: 2012/10/06 08:57:51
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
dnl $1 is the root library name (default: "ncurses")
AC_DEFUN([CF_NCURSES_CONFIG],
[
cf_ncuconfig_root=ifelse($1,,ncurses,$1)
echo "Looking for ${cf_ncuconfig_root}-config"
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)])
if test "$NCURSES_CONFIG" != none ; then
CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
CF_ADD_LIBS(`$NCURSES_CONFIG --libs`)
# even with config script, some packages use no-override for curses.h
CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
dnl like CF_NCURSES_CPPFLAGS
AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
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`
else
CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51
dnl -------------------
dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
dnl the CPPFLAGS variable so we can include its header.
dnl
dnl The header files may be installed as either curses.h, or ncurses.h (would
dnl be obsolete, except that some packagers prefer this name to distinguish it
dnl from a "native" curses implementation). If not installed for overwrite,
dnl the curses.h file would be in an ncurses subdirectory (e.g.,
dnl /usr/include/ncurses), but someone may have installed overwriting the
dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
dnl the header.
dnl
dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
dnl is already in the include-path, don't even bother with this, since we cannot
dnl easily determine which file it is. In this case, it has to be .
dnl
dnl The optional parameter gives the root name of the library, in case it is
dnl not installed as the default curses library. That is how the
dnl wide-character version of ncurses is installed.
AC_DEFUN([CF_NCURSES_CPPFLAGS],
[AC_REQUIRE([CF_WITH_CURSES_DIR])
AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
cf_ncuhdr_root=ifelse($1,,ncurses,$1)
test -n "$cf_cv_curses_dir" && \
test "$cf_cv_curses_dir" != "no" && { \
CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root)
}
AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
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
CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
test "$cf_cv_ncurses_h" != no && break
done
])
CF_NCURSES_HEADER
CF_TERM_HEADER
# some applications need this, but should check for NCURSES_VERSION
AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
CF_NCURSES_VERSION
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_NCURSES_EXT_FUNCS version: 4 updated: 2012/10/06 16:39:58
dnl --------------------
dnl Since 2007/11/17, ncurses has defined NCURSES_EXT_FUNCS; earlier versions
dnl may provide these functions. Define the symbol if it is not defined, and
dnl if it is valid.
AC_DEFUN([CF_NCURSES_EXT_FUNCS],
[
AC_CACHE_CHECK(for ncurses extended functions,cf_cv_ncurses_ext_funcs,[
AC_TRY_COMPILE([
#include <${cf_cv_ncurses_header:-curses.h}>],
[
int x = NCURSES_EXT_FUNCS
],[cf_cv_ncurses_ext_funcs=defined],[
AC_TRY_LINK([
#include <${cf_cv_ncurses_header:-curses.h}>],
[
(void) assume_default_colors (0, 0);
(void) curses_version ();
(void) define_key (0, 0);
(void) is_term_resized (0, 0);
(void) key_defined (0);
(void) keybound (0, 0);
(void) keyok (0, 0);
(void) resize_term (0, 0);
(void) resizeterm (0, 0);
(void) use_default_colors ();
(void) use_extended_names (0);
(void) wresize (0, 0, 0);],
[cf_cv_ncurses_ext_funcs=yes],
[cf_cv_ncurses_ext_funcs=no])
])
])
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 -----------------
dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
dnl variations of ncurses' installs.
dnl
dnl See also CF_CURSES_HEADER, which sets the same cache variable.
AC_DEFUN([CF_NCURSES_HEADER],[
if test "$cf_cv_ncurses_h" != no ; then
cf_cv_ncurses_header=$cf_cv_ncurses_h
else
AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
test -n "$verbose" && echo
CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
test -n "$verbose" && echo search path $cf_search
cf_save2_CPPFLAGS="$CPPFLAGS"
for cf_incdir in $cf_search
do
CF_ADD_INCDIR($cf_incdir)
for cf_header in \
ncurses.h \
curses.h
do
CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
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>&AC_FD_MSG
break
fi
test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
done
CPPFLAGS="$cf_save2_CPPFLAGS"
test "$cf_cv_ncurses_h2" != no && break
done
test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
])
CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
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
CF_ADD_INCDIR($cf_1st_incdir)
fi
# Set definitions to allow ifdef'ing for ncurses.h
case $cf_cv_ncurses_header in # (vi
*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)
AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/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 ---------------
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.
dnl Some distributions have gpm linked with (bsd) curses, which makes it
dnl unusable with ncurses. However, we don't want to link with gpm unless
dnl ncurses has a dependency, since gpm is normally set up as a shared library,
dnl and the linker will record a dependency.
dnl
dnl The optional parameter gives the root name of the library, in case it is
dnl not installed as the default curses library. That is how the
dnl wide-character version of ncurses is installed.
AC_DEFUN([CF_NCURSES_LIBS],
[AC_REQUIRE([CF_NCURSES_CPPFLAGS])
cf_nculib_root=ifelse($1,,ncurses,$1)
# 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"
AC_CHECK_LIB(gpm,Gpm_Open,
[AC_CHECK_LIB(gpm,initscr,
[LIBS="$cf_ncurses_SAVE"],
[cf_ncurses_LIBS="-lgpm"])])
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
AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
fi
;;
esac
CF_ADD_LIBS($cf_ncurses_LIBS)
if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
then
CF_ADD_LIBS(-l$cf_nculib_root)
else
CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
[#include <${cf_cv_ncurses_header:-curses.h}>],
[initscr()],
initscr)
fi
if test -n "$cf_ncurses_LIBS" ; then
AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
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
AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
[initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
LIBS="$cf_ncurses_SAVE"])
fi
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 ------------------
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
dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
AC_DEFUN([CF_NCURSES_VERSION],
[
AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
cf_cv_ncurses_version=no
cf_tempfile=out$$
rm -f $cf_tempfile
AC_TRY_RUN([
#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);
}],[
cf_cv_ncurses_version=`cat $cf_tempfile`],,[
# 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>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
AC_TRY_EVAL(cf_try)
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
])
rm -f $cf_tempfile
])
test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_NCURSES_WRAP_PREFIX version: 1 updated: 2009/03/28 16:08:10
dnl ----------------------
dnl Check for ncurses "wrap-prefix" used for public variables which have been
dnl wrapped with a function to help with concurrency control.
AC_DEFUN([CF_NCURSES_WRAP_PREFIX],
[
AC_MSG_CHECKING(for ncurses wrap-prefix)
AC_ARG_WITH(ncurses-wrap-prefix,
[ --with-ncurses-wrap-prefix naming-prefix for ncurses wrapped-variables],
[NCURSES_WRAP_PREFIX=$withval],
[NCURSES_WRAP_PREFIX=_nc_])
AC_MSG_RESULT($NCURSES_WRAP_PREFIX)
AC_SUBST(NCURSES_WRAP_PREFIX)
])
dnl ---------------------------------------------------------------------------
dnl CF_NETBSD_FORM_H version: 2 updated: 2012/10/06 16:39:58
dnl ----------------
dnl Check for NetBSD's form.h, which is incompatible with SVr4 and ncurses.
dnl Some workarounds are needed in client programs to allow them to compile.
AC_DEFUN([CF_NETBSD_FORM_H],[
AC_CACHE_CHECK(for NetBSD form.h,cf_cv_netbsd_form_h,[
AC_TRY_COMPILE([
#include <${cf_cv_ncurses_header:-curses.h}>
#include
],[
FORM *form;
int y = current_field(form)->cursor_ypos;
int x = current_field(form)->cursor_xpos;
],[cf_cv_netbsd_form_h=yes
],[cf_cv_netbsd_form_h=no])
])
test "$cf_cv_netbsd_form_h" = yes && AC_DEFINE(HAVE_NETBSD_FORM_H,1,[Define to 1 if we appear to be using NetBSD form.h])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_NETBSD_MENU_H version: 2 updated: 2012/10/06 16:39:58
dnl ----------------
dnl Check for NetBSD's menu.h, which is incompatible with SVr4 and ncurses.
dnl Some workarounds are needed in client programs to allow them to compile.
AC_DEFUN([CF_NETBSD_MENU_H],[
AC_CACHE_CHECK(for NetBSD menu.h,cf_cv_netbsd_menu_h,[
AC_TRY_COMPILE([
#include <${cf_cv_ncurses_header:-curses.h}>
#include
],[
MENU *menu;
int y = menu->max_item_width;
],[cf_cv_netbsd_menu_h=yes
],[cf_cv_netbsd_menu_h=no])
])
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 ------------------
dnl see CF_WITH_NO_LEAKS
AC_DEFUN([CF_NO_LEAKS_OPTION],[
AC_MSG_CHECKING(if you want to use $1 for testing)
AC_ARG_WITH($1,
[$2],
[AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
$4
])
: ${with_cflags:=-g}
: ${with_no_leaks:=yes}
with_$1=yes],
[with_$1=])
AC_MSG_RESULT(${with_$1:-no})
case .$with_cflags in #(vi
.*-g*)
case .$CFLAGS in #(vi
.*-g*) #(vi
;;
*)
CF_ADD_CFLAGS([-g])
;;
esac
;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54
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
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"
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)
;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PDCURSES_X11 version: 13 updated: 2012/10/06 16:39:58
dnl ---------------
dnl Configure for PDCurses' X11 library
AC_DEFUN([CF_PDCURSES_X11],[
AC_REQUIRE([CF_X_ATHENA])
CF_ACVERSION_CHECK(2.52,
[AC_CHECK_TOOLS(XCURSES_CONFIG, xcurses-config, none)],
[AC_PATH_PROGS(XCURSES_CONFIG, xcurses-config, none)])
if test "$XCURSES_CONFIG" != none ; then
CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`"
CF_ADD_LIBS(`$XCURSES_CONFIG --libs`)
cf_cv_lib_XCurses=yes
else
LDFLAGS="$LDFLAGS $X_LIBS"
CF_CHECK_CFLAGS($X_CFLAGS)
AC_CHECK_LIB(X11,XOpenDisplay,
[CF_ADD_LIBS(-lX11)],,
[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[
CF_ADD_LIBS(-lXCurses)
AC_TRY_LINK([
#include
char *XCursesProgramName = "test";
],[XCursesExit();],
[cf_cv_lib_XCurses=yes],
[cf_cv_lib_XCurses=no])
])
fi
if test $cf_cv_lib_XCurses = yes ; then
AC_DEFINE(UNIX,1,[Define to 1 if using PDCurses on Unix])
AC_DEFINE(XCURSES,1,[Define to 1 if using PDCurses on Unix])
AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES,1,[Define to 1 if using PDCurses on Unix]))
else
AC_MSG_ERROR(Cannot link with XCurses)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22
dnl -------------
dnl Check for the package-config program, unless disabled by command-line.
AC_DEFUN([CF_PKG_CONFIG],
[
AC_MSG_CHECKING(if you want to use pkg-config)
AC_ARG_WITH(pkg-config,
[ --with-pkg-config{=path} enable/disable use of pkg-config],
[cf_pkg_config=$withval],
[cf_pkg_config=yes])
AC_MSG_RESULT($cf_pkg_config)
case $cf_pkg_config in #(vi
no) #(vi
PKG_CONFIG=none
;;
yes) #(vi
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
test -z "$PKG_CONFIG" && PKG_CONFIG=none
if test "$PKG_CONFIG" != none ; then
CF_PATH_SYNTAX(PKG_CONFIG)
fi
AC_SUBST(PKG_CONFIG)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42
dnl -----------------
dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
dnl
dnl POSIX.1-1990 _POSIX_SOURCE
dnl POSIX.1-1990 and _POSIX_SOURCE and
dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
dnl Bindings Option
dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
dnl X/Open 2000 _POSIX_C_SOURCE=200112L
dnl
dnl Parameters:
dnl $1 is the nominal value for _POSIX_C_SOURCE
AC_DEFUN([CF_POSIX_C_SOURCE],
[
cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
cf_save_CFLAGS="$CFLAGS"
cf_save_CPPFLAGS="$CPPFLAGS"
CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
CF_MSG_LOG(if the symbol is already defined go no further)
AC_TRY_COMPILE([#include ],[
#ifndef _POSIX_C_SOURCE
make an error
#endif],
[cf_cv_posix_c_source=no],
[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
AC_TRY_COMPILE([#include ],[
#ifdef _POSIX_SOURCE
make an error
#endif],[],
cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
fi
CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
CFLAGS="$cf_trim_CFLAGS"
CPPFLAGS="$cf_trim_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
make an error
#endif],,
[cf_cv_posix_c_source=no])
CFLAGS="$cf_save_CFLAGS"
CPPFLAGS="$cf_save_CPPFLAGS"
])
])
if test "$cf_cv_posix_c_source" != no ; then
CFLAGS="$cf_trim_CFLAGS"
CPPFLAGS="$cf_trim_CPPFLAGS"
CF_ADD_CFLAGS($cf_cv_posix_c_source)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
dnl ------------
dnl Append definitions and rules for the given programs to the subdirectory
dnl Makefiles, and the recursion rule for the top-level Makefile.
dnl
dnl parameters
dnl $1 = script to run
dnl $2 = list of subdirectories
dnl
dnl variables
dnl $AWK
AC_DEFUN([CF_PRG_RULES],
[
for cf_dir in $2
do
if test ! -d $srcdir/$cf_dir; then
continue
elif test -f $srcdir/$cf_dir/programs; then
$AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
fi
done
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55
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],[
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
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07
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
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%^.*/%%'`
;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
dnl ------------
AC_DEFUN([CF_PROG_LINT],
[
AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint)
AC_SUBST(LINT_OPTS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
dnl ----------------
dnl Remove all -U and -D options that refer to the given symbol from a list
dnl of C compiler options. This works around the problem that not all
dnl compilers process -U and -D options from left-to-right, so a -U option
dnl cannot be used to cancel the effect of a preceding -D option.
dnl
dnl $1 = target (which could be the same as the source variable)
dnl $2 = source (including '$')
dnl $3 = symbol to remove
define([CF_REMOVE_DEFINE],
[
$1=`echo "$2" | \
sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
-e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00
dnl -------------
AC_DEFUN([CF_RPATH_HACK],
[
AC_REQUIRE([CF_LD_RPATH_OPT])
AC_MSG_CHECKING(for updated LDFLAGS)
if test -n "$LD_RPATH_OPT" ; then
AC_MSG_RESULT(maybe)
AC_CHECK_PROGS(cf_ldd_prog,ldd,no)
cf_rpath_list="/usr/lib /lib"
if test "$cf_ldd_prog" != no
then
cf_rpath_oops=
AC_TRY_LINK([#include ],
[printf("Hello");],
[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`])
# If we passed the link-test, but get a "not found" on a given library,
# this could be due to inept reconfiguration of gcc to make it only
# partly honor /usr/local/lib (or whatever). Sometimes this behavior
# is intentional, e.g., installing gcc in /usr/bin and suppressing the
# /usr/local libraries.
if test -n "$cf_rpath_oops"
then
for cf_rpath_src in $cf_rpath_oops
do
for cf_rpath_dir in \
/usr/local \
/usr/pkg \
/opt/sfw
do
if test -f $cf_rpath_dir/lib/$cf_rpath_src
then
CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src)
LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
break
fi
done
done
fi
fi
CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
CF_RPATH_HACK_2(LDFLAGS)
CF_RPATH_HACK_2(LIBS)
CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
else
AC_MSG_RESULT(no)
fi
AC_SUBST(EXTRA_LDFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24
dnl ---------------
dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to
dnl EXTRA_LDFLAGS for each -L option found.
dnl
dnl $cf_rpath_list contains a list of directories to ignore.
dnl
dnl $1 = variable name to update. The LDFLAGS variable should be the only one,
dnl but LIBS often has misplaced -L options.
AC_DEFUN([CF_RPATH_HACK_2],
[
CF_VERBOSE(...checking $1 [$]$1)
cf_rpath_dst=
for cf_rpath_src in [$]$1
do
case $cf_rpath_src in #(vi
-L*) #(vi
# check if this refers to a directory which we will ignore
cf_rpath_skip=no
if test -n "$cf_rpath_list"
then
for cf_rpath_item in $cf_rpath_list
do
if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
then
cf_rpath_skip=yes
break
fi
done
fi
if test "$cf_rpath_skip" = no
then
# transform the option
if test "$LD_RPATH_OPT" = "-R " ; then
cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
else
cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
fi
# if we have not already added this, add it now
cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"`
if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS"
then
CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp)
EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
fi
fi
;;
esac
cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
done
$1=$cf_rpath_dst
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 ---------------
dnl signal handler, but there are some gcc depedencies in that recommendation.
dnl Try anyway.
AC_DEFUN([CF_SIG_ATOMIC_T],
[
AC_MSG_CHECKING(for signal global datatype)
AC_CACHE_VAL(cf_cv_sig_atomic_t,[
for cf_type in \
"volatile sig_atomic_t" \
"sig_atomic_t" \
"int"
do
AC_TRY_COMPILE([
#include
#include
#include
extern $cf_type x;
$cf_type x;
static void handler(int sig)
{
x = 5;
}],
[signal(SIGINT, handler);
x = 1],
[cf_cv_sig_atomic_t=$cf_type],
[cf_cv_sig_atomic_t=no])
test "$cf_cv_sig_atomic_t" != no && break
done
])
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 --------------
dnl Construct a search-list for a nonstandard header/lib-file
dnl $1 = the variable to return as result
dnl $2 = the package name
dnl $3 = the subdirectory, e.g., bin, include or lib
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)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_SYS_TIME_SELECT version: 5 updated: 2012/10/04 05:24:07
dnl ------------------
dnl Check if we can include with ; this breaks on
dnl older SCO configurations.
AC_DEFUN([CF_SYS_TIME_SELECT],
[
AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
AC_CACHE_VAL(cf_cv_sys_time_select,[
AC_TRY_COMPILE([
#include
#ifdef HAVE_SYS_TIME_H
#include
#endif
#ifdef HAVE_SYS_SELECT_H
#include
#endif
],[],[cf_cv_sys_time_select=yes],
[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 --------------
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
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
AC_TRY_COMPILE([#include
#include <${cf_cv_ncurses_header:-curses.h}>
#include <$cf_test>
],[int x = auto_left_margin],[
cf_cv_term_header="$cf_test"],[
cf_cv_term_header=unknown
])
test "$cf_cv_term_header" != unknown && break
done
])
# Set definitions to allow ifdef'ing to accommodate subdirectories
case $cf_cv_term_header in # (vi
*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
AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/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_TOP_BUILDDIR version: 2 updated: 2013/07/27 17:38:32
dnl ---------------
dnl Define a top_builddir symbol, for applications that need an absolute path.
AC_DEFUN([CF_TOP_BUILDDIR],
[
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 --------------
dnl Check for type of function-pointer passed to tputs. Some old
dnl implementations used functions that had different prototypes, making it
dnl hard to compile portable programs using tputs.
AC_DEFUN([CF_TPUTS_PROTO],[
CF_CURSES_FUNCS(tputs)
if test x$cf_cv_func_tputs = xyes
then
cf_done=no
for cf_arg in int char
do
for cf_ret in int void
do
if test $cf_ret = void
then
cf_return="/* nothing */"
else
cf_return="return value"
fi
AC_TRY_COMPILE([
#include <${cf_cv_ncurses_header:-curses.h}>
#include <$cf_cv_term_header>
static $cf_ret outc($cf_arg value) { $cf_return; }
],[
tputs("hello", 0, outc);
${cf_cv_main_return:-return}(0);
],[
CF_VERBOSE([prototype $cf_ret func($cf_arg value)])
cat >>confdefs.h <
#include
#include
],[
#ifndef _XOPEN_SOURCE
make an error
#endif],
[cf_cv_xopen_source=no],
[cf_save="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
AC_TRY_COMPILE([
#include
#include
#include
],[
#ifdef _XOPEN_SOURCE
make an error
#endif],
[cf_cv_xopen_source=no],
[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
CPPFLAGS="$cf_save"
])
])
if test "$cf_cv_xopen_source" != no ; then
CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
CF_ADD_CFLAGS($cf_temp_xopen_source)
fi
])
dnl ---------------------------------------------------------------------------
dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
dnl --------
dnl Make an uppercase version of a variable
dnl $1=uppercase($2)
AC_DEFUN([CF_UPPER],
[
$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
dnl -----------
dnl Check for multibyte support, and if not found, utf8 compatibility library
AC_DEFUN([CF_UTF8_LIB],
[
AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
cf_save_LIBS="$LIBS"
AC_TRY_LINK([
#include ],[putwc(0,0);],
[cf_cv_utf8_lib=yes],
[CF_FIND_LINKAGE([
#include ],[putwc(0,0);],utf8,
[cf_cv_utf8_lib=add-on],
[cf_cv_utf8_lib=no])
])])
# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
# ncurses/ncursesw:
if test "$cf_cv_utf8_lib" = "add-on" ; then
AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
CF_ADD_INCDIR($cf_cv_header_path_utf8)
CF_ADD_LIBDIR($cf_cv_library_path_utf8)
CF_ADD_LIBS($cf_cv_library_file_utf8)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
dnl ----------
dnl Use AC_VERBOSE w/o the warnings
AC_DEFUN([CF_VERBOSE],
[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
CF_MSG_LOG([$1])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WCHAR_TYPE version: 4 updated: 2012/10/06 16:39:58
dnl -------------
dnl Check if type wide-character type $1 is declared, and if so, which header
dnl file is needed. The second parameter is used to set a shell variable when
dnl the type is not found. The first parameter sets a shell variable for the
dnl opposite sense.
AC_DEFUN([CF_WCHAR_TYPE],
[
# This is needed on Tru64 5.0 to declare $1
AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
AC_TRY_COMPILE([
#include
#include
#include
#ifdef HAVE_LIBUTF8_H
#include
#endif],
[$1 state],
[cf_cv_$1=no],
[AC_TRY_COMPILE([
#include
#include
#include
#include
#ifdef HAVE_LIBUTF8_H
#include
#endif],
[$1 value],
[cf_cv_$1=yes],
[cf_cv_$1=unknown])])])
if test "$cf_cv_$1" = yes ; then
AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h])
NEED_WCHAR_H=1
fi
ifelse([$2],,,[
# if we do not find $1 in either place, use substitution to provide a fallback.
if test "$cf_cv_$1" = unknown ; then
$2=1
fi
])
ifelse($3,,,[
# if we find $1 in either place, use substitution to provide a fallback.
if test "$cf_cv_$1" != unknown ; then
$3=1
fi
])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38
dnl ------------------
dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
dnl libraries.
AC_DEFUN([CF_WITH_CURSES_DIR],[
AC_MSG_CHECKING(for specific curses-directory)
AC_ARG_WITH(curses-dir,
[ --with-curses-dir=DIR directory in which (n)curses is installed],
[cf_cv_curses_dir=$withval],
[cf_cv_curses_dir=no])
AC_MSG_RESULT($cf_cv_curses_dir)
if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
then
CF_PATH_SYNTAX(withval)
if test -d "$cf_cv_curses_dir"
then
CF_ADD_INCDIR($cf_cv_curses_dir/include)
CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
fi
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
dnl ----------------
dnl Configure-option for dbmalloc. The optional parameter is used to override
dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
AC_DEFUN([CF_WITH_DBMALLOC],[
CF_NO_LEAKS_OPTION(dbmalloc,
[ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
[USE_DBMALLOC])
if test "$with_dbmalloc" = yes ; then
AC_CHECK_HEADER(dbmalloc.h,
[AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
dnl ---------------
dnl Configure-option for dmalloc. The optional parameter is used to override
dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
AC_DEFUN([CF_WITH_DMALLOC],[
CF_NO_LEAKS_OPTION(dmalloc,
[ --with-dmalloc test: use Gray Watson's dmalloc library],
[USE_DMALLOC])
if test "$with_dmalloc" = yes ; then
AC_CHECK_HEADER(dmalloc.h,
[AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_NCURSES_ETC version: 2 updated: 2012/01/13 10:49:00
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
dnl library (such as slang) should use a "--with-screen=XXX" option.
dnl
dnl This does not use AC_DEFUN, because that would tell autoconf to run each
dnl of the macros inside this one - before this macro.
define([CF_WITH_NCURSES_ETC],[
CF_WITH_CURSES_DIR
cf_cv_screen=curses
AC_MSG_CHECKING(for specified curses library type)
AC_ARG_WITH(ncursesw,
[ --with-ncursesw use wide ncurses-libraries],
[cf_cv_screen=ncursesw],[
AC_ARG_WITH(ncurses,
[ --with-ncurses use ncurses-libraries],
[cf_cv_screen=ncurses],[
AC_ARG_WITH(pdcurses,
[ --with-pdcurses compile/link with pdcurses X11 library],
[cf_cv_screen=pdcurses],[
AC_ARG_WITH(curses-colr,
[ --with-curses-colr compile/link with HPUX 10.x color-curses],
[cf_cv_screen=curses_colr],[
AC_ARG_WITH(curses-5lib,
[ --with-curses-5lib compile/link with SunOS 5lib curses],
[cf_cv_screen=curses_5lib])])])])])
AC_MSG_RESULT($cf_cv_screen)
case $cf_cv_screen in #(vi
curses|curses_*) #(vi
CF_CURSES_CONFIG
;;
ncurses) #(vi
CF_NCURSES_CONFIG
;;
ncursesw) #(vi
CF_UTF8_LIB
CF_NCURSES_CONFIG(ncursesw)
;;
pdcurses)
CF_PDCURSES_X11
;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
dnl ----------------
AC_DEFUN([CF_WITH_VALGRIND],[
CF_NO_LEAKS_OPTION(valgrind,
[ --with-valgrind test: use valgrind],
[USE_VALGRIND])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_XOPEN_CURSES version: 11 updated: 2011/01/18 18:15:30
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.
dnl
dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
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_TRY_LINK([
#include
#include <${cf_cv_ncurses_header:-curses.h}>],[
#if defined(NCURSES_VERSION_PATCH)
#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
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));
#endif
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"
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_XOPEN_SOURCE version: 45 updated: 2013/09/07 14:06:25
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,
dnl without losing the common non-POSIX features.
dnl
dnl Parameters:
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])
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
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
CF_GNU_SOURCE
;;
mirbsd*) #(vi
# 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
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_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)
fi
dnl In anything but the default case, we may have system-specific setting
dnl which is still not guaranteed to provide all of the entrypoints that
dnl _XOPEN_SOURCE would yield.
if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
AC_TRY_COMPILE([#include ],[
#ifndef _XOPEN_SOURCE
make an error
#endif],
[cf_XOPEN_SOURCE_set=yes],
[cf_XOPEN_SOURCE_set=no])
AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
if test $cf_XOPEN_SOURCE_set = yes
then
AC_TRY_COMPILE([#include ],[
#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
make an error
#endif],
[cf_XOPEN_SOURCE_set_ok=yes],
[cf_XOPEN_SOURCE_set_ok=no])
if test $cf_XOPEN_SOURCE_set_ok = no
then
AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
fi
else
CF_TRY_XOPEN_SOURCE
fi
fi
])
dnl ---------------------------------------------------------------------------
dnl CF_X_ATHENA version: 21 updated: 2013/07/06 21:27:06
dnl -----------
dnl Check for Xaw (Athena) libraries
dnl
dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
AC_DEFUN([CF_X_ATHENA],
[
cf_x_athena=${cf_x_athena:-Xaw}
AC_MSG_CHECKING(if you want to link with Xaw 3d library)
withval=
AC_ARG_WITH(Xaw3d,
[ --with-Xaw3d link with Xaw 3d library])
if test "$withval" = yes ; then
cf_x_athena=Xaw3d
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,
[ --with-neXtaw link with neXT Athena library])
if test "$withval" = yes ; then
cf_x_athena=neXtaw
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(if you want to link with Athena-Plus library)
withval=
AC_ARG_WITH(XawPlus,
[ --with-XawPlus link with Athena-Plus library])
if test "$withval" = yes ; then
cf_x_athena=XawPlus
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
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
CF_TRY_PKG_CONFIG($cf_athena_pkg,[
cf_x_athena_lib="$cf_pkgconfig_libs"
CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
CF_TRIM_X_LIBS
AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[
AC_TRY_LINK([
#include
],[
int check = XmuCompareISOLatin1("big", "small")
],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])])
if test "$cf_cv_xaw_compat" = no
then
# workaround for broken ".pc" files...
case "$cf_x_athena_lib" in #(vi
*-lXmu*) #(vi
;;
*)
CF_VERBOSE(work around broken package)
cf_save_xmu="$LIBS"
cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'`
CF_TRY_PKG_CONFIG(xmu,[
LIBS="$cf_save_xmu"
CF_ADD_LIB_AFTER($cf_first_lib,$cf_pkgconfig_libs)
],[
CF_ADD_LIB_AFTER($cf_first_lib,-lXmu)
])
CF_TRIM_X_LIBS
;;
esac
fi
break])
done
fi
if test -z "$cf_x_athena_lib" ; then
CF_X_EXT
CF_X_TOOLKIT
CF_X_ATHENA_CPPFLAGS($cf_x_athena)
CF_X_ATHENA_LIBS($cf_x_athena)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30
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],
[
cf_x_athena_root=ifelse([$1],,Xaw,[$1])
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"
AC_MSG_CHECKING(for $cf_test in $cf_path)
else
AC_MSG_CHECKING(for $cf_test)
fi
AC_TRY_COMPILE([
#include
#include <$cf_test>],[],
[cf_result=yes],
[cf_result=no])
AC_MSG_RESULT($cf_result)
if test "$cf_result" = yes ; then
cf_x_athena_inc=$cf_path
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])
elif test "$cf_x_athena_inc" != default ; then
CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc"
fi
])
dnl ---------------------------------------------------------------------------
dnl CF_X_ATHENA_LIBS version: 12 updated: 2011/07/17 19:55:02
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_LIBS],
[AC_REQUIRE([CF_X_TOOLKIT])
cf_x_athena_root=ifelse([$1],,Xaw,[$1])
cf_x_athena_lib=""
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
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([
#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"
fi
done # cf_libs
test -n "$cf_x_athena_lib" && break
done # cf_lib
done
if test -z "$cf_x_athena_lib" ; then
AC_MSG_ERROR(
[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
fi
CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
])
dnl ---------------------------------------------------------------------------
dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05
dnl --------
AC_DEFUN([CF_X_EXT],[
CF_TRY_PKG_CONFIG(Xext,,[
AC_CHECK_LIB(Xext,XextCreateExtension,
[CF_ADD_LIB(Xext)])])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_X_TOOLKIT version: 21 updated: 2012/10/04 06:57:36
dnl ------------
dnl Check for X Toolkit libraries
dnl
AC_DEFUN([CF_X_TOOLKIT],
[
AC_REQUIRE([AC_PATH_XTRA])
AC_REQUIRE([CF_CHECK_CACHE])
cf_have_X_LIBS=no
CF_TRY_PKG_CONFIG(xt,[
case "x$LIBS" in #(vi
*-lX11*) #(vi
;;
*)
# 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([
#include
],[
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_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])])
if test "$cf_cv_xt_x11_compat" = no
then
CF_VERBOSE(work around broken X11 dependency)
# 2010/11/19 - good enough until a working Xt on Xcb is delivered.
CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)])
fi
;;
esac
AC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[
AC_TRY_LINK([
#include
],[int num = IceConnectionNumber(0)
],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])])
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
;;
*)
CF_VERBOSE(work around broken ICE dependency)
CF_TRY_PKG_CONFIG(ice,
[CF_TRY_PKG_CONFIG(sm)],
[CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)])
;;
esac
;;
esac
fi
cf_have_X_LIBS=yes
],[
LDFLAGS="$X_LIBS $LDFLAGS"
CF_CHECK_CFLAGS($X_CFLAGS)
AC_CHECK_FUNC(XOpenDisplay,,[
AC_CHECK_LIB(X11,XOpenDisplay,
[CF_ADD_LIB(X11)],,
[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
AC_CHECK_FUNC(XtAppInitialize,,[
AC_CHECK_LIB(Xt, XtAppInitialize,
[AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library])
cf_have_X_LIBS=Xt
LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
])
if test $cf_have_X_LIBS = no ; then
AC_MSG_WARN(
[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.])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49
dnl ---------------
dnl Define a reusable chunk which includes and when they
dnl are both available.
define([CF__CURSES_HEAD],[
#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
])
ncurses-5.9-20140118/test/foldkeys.c 0000644 0001751 0000144 00000016700 11467632305 015444 0 ustar tom users /****************************************************************************
* Copyright (c) 2006 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/*
* Author: Thomas E. Dickey, 2006
*
* $Id: foldkeys.c,v 1.4 2010/11/14 01:00:53 tom Exp $
*
* Demonstrate a method for altering key definitions at runtime.
*
* This program reads the key definitions, merging those which have xterm-style
* modifiers into their equivalents which have no modifiers. It does this
* merging only for the keys which are defined in the terminal description.
*/
#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)
/*
* Log the most recently-written line to our logfile
*/
static void
log_last_line(WINDOW *win)
{
FILE *fp;
int y, x, n;
char temp[256];
if ((fp = fopen(MY_LOGFILE, "a")) != 0) {
int need = sizeof(temp) - 1;
if (need > COLS)
need = COLS;
getyx(win, y, x);
wmove(win, y - 1, 0);
n = winnstr(win, temp, need);
while (n-- > 0) {
if (isspace(UChar(temp[n])))
temp[n] = '\0';
else
break;
}
wmove(win, y, x);
fprintf(fp, "%s\n", temp);
fclose(fp);
}
}
/*
* ncurses has no API for telling what the actual last key-code is. That is
* a secret because the codes past KEY_MAX are computed at run-time and may
* differ depending on the previous calls to newterm(), etc. It is unlikely
* that one could have more than a thousand key definitions...
*/
#define MAX_KEYS 2000
typedef struct {
const char *name;
const char *value;
int code;
int state;
} KeyInfo;
static void
demo_foldkeys(void)
{
KeyInfo info[MAX_KEYS];
int info_len = 0;
int merged = 0;
int code;
int j, k;
/*
* Tell ncurses that we want to use function keys. That will make it add
* any user-defined keys that appear in the terminfo.
*/
keypad(stdscr, TRUE);
/*
* List the predefined keys using the strnames[] array.
*/
for (code = 0; code < STRCOUNT; ++code) {
NCURSES_CONST char *name = strnames[code];
NCURSES_CONST char *value = tigetstr(name);
if (value != 0 && value != (NCURSES_CONST char *) -1) {
info[info_len].name = strnames[code];
info[info_len].code = key_defined(value);
info[info_len].value = value;
info[info_len].state = 0;
if (info[info_len].code > 0)
++info_len;
}
}
/*
* We can get the names for user-defined keys from keyname(). It returns
* a name like KEY_foo for the predefined keys, which tigetstr() does not
* understand.
*/
for (code = KEY_MAX; code < MAX_KEYS; ++code) {
NCURSES_CONST char *name = keyname(code);
if (name != 0) {
info[info_len].name = name;
info[info_len].code = code;
info[info_len].value = tigetstr(name);
info[info_len].state = 0;
++info_len;
}
}
printw("Initially %d key definitions\n", info_len);
/*
* Look for keys that have xterm-style modifiers.
*/
for (j = 0; j < info_len; ++j) {
int first, second;
char final[2];
char *value;
if (info[j].state == 0
&& sscanf(info[j].value,
"\033[%d;%d%c",
&first,
&second,
final) == 3
&& *final != ';'
&& (value = strdup(info[j].value)) != 0) {
sprintf(value, "\033[%d%c", first, *final);
for (k = 0; k < info_len; ++k) {
if (info[k].state == 0
&& !strcmp(info[k].value, value)) {
info[j].state = 1;
break;
}
}
if (info[j].state == 0) {
sprintf(value, "\033O%c", *final);
for (k = 0; k < info_len; ++k) {
if (info[k].state == 0
&& !strcmp(info[k].value, value)) {
info[j].state = 1;
break;
}
}
}
if (info[j].state == 1) {
if ((define_key(info[j].value, info[k].code)) != ERR) {
printw("map %s to %s\n", info[j].value, info[k].value);
keyok(info[j].code, FALSE);
++merged;
} else {
printw("? cannot define_key %d:%s\n", j, info[j].value);
}
} else {
printw("? cannot merge %d:%s\n", j, info[j].value);
}
free(value);
}
}
printw("Merged to %d key definitions\n", info_len - merged);
}
int
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
int ch;
#if HAVE_GETTIMEOFDAY
int secs, msecs;
struct timeval current, previous;
#endif
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 */
scrollok(stdscr, TRUE);
keypad(stdscr, TRUE);
move(0, 0);
demo_foldkeys();
#if HAVE_GETTIMEOFDAY
gettimeofday(&previous, 0);
#endif
while ((ch = getch()) != ERR) {
bool escaped = (ch >= MY_KEYS);
const char *name = keyname(escaped ? (ch - MY_KEYS) : ch);
#if HAVE_GETTIMEOFDAY
gettimeofday(¤t, 0);
secs = (int) (current.tv_sec - previous.tv_sec);
msecs = (int) ((current.tv_usec - previous.tv_usec) / 1000);
if (msecs < 0) {
msecs += 1000;
--secs;
}
if (msecs >= 1000) {
secs += msecs / 1000;
msecs %= 1000;
}
printw("%6d.%03d ", secs, msecs);
previous = current;
#endif
printw("Keycode %d, name %s%s\n",
ch,
escaped ? "ESC-" : "",
name != 0 ? name : "");
log_last_line(stdscr);
clrtoeol();
if (ch == 'q')
break;
}
endwin();
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(void)
{
printf("This program requires the ncurses library\n");
ExitProgram(EXIT_FAILURE);
}
#endif
ncurses-5.9-20140118/test/test_inwstr.c 0000644 0001751 0000144 00000015301 11367076552 016212 0 ustar tom users /****************************************************************************
* Copyright (c) 2007,2010 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_inwstr.c,v 1.4 2010/05/01 19:13:46 tom Exp $
*
* Author: Thomas E Dickey
*
* Demonstrate the inwstr functions from the curses library.
int inwstr(wchar_t *str);
int innwstr(wchar_t *str, int n);
int winwstr(WINDOW *win, wchar_t *str);
int winnwstr(WINDOW *win, wchar_t *str, int n);
int mvinwstr(int y, int x, wchar_t *str);
int mvinnwstr(int y, int x, wchar_t *str, int n);
int mvwinwstr(WINDOW *win, int y, int x, wchar_t *str);
int mvwinnwstr(WINDOW *win, int y, int x, wchar_t *str, int n);
*/
#include
#if USE_WIDEC_SUPPORT
#define BASE_Y 6
#define MAX_COLS 1024
static bool
Quit(int ch)
{
return (ch == ERR || ch == 'q' || ch == QUIT || ch == ESCAPE);
}
static void
show_1st(WINDOW *win, int line, wchar_t *buffer)
{
(void) mvwaddwstr(win, line, 5, buffer);
}
static void
showmore(WINDOW *win, int line, wchar_t *buffer)
{
wmove(win, line, 0);
wclrtoeol(win);
show_1st(win, line, buffer);
}
static int
test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin)
{
WINDOW *txtbox = 0;
WINDOW *txtwin = 0;
FILE *fp;
int ch;
int txt_x = 0, txt_y = 0;
int base_y;
int limit = getmaxx(strwin) - 5;
wchar_t buffer[MAX_COLS];
if (argv[level] == 0) {
beep();
return FALSE;
}
if (level > 1) {
txtbox = newwin(LINES - BASE_Y, COLS - level, BASE_Y, level);
box(txtbox, 0, 0);
wnoutrefresh(txtbox);
txtwin = derwin(txtbox,
getmaxy(txtbox) - 2,
getmaxx(txtbox) - 2,
1, 1);
base_y = 0;
} else {
txtwin = stdscr;
base_y = BASE_Y;
}
keypad(txtwin, TRUE); /* enable keyboard mapping */
(void) cbreak(); /* take input chars one at a time, no wait for \n */
(void) noecho(); /* don't echo input */
txt_y = base_y;
txt_x = 0;
wmove(txtwin, txt_y, txt_x);
if ((fp = fopen(argv[level], "r")) != 0) {
while ((ch = fgetc(fp)) != EOF) {
if (waddch(txtwin, UChar(ch)) != OK) {
break;
}
}
fclose(fp);
} else {
wprintw(txtwin, "Cannot open:\n%s", argv[1]);
}
while (!Quit(ch = mvwgetch(txtwin, txt_y, txt_x))) {
switch (ch) {
case KEY_DOWN:
case 'j':
if (txt_y < getmaxy(txtwin) - 1)
txt_y++;
else
beep();
break;
case KEY_UP:
case 'k':
if (txt_y > base_y)
txt_y--;
else
beep();
break;
case KEY_LEFT:
case 'h':
if (txt_x > 0)
txt_x--;
else
beep();
break;
case KEY_RIGHT:
case 'l':
if (txt_x < getmaxx(txtwin) - 1)
txt_x++;
else
beep();
break;
case 'w':
test_inchs(level + 1, argv, chrwin, strwin);
if (txtbox != 0) {
touchwin(txtbox);
wnoutrefresh(txtbox);
} else {
touchwin(txtwin);
wnoutrefresh(txtwin);
}
break;
case '-':
if (limit > 0) {
--limit;
} else {
beep();
}
break;
case '+':
++limit;
break;
default:
beep();
break;
}
MvWPrintw(chrwin, 0, 0, "line:");
wclrtoeol(chrwin);
if (txtwin != stdscr) {
wmove(txtwin, txt_y, txt_x);
if (winwstr(txtwin, buffer) != ERR) {
show_1st(chrwin, 0, buffer);
}
if (mvwinwstr(txtwin, txt_y, txt_x, buffer) != ERR) {
showmore(chrwin, 1, buffer);
}
} else {
move(txt_y, txt_x);
if (inwstr(buffer) != ERR) {
show_1st(chrwin, 0, buffer);
}
if (mvinwstr(txt_y, txt_x, buffer) != ERR) {
showmore(chrwin, 1, buffer);
}
}
wnoutrefresh(chrwin);
MvWPrintw(strwin, 0, 0, "%4d:", limit);
wclrtobot(strwin);
if (txtwin != stdscr) {
wmove(txtwin, txt_y, txt_x);
if (winnwstr(txtwin, buffer, limit) != ERR) {
show_1st(strwin, 0, buffer);
}
if (mvwinnwstr(txtwin, txt_y, txt_x, buffer, limit) != ERR) {
showmore(strwin, 1, buffer);
}
} else {
move(txt_y, txt_x);
if (innwstr(buffer, limit) != ERR) {
show_1st(strwin, 0, buffer);
}
if (mvinnwstr(txt_y, txt_x, buffer, limit) != ERR) {
showmore(strwin, 1, buffer);
}
}
wnoutrefresh(strwin);
}
if (level > 1) {
delwin(txtwin);
delwin(txtbox);
}
return TRUE;
}
int
main(int argc, char *argv[])
{
WINDOW *chrbox;
WINDOW *chrwin;
WINDOW *strwin;
setlocale(LC_ALL, "");
if (argc < 2) {
fprintf(stderr, "usage: %s file\n", argv[0]);
return EXIT_FAILURE;
}
initscr();
chrbox = derwin(stdscr, BASE_Y, COLS, 0, 0);
box(chrbox, 0, 0);
wnoutrefresh(chrbox);
chrwin = derwin(chrbox, 2, COLS - 2, 1, 1);
strwin = derwin(chrbox, 2, COLS - 2, 3, 1);
test_inchs(1, argv, chrwin, strwin);
endwin();
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(void)
{
printf("This program requires the wide-ncurses library\n");
ExitProgram(EXIT_FAILURE);
}
#endif
ncurses-5.9-20140118/test/testcurs.c 0000644 0001751 0000144 00000041327 12145775422 015505 0 ustar tom users /*
* This is a test program for the PDCurses screen package for IBM PC type
* machines.
*
* This program was written by John Burnell (johnb@kea.am.dsir.govt.nz)
* 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 $
*/
#include
#if defined(XCURSES)
char *XCursesProgramName = "testcurs";
#endif
static int initTest(WINDOW **);
static void display_menu(int, int);
static void inputTest(WINDOW *);
static void introTest(WINDOW *);
static void outputTest(WINDOW *);
static void padTest(WINDOW *);
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)
{
int y1 = getmaxy(win);
int x1 = getmaxx(win);
int y0 = y1 < 10 ? y1 : 10;
int x0 = 1;
chtype save;
save = mvwinch(win, y0, x1 - 1);
MvWAddStr(win, y0, x0, " Press any key to continue");
wclrtoeol(win);
getyx(win, y0, x0);
MvWAddCh(win, y0, x1 - 1, save);
wmove(win, y0, x0);
raw();
wgetch(win);
}
static int
initTest(WINDOW **win)
{
#ifdef PDCDEBUG
PDC_debug("initTest called\n");
#endif
#ifdef TRACE
trace(TRACE_MAXIMUM);
#endif
initscr();
#ifdef PDCDEBUG
PDC_debug("after initscr()\n");
#endif
#ifdef A_COLOR
if (has_colors())
start_color();
#endif
width = 60;
height = 13; /* Create a drawing window */
*win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2);
if (*win == NULL) {
endwin();
return 0;
}
return 1;
}
static void
introTest(WINDOW *win)
{
wmove(win, height / 2 - 5, width / 2);
wvline(win, ACS_VLINE, 10);
wmove(win, height / 2, width / 2 - 10);
whline(win, ACS_HLINE, 20);
Continue(win);
beep();
werase(win);
box(win, ACS_VLINE, ACS_HLINE);
wrefresh(win);
cbreak();
MvWAddStr(win, 1, 1,
"You should have rectangle in the middle of the screen");
MvWAddStr(win, 2, 1, "You should have heard a beep");
Continue(win);
return;
}
static void
scrollTest(WINDOW *win)
{
int i;
int half;
int OldY;
NCURSES_CONST char *Message = "The window will now scroll slowly";
wclear(win);
OldY = getmaxy(win);
half = OldY / 2;
MvWAddStr(win, OldY - 2, 1, Message);
wrefresh(win);
scrollok(win, TRUE);
for (i = 1; i <= OldY; i++) {
napms(600);
scroll(win);
wrefresh(win);
}
werase(win);
for (i = 1; i < OldY; i++) {
MvWPrintw(win, i, 1, "Line %d", i);
}
MvWPrintw(win, OldY - 2, 1, "The top of the window will scroll");
wmove(win, 1, 1);
wsetscrreg(win, 0, half - 1);
box(win, ACS_VLINE, ACS_HLINE);
wrefresh(win);
for (i = 1; i <= half; i++) {
napms(600);
scroll(win);
box(win, ACS_VLINE, ACS_HLINE);
wrefresh(win);
}
werase(win);
for (i = 1; i < OldY; i++) {
MvWPrintw(win, i, 1, "Line %d", i);
}
MvWPrintw(win, 1, 1, "The bottom of the window will scroll");
wmove(win, OldY - 2, 1);
wsetscrreg(win, half, --OldY);
box(win, ACS_VLINE, ACS_HLINE);
wrefresh(win);
for (i = half; i <= OldY; i++) {
napms(600);
wscrl(win, -1);
box(win, ACS_VLINE, ACS_HLINE);
wrefresh(win);
}
wsetscrreg(win, 0, OldY);
}
static void
inputTest(WINDOW *win)
{
int answered;
int repeat;
int w, h, bx, by, sw, sh, i, c, num;
char buffer[80];
WINDOW *subWin;
wclear(win);
getmaxyx(win, h, w);
getbegyx(win, by, bx);
sw = w / 3;
sh = h / 3;
if ((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == NULL)
return;
#ifdef A_COLOR
if (has_colors()) {
init_pair(2, COLOR_WHITE, COLOR_RED);
wbkgd(subWin, COLOR_PAIR(2) | A_BOLD);
} else
wbkgd(subWin, A_BOLD);
#else
wbkgd(subWin, A_BOLD);
#endif
box(subWin, ACS_VLINE, ACS_HLINE);
wrefresh(win);
nocbreak();
MvWAddStr(win, 2, 1, "Press some keys for 5 seconds");
MvWAddStr(win, 1, 1, "Pressing ^C should do nothing");
wrefresh(win);
werase(subWin);
box(subWin, ACS_VLINE, ACS_HLINE);
for (i = 0; i < 5; i++) {
MvWPrintw(subWin, 1, 1, "Time = %d", i);
wrefresh(subWin);
napms(1000);
flushinp();
}
delwin(subWin);
werase(win);
flash();
wrefresh(win);
napms(500);
MvWAddStr(win, 2, 1, "Press a key, followed by ENTER");
wmove(win, 9, 10);
wrefresh(win);
echo();
noraw();
wgetch(win);
flushinp();
wmove(win, 9, 10);
wdelch(win);
MvWAddStr(win, 4, 1, "The character should now have been deleted");
Continue(win);
wclear(win);
MvWAddStr(win, 1, 1, "Press keys (or mouse buttons) to show their names");
MvWAddStr(win, 2, 1, "Press spacebar to finish");
wrefresh(win);
keypad(win, TRUE);
raw();
noecho();
#if HAVE_TYPEAHEAD
typeahead(-1);
#endif
#ifdef NCURSES_MOUSE_VERSION
mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0);
#endif
#if defined(PDCURSES)
mouse_set(ALL_MOUSE_EVENTS);
#endif
for (;;) {
wmove(win, 3, 5);
c = wgetch(win);
wclrtobot(win);
if (c >= KEY_MIN)
wprintw(win, "Key Pressed: %s", keyname(c));
else if (isprint(c))
wprintw(win, "Key Pressed: %c", c);
else
wprintw(win, "Key Pressed: %s", unctrl(UChar(c)));
#ifdef KEY_MOUSE
if (c == KEY_MOUSE) {
#if defined(NCURSES_MOUSE_VERSION)
#define ButtonChanged(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, 037))
#define ButtonPressed(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED))
#define ButtonDouble(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED))
#define ButtonTriple(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED))
#define ButtonRelease(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED))
MEVENT event;
int button = 0;
getmouse(&event);
if (ButtonChanged(1))
button = 1;
else if (ButtonChanged(2))
button = 2;
else if (ButtonChanged(3))
button = 3;
else
button = 0;
wmove(win, 4, 18);
wprintw(win, "Button %d: ", button);
if (ButtonPressed(button))
wprintw(win, "pressed: ");
else if (ButtonDouble(button))
wprintw(win, "double: ");
else if (ButtonTriple(button))
wprintw(win, "triple: ");
else
wprintw(win, "released: ");
wprintw(win, " Position: Y: %d X: %d", event.y, event.x);
#elif defined(PDCURSES)
int button = 0;
request_mouse_pos();
if (BUTTON_CHANGED(1))
button = 1;
else if (BUTTON_CHANGED(2))
button = 2;
else if (BUTTON_CHANGED(3))
button = 3;
else
button = 0;
wmove(win, 4, 18);
wprintw(win, "Button %d: ", button);
if (MOUSE_MOVED)
wprintw(win, "moved: ");
else if ((BUTTON_STATUS(button) & BUTTON_ACTION_MASK) == BUTTON_PRESSED)
wprintw(win, "pressed: ");
else if ((BUTTON_STATUS(button) & BUTTON_ACTION_MASK) == BUTTON_DOUBLE_CLICKED)
wprintw(win, "double: ");
else
wprintw(win, "released: ");
wprintw(win, " Position: Y: %d X: %d", MOUSE_Y_POS, MOUSE_X_POS);
#endif /* NCURSES_VERSION vs PDCURSES */
}
#endif /* KEY_MOUSE */
wrefresh(win);
if (c == ' ')
break;
}
#if 0
nodelay(win, TRUE);
wgetch(win);
nodelay(win, FALSE);
#endif
#if defined(PDCURSES)
mouse_set(0L);
#endif
refresh();
repeat = 0;
do {
static const char *fmt[] =
{
"%d %10s",
"%d %[a-zA-Z]s",
"%d %[][a-zA-Z]s",
"%d %[^0-9]"
};
const char *format = fmt[(unsigned) repeat % SIZEOF(fmt)];
wclear(win);
MvWAddStr(win, 3, 2, "The window should have moved");
MvWAddStr(win, 4, 2,
"This text should have appeared without you pressing a key");
MvWPrintw(win, 6, 2,
"Scanning with format \"%s\"", format);
mvwin(win, 2 + 2 * (repeat % 4), 1 + 2 * (repeat % 4));
erase();
refresh();
wrefresh(win);
echo();
noraw();
num = 0;
*buffer = 0;
answered = mvwscanw(win, 7, 6, strdup(format), &num, buffer);
MvWPrintw(win, 8, 6,
"String: %s Number: %d (%d values read)",
buffer, num, answered);
Continue(win);
++repeat;
} while (answered > 0);
}
static void
outputTest(WINDOW *win)
{
WINDOW *win1;
char Buffer[80];
chtype ch;
int by, bx;
#if !HAVE_TIGETSTR
#if HAVE_TGETENT
char tc_buffer[4096];
char tc_parsed[4096];
char *area_pointer = tc_parsed;
tgetent(tc_buffer, getenv("TERM"));
#else
#define tgetstr(a,b) 0
#endif
#endif /* !HAVE_TIGETSTR */
nl();
wclear(win);
MvWAddStr(win, 1, 1,
"You should now have a screen in the upper left corner, and this text should have wrapped");
mvwin(win, 2, 1);
waddstr(win, "\nThis text should be down\n");
waddstr(win, "and broken into two here ^");
Continue(win);
wclear(win);
wattron(win, A_BOLD);
MvWAddStr(win, 1, 1, "A new window will appear with this text in it");
MvWAddStr(win, 8, 1, "Press any key to continue");
wrefresh(win);
wgetch(win);
getbegyx(win, by, bx);
if (LINES < 24 || COLS < 75) {
MvWAddStr(win, 5, 1,
"Some tests have been skipped as they require a");
MvWAddStr(win, 6, 1, "display of at least 24 LINES by 75 COLUMNS");
Continue(win);
} else {
win1 = newwin(10, 50, 14, 25);
if (win1 == NULL) {
endwin();
return;
}
#ifdef A_COLOR
if (has_colors()) {
init_pair(3, COLOR_BLUE, COLOR_WHITE);
wbkgd(win1, (chtype) COLOR_PAIR(3));
} else
wbkgd(win1, A_NORMAL);
#else
wbkgd(win1, A_NORMAL);
#endif
wclear(win1);
MvWAddStr(win1, 5, 1,
"This text should appear; using overlay option");
copywin(win, win1, 0, 0, 0, 0, 9, 49, TRUE);
#if defined(PDCURSES) && !defined(XCURSES)
box(win1, 0xb3, 0xc4);
#else
box(win1, ACS_VLINE, ACS_HLINE);
#endif
wmove(win1, 8, 26);
wrefresh(win1);
wgetch(win1);
wclear(win1);
wattron(win1, A_BLINK);
MvWAddStr(win1, 4, 1,
"This blinking text should appear in only the second window");
wattroff(win1, A_BLINK);
mvwin(win1, by, bx);
overlay(win, win1);
mvwin(win1, 14, 25);
wmove(win1, 8, 26);
wrefresh(win1);
wgetch(win1);
delwin(win1);
}
clear();
wclear(win);
wrefresh(win);
MvWAddStr(win, 6, 2, "This line shouldn't appear");
MvWAddStr(win, 4, 2, "Only half of the next line is visible");
MvWAddStr(win, 5, 2, "Only half of the next line is visible");
wmove(win, 6, 1);
wclrtobot(win);
wmove(win, 5, 20);
wclrtoeol(win);
MvWAddStr(win, 8, 2, "This line also shouldn't appear");
wmove(win, 8, 1);
wdeleteln(win);
Continue(win);
wmove(win, 5, 9);
ch = winch(win);
wclear(win);
wmove(win, 6, 2);
waddstr(win, "The next char should be l: ");
winsch(win, ch);
Continue(win);
#if HAVE_WINSSTR
(void) mvwinsstr(win, 6, 2, "A1B2C3D4E5");
Continue(win);
#endif
wmove(win, 5, 1);
winsertln(win);
MvWAddStr(win, 5, 2, "The lines below should have moved down");
Continue(win);
wclear(win);
wmove(win, 2, 2);
wprintw(win, "This is a formatted string in a window: %d %s\n", 42,
"is it");
MvWAddStr(win, 10, 1, "Enter a string: ");
wrefresh(win);
noraw();
echo();
*Buffer = 0;
wscanw(win, "%s", Buffer);
printw("This is a formatted string in stdscr: %d %s\n", 42, "is it");
MvAddStr(10, 1, "Enter a string: ");
*Buffer = 0;
scanw("%s", Buffer);
if (TIGETSTR("cvvis", "vs") != 0) {
wclear(win);
curs_set(2);
MvWAddStr(win, 1, 1, "The cursor should appear as a block (visible)");
Continue(win);
}
if (TIGETSTR("civis", "vi") != 0) {
wclear(win);
curs_set(0);
MvWAddStr(win, 1, 1,
"The cursor should have disappeared (invisible)");
Continue(win);
}
if (TIGETSTR("cnorm", "ve") != 0) {
wclear(win);
curs_set(1);
MvWAddStr(win, 1, 1, "The cursor should be an underline (normal)");
Continue(win);
}
#ifdef A_COLOR
if (has_colors()) {
wclear(win);
MvWAddStr(win, 1, 1, "Colors should change after you press a key");
Continue(win);
init_pair(1, COLOR_RED, COLOR_WHITE);
wrefresh(win);
}
#endif
werase(win);
#if HAVE_TERMNAME
MvWAddStr(win, 1, 1, "Information About Your Terminal");
MvWAddStr(win, 3, 1, termname());
MvWAddStr(win, 4, 1, longname());
if (termattrs() & A_BLINK)
MvWAddStr(win, 5, 1, "This terminal supports blinking.");
else
MvWAddStr(win, 5, 1, "This terminal does NOT support blinking.");
#endif
(void) mvwaddnstr(win, 7, 5, "Have a nice day!ok", 16);
wrefresh(win);
(void) mvwinnstr(win, 7, 5, Buffer, 18);
MvAddStr(LINES - 2, 10, Buffer);
refresh();
Continue(win);
}
#if defined(PDCURSES) && !defined(XCURSES)
static void
resizeTest(WINDOW *dummy GCC_UNUSED)
{
WINDOW *win1;
savetty();
clear();
refresh();
# if defined(OS2)
resize_term(50, 120);
# else
resize_term(50, 80);
# endif
win1 = newwin(10, 50, 14, 25);
if (win1 == NULL) {
endwin();
return;
}
#ifdef A_COLOR
if (has_colors()) {
init_pair(3, COLOR_BLUE, COLOR_WHITE);
wattrset(win1, COLOR_PAIR(3));
}
#endif
wclear(win1);
MvWAddStr(win1, 1, 1, "The screen may now have 50 lines");
Continue(win1);
wclear(win1);
resetty();
MvWAddStr(win1, 1, 1, "The screen should now be reset");
Continue(win1);
delwin(win1);
clear();
refresh();
}
#endif
static void
padTest(WINDOW *dummy GCC_UNUSED)
{
WINDOW *pad, *spad;
if ((pad = newpad(50, 100)) != 0) {
wattron(pad, A_REVERSE);
MvWAddStr(pad, 5, 2, "This is a new pad");
(void) wattrset(pad, A_NORMAL);
MvWAddStr(pad, 8, 0,
"The end of this line should be truncated here:except now");
MvWAddStr(pad, 11, 1, "This line should not appear.It will now");
wmove(pad, 10, 1);
wclrtoeol(pad);
MvWAddStr(pad, 10, 1, " Press any key to continue");
prefresh(pad, 0, 0, 0, 0, 10, 45);
keypad(pad, TRUE);
raw();
wgetch(pad);
if ((spad = subpad(pad, 12, 25, 6, 52)) != 0) {
MvWAddStr(spad, 2, 2, "This is a new subpad");
box(spad, 0, 0);
delwin(spad);
}
prefresh(pad, 0, 0, 0, 0, 15, 75);
keypad(pad, TRUE);
raw();
wgetch(pad);
MvWAddStr(pad, 35, 2, "This is displayed at line 35 in the pad");
MvWAddStr(pad, 40, 1, " Press any key to continue");
prefresh(pad, 30, 0, 0, 0, 10, 45);
keypad(pad, TRUE);
raw();
wgetch(pad);
delwin(pad);
}
}
static void
display_menu(int old_option, int new_option)
{
int i;
assert((new_option >= 0) && (new_option < MAX_OPTIONS));
(void) attrset(A_NORMAL);
MvAddStr(3, 20, "PDCurses Test Program");
for (i = 0; i < (int) MAX_OPTIONS; i++)
MvAddStr(5 + i, 25, command[i].text);
if ((old_option >= 0) && (old_option < MAX_OPTIONS))
MvAddStr(5 + old_option, 25, command[old_option].text);
(void) attrset(A_REVERSE);
MvAddStr(5 + new_option, 25, command[new_option].text);
(void) attrset(A_NORMAL);
MvAddStr(13, 3,
"Use Up and Down Arrows to select - Enter to run - Q to quit");
refresh();
}
ncurses-5.9-20140118/test/test_get_wstr.c 0000644 0001751 0000144 00000021676 11514362057 016526 0 ustar tom users /****************************************************************************
* Copyright (c) 2007-2009,2011 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_get_wstr.c,v 1.8 2011/01/15 18:15:11 tom Exp $
*
* Author: Thomas E Dickey
*
* Demonstrate the get_wstr functions from the curses library.
int get_wstr(wint_t *wstr);
int getn_wstr(wint_t *wstr, int n);
int wget_wstr(WINDOW *win, wint_t *wstr);
int wgetn_wstr(WINDOW *win, wint_t *wstr, int n);
int mvget_wstr(int y, int x, wint_t *wstr);
int mvgetn_wstr(int y, int x, wint_t *wstr, int n);
int mvwget_wstr(WINDOW *win, int y, int x, wint_t *wstr);
int mvwgetn_wstr(WINDOW *win, int y, int x, wint_t *wstr, int n);
*/
#include
#if HAVE_CHGAT
/* NetBSD curses wchgat */
#if USE_WIDEC_SUPPORT
#define BASE_Y 6
#define MAX_COLS 1024
typedef enum {
eGetStr = 0,
eGetNStr,
eMvGetStr,
eMvGetNStr,
eMaxFlavor
} Flavors;
static bool
Quit(int ch)
{
return (ch == ERR || ch == 'q' || ch == QUIT || ch == ESCAPE);
}
static int
Remainder(WINDOW *txtwin)
{
int result = getmaxx(txtwin) - getcurx(txtwin);
return (result > 0) ? result : 0;
}
/*
* Show a highlighted line in the place where input will happen.
*/
static void
ShowPrompt(WINDOW *txtwin, int limit)
{
wchgat(txtwin, limit, A_REVERSE, 0, NULL);
wnoutrefresh(txtwin);
}
static void
MovePrompt(WINDOW *txtwin, int limit, int y, int x)
{
wchgat(txtwin, Remainder(txtwin), A_NORMAL, 0, NULL);
wmove(txtwin, y, x);
ShowPrompt(txtwin, limit);
}
static int
ShowFlavor(WINDOW *strwin, WINDOW *txtwin, int flavor, int limit)
{
const char *name = "?";
bool limited = FALSE;
bool wins = (txtwin != stdscr);
int result;
switch (flavor) {
case eGetStr:
name = wins ? "wget_wstr" : "get_wstr";
break;
case eGetNStr:
limited = TRUE;
name = wins ? "wgetn_wstr" : "getn_wstr";
break;
case eMvGetStr:
name = wins ? "mvwget_wstr" : "mvget_wstr";
break;
case eMvGetNStr:
limited = TRUE;
name = wins ? "mvwgetn_wstr" : "mvgetn_wstr";
break;
case eMaxFlavor:
break;
}
wmove(strwin, 0, 0);
werase(strwin);
if (limited) {
wprintw(strwin, "%s(%d):", name, limit);
} else {
wprintw(strwin, "%s:", name);
}
result = limited ? limit : Remainder(txtwin);
ShowPrompt(txtwin, result);
wnoutrefresh(strwin);
return result;
}
static int
test_get_wstr(int level, char **argv, WINDOW *strwin)
{
WINDOW *txtbox = 0;
WINDOW *txtwin = 0;
FILE *fp;
int ch;
int rc;
int txt_x = 0, txt_y = 0;
int base_y;
int flavor = 0;
int limit = getmaxx(strwin) - 5;
int actual;
wint_t buffer[MAX_COLS];
if (argv[level] == 0) {
beep();
return FALSE;
}
if (level > 1) {
txtbox = newwin(LINES - BASE_Y, COLS - level, BASE_Y, level);
box(txtbox, 0, 0);
wnoutrefresh(txtbox);
txtwin = derwin(txtbox,
getmaxy(txtbox) - 2,
getmaxx(txtbox) - 2,
1, 1);
base_y = 0;
} else {
txtwin = stdscr;
base_y = BASE_Y;
}
keypad(txtwin, TRUE); /* enable keyboard mapping */
(void) cbreak(); /* take input chars one at a time, no wait for \n */
(void) noecho(); /* don't echo input */
txt_y = base_y;
txt_x = 0;
wmove(txtwin, txt_y, txt_x);
if ((fp = fopen(argv[level], "r")) != 0) {
while ((ch = fgetc(fp)) != EOF) {
if (waddch(txtwin, UChar(ch)) != OK) {
break;
}
}
fclose(fp);
} else {
wprintw(txtwin, "Cannot open:\n%s", argv[1]);
}
wmove(txtwin, txt_y, txt_x);
actual = ShowFlavor(strwin, txtwin, flavor, limit);
while (!Quit(ch = mvwgetch(txtwin, txt_y, txt_x))) {
switch (ch) {
case KEY_DOWN:
case 'j':
if (txt_y < getmaxy(txtwin) - 1) {
MovePrompt(txtwin, actual, ++txt_y, txt_x);
} else {
beep();
}
break;
case KEY_UP:
case 'k':
if (txt_y > base_y) {
MovePrompt(txtwin, actual, --txt_y, txt_x);
} else {
beep();
}
break;
case KEY_LEFT:
case 'h':
if (txt_x > 0) {
MovePrompt(txtwin, actual, txt_y, --txt_x);
} else {
beep();
}
break;
case KEY_RIGHT:
case 'l':
if (txt_x < getmaxx(txtwin) - 1) {
MovePrompt(txtwin, actual, txt_y, ++txt_x);
} else {
beep();
}
break;
case 'w':
test_get_wstr(level + 1, argv, strwin);
if (txtbox != 0) {
touchwin(txtbox);
wnoutrefresh(txtbox);
} else {
touchwin(txtwin);
wnoutrefresh(txtwin);
}
break;
case '-':
if (limit > 0) {
actual = ShowFlavor(strwin, txtwin, flavor, --limit);
MovePrompt(txtwin, actual, txt_y, txt_x);
} else {
beep();
}
break;
case '+':
actual = ShowFlavor(strwin, txtwin, flavor, ++limit);
MovePrompt(txtwin, actual, txt_y, txt_x);
break;
case '<':
if (flavor > 0) {
actual = ShowFlavor(strwin, txtwin, --flavor, limit);
MovePrompt(txtwin, actual, txt_y, txt_x);
} else {
beep();
}
break;
case '>':
if (flavor + 1 < eMaxFlavor) {
actual = ShowFlavor(strwin, txtwin, ++flavor, limit);
MovePrompt(txtwin, actual, txt_y, txt_x);
} else {
beep();
}
break;
case ':':
actual = ShowFlavor(strwin, txtwin, flavor, limit);
*buffer = '\0';
rc = ERR;
echo();
(void) wattrset(txtwin, A_REVERSE);
switch (flavor) {
case eGetStr:
if (txtwin != stdscr) {
wmove(txtwin, txt_y, txt_x);
rc = wget_wstr(txtwin, buffer);
} else {
move(txt_y, txt_x);
rc = get_wstr(buffer);
}
break;
case eGetNStr:
if (txtwin != stdscr) {
wmove(txtwin, txt_y, txt_x);
rc = wgetn_wstr(txtwin, buffer, limit);
} else {
move(txt_y, txt_x);
rc = getn_wstr(buffer, limit);
}
break;
case eMvGetStr:
if (txtwin != stdscr) {
rc = mvwget_wstr(txtwin, txt_y, txt_x, buffer);
} else {
rc = mvget_wstr(txt_y, txt_x, buffer);
}
break;
case eMvGetNStr:
if (txtwin != stdscr) {
rc = mvwgetn_wstr(txtwin, txt_y, txt_x, buffer, limit);
} else {
rc = mvgetn_wstr(txt_y, txt_x, buffer, limit);
}
break;
case eMaxFlavor:
break;
}
noecho();
(void) wattrset(txtwin, A_NORMAL);
wprintw(strwin, "%d", rc);
(void) waddwstr(strwin, (wchar_t *) buffer);
wnoutrefresh(strwin);
break;
default:
beep();
break;
}
doupdate();
}
if (level > 1) {
delwin(txtwin);
delwin(txtbox);
}
return TRUE;
}
int
main(int argc, char *argv[])
{
WINDOW *chrbox;
WINDOW *strwin;
setlocale(LC_ALL, "");
if (argc < 2) {
fprintf(stderr, "usage: %s file\n", argv[0]);
return EXIT_FAILURE;
}
initscr();
chrbox = derwin(stdscr, BASE_Y, COLS, 0, 0);
box(chrbox, 0, 0);
wnoutrefresh(chrbox);
strwin = derwin(chrbox, 4, COLS - 2, 1, 1);
test_get_wstr(1, argv, strwin);
endwin();
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(void)
{
printf("This program requires the wide-ncurses library\n");
ExitProgram(EXIT_FAILURE);
}
#endif
#else
int
main(void)
{
printf("This program requires the curses chgat function\n");
ExitProgram(EXIT_FAILURE);
}
#endif
ncurses-5.9-20140118/test/test_addstr.c 0000644 0001751 0000144 00000024465 12063211122 016132 0 ustar tom users /****************************************************************************
* Copyright (c) 2009-2010,2012 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_addstr.c,v 1.10 2012/12/16 00:14:10 tom Exp $
*
* Demonstrate the waddstr() and waddch functions.
* Thomas Dickey - 2009/9/12
*/
#include
#include
#define AddNStr addnstr
#define AddStr addstr
#define MvAddNStr (void) mvaddnstr
#define MvWAddNStr (void) mvwaddnstr
#define WAddNStr waddnstr
#define WAddStr waddstr
#define AddCh addch
#define WAddCh waddch
#define MY_TABSIZE 8
typedef enum {
oDefault = 0,
oMove = 1,
oWindow = 2,
oMoveWindow = 3
} Options;
static bool m_opt = FALSE;
static bool w_opt = FALSE;
static int n_opt = -1;
static void
legend(WINDOW *win, int level, Options state, char *buffer, int length)
{
const char *showstate;
switch (state) {
default:
case oDefault:
showstate = "";
break;
case oMove:
showstate = " (mvXXX)";
break;
case oWindow:
showstate = " (winXXX)";
break;
case oMoveWindow:
showstate = " (mvwinXXX)";
break;
}
wmove(win, 0, 0);
wprintw(win,
"The Strings/Chars displays should match. Enter any characters, except:\n");
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 added %d characters <%s>", level,
showstate, length, buffer);
}
static int
ColOf(char *buffer, int length, int margin)
{
int n;
int result;
for (n = 0, result = margin + 1; n < length; ++n) {
int ch = UChar(buffer[n]);
switch (ch) {
case '\n':
/* actually newline should clear the remainder of the line
* and move to the next line - but that seems a little awkward
* in this example.
*/
case '\r':
result = 0;
break;
case '\b':
if (result > 0)
--result;
break;
case '\t':
result += (MY_TABSIZE - (result % MY_TABSIZE));
break;
case '\177':
result += 2;
break;
default:
++result;
if (ch < 32)
++result;
break;
}
}
return result;
}
#define LEN(n) ((length - (n) > n_opt) ? n_opt : (length - (n)))
static void
test_adds(int level)
{
static bool first = TRUE;
int ch;
int limit;
int row = 1;
int col;
int row2, col2;
int length;
char buffer[BUFSIZ];
WINDOW *look = 0;
WINDOW *work = 0;
WINDOW *show = 0;
int margin = (2 * MY_TABSIZE) - 1;
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"));
initscr();
(void) cbreak(); /* take input chars one at a time, no wait for \n */
(void) noecho(); /* don't echo input */
keypad(stdscr, TRUE);
/*
* Show the characters added in color, to distinguish from those that
* are shifted.
*/
if (has_colors()) {
start_color();
init_pair(1, COLOR_WHITE, COLOR_BLUE);
}
}
limit = LINES - 5;
if (level > 0) {
look = newwin(limit, COLS - (2 * (level - 1)), 0, level - 1);
work = newwin(limit - 2, COLS - (2 * level), 1, level);
show = newwin(4, COLS, limit + 1, 0);
box(look, 0, 0);
wnoutrefresh(look);
limit -= 2;
} else {
work = stdscr;
show = derwin(stdscr, 4, COLS, limit + 1, 0);
}
keypad(work, TRUE);
for (col = margin + 1; col < COLS; col += MY_TABSIZE)
MvWVLine(work, row, col, '.', limit - 2);
MvWVLine(work, row, margin, ACS_VLINE, limit - 2);
MvWVLine(work, row, margin + 1, ACS_VLINE, limit - 2);
limit /= 2;
MvWAddStr(work, 1, 2, "String");
MvWAddStr(work, limit + 1, 2, "Chars");
wnoutrefresh(work);
buffer[length = 0] = '\0';
legend(show, level, option, buffer, length);
wnoutrefresh(show);
doupdate();
if (has_colors()) {
wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
}
while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) {
wmove(work, row, margin + 1);
switch (ch) {
case key_RECUR:
test_adds(level + 1);
if (look)
touchwin(look);
touchwin(work);
touchwin(show);
if (look)
wnoutrefresh(look);
wnoutrefresh(work);
wnoutrefresh(show);
doupdate();
break;
case key_NEWLINE:
if (row < limit) {
++row;
/* put the whole string in, all at once */
col2 = margin + 1;
switch (option) {
case oDefault:
if (n_opt > 1) {
for (col = 0; col < length; col += n_opt) {
col2 = ColOf(buffer, col, margin);
if (move(row, col2) != ERR) {
AddNStr(buffer + col, LEN(col));
}
}
} else {
if (move(row, col2) != ERR) {
AddStr(buffer);
}
}
break;
case oMove:
if (n_opt > 1) {
for (col = 0; col < length; col += n_opt) {
col2 = ColOf(buffer, col, margin);
MvAddNStr(row, col2, buffer + col, LEN(col));
}
} else {
MvAddStr(row, col2, buffer);
}
break;
case oWindow:
if (n_opt > 1) {
for (col = 0; col < length; col += n_opt) {
col2 = ColOf(buffer, col, margin);
if (wmove(work, row, col2) != ERR) {
WAddNStr(work, buffer + col, LEN(col));
}
}
} else {
if (wmove(work, row, col2) != ERR) {
WAddStr(work, buffer);
}
}
break;
case oMoveWindow:
if (n_opt > 1) {
for (col = 0; col < length; col += n_opt) {
col2 = ColOf(buffer, col, margin);
MvWAddNStr(work, row, col2, buffer + col, LEN(col));
}
} else {
MvWAddStr(work, row, col2, buffer);
}
break;
}
/* do the corresponding single-character add */
row2 = limit + row;
for (col = 0; col < length; ++col) {
col2 = ColOf(buffer, col, margin);
switch (option) {
case oDefault:
if (move(row2, col2) != ERR) {
AddCh(UChar(buffer[col]));
}
break;
case oMove:
MvAddCh(row2, col2, UChar(buffer[col]));
break;
case oWindow:
if (wmove(work, row2, col2) != ERR) {
WAddCh(work, UChar(buffer[col]));
}
break;
case oMoveWindow:
MvWAddCh(work, row2, col2, UChar(buffer[col]));
break;
}
}
} else {
beep();
}
break;
default:
if (ch <= 0 || ch > 255) {
beep();
break;
}
buffer[length++] = (char) ch;
buffer[length] = '\0';
/* put the string in, one character at a time */
col = ColOf(buffer, length - 1, margin);
switch (option) {
case oDefault:
if (move(row, col) != ERR) {
AddStr(buffer + length - 1);
}
break;
case oMove:
MvAddStr(row, col, buffer + length - 1);
break;
case oWindow:
if (wmove(work, row, col) != ERR) {
WAddStr(work, buffer + length - 1);
}
break;
case oMoveWindow:
MvWAddStr(work, row, col, buffer + length - 1);
break;
}
/* do the corresponding single-character add */
switch (option) {
case oDefault:
if (move(limit + row, col) != ERR) {
AddCh(UChar(ch));
}
break;
case oMove:
MvAddCh(limit + row, col, UChar(ch));
break;
case oWindow:
if (wmove(work, limit + row, col) != ERR) {
WAddCh(work, UChar(ch));
}
break;
case oMoveWindow:
MvWAddCh(work, limit + row, col, UChar(ch));
break;
}
wnoutrefresh(work);
legend(show, level, option, buffer, length);
wnoutrefresh(show);
doupdate();
break;
}
}
delwin(show);
if (level > 0) {
delwin(work);
delwin(look);
}
}
static void
usage(void)
{
static const char *tbl[] =
{
"Usage: test_addstr [options]"
,""
,"Options:"
," -f FILE read data from given file"
," -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;
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;
setlocale(LC_ALL, "");
while ((ch = getopt(argc, argv, "f:mn:w")) != -1) {
switch (ch) {
case 'f':
init_linedata(optarg);
break;
case 'm':
m_opt = TRUE;
break;
case 'n':
n_opt = atoi(optarg);
if (n_opt == 0)
n_opt = -1;
break;
case 'w':
w_opt = TRUE;
break;
default:
usage();
break;
}
}
if (optind < argc)
usage();
test_adds(0);
endwin();
ExitProgram(EXIT_SUCCESS);
}
ncurses-5.9-20140118/test/lrtest.c 0000644 0001751 0000144 00000012362 11367076373 015147 0 ustar tom users /****************************************************************************
* Copyright (c) 1998-2005,2010 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. *
****************************************************************************/
/*
* Test lower-right-hand corner access
*
* originally by Eric S. Raymond , written for animation
* and resizing -T.Dickey
*
* 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 $
*/
#include
typedef struct {
int y, x, mode, dir, inc;
chtype value;
} MARK;
/*
* Make a couple of markers go 'round the border to demonstrate that we can
* really write to all positions properly.
*/
static void
show(MARK *m)
{
MvAddCh(m->y, m->x, m->value);
if (m->mode == 0) { /* along the x-direction */
m->x += m->inc;
if (m->x >= COLS) {
m->x = COLS - 1;
m->inc = -m->dir * m->inc;
m->y += m->inc;
m->mode = 1;
} else if (m->x < 0) {
m->x = 0;
m->inc = -m->dir * m->inc;
m->y += m->inc;
m->mode = 1;
}
} else { /* along the y-direction */
m->y += m->inc;
if (m->y >= LINES) {
m->y = LINES - 1;
m->inc = m->dir * m->inc;
m->x += m->inc;
m->mode = 0;
} else if (m->y < 0) {
m->y = 0;
m->inc = m->dir * m->inc;
m->x += m->inc;
m->mode = 0;
}
}
}
int
main(
int argc GCC_UNUSED,
char *argv[]GCC_UNUSED)
{
static MARK marks[] =
{
{0, 0, 0, -1, 1, '+' | A_BOLD},
{0, 0, 1, 1, 2, 'X'},
{0, 0, 1, -1, 3, 'Y'},
{0, 8, 0, -1, 1, '+' | A_BOLD},
{0, 9, 0, -1, 1, '+' | A_BOLD},
{1, 0, 1, 1, 1, '*' | A_REVERSE},
{2, 0, 1, 1, 1, '*' | A_REVERSE}
};
setlocale(LC_ALL, "");
initscr();
noecho();
cbreak();
nodelay(stdscr, TRUE);
curs_set(0);
#ifdef KEY_RESIZE
keypad(stdscr, TRUE);
restart:
#endif
move(LINES / 2 - 1, 4);
if (!(has_ic()
#if HAVE_SETUPTERM
/* see PutCharLR() */
|| auto_right_margin
|| (enter_am_mode && exit_am_mode)
#endif
)) {
addstr("Your terminal lacks the capabilities needed to address the\n");
move(LINES / 2, 4);
addstr("lower-right-hand corner of the screen.\n");
} else {
addstr("This is a test of access to the lower right corner.\n");
move(LINES / 2, 4);
addstr("If the top of the box is missing, the test failed.\n");
move(LINES / 2 + 1, 4);
addstr("Please report this (with a copy of your terminfo entry).\n");
move(LINES / 2 + 2, 4);
addstr("to the ncurses maintainers, at bug-ncurses@gnu.org.\n");
}
for (;;) {
int ch;
unsigned n;
box(stdscr, 0, 0);
for (n = 0; n < SIZEOF(marks); n++) {
show(&marks[n]);
}
if ((ch = getch()) > 0) {
if (ch == 'q')
break;
else if (ch == 's')
nodelay(stdscr, FALSE);
else if (ch == ' ')
nodelay(stdscr, TRUE);
#ifdef TRACE
else if (ch == 'T')
trace(0);
else if (ch == 't')
trace(TRACE_CALLS | TRACE_ICALLS | TRACE_UPDATE);
#endif
#ifdef KEY_RESIZE
else if (ch == KEY_RESIZE) {
for (n = 0; n < SIZEOF(marks); n++) {
if (marks[n].mode == 0) { /* moving along x-direction */
if (marks[n].y)
marks[n].y = LINES - 1;
} else {
if (marks[n].x)
marks[n].x = COLS - 1;
}
}
flash();
erase();
wrefresh(curscr);
goto restart;
}
#endif
}
napms(50);
refresh();
}
curs_set(1);
endwin();
ExitProgram(EXIT_SUCCESS);
}
/* lrtest.c ends here */
ncurses-5.9-20140118/test/blue.c 0000644 0001751 0000144 00000030636 12137025455 014554 0 ustar tom users /****************************************************************************
* Copyright (c) 1998-2009,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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. *
****************************************************************************/
/*****************************************************************************
* *
* B l u e M o o n *
* ================= *
* V2.2 *
* A patience game by T.A.Lister *
* Integral screen support by Eric S. Raymond *
* *
*****************************************************************************/
/*
* 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 $
*/
#include
#include
#define NOCARD (-1)
#define ACE 0
#define KING 12
#define SUIT_LENGTH 13
#define HEARTS 0
#define SPADES 1
#define DIAMONDS 2
#define CLUBS 3
#define NSUITS 4
#define GRID_WIDTH 14 /* 13+1 */
#define GRID_LENGTH 56 /* 4*(13+1) */
#define PACK_SIZE 52
#define BASEROW 1
#define PROMPTROW 11
#define RED_ON_WHITE 1
#define BLACK_ON_WHITE 2
#define BLUE_ON_WHITE 3
static void die(int onsig) GCC_NORETURN;
static int deck_size = PACK_SIZE; /* initial deck */
static int deck[PACK_SIZE];
static int grid[GRID_LENGTH]; /* card layout grid */
static int freeptr[4]; /* free card space pointers */
static int deal_number = 0;
static chtype ranks[SUIT_LENGTH][2] =
{
{' ', 'A'},
{' ', '2'},
{' ', '3'},
{' ', '4'},
{' ', '5'},
{' ', '6'},
{' ', '7'},
{' ', '8'},
{' ', '9'},
{'1', '0'},
{' ', 'J'},
{' ', 'Q'},
{' ', '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
#define PC_COLORS(value,pair) (OR_COLORS(value,pair) | A_ALTCHARSET)
static chtype letters[4] =
{
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 */
};
#if defined(__i386__) && defined(A_ALTCHARSET) && HAVE_TIGETSTR
static chtype glyphs[] =
{
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 */
};
#define USE_CP437 1
#else
#define USE_CP437 0
#endif /* __i386__ */
static chtype *suits = letters; /* this may change to glyphs below */
static void
die(int onsig)
{
(void) signal(onsig, SIG_IGN);
endwin();
ExitProgram(EXIT_SUCCESS);
}
static void
init_vars(void)
{
int i;
deck_size = PACK_SIZE;
for (i = 0; i < PACK_SIZE; i++)
deck[i] = i;
for (i = 0; i < 4; i++)
freeptr[i] = i * GRID_WIDTH;
}
static void
shuffle(int size)
{
int i, j, numswaps, swapnum, temp;
numswaps = size * 10; /* an arbitrary figure */
for (swapnum = 0; swapnum < numswaps; swapnum++) {
i = rand() % size;
j = rand() % size;
temp = deck[i];
deck[i] = deck[j];
deck[j] = temp;
}
}
static void
deal_cards(void)
{
int ptr, card = 0, value, csuit, crank, suit, aces[4];
memset(aces, 0, sizeof(aces));
for (suit = HEARTS; suit <= CLUBS; suit++) {
ptr = freeptr[suit];
grid[ptr++] = NOCARD; /* 1st card space is blank */
while ((ptr % GRID_WIDTH) != 0) {
value = deck[card++];
crank = value % SUIT_LENGTH;
csuit = value / SUIT_LENGTH;
if (crank == ACE)
aces[csuit] = ptr;
grid[ptr++] = value;
}
}
if (deal_number == 1) /* shift the aces down to the 1st column */
for (suit = HEARTS; suit <= CLUBS; suit++) {
grid[suit * GRID_WIDTH] = suit * SUIT_LENGTH;
grid[aces[suit]] = NOCARD;
freeptr[suit] = aces[suit];
}
}
static void
printcard(int value)
{
(void) 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]);
}
(void) addch(' ');
}
static void
display_cards(int deal)
{
int row, card;
clear();
(void) printw(
"Blue Moon 2.1 - by Tim Lister & Eric Raymond - Deal %d.\n",
deal);
for (row = HEARTS; row <= CLUBS; row++) {
move(BASEROW + row + row + 2, 1);
for (card = 0; card < GRID_WIDTH; card++)
printcard(grid[row * GRID_WIDTH + card]);
}
move(PROMPTROW + 2, 0);
refresh();
#define P(x) (void)printw("%s\n", x)
P(" This 52-card solitaire starts with the entire deck shuffled and dealt");
P("out in four rows. The aces are then moved to the left end of the layout,");
P("making 4 initial free spaces. You may move to a space only the card that");
P("matches the left neighbor in suit, and is one greater in rank. Kings are");
P("high, so no cards may be placed to their right (they create dead spaces).");
P(" When no moves can be made, cards still out of sequence are reshuffled");
P("and dealt face up after the ends of the partial sequences, leaving a card");
P("space after each sequence, so that each row looks like a partial sequence");
P("followed by a space, followed by enough cards to make a row of 14. ");
P(" A moment's reflection will show that this game cannot take more than 13");
P("deals. A good score is 1-3 deals, 4-7 is average, 8 or more is poor. ");
#undef P
refresh();
}
static int
find(int card)
{
int i;
if ((card < 0) || (card >= PACK_SIZE))
return (NOCARD);
for (i = 0; i < GRID_LENGTH; i++)
if (grid[i] == card)
return i;
return (NOCARD);
}
static void
movecard(int src, int dst)
{
grid[dst] = grid[src];
grid[src] = NOCARD;
move(BASEROW + (dst / GRID_WIDTH) * 2 + 2, (dst % GRID_WIDTH) * 5 + 1);
printcard(grid[dst]);
move(BASEROW + (src / GRID_WIDTH) * 2 + 2, (src % GRID_WIDTH) * 5 + 1);
printcard(grid[src]);
refresh();
}
static void
play_game(void)
{
int dead = 0, i, j;
char c;
int selection[4], card;
while (dead < 4) {
dead = 0;
for (i = 0; i < 4; i++) {
card = grid[freeptr[i] - 1];
if (((card % SUIT_LENGTH) == KING)
||
(card == NOCARD))
selection[i] = NOCARD;
else
selection[i] = find(card + 1);
if (selection[i] == NOCARD)
dead++;
};
if (dead < 4) {
char live[NSUITS + 1], *lp = live;
for (i = 0; i < 4; i++) {
if (selection[i] != NOCARD) {
move(BASEROW + (selection[i] / GRID_WIDTH) * 2 + 3,
(selection[i] % GRID_WIDTH) * 5);
(void) printw(" %c ", (*lp++ = (char) ('a' + i)));
}
};
*lp = '\0';
if (strlen(live) == 1) {
move(PROMPTROW, 0);
(void) printw(
"Making forced moves... ");
refresh();
(void) sleep(1);
c = live[0];
} else {
char buf[BUFSIZ];
(void) sprintf(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(' ');
} while
(((c = (char) getch()) < 'a' || c > 'd')
&& (c != 'r')
&& (c != 'q'));
}
for (j = 0; j < 4; j++)
if (selection[j] != NOCARD) {
move(BASEROW + (selection[j] / GRID_WIDTH) * 2 + 3,
(selection[j] % GRID_WIDTH) * 5);
(void) printw(" ");
}
if (c == 'r')
display_cards(deal_number);
else if (c == 'q')
die(SIGINT);
else {
i = c - 'a';
if (selection[i] == NOCARD)
beep();
else {
movecard(selection[i], freeptr[i]);
freeptr[i] = selection[i];
}
}
}
}
move(PROMPTROW, 0);
(void) standout();
(void) printw("Finished deal %d - type any character to continue...", deal_number);
(void) standend();
(void) getch();
}
static int
collect_discards(void)
{
int row, col, cardno = 0, finish, gridno;
for (row = HEARTS; row <= CLUBS; row++) {
finish = 0;
for (col = 1; col < GRID_WIDTH; col++) {
gridno = row * GRID_WIDTH + col;
if ((grid[gridno] != (grid[gridno - 1] + 1)) && (finish == 0)) {
finish = 1;
freeptr[row] = gridno;
};
if ((finish != 0) && (grid[gridno] != NOCARD))
deck[cardno++] = grid[gridno];
}
}
return cardno;
}
static void
game_finished(int deal)
{
clear();
(void) printw("You finished the game in %d deals. This is ", deal);
(void) standout();
if (deal < 2)
(void) addstr("excellent");
else if (deal < 4)
(void) addstr("good");
else if (deal < 8)
(void) addstr("average");
else
(void) addstr("poor");
(void) standend();
(void) addstr(". ");
refresh();
}
int
main(int argc, char *argv[])
{
CATCHALL(die);
setlocale(LC_ALL, "");
initscr();
/*
* 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)
srand((unsigned) atoi(argv[1]));
else
srand((unsigned) time((time_t *) 0));
init_vars();
do {
deal_number++;
shuffle(deck_size);
deal_cards();
display_cards(deal_number);
play_game();
}
while
((deck_size = collect_discards()) != 0);
game_finished(deal_number);
die(SIGINT);
/*NOTREACHED */
}
/* blue.c ends here */
ncurses-5.9-20140118/test/test_addwstr.c 0000644 0001751 0000144 00000030577 12063210646 016334 0 ustar tom users /****************************************************************************
* Copyright (c) 2009-2010,2012 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_addwstr.c,v 1.11 2012/12/16 00:11:18 tom Exp $
*
* Demonstrate the waddwstr() and wadd_wch functions.
* Thomas Dickey - 2009/9/12
*
* Note: to provide inputs for *add_wch(), we use setcchar(). A quirk of the
* X/Open definition for that function is that the string contains no
* characters with negative width. Any control character (such as tab) falls
* into that category. So it follows that *add_wch() cannot render a tab
* character because there is no legal way to construct a cchar_t containing
* one. X/Open does not document this, and it would be logical to assume that
* *addwstr() has the same limitation, but it uses a wchar_t string directly,
* and does not document how tabs are handled.
*/
#include
#if USE_WIDEC_SUPPORT
#define WIDE_LINEDATA
#include
#undef MvAddCh
#undef MvAddStr
#undef MvWAddCh
#undef MvWAddStr
/* definitions to make it simpler to compare with inserts.c */
#define AddNStr addnwstr
#define AddStr addwstr
#define MvAddNStr (void) mvaddnwstr
#define MvAddStr (void) mvaddwstr
#define MvWAddNStr (void) mvwaddnwstr
#define MvWAddStr (void) mvwaddwstr
#define WAddNStr waddnwstr
#define WAddStr waddwstr
#define MY_TABSIZE 8
typedef enum {
oDefault = 0,
oMove = 1,
oWindow = 2,
oMoveWindow = 3
} Options;
static bool m_opt = FALSE;
static bool w_opt = FALSE;
static int n_opt = -1;
static void
legend(WINDOW *win, int level, Options state, wchar_t *buffer, int length)
{
const char *showstate;
switch (state) {
default:
case oDefault:
showstate = "";
break;
case oMove:
showstate = " (mvXXX)";
break;
case oWindow:
showstate = " (winXXX)";
break;
case oMoveWindow:
showstate = " (mvwinXXX)";
break;
}
wmove(win, 0, 0);
wprintw(win,
"The Strings/Chars displays should match. Enter any characters, except:\n");
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);
waddwstr(win, buffer);
waddstr(win, ">");
}
static int
ColOf(wchar_t *buffer, int length, int margin)
{
int n;
int result;
for (n = 0, result = margin + 1; n < length; ++n) {
int ch = buffer[n];
switch (ch) {
case '\n':
/* actually newline should clear the remainder of the line
* and move to the next line - but that seems a little awkward
* in this example.
*/
case '\r':
result = 0;
break;
case '\b':
if (result > 0)
--result;
break;
case '\t':
result += (MY_TABSIZE - (result % MY_TABSIZE));
break;
case '\177':
result += 2;
break;
default:
result += wcwidth(ch);
if (ch < 32)
++result;
break;
}
}
return result;
}
static int
ConvertCh(chtype source, cchar_t *target)
{
wchar_t tmp_wchar[2];
tmp_wchar[0] = (wchar_t) source;
tmp_wchar[1] = 0;
if (setcchar(target, tmp_wchar, A_NORMAL, 0, (void *) 0) == ERR) {
beep();
return FALSE;
}
return TRUE;
}
static int
MvWAddCh(WINDOW *win, int y, int x, chtype ch)
{
int code;
cchar_t tmp_cchar;
if (ConvertCh(ch, &tmp_cchar)) {
code = mvwadd_wch(win, y, x, &tmp_cchar);
} else {
code = mvwaddch(win, y, x, ch);
}
return code;
}
static int
MvAddCh(int y, int x, chtype ch)
{
int code;
cchar_t tmp_cchar;
if (ConvertCh(ch, &tmp_cchar)) {
code = mvadd_wch(y, x, &tmp_cchar);
} else {
code = mvaddch(y, x, ch);
}
return code;
}
static int
WAddCh(WINDOW *win, chtype ch)
{
int code;
cchar_t tmp_cchar;
if (ConvertCh(ch, &tmp_cchar)) {
code = wadd_wch(win, &tmp_cchar);
} else {
code = waddch(win, ch);
}
return code;
}
static int
AddCh(chtype ch)
{
int code;
cchar_t tmp_cchar;
if (ConvertCh(ch, &tmp_cchar)) {
code = add_wch(&tmp_cchar);
} else {
code = addch(ch);
}
return code;
}
#define LEN(n) ((length - (n) > n_opt) ? n_opt : (length - (n)))
static void
test_inserts(int level)
{
static bool first = TRUE;
int ch;
int limit;
int row = 1;
int col;
int row2, col2;
int length;
wchar_t buffer[BUFSIZ];
WINDOW *look = 0;
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));
if (first) {
static char cmd[80];
setlocale(LC_ALL, "");
putenv(strcpy(cmd, "TABSIZE=8"));
initscr();
(void) cbreak(); /* take input chars one at a time, no wait for \n */
(void) noecho(); /* don't echo input */
keypad(stdscr, TRUE);
/*
* Show the characters inserted in color, to distinguish from those that
* are shifted.
*/
if (has_colors()) {
start_color();
init_pair(1, COLOR_WHITE, COLOR_BLUE);
}
}
limit = LINES - 5;
if (level > 0) {
look = newwin(limit, COLS - (2 * (level - 1)), 0, level - 1);
work = newwin(limit - 2, COLS - (2 * level), 1, level);
show = newwin(4, COLS, limit + 1, 0);
box(look, 0, 0);
wnoutrefresh(look);
limit -= 2;
} else {
work = stdscr;
show = derwin(stdscr, 4, COLS, limit + 1, 0);
}
keypad(work, TRUE);
for (col = margin + 1; col < COLS; col += MY_TABSIZE)
MvWVLine(work, row, col, '.', limit - 2);
MvWVLine(work, row, margin, ACS_VLINE, limit - 2);
MvWVLine(work, row, margin + 1, ACS_VLINE, limit - 2);
limit /= 2;
(void) mvwaddstr(work, 1, 2, "String");
(void) mvwaddstr(work, limit + 1, 2, "Chars");
wnoutrefresh(work);
buffer[length = 0] = '\0';
legend(show, level, option, buffer, length);
wnoutrefresh(show);
doupdate();
if (has_colors()) {
wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
}
while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) {
wmove(work, row, margin + 1);
switch (ch) {
case key_RECUR:
test_inserts(level + 1);
if (look)
touchwin(look);
touchwin(work);
touchwin(show);
if (look)
wnoutrefresh(look);
wnoutrefresh(work);
wnoutrefresh(show);
doupdate();
break;
case key_NEWLINE:
if (row < limit) {
++row;
/* put the whole string in, all at once */
col2 = margin + 1;
switch (option) {
case oDefault:
if (n_opt > 1) {
for (col = 0; col < length; col += n_opt) {
col2 = ColOf(buffer, col, margin);
if (move(row, col2) != ERR) {
AddNStr(buffer + col, LEN(col));
}
}
} else {
if (move(row, col2) != ERR) {
AddStr(buffer);
}
}
break;
case oMove:
if (n_opt > 1) {
for (col = 0; col < length; col += n_opt) {
col2 = ColOf(buffer, col, margin);
MvAddNStr(row, col2, buffer + col, LEN(col));
}
} else {
MvAddStr(row, col2, buffer);
}
break;
case oWindow:
if (n_opt > 1) {
for (col = 0; col < length; col += n_opt) {
col2 = ColOf(buffer, col, margin);
if (wmove(work, row, col2) != ERR) {
WAddNStr(work, buffer + col, LEN(col));
}
}
} else {
if (wmove(work, row, col2) != ERR) {
WAddStr(work, buffer);
}
}
break;
case oMoveWindow:
if (n_opt > 1) {
for (col = 0; col < length; col += n_opt) {
col2 = ColOf(buffer, col, margin);
MvWAddNStr(work, row, col2, buffer + col, LEN(col));
}
} else {
MvWAddStr(work, row, col2, buffer);
}
break;
}
/* do the corresponding single-character insertion */
row2 = limit + row;
for (col = 0; col < length; ++col) {
col2 = ColOf(buffer, col, margin);
switch (option) {
case oDefault:
if (move(row2, col2) != ERR) {
AddCh((chtype) buffer[col]);
}
break;
case oMove:
MvAddCh(row2, col2, (chtype) buffer[col]);
break;
case oWindow:
if (wmove(work, row2, col2) != ERR) {
WAddCh(work, (chtype) buffer[col]);
}
break;
case oMoveWindow:
MvWAddCh(work, row2, col2, (chtype) buffer[col]);
break;
}
}
} else {
beep();
}
break;
case KEY_BACKSPACE:
ch = '\b';
/* FALLTHRU */
default:
buffer[length++] = ch;
buffer[length] = '\0';
/* put the string in, one character at a time */
col = ColOf(buffer, length - 1, margin);
switch (option) {
case oDefault:
if (move(row, col) != ERR) {
AddStr(buffer + length - 1);
}
break;
case oMove:
MvAddStr(row, col, buffer + length - 1);
break;
case oWindow:
if (wmove(work, row, col) != ERR) {
WAddStr(work, buffer + length - 1);
}
break;
case oMoveWindow:
MvWAddStr(work, row, col, buffer + length - 1);
break;
}
/* do the corresponding single-character insertion */
switch (option) {
case oDefault:
if (move(limit + row, col) != ERR) {
AddCh((chtype) ch);
}
break;
case oMove:
MvAddCh(limit + row, col, (chtype) ch);
break;
case oWindow:
if (wmove(work, limit + row, col) != ERR) {
WAddCh(work, (chtype) ch);
}
break;
case oMoveWindow:
MvWAddCh(work, limit + row, col, (chtype) ch);
break;
}
wnoutrefresh(work);
legend(show, level, option, buffer, length);
wnoutrefresh(show);
doupdate();
break;
}
}
delwin(show);
if (level > 0) {
delwin(work);
delwin(look);
}
}
static void
usage(void)
{
static const char *tbl[] =
{
"Usage: inserts [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"
," -w use window-parameter even when stdscr would be implied"
};
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;
setlocale(LC_ALL, "");
while ((ch = getopt(argc, argv, "f:mn:w")) != -1) {
switch (ch) {
case 'f':
init_linedata(optarg);
break;
case 'm':
m_opt = TRUE;
break;
case 'n':
n_opt = atoi(optarg);
if (n_opt == 0)
n_opt = -1;
break;
case 'w':
w_opt = TRUE;
break;
default:
usage();
break;
}
}
if (optind < argc)
usage();
test_inserts(0);
endwin();
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(void)
{
printf("This program requires the wide-ncurses library\n");
ExitProgram(EXIT_FAILURE);
}
#endif
ncurses-5.9-20140118/test/cardfile.dat 0000644 0001751 0000144 00000000612 06703777115 015724 0 ustar tom users title 1
Some text for title1
and some more text
title 2
The quicker brown fox ran all over the lazy dog.
put a card before the first two
This is an example of a simple cardfile.
show a fourth card
The fourth card
has a large amount of data,
more than the other cards.
At least, that is what I thought it should do, since I want to see how well
the forms package handles justification.
ncurses-5.9-20140118/test/worm.c 0000644 0001751 0000144 00000033775 12161401245 014610 0 ustar tom users /****************************************************************************
* Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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. *
****************************************************************************/
/*
@@@ @@@ @@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@
@@@ @@@ @@@@@@@@@@@@ @@@@@@@@@@@@ @@@@@@@@@@@@@
@@@ @@@ @@@@ @@@@ @@@@ @@@@ @@@ @@@@
@@@ @@ @@@ @@@ @@@ @@@ @@@ @@@ @@@
@@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@
@@@@ @@@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@
@@@@@@@@@@@@ @@@@ @@@@ @@@ @@@ @@@ @@@
@@@@ @@@@ @@@@@@@@@@@@ @@@ @@@ @@@ @@@
@@ @@ @@@@@@@@@@ @@@ @@@ @@@ @@@
Eric P. Scott
Caltech High Energy Physics
October, 1980
Hacks to turn this into a test frame for cursor movement:
Eric S. Raymond
January, 1995
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 $
*/
#include
#ifdef USE_PTHREADS
#include
#endif
WANT_USE_WINDOW();
#define MAX_WORMS 40
#define MAX_LENGTH 1024
static chtype flavor[] =
{
'O', '*', '#', '$', '%', '0', '@',
};
static const int xinc[] =
{
1, 1, 1, 0, -1, -1, -1, 0
}, yinc[] =
{
-1, 0, 1, 1, 1, 0, -1, -1
};
typedef struct worm {
int orientation;
int head;
int *xpos;
int *ypos;
chtype attrs;
#ifdef USE_PTHREADS
pthread_t thread;
#endif
} WORM;
static unsigned long sequence = 0;
static bool quitting = FALSE;
static WORM worm[MAX_WORMS];
static int **refs;
static int last_x, last_y;
static const char *field;
static int length = 16, number = 3;
static chtype trail = ' ';
static unsigned pending;
#ifdef TRACE
static int generation, trace_start, trace_end;
#endif /* TRACE */
/* *INDENT-OFF* */
static const struct options {
int nopts;
int opts[3];
} normal[8]={
{ 3, { 7, 0, 1 } },
{ 3, { 0, 1, 2 } },
{ 3, { 1, 2, 3 } },
{ 3, { 2, 3, 4 } },
{ 3, { 3, 4, 5 } },
{ 3, { 4, 5, 6 } },
{ 3, { 5, 6, 7 } },
{ 3, { 6, 7, 0 } }
}, upper[8]={
{ 1, { 1, 0, 0 } },
{ 2, { 1, 2, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 2, { 4, 5, 0 } },
{ 1, { 5, 0, 0 } },
{ 2, { 1, 5, 0 } }
}, left[8]={
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 2, { 2, 3, 0 } },
{ 1, { 3, 0, 0 } },
{ 2, { 3, 7, 0 } },
{ 1, { 7, 0, 0 } },
{ 2, { 7, 0, 0 } }
}, right[8]={
{ 1, { 7, 0, 0 } },
{ 2, { 3, 7, 0 } },
{ 1, { 3, 0, 0 } },
{ 2, { 3, 4, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 2, { 6, 7, 0 } }
}, lower[8]={
{ 0, { 0, 0, 0 } },
{ 2, { 0, 1, 0 } },
{ 1, { 1, 0, 0 } },
{ 2, { 1, 5, 0 } },
{ 1, { 5, 0, 0 } },
{ 2, { 5, 6, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } }
}, upleft[8]={
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 1, { 3, 0, 0 } },
{ 2, { 1, 3, 0 } },
{ 1, { 1, 0, 0 } }
}, upright[8]={
{ 2, { 3, 5, 0 } },
{ 1, { 3, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 1, { 5, 0, 0 } }
}, lowleft[8]={
{ 3, { 7, 0, 1 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 1, { 1, 0, 0 } },
{ 2, { 1, 7, 0 } },
{ 1, { 7, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } }
}, lowright[8]={
{ 0, { 0, 0, 0 } },
{ 1, { 7, 0, 0 } },
{ 2, { 5, 7, 0 } },
{ 1, { 5, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } },
{ 0, { 0, 0, 0 } }
};
/* *INDENT-ON* */
static void
failed(const char *s)
{
perror(s);
endwin();
ExitProgram(EXIT_FAILURE);
}
static void
cleanup(void)
{
USING_WINDOW(stdscr, wrefresh);
curs_set(1);
endwin();
}
static void
onsig(int sig GCC_UNUSED)
{
cleanup();
ExitProgram(EXIT_FAILURE);
}
static double
ranf(void)
{
long r = (rand() & 077777);
return ((double) r / 32768.);
}
static int
draw_worm(WINDOW *win, void *data)
{
WORM *w = (WORM *) data;
const struct options *op;
unsigned mask = (unsigned) (~(1 << (w - worm)));
chtype attrs = w->attrs | ((mask & pending) ? A_REVERSE : 0);
int x;
int y;
int h;
bool done = FALSE;
if ((x = w->xpos[h = w->head]) < 0) {
wmove(win, y = w->ypos[h] = last_y, x = w->xpos[h] = 0);
waddch(win, attrs);
refs[y][x]++;
} else {
y = w->ypos[h];
}
if (x > last_x)
x = last_x;
if (y > last_y)
y = last_y;
if (++h == length)
h = 0;
if (w->xpos[w->head = h] >= 0) {
int x1, y1;
x1 = w->xpos[h];
y1 = w->ypos[h];
if (y1 < LINES
&& x1 < COLS
&& --refs[y1][x1] == 0) {
wmove(win, y1, x1);
waddch(win, trail);
}
}
op = &(x == 0
? (y == 0
? upleft
: (y == last_y
? lowleft
: left))
: (x == last_x
? (y == 0
? upright
: (y == last_y
? lowright
: right))
: (y == 0
? upper
: (y == last_y
? lower
: normal))))[w->orientation];
switch (op->nopts) {
case 0:
done = TRUE;
break;
case 1:
w->orientation = op->opts[0];
break;
default:
w->orientation = op->opts[(int) (ranf() * (double) op->nopts)];
break;
}
if (!done) {
x += xinc[w->orientation];
y += yinc[w->orientation];
wmove(win, y, x);
if (y < 0)
y = 0;
waddch(win, attrs);
w->ypos[h] = y;
w->xpos[h] = x;
refs[y][x]++;
}
return done;
}
#ifdef USE_PTHREADS
static bool
quit_worm(int bitnum)
{
pending |= (1 << bitnum);
napms(10); /* let the other thread(s) have a chance */
pending &= ~(1 << bitnum);
return quitting;
}
static void *
start_worm(void *arg)
{
unsigned long compare = 0;
Trace(("start_worm"));
while (!quit_worm(((struct worm *) arg) - worm)) {
while (compare < sequence) {
++compare;
#if HAVE_USE_WINDOW
use_window(stdscr, draw_worm, arg);
#else
draw_worm(stdscr, arg);
#endif
}
}
Trace(("...start_worm (done)"));
return NULL;
}
#endif
static bool
draw_all_worms(void)
{
bool done = FALSE;
int n;
struct worm *w;
#ifdef USE_PTHREADS
static bool first = TRUE;
if (first) {
first = FALSE;
for (n = 0, w = &worm[0]; n < number; n++, w++) {
(void) pthread_create(&(w->thread), NULL, start_worm, w);
}
}
#else
for (n = 0, w = &worm[0]; n < number; n++, w++) {
if (
#if HAVE_USE_WINDOW
USING_WINDOW2(stdscr, draw_worm, w)
#else
draw_worm(stdscr, w)
#endif
)
done = TRUE;
}
#endif
return done;
}
static int
get_input(void)
{
int ch;
ch = USING_WINDOW(stdscr, wgetch);
return ch;
}
#ifdef KEY_RESIZE
static int
update_refs(WINDOW *win)
{
int x, y;
(void) win;
if (last_x != COLS - 1) {
for (y = 0; y <= last_y; y++) {
refs[y] = typeRealloc(int, (size_t) COLS, refs[y]);
if (!refs[y])
failed("update_refs");
for (x = last_x + 1; x < COLS; x++)
refs[y][x] = 0;
}
last_x = COLS - 1;
}
if (last_y != LINES - 1) {
for (y = LINES; y <= last_y; y++)
free(refs[y]);
refs = typeRealloc(int *, (size_t) LINES, refs);
for (y = last_y + 1; y < LINES; y++) {
refs[y] = typeMalloc(int, (size_t) COLS);
if (!refs[y])
failed("update_refs");
for (x = 0; x < COLS; x++)
refs[y][x] = 0;
}
last_y = LINES - 1;
}
return OK;
}
#endif
int
main(int argc, char *argv[])
{
int x, y;
int n;
struct worm *w;
int *ip;
bool done = FALSE;
int max_refs;
setlocale(LC_ALL, "");
for (x = 1; x < argc; x++) {
char *p;
p = argv[x];
if (*p == '-')
p++;
switch (*p) {
case 'f':
field = "WORM";
break;
case 'l':
if (++x == argc)
goto usage;
if ((length = atoi(argv[x])) < 2 || length > MAX_LENGTH) {
fprintf(stderr, "%s: Invalid length\n", *argv);
ExitProgram(EXIT_FAILURE);
}
break;
case 'n':
if (++x == argc)
goto usage;
if ((number = atoi(argv[x])) < 1 || number > MAX_WORMS) {
fprintf(stderr, "%s: Invalid number of worms\n", *argv);
ExitProgram(EXIT_FAILURE);
}
break;
case 't':
trail = '.';
break;
#ifdef TRACE
case 'T':
trace_start = atoi(argv[++x]);
trace_end = atoi(argv[++x]);
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);
}
}
signal(SIGINT, onsig);
initscr();
noecho();
cbreak();
nonl();
curs_set(0);
last_y = LINES - 1;
last_x = COLS - 1;
#ifdef A_COLOR
if (has_colors()) {
int bg = COLOR_BLACK;
start_color();
#if HAVE_USE_DEFAULT_COLORS
if (use_default_colors() == OK)
bg = -1;
#endif
#define SET_COLOR(num, fg) \
init_pair(num+1, (short) fg, (short) bg); \
flavor[num] |= (chtype) COLOR_PAIR(num+1) | A_BOLD
SET_COLOR(0, COLOR_GREEN);
SET_COLOR(1, COLOR_RED);
SET_COLOR(2, COLOR_CYAN);
SET_COLOR(3, COLOR_WHITE);
SET_COLOR(4, COLOR_MAGENTA);
SET_COLOR(5, COLOR_BLUE);
SET_COLOR(6, COLOR_YELLOW);
}
#endif /* A_COLOR */
max_refs = LINES;
refs = typeMalloc(int *, (size_t) max_refs);
for (y = 0; y < max_refs; y++) {
refs[y] = typeMalloc(int, (size_t) COLS);
for (x = 0; x < COLS; x++) {
refs[y][x] = 0;
}
}
#ifdef BADCORNER
/* if addressing the lower right corner doesn't work in your curses */
refs[last_y][last_x] = 1;
#endif /* BADCORNER */
for (n = number, w = &worm[0]; --n >= 0; w++) {
w->attrs = flavor[(unsigned) n % SIZEOF(flavor)];
w->orientation = 0;
w->head = 0;
if (!(ip = typeMalloc(int, (size_t) (length + 1)))) {
fprintf(stderr, "%s: out of memory\n", *argv);
ExitProgram(EXIT_FAILURE);
}
w->xpos = ip;
for (x = length; --x >= 0;)
*ip++ = -1;
if (!(ip = typeMalloc(int, (size_t) (length + 1)))) {
fprintf(stderr, "%s: out of memory\n", *argv);
ExitProgram(EXIT_FAILURE);
}
w->ypos = ip;
for (y = length; --y >= 0;)
*ip++ = -1;
}
if (field) {
const char *p;
p = field;
for (y = last_y; --y >= 0;) {
for (x = COLS; --x >= 0;) {
addch((chtype) (*p++));
if (!*p)
p = field;
}
}
}
USING_WINDOW(stdscr, 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);
get_input();
} else if (generation == trace_end) {
trace(0);
get_input();
}
generation++;
}
#endif
#ifdef KEY_RESIZE
if (ch == KEY_RESIZE) {
USING_WINDOW(stdscr, update_refs);
}
#endif
/*
* Make it simple to put this into single-step mode, or resume
* normal operation -T.Dickey
*/
if (ch == 'q') {
quitting = TRUE;
done = TRUE;
continue;
} else if (ch == 's') {
nodelay(stdscr, FALSE);
} else if (ch == ' ') {
nodelay(stdscr, TRUE);
}
}
done = draw_all_worms();
napms(10);
USING_WINDOW(stdscr, wrefresh);
}
Trace(("Cleanup"));
cleanup();
#ifdef NO_LEAKS
for (y = 0; y < max_refs; y++) {
free(refs[y]);
}
free(refs);
for (n = number, w = &worm[0]; --n >= 0; w++) {
free(w->xpos);
free(w->ypos);
}
#endif
#ifdef USE_PTHREADS
/*
* Do this just in case one of the threads did not really exit.
*/
Trace(("join all threads"));
for (n = 0; n < number; n++) {
pthread_join(worm[n].thread, NULL);
}
#endif
ExitProgram(EXIT_SUCCESS);
}
ncurses-5.9-20140118/test/ins_wide.c 0000644 0001751 0000144 00000030376 12063215366 015427 0 ustar tom users /****************************************************************************
* Copyright (c) 2002-2010,2012 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: ins_wide.c,v 1.20 2012/12/16 00:51:02 tom Exp $
*
* Demonstrate the wins_wstr() and wins_wch functions.
* Thomas Dickey - 2002/11/23
*
* Note: to provide inputs for *ins_wch(), we use setcchar(). A quirk of the
* X/Open definition for that function is that the string contains no
* characters with negative width. Any control character (such as tab) falls
* into that category. So it follows that *ins_wch() cannot render a tab
* character because there is no legal way to construct a cchar_t containing
* one. X/Open does not document this, and it would be logical to assume that
* *ins_wstr() has the same limitation, but it uses a wchar_t string directly,
* and does not document how tabs are handled.
*/
#include
#if USE_WIDEC_SUPPORT
#define WIDE_LINEDATA
#include
/* definitions to make it simpler to compare with inserts.c */
#define InsNStr ins_nwstr
#define InsStr ins_wstr
#define MvInsNStr (void) mvins_nwstr
#define MvInsStr (void) mvins_wstr
#define MvWInsNStr (void) mvwins_nwstr
#define MvWInsStr (void) mvwins_wstr
#define WInsNStr wins_nwstr
#define WInsStr wins_wstr
#define MY_TABSIZE 8
typedef enum {
oDefault = 0,
oMove = 1,
oWindow = 2,
oMoveWindow = 3
} Options;
static bool m_opt = FALSE;
static bool w_opt = FALSE;
static int n_opt = -1;
static void
legend(WINDOW *win, int level, Options state, wchar_t *buffer, int length)
{
const char *showstate;
switch (state) {
default:
case oDefault:
showstate = "";
break;
case oMove:
showstate = " (mvXXX)";
break;
case oWindow:
showstate = " (winXXX)";
break;
case oMoveWindow:
showstate = " (mvwinXXX)";
break;
}
wmove(win, 0, 0);
wprintw(win,
"The Strings/Chars displays should match. Enter any characters, except:\n");
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);
waddwstr(win, buffer);
waddstr(win, ">");
}
static int
ColOf(wchar_t *buffer, int length, int margin)
{
int n;
int result;
for (n = 0, result = margin + 1; n < length; ++n) {
int ch = buffer[n];
switch (ch) {
case '\n':
/* actually newline should clear the remainder of the line
* and move to the next line - but that seems a little awkward
* in this example.
*/
case '\r':
result = 0;
break;
case '\b':
if (result > 0)
--result;
break;
case '\t':
result += (MY_TABSIZE - (result % MY_TABSIZE));
break;
case '\177':
result += 2;
break;
default:
result += wcwidth(ch);
if (ch < 32)
++result;
break;
}
}
return result;
}
static int
ConvertCh(chtype source, cchar_t *target)
{
wchar_t tmp_wchar[2];
tmp_wchar[0] = (wchar_t) source;
tmp_wchar[1] = 0;
if (setcchar(target, tmp_wchar, A_NORMAL, 0, (void *) 0) == ERR) {
beep();
return FALSE;
}
return TRUE;
}
static int
MvWInsCh(WINDOW *win, int y, int x, chtype ch)
{
int code;
cchar_t tmp_cchar;
if (ConvertCh(ch, &tmp_cchar)) {
code = mvwins_wch(win, y, x, &tmp_cchar);
} else {
code = mvwinsch(win, y, x, ch);
}
return code;
}
static int
MvInsCh(int y, int x, chtype ch)
{
int code;
cchar_t tmp_cchar;
if (ConvertCh(ch, &tmp_cchar)) {
code = mvins_wch(y, x, &tmp_cchar);
} else {
code = mvinsch(y, x, ch);
}
return code;
}
static int
WInsCh(WINDOW *win, chtype ch)
{
int code;
cchar_t tmp_cchar;
if (ConvertCh(ch, &tmp_cchar)) {
code = wins_wch(win, &tmp_cchar);
} else {
code = winsch(win, ch);
}
return code;
}
static int
InsCh(chtype ch)
{
int code;
cchar_t tmp_cchar;
if (ConvertCh(ch, &tmp_cchar)) {
code = ins_wch(&tmp_cchar);
} else {
code = insch(ch);
}
return code;
}
#define LEN(n) ((length - (n) > n_opt) ? n_opt : (length - (n)))
static void
test_inserts(int level)
{
static bool first = TRUE;
int ch;
int limit;
int row = 1;
int col;
int row2, col2;
int length;
wchar_t buffer[BUFSIZ];
WINDOW *look = 0;
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));
if (first) {
static char cmd[80];
setlocale(LC_ALL, "");
putenv(strcpy(cmd, "TABSIZE=8"));
initscr();
(void) cbreak(); /* take input chars one at a time, no wait for \n */
(void) noecho(); /* don't echo input */
keypad(stdscr, TRUE);
/*
* Show the characters inserted in color, to distinguish from those
* that are shifted.
*/
if (has_colors()) {
start_color();
init_pair(1, COLOR_WHITE, COLOR_BLUE);
}
}
limit = LINES - 5;
if (level > 0) {
look = newwin(limit, COLS - (2 * (level - 1)), 0, level - 1);
work = newwin(limit - 2, COLS - (2 * level), 1, level);
show = newwin(4, COLS, limit + 1, 0);
box(look, 0, 0);
wnoutrefresh(look);
limit -= 2;
} else {
work = stdscr;
show = derwin(stdscr, 4, COLS, limit + 1, 0);
}
keypad(work, TRUE);
for (col = margin + 1; col < COLS; col += MY_TABSIZE)
MvWVLine(work, row, col, '.', limit - 2);
MvWVLine(work, row, margin, ACS_VLINE, limit - 2);
MvWVLine(work, row, margin + 1, ACS_VLINE, limit - 2);
limit /= 2;
MvWAddStr(work, 1, 2, "String");
MvWAddStr(work, limit + 1, 2, "Chars");
wnoutrefresh(work);
buffer[length = 0] = '\0';
legend(show, level, option, buffer, length);
wnoutrefresh(show);
doupdate();
if (has_colors()) {
wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
}
while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) {
wmove(work, row, margin + 1);
switch (ch) {
case key_RECUR:
test_inserts(level + 1);
if (look)
touchwin(look);
touchwin(work);
touchwin(show);
if (look)
wnoutrefresh(look);
wnoutrefresh(work);
wnoutrefresh(show);
doupdate();
break;
case key_NEWLINE:
if (row < limit) {
++row;
/* put the whole string in, all at once */
col2 = margin + 1;
switch (option) {
case oDefault:
if (n_opt > 1) {
for (col = 0; col < length; col += n_opt) {
col2 = ColOf(buffer, col, margin);
if (move(row, col2) != ERR) {
InsNStr(buffer + col, LEN(col));
}
}
} else {
if (move(row, col2) != ERR) {
InsStr(buffer);
}
}
break;
case oMove:
if (n_opt > 1) {
for (col = 0; col < length; col += n_opt) {
col2 = ColOf(buffer, col, margin);
MvInsNStr(row, col2, buffer + col, LEN(col));
}
} else {
MvInsStr(row, col2, buffer);
}
break;
case oWindow:
if (n_opt > 1) {
for (col = 0; col < length; col += n_opt) {
col2 = ColOf(buffer, col, margin);
if (wmove(work, row, col2) != ERR) {
WInsNStr(work, buffer + col, LEN(col));
}
}
} else {
if (wmove(work, row, col2) != ERR) {
WInsStr(work, buffer);
}
}
break;
case oMoveWindow:
if (n_opt > 1) {
for (col = 0; col < length; col += n_opt) {
col2 = ColOf(buffer, col, margin);
MvWInsNStr(work, row, col2, buffer + col, LEN(col));
}
} else {
MvWInsStr(work, row, col2, buffer);
}
break;
}
/* do the corresponding single-character insertion */
row2 = limit + row;
for (col = 0; col < length; ++col) {
col2 = ColOf(buffer, col, margin);
switch (option) {
case oDefault:
if (move(row2, col2) != ERR) {
InsCh((chtype) buffer[col]);
}
break;
case oMove:
MvInsCh(row2, col2, (chtype) buffer[col]);
break;
case oWindow:
if (wmove(work, row2, col2) != ERR) {
WInsCh(work, (chtype) buffer[col]);
}
break;
case oMoveWindow:
MvWInsCh(work, row2, col2, (chtype) buffer[col]);
break;
}
}
} else {
beep();
}
break;
default:
buffer[length++] = ch;
buffer[length] = '\0';
/* put the string in, one character at a time */
col = ColOf(buffer, length - 1, margin);
switch (option) {
case oDefault:
if (move(row, col) != ERR) {
InsStr(buffer + length - 1);
}
break;
case oMove:
MvInsStr(row, col, buffer + length - 1);
break;
case oWindow:
if (wmove(work, row, col) != ERR) {
WInsStr(work, buffer + length - 1);
}
break;
case oMoveWindow:
MvWInsStr(work, row, col, buffer + length - 1);
break;
}
/* do the corresponding single-character insertion */
switch (option) {
case oDefault:
if (move(limit + row, col) != ERR) {
InsCh((chtype) ch);
}
break;
case oMove:
MvInsCh(limit + row, col, (chtype) ch);
break;
case oWindow:
if (wmove(work, limit + row, col) != ERR) {
WInsCh(work, (chtype) ch);
}
break;
case oMoveWindow:
MvWInsCh(work, limit + row, col, (chtype) ch);
break;
}
wnoutrefresh(work);
legend(show, level, option, buffer, length);
wnoutrefresh(show);
doupdate();
break;
}
}
if (level > 0) {
delwin(work);
delwin(look);
}
delwin(show);
}
static void
usage(void)
{
static const char *tbl[] =
{
"Usage: inserts [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"
," -w use window-parameter even when stdscr would be implied"
};
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;
setlocale(LC_ALL, "");
while ((ch = getopt(argc, argv, "f:mn:w")) != -1) {
switch (ch) {
case 'f':
init_linedata(optarg);
break;
case 'm':
m_opt = TRUE;
break;
case 'n':
n_opt = atoi(optarg);
if (n_opt == 0)
n_opt = -1;
break;
case 'w':
w_opt = TRUE;
break;
default:
usage();
break;
}
}
if (optind < argc)
usage();
test_inserts(0);
endwin();
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(void)
{
printf("This program requires the wide-ncurses library\n");
ExitProgram(EXIT_FAILURE);
}
#endif
ncurses-5.9-20140118/test/edit_field.c 0000644 0001751 0000144 00000030071 12221650751 015703 0 ustar tom users /****************************************************************************
* Copyright (c) 2003-2011,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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: edit_field.c,v 1.22 2013/09/28 22:02:17 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
* null-terminated string in field_buffer(field,1).
*
* Thomas Dickey - 2003/4/26.
*/
#include
#if USE_LIBFORM
#include
static struct {
int code;
int result;
const char *help;
} commands[] = {
{
CTRL('A'), REQ_NEXT_CHOICE, ""
},
{
CTRL('B'), REQ_PREV_WORD, "go to previous word"
},
{
CTRL('C'), REQ_CLR_EOL, "clear to end of line"
},
{
CTRL('D'), REQ_DOWN_FIELD, "move downward to field"
},
{
CTRL('E'), REQ_END_FIELD, "go to end of field"
},
{
CTRL('F'), REQ_NEXT_PAGE, "go to next page"
},
{
CTRL('G'), REQ_DEL_WORD, "delete current word"
},
{
CTRL('H'), REQ_DEL_PREV, "delete previous character"
},
{
CTRL('I'), REQ_INS_CHAR, "insert character"
},
{
CTRL('K'), REQ_CLR_EOF, "clear to end of field"
},
{
CTRL('L'), REQ_LEFT_FIELD, "go to field to left"
},
{
CTRL('M'), REQ_NEW_LINE, "insert/overlay new line"
},
{
CTRL('N'), REQ_NEXT_FIELD, "go to next field"
},
{
CTRL('O'), REQ_INS_LINE, "insert blank line at cursor"
},
{
CTRL('P'), REQ_PREV_FIELD, "go to previous field"
},
{
CTRL('Q'), MY_QUIT, "exit form"
},
{
CTRL('R'), REQ_RIGHT_FIELD, "go to field to right"
},
{
CTRL('S'), REQ_BEG_FIELD, "go to beginning of field"
},
{
CTRL('T'), MY_EDT_MODE, "toggle O_EDIT mode, clear field status",
},
{
CTRL('U'), REQ_UP_FIELD, "move upward to field"
},
{
CTRL('V'), REQ_DEL_CHAR, "delete character"
},
{
CTRL('W'), REQ_NEXT_WORD, "go to next word"
},
{
CTRL('X'), REQ_CLR_FIELD, "clear field"
},
{
CTRL('Y'), REQ_DEL_LINE, "delete line"
},
{
CTRL('Z'), REQ_PREV_CHOICE, ""
},
{
CTRL('['), MY_QUIT, "exit form"
},
{
CTRL(']'), MY_INS_MODE, "toggle REQ_INS_MODE/REQ_OVL_MODE",
},
{
KEY_F(1), MY_HELP, "show this screen",
},
{
KEY_BACKSPACE, REQ_DEL_PREV, "delete previous character"
},
{
KEY_DOWN, REQ_DOWN_CHAR, "move down 1 character"
},
{
KEY_END, REQ_LAST_FIELD, "go to last field"
},
{
KEY_HOME, REQ_FIRST_FIELD, "go to first field"
},
{
KEY_LEFT, REQ_LEFT_CHAR, "move left 1 character"
},
{
KEY_LL, REQ_LAST_FIELD, "go to last field"
},
{
KEY_NEXT, REQ_NEXT_FIELD, "go to next field"
},
{
KEY_NPAGE, REQ_NEXT_PAGE, "go to next page"
},
{
KEY_PPAGE, REQ_PREV_PAGE, "go to previous page"
},
{
KEY_PREVIOUS, REQ_PREV_FIELD, "go to previous field"
},
{
KEY_RIGHT, REQ_RIGHT_CHAR, "move right 1 character"
},
{
KEY_UP, REQ_UP_CHAR, "move up 1 character"
}
};
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);
unsigned n;
int ch = ERR;
begin_popup();
keypad(help, TRUE);
keypad(data, TRUE);
waddstr(data, "Defined form edit/traversal keys:\n");
for (n = 0; n < SIZEOF(commands); ++n) {
const char *name;
#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);
}
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();
}
static int
offset_in_field(FORM * form)
{
FIELD *field = current_field(form);
int currow, curcol;
form_getyx(form, currow, curcol);
return curcol + currow * field->dcols;
}
static void
inactive_field(FIELD * f)
{
set_field_back(f, field_attrs(f)->background);
}
FieldAttrs *
field_attrs(FIELD * f)
{
return (FieldAttrs *) field_userptr(f);
}
static int
buffer_length(FIELD * f)
{
return field_attrs(f)->row_lengths[0];
}
static void
set_buffer_length(FIELD * f, int length)
{
field_attrs(f)->row_lengths[0] = length;
}
/*
* The userptr is used in edit_field.c's inactive_field(), as well as for
* keeping track of the actual lengths of lines in a multiline field.
*/
void
init_edit_field(FIELD * f, char *value)
{
FieldAttrs *ptr = field_attrs(f);
if (ptr == 0) {
int rows, cols, frow, fcol, nrow, nbuf;
ptr = typeCalloc(FieldAttrs, (size_t) 1);
ptr->background = field_back(f);
if (field_info(f, &rows, &cols, &frow, &fcol, &nrow, &nbuf) == E_OK) {
ptr->row_count = nrow;
ptr->row_lengths = typeCalloc(int, (size_t) nrow + 1);
}
}
set_field_userptr(f, (void *) ptr);
set_field_buffer(f, 0, value); /* will be formatted */
set_field_buffer(f, 1, value); /* will be unformatted */
set_buffer_length(f, (int) strlen(value));
}
int
edit_field(FORM * form, int *result)
{
int ch = wgetch(form_win(form));
int status;
FIELD *before;
unsigned n;
int length;
int before_row;
int before_col;
int before_off = offset_in_field(form);
form_getyx(form, before_row, before_col);
before = current_field(form);
set_field_back(before, A_NORMAL);
if (ch <= KEY_MAX) {
set_field_back(before, A_REVERSE);
} else if (ch <= MAX_FORM_COMMAND) {
inactive_field(before);
}
*result = ch;
for (n = 0; n < SIZEOF(commands); ++n) {
if (commands[n].code == ch) {
*result = commands[n].result;
break;
}
}
status = form_driver(form, *result);
if (status == E_OK) {
bool modified = TRUE;
length = buffer_length(before);
if (length < before_off)
length = before_off;
switch (*result) {
case REQ_CLR_EOF:
length = before_off;
break;
case REQ_CLR_EOL:
if (before_row + 1 == before->rows)
length = before_off;
break;
case REQ_CLR_FIELD:
length = 0;
break;
case REQ_DEL_CHAR:
if (length > before_off)
--length;
break;
case REQ_DEL_PREV:
if (length > 0) {
if (before_col > 0) {
--length;
} else if (before_row > 0) {
length -= before->cols + before_col;
}
}
break;
case REQ_NEW_LINE:
length += before->cols;
break;
#if 0
/* FIXME: finish these */
case REQ_DEL_LINE: /* delete line */
case REQ_DEL_WORD: /* delete word at cursor */
case REQ_INS_CHAR: /* insert blank char at cursor */
case REQ_INS_LINE: /* insert blank line at cursor */
case REQ_INS_MODE: /* begin insert mode */
case REQ_OVL_MODE: /* begin overlay mode */
#endif
/* ignore all of the motion commands */
case REQ_SCR_BCHAR: /* FALLTHRU */
case REQ_SCR_BHPAGE: /* FALLTHRU */
case REQ_SCR_BLINE: /* FALLTHRU */
case REQ_SCR_BPAGE: /* FALLTHRU */
case REQ_SCR_FCHAR: /* FALLTHRU */
case REQ_SCR_FHPAGE: /* FALLTHRU */
case REQ_SCR_FLINE: /* FALLTHRU */
case REQ_SCR_FPAGE: /* FALLTHRU */
case REQ_SCR_HBHALF: /* FALLTHRU */
case REQ_SCR_HBLINE: /* FALLTHRU */
case REQ_SCR_HFHALF: /* FALLTHRU */
case REQ_SCR_HFLINE: /* FALLTHRU */
case REQ_BEG_FIELD: /* FALLTHRU */
case REQ_BEG_LINE: /* FALLTHRU */
case REQ_DOWN_CHAR: /* FALLTHRU */
case REQ_DOWN_FIELD: /* FALLTHRU */
case REQ_END_FIELD: /* FALLTHRU */
case REQ_END_LINE: /* FALLTHRU */
case REQ_FIRST_FIELD: /* FALLTHRU */
case REQ_FIRST_PAGE: /* FALLTHRU */
case REQ_LAST_FIELD: /* FALLTHRU */
case REQ_LAST_PAGE: /* FALLTHRU */
case REQ_LEFT_CHAR: /* FALLTHRU */
case REQ_LEFT_FIELD: /* FALLTHRU */
case REQ_NEXT_CHAR: /* FALLTHRU */
case REQ_NEXT_CHOICE: /* FALLTHRU */
case REQ_NEXT_FIELD: /* FALLTHRU */
case REQ_NEXT_LINE: /* FALLTHRU */
case REQ_NEXT_PAGE: /* FALLTHRU */
case REQ_NEXT_WORD: /* FALLTHRU */
case REQ_PREV_CHAR: /* FALLTHRU */
case REQ_PREV_CHOICE: /* FALLTHRU */
case REQ_PREV_FIELD: /* FALLTHRU */
case REQ_PREV_LINE: /* FALLTHRU */
case REQ_PREV_PAGE: /* FALLTHRU */
case REQ_PREV_WORD: /* FALLTHRU */
case REQ_RIGHT_CHAR: /* FALLTHRU */
case REQ_RIGHT_FIELD: /* FALLTHRU */
case REQ_SFIRST_FIELD: /* FALLTHRU */
case REQ_SLAST_FIELD: /* FALLTHRU */
case REQ_SNEXT_FIELD: /* FALLTHRU */
case REQ_SPREV_FIELD: /* FALLTHRU */
case REQ_UP_CHAR: /* FALLTHRU */
case REQ_UP_FIELD: /* FALLTHRU */
case REQ_VALIDATION: /* FALLTHRU */
modified = FALSE;
break;
default:
modified = FALSE;
if (ch >= MIN_FORM_COMMAND) {
beep();
} else if (isprint(ch)) {
modified = TRUE;
}
break;
}
/*
* If we do not force a re-validation, then field_buffer 0 will
* be lagging by one character.
*/
if (modified && form_driver(form, REQ_VALIDATION) == E_OK && *result
< MIN_FORM_COMMAND)
++length;
set_buffer_length(before, length);
}
if (current_field(form) != before)
inactive_field(before);
return status;
}
#else
extern void no_edit_field(void);
void
no_edit_field(void)
{
}
#endif
ncurses-5.9-20140118/test/testaddch.c 0000644 0001751 0000144 00000006722 12074403661 015566 0 ustar tom users /****************************************************************************
* Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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. *
****************************************************************************/
/*
* 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 $
*/
#include
static void
attr_addstr(const char *s, chtype a)
{
while (*s)
addch(((unsigned char) (*s++)) | a);
}
int
main(
int argc GCC_UNUSED,
char *argv[]GCC_UNUSED)
{
unsigned i;
chtype back, set, attr;
setlocale(LC_ALL, "");
initscr();
start_color();
init_pair(1, COLOR_WHITE, COLOR_BLUE);
init_pair(2, COLOR_WHITE, COLOR_RED);
init_pair(3, COLOR_BLACK, COLOR_MAGENTA);
init_pair(4, COLOR_BLACK, COLOR_GREEN);
init_pair(5, COLOR_BLACK, COLOR_CYAN);
init_pair(6, COLOR_BLACK, COLOR_YELLOW);
init_pair(7, COLOR_BLACK, COLOR_WHITE);
for (i = 0; i < 8; i++) {
back = (i & 1) ? A_BOLD | 'B' : ' ';
set = (i & 2) ? A_REVERSE : 0;
attr = (chtype) ((i & 4) ? COLOR_PAIR(4) : 0);
bkgdset(back);
(void) attrset(set);
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);
bkgdset(back);
(void) attrset(set);
attr_addstr("Test string with spaces -> <-\n", attr);
}
getch();
endwin();
ExitProgram(EXIT_SUCCESS);
}
ncurses-5.9-20140118/test/bs.c 0000644 0001751 0000144 00000073714 12241747104 014233 0 ustar tom users /****************************************************************************
* Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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. *
****************************************************************************/
/*
* bs.c - original author: Bruce Holloway
* salvo option by: Chuck A DeGaul
* with improved user interface, autoconfiguration and code cleanup
* by Eric S. Raymond
* v1.2 with color support and minor portability fixes, November 1990
* 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 $
*/
#include
#include
#ifndef SIGIOT
#define SIGIOT SIGABRT
#endif
static int getcoord(int);
/*
* Constants for tuning the random-fire algorithm. It prefers moves that
* diagonal-stripe the board with a stripe separation of srchstep. If
* no such preferred moves are found, srchstep is decremented.
*/
#define BEGINSTEP 3 /* initial value of srchstep */
/* miscellaneous constants */
#define SHIPTYPES 5
#define OTHER (1-turn)
#define PLAYER 0
#define COMPUTER 1
#define MARK_HIT 'H'
#define MARK_MISS 'o'
#define CTRLC '\003' /* used as terminate command */
#define FF '\014' /* used as redraw command */
/* coordinate handling */
#define BWIDTH 10
#define BDEPTH 10
/* display symbols */
#define SHOWHIT '*'
#define SHOWSPLASH ' '
#define IS_SHIP(c) (isupper(UChar(c)) ? TRUE : FALSE)
/* how to position us on player board */
#define PYBASE 3
#define PXBASE 3
#define PY(y) (PYBASE + (y))
#define PX(x) (PXBASE + (x)*3)
#define pgoto(y, x) (void)move(PY(y), PX(x))
/* how to position us on cpu board */
#define CYBASE 3
#define CXBASE 48
#define CY(y) (CYBASE + (y))
#define CX(x) (CXBASE + (x)*3)
#define CYINV(y) ((y) - CYBASE)
#define CXINV(x) (((x) - CXBASE) / 3)
#define cgoto(y, x) (void)move(CY(y), CX(x))
#define ONBOARD(x, y) (x >= 0 && x < BWIDTH && y >= 0 && y < BDEPTH)
/* other board locations */
#define COLWIDTH 80
#define PROMPTLINE 21 /* prompt line */
#define SYBASE CYBASE + BDEPTH + 3 /* move key diagram */
#define SXBASE 63
#define MYBASE SYBASE - 1 /* diagram caption */
#define MXBASE 64
#define HYBASE SYBASE - 1 /* help area */
#define HXBASE 0
/* this will need to be changed if BWIDTH changes */
static char numbers[] = " 0 1 2 3 4 5 6 7 8 9";
static char carrier[] = "Aircraft Carrier";
static char battle[] = "Battleship";
static char sub[] = "Submarine";
static char destroy[] = "Destroyer";
static char ptboat[] = "PT Boat";
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] =
{1, 1, 0, -1, -1, -1, 0, 1};
static int yincr[8] =
{0, 1, 1, 1, 0, -1, -1, -1};
/* current ship position and direction */
static int curx = (BWIDTH / 2);
static int cury = (BDEPTH / 2);
typedef struct {
char *name; /* name of the ship type */
int hits; /* how many times has this ship been hit? */
char symbol; /* symbol for game purposes */
int length; /* length of ship */
int x, y; /* coordinates of ship start point */
int dir; /* direction of `bow' */
bool placed; /* has it been placed on the board? */
} ship_t;
static bool checkplace(int b, ship_t * ss, int vis);
#define SHIPIT(name, symbol, length) { name, 0, symbol, length, 0,0, 0, FALSE }
static ship_t plyship[SHIPTYPES] =
{
SHIPIT(carrier, 'A', 5),
SHIPIT(battle, 'B', 4),
SHIPIT(destroy, 'D', 3),
SHIPIT(sub, 'S', 3),
SHIPIT(ptboat, 'P', 2),
};
static ship_t cpuship[SHIPTYPES] =
{
SHIPIT(carrier, 'A', 5),
SHIPIT(battle, 'B', 4),
SHIPIT(destroy, 'D', 3),
SHIPIT(sub, 'S', 3),
SHIPIT(ptboat, 'P', 2),
};
/* "Hits" board, and main board. */
static char hits[2][BWIDTH][BDEPTH];
static char board[2][BWIDTH][BDEPTH];
static int turn; /* 0=player, 1=computer */
static int plywon = 0, cpuwon = 0; /* How many games has each won? */
static int salvo, blitz, closepack;
#define PR (void)addstr
static void uninitgame(int sig) GCC_NORETURN;
static void
uninitgame(int sig GCC_UNUSED)
/* end the game, either normally or due to signal */
{
clear();
(void) refresh();
(void) reset_shell_mode();
(void) echo();
(void) endwin();
ExitProgram(sig ? EXIT_FAILURE : EXIT_SUCCESS);
}
static void
announceopts(void)
/* announce which game options are enabled */
{
if (salvo || blitz || closepack) {
(void) printw("Playing optional game (");
if (salvo)
(void) printw("salvo, ");
else
(void) printw("nosalvo, ");
if (blitz)
(void) printw("blitz ");
else
(void) printw("noblitz, ");
if (closepack)
(void) printw("closepack)");
else
(void) printw("noclosepack)");
} else
(void) printw(
"Playing standard game (noblitz, nosalvo, noclosepack)");
}
static void
intro(void)
{
char *tmpname;
srand((unsigned) (time(0L) + getpid())); /* Kick the random number generator */
CATCHALL(uninitgame);
if ((tmpname = getlogin()) != 0 &&
(your_name = strdup(tmpname)) != 0) {
your_name[0] = (char) toupper(UChar(your_name[0]));
} else {
your_name = dftname;
}
(void) initscr();
keypad(stdscr, TRUE);
(void) def_prog_mode();
(void) nonl();
(void) cbreak();
(void) noecho();
#ifdef PENGUIN
(void) clear();
MvAddStr(4, 29, "Welcome to Battleship!");
(void) move(8, 0);
PR(" \\\n");
PR(" \\ \\ \\\n");
PR(" \\ \\ \\ \\ \\_____________\n");
PR(" \\ \\ \\_____________ \\ \\/ |\n");
PR(" \\ \\/ \\ \\/ |\n");
PR(" \\/ \\_____/ |__\n");
PR(" ________________/ |\n");
PR(" \\ S.S. Penguin |\n");
PR(" \\ /\n");
PR(" \\___________________________________________________/\n");
MvAddStr(22, 27, "Hit any key to continue...");
(void) refresh();
(void) getch();
#endif /* PENGUIN */
#ifdef A_COLOR
start_color();
init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK);
init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK);
init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK);
init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK);
init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK);
init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK);
init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK);
#endif /* A_COLOR */
#ifdef NCURSES_MOUSE_VERSION
(void) mousemask(BUTTON1_CLICKED, (mmask_t *) NULL);
#endif /* NCURSES_MOUSE_VERSION */
}
/* VARARGS1 */
static void
prompt(int n, NCURSES_CONST char *f, const char *s)
/* print a message at the prompt line */
{
(void) move(PROMPTLINE + n, 0);
(void) clrtoeol();
(void) printw(f, s);
(void) refresh();
}
static void
error(NCURSES_CONST char *s)
{
(void) move(PROMPTLINE + 2, 0);
(void) clrtoeol();
if (s) {
(void) addstr(s);
(void) beep();
}
}
static void
placeship(int b, ship_t * ss, int vis)
{
int l;
for (l = 0; l < ss->length; ++l) {
int newx = ss->x + l * xincr[ss->dir];
int newy = ss->y + l * yincr[ss->dir];
board[b][newx][newy] = ss->symbol;
if (vis) {
pgoto(newy, newx);
(void) addch((chtype) ss->symbol);
}
}
ss->hits = 0;
}
static int
rnd(int n)
{
return (((rand() & 0x7FFF) % n));
}
static void
randomplace(int b, ship_t * ss)
/* generate a valid random ship placement into px,py */
{
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));
} while
(!checkplace(b, ss, FALSE));
}
static void
initgame(void)
{
int i, j, unplaced;
ship_t *ss;
(void) clear();
MvAddStr(0, 35, "BATTLESHIPS");
(void) move(PROMPTLINE + 2, 0);
announceopts();
memset(board, 0, sizeof(char) * BWIDTH * BDEPTH * 2);
memset(hits, 0, sizeof(char) * BWIDTH * BDEPTH * 2);
for (i = 0; i < SHIPTYPES; i++) {
ss = cpuship + i;
ss->x =
ss->y =
ss->dir =
ss->hits = 0;
ss->placed = FALSE;
ss = plyship + i;
ss->x =
ss->y =
ss->dir =
ss->hits = 0;
ss->placed = FALSE;
}
/* draw empty boards */
MvAddStr(PYBASE - 2, PXBASE + 5, "Main Board");
MvAddStr(PYBASE - 1, PXBASE - 3, numbers);
for (i = 0; i < BDEPTH; ++i) {
MvAddCh(PYBASE + i, PXBASE - 3, (chtype) (i + 'A'));
#ifdef A_COLOR
if (has_colors())
attron((attr_t) COLOR_PAIR(COLOR_BLUE));
#endif /* A_COLOR */
(void) 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'));
}
MvAddStr(PYBASE + BDEPTH, PXBASE - 3, numbers);
MvAddStr(CYBASE - 2, CXBASE + 7, "Hit/Miss Board");
MvAddStr(CYBASE - 1, CXBASE - 3, numbers);
for (i = 0; i < BDEPTH; ++i) {
MvAddCh(CYBASE + i, CXBASE - 3, (chtype) (i + 'A'));
#ifdef A_COLOR
if (has_colors())
attron((attr_t) COLOR_PAIR(COLOR_BLUE));
#endif /* A_COLOR */
(void) 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'));
}
MvAddStr(CYBASE + BDEPTH, CXBASE - 3, numbers);
MvPrintw(HYBASE, HXBASE,
"To position your ships: move the cursor to a spot, then");
MvPrintw(HYBASE + 1, HXBASE,
"type the first letter of a ship type to select it, then");
MvPrintw(HYBASE + 2, HXBASE,
"type a direction ([hjkl] or [4862]), indicating how the");
MvPrintw(HYBASE + 3, HXBASE,
"ship should be pointed. You may also type a ship letter");
MvPrintw(HYBASE + 4, HXBASE,
"followed by `r' to position it randomly, or type `R' to");
MvPrintw(HYBASE + 5, HXBASE,
"place all remaining ships randomly.");
MvAddStr(MYBASE, MXBASE, "Aiming keys:");
MvAddStr(SYBASE, SXBASE, "y k u 7 8 9");
MvAddStr(SYBASE + 1, SXBASE, " \\|/ \\|/ ");
MvAddStr(SYBASE + 2, SXBASE, "h-+-l 4-+-6");
MvAddStr(SYBASE + 3, SXBASE, " /|\\ /|\\ ");
MvAddStr(SYBASE + 4, SXBASE, "b j n 1 2 3");
/* have the computer place ships */
for (ss = cpuship; ss < cpuship + SHIPTYPES; ss++) {
randomplace(COMPUTER, ss);
placeship(COMPUTER, ss, FALSE);
}
do {
char c, docked[SHIPTYPES + 2], *cp = docked;
ss = (ship_t *) NULL;
/* figure which ships still wait to be placed */
*cp++ = 'R';
for (i = 0; i < SHIPTYPES; i++)
if (!plyship[i].placed)
*cp++ = plyship[i].symbol;
*cp = '\0';
/* get a command letter */
prompt(1, "Type one of [%s] to pick a ship.", docked + 1);
do {
c = (char) getcoord(PLAYER);
} while
(!(strchr) (docked, c));
if (c == 'R')
(void) ungetch('R');
else {
/* map that into the corresponding symbol */
for (ss = plyship; ss < plyship + SHIPTYPES; ss++)
if (ss->symbol == c)
break;
prompt(1, "Type one of [hjklrR] to place your %s.", ss->name);
pgoto(cury, curx);
}
do {
c = (char) getch();
} while
(!(strchr("hjkl8462rR", c) || c == FF));
if (c == FF) {
(void) clearok(stdscr, TRUE);
(void) refresh();
} else if (ss == 0) {
beep(); /* simple to verify, unlikely to happen */
} else if (c == 'r') {
prompt(1, "Random-placing your %s", ss->name);
randomplace(PLAYER, ss);
placeship(PLAYER, ss, TRUE);
error((char *) NULL);
ss->placed = TRUE;
} else if (c == 'R') {
prompt(1, "Placing the rest of your fleet at random...", "");
for (ss = plyship; ss < plyship + SHIPTYPES; ss++)
if (!ss->placed) {
randomplace(PLAYER, ss);
placeship(PLAYER, ss, TRUE);
ss->placed = TRUE;
}
error((char *) NULL);
} else if (strchr("hjkl8462", c)) {
ss->x = curx;
ss->y = cury;
switch (c) {
case 'k':
case '8':
ss->dir = N;
break;
case 'j':
case '2':
ss->dir = S;
break;
case 'h':
case '4':
ss->dir = W;
break;
case 'l':
case '6':
ss->dir = E;
break;
}
if (checkplace(PLAYER, ss, TRUE)) {
placeship(PLAYER, ss, TRUE);
error((char *) NULL);
ss->placed = TRUE;
}
}
for (unplaced = i = 0; i < SHIPTYPES; i++)
unplaced += !plyship[i].placed;
} while
(unplaced);
turn = rnd(2);
MvPrintw(HYBASE, HXBASE,
"To fire, move the cursor to your chosen aiming point ");
MvPrintw(HYBASE + 1, HXBASE,
"and strike any key other than a motion key. ");
MvPrintw(HYBASE + 2, HXBASE,
" ");
MvPrintw(HYBASE + 3, HXBASE,
" ");
MvPrintw(HYBASE + 4, HXBASE,
" ");
MvPrintw(HYBASE + 5, HXBASE,
" ");
(void) prompt(0, "Press any key to start...", "");
(void) getch();
}
static int
getcoord(int atcpu)
{
int ny, nx, c;
if (atcpu)
cgoto(cury, curx);
else
pgoto(cury, curx);
(void) refresh();
for (;;) {
if (atcpu) {
MvPrintw(CYBASE + BDEPTH + 1, CXBASE + 11, "(%d, %c)",
curx, 'A' + cury);
cgoto(cury, curx);
} else {
MvPrintw(PYBASE + BDEPTH + 1, PXBASE + 11, "(%d, %c)",
curx, 'A' + cury);
pgoto(cury, curx);
}
switch (c = getch()) {
case 'k':
case '8':
case KEY_UP:
ny = cury + BDEPTH - 1;
nx = curx;
break;
case 'j':
case '2':
case KEY_DOWN:
ny = cury + 1;
nx = curx;
break;
case 'h':
case '4':
case KEY_LEFT:
ny = cury;
nx = curx + BWIDTH - 1;
break;
case 'l':
case '6':
case KEY_RIGHT:
ny = cury;
nx = curx + 1;
break;
case 'y':
case '7':
case KEY_A1:
ny = cury + BDEPTH - 1;
nx = curx + BWIDTH - 1;
break;
case 'b':
case '1':
case KEY_C1:
ny = cury + 1;
nx = curx + BWIDTH - 1;
break;
case 'u':
case '9':
case KEY_A3:
ny = cury + BDEPTH - 1;
nx = curx + 1;
break;
case 'n':
case '3':
case KEY_C3:
ny = cury + 1;
nx = curx + 1;
break;
case FF:
nx = curx;
ny = cury;
(void) clearok(stdscr, TRUE);
(void) refresh();
break;
#ifdef NCURSES_MOUSE_VERSION
case KEY_MOUSE:
{
MEVENT myevent;
getmouse(&myevent);
if (atcpu
&& myevent.y >= CY(0) && myevent.y <= CY(BDEPTH)
&& myevent.x >= CX(0) && myevent.x <= CX(BDEPTH)) {
curx = CXINV(myevent.x);
cury = CYINV(myevent.y);
return (' ');
} else {
beep();
continue;
}
}
/* no fall through */
#endif /* NCURSES_MOUSE_VERSION */
default:
if (atcpu)
MvAddStr(CYBASE + BDEPTH + 1, CXBASE + 11, " ");
else
MvAddStr(PYBASE + BDEPTH + 1, PXBASE + 11, " ");
return (c);
}
curx = nx % BWIDTH;
cury = ny % BDEPTH;
}
}
static bool
collidecheck(int b, int y, int x)
/* is this location on the selected zboard adjacent to a ship? */
{
bool collide;
/* anything on the square */
if ((collide = IS_SHIP(board[b][x][y])) != FALSE)
return (collide);
/* anything on the neighbors */
if (!closepack) {
int i;
for (i = 0; i < 8; i++) {
int xend, yend;
yend = y + yincr[i];
xend = x + xincr[i];
if (ONBOARD(xend, yend)
&& IS_SHIP(board[b][xend][yend])) {
collide = TRUE;
break;
}
}
}
return (collide);
}
static bool
checkplace(int b, ship_t * ss, int vis)
{
int l, xend, yend;
/* first, check for board edges */
xend = ss->x + (ss->length - 1) * xincr[ss->dir];
yend = ss->y + (ss->length - 1) * yincr[ss->dir];
if (!ONBOARD(xend, yend)) {
if (vis)
switch (rnd(3)) {
case 0:
error("Ship is hanging from the edge of the world");
break;
case 1:
error("Try fitting it on the board");
break;
case 2:
error("Figure I won't find it if you put it there?");
break;
}
return (FALSE);
}
for (l = 0; l < ss->length; ++l) {
if (collidecheck(b, ss->y + l * yincr[ss->dir], ss->x + l * xincr[ss->dir])) {
if (vis)
switch (rnd(3)) {
case 0:
error("There's already a ship there");
break;
case 1:
error("Collision alert! Aaaaaagh!");
break;
case 2:
error("Er, Admiral, what about the other ship?");
break;
}
return (FALSE);
}
}
return (TRUE);
}
static int
awinna(void)
{
int i, j;
ship_t *ss;
for (i = 0; i < 2; ++i) {
ss = (i) ? cpuship : plyship;
for (j = 0; j < SHIPTYPES; ++j, ++ss)
if (ss->length > ss->hits)
break;
if (j == SHIPTYPES)
return (OTHER);
}
return (-1);
}
static ship_t *
hitship(int x, int y)
/* register a hit on the targeted ship */
{
ship_t *sb, *ss;
char sym;
int oldx, oldy;
getyx(stdscr, oldy, oldx);
sb = (turn) ? plyship : cpuship;
if ((sym = board[OTHER][x][y]) == 0)
return ((ship_t *) NULL);
for (ss = sb; ss < sb + SHIPTYPES; ++ss)
if (ss->symbol == sym) {
if (++ss->hits < ss->length) /* still afloat? */
return ((ship_t *) NULL);
else { /* sunk! */
int i, 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];
for (i = -1; i <= ss->length; ++i) {
int x1, y1;
x1 = bx + i * xincr[ss->dir];
y1 = by + i * yincr[ss->dir];
if (ONBOARD(x1, y1)) {
hits[turn][x1][y1] = MARK_MISS;
if (turn % 2 == PLAYER) {
cgoto(y1, x1);
#ifdef A_COLOR
if (has_colors())
attron((attr_t) COLOR_PAIR(COLOR_GREEN));
#endif /* A_COLOR */
(void) addch(MARK_MISS);
#ifdef A_COLOR
(void) attrset(0);
#endif /* A_COLOR */
} else {
pgoto(y1, x1);
(void) addch(SHOWSPLASH);
}
}
}
}
for (i = 0; i < ss->length; ++i) {
int x1 = ss->x + i * xincr[ss->dir];
int y1 = ss->y + i * yincr[ss->dir];
hits[turn][x1][y1] = ss->symbol;
if (turn % 2 == PLAYER) {
cgoto(y1, x1);
(void) addch((chtype) (ss->symbol));
} else {
pgoto(y1, x1);
#ifdef A_COLOR
if (has_colors())
attron((attr_t) COLOR_PAIR(COLOR_RED));
#endif /* A_COLOR */
(void) addch(SHOWHIT);
#ifdef A_COLOR
(void) attrset(0);
#endif /* A_COLOR */
}
}
(void) move(oldy, oldx);
return (ss);
}
}
(void) move(oldy, oldx);
return ((ship_t *) NULL);
}
static bool
plyturn(void)
{
ship_t *ss;
bool hit;
NCURSES_CONST char *m = NULL;
prompt(1, "Where do you want to shoot? ", "");
for (;;) {
(void) getcoord(COMPUTER);
if (hits[PLAYER][curx][cury]) {
prompt(1, "You shelled this spot already! Try again.", "");
beep();
} else
break;
}
hit = IS_SHIP(board[COMPUTER][curx][cury]);
hits[PLAYER][curx][cury] = (char) (hit ? MARK_HIT : MARK_MISS);
cgoto(cury, curx);
#ifdef A_COLOR
if (has_colors()) {
if (hit)
attron((attr_t) COLOR_PAIR(COLOR_RED));
else
attron((attr_t) COLOR_PAIR(COLOR_GREEN));
}
#endif /* A_COLOR */
(void) addch((chtype) hits[PLAYER][curx][cury]);
#ifdef A_COLOR
(void) attrset(0);
#endif /* A_COLOR */
prompt(1, "You %s.", hit ? "scored a hit" : "missed");
if (hit && (ss = hitship(curx, cury))) {
switch (rnd(5)) {
case 0:
m = " You sank my %s!";
break;
case 1:
m = " I have this sinking feeling about my %s....";
break;
case 2:
m = " My %s has gone to Davy Jones's locker!";
break;
case 3:
m = " Glub, glub -- my %s is headed for the bottom!";
break;
case 4:
m = " You'll pick up survivors from my %s, I hope...!";
break;
}
if (m != 0) {
(void) printw(m, ss->name);
}
(void) beep();
}
return (hit);
}
static int
sgetc(const char *s)
{
const char *s1;
int ch;
(void) refresh();
for (;;) {
ch = getch();
if (islower(ch))
ch = toupper(ch);
if (ch == CTRLC)
uninitgame(0);
for (s1 = s; *s1 && ch != *s1; ++s1)
continue;
if (*s1) {
(void) addch((chtype) ch);
(void) refresh();
return (ch);
}
}
}
static void
randomfire(int *px, int *py)
/* random-fire routine -- implements simple diagonal-striping strategy */
{
static int turncount = 0;
static int srchstep = BEGINSTEP;
static int huntoffs; /* Offset on search strategy */
int ypossible[BWIDTH * BDEPTH], xpossible[BWIDTH * BDEPTH], nposs;
int ypreferred[BWIDTH * BDEPTH], xpreferred[BWIDTH * BDEPTH], npref;
int x, y, i;
if (turncount++ == 0)
huntoffs = rnd(srchstep);
/* first, list all possible moves */
nposs = npref = 0;
for (x = 0; x < BWIDTH; x++)
for (y = 0; y < BDEPTH; y++)
if (!hits[COMPUTER][x][y]) {
xpossible[nposs] = x;
ypossible[nposs] = y;
nposs++;
if (((x + huntoffs) % srchstep) != (y % srchstep)) {
xpreferred[npref] = x;
ypreferred[npref] = y;
npref++;
}
}
if (npref) {
i = rnd(npref);
*px = xpreferred[i];
*py = ypreferred[i];
} else if (nposs) {
i = rnd(nposs);
*px = xpossible[i];
*py = ypossible[i];
if (srchstep > 1)
--srchstep;
} else {
error("No moves possible?? Help!");
ExitProgram(EXIT_FAILURE);
/*NOTREACHED */
}
}
#define S_MISS 0
#define S_HIT 1
#define S_SUNK -1
static int
cpufire(int x, int y)
/* fire away at given location */
{
bool hit, sunk;
ship_t *ss = NULL;
hit = (bool) board[PLAYER][x][y];
hits[COMPUTER][x][y] = (hit ? MARK_HIT : MARK_MISS);
MvPrintw(PROMPTLINE, 0,
"I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" :
"miss");
if ((sunk = (hit && (ss = hitship(x, y)))) != 0)
(void) printw(" I've sunk your %s", ss->name);
(void) clrtoeol();
pgoto(y, x);
#ifdef A_COLOR
if (has_colors()) {
if (hit)
attron((attr_t) COLOR_PAIR(COLOR_RED));
else
attron((attr_t) COLOR_PAIR(COLOR_GREEN));
}
#endif /* A_COLOR */
(void) addch((chtype) (hit ? SHOWHIT : SHOWSPLASH));
#ifdef A_COLOR
(void) attrset(0);
#endif /* A_COLOR */
return hit ? (sunk ? S_SUNK : S_HIT) : S_MISS;
}
/*
* This code implements a fairly irregular FSM, so please forgive the rampant
* unstructuredness below. The five labels are states which need to be held
* between computer turns.
*
* The FSM is not externally reset to RANDOM_FIRE if the player wins. Instead,
* the other states check for "impossible" conditions which signify a new
* game, then if found transition to RANDOM_FIRE.
*/
static bool
cputurn(void)
{
#define POSSIBLE(x, y) (ONBOARD(x, y) && !hits[COMPUTER][x][y])
#define RANDOM_FIRE 0
#define RANDOM_HIT 1
#define HUNT_DIRECT 2
#define FIRST_PASS 3
#define REVERSE_JUMP 4
#define SECOND_PASS 5
static int next = RANDOM_FIRE;
static bool used[4];
static ship_t ts;
int navail, x, y, d, n;
int hit = S_MISS;
switch (next) {
case RANDOM_FIRE: /* last shot was random and missed */
refire:
randomfire(&x, &y);
if (!(hit = cpufire(x, y)))
next = RANDOM_FIRE;
else {
ts.x = x;
ts.y = y;
ts.hits = 1;
next = (hit == S_SUNK) ? RANDOM_FIRE : RANDOM_HIT;
}
break;
case RANDOM_HIT: /* last shot was random and hit */
used[E / 2] = used[S / 2] = used[W / 2] = used[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++) {
x = ts.x + xincr[d * 2];
y = ts.y + yincr[d * 2];
if (!used[d] && POSSIBLE(x, y))
navail++;
else
used[d] = TRUE;
}
if (navail == 0) /* no valid places for shots adjacent... */
goto refire; /* ...so we must random-fire */
else {
n = rnd(navail) + 1;
for (d = 0; used[d]; d++) ;
/* used[d] is first that == 0 */
for (; n > 1; n--)
while (used[++d]) ;
/* used[d] is next that == 0 */
assert(d < 4);
assert(used[d] == FALSE);
used[d] = TRUE;
x = ts.x + xincr[d * 2];
y = ts.y + yincr[d * 2];
assert(POSSIBLE(x, y));
if (!(hit = cpufire(x, y)))
next = HUNT_DIRECT;
else {
ts.x = x;
ts.y = y;
ts.dir = d * 2;
ts.hits++;
next = (hit == S_SUNK) ? RANDOM_FIRE : FIRST_PASS;
}
}
break;
case FIRST_PASS: /* we have a start and a direction now */
x = ts.x + xincr[ts.dir];
y = ts.y + yincr[ts.dir];
if (POSSIBLE(x, y) && (hit = cpufire(x, y))) {
ts.x = x;
ts.y = y;
ts.hits++;
next = (hit == S_SUNK) ? RANDOM_FIRE : FIRST_PASS;
} else
next = REVERSE_JUMP;
break;
case REVERSE_JUMP: /* nail down the ship's other end */
d = (ts.dir + 4) % 8;
x = ts.x + ts.hits * xincr[d];
y = ts.y + ts.hits * yincr[d];
if (POSSIBLE(x, y) && (hit = cpufire(x, y))) {
ts.x = x;
ts.y = y;
ts.dir = d;
ts.hits++;
next = (hit == S_SUNK) ? RANDOM_FIRE : SECOND_PASS;
} else
next = RANDOM_FIRE;
break;
case SECOND_PASS: /* continue shooting after reversing */
x = ts.x + xincr[ts.dir];
y = ts.y + yincr[ts.dir];
if (POSSIBLE(x, y) && (hit = cpufire(x, y))) {
ts.x = x;
ts.y = y;
ts.hits++;
next = (hit == S_SUNK) ? RANDOM_FIRE : SECOND_PASS;
break;
} else
next = RANDOM_FIRE;
break;
}
/* pause between shots in salvo */
if (salvo) {
(void) refresh();
(void) sleep(1);
}
#ifdef DEBUG
MvPrintw(PROMPTLINE + 2, 0,
"New state %d, x=%d, y=%d, d=%d",
next, x, y, d);
#endif /* DEBUG */
return ((hit) ? TRUE : FALSE);
}
static int
playagain(void)
{
int j;
ship_t *ss;
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);
}
if (awinna())
++cpuwon;
else
++plywon;
j = 18 + (int) strlen(your_name);
if (plywon >= 10)
++j;
if (cpuwon >= 10)
++j;
MvPrintw(1, (COLWIDTH - j) / 2,
"%s: %d Computer: %d", your_name, plywon, cpuwon);
prompt(2, (awinna())? "Want to be humiliated again, %s [yn]? "
: "Going to give me a chance for revenge, %s [yn]? ", your_name);
return (sgetc("YN") == 'Y');
}
static void
do_options(int c, char *op[])
{
register int i;
if (c > 1) {
for (i = 1; i < c; i++) {
switch (op[i][0]) {
default:
case '?':
(void) fprintf(stderr, "Usage: battle [-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");
(void) fprintf(stderr, "\t-c : ships may be adjacent\n");
ExitProgram(EXIT_FAILURE);
break;
case '-':
switch (op[i][1]) {
case 'b':
blitz = 1;
if (salvo == 1) {
(void) fprintf(stderr,
"Bad Arg: -b and -s are mutually exclusive\n");
ExitProgram(EXIT_FAILURE);
}
break;
case 's':
salvo = 1;
if (blitz == 1) {
(void) fprintf(stderr,
"Bad Arg: -s and -b are mutually exclusive\n");
ExitProgram(EXIT_FAILURE);
}
break;
case 'c':
closepack = 1;
break;
default:
(void) fprintf(stderr,
"Bad arg: type \"%s ?\" for usage message\n",
op[0]);
ExitProgram(EXIT_FAILURE);
}
}
}
}
}
static int
scount(int who)
{
register int i, shots;
register ship_t *sp;
if (who)
sp = cpuship; /* count cpu shots */
else
sp = plyship; /* count player shots */
for (i = 0, shots = 0; i < SHIPTYPES; i++, sp++) {
if (sp->hits >= sp->length)
continue; /* dead ship */
else
shots++;
}
return (shots);
}
int
main(int argc, char *argv[])
{
setlocale(LC_ALL, "");
do_options(argc, argv);
intro();
do {
initgame();
while (awinna() == -1) {
if (!blitz) {
if (!salvo) {
if (turn)
(void) cputurn();
else
(void) plyturn();
} else {
register int i;
i = scount(turn);
while (i--) {
if (turn) {
if (cputurn() && awinna() != -1)
i = 0;
} else {
if (plyturn() && awinna() != -1)
i = 0;
}
}
}
} else
while ((turn ? cputurn() : plyturn()) && awinna() == -1)
continue;
turn = OTHER;
}
} while
(playagain());
uninitgame(0);
/*NOTREACHED */
}
/* bs.c ends here */
ncurses-5.9-20140118/test/background.c 0000644 0001751 0000144 00000015530 11764731151 015742 0 ustar tom users /****************************************************************************
* Copyright (c) 2003-2011,2012 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: background.c,v 1.13 2012/06/09 20:30:33 tom Exp $
*/
#define NEED_COLOR_CODE 1
#define NEED_COLOR_NAME 1
#include
static int default_bg = COLOR_BLACK;
static int default_fg = COLOR_WHITE;
static void
test_background(void)
{
short f, b;
int row;
int chr;
if (pair_content(0, &f, &b) == ERR) {
printw("pair 0 contains no data\n");
} else {
printw("pair 0 contains (%d,%d)\n", f, b);
}
getch();
printw("Initializing pair 1 to red/%s\n", color_name(default_bg));
init_pair(1, COLOR_RED, (short) default_bg);
bkgdset((chtype) (' ' | COLOR_PAIR(1)));
printw("RED/BLACK\n");
getch();
printw("Initializing pair 2 to %s/blue\n", color_name(default_fg));
init_pair(2, (short) default_fg, COLOR_BLUE);
bkgdset((chtype) (' ' | COLOR_PAIR(2)));
printw("This line should be %s/blue\n", color_name(default_fg));
getch();
printw("Initializing pair 3 to %s/cyan (ACS_HLINE)\n", color_name(default_fg));
init_pair(3, (short) default_fg, COLOR_CYAN);
printw("...and drawing a box which should be followed by lines\n");
bkgdset(ACS_HLINE | 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
* of the background is replaced by the nonblank characters written.
*
* Characters not in the line-drawing range are usually sent as-is.
*
* With SVr4 curses it is possible to rely on this to mix uppercase text
* with the (lowercase) line-drawing characters. ncurses uses some of
* the uppercase characters for encoding thick- and double-lines.
*/
row = 7;
mvprintw(row++, 10, "l");
for (chr = 0; chr < 32; ++chr)
addch(' ');
printw("x\n");
chr = 32;
while (chr < 128) {
if ((chr % 32) == 0)
mvprintw(row++, 10, "x");
addch((chtype) ((chr == 127) ? ' ' : chr));
if ((++chr % 32) == 0)
printw("x\n");
}
mvprintw(row++, 10, "m");
for (chr = 0; chr < 32; ++chr)
addch(' ');
printw("j\n");
getch();
bkgdset((chtype) (' ' | COLOR_PAIR(0)));
printw("Default Colors\n");
getch();
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();
printw("Setting screen to pair 0\n");
bkgd((chtype) (' ' | COLOR_PAIR(0)));
getch();
printw("Setting screen to pair 1\n");
bkgd((chtype) (' ' | COLOR_PAIR(1)));
getch();
printw("Setting screen to pair 2\n");
bkgd((chtype) (' ' | COLOR_PAIR(2)));
getch();
printw("Setting screen to pair 3\n");
bkgd((chtype) (' ' | COLOR_PAIR(3)));
getch();
printw("Setting screen to pair 0\n");
bkgd((chtype) (' ' | COLOR_PAIR(0)));
getch();
}
static void
usage(void)
{
static const char *msg[] =
{
"Usage: background [options]"
,""
,"Options:"
#if HAVE_ASSUME_DEFAULT_COLORS
," -a invoke assume_default_colors, repeat to use in init_pair"
#endif
," -b XXX specify background color"
#if HAVE_USE_DEFAULT_COLORS
," -d invoke use_default_colors, repeat to use in init_pair"
#endif
," -f XXX specify foreground color"
};
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)
{
#if HAVE_ASSUME_DEFAULT_COLORS
int a_option = 0;
#endif
#if HAVE_USE_DEFAULT_COLORS
int d_option = 0;
#endif
int n;
setlocale(LC_ALL, "");
while ((n = getopt(argc, argv, "ab:df:")) != -1) {
switch (n) {
#if HAVE_ASSUME_DEFAULT_COLORS
case 'a':
++a_option;
break;
#endif
case 'b':
default_bg = color_code(optarg);
break;
#if HAVE_USE_DEFAULT_COLORS
case 'd':
++d_option;
break;
#endif
case 'f':
default_fg = color_code(optarg);
break;
default:
usage();
}
}
#if HAVE_USE_DEFAULT_COLORS && HAVE_ASSUME_DEFAULT_COLORS
if (a_option && d_option) {
fprintf(stderr, "Use either -a or -d option, but not both\n");
ExitProgram(EXIT_FAILURE);
}
#endif
initscr();
cbreak();
noecho();
if (has_colors()) {
start_color();
#if HAVE_USE_DEFAULT_COLORS
if (d_option) {
printw("Using default colors...\n");
use_default_colors();
if (d_option > 1) {
default_fg = -1;
default_bg = -1;
}
}
#endif
#if HAVE_ASSUME_DEFAULT_COLORS
if (a_option) {
printw("Using assumed colors %s/%s...\n",
color_name(default_fg),
color_name(default_bg));
assume_default_colors(default_fg, default_bg);
if (a_option > 1) {
default_fg = -1;
default_bg = -1;
}
}
#endif
test_background();
} else {
printw("This demo requires a color terminal");
getch();
}
endwin();
ExitProgram(EXIT_SUCCESS);
}
ncurses-5.9-20140118/test/savescreen.sh 0000755 0001751 0000144 00000005241 11264137635 016154 0 ustar tom users #!/bin/sh
##############################################################################
# Copyright (c) 2007,2009 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: savescreen.sh,v 1.4 2009/10/10 17:08:45 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.
PARAMS=
NFILES=4
PREFIX=savescreen-$$
n=0
BEGINS=$PREFIX-$n.tmp
while test $n != $NFILES
do
LATEST=$PREFIX-$n.tmp
PARAMS="$PARAMS $LATEST"
n=`expr $n + 1`
done
./savescreen $PARAMS
if test -f $BEGINS
then
while test -f $BEGINS
do
./savescreen -r $PARAMS
test $? != 0 && break
done
else
echo "No screens were saved"
fi
ncurses-5.9-20140118/test/configure 0000755 0001751 0000144 00001607422 12244172111 015363 0 ustar tom users #! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by Autoconf 2.52.20121002.
#
# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# Sed expression to map a string onto a valid variable name.
as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
# Name of the executable.
as_me=`echo "$0" |sed 's,.*[\\/],,'`
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
# We could just check for DJGPP; but this test a) works b) is more generic
# and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
if test -f conf$$.exe; then
# Don't use ln at all; we don't have any links
as_ln_s='cp -p'
else
as_ln_s='ln -s'
fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.file
as_executable_p="test -f"
# Support unset when possible.
if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# NLS nuisances.
$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; }
$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; }
$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; }
$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; }
$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; }
$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; }
$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; }
$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; }
# IFS
# We need space, tab and new line, in precisely that order.
as_nl='
'
IFS=" $as_nl"
# CDPATH.
$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; }
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
exec 6>&1
#
# Initializations.
#
ac_default_prefix=/usr/local
cross_compiling=no
subdirs=
MFLAGS= MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
# This variable seems obsolete. It should probably be removed, and
# only ac_max_sed_lines should be used.
: ${ac_max_here_lines=38}
ac_unique_file="ncurses.c"
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datarootdir='${prefix}/share'
datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${datarootdir}/info'
mandir='${datarootdir}/man'
# Identity of this package.
PACKAGE_NAME=
PACKAGE_TARNAME=
PACKAGE_VERSION=
PACKAGE_STRING=
PACKAGE_BUGREPORT=
ac_prev=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
datadir=$ac_optarg ;;
-datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
| --dataroo | --dataro | --datar)
ac_prev=datarootdir ;;
-datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
| --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
datarootdir=$ac_optarg ;;
-disable-* | --disable-*)
ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
eval "enable_$ac_feature=no" ;;
-enable-* | --enable-*)
ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
case $ac_option in
*=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
| --locals | --local | --loca | --loc | --lo)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
case $ac_option in
*=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package | sed 's/-/_/g'`
eval "with_$ac_package=no" ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) { echo "$as_me: error: unrecognized option: $ac_option
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; }
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid variable name: $ac_envvar" >&2
{ (exit 1); exit 1; }; }
ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
eval "$ac_envvar='$ac_optarg'"
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
echo "$as_me: WARNING: invalid host type: $ac_option" >&2
: ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
{ echo "$as_me: error: missing argument to $ac_option" >&2
{ (exit 1); exit 1; }; }
fi
# Be sure to have absolute paths.
for ac_var in exec_prefix prefix
do
eval ac_val=$`echo $ac_var`
case $ac_val in
[\\/$]* | ?:[\\/]* | NONE | '' ) ;;
*) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; };;
esac
done
# Be sure to have absolute paths.
for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \
localstatedir libdir includedir oldincludedir infodir mandir
do
eval ac_val=$`echo $ac_var`
case $ac_val in
[\\/$]* | ?:[\\/]* ) ;;
*) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; };;
esac
done
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: should be removed in autoconf 3.0.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used." >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then its parent.
ac_prog=$0
ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'`
test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r $srcdir/$ac_unique_file; then
if test "$ac_srcdir_defaulted" = yes; then
{ echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2
{ (exit 1); exit 1; }; }
else
{ echo "$as_me: error: cannot find sources in $srcdir" >&2
{ (exit 1); exit 1; }; }
fi
fi
srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
ac_env_build_alias_set=${build_alias+set}
ac_env_build_alias_value=$build_alias
ac_cv_env_build_alias_set=${build_alias+set}
ac_cv_env_build_alias_value=$build_alias
ac_env_host_alias_set=${host_alias+set}
ac_env_host_alias_value=$host_alias
ac_cv_env_host_alias_set=${host_alias+set}
ac_cv_env_host_alias_value=$host_alias
ac_env_target_alias_set=${target_alias+set}
ac_env_target_alias_value=$target_alias
ac_cv_env_target_alias_set=${target_alias+set}
ac_cv_env_target_alias_value=$target_alias
ac_env_CC_set=${CC+set}
ac_env_CC_value=$CC
ac_cv_env_CC_set=${CC+set}
ac_cv_env_CC_value=$CC
ac_env_CFLAGS_set=${CFLAGS+set}
ac_env_CFLAGS_value=$CFLAGS
ac_cv_env_CFLAGS_set=${CFLAGS+set}
ac_cv_env_CFLAGS_value=$CFLAGS
ac_env_LDFLAGS_set=${LDFLAGS+set}
ac_env_LDFLAGS_value=$LDFLAGS
ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
ac_cv_env_LDFLAGS_value=$LDFLAGS
ac_env_CPPFLAGS_set=${CPPFLAGS+set}
ac_env_CPPFLAGS_value=$CPPFLAGS
ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
ac_cv_env_CPPFLAGS_value=$CPPFLAGS
ac_env_CPP_set=${CPP+set}
ac_env_CPP_value=$CPP
ac_cv_env_CPP_set=${CPP+set}
ac_cv_env_CPP_value=$CPP
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat < if you have libraries in a
nonstandard directory
CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have
headers in a nonstandard directory
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
EOF
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
ac_popdir=`pwd`
for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue
cd $ac_subdir
# A "../" for each directory in /$ac_subdir.
ac_dots=`echo $ac_subdir |
sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'`
case $srcdir in
.) # No --srcdir option. We are building in place.
ac_sub_srcdir=$srcdir ;;
[\\/]* | ?:[\\/]* ) # Absolute path.
ac_sub_srcdir=$srcdir/$ac_subdir ;;
*) # Relative path.
ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;;
esac
# Check for guested configure; otherwise get Cygnus style configure.
if test -f $ac_sub_srcdir/configure.gnu; then
echo
$SHELL $ac_sub_srcdir/configure.gnu --help=recursive
elif test -f $ac_sub_srcdir/configure; then
echo
$SHELL $ac_sub_srcdir/configure --help=recursive
elif test -f $ac_sub_srcdir/configure.ac ||
test -f $ac_sub_srcdir/configure.in; then
echo
$ac_configure --help
else
echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2
fi
cd $ac_popdir
done
fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\EOF
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
EOF
exit 0
fi
exec 5>config.log
cat >&5 </dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
PATH = $PATH
_ASUNAME
} >&5
cat >&5 <\?\"\']*)
ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
ac_sep=" " ;;
*) ac_configure_args="$ac_configure_args$ac_sep$ac_arg"
ac_sep=" " ;;
esac
# Get rid of the leading space.
done
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
echo >&5
echo "## ----------------- ##" >&5
echo "## Cache variables. ##" >&5
echo "## ----------------- ##" >&5
echo >&5
# The following way of writing the cache mishandles newlines in values,
{
(set) 2>&1 |
case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
*ac_space=\ *)
sed -n \
"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
;;
*)
sed -n \
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
} >&5
sed "/^$/d" confdefs.h >conftest.log
if test -s conftest.log; then
echo >&5
echo "## ------------ ##" >&5
echo "## confdefs.h. ##" >&5
echo "## ------------ ##" >&5
echo >&5
cat conftest.log >&5
fi
(echo; echo) >&5
test "$ac_signal" != 0 &&
echo "$as_me: caught signal $ac_signal" >&5
echo "$as_me: exit $exit_status" >&5
rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -rf conftest* confdefs.h
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
echo >confdefs.h
# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
else
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
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: loading site script $ac_site_file" >&6;}
cat "$ac_site_file" >&5
. "$ac_site_file"
fi
done
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: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . $cache_file;;
*) . ./$cache_file;;
esac
fi
else
{ echo "$as_me:892: creating cache $cache_file" >&5
echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in `(set) 2>&1 |
sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val="\$ac_cv_env_${ac_var}_value"
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: 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: 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: error: \`$ac_var' has changed since the previous run:" >&2;}
{ echo "$as_me:920: 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: current value: $ac_new_val" >&2;}
ac_cache_corrupted=:
fi;;
esac
# Pass precious variables to config.status. It doesn't matter if
# we pass some twice (in addition to the command line arguments).
if test "$ac_new_set" = set; then
case $ac_new_val in
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"`
ac_configure_args="$ac_configure_args '$ac_arg'"
;;
*) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val"
;;
esac
fi
done
if $ac_cache_corrupted; then
{ echo "$as_me:941: 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: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
{ (exit 1); exit 1; }; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
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=' ' ;;
*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
(PATH=".;."; conftest.sh) 2>&5
ac_status=$?
echo "$as_me:967: \$? = $ac_status" >&5
(exit $ac_status); }; then
ac_path_separator=';'
else
ac_path_separator=:
fi
PATH_SEPARATOR="$ac_path_separator"
rm -f conftest.sh
ac_config_headers="$ac_config_headers ncurses_cfg.h:ncurses_tst.hin"
test -f config.guess || ( test -f ../config.guess && cp ../config.guess ./ )
test -f config.sub || ( test -f ../config.sub && cp ../config.sub ./ )
ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
if test -f $ac_dir/install-sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f $ac_dir/install.sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f $ac_dir/shtool; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
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: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
{ (exit 1); exit 1; }; }
fi
ac_config_guess="$SHELL $ac_aux_dir/config.guess"
ac_config_sub="$SHELL $ac_aux_dir/config.sub"
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: error: cannot run $ac_config_sub" >&2;}
{ (exit 1); exit 1; }; }
echo "$as_me:1013: 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
else
ac_cv_build_alias=$build_alias
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: 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: 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 "${ECHO_T}$ac_cv_build" >&6
build=$ac_cv_build
build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
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 $ECHO_N "checking host system type... $ECHO_C" >&6
if test "${ac_cv_host+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_host_alias=$host_alias
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: 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 "${ECHO_T}$ac_cv_host" >&6
host=$ac_cv_host
host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
system_name="$host_os"
else
system_name="`(uname -s -r) 2>/dev/null`"
if test -z "$system_name" ; then
system_name="`(hostname) 2>/dev/null`"
fi
fi
test -n "$system_name" &&
cat >>confdefs.h <&6
else
cf_cv_system_name="$system_name"
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
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 "${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: error: \"Please remove config.cache and try again.\"" >&2;}
{ (exit 1); exit 1; }; }
fi
test "$program_prefix" != NONE &&
program_transform_name="s,^,$program_prefix,;$program_transform_name"
# Use a double $ so make ignores it.
test "$program_suffix" != NONE &&
program_transform_name="s,\$,$program_suffix,;$program_transform_name"
# Double any \ or $. echo might interpret backslashes.
# By default was `s,x,x', remove it if useless.
cat <<\_ACEOF >conftest.sed
s/[\\$]/&&/g;s/;s,x,x,$//
_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 $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
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.make <<\EOF
all:
@echo 'ac_maketemp="${MAKE}"'
EOF
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
if test -n "$ac_maketemp"; then
eval ac_cv_prog_make_${ac_make}_set=yes
else
eval ac_cv_prog_make_${ac_make}_set=no
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 "${ECHO_T}yes" >&6
SET_MAKE=
else
echo "$as_me:1127: result: no" >&5
echo "${ECHO_T}no" >&6
SET_MAKE="MAKE=${MAKE-make}"
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
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 $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
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # 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_CC="${ac_tool_prefix}gcc"
echo "$as_me:1156: found $ac_dir/$ac_word" >&5
break
done
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:1164: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:1167: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
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 $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
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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_CC="gcc"
echo "$as_me:1191: found $ac_dir/$ac_word" >&5
break
done
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 "${ECHO_T}$ac_ct_CC" >&6
else
echo "$as_me:1202: result: no" >&5
echo "${ECHO_T}no" >&6
fi
CC=$ac_ct_CC
else
CC="$ac_cv_prog_CC"
fi
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 $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
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # 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_CC="${ac_tool_prefix}cc"
echo "$as_me:1230: found $ac_dir/$ac_word" >&5
break
done
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:1238: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:1241: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
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 $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
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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_CC="cc"
echo "$as_me:1265: found $ac_dir/$ac_word" >&5
break
done
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 "${ECHO_T}$ac_ct_CC" >&6
else
echo "$as_me:1276: result: no" >&5
echo "${ECHO_T}no" >&6
fi
CC=$ac_ct_CC
else
CC="$ac_cv_prog_CC"
fi
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 $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
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=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
if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
echo "$as_me:1309: found $ac_dir/$ac_word" >&5
break
done
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
set dummy "$ac_dir/$ac_word" ${1+"$@"}
shift
ac_cv_prog_CC="$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:1331: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:1334: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl
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 $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
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # 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_CC="$ac_tool_prefix$ac_prog"
echo "$as_me:1360: found $ac_dir/$ac_word" >&5
break
done
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:1368: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:1371: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl
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 $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
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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_CC="$ac_prog"
echo "$as_me:1399: found $ac_dir/$ac_word" >&5
break
done
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 "${ECHO_T}$ac_ct_CC" >&6
else
echo "$as_me:1410: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$ac_ct_CC" && break
done
CC=$ac_ct_CC
fi
fi
test -z "$CC" && { { echo "$as_me:1422: 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:" \
"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 $ac_compiler --version &5) 2>&5
ac_status=$?
echo "$as_me:1433: \$? = $ac_status" >&5
(exit $ac_status); }
{ (eval echo "$as_me:1435: \"$ac_compiler -v &5\"") >&5
(eval $ac_compiler -v &5) 2>&5
ac_status=$?
echo "$as_me:1438: \$? = $ac_status" >&5
(exit $ac_status); }
{ (eval echo "$as_me:1440: \"$ac_compiler -V &5\"") >&5
(eval $ac_compiler -V &5) 2>&5
ac_status=$?
echo "$as_me:1443: \$? = $ac_status" >&5
(exit $ac_status); }
cat >conftest.$ac_ext <<_ACEOF
#line 1447 "configure"
#include "confdefs.h"
int
main ()
{
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
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 $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
(eval $ac_link_default) 2>&5
ac_status=$?
echo "$as_me:1469: \$? = $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
# resort.
for ac_file in `ls a.exe conftest.exe 2>/dev/null;
ls a.out conftest 2>/dev/null;
ls a.* conftest.* 2>/dev/null`; do
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
a.out ) # We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
# FIXME: I believe we export ac_cv_exeext for Libtool --akim.
export ac_cv_exeext
break;;
* ) break;;
esac
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: 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 "${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 $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 $ac_try) 2>&5
ac_status=$?
echo "$as_me:1512: \$? = $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.
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;}
{ (exit 1); exit 1; }; }
fi
fi
fi
echo "$as_me:1527: 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 $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
echo "$as_me:1536: result: $cross_compiling" >&5
echo "${ECHO_T}$cross_compiling" >&6
echo "$as_me:1539: checking for executable suffix" >&5
echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6
if { (eval echo "$as_me:1541: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:1544: \$? = $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
# work properly (i.e., refer to `conftest.exe'), while it won't with
# `rm'.
for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
export ac_cv_exeext
break;;
* ) break;;
esac
done
else
{ { echo "$as_me:1560: 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 "${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 $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"
#include "confdefs.h"
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.o conftest.obj
if { (eval echo "$as_me:1590: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:1593: \$? = $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
*.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.map | *.inf ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
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: 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 "${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 $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"
#include "confdefs.h"
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:1637: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:1640: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:1643: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:1646: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_compiler_gnu=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
ac_compiler_gnu=no
fi
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 "${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 $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"
#include "confdefs.h"
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:1682: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:1685: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:1688: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:1691: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
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 "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
# Some people use a C++ compiler to compile C. Since we use `exit',
# in C++ we need to declare it. In case someone uses the same compiler
# for both compiling C and C++ we need to have the C++ compiler decide
# the declaration of exit, since it's the most demanding environment.
cat >conftest.$ac_ext <<_ACEOF
#ifndef __cplusplus
choke me
#endif
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:1728: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:1731: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:1734: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:1737: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
for ac_declaration in \
''\
'#include ' \
'extern "C" void std::exit (int) throw (); using std::exit;' \
'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
'extern "C" void exit (int);' \
'void exit (int);'
do
cat >conftest.$ac_ext <<_ACEOF
#line 1749 "configure"
#include "confdefs.h"
#include
$ac_declaration
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:1762: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:1765: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:1768: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:1771: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
continue
fi
rm -f conftest.$ac_objext conftest.$ac_ext
cat >conftest.$ac_ext <<_ACEOF
#line 1781 "configure"
#include "confdefs.h"
$ac_declaration
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:1793: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:1796: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:1799: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:1802: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
break
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
done
rm -rf conftest*
if test -n "$ac_declaration"; then
echo '#ifdef __cplusplus' >>confdefs.h
echo $ac_declaration >>confdefs.h
echo '#endif' >>confdefs.h
fi
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_main_return=return
GCC_VERSION=none
if test "$GCC" = yes ; then
echo "$as_me:1832: 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 "${ECHO_T}$GCC_VERSION" >&6
fi
echo "$as_me:1840: 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
else
ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
cat >conftest.$ac_ext <<_ACEOF
#line 1848 "configure"
#include "confdefs.h"
#include
#include
#include
#include
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_ACEOF
# Don't try gcc -ansi; that turns off useful extensions and
# breaks some systems' header files.
# AIX -qlanglvl=ansi
# Ultrix and OSF/1 -std1
# HP-UX 10.20 and later -Ae
# HP-UX older versions -Aa -D_HPUX_SOURCE
# SVR4 -Xc -D__EXTENSIONS__
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
rm -f conftest.$ac_objext
if { (eval echo "$as_me:1897: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:1900: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:1903: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:1906: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cc_stdc=$ac_arg
break
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext
done
rm -f conftest.$ac_ext conftest.$ac_objext
CC=$ac_save_CC
fi
case "x$ac_cv_prog_cc_stdc" in
x|xno)
echo "$as_me:1923: result: none needed" >&5
echo "${ECHO_T}none needed" >&6 ;;
*)
echo "$as_me:1926: result: $ac_cv_prog_cc_stdc" >&5
echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
CC="$CC $ac_cv_prog_cc_stdc" ;;
esac
# This should have been defined by AC_PROG_CC
: ${CC:=cc}
echo "$as_me:1934: 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
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;}
# humor him...
cf_flags=`echo "$CC" | sed -e 's/^[^ ]*[ ]//'`
CC=`echo "$CC" | sed -e 's/[ ].*//'`
cf_fix_cppflags=no
cf_new_cflags=
cf_new_cppflags=
cf_new_extra_cppflags=
for cf_add_cflags in $cf_flags
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[^=]*='\''\"[^"]*//'`
test "${cf_add_cflags}" != "${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"
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/=.*//'`
CPPFLAGS=`echo "$CPPFLAGS" | \
sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \
-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'`
;;
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_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
test "${cf_add_cflags}" != "${cf_tst_cflags}" \
&& test -z "${cf_tst_cflags}" \
&& cf_fix_cppflags=no
;;
esac
done
if test -n "$cf_new_cflags" ; then
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
EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
fi
;;
*)
echo "$as_me:2026: result: ok" >&5
echo "${ECHO_T}ok" >&6
;;
esac
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_main_return=return
echo "$as_me:2037: 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
CPP=
fi
if test -z "$CPP"; then
if test "${ac_cv_prog_CPP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
do
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# 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"
#include "confdefs.h"
#include
Syntax error
_ACEOF
if { (eval echo "$as_me:2063: \"$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
(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
:
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
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"
#include "confdefs.h"
#include
_ACEOF
if { (eval echo "$as_me:2096: \"$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
(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
# Broken: success on invalid input.
continue
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
break
fi
done
ac_cv_prog_CPP=$CPP
fi
CPP=$ac_cv_prog_CPP
else
ac_cv_prog_CPP=$CPP
fi
echo "$as_me:2139: result: $CPP" >&5
echo "${ECHO_T}$CPP" >&6
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# 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"
#include "confdefs.h"
#include
Syntax error
_ACEOF
if { (eval echo "$as_me:2154: \"$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
(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
:
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
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"
#include "confdefs.h"
#include
_ACEOF
if { (eval echo "$as_me:2187: \"$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
(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
# Broken: success on invalid input.
continue
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
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: error: C preprocessor \"$CPP\" fails sanity check" >&2;}
{ (exit 1); exit 1; }; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_main_return=return
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 $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
else
if test -n "$AWK"; then
ac_cv_prog_AWK="$AWK" # 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_AWK="$ac_prog"
echo "$as_me:2252: found $ac_dir/$ac_word" >&5
break
done
fi
fi
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
echo "$as_me:2260: result: $AWK" >&5
echo "${ECHO_T}$AWK" >&6
else
echo "$as_me:2263: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$AWK" && break
done
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AmigaOS /C/install, which installs bootblocks on floppy discs
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# 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 $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
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_save_IFS=$IFS; IFS=$ac_path_separator
for ac_dir in $PATH; do
IFS=$ac_save_IFS
# Account for people who put trailing slashes in PATH elements.
case $ac_dir/ in
/ | ./ | .// | /cC/* \
| /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \
| /usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
# Don't use installbsd from OSF since it installs stuff as root
# by default.
for ac_prog in ginstall scoinst install; do
if $as_executable_p "$ac_dir/$ac_prog"; then
if test $ac_prog = install &&
grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
elif test $ac_prog = install &&
grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then
# program-specific install script used by HP pwplus--don't use.
:
else
ac_cv_path_install="$ac_dir/$ac_prog -c"
break 2
fi
fi
done
;;
esac
done
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
# As a last resort, use the slow shell script. We don't cache a
# path for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the path is relative.
INSTALL=$ac_install_sh
fi
fi
echo "$as_me:2331: result: $INSTALL" >&5
echo "${ECHO_T}$INSTALL" >&6
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
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%^.*/%%'`
;;
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.
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
fi
fi
LINT=$ac_cv_prog_LINT
if test -n "$LINT"; then
echo "$as_me:2379: result: $LINT" >&5
echo "${ECHO_T}$LINT" >&6
else
echo "$as_me:2382: 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
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
cf_cv_mixedcase=no
;;
*)
cf_cv_mixedcase=yes
;;
esac
else
rm -f conftest CONFTEST
echo test >conftest
if test -f CONFTEST ; then
cf_cv_mixedcase=no
else
cf_cv_mixedcase=yes
fi
rm -f conftest CONFTEST
fi
fi
echo "$as_me:2416: result: $cf_cv_mixedcase" >&5
echo "${ECHO_T}$cf_cv_mixedcase" >&6
test "$cf_cv_mixedcase" = yes &&
cat >>confdefs.h <<\EOF
#define MIXEDCASE_FILENAMES 1
EOF
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 $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
else
if test -n "$CTAGS"; then
ac_cv_prog_CTAGS="$CTAGS" # 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_CTAGS="$ac_prog"
echo "$as_me:2442: found $ac_dir/$ac_word" >&5
break
done
fi
fi
CTAGS=$ac_cv_prog_CTAGS
if test -n "$CTAGS"; then
echo "$as_me:2450: result: $CTAGS" >&5
echo "${ECHO_T}$CTAGS" >&6
else
echo "$as_me:2453: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$CTAGS" && break
done
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 $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
else
if test -n "$ETAGS"; then
ac_cv_prog_ETAGS="$ETAGS" # 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_ETAGS="$ac_prog"
echo "$as_me:2479: found $ac_dir/$ac_word" >&5
break
done
fi
fi
ETAGS=$ac_cv_prog_ETAGS
if test -n "$ETAGS"; then
echo "$as_me:2487: result: $ETAGS" >&5
echo "${ECHO_T}$ETAGS" >&6
else
echo "$as_me:2490: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$ETAGS" && break
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 $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
else
if test -n "$MAKE_LOWER_TAGS"; then
ac_cv_prog_MAKE_LOWER_TAGS="$MAKE_LOWER_TAGS" # 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_MAKE_LOWER_TAGS="yes"
echo "$as_me:2514: found $ac_dir/$ac_word" >&5
break
done
test -z "$ac_cv_prog_MAKE_LOWER_TAGS" && ac_cv_prog_MAKE_LOWER_TAGS="no"
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 "${ECHO_T}$MAKE_LOWER_TAGS" >&6
else
echo "$as_me:2526: 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 $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
else
if test -n "$MAKE_UPPER_TAGS"; then
ac_cv_prog_MAKE_UPPER_TAGS="$MAKE_UPPER_TAGS" # 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_MAKE_UPPER_TAGS="yes"
echo "$as_me:2548: found $ac_dir/$ac_word" >&5
break
done
test -z "$ac_cv_prog_MAKE_UPPER_TAGS" && ac_cv_prog_MAKE_UPPER_TAGS="no"
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 "${ECHO_T}$MAKE_UPPER_TAGS" >&6
else
echo "$as_me:2560: result: no" >&5
echo "${ECHO_T}no" >&6
fi
else
MAKE_UPPER_TAGS=no
fi
if test "$MAKE_UPPER_TAGS" = yes ; then
MAKE_UPPER_TAGS=
else
MAKE_UPPER_TAGS="#"
fi
if test "$MAKE_LOWER_TAGS" = yes ; then
MAKE_LOWER_TAGS=
else
MAKE_LOWER_TAGS="#"
fi
echo "$as_me:2580: 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"
#include "confdefs.h"
#include
#include
int
main ()
{
double x = rand(); printf("result = %g\n", pow(sin(x),x))
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:2602: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:2605: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:2608: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:2611: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_need_libm=no
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
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 "${ECHO_T}$cf_cv_need_libm" >&6
if test "$cf_cv_need_libm" = yes
then
MATH_LIB=-lm
fi
top_builddir=`pwd`
CC_G_OPT="-g"
CC_SHARED_OPTS=unknown
CPPFLAGS="$CPPFLAGS"
DFT_DEP_SUFFIX=""
DFT_OBJ_SUBDIR=`pwd|sed -e's:.*/::'`
DFT_UPR_MODEL="NORMAL"
LD="ld"
LDFLAGS_SHARED=""
LDFLAGS_STATIC=""
LD_MODEL=""
LD_SHARED_OPTS=""
LIBTOOL=""
LIB_CLEAN=""
LIB_COMPILE=""
LIB_LINK='${CC}'
LINK_TESTS=""
LOCAL_LDFLAGS=""
PTHREAD="-lm"
TEST_ARGS=""
TEST_DEPS=""
TEST_LIBS=""
TINFO_LDFLAGS=''
TINFO_LIBS='$(LIBS_CURSES)'
cf_cv_abi_version=""
cf_cv_rel_version=""
includesubdir=""
cf_cv_screen=curses
cf_cv_libtype=
if test "$GCC" = yes
then
cat > conftest.i <&5
echo "$as_me: checking for $CC __attribute__ directives..." >&6;}
cat > conftest.$ac_ext <&5
case $cf_attribute in #(vi
printf) #(vi
cf_printf_attribute=yes
cat >conftest.h <conftest.h <conftest.h <&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:2733: \$? = $ac_status" >&5
(exit $ac_status); }; then
test -n "$verbose" && echo "$as_me:2735: result: ... $cf_attribute" >&5
echo "${ECHO_T}... $cf_attribute" >&6
cat conftest.h >>confdefs.h
case $cf_attribute in #(vi
noreturn) #(vi
cat >>confdefs.h <>confdefs.h <<\EOF
#define GCC_PRINTF 1
EOF
fi
cat >>confdefs.h <>confdefs.h <<\EOF
#define GCC_SCANF 1
EOF
fi
cat >>confdefs.h <>confdefs.h <>confdefs.h
fi
rm -rf conftest*
fi
cf_XOPEN_SOURCE=500
cf_POSIX_C_SOURCE=199506L
cf_xopen_source=
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
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
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line 2839 "configure"
#include "confdefs.h"
#include
int
main ()
{
#ifndef _XOPEN_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:2854: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:2857: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:2860: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:2863: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_gnu_source=no
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"
#include "confdefs.h"
#include
int
main ()
{
#ifdef _XOPEN_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:2887: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:2890: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:2893: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:2896: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_gnu_source=no
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
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: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=
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: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
echo $ECHO_N "(cached) $ECHO_C" >&6
else
echo "${as_me:-configure}:2939: testing if the symbol is already defined go no further ..." 1>&5
cat >conftest.$ac_ext <<_ACEOF
#line 2942 "configure"
#include "confdefs.h"
#include
int
main ()
{
#ifndef _POSIX_C_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:2957: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:2960: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:2963: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:2966: \$? = $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 #(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"
#include "confdefs.h"
#include
int
main ()
{
#ifdef _POSIX_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:3002: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:3005: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:3008: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:3011: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
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"
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
CFLAGS="$cf_trim_CFLAGS"
CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
echo "${as_me:-configure}:3027: testing if the second compile does not leave our definition intact error ..." 1>&5
cat >conftest.$ac_ext <<_ACEOF
#line 3030 "configure"
#include "confdefs.h"
#include
int
main ()
{
#ifndef _POSIX_C_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:3045: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:3048: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:3051: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:3054: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
cf_cv_posix_c_source=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
CFLAGS="$cf_save_CFLAGS"
CPPFLAGS="$cf_save_CPPFLAGS"
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:3070: 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
CFLAGS="$cf_trim_CFLAGS"
CPPFLAGS="$cf_trim_CPPFLAGS"
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 #(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[^=]*='\''\"[^"]*//'`
test "${cf_add_cflags}" != "${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"
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/=.*//'`
CPPFLAGS=`echo "$CPPFLAGS" | \
sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \
-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'`
;;
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_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
test "${cf_add_cflags}" != "${cf_tst_cflags}" \
&& test -z "${cf_tst_cflags}" \
&& cf_fix_cppflags=no
;;
esac
done
if test -n "$cf_new_cflags" ; then
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
EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
fi
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__"
;;
*)
echo "$as_me:3183: 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 3190 "configure"
#include "confdefs.h"
#include
#include
#include
int
main ()
{
#ifndef _XOPEN_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:3209: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:3212: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:3215: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:3218: \$? = $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 3227 "configure"
#include "confdefs.h"
#include
#include
#include
int
main ()
{
#ifdef _XOPEN_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:3246: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:3249: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:3252: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:3255: \$? = $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:3270: 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_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
case $cf_add_cflags in
-D*)
cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
test "${cf_add_cflags}" != "${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"
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/=.*//'`
CPPFLAGS=`echo "$CPPFLAGS" | \
sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \
-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'`
;;
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_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
test "${cf_add_cflags}" != "${cf_tst_cflags}" \
&& test -z "${cf_tst_cflags}" \
&& cf_fix_cppflags=no
;;
esac
done
if test -n "$cf_new_cflags" ; then
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
EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
fi
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:3378: 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}:3384: testing if the symbol is already defined go no further ..." 1>&5
cat >conftest.$ac_ext <<_ACEOF
#line 3387 "configure"
#include "confdefs.h"
#include
int
main ()
{
#ifndef _POSIX_C_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:3402: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:3405: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:3408: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:3411: \$? = $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 #(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 3432 "configure"
#include "confdefs.h"
#include
int
main ()
{
#ifdef _POSIX_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:3447: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:3450: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:3453: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:3456: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
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"
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "${as_me:-configure}:3467: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5
CFLAGS="$cf_trim_CFLAGS"
CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
echo "${as_me:-configure}:3472: testing if the second compile does not leave our definition intact error ..." 1>&5
cat >conftest.$ac_ext <<_ACEOF
#line 3475 "configure"
#include "confdefs.h"
#include
int
main ()
{
#ifndef _POSIX_C_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:3490: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:3493: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:3496: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:3499: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
cf_cv_posix_c_source=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
CFLAGS="$cf_save_CFLAGS"
CPPFLAGS="$cf_save_CPPFLAGS"
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:3515: 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
CFLAGS="$cf_trim_CFLAGS"
CPPFLAGS="$cf_trim_CPPFLAGS"
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 #(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[^=]*='\''\"[^"]*//'`
test "${cf_add_cflags}" != "${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"
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/=.*//'`
CPPFLAGS=`echo "$CPPFLAGS" | \
sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \
-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'`
;;
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_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
test "${cf_add_cflags}" != "${cf_tst_cflags}" \
&& test -z "${cf_tst_cflags}" \
&& cf_fix_cppflags=no
;;
esac
done
if test -n "$cf_new_cflags" ; then
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
EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
fi
fi
;;
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_xopen_source
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[^=]*='\''\"[^"]*//'`
test "${cf_add_cflags}" != "${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"
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/=.*//'`
CPPFLAGS=`echo "$CPPFLAGS" | \
sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \
-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'`
;;
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_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
test "${cf_add_cflags}" != "${cf_tst_cflags}" \
&& test -z "${cf_tst_cflags}" \
&& cf_fix_cppflags=no
;;
esac
done
if test -n "$cf_new_cflags" ; then
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
EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
fi
fi
if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
echo "$as_me:3688: 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 3691 "configure"
#include "confdefs.h"
#include
int
main ()
{
#ifndef _XOPEN_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:3706: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:3709: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:3712: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:3715: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_XOPEN_SOURCE_set=yes
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:3724: 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 3729 "configure"
#include "confdefs.h"
#include
int
main ()
{
#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:3744: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:3747: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:3750: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:3753: \$? = $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
fi
rm -f conftest.$ac_objext conftest.$ac_ext
if test $cf_XOPEN_SOURCE_set_ok = no
then
{ echo "$as_me:3764: WARNING: _XOPEN_SOURCE is lower than requested" >&5
echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;}
fi
else
echo "$as_me:3769: 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 3776 "configure"
#include "confdefs.h"
#include
#include
#include
int
main ()
{
#ifndef _XOPEN_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:3795: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:3798: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:3801: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:3804: \$? = $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 3813 "configure"
#include "confdefs.h"
#include
#include
#include
int
main ()
{
#ifdef _XOPEN_SOURCE
make an error
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:3832: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:3835: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:3838: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:3841: \$? = $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:3856: 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_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
case $cf_add_cflags in
-D*)
cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
test "${cf_add_cflags}" != "${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"
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/=.*//'`
CPPFLAGS=`echo "$CPPFLAGS" | \
sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \
-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'`
;;
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_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
test "${cf_add_cflags}" != "${cf_tst_cflags}" \
&& test -z "${cf_tst_cflags}" \
&& cf_fix_cppflags=no
;;
esac
done
if test -n "$cf_new_cflags" ; then
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
EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
fi
fi
fi
fi
echo "$as_me:3954: 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 3966 "configure"
#include "confdefs.h"
#include
#include
#include
extern $cf_type x;
$cf_type x;
static void handler(int sig)
{
x = 5;
}
int
main ()
{
signal(SIGINT, handler);
x = 1
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:3989: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:3992: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:3995: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:3998: \$? = $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_cv_sig_atomic_t=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
test "$cf_cv_sig_atomic_t" != no && break
done
fi
echo "$as_me:4012: 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
else
cf_pkg_config=yes
fi;
echo "$as_me:4029: 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
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:4041: 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:4058: 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:4069: result: $PKG_CONFIG" >&5
echo "${ECHO_T}$PKG_CONFIG" >&6
else
echo "$as_me:4072: 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:4081: 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:4098: found $ac_dir/$ac_word" >&5
break
fi
done
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
if test -n "$ac_pt_PKG_CONFIG"; then
echo "$as_me:4110: result: $ac_pt_PKG_CONFIG" >&5
echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6
else
echo "$as_me:4113: result: no" >&5
echo "${ECHO_T}no" >&6
fi
PKG_CONFIG=$ac_pt_PKG_CONFIG
else
PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
fi
;;
*)
PKG_CONFIG=$withval
;;
esac
test -z "$PKG_CONFIG" && PKG_CONFIG=none
if test "$PKG_CONFIG" != none ; then
if test "x$prefix" != xNONE; then
cf_path_syntax="$prefix"
else
cf_path_syntax="$ac_default_prefix"
fi
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:4156: 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
echo "$as_me:4164: 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
enableval=yes
ECHO_LT=''
ECHO_LD=''
RULE_CC=''
SHOW_CC=''
ECHO_CC=''
fi;
echo "$as_me:4198: result: $enableval" >&5
echo "${ECHO_T}$enableval" >&6
echo "$as_me:4201: 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
NCURSES_WRAP_PREFIX=_nc_
fi;
echo "$as_me:4211: result: $NCURSES_WRAP_PREFIX" >&5
echo "${ECHO_T}$NCURSES_WRAP_PREFIX" >&6
echo "$as_me:4214: 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
enableval=yes
cf_enable_widec=yes
fi;
echo "$as_me:4231: result: $cf_enable_widec" >&5
echo "${ECHO_T}$cf_enable_widec" >&6
echo "$as_me:4234: 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
cf_cv_curses_dir=no
fi;
echo "$as_me:4244: result: $cf_cv_curses_dir" >&5
echo "${ECHO_T}$cf_cv_curses_dir" >&6
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
cf_path_syntax="$ac_default_prefix"
fi
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:4275: error: expected a pathname, not \"$withval\"" >&5
echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;}
{ (exit 1); exit 1; }; }
;;
esac
if test -d "$cf_cv_curses_dir"
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
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 4308 "configure"
#include "confdefs.h"
#include
int
main ()
{
printf("Hello")
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:4320: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:4323: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:4326: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:4329: \$? = $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}:4346: 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_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}:4380: 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:4393: checking for specified curses library type" >&5
echo $ECHO_N "checking for specified curses library type... $ECHO_C" >&6
# Check whether --with-ncursesw or --without-ncursesw was given.
if test "${with_ncursesw+set}" = set; then
withval="$with_ncursesw"
cf_cv_screen=ncursesw
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
# Check whether --with-pdcurses or --without-pdcurses was given.
if test "${with_pdcurses+set}" = set; then
withval="$with_pdcurses"
cf_cv_screen=pdcurses
else
# 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
# 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:4430: result: $cf_cv_screen" >&5
echo "${ECHO_T}$cf_cv_screen" >&6
case $cf_cv_screen in #(vi
curses|curses_*) #(vi
echo "$as_me:4436: 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
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
echo "$as_me:4462: 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:4466: 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 \
ncurses.h \
curses.h ncurses/ncurses.h ncurses/curses.h
do
cat >conftest.$ac_ext <<_ACEOF
#line 4478 "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:4490: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:4493: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:4496: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:4499: \$? = $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:4510: 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:4514: 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:4524: 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 4530 "configure"
#include "confdefs.h"
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:4534: \"$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:4540: \$? = $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:4559: 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 4587 "configure"
#include "confdefs.h"
#include
#include <${cf_cv_ncurses_header:-curses.h}>
#include <$cf_test>
int
main ()
{
int x = auto_left_margin
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:4602: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:4605: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:4608: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:4611: \$? = $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:4627: 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
echo "$as_me:4659: 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:4685: \"$cf_try\"") >&5
(eval $cf_try) 2>&5
ac_status=$?
echo "$as_me:4688: \$? = $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 4698 "configure"
#include "confdefs.h"
#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:4723: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:4726: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:4728: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:4731: \$? = $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:4745: 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:4752: 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 4755 "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:4767: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:4770: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:4773: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:4776: \$? = $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_exeext conftest.$ac_ext
echo "$as_me:4785: result: $cf_result" >&5
echo "${ECHO_T}$cf_result" >&6
if test "$cf_result" = no ; then
case $host_os in #(vi
freebsd*) #(vi
echo "$as_me:4791: 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 4799 "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 ()
{
tgoto ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:4818: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:4821: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:4824: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:4827: \$? = $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:4838: 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
;;
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:4852: 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
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcur_colr $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line 4860 "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 ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:4879: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:4882: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:4885: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:4888: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
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_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:4899: 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
else
echo "$as_me:4908: 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 4916 "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 ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:4935: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:4938: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:4941: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:4944: \$? = $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
fi
echo "$as_me:4955: 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.
LIBS="-lHcurses $LIBS"
CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
ac_cv_func_initscr=yes
fi
fi
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}:4995: testing adding $cf_add_libdir to library-path ..." 1>&5
LDFLAGS="-L$cf_add_libdir $LDFLAGS"
fi
fi
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
echo "${as_me:-configure}:5024: testing adding $cf_add_libdir to library-path ..." 1>&5
LDFLAGS="-L$cf_add_libdir $LDFLAGS"
fi
fi
done
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
echo "${as_me:-configure}:5055: testing adding $cf_add_libdir to library-path ..." 1>&5
LDFLAGS="-L$cf_add_libdir $LDFLAGS"
fi
fi
done
fi
;;
esac
;;
sunos3*|sunos4*)
if test "x$cf_cv_screen" = "xcurses_5lib"
then
if test -d /usr/5lib ; then
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
echo "${as_me:-configure}:5090: testing adding $cf_add_libdir to library-path ..." 1>&5
LDFLAGS="-L$cf_add_libdir $LDFLAGS"
fi
fi
done
fi
LIBS="-lcurses -ltermcap $LIBS"
fi
fi
ac_cv_func_initscr=yes
;;
esac
if test ".$ac_cv_func_initscr" != .yes ; then
cf_save_LIBS="$LIBS"
if test ".${cf_cv_ncurses_version:-no}" != .no
then
cf_check_list="ncurses curses cursesX"
else
cf_check_list="cursesX curses ncurses"
fi
# 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:5119: 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 5125 "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
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:5156: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:5159: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:5162: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:5165: \$? = $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
fi
echo "$as_me:5175: 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:5184: 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 5192 "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 ()
{
tgoto ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:5211: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:5214: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:5217: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:5220: \$? = $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:5231: 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
done
fi
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
as_ac_Lib=`echo "ac_cv_lib_$cf_curs_lib''_initscr" | $as_tr_sh`
echo "$as_me:5250: 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
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 5258 "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 ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:5277: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:5280: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:5283: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:5286: \$? = $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:5297: 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
done
fi
test $cf_curs_lib = unknown && { { echo "$as_me:5305: 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:5311: 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 5314 "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:5326: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:5329: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:5332: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:5335: \$? = $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_exeext conftest.$ac_ext
echo "$as_me:5344: result: $cf_result" >&5
echo "${ECHO_T}$cf_result" >&6
test $cf_result = no && { { echo "$as_me:5346: 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:5352: 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 5355 "configure"
#include "confdefs.h"
#include <${cf_cv_ncurses_header:-curses.h}>
int
main ()
{
initscr(); tgoto((char *)0, 0, 0);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:5367: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:5370: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:5373: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:5376: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_result=no
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line 5385 "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:5397: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:5400: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:5403: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:5406: \$? = $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
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
echo "$as_me:5418: result: $cf_result" >&5
echo "${ECHO_T}$cf_result" >&6
fi
fi
fi
;;
ncurses) #(vi
cf_ncuconfig_root=ncurses
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:5436: 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:5451: 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:5459: result: $NCURSES_CONFIG" >&5
echo "${ECHO_T}$NCURSES_CONFIG" >&6
else
echo "$as_me:5462: 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:5475: 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:5490: 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:5498: result: $ac_ct_NCURSES_CONFIG" >&5
echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6
else
echo "$as_me:5501: 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:5519: 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 \
ncurses/ncurses.h \
ncurses/curses.h \
ncurses.h \
curses.h
do
cat >conftest.$ac_ext <<_ACEOF
#line 5533 "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:5545: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:5548: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:5551: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:5554: \$? = $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:5565: 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:5569: 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:5579: 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 5585 "configure"
#include "confdefs.h"
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:5589: \"$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:5595: \$? = $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:5614: 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
cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
cat >>confdefs.h <conftest.$ac_ext <<_ACEOF
#line 5667 "configure"
#include "confdefs.h"
#include
int
main ()
{
printf("Hello")
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:5679: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:5682: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:5685: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:5688: \$? = $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}:5705: 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
}
echo "$as_me:5722: 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
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 5734 "configure"
#include "confdefs.h"
#include <$cf_header>
int
main ()
{
#ifdef NCURSES_VERSION
printf("%s\n", NCURSES_VERSION);
#else
#ifdef __NCURSES_H
printf("old\n");
#else
make an error
#endif
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:5758: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:5761: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:5764: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:5767: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_ncurses_h=$cf_header
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
test "$cf_cv_ncurses_h" != no && break
done
fi
echo "$as_me:5782: 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:5789: 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=
# 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$,,'`
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/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" && \
{
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"
}
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"
}
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$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"
}
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
CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
cat >conftest.$ac_ext <<_ACEOF
#line 5929 "configure"
#include "confdefs.h"
#include
int
main ()
{
printf("Hello")
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:5941: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:5944: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:5947: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:5950: \$? = $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}:5967: 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
for cf_header in \
ncurses.h \
curses.h
do
cat >conftest.$ac_ext <<_ACEOF
#line 5988 "configure"
#include "confdefs.h"
#include <$cf_header>
int
main ()
{
#ifdef NCURSES_VERSION
printf("%s\n", NCURSES_VERSION);
#else
#ifdef __NCURSES_H
printf("old\n");
#else
make an error
#endif
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:6012: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:6015: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:6018: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:6021: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_ncurses_h2=$cf_header
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
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:6042: error: not found" >&5
echo "$as_me: error: not found" >&2;}
{ (exit 1); exit 1; }; }
fi
echo "$as_me:6047: 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
CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
cat >conftest.$ac_ext <<_ACEOF
#line 6080 "configure"
#include "confdefs.h"
#include
int
main ()
{
printf("Hello")
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:6092: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:6095: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:6098: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:6101: \$? = $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}:6118: 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
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
;;
esac
echo "$as_me:6164: 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
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 6182 "configure"
#include "confdefs.h"
#include
#include <${cf_cv_ncurses_header:-curses.h}>
#include <$cf_test>
int
main ()
{
int x = auto_left_margin
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:6197: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:6200: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:6203: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:6206: \$? = $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:6222: 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:6260: 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:6286: \"$cf_try\"") >&5
(eval $cf_try) 2>&5
ac_status=$?
echo "$as_me:6289: \$? = $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 6299 "configure"
#include "confdefs.h"
#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:6324: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:6327: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:6329: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:6332: \$? = $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:6346: 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=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:6359: 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 6367 "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 ()
{
Gpm_Open ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:6386: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:6389: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:6392: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:6395: \$? = $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:6406: 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:6409: 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 6417 "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 ();
;
return 0;
}
_ACEOF
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:6439: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ 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:6445: \$? = $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:6456: 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:6471: 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 6479 "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 ()
{
tgoto ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:6498: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:6501: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:6504: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:6507: \$? = $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:6518: 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
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:6537: 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 6543 "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
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:6574: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:6577: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:6580: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:6583: \$? = $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:6593: 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:6600: 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 6604 "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:6616: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:6619: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:6622: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:6625: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
echo "$as_me:6627: 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:6634: 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 #(vi
-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/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 "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"
}
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$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"
}
cf_search="$cf_library_path_list $cf_search"
for cf_libdir in $cf_search
do
echo "$as_me:6724: 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 6728 "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:6740: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:6743: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:6746: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:6749: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
echo "$as_me:6751: 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:6758: 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:6773: 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:6781: 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 6791 "configure"
#include "confdefs.h"
#include <${cf_cv_ncurses_header:-curses.h}>
int
main ()
{
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:6803: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:6806: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:6809: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:6812: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
echo "$as_me:6814: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
echo "$as_me:6819: 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 multibyte character support... $ECHO_C" >&6
if test "${cf_cv_utf8_lib+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cf_save_LIBS="$LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line 6845 "configure"
#include "confdefs.h"
#include
int
main ()
{
putwc(0,0);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:6858: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:6861: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:6864: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:6867: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_utf8_lib=yes
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}:6879: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5
cf_save_LIBS="$LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line 6884 "configure"
#include "confdefs.h"
#include
int
main ()
{
putwc(0,0);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:6897: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:6900: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:6903: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:6906: \$? = $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
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
LIBS="-lutf8 $cf_save_LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line 6920 "configure"
#include "confdefs.h"
#include
int
main ()
{
putwc(0,0);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:6933: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:6936: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:6939: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:6942: \$? = $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"
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
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}:6959: testing find linkage for utf8 library ..." 1>&5
echo "${as_me:-configure}:6961: 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 #(vi
-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
# add the variations for the package we are looking for
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/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"
}
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"
}
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"
}
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"
}
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"
}
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}:7074: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5
CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_utf8"
cat >conftest.$ac_ext <<_ACEOF
#line 7078 "configure"
#include "confdefs.h"
#include
int
main ()
{
putwc(0,0);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:7091: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:7094: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:7097: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:7100: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
test -n "$verbose" && echo " ... found utf8 headers in $cf_cv_header_path_utf8" 1>&6
echo "${as_me:-configure}:7105: 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
CPPFLAGS="$cf_save_CPPFLAGS"
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
done
if test "$cf_cv_find_linkage_utf8" = maybe ; then
echo "${as_me:-configure}:7123: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5
cf_save_LIBS="$LIBS"
cf_save_LDFLAGS="$LDFLAGS"
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*)
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/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"
;;
esac
done
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/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 "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"
}
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"
}
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 "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"
}
cf_search="$cf_library_path_list $cf_search"
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
echo "${as_me:-configure}:7220: 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 7226 "configure"
#include "confdefs.h"
#include
int
main ()
{
putwc(0,0);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:7239: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:7242: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:7245: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:7248: \$? = $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}:7253: 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
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
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:7295: 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 7330 "configure"
#include "confdefs.h"
#include
int
main ()
{
printf("Hello")
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:7342: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:7345: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:7348: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:7351: \$? = $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}:7368: 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}:7402: 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:7422: 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:7437: 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:7445: result: $NCURSES_CONFIG" >&5
echo "${ECHO_T}$NCURSES_CONFIG" >&6
else
echo "$as_me:7448: 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:7461: 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:7476: 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:7484: result: $ac_ct_NCURSES_CONFIG" >&5
echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6
else
echo "$as_me:7487: 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:7505: 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 7519 "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:7531: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:7534: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:7537: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:7540: \$? = $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:7551: 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:7555: 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:7565: 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 7571 "configure"
#include "confdefs.h"
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:7575: \"$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:7581: \$? = $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:7600: 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
cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
cat >>confdefs.h <conftest.$ac_ext <<_ACEOF
#line 7653 "configure"
#include "confdefs.h"
#include
int
main ()
{
printf("Hello")
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:7665: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:7668: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:7671: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:7674: \$? = $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}:7691: 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
}
echo "$as_me:7708: 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
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 7720 "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 ()
{
#ifdef NCURSES_VERSION
#ifndef WACS_BSSB
make an error
#endif
printf("%s\n", NCURSES_VERSION);
#else
#ifdef __NCURSES_H
printf("old\n");
#else
make an error
#endif
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:7752: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:7755: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:7758: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:7761: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_ncurses_h=$cf_header
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
test "$cf_cv_ncurses_h" != no && break
done
fi
echo "$as_me:7776: 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:7783: 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=
# 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$,,'`
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/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" && \
{
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"
}
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"
}
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$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"
}
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
CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
cat >conftest.$ac_ext <<_ACEOF
#line 7923 "configure"
#include "confdefs.h"
#include
int
main ()
{
printf("Hello")
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:7935: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:7938: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:7941: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:7944: \$? = $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}:7961: 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
for cf_header in \
ncurses.h \
curses.h
do
cat >conftest.$ac_ext <<_ACEOF
#line 7982 "configure"
#include "confdefs.h"
#include <$cf_header>
int
main ()
{
#ifdef NCURSES_VERSION
printf("%s\n", NCURSES_VERSION);
#else
#ifdef __NCURSES_H
printf("old\n");
#else
make an error
#endif
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:8006: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:8009: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:8012: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:8015: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_ncurses_h2=$cf_header
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
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:8036: error: not found" >&5
echo "$as_me: error: not found" >&2;}
{ (exit 1); exit 1; }; }
fi
echo "$as_me:8041: 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
CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
cat >conftest.$ac_ext <<_ACEOF
#line 8074 "configure"
#include "confdefs.h"
#include
int
main ()
{
printf("Hello")
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:8086: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:8089: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:8092: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:8095: \$? = $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}:8112: 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
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
;;
esac
echo "$as_me:8158: 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
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 8176 "configure"
#include "confdefs.h"
#include
#include <${cf_cv_ncurses_header:-curses.h}>
#include <$cf_test>
int
main ()
{
int x = auto_left_margin
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:8191: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:8194: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:8197: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:8200: \$? = $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:8216: 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:8254: 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:8280: \"$cf_try\"") >&5
(eval $cf_try) 2>&5
ac_status=$?
echo "$as_me:8283: \$? = $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 8293 "configure"
#include "confdefs.h"
#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:8318: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:8321: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:8323: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:8326: \$? = $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:8340: 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
# 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:8353: 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 8361 "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 ()
{
Gpm_Open ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:8380: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:8383: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:8386: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:8389: \$? = $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:8400: 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:8403: 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 8411 "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 ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:8430: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:8433: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:8436: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:8439: \$? = $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:8450: 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:8465: 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 8473 "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 ()
{
tgoto ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:8492: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:8495: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:8498: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:8501: \$? = $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:8512: 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
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:8531: 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 8537 "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
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:8568: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:8571: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:8574: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:8577: \$? = $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:8587: 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:8594: 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 8598 "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:8610: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:8613: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:8616: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:8619: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
echo "$as_me:8621: 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:8628: 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 #(vi
-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/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 "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"
}
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$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"
}
cf_search="$cf_library_path_list $cf_search"
for cf_libdir in $cf_search
do
echo "$as_me:8718: 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 8722 "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:8734: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:8737: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:8740: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:8743: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
echo "$as_me:8745: 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:8752: 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:8767: 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:8775: 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 8785 "configure"
#include "confdefs.h"
#include <${cf_cv_ncurses_header:-curses.h}>
int
main ()
{
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:8797: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:8800: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:8803: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:8806: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
echo "$as_me:8808: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
echo "$as_me:8813: 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/X11R6/include
/usr/X11R5/include
/usr/X11R4/include
/usr/include/X11
/usr/include/X11R6
/usr/include/X11R5
/usr/include/X11R4
/usr/local/X11/include
/usr/local/X11R6/include
/usr/local/X11R5/include
/usr/local/X11R4/include
/usr/local/include/X11
/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 8927 "configure"
#include "confdefs.h"
#include
_ACEOF
if { (eval echo "$as_me:8931: \"$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:8937: \$? = $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 8970 "configure"
#include "confdefs.h"
#include
int
main ()
{
XtMalloc (0)
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:8982: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:8985: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:8988: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:8991: \$? = $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:9029: 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:9039: 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:9063: 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 9067 "configure"
#include "confdefs.h"
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:9079: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9082: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9085: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9088: \$? = $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:9098: 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 9104 "configure"
#include "confdefs.h"
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:9116: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9119: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9122: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9125: \$? = $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:9135: result: yes" >&5
echo "${ECHO_T}yes" >&6
X_LIBS="$X_LIBS -R $x_libraries"
else
echo "$as_me:9139: 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 9159 "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:9178: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9181: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9184: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9187: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
echo "$as_me:9193: 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 9201 "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:9220: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9223: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9226: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9229: \$? = $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:9240: 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:9247: 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 9255 "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:9274: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9277: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9280: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9283: \$? = $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:9294: 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:9313: 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 9319 "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) ();
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
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:9350: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9353: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9356: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9359: \$? = $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:9369: 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:9373: 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 9381 "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;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:9400: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9403: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9406: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9409: \$? = $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:9420: 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:9427: 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 9435 "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;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:9454: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9457: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9460: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9463: \$? = $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:9474: 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:9490: 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 9496 "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) ();
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
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:9527: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9530: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9533: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9536: \$? = $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:9546: 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:9550: 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 9558 "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 ()
{
connect ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:9577: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9580: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9583: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9586: \$? = $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:9597: 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:9606: 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 9612 "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) ();
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_remove) || defined (__stub___remove)
choke me
#else
f = remove; /* 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:9643: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9646: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9649: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9652: \$? = $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:9662: 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:9666: 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 9674 "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 ()
{
remove ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:9693: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9696: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9699: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9702: \$? = $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:9713: 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:9722: 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 9728 "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) ();
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_shmat) || defined (__stub___shmat)
choke me
#else
f = shmat; /* 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:9759: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9762: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9765: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9768: \$? = $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:9778: 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:9782: 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 9790 "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 ()
{
shmat ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:9809: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9812: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9815: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9818: \$? = $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:9829: 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:9847: 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 9855 "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 ()
{
IceConnectionNumber ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:9874: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:9877: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:9880: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:9883: \$? = $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:9894: 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:9906: 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:9917: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
echo "$as_me:9920: result: no" >&5
echo "${ECHO_T}no" >&6
fi
echo "$as_me:9924: 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:9935: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
echo "$as_me:9938: result: no" >&5
echo "${ECHO_T}no" >&6
fi
echo "$as_me:9942: 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:9953: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
echo "$as_me:9956: 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}:9976: 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}:9982: 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}:9986: 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 #(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[^=]*='\''\"[^"]*//'`
test "${cf_add_cflags}" != "${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"
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/=.*//'`
CPPFLAGS=`echo "$CPPFLAGS" | \
sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \
-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'`
;;
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_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
test "${cf_add_cflags}" != "${cf_tst_cflags}" \
&& test -z "${cf_tst_cflags}" \
&& cf_fix_cppflags=no
;;
esac
done
if test -n "$cf_new_cflags" ; then
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
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}:10083: testing ..trimmed $LIBS ..." 1>&5
;;
esac
done
echo "$as_me:10089: 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 10096 "configure"
#include "confdefs.h"
#include