diff options
Diffstat (limited to 'mail/mail.c')
-rw-r--r-- | mail/mail.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/mail/mail.c b/mail/mail.c index 723fdc88a..5cfcd70bd 100644 --- a/mail/mail.c +++ b/mail/mail.c @@ -1,5 +1,5 @@ /* GNU Mailutils -- a suite of utilities for electronic mail - Copyright (C) 1999-2021 Free Software Foundation, Inc. + Copyright (C) 1999-2024 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 @@ -31,6 +31,8 @@ const char *program_version = "mail (" PACKAGE_STRING ")"; #define HINT_SEND_MODE 0x1 #define HINT_FILE_OPTION 0x2 +#define HINT_BYNAME 0x4 + int hint; char *file; char *user; @@ -72,6 +74,7 @@ cli_command_option (struct mu_parseopt *po, struct mu_option *opt, case 'r': util_cache_command (&command_list, "set return-address=%s", arg); + hint |= HINT_SEND_MODE; break; case 'q': @@ -81,7 +84,7 @@ cli_command_option (struct mu_parseopt *po, struct mu_option *opt, case 't': read_recipients = 1; util_cache_command (&command_list, "set editheaders"); - util_cache_command (&command_list, "setq mode=send"); + hint |= HINT_SEND_MODE; break; case 'H': @@ -105,7 +108,8 @@ cli_command_option (struct mu_parseopt *po, struct mu_option *opt, break; case 'F': - util_cache_command (&command_list, "set byname"); + hint |= HINT_SEND_MODE; + hint |= HINT_BYNAME; break; case 0: @@ -388,7 +392,7 @@ static char *default_setup[] = { "set regex", "set replyprefix=\"Re: \"", "set charset=auto", - "set xmailer", + "set useragent", "unfold subject", "sender mail-followup-to reply-to from", "set nocmd", @@ -398,6 +402,8 @@ static char *default_setup[] = { "set fromfield", "set headline=\"%>%a%4m %18f %16d %3L/%-5o %s\"", "unset folder", + "set fullnames", + "set outfilename=local", /* Start in mail reading mode */ "setq mode=read", @@ -485,7 +491,7 @@ main (int argc, char **argv) else util_do_command ("set columns=%d", util_getcols ()); - /* Set the default mailer to sendmail. */ + /* Set the default mailer to sendmail. FIXME: Minor memory leak. */ mailvar_set (mailvar_name_sendmail, mu_strdup ("sendmail:" PATH_SENDMAIL), mailvar_type_string, MOPTF_OVERWRITE); @@ -581,13 +587,15 @@ main (int argc, char **argv) /* Mode is just sending */ if (strcmp (mode, "send") == 0) { - char *buf = NULL; - int rc; - - mu_argcv_string (argc, argv, &buf); - rc = util_do_command ("mail %s", buf); - free (buf); - return mailvar_is_true (mailvar_name_mailx) ? 0 : rc; + --argv; + ++argc; + if (hint & HINT_BYNAME) + argv[0] = "Mail"; + else + argv[0] = "mail"; + return mail_send (argc, argv) + ? (mailvar_is_true (mailvar_name_mailx) ? 0 : EXIT_FAILURE) + : 0; } /* Or acting as a normal reader */ else |