Commit 10a75b15 10a75b15697e10e317c20daf64a34ae683444bc8 by Sergey Poznyakoff

* NEWS, TODO: Update

* include/mailutils/types.hin: New type mu_log_level_t.
* include/mailutils/debug.hm4, include/mailutils/diag.h,
mailbox/cfg_lexer.c, mailbox/cfg_parser.y, mailbox/dbgstderr.c,
mailbox/dbgsyslog.c, mailbox/debug.c, mailbox/diag.c,
mailbox/gdebug.c, mailbox/muerror.c, mailbox/syslog.c,
sieve/sieve.c: Use mu_log_level_t instead of size_t for debugging
and logging levels.
1 parent cec83dca
2007-11-30 Sergey Poznyakoff <gray@gnu.org.ua>
* NEWS, TODO: Update
* include/mailutils/types.hin: New type mu_log_level_t.
* include/mailutils/debug.hm4, include/mailutils/diag.h,
mailbox/cfg_lexer.c, mailbox/cfg_parser.y, mailbox/dbgstderr.c,
mailbox/dbgsyslog.c, mailbox/debug.c, mailbox/diag.c,
mailbox/gdebug.c, mailbox/muerror.c, mailbox/syslog.c,
sieve/sieve.c: Use mu_log_level_t instead of size_t for debugging
and logging levels.
2007-11-29 Sergey Poznyakoff <gray@gnu.org.ua>
* comsat/action.c, comsat/comsat.c, imap4d/auth_gsasl.c,
......
GNU mailutils NEWS -- history of user-visible changes. 2007-11-26
GNU mailutils NEWS -- history of user-visible changes. 2007-11-30
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
See the end of file for copying conditions.
......@@ -9,6 +9,56 @@ Version 1.2.90:
* New configuration file format.
* Diagnostic and debugging functions essentially rewritten.
A set of debugging macros, MU_DEBUG0 through MU_DEBUG11, is provided.
New functions mu_debug_printf and mu_debug_vprintf allow for flexible
formatting of debugging messages. The mu_debug_t object features
built-in line bufferring.
The new function mu_debug_check_level(d,l) returns true if the logging
level currently set for debugging object `d' matches that given by
`l'.
New diagnostics functions are available, among them:
void mu_diag_vprintf (int level, const char *fmt, va_list ap);
void mu_diag_printf (int level, const char *fmt, ...);
void mu_diag_voutput (int level, const char *fmt, va_list ap);
void mu_diag_output (int level, const char *fmt, ...);
A new header file, mailutils/diag.h, declarations of these and other
related functions.
See documentation (FIXME: Chapter?) for more information.
The functions mu_error and mu_verror are shortcuts for
mu_diag_output (MU_DIAG_ERROR, ...) and mu_diag_voutput (MU_DIAG_ERROR, ...),
correspondingly.
The function mu_error_set_print is deprecated as well as the
mu_error_pfn_t type. They are, however, still supported. The following
approach is recommended to use instead of mu_error_set_print:
mu_diag_get_debug (&debug);
mu_debug_set_print (debug, new_printer, NULL);
* Global debugging and verbosity settings.
These settings provide default values for mu_debug_t objects created
by various library objects. The following functions are provided for
dealing with global debugging level:
unsigned mu_global_debug_level (const char *object_name);
int mu_global_debug_set_level (const char *object_name, unsigned level);
int mu_global_debug_clear_level (const char *object_name);
Each Mailutils utility understands two additional command line
options:
--debug-level=LEVEL Set Mailutils debugging level.
--debug-line-info Show source info with debugging messages.
* New utility `maidag'
Maidag is a MAIl Delivery AGent. It is a general-purpose MDA able to
......
GNU mailutils TODO list. 2005-03-18
Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
GNU mailutils TODO list. 2007-11-30
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006,
2007 Free Software Foundation, Inc.
* Documentation
......@@ -25,10 +26,6 @@ is definitely gone.
** mailboxes don't remember whether or not they've been opened
** mu_error() vs. debug_t: Revise both methods of reporting the
diagnostics. Possibly they could be merged. Possibly log_t object
is needed.
** does IMAP do an EXAMINE instead of a select if the mailbox is being
opened readonly? Does list return whether a mailbox is readonly?
Check against CMUs anon server, it is a read-only mailbox.
......@@ -61,15 +58,6 @@ and use them in mail.remote.
** support AUTH=anonymous (imap://cyrus.andrew.cmu.edu/archive.info-cyrus)
** support POP3S and IMAPS mailers (ports 995/993).
Jeff Bailey says:
I think this might be the only encryption that common versions of
Outlook Express support. As a low priority TODO list item, (like if it
never gets done, there's no worries) I think it can probably stay on.
The advantage of having it just do this itself is that other utilities
aren't required to get this configured up in something like Debian.
** filter_trans needs readline method.
* pop3
......@@ -109,12 +97,8 @@ of message arrival, this is supported by imap, but we'll have to fake
for pop and local spools my polling, why can't you select() on a unix
file?)
* mail.local: Add daemon mode with LMTP support
* utilities
** forward only MTA, nullmailer like, but accepting SMTP on 25 from localhost
** mimeview: support nametemplate
** all
......
......@@ -57,38 +57,40 @@ struct mu_debug_locus
int mu_debug_create (mu_debug_t *, void *);
void mu_debug_destroy (mu_debug_t *, void *);
void *mu_debug_get_owner (mu_debug_t);
int mu_debug_set_level (mu_debug_t, size_t);
int mu_debug_get_level (mu_debug_t, size_t *);
int mu_debug_set_level (mu_debug_t, mu_log_level_t);
int mu_debug_get_level (mu_debug_t, mu_log_level_t *);
int mu_debug_set_locus (mu_debug_t, const char *, int);
int mu_debug_get_locus (mu_debug_t, struct mu_debug_locus *);
int mu_debug_set_function (mu_debug_t, const char *);
int mu_debug_get_function (mu_debug_t, const char **);
int mu_debug_print (mu_debug_t, size_t, const char *, ...)
int mu_debug_print (mu_debug_t, mu_log_level_t, const char *, ...)
MU_PRINTFLIKE(3,4);
int mu_debug_printv (mu_debug_t, size_t, const char *, va_list);
int mu_debug_check_level (mu_debug_t, size_t);
int mu_debug_printv (mu_debug_t, mu_log_level_t, const char *, va_list);
int mu_debug_check_level (mu_debug_t, mu_log_level_t);
int mu_debug_printf (mu_debug_t, size_t, const char *, ...)
int mu_debug_printf (mu_debug_t, mu_log_level_t, const char *, ...)
MU_PRINTFLIKE(3,4);
int mu_debug_vprintf (mu_debug_t, size_t, const char *, va_list);
int mu_debug_vprintf (mu_debug_t, mu_log_level_t, const char *, va_list);
extern int mu_debug_line_info;
typedef int (*mu_debug_printer_fp) (void*, size_t, const char *);
typedef int (*mu_debug_printer_fp) (void*, mu_log_level_t, const char *);
int mu_debug_set_print (mu_debug_t, mu_debug_printer_fp, void *);
int mu_debug_set_data (mu_debug_t, void *, void (*) (void*), void *);
extern mu_debug_printer_fp mu_debug_default_printer;
int mu_debug_syslog_printer (void *, size_t, const char *);
int mu_debug_stderr_printer (void *, size_t, const char *);
int mu_debug_syslog_printer (void *, mu_log_level_t, const char *);
int mu_debug_stderr_printer (void *, mu_log_level_t, const char *);
unsigned mu_global_debug_level (const char *);
int mu_global_debug_set_level (const char *, unsigned);
mu_log_level_t mu_global_debug_level (const char *);
int mu_global_debug_set_level (const char *, mu_log_level_t);
int mu_global_debug_clear_level (const char *);
int mu_global_debug_from_string (const char *, const char *);
int mu_debug_level_from_string (const char *string, mu_log_level_t *plev,
mu_debug_t debug);
forloop(`i',1,11,`MKDEBUG(i)')
......
......@@ -44,16 +44,16 @@ void mu_set_program_name (const char *);
void mu_diag_init (void);
void mu_diag_get_debug (mu_debug_t *);
void mu_diag_set_debug (mu_debug_t);
void mu_diag_vprintf (int, const char *, va_list);
void mu_diag_printf (int, const char *, ...) MU_PRINTFLIKE(2,3);
void mu_diag_voutput (int, const char *, va_list);
void mu_diag_output (int, const char *, ...) MU_PRINTFLIKE(2,3);
void mu_diag_vprintf (mu_log_level_t, const char *, va_list);
void mu_diag_printf (mu_log_level_t, const char *, ...) MU_PRINTFLIKE(2,3);
void mu_diag_voutput (mu_log_level_t, const char *, va_list);
void mu_diag_output (mu_log_level_t, const char *, ...) MU_PRINTFLIKE(2,3);
int mu_diag_syslog_printer (void *, size_t, const char *);
int mu_diag_stderr_printer (void *, size_t, const char *);
int mu_diag_syslog_printer (void *, mu_log_level_t, const char *);
int mu_diag_stderr_printer (void *, mu_log_level_t, const char *);
int mu_diag_level_to_syslog (int level);
const char *mu_diag_level_to_string (int level);
int mu_diag_level_to_syslog (mu_log_level_t level);
const char *mu_diag_level_to_string (mu_log_level_t level);
#ifdef __cplusplus
}
......
......@@ -100,7 +100,8 @@ typedef struct _mu_wicket *mu_wicket_t;
typedef void *mu_transport_t;
typedef struct _mu_assoc *mu_assoc_t;
typedef char *mu_message_qid_t;
typedef int mu_log_level_t;
#define MU_FOLDER_ATTRIBUTE_DIRECTORY 0x001
#define MU_FOLDER_ATTRIBUTE_FILE 0x002
#define MU_FOLDER_ATTRIBUTE_ALL \
......
......@@ -229,7 +229,7 @@ again:
skipline (p);
if (strncmp (start, "debug=", 6) == 0)
{
size_t lev;
mu_log_level_t lev;
if (p->curp[0] == '\n')
{
mu_cfg_locus.line++;
......
......@@ -228,7 +228,7 @@ tag : MU_CFG_START_TOKEN opt_eol taglist MU_CFG_END_TOKEN MU_CFG_EOL_TOKEN
%%
static int
_cfg_default_printer (void *unused, size_t level, const char *str)
_cfg_default_printer (void *unused, mu_log_level_t level, const char *str)
{
fprintf (stderr, "%s", str);
return 0;
......
......@@ -24,7 +24,7 @@
#include <stdio.h>
int
mu_debug_stderr_printer (void *unused, size_t level, const char *str)
mu_debug_stderr_printer (void *unused, mu_log_level_t level, const char *str)
{
fprintf (stderr, "%s: %s",
(level == MU_DEBUG_ERROR) ? "ERROR" : "DEBUG",
......
......@@ -24,7 +24,7 @@
#include <syslog.h>
int
mu_debug_syslog_printer (void *unused, size_t level, const char *str)
mu_debug_syslog_printer (void *unused, mu_log_level_t level, const char *str)
{
syslog ((level == MU_DEBUG_ERROR) ? LOG_ERR : LOG_DEBUG, "%s", str);
return 0;
......
......@@ -78,7 +78,7 @@ mu_debug_get_owner (mu_debug_t debug)
}
int
mu_debug_set_level (mu_debug_t debug, size_t level)
mu_debug_set_level (mu_debug_t debug, mu_log_level_t level)
{
if (debug == NULL)
return EINVAL;
......@@ -87,7 +87,7 @@ mu_debug_set_level (mu_debug_t debug, size_t level)
}
int
mu_debug_get_level (mu_debug_t debug, size_t *plevel)
mu_debug_get_level (mu_debug_t debug, mu_log_level_t *plevel)
{
if (debug == NULL)
return EINVAL;
......@@ -143,7 +143,7 @@ debug_format_prefix (mu_debug_t debug)
}
int
mu_debug_vprintf (mu_debug_t debug, size_t level,
mu_debug_vprintf (mu_debug_t debug, mu_log_level_t level,
const char *format, va_list ap)
{
if (debug == NULL || format == NULL)
......@@ -214,7 +214,8 @@ mu_debug_vprintf (mu_debug_t debug, size_t level,
}
int
mu_debug_printf (mu_debug_t debug, size_t level, const char *format, ...)
mu_debug_printf (mu_debug_t debug, mu_log_level_t level,
const char *format, ...)
{
va_list ap;
......@@ -226,7 +227,8 @@ mu_debug_printf (mu_debug_t debug, size_t level, const char *format, ...)
int
mu_debug_print (mu_debug_t debug, size_t level, const char *format, ...)
mu_debug_print (mu_debug_t debug, mu_log_level_t level,
const char *format, ...)
{
va_list ap;
mu_debug_printv (debug, level, format, ap);
......@@ -235,7 +237,7 @@ mu_debug_print (mu_debug_t debug, size_t level, const char *format, ...)
}
int
mu_debug_printv (mu_debug_t debug, size_t level, const char *format,
mu_debug_printv (mu_debug_t debug, mu_log_level_t level, const char *format,
va_list ap)
{
if (debug == NULL || format == NULL)
......@@ -246,7 +248,7 @@ mu_debug_printv (mu_debug_t debug, size_t level, const char *format,
}
int
mu_debug_check_level (mu_debug_t debug, size_t level)
mu_debug_check_level (mu_debug_t debug, mu_log_level_t level)
{
if (!debug)
return 0;
......
......@@ -87,14 +87,14 @@ mu_diag_set_debug (mu_debug_t debug)
}
void
mu_diag_vprintf (int level, const char *fmt, va_list ap)
mu_diag_vprintf (mu_log_level_t level, const char *fmt, va_list ap)
{
mu_diag_init ();
mu_debug_vprintf (mu_diag_debug, level, fmt, ap);
}
void
mu_diag_printf (int level, const char *fmt, ...)
mu_diag_printf (mu_log_level_t level, const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
......@@ -103,7 +103,7 @@ mu_diag_printf (int level, const char *fmt, ...)
}
void
mu_diag_voutput (int level, const char *fmt, va_list ap)
mu_diag_voutput (mu_log_level_t level, const char *fmt, va_list ap)
{
mu_diag_init ();
mu_debug_vprintf (mu_diag_debug, level, fmt, ap);
......@@ -111,7 +111,7 @@ mu_diag_voutput (int level, const char *fmt, va_list ap)
}
void
mu_diag_output (int level, const char *fmt, ...)
mu_diag_output (mu_log_level_t level, const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
......@@ -120,7 +120,7 @@ mu_diag_output (int level, const char *fmt, ...)
}
const char *
mu_diag_level_to_string (int level)
mu_diag_level_to_string (mu_log_level_t level)
{
switch (level)
{
......@@ -152,7 +152,7 @@ mu_diag_level_to_string (int level)
}
int
mu_diag_stderr_printer (void *data, size_t level, const char *buf)
mu_diag_stderr_printer (void *data, mu_log_level_t level, const char *buf)
{
if (mu_program_name)
fprintf (stderr, "%s: ", mu_program_name);
......
......@@ -44,7 +44,7 @@ struct debug_level
static mu_assoc_t debug_table;
unsigned
mu_log_level_t
mu_global_debug_level (const char *object_name)
{
struct debug_level *p = mu_assoc_ref (debug_table, object_name);
......@@ -54,7 +54,7 @@ mu_global_debug_level (const char *object_name)
}
int
mu_global_debug_set_level (const char *object_name, unsigned level)
mu_global_debug_set_level (const char *object_name, mu_log_level_t level)
{
int rc;
struct debug_level *dbg;
......@@ -99,7 +99,8 @@ decode_debug_level (const char *p, int *lev)
}
int
mu_debug_level_from_string (const char *string, size_t *plev, mu_debug_t debug)
mu_debug_level_from_string (const char *string, mu_log_level_t *plev,
mu_debug_t debug)
{
char *p, *q;
unsigned level = MU_DEBUG_INHERIT;
......@@ -175,7 +176,7 @@ mu_global_debug_from_string (const char *string, const char *errpfx)
for (i = 0; i < argc; i++)
{
char *p;
unsigned level = MU_DEBUG_INHERIT;
mu_log_level_t level = MU_DEBUG_INHERIT;
char *object_name = argv[i];
for (p = object_name; *p && *p != '='; p++)
......
......@@ -81,7 +81,7 @@ compat_error_printer0 (mu_error_pfn_t pfn, const char *fmt, ...)
}
static int
compat_error_printer (void *data, size_t level, const char *buf)
compat_error_printer (void *data, mu_log_level_t level, const char *buf)
{
if (!data)
mu_diag_stderr_printer (NULL, level, buf);
......
......@@ -106,7 +106,7 @@ mu_syslog_priority_to_string (int n)
}
int
mu_diag_level_to_syslog (int level)
mu_diag_level_to_syslog (mu_log_level_t level)
{
switch (level)
{
......@@ -138,7 +138,7 @@ mu_diag_level_to_syslog (int level)
}
int
mu_diag_syslog_printer (void *data, size_t level, const char *buf)
mu_diag_syslog_printer (void *data, mu_log_level_t level, const char *buf)
{
int len = strlen (buf);
if (len > 0 && buf[len-1] == '\n')
......
......@@ -164,7 +164,7 @@ set_debug_level (mu_debug_t debug, const char *arg)
}
int
mu_compat_printer (void *data, size_t level, const char *buf)
mu_compat_printer (void *data, mu_log_level_t level, const char *buf)
{
fputs (buf, stderr);
return 0;
......