Commit fb16f4df fb16f4dff202b1b0033386c6d2e0169ab35b9103 by Sergey Poznyakoff

Bigfixes.

* configure.ac: Fix checks for readline.  If it is
not present - bail out if it was explicitly requested
and silently disable it otherwise.
Check for dbm_dirfno and dbm_pagfno (see libmu_dbm/ndbm.c,
below).
* examples/mboxidx.c (set_charset_filter): Fix array dimensions.
* lib/python.c (python_done): add missing return statement.
* libmailutils/address/address.c (mu_address_union): Fix size
argument to memset.
* libmailutils/server/msrv.c (mu_m_server_get_hints): Likewise.
* libmu_compat/vartab.c (vardefn_free): Likewise.
* libmailutils/cfg/parser.y (_set_fun): cast enum to size_t before
comparison
* libmailutils/diag/wd.c (mu_wd): fix while loop.
* libmailutils/tests/url-parse.c (main): Fix printf format.
* libmu_dbm/ndbm.c (_ndbm_get_fd): One of dbm_dirfno or
dbm_pagfno may be missing (on FreeBSD, dbm_pagfno expands
to a non-defined macro, which produces compilation error.
* mail/mailvar.c (mailvar_varptr_comp): Remove.
(mailvar_list_copy): Use mailvar_variable_comp instead
of the removed mailvar_varptr_comp.
1 parent 30bc0edd
......@@ -93,6 +93,7 @@ status_mysql=no
status_pgsql=no
status_ldap=no
status_tcpwrap=maybe
status_readline=probe
dnl Internationalization macros.
AM_GNU_GETTEXT([external], [need-ngettext])
......@@ -240,10 +241,10 @@ AC_ARG_WITH([readline],
[do not use readline]),
[
case "${withval}" in
yes) usereadline=yes ;;
no) usereadline=no ;;
yes) status_readline=yes ;;
no) status_readline=no ;;
*) AC_MSG_ERROR(bad value ${withval} for --without-readline) ;;
esac],[usereadline=yes])
esac],[status_readline=probe])
AC_SUBST(SERV_AUTHLIBS)
AC_SUBST(SERV_AUTHINCS)
......@@ -560,6 +561,10 @@ check_dbm_impl() {
if test $has_ndbm = yes; then
AC_DEFINE(WITH_NDBM,1,[Enable use of NDBM])
status_dbm="$status_dbm,NDBM"
save_LIBS=$LIBS
LIBS="$LIBS $DBMLIBS"
AC_CHECK_FUNCS(dbm_dirfno dbm_pagfno)
LIBS=$save_LIBS
fi
;;
......@@ -1107,17 +1112,24 @@ AC_SUBST(CURSES_LIBS)
dnl Check for GNU Readline
AC_SUBST(READLINE_LIBS)
if test "$usereadline" = "yes"; then
if test "$status_readline" != "no"; then
dnl FIXME This should only link in the curses libraries if it's
dnl really needed!
saved_LIBS=$LIBS
LIBS="$LIBS $CURSES_LIBS"
AC_CHECK_LIB(readline, readline, mu_have_readline=yes)
AC_CHECK_LIB(readline, readline,
[status_readline=yes],
[if test "$status_readline" = "yes"; then
AC_MSG_ERROR(readline requested but does not seem to be installed)
else
status_readline=no
fi
])
LIBS=$saved_LIBS
if test "$mu_have_readline" = "yes"; then
if test "$status_readline" = "yes"; then
AC_CHECK_HEADERS(readline/readline.h,
AC_DEFINE(WITH_READLINE,1,[Enable use of readline]))
READLINE_LIBS="-lreadline $CURSES_LIBS"
......@@ -1125,13 +1137,12 @@ if test "$usereadline" = "yes"; then
LIBS="$LIBS $READLINE_LIBS"
AC_CHECK_FUNCS(rl_completion_matches)
LIBS=$saved_LIBS
else
AC_MSG_WARN(readline requested but does not seem to be installed)
fi
else
status_readline=no
fi
AM_CONDITIONAL([MU_COND_READLINE], [test "$usereadline" = "yes"])
AM_CONDITIONAL([MU_COND_READLINE], [test "$status_readline" = "yes"])
AH_BOTTOM([
/* Newer versions of readline have rl_completion_matches */
......@@ -1424,7 +1435,7 @@ status_python=$status_python
status_cxx=$mu_cv_enable_cxx
status_tcpwrap=$status_tcpwrap
status_pthread=$usepthread
status_readline=$usereadline
status_readline=$status_readline
status_mysql=$status_mysql
status_pgsql=$status_pgsql
status_radius=$mu_cv_enable_radius
......@@ -1528,3 +1539,6 @@ AC_CONFIG_FILES([
])
AC_OUTPUT
dnl Local Variables:
dnl mode: autoconf
dnl End:
......
......@@ -124,7 +124,7 @@ static int
set_charset_filter (mu_stream_t * str, char *input_charset)
{
int rc;
char const *args[4];
char const *args[5];
mu_stream_t b_stream = *str;
......
......@@ -32,6 +32,7 @@ static int
python_done (mu_script_descr_t descr)
{
free (descr);
return 0;
}
static int
......@@ -56,7 +57,7 @@ python_proc (mu_script_descr_t descr, mu_message_t msg)
data[0].attrs = dict;
dict[1].name = NULL;
mu_py_script_run ((char*)descr, data);
mu_py_script_run ((char*)descr, data);
mu_py_script_finish ();
return 0;
}
......
......@@ -788,7 +788,7 @@ mu_address_union (mu_address_t *a, mu_address_t b)
if (rc)
{
_address_free (last);
memset (last, 0, sizeof (last));
memset (last, 0, sizeof (*last));
return rc;
}
}
......
......@@ -1170,7 +1170,7 @@ _set_fun (void *item, void *data)
void *tgt;
size_t size;
if (clos->type >= MU_ARRAY_SIZE(config_type_size)
if ((size_t) clos->type >= MU_ARRAY_SIZE(config_type_size)
|| (size = config_type_size[clos->type]) == 0)
{
mu_diag_at_locus (MU_LOG_EMERG, clos->locus,
......
......@@ -49,7 +49,7 @@ mu_wd (unsigned to)
if (to)
{
_count_down = to;
while (_count_down--);
while (_count_down--)
{
sleep (1);
}
......
......@@ -391,7 +391,7 @@ mu_m_server_get_hints (mu_m_server_t srv, struct mu_sockaddr_hints *hints)
{
if (!hints)
return EINVAL;
memcpy (hints, &srv->hints, sizeof (hints));
memcpy (hints, &srv->hints, sizeof (*hints));
return 0;
}
......
......@@ -164,7 +164,7 @@ main (int argc, char **argv)
mu_error ("cannot get %s: %s", "port", mu_strerror (rc));
exit (1);
}
printf ("port %hu\n", port);
printf ("port %u\n", port);
GET_AND_PRINT (path, u, buf, rc);
print_fvpairs (u);
......
......@@ -75,7 +75,7 @@ vardefn_free (struct vardefn *vd)
else if (!(vd->flags & MU_VARDEFN_STATIC))
free (vd->value);
}
memset (vd, 0, sizeof vd);
memset (vd, 0, sizeof *vd);
}
int
......
......@@ -55,6 +55,24 @@ _ndbm_file_safety (mu_dbm_file_t db, int mode, uid_t owner)
return rc;
}
#ifndef HAVE_DBM_PAGFNO
# ifdef HAVE_DBM_DIRFNO
# undef dbm_pagfno
# define dbm_pagfno dbm_dirfno
# else
# error "neither dbm_pagfno nor dbm_dirfno available"
# endif
#endif
#ifndef HAVE_DBM_DIRFNO
# ifdef HAVE_DBM_PAGFNO
# undef dbm_dirfno
# define dbm_dirfno dbm_pagfno
# else
# error "neither dbm_pagfno nor dbm_dirfno available"
# endif
#endif
int
_ndbm_get_fd (mu_dbm_file_t db, int *pag, int *dir)
{
......
......@@ -343,15 +343,6 @@ mailvar_variable_comp (const void *a, const void *b)
return strcmp (v1->name, v2->name);
}
static int
mailvar_varptr_comp (const void *a, const void *b)
{
const struct mailvar_variable const * v1 = a;
const struct mailvar_variable const *v2 = b;
return strcmp (v1->name, v2->name);
}
/* Find mailvar_list entry VAR. If not found and CREATE is not NULL, then
create the (unset and untyped) variable */
struct mailvar_variable *
......@@ -631,7 +622,7 @@ mailvar_list_copy (int set)
if (!list)
mu_list_create (&list);
_mailvar_symbol_to_list (set, list);
mu_list_sort (list, mailvar_varptr_comp);
mu_list_sort (list, mailvar_variable_comp);
return list;
}
......