diff -urN elmo-0.8/aclocal.m4 elmo-0.8.1/aclocal.m4 --- elmo-0.8/aclocal.m4 2003-07-01 11:56:50.000000000 +0200 +++ elmo-0.8.1/aclocal.m4 2003-07-21 17:22:17.000000000 +0200 @@ -851,30 +851,45 @@ LEX=${am_missing_run}flex fi]) -# Macro to add for using GNU gettext. -# Ulrich Drepper , 1995. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU General Public -# License or the GNU Library General Public License but which still want -# to provide support for the GNU gettext functionality. -# Please note that the actual code of the GNU gettext library is covered -# by the GNU Library General Public License, and the rest of the GNU -# gettext package package is covered by the GNU General Public License. -# They are *not* in the public domain. - -# serial 10 - -dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]). -dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library +# gettext.m4 serial 17 (gettext-0.11.5) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2002. + +dnl Macro to add for using GNU gettext. + +dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). +dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The +dnl default (if it is not specified or empty) is 'no-libtool'. +dnl INTLSYMBOL should be 'external' for packages with no intl directory, +dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. +dnl If INTLSYMBOL is 'use-libtool', then a libtool library dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, dnl depending on --{enable,disable}-{shared,static} and on the presence of -dnl AM-DISABLE-SHARED). Otherwise, a static library +dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library dnl $(top_builddir)/intl/libintl.a will be created. dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext dnl implementations (in libc or libintl) without the ngettext() function -dnl will be ignored. -dnl LIBDIR is used to find the intl libraries. If empty, +dnl will be ignored. If NEEDSYMBOL is specified and is +dnl 'need-formatstring-macros', then GNU gettext implementations that don't +dnl support the ISO C 99 formatstring macros will be ignored. +dnl INTLDIR is used to find the intl libraries. If empty, dnl the value `$(top_builddir)/intl/' is used. dnl dnl The result of the configuration is one of three cases: @@ -888,29 +903,68 @@ dnl 3) No internationalization, always use English msgid. dnl Catalog format: none dnl Catalog extension: none +dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. dnl The use of .gmo is historical (it was needed to avoid overwriting the dnl GNU format catalogs when building on a platform with an X/Open gettext), dnl but we keep it in order not to force irrelevant filename changes on the dnl maintainers. dnl -AC_DEFUN([AM_WITH_NLS], - [AC_MSG_CHECKING([whether NLS is requested]) - dnl Default is enabled NLS - AC_ARG_ENABLE(nls, - [ --disable-nls do not use Native Language Support], - USE_NLS=$enableval, USE_NLS=yes) - AC_MSG_RESULT($USE_NLS) - AC_SUBST(USE_NLS) +AC_DEFUN([AM_GNU_GETTEXT], +[ + dnl Argument checking. + ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , + [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT +])])])])]) + ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , + [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT +])])])]) + define(gt_included_intl, ifelse([$1], [external], [no], [yes])) + define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) + + AC_REQUIRE([AM_PO_SUBDIRS])dnl + ifelse(gt_included_intl, yes, [ + AC_REQUIRE([AM_INTL_SUBDIR])dnl + ]) + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Sometimes libintl requires libiconv, so first search for libiconv. + dnl Ideally we would do this search only after the + dnl if test "$USE_NLS" = "yes"; then + dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then + dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT + dnl the configure script would need to contain the same shell code + dnl again, outside any 'if'. There are two solutions: + dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. + dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. + dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not + dnl documented, we avoid it. + ifelse(gt_included_intl, yes, , [ + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + ]) + + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) + + ifelse(gt_included_intl, yes, [ BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no - INTLLIBS= - - dnl If we use NLS figure out what method - if test "$USE_NLS" = "yes"; then - AC_DEFINE(ENABLE_NLS, 1, - [Define to 1 if translation of program messages to the user's native language - is requested.]) + ]) + LIBINTL= + LTLIBINTL= + POSUB= + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + ifelse(gt_included_intl, yes, [ AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH(included-gettext, [ --with-included-gettext use the GNU gettext library included here], @@ -920,214 +974,177 @@ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + ]) dnl User does not insist on using GNU NLS library. Figure out what dnl to use. If GNU gettext is available we use this. Else we have dnl to fall back to GNU NLS library. - CATOBJEXT=NONE dnl Add a version number to the cache macros. - define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc]) - define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl]) + define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) + define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) + define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) + + AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, + [AC_TRY_LINK([#include +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings;], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], + gt_cv_func_gnugettext_libc=yes, + gt_cv_func_gnugettext_libc=no)]) + + if test "$gt_cv_func_gnugettext_libc" != "yes"; then + dnl Sometimes libintl requires libiconv, so first search for libiconv. + ifelse(gt_included_intl, yes, , [ + AM_ICONV_LINK + ]) + dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL + dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) + dnl because that would add "-liconv" to LIBINTL and LTLIBINTL + dnl even if libiconv doesn't exist. + AC_LIB_LINKFLAGS_BODY([intl]) + AC_CACHE_CHECK([for GNU gettext in libintl], + gt_cv_func_gnugettext_libintl, + [gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + dnl Now see whether libintl exists and does not depend on libiconv. + AC_TRY_LINK([#include +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias ();], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], + gt_cv_func_gnugettext_libintl=yes, + gt_cv_func_gnugettext_libintl=no) + dnl Now see whether libintl exists and depends on libiconv. + if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias ();], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], + [LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + gt_cv_func_gnugettext_libintl=yes + ]) + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS"]) + fi - AC_CHECK_HEADER(libintl.h, - [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, - [AC_TRY_LINK([#include -extern int _nl_msg_cat_cntr;], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], - gt_cv_func_gnugettext_libc=yes, - gt_cv_func_gnugettext_libc=no)]) - - if test "$gt_cv_func_gnugettext_libc" != "yes"; then - AC_CACHE_CHECK([for GNU gettext in libintl], - gt_cv_func_gnugettext_libintl, - [gt_save_LIBS="$LIBS" - LIBS="$LIBS -lintl $LIBICONV" - AC_TRY_LINK([#include -extern int _nl_msg_cat_cntr;], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], - gt_cv_func_gnugettext_libintl=yes, - gt_cv_func_gnugettext_libintl=no) - LIBS="$gt_save_LIBS"]) - fi - - dnl If an already present or preinstalled GNU gettext() is found, - dnl use it. But if this macro is used in GNU gettext, and GNU - dnl gettext is already preinstalled in libintl, we update this - dnl libintl. (Cf. the install rule in intl/Makefile.in.) - if test "$gt_cv_func_gnugettext_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ - && test "$PACKAGE" != gettext; }; then - AC_DEFINE(HAVE_GETTEXT, 1, - [Define if the GNU gettext() function is already present or preinstalled.]) - - if test "$gt_cv_func_gnugettext_libintl" = "yes"; then - dnl If iconv() is in a separate libiconv library, then anyone - dnl linking with libintl{.a,.so} also needs to link with - dnl libiconv. - INTLLIBS="-lintl $LIBICONV" - fi - - gt_save_LIBS="$LIBS" - LIBS="$LIBS $INTLLIBS" - AC_CHECK_FUNCS(dcgettext) - LIBS="$gt_save_LIBS" - - dnl Search for GNU msgfmt in the PATH. - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - - dnl Search for GNU xgettext in the PATH. - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) - - CATOBJEXT=.gmo - fi - ]) - - if test "$CATOBJEXT" = "NONE"; then - dnl GNU gettext is not found in the C library. - dnl Fall back on GNU gettext library. - nls_cv_use_gnu_gettext=yes + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if test "$gt_cv_func_gnugettext_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ + && test "$PACKAGE" != gettext; }; then + gt_use_preinstalled_gnugettext=yes + else + dnl Reset the values set by searching for libintl. + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + ifelse(gt_included_intl, yes, [ + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + dnl GNU gettext is not found in the C library. + dnl Fall back on included GNU gettext library. + nls_cv_use_gnu_gettext=yes fi fi if test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions used to generate GNU NLS library. INTLOBJS="\$(GETTOBJS)" - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) - AC_SUBST(MSGFMT) - BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" + LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions to use GNU gettext tools. CATOBJEXT=.gmo - INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi + ]) - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU msgfmt. - if test "$GMSGFMT" != ":"; then - dnl If it is no GNU msgfmt we define it as : so that the - dnl Makefiles still can work. - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then - : ; - else - AC_MSG_RESULT( - [found msgfmt program is not GNU msgfmt; ignore it]) - GMSGFMT=":" - fi - fi - - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU xgettext. - if test "$XGETTEXT" != ":"; then - dnl If it is no GNU xgettext we define it as : so that the - dnl Makefiles still can work. - if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then - : ; - else - AC_MSG_RESULT( - [found xgettext program is not GNU xgettext; ignore it]) - XGETTEXT=":" - fi - fi - - dnl We need to process the po/ directory. - POSUB=po - fi - AC_OUTPUT_COMMANDS( - [for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - fi - ;; - esac - done]) + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + AC_DEFINE(ENABLE_NLS, 1, + [Define to 1 if translation of program messages to the user's native language + is requested.]) + else + USE_NLS=no + fi + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext_libintl" = "yes"; then + AC_MSG_CHECKING([how to link with libintl]) + AC_MSG_RESULT([$LIBINTL]) + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) + fi + + dnl For backward compatibility. Some packages may be using this. + AC_DEFINE(HAVE_GETTEXT, 1, + [Define if the GNU gettext() function is already present or preinstalled.]) + AC_DEFINE(HAVE_DCGETTEXT, 1, + [Define if the GNU dcgettext() function is already present or preinstalled.]) + fi + dnl We need to process the po/ directory. + POSUB=po + fi + ifelse(gt_included_intl, yes, [ dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL dnl to 'yes' because some of the testsuite requires it. if test "$PACKAGE" = gettext; then BUILD_INCLUDED_LIBINTL=yes fi - dnl intl/plural.c is generated from intl/plural.y. It requires bison, - dnl because plural.y uses bison specific features. It requires at least - dnl bison-1.26 because earlier versions generate a plural.c that doesn't - dnl compile. - dnl bison is only needed for the maintainer (who touches plural.y). But in - dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put - dnl the rule in general Makefile. Now, some people carelessly touch the - dnl files or have a broken "make" program, hence the plural.c rule will - dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not - dnl present or too old. - AC_CHECK_PROGS([INTLBISON], [bison]) - if test -z "$INTLBISON"; then - ac_verc_fail=yes - else - dnl Found it, now check the version. - AC_MSG_CHECKING([version of bison]) -changequote(<<,>>)dnl - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) -changequote([,])dnl - ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; - *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; - esac - AC_MSG_RESULT([$ac_prog_version]) - fi - if test $ac_verc_fail = yes; then - INTLBISON=: - fi - - dnl These rules are solely for the distribution goal. While doing this - dnl we only have to keep exactly one list of the available catalogs - dnl in configure.in. - for lang in $ALL_LINGUAS; do - GMOFILES="$GMOFILES $lang.gmo" - POFILES="$POFILES $lang.po" - done - dnl Make all variables we use known to autoconf. AC_SUBST(BUILD_INCLUDED_LIBINTL) AC_SUBST(USE_INCLUDED_LIBINTL) - AC_SUBST(CATALOGS) AC_SUBST(CATOBJEXT) - AC_SUBST(GMOFILES) - AC_SUBST(INTLLIBS) AC_SUBST(INTLOBJS) - AC_SUBST(POFILES) - AC_SUBST(POSUB) dnl For backward compatibility. Some configure.ins may be using this. nls_cv_header_intl= @@ -1144,97 +1161,1211 @@ dnl For backward compatibility. Some Makefiles may be using this. GENCAT=gencat AC_SUBST(GENCAT) + + dnl Enable libtool support if the surrounding package wishes it. + INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix + AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) ]) -dnl Usage: Just like AM_WITH_NLS, which see. -AC_DEFUN([AM_GNU_GETTEXT], - [AC_REQUIRE([AC_PROG_MAKE_SET])dnl - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - AC_REQUIRE([AC_PROG_RANLIB])dnl - AC_REQUIRE([AC_ISC_POSIX])dnl - AC_REQUIRE([AC_HEADER_STDC])dnl - AC_REQUIRE([AC_C_CONST])dnl - AC_REQUIRE([AC_C_INLINE])dnl - AC_REQUIRE([AC_TYPE_OFF_T])dnl - AC_REQUIRE([AC_TYPE_SIZE_T])dnl - AC_REQUIRE([AC_FUNC_ALLOCA])dnl - AC_REQUIRE([AC_FUNC_MMAP])dnl - AC_REQUIRE([jm_GLIBC21])dnl + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" + AC_SUBST(INTLLIBS) + + dnl Make all documented variables known to autoconf. + AC_SUBST(LIBINTL) + AC_SUBST(LTLIBINTL) + AC_SUBST(POSUB) +]) + + +dnl Checks for all prerequisites of the po subdirectory, +dnl except for USE_NLS. +AC_DEFUN([AM_PO_SUBDIRS], +[ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. + dnl The second test excludes FreeBSD msgfmt. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + dnl Search for GNU xgettext 0.11 or newer in the PATH. + dnl The first test excludes Solaris xgettext and early GNU xgettext versions. + dnl The second test excludes FreeBSD xgettext. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU msgfmt. + if test "$GMSGFMT" != ":"; then + dnl If it is no GNU msgfmt we define it as : so that the + dnl Makefiles still can work. + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && + (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` + AC_MSG_RESULT( + [found $GMSGFMT program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + fi + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && + (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + fi + + AC_OUTPUT_COMMANDS([ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + fi + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + GMOFILES= + UPDATEPOFILES= + DUMMYPOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done], + [# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it + # from automake. + eval 'ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) +]) + - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +dnl Checks for all prerequisites of the intl subdirectory, +dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, +dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. +AC_DEFUN([AM_INTL_SUBDIR], +[ + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([AC_C_INLINE])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([jm_GLIBC21])dnl + AC_REQUIRE([gt_INTDIV0])dnl + AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl + AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl + AC_REQUIRE([gt_INTTYPES_PRI])dnl + + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ stdlib.h string.h unistd.h sys/param.h]) - AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ -getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ -strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) - - AM_ICONV - AM_LANGINFO_CODESET - AM_LC_MESSAGES - AM_WITH_NLS([$1],[$2],[$3]) - - if test "x$CATOBJEXT" != "x"; then - if test "x$ALL_LINGUAS" = "x"; then - LINGUAS= - else - AC_MSG_CHECKING(for catalogs to be installed) - NEW_LINGUAS= - for presentlang in $ALL_LINGUAS; do - useit=no - for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - NEW_LINGUAS="$NEW_LINGUAS $presentlang" - fi - done - LINGUAS=$NEW_LINGUAS - AC_MSG_RESULT($LINGUAS) - fi - - dnl Construct list of names of catalog files to be constructed. - if test -n "$LINGUAS"; then - for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done - fi - fi - - dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly - dnl find the mkinstalldirs script in another subdir but $(top_srcdir). - dnl Try to locate is. - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - AC_SUBST(MKINSTALLDIRS) - - dnl Enable libtool support if the surrounding package wishes it. - INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) - AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) + AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ +geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ +strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) + + AM_ICONV + AM_LANGINFO_CODESET + if test $ac_cv_header_locale_h = yes; then + AM_LC_MESSAGES + fi + + dnl intl/plural.c is generated from intl/plural.y. It requires bison, + dnl because plural.y uses bison specific features. It requires at least + dnl bison-1.26 because earlier versions generate a plural.c that doesn't + dnl compile. + dnl bison is only needed for the maintainer (who touches plural.y). But in + dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put + dnl the rule in general Makefile. Now, some people carelessly touch the + dnl files or have a broken "make" program, hence the plural.c rule will + dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not + dnl present or too old. + AC_CHECK_PROGS([INTLBISON], [bison]) + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + dnl Found it, now check the version. + AC_MSG_CHECKING([version of bison]) +changequote(<<,>>)dnl + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) +changequote([,])dnl + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + AC_MSG_RESULT([$ac_prog_version]) + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + fi +]) + + +AC_DEFUN([AM_MKINSTALLDIRS], +[ + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but $(top_srcdir). + dnl Try to locate is. + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) +]) + + +dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) + +# lib-prefix.m4 serial 1 (gettext-0.11) +dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" ]) + AC_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) -# Search path for a program which passes the given test. -# Ulrich Drepper , 1996. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU General Public -# License or the GNU Library General Public License but which still want -# to provide support for the GNU gettext functionality. -# Please note that the actual code of the GNU gettext library is covered -# by the GNU Library General Public License, and the rest of the GNU -# gettext package package is covered by the GNU General Public License. -# They are *not* in the public domain. +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +]) + +# lib-link.m4 serial 3 (gettext-0.11.3) +dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and +dnl augments the CPPFLAGS variable. +AC_DEFUN([AC_LIB_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + ac_cv_lib[]Name[]_libs="$LIB[]NAME" + ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" + ac_cv_lib[]Name[]_cppflags="$INC[]NAME" + ]) + LIB[]NAME="$ac_cv_lib[]Name[]_libs" + LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" + INC[]NAME="$ac_cv_lib[]Name[]_cppflags" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the + dnl results of this search when this library appears as a dependency. + HAVE_LIB[]NAME=yes + undefine([Name]) + undefine([NAME]) +]) + +dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) +dnl searches for libname and the libraries corresponding to explicit and +dnl implicit dependencies, together with the specified include files and +dnl the ability to compile and link the specified testcode. If found, it +dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and +dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and +dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs +dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. +AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + + dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + + dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, + dnl because if the user has installed lib[]Name and not disabled its use + dnl via --without-lib[]Name-prefix, he wants to use it. + ac_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + + AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ + ac_save_LIBS="$LIBS" + LIBS="$LIBS $LIB[]NAME" + AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) + LIBS="$ac_save_LIBS" + ]) + if test "$ac_cv_lib[]Name" = yes; then + HAVE_LIB[]NAME=yes + AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) + AC_MSG_CHECKING([how to link with lib[]$1]) + AC_MSG_RESULT([$LIB[]NAME]) + else + HAVE_LIB[]NAME=no + dnl If $LIB[]NAME didn't lead to a usable library, we don't need + dnl $INC[]NAME either. + CPPFLAGS="$ac_save_CPPFLAGS" + LIB[]NAME= + LTLIB[]NAME= + fi + AC_SUBST([HAVE_LIB]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + undefine([Name]) + undefine([NAME]) +]) + +dnl Determine the platform dependent parameters needed to use rpath: +dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, +dnl hardcode_direct, hardcode_minus_L, +dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec. +AC_DEFUN([AC_LIB_RPATH], +[ + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" + sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE(rpath, + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_ARG_WITH([lib$1-prefix], +[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib + --without-lib$1-prefix don't search for lib$1 in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) + +# lib-ld.m4 serial 1 (gettext-0.11) +dnl Copyright (C) 1996-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl Subroutines of libtool.m4, +dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision +dnl with libtool.m4. + +dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + acl_cv_prog_gnu_ld=yes +else + acl_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$acl_cv_prog_gnu_ld +]) + +dnl From libtool-1.4. Sets the variable LD. +AC_DEFUN([AC_LIB_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + [re_direlt='/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(acl_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$acl_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_LIB_PROG_LD_GNU +]) + +# iconv.m4 serial AM4 (gettext-0.11.3) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST(LIBICONV) + AC_SUBST(LTLIBICONV) +]) + +AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi +]) + +# progtest.m4 serial 2 (gettext-0.10.40) +dnl Copyright (C) 1996-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. -# serial 2 +dnl Authors: +dnl Ulrich Drepper , 1996. + +# Search path for a program which passes the given test. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) @@ -1274,7 +2405,16 @@ AC_SUBST($1)dnl ]) -#serial 1 +# isc-posix.m4 serial 2 (gettext-0.11.2) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. + # This test replaces the one in autoconf. # Currently this macro should have the same name as the autoconf macro # because gettext's gettext.m4 (distributed in the automake package) @@ -1292,7 +2432,13 @@ ] ) -#serial 2 +# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. # Test for the GNU C Library, version 2.1 or newer. # From Bruno Haible. @@ -1319,77 +2465,259 @@ ] ) -#serial AM2 +# intdiv0.m4 serial 1 (gettext-0.11.3) +dnl Copyright (C) 2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. -AC_DEFUN([AM_ICONV], +AC_DEFUN([gt_INTDIV0], [ - dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and - dnl those with the standalone portable GNU libiconv installed). - - AC_ARG_WITH([libiconv-prefix], -[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ - for dir in `echo "$withval" | tr : ' '`; do - if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi - if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi - done - ]) + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl - AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - AC_TRY_LINK([#include -#include ], - [iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);], - am_cv_func_iconv=yes) - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS -liconv" - AC_TRY_LINK([#include -#include ], - [iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);], - am_cv_lib_iconv=yes - am_cv_func_iconv=yes) - LIBS="$am_save_LIBS" - fi - ]) - if test "$am_cv_func_iconv" = yes; then - AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) - AC_MSG_CHECKING([for iconv declaration]) - AC_CACHE_VAL(am_cv_proto_iconv, [ - AC_TRY_COMPILE([ + AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], + gt_cv_int_divbyzero_sigfpe, + [ + AC_TRY_RUN([ #include -#include -extern +#include + +static void #ifdef __cplusplus -"C" -#endif -#if defined(__STDC__) || defined(__cplusplus) -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +sigfpe_handler (int sig) #else -size_t iconv(); +sigfpe_handler (sig) int sig; #endif -], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) - am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - AC_MSG_RESULT([$]{ac_t:- - }[$]am_cv_proto_iconv) - AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, - [Define as const if the declaration of iconv() needs const.]) +{ + /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ + exit (sig != SIGFPE); +} + +int x = 1; +int y = 0; +int z; +int nan; + +int main () +{ + signal (SIGFPE, sigfpe_handler); +/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ +#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) + signal (SIGTRAP, sigfpe_handler); +#endif +/* Linux/SPARC yields signal SIGILL. */ +#if defined (__sparc__) && defined (__linux__) + signal (SIGILL, sigfpe_handler); +#endif + + z = x / y; + nan = y / y; + exit (1); +} +], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, + [ + # Guess based on the CPU. + case "$host_cpu" in + alpha* | i[34567]86 | m68k | s390*) + gt_cv_int_divbyzero_sigfpe="guessing yes";; + *) + gt_cv_int_divbyzero_sigfpe="guessing no";; + esac + ]) + ]) + case "$gt_cv_int_divbyzero_sigfpe" in + *yes) value=1;; + *) value=0;; + esac + AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, + [Define if integer division by zero raises signal SIGFPE.]) +]) + +# uintmax_t.m4 serial 6 (gettext-0.11) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +AC_PREREQ(2.13) + +# Define uintmax_t to `unsigned long' or `unsigned long long' +# if does not exist. + +AC_DEFUN([jm_AC_TYPE_UINTMAX_T], +[ + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_HEADER_STDINT_H]) + if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then + AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) + test $ac_cv_type_unsigned_long_long = yes \ + && ac_type='unsigned long long' \ + || ac_type='unsigned long' + AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, + [Define to unsigned long or unsigned long long + if and don't define.]) fi - LIBICONV= - if test "$am_cv_lib_iconv" = yes; then - LIBICONV="-liconv" +]) + +# inttypes_h.m4 serial 4 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, +# doesn't clash with , and declares uintmax_t. + +AC_DEFUN([jm_AC_HEADER_INTTYPES_H], +[ + AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, + [AC_TRY_COMPILE( + [#include +#include ], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_inttypes_h=yes, + jm_ac_cv_header_inttypes_h=no)]) + if test $jm_ac_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, +[Define if exists, doesn't clash with , + and declares uintmax_t. ]) + fi +]) + +# stdint_h.m4 serial 2 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_STDINT_H_WITH_UINTMAX if exists, +# doesn't clash with , and declares uintmax_t. + +AC_DEFUN([jm_AC_HEADER_STDINT_H], +[ + AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h, + [AC_TRY_COMPILE( + [#include +#include ], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_stdint_h=yes, + jm_ac_cv_header_stdint_h=no)]) + if test $jm_ac_cv_header_stdint_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, +[Define if exists, doesn't clash with , + and declares uintmax_t. ]) + fi +]) + +# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40) +dnl Copyright (C) 1999-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG], +[ + AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, + [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], + [unsigned long long ullmax = (unsigned long long) -1; + return ull << i | ull >> i | ullmax / ull | ullmax % ull;], + ac_cv_type_unsigned_long_long=yes, + ac_cv_type_unsigned_long_long=no)]) + if test $ac_cv_type_unsigned_long_long = yes; then + AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, + [Define if you have the unsigned long long type.]) + fi +]) + +# inttypes.m4 serial 1 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H if exists and doesn't clash with +# . + +AC_DEFUN([gt_HEADER_INTTYPES_H], +[ + AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, + [ + AC_TRY_COMPILE( + [#include +#include ], + [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) + ]) + if test $gt_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, + [Define if exists and doesn't clash with .]) + fi +]) + +# inttypes-pri.m4 serial 1 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +# Define PRI_MACROS_BROKEN if exists and defines the PRI* +# macros to non-string values. This is the case on AIX 4.3.3. + +AC_DEFUN([gt_INTTYPES_PRI], +[ + AC_REQUIRE([gt_HEADER_INTTYPES_H]) + if test $gt_cv_header_inttypes_h = yes; then + AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], + gt_cv_inttypes_pri_broken, + [ + AC_TRY_COMPILE([#include +#ifdef PRId32 +char *p = PRId32; +#endif +], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) + ]) + fi + if test "$gt_cv_inttypes_pri_broken" = yes; then + AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, + [Define if exists and defines unusable PRI* macros.]) fi - AC_SUBST(LIBICONV) ]) -#serial AM1 +# codeset.m4 serial AM1 (gettext-0.10.40) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. @@ -1407,28 +2735,36 @@ fi ]) -# Check whether LC_MESSAGES is available in . -# Ulrich Drepper , 1995. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU General Public -# License or the GNU Library General Public License but which still want -# to provide support for the GNU gettext functionality. -# Please note that the actual code of the GNU gettext library is covered -# by the GNU Library General Public License, and the rest of the GNU -# gettext package package is covered by the GNU General Public License. -# They are *not* in the public domain. +# lcmessage.m4 serial 3 (gettext-0.11.3) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. -# serial 2 +dnl Authors: +dnl Ulrich Drepper , 1995. + +# Check whether LC_MESSAGES is available in . AC_DEFUN([AM_LC_MESSAGES], - [if test $ac_cv_header_locale_h = yes; then - AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, - [AC_TRY_LINK([#include ], [return LC_MESSAGES], +[ + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) - if test $am_cv_val_LC_MESSAGES = yes; then - AC_DEFINE(HAVE_LC_MESSAGES, 1, - [Define if your file defines LC_MESSAGES.]) - fi - fi]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, + [Define if your file defines LC_MESSAGES.]) + fi +]) diff -urN elmo-0.8/config.h.in elmo-0.8.1/config.h.in --- elmo-0.8/config.h.in 2003-07-01 11:57:19.000000000 +0200 +++ elmo-0.8.1/config.h.in 2003-07-21 17:22:23.000000000 +0200 @@ -28,7 +28,8 @@ /* Define to 1 if you have the header file. */ #undef HAVE_CURSES_H -/* Define to 1 if you have the `dcgettext' function. */ +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ #undef HAVE_DCGETTEXT /* Define to 1 if you have the `feof_unlocked' function. */ @@ -40,6 +41,9 @@ /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD +/* Define to 1 if you have the `getc_unlocked' function. */ +#undef HAVE_GETC_UNLOCKED + /* Define to 1 if you have the `getegid' function. */ #undef HAVE_GETEGID @@ -70,9 +74,13 @@ /* Define if you have the iconv() function. */ #undef HAVE_ICONV -/* Define to 1 if you have the header file. */ +/* Define if exists and doesn't clash with . */ #undef HAVE_INTTYPES_H +/* Define if exists, doesn't clash with , and + declares uintmax_t. */ +#undef HAVE_INTTYPES_H_WITH_UINTMAX + /* Define if you have and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET @@ -127,6 +135,10 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H +/* Define if exists, doesn't clash with , and declares + uintmax_t. */ +#undef HAVE_STDINT_H_WITH_UINTMAX + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -136,9 +148,6 @@ /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP @@ -166,6 +175,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define if you have the unsigned long long type. */ +#undef HAVE_UNSIGNED_LONG_LONG + /* Define to 1 if you have the `vasprintf' function. */ #undef HAVE_VASPRINTF @@ -184,6 +196,9 @@ /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST +/* Define if integer division by zero raises signal SIGFPE. */ +#undef INTDIV0_RAISES_SIGFPE + /* turns off the offensive boundary */ #undef NO_OFFENSIVE_BOUNDARY @@ -205,6 +220,9 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Define if exists and defines unusable PRI* macros. */ +#undef PRI_MACROS_BROKEN + /* The size of a `unsigned', as computed by sizeof. */ #undef SIZEOF_UNSIGNED @@ -241,3 +259,7 @@ /* Define to `unsigned' if does not define. */ #undef size_t + +/* Define to unsigned long or unsigned long long if and + don't define. */ +#undef uintmax_t diff -urN elmo-0.8/configure elmo-0.8.1/configure --- elmo-0.8/configure 2003-07-01 11:56:58.000000000 +0200 +++ elmo-0.8.1/configure 2003-07-21 17:22:29.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for elmo 0.8. +# Generated by GNU Autoconf 2.57 for elmo 0.8.1. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. @@ -266,8 +266,8 @@ # Identity of this package. PACKAGE_NAME='elmo' PACKAGE_TARNAME='elmo' -PACKAGE_VERSION='0.8' -PACKAGE_STRING='elmo 0.8' +PACKAGE_VERSION='0.8.1' +PACKAGE_STRING='elmo 0.8.1' PACKAGE_BUGREPORT='' ac_unique_file="src/elmo.c" @@ -308,7 +308,7 @@ # include #endif" -ac_subst_vars='HAVE_SHORT_NAME SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LEX LEXLIB LEX_OUTPUT_ROOT build build_cpu build_vendor build_os host host_cpu host_vendor host_os RANLIB ac_ct_RANLIB CPP EGREP ALLOCA GLIBC21 LIBICONV USE_NLS MSGFMT GMSGFMT XGETTEXT INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATALOGS CATOBJEXT GMOFILES INTLLIBS INTLOBJS POFILES POSUB DATADIRNAME INSTOBJEXT GENCAT MKINSTALLDIRS INTL_LIBTOOL_SUFFIX_PREFIX INCLUDED_VASPRINTF_TRUE INCLUDED_VASPRINTF_FALSE MAILDIR_SUPPORT_TRUE MAILDIR_SUPPORT_FALSE LIBOBJS LTLIBOBJS' +ac_subst_vars='HAVE_SHORT_NAME SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LEX LEXLIB LEX_OUTPUT_ROOT MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE build build_cpu build_vendor build_os host host_cpu host_vendor host_os RANLIB ac_ct_RANLIB CPP EGREP ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON USE_NLS BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT INTLOBJS DATADIRNAME INSTOBJEXT GENCAT INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB INCLUDED_VASPRINTF_TRUE INCLUDED_VASPRINTF_FALSE MAILDIR_SUPPORT_TRUE MAILDIR_SUPPORT_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -777,7 +777,7 @@ # 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 <<_ACEOF -\`configure' configures elmo 0.8 to adapt to many kinds of systems. +\`configure' configures elmo 0.8.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -843,7 +843,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of elmo 0.8:";; + short | recursive ) echo "Configuration of elmo 0.8.1:";; esac cat <<\_ACEOF @@ -852,6 +852,7 @@ --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors + --disable-rpath do not hardcode runtime library paths --disable-nls do not use Native Language Support --enable-debug additional debugging support --disable-offensive-boundary @@ -861,8 +862,12 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld default=no --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib + --without-libiconv-prefix don't search for libiconv in includedir and libdir --with-included-gettext use the GNU gettext library included here + --with-libintl-prefix=DIR search for libintl in DIR/include and DIR/lib + --without-libintl-prefix don't search for libintl in includedir and libdir Some influential environment variables: CC C compiler command @@ -938,7 +943,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -elmo configure 0.8 +elmo configure 0.8.1 generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -953,7 +958,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by elmo $as_me 0.8, which was +It was created by elmo $as_me 0.8.1, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1563,7 +1568,7 @@ # Define the identity of the package. PACKAGE='elmo' - VERSION='0.8' + VERSION='0.8.1' cat >>confdefs.h <<_ACEOF @@ -3041,6 +3046,200 @@ ALL_LINGUAS="pl de" + + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + + + + + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + echo "$as_me:$LINENO: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT + +if test -n "$GMSGFMT"; then + echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + rm -f messages.po + + # Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGMERGE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGMERGE" in + /*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; +esac +fi +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + echo "$as_me:$LINENO: result: $MSGMERGE" >&5 +echo "${ECHO_T}$MSGMERGE" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + if test "$GMSGFMT" != ":"; then + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && + (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` + echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 +echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 + GMSGFMT=":" + fi + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && + (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 +echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 + XGETTEXT=":" + fi + rm -f messages.po + fi + + ac_config_commands="$ac_config_commands default-1" + + # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 @@ -4746,40 +4945,126 @@ + echo "$as_me:$LINENO: checking whether integer division by zero raises SIGFPE" >&5 +echo $ECHO_N "checking whether integer division by zero raises SIGFPE... $ECHO_C" >&6 +if test "${gt_cv_int_divbyzero_sigfpe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + # Guess based on the CPU. + case "$host_cpu" in + alpha* | i3456786 | m68k | s390*) + gt_cv_int_divbyzero_sigfpe="guessing yes";; + *) + gt_cv_int_divbyzero_sigfpe="guessing no";; + esac +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +static void +#ifdef __cplusplus +sigfpe_handler (int sig) +#else +sigfpe_handler (sig) int sig; +#endif +{ + /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ + exit (sig != SIGFPE); +} +int x = 1; +int y = 0; +int z; +int nan; +int main () +{ + signal (SIGFPE, sigfpe_handler); +/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ +#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) + signal (SIGTRAP, sigfpe_handler); +#endif +/* Linux/SPARC yields signal SIGILL. */ +#if defined (__sparc__) && defined (__linux__) + signal (SIGILL, sigfpe_handler); +#endif + z = x / y; + nan = y / y; + exit (1); +} -for ac_header in argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ -stdlib.h string.h unistd.h sys/param.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: 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 +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_int_divbyzero_sigfpe=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gt_cv_int_divbyzero_sigfpe=no fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +fi +echo "$as_me:$LINENO: result: $gt_cv_int_divbyzero_sigfpe" >&5 +echo "${ECHO_T}$gt_cv_int_divbyzero_sigfpe" >&6 + case "$gt_cv_int_divbyzero_sigfpe" in + *yes) value=1;; + *) value=0;; + esac + +cat >>confdefs.h <<_ACEOF +#define INTDIV0_RAISES_SIGFPE $value +_ACEOF + + + + echo "$as_me:$LINENO: checking for inttypes.h" >&5 +echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 +if test "${jm_ac_cv_header_inttypes_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +#include +#include +int +main () +{ +uintmax_t i = (uintmax_t) -1; + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -4793,139 +5078,83 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + jm_ac_cv_header_inttypes_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no +jm_ac_cv_header_inttypes_h=no fi rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 +fi +echo "$as_me:$LINENO: result: $jm_ac_cv_header_inttypes_h" >&5 +echo "${ECHO_T}$jm_ac_cv_header_inttypes_h" >&6 + if test $jm_ac_cv_header_inttypes_h = yes; then -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF +cat >>confdefs.h <<_ACEOF +#define HAVE_INTTYPES_H_WITH_UINTMAX 1 +_ACEOF + + fi + + + echo "$as_me:$LINENO: checking for stdint.h" >&5 +echo $ECHO_N "checking for stdint.h... $ECHO_C" >&6 +if test "${jm_ac_cv_header_stdint_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 +#include +#include +int +main () +{ +uintmax_t i = (uintmax_t) -1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + jm_ac_cv_header_stdint_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no +jm_ac_cv_header_stdint_h=no fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to address@hidden ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to address@hidden ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: 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 - eval "$as_ac_Header=$ac_header_preproc" +rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +echo "$as_me:$LINENO: result: $jm_ac_cv_header_stdint_h" >&5 +echo "${ECHO_T}$jm_ac_cv_header_stdint_h" >&6 + if test $jm_ac_cv_header_stdint_h = yes; then -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_STDINT_H_WITH_UINTMAX 1 _ACEOF -fi - -done - - - - - - - - - - - - - - - - - - - - + fi -for ac_func in feof_unlocked fgets_unlocked getcwd getegid geteuid \ -getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ -strdup strtoul tsearch __argz_count __argz_stringify __argz_next -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then + echo "$as_me:$LINENO: checking for unsigned long long" >&5 +echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6 +if test "${ac_cv_type_unsigned_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -4935,39 +5164,12 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ -#ifdef __STDC__ -# include -#else -# include -#endif -/* 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 $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - +unsigned long long ull = 1; int i = 63; int main () { -return f != $ac_func; +unsigned long long ullmax = (unsigned long long) -1; + return ull << i | ull >> i | ullmax / ull | ullmax % ull; ; return 0; } @@ -4984,48 +5186,47 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_type_unsigned_long_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" +ac_cv_type_unsigned_long_long=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_unsigned_long_long" >&6 + if test $ac_cv_type_unsigned_long_long = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_UNSIGNED_LONG_LONG 1 _ACEOF -fi -done + fi + if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then -# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. -if test "${with_libiconv_prefix+set}" = set; then - withval="$with_libiconv_prefix" + test $ac_cv_type_unsigned_long_long = yes \ + && ac_type='unsigned long long' \ + || ac_type='unsigned long' - for dir in `echo "$withval" | tr : ' '`; do - if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi - if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi - done +cat >>confdefs.h <<_ACEOF +#define uintmax_t $ac_type +_ACEOF -fi; + fi - echo "$as_me:$LINENO: checking for iconv" >&5 -echo $ECHO_N "checking for iconv... $ECHO_C" >&6 -if test "${am_cv_func_iconv+set}" = set; then + + echo "$as_me:$LINENO: checking for inttypes.h" >&5 +echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 +if test "${gt_cv_header_inttypes_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ @@ -5033,115 +5234,67 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include +#include +#include int main () { -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_func_iconv=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS -liconv" - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -int -main () -{ -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - am_cv_lib_iconv=yes - am_cv_func_iconv=yes + gt_cv_header_inttypes_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +gt_cv_header_inttypes_h=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS="$am_save_LIBS" - fi +rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 -echo "${ECHO_T}$am_cv_func_iconv" >&6 - if test "$am_cv_func_iconv" = yes; then +echo "$as_me:$LINENO: result: $gt_cv_header_inttypes_h" >&5 +echo "${ECHO_T}$gt_cv_header_inttypes_h" >&6 + if test $gt_cv_header_inttypes_h = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_ICONV 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_INTTYPES_H 1 _ACEOF - echo "$as_me:$LINENO: checking for iconv declaration" >&5 -echo $ECHO_N "checking for iconv declaration... $ECHO_C" >&6 - if test "${am_cv_proto_iconv+set}" = set; then + fi + + + + if test $gt_cv_header_inttypes_h = yes; then + echo "$as_me:$LINENO: checking whether the inttypes.h PRIxNN macros are broken" >&5 +echo $ECHO_N "checking whether the inttypes.h PRIxNN macros are broken... $ECHO_C" >&6 +if test "${gt_cv_inttypes_pri_broken+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include -#include -extern -#ifdef __cplusplus -"C" -#endif -#if defined(__STDC__) || defined(__cplusplus) -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); +#include +#ifdef PRId32 +char *p = PRId32; #endif int @@ -5164,196 +5317,587 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - am_cv_proto_iconv_arg1="" + gt_cv_inttypes_pri_broken=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -am_cv_proto_iconv_arg1="const" +gt_cv_inttypes_pri_broken=yes fi rm -f conftest.$ac_objext conftest.$ac_ext - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" -fi - am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - echo "$as_me:$LINENO: result: ${ac_t:- - }$am_cv_proto_iconv" >&5 -echo "${ECHO_T}${ac_t:- - }$am_cv_proto_iconv" >&6 +fi +echo "$as_me:$LINENO: result: $gt_cv_inttypes_pri_broken" >&5 +echo "${ECHO_T}$gt_cv_inttypes_pri_broken" >&6 + fi + if test "$gt_cv_inttypes_pri_broken" = yes; then cat >>confdefs.h <<_ACEOF -#define ICONV_CONST $am_cv_proto_iconv_arg1 +#define PRI_MACROS_BROKEN 1 _ACEOF fi - LIBICONV= - if test "$am_cv_lib_iconv" = yes; then - LIBICONV="-liconv" - fi + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" - echo "$as_me:$LINENO: checking for nl_langinfo and CODESET" >&5 -echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6 -if test "${am_cv_langinfo_codeset+set}" = set; then + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by GCC" >&5 +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${acl_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -char* cs = nl_langinfo(CODESET); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_langinfo_codeset=yes + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -am_cv_langinfo_codeset=no + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LD="$acl_cv_path_LD" +if test -n "$LD"; then + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo "$as_me:$LINENO: result: $am_cv_langinfo_codeset" >&5 -echo "${ECHO_T}$am_cv_langinfo_codeset" >&6 - if test $am_cv_langinfo_codeset = yes; then +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${acl_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + acl_cv_prog_gnu_ld=yes +else + acl_cv_prog_gnu_ld=no +fi +fi +echo "$as_me:$LINENO: result: $acl_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6 +with_gnu_ld=$acl_cv_prog_gnu_ld -cat >>confdefs.h <<\_ACEOF -#define HAVE_LANGINFO_CODESET 1 -_ACEOF - fi - if test $ac_cv_header_locale_h = yes; then - echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5 -echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6 -if test "${am_cv_val_LC_MESSAGES+set}" = set; then + echo "$as_me:$LINENO: checking for shared library run path origin" >&5 +echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6 +if test "${acl_cv_rpath+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -return LC_MESSAGES - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_val_LC_MESSAGES=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -am_cv_val_LC_MESSAGES=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + fi -echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5 -echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6 - if test $am_cv_val_LC_MESSAGES = yes; then +echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5 +echo "${ECHO_T}$acl_cv_rpath" >&6 + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" + sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" + # Check whether --enable-rpath or --disable-rpath was given. +if test "${enable_rpath+set}" = set; then + enableval="$enable_rpath" + : +else + enable_rpath=yes +fi; + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" -cat >>confdefs.h <<\_ACEOF -#define HAVE_LC_MESSAGES 1 -_ACEOF +# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then + withval="$with_libiconv_prefix" + + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi fi - fi - echo "$as_me:$LINENO: checking whether NLS is requested" >&5 -echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 - # Check whether --enable-nls or --disable-nls was given. -if test "${enable_nls+set}" = set; then - enableval="$enable_nls" - USE_NLS=$enableval -else - USE_NLS=yes + fi; - echo "$as_me:$LINENO: result: $USE_NLS" >&5 -echo "${ECHO_T}$USE_NLS" >&6 + LIBICONV= + LTLIBICONV= + INCICONV= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + - BUILD_INCLUDED_LIBINTL=no - USE_INCLUDED_LIBINTL=no - INTLLIBS= - if test "$USE_NLS" = "yes"; then -cat >>confdefs.h <<\_ACEOF -#define ENABLE_NLS 1 -_ACEOF - echo "$as_me:$LINENO: checking whether included gettext is requested" >&5 -echo $ECHO_N "checking whether included gettext is requested... $ECHO_C" >&6 -# Check whether --with-included-gettext or --without-included-gettext was given. -if test "${with_included_gettext+set}" = set; then - withval="$with_included_gettext" - nls_cv_force_use_gnu_gettext=$withval -else - nls_cv_force_use_gnu_gettext=no -fi; - echo "$as_me:$LINENO: result: $nls_cv_force_use_gnu_gettext" >&5 -echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6 - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - CATOBJEXT=NONE - if test "${ac_cv_header_libintl_h+set}" = set; then - echo "$as_me:$LINENO: checking for libintl.h" >&5 -echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6 -if test "${ac_cv_header_libintl_h+set}" = set; then + +for ac_header in argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +stdlib.h string.h unistd.h sys/param.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: 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 fi -echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 -echo "${ECHO_T}$ac_cv_header_libintl_h" >&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? -echo "$as_me:$LINENO: checking libintl.h usability" >&5 -echo $ECHO_N "checking libintl.h usability... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ @@ -5362,7 +5906,7 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -#include +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -5388,8 +5932,8 @@ echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? -echo "$as_me:$LINENO: checking libintl.h presence" >&5 -echo $ECHO_N "checking libintl.h presence... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ @@ -5397,7 +5941,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -5430,10 +5974,10 @@ # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) - { echo "$as_me:$LINENO: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: libintl.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## @@ -5444,12 +5988,12 @@ sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) - { echo "$as_me:$LINENO: WARNING: libintl.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: libintl.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: libintl.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: libintl.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: libintl.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## @@ -5460,37 +6004,97 @@ sed "s/^/$as_me: WARNING: /" >&2 ;; esac -echo "$as_me:$LINENO: checking for libintl.h" >&5 -echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6 -if test "${ac_cv_header_libintl_h+set}" = set; then +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_header_libintl_h=$ac_header_preproc + eval "$as_ac_Header=$ac_header_preproc" fi -echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 -echo "${ECHO_T}$ac_cv_header_libintl_h" >&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi -if test $ac_cv_header_libintl_h = yes; then - echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 -echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6 -if test "${gt_cv_func_gnugettext1_libc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + + + + + + + + + + + + + + + +for ac_func in feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ +geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ +strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -extern int _nl_msg_cat_cntr; +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* 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 $ac_func (); +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + int main () { -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr +return f != $ac_func; ; return 0; } @@ -5507,40 +6111,79 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_func_gnugettext1_libc=yes + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -gt_cv_func_gnugettext1_libc=no +eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5 -echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF - if test "$gt_cv_func_gnugettext1_libc" != "yes"; then - echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 -echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6 -if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then +fi +done + + + + + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + echo "$as_me:$LINENO: checking for iconv" >&5 +echo $ECHO_N "checking for iconv... $ECHO_C" >&6 +if test "${am_cv_func_iconv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - gt_save_LIBS="$LIBS" - LIBS="$LIBS -lintl $LIBICONV" - cat >conftest.$ac_ext <<_ACEOF + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -extern int _nl_msg_cat_cntr; +#include +#include int main () { -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); ; return 0; } @@ -5557,468 +6200,1010 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_func_gnugettext1_libintl=yes + am_cv_func_iconv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -gt_cv_func_gnugettext1_libintl=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS="$gt_save_LIBS" + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5 -echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6 - fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi - if test "$gt_cv_func_gnugettext1_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ - && test "$PACKAGE" != gettext; }; then +fi +echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 +echo "${ECHO_T}$am_cv_func_iconv" >&6 + if test "$am_cv_func_iconv" = yes; then cat >>confdefs.h <<\_ACEOF -#define HAVE_GETTEXT 1 +#define HAVE_ICONV 1 _ACEOF + fi + if test "$am_cv_lib_iconv" = yes; then + echo "$as_me:$LINENO: checking how to link with libiconv" >&5 +echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $LIBICONV" >&5 +echo "${ECHO_T}$LIBICONV" >&6 + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi - if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then - INTLLIBS="-lintl $LIBICONV" - fi - gt_save_LIBS="$LIBS" - LIBS="$LIBS $INTLLIBS" -for ac_func in dcgettext -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then + if test "$am_cv_func_iconv" = yes; then + echo "$as_me:$LINENO: checking for iconv declaration" >&5 +echo $ECHO_N "checking for iconv declaration... $ECHO_C" >&6 + if test "${am_cv_proto_iconv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + + cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ -#ifdef __STDC__ -# include -#else -# include -#endif -/* Override any gcc2 internal prototype to avoid an error. */ + +#include +#include +extern #ifdef __cplusplus -extern "C" -{ +"C" #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} +size_t iconv(); #endif int main () { -return f != $ac_func; + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + am_cv_proto_iconv_arg1="" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" +am_cv_proto_iconv_arg1="const" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.$ac_objext conftest.$ac_ext + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 + + am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + echo "$as_me:$LINENO: result: ${ac_t:- + }$am_cv_proto_iconv" >&5 +echo "${ECHO_T}${ac_t:- + }$am_cv_proto_iconv" >&6 + +cat >>confdefs.h <<_ACEOF +#define ICONV_CONST $am_cv_proto_iconv_arg1 _ACEOF -fi -done + fi - LIBS="$gt_save_LIBS" - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MSGFMT+set}" = set; then + echo "$as_me:$LINENO: checking for nl_langinfo and CODESET" >&5 +echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6 +if test "${am_cv_langinfo_codeset+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" - ;; -esac + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +char* cs = nl_langinfo(CODESET); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_langinfo_codeset=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +am_cv_langinfo_codeset=no fi -MSGFMT="$ac_cv_path_MSGFMT" -if test "$MSGFMT" != ":"; then - echo "$as_me:$LINENO: result: $MSGFMT" >&5 -echo "${ECHO_T}$MSGFMT" >&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $am_cv_langinfo_codeset" >&5 +echo "${ECHO_T}$am_cv_langinfo_codeset" >&6 + if test $am_cv_langinfo_codeset = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LANGINFO_CODESET 1 +_ACEOF + + fi + + if test $ac_cv_header_locale_h = yes; then + + echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5 +echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6 +if test "${am_cv_val_LC_MESSAGES+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +return LC_MESSAGES + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_val_LC_MESSAGES=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +am_cv_val_LC_MESSAGES=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5 +echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6 + if test $am_cv_val_LC_MESSAGES = yes; then - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 +cat >>confdefs.h <<\_ACEOF +#define HAVE_LC_MESSAGES 1 +_ACEOF + + fi + + fi + + for ac_prog in bison +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:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_GMSGFMT+set}" = set; then +if test "${ac_cv_prog_INTLBISON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case $GMSGFMT in - [\\/]* | ?:[\\/]*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + if test -n "$INTLBISON"; then + ac_cv_prog_INTLBISON="$INTLBISON" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + ac_cv_prog_INTLBISON="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac fi -GMSGFMT=$ac_cv_path_GMSGFMT - -if test -n "$GMSGFMT"; then - echo "$as_me:$LINENO: result: $GMSGFMT" >&5 -echo "${ECHO_T}$GMSGFMT" >&6 +fi +INTLBISON=$ac_cv_prog_INTLBISON +if test -n "$INTLBISON"; then + echo "$as_me:$LINENO: result: $INTLBISON" >&5 +echo "${ECHO_T}$INTLBISON" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi + test -n "$INTLBISON" && break +done - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_XGETTEXT+set}" = set; then + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + echo "$as_me:$LINENO: checking version of bison" >&5 +echo $ECHO_N "checking version of bison... $ECHO_C" >&6 + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + echo "$as_me:$LINENO: result: $ac_prog_version" >&5 +echo "${ECHO_T}$ac_prog_version" >&6 + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + fi + + + + + + + + + + + + + + + + echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 + # Check whether --enable-nls or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval +else + USE_NLS=yes +fi; + echo "$as_me:$LINENO: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6 + + + + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + + LIBINTL= + LTLIBINTL= + POSUB= + + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + + echo "$as_me:$LINENO: checking whether included gettext is requested" >&5 +echo $ECHO_N "checking whether included gettext is requested... $ECHO_C" >&6 + +# Check whether --with-included-gettext or --without-included-gettext was given. +if test "${with_included_gettext+set}" = set; then + withval="$with_included_gettext" + nls_cv_force_use_gnu_gettext=$withval +else + nls_cv_force_use_gnu_gettext=no +fi; + echo "$as_me:$LINENO: result: $nls_cv_force_use_gnu_gettext" >&5 +echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6 + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + + + + + + + echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 +echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6 +if test "${gt_cv_func_gnugettext1_libc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings; +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_gnugettext1_libc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gt_cv_func_gnugettext1_libc=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5 +echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6 + + if test "$gt_cv_func_gnugettext1_libc" != "yes"; then + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libintl-prefix or --without-libintl-prefix was given. +if test "${with_libintl_prefix+set}" = set; then + withval="$with_libintl_prefix" + + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" fi fi + +fi; + LIBINTL= + LTLIBINTL= + INCINTL= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='intl ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$hardcode_direct" = yes; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" + ;; + esac + done + fi + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" + fi + fi + fi + done done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test "$XGETTEXT" != ":"; then - echo "$as_me:$LINENO: result: $XGETTEXT" >&5 -echo "${ECHO_T}$XGETTEXT" >&6 + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" + done + fi + + echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 +echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6 +if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (); +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_gnugettext1_libintl=yes else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +gt_cv_func_gnugettext1_libintl=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (); +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + gt_cv_func_gnugettext1_libintl=yes - CATOBJEXT=.gmo - fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS" +fi +echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5 +echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6 + fi + if test "$gt_cv_func_gnugettext1_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ + && test "$PACKAGE" != gettext; }; then + gt_use_preinstalled_gnugettext=yes + else + LIBINTL= + LTLIBINTL= + INCINTL= + fi - if test "$CATOBJEXT" = "NONE"; then - nls_cv_use_gnu_gettext=yes + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + nls_cv_use_gnu_gettext=yes fi fi if test "$nls_cv_use_gnu_gettext" = "yes"; then INTLOBJS="\$(GETTOBJS)" - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="\${top_builddir}/intl/libintl.a $LIBICONV" + LTLIBINTL="\${top_builddir}/intl/libintl.a $LTLIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" - ;; -esac -fi -MSGFMT="$ac_cv_path_MSGFMT" -if test "$MSGFMT" != ":"; then - echo "$as_me:$LINENO: result: $MSGFMT" >&5 -echo "${ECHO_T}$MSGFMT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_GMSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $GMSGFMT in - [\\/]* | ?:[\\/]*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + CATOBJEXT=.gmo + fi - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT=$ac_cv_path_GMSGFMT -if test -n "$GMSGFMT"; then - echo "$as_me:$LINENO: result: $GMSGFMT" >&5 -echo "${ECHO_T}$GMSGFMT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_XGETTEXT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi +cat >>confdefs.h <<\_ACEOF +#define ENABLE_NLS 1 +_ACEOF + + else + USE_NLS=no fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test "$XGETTEXT" != ":"; then - echo "$as_me:$LINENO: result: $XGETTEXT" >&5 -echo "${ECHO_T}$XGETTEXT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi + fi + if test "$USE_NLS" = "yes"; then - BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.gmo - INTLLIBS="\$(top_builddir)/intl/libintl.a $LIBICONV" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` - fi + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then + echo "$as_me:$LINENO: checking how to link with libintl" >&5 +echo $ECHO_N "checking how to link with libintl... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $LIBINTL" >&5 +echo "${ECHO_T}$LIBINTL" >&6 + + for element in $INCINTL; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" - if test "$GMSGFMT" != ":"; then - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then - : ; - else - echo "$as_me:$LINENO: result: found msgfmt program is not GNU msgfmt; ignore it" >&5 -echo "${ECHO_T}found msgfmt program is not GNU msgfmt; ignore it" >&6 - GMSGFMT=":" - fi + if test "X$x" = "X$element"; then + haveit=yes + break fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then - : ; - else - echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 -echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 - XGETTEXT=":" - fi fi - POSUB=po - fi - ac_config_commands="$ac_config_commands default-1" +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETTEXT 1 +_ACEOF - if test "$PACKAGE" = gettext; then - BUILD_INCLUDED_LIBINTL=yes +cat >>confdefs.h <<\_ACEOF +#define HAVE_DCGETTEXT 1 +_ACEOF + fi - for ac_prog in bison -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:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_INTLBISON+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$INTLBISON"; then - ac_cv_prog_INTLBISON="$INTLBISON" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_INTLBISON="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 + POSUB=po fi -done -done - -fi -fi -INTLBISON=$ac_cv_prog_INTLBISON -if test -n "$INTLBISON"; then - echo "$as_me:$LINENO: result: $INTLBISON" >&5 -echo "${ECHO_T}$INTLBISON" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - test -n "$INTLBISON" && break -done - if test -z "$INTLBISON"; then - ac_verc_fail=yes - else - echo "$as_me:$LINENO: checking version of bison" >&5 -echo $ECHO_N "checking version of bison... $ECHO_C" >&6 - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) - ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; - *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; - esac - echo "$as_me:$LINENO: result: $ac_prog_version" >&5 -echo "${ECHO_T}$ac_prog_version" >&6 - fi - if test $ac_verc_fail = yes; then - INTLBISON=: + if test "$PACKAGE" = gettext; then + BUILD_INCLUDED_LIBINTL=yes fi - for lang in $ALL_LINGUAS; do - GMOFILES="$GMOFILES $lang.gmo" - POFILES="$POFILES $lang.po" - done - - - - - - @@ -6036,50 +7221,15 @@ GENCAT=gencat + INTL_LIBTOOL_SUFFIX_PREFIX= - if test "x$CATOBJEXT" != "x"; then - if test "x$ALL_LINGUAS" = "x"; then - LINGUAS= - else - echo "$as_me:$LINENO: checking for catalogs to be installed" >&5 -echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6 - NEW_LINGUAS= - for presentlang in $ALL_LINGUAS; do - useit=no - for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - NEW_LINGUAS="$NEW_LINGUAS $presentlang" - fi - done - LINGUAS=$NEW_LINGUAS - echo "$as_me:$LINENO: result: $LINGUAS" >&5 -echo "${ECHO_T}$LINGUAS" >&6 - fi - if test -n "$LINGUAS"; then - for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done - fi - fi - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi + INTLLIBS="$LIBINTL" + + - INTL_LIBTOOL_SUFFIX_PREFIX= @@ -8027,7 +9177,7 @@ } >&5 cat >&5 <<_CSEOF -This file was extended by elmo $as_me 0.8, which was +This file was extended by elmo $as_me 0.8.1, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8090,7 +9240,7 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -elmo config.status 0.8 +elmo config.status 0.8.1 configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -8191,6 +9341,12 @@ # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it + # from automake. + eval 'ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" _ACEOF @@ -8334,6 +9490,11 @@ s,@LEX@,$LEX,;t t s,@LEXLIB@,$LEXLIB,;t t s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t +s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t +s,@MSGFMT@,$MSGFMT,;t t +s,@GMSGFMT@,$GMSGFMT,;t t +s,@XGETTEXT@,$XGETTEXT,;t t +s,@MSGMERGE@,$MSGMERGE,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t @@ -8349,25 +9510,21 @@ s,@ALLOCA@,$ALLOCA,;t t s,@GLIBC21@,$GLIBC21,;t t s,@LIBICONV@,$LIBICONV,;t t -s,@USE_NLS@,$USE_NLS,;t t -s,@MSGFMT@,$MSGFMT,;t t -s,@GMSGFMT@,$GMSGFMT,;t t -s,@XGETTEXT@,$XGETTEXT,;t t +s,@LTLIBICONV@,$LTLIBICONV,;t t s,@INTLBISON@,$INTLBISON,;t t +s,@USE_NLS@,$USE_NLS,;t t s,@BUILD_INCLUDED_LIBINTL@,$BUILD_INCLUDED_LIBINTL,;t t s,@USE_INCLUDED_LIBINTL@,$USE_INCLUDED_LIBINTL,;t t -s,@CATALOGS@,$CATALOGS,;t t s,@CATOBJEXT@,$CATOBJEXT,;t t -s,@GMOFILES@,$GMOFILES,;t t -s,@INTLLIBS@,$INTLLIBS,;t t s,@INTLOBJS@,$INTLOBJS,;t t -s,@POFILES@,$POFILES,;t t -s,@POSUB@,$POSUB,;t t s,@DATADIRNAME@,$DATADIRNAME,;t t s,@INSTOBJEXT@,$INSTOBJEXT,;t t s,@GENCAT@,$GENCAT,;t t -s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t s,@INTL_LIBTOOL_SUFFIX_PREFIX@,$INTL_LIBTOOL_SUFFIX_PREFIX,;t t +s,@INTLLIBS@,$INTLLIBS,;t t +s,@LIBINTL@,$LIBINTL,;t t +s,@LTLIBINTL@,$LTLIBINTL,;t t +s,@POSUB@,$POSUB,;t t s,@INCLUDED_VASPRINTF_TRUE@,$INCLUDED_VASPRINTF_TRUE,;t t s,@INCLUDED_VASPRINTF_FALSE@,$INCLUDED_VASPRINTF_FALSE,;t t s,@MAILDIR_SUPPORT_TRUE@,$MAILDIR_SUPPORT_TRUE,;t t @@ -8970,35 +10127,102 @@ done done ;; - default-1 ) for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + default-1 ) + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + fi case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; esac - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + POFILES= + GMOFILES= + UPDATEPOFILES= + DUMMYPOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done fi - ;; - esac - done ;; + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done ;; esac done _ACEOF diff -urN elmo-0.8/configure.in elmo-0.8.1/configure.in --- elmo-0.8/configure.in 2003-06-14 14:15:38.000000000 +0200 +++ elmo-0.8.1/configure.in 2003-07-21 17:21:54.000000000 +0200 @@ -2,7 +2,7 @@ AC_SUBST(HAVE_SHORT_NAME, "") -AC_INIT(elmo, 0.8) +AC_INIT(elmo, 0.8.1) AC_CONFIG_SRCDIR(src/elmo.c) AM_INIT_AUTOMAKE(1.7) AC_CONFIG_HEADER(config.h) diff -urN elmo-0.8/doc/elmo.1 elmo-0.8.1/doc/elmo.1 --- elmo-0.8/doc/elmo.1 2003-05-18 13:17:50.000000000 +0200 +++ elmo-0.8.1/doc/elmo.1 2003-07-06 12:04:00.000000000 +0200 @@ -74,4 +74,6 @@ .I rzyjontko .br .I Artur Skura +.br +.I Krzysztof Gibas .RE \ Brak znaku nowej linii na koñcu pliku diff -urN elmo-0.8/doc/elmo.info elmo-0.8.1/doc/elmo.info --- elmo-0.8/doc/elmo.info 2003-07-01 11:57:23.000000000 +0200 +++ elmo-0.8.1/doc/elmo.info 2003-07-21 17:23:00.000000000 +0200 @@ -1,4 +1,4 @@ -This is elmo.info, produced by makeinfo version 4.1 from elmo.texi. +This is elmo.info, produced by makeinfo version 4.3 from elmo.texi. INFO-DIR-SECTION Net Utilities START-INFO-DIR-ENTRY @@ -46,6 +46,8 @@ * hash:: Hashing tables. * line:: Constant length strings. * memblock:: Memory block allocation. +* mail:: How messages are stored. +* address:: How addresses are stored. * Function Index:: * Concept Index:: @@ -126,7 +128,7 @@ Xmalloc is very general. There is a macro called FRAME_NO. If mtrace output says that memory was allocated in rarray_create it will -probably won't tell you where it really was. You should increase +probably not tell you where it really was. You should increase FRAME_NO, recompile and rerun elmo.  @@ -216,7 +218,8 @@ =============== These are growable hashing tables. Table size is exponent of 2 and -it grows twice each time table is 200% filled. +it grows twice each time table is 200% filled (to ensure that lookup +runs in constant time). `htable_t *htable_create (unsigned EXPONENT)' Creates new hashing table of size 2^EXPONENT. @@ -242,11 +245,12 @@ `void htable_clear (htable_t *TABLE, void (*FUN)(void *))' This function clears all the mappings. Function FUN is feeded - with entry contents. + with entry contents to destroy them (if needed). You can pass + NULL if no action is needed. `void htable_iterator (htable_t *TABLE, void (*FUN)(entry_t *))' - This function runs FUN on each entry in TABLE. Order is not - specified. + This function runs FUN on each entry in TABLE. There is no order + you could rely on.  File: elmo.info, Node: line, Next: memblock, Prev: hash, Up: Top @@ -295,7 +299,10 @@ Adds X to the end of the LINE.  -File: elmo.info, Node: memblock, Next: Function Index, Prev: line, Up: Top +File: elmo.info, Node: memblock, Next: mail, Prev: line, Up: Top + +Memory blocks. +============== Sometimes it would be very inefficient to allocate memory with xmalloc or xstrudp. This is especially an important issue when you @@ -316,8 +323,52 @@ This functions works just like xmalloc but returned pointer is part of memory block BLOCK. +`void memblock_free_last (memblock_t *BLOCK)' + This function allows one to free last allocated pointer. + +`void memblock_set_mark (memblock_t *BLOCK)' + This function sets mark, that may be later used to free all the + memory allocated from this point. + +`void memblock_free_marked (memblock_t **BLOCK)' + This function frees all the memory allocated after + memblock_set_mark. If there was no mark set, all the memory is + freed. + +`char *memblock_sprintf (memblock_t **BLOCK, const char *FMT, ...)' + This function works just like sprintf but handles only %d, %s, %c + and %% format sequences. + + +File: elmo.info, Node: mail, Next: address, Prev: memblock, Up: Top + +Message storage. +================ + + This is probably the most important issue in every mail reader. A +single message is represented by a `mail_t' object. This structure +holds all the necessary data about a mail. + + Messages are stored in an array of type `mail_array_t'. + + +File: elmo.info, Node: address, Next: Function Index, Prev: mail, Up: Top + +Address storage. +================ + + Email addresses are stored in special structures of type `addr_t'. +This structure holds some additional information computed from the +given data. It could be contents of message header fields or +addressbook. Addresses are held in a hashing table to prevent +unnecessary data storage. The table is bounded with a single mail +array because different arrays may define different address table. All +the data is stored in one memory block so the allocation is fast and +very simple and allocated pointers are freed together, when they are no +more in use. +  -File: elmo.info, Node: Function Index, Next: Concept Index, Prev: memblock, Up: Top +File: elmo.info, Node: Function Index, Next: Concept Index, Prev: address, Up: Top Function Index ************** @@ -327,6 +378,7 @@ * char *ask_hide_passwd (char *NAME): ask. * char *ask_noninteractive (char *NAME): ask. * char *ask_value (char *NAME): ask. +* char *memblock_sprintf (memblock_t **BLOCK, const char *FMT, ...): memblock. * char *memblock_strdup (memblock_t **BLOCK, const char *STR): memblock. * char *xstrdup (char *STR): xmalloc. * entry_t *htable_insert (htable_t *TABLE, const char *KEY, void *CONTENT): hash. @@ -363,6 +415,9 @@ * void line_destroy (line_t *LINE): line. * void line_put_str (line_t *LINE, const char *STR): line. * void memblock_destroy (memblock_t *BLOCK): memblock. +* void memblock_free_last (memblock_t *BLOCK): memblock. +* void memblock_free_marked (memblock_t **BLOCK): memblock. +* void memblock_set_mark (memblock_t *BLOCK): memblock. * void screen_free_resources (void): ncurses.  @@ -380,16 +435,18 @@  Tag Table: Node: Top949 -Node: general1921 -Node: software2479 -Node: xmalloc2843 -Node: ncurses4578 -Node: error5390 -Node: ask6330 -Node: hash7515 -Node: line9045 -Node: memblock10477 -Node: Function Index11328 -Node: Concept Index13734 +Node: general2014 +Node: software2572 +Node: xmalloc2936 +Node: ncurses4669 +Node: error5481 +Node: ask6421 +Node: hash7606 +Node: line9271 +Node: memblock10703 +Node: mail12195 +Node: address12547 +Node: Function Index13219 +Node: Concept Index15876  End Tag Table diff -urN elmo-0.8/doc/elmo.texi elmo-0.8.1/doc/elmo.texi --- elmo-0.8/doc/elmo.texi 2003-06-13 14:06:48.000000000 +0200 +++ elmo-0.8.1/doc/elmo.texi 2003-07-15 12:36:38.000000000 +0200 @@ -92,6 +92,8 @@ * hash:: Hashing tables. * line:: Constant length strings. * memblock:: Memory block allocation. +* mail:: How messages are stored. +* address:: How addresses are stored. * Function Index:: * Concept Index:: @end menu @@ -170,7 +172,7 @@ Xmalloc is very general. There is a macro called FRAME_NO. If mtrace output says that memory was allocated in rarray_create it will -probably won't tell you where it really was. You should increase +probably not tell you where it really was. You should increase FRAME_NO, recompile and rerun elmo. @@ -257,7 +259,8 @@ @section Hashing tables. These are growable hashing tables. Table size is exponent of 2 and it -grows twice each time table is 200% filled. +grows twice each time table is 200% filled (to ensure that lookup runs +in constant time). @ftable @code @item htable_t *htable_create (unsigned EXPONENT) @@ -279,10 +282,11 @@ shouldn't be used to often. @item void htable_clear (htable_t *TABLE, void (*FUN)(void *)) This function clears all the mappings. Function @var{FUN} is feeded -with entry contents. +with entry contents to destroy them (if needed). You can pass NULL if +no action is needed. @item void htable_iterator (htable_t *TABLE, void (*FUN)(entry_t *)) -This function runs @var{FUN} on each entry in @var{TABLE}. Order is -not specified. +This function runs @var{FUN} on each entry in @var{TABLE}. There is +no order you could rely on. @end ftable @@ -326,7 +330,8 @@ @c -------------------------------------------------- memblock - address@hidden memblock, Function Index, line, Top address@hidden memblock, mail, line, Top address@hidden Memory blocks. Sometimes it would be very inefficient to allocate memory with xmalloc or xstrudp. This is especially an important issue when you have to @@ -344,11 +349,51 @@ @item void *memblock_malloc (memblock_t **BLOCK, int SIZE) This functions works just like xmalloc but returned pointer is part of memory block @var{BLOCK}. address@hidden void memblock_free_last (memblock_t *BLOCK) +This function allows one to free last allocated pointer. address@hidden void memblock_set_mark (memblock_t *BLOCK) +This function sets mark, that may be later used to free all the +memory allocated from this point. address@hidden void memblock_free_marked (memblock_t **BLOCK) +This function frees all the memory allocated after memblock_set_mark. +If there was no mark set, all the memory is freed. address@hidden char *memblock_sprintf (memblock_t **BLOCK, const char *FMT, ...) +This function works just like sprintf but handles only %d, %s, %c and %% +format sequences. @end ftable + address@hidden -------------------------------------------------- mail - address@hidden mail, address, memblock, Top address@hidden Message storage. + +This is probably the most important issue in every mail reader. A +single message is represented by a @code{mail_t} object. This +structure holds all the necessary data about a mail. + +Messages are stored in an array of type @code{mail_array_t}. + + + address@hidden -------------------------------------------------- address - address@hidden address, Function Index, mail, Top address@hidden Address storage. + +Email addresses are stored in special structures of type address@hidden This structure holds some additional information +computed from the given data. It could be contents of message header +fields or addressbook. Addresses are held in a hashing table to +prevent unnecessary data storage. The table is bounded with a single +mail array because different arrays may define different address +table. All the data is stored in one memory block so the allocation +is fast and very simple and allocated pointers are freed together, +when they are no more in use. + + + @c -------------------------------------------------- Function Index - address@hidden Function Index, Concept Index, memblock, Top address@hidden Function Index, Concept Index, address, Top @unnumbered Function Index @printindex fn diff -urN elmo-0.8/doc/Makefile.in elmo-0.8.1/doc/Makefile.in --- elmo-0.8/doc/Makefile.in 2003-07-01 11:57:22.000000000 +0200 +++ elmo-0.8.1/doc/Makefile.in 2003-07-21 17:22:26.000000000 +0200 @@ -46,7 +46,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ -CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -64,7 +63,6 @@ EXEEXT = @EXEEXT@ GENCAT = @GENCAT@ GLIBC21 = @GLIBC21@ -GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ HAVE_SHORT_NAME = @HAVE_SHORT_NAME@ INCLUDED_VASPRINTF_FALSE = @INCLUDED_VASPRINTF_FALSE@ @@ -83,14 +81,18 @@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAILDIR_SUPPORT_FALSE = @MAILDIR_SUPPORT_FALSE@ MAILDIR_SUPPORT_TRUE = @MAILDIR_SUPPORT_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -99,7 +101,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POFILES = @POFILES@ POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ diff -urN elmo-0.8/doc/stamp-vti elmo-0.8.1/doc/stamp-vti --- elmo-0.8/doc/stamp-vti 2003-07-01 11:57:22.000000000 +0200 +++ elmo-0.8.1/doc/stamp-vti 2003-07-21 17:22:59.000000000 +0200 @@ -1,4 +1,4 @@ address@hidden UPDATED 13 June 2003 address@hidden UPDATED-MONTH June 2003 address@hidden EDITION 0.8 address@hidden VERSION 0.8 address@hidden UPDATED 15 July 2003 address@hidden UPDATED-MONTH July 2003 address@hidden EDITION 0.8.1 address@hidden VERSION 0.8.1 diff -urN elmo-0.8/doc/version.texi elmo-0.8.1/doc/version.texi --- elmo-0.8/doc/version.texi 2003-07-01 11:57:22.000000000 +0200 +++ elmo-0.8.1/doc/version.texi 2003-07-21 17:22:59.000000000 +0200 @@ -1,4 +1,4 @@ address@hidden UPDATED 13 June 2003 address@hidden UPDATED-MONTH June 2003 address@hidden EDITION 0.8 address@hidden VERSION 0.8 address@hidden UPDATED 15 July 2003 address@hidden UPDATED-MONTH July 2003 address@hidden EDITION 0.8.1 address@hidden VERSION 0.8.1 diff -urN elmo-0.8/Makefile.in elmo-0.8.1/Makefile.in --- elmo-0.8/Makefile.in 2003-07-01 11:56:56.000000000 +0200 +++ elmo-0.8.1/Makefile.in 2003-07-21 17:22:26.000000000 +0200 @@ -46,7 +46,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ -CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -64,7 +63,6 @@ EXEEXT = @EXEEXT@ GENCAT = @GENCAT@ GLIBC21 = @GLIBC21@ -GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ HAVE_SHORT_NAME = @HAVE_SHORT_NAME@ INCLUDED_VASPRINTF_FALSE = @INCLUDED_VASPRINTF_FALSE@ @@ -83,14 +81,18 @@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAILDIR_SUPPORT_FALSE = @MAILDIR_SUPPORT_FALSE@ MAILDIR_SUPPORT_TRUE = @MAILDIR_SUPPORT_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -99,7 +101,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POFILES = @POFILES@ POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ diff -urN elmo-0.8/NEWS elmo-0.8.1/NEWS --- elmo-0.8/NEWS 2003-06-23 15:19:39.000000000 +0200 +++ elmo-0.8.1/NEWS 2003-07-21 16:58:22.000000000 +0200 @@ -1,28 +1,31 @@ - -=== -- removing messages from trash -- tab completion with tilde expansion +0.8.1 +===== + - removing messages from trash + - tab completion with tilde expansion + - guessing smtp account in reply and forward + - address tab-completion + - finding duplicates 0.8 === -- Bayesian spam filter now complete! Check the docs for details -- German translation added -- mailbox caching -- more convenient config file syntax -- improved configuration script -- many bugfixes + - Bayesian spam filter now complete! Check the docs for details + - German translation added + - mailbox caching + - more convenient config file syntax + - improved configuration script + - many bugfixes 0.7.2 ===== -- shows the number of mails in a mailbox -- new variables: indent_string, autoflush, sig_dashes (as in Mutt) -- new flags which can be used in X_wrote and indent_string (such as date, - initials, size, etc.) -- folder look can be customized -- better coloring -- many bugfixes + - shows the number of mails in a mailbox + - new variables: indent_string, autoflush, sig_dashes (as in Mutt) + - new flags which can be used in X_wrote and indent_string (such as date, + initials, size, etc.) + - folder look can be customized + - better coloring + - many bugfixes 0.7 @@ -33,7 +36,3 @@ - bayesian mail filter - multiple boxes (inbox, sent, drafts, etc) -Developers: -Beware: this version of elmo needs automake 1.5 if you want to regenerate -makefiles. - Pliki binarne elmo-0.8/po/de.gmo i elmo-0.8.1/po/de.gmo siê ró¿ni± diff -urN elmo-0.8/po/de.po elmo-0.8.1/po/de.po --- elmo-0.8/po/de.po 2003-07-01 11:57:28.000000000 +0200 +++ elmo-0.8.1/po/de.po 2003-07-21 17:38:25.000000000 +0200 @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: elmo 0.8.x\n" -"POT-Creation-Date: 2003-07-01 11:57+0200\n" +"POT-Creation-Date: 2003-07-21 17:36+0200\n" "PO-Revision-Date: 2003-06-18 11:21+0200\n" "Last-Translator: Martin Sieper \n" "Language-Team: German \n" @@ -16,11 +16,11 @@ "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: src/abook.c:166 +#: src/abook.c:445 msgid "addressbook" msgstr "Adressbuch" -#: src/abook.c:389 +#: src/abook.c:757 msgid "select address" msgstr "Adresse wählen" @@ -32,70 +32,75 @@ msgid "file: " msgstr "Datei: " -#: src/cmd.c:294 +#: src/cmd.c:296 msgid "state stack overflow, please send bug report" msgstr "Status Stack Ãœberlauf, bitte Fehlerbericht senden" -#: src/cmd.c:306 +#: src/cmd.c:308 msgid "state stack underflow, please send bug report" msgstr "Status Stack Unterlauf, bitte Fehlerbericht senden" -#: confread.l:362 +#: confread.l:366 msgid "includes nested to deep" msgstr "" -#: confread.l:465 +#: confread.l:469 msgid "identifier" msgstr "Identifizierer" -#: confread.l:470 +#: confread.l:474 msgid "end of line" msgstr "Zeilenende" -#: confread.l:474 +#: confread.l:478 msgid "quoted text" msgstr "zitierter Text" -#: confread.l:480 +#: confread.l:484 msgid "key specifier" msgstr "Tastenbeschreibung" -#: confread.l:490 +#: confread.l:487 +#, fuzzy +msgid "end of file" +msgstr "Zeilenende" + +#: confread.l:497 #, c-format msgid "%s:%d: parse error near %s" msgstr "%s:%d: Fehler bei grammatikalischer Analyse neben %s" -#: src/elmo.c:175 +#: src/elmo.c:171 #, c-format msgid "%s - ELectronic Mail Operator\n" msgstr "%s - ELectronic Mail Operator\n" -#: src/elmo.c:176 +#: src/elmo.c:172 #, c-format msgid "Usage: %s [OPTION]... \n" msgstr "Benutzung: %s [Option]... \n" -#: src/elmo.c:177 +#: src/elmo.c:173 msgid "Options:\n" msgstr "Optionen:\n" -#: src/elmo.c:178 +#: src/elmo.c:174 msgid " -F use alternate rc file\n" msgstr " -F benutze alternative rc Datei\n" -#: src/elmo.c:179 +#: src/elmo.c:175 msgid " -h, --help display this help and exit\n" msgstr " -h, --help diese Hilfe ausgeben und beenden\n" -#: src/elmo.c:180 +#: src/elmo.c:176 msgid " -V, --version output version information and exit\n" msgstr " -V, --version Versionsinformation anzeigen und beenden\n" -#: src/elmo.c:261 +#: src/elmo.c:248 msgid " initializing..." msgstr " initialisierung..." -#: src/elmo.c:329 +#: src/elmo.c:319 msgid "ncurses: initialization failure\n" msgstr "ncurses: Initialisierungsversagen\n" @@ -104,42 +109,42 @@ msgid "undefined function %s" msgstr "Undefinierte Funktion %s" -#: src/fetch.c:209 +#: src/fetch.c:199 msgid "server field in pop_acc not defined" msgstr "Undefiniertes Feld (server: foo.bar) in pop_acc" -#: src/fetch.c:216 +#: src/fetch.c:206 msgid "username field in pop_acc not defined" msgstr "Undefiniertes Feld (username: address@hidden) in pop_acc" -#: src/fetch.c:223 +#: src/fetch.c:213 msgid "password field in pop_acc not defined" msgstr "Undefiniertes Feld (password: TopSecret) in pop_acc" -#: src/fetch.c:270 +#: src/fetch.c:260 #, c-format msgid "couldn't write to %s" msgstr "Kann nicht nach %s schreiben" -#: src/fetch.c:281 +#: src/fetch.c:271 #, c-format msgid "couldn't fetch mail %d" msgstr "Kann keine Post holen %d" -#: src/fetch.c:307 +#: src/fetch.c:297 msgid "no new mail" msgstr "Keine neue Post" -#: src/fetch.c:329 +#: src/fetch.c:323 msgid "fetch" msgstr "holen" -#: src/maildir.c:283 +#: src/maildir.c:284 #, c-format msgid "%s has bad format" msgstr "%s hat falsches Format" -#: src/maildir.c:504 +#: src/maildir.c:505 msgid "reading directory" msgstr "lese Verzeichnis" @@ -167,7 +172,7 @@ msgid " Attachments" msgstr " Anhänge" -#: src/mbox.c:131 +#: src/mbox.c:132 msgid "reading file" msgstr "lese Datei" diff -urN elmo-0.8/po/elmo.pot elmo-0.8.1/po/elmo.pot --- elmo-0.8/po/elmo.pot 2003-07-01 11:57:28.000000000 +0200 +++ elmo-0.8.1/po/elmo.pot 2003-07-21 17:36:09.000000000 +0200 @@ -1,12 +1,13 @@ # SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Free Software Foundation, Inc. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2003-07-01 11:57+0200\n" +"POT-Creation-Date: 2003-07-21 17:36+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -14,11 +15,11 @@ "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: src/abook.c:166 +#: src/abook.c:445 msgid "addressbook" msgstr "" -#: src/abook.c:389 +#: src/abook.c:757 msgid "select address" msgstr "" @@ -30,70 +31,74 @@ msgid "file: " msgstr "" -#: src/cmd.c:294 +#: src/cmd.c:296 msgid "state stack overflow, please send bug report" msgstr "" -#: src/cmd.c:306 +#: src/cmd.c:308 msgid "state stack underflow, please send bug report" msgstr "" -#: confread.l:362 +#: confread.l:366 msgid "includes nested to deep" msgstr "" -#: confread.l:465 +#: confread.l:469 msgid "identifier" msgstr "" -#: confread.l:470 +#: confread.l:474 msgid "end of line" msgstr "" -#: confread.l:474 +#: confread.l:478 msgid "quoted text" msgstr "" -#: confread.l:480 +#: confread.l:484 msgid "key specifier" msgstr "" -#: confread.l:490 +#: confread.l:487 +msgid "end of file" +msgstr "" + +#: confread.l:497 #, c-format msgid "%s:%d: parse error near %s" msgstr "" -#: src/elmo.c:175 +#: src/elmo.c:171 #, c-format msgid "%s - ELectronic Mail Operator\n" msgstr "" -#: src/elmo.c:176 +#: src/elmo.c:172 #, c-format msgid "Usage: %s [OPTION]... \n" msgstr "" -#: src/elmo.c:177 +#: src/elmo.c:173 msgid "Options:\n" msgstr "" -#: src/elmo.c:178 +#: src/elmo.c:174 msgid " -F use alternate rc file\n" msgstr "" -#: src/elmo.c:179 +#: src/elmo.c:175 msgid " -h, --help display this help and exit\n" msgstr "" -#: src/elmo.c:180 +#: src/elmo.c:176 msgid " -V, --version output version information and exit\n" msgstr "" -#: src/elmo.c:261 +#: src/elmo.c:248 msgid " initializing..." msgstr "" -#: src/elmo.c:329 +#: src/elmo.c:319 msgid "ncurses: initialization failure\n" msgstr "" @@ -102,42 +107,42 @@ msgid "undefined function %s" msgstr "" -#: src/fetch.c:209 +#: src/fetch.c:199 msgid "server field in pop_acc not defined" msgstr "" -#: src/fetch.c:216 +#: src/fetch.c:206 msgid "username field in pop_acc not defined" msgstr "" -#: src/fetch.c:223 +#: src/fetch.c:213 msgid "password field in pop_acc not defined" msgstr "" -#: src/fetch.c:270 +#: src/fetch.c:260 #, c-format msgid "couldn't write to %s" msgstr "" -#: src/fetch.c:281 +#: src/fetch.c:271 #, c-format msgid "couldn't fetch mail %d" msgstr "" -#: src/fetch.c:307 +#: src/fetch.c:297 msgid "no new mail" msgstr "" -#: src/fetch.c:329 +#: src/fetch.c:323 msgid "fetch" msgstr "" -#: src/maildir.c:283 +#: src/maildir.c:284 #, c-format msgid "%s has bad format" msgstr "" -#: src/maildir.c:504 +#: src/maildir.c:505 msgid "reading directory" msgstr "" @@ -165,7 +170,7 @@ msgid " Attachments" msgstr "" -#: src/mbox.c:131 +#: src/mbox.c:132 msgid "reading file" msgstr "" Pliki binarne elmo-0.8/po/pl.gmo i elmo-0.8.1/po/pl.gmo siê ró¿ni± diff -urN elmo-0.8/po/pl.po elmo-0.8.1/po/pl.po --- elmo-0.8/po/pl.po 2003-07-01 11:57:28.000000000 +0200 +++ elmo-0.8.1/po/pl.po 2003-07-21 17:38:24.000000000 +0200 @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: elmo 0.6\n" -"POT-Creation-Date: 2003-07-01 11:57+0200\n" +"POT-Creation-Date: 2003-07-21 17:36+0200\n" "PO-Revision-Date: 2003-04-16 01:41+0200\n" "Last-Translator: Artur Skura \n" "Language-Team: Polish \n" @@ -16,11 +16,11 @@ "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" -#: src/abook.c:166 +#: src/abook.c:445 msgid "addressbook" msgstr "ksi±¿ka adresowa" -#: src/abook.c:389 +#: src/abook.c:757 msgid "select address" msgstr "wybierz adres" @@ -32,70 +32,75 @@ msgid "file: " msgstr "plik: " -#: src/cmd.c:294 +#: src/cmd.c:296 msgid "state stack overflow, please send bug report" msgstr "przepe³nienie bufora stanu, prosimy o przes³anie raportu o b³êdzie" -#: src/cmd.c:306 +#: src/cmd.c:308 msgid "state stack underflow, please send bug report" msgstr "niedope³nienie bufora stanu, prosimy o przes³anie raportu o b³êdzie" -#: confread.l:362 +#: confread.l:366 msgid "includes nested to deep" msgstr "" -#: confread.l:465 +#: confread.l:469 msgid "identifier" msgstr "" -#: confread.l:470 +#: confread.l:474 msgid "end of line" msgstr "" -#: confread.l:474 +#: confread.l:478 msgid "quoted text" msgstr "" -#: confread.l:480 +#: confread.l:484 msgid "key specifier" msgstr "" -#: confread.l:490 +#: confread.l:487 +#, fuzzy +msgid "end of file" +msgstr "odczytywanie pliku" + +#: confread.l:497 #, c-format msgid "%s:%d: parse error near %s" msgstr "%s:%d: b³±d parsowania przy %s" -#: src/elmo.c:175 +#: src/elmo.c:171 #, c-format msgid "%s - ELectronic Mail Operator\n" msgstr "%s - ELektroniczny prograM pOcztowy\n" -#: src/elmo.c:176 +#: src/elmo.c:172 #, c-format msgid "Usage: %s [OPTION]... \n" msgstr "Wywo³anie: %s [OPCJE]... \n" -#: src/elmo.c:177 +#: src/elmo.c:173 msgid "Options:\n" msgstr "Opcje:\n" -#: src/elmo.c:178 +#: src/elmo.c:174 msgid " -F use alternate rc file\n" msgstr " -F u¿yj innego pliku rc\n" -#: src/elmo.c:179 +#: src/elmo.c:175 msgid " -h, --help display this help and exit\n" msgstr " -h, --help wy¶wietl ten komunikat i zakoñcz pracê\n" -#: src/elmo.c:180 +#: src/elmo.c:176 msgid " -V, --version output version information and exit\n" msgstr " -V, --version wy¶wietl numer wersji i zakoñcz pracê\n" -#: src/elmo.c:261 +#: src/elmo.c:248 msgid " initializing..." msgstr " inicjalizacja..." -#: src/elmo.c:329 +#: src/elmo.c:319 msgid "ncurses: initialization failure\n" msgstr "b³ad inicjalizacji ncurses\n" @@ -104,42 +109,42 @@ msgid "undefined function %s" msgstr "niezdefiniowana funkcja %s" -#: src/fetch.c:209 +#: src/fetch.c:199 msgid "server field in pop_acc not defined" msgstr "" -#: src/fetch.c:216 +#: src/fetch.c:206 msgid "username field in pop_acc not defined" msgstr "" -#: src/fetch.c:223 +#: src/fetch.c:213 msgid "password field in pop_acc not defined" msgstr "" -#: src/fetch.c:270 +#: src/fetch.c:260 #, fuzzy, c-format msgid "couldn't write to %s" msgstr "zapis w katalogu %s nie jest mo¿liwy" -#: src/fetch.c:281 +#: src/fetch.c:271 #, c-format msgid "couldn't fetch mail %d" msgstr "nie mo¿na pobraæ listu nr %d" -#: src/fetch.c:307 +#: src/fetch.c:297 msgid "no new mail" msgstr "brak nowej poczty" -#: src/fetch.c:329 +#: src/fetch.c:323 msgid "fetch" msgstr "pobieranie" -#: src/maildir.c:283 +#: src/maildir.c:284 #, c-format msgid "%s has bad format" msgstr "%s ma z³y format" -#: src/maildir.c:504 +#: src/maildir.c:505 msgid "reading directory" msgstr "odczytywanie katalogu" @@ -169,7 +174,7 @@ msgid " Attachments" msgstr " Za³±czniki" -#: src/mbox.c:131 +#: src/mbox.c:132 msgid "reading file" msgstr "odczytywanie pliku" diff -urN elmo-0.8/src/abook.c elmo-0.8.1/src/abook.c --- elmo-0.8/src/abook.c 2003-06-19 11:18:01.000000000 +0200 +++ elmo-0.8.1/src/abook.c 2003-07-21 17:32:29.000000000 +0200 @@ -27,6 +27,7 @@ ****************************************************************************/ #include +#include #include #include #include @@ -44,26 +45,40 @@ #include "line.h" #include "read.h" #include "gettext.h" +#include "memblock.h" +#include "confread.h" +#include "abook.h" +#include "eprintf.h" +#include "str.h" +#include "sender.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS ****************************************************************************/ +#define INITIAL_BLOCK_SIZE 2048 #define ABOOK_WIDTH 80 +#define DFL_LOCATION() file_with_dir (getenv ("HOME"), ".addressbook") +#define PREAMBLE do { if (abook_select == NULL) return; } while (0) +#define PREAMBLE_ADD do { if (add_select == NULL) return; } while (0) + +#define DEFAULT_FORMAT "%s %020n %e" + /**************************************************************************** * IMPLEMENTATION PRIVATE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES ****************************************************************************/ + +typedef struct new_item { + addr_t *addr; + char **s_field; + int shift; + unsigned mask; +} new_item_t; + /**************************************************************************** * IMPLEMENTATION PRIVATE STRUCTURES / UTILITY CLASSES ****************************************************************************/ - -typedef struct abook_entry { - char *name; - raddress_t *addresses; - int flags; -} abook_entry_t; - /**************************************************************************** * IMPLEMENTATION REQUIRED EXTERNAL REFERENCES (AVOID) ****************************************************************************/ @@ -71,13 +86,45 @@ * IMPLEMENTATION PRIVATE DATA ****************************************************************************/ +/** + * This is to decide if the addressbook should be flushed back to the file. + */ +static int abook_changed = 0; + +/** + * This is to decide if the addressbook should be sorted before showing + * it to the user. + */ +static int abook_sorted = 0; + +/** + * This is the address book itself. It's just a set of addresses grouped + * in a single array. + */ static raddress_t *abook = NULL; +/** + * These are used when opening a window with addresses which should be added + * to the address book. + */ static select_t *add_select = NULL; static raddress_t *add_raddress = NULL; +/** + * Selection window with addresses from address book. + */ static select_t *abook_select = NULL; +/** + * This is used when reading configuration. + */ +static new_item_t new_item = {NULL, NULL, 0, 0}; + +/** + * All addressbook addresses are stored in this memblock. + */ +static memblock_t *addr_block = NULL; + /**************************************************************************** * INTERFACE DATA ****************************************************************************/ @@ -89,30 +136,20 @@ ****************************************************************************/ -static char * -make_item (line_t *line, address_t *addr) -{ - line_clear (line); - line_add_char (line, addr->flags & 0xff); - line_add_char (line, ' '); - line_add_str_pad (line, addr->name, 30); - line_add_char (line, ' '); - line_add_str (line, addr->email); - - return xstrdup (line->str); -} - - - static rstring_t * make_items (void) { - address_t **addr; + addr_t **addr; + char *fmt = ask_for_default ("abook_format", NULL); rstring_t *result = rstring_create_size (abook->count + 1); line_t *line = line_create (ABOOK_WIDTH - 2 + 1); + if (fmt == NULL) + fmt = DEFAULT_FORMAT; + + result->allocated_all = 1; for (addr = abook->array; *addr; addr++){ - rstring_add (result, make_item (line, *addr)); + rstring_add (result, eprintf_addr (fmt, *addr)); } line_destroy (line); return result; @@ -120,12 +157,84 @@ +static int +int_value (const char *s) +{ + if (strcmp (s, "M") == 0) + return SEX_MALE; + if (strcmp (s, "m") == 0) + return SEX_MALE; + if (strcmp (s, "male") == 0) + return SEX_MALE; + + if (strcmp (s, "F") == 0) + return SEX_FEMALE; + if (strcmp (s, "f") == 0) + return SEX_FEMALE; + if (strcmp (s, "female") == 0) + return SEX_FEMALE; + + if (strcmp (s, "Y") == 0) + return YES; + if (strcmp (s, "y") == 0) + return YES; + if (strcmp (s, "yes") == 0) + return YES; + if (strcmp (s, "YES") == 0) + return YES; + if (strcmp (s, "1") == 0) + return YES; + if (strcmp (s, "true") == 0) + return YES; + if (strcmp (s, "t") == 0) + return YES; + if (strcmp (s, "T") == 0) + return YES; + + return NO; +} + + +static void +write_addr (addr_t *addr, FILE *fp) +{ + fprintf (fp, "addr {\n"); + + if (addr->name) + fprintf (fp, " name:\t\t\"%s\"\n", addr->name); + if (addr->email) + fprintf (fp, " email:\t\t\"%s\"\n", addr->email); + if (addr->initials) + fprintf (fp, " initials:\t\"%s\"\n", addr->initials); + if (addr->flags.sex == SEX_MALE) + fprintf (fp, " sex:\t\tM\n"); + else if (addr->flags.sex == SEX_FEMALE) + fprintf (fp, " sex:\t\tF\n"); + if (addr->flags.official) + fprintf (fp, " official:\tY\n"); + if (addr->flags.foreign) + fprintf (fp, " foreign:\tY\n"); + + fprintf (fp, "}\n"); +} + + +static int +cmp_addr (const void *a, const void *b) +{ + const addr_t **aa = (const addr_t **) a; + const addr_t **bb = (const addr_t **) b; + + return address_cmp (*aa, *bb); +} + + /**************************************************************************** * INTERFACE FUNCTIONS ****************************************************************************/ void -abook_start (void) +abook_init (void) { } @@ -133,27 +242,194 @@ void -abook_sort (void) +abook_free_resources (void) { + if (addr_block){ + memblock_destroy (addr_block); + addr_block = NULL; + } + if (abook){ + raddress_destroy (abook); + abook = NULL; + } } void +abook_put_loaded (void) +{ + int i; + + if (abook == NULL) + abook_load (); + + if (abook == NULL) + return; + + for (i = 0; i < abook->count; i++) + address_complete (abook->array[i]); +} + + + +void +abook_load (void) +{ + char *dfl_location = DFL_LOCATION (); + char *fname = ask_for_default ("addressbook", NULL); + + if (fname == NULL) + fname = dfl_location; + + abook_free_resources (); + addr_block = memblock_create (INITIAL_BLOCK_SIZE); + abook = raddress_create (); + abook_sorted = 0; + confread_read_file (fname); + + xfree (dfl_location); +} + + +void abook_save (void) { + int i; + addr_t *addr; + char *dfl_location; + char *fname; + FILE *fp; + + + if (! abook_changed) + return; + dfl_location = DFL_LOCATION (); + fname = ask_for_default ("addressbook", NULL); + + if (fname == NULL) + fname = dfl_location; + + fp = fopen (fname, "w"); + if (fp == NULL){ + error_ (0, errno, "%s", fname); + xfree (dfl_location); + return; + } + + for (i = 0; i < abook->count; i++){ + addr = abook->array[i]; + write_addr (addr, fp); + } + + fclose (fp); + xfree (dfl_location); } void -abook_end (void) +abook_sort (void) +{ + if (abook_sorted) + return; + + /* do not sort addressbook when selection window is open */ + if (abook_select) + return; + + qsort (abook->array, abook->count, sizeof (addr_t *), cmp_addr); + abook_sorted = 1; +} + + +rstring_t * +abook_strings (const char *prefix) +{ + int i; + char *str; + addr_t *addr; + rstring_t *result = rstring_create_size (abook->count + 1); + + if (*prefix == '"') + prefix++; + + for (i = 0; i < abook->count; i++){ + addr = abook->array[i]; + if (*addr->full == '"') + str = addr->full + 1; + else + str = addr->full; + if (strstr (str, prefix) == str) + rstring_add (result, abook->array[i]->full); + } + + return result; +} + +/**************************************************************************** + * ADDRESSBOOK WINDOW PRIVATE DATA + ****************************************************************************/ + +/** + * This string holds list of addresses that may be a value of To field. + */ +static str_t *to_str = NULL; + +/**************************************************************************** + * ADDRESSBOOK WINDOW PRIVATE FUNCTIONS + ****************************************************************************/ + +static void +action_remove (int index) +{ + addr_t *addr = abook->array[index]; + + addr->flags.abook = NO; + + abook_changed = 1; + abook_sorted = 0; + raddress_remove (abook, index); +} + + +static void +action_add_to_str (int index) { + addr_t *addr = abook->array[index]; + + if (to_str->len == 0) + str_sprintf (to_str, "%s", addr->full); + else + str_sprintf (to_str, ", %s", addr->full); +} + + +static void +take_action (void (*fun)(int)) +{ + int i; + int took = 0; + + PREAMBLE; + + for (i = abook->count - 1; i >= 0; i--){ + if (bitarray_is_set (abook_select->selected, i)){ + fun (i); + took = 1; + } + } + if (! took){ + fun (abook_select->bar_pos); + } } +/**************************************************************************** + * ADDRESSBOOK WINDOW INTERFACE FUNCTIONS + ****************************************************************************/ void @@ -161,6 +437,9 @@ { rstring_t *items; + if (! abook_sorted) + abook_sort (); + items = make_items (); abook_select = select_open (items, ABOOK_WIDTH, 20, 1, 0, _("addressbook")); @@ -176,12 +455,11 @@ void abook_close (void) { - if (abook_select == NULL) - return; + PREAMBLE; - rstring_free_strings (abook_select->items); rstring_delete (abook_select->items); select_close (abook_select); + abook_select = NULL; cmd_state_pop (); } @@ -190,6 +468,8 @@ void abook_next (void) { + PREAMBLE; + select_next (abook_select); } @@ -198,6 +478,8 @@ void abook_prev (void) { + PREAMBLE; + select_prev (abook_select); } @@ -206,6 +488,8 @@ void abook_next_page (void) { + PREAMBLE; + select_next_page (abook_select); } @@ -214,6 +498,8 @@ void abook_prev_page (void) { + PREAMBLE; + select_prev_page (abook_select); } @@ -222,6 +508,8 @@ void abook_first (void) { + PREAMBLE; + select_first (abook_select); } @@ -230,19 +518,94 @@ void abook_last (void) { + PREAMBLE; + select_last (abook_select); } +void +abook_change (void) +{ + PREAMBLE; + + select_change (abook_select); +} + + + +void +abook_change_all (void) +{ + PREAMBLE; + + select_change_all (abook_select); +} + + +void +abook_set (void) +{ + PREAMBLE; + + select_set (abook_select); +} + + +void +abook_unset (void) +{ + PREAMBLE; + + select_unset (abook_select); +} + + +void +abook_set_all (void) +{ + PREAMBLE; + + select_set_all (abook_select); +} + + +void +abook_unset_all (void) +{ + PREAMBLE; + + select_unset_all (abook_select); +} + + void abook_remove (void) { - raddress_remove (abook, abook_select->bar_pos); - select_remove_selected (abook_select); + rstring_t *items; + + PREAMBLE; + + take_action (action_remove); + abook_sort (); + items = make_items (); + select_install_new_items (abook_select, items); } +void +abook_compose (void) +{ + PREAMBLE; + + to_str = str_create (); + take_action (action_add_to_str); + abook_close (); + sender_open_new_to (to_str->str); + str_destroy (to_str); + to_str = NULL; +} void @@ -251,8 +614,8 @@ char *name; char *email; char *flags; - address_t *addr; - char *item; + addr_t *addr = NULL; + char *item = NULL; line_t *line = line_create (ABOOK_WIDTH + 2 - 1); name = xstrdup (read_argument ("name: ", NULL, COMPLETE_NONE)); @@ -279,9 +642,9 @@ line_destroy (line); return; } - +/* addr = address_construct (email, name, *flags); - item = make_item (line, addr); +*/ raddress_add (abook, addr); select_add_item (abook_select, item); @@ -296,7 +659,7 @@ void abook_change_name (void) { - address_t *addr = abook->array[abook_select->bar_pos]; + addr_t *addr = abook->array[abook_select->bar_pos]; char *name = read_argument ("name: ", addr->name, COMPLETE_NONE); char **item = abook_select->items->array + abook_select->bar_pos; line_t *line = line_create (ABOOK_WIDTH + 2 - 1); @@ -306,9 +669,10 @@ return; } +/* addr = address_construct (addr->email, name, addr->flags); +*/ xfree (*item); - *item = make_item (line, addr); abook->array[abook_select->bar_pos] = addr; select_redraw (abook_select); @@ -320,7 +684,7 @@ void abook_change_email (void) { - address_t *addr = abook->array[abook_select->bar_pos]; + addr_t *addr = abook->array[abook_select->bar_pos]; char *email = read_argument ("email: ", addr->email, COMPLETE_NONE); char **item = abook_select->items->array + abook_select->bar_pos; line_t *line = line_create (ABOOK_WIDTH + 2 - 1); @@ -330,9 +694,10 @@ return; } +/* addr = address_construct (email, addr->name, addr->flags); +*/ xfree (*item); - *item = make_item (line, addr); abook->array[abook_select->bar_pos] = addr; select_redraw (abook_select); @@ -345,7 +710,6 @@ void abook_change_flag (void) { - address_t *addr = abook->array[abook_select->bar_pos]; char *flags = read_argument ("flag: ", NULL, COMPLETE_NONE); char **item = abook_select->items->array + abook_select->bar_pos; line_t *line = line_create (ABOOK_WIDTH + 2 - 1); @@ -355,15 +719,19 @@ return; } +/* addr->flags = *flags; +*/ xfree (*item); - *item = make_item (line, addr); select_redraw (abook_select); line_destroy (line); } +/**************************************************************************** + * ADDRESSBOOK ADDING WINDOW FUNCTIONS + ****************************************************************************/ void @@ -401,6 +769,8 @@ void abook_add_close (void) { + PREAMBLE_ADD; + if (add_raddress){ raddress_destroy (add_raddress); add_raddress = NULL; @@ -417,6 +787,8 @@ void abook_add_next (void) { + PREAMBLE_ADD; + select_next (add_select); } @@ -425,6 +797,8 @@ void abook_add_prev (void) { + PREAMBLE_ADD; + select_prev (add_select); } @@ -433,6 +807,8 @@ void abook_add_next_page (void) { + PREAMBLE_ADD; + select_next_page (add_select); } @@ -441,6 +817,8 @@ void abook_add_prev_page (void) { + PREAMBLE_ADD; + select_prev_page (add_select); } @@ -449,6 +827,8 @@ void abook_add_first (void) { + PREAMBLE_ADD; + select_first (add_select); } @@ -457,6 +837,8 @@ void abook_add_last (void) { + PREAMBLE_ADD; + select_last (add_select); } @@ -465,9 +847,115 @@ void abook_add_hit (void) { - address_t *addr = add_raddress->array[add_select->bar_pos]; + addr_t *addr; + + PREAMBLE_ADD; + + addr = add_raddress->array[add_select->bar_pos]; + if (addr->flags.abook) + return; + + addr = address_copy (addr, &addr_block); + addr->flags.abook = YES; + raddress_add (abook, addr); + abook_changed = 1; + abook_sorted = 0; + select_remove_selected (add_select); +} + + + +/**************************************************************************** + * CONFIG FUNCTIONS + ****************************************************************************/ + + +void +abook_new_prepare (void) +{ + memblock_set_mark (addr_block); + if (new_item.addr == NULL) + new_item.addr = address_empty_mem (&addr_block); +} + + + +void +abook_new_drop (void) +{ + memblock_free_marked (&addr_block); + new_item.addr = NULL; +} + + +/** + * this function _requires_ that the addressbook is read before any other + * address is added to address table + */ +void +abook_new_store (void) +{ + addr_t *addr; + if (new_item.addr == NULL) + return; + + new_item.addr->flags.abook = YES; + if (new_item.addr->name == NULL && new_item.addr->email == NULL){ + abook_new_drop (); + return; + } + + addr = address_complete_mem (new_item.addr, &addr_block); + if (addr != new_item.addr){ + abook_new_drop (); + return; + } raddress_add (abook, addr); + new_item.addr = NULL; +} + + + +void +abook_new_field (const char *field) +{ + new_item.s_field = NULL; + new_item.shift = 0; + new_item.mask = 0; + + if (strcmp (field, "name") == 0) + new_item.s_field = &new_item.addr->name; + else if (strcmp (field, "email") == 0) + new_item.s_field = &new_item.addr->email; + else if (strcmp (field, "sex") == 0){ + new_item.shift = A_SHIFT_SEX; + new_item.mask = A_MASK_SEX; + } + else if (strcmp (field, "initials") == 0) + new_item.s_field = &new_item.addr->initials; + else if (strcmp (field, "official") == 0){ + new_item.shift = A_SHIFT_OFFICIAL; + new_item.mask = A_MASK_OFFICIAL; + } + else if (strcmp (field, "foreign") == 0){ + new_item.shift = A_SHIFT_FOREIGN; + new_item.mask = A_MASK_FOREIGN; + } +} + + + +void +abook_new_value (const char *value) +{ + if (new_item.s_field){ + *new_item.s_field = memblock_strdup (&addr_block, value); + } + else if (new_item.mask){ + new_item.addr->flags.value |= (int_value (value) << new_item.shift) + & new_item.mask; + } } diff -urN elmo-0.8/src/abook.h elmo-0.8.1/src/abook.h --- elmo-0.8/src/abook.h 2003-04-01 15:59:37.000000000 +0200 +++ elmo-0.8.1/src/abook.h 2003-07-20 23:35:35.000000000 +0200 @@ -24,7 +24,7 @@ * INTERFACE REQUIRED HEADERS ****************************************************************************/ -#include "address.h" +#include "rstring.h" /**************************************************************************** * INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -42,10 +42,17 @@ * INTERFACE FUNCTION PROTOTYPES ****************************************************************************/ -extern void abook_start (void); +extern void abook_init (void); +extern void abook_free_resources (void); +extern void abook_put_loaded (void); +extern void abook_load (void); extern void abook_save (void); -extern void abook_end (void); -extern void abook_sort (void); + +extern void abook_new_prepare (void); +extern void abook_new_drop (void); +extern void abook_new_store (void); +extern void abook_new_field (const char *field); +extern void abook_new_value (const char *value); extern void abook_open (void); extern void abook_close (void); @@ -55,11 +62,18 @@ extern void abook_prev_page (void); extern void abook_first (void); extern void abook_last (void); +extern void abook_change (void); +extern void abook_change_all (void); +extern void abook_set (void); +extern void abook_unset (void); +extern void abook_set_all (void); +extern void abook_unset_all (void); extern void abook_change_name (void); extern void abook_change_email (void); extern void abook_change_flag (void); extern void abook_remove (void); extern void abook_insert (void); +extern void abook_compose (void); extern void abook_add_open (void); extern void abook_add_close (void); @@ -71,6 +85,8 @@ extern void abook_add_last (void); extern void abook_add_hit (void); +extern rstring_t *abook_strings (const char *prefix); + /**************************************************************************** * INTERFACE OBJECT CLASS DEFINITIONS ****************************************************************************/ diff -urN elmo-0.8/src/address.c elmo-0.8.1/src/address.c --- elmo-0.8/src/address.c 2003-06-13 10:09:08.000000000 +0200 +++ elmo-0.8.1/src/address.c 2003-07-21 17:10:25.000000000 +0200 @@ -26,31 +26,76 @@ * IMPLEMENTATION HEADERS ****************************************************************************/ -#include +#include #include +#include +#include #include #include "address.h" +#include "ask.h" #include "xmalloc.h" +#include "memblock.h" +#include "error.h" +#include "misc.h" #include "hash.h" -#include "elmo.h" -#include "memchunk.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS ****************************************************************************/ + +#define INITIAL_BLOCK_SIZE 2048 +#define INITIAL_HASH_SIZE 10 + +/**************************************************************************** + * REGULAR EXPRESSIONS + ****************************************************************************/ + +#define WS "([[:space:]]?)" + +#define ATEXT "([[:alpha:][:digit:]!#\\$%&\\\\\\'\\*\\+\\/\\=\\?\\^_\\`" \ + "\\{\\}\\~\\|\\-])" +#define ATOM "(" WS ATEXT "+" WS ")" +#define DOT_ATOM_TEXT "(" ATEXT "+(\\." ATEXT "+)*)" +#define DOT_ATOM "(" DOT_ATOM_TEXT ")" + +#define QUOTED_STRING "\"(([^\"])|(\\\\\"))*\"" +#define WORD "(" ATOM "|" QUOTED_STRING ")" +#define PHRASE "(" WORD "+)" + + +#define EMAIL_RE "(" DOT_ATOM "@" DOT_ATOM ")" +#define COMMENT_RE "[(][^()]*[)]" + +#define FEMALE_RE "^[^[:space:]]*[aA](([^[:alpha:]])|($))" +#define LAST_RE "[[:space:]][^[:space:]]+$" + /**************************************************************************** * IMPLEMENTATION PRIVATE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES ****************************************************************************/ /**************************************************************************** * IMPLEMENTATION PRIVATE STRUCTURES / UTILITY CLASSES ****************************************************************************/ + +struct table_set { + int used; + memblock_t *data_block; + htable_t *address_table; +}; + /**************************************************************************** * IMPLEMENTATION REQUIRED EXTERNAL REFERENCES (AVOID) ****************************************************************************/ /**************************************************************************** * IMPLEMENTATION PRIVATE DATA ****************************************************************************/ + +static struct table_set descriptors[ADDRESS_DESCRIPTORS_COUNT]; + +static struct table_set *current = NULL; + +static void (*iterator_fun)(addr_t *) = NULL; + /**************************************************************************** * INTERFACE DATA ****************************************************************************/ @@ -61,328 +106,633 @@ * IMPLEMENTATION PRIVATE FUNCTIONS ****************************************************************************/ + /** - * This function may get something like: - * - Ania Kowalska - * - Grzesiu - * - address@hidden + * ALGORITHM: + * 1. find email (according to RFC2822 syntax) in the addr->full string + * 2. if it is surrounded with angle brackets (<>), then set kind to + * email_in_angles + * 3. if the type of the addr is still unknown try to find a comment + * that can be used as a display name (this is an obsolete form + * described in RFC822); when found, set kind to name_as_comment + * 4. if the email was found (and nothing else), set kind to pure_email + * 5. set kind to strange */ -static char -get_sex (const char *name) +static void +determine_kind (addr_t *addr, memblock_t **data_block) { - char *seek; - - if (!name) - return 'M'; + int len; + int off; + regmatch_t matches[1]; - seek = strchr (name, ' '); - - /* option 1 */ - if (seek && seek > name){ - if (*(seek - 1) == 'a' || *(seek - 1) == 'A') - return 'F'; - else - return 'M'; - } - /* option 3 */ - else if ((seek = strchr (name, '@')) != NULL) { - do { - seek--; - } while (seek > name && !isalpha (*seek)); - if (*seek == 'a' || *seek == 'A') - return 'F'; - else - return 'M'; + if (addr->flags.kind != KIND_UNKNOWN) + return; + + if (misc_regex (EMAIL_RE, addr->full, matches) == 0){ + addr->email = NULL; + addr->flags.kind = KIND_NO_EMAIL; } - /* option 2 -- fallback */ else { - size_t len = strlen (name); - - if (name[len - 1] == 'a' || name[len - 1] == 'A') - return 'F'; - else - return 'M'; + len = matches[0].rm_eo - matches[0].rm_so; + off = matches[0].rm_so; + addr->email = memblock_malloc (data_block, len + 1); + memcpy (addr->email, addr->full + off, len); + addr->email[len] = '\0'; + + if (off > 0 && addr->full[off - 1] == '<' + && addr->full[off + len] == '>') + addr->flags.kind = KIND_EMAIL_IN_ANGLES; + else if (off > 0) + addr->flags.kind = KIND_STRANGE; + + if (off == 0 && addr->full[len] == '\0') + addr->flags.kind = KIND_PURE_EMAIL; + } + + if (addr->flags.kind != KIND_UNKNOWN) + return; + + if (misc_regex (COMMENT_RE, addr->full, matches)){ + addr->flags.kind = KIND_NAME_AS_COMMENT; + addr->first = addr->full + matches[0].rm_so; } + else + addr->flags.kind = KIND_STRANGE; } -static char * -get_name (char *addr, char **email) + +static void +strip_escapes (char *str) { - char *seek; - char *end; - char *result; + int len; + + if (str == NULL) + return; - if (!addr){ - *email = NULL; - return NULL; + len = strlen (str); + + while (*str){ + if (*str == '\\'){ + memmove (str, str + 1, len); + len--; + } + str++; + len--; } +} + - while (isspace (*addr) || *addr == '"') - addr++; +static void +strip_name (addr_t *addr) +{ + char *seek; + char *last; - /* - * option 1: John Doe - */ - seek = strchr (addr, '<'); - if (seek == addr){ - *email = addr + 1; - return xstrdup (addr); - } - - if (seek){ - - *email = seek + 1; - do - seek--; - while (seek > addr && (isspace (seek[-1]) || seek[-1] == '"')); - - result = xmalloc (seek - addr + 1); - result[seek - addr] = '\0'; - memcpy (result, addr, seek - addr); - return result; - } - - /* - * option 2: address@hidden (John Doe) - */ - *email = addr; - while (isspace (**email)) - (*email)++; - seek = strchr (addr, '('); - if (!seek) - return xstrdup (addr); - seek++; - end = strchr (addr, ')'); - if (!end) - return xstrdup (addr); - - result = xmalloc (end - seek + 1); - result[end - seek] = '\0'; - memcpy (result, seek, end - seek); - return result; + if (addr->name == NULL) + return; + + while (isspace (*addr->name) || *addr->name == '(') + addr->name++; + + last = seek = addr->name; + while (*seek){ + if (! isspace (*seek) && *seek != ')') + last = seek; + seek++; + } + seek = last + 1; + *seek = '\0'; } -static char * -get_email (char *s) +static void +strip_quotes (char *str) { - char old; - char *seek = s; - char *result; + char *src = str; + char *dest = str; + int off = 0; + int len = 0; + int slen; + regmatch_t matches[1]; + + if (str == NULL) + return; + + while (misc_regex (QUOTED_STRING, src, matches)){ + off = matches[0].rm_so; + len = matches[0].rm_eo - matches[0].rm_so; + + memmove (dest, src, off); + memmove (dest + off, src + off + 1, len - 2); + dest += off + len - 2; + src = src + matches[0].rm_eo; + } + + if (len){ + slen = strlen (src); + if (slen > 0) + memmove (dest, src + 1, slen - 1); + dest[slen] = '\0'; + } +} + - if (s == NULL) - return NULL; - while (isspace (*s)) - s++; +static void +determine_name (addr_t *addr, memblock_t **data_block) +{ + int len; + int off; + char *re = NULL; + regmatch_t matches[1]; - while (*seek){ - if (isspace (*seek) || *seek == '>') + if (addr->name != NULL) + return; + + switch (addr->flags.kind){ + + case KIND_UNKNOWN: + case KIND_PURE_EMAIL: + addr->name = NULL; + return; + + case KIND_NO_EMAIL: + addr->name = addr->full; + return; + + case KIND_EMAIL_IN_ANGLES: + case KIND_STRANGE: + re = PHRASE; + break; + + case KIND_NAME_AS_COMMENT: + re = COMMENT_RE; break; - seek++; } - old = *seek; - *seek = '\0'; - result = xstrdup (s); - *seek = old; - return result; + if (misc_regex (re, addr->full, matches)){ + off = matches[0].rm_so; + len = matches[0].rm_eo - matches[0].rm_so; + addr->name = memblock_malloc (data_block, len + 1); + memcpy (addr->name, addr->full + off, len); + addr->name[len] = '\0'; + } + else + addr->name = NULL; + + strip_name (addr); + strip_quotes (addr->name); + strip_escapes (addr->name); } -static int -have_special (const char *str) +static void +determine_sex (addr_t *addr) { - if (*str == '"') - return 0; + char *str = NULL; + regmatch_t matches[1]; - while (str && *str){ + if (addr->flags.sex != SEX_UNKNOWN) + return; + + if (addr->first) + str = addr->first; + else if (addr->name) + str = addr->name; + else if (addr->full) + str = addr->full; + else + str = addr->email; - if (*str == '.' || *str == '@' || *str == ')' || *str == '(' - || *str == '<' || *str == '>' || *str == '[' || *str == ']' - || *str == ':' || *str == ';' || *str == '\\' || *str == ',') - return 1; - str++; + if (str == NULL) + return; + + if (misc_regex (FEMALE_RE, str, matches)){ + addr->flags.sex = SEX_FEMALE; + } + else { + addr->flags.sex = SEX_MALE; } - return 0; } static void -make_full (address_t *addr) +find_last (addr_t *addr) { - size_t elen = strlen (addr->email); - size_t nlen = strlen (addr->name); - size_t dquote = 0; - char *result; + regmatch_t matches[1]; - if (have_special (addr->name)) - dquote = 2; + if (addr->name == NULL) + return; + + if (misc_regex (LAST_RE, addr->name, matches)){ + addr->last = addr->name + matches[0].rm_so + 1; + } +} - /* name _ < email > \0 */ - result = xmalloc (dquote + nlen + 1 + 1 + elen + 1 + 1); - memcpy (result + dquote / 2, addr->name, nlen); - memcpy (result + dquote + nlen + 2, addr->email, elen); - if (dquote){ - result[0] = '"'; - result[nlen + 1] = '"'; - } +static void +make_initials (addr_t *addr, memblock_t **data_block) +{ + int first = 1; + char *seek; + char *initials; + char *iseek; + + if (addr->name == NULL) + return; - result[nlen + dquote] = ' '; - result[nlen + dquote + 1] = '<'; - result[nlen + dquote + 1 + 1 + elen] = '>'; - result[nlen + dquote + 1 + 1 + elen + 1] = '\0'; + iseek = initials = xmalloc (strlen (addr->name)); + + for (seek = addr->name; *seek; seek++){ + if (isalpha (*seek) && first){ + *iseek = *seek; + first = 0; + iseek++; + } + else if (isspace (*seek)){ + first = 1; + } + } + *iseek = '\0'; + addr->initials = memblock_strdup (data_block, initials); + xfree (initials); +} + + +static void +make_full (addr_t *addr, memblock_t **data_block) +{ + if (addr->name && addr->email){ + addr->full = memblock_sprintf (data_block, "\"%s\" <%s>", addr->name, + addr->email); + } + else if (addr->name){ + addr->full = addr->name; + } + else { + addr->full = addr->email; + } +} + - addr->full = result; + +static void +complete_info (addr_t *addr, memblock_t **data_block) +{ + if (addr->full == NULL) + make_full (addr, data_block); + if (addr->flags.kind == KIND_UNKNOWN) + determine_kind (addr, data_block); + if (addr->name == NULL) + determine_name (addr, data_block); + if (addr->flags.sex == SEX_UNKNOWN) + determine_sex (addr); + if (addr->last == NULL) + find_last (addr); + if (addr->initials == NULL) + make_initials (addr, data_block); } +static addr_t * +insert (addr_t *addr) +{ + entry_t *entry; + + entry = htable_insert (current->address_table, addr->full, NULL); + if (entry->content != NULL) + return entry->content; -static char * -get_last (char *name) + entry->content = addr; + return NULL; +} + + +static void +iterator (entry_t *entry) { - char *seek = strrchr (name, ' '); + addr_t *addr = entry->content; - if (seek == NULL) - return NULL; + iterator_fun (addr); +} - do { - seek++; + +static void +replace_in_hash (addr_t *addr) +{ + entry_t *entry; + + entry = htable_insert (current->address_table, addr->full, NULL); + if (entry->key != addr->full){ + entry->key = addr->full; } - while (*seek && isspace (*seek)); - if (*seek == '\0') - seek = name; - return seek; + entry->content = addr; } - /**************************************************************************** * INTERFACE FUNCTIONS ****************************************************************************/ -/** - * Full name (i.e. "John Doe ") is a key in hash table. - * Once I wanted email address to be a key - field but it failed. - * Remember few things: - * - Do NOT alter address fields. This will influence address book. - * - Do NOT delete any address. They are all deleted at exit. - */ -address_t * -address_insert (address_t *addr) +void +address_init (void) { - entry_t *entry; + memset (descriptors, '\0', sizeof (descriptors)); +} + + + +void +address_free_resources (void) +{ + int i; + struct table_set *tset; + + for (i = 0; i < ADDRESS_DESCRIPTORS_COUNT; i++){ + tset = descriptors + i; + if (tset->used){ + if (tset->data_block) + memblock_destroy (tset->data_block); + if (tset->address_table) + htable_destroy (tset->address_table, NULL); + } + } + current = NULL; +} + + +/**************************************************************************** + * OBJECT OPERATIONS + ****************************************************************************/ + +addr_t * +address_empty_mem (memblock_t **data_block) +{ + addr_t *addr; + + if (! current || ! current->used) + return NULL; + + addr = memblock_malloc (data_block, sizeof (addr_t)); + + addr->full = NULL; + addr->email = NULL; + addr->name = NULL; + addr->first = NULL; + addr->last = NULL; + addr->initials = NULL; + addr->flags.value = 0; + + return addr; +} + + +addr_t * +address_empty (void) +{ + return address_empty_mem (¤t->data_block); +} + + +addr_t * +address_from_string_mem (const char *str, memblock_t **data_block) +{ + addr_t *addr; + addr_t *inserted; - if (addr == NULL || addr->full == NULL) + if (! current || ! current->used) return NULL; - entry = htable_insert (address_table, addr->full, NULL); - if (!entry->content){ - entry->content = addr; + addr = address_empty_mem (data_block); + addr->full = memblock_strdup (data_block, str); + inserted = insert (addr); + + if (inserted){ + memblock_free_last (*data_block); + return inserted; } - else { - address_destroy (addr); + + complete_info (addr, data_block); + return addr; +} + + +addr_t * +address_from_string (const char *str) +{ + return address_from_string_mem (str, ¤t->data_block); +} + + +addr_t * +address_complete_mem (addr_t *addr, memblock_t **data_block) +{ + addr_t *inserted; + + complete_info (addr, data_block); + + inserted = insert (addr); + + if (inserted){ + return inserted; } + + return addr; +} + + +addr_t * +address_complete (addr_t *addr) +{ + return address_complete_mem (addr, ¤t->data_block); +} + + +addr_t * +address_copy (addr_t *addr, memblock_t **data_block) +{ + addr_t *result = memblock_malloc (data_block, sizeof (addr_t)); - return entry->content; + if (addr->full) + result->full = memblock_strdup (data_block, addr->full); + if (addr->email) + result->email = memblock_strdup (data_block, addr->email); + if (addr->name) + result->name = memblock_strdup (data_block, addr->name); + if (addr->first) + result->first = memblock_strdup (data_block, addr->first); + if (addr->last) + result->last = memblock_strdup (data_block, addr->last); + if (addr->initials) + result->initials = memblock_strdup (data_block, addr->initials); + result->flags.value = addr->flags.value; + + replace_in_hash (result); + return result; } +/**************************************************************************** + * SERVICE FUNCTIONS + ****************************************************************************/ -address_t * -address_create (char *addr) +char * +address_wrote_format (addr_t *addr) { - char *email; - address_t *result = xcalloc (1, sizeof (address_t)); + switch (addr->flags.sex){ - while (isspace (*addr)) - addr++; - - result->name = get_name (addr, &email); - result->email = get_email (email); - result->flags = get_sex (result->name); - result->last = get_last (result->name); - result->name_short[ADDR_NAME_LEN] = '\0'; - strncpy (result->name_short, result->name, ADDR_NAME_LEN); + case SEX_UNKNOWN: + return NULL; - if (email != addr && have_special (result->name)) - make_full (result); + case SEX_MALE: + if (addr->flags.official) + return ask_for_default ("o_male_wrote", NULL); + else + return ask_for_default ("male_wrote", NULL); + + case SEX_FEMALE: + if (addr->flags.official) + return ask_for_default ("o_female_wrote", NULL); + else + return ask_for_default ("female_wrote", NULL); + + default: + return NULL; + } +} + + +int +address_cmp (const addr_t *a, const addr_t *b) +{ + char *as = NULL; + char *bs = NULL; + + if (a->last) + as = a->last; + else if (a->name) + as = a->name; else - result->full = xstrdup (addr); - - result = address_insert (result); + as = a->full; - return result; + if (b->last) + bs = b->last; + else if (b->name) + bs = b->name; + else + bs = b->full; + + if (as == NULL || bs == NULL) + return 0; + + return strcmp (as, bs); } -address_t * -address_construct (const char *email, const char *name, int flags) +int +address_open (void) { - address_t *result = xcalloc (1, sizeof (address_t)); - - result->email = xstrdup (email); - result->name = xstrdup (name); - result->last = get_last (result->name); - result->flags = flags; - result->name_short[ADDR_NAME_LEN] = '\0'; - strncpy (result->name_short, result->name, ADDR_NAME_LEN); - make_full (result); + int i; + struct table_set *tset; + + for (i = 0; i < ADDRESS_DESCRIPTORS_COUNT; i++){ + tset = descriptors + i; + if (! tset->used) + break; + } + if (i == ADDRESS_DESCRIPTORS_COUNT) + return -1; - result = address_insert (result); + tset->data_block = NULL; + tset->address_table = NULL; + tset->used = 1; - return result; + return i; } -address_t * -address_read (memchunk_t *memchunk) +void +address_close (int ad) { - char *addr = memchunk_strget (memchunk); - address_t *result; + struct table_set *tset; - if (addr == NULL) - return NULL; + if (ad < 0 || ad >= ADDRESS_DESCRIPTORS_COUNT) + return; - result = address_create (addr); - xfree (addr); - return result; -} + tset = descriptors + ad; + if (! tset->used) + return; + if (tset->data_block){ + memblock_destroy (tset->data_block); + tset->data_block = NULL; + } + if (tset->address_table){ + htable_destroy (tset->address_table, NULL); + tset->address_table = NULL; + } + tset->used = 0; +} void -address_destroy (address_t *addr) +address_point (int ad) { - if (addr->name) - xfree (addr->name); - if (addr->email) - xfree (addr->email); - if (addr->full) - xfree (addr->full); - xfree (addr); -} + if (ad < 0 || ad >= ADDRESS_DESCRIPTORS_COUNT) + return; + + current = descriptors + ad; + if (current->data_block == NULL) + current->data_block = memblock_create (INITIAL_BLOCK_SIZE); + if (current->address_table == NULL) + current->address_table = htable_create (INITIAL_HASH_SIZE); +} void -address_dump (memchunk_t *chunk, address_t *addr) +address_for_all (int ad, void (*fun)(addr_t *)) { - if (addr) - memchunk_strdump (chunk, addr->full); - else - memchunk_strdump (chunk, NULL); + struct table_set *tset; + + if (ad < 0 || ad >= ADDRESS_DESCRIPTORS_COUNT) + return; + + tset = descriptors + ad; + + if (tset->address_table){ + iterator_fun = fun; + htable_iterator (tset->address_table, iterator); + iterator_fun = NULL; + } +} + + + +int +address_count (int ad) +{ + struct table_set *tset; + + if (ad < 0 || ad >= ADDRESS_DESCRIPTORS_COUNT) + return -1; + + tset = descriptors + ad; + + if (tset->address_table) + return tset->address_table->count; + + return 0; } diff -urN elmo-0.8/src/address.h elmo-0.8.1/src/address.h --- elmo-0.8/src/address.h 2003-06-10 22:40:22.000000000 +0200 +++ elmo-0.8.1/src/address.h 2003-07-21 17:21:04.000000000 +0200 @@ -24,18 +24,57 @@ * INTERFACE REQUIRED HEADERS ****************************************************************************/ -#include "memchunk.h" +#include "memblock.h" /**************************************************************************** * INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS ****************************************************************************/ -#define ADDR_NAME_LEN 16 +/** + * email_kind describes one of the syntax, that can be used in an email: + * + * KIND_UNKNOWN -- there was no attempt to guess the type yet + * KIND_EMAIL_IN_ANGLES -- the "modern" syntax described in RFC 2822 + * example: rzyjontko + * KIND_NAME_AS_COMMENT -- the obsolete syntax described in RFC 822 + * example: address@hidden (rzyjontko) + * KIND_PURE_EMAIL -- just an email addres + * example: address@hidden + * KIND_NO_EMAIL -- possibly only user name for local delivery + * example: rzyj + * KIND_STRANGE -- email with something else, possibly syntax error + * example: rzyjontko < address@hidden > + */ +enum email_kind { + KIND_UNKNOWN = 0, + KIND_EMAIL_IN_ANGLES = 1, + KIND_NAME_AS_COMMENT = 2, + KIND_PURE_EMAIL = 3, + KIND_NO_EMAIL = 4, + KIND_STRANGE = 5, +}; + +enum email_sex { + SEX_UNKNOWN = 0, + SEX_MALE = 1, + SEX_FEMALE = 2, +}; + +enum yes_no { + NO = 0, + YES = 1, +}; + +#define A_SHIFT_SEX 3 +#define A_MASK_SEX (3 << A_SHIFT_SEX) -#define BOOK_ADDRESS 0x100 +#define A_SHIFT_OFFICIAL 5 +#define A_MASK_OFFICIAL (1 << A_SHIFT_OFFICIAL) -#define IS_MALE(addr) (((addr)->flags & 0xff) == 'M') -#define IS_FEMALE(addr) (((addr)->flags & 0xff) == 'F') +#define A_SHIFT_FOREIGN 6 +#define A_MASK_FOREIGN (1 << A_SHIFT_FOREIGN) + +#define ADDRESS_DESCRIPTORS_COUNT 4 /**************************************************************************** * INTERFACE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES @@ -45,19 +84,34 @@ ****************************************************************************/ /** - * This structure describes single email address of form: - * "Name Surname " - * "Nickname " - * "address@hidden (Name Surname)" + * full -- when parsing a message, this is the email, as appearing in + * a header field (To, From, etc.), otherwise it holds a string + * that may be put in a header field + * email -- address specifier of a message (see RFC2822) + * name -- display name of the address (see RFC2822), but maybe empty, + * in which case, there should be used email address + * last -- last name of the display name */ -typedef struct address { - char *full; /* whole string */ - char *email; /* "address@hidden" */ - char *name; /* "Name Surname" or "Nickname" */ - char *last; /* last name - but only pointer, not a copy */ - char name_short[ADDR_NAME_LEN + 1]; /* same as above but shorter */ - int flags; /* first byte is sex - 'M'/'F' */ -} address_t; +typedef struct addr { + int index; + char *full; + char *email; + char *name; + char *first; + char *last; + char *initials; + union { + struct { + enum email_kind kind : 3; + enum email_sex sex : 2; + enum yes_no official : 1; + enum yes_no foreign : 1; + enum yes_no abook : 1; + enum yes_no own : 1; + }; + unsigned value; + } flags; +} addr_t; /**************************************************************************** * INTERFACE DATA DECLARATIONS @@ -66,13 +120,26 @@ * INTERFACE FUNCTION PROTOTYPES ****************************************************************************/ -extern address_t *address_insert (address_t *addr); -extern address_t *address_create (char *addr); -extern address_t *address_construct (const char *email, const char *name, - int flags); -extern address_t *address_read (memchunk_t *memchunk); -extern void address_destroy (address_t *addr); -extern void address_dump (memchunk_t *memchunk, address_t *addr); +extern void address_init (void); +extern void address_free_resources (void); + +extern addr_t *address_empty_mem (memblock_t **data_block); +extern addr_t *address_empty (void); +extern addr_t *address_from_string_mem (const char *str, + memblock_t **data_block); +extern addr_t *address_from_string (const char *str); +extern addr_t *address_complete_mem (addr_t *addr, memblock_t **data_block); +extern addr_t *address_complete (addr_t *addr); +extern addr_t *address_copy (addr_t *addr, memblock_t **data_block); + +extern char *address_wrote_format (addr_t *addr); +extern int address_cmp (const addr_t *a, const addr_t *b); + +extern int address_open (void); +extern void address_close (int ad); +extern void address_point (int ad); +extern void address_for_all (int ad, void (*fun)(addr_t *)); +extern int address_count (int ad); /**************************************************************************** * INTERFACE OBJECT CLASS DEFINITIONS diff -urN elmo-0.8/src/atable.c elmo-0.8.1/src/atable.c --- elmo-0.8/src/atable.c 1970-01-01 01:00:00.000000000 +0100 +++ elmo-0.8.1/src/atable.c 2003-07-20 16:25:01.000000000 +0200 @@ -0,0 +1,237 @@ +/* + elmo - ELectronic Mail Operator + + Copyright (C) 2003 rzyjontko + + This program 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 2, 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, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ---------------------------------------------------------------------- + + +*/ +/**************************************************************************** + * IMPLEMENTATION HEADERS + ****************************************************************************/ + +#include "atable.h" +#include "hash.h" +#include "raddress.h" +#include "address.h" +#include "xmalloc.h" +#include "misc.h" +#include "memchunk.h" +#include "abook.h" + +/**************************************************************************** + * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE STRUCTURES / UTILITY CLASSES + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION REQUIRED EXTERNAL REFERENCES (AVOID) + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE DATA + ****************************************************************************/ + +static raddress_t *tables[ADDRESS_DESCRIPTORS_COUNT]; + +static raddress_t *destination = NULL; + +/**************************************************************************** + * INTERFACE DATA + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE FUNCTION PROTOTYPES + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE FUNCTIONS + ****************************************************************************/ + +static void +add_address (addr_t *addr) +{ + raddress_add (destination, addr); +} + + +/**************************************************************************** + * INTERFACE FUNCTIONS + ****************************************************************************/ + + +void +atable_dump (memchunk_t *chunk, int ad) +{ + int i; + int size = address_count (ad); + addr_t *addr; + raddress_t *list; + + if (size == 0 || size == -1){ + memchunk_intdump (chunk, 0); + return; + } + + list = raddress_create_size (size + 1); + destination = list; + address_for_all (ad, add_address); + destination = NULL; + + memchunk_intdump (chunk, size); + for (i = 0; i < size; i++){ + addr = list->array[i]; + addr->index = i; + memchunk_strdump (chunk, addr->full); + } + raddress_destroy (list); +} + + +void +atable_dump_addr (memchunk_t *chunk, addr_t *addr) +{ + if (addr == NULL) + memchunk_intdump (chunk, -1); + else + memchunk_intdump (chunk, addr->index); +} + + + +void +atable_dump_raddress (memchunk_t *chunk, raddress_t *ptr) +{ + int i; + + if (ptr == NULL){ + memchunk_intdump (chunk, 0); + return; + } + + memchunk_intdump (chunk, ptr->count); + for (i = 0; i < ptr->count; i++) + memchunk_intdump (chunk, ptr->array[i]->index); +} + + + +int +atable_read (memchunk_t *chunk) +{ + int i; + int ad = address_open (); + int size = memchunk_intget (chunk); + char *str; + addr_t *addr; + + if (ad == -1) + return -1; + + if (size == 0) + return ad; + + atable_point (ad); + tables[ad] = raddress_create_size (size + 1); + for (i = 0; i < size; i++){ + str = memchunk_strget (chunk); + addr = address_from_string (str); + if (addr){ + raddress_add (tables[ad], addr); + } + if (str) + xfree (str); + } + return ad; +} + + + +addr_t * +atable_read_addr (memchunk_t *chunk, int ad) +{ + int index = memchunk_intget (chunk); + + if (ad == -1) + return NULL; + + if (index == -1) + return NULL; + + if (tables[ad] == NULL) + return NULL; + + if (index > tables[ad]->count) + return NULL; + + return tables[ad]->array[index]; +} + + + +raddress_t * +atable_read_raddress (memchunk_t *chunk, int ad) +{ + int i; + int count = memchunk_intget (chunk); + raddress_t *result; + + if (count == 0) + return NULL; + + result = raddress_create_size (count + 1); + for (i = 0; i < count; i++){ + raddress_add (result, atable_read_addr (chunk, ad)); + } + return result; +} + + + +void +atable_finished (int ad) +{ + if (tables[ad]) + raddress_destroy (tables[ad]); + tables[ad] = NULL; +} + + + +/** + * it is a wrapper to address_point + * after switching to this address descriptor, addresses from addressbook + * are added + */ +void +atable_point (int ad) +{ + address_point (ad); + abook_put_loaded (); +} + + +/**************************************************************************** + * INTERFACE CLASS BODIES + ****************************************************************************/ +/**************************************************************************** + * + * END MODULE atable.c + * + ****************************************************************************/ diff -urN elmo-0.8/src/atable.h elmo-0.8.1/src/atable.h --- elmo-0.8/src/atable.h 1970-01-01 01:00:00.000000000 +0100 +++ elmo-0.8.1/src/atable.h 2003-07-15 18:58:31.000000000 +0200 @@ -0,0 +1,69 @@ +#ifndef __ATABLE_H__ +#define __ATABLE_H__ 1 +/* + elmo - ELectronic Mail Operator + + Copyright (C) 2003 rzyjontko + + This program 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 2, 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, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +/**************************************************************************** + * INTERFACE REQUIRED HEADERS + ****************************************************************************/ + +#include "address.h" +#include "raddress.h" +#include "hash.h" +#include "memchunk.h" +#include "memblock.h" + +/**************************************************************************** + * INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS + ****************************************************************************/ +/**************************************************************************** + * INTERFACE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES + ****************************************************************************/ +/**************************************************************************** + * INTERFACE STRUCTURES / UTILITY CLASSES + ****************************************************************************/ +/**************************************************************************** + * INTERFACE DATA DECLARATIONS + ****************************************************************************/ +/**************************************************************************** + * INTERFACE FUNCTION PROTOTYPES + ****************************************************************************/ + +extern void atable_dump (memchunk_t *chunk, int ad); +extern void atable_dump_addr (memchunk_t *chunk, addr_t *addr); +extern void atable_dump_raddress (memchunk_t *chunk, raddress_t *ptr); +extern int atable_read (memchunk_t *chunk); +extern raddress_t *atable_read_raddress (memchunk_t *chunk, int ad); +extern addr_t *atable_read_addr (memchunk_t *chunk, int ad); +extern void atable_finished (int ad); +extern void atable_point (int ad); + +/**************************************************************************** + * INTERFACE OBJECT CLASS DEFINITIONS + ****************************************************************************/ +/**************************************************************************** + * INTERFACE TRAILING HEADERS + ****************************************************************************/ +/**************************************************************************** + * + * END HEADER atable.h + * + ****************************************************************************/ +#endif diff -urN elmo-0.8/src/bitarray.c elmo-0.8.1/src/bitarray.c --- elmo-0.8/src/bitarray.c 1970-01-01 01:00:00.000000000 +0100 +++ elmo-0.8.1/src/bitarray.c 2003-07-20 11:01:49.000000000 +0200 @@ -0,0 +1,388 @@ +/* + elmo - ELectronic Mail Operator + + Copyright (C) 2003 rzyjontko + + This program 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 2, 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, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ---------------------------------------------------------------------- + + This file contains an implementation of bitarrays - arrays of bits, + efficient representation of sets. + +*/ +/**************************************************************************** + * IMPLEMENTATION HEADERS + ****************************************************************************/ + +#include + +#include "bitarray.h" +#include "xmalloc.h" + +/**************************************************************************** + * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE STRUCTURES / UTILITY CLASSES + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION REQUIRED EXTERNAL REFERENCES (AVOID) + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE DATA + ****************************************************************************/ +/**************************************************************************** + * INTERFACE DATA + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE FUNCTION PROTOTYPES + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE FUNCTIONS + ****************************************************************************/ + +static void +print_int (int a) +{ + printf (" %d", a); +} + +/**************************************************************************** + * INTERFACE FUNCTIONS + ****************************************************************************/ + +bitarray_t * +bitarray_create (int bits) +{ + bitarray_t *result; + + if (bits == 0) + return NULL; + + result = xmalloc (sizeof (bitarray_t)); + result->bits = bits; + result->size = (bits - 1) / 32 + 1; + result->array = xmalloc (result->size * 4); + return result; +} + + + +bitarray_t * +bitarray_reverse (bitarray_t *b) +{ + int i; + bitarray_t *result; + + result = bitarray_create (b->bits); + bitarray_ones (result); + for (i = 0; i < result->size; i++) + result->array[i] ^= b->array[i]; + return result; +} + + +void +bitarray_resize (bitarray_t *a, int bits) +{ + int size; + + a->bits = bits; + size = (bits - 1) / 32 + 1; + + if (size > a->size){ + a->size = size; + a->array = xrealloc (a->array, size * 4); + } +} + + +void +bitarray_remove (bitarray_t *a, int index) +{ + if (bitarray_is_set (a, a->bits - 1)) + bitarray_set (a, index); + else + bitarray_unset (a, index); + + a->bits--; +} + + + +void +bitarray_destroy (bitarray_t *a) +{ + if (a == NULL) + return; + + if (a && a->array) + xfree (a->array); + if (a) + xfree (a); +} + + + +void +bitarray_zeros (bitarray_t *a) +{ + int i; + + if (a == NULL) + return; + + for (i = 0; i < a->size; i++) + a->array[i] ^= a->array[i]; +} + + + +void +bitarray_ones (bitarray_t *a) +{ + int i; + + if (a == NULL) + return; + + for (i = 0; i < a->size; i++) + a->array[i] |= ~a->array[i]; +} + + + +void +bitarray_set (bitarray_t *a, int bit) +{ + if (a == NULL) + return; + + if (bit > a->bits) + return; + + a->array[bit / 32] |= (1 << (bit % 32)); +} + + + +void +bitarray_unset (bitarray_t *a, int bit) +{ + if (a == NULL) + return; + + if (bit > a->bits) + return; + + a->array[bit / 32] &= ~ (1 << (bit % 32)); +} + + + +void +bitarray_change_bit (bitarray_t *a, int bit) +{ + if (a == NULL) + return; + + if (bit > a->bits) + return; + + a->array[bit / 32] ^= (1 << (bit % 32)); +} + + + +void +bitarray_neg (bitarray_t *a) +{ + int i; + + for (i = 0; i < a->size; i++) + a->array[i] ^= ~ 0; +} + + + +void +bitarray_sum (bitarray_t *a, bitarray_t *b) +{ + int i; + + for (i = 0; i < a->size; i++) + a->array[i] |= b->array[i]; +} + + + +void +bitarray_intersect (bitarray_t *a, bitarray_t *b) +{ + int i; + + for (i = 0; i < a->size; i++) + a->array[i] &= b->array[i]; +} + + + +void +bitarray_subtract (bitarray_t *a, bitarray_t *b) +{ + int i; + + for (i = 0; i < a->size; i++) + a->array[i] &= ~ b->array[i]; +} + + +int +bitarray_equal (bitarray_t *a, bitarray_t *b) +{ + int i; + + for (i = 0; i < a->size; i++) + if (a->array[i] != b->array[i]) + return 0; + return 1; +} + + + +void +bitarray_copy (bitarray_t *to, bitarray_t *from) +{ + int i; + + for (i = 0; i < to->size; i++) + to->array[i] = from->array[i]; +} + + + +int +bitarray_is_set (bitarray_t *a, int bit) +{ + return a->array[bit / 32] & (1 << (bit % 32)); +} + + + +void +bitarray_for_ones (bitarray_t *a, void (*fun)(int)) +{ + int i, j; + + if (a == NULL) + return; + + for (i = 0; i < a->size; i++){ + for (j = 0; j < 32 && 32 * i + j < a->bits; j++){ + if ((a->array[i] & (1 << j)) != 0) + fun (32 * i + j); + } + } +} + + + +void +bitarray_print (bitarray_t *a) +{ + bitarray_for_ones (a, print_int); + printf ("\n"); +} + + + +int +bitarray_ones_count (bitarray_t *a) +{ + unsigned x; + int i; + int result = 0; + + for (i = 0; i < a->size; i++){ + x = a->array[i]; + while (x){ + x &= x - 1; + result++; + } + } + return result; +} + + + +int +bitarray_true_for_all (bitarray_t *a, int (*fun)(int)) +{ + int i; + int j; + + for (i = 0; i < a->size; i++){ + for (j = 0; j < 32 && 32 * i + j < a->bits; j++){ + if ((a->array[i] & (1 << j)) != 0) + if (! fun (32 * i + j)) + return 0; + } + } + return 1; +} + + + +int +bitarray_first_set (bitarray_t *a) +{ + int i; + int j; + + for (i = 0; i < a->size; i++){ + for (j = 0; j < 32 && 32 * i + j < a->bits; j++){ + if ((a->array[i] & (1 << j)) != 0) + return 32 * i + j; + } + } + return -1; +} + + + +int +bitarray_none_is_set (bitarray_t *a) +{ + int i; + + for (i = 0; i < a->size; i++){ + if (a->array[i]) + break; + } + return i == a->size; +} + +/**************************************************************************** + * INTERFACE CLASS BODIES + ****************************************************************************/ +/**************************************************************************** + * + * END MODULE bitarray.c + * + ****************************************************************************/ diff -urN elmo-0.8/src/bitarray.h elmo-0.8.1/src/bitarray.h --- elmo-0.8/src/bitarray.h 1970-01-01 01:00:00.000000000 +0100 +++ elmo-0.8.1/src/bitarray.h 2003-07-20 11:02:52.000000000 +0200 @@ -0,0 +1,84 @@ +#ifndef __BITARRAY_H__ +#define __BITARRAY_H__ 1 +/* + elmo - ELectronic Mail Operator + + Copyright (C) 2003 rzyjontko + + This program 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 2, 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, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +/**************************************************************************** + * INTERFACE REQUIRED HEADERS + ****************************************************************************/ +/**************************************************************************** + * INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS + ****************************************************************************/ +/**************************************************************************** + * INTERFACE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES + ****************************************************************************/ +/**************************************************************************** + * INTERFACE STRUCTURES / UTILITY CLASSES + ****************************************************************************/ + +typedef struct bitarray { + unsigned *array; + int size; + int bits; +} bitarray_t; + +/**************************************************************************** + * INTERFACE DATA DECLARATIONS + ****************************************************************************/ +/**************************************************************************** + * INTERFACE FUNCTION PROTOTYPES + ****************************************************************************/ + +extern bitarray_t *bitarray_create (int bits); +extern bitarray_t *bitarray_reverse (bitarray_t *b); +extern void bitarray_destroy (bitarray_t *a); +extern void bitarray_resize (bitarray_t *a, int bits); +extern void bitarray_remove (bitarray_t *a, int index); +extern void bitarray_zeros (bitarray_t *a); +extern void bitarray_ones (bitarray_t *a); +extern void bitarray_set (bitarray_t *a, int bit); +extern void bitarray_unset (bitarray_t *a, int bit); +extern void bitarray_change_bit (bitarray_t *a, int bit); +extern void bitarray_neg (bitarray_t *a); +extern void bitarray_sum (bitarray_t *a, bitarray_t *b); +extern void bitarray_intersect (bitarray_t *a, bitarray_t *b); +extern void bitarray_subtract (bitarray_t *a, bitarray_t *b); +extern int bitarray_equal (bitarray_t *a, bitarray_t *b); +extern void bitarray_copy (bitarray_t *to, bitarray_t *from); +extern int bitarray_is_set (bitarray_t *a, int bit); +extern void bitarray_for_ones (bitarray_t *a, void (*fun)(int)); +extern void bitarray_print (bitarray_t *a); +extern int bitarray_ones_count (bitarray_t *a); +extern int bitarray_true_for_all (bitarray_t *a, int (*fun)(int)); +extern int bitarray_first_set (bitarray_t *a); +extern int bitarray_none_is_set (bitarray_t *a); + +/**************************************************************************** + * INTERFACE OBJECT CLASS DEFINITIONS + ****************************************************************************/ +/**************************************************************************** + * INTERFACE TRAILING HEADERS + ****************************************************************************/ +/**************************************************************************** + * + * END HEADER bitarray.h + * + ****************************************************************************/ +#endif diff -urN elmo-0.8/src/cmd.c elmo-0.8.1/src/cmd.c --- elmo-0.8/src/cmd.c 2003-06-23 21:23:57.000000000 +0200 +++ elmo-0.8.1/src/cmd.c 2003-07-20 23:41:10.000000000 +0200 @@ -160,6 +160,8 @@ keymap_add (keymaps + CMD_ABOOK, 'f', abook_change_flag); keymap_add (keymaps + CMD_ABOOK, 'a', abook_insert); keymap_add (keymaps + CMD_ABOOK, 'q', abook_close); + keymap_add (keymaps + CMD_ABOOK, ' ', abook_change); + keymap_add (keymaps + CMD_ABOOK, 'm', abook_compose); keymap_add (keymaps + CMD_READ_MAIL, 'q', mailreader_close); keymap_add (keymaps + CMD_READ_MAIL, KEY_PPAGE, mailreader_page_up); diff -urN elmo-0.8/src/compose.c elmo-0.8.1/src/compose.c --- elmo-0.8/src/compose.c 2003-06-26 11:42:36.000000000 +0200 +++ elmo-0.8.1/src/compose.c 2003-07-21 00:01:28.000000000 +0200 @@ -63,6 +63,7 @@ #include "eprintf.h" #include "wrapbox.h" #include "misc.h" +#include "read.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -269,9 +270,12 @@ result = xmalloc (14 + s_len + 1); if (subj && *subj){ - seek = strstr (subj, prefix); + if (prefix) + seek = strstr (subj, prefix); + else + seek = subj; - if (!seek) + if (! seek) sprintf (result, "Subject: %s %s", prefix, subj); else sprintf (result, "Subject: %s", subj); @@ -300,20 +304,11 @@ static char * make_wrote (mail_t *mail) { - char what[10]; char *result; char *fmt = NULL; - char who = '\0'; - - if (mail->from) - who = mail->from->flags & 0xff; - if (who){ - sprintf (what, "%c_wrote", who); - fmt = ask_for_default (what, NULL); - } - - if (fmt == NULL || *fmt == '\0') + fmt = address_wrote_format (mail->from); + if (fmt == NULL) fmt = DEFAULT_REPLY_FMT; result = eprintf_mail (fmt, mail, NULL); @@ -462,25 +457,35 @@ ****************************************************************************/ char * -compose_new (void) +compose_new (char *to) { char *ret; - rstring_t *header = rstring_create (); - address_t *to = NULL; + char *subject; + rstring_t *header; + + if (to == NULL) + to = xstrdup (read_argument ("To: ", NULL, COMPLETE_ADDRS)); + if (to == NULL) + return NULL; + + subject = read_argument ("Subject: ", NULL, COMPLETE_NONE); + if (subject == NULL){ + xfree (to); + return NULL; + } + header = rstring_create (); compose_act = COMPOSE_NEW; rstring_add (header, make_from ()); - if (to) - rstring_add (header, make_to (to->full)); - else - rstring_add (header, make_to ("")); - rstring_add (header, make_subject ("", NULL)); + rstring_add (header, make_to (to)); + rstring_add (header, make_subject (subject, NULL)); rstring_add (header, make_empty_line ()); rstring_add (header, make_signature ()); ret = make_file_and_run (header, header->count, header->count, NULL); + xfree (to); rstring_free_strings (header); rstring_delete (header); @@ -507,6 +512,9 @@ compose_act = COMPOSE_REPLY; + if (mail->recv_for && mail->recv_for->email) + ask_change_where (sender_ask, "email", mail->recv_for->email); + rstring_add (header, make_from ()); if (mail->reply_to) rstring_add (header, make_to (mail->reply_to->full)); @@ -550,7 +558,7 @@ char * -compose_fwd (void) +compose_fwd (char *to) { mail_t *mail = folder_mail_selected (); rstring_t *header; @@ -562,12 +570,20 @@ PREAMBLE; + if (to == NULL) + to = read_argument ("To: ", NULL, COMPLETE_ADDRS); + if (to == NULL) + return NULL; + header = rstring_create (); compose_act = COMPOSE_FWD; + if (mail->recv_for && mail->recv_for->email) + ask_change_where (sender_ask, "email", mail->recv_for->email); + rstring_add (header, make_from ()); - rstring_add (header, make_to ("")); + rstring_add (header, make_to (to)); rstring_add (header, make_subject (mail->subject, "Fwd:")); rstring_add (header, make_empty_line ()); diff -urN elmo-0.8/src/compose.h elmo-0.8.1/src/compose.h --- elmo-0.8/src/compose.h 2003-04-01 15:59:37.000000000 +0200 +++ elmo-0.8.1/src/compose.h 2003-07-20 21:59:45.000000000 +0200 @@ -43,9 +43,9 @@ * INTERFACE FUNCTION PROTOTYPES ****************************************************************************/ -extern char *compose_new (void); +extern char *compose_new (char *to); extern char *compose_reply (void); -extern char *compose_fwd (void); +extern char *compose_fwd (char *to); extern char *compose_date (void); extern char *compose_msg_id (void); extern char *compose_boundary (void); diff -urN elmo-0.8/src/confhold.c elmo-0.8.1/src/confhold.c --- elmo-0.8/src/confhold.c 2003-05-18 13:24:18.000000000 +0200 +++ elmo-0.8.1/src/confhold.c 2003-07-20 17:32:47.000000000 +0200 @@ -314,11 +314,14 @@ void confhold_select_where (int cd, const char *field, const char *desired) { - int index; + int index; + vitem_t *old_selected; if (conf_table[cd].unused) return; + old_selected = conf_table[cd].selected; + index = field_index (conf_table[cd].citem, field); for (conf_table[cd].selected = conf_table[cd].vitem; conf_table[cd].selected; @@ -326,6 +329,9 @@ if (! strcmp (conf_table[cd].selected->m_value->array[index], desired)) break; } + + if (conf_table[cd].selected == NULL) + conf_table[cd].selected = old_selected; } diff -urN elmo-0.8/src/confread.c elmo-0.8.1/src/confread.c --- elmo-0.8/src/confread.c 2003-06-19 11:18:01.000000000 +0200 +++ elmo-0.8.1/src/confread.c 2003-07-20 11:49:12.000000000 +0200 @@ -18,7 +18,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvsroot/elmo/elmo/src/confread.c,v 1.29 2003/06/19 09:18:01 rzyjontko Exp $ + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ */ #define FLEX_SCANNER @@ -41,12 +41,6 @@ #include #ifndef _WIN32 #include -#else -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif #endif /* Use prototypes in function declarations. */ @@ -87,6 +81,7 @@ #define YY_PROTO(proto) () #endif + /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -568,6 +563,7 @@ #include "keymap.h" #include "cmd.h" #include "gettext.h" +#include "abook.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -612,9 +608,6 @@ /**************************************************************************** * IMPLEMENTATION REQUIRED EXTERNAL REFERENCES (AVOID) ****************************************************************************/ - - extern char *stpcpy (char *dest, const char *src); - /**************************************************************************** * IMPLEMENTATION PRIVATE DATA ****************************************************************************/ @@ -623,9 +616,15 @@ /** * this is used for recursive file inclusion + * + * fstack and ftop are to be used only by frame_pop, and frame_push + * others should use these functions and get data from fframe + * + * ftop points to the top used frame, so that fstack[ftop + 1] is the + * first available */ static finfo_t fstack[MAX_DEPTH]; - static int ftop = 0; + static int ftop = -1; static finfo_t *fframe; /** @@ -666,7 +665,7 @@ * INTERFACE FUNCTIONS ****************************************************************************/ -#line 670 "confread.c" +#line 669 "confread.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -831,10 +830,10 @@ register char *yy_cp, *yy_bp; register int yy_act; -#line 168 "confread.l" +#line 172 "confread.l" -#line 838 "confread.c" +#line 837 "confread.c" if ( yy_init ) { @@ -920,62 +919,62 @@ case 1: YY_RULE_SETUP -#line 170 "confread.l" +#line 174 "confread.l" /* ignore */ YY_BREAK case 2: YY_RULE_SETUP -#line 172 "confread.l" +#line 176 "confread.l" /* ignore */ YY_BREAK case 3: YY_RULE_SETUP -#line 174 "confread.l" +#line 178 "confread.l" return KW_SET; YY_BREAK case 4: YY_RULE_SETUP -#line 176 "confread.l" +#line 180 "confread.l" return KW_KEY; YY_BREAK case 5: YY_RULE_SETUP -#line 178 "confread.l" +#line 182 "confread.l" return KW_HOOK; YY_BREAK case 6: YY_RULE_SETUP -#line 180 "confread.l" +#line 184 "confread.l" return KW_SET; YY_BREAK case 7: YY_RULE_SETUP -#line 182 "confread.l" +#line 186 "confread.l" return KW_ADDR; YY_BREAK case 8: YY_RULE_SETUP -#line 184 "confread.l" +#line 188 "confread.l" return KW_INCLUDE; YY_BREAK case 9: YY_RULE_SETUP -#line 186 "confread.l" +#line 190 "confread.l" return IDENTIFIER; YY_BREAK case 10: YY_RULE_SETUP -#line 188 "confread.l" +#line 192 "confread.l" return SQUOTED; YY_BREAK case 11: YY_RULE_SETUP -#line 190 "confread.l" +#line 194 "confread.l" return DQUOTED; YY_BREAK case 12: YY_RULE_SETUP -#line 192 "confread.l" +#line 196 "confread.l" { if (*yytext == '\\') token_key = yytext[1]; @@ -986,7 +985,7 @@ YY_BREAK case 13: YY_RULE_SETUP -#line 200 "confread.l" +#line 204 "confread.l" { int f; @@ -1029,7 +1028,7 @@ YY_BREAK case 14: YY_RULE_SETUP -#line 240 "confread.l" +#line 244 "confread.l" { token_key = strtol (yytext + 1, NULL, 8); return KEY_VALUE; @@ -1037,7 +1036,7 @@ YY_BREAK case 15: YY_RULE_SETUP -#line 245 "confread.l" +#line 249 "confread.l" { token_key = yytext[2] - 'a' + 1; return KEY_CONTROL; @@ -1045,26 +1044,26 @@ YY_BREAK case 16: YY_RULE_SETUP -#line 250 "confread.l" +#line 254 "confread.l" fframe->lineno++; YY_BREAK case 17: YY_RULE_SETUP -#line 252 "confread.l" +#line 256 "confread.l" fframe->lineno++; return EOL; YY_BREAK case 18: YY_RULE_SETUP -#line 254 "confread.l" +#line 258 "confread.l" return TEXT; YY_BREAK case 19: YY_RULE_SETUP -#line 256 "confread.l" +#line 260 "confread.l" return *yytext; YY_BREAK case YY_STATE_EOF(INITIAL): -#line 258 "confread.l" +#line 262 "confread.l" { if (ftop > 0) frame_pop (); @@ -1076,10 +1075,10 @@ YY_BREAK case 20: YY_RULE_SETUP -#line 267 "confread.l" +#line 271 "confread.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1083 "confread.c" +#line 1082 "confread.c" case YY_END_OF_BUFFER: { @@ -1969,7 +1968,7 @@ return 0; } #endif -#line 267 "confread.l" +#line 271 "confread.l" @@ -2145,7 +2144,7 @@ { static char token_txt[2] = {'\0', '\0'}; - if (token < 255){ + if (token > 0 && token < 255){ *token_txt = token; return token_txt; } @@ -2184,6 +2183,9 @@ case KEY_SIMPLE: case KEY_VALUE: return _("key specifier"); + + case EOF: + return _("end of file"); } return ""; @@ -2432,6 +2434,8 @@ static int addr_field_value (void) { + char *txt; + switch (current_token){ case IDENTIFIER: @@ -2440,6 +2444,11 @@ case DQUOTED: case KEY_SIMPLE: match (current_token); + txt = expand (token_txt); + if (txt){ + abook_new_value (txt); + xfree (txt); + } return 0; default: @@ -2460,6 +2469,7 @@ case IDENTIFIER: match (IDENTIFIER); + abook_new_field (token_txt); if (match (':')) return 1; return addr_field_value (); @@ -2497,9 +2507,15 @@ if (match (EOL)) return 1; - if (addr_value ()) + abook_new_prepare (); + + if (addr_value ()){ + abook_new_drop (); return 1; + } + abook_new_store (); + return match ('}'); } diff -urN elmo-0.8/src/confread.l elmo-0.8.1/src/confread.l --- elmo-0.8/src/confread.l 2003-06-19 11:18:01.000000000 +0200 +++ elmo-0.8.1/src/confread.l 2003-07-15 13:27:48.000000000 +0200 @@ -53,6 +53,7 @@ #include "keymap.h" #include "cmd.h" #include "gettext.h" +#include "abook.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -97,9 +98,6 @@ /**************************************************************************** * IMPLEMENTATION REQUIRED EXTERNAL REFERENCES (AVOID) ****************************************************************************/ - - extern char *stpcpy (char *dest, const char *src); - /**************************************************************************** * IMPLEMENTATION PRIVATE DATA ****************************************************************************/ @@ -108,9 +106,15 @@ /** * this is used for recursive file inclusion + * + * fstack and ftop are to be used only by frame_pop, and frame_push + * others should use these functions and get data from fframe + * + * ftop points to the top used frame, so that fstack[ftop + 1] is the + * first available */ static finfo_t fstack[MAX_DEPTH]; - static int ftop = 0; + static int ftop = -1; static finfo_t *fframe; /** @@ -439,7 +443,7 @@ { static char token_txt[2] = {'\0', '\0'}; - if (token < 255){ + if (token > 0 && token < 255){ *token_txt = token; return token_txt; } @@ -478,6 +482,9 @@ case KEY_SIMPLE: case KEY_VALUE: return _("key specifier"); + + case EOF: + return _("end of file"); } return ""; @@ -726,6 +733,8 @@ static int addr_field_value (void) { + char *txt; + switch (current_token){ case IDENTIFIER: @@ -734,6 +743,11 @@ case DQUOTED: case KEY_SIMPLE: match (current_token); + txt = expand (token_txt); + if (txt){ + abook_new_value (txt); + xfree (txt); + } return 0; default: @@ -754,6 +768,7 @@ case IDENTIFIER: match (IDENTIFIER); + abook_new_field (token_txt); if (match (':')) return 1; return addr_field_value (); @@ -791,9 +806,15 @@ if (match (EOL)) return 1; - if (addr_value ()) + abook_new_prepare (); + + if (addr_value ()){ + abook_new_drop (); return 1; + } + abook_new_store (); + return match ('}'); } diff -urN elmo-0.8/src/elmo.c elmo-0.8.1/src/elmo.c --- elmo-0.8/src/elmo.c 2003-06-19 11:18:01.000000000 +0200 +++ elmo-0.8.1/src/elmo.c 2003-07-21 17:16:52.000000000 +0200 @@ -117,9 +117,6 @@ /**************************************************************************** * INTERFACE DATA ****************************************************************************/ - -htable_t *address_table = NULL; - /**************************************************************************** * IMPLEMENTATION PRIVATE FUNCTION PROTOTYPES ****************************************************************************/ @@ -127,7 +124,6 @@ static void usage (int status); static int decode_switches (int argc, char **argv); static void setup_window (void); -static void destroy_content (void *); /**************************************************************************** * IMPLEMENTATION PRIVATE FUNCTIONS @@ -185,17 +181,6 @@ static void -destroy_content (void *ptr) -{ - address_t *addr = (address_t *)ptr; - - address_destroy (addr); -} - - - - -static void variable_registration (void) { confhold_register ("addressbook", 0); @@ -203,6 +188,8 @@ confhold_register ("indent_string", 0); confhold_register ("line_format", 0); confhold_register ("sent_format", 0); + confhold_register ("abook_format", 0); + confhold_register ("fetch_format", 0); confhold_register ("sigfile", 0); confhold_register ("sig_dashes", 0); confhold_register ("relative_names", 0); @@ -284,9 +271,14 @@ configuration (); /** + * needs: configuration + */ + address_init (); + + /** * needs: error, configuration */ - abook_start (); + abook_init (); folder_init (); screen_doupdate (); @@ -323,8 +315,6 @@ signal (SIGFPE, curses_cleanup); signal (SIGABRT, curses_cleanup); - address_table = htable_create (8); - if (!initscr ()){ fprintf (stderr, _("ncurses: initialization failure\n")); exit (EXIT_FAILURE); @@ -387,12 +377,13 @@ net_free_resources (); pop_free_resources (); read_free_resources (); - abook_end (); folder_free_resources (); bayes_free_resources (); exec_free_resources (); wrapbox_free_resources (); - htable_destroy (address_table, destroy_content); + address_free_resources (); + abook_save (); + abook_free_resources (); error_free_resources (); status_free_resources (); screen_free_resources (); diff -urN elmo-0.8/src/elmo.h elmo-0.8.1/src/elmo.h --- elmo-0.8/src/elmo.h 2003-05-18 13:24:18.000000000 +0200 +++ elmo-0.8.1/src/elmo.h 2003-07-08 23:09:48.000000000 +0200 @@ -42,8 +42,6 @@ extern char *program_invocation_short_name; -extern htable_t *address_table; - /**************************************************************************** * INTERFACE FUNCTION PROTOTYPES ****************************************************************************/ diff -urN elmo-0.8/src/eprintf.c elmo-0.8.1/src/eprintf.c --- elmo-0.8/src/eprintf.c 2003-05-30 18:41:49.000000000 +0200 +++ elmo-0.8.1/src/eprintf.c 2003-07-21 17:06:15.000000000 +0200 @@ -28,6 +28,7 @@ #include #include +#include #include "mail.h" #include "xmalloc.h" @@ -40,6 +41,8 @@ #define FIRST_ALLOC 20 +enum justify { JUSTIFY_LEFT = 0, JUSTIFY_RIGHT = 1}; + /**************************************************************************** * IMPLEMENTATION PRIVATE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES ****************************************************************************/ @@ -53,6 +56,31 @@ int size; } str_t; +/** + * This structure describes formatting sequence (i.e. %-020n) + * everything between % and the first letter is used to format + * a string. + * In the example above -020 means that we want the desired string + * be exactly 20 characters long, filled with spaces (leading 0), + * and justified to right (dash). + * + * To be more precise: + * len = 20 + * character = 'n' + * fill = YES + * justify = JUSTIFY_RIGHT + */ +struct fmt_seq { + int fs_len; + + int len; + char character; + struct { + enum yes_no fill : 1; + enum justify justify : 1; + }; +}; + /**************************************************************************** * IMPLEMENTATION REQUIRED EXTERNAL REFERENCES (AVOID) ****************************************************************************/ @@ -70,6 +98,46 @@ ****************************************************************************/ static void +eval_fmt_seq (struct fmt_seq *fs, const char *s) +{ + char *rest; + + fs->fs_len = 0; + fs->len = 0; + fs->character = '\0'; + fs->fill = NO; + fs->justify = JUSTIFY_LEFT; + + if (*s != '%') + return; + + s++; + + if (*s == '-'){ + fs->justify = JUSTIFY_RIGHT; + s++; + fs->fs_len++; + } + + if (*s == '0'){ + fs->fill = YES; + s++; + fs->fs_len++; + } + + if (isdigit (*s)){ + fs->len = strtol (s, &rest, 10); + if (rest) + fs->fs_len += rest - s; + s = rest; + } + + fs->character = *s; + fs->fs_len++; +} + + +static void initialize_str (str_t *s) { s->size = FIRST_ALLOC; @@ -102,17 +170,25 @@ } +static void +put_nchar (str_t *s, char c, int n) +{ + while (n){ + put_char (s, c); + n--; + } +} + + static void -put_string (str_t *s, const char *t) +put_string_len (str_t *s, const char *t, int len) { - int len; int oldlen = s->end - s->str; if (!t) return; - len = strlen (t); if (len + oldlen >= s->size - 1){ s->size = (s->size + len) * 2; s->str = xrealloc (s->str, s->size); @@ -126,35 +202,54 @@ static void -put_string_to_len (str_t *s, const char *t, int len) +put_string (str_t *s, const char *t) { - int oldlen = s->end - s->str; - int reallen; + int len; - if (!t) + len = strlen (t); + put_string_len (s, t, len); +} + + + +static void +put_string_fs (str_t *s, const char *t, struct fmt_seq *fs) +{ + int spaces; + int t_len; + int w_len; + + if (! t) return; - reallen = strlen (t); + t_len = strlen (t); - if (len + oldlen >= s->size - 1){ - s->size = (s->size + len) * 2; - s->str = xrealloc (s->str, s->size); + if (t_len <= fs->len){ + w_len = t_len; + spaces = fs->len - t_len; + } + else if (fs->len != 0){ + w_len = fs->len; + spaces = 0; + } + else { + w_len = t_len; + spaces = 0; } - if (reallen < len){ - memcpy (s->str + oldlen, t, reallen); - memset (s->str + oldlen + reallen, ' ', len - reallen); + if (fs->justify == JUSTIFY_LEFT){ + put_string_len (s, t, w_len); + if (fs->fill) + put_nchar (s, ' ', spaces); } else { - memcpy (s->str + oldlen, t, len); + if (fs->fill) + put_nchar (s, ' ', spaces); + put_string_len (s, t, w_len); } - - s->str[oldlen + len] = '\0'; - s->end = s->str + oldlen + len; } - static void put_int (str_t *s, int d) { @@ -173,14 +268,17 @@ * Date: Wed, 7 May 2003 15:36:46 +0200 * */ -static void -put_mail_special (str_t *s, char c, mail_t *mail) +static int +put_mail_special (str_t *s, const char *fmt, mail_t *mail) { int size; char *date; + struct fmt_seq fs; + eval_fmt_seq (&fs, fmt); + resize_str (s); - switch (c){ + switch (fs.character){ case '%': put_char (s, '%'); @@ -189,85 +287,68 @@ /* Johnny Masta Killa */ case 'f': if (mail->from && mail->from->name) - put_string (s, mail->from->name); + put_string_fs (s, mail->from->name, &fs); else if (mail->from && mail->from->full) - put_string (s, mail->from->full); + put_string_fs (s, mail->from->full, &fs); break; /* Johnny Masta Killa */ case 'F': if (mail->from && mail->from->full) - put_string (s, mail->from->full); + put_string_fs (s, mail->from->full, &fs); break; /* Bob The Ripper */ case 't': if (mail->to && mail->to->count && mail->to->array[0]->name) - put_string (s, mail->to->array[0]->name); + put_string_fs (s, mail->to->array[0]->name, &fs); else if (mail->to && mail->to->count && mail->to->array[0]->full) - put_string (s, mail->to->array[0]->full); + put_string_fs (s, mail->to->array[0]->full, &fs); break; /* Bob The Ripper */ case 'T': if (mail->to && mail->to->count && mail->to->array[0]->full) - put_string (s, mail->to->array[0]->full); - break; - - /** - * Johnny Masta Kil - * this one is filled with spaces to ADDR_NAME_LEN if needed - */ - case 'x': - if (mail->from && mail->from->name_short) - put_string_to_len (s, mail->from->name_short, ADDR_NAME_LEN); - else - put_string_to_len (s, "", ADDR_NAME_LEN); - break; - - /** - * Bob The Ripper - * this one is filled with spaces to ADDR_NAME_LEN if needed - */ - case 'y': - if (mail->to && mail->to->count && mail->to->array[0]->name_short) - put_string_to_len (s, mail->to->array[0]->name_short, ADDR_NAME_LEN); - else - put_string_to_len (s, "", ADDR_NAME_LEN); + put_string_fs (s, mail->to->array[0]->full, &fs); break; /* Wed, 7 May 2003 15:36:46 +0200 */ case 'd': - put_string (s, mail->date_str); + put_string_fs (s, mail->date_str, &fs); break; - /* 7 May */ + /* 07 May */ case 'D': date = date_string ("%b %d", mail->date); - put_string (s, date); + put_string_fs (s, date, &fs); xfree (date); break; /* Bow before me! */ case 's': if (mail->subject) - put_string (s, mail->subject); + put_string_fs (s, mail->subject, &fs); break; - /* JM */ + /* JMK */ case 'i': - if (mail->from && mail->from->name) - put_char (s, *mail->from->name); - else if (mail->from && mail->from->full) - put_char (s, *mail->from->full); - if (mail->from && mail->from->last) - put_char (s, *mail->from->last); + if (mail->from && mail->from->initials) + put_string_fs (s, mail->from->initials, &fs); + else { + if (mail->from && mail->from->name) + put_char (s, *mail->from->name); + else if (mail->from + && mail->from->full) + put_char (s, *mail->from->full); + if (mail->from && mail->from->last) + put_char (s, *mail->from->last); + } break; /* (3.5K) */ case 'S': size = wrapbox_mail_size (mail); - put_string (s, human_size_paren (size)); + put_string_fs (s, human_size_paren (size), &fs); break; /* these are flags */ @@ -310,27 +391,86 @@ put_char (s, '?'); break; } + + return fs.fs_len; } -static void -put_editor_special (str_t *s, char c, const char *fname, int lineno) +static int +put_editor_special (str_t *s, const char *fmt, const char *fname, int lineno) { + struct fmt_seq fs; + + eval_fmt_seq (&fs, fmt); + resize_str (s); - switch (c){ + switch (fs.character){ case '%': put_char (s, '%'); break; case 'f': - put_string (s, fname); + put_string_fs (s, fname, &fs); break; case 'd': put_int (s, lineno); break; } + + return fs.fs_len; +} + + +static int +put_addr_special (str_t *s, const char *fmt, addr_t *addr) +{ + struct fmt_seq fs; + + eval_fmt_seq (&fs, fmt); + + resize_str (s); + switch (fs.character){ + + case '%': + put_char (s, '%'); + break; + + case 'n': + if (addr->name) + put_string_fs (s, addr->name, &fs); + break; + + case 'e': + if (addr->email) + put_string_fs (s, addr->email, &fs); + break; + + case 'o': + if (addr->flags.official) + put_char (s, 'o'); + else + put_char (s, ' '); + break; + + case 'f': + if (addr->flags.foreign) + put_char (s, 'f'); + else + put_char (s, ' '); + break; + + case 's': + if (addr->flags.sex == SEX_MALE) + put_char (s, 'M'); + else if (addr->flags.sex == SEX_FEMALE) + put_char (s, 'F'); + else + put_char (s, '?'); + break; + } + return fs.fs_len; } @@ -338,6 +478,7 @@ substitute_mail (const char *fmt, mail_t *mail, char *buf) { str_t result; + int fs_len; const char *seek; if (buf){ @@ -352,8 +493,8 @@ for (seek = fmt; *seek; seek++){ if (*seek == '%'){ - put_mail_special (&result, seek[1], mail); - seek++; + fs_len = put_mail_special (&result, seek, mail); + seek += fs_len; } else put_char (&result, *seek); @@ -368,13 +509,35 @@ substitute_editor (const char *fmt, const char *fname, int lineno) { str_t result; + int fs_len; const char *seek; initialize_str (&result); for (seek = fmt; *seek; seek++){ if (*seek == '%'){ - put_editor_special (&result, seek[1], fname, lineno); - seek++; + fs_len = put_editor_special (&result, seek, fname, lineno); + seek += fs_len; + } + else + put_char (&result, *seek); + } + + return result.str; +} + + +static char * +substitute_addr (const char *fmt, addr_t *addr) +{ + str_t result; + int fs_len; + const char *seek; + + initialize_str (&result); + for (seek = fmt; *seek; seek++){ + if (*seek == '%'){ + fs_len = put_addr_special (&result, seek, addr); + seek += fs_len; } else put_char (&result, *seek); @@ -407,6 +570,16 @@ return result; } + +char * +eprintf_addr (const char *fmt, addr_t *addr) +{ + char *result; + + result = substitute_addr (fmt, addr); + return result; +} + /**************************************************************************** * INTERFACE CLASS BODIES ****************************************************************************/ diff -urN elmo-0.8/src/eprintf.h elmo-0.8.1/src/eprintf.h --- elmo-0.8/src/eprintf.h 2003-05-07 17:18:41.000000000 +0200 +++ elmo-0.8.1/src/eprintf.h 2003-07-16 23:46:04.000000000 +0200 @@ -25,6 +25,7 @@ ****************************************************************************/ #include "mail.h" +#include "address.h" /**************************************************************************** * INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -47,6 +48,7 @@ extern char *eprintf_mail (const char *fmt, mail_t *mail, char *buf); extern char *eprintf_editor (const char *fmt, const char *fname, int lineno); +extern char *eprintf_addr (const char *fmt, addr_t *addr); /**************************************************************************** * INTERFACE TRAILING HEADERS diff -urN elmo-0.8/src/exampl.c elmo-0.8.1/src/exampl.c --- elmo-0.8/src/exampl.c 2003-06-24 10:42:21.000000000 +0200 +++ elmo-0.8.1/src/exampl.c 2003-07-21 17:38:08.000000000 +0200 @@ -45,10 +45,13 @@ #include "memblock.h" #include "hmac-md5.h" #include "md5.h" +#include "address.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS ****************************************************************************/ +#define ATEXT "([[:alpha:][:digit:]!#\\$%&\\\\\\'\\*\\+\\/\\=\\?\\^_\\`" \ + "\\{\\}\\~\\|\\-])" /**************************************************************************** * IMPLEMENTATION PRIVATE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES ****************************************************************************/ @@ -148,6 +151,13 @@ xfree (buffer); } + +char * +ask_for_default (const char *a, const char *b) +{ + return NULL; +} + /**************************************************************************** * IMPLEMENTATION PRIVATE FUNCTIONS ****************************************************************************/ @@ -254,6 +264,72 @@ } + +static void +display_addr (addr_t *a) +{ + if (a->full) + printf (" full: %s\n", a->full); + if (a->email) + printf (" email: <%s>\n", a->email); + if (a->name) + printf (" name: '%s'\n", a->name); + if (a->initials) + printf (" initials: %s\n", a->initials); + printf (" kind: %d\n", a->flags.kind); + if (a->flags.sex == SEX_MALE) + printf (" sex: M\n"); + else if (a->flags.sex == SEX_FEMALE) + printf (" sex: F\n"); + printf (" abook: %d\n", a->flags.abook); +} + + + +static int +address_test (void) +{ + struct addr *a; + htable_t *table; + + address_init (); + + printf ("%s\n", ATEXT); + + printf (" sizeof (struct addr) == %d\n", sizeof (struct addr)); +#define STR "ala" + printf ("%d\n", sizeof (STR)); + + a = address_from_string ("rzyjontko "); + display_addr (a); + + a = address_from_string ("address@hidden (rzyjontko)"); + display_addr (a); + + a = address_from_string ("address@hidden"); + display_addr (a); + + a = address_from_string ("rzyj"); + display_addr (a); + + a = address_from_string (" rzyjontko < address@hidden >"); + display_addr (a); + + a = address_from_string ("\".ala.\" ma \".kota.\" "); + display_addr (a); + + a = address_from_string ("\" [ala \\\"ma\\\" kota] \" "); + display_addr (a); + + a = address_from_string ("address@hidden"); + display_addr (a); + + address_free_resources (); + + return 0; +} + + /**************************************************************************** * INTERFACE FUNCTIONS ****************************************************************************/ @@ -267,7 +343,8 @@ " 1 - token test\n" " 2 - hashing tables test\n" " 3 - hmac test\n" - " 4 - md5 test\n"); + " 4 - md5 test\n" + " 5 - address test\n"); exit (status); } @@ -295,12 +372,18 @@ case '4': return md5_test (); + + case '5': + return address_test (); default: usage (EXIT_FAILURE); break; } } + else { + usage (EXIT_FAILURE); + } exit (EXIT_SUCCESS); } diff -urN elmo-0.8/src/exec_table.t elmo-0.8.1/src/exec_table.t --- elmo-0.8/src/exec_table.t 2003-06-23 21:46:11.000000000 +0200 +++ elmo-0.8.1/src/exec_table.t 2003-07-20 23:35:40.000000000 +0200 @@ -1,7 +1,11 @@ -{"abook_start", abook_start, NULL, NULL}, +{"abook_init", abook_init, NULL, NULL}, +{"abook_free_resources", abook_free_resources, NULL, NULL}, +{"abook_put_loaded", abook_put_loaded, NULL, NULL}, +{"abook_load", abook_load, NULL, NULL}, {"abook_save", abook_save, NULL, NULL}, -{"abook_end", abook_end, NULL, NULL}, -{"abook_sort", abook_sort, NULL, NULL}, +{"abook_new_prepare", abook_new_prepare, NULL, NULL}, +{"abook_new_drop", abook_new_drop, NULL, NULL}, +{"abook_new_store", abook_new_store, NULL, NULL}, {"abook_open", abook_open, NULL, NULL}, {"abook_close", abook_close, NULL, NULL}, {"abook_next", abook_next, NULL, NULL}, @@ -10,11 +14,18 @@ {"abook_prev_page", abook_prev_page, NULL, NULL}, {"abook_first", abook_first, NULL, NULL}, {"abook_last", abook_last, NULL, NULL}, +{"abook_change", abook_change, NULL, NULL}, +{"abook_change_all", abook_change_all, NULL, NULL}, +{"abook_set", abook_set, NULL, NULL}, +{"abook_unset", abook_unset, NULL, NULL}, +{"abook_set_all", abook_set_all, NULL, NULL}, +{"abook_unset_all", abook_unset_all, NULL, NULL}, {"abook_change_name", abook_change_name, NULL, NULL}, {"abook_change_email", abook_change_email, NULL, NULL}, {"abook_change_flag", abook_change_flag, NULL, NULL}, {"abook_remove", abook_remove, NULL, NULL}, {"abook_insert", abook_insert, NULL, NULL}, +{"abook_compose", abook_compose, NULL, NULL}, {"abook_add_open", abook_add_open, NULL, NULL}, {"abook_add_close", abook_add_close, NULL, NULL}, {"abook_add_next", abook_add_next, NULL, NULL}, diff -urN elmo-0.8/src/fetch.c elmo-0.8.1/src/fetch.c --- elmo-0.8/src/fetch.c 2003-06-23 21:46:11.000000000 +0200 +++ elmo-0.8.1/src/fetch.c 2003-07-21 17:18:33.000000000 +0200 @@ -49,6 +49,7 @@ #include "fetch.h" #include "gettext.h" #include "mybox.h" +#include "eprintf.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -85,6 +86,11 @@ */ static ask_t *fetch_ask = NULL; +/** + * This is the default format of the line displayed in the fetch window. + */ +static char *default_format = "%?%$ %D %016f %S %s"; + /**************************************************************************** * INTERFACE DATA ****************************************************************************/ @@ -100,32 +106,16 @@ static rstring_t * -make_items (void) +make_items (const char *fmt) { int i; - line_t *line = line_create (WINDOW_WIDTH - 2); rstring_t *result = rstring_create (); for (i = 0; i < pop_stat_size; i++){ if (pop_stat_list[i].mark == 1) continue; - line_clear (line); - line_add_char (line, ' '); - line_add_int (line, pop_stat_list[i].num); - line_add_char (line, ' '); - line_add_str (line, human_size_paren (pop_stat_list[i].size)); - line_add_char (line, ' '); - if (pop_stat_list[i].info){ - if (pop_stat_list[i].info->from) - line_add_str_pad (line, pop_stat_list[i].info->from->name_short, - ADDR_NAME_LEN); - line_add_char (line, ' '); - if (pop_stat_list[i].info->subject) - line_add_str_dots (line, pop_stat_list[i].info->subject); - } - rstring_add (result, xstrdup (line->str)); + rstring_add (result, eprintf_mail (fmt, pop_stat_list[i].info, NULL)); } - line_destroy (line); return result; } @@ -313,12 +303,16 @@ static void open_window (void) { + char *fmt = ask_for_default ("fetch_format", NULL); rstring_t *items; if (pop_list_ext ()) return; - items = make_items (); + if (fmt == NULL) + fmt = default_format; + + items = make_items (fmt); if (items->count == 0){ fetch_save_pop_list (); no_new_mail (items); @@ -379,6 +373,7 @@ fetch_get_rest (void) { int i; + char *fmt; rstring_t *items; PREAMBLE; @@ -390,7 +385,11 @@ if (pop_list_ext ()) return; - items = make_items (); + fmt = ask_for_default ("fetch_format", NULL); + if (fmt == NULL) + fmt = default_format; + + items = make_items (fmt); if (items->count == 0){ no_new_mail (items); fetch_close (); diff -urN elmo-0.8/src/hash.c elmo-0.8.1/src/hash.c --- elmo-0.8/src/hash.c 2003-05-18 13:26:45.000000000 +0200 +++ elmo-0.8.1/src/hash.c 2003-07-08 19:48:30.000000000 +0200 @@ -44,7 +44,7 @@ /** * This is - * floor (((sqrt (5) - 1) / 2) * 2 ^ 32) + * floor (((sqrt (5) - 1) / 2) * 2 ^ (8 * sizeof (unsigned))) */ #if SIZEOF_UNSIGNED == 4 #define KNUTH_CONST (2654435769U) diff -urN elmo-0.8/src/mail.c elmo-0.8.1/src/mail.c --- elmo-0.8/src/mail.c 2003-06-10 23:55:19.000000000 +0200 +++ elmo-0.8.1/src/mail.c 2003-07-20 16:48:34.000000000 +0200 @@ -30,6 +30,7 @@ ****************************************************************************/ #include +#include #include "xmalloc.h" #include "mail.h" @@ -37,6 +38,8 @@ #include "multree.h" #include "misc.h" #include "memchunk.h" +#include "error.h" +#include "atable.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -45,12 +48,22 @@ #define INITIAL_MAIL_COUNT 100 #define CHUNK_SIZE 1000 +#define INFO_MAGIC 0x1D10A1DA +#define INFO_VERSION 2 + /**************************************************************************** * IMPLEMENTATION PRIVATE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES ****************************************************************************/ /**************************************************************************** * IMPLEMENTATION PRIVATE STRUCTURES / UTILITY CLASSES ****************************************************************************/ + +struct mail_array_info { + unsigned magic; + int version; + int size; +}; + /**************************************************************************** * IMPLEMENTATION REQUIRED EXTERNAL REFERENCES (AVOID) ****************************************************************************/ @@ -203,15 +216,17 @@ static void dump_mail_but_place (memchunk_t *chunk, mail_t *mail) { - address_dump (chunk, mail->from); - address_dump (chunk, mail->reply_to); + atable_dump_addr (chunk, mail->from); + atable_dump_addr (chunk, mail->reply_to); memchunk_strdump (chunk, mail->subject); memchunk_strdump (chunk, mail->date_str); - raddress_dump (chunk, mail->to); - raddress_dump (chunk, mail->cc); - raddress_dump (chunk, mail->bcc); + atable_dump_raddress (chunk, mail->to); + atable_dump_raddress (chunk, mail->cc); + atable_dump_raddress (chunk, mail->bcc); + + atable_dump_addr (chunk, mail->recv_for); memchunk_strdump (chunk, mail->msg_id); @@ -227,17 +242,19 @@ static void -read_mail_but_place (memchunk_t *chunk, mail_t *mail) +read_mail_but_place (memchunk_t *chunk, mail_t *mail, int ad) { - mail->from = address_read (chunk); - mail->reply_to = address_read (chunk); + mail->from = atable_read_addr (chunk, ad); + mail->reply_to = atable_read_addr (chunk, ad); mail->subject = memchunk_strget (chunk); mail->date_str = memchunk_strget (chunk); - mail->to = raddress_read (chunk); - mail->cc = raddress_read (chunk); - mail->bcc = raddress_read (chunk); + mail->to = atable_read_raddress (chunk, ad); + mail->cc = atable_read_raddress (chunk, ad); + mail->bcc = atable_read_raddress (chunk, ad); + + mail->recv_for = atable_read_addr (chunk, ad); mail->msg_id = memchunk_strget (chunk); @@ -264,6 +281,7 @@ mail->to = NULL; mail->cc = NULL; mail->bcc = NULL; + mail->recv_for = NULL; mail->reply_to = NULL; mail->msg_id = NULL; mail->in_reply_to = NULL; @@ -327,6 +345,7 @@ result->size = size; result->type = type; result->path = xstrdup (path); + result->ad = address_open (); result->array = xmalloc (size * sizeof (mail_t)); @@ -357,6 +376,8 @@ xfree (marray->path); if (marray->array) xfree (marray->array); + if (marray->ad != -1) + address_close (marray->ad); xfree (marray); } @@ -375,7 +396,8 @@ marray->array = with->array; marray->size = with->size; marray->count = with->count; - marray->type = marray->type; + marray->type = with->type; + marray->ad = with->ad; marray->not_replies_count = -1; marray->old_count = -1; marray->read_count = -1; @@ -490,18 +512,30 @@ mail_array_dump (mail_array_t *marray, FILE *fp, void (*dump_place)(memchunk_t *, mail_t *)) { - int i; + struct mail_array_info info; memchunk_t *chunk = memchunk_create_size (CHUNK_SIZE); - - int_dump (marray->count, fp); + int i; + + info.magic = INFO_MAGIC; + info.version = INFO_VERSION; + info.size = marray->count; + + if (fwrite (&info, sizeof (info), 1, fp) != 1){ + error_ (0, errno, "fwrite"); + fclose (fp); + return; + } + + atable_dump (chunk, marray->ad); + if (memchunk_dump (chunk, fp)) + return; for (i = 0; i < marray->count; i++){ memchunk_reset (chunk); dump_mail_but_place (chunk, marray->array + i); dump_place (chunk, marray->array + i); - - int_dump (chunk->used, fp); - fwrite (chunk->memptr, 1, chunk->used, fp); + if (memchunk_dump (chunk, fp)) + return; } memchunk_destroy (chunk); } @@ -512,29 +546,50 @@ mail_array_read_from_file (FILE *fp, box_type_t type, const char *path, void (*read_place)(memchunk_t *, mail_t *)) { + struct mail_array_info info; int i; - int size; - int chunk_size; mail_array_t *result; memchunk_t *chunk = memchunk_create_size (CHUNK_SIZE); - fread (&size, sizeof (size), 1, fp); - result = mail_array_create_size (size, type, path); + if (fread (&info, sizeof (info), 1, fp) != 1){ + error_ (0, errno, "fread"); + fclose (fp); + return NULL; + } + + if (info.magic != INFO_MAGIC){ + error_ (0, 0, "cache file has invalid format"); + fclose (fp); + return NULL; + } + + if (info.version != INFO_VERSION){ + error_ (0, 0, "cache file format changed since last version"); + fclose (fp); + return NULL; + } + + result = mail_array_create_size (info.size, type, path); + address_close (result->ad); + + if (memchunk_read (chunk, fp)) + return NULL; + result->ad = atable_read (chunk); - for (i = 0; i < size; i++){ + for (i = 0; i < info.size; i++){ memchunk_reset (chunk); - fread (&chunk_size, sizeof (chunk_size), 1, fp); - memchunk_resize_to (chunk, chunk_size); - fread (chunk->memptr, chunk_size, 1, fp); + if (memchunk_read (chunk, fp)) + return NULL; memchunk_rewind (chunk); mail_clear (result->array + i); - read_mail_but_place (chunk, result->array + i); + read_mail_but_place (chunk, result->array + i, result->ad); read_place (chunk, result->array + i); } + atable_finished (result->ad); - result->count = size; + result->count = info.size; memchunk_destroy (chunk); return result; @@ -817,6 +872,8 @@ refind_parents (); if (marray->array) xfree (marray->array); + if (thread_array->ad != -1) + address_close (thread_array->ad); marray->array = thread_array->array; marray->order = ORDER_THREAD; xfree (thread_array); diff -urN elmo-0.8/src/maildir.c elmo-0.8.1/src/maildir.c --- elmo-0.8/src/maildir.c 2003-06-23 15:19:39.000000000 +0200 +++ elmo-0.8.1/src/maildir.c 2003-07-15 18:58:17.000000000 +0200 @@ -47,6 +47,7 @@ #include "gettext.h" #include "hash.h" #include "misc.h" +#include "atable.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -507,6 +508,7 @@ new_marray = mail_array_create_size (cur_count + new_count, BOX_MAILDIR, dir); + atable_point (new_marray->ad); process_list (cur_list, cur_count, directory_cur); process_list (new_list, new_count, directory_new); @@ -541,7 +543,13 @@ return NULL; } - marray = mail_array_read_from_file (fp, BOX_MAILDIR, dir, read_place); + marray = mail_array_read_from_file (fp, BOX_MAILDIR, dir, read_place); + + if (marray == NULL){ + xfree (fname); + return NULL; + } + marray_r = maildir_refresh (marray); if (marray_r) mail_array_substitute (marray, marray_r); @@ -610,6 +618,8 @@ file_table = htable_create (misc_logarithm (cur_count + new_count)); new_marray = mail_array_create_size (cur_count + new_count, BOX_MAILDIR, marray->path); + address_close (new_marray->ad); + new_marray->ad = marray->ad; /** * step 3: reset marker and put file names into hashing table diff -urN elmo-0.8/src/mail.h elmo-0.8.1/src/mail.h --- elmo-0.8/src/mail.h 2003-06-10 22:40:22.000000000 +0200 +++ elmo-0.8.1/src/mail.h 2003-07-20 16:42:23.000000000 +0200 @@ -42,7 +42,7 @@ #define FLAG_TRASHED 0x0008 #define FLAG_DRAFT 0x0010 #define FLAG_FLAGGED 0x0020 -#define FLAG_PASSED 0x0040 + #define FLAG_PASSED 0x0040 #define FLAG_LEGITIMATE 0x0080 #define FLAG_NOSPAM 0x0100 #define FLAG_SPAM 0x0200 @@ -152,13 +152,14 @@ struct mail_st { int parent; - address_t *from; - address_t *reply_to; + addr_t *from; + addr_t *reply_to; char *subject; char *date_str; raddress_t *to; raddress_t *cc; raddress_t *bcc; + addr_t *recv_for; char *msg_id; rstring_t *in_reply_to; chtype *tree; @@ -198,6 +199,7 @@ * type -- box type * order -- how messages are ordered * have_parents -- is a boolean saying if parents are evaluated + * ad -- address table descriptor */ typedef struct mail_array { char *path; @@ -210,6 +212,7 @@ box_type_t type; box_order_t order; int have_parents; + int ad; } mail_array_t; /**************************************************************************** diff -urN elmo-0.8/src/mailreader.c elmo-0.8.1/src/mailreader.c --- elmo-0.8/src/mailreader.c 2003-06-16 13:05:51.000000000 +0200 +++ elmo-0.8.1/src/mailreader.c 2003-07-11 18:21:21.000000000 +0200 @@ -112,19 +112,28 @@ if (mail->subject) rchtype_add_string (result, "Subject: %s", mail->subject); if (mail->to && mail->to->count){ - rchtype_add_string (result, "To: %s", mail->to->array[0]->full); + if (mail->to->array[0] && mail->to->array[0]->full) + rchtype_add_string (result, "To: %s", mail->to->array[0]->full); + else + rchtype_add_string (result, "To:"); for (i = 1; i < mail->to->count; i++){ rchtype_add_string (result, " %s", mail->to->array[i]->full); } } if (mail->cc && mail->cc->count){ - rchtype_add_string (result, "Cc: %s", mail->cc->array[0]->full); + if (mail->cc->array[0] && mail->cc->array[0]->full) + rchtype_add_string (result, "Cc: %s", mail->cc->array[0]->full); + else + rchtype_add_string (result, "Cc:"); for (i = 1; i < mail->cc->count; i++){ rchtype_add_string (result, " %s", mail->cc->array[i]->full); } } if (mail->bcc && mail->bcc->count){ - rchtype_add_string (result, "To: %s", mail->bcc->array[0]->full); + if (mail->bcc->array[0] && mail->bcc->array[0]->full) + rchtype_add_string (result, "Bcc: %s", mail->bcc->array[0]->full); + else + rchtype_add_string (result, "Bcc:"); for (i = 1; i < mail->bcc->count; i++){ rchtype_add_string (result, " %s", mail->bcc->array[i]->full); } diff -urN elmo-0.8/src/Makefile.am elmo-0.8.1/src/Makefile.am --- elmo-0.8/src/Makefile.am 2003-06-24 10:42:21.000000000 +0200 +++ elmo-0.8.1/src/Makefile.am 2003-07-20 23:01:07.000000000 +0200 @@ -23,7 +23,8 @@ ask.c ask.h bayes.c bayes.h ecurses.h wrapbox.c wrapbox.h \ memblock.c memblock.h help.c help.h mybox.h \ gettext.h token.c token.h confhold.c confhold.h \ - memchunk.c memchunk.h md5c.c md5.h hmac-md5.c hmac-md5.h + memchunk.c memchunk.h md5c.c md5.h hmac-md5.c hmac-md5.h \ + atable.c atable.h bitarray.c bitarray.h str.c str.h bin_PROGRAMS = elmo bin_SCRIPTS = elmoconf.pl @@ -41,14 +42,14 @@ endif elmo_SOURCES = $(ZRODLA_elmo) $(MAILDIR_elmo) $(VASPRINTF_elmo) -elmo_LDADD = -lm elmo_LDFLAGS = -rdynamic check_PROGRAMS = exampl exampl_SOURCES = exampl.c token.c token.h xmalloc.c xmalloc.h hash.c hash.h \ memblock.c memblock.h debug.c debug.h md5c.c md5.h \ - hmac-md5.c hmac-md5.h + hmac-md5.c hmac-md5.h address.c address.h \ + memchunk.c memchunk.h misc.c misc.h exec_headers = abook.h attach.h box_selection.h fetch.h folder.h \ diff -urN elmo-0.8/src/Makefile.in elmo-0.8.1/src/Makefile.in --- elmo-0.8/src/Makefile.in 2003-07-01 11:57:25.000000000 +0200 +++ elmo-0.8.1/src/Makefile.in 2003-07-21 17:22:27.000000000 +0200 @@ -46,7 +46,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ -CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -64,7 +63,6 @@ EXEEXT = @EXEEXT@ GENCAT = @GENCAT@ GLIBC21 = @GLIBC21@ -GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ HAVE_SHORT_NAME = @HAVE_SHORT_NAME@ INCLUDED_VASPRINTF_FALSE = @INCLUDED_VASPRINTF_FALSE@ @@ -83,14 +81,18 @@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAILDIR_SUPPORT_FALSE = @MAILDIR_SUPPORT_FALSE@ MAILDIR_SUPPORT_TRUE = @MAILDIR_SUPPORT_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -99,7 +101,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POFILES = @POFILES@ POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ @@ -170,7 +171,8 @@ ask.c ask.h bayes.c bayes.h ecurses.h wrapbox.c wrapbox.h \ memblock.c memblock.h help.c help.h mybox.h \ gettext.h token.c token.h confhold.c confhold.h \ - memchunk.c memchunk.h md5c.c md5.h hmac-md5.c hmac-md5.h + memchunk.c memchunk.h md5c.c md5.h hmac-md5.c hmac-md5.h \ + atable.c atable.h bitarray.c bitarray.h str.c str.h bin_PROGRAMS = elmo @@ -183,13 +185,13 @@ @address@hidden = elmo_SOURCES = $(ZRODLA_elmo) $(MAILDIR_elmo) $(VASPRINTF_elmo) -elmo_LDADD = -lm elmo_LDFLAGS = -rdynamic check_PROGRAMS = exampl exampl_SOURCES = exampl.c token.c token.h xmalloc.c xmalloc.h hash.c hash.h \ memblock.c memblock.h debug.c debug.h md5c.c md5.h \ - hmac-md5.c hmac-md5.h + hmac-md5.c hmac-md5.h address.c address.h \ + memchunk.c memchunk.h misc.c misc.h exec_headers = abook.h attach.h box_selection.h fetch.h folder.h \ @@ -222,8 +224,9 @@ linech.h ask.c ask.h bayes.c bayes.h ecurses.h wrapbox.c \ wrapbox.h memblock.c memblock.h help.c help.h mybox.h gettext.h \ token.c token.h confhold.c confhold.h memchunk.c memchunk.h \ - md5c.c md5.h hmac-md5.c hmac-md5.h maildir-void.c mybox-void.c \ - maildir.c mybox.c vasprintf.c + md5c.c md5.h hmac-md5.c hmac-md5.h atable.c atable.h bitarray.c \ + bitarray.h str.c str.h maildir-void.c mybox-void.c maildir.c \ + mybox.c vasprintf.c am__objects_1 = elmo.$(OBJEXT) status.$(OBJEXT) folder.$(OBJEXT) \ cmd.$(OBJEXT) mbox.$(OBJEXT) mlex.$(OBJEXT) xmalloc.$(OBJEXT) \ line.$(OBJEXT) hash.$(OBJEXT) address.$(OBJEXT) clock.$(OBJEXT) \ @@ -241,7 +244,8 @@ linech.$(OBJEXT) ask.$(OBJEXT) bayes.$(OBJEXT) \ wrapbox.$(OBJEXT) memblock.$(OBJEXT) help.$(OBJEXT) \ token.$(OBJEXT) confhold.$(OBJEXT) memchunk.$(OBJEXT) \ - md5c.$(OBJEXT) hmac-md5.$(OBJEXT) + md5c.$(OBJEXT) hmac-md5.$(OBJEXT) atable.$(OBJEXT) \ + bitarray.$(OBJEXT) str.$(OBJEXT) @address@hidden = maildir.$(OBJEXT) mybox.$(OBJEXT) @address@hidden = maildir-void.$(OBJEXT) \ @MAILDIR_SUPPORT_FALSE@ mybox-void.$(OBJEXT) @@ -249,10 +253,12 @@ @address@hidden = am_elmo_OBJECTS = $(am__objects_1) $(am__objects_2) $(am__objects_3) elmo_OBJECTS = $(am_elmo_OBJECTS) +elmo_LDADD = $(LDADD) elmo_DEPENDENCIES = am_exampl_OBJECTS = exampl.$(OBJEXT) token.$(OBJEXT) xmalloc.$(OBJEXT) \ hash.$(OBJEXT) memblock.$(OBJEXT) debug.$(OBJEXT) \ - md5c.$(OBJEXT) hmac-md5.$(OBJEXT) + md5c.$(OBJEXT) hmac-md5.$(OBJEXT) address.$(OBJEXT) \ + memchunk.$(OBJEXT) misc.$(OBJEXT) exampl_OBJECTS = $(am_exampl_OBJECTS) exampl_LDADD = $(LDADD) exampl_DEPENDENCIES = @@ -264,34 +270,36 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @address@hidden = ./$(DEPDIR)/abook.Po ./$(DEPDIR)/address.Po \ address@hidden@ ./$(DEPDIR)/ask.Po ./$(DEPDIR)/attach.Po \ address@hidden@ ./$(DEPDIR)/bayes.Po ./$(DEPDIR)/box_selection.Po \ address@hidden@ ./$(DEPDIR)/choose.Po ./$(DEPDIR)/clock.Po \ address@hidden@ ./$(DEPDIR)/cmd.Po ./$(DEPDIR)/compose.Po \ address@hidden@ ./$(DEPDIR)/confhold.Po ./$(DEPDIR)/confread.Po \ address@hidden@ ./$(DEPDIR)/debug.Po ./$(DEPDIR)/elmo.Po \ address@hidden@ ./$(DEPDIR)/eprintf.Po ./$(DEPDIR)/error.Po \ address@hidden@ ./$(DEPDIR)/exampl.Po ./$(DEPDIR)/exec.Po \ address@hidden@ ./$(DEPDIR)/fetch.Po ./$(DEPDIR)/file.Po \ address@hidden@ ./$(DEPDIR)/folder.Po ./$(DEPDIR)/hash.Po \ address@hidden@ ./$(DEPDIR)/help.Po ./$(DEPDIR)/hmac-md5.Po \ address@hidden@ ./$(DEPDIR)/hook.Po ./$(DEPDIR)/keymap.Po \ address@hidden@ ./$(DEPDIR)/lcs.Po ./$(DEPDIR)/line.Po \ address@hidden@ ./$(DEPDIR)/linech.Po ./$(DEPDIR)/mail.Po \ address@hidden@ ./$(DEPDIR)/maildir-void.Po ./$(DEPDIR)/maildir.Po \ address@hidden@ ./$(DEPDIR)/mailinfo.Po ./$(DEPDIR)/mailreader.Po \ address@hidden@ ./$(DEPDIR)/mbox.Po ./$(DEPDIR)/md5c.Po \ address@hidden@ ./$(DEPDIR)/memblock.Po ./$(DEPDIR)/memchunk.Po \ address@hidden@ ./$(DEPDIR)/mime.Po ./$(DEPDIR)/misc.Po \ address@hidden@ ./$(DEPDIR)/mlex.Po ./$(DEPDIR)/multree.Po \ address@hidden@ ./$(DEPDIR)/mybox-void.Po ./$(DEPDIR)/mybox.Po \ address@hidden@ ./$(DEPDIR)/networking.Po ./$(DEPDIR)/pop.Po \ address@hidden@ ./$(DEPDIR)/progress.Po ./$(DEPDIR)/raddress.Po \ address@hidden@ ./$(DEPDIR)/rarray.Po ./$(DEPDIR)/rchtype.Po \ address@hidden@ ./$(DEPDIR)/read.Po ./$(DEPDIR)/rmime.Po \ address@hidden@ ./$(DEPDIR)/rstring.Po ./$(DEPDIR)/screen.Po \ address@hidden@ ./$(DEPDIR)/select.Po ./$(DEPDIR)/sender.Po \ address@hidden@ ./$(DEPDIR)/smtp.Po ./$(DEPDIR)/status.Po \ address@hidden@ ./$(DEPDIR)/ask.Po ./$(DEPDIR)/atable.Po \ address@hidden@ ./$(DEPDIR)/attach.Po ./$(DEPDIR)/bayes.Po \ address@hidden@ ./$(DEPDIR)/bitarray.Po \ address@hidden@ ./$(DEPDIR)/box_selection.Po ./$(DEPDIR)/choose.Po \ address@hidden@ ./$(DEPDIR)/clock.Po ./$(DEPDIR)/cmd.Po \ address@hidden@ ./$(DEPDIR)/compose.Po ./$(DEPDIR)/confhold.Po \ address@hidden@ ./$(DEPDIR)/confread.Po ./$(DEPDIR)/debug.Po \ address@hidden@ ./$(DEPDIR)/elmo.Po ./$(DEPDIR)/eprintf.Po \ address@hidden@ ./$(DEPDIR)/error.Po ./$(DEPDIR)/exampl.Po \ address@hidden@ ./$(DEPDIR)/exec.Po ./$(DEPDIR)/fetch.Po \ address@hidden@ ./$(DEPDIR)/file.Po ./$(DEPDIR)/folder.Po \ address@hidden@ ./$(DEPDIR)/hash.Po ./$(DEPDIR)/help.Po \ address@hidden@ ./$(DEPDIR)/hmac-md5.Po ./$(DEPDIR)/hook.Po \ address@hidden@ ./$(DEPDIR)/keymap.Po ./$(DEPDIR)/lcs.Po \ address@hidden@ ./$(DEPDIR)/line.Po ./$(DEPDIR)/linech.Po \ address@hidden@ ./$(DEPDIR)/mail.Po ./$(DEPDIR)/maildir-void.Po \ address@hidden@ ./$(DEPDIR)/maildir.Po ./$(DEPDIR)/mailinfo.Po \ address@hidden@ ./$(DEPDIR)/mailreader.Po ./$(DEPDIR)/mbox.Po \ address@hidden@ ./$(DEPDIR)/md5c.Po ./$(DEPDIR)/memblock.Po \ address@hidden@ ./$(DEPDIR)/memchunk.Po ./$(DEPDIR)/mime.Po \ address@hidden@ ./$(DEPDIR)/misc.Po ./$(DEPDIR)/mlex.Po \ address@hidden@ ./$(DEPDIR)/multree.Po ./$(DEPDIR)/mybox-void.Po \ address@hidden@ ./$(DEPDIR)/mybox.Po ./$(DEPDIR)/networking.Po \ address@hidden@ ./$(DEPDIR)/pop.Po ./$(DEPDIR)/progress.Po \ address@hidden@ ./$(DEPDIR)/raddress.Po ./$(DEPDIR)/rarray.Po \ address@hidden@ ./$(DEPDIR)/rchtype.Po ./$(DEPDIR)/read.Po \ address@hidden@ ./$(DEPDIR)/rmime.Po ./$(DEPDIR)/rstring.Po \ address@hidden@ ./$(DEPDIR)/screen.Po ./$(DEPDIR)/select.Po \ address@hidden@ ./$(DEPDIR)/sender.Po ./$(DEPDIR)/smtp.Po \ address@hidden@ ./$(DEPDIR)/status.Po ./$(DEPDIR)/str.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/token.Po ./$(DEPDIR)/vasprintf.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/wrapbox.Po ./$(DEPDIR)/xmalloc.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -377,8 +385,10 @@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @@ -432,6 +442,7 @@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ diff -urN elmo-0.8/src/mbox.c elmo-0.8.1/src/mbox.c --- elmo-0.8/src/mbox.c 2003-05-30 20:31:16.000000000 +0200 +++ elmo-0.8.1/src/mbox.c 2003-07-20 19:36:56.000000000 +0200 @@ -48,6 +48,7 @@ #include "error.h" #include "progress.h" #include "gettext.h" +#include "atable.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -141,6 +142,7 @@ } result = mail_array_create (BOX_MBOX, file); + atable_point (result->ad); while (ret != END_OF_FILE){ diff -urN elmo-0.8/src/memblock.c elmo-0.8.1/src/memblock.c --- elmo-0.8/src/memblock.c 2003-04-15 11:21:02.000000000 +0200 +++ elmo-0.8.1/src/memblock.c 2003-07-15 13:20:47.000000000 +0200 @@ -27,6 +27,8 @@ ****************************************************************************/ #include +#include +#include #include "memblock.h" #include "xmalloc.h" @@ -76,6 +78,44 @@ return block; } + +static int +get_len (const char *fmt, va_list ap) +{ + int len = 0; + char *str; + + while (*fmt){ + if (*fmt == '%'){ + switch (fmt[1]){ + + case 's': + str = va_arg (ap, char *); + len += strlen (str); + fmt++; + break; + + case 'd': + va_arg (ap, int); + len += 10; + fmt++; + break; + + case 'c': + va_arg (ap, int); + + case '%': + fmt++; + break; + } + } + fmt++; + len++; + } + + return len; +} + /**************************************************************************** * INTERFACE FUNCTIONS ****************************************************************************/ @@ -90,6 +130,8 @@ result->size = size; result->memptr = xmalloc (result->size); result->used = 0; + result->last = 0; + result->mark = -1; return result; } @@ -118,14 +160,19 @@ char * memblock_strdup (memblock_t **block, const char *str) { - int len = strlen (str) + 1; + int len; char *result; + if (str == NULL) + return NULL; + + len = strlen (str) + 1; *block = resize (*block, len); result = (*block)->memptr + (*block)->used; memcpy ((*block)->memptr + (*block)->used, str, len); (*block)->used += len; + (*block)->last = len; return result; } @@ -137,11 +184,68 @@ { void *result; + if (size == 0) + return NULL; + *block = resize (*block, size); result = (*block)->memptr + (*block)->used; (*block)->used += size; + (*block)->last = size; + + return result; +} + + + +void +memblock_free_last (memblock_t *block) +{ + block->used -= block->last; + block->last = 0; +} + + +void +memblock_set_mark (memblock_t *block) +{ + block->mark = block->used; +} + + + +void +memblock_free_marked (memblock_t **block) +{ + memblock_t *next; + + while ((*block)->mark == -1){ + next = (*block)->next; + xfree ((*block)->memptr); + xfree (*block); + *block = next; + } + (*block)->used = (*block)->mark; +} + + + +char * +memblock_sprintf (memblock_t **block, const char *fmt, ...) +{ + int len; + char *result; + va_list ap; + + va_start (ap, fmt); + len = get_len (fmt, ap); + va_end (ap); + + va_start (ap, fmt); + result = memblock_malloc (block, len + 1); + vsprintf (result, fmt, ap); + va_end (ap); return result; } diff -urN elmo-0.8/src/memblock.h elmo-0.8.1/src/memblock.h --- elmo-0.8/src/memblock.h 2003-04-15 11:21:08.000000000 +0200 +++ elmo-0.8.1/src/memblock.h 2003-07-20 23:03:03.000000000 +0200 @@ -26,6 +26,11 @@ /**************************************************************************** * INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS ****************************************************************************/ + +#ifdef __GNUC__ +# define FORMAT_2 __attribute__ ((format (printf, 2, 3))) +#endif + /**************************************************************************** * INTERFACE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES ****************************************************************************/ @@ -38,6 +43,8 @@ void *memptr; int size; int used; + int last; + int mark; } memblock_t; /**************************************************************************** @@ -51,6 +58,11 @@ extern void memblock_destroy (memblock_t *block); extern char *memblock_strdup (memblock_t **block, const char *str); extern void *memblock_malloc (memblock_t **block, int size); +extern void memblock_free_last (memblock_t *block); +extern void memblock_set_mark (memblock_t *block); +extern void memblock_free_marked (memblock_t **block); +extern char *memblock_sprintf (memblock_t **block, const char *fmt,...) + FORMAT_2; /**************************************************************************** * INTERFACE OBJECT CLASS DEFINITIONS diff -urN elmo-0.8/src/memchunk.c elmo-0.8.1/src/memchunk.c --- elmo-0.8/src/memchunk.c 2003-06-10 22:40:48.000000000 +0200 +++ elmo-0.8.1/src/memchunk.c 2003-07-11 17:46:07.000000000 +0200 @@ -25,9 +25,14 @@ ****************************************************************************/ #include +#include +#include #include "memchunk.h" #include "xmalloc.h" +#include "memblock.h" +#include "misc.h" +#include "error.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -194,6 +199,60 @@ return result; } + + +char * +memchunk_strget_memblock (memchunk_t *memchunk, memblock_t **memblock) +{ + int len; + char *result; + + len = memchunk_intget (memchunk); + result = memblock_malloc (memblock, len); + memcpy (result, memchunk->memptr + memchunk->pos, len); + memchunk->pos += len; + + return result; +} + + + +int +memchunk_dump (memchunk_t *chunk, FILE *fp) +{ + if (int_dump (chunk->used, fp) != 1 + || fwrite (chunk->memptr, 1, chunk->used, fp) != chunk->used){ + error_ (0, errno, "fwrite"); + fclose (fp); + return 1; + } + return 0; +} + + + +int +memchunk_read (memchunk_t *chunk, FILE *fp) +{ + int chunk_size; + + if (fread (&chunk_size, sizeof (chunk_size), 1, fp) != 1){ + error_ (0, errno, "fread"); + fclose (fp); + return 1; + } + memchunk_resize_to (chunk, chunk_size); + if (fread (chunk->memptr, chunk_size, 1, fp) != 1){ + error_ (0, errno, "fread"); + fclose (fp); + return 1; + } + + memchunk_rewind (chunk); + + return 0; +} + /**************************************************************************** * INTERFACE CLASS BODIES ****************************************************************************/ diff -urN elmo-0.8/src/memchunk.h elmo-0.8.1/src/memchunk.h --- elmo-0.8/src/memchunk.h 2003-06-10 22:40:48.000000000 +0200 +++ elmo-0.8.1/src/memchunk.h 2003-07-09 18:01:14.000000000 +0200 @@ -23,6 +23,11 @@ /**************************************************************************** * INTERFACE REQUIRED HEADERS ****************************************************************************/ + +#include + +#include "memblock.h" + /**************************************************************************** * INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS ****************************************************************************/ @@ -61,6 +66,10 @@ extern void memchunk_rewind (memchunk_t *memchunk); extern int memchunk_intget (memchunk_t *memchunk); extern char *memchunk_strget (memchunk_t *memchunk); +extern char *memchunk_strget_memblock (memchunk_t *memchunk, memblock_t **); + +extern int memchunk_dump (memchunk_t *chunk, FILE *fp); +extern int memchunk_read (memchunk_t *chunk, FILE *fp); /**************************************************************************** * INTERFACE OBJECT CLASS DEFINITIONS diff -urN elmo-0.8/src/misc.c elmo-0.8.1/src/misc.c --- elmo-0.8/src/misc.c 2003-06-09 19:05:32.000000000 +0200 +++ elmo-0.8.1/src/misc.c 2003-07-11 17:59:52.000000000 +0200 @@ -34,8 +34,11 @@ #include #include #include +#include +#include #include "xmalloc.h" +#include "error.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -166,6 +169,33 @@ } + +int +misc_regex (const char *re, const char *text, regmatch_t *matches) +{ + int ret; + regex_t compiled; + + ret = regcomp (&compiled, re, REG_ICASE | REG_EXTENDED | REG_NEWLINE); + + if (ret){ + error_regex (ret, &compiled); + regfree (&compiled); + return 0; + } + + ret = regexec (&compiled, text, 1, matches, 0); + regfree (&compiled); + + if (ret && ret != REG_NOMATCH){ + error_regex (ret, &compiled); + return 0; + } + + return ! ret; +} + + /**************************************************************************** * INTERFACE CLASS BODIES ****************************************************************************/ diff -urN elmo-0.8/src/misc.h elmo-0.8.1/src/misc.h --- elmo-0.8/src/misc.h 2003-06-09 19:05:32.000000000 +0200 +++ elmo-0.8.1/src/misc.h 2003-07-21 17:35:39.000000000 +0200 @@ -31,6 +31,8 @@ #include #include #include +#include +#include /**************************************************************************** * INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -51,18 +53,19 @@ * INTERFACE FUNCTION PROTOTYPES ****************************************************************************/ -#ifndef HAVE_STPCPY +#ifndef stpcpy extern char *stpcpy (char *dest, const char *src); #endif #ifndef HAVE_VASPRINTF -extern int vasprintf (char **result, const char *format, va_list args); -extern int asprintf (char **result, const char *format, ...); +extern int vasprintf (char **result, const char *format, va_list args); +extern int asprintf (char **result, const char *format, ...); #endif extern char *human_size_pure (int size); extern char *human_size_paren (int size); extern char *date_string (const char *format, time_t tm); extern int misc_logarithm (int n); extern void string_dump (const char *str, FILE *fp); +extern int misc_regex (const char *re, const char *text, regmatch_t *m); /**************************************************************************** * INTERFACE OBJECT CLASS DEFINITIONS diff -urN elmo-0.8/src/mlex.c elmo-0.8.1/src/mlex.c --- elmo-0.8/src/mlex.c 2003-06-19 11:18:01.000000000 +0200 +++ elmo-0.8.1/src/mlex.c 2003-07-20 16:43:47.000000000 +0200 @@ -1,7 +1,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvsroot/elmo/elmo/src/mlex.c,v 1.54 2003/06/19 09:18:01 rzyjontko Exp $ + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ */ #define FLEX_SCANNER @@ -24,12 +24,6 @@ #include #ifndef _WIN32 #include -#else -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif #endif /* Use prototypes in function declarations. */ @@ -70,6 +64,7 @@ #define YY_PROTO(proto) () #endif + /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -295,26 +290,26 @@ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 26 -#define YY_END_OF_BUFFER 27 -static yyconst short int yy_acclist[117] = +#define YY_NUM_RULES 27 +#define YY_END_OF_BUFFER 28 +static yyconst short int yy_acclist[119] = { 0, - 27, 24, 26, 25, 26, 24, 26, 24, 26, 22, - 26, 21, 26, 22, 26, 22, 26, 22, 26, 22, - 26, 22, 26, 22, 26, 22, 26, 22, 26, 22, - 26, 22, 26, 22, 26, 22, 26, 26, 24, 25, - 24, 24, 20, 21, 24, 24, 23, 24, 24, 12, - 11, 24, 13, 24, 7, 9, 24, 12, 11, 24, - 13, 10, 18, 24, 7, 9, 8, 24, 17, 3, - 19, 24, 17, 17, 10, 18, 24, 14, 16, 8, - 2, 24, 15, 17, 3, 19, 24, 4, 24, 14, - 16, 2, 24, 24, 15, 24, 24, 4, 24, 24, + 28, 25, 27, 26, 27, 25, 27, 25, 27, 23, + 27, 22, 27, 23, 27, 23, 27, 23, 27, 23, + 27, 23, 27, 23, 27, 23, 27, 23, 27, 23, + 27, 23, 27, 23, 27, 23, 27, 27, 25, 26, + 25, 25, 21, 22, 25, 25, 24, 25, 25, 12, + 11, 25, 13, 25, 7, 9, 25, 12, 11, 25, + 13, 10, 18, 25, 7, 9, 8, 25, 20, 17, + 3, 19, 25, 17, 17, 10, 18, 25, 14, 16, + 8, 2, 25, 15, 20, 17, 3, 19, 25, 4, + 25, 14, 16, 2, 25, 25, 15, 25, 25, 4, - 24, 24, 5, 24, 24, 24, 5, 24, 24, 24, - 6, 24, 24, 1, 24, 6 + 25, 25, 25, 25, 5, 25, 25, 25, 5, 25, + 25, 25, 6, 25, 25, 1, 25, 6 } ; -static yyconst short int yy_accept[301] = +static yyconst short int yy_accept[313] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, @@ -322,33 +317,35 @@ 41, 42, 43, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 46, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 48, 49, - 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 52, 52, 52, 52, 53, 54, 54, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 48, + 49, 50, 50, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 52, 52, 52, 52, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, - 55, 56, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 58, 58, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, - 60, 60, 60, 61, 62, 62, 62, 62, 62, 62, - 62, 62, 63, 64, 64, 64, 64, 64, 65, 65, - 65, 66, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 68, 68, 68, 68, 69, 69, 69, 69, 69, - 69, 69, 70, 70, 70, 70, 70, 70, 71, 72, - 73, 73, 73, 73, 73, 73, 73, 74, 74, 74, - - 75, 76, 77, 77, 77, 77, 77, 77, 77, 78, - 78, 78, 78, 78, 79, 80, 80, 81, 82, 82, - 82, 83, 83, 83, 83, 84, 84, 84, 84, 84, - 85, 85, 85, 86, 87, 88, 88, 88, 89, 89, - 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, - 91, 92, 93, 94, 95, 95, 95, 95, 96, 97, - 98, 98, 98, 99, 100, 100, 100, 101, 101, 101, - 102, 102, 102, 103, 104, 104, 105, 105, 105, 105, - 106, 106, 106, 107, 108, 108, 109, 109, 110, 110, - 111, 112, 113, 113, 113, 114, 114, 116, 117, 117 + 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, + 55, 55, 55, 55, 56, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 58, 58, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 60, 60, 60, 60, 61, 62, + 62, 62, 62, 62, 62, 62, 62, 62, 63, 64, + 64, 64, 64, 64, 65, 65, 65, 66, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, + 68, 68, 69, 69, 69, 69, 69, 69, 70, 70, + 71, 71, 71, 71, 71, 71, 72, 73, 74, 74, + + 74, 74, 74, 74, 74, 74, 74, 75, 75, 75, + 76, 77, 78, 78, 78, 78, 78, 78, 78, 79, + 79, 79, 79, 79, 80, 80, 81, 81, 82, 83, + 83, 83, 84, 84, 84, 84, 85, 85, 85, 86, + 86, 86, 87, 87, 87, 88, 89, 90, 90, 90, + 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, + 92, 92, 93, 94, 95, 96, 97, 97, 97, 97, + 98, 99, 100, 100, 100, 101, 102, 102, 102, 103, + 103, 103, 104, 104, 104, 105, 106, 106, 107, 107, + 107, 107, 108, 108, 108, 109, 110, 110, 111, 111, + 112, 112, 113, 114, 115, 115, 115, 116, 116, 118, + 119, 119 } ; static yyconst int yy_ec[256] = @@ -361,12 +358,12 @@ 7, 7, 7, 7, 7, 7, 7, 8, 1, 1, 1, 1, 1, 1, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 16, 19, 20, 21, 22, 23, - 16, 24, 25, 26, 27, 16, 16, 28, 29, 16, + 16, 24, 25, 26, 27, 28, 16, 29, 30, 16, 1, 1, 1, 1, 1, 1, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 16, 19, 20, 21, - 22, 23, 16, 24, 25, 26, 27, 16, 16, 28, - 29, 16, 1, 1, 1, 1, 1, 1, 1, 1, + 22, 23, 16, 24, 25, 26, 27, 28, 16, 29, + 30, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -383,205 +380,213 @@ 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[30] = +static yyconst int yy_meta[31] = { 0, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static yyconst short int yy_base[349] = +static yyconst short int yy_base[363] = { 0, - 0, 1, 5, 13, 0, 0, 0, 0, 440, 0, - 436, 432, 413, 441, 7, 433, 424, 7, 425, 409, - 411, 418, 417, 8, 407, 403, 421, 441, 0, 423, - 0, 403, 441, 421, 9, 412, 414, 400, 394, 397, - 412, 392, 5, 395, 406, 404, 405, 399, 6, 39, - 391, 402, 0, 383, 395, 387, 382, 380, 391, 384, - 390, 375, 382, 0, 375, 389, 371, 441, 41, 391, - 0, 43, 382, 386, 385, 379, 382, 366, 360, 375, - 360, 373, 45, 379, 367, 374, 0, 47, 50, 379, - 360, 0, 0, 357, 364, 365, 371, 352, 350, 363, - - 51, 370, 363, 352, 344, 52, 56, 366, 0, 342, - 56, 59, 348, 353, 344, 338, 355, 354, 335, 0, - 345, 346, 331, 63, 0, 69, 351, 72, 353, 73, - 352, 325, 347, 341, 329, 0, 0, 342, 76, 336, - 324, 322, 80, 86, 10, 0, 0, 340, 328, 331, - 335, 88, 90, 0, 321, 333, 332, 94, 322, 79, - 101, 103, 312, 325, 311, 0, 107, 332, 108, 331, - 111, 307, 0, 0, 327, 306, 321, 306, 306, 319, - 318, 113, 0, 0, 117, 322, 316, 120, 122, 126, - 300, 301, 308, 312, 0, 0, 132, 135, 316, 135, - - 138, 140, 0, 0, 143, 315, 144, 314, 149, 294, - 290, 306, 0, 155, 157, 0, 159, 161, 0, 0, - 165, 288, 298, 0, 171, 174, 308, 175, 307, 178, - 181, 306, 181, 184, 303, 290, 293, 186, 189, 302, - 0, 0, 0, 113, 278, 279, 190, 299, 0, 193, - 195, 197, 294, 197, 283, 293, 0, 202, 291, 292, - 274, 282, 204, 287, 272, 271, 283, 282, 278, 281, - 0, 265, 279, 206, 273, 276, 209, 280, 265, 274, - 0, 259, 272, 209, 263, 272, 268, 268, 0, 267, - 212, 266, 215, 269, 264, 0, 0, 215, 441, 220, - - 223, 226, 229, 232, 269, 268, 267, 235, 266, 265, - 264, 263, 238, 262, 261, 260, 241, 259, 257, 254, - 244, 251, 245, 242, 247, 239, 236, 250, 233, 230, - 202, 192, 253, 177, 167, 151, 146, 256, 128, 110, - 96, 82, 75, 65, 31, 19, 13, 0 + 0, 1, 5, 13, 0, 0, 0, 0, 456, 0, + 452, 448, 429, 457, 7, 449, 440, 7, 441, 425, + 427, 434, 433, 8, 423, 419, 437, 457, 0, 439, + 0, 419, 457, 437, 9, 428, 430, 416, 410, 413, + 428, 408, 8, 411, 422, 420, 421, 415, 16, 40, + 407, 418, 0, 399, 411, 403, 398, 396, 407, 406, + 399, 405, 390, 397, 0, 390, 404, 386, 457, 42, + 406, 0, 44, 397, 401, 400, 394, 397, 388, 380, + 373, 389, 374, 387, 46, 393, 381, 388, 0, 48, + 51, 393, 374, 0, 0, 371, 378, 364, 378, 384, + + 365, 363, 376, 52, 383, 376, 365, 357, 53, 57, + 379, 0, 355, 57, 60, 361, 366, 365, 356, 350, + 367, 366, 347, 0, 357, 358, 343, 64, 0, 70, + 363, 73, 365, 74, 364, 336, 359, 352, 352, 340, + 0, 0, 353, 77, 347, 335, 333, 81, 87, 2, + 0, 0, 351, 339, 347, 341, 345, 89, 91, 0, + 331, 343, 342, 95, 332, 2, 101, 103, 322, 335, + 0, 321, 0, 106, 342, 107, 341, 110, 317, 0, + 0, 337, 316, 331, 316, 316, 329, 112, 328, 114, + 0, 0, 118, 332, 326, 121, 123, 127, 310, 311, + + 318, 322, 0, 134, 326, 0, 134, 138, 325, 138, + 141, 143, 0, 0, 146, 324, 147, 323, 152, 303, + 299, 315, 0, 158, 0, 160, 0, 162, 164, 0, + 0, 168, 297, 307, 0, 174, 177, 317, 177, 181, + 316, 181, 185, 315, 185, 188, 312, 299, 302, 190, + 193, 311, 0, 0, 0, 114, 287, 288, 194, 308, + 0, 197, 199, 201, 303, 201, 292, 302, 0, 206, + 300, 301, 283, 291, 208, 296, 281, 280, 292, 291, + 287, 290, 0, 274, 288, 210, 282, 285, 213, 289, + 274, 283, 0, 268, 281, 213, 272, 281, 277, 277, + + 0, 276, 216, 275, 219, 278, 273, 0, 0, 219, + 457, 224, 227, 230, 233, 236, 278, 277, 276, 239, + 275, 274, 273, 272, 242, 271, 270, 269, 245, 268, + 267, 266, 248, 265, 264, 263, 261, 251, 258, 255, + 254, 249, 246, 243, 240, 257, 237, 234, 206, 196, + 170, 260, 154, 149, 129, 109, 97, 83, 76, 66, + 19, 0 } ; -static yyconst short int yy_def[349] = +static yyconst short int yy_def[363] = { 0, - 300, 300, 301, 301, 302, 302, 302, 302, 299, 303, - 299, 303, 303, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 299, 303, 299, - 304, 303, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 299, 299, 304, - 303, 299, 305, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 306, 299, 299, 299, 299, 304, 303, - 307, 305, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 306, 299, 299, 299, 308, 307, 299, 299, - 299, 309, 310, 299, 299, 299, 299, 299, 299, 299, - - 299, 299, 299, 299, 299, 308, 299, 299, 311, 299, - 309, 310, 299, 299, 299, 299, 299, 299, 299, 312, - 299, 299, 299, 313, 314, 311, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 315, 316, 299, 312, 299, - 299, 299, 317, 314, 299, 318, 319, 299, 299, 299, - 299, 315, 316, 320, 299, 299, 299, 321, 299, 299, - 318, 319, 299, 299, 299, 322, 299, 299, 299, 299, - 320, 299, 323, 324, 303, 299, 299, 299, 299, 299, - 299, 325, 326, 327, 299, 299, 299, 323, 324, 328, - 299, 299, 299, 299, 329, 330, 325, 299, 299, 322, - - 326, 327, 331, 332, 299, 299, 299, 299, 333, 299, - 299, 299, 334, 329, 330, 335, 331, 332, 336, 337, - 338, 299, 299, 339, 334, 299, 299, 299, 299, 335, - 299, 299, 336, 337, 303, 299, 299, 339, 299, 299, - 340, 341, 342, 303, 299, 299, 299, 299, 343, 340, - 341, 342, 303, 303, 299, 299, 344, 343, 303, 303, - 299, 299, 344, 303, 299, 299, 303, 299, 299, 303, - 345, 299, 303, 345, 299, 303, 299, 299, 299, 303, - 346, 299, 303, 346, 299, 303, 299, 303, 347, 303, - 347, 303, 299, 299, 303, 348, 303, 348, 0, 299, - - 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 299 + 312, 312, 313, 313, 314, 314, 314, 314, 311, 315, + 311, 315, 315, 311, 311, 311, 311, 311, 311, 311, + 311, 311, 311, 311, 311, 311, 311, 311, 315, 311, + 316, 315, 311, 311, 311, 311, 311, 311, 311, 311, + 311, 311, 311, 311, 311, 311, 311, 311, 311, 316, + 315, 311, 317, 311, 311, 311, 311, 311, 311, 311, + 311, 311, 311, 311, 318, 311, 311, 311, 311, 316, + 315, 319, 317, 311, 311, 311, 311, 311, 311, 311, + 311, 311, 311, 311, 318, 311, 311, 311, 320, 319, + 311, 311, 311, 321, 322, 311, 311, 311, 311, 311, + + 311, 311, 311, 311, 311, 311, 311, 311, 320, 311, + 311, 323, 311, 321, 322, 311, 311, 311, 311, 311, + 311, 311, 311, 324, 311, 311, 311, 325, 326, 323, + 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, + 327, 328, 311, 324, 311, 311, 311, 329, 326, 311, + 330, 331, 311, 311, 311, 311, 311, 327, 328, 332, + 311, 311, 311, 333, 311, 311, 330, 331, 311, 311, + 334, 311, 335, 311, 311, 311, 311, 332, 311, 336, + 337, 315, 311, 311, 311, 311, 311, 334, 311, 338, + 339, 340, 311, 311, 311, 336, 337, 341, 311, 311, + + 311, 311, 342, 311, 311, 343, 338, 311, 311, 335, + 339, 340, 344, 345, 311, 311, 311, 311, 346, 311, + 311, 311, 347, 342, 348, 343, 349, 344, 345, 350, + 351, 352, 311, 311, 353, 347, 311, 311, 348, 311, + 311, 349, 311, 311, 350, 351, 315, 311, 311, 353, + 311, 311, 354, 355, 356, 315, 311, 311, 311, 311, + 357, 354, 355, 356, 315, 315, 311, 311, 358, 357, + 315, 315, 311, 311, 358, 315, 311, 311, 315, 311, + 311, 315, 359, 311, 315, 359, 311, 315, 311, 311, + 311, 315, 360, 311, 315, 360, 311, 315, 311, 315, + + 361, 315, 361, 315, 311, 311, 315, 362, 315, 362, + 0, 311, 311, 311, 311, 311, 311, 311, 311, 311, + 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, + 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, + 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, + 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, + 311, 311 } ; -static yyconst short int yy_nxt[471] = +static yyconst short int yy_nxt[488] = { 0, - 298, 29, 11, 11, 29, 12, 12, 15, 16, 33, - 34, 33, 34, 291, 13, 15, 16, 37, 59, 284, - 44, 159, 17, 18, 19, 66, 20, 60, 38, 21, - 67, 274, 22, 45, 46, 160, 23, 24, 25, 26, - 27, 68, 69, 68, 69, 89, 90, 101, 102, 107, - 108, 109, 120, 29, 109, 120, 124, 125, 128, 129, - 125, 130, 131, 29, 29, 263, 29, 124, 29, 29, - 29, 89, 90, 146, 147, 258, 146, 147, 101, 102, - 29, 29, 252, 29, 29, 29, 29, 29, 107, 108, - 167, 168, 169, 170, 29, 29, 251, 29, 29, 29, - - 29, 29, 177, 128, 129, 130, 131, 178, 183, 184, - 250, 183, 184, 185, 186, 198, 199, 253, 203, 254, - 200, 203, 205, 206, 207, 208, 29, 29, 238, 29, - 29, 29, 29, 29, 198, 199, 216, 198, 199, 216, - 167, 168, 169, 170, 219, 220, 234, 219, 220, 29, - 29, 233, 29, 29, 29, 29, 29, 226, 227, 228, - 229, 185, 186, 231, 232, 29, 29, 230, 29, 29, - 29, 29, 29, 239, 240, 241, 242, 225, 241, 242, - 198, 199, 243, 205, 206, 243, 207, 208, 247, 248, - 249, 257, 218, 249, 257, 226, 227, 228, 229, 231, - - 232, 259, 217, 260, 239, 240, 247, 248, 277, 278, - 281, 277, 278, 281, 293, 294, 296, 293, 294, 296, - 10, 10, 10, 14, 14, 14, 28, 28, 28, 29, - 215, 29, 50, 214, 50, 106, 202, 106, 143, 201, - 143, 158, 189, 158, 175, 188, 175, 197, 197, 197, - 209, 182, 209, 221, 171, 221, 235, 162, 235, 161, - 153, 152, 144, 139, 126, 112, 111, 88, 83, 72, - 297, 293, 295, 292, 290, 289, 288, 287, 286, 285, - 283, 282, 277, 280, 279, 276, 275, 273, 272, 271, - 270, 269, 268, 267, 266, 265, 259, 264, 262, 261, - - 254, 247, 256, 255, 239, 246, 245, 244, 231, 228, - 226, 237, 236, 224, 223, 222, 207, 205, 198, 213, - 212, 211, 210, 204, 185, 196, 195, 194, 193, 192, - 191, 190, 187, 169, 167, 181, 180, 179, 176, 174, - 173, 172, 166, 165, 164, 163, 157, 156, 155, 154, - 151, 150, 149, 148, 130, 128, 145, 142, 141, 140, - 138, 137, 136, 135, 134, 133, 132, 127, 107, 123, - 122, 121, 101, 119, 118, 117, 116, 115, 114, 113, - 110, 89, 105, 104, 103, 100, 99, 98, 97, 96, - 95, 94, 93, 92, 91, 87, 86, 85, 84, 82, - - 81, 80, 79, 78, 77, 76, 75, 74, 73, 71, - 70, 65, 64, 63, 62, 61, 58, 57, 56, 55, - 54, 53, 52, 33, 51, 30, 49, 48, 47, 43, - 42, 41, 40, 39, 36, 35, 32, 31, 30, 299, - 9, 299, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 299, 299, 299 + 310, 29, 11, 11, 29, 12, 12, 15, 16, 33, + 34, 33, 34, 165, 13, 15, 16, 37, 59, 303, + 44, 60, 17, 18, 19, 184, 20, 166, 38, 21, + 61, 185, 22, 45, 46, 67, 23, 24, 25, 26, + 68, 27, 69, 70, 69, 70, 91, 92, 104, 105, + 110, 111, 112, 124, 29, 112, 124, 128, 129, 132, + 133, 129, 134, 135, 29, 29, 296, 29, 128, 29, + 29, 29, 91, 92, 151, 152, 286, 151, 152, 104, + 105, 29, 29, 275, 29, 29, 29, 29, 29, 110, + 111, 174, 175, 176, 177, 29, 29, 270, 29, 29, + + 29, 29, 29, 132, 133, 134, 135, 191, 192, 264, + 191, 192, 193, 194, 204, 205, 208, 209, 265, 213, + 266, 210, 213, 215, 216, 217, 218, 29, 29, 263, + 29, 29, 29, 29, 29, 225, 208, 209, 225, 227, + 208, 209, 227, 174, 175, 176, 177, 230, 231, 262, + 230, 231, 29, 29, 250, 29, 29, 29, 29, 29, + 237, 238, 240, 241, 193, 194, 243, 244, 29, 29, + 246, 29, 29, 29, 29, 29, 251, 252, 253, 204, + 205, 253, 254, 208, 209, 254, 255, 215, 216, 255, + 217, 218, 259, 260, 261, 269, 245, 261, 269, 237, + + 238, 240, 241, 243, 244, 271, 242, 272, 251, 252, + 259, 260, 289, 290, 293, 289, 290, 293, 305, 306, + 308, 305, 306, 308, 10, 10, 10, 14, 14, 14, + 28, 28, 28, 29, 239, 29, 50, 236, 50, 109, + 229, 109, 148, 228, 148, 164, 226, 164, 182, 224, + 182, 207, 207, 207, 219, 212, 219, 232, 211, 232, + 247, 197, 247, 196, 190, 188, 178, 168, 167, 159, + 158, 149, 144, 130, 115, 114, 90, 85, 73, 309, + 305, 307, 304, 302, 301, 300, 299, 298, 297, 295, + 294, 289, 292, 291, 288, 287, 285, 284, 283, 282, + + 281, 280, 279, 278, 277, 271, 276, 274, 273, 266, + 259, 268, 267, 251, 258, 257, 256, 243, 240, 237, + 249, 248, 235, 234, 233, 217, 215, 208, 204, 223, + 222, 221, 220, 214, 193, 206, 203, 202, 201, 200, + 199, 198, 195, 176, 174, 189, 187, 186, 183, 181, + 180, 179, 173, 172, 171, 170, 169, 163, 162, 161, + 160, 157, 156, 155, 154, 153, 134, 132, 150, 147, + 146, 145, 143, 142, 141, 140, 139, 138, 137, 136, + 131, 110, 127, 126, 125, 104, 123, 122, 121, 120, + 119, 118, 117, 116, 113, 91, 108, 107, 106, 103, + + 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, + 89, 88, 87, 86, 84, 83, 82, 81, 80, 79, + 78, 77, 76, 75, 74, 72, 71, 66, 65, 64, + 63, 62, 58, 57, 56, 55, 54, 53, 52, 33, + 51, 30, 49, 48, 47, 43, 42, 41, 40, 39, + 36, 35, 32, 31, 30, 311, 9, 311, 311, 311, + 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, + 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, + 311, 311, 311, 311, 311, 311, 311 } ; -static yyconst short int yy_chk[471] = +static yyconst short int yy_chk[488] = { 0, - 348, 87, 1, 2, 87, 1, 2, 3, 3, 15, - 15, 35, 35, 347, 2, 4, 4, 18, 43, 346, - 24, 145, 4, 4, 4, 49, 4, 43, 18, 4, - 49, 345, 4, 24, 24, 145, 4, 4, 4, 4, - 4, 50, 50, 69, 69, 72, 72, 83, 83, 88, - 88, 89, 101, 106, 89, 101, 106, 107, 111, 111, - 107, 112, 112, 124, 124, 344, 124, 124, 124, 124, - 124, 126, 126, 128, 130, 343, 128, 130, 139, 139, - 143, 143, 342, 143, 143, 143, 143, 143, 144, 144, - 152, 152, 153, 153, 158, 158, 341, 158, 158, 158, - - 158, 158, 160, 161, 161, 162, 162, 160, 167, 169, - 340, 167, 169, 171, 171, 182, 182, 244, 185, 244, - 182, 185, 188, 188, 189, 189, 190, 190, 339, 190, - 190, 190, 190, 190, 197, 197, 198, 200, 200, 198, - 201, 201, 202, 202, 205, 207, 337, 205, 207, 209, - 209, 336, 209, 209, 209, 209, 209, 214, 214, 215, - 215, 217, 217, 218, 218, 221, 221, 335, 221, 221, - 221, 221, 221, 225, 225, 226, 228, 334, 226, 228, - 230, 230, 231, 233, 233, 231, 234, 234, 238, 238, - 239, 247, 332, 239, 247, 250, 250, 251, 251, 252, - - 252, 254, 331, 254, 258, 258, 263, 263, 274, 274, - 277, 284, 284, 277, 291, 291, 293, 298, 298, 293, - 300, 300, 300, 301, 301, 301, 302, 302, 302, 303, - 330, 303, 304, 329, 304, 308, 327, 308, 313, 326, - 313, 317, 324, 317, 321, 323, 321, 325, 325, 325, - 328, 322, 328, 333, 320, 333, 338, 319, 338, 318, - 316, 315, 314, 312, 311, 310, 309, 307, 306, 305, - 295, 294, 292, 290, 288, 287, 286, 285, 283, 282, - 280, 279, 278, 276, 275, 273, 272, 270, 269, 268, - 267, 266, 265, 264, 262, 261, 260, 259, 256, 255, - - 253, 248, 246, 245, 240, 237, 236, 235, 232, 229, - 227, 223, 222, 212, 211, 210, 208, 206, 199, 194, - 193, 192, 191, 187, 186, 181, 180, 179, 178, 177, - 176, 175, 172, 170, 168, 165, 164, 163, 159, 157, - 156, 155, 151, 150, 149, 148, 142, 141, 140, 138, - 135, 134, 133, 132, 131, 129, 127, 123, 122, 121, - 119, 118, 117, 116, 115, 114, 113, 110, 108, 105, - 104, 103, 102, 100, 99, 98, 97, 96, 95, 94, - 91, 90, 86, 85, 84, 82, 81, 80, 79, 78, - 77, 76, 75, 74, 73, 70, 67, 66, 65, 63, - - 62, 61, 60, 59, 58, 57, 56, 55, 54, 52, - 51, 48, 47, 46, 45, 44, 42, 41, 40, 39, - 38, 37, 36, 34, 32, 30, 27, 26, 25, 23, - 22, 21, 20, 19, 17, 16, 13, 12, 11, 9, - 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 299, 299, 299 + 362, 89, 1, 2, 89, 1, 2, 3, 3, 15, + 15, 35, 35, 150, 2, 4, 4, 18, 43, 361, + 24, 43, 4, 4, 4, 166, 4, 150, 18, 4, + 43, 166, 4, 24, 24, 49, 4, 4, 4, 4, + 49, 4, 50, 50, 70, 70, 73, 73, 85, 85, + 90, 90, 91, 104, 109, 91, 104, 109, 110, 114, + 114, 110, 115, 115, 128, 128, 360, 128, 128, 128, + 128, 128, 130, 130, 132, 134, 359, 132, 134, 144, + 144, 148, 148, 358, 148, 148, 148, 148, 148, 149, + 149, 158, 158, 159, 159, 164, 164, 357, 164, 164, + + 164, 164, 164, 167, 167, 168, 168, 174, 176, 356, + 174, 176, 178, 178, 188, 188, 190, 190, 256, 193, + 256, 190, 193, 196, 196, 197, 197, 198, 198, 355, + 198, 198, 198, 198, 198, 204, 207, 207, 204, 208, + 210, 210, 208, 211, 211, 212, 212, 215, 217, 354, + 215, 217, 219, 219, 353, 219, 219, 219, 219, 219, + 224, 224, 226, 226, 228, 228, 229, 229, 232, 232, + 351, 232, 232, 232, 232, 232, 236, 236, 237, 239, + 239, 237, 240, 242, 242, 240, 243, 245, 245, 243, + 246, 246, 250, 250, 251, 259, 350, 251, 259, 262, + + 262, 263, 263, 264, 264, 266, 349, 266, 270, 270, + 275, 275, 286, 286, 289, 296, 296, 289, 303, 303, + 305, 310, 310, 305, 312, 312, 312, 313, 313, 313, + 314, 314, 314, 315, 348, 315, 316, 347, 316, 320, + 345, 320, 325, 344, 325, 329, 343, 329, 333, 342, + 333, 338, 338, 338, 341, 340, 341, 346, 339, 346, + 352, 337, 352, 336, 335, 334, 332, 331, 330, 328, + 327, 326, 324, 323, 322, 321, 319, 318, 317, 307, + 306, 304, 302, 300, 299, 298, 297, 295, 294, 292, + 291, 290, 288, 287, 285, 284, 282, 281, 280, 279, + + 278, 277, 276, 274, 273, 272, 271, 268, 267, 265, + 260, 258, 257, 252, 249, 248, 247, 244, 241, 238, + 234, 233, 222, 221, 220, 218, 216, 209, 205, 202, + 201, 200, 199, 195, 194, 189, 187, 186, 185, 184, + 183, 182, 179, 177, 175, 172, 170, 169, 165, 163, + 162, 161, 157, 156, 155, 154, 153, 147, 146, 145, + 143, 140, 139, 138, 137, 136, 135, 133, 131, 127, + 126, 125, 123, 122, 121, 120, 119, 118, 117, 116, + 113, 111, 108, 107, 106, 105, 103, 102, 101, 100, + 99, 98, 97, 96, 93, 92, 88, 87, 86, 84, + + 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, + 71, 68, 67, 66, 64, 63, 62, 61, 60, 59, + 58, 57, 56, 55, 54, 52, 51, 48, 47, 46, + 45, 44, 42, 41, 40, 39, 38, 37, 36, 34, + 32, 30, 27, 26, 25, 23, 22, 21, 20, 19, + 17, 16, 13, 12, 11, 9, 311, 311, 311, 311, + 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, + 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, + 311, 311, 311, 311, 311, 311, 311 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -639,6 +644,8 @@ #include #include #include +#include +#include #ifdef HAVE_CONFIG_H # include @@ -661,6 +668,7 @@ #include "mime.h" #include "rmime.h" #include "compose.h" +#include "misc.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -676,6 +684,13 @@ #define boundary (bound_array[bound_index]) +#define ATEXT "([[:alpha:][:digit:]!#\\$%&\\\\\\'\\*\\+\\/\\=\\?\\^_\\`" \ + "\\{\\}\\~\\|\\-])" +#define DOT_ATOM_TEXT "(" ATEXT "+(\\." ATEXT "+)*)" +#define DOT_ATOM "(" DOT_ATOM_TEXT ")" +#define EMAIL_RE "(" DOT_ATOM "@" DOT_ATOM ")" +#define FOR_EMAIL_RE "for <" EMAIL_RE ">;" + /**************************************************************************** * IMPLEMENTATION PRIVATE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES ****************************************************************************/ @@ -755,7 +770,7 @@ #define FINISH 2 #define MIME 3 -#line 759 "mlex.c" +#line 774 "mlex.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -920,10 +935,10 @@ register char *yy_cp, *yy_bp; register int yy_act; -#line 165 "mlex.l" +#line 175 "mlex.l" -#line 927 "mlex.c" +#line 942 "mlex.c" if ( yy_init ) { @@ -972,14 +987,14 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 300 ) + if ( yy_current_state >= 312 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *yy_state_ptr++ = yy_current_state; ++yy_cp; } - while ( yy_base[yy_current_state] != 441 ); + while ( yy_base[yy_current_state] != 457 ); yy_find_action: yy_current_state = *--yy_state_ptr; @@ -1010,7 +1025,7 @@ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 167 "mlex.l" +#line 177 "mlex.l" { struct tm tm; @@ -1066,7 +1081,7 @@ YY_BREAK case 2: YY_RULE_SETUP -#line 222 "mlex.l" +#line 232 "mlex.l" { if (strstr (yytext + 11, "Mutt")) a_mail->mua = MUA_MUTT; @@ -1082,7 +1097,7 @@ YY_BREAK case 3: YY_RULE_SETUP -#line 236 "mlex.l" +#line 246 "mlex.l" { if (strstr (yytext + 10, "Outlook Express")) a_mail->mua = MUA_OUTLOOK_EXPRESS; @@ -1106,7 +1121,7 @@ YY_BREAK case 4: YY_RULE_SETUP -#line 258 "mlex.l" +#line 268 "mlex.l" { mime_t *mime = a_mail->rmime->array[a_mail->rmime->count - 1]; @@ -1125,7 +1140,7 @@ YY_BREAK case 5: YY_RULE_SETUP -#line 275 "mlex.l" +#line 285 "mlex.l" { mime_t *mime = a_mail->rmime->array[a_mail->rmime->count -1 ]; @@ -1134,7 +1149,7 @@ YY_BREAK case 6: YY_RULE_SETUP -#line 282 "mlex.l" +#line 292 "mlex.l" { mime_t *mime = a_mail->rmime->array[a_mail->rmime->count - 1]; mime->encoding = MENC_NONE; @@ -1147,7 +1162,7 @@ YY_BREAK case 7: YY_RULE_SETUP -#line 293 "mlex.l" +#line 303 "mlex.l" { char *tmp = yytext + 6; char *date = unfold_content (tmp); @@ -1180,7 +1195,7 @@ YY_BREAK case 8: YY_RULE_SETUP -#line 324 "mlex.l" +#line 334 "mlex.l" { char *tmp = yytext + 9; a_mail->subject = unfold_content (tmp); @@ -1188,31 +1203,30 @@ YY_BREAK case 9: YY_RULE_SETUP -#line 330 "mlex.l" +#line 340 "mlex.l" { char *tmp = yytext + 6; char *from = unfold_content (tmp); - a_mail->from = address_create (from); + a_mail->from = address_from_string (from); xfree (from); } YY_BREAK case 10: YY_RULE_SETUP -#line 339 "mlex.l" +#line 349 "mlex.l" { char *tmp = yytext + 8; char *sender = unfold_content (tmp); - if (a_mail->from == NULL){ - a_mail->from = address_create (sender); - } + if (a_mail->from == NULL) + a_mail->from = address_from_string (sender); xfree (sender); } YY_BREAK case 11: YY_RULE_SETUP -#line 350 "mlex.l" +#line 359 "mlex.l" { char *tmp = yytext + 4; char *to = unfold_content (tmp); @@ -1223,7 +1237,7 @@ YY_BREAK case 12: YY_RULE_SETUP -#line 359 "mlex.l" +#line 368 "mlex.l" { char *tmp = yytext + 4; char *cc = unfold_content (tmp); @@ -1234,7 +1248,7 @@ YY_BREAK case 13: YY_RULE_SETUP -#line 368 "mlex.l" +#line 377 "mlex.l" { char *tmp = yytext + 4; char *bcc = unfold_content (tmp); @@ -1245,7 +1259,7 @@ YY_BREAK case 14: YY_RULE_SETUP -#line 377 "mlex.l" +#line 386 "mlex.l" { char *tmp = yytext + 12; a_mail->msg_id = unfold_content (tmp); @@ -1258,7 +1272,7 @@ YY_BREAK case 15: YY_RULE_SETUP -#line 388 "mlex.l" +#line 397 "mlex.l" { char *tmp = yytext + 13; char *irt; @@ -1277,7 +1291,7 @@ YY_BREAK case 16: YY_RULE_SETUP -#line 405 "mlex.l" +#line 414 "mlex.l" { char *tmp = yytext + 12; @@ -1292,18 +1306,19 @@ YY_BREAK case 17: YY_RULE_SETUP -#line 418 "mlex.l" +#line 427 "mlex.l" { char *tmp = yytext + 10; char *reply_to = unfold_content (tmp); - a_mail->reply_to = address_create (reply_to); + + a_mail->reply_to = address_from_string (reply_to); xfree (reply_to); } YY_BREAK case 18: YY_RULE_SETUP -#line 427 "mlex.l" +#line 437 "mlex.l" { char *i; char *tmp = yytext + 8; @@ -1330,7 +1345,7 @@ YY_BREAK case 19: YY_RULE_SETUP -#line 452 "mlex.l" +#line 462 "mlex.l" { char *i; char *tmp = yytext + 10; @@ -1351,7 +1366,32 @@ YY_BREAK case 20: YY_RULE_SETUP -#line 471 "mlex.l" +#line 481 "mlex.l" +{ + int len; + char *tmp; + char *recv_for; + regmatch_t matches[1]; + + if (a_mail->recv_for == NULL){ + tmp = yytext + 9; + recv_for = unfold_content (tmp); + + if (misc_regex (FOR_EMAIL_RE, recv_for, matches)){ + len = matches[0].rm_eo - matches[0].rm_so - 7 + 1; + tmp = xmalloc (len); + memcpy (tmp, recv_for + matches[0].rm_so + 5, len - 1); + tmp[len - 1] = '\0'; + a_mail->recv_for = address_from_string (tmp); + xfree (tmp); + } + xfree (recv_for); + } +} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 504 "mlex.l" { mime_t *mime = a_mail->rmime->array[a_mail->rmime->count - 1]; @@ -1360,19 +1400,19 @@ mime->offset_start = offset + yyleng; } YY_BREAK -case 21: +case 22: YY_RULE_SETUP -#line 480 "mlex.l" +#line 513 "mlex.l" YY_BREAK -case 22: +case 23: YY_RULE_SETUP -#line 483 "mlex.l" +#line 516 "mlex.l" YY_BREAK -case 23: +case 24: YY_RULE_SETUP -#line 487 "mlex.l" +#line 520 "mlex.l" { char *seek; mime_t *mime; @@ -1407,18 +1447,18 @@ BEGIN (HEADER); } YY_BREAK -case 24: +case 25: YY_RULE_SETUP -#line 522 "mlex.l" +#line 555 "mlex.l" YY_BREAK -case 25: +case 26: YY_RULE_SETUP -#line 525 "mlex.l" +#line 558 "mlex.l" YY_BREAK case YY_STATE_EOF(HEADER): -#line 528 "mlex.l" +#line 561 "mlex.l" { only_one = 0; @@ -1431,7 +1471,7 @@ } YY_BREAK case YY_STATE_EOF(FINISH): -#line 540 "mlex.l" +#line 573 "mlex.l" { BEGIN (INITIAL); @@ -1446,7 +1486,7 @@ YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(MIME): -#line 553 "mlex.l" +#line 586 "mlex.l" { mime_t *mime; @@ -1469,12 +1509,12 @@ return NEXT_MAIL; } YY_BREAK -case 26: +case 27: YY_RULE_SETUP -#line 577 "mlex.l" +#line 610 "mlex.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1478 "mlex.c" +#line 1518 "mlex.c" case YY_END_OF_BUFFER: { @@ -1762,7 +1802,7 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 300 ) + if ( yy_current_state >= 312 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1792,11 +1832,11 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 300 ) + if ( yy_current_state >= 312 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 299); + yy_is_jam = (yy_current_state == 311); if ( ! yy_is_jam ) *yy_state_ptr++ = yy_current_state; @@ -2358,7 +2398,7 @@ return 0; } #endif -#line 577 "mlex.l" +#line 610 "mlex.l" @@ -2462,13 +2502,6 @@ for (ptr = content; *ptr; ptr++){ switch (*ptr){ - case '"': - if (ptr != content && ptr[-1] == '\\'){ - *result_ptr = *ptr; - result_ptr++; - } - break; - case '\r': *result_ptr = ' '; result_ptr++; diff -urN elmo-0.8/src/mlex.l elmo-0.8.1/src/mlex.l --- elmo-0.8/src/mlex.l 2003-06-10 22:40:22.000000000 +0200 +++ elmo-0.8.1/src/mlex.l 2003-07-20 16:43:38.000000000 +0200 @@ -38,6 +38,8 @@ #include #include #include +#include +#include #ifdef HAVE_CONFIG_H # include @@ -60,6 +62,7 @@ #include "mime.h" #include "rmime.h" #include "compose.h" +#include "misc.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -75,6 +78,13 @@ #define boundary (bound_array[bound_index]) +#define ATEXT "([[:alpha:][:digit:]!#\\$%&\\\\\\'\\*\\+\\/\\=\\?\\^_\\`" \ + "\\{\\}\\~\\|\\-])" +#define DOT_ATOM_TEXT "(" ATEXT "+(\\." ATEXT "+)*)" +#define DOT_ATOM "(" DOT_ATOM_TEXT ")" +#define EMAIL_RE "(" DOT_ATOM "@" DOT_ATOM ")" +#define FOR_EMAIL_RE "for <" EMAIL_RE ">;" + /**************************************************************************** * IMPLEMENTATION PRIVATE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES ****************************************************************************/ @@ -331,7 +341,7 @@ char *tmp = yytext + 6; char *from = unfold_content (tmp); - a_mail->from = address_create (from); + a_mail->from = address_from_string (from); xfree (from); } @@ -340,9 +350,8 @@ char *tmp = yytext + 8; char *sender = unfold_content (tmp); - if (a_mail->from == NULL){ - a_mail->from = address_create (sender); - } + if (a_mail->from == NULL) + a_mail->from = address_from_string (sender); xfree (sender); } @@ -419,7 +428,8 @@ char *tmp = yytext + 10; char *reply_to = unfold_content (tmp); - a_mail->reply_to = address_create (reply_to); + + a_mail->reply_to = address_from_string (reply_to); xfree (reply_to); } @@ -468,6 +478,29 @@ } +
^Received:{HEADER_CONTENT} { + int len; + char *tmp; + char *recv_for; + regmatch_t matches[1]; + + if (a_mail->recv_for == NULL){ + tmp = yytext + 9; + recv_for = unfold_content (tmp); + + if (misc_regex (FOR_EMAIL_RE, recv_for, matches)){ + len = matches[0].rm_eo - matches[0].rm_so - 7 + 1; + tmp = xmalloc (len); + memcpy (tmp, recv_for + matches[0].rm_so + 5, len - 1); + tmp[len - 1] = '\0'; + a_mail->recv_for = address_from_string (tmp); + xfree (tmp); + } + xfree (recv_for); + } +} + +
\r?\n\r?\n { mime_t *mime = a_mail->rmime->array[a_mail->rmime->count - 1]; @@ -677,13 +710,6 @@ for (ptr = content; *ptr; ptr++){ switch (*ptr){ - case '"': - if (ptr != content && ptr[-1] == '\\'){ - *result_ptr = *ptr; - result_ptr++; - } - break; - case '\r': *result_ptr = ' '; result_ptr++; diff -urN elmo-0.8/src/mybox.c elmo-0.8.1/src/mybox.c --- elmo-0.8/src/mybox.c 2003-06-19 11:18:01.000000000 +0200 +++ elmo-0.8.1/src/mybox.c 2003-07-21 17:07:10.000000000 +0200 @@ -92,7 +92,7 @@ * folder line format */ -char *mybox_format = "%?%$%# %D %x %S "; +char *mybox_format = "%?%$%# %D %016f %S "; /**************************************************************************** * IMPLEMENTATION PRIVATE FUNCTION PROTOTYPES @@ -193,12 +193,12 @@ if (is_box (box, "sent") || is_box (box, "drafts")){ mybox_format = ask_for_default ("sent_format", NULL); if (mybox_format == NULL) - mybox_format = "%?%$ %D %y %S "; + mybox_format = "%?%$ %D %016t %S "; } else { mybox_format = ask_for_default ("line_format", NULL); if (mybox_format == NULL) - mybox_format = "%?%$%# %D %x %S "; + mybox_format = "%?%$%# %D %016f %S "; } } diff -urN elmo-0.8/src/raddress.c elmo-0.8.1/src/raddress.c --- elmo-0.8/src/raddress.c 2003-06-10 22:40:22.000000000 +0200 +++ elmo-0.8.1/src/raddress.c 2003-07-10 22:07:11.000000000 +0200 @@ -33,7 +33,6 @@ #include "rarray.h" #include "raddress.h" #include "rstring.h" -#include "memchunk.h" #include "xmalloc.h" /**************************************************************************** @@ -91,7 +90,7 @@ void -raddress_add (raddress_t *ptr, address_t *x) +raddress_add (raddress_t *ptr, addr_t *x) { rarray_add ((rarray_t *) ptr, x); } @@ -133,10 +132,10 @@ raddress_get_from_header (char *header) { raddress_t *result; - address_t *addr; + addr_t *addr; char *seek = header; char *comma = NULL; - + result = raddress_create (); while (seek && *seek){ @@ -144,7 +143,7 @@ if (comma) *comma = '\0'; - addr = address_create (seek); + addr = address_from_string (seek); raddress_add (result, addr); if (comma){ @@ -154,7 +153,7 @@ else break; } - + return result; } @@ -164,7 +163,7 @@ raddress_to_strings (raddress_t *ptr) { rstring_t *result = rstring_create_size (ptr->count + 1); - address_t **addr; + addr_t **addr; for (addr = ptr->array; *addr; addr++){ rstring_add (result, (*addr)->full); @@ -175,43 +174,6 @@ -void -raddress_dump (memchunk_t *memchunk, raddress_t *ptr) -{ - int i; - int zero = 0; - - if (ptr == NULL){ - memchunk_intdump (memchunk, zero); - return; - } - - memchunk_intdump (memchunk, ptr->count); - for (i = 0; i < ptr->count; i++){ - address_dump (memchunk, ptr->array[i]); - } -} - - - -raddress_t * -raddress_read (memchunk_t *memchunk) -{ - int i; - int size = memchunk_intget (memchunk); - raddress_t *result; - - if (size == 0) - return NULL; - - result = raddress_create_size (size + 1); - for (i = 0; i < size; i++){ - raddress_add (result, address_read (memchunk)); - } - return result; -} - - /**************************************************************************** * INTERFACE CLASS BODIES ****************************************************************************/ diff -urN elmo-0.8/src/raddress.h elmo-0.8.1/src/raddress.h --- elmo-0.8/src/raddress.h 2003-06-10 22:40:22.000000000 +0200 +++ elmo-0.8.1/src/raddress.h 2003-07-10 22:07:23.000000000 +0200 @@ -28,7 +28,6 @@ #include "address.h" #include "rstring.h" -#include "memchunk.h" /**************************************************************************** * INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -41,7 +40,7 @@ ****************************************************************************/ struct raddress { - address_t **array; + addr_t **array; int size; int count; unsigned flags; @@ -59,15 +58,13 @@ extern raddress_t *raddress_create_size (int count); extern raddress_t *raddress_create (void); extern void raddress_destroy (raddress_t *ptr); -extern void raddress_add (raddress_t *ptr, address_t *x); +extern void raddress_add (raddress_t *ptr, addr_t *x); extern void raddress_remove (raddress_t *ptr, unsigned index); extern void raddress_shrink (raddress_t *ptr); extern raddress_t *raddress_join (raddress_t *x, raddress_t *y); extern void raddress_add_array (raddress_t *x, raddress_t *y); extern raddress_t *raddress_get_from_header (char *header); extern rstring_t *raddress_to_strings (raddress_t *ptr); -extern void raddress_dump (memchunk_t *memchunk, raddress_t *ptr); -extern raddress_t *raddress_read (memchunk_t *memchunk); /**************************************************************************** * INTERFACE OBJECT CLASS DEFINITIONS diff -urN elmo-0.8/src/rarray.c elmo-0.8.1/src/rarray.c --- elmo-0.8/src/rarray.c 2003-06-10 22:40:22.000000000 +0200 +++ elmo-0.8.1/src/rarray.c 2003-07-13 12:37:16.000000000 +0200 @@ -67,6 +67,9 @@ { rarray_t *result; + if (size == 0) + return NULL; + result = xmalloc (sizeof (rarray_t)); result->flags = 0; result->count = 0; @@ -87,7 +90,6 @@ void rarray_destroy (rarray_t *ptr) - { xfree (ptr->array); xfree (ptr); @@ -103,6 +105,9 @@ ptr->array = xrealloc (ptr->array, ptr->size * sizeof (void *)); } + if (p == NULL) + return; + ptr->array[ptr->count] = p; ptr->array[ptr->count + 1] = NULL; ptr->count++; diff -urN elmo-0.8/src/read.c elmo-0.8.1/src/read.c --- elmo-0.8/src/read.c 2003-06-23 14:54:01.000000000 +0200 +++ elmo-0.8.1/src/read.c 2003-07-20 21:50:47.000000000 +0200 @@ -31,6 +31,7 @@ #include #include +#include #include "ecurses.h" #include "screen.h" @@ -41,6 +42,7 @@ #include "rstring.h" #include "read.h" #include "file.h" +#include "abook.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -78,7 +80,7 @@ * IMPLEMENTATION PRIVATE FUNCTION PROTOTYPES ****************************************************************************/ /**************************************************************************** - * CURSOR MOVEMENT FUNCTIONS + * CURSOR MOTION FUNCTIONS ****************************************************************************/ static void @@ -300,6 +302,30 @@ } +static void +complete_prepare_addrs (void) +{ + char c = *position; + char *seek; + + *position = '\0'; + seek = strrchr (buffer, ','); + *position = c; + + if (seek){ + do + seek++; + while (isspace (*seek)); + } + else { + seek = buffer; + } + + compl_items = abook_strings (seek); + change_one_item (); +} + + static int longest_common_prefix (rstring_t *vect) { @@ -330,7 +356,8 @@ { int l; char c; - char *fname; + char *fname = NULL; + char *addr = NULL; if (len == 0) return; @@ -369,6 +396,38 @@ buffer[len] = '\0'; position = buffer + len; break; + + case COMPLETE_ADDRS: + c = *position; + *position = '\0'; + addr = strrchr (buffer, ','); + *position = c; + + if (addr) + addr++; + else + addr = buffer; + + l = strlen (position); + if (len > position - addr && l > 0){ + if (addr != buffer){ + addr[len] = ' '; + addr++; + } + memmove (addr + len, position, l + 1); + memcpy (fname, str, len); + position = addr + len; + } + else if (len > position - addr){ + if (addr != buffer){ + *addr = ' '; + addr++; + } + memcpy (addr, str, len); + position = addr + len; + *position = '\0'; + } + break; } wmove (cmd_echo_area, 0, prompt_len); wclrtoeol (cmd_echo_area); @@ -395,6 +454,10 @@ case COMPLETE_FUNS: complete_prepare_funs (); break; + + case COMPLETE_ADDRS: + complete_prepare_addrs (); + break; } if (compl_string){ diff -urN elmo-0.8/src/read.h elmo-0.8.1/src/read.h --- elmo-0.8/src/read.h 2003-06-19 11:18:01.000000000 +0200 +++ elmo-0.8.1/src/read.h 2003-07-20 21:15:44.000000000 +0200 @@ -31,6 +31,7 @@ COMPLETE_NONE, COMPLETE_FILES, COMPLETE_FUNS, + COMPLETE_ADDRS, } complete_mode_t; /**************************************************************************** diff -urN elmo-0.8/src/select.c elmo-0.8.1/src/select.c --- elmo-0.8/src/select.c 2003-05-02 00:31:12.000000000 +0200 +++ elmo-0.8.1/src/select.c 2003-07-20 10:59:35.000000000 +0200 @@ -34,6 +34,7 @@ #include "screen.h" #include "error.h" #include "line.h" +#include "bitarray.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -94,6 +95,7 @@ static void put_items (select_t *select) { + int bold; int i; unsigned index; line_t *line; @@ -104,12 +106,19 @@ for (i = 0; i < select->win->_maxy - select->with_box && index + i < select->items->count; i++){ + bold = bitarray_is_set (select->selected, index + i); line_put_str (line, select->items->array[index + i]); - mvwaddstr (select->win, i + select->with_box, select->with_box, line->str); + if (bold) + wattron (select->win, A_BOLD); + mvwaddstr (select->win, i + select->with_box, select->with_box, + line->str); + if (bold) + wattroff (select->win, A_BOLD); } line_clear (line); while (i < select->win->_maxy - select->with_box){ - mvwaddstr (select->win, i + select->with_box, select->with_box, line->str); + mvwaddstr (select->win, i + select->with_box, select->with_box, + line->str); i++; } line_destroy (line); @@ -119,11 +128,13 @@ static void draw_bar (select_t *select) { + int bold; line_t *line; if (select->no_bar) return; + bold = bitarray_is_set (select->selected, select->bar_pos); line = line_create (select->win->_maxx + 1 - 2 * select->with_box); if (select->items->count){ @@ -132,7 +143,11 @@ else { line_clear (line); } + if (bold) + wattron (select->bar, A_BOLD); mvwaddstr (select->bar, 0, 0, line->str); + if (bold) + wattroff (select->bar, A_BOLD); line_destroy (line); } @@ -213,6 +228,8 @@ select_open (rstring_t *items, int w, int h, int with_box, int no_bar, const char *title) { + int title_len; + int xpos; select_t *result; if (items == NULL) @@ -228,6 +245,7 @@ result->with_box = with_box; result->no_bar = no_bar; result->win = newwin (h, w, (LINES - h) / 2, (COLS - w) / 2); + result->selected = bitarray_create (items->count); if (!no_bar){ result->bar = newwin (1, w - 2 * with_box, result->win->_begy + with_box, @@ -235,12 +253,24 @@ wbkgdset (result->bar, COLOR_PAIR (2)); } + bitarray_zeros (result->selected); + wattron (result->win, A_BOLD); if (with_box) - box (result->win, 0, 0); + wborder (result->win, 0, 0, ' ', 0, ' ', ' ', 0, 0); if (title){ - mvwaddstr (result->win, 0, (w - strlen (title)) / 2, title); + title_len = strlen (title); + xpos = (w - title_len) / 2 - 2; + mvwinsch (result->win, 0, 0, ACS_ULCORNER); + mvwhline (result->win, 0, 1, ACS_HLINE, xpos - 1); + mvwinsch (result->win, 0, xpos, ACS_RTEE); + wmove (result->win, 0, xpos + 1); + waddstr (result->win, title); + winsch (result->win, ACS_LTEE); + mvwhline (result->win, 0, xpos + title_len + 2, ACS_HLINE, + w - (xpos + title_len + 3)); + mvwinsch (result->win, 0, w - 1, ACS_URCORNER); } wattroff (result->win, A_BOLD); @@ -277,6 +307,9 @@ if (!select->no_bar) delwin (select->bar); + if (select->selected) + bitarray_destroy (select->selected); + xfree (select); return result; @@ -401,9 +434,71 @@ void +select_change (select_t *select) +{ + PREAMBLE; + + bitarray_change_bit (select->selected, select->bar_pos); + select_redraw (select); +} + + +void +select_change_all (select_t *select) +{ + PREAMBLE; + + bitarray_neg (select->selected); + select_redraw (select); +} + + +void +select_set (select_t *select) +{ + PREAMBLE; + + bitarray_set (select->selected, select->bar_pos); + select_redraw (select); +} + + +void +select_unset (select_t *select) +{ + PREAMBLE; + + bitarray_unset (select->selected, select->bar_pos); + select_redraw (select); +} + + + +void +select_set_all (select_t *select) +{ + PREAMBLE; + + bitarray_ones (select->selected); + select_redraw (select); +} + + +void +select_unset_all (select_t *select) +{ + PREAMBLE; + + bitarray_zeros (select->selected); + select_redraw (select); +} + + +void select_redraw (select_t *select) { PREAMBLE; + put_items (select); draw_bar (select); refresh_me (select); @@ -415,6 +510,7 @@ select_add_item (select_t *select, char *item) { PREAMBLE; + rstring_add (select->items, item); select_redraw (select); } @@ -425,7 +521,9 @@ select_remove_item (select_t *select, int index) { PREAMBLE; + rstring_remove (select->items, index); + bitarray_remove (select->selected, index); select_redraw (select); } @@ -435,6 +533,7 @@ select_remove_selected (select_t *select) { PREAMBLE; + select_remove_item (select, select->bar_pos); } @@ -444,8 +543,13 @@ select_install_new_items (select_t *select, rstring_t *items) { PREAMBLE; + rstring_delete (select->items); select->items = items; + if (select->selected) + bitarray_destroy (select->selected); + select->selected = bitarray_create (items->count); + bitarray_zeros (select->selected); select_redraw (select); } diff -urN elmo-0.8/src/select.h elmo-0.8.1/src/select.h --- elmo-0.8/src/select.h 2003-04-23 17:11:38.000000000 +0200 +++ elmo-0.8.1/src/select.h 2003-07-19 14:33:27.000000000 +0200 @@ -26,6 +26,7 @@ #include "ecurses.h" #include "rstring.h" +#include "bitarray.h" /***************************************************************************** * INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -47,13 +48,14 @@ * no_bar -- 1 - no bar and automatic scrolling */ typedef struct select { - WINDOW *win; - WINDOW *bar; - rstring_t *items; - int top_pos; - int bar_pos; - int with_box; - int no_bar; + WINDOW *win; + WINDOW *bar; + rstring_t *items; + bitarray_t *selected; + int top_pos; + int bar_pos; + int with_box; + int no_bar; } select_t; /**************************************************************************** @@ -74,6 +76,12 @@ extern void select_prev_page (select_t *select); extern void select_first (select_t *select); extern void select_last (select_t *select); +extern void select_change (select_t *select); +extern void select_change_all (select_t *select); +extern void select_set (select_t *select); +extern void select_unset (select_t *select); +extern void select_set_all (select_t *select); +extern void select_unset_all (select_t *select); extern void select_redraw (select_t *select); extern void select_add_item (select_t *select, char *item); extern void select_remove_item (select_t *select, int index); diff -urN elmo-0.8/src/sender.c elmo-0.8.1/src/sender.c --- elmo-0.8/src/sender.c 2003-06-23 14:54:00.000000000 +0200 +++ elmo-0.8.1/src/sender.c 2003-07-20 22:22:29.000000000 +0200 @@ -427,7 +427,7 @@ void -sender_open_new (void) +sender_open_new_to (char *to) { char *file; @@ -435,7 +435,7 @@ if (sender_ask == NULL) return; - file = compose_new (); + file = compose_new (to); if (file == NULL){ ask_destroy (sender_ask); @@ -450,6 +450,13 @@ } +void +sender_open_new (void) +{ + sender_open_new_to (NULL); +} + + void sender_open_reply (void) @@ -485,7 +492,7 @@ if (sender_ask == NULL) return; - file = compose_fwd (); + file = compose_fwd (NULL); if (file == NULL){ ask_destroy (sender_ask); @@ -594,7 +601,9 @@ } if (from){ +/* message->reply_to = message->from = address_create (from); +*/ } mailinfo_refresh (); @@ -616,7 +625,9 @@ email = ask_get_field (sender_ask, "email"); name = ask_get_field (sender_ask, "my_name"); +/* message->reply_to = message->from = address_construct (email, name, 'F'); +*/ select_redraw (sender_select); mailinfo_refresh (); @@ -641,7 +652,9 @@ } if (reply_to){ +/* message->reply_to = address_create (reply_to); +*/ } mailinfo_refresh (); diff -urN elmo-0.8/src/sender.h elmo-0.8.1/src/sender.h --- elmo-0.8/src/sender.h 2003-05-18 13:24:18.000000000 +0200 +++ elmo-0.8.1/src/sender.h 2003-07-20 22:22:50.000000000 +0200 @@ -50,6 +50,7 @@ extern void sender_go (void); extern int sender_open (const char *file); extern void sender_refresh (void); +extern void sender_open_new_to (char *to); extern void sender_open_new (void); extern void sender_open_reply (void); extern void sender_open_fwd (void); diff -urN elmo-0.8/src/smtp.c elmo-0.8.1/src/smtp.c --- elmo-0.8/src/smtp.c 2003-05-07 14:54:02.000000000 +0200 +++ elmo-0.8.1/src/smtp.c 2003-07-06 14:34:57.000000000 +0200 @@ -513,9 +513,9 @@ int smtp_send_mail (const char *file, raddress_t *receivers) { - address_t **rcpt; - int success_count = 0; - int ret; + addr_t **rcpt; + int success_count = 0; + int ret; if (receivers == NULL){ smtp_finish_connection (); diff -urN elmo-0.8/src/str.c elmo-0.8.1/src/str.c --- elmo-0.8/src/str.c 1970-01-01 01:00:00.000000000 +0100 +++ elmo-0.8.1/src/str.c 2003-07-20 23:18:04.000000000 +0200 @@ -0,0 +1,131 @@ +/* + elmo - ELectronic Mail Operator + + Copyright (C) 2003 rzyjontko + + This program 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 2, 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, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ---------------------------------------------------------------------- + + resizable strings + +*/ +/**************************************************************************** + * IMPLEMENTATION HEADERS + ****************************************************************************/ + +#include +#include + +#include "str.h" +#include "xmalloc.h" + +/**************************************************************************** + * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS + ****************************************************************************/ + +#define INITIAL_SIZE 64 + +/**************************************************************************** + * IMPLEMENTATION PRIVATE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE STRUCTURES / UTILITY CLASSES + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION REQUIRED EXTERNAL REFERENCES (AVOID) + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE DATA + ****************************************************************************/ +/**************************************************************************** + * INTERFACE DATA + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE FUNCTION PROTOTYPES + ****************************************************************************/ +/**************************************************************************** + * IMPLEMENTATION PRIVATE FUNCTIONS + ****************************************************************************/ +/**************************************************************************** + * INTERFACE FUNCTIONS + ****************************************************************************/ + + +str_t * +str_create_size (int size) +{ + str_t *result = xmalloc (sizeof (str_t)); + + result->len = 0; + result->size = size; + result->str = xmalloc (size + 1); + *result->str = '\0'; + + return result; +} + + +str_t * +str_create (void) +{ + return str_create_size (INITIAL_SIZE); +} + + +void +str_destroy (str_t *str) +{ + if (str->str) + xfree (str->str); + xfree (str); +} + + +void +str_sprintf (str_t *str, const char *fmt, ...) +{ + int n; + int max_size = str->size - str->len; + va_list ap; + + while (1){ + va_start (ap, fmt); + n = vsnprintf (str->str + str->len, max_size, fmt, ap); + va_end (ap); + if (n > -1 && n < max_size){ + str->len += n; + return; + } + if (n > -1) + while (max_size < n + 1){ + str->size *= 2; + max_size = str->size - str->len; + } + else + str->size *= 2; + + str->str = xrealloc (str->str, str->size); + } +} + +/**************************************************************************** + * INTERFACE CLASS BODIES + ****************************************************************************/ +/**************************************************************************** + * + * END MODULE str.c + * + ****************************************************************************/ diff -urN elmo-0.8/src/str.h elmo-0.8.1/src/str.h --- elmo-0.8/src/str.h 1970-01-01 01:00:00.000000000 +0100 +++ elmo-0.8.1/src/str.h 2003-07-20 23:19:57.000000000 +0200 @@ -0,0 +1,70 @@ +#ifndef __STR_H__ +#define __STR_H__ 1 +/* + elmo - ELectronic Mail Operator + + Copyright (C) 2003 rzyjontko + + This program 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 2, 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, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +/**************************************************************************** + * INTERFACE REQUIRED HEADERS + ****************************************************************************/ + +#ifdef __GNUC__ +# define FORMAT __attribute__ ((format (printf, 2, 3))) +#endif + +/**************************************************************************** + * INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS + ****************************************************************************/ +/**************************************************************************** + * INTERFACE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES + ****************************************************************************/ +/**************************************************************************** + * INTERFACE STRUCTURES / UTILITY CLASSES + ****************************************************************************/ + +typedef struct str { + char *str; + int len; + int size; +} str_t; + +/**************************************************************************** + * INTERFACE DATA DECLARATIONS + ****************************************************************************/ +/**************************************************************************** + * INTERFACE FUNCTION PROTOTYPES + ****************************************************************************/ + +extern str_t *str_create_size (int size); +extern str_t *str_create (void); +extern void str_destroy (str_t *str); +extern void str_sprintf (str_t *str, const char *fmt, ...) FORMAT; + +/**************************************************************************** + * INTERFACE OBJECT CLASS DEFINITIONS + ****************************************************************************/ +/**************************************************************************** + * INTERFACE TRAILING HEADERS + ****************************************************************************/ +/**************************************************************************** + * + * END HEADER str.h + * + ****************************************************************************/ +#endif diff -urN elmo-0.8/src/wrapbox.c elmo-0.8.1/src/wrapbox.c --- elmo-0.8/src/wrapbox.c 2003-06-23 21:42:59.000000000 +0200 +++ elmo-0.8.1/src/wrapbox.c 2003-07-15 18:57:51.000000000 +0200 @@ -64,6 +64,7 @@ #include "mybox.h" #include "xmalloc.h" #include "folder.h" +#include "atable.h" /**************************************************************************** * IMPLEMENTATION PRIVATE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS @@ -154,6 +155,7 @@ /* fallback */ /* at this point wrapbox_marray did not change */ + atable_point (wrapbox_marray->ad); return 1; } diff -urN elmo-0.8/src/xmalloc.c elmo-0.8.1/src/xmalloc.c --- elmo-0.8/src/xmalloc.c 2003-06-13 21:24:10.000000000 +0200 +++ elmo-0.8.1/src/xmalloc.c 2003-07-21 17:31:38.000000000 +0200 @@ -65,8 +65,12 @@ * IMPLEMENTATION PRIVATE DATA ****************************************************************************/ +#ifdef XMALLOC_DEBUG + static FILE *fp = NULL; +#endif + /**************************************************************************** * INTERFACE DATA ****************************************************************************/ diff -urN elmo-0.8/TODO elmo-0.8.1/TODO --- elmo-0.8/TODO 2003-06-23 15:19:39.000000000 +0200 +++ elmo-0.8.1/TODO 2003-07-21 16:56:28.000000000 +0200 @@ -10,6 +10,7 @@ - message searching - defaults - utf8 + - signal handler Wanna-have list: @@ -20,7 +21,5 @@ Files to be rewritten: - - abook.c - - address.c - error.c - mime.c