Import Upstream version 5.0.20161120

parent f25a49fd
-- $Id: CHANGES,v 1.247 2016/02/01 00:49:04 tom Exp $
-- $Id: CHANGES,v 1.257 2016/11/20 20:35:10 tom Exp $
-------------------------------------------------------------------------------
Cdk Version Change List
Copyright Mike Glover, 1995, 1996, 1997, 1998, 1999
......@@ -9,6 +9,39 @@ This file outlines all of the changes/additions from one release to another.
Changes through 4.9.8 (December 1998) were recorded by Mike Glover.
Thereafter, changes have been recorded by Thomas E. Dickey.
2016/11/20
+ fix warnings from cppcheck 1.76.1
+ updated configure macros:
+ CF_CC_ENV_FLAGS don't limit the check to -I, -U and -D options,
since the added options can include various compiler options before
and after preprocessor options.
+ CF_GNU_SOURCE recent glibc (Debian 2.23-4 for example) has
misordered ifdef/checks for new symbol _DEFAULT_SOURCE, producing
warning messages when only _GNU_SOURCE is defined. Add a followup
check to define _DEFAULT_SOURCE.
+ CF_LD_RPATH_OPT change FreeBSD to use -Wl,-rpath rather than -rpath
option. According to FreeBSD #178732, either works since FreeBSD
4.x; however scons does not accept anything except the -Wl,-rpath
form.
+ CF_PROG_LINT add cpplint to programs to use; drop ad hoc tdlint and
alint.
+ CF_WITH_NCURSES_ETC add check for ncurses pthreads
+ CF_XOPEN_SOURCE add "uclinux" to list of Linux's and use
_GNU_SOURCE for cygwin headers, tested with cygwin 2.3, 2.5
+ CF__ADD_SHLIB_RULES improve scripting for ldconfig to avoid warning
messages if no permissions
+ update config.guess, config.sub
> patches by Aarian P. Aleahmad:
+ modify encodeAttribute() to allow up to 256 color pairs.
+ corrected assignment in scroller_SetPosition(), to show highlighted
member.
+ improve the way attributes are applied to Mentry widgets.
+ improve Entry widget by using newwin rather than subwin, as well
as passing arguments to callback function.
2016/11/19
+ add reRegisterCDKObject()
2016/01/31
+ fix a few of the lintian errors in package/debian
+ fix some too-wide tables in manpages, which caused Debian lintian
......
6:0:4 5.0 20160131
6:1:4 5.0 20161120
dnl $Id: aclocal.m4,v 1.96 2016/01/31 19:51:40 tom Exp $
dnl $Id: aclocal.m4,v 1.98 2016/11/20 15:18:17 tom Exp $
dnl macros used for CDK configure script
dnl ---------------------------------------------------------------------------
dnl Copyright 1999-2015,2016 Thomas E. Dickey
......@@ -407,11 +407,18 @@ ifelse([$3],,[ :]dnl
])dnl
])])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CC_ENV_FLAGS version: 2 updated: 2015/04/12 15:39:00
dnl CF_CC_ENV_FLAGS version: 6 updated: 2016/08/29 20:57:00
dnl ---------------
dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
dnl into CC. This will not help with broken scripts that wrap the compiler with
dnl options, but eliminates a more common category of user confusion.
dnl into CC. This will not help with broken scripts that wrap the compiler
dnl with options, but eliminates a more common category of user confusion.
dnl
dnl In particular, it addresses the problem of being able to run the C
dnl preprocessor in a consistent manner.
dnl
dnl Caveat: this also disallows blanks in the pathname for the compiler, but
dnl the nuisance of having inconsistent settings for compiler and preprocessor
dnl outweighs that limitation.
AC_DEFUN([CF_CC_ENV_FLAGS],
[
# This should have been defined by AC_PROG_CC
......@@ -419,13 +426,26 @@ AC_DEFUN([CF_CC_ENV_FLAGS],
AC_MSG_CHECKING(\$CC variable)
case "$CC" in
(*[[\ \ ]]-[[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)
cf_flags=`echo "$CC" | sed -e 's/^.*[[ ]]\(-[[^ ]]\)/\1/'`
CC=`echo "$CC " | sed -e 's/[[ ]]-[[^ ]].*$//' -e 's/[[ ]]*$//'`
for cf_arg in $cf_flags
do
case "x$cf_arg" in
(x-[[IUDfgOW]]*)
CF_ADD_CFLAGS($cf_flags)
;;
(*)
CC="$CC $cf_arg"
;;
esac
done
CF_VERBOSE(resulting CC: '$CC')
CF_VERBOSE(resulting CFLAGS: '$CFLAGS')
CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS')
;;
(*)
AC_MSG_RESULT(ok)
......@@ -1575,7 +1595,7 @@ if test $cf_cv_getopt_header = getopt.h ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
dnl CF_GNU_SOURCE version: 7 updated: 2016/08/05 05:15:37
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
......@@ -1602,7 +1622,20 @@ make an error
CPPFLAGS="$cf_save"
])
])
test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
if test "$cf_cv_gnu_source" = yes
then
AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
AC_TRY_COMPILE([#include <sys/types.h>],[
#ifdef _DEFAULT_SOURCE
make an error
#endif],
[cf_cv_default_source=no],
[cf_cv_default_source=yes])
])
test "$cf_cv_default_source" = yes && CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE"
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48
......@@ -1689,7 +1722,7 @@ cf_save_CFLAGS="$cf_save_CFLAGS -we147"
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_LD_RPATH_OPT version: 6 updated: 2015/04/12 15:39:00
dnl CF_LD_RPATH_OPT version: 7 updated: 2016/02/20 18:01:19
dnl ---------------
dnl For the given system and compiler, find the compiler flags to pass to the
dnl loader to use the "rpath" feature.
......@@ -1707,13 +1740,13 @@ case $cf_cv_system_name in
LD_RPATH_OPT="-rpath "
fi
;;
(linux*|gnu*|k*bsd*-gnu)
(linux*|gnu*|k*bsd*-gnu|freebsd*)
LD_RPATH_OPT="-Wl,-rpath,"
;;
(openbsd[[2-9]].*|mirbsd*)
LD_RPATH_OPT="-Wl,-rpath,"
;;
(dragonfly*|freebsd*)
(dragonfly*)
LD_RPATH_OPT="-rpath "
;;
(netbsd*)
......@@ -2314,6 +2347,21 @@ CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_NCURSES_PTHREADS version: 2 updated: 2016/04/22 05:07:41
dnl -------------------
dnl Use this followup check to ensure that we link with pthreads if ncurses
dnl uses it.
AC_DEFUN([CF_NCURSES_PTHREADS],[
: ${cf_nculib_root:=ifelse($1,,ncurses,$1)}
AC_CHECK_LIB($cf_nculib_root,_nc_init_pthreads,
cf_cv_ncurses_pthreads=yes,
cf_cv_ncurses_pthreads=no)
if test "$cf_cv_ncurses_pthreads" = yes
then
CF_ADD_LIBS(-lpthread)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51
dnl ------------------
dnl Check for the version of ncurses, to aid in reporting bugs, etc.
......@@ -2653,11 +2701,11 @@ AC_SUBST(PROG_EXT)
test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
dnl CF_PROG_LINT version: 3 updated: 2016/05/22 15:25:54
dnl ------------
AC_DEFUN([CF_PROG_LINT],
[
AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint)
AC_CHECK_PROGS(LINT, lint cppcheck splint)
AC_SUBST(LINT_OPTS)
])dnl
dnl ---------------------------------------------------------------------------
......@@ -3832,7 +3880,7 @@ esac
AC_SUBST(LIBTOOL_OPTS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_NCURSES_ETC version: 4 updated: 2015/04/25 20:53:11
dnl CF_WITH_NCURSES_ETC version: 5 updated: 2016/02/20 19:23:20
dnl -------------------
dnl Use this macro for programs which use any variant of "curses", e.g.,
dnl "ncurses", and "PDCurses". Programs that can use curses and some unrelated
......@@ -3891,6 +3939,8 @@ case $cf_cv_screen in
;;
esac
CF_NCURSES_PTHREADS($cf_cv_screen)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_NC_ALLOC_H version: 4 updated: 2008/11/01 12:44:02
......@@ -4237,7 +4287,7 @@ esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_XOPEN_SOURCE version: 50 updated: 2015/10/17 19:03:33
dnl CF_XOPEN_SOURCE version: 52 updated: 2016/08/27 12:21:42
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,
......@@ -4257,7 +4307,7 @@ case $host_os in
(aix[[4-7]]*)
cf_xopen_source="-D_ALL_SOURCE"
;;
(cygwin|msys)
(msys)
cf_XOPEN_SOURCE=600
;;
(darwin[[0-8]].*)
......@@ -4285,7 +4335,7 @@ case $host_os in
cf_xopen_source="-D_SGI_SOURCE"
cf_XOPEN_SOURCE=
;;
(linux*|gnu*|mint*|k*bsd*-gnu)
(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
CF_GNU_SOURCE
;;
(minix*)
......@@ -4307,9 +4357,6 @@ case $host_os in
(openbsd*)
# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
;;
(os2*)
cf_XOPEN_SOURCE=
;;
(osf[[45]]*)
cf_xopen_source="-D_OSF_SOURCE"
;;
......@@ -4698,7 +4745,7 @@ to makefile.])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF__ADD_SHLIB_RULES version: 5 updated: 2015/05/10 19:52:14
dnl CF__ADD_SHLIB_RULES version: 6 updated: 2016/04/21 21:07:50
dnl -------------------
dnl Append rules for creating, installing, uninstalling and cleaning library.
dnl In particular, this is needed for shared libraries since there are symbolic
......@@ -4776,7 +4823,7 @@ fi
if test x$2 = xshared
then
cat >>$1 <<CF_EOF
- test -z "\$(DESTDIR)" && /sbin/ldconfig
- \$(SHELL) -c "if test -z "\$(DESTDIR)" ; then /sbin/ldconfig; fi"
CF_EOF
fi
......
......@@ -2,8 +2,8 @@
/*
* $Author: tom $
* $Date: 2014/01/19 01:58:00 $
* $Revision: 1.110 $
* $Date: 2016/11/20 18:39:12 $
* $Revision: 1.111 $
*/
/*
......@@ -36,7 +36,6 @@ CDKALPHALIST *newCDKAlphalist (CDKSCREEN *cdkscreen,
{
/* *INDENT-EQLS* */
CDKALPHALIST *alphalist = 0;
chtype *chtypeLabel = 0;
int parentWidth = getmaxx (cdkscreen->window);
int parentHeight = getmaxy (cdkscreen->window);
int boxWidth;
......@@ -80,7 +79,7 @@ CDKALPHALIST *newCDKAlphalist (CDKSCREEN *cdkscreen,
/* Translate the label char *pointer to a chtype pointer. */
if (label != 0)
{
chtypeLabel = char2Chtype (label, &labelLen, &junk2);
chtype *chtypeLabel = char2Chtype (label, &labelLen, &junk2);
freeChtype (chtypeLabel);
}
......@@ -344,7 +343,7 @@ char *activateCDKAlphalist (CDKALPHALIST *alphalist, chtype *actions)
static int _injectCDKAlphalist (CDKOBJS *object, chtype input)
{
CDKALPHALIST *alphalist = (CDKALPHALIST *)object;
char *ret = unknownString;
char *ret;
/* Draw the widget. */
drawCDKAlphalist (alphalist, ObjOf (alphalist)->box);
......@@ -602,10 +601,11 @@ static int adjustAlphalistCB (EObjectType objectType GCC_UNUSED, void
CDKALPHALIST *alphalist = (CDKALPHALIST *)clientData;
CDKSCROLL *scrollp = alphalist->scrollField;
CDKENTRY *entry = alphalist->entryField;
char *current = 0;
if (scrollp->listSize > 0)
{
char *current;
/* Adjust the scrolling list. */
injectMyScroller (alphalist, key);
......@@ -743,17 +743,10 @@ static int completeWordCB (EObjectType objectType GCC_UNUSED, void *object GCC_U
CDKALPHALIST *alphalist = (CDKALPHALIST *)clientData;
CDKENTRY *entry = (CDKENTRY *)alphalist->entryField;
CDKSCROLL *scrollp = 0;
int currentIndex = 0;
int wordLength = 0;
int selected = -1;
int altCount = 0;
int height = 0;
int match = 0;
int Index = 0;
int ret = 0;
int x = 0;
char **altWords = 0;
unsigned used = 0;
if (entry->info == 0)
{
......@@ -791,9 +784,13 @@ static int completeWordCB (EObjectType objectType GCC_UNUSED, void *object GCC_U
ret = strncmp (alphalist->list[Index + 1], entry->info, (size_t) wordLength);
if (ret == 0)
{
/* *INDENT-EQLS* */
currentIndex = Index;
altCount = 0;
int currentIndex = Index;
int altCount = 0;
unsigned used = 0;
int selected;
int height;
int match;
int x;
/* Start looking for alternate words. */
/* FIXME: bsearch would be more suitable */
......
......@@ -2,8 +2,8 @@
/*
* $Author: tom $
* $Date: 2013/06/16 15:00:10 $
* $Revision: 1.67 $
* $Date: 2016/11/20 18:41:25 $
* $Revision: 1.68 $
*/
DeclareCDKObjects (BUTTONBOX, Buttonbox, setCdk, Int);
......@@ -217,7 +217,6 @@ static int _injectCDKButtonbox (CDKOBJS *object, chtype input)
{
/* *INDENT-EQLS* */
CDKBUTTONBOX *widget = (CDKBUTTONBOX *)object;
int firstButton = 0;
int lastButton = widget->buttonCount - 1;
int ppReturn = 1;
int ret = unknownInt;
......@@ -246,6 +245,8 @@ static int _injectCDKButtonbox (CDKOBJS *object, chtype input)
}
else
{
int firstButton = 0;
switch (input)
{
case KEY_LEFT:
......
......@@ -2,8 +2,8 @@
/*
* $Author: tom $
* $Date: 2012/03/23 13:54:44 $
* $Revision: 1.98 $
* $Date: 2016/11/20 20:06:42 $
* $Revision: 1.99 $
*/
#define YEAR2INDEX(year) (((year) >= 1900) ? ((year) - 1900) : (year))
......@@ -102,6 +102,7 @@ CDKCALENDAR *newCDKCalendar (CDKSCREEN *cdkscreen,
};
/* *INDENT-ON* */
if ((calendar = newCDKObject (CDKCALENDAR, &my_funcs)) == 0)
return (0);
......@@ -501,7 +502,6 @@ static void drawCDKCalendarField (CDKCALENDAR *calendar)
char *monthName = calendar->MonthName[calendar->month];
int monthLength = getMonthLength (calendar->year, calendar->month);
int yearIndex = YEAR2INDEX (calendar->year);
int yearLen = 0;
int day;
int row, col;
int save_y = -1;
......@@ -551,6 +551,8 @@ static void drawCDKCalendarField (CDKCALENDAR *calendar)
/* Draw the month in. */
if (calendar->labelWin != 0)
{
int yearLen = 0;
sprintf (temp, "%s %d,", monthName, calendar->day);
writeChar (calendar->labelWin, 0, 0,
temp, HORIZONTAL, 0, (int)strlen (temp));
......@@ -937,11 +939,11 @@ static void incrementCalendarDay (CDKCALENDAR *calendar, int adjust)
*/
static void decrementCalendarDay (CDKCALENDAR *calendar, int adjust)
{
int monthLength;
/* Make sure we adjust the day correctly. */
if (calendar->day - adjust < 1)
{
int monthLength;
/* Set the day according to the length of the month. */
if (calendar->month == 1)
{
......@@ -954,7 +956,7 @@ static void decrementCalendarDay (CDKCALENDAR *calendar, int adjust)
"Can not go past the year 1900"
};
Beep ();
popupLabel (ScreenOf (calendar), (CDK_CSTRING2) mesg, 2);
popupLabel (ScreenOf (calendar), (CDK_CSTRING2)mesg, 2);
return;
}
monthLength = getMonthLength (calendar->year - 1, 12);
......@@ -1027,7 +1029,7 @@ static void decrementCalendarMonth (CDKCALENDAR *calendar, int adjust)
"Can not go past the year 1900"
};
Beep ();
popupLabel (ScreenOf (calendar), (CDK_CSTRING2) mesg, 2);
popupLabel (ScreenOf (calendar), (CDK_CSTRING2)mesg, 2);
return;
}
else
......@@ -1096,7 +1098,7 @@ static void decrementCalendarYear (CDKCALENDAR *calendar, int adjust)
"Can not go past the year 1900"
};
Beep ();
popupLabel (ScreenOf (calendar), (CDK_CSTRING2) mesg, 2);
popupLabel (ScreenOf (calendar), (CDK_CSTRING2)mesg, 2);
return;
}
......
......@@ -2,8 +2,8 @@
/*
* $Author: tom $
* $Date: 2014/11/05 10:20:13 $
* $Revision: 1.215 $
* $Date: 2016/11/20 18:59:18 $
* $Revision: 1.218 $
*/
#define L_MARKER '<'
......@@ -204,10 +204,11 @@ chtype *copyChtype (const chtype *original)
if (original != 0)
{
int len = chlen (original);
int x;
if ((newstring = typeMallocN (chtype, len + 4)) != 0)
{
int x;
for (x = 0; x < len; x++)
{
newstring[x] = original[x];
......@@ -336,6 +337,20 @@ static int encodeAttribute (const char *string, int from, chtype *mask)
{
from++;
}
else if (isdigit (CharOf (string[from + 1])) &&
isdigit (CharOf (string[from + 2])) &&
isdigit (CharOf (string[from + 3])))
{
#ifdef HAVE_START_COLOR
pair = (DigitOf (string[from + 1]) * 100
+ DigitOf (string[from + 2]) * 10
+ DigitOf (string[from + 3]));
*mask = (chtype)COLOR_PAIR ((pair > 255) ? 255 : pair);
#else
*mask = A_BOLD;
#endif
from += 3;
}
else if (isdigit (CharOf (string[from + 1])) &&
isdigit (CharOf (string[from + 2])))
{
......@@ -464,28 +479,27 @@ chtype *char2Chtype (const char *string, int *to, int *align)
chtype attrib;
chtype lastChar;
chtype mask;
int adjust;
int from;
int insideMarker;
int len;
int pass;
int start;
int used;
int x;
(*to) = 0;
*align = LEFT;
if (string != 0 && *string != 0)
{
len = (int)strlen (string);
used = 0;
int len = (int)strlen (string);
int pass;
int used = 0;
/*
* We make two passes because we may have indents and tabs to expand, and
* do not know in advance how large the result will be.
*/
for (pass = 0; pass < 2; pass++)
{
int insideMarker;
int from;
int adjust;
int start;
int x = 3;
if (pass != 0)
{
if ((result = typeMallocN (chtype, used + 2)) == 0)
......@@ -498,7 +512,6 @@ chtype *char2Chtype (const char *string, int *to, int *align)
attrib = A_NORMAL;
start = 0;
used = 0;
x = 3;
/* Look for an alignment marker. */
if (*string == L_MARKER)
......@@ -844,10 +857,11 @@ char *chtype2Char (const chtype *string)
if (string != 0)
{
int len = chlen (string);
int x;
if ((newstring = typeMallocN (char, len + 1)) != 0)
{
int x;
for (x = 0; x < len; x++)
{
newstring[x] = (char)CharOf (string[x]);
......@@ -916,8 +930,6 @@ void stripWhiteSpace (EStripType stripType, char *string)
{
/* Declare local variables. */
size_t stringLength = 0;
unsigned alphaChar = 0;
unsigned x;
/* Make sure the string is not null. */
if (string != 0
......@@ -926,6 +938,9 @@ void stripWhiteSpace (EStripType stripType, char *string)
/* Strip leading whitespace */
if (stripType == vFRONT || stripType == vBOTH)
{
unsigned alphaChar = 0;
unsigned x;
/* Find the first non-whitespace character. */
while (string[alphaChar] == ' ' || string[alphaChar] == '\t')
{
......@@ -969,18 +984,15 @@ static unsigned countChar (const char *string, int separator)
char **CDKsplitString (const char *string, int separator)
{
char **result = 0;
const char *first;
char *temp;
unsigned item;
unsigned need;
if (string != 0 && *string != 0)
{
need = countChar (string, separator) + 2;
unsigned need = countChar (string, separator) + 2;
if ((result = typeMallocN (char *, need)) != 0)
{
item = 0;
first = string;
unsigned item = 0;
const char *first = string;
for (;;)
{
while (*string != 0 && *string != separator)
......@@ -1241,21 +1253,19 @@ int CDKgetDirectoryContents (const char *directory, char ***list)
*/
int searchList (CDK_CSTRING2 list, int listSize, const char *pattern)
{
/* Declare local variables. */
size_t len;
int Index = -1;
int x, ret;
/* Make sure the pattern isn't null. */
if (pattern != 0)
{
len = strlen (pattern);
size_t len = strlen (pattern);
int x;
/* Cycle through the list looking for the word. */
for (x = 0; x < listSize; x++)
{
/* Do a string compare. */
ret = strncmp (list[x], pattern, len);
int ret = strncmp (list[x], pattern, len);
/*
* If 'ret' is less than 0, then the current word is alphabetically
......@@ -1287,7 +1297,6 @@ int checkForLink (const char *line, char *filename)
{
int len = 0;
int fPos = 0;
int x = 3;
/* Make sure the line isn't null. */
if (line == 0)
......@@ -1299,6 +1308,8 @@ int checkForLink (const char *line, char *filename)
/* Strip out the filename. */
if (line[0] == L_MARKER && line[1] == 'F' && line[2] == '=')
{
int x = 3;
/* Strip out the filename. */
while (x < len)
{
......@@ -1322,15 +1333,17 @@ int checkForLink (const char *line, char *filename)
char *baseName (char *pathname)
{
char *base = 0;
size_t pathLen;
size_t x;
if (pathname != 0
&& *pathname != '\0'
&& (base = copyChar (pathname)) != 0)
{
size_t pathLen;
if ((pathLen = strlen (pathname)) != 0)
{
size_t x;
for (x = pathLen - 1; x != 0; --x)
{
/* Find the last '/' in the pathname. */
......@@ -1353,14 +1366,13 @@ char *dirName (char *pathname)
{
char *dir = 0;
size_t pathLen;
size_t x;
/* Check if the string is null. */
if (pathname != 0
&& (dir = copyChar (pathname)) != 0
&& (pathLen = strlen (pathname)) != 0)
{
x = pathLen;
size_t x = pathLen;
while ((dir[x] != '/') && (x > 0))
{
dir[x--] = '\0';
......
......@@ -4,8 +4,8 @@
* Default method-functions for CDK objects.
*
* $Author: tom $
* $Date: 2012/03/22 00:43:33 $
* $Revision: 1.16 $
* $Date: 2016/11/20 20:07:11 $
* $Revision: 1.17 $
*/
/*
......@@ -99,17 +99,15 @@ int setCdkTitle (CDKOBJS *obj, const char *title, int boxWidth)
if (title != 0)
{
chtype *holder;
char **temp = 0;
int titleWidth;
int x;
int len;
int align;
int maxWidth = 0;
/* We need to split the title on \n. */
temp = CDKsplitString (title, '\n');
obj->titleLines = (int)CDKcountStrings ((CDK_CSTRING2) temp);
obj->titleLines = (int)CDKcountStrings ((CDK_CSTRING2)temp);
obj->title = typeCallocN (chtype *, obj->titleLines + 1);
obj->titlePos = typeCallocN (int, obj->titleLines + 1);
......@@ -117,10 +115,12 @@ int setCdkTitle (CDKOBJS *obj, const char *title, int boxWidth)
if (boxWidth >= 0)
{
int maxWidth = 0;
/* We need to determine the widest title line. */
for (x = 0; x < obj->titleLines; x++)
{
holder = char2Chtype (temp[x], &len, &align);
chtype *holder = char2Chtype (temp[x], &len, &align);
maxWidth = MAXIMUM (maxWidth, len);
freeChtype (holder);
}
......
......@@ -4,8 +4,8 @@
* Useful functions for command-line parsing.
*
* $Author: tom $
* $Date: 2014/11/06 00:56:26 $
* $Revision: 1.11 $
* $Date: 2016/11/20 18:32:53 $
* $Revision: 1.12 $
*/
#define OPTION_ON ((char *)1)
......@@ -111,13 +111,14 @@ void CDKparseParams (int argc,
const char *options)
{
int code;
const char *str;
memset (params, 0, sizeof (*params));
params->Box = TRUE;
while ((code = getopt (argc, argv, options)) != EOF)
{
const char *str;
if (code == '?' || (str = (strchr) (options, code)) == 0)
{
usage (argv, params, options);
......
......@@ -6,8 +6,8 @@
/*
* $Author: tom $
* $Date: 2008/11/01 14:27:23 $
* $Revision: 1.88 $
* $Date: 2016/11/20 20:07:27 $
* $Revision: 1.90 $
*/
typedef struct _all_screens
......@@ -149,10 +149,10 @@ void *_newCDKObject (unsigned size, const CDKFUNCS * funcs)
void _destroyCDKObject (CDKOBJS *obj)
{
ALL_OBJECTS *p, *q;
if (validCDKObject (obj))
{
ALL_OBJECTS *p, *q;
for (p = all_objects, q = 0; p != 0; q = p, p = p->link)
{
if (p->object == obj)
......@@ -234,6 +234,16 @@ void registerCDKObject (CDKSCREEN *screen, EObjectType cdktype, void *object)
}
}
/*