summaryrefslogtreecommitdiff
path: root/movemail
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2004-11-18 16:18:03 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2004-11-18 16:18:03 +0000
commita2f3bd9d825be08f1eb922a327e047a154c0677d (patch)
tree7b45d6c2faf1c2d044a6f00f24c5a5579024b0ea /movemail
parentf5e458e1c31b99e83b1bd226e2c2d061f29ee500 (diff)
downloadmailutils-a2f3bd9d825be08f1eb922a327e047a154c0677d.tar.gz
mailutils-a2f3bd9d825be08f1eb922a327e047a154c0677d.tar.bz2
Emacs-iteraction mode (--emacs)
Diffstat (limited to 'movemail')
-rw-r--r--movemail/movemail.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/movemail/movemail.c b/movemail/movemail.c
index 11646d815..f0108c8a4 100644
--- a/movemail/movemail.c
+++ b/movemail/movemail.c
@@ -29,16 +29,19 @@ const char *program_version = "movemail (" PACKAGE_STRING ")";
static char doc[] = N_("GNU movemail");
static char args_doc[] = N_("inbox-url destfile [POP-password]");
+#define OPT_EMACS 256
+
static struct argp_option options[] = {
{ "preserve", 'p', NULL, 0, N_("Preserve the source mailbox"), 0 },
{ "keep-messages", 0, NULL, OPTION_ALIAS, NULL },
{ "reverse", 'r', NULL, 0, N_("Reverse the sorting order"), 0 },
-
+ { "emacs", OPT_EMACS, NULL, 0, N_("Output information used by Emacs rmail interface"), 0 },
{ NULL, 0, NULL, 0, NULL, 0 }
};
static int reverse_order;
static int preserve_mail;
+static int emacs_mode;
static error_t
parse_opt (int key, char *arg, struct argp_state *state)
@@ -53,6 +56,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
preserve_mail++;
break;
+ case OPT_EMACS:
+ emacs_mode++;
+ break;
+
default:
return ARGP_ERR_UNKNOWN;
}
@@ -78,14 +85,32 @@ static const char *mail_capa[] = {
NULL
};
+int
+movemail_error_printer (const char *fmt, va_list ap)
+{
+ int n;
+
+ n = fprintf (stderr, "%s: ", program_invocation_short_name);
+ n += vfprintf (stderr, fmt, ap);
+ fputc ('\n', stderr);
+ return n + 1;
+}
+
void
die (mailbox_t mbox, char *msg, int status)
{
url_t url = NULL;
mailbox_get_url (mbox, &url);
- mu_error (_("mailbox '%s': %s: %s"),
- url_to_string (url), msg, mu_strerror (status));
+ if (emacs_mode)
+ mu_error (_("%s:mailbox '%s': %s: %s"),
+ mu_errname (status),
+ url_to_string (url),
+ msg,
+ mu_strerror (status));
+ else
+ mu_error (_("mailbox '%s': %s: %s"),
+ url_to_string (url), msg, mu_strerror (status));
exit (1);
}
@@ -227,16 +252,6 @@ compatibility_mode (mailbox_t *mbx, char *source_name, char *password,
}
int
-movemail_error_printer (const char *fmt, va_list ap)
-{
- int n;
- n = fprintf (stderr, "%s: ", program_invocation_short_name);
- n += vfprintf (stderr, fmt, ap);
- fputc ('\n', stderr);
- return n + 1;
-}
-
-int
main (int argc, char **argv)
{
int index;

Return to:

Send suggestions and report system problems to the System administrator.