diff options
31 files changed, 512 insertions, 31 deletions
diff --git a/Makefile.am b/Makefile.am index aed3f5ac4..d17f724e5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -91,12 +91,13 @@ SUBDIRS = . \ include\ po\ libmailutils\ sql\ libmu_auth\ libproto\ + libmu_compat\ testsuite\ lib\ libmu_argp\ libmu_cfg\ $(LIBMU_CPP_DIR)\ $(GINT_DIR)\ diff --git a/configure.ac b/configure.ac index abcf5c9fb..aafad7f31 100644 --- a/configure.ac +++ b/configure.ac @@ -1202,21 +1202,24 @@ AC_ARG_WITH([mh-bindir], [MH_BIN_DIR='${exec_prefix}/bin/mu-mh']) # Initialize the (autotest) test suite. AC_CONFIG_TESTDIR(libmailutils/tests) AC_CONFIG_TESTDIR(testsuite) +AC_CONFIG_TESTDIR(libmu_compat/tests) AC_CONFIG_TESTDIR(frm/tests) AC_CONFIG_TESTDIR(maidag/tests) AC_CONFIG_TESTDIR(messages/tests) AC_CONFIG_TESTDIR(readmsg/tests) AC_CONFIG_TESTDIR(sieve/tests) AC_CONFIG_TESTDIR(mh/tests) AC_CONFIG_FILES([libmailutils/tests/Makefile libmailutils/tests/atlocal + libmu_compat/tests/Makefile + libmu_compat/tests/atlocal testsuite/Makefile testsuite/atlocal frm/tests/Makefile frm/tests/atlocal maidag/tests/Makefile maidag/tests/atlocal @@ -1365,12 +1368,13 @@ AC_CONFIG_FILES([ libproto/mh/Makefile libproto/maildir/Makefile libproto/mailer/Makefile libproto/pop/Makefile libproto/nntp/Makefile libproto/imap/Makefile + libmu_compat/Makefile maidag/Makefile mail/Makefile mail/testsuite/Makefile libmailutils/auth/Makefile libmailutils/base/Makefile libmailutils/address/Makefile @@ -1381,12 +1385,13 @@ AC_CONFIG_FILES([ libmailutils/mailer/Makefile libmailutils/mime/Makefile libmailutils/property/Makefile libmailutils/server/Makefile libmailutils/string/Makefile libmailutils/stream/Makefile + libmailutils/stdstream/Makefile libmailutils/url/Makefile libmailutils/Makefile messages/Makefile mh/Makefile mh/etc/Makefile mimeview/Makefile diff --git a/include/mailutils/Makefile.am b/include/mailutils/Makefile.am index b52db2c78..b31515819 100644 --- a/include/mailutils/Makefile.am +++ b/include/mailutils/Makefile.am @@ -58,12 +58,13 @@ pkginclude_HEADERS = \ kwd.h\ ldap.h\ libargp.h\ libcfg.h\ list.h\ locker.h\ + log.h\ mailbox.h\ mailcap.h\ mailer.h\ mailutils.h\ md5.h\ message.h\ @@ -87,12 +88,13 @@ pkginclude_HEADERS = \ registrar.h\ sha1.h\ secret.h\ server.h\ sieve.h\ smtp.h\ + stdstream.h\ stream.h\ syslog.h\ sql.h\ tls.h\ url.h\ vartab.h\ diff --git a/include/mailutils/argcv.h b/include/mailutils/argcv.h index 49d3bfa2d..4a8f29399 100644 --- a/include/mailutils/argcv.h +++ b/include/mailutils/argcv.h @@ -21,12 +21,14 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> +#include <mailutils/types.h> + #ifdef __cplusplus extern "C" { #endif void mu_argcv_free (size_t argc, char **argv); void mu_argv_free (char **argv); @@ -34,26 +36,28 @@ void mu_argv_free (char **argv); enum mu_argcv_escape { mu_argcv_escape_no, mu_argcv_escape_c /* mu_argcv_escape_sh */ }; + int mu_argcv_join (int argc, char **argv, char *delim, enum mu_argcv_escape esc, char **pstring); -int mu_argcv_string (int argc, char **argv, char **string); - void mu_argcv_remove (int *pargc, char ***pargv, int (*sel) (const char *, void *), void *); - +int mu_argcv_string (int argc, char **argv, char **string); + + /* Deprecated interfaces */ + #define MU_ARGCV_RETURN_DELIMS 0x01 #ifndef MU_ARCGV_DEPRECATED -# define MU_ARCGV_DEPRECATED __attribute__((deprecated)) -#endif +# define MU_ARCGV_DEPRECATED MU_DEPRECATED +#endif int mu_argcv_get (const char *command, const char *delim, const char *cmnt, int *argc, char ***argv) MU_ARCGV_DEPRECATED; int mu_argcv_get_n (const char *command, int len, const char *delim, const char *cmnt, diff --git a/include/mailutils/log.h b/include/mailutils/log.h new file mode 100644 index 000000000..a36b85ab5 --- /dev/null +++ b/include/mailutils/log.h @@ -0,0 +1,49 @@ +/* GNU Mailutils -- a suite of utilities for electronic mail + Copyright (C) 2010 Free Software Foundation, Inc. + + GNU Mailutils is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GNU Mailutils 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 GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef _MAILUTILS_LOG_H +#define _MAILUTILS_LOG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <mailutils/types.h> + +#define MU_LOG_DEBUG 0 +#define MU_LOG_INFO 1 +#define MU_LOG_NOTICE 2 +#define MU_LOG_WARNING 3 +#define MU_LOG_ERROR 4 +#define MU_LOG_CRIT 5 +#define MU_LOG_ALERT 6 +#define MU_LOG_EMERG 7 + +#define MU_LOGMODE_SEVERITY 0x0001 +#define MU_LOGMODE_LOCUS 0x0002 + +int mu_log_stream_create (mu_stream_t *, mu_stream_t); +int mu_syslog_stream_create (mu_stream_t *, int); + +extern char *_mu_severity_str[]; +extern int _mu_severity_num; + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/include/mailutils/mailutils.h b/include/mailutils/mailutils.h index ccaa3d5e6..19b8e773f 100644 --- a/include/mailutils/mailutils.h +++ b/include/mailutils/mailutils.h @@ -56,15 +56,15 @@ #include <mailutils/registrar.h> #include <mailutils/stream.h> #include <mailutils/tls.h> #include <mailutils/url.h> #include <mailutils/gocs.h> #include <mailutils/version.h> -#include <mailutils/vartab.h> #include <mailutils/io.h> #include <mailutils/secret.h> #include <mailutils/cctype.h> #include <mailutils/cstr.h> #include <mailutils/wordsplit.h> #include <mailutils/log.h> +#include <mailutils/stdstream.h> /* EOF */ diff --git a/include/mailutils/stdstream.h b/include/mailutils/stdstream.h new file mode 100644 index 000000000..fcb971fdb --- /dev/null +++ b/include/mailutils/stdstream.h @@ -0,0 +1,46 @@ +/* GNU Mailutils -- a suite of utilities for electronic mail + Copyright (C) 2009 Free Software Foundation, Inc. + + GNU Mailutils is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GNU Mailutils 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 GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef _MAILUTILS_STDSTREAM_H +#define _MAILUTILS_STDSTREAM_H + +#include <mailutils/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern mu_stream_t mu_strin; +extern mu_stream_t mu_strout; +extern mu_stream_t mu_strerr; + +extern const char *mu_program_name; + +#define MU_STRERR_STDERR 0 +#define MU_STRERR_SYSLOG 1 +/* #define MU_STRERR_FILE 2 */ + +void mu_stdstream_setup (void); +int mu_stdstream_strerr_create (mu_stream_t *str, int type, int facility, + int priority, const char *tag, + const char *fname); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/include/mailutils/stream.h b/include/mailutils/stream.h index f1fc4f51b..a7bbfe1ec 100644 --- a/include/mailutils/stream.h +++ b/include/mailutils/stream.h @@ -103,13 +103,13 @@ enum mu_buffer_type #define MU_IOCTL_LOGSTREAM_SET_LOCUS 21 /* Get or set log mode. Arg: int * */ #define MU_IOCTL_LOGSTREAM_GET_MODE 22 #define MU_IOCTL_LOGSTREAM_SET_MODE 23 - + #define MU_TRANSPORT_INPUT 0 #define MU_TRANSPORT_OUTPUT 1 #define MU_TRANSPORT_VALID_TYPE(n) \ ((n) == MU_TRANSPORT_INPUT || (n) == MU_TRANSPORT_OUTPUT) struct mu_nullstream_pattern diff --git a/include/mailutils/types.hin b/include/mailutils/types.hin index e0b356618..26916e559 100644 --- a/include/mailutils/types.hin +++ b/include/mailutils/types.hin @@ -30,12 +30,16 @@ #endif #ifndef MU_PRINTFLIKE # define MU_PRINTFLIKE(fmt,narg) __attribute__ ((__format__ (__printf__, fmt, narg))) #endif +#ifndef MU_DEPRECATED +# define MU_DEPRECATED __attribute__ ((deprecated)) +#endif + #ifdef __cplusplus extern "C" { #endif struct mu_core_class; struct mu_core_object; diff --git a/include/mailutils/vartab.h b/include/mailutils/vartab.h index 26f46bb3f..5d0598295 100644 --- a/include/mailutils/vartab.h +++ b/include/mailutils/vartab.h @@ -17,20 +17,30 @@ #ifndef _MAILUTILS_VARTAB_H #define _MAILUTILS_VARTAB_H #include <mailutils/types.h> +#ifdef MU_SUPPRESS_DEPRECATION +# undef MU_DEPRECATED +# define MU_DEPRECATED +#else +# warning "Mailutils support for vartab functions has been deprecated." +# warning "Revise your code to use <mailutils/wordsplit.h>." +#endif + typedef int (*mu_var_expansion_fp) (const char *name, void *data, char **p); typedef void (*mu_var_free_fp) (void *data, char *value); -int mu_vartab_create (mu_vartab_t *pvar); -int mu_vartab_destroy (mu_vartab_t *pvar); +int mu_vartab_create (mu_vartab_t *pvar) MU_DEPRECATED; +int mu_vartab_destroy (mu_vartab_t *pvar) MU_DEPRECATED; int mu_vartab_define (mu_vartab_t var, const char *name, const char *value, - int isstatic); + int isstatic) MU_DEPRECATED; int mu_vartab_define_exp (mu_vartab_t var, const char *name, mu_var_expansion_fp fun, mu_var_free_fp free, - void *data); -int mu_vartab_count (mu_vartab_t vt, size_t *pcount); -int mu_vartab_getvar (mu_vartab_t vt, const char *name, const char **pvalue); -int mu_vartab_expand (mu_vartab_t vt, const char *str, char **pres); + void *data) MU_DEPRECATED; +int mu_vartab_count (mu_vartab_t vt, size_t *pcount) MU_DEPRECATED; +int mu_vartab_getvar (mu_vartab_t vt, const char *name, const char **pvalue) + MU_DEPRECATED; +int mu_vartab_expand (mu_vartab_t vt, const char *str, char **pres) + MU_DEPRECATED; #endif diff --git a/libmailutils/Makefile.am b/libmailutils/Makefile.am index 34246dcf8..bac6aa994 100644 --- a/libmailutils/Makefile.am +++ b/libmailutils/Makefile.am @@ -14,13 +14,13 @@ # # You should have received a copy of the GNU Lesser General # Public License along with this library. If not, see # <http://www.gnu.org/licenses/>. SUBDIRS = auth base address cfg diag filter mailbox mailer mime\ - server string stream property url . tests + server string stream stdstream property url . tests lib_LTLIBRARIES = libmailutils.la libmailutils_la_SOURCES = libmailutils_la_LIBADD = \ @@ -35,10 +35,11 @@ libmailutils_la_LIBADD = \ mailer/libmailer.la\ mime/libmime.la\ property/libproperty.la\ server/libserver.la\ string/libstring.la\ stream/libstream.la\ + stdstream/libstdstream.la\ url/liburl.la libmailutils_la_LDFLAGS = -version-info @VI_CURRENT@:@VI_REVISION@:@VI_AGE@ diff --git a/libmailutils/base/Makefile.am b/libmailutils/base/Makefile.am index ae9d2a972..b50781c20 100644 --- a/libmailutils/base/Makefile.am +++ b/libmailutils/base/Makefile.am @@ -17,13 +17,12 @@ noinst_LTLIBRARIES = libbase.la libbase_la_SOURCES = \ alloc.c\ amd.c\ - argcv.c\ argcvfree.c\ argcvjoin.c\ argcvrem.c\ assoc.c\ daemon.c\ date.c\ @@ -62,13 +61,12 @@ libbase_la_SOURCES = \ spawnvp.c\ symlink.c\ tempfile.c\ ticket.c\ tilde.c\ usremail.c\ - vartab.c\ version.c\ wicket.c localedir = $(datadir)/locale AM_CPPFLAGS = \ -DSYSCONFDIR=\"$(sysconfdir)\"\ diff --git a/libmailutils/stdstream/Makefile.am b/libmailutils/stdstream/Makefile.am new file mode 100644 index 000000000..feede72b3 --- /dev/null +++ b/libmailutils/stdstream/Makefile.am @@ -0,0 +1,24 @@ +# GNU Mailutils -- a suite of utilities for electronic mail +# Copyright (C) 2010 Free Software Foundation, Inc. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General +# Public License along with this library. If not, see +# <http://www.gnu.org/licenses/>. + +noinst_LTLIBRARIES = libstdstream.la + +libstdstream_la_SOURCES = \ + basestr.c\ + strerr.c + +INCLUDES = @MU_LIB_COMMON_INCLUDES@ -I/libmailutils diff --git a/libmailutils/stdstream/basestr.c b/libmailutils/stdstream/basestr.c new file mode 100644 index 000000000..28759aaf3 --- /dev/null +++ b/libmailutils/stdstream/basestr.c @@ -0,0 +1,80 @@ +/* GNU Mailutils -- a suite of utilities for electronic mail + Copyright (C) 2010 Free Software Foundation, Inc. + + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This library 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <unistd.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <mailutils/types.h> +#include <mailutils/errno.h> +#include <mailutils/log.h> +#include <mailutils/stream.h> +#include <mailutils/stdstream.h> + +mu_stream_t mu_strin; +mu_stream_t mu_strout; +mu_stream_t mu_strerr; + +void +mu_stdstream_setup () +{ + int rc; + int fd; + + /* Ensure that first 3 descriptors are open in proper mode */ + fd = open ("/dev/null", O_WRONLY); + switch (fd) + { + case 2: + /* keep it open */; + break; + + case 1: + /* keep it open and try 0 */ + fd = open ("/dev/null", O_RDONLY); + if (fd != 0) + close (fd); + break; + + default: + close (fd); + break; + } + + /* Create the corresponding streams */ + rc = mu_stdio_stream_create (&mu_strin, MU_STDIN_FD, 0); + if (rc) + { + fprintf (stderr, "mu_stdio_stream_create(%d): %s\n", + MU_STDIN_FD, mu_strerror (rc)); + abort (); + } + rc = mu_stdio_stream_create (&mu_strout, MU_STDOUT_FD, 0); + if (rc) + { + fprintf (stderr, "mu_stdio_stream_create(%d): %s\n", + MU_STDOUT_FD, mu_strerror (rc)); + abort (); + } + + if (mu_stdstream_strerr_create (&mu_strerr, MU_STRERR_STDERR, 0, 0, + NULL, NULL)) + abort (); +} diff --git a/libmailutils/stdstream/strerr.c b/libmailutils/stdstream/strerr.c new file mode 100644 index 000000000..76dd2cb7f --- /dev/null +++ b/libmailutils/stdstream/strerr.c @@ -0,0 +1,101 @@ +/* GNU Mailutils -- a suite of utilities for electronic mail + Copyright (C) 2010 Free Software Foundation, Inc. + + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This library 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <syslog.h> +#include <mailutils/types.h> +#include <mailutils/nls.h> +#include <mailutils/io.h> +#include <mailutils/errno.h> +#include <mailutils/log.h> +#include <mailutils/stream.h> +#include <mailutils/stdstream.h> +#include <mailutils/filter.h> + +int +mu_stdstream_strerr_create (mu_stream_t *plogger, int type, int facility, + int priority, const char *tag, + const char *fname MU_ARG_UNUSED) +{ + int rc; + mu_stream_t transport; + + if (!tag) + tag = mu_program_name; + switch (type) + { + case MU_STRERR_STDERR: + { + mu_stream_t str; + char *fltargs[3] = { "INLINE-COMMENT", }; + + rc = mu_stdio_stream_create (&str, MU_STDERR_FD, 0); + if (rc) + { + fprintf (stderr, _("%s: cannot open error stream: %s\n"), + tag, mu_strerror (rc)); + return MU_ERR_FAILURE; + } + mu_asprintf (&fltargs[1], "%s: ", tag); + fltargs[2] = NULL; + rc = mu_filter_create_args (&transport, str, + "INLINE-COMMENT", 2, (const char**)fltargs, + MU_FILTER_ENCODE, MU_STREAM_WRITE); + mu_stream_unref (str); + free (fltargs[1]); + if (rc) + { + fprintf (stderr, + _("%s: cannot open output filter stream: %s"), + tag, mu_strerror (rc)); + return MU_ERR_FAILURE; + } + } + break; + + case MU_STRERR_SYSLOG: + openlog (tag, LOG_PID, facility); + rc = mu_syslog_stream_create (&transport, priority); + if (rc) + { + fprintf (stderr, _("%s: cannot create syslog stream: %s\n"), + tag, mu_strerror (rc)); + return MU_ERR_FAILURE; + } + break; + + default: + fprintf (stderr, _("%s: cannot create error stream: %s\n"), + tag, mu_strerror (EINVAL)); + return EINVAL; + } + + rc = mu_log_stream_create (plogger, transport); + mu_stream_unref (transport); + if (rc) + { + fprintf (stderr, _("%s: cannot open logger stream: %s\n"), + tag , mu_strerror (rc)); + return MU_ERR_FAILURE; + } + return 0; +} + diff --git a/libmailutils/stream/logstream.c b/libmailutils/stream/logstream.c index 5908a27ec..ece636e74 100644 --- a/libmailutils/stream/logstream.c +++ b/libmailutils/stream/logstream.c @@ -155,13 +155,13 @@ _log_write (struct _mu_stream *str, const char *buf, size_t size, return EINVAL; } } if (severity >= _mu_severity_num) severity = MU_LOG_EMERG; - + if (logmode & MU_LOGMODE_LOCUS) { if (fname) _locus_set_file (&loc, fname, flen); if (loc.mu_file) diff --git a/libmailutils/stream/syslogstream.c b/libmailutils/stream/syslogstream.c index 384694e59..c81815f38 100644 --- a/libmailutils/stream/syslogstream.c +++ b/libmailutils/stream/syslogstream.c @@ -54,13 +54,13 @@ _syslog_ctl (struct _mu_stream *str, int op, void *arg) case MU_IOCTL_LOGSTREAM_SET_SEVERITY: if (!arg) return EINVAL; sp->prio = *(int*)arg; break; - + default: return ENOSYS; } return 0; } diff --git a/libmailutils/tests/Makefile.am b/libmailutils/tests/Makefile.am index cfcea3997..b7960bfc3 100644 --- a/libmailutils/tests/Makefile.am +++ b/libmailutils/tests/Makefile.am @@ -38,13 +38,12 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac ## Non-installable programs ## -------------------------- ## INCLUDES = @MU_LIB_COMMON_INCLUDES@ noinst_PROGRAMS = \ addr\ - argcv\ decode2047\ encode2047\ fltst\ listop\ mailcap\ prop\ @@ -60,13 +59,12 @@ EXTRA_DIST += Encode Decode Wicketfile ## ------------ ## ## Test suite. ## ## ------------ ## TESTSUITE_AT = \ address.at\ - argcv.at\ base64d.at\ base64e.at\ decode2047.at\ encode2047.at\ fromflt.at\ hdrflt.at\ diff --git a/libmailutils/tests/testsuite.at b/libmailutils/tests/testsuite.at index 722e83946..fa3118954 100644 --- a/libmailutils/tests/testsuite.at +++ b/libmailutils/tests/testsuite.at @@ -52,13 +52,12 @@ AT_CLEANUP ]) AT_INIT m4_include([list.at]) m4_include([address.at]) -m4_include([argcv.at]) m4_include([wordsplit.at]) m4_include([url.at]) m4_include([mailcap.at]) m4_include([base64e.at]) m4_include([base64d.at]) m4_include([decode2047.at]) diff --git a/libmu_compat/Makefile.am b/libmu_compat/Makefile.am new file mode 100644 index 000000000..c55590830 --- /dev/null +++ b/libmu_compat/Makefile.am @@ -0,0 +1,25 @@ +# This file is part of GNU Mailutils +# Copyright (C) 2010 Free Software Foundation, Inc. +# +# GNU Mailutils is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3, or (at +# your option) any later version. +# +# GNU Mailutils 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 GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. + +SUBDIRS = . tests +lib_LTLIBRARIES = libmu_compat.la + +libmu_compat_la_SOURCES = \ + argcv.c\ + vartab.c + +INCLUDES = @MU_LIB_COMMON_INCLUDES@ -I/libmailutils + diff --git a/libmailutils/base/argcv.c b/libmu_compat/argcv.c index 142de6b6a..142de6b6a 100644 --- a/libmailutils/base/argcv.c +++ b/libmu_compat/argcv.c diff --git a/libmu_compat/tests/.gitignore b/libmu_compat/tests/.gitignore new file mode 100644 index 000000000..81721a669 --- /dev/null +++ b/libmu_compat/tests/.gitignore @@ -0,0 +1,7 @@ +atconfig +atlocal +package.m4 +testsuite +testsuite.dir +testsuite.log +argcv diff --git a/libmu_compat/tests/Makefile.am b/libmu_compat/tests/Makefile.am new file mode 100644 index 000000000..14bb70ce0 --- /dev/null +++ b/libmu_compat/tests/Makefile.am @@ -0,0 +1,75 @@ +# This file is part of GNU Mailutils. +# Copyright (C) 2010 Free Software Foundation, Inc. +# +# GNU Mailutils is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3, or (at +# your option) any later version. +# +# GNU Mailutils 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 GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. + +EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 +DISTCLEANFILES = atconfig $(check_SCRIPTS) +MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) + +## ------------ ## +## package.m4. ## +## ------------ ## + +$(srcdir)/package.m4: $(top_srcdir)/configure.ac + $(AM_V_GEN){ \ + echo '# Signature of the current package.'; \ + echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ + echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ + echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ + echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ + echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ + } >$(srcdir)/package.m4 + +# + +## -------------------------- ## +## Non-installable programs +## -------------------------- ## + +INCLUDES = @MU_LIB_COMMON_INCLUDES@ +noinst_PROGRAMS = argcv + +LDADD = ../libmu_compat.la ${MU_LIB_MAILUTILS} + +## ------------ ## +## Test suite. ## +## ------------ ## + +TESTSUITE_AT = \ + argcv.at\ + testsuite.at + +TESTSUITE = $(srcdir)/testsuite +M4=m4 + +AUTOTEST = $(AUTOM4TE) --language=autotest +$(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc + $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp + $(AM_V_at)mv $@.tmp $@ + +atconfig: $(top_builddir)/config.status + cd $(top_builddir) && ./config.status tests/$@ + +clean-local: + @test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean + +check-local: atconfig atlocal $(TESTSUITE) + @$(SHELL) $(TESTSUITE) + +# Run the test suite on the *installed* tree. +#installcheck-local: +# $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin + + |