Imported Upstream version 5.0.20141106

parent dacaf1fb
This diff is collapsed.
Modifications copyright Thomas Dickey 1999, 2000, 2001, 2002, 2003, 2004, 2005
Modifications copyright Thomas Dickey 1999-2013,2014
The software and documentation are still under the same licensing are the
original Cdk, but noting that substantial work and enhancements have been made,
......
This diff is collapsed.
-- $Id: README,v 1.6 2006/05/07 23:19:21 tom Exp $
-- $Id: README,v 1.8 2014/01/01 22:24:05 tom Exp $
-------------------------------------------------------------------------------
Copyright Thomas Dickey 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Copyright Thomas Dickey 1999-2013,2014
This is a modified/enhanced version of Cdk. The original README contents are
given below.
......
4:0:3 5.0 20060507
6:0:4 5.0 20141106
This diff is collapsed.
This diff is collapsed.
......@@ -2,8 +2,8 @@
/*
* $Author: tom $
* $Date: 2006/04/06 19:59:29 $
* $Revision: 1.54 $
* $Date: 2011/05/16 22:36:08 $
* $Revision: 1.56 $
*
* Notes:
*
......@@ -55,7 +55,7 @@ void bindCDKObject (EObjectType cdktype,
{
if (key != 0 && (unsigned)key >= obj->bindingCount)
{
unsigned next = (key + 1);
unsigned next = (unsigned) (key + 1);
if (obj->bindingList != 0)
obj->bindingList = typeReallocN (CDKBINDING, obj->bindingList, next);
......@@ -177,7 +177,7 @@ int getcCDKObject (CDKOBJS *obj)
result = (int)(long)test->bindingList[result].bindData;
}
else if (test == 0
|| (unsigned)result > test->bindingCount
|| (unsigned)result >= test->bindingCount
|| test->bindingList[result].bindFunction == 0)
{
switch (result)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!@SHELL@
# $Id: cdk-config.in,v 1.4 2013/06/15 15:38:16 tom Exp $
##############################################################################
# Copyright (c) 2007-2011,2013 Thomas E. Dickey #
# #
# 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. #
##############################################################################
prefix="@prefix@"
exec_prefix="@exec_prefix@"
bindir="@bindir@"
libdir="@libdir@"
datarootdir="@datarootdir@"
datadir="@datadir@"
mandir="@mandir@"
includedir="@includedir@"
THIS="@CFG_ROOTNAME@"
XHDR="@HDR_ROOTNAME@"
XLIB="@LIB_ROOTNAME@"
test $# = 0 && exec @SHELL@ $0 --error
while test $# -gt 0; do
case "$1" in
-*=*)
ARG=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
;;
*)
ARG=
;;
esac
case "$1" in
# basic configuration
--prefix=*)
prefix="$ARG"
test -z "$exec_prefix" && exec_prefix="$ARG"
;;
--prefix)
echo "$prefix"
;;
--exec-prefix=*)
exec_prefix="$ARG"
;;
--exec-prefix)
echo "$exec_prefix"
;;
# compile/link
--cflags)
INCS="-I$includedir/$XHDR"
sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
$INCS
ENDECHO
;;
--libs)
sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
-L${exec_prefix}/lib -l${XLIB} @LIBS@
ENDECHO
;;
# identification
--version)
echo "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@"
;;
--abi-version)
echo "@VERSION@" | sed -e 's/:/./g'
;;
# locations
--bindir)
echo "${bindir}"
;;
--datadir)
echo "${datadir}"
;;
--libdir)
echo "${libdir}"
;;
--mandir)
echo "${mandir}"
;;
# general info
--help)
cat <<ENDHELP
Usage: ${THIS}-config [options]
Options:
--prefix echos the package-prefix of ${THIS}
--prefix=ARG sets the package-prefix of ${THIS}
--exec-prefix echos the executable-prefix of ${THIS}
--exec-prefix=ARG sets the executable-prefix of ${THIS}
--cflags echos the C compiler flags needed to compile with ${THIS}
--libs echos the libraries needed to link with ${THIS}
--version echos the release+patchdate version of ${THIS}
--abi-version echos the ABI version of ${THIS}
--bindir echos the directory containing ${THIS} programs
--datadir echos the directory containing ${THIS} data
--libdir echos the directory containing ${THIS} libraries
--mandir echos the directory containing ${THIS} manpages
--help prints this message
ENDHELP
;;
--error|*)
@SHELL@ $0 --help 1>&2
exit 1
;;
esac
shift
done
# vile:shmode
This diff is collapsed.
# $Id: cdk.spec,v 1.15 2005/12/30 02:06:06 tom Exp $
# Note that this is NOT a relocatable package
%define ver 5.0
%define subver 20051230
%define rel 1
%define prefix /usr
Summary: A Curses Development Library (ncurses-based widgets)
Name: cdk
Version: %ver
Release: %rel
Copyright: BSD
Group: Applications/Libraries
Source: ftp://invisible-island.com/cdk/cdk.tar.gz
BuildRoot: /tmp/cdk-%{ver}-root
Packager: Squidster <squidster@msa.dec.com>
Requires: ncurses
%description
A Curses Development Library (ncurses-based widgets)
%changelog
%prep
%setup -n %{name}-%{ver}-%{subver}
%build
CFLAGS="${RPM_OPT_FLAGS}"
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix
make DOCUMENT_DIR=/usr/share/doc/cdk
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT DOCUMENT_DIR=$RPM_BUILD_ROOT/usr/share/doc/cdk install
%clean
rm -rf $RPM_BUILD_ROOT
%post
%postun
%files
%defattr(-, root, root)
%doc BUGS EXPANDING NOTES TODO COPYING INSTALL README
%{prefix}/include/cdk/*.h
%{prefix}/lib/lib*.a
%{prefix}/man/man3/*
......@@ -2,14 +2,14 @@
/*
* $Author: tom $
* $Date: 2006/04/18 00:06:07 $
* $Revision: 1.3 $
* $Date: 2012/03/20 09:54:37 $
* $Revision: 1.4 $
*/
/*
* Given a character pointer, returns the equivalent display type.
*/
EDisplayType char2DisplayType (char *string)
EDisplayType char2DisplayType (const char *string)
{
/* *INDENT-OFF* */
static const struct {
......
......@@ -4,8 +4,8 @@
* Default method-functions for CDK objects.
*
* $Author: tom $
* $Date: 2005/04/15 22:08:58 $
* $Revision: 1.12 $
* $Date: 2012/03/22 00:43:33 $
* $Revision: 1.16 $
*/
/*
......@@ -67,7 +67,7 @@ void setCdkBXattr (CDKOBJS *obj, chtype ch)
/*
* This sets the background color of the widget.
*/
void setCDKObjectBackgroundColor (CDKOBJS *obj, char *color)
void setCDKObjectBackgroundColor (CDKOBJS *obj, const char *color)
{
chtype *holder = 0;
int junk1, junk2;
......@@ -82,7 +82,7 @@ void setCDKObjectBackgroundColor (CDKOBJS *obj, char *color)
holder = char2Chtype (color, &junk1, &junk2);
/* Set the widget's background color. */
SetBackAttrObj(obj, holder[0]);
SetBackAttrObj (obj, holder[0]);
/* Clean up. */
freeChtype (holder);
......@@ -91,7 +91,7 @@ void setCDKObjectBackgroundColor (CDKOBJS *obj, char *color)
/*
* Set the widget's title.
*/
int setCdkTitle (CDKOBJS *obj, char *title, int boxWidth)
int setCdkTitle (CDKOBJS *obj, const char *title, int boxWidth)
{
if (obj != 0)
{
......@@ -109,7 +109,7 @@ int setCdkTitle (CDKOBJS *obj, char *title, int boxWidth)
/* We need to split the title on \n. */
temp = CDKsplitString (title, '\n');
obj->titleLines = CDKcountStrings (temp);
obj->titleLines = (int)CDKcountStrings ((CDK_CSTRING2) temp);
obj->title = typeCallocN (chtype *, obj->titleLines + 1);
obj->titlePos = typeCallocN (int, obj->titleLines + 1);
......@@ -211,6 +211,9 @@ void setCdkExitType (CDKOBJS *obj, EExitType *type, chtype ch)
{
switch (ch)
{
case KEY_ERROR:
*type = vERROR;
break;
case KEY_ESC:
*type = vESCAPE_HIT;
break;
......
......@@ -4,8 +4,8 @@
* Useful functions for command-line parsing.
*
* $Author: tom $
* $Date: 2005/12/27 19:52:30 $
* $Revision: 1.6 $
* $Date: 2014/11/06 00:56:26 $
* $Revision: 1.11 $
*/
#define OPTION_ON ((char *)1)
......@@ -13,17 +13,18 @@
static void usage (char **argv,
CDK_PARAMS * params,
char *options)
const char *options)
{
int n;
char *str;
const char *str;
char *base = baseName (argv[0]);
fprintf (stderr, "Usage: %s [options]\n\nOptions:\n", baseName (argv[0]));
fprintf (stderr, "Usage: %s [options]\n\nOptions:\n", base);
for (n = 1; n < MAX_CDK_PARAMS; ++n)
{
if (n != ':'
&& (str = strchr (options, n)) != 0)
&& (str = (strchr) (options, n)) != 0)
{
int value = (str[1] == ':');
fprintf (stderr, " -%c", n);
......@@ -43,6 +44,7 @@ static void usage (char **argv,
}
}
}
free (base);
exit (EXIT_FAILURE);
}
......@@ -55,7 +57,7 @@ static int CDKparseSize (char *string, int fullSize)
}
else
{
result = strtol (string, (char **)0, 0);
result = (int)strtol (string, (char **)0, 0);
}
return result;
}
......@@ -64,7 +66,7 @@ static int CDKparseSize (char *string, int fullSize)
* Parse the string as one of CDK's positioning keywords, or an actual
* position.
*/
int CDKparsePosition (char *string)
int CDKparsePosition (const char *string)
{
int result;
......@@ -94,7 +96,7 @@ int CDKparsePosition (char *string)
}
else
{
result = strtol (string, (char **)0, 0);
result = (int)strtol (string, (char **)0, 0);
}
return result;
}
......@@ -106,17 +108,17 @@ int CDKparsePosition (char *string)
void CDKparseParams (int argc,
char **argv,
CDK_PARAMS * params,
char *options)
const char *options)
{
int code;
char *str;
const char *str;
memset (params, 0, sizeof (*params));
params->Box = TRUE;
while ((code = getopt (argc, argv, options)) != EOF)
{
if (code == '?' || (str = strchr (options, code)) == 0)
if (code == '?' || (str = (strchr) (options, code)) == 0)
{
usage (argv, params, options);
}
......@@ -184,13 +186,13 @@ char *CDKparamString (CDK_PARAMS * params, int option)
/*
* Retrieve the string value of an option, with default for missing value.
*/
char *CDKparamString2 (CDK_PARAMS * params, int option, char *missing)
char *CDKparamString2 (CDK_PARAMS * params, int option, const char *missing)
{
char *value = ((option > 0 && option < MAX_CDK_PARAMS)
? params->allParams[option]
: 0);
if (value == 0)
value = missing;
value = copyChar (missing);
return value;
}
......@@ -240,7 +242,7 @@ int CDKparamValue (CDK_PARAMS * params, int option, int missing)
}
else
{
result = strtol (value, (char **)0, 0);
result = (int)strtol (value, (char **)0, 0);
}
return result;
......
......@@ -6,8 +6,8 @@
/*
* $Author: tom $
* $Date: 2005/12/29 20:51:17 $
* $Revision: 1.87 $
* $Date: 2008/11/01 14:27:23 $
* $Revision: 1.88 $
*/
typedef struct _all_screens
......@@ -389,12 +389,6 @@ void refreshCDKScreen (CDKSCREEN *cdkscreen)
}
}
/*
* Exactly one widget should have focus, and it should be visible.
*/
if (focused < 0)
focused = visible;
for (x = 0; x < objectCount; x++)
{
CDKOBJS *obj = cdkscreen->object[x];
......
# $Id: Makefile.in,v 1.4 2003/11/27 12:03:41 tom Exp $
# $Id: Makefile.in,v 1.7 2013/07/19 23:55:03 tom Exp $
#
# Makefile for the cli directory.
#
......@@ -12,20 +12,25 @@ VPATH = $(srcdir)
CC = @CC@
RM = rm -f
CTAGS = @CTAGS@
ETAGS = @ETAGS@
LINT = @LINT@
LINT_OPTS = @LINT_OPTS@
LIBS = -l@LIB_ROOTNAME@ @LIBS@
LIBTOOL = @LIBTOOL@ @ECHO_LT@
LIBTOOL_CLEAN = @LIB_CLEAN@
LIBTOOL_LINK = @LIB_LINK@
LINK = $(LIBTOOL_LINK) $(CC)
LINK = $(LIBTOOL_LINK)
x = @EXEEXT@
o = .@OBJEXT@
LOCAL_LIBDIR = @top_builddir@
CFLAGS = @CFLAGS@ @EXTRA_CFLAGS@
CPPFLAGS = @DEFS@ -I../include -I$(srcdir)/../include -I. @CPPFLAGS@
LDFLAGS = -L.. @LDFLAGS@
LDFLAGS = -L.. @LDFLAGS@ @LOCAL_LDFLAGS@
BINS = \
cdkalphalist$x \
......@@ -45,6 +50,24 @@ BINS = \
cdktemplate$x \
cdkviewer$x
CDKSRC = \
cdkalphalist.c \
cdkcalendar.c \
cdkdialog.c \
cdkentry.c \
cdkfselect.c \
cdkitemlist.c \
cdklabel.c \
cdkmatrix.c \
cdkmentry.c \
cdkradio.c \
cdkscale.c \
cdkscroll.c \
cdkselection.c \
cdkslider.c \
cdktemplate.c \
cdkviewer.c
LINKIT = @ECHO_LD@$(LINK) $(CFLAGS) $(CPPFLAGS) $? -o $@ $(LDFLAGS) $(LIBS)
all : $(BINS)
......@@ -73,3 +96,12 @@ clean::
distclean:: clean
$(RM) Makefile
@MAKE_LOWER_TAGS@tags :
@MAKE_LOWER_TAGS@ $(CTAGS) *.[ch] */*.[ch]
@MAKE_LOWER_TAGS@TAGS :
@MAKE_LOWER_TAGS@ $(ETAGS) *.[ch] */*.[ch]
lint: $(CDKSRC)
$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(CDKSRC)
/* $Id: cdkalphalist.c,v 1.12 2005/12/27 17:26:08 tom Exp $ */
/* $Id: cdkalphalist.c,v 1.17 2014/01/19 02:27:01 tom Exp $ */
#include <cdk_test.h>
#ifdef XCURSES
char *XCursesProgramName="cdkalphalist";
char *XCursesProgramName = "cdkalphalist";
#endif
/*
......@@ -14,31 +14,30 @@ int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key);
/*
* Define file local variables.
*/
static char *FPUsage = "-l List | -f filename [-F Field Character] [-T Title] [-L Label] [-B Buttons] [-O Output File] [-X X Position] [-Y Y Position] [-H Height] [-W Width] [-N] [-S]";
static const char *FPUsage = "-l List | -f filename [-F Field Character] [-T Title] [-L Label] [-B Buttons] [-O Output File] [-X X Position] [-Y Y Position] [-H Height] [-W Width] [-N] [-S]";
/*
*
*/
int main (int argc, char **argv)
{
/* Declare variables. */
CDKSCREEN *cdkScreen = 0;
CDKALPHALIST *widget = 0;
CDKBUTTONBOX *buttonWidget = 0;
WINDOW *cursesWindow = 0;
char *CDK_WIDGET_COLOR = 0;
char *answer = 0;
/* *INDENT-EQLS* */
CDKSCREEN *cdkScreen = 0;
CDKALPHALIST *widget = 0;
CDKBUTTONBOX *buttonWidget = 0;
WINDOW *cursesWindow = 0;
char *CDK_WIDGET_COLOR = 0;
char *answer = 0;
char *buttons;
char *temp = 0;
chtype *holder = 0;
chtype filler = A_NORMAL | '.';
int scrollLines = -1;
int buttonCount = 0;
int selection = 0;
int shadowHeight = 0;
FILE *fp = stderr;
char **scrollList = 0;
char **buttonList = 0;
char *temp = 0;
chtype *holder = 0;
chtype filler = A_NORMAL | '.';
int scrollLines = -1;
int buttonCount = 0;
int shadowHeight = 0;
FILE *fp = stderr;
char **scrollList = 0;
char **buttonList = 0;
int j1, j2;
CDK_PARAMS params;
......@@ -55,22 +54,22 @@ int main (int argc, char **argv)
int xpos;
int ypos;
CDKparseParams(argc, argv, &params, "f:l:B:F:L:O:T:" CDK_CLI_PARAMS);
xpos = CDKparamValue(&params, 'X', CENTER);
ypos = CDKparamValue(&params, 'Y', CENTER);
height = CDKparamValue(&params, 'H', -1);
width = CDKparamValue(&params, 'W', -1);
boxWidget = CDKparamValue(&params, 'N', TRUE);
shadowWidget = CDKparamValue(&params, 'S', FALSE);
filename = CDKparamString(&params, 'f');
list = CDKparamString(&params, 'l');
buttons = CDKparamString(&params, 'B');
tempFiller = CDKparamString(&params, 'F');
label = CDKparamString(&params, 'L');
outputFile = CDKparamString(&params, 'O');
title = CDKparamString(&params, 'T');
CDKparseParams (argc, argv, &params, "f:l:B:F:L:O:T:" CDK_CLI_PARAMS);
/* *INDENT-EQLS* */
xpos = CDKparamValue (&params, 'X', CENTER);
ypos = CDKparamValue (&params, 'Y', CENTER);
height = CDKparamValue (&params, 'H', -1);
width = CDKparamValue (&params, 'W', -1);
boxWidget = CDKparamValue (&params, 'N', TRUE);
shadowWidget = CDKparamValue (&params, 'S', FALSE);
filename = CDKparamString (&params, 'f');
list = CDKparamString (&params, 'l');
buttons = CDKparamString (&params, 'B');
tempFiller = CDKparamString (&params, 'F');
label = CDKparamString (&params, 'L');
outputFile = CDKparamString (&params, 'O');
title = CDKparamString (&params, 'T');
/* If the user asked for an output file, try to open it. */
if (outputFile != 0)
......@@ -109,17 +108,17 @@ int main (int argc, char **argv)
{
/* Split the scroll lines up. */
scrollList = CDKsplitString (list, '\n');
scrollLines = CDKcountStrings (scrollList);
scrollLines = (int)CDKcountStrings ((CDK_CSTRING2)scrollList);
}
/* Start curses. */
cursesWindow = initscr();
cursesWindow = initscr ();
/* Create the CDK screen. */
cdkScreen = initCDKScreen (cursesWindow);
/* Start color. */
initCDKColor();
initCDKColor ();
/* Check if the user wants to set the background of the main screen. */
if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0)
......@@ -146,20 +145,22 @@ int main (int argc, char **argv)
/* Create the widget. */
widget = newCDKAlphalist (cdkScreen, xpos, ypos,
height, width,
title, label,
scrollList, scrollLines,
filler, A_REVERSE,
boxWidget, shadowWidget);
height, width,
title, label,
(CDK_CSTRING *)scrollList, scrollLines,
filler, A_REVERSE,
boxWidget, shadowWidget);
/* Make sure we could create the widget. */
if (widget == 0)
{
CDKfreeStrings(scrollList);
CDKfreeStrings (scrollList);
destroyCDKScreen (cdkScreen);
endCDK();
endCDK ();
fprintf (stderr, "Error: Could not create the alphalist. Is the window too small?\n");
fprintf (stderr,
"Error: Could not create the alphalist. "
"Is the window too small?\n");