Commit 9b0dee5f 9b0dee5fa917d5804aa2ca89a186ea8da64578ca by Sergey Poznyakoff

Mail: configurable `headers' output format.

* mail/from.c: Rewrite using format string.
* mail/mail.c (default_setup): Set default value for `headline'.
(main): Fix call to util_do_command.
* mail/mail.h [HAVE_STDARG_H]: Remove conditions.
(mail_compile_headline): New proto.
* mail/mailvar.c (mailvar_tab): New variable "headline".
* mail/util.c: Minor fixes.
* NEWS, doc/programs.texi: Update.
1 parent f2eb56bb
GNU mailutils NEWS -- history of user-visible changes. 2009-08-03
GNU mailutils NEWS -- history of user-visible changes. 2009-08-14
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007,
2008, 2009 Free Software Foundation, Inc.
See the end of file for copying conditions.
......@@ -83,6 +83,12 @@ described.
For each variable, this command prints its name, data type, current
value and a short description.
** headline variable
The headline variable holds a format string to use for the header
summary. Its format is mostly compatible with that of the `nail'
mail reader.
** showenvelope variable
If the `showenvelope' variable is set, print command will include the
......@@ -90,7 +96,7 @@ SMTP envelope in its output.
** fromfield variable
The `fromenvelope' boolean variable, if set, instructs mail to obtain
The `fromfield' boolean variable, if set, instructs mail to obtain
the sender address from the `From:' header. This is the default.
If unset, the sender address is obtained from the SMTP envelope.
......
......@@ -287,6 +287,7 @@ static char *default_setup[] = {
"set recursivealiases",
"set noinplacealiases",
"set fromfield",
"set headline=\"%>%a%4m %18f %16d %3l/%-5o %s\"",
/* Start in mail reading mode */
"setq mode=read",
......@@ -364,7 +365,7 @@ main (int argc, char **argv)
/* set defaults for execution */
for (i = 0; i < sizeof (default_setup)/sizeof (default_setup[0]); i++)
util_do_command (default_setup[i]);
util_do_command ("%s", default_setup[i]);
util_do_command ("set screen=%d", util_getlines ());
util_do_command ("set columns=%d", util_getcols ());
......
......@@ -45,11 +45,7 @@
#endif
#include <sys/wait.h>
#include <sys/types.h>
#ifdef HAVE_STDARG_H
# include <stdarg.h>
#else
# include <varargs.h>
#endif
#include <stdarg.h>
#include <signal.h>
#include <confpaths.h>
......@@ -200,6 +196,8 @@ extern int mail_folders (int argc, char **argv);
extern int mail_followup (int argc, char **argv);
extern int mail_from (int argc, char **argv);
extern int mail_from0 (msgset_t *mspec, mu_message_t msg, void *data);
extern void mail_compile_headline (struct mailvar_variable *var);
extern int mail_headers (int argc, char **argv);
extern int mail_hold (int argc, char **argv);
extern int mail_help (int argc, char **argv);
......
......@@ -130,6 +130,10 @@ struct mailvar_symbol mailvar_tab[] =
{ { "header", },
MAILVAR_TYPEMASK (mailvar_type_boolean),
N_("run the `headers' command after entering interactive mode") },
{ { "headline", },
MAILVAR_TYPEMASK (mailvar_type_string),
N_("format string to use for the header summary"),
mail_compile_headline },
{ { "hold", },
MAILVAR_TYPEMASK (mailvar_type_boolean),
N_("hold the read or saved messages in the system mailbox") },
......
......@@ -468,7 +468,7 @@ util_get_homedir ()
char *
util_fullpath (const char *inpath)
{
return mu_tilde_expansion(inpath, "/", NULL);
return mu_tilde_expansion (inpath, "/", NULL);
}
char *
......@@ -661,7 +661,7 @@ util_slist_to_string (mu_list_t list, const char *delim)
}
void
util_strcat(char **dest, const char *str)
util_strcat (char **dest, const char *str)
{
if (!*dest)
*dest = strdup (str);
......@@ -754,26 +754,13 @@ util_save_outgoing (mu_message_t msg, char *savefile)
}
}
#ifdef HAVE_STDARG_H
void
util_error (const char *format, ...)
#else
void
util_error (va_alist)
va_dcl
#endif
{
va_list ap;
#ifdef HAVE_STDARG_H
va_start(ap, format);
#else
char *format;
va_start (ap);
format = va_arg (ap, char *);
#endif
va_start (ap, format);
vfprintf (stderr, format, ap);
fprintf (stderr, "\n");
......