Commit d153077c d153077cd608fc034e61e046c59ff46159223b31 by Sergey Poznyakoff

MH: Fix MH-E compatibility

* include/mailutils/cli.h (mu_version_func): Rename to mu_version_hook.
* libmailutils/cli/cli.c: Likewise.
* pop3d/popauth.c: Likewise.
* mh/mh_getopt.c: (mh_getopt): Initialize NLS support. Install
standard version hook (needed for mh-e autodetect feature).

* mh/ali.c: Update prog_doc. Remove NLS initialization.
* mh/anno.c: Likewise
* mh/burst.c: Likewise
* mh/comp.c: Likewise
* mh/fmtcheck.c: Likewise
* mh/folder.c: Likewise
* mh/forw.c: Likewise
* mh/inc.c: Likewise
* mh/install-mh.c: Likewise
* mh/mark.c: Likewise
* mh/mhl.c: Likewise
* mh/mhn.c: Likewise
* mh/mhparam.c: Likewise
* mh/mhpath.c: Likewise
* mh/mhseq.c: Likewise
* mh/msgchk.c: Likewise
* mh/pick.c: Likewise
* mh/prompter.c: Likewise
* mh/refile.c: Likewise
* mh/repl.c: Likewise
* mh/rmf.c: Likewise
* mh/rmm.c: Likewise
* mh/scan.c: Likewise
* mh/send.c: Likewise
* mh/show.c: Likewise
* mh/sortm.c: Likewise
* mh/whatnow.c: Likewise
* mh/whom.c: Likewise
1 parent e267ac86
......@@ -54,7 +54,7 @@ struct mu_cli_setup
void (*prog_doc_hook) (mu_stream_t);
};
void mu_version_func (struct mu_parseopt *po, mu_stream_t stream);
void mu_version_hook (struct mu_parseopt *po, mu_stream_t stream);
void mu_cli (int argc, char **argv, struct mu_cli_setup *setup,
char **capa, void *data,
int *ret_argc, char ***ret_argv);
......
......@@ -54,7 +54,7 @@ const char mu_version_copyright[] =
"Copyright %s 2007-2016 Free Software Foundation, inc.";
void
mu_version_func (struct mu_parseopt *po, mu_stream_t stream)
mu_version_hook (struct mu_parseopt *po, mu_stream_t stream)
{
#ifdef GIT_DESCRIBE
mu_stream_printf (stream, "%s (%s) %s [%s]\n",
......@@ -428,7 +428,7 @@ mu_cli (int argc, char **argv, struct mu_cli_setup *setup, char **capa,
po.po_extra_info = gnu_general_help_url;
flags |= MU_PARSEOPT_EXTRA_INFO;
po.po_version_hook = mu_version_func;
po.po_version_hook = mu_version_hook;
flags |= MU_PARSEOPT_VERSION_HOOK;
if (setup->prog_extra_doc)
......
......@@ -23,7 +23,7 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
static char prog_doc[] = N_("GNU MH ali");
static char prog_doc[] = N_("List mail aliases");
static char args_doc[] = N_("ALIAS [ALIAS...]");
static int list_mode;
......@@ -142,9 +142,6 @@ ali_print_name (char *name)
int
main (int argc, char **argv)
{
/* Native Language Support */
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL);
if (!nolist_mode)
......
......@@ -19,7 +19,7 @@
#include <mh.h>
static char prog_doc[] = N_("GNU MH anno");
static char prog_doc[] = N_("Annotate messages");
static char args_doc[] = N_("[MSGLIST]");
//static int inplace; /* Annotate the message in place */
......@@ -58,8 +58,6 @@ main (int argc, char **argv)
mu_msgset_t msgset;
size_t len;
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, MH_GETOPT_DEFAULT_FOLDER,
args_doc, prog_doc, NULL);
if (anno_text)
......
......@@ -18,7 +18,7 @@
#include <mh.h>
static char prog_doc[] = N_("GNU MH burst");
static char prog_doc[] = N_("Explode digests into messages");
static char args_doc[] = N_("[MSGLIST]");
/* Command line switches */
......@@ -652,9 +652,6 @@ main (int argc, char **argv)
mu_msgset_t msgset;
const char *tempfolder = mh_global_profile_get ("Temp-Folder", ".temp");
/* Native Language Support */
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, MH_GETOPT_DEFAULT_FOLDER,
args_doc, prog_doc, NULL);
if (eb_min_length == 0)
......
......@@ -21,7 +21,7 @@
#include <sys/types.h>
#include <sys/stat.h>
static char prog_doc[] = N_("GNU MH comp");
static char prog_doc[] = N_("Compose a message");
static char args_doc[] = N_("[MSG]");
struct mh_whatnow_env wh_env = { 0 };
......@@ -131,14 +131,10 @@ copy_message (mu_mailbox_t mbox, size_t n, const char *file)
int
main (int argc, char **argv)
{
/* Native Language Support */
MU_APP_INIT_NLS ();
draftfolder = mh_global_profile_get ("Draft-Folder", NULL);
whatnowproc = mh_global_profile_get ("whatnowproc", NULL);
mh_getopt (&argc, &argv, options, 0,
args_doc, prog_doc, NULL);
mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL);
if (use_draft)
draftmessage = "cur";
if (!formfile)
......
......@@ -19,7 +19,7 @@
#include <mh.h>
static char prog_doc[] = N_("GNU MH fmtcheck");
static char prog_doc[] = N_("Check MH format string");
char *format_str;
static mh_format_t format;
......@@ -59,9 +59,6 @@ action_dump (void)
int
main (int argc, char **argv)
{
/* Native Language Support */
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, 0, NULL, prog_doc, NULL);
mh_format_debug (debug_option);
if (format_str && mh_format_parse (format_str, &format))
......
......@@ -28,7 +28,7 @@
#include <dirent.h>
static char prog_doc[] = N_("GNU MH folder");
static char prog_doc[] = N_("set or list current folder or message");
static char args_doc[] = N_("[ACTION] [MSG]");
typedef int (*folder_action) (void);
......@@ -889,9 +889,6 @@ main (int argc, char **argv)
int index = 0;
mu_msgset_t msgset;
/* Native Language Support */
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL);
if (recurse_option)
max_depth = 0;
......
......@@ -19,7 +19,7 @@
#include <mh.h>
static char prog_doc[] = N_("GNU MH forw");
static char prog_doc[] = N_("Forward messages");
static char args_doc[] = N_("[MSGLIST]");
enum encap_type
......@@ -383,9 +383,6 @@ main (int argc, char **argv)
{
int rc;
/* Native Language Support */
MU_APP_INIT_NLS ();
draftfolder = mh_global_profile_get ("Draft-Folder", NULL);
whatnowproc = mh_global_profile_get ("whatnowproc", NULL);
mh_getopt (&argc, &argv, options, MH_GETOPT_DEFAULT_FOLDER,
......
......@@ -20,7 +20,7 @@
#include <mh.h>
#include "muscript.h"
static char prog_doc[] = N_("GNU MH inc");
static char prog_doc[] = N_("Incorporate new mail");
static char extra_doc[] = N_("Debug flags are:\n\
g - guile stack traces\n\
t - sieve trace (MU_SIEVE_DEBUG_TRACE)\n\
......@@ -345,9 +345,6 @@ main (int argc, char **argv)
size_t lastseen;
const char *unseen_seq;
/* Native Language Support */
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, extra_doc);
if (!append_folder)
append_folder = mh_global_profile_get ("Inbox", "inbox");
......
......@@ -35,9 +35,6 @@ main (int argc, char **argv)
char *name;
extern int mh_auto_install;
/* Native Language Support */
MU_APP_INIT_NLS ();
mh_auto_install = 0;
mh_getopt (&argc, &argv, options, 0, NULL, prog_doc, NULL);
......
......@@ -17,7 +17,7 @@
#include <mh.h>
static char prog_doc[] = N_("GNU MH mark");
static char prog_doc[] = N_("Manipulate message sequences");
static char args_doc[] = N_("[MSGLIST]");
enum action_type
......@@ -167,8 +167,6 @@ main (int argc, char **argv)
mu_url_t url;
struct mark_closure clos;
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, MH_GETOPT_DEFAULT_FOLDER,
args_doc, prog_doc, NULL);
if (public_option == -1)
......
......@@ -26,6 +26,7 @@
#include <mailutils/stream.h>
#include <mailutils/wordsplit.h>
#include <mailutils/io.h>
#include <mailutils/cli.h>
struct getopt_data
{
......@@ -140,30 +141,6 @@ static struct mu_option folder_option[] = {
MU_OPTION_END
};
void
mh_version_hook (struct mu_parseopt *po, mu_stream_t stream)
{
extern const char mu_version_copyright[];
#ifdef GIT_DESCRIBE
mu_stream_printf (stream, "%s (GNU MH, %s) %s [%s]\n",
mu_program_name, PACKAGE_NAME, PACKAGE_VERSION,
GIT_DESCRIBE);
#else
mu_stream_printf (stream, "%s (GNU MH, %s) %s\n", mu_program_name,
PACKAGE_NAME, PACKAGE_VERSION);
#endif
/* TRANSLATORS: Translate "(C)" to the copyright symbol
(C-in-a-circle), if this symbol is available in the user's
locale. Otherwise, do not translate "(C)"; leave it as-is. */
mu_stream_printf (stream, mu_version_copyright, _("(C)"));
mu_stream_printf (stream, _("\
\n\
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\n\
There is NO WARRANTY, to the extent permitted by law.\n\
\n\
"));
}
static void
fn_version (struct mu_parseopt *po, struct mu_option *opt, char const *unused)
{
......@@ -192,6 +169,9 @@ mh_getopt (int *pargc, char ***pargv, struct mu_option *options,
int flags = MU_PARSEOPT_SINGLE_DASH | MU_PARSEOPT_IMMEDIATE;
int i;
/* Native Language Support */
MU_APP_INIT_NLS ();
po.po_negation = "no";
flags |= MU_PARSEOPT_NEGATION;
......@@ -233,7 +213,7 @@ mh_getopt (int *pargc, char ***pargv, struct mu_option *options,
//po.po_extra_info = gnu_general_help_url;
//flags |= MU_PARSEOPT_EXTRA_INFO;
po.po_version_hook = mh_version_hook;
po.po_version_hook = mu_version_hook;
flags |= MU_PARSEOPT_VERSION_HOOK;
mu_set_program_name (argv[0]);
......
......@@ -21,7 +21,7 @@
#include <sys/stat.h>
#include <unistd.h>
static char prog_doc[] = N_("GNU MH mhl");
static char prog_doc[] = N_("Produce formatted listings of MH messages");
static char args_doc[] = N_("[FILE [FILE...]]");
static int bell_option;
......@@ -138,8 +138,6 @@ main (int argc, char **argv)
interactive = isatty (1) && isatty (0);
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, MH_GETOPT_DEFAULT_FOLDER,
args_doc, prog_doc, NULL);
......
......@@ -22,7 +22,7 @@
#include <mailutils/mime.h>
#include <setjmp.h>
static char prog_doc[] = N_("GNU MH mhn");
static char prog_doc[] = N_("manipulate MIME messages");
static char args_doc[] = N_("[MSGLIST]");
typedef struct _msg_part *msg_part_t;
......@@ -2759,8 +2759,6 @@ main (int argc, char **argv)
{
int rc;
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL);
if (!formfile)
mh_find_file ("mhl.headers", &formfile);
......
......@@ -19,7 +19,7 @@
#include <mh.h>
static char prog_doc[] = N_("GNU MH mhparam");
static char prog_doc[] = N_("Print GNU MH profile and context components");
static char args_doc[] = N_("[COMPONENT [COMPONENT...]]");
static int display_all;
......@@ -87,9 +87,6 @@ mhparam (char *comp)
int
main (int argc, char **argv)
{
/* Native Language Support */
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL);
if (display_all)
......
......@@ -19,7 +19,7 @@
#include <mh.h>
static char prog_doc[] = N_("GNU MH mhpath");
static char prog_doc[] = N_("Print full pathnames of GNU MH messages and folders");
static char args_doc[] = N_("[+FOLDER] [MSGLIST]");
static int
......@@ -43,9 +43,6 @@ main (int argc, char **argv)
int status;
const char *current_folder;
/* Native Language Support */
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, NULL, MH_GETOPT_DEFAULT_FOLDER,
args_doc, prog_doc, NULL);
......
......@@ -14,11 +14,9 @@
You should have received a copy of the GNU General Public License
along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */
/* MH mhparam command */
#include <mh.h>
static char prog_doc[] = N_("GNU MH mhseq");
static char prog_doc[] = N_("Print numbers of messages in GNU MH sequence");
static char args_doc[] = N_("[SEQUENCE]");
static int uid_option = 1;
......@@ -46,9 +44,6 @@ main (int argc, char **argv)
mu_mailbox_t mbox;
mu_msgset_t msgset;
/* Native Language Support */
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, MH_GETOPT_DEFAULT_FOLDER,
args_doc, prog_doc, NULL);
......
......@@ -21,7 +21,7 @@
#include "mailutils/datetime.h"
#include <pwd.h>
static char prog_doc[] = N_("GNU MH msgchk");
static char prog_doc[] = N_("Check for messages");
static char args_doc[] = N_("USER [USER...]");
int date_option = 1;
......@@ -349,8 +349,6 @@ main (int argc, char **argv)
{
int rc = 0;
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL);
if (argc == 0)
......
......@@ -22,7 +22,7 @@
#include <pick.h>
#include <pick-gram.h>
static char prog_doc[] = N_("GNU MH pick");
static char prog_doc[] = N_("Search for messages by content");
static char args_doc[] = N_("[--COMPONENT PATTERN]... [MSGLIST]");
static int public_option = 1;
......@@ -267,8 +267,6 @@ main (int argc, char **argv)
mu_mailbox_t mbox;
mu_msgset_t msgset;
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, MH_GETOPT_DEFAULT_FOLDER,
args_doc, prog_doc, NULL);
......
......@@ -19,7 +19,7 @@
#include <mh.h>
#include "prompter.h"
static char prog_doc[] = N_("GNU MH prompter");
static char prog_doc[] = N_("Prompting editor front-end for GNU MH");
static char args_doc[] = N_("FILE");
char *erase_seq;
......@@ -88,8 +88,6 @@ main (int argc, char **argv)
mu_body_t body;
mu_stream_t bstr;
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL);
if (argc == 0)
......
......@@ -23,7 +23,7 @@
#include <errno.h>
#include <fcntl.h>
static char prog_doc[] = N_("GNU MH refile");
static char prog_doc[] = N_("File messages in other folders");
static char args_doc[] = N_("MSGLIST FOLDER [FOLDER...]");
int link_flag = 0;
......@@ -185,9 +185,6 @@ main (int argc, char **argv)
mu_mailbox_t mbox;
int status, i, j;
/* Native Language Support */
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL);
/* Collect any surplus folders */
for (i = j = 0; i < argc; i++)
......
......@@ -22,7 +22,7 @@
#include <sys/stat.h>
#include <unistd.h>
static char prog_doc[] = N_("GNU MH repl");
static char prog_doc[] = N_("Reply to a message");
static char args_doc[] = N_("[+FOLDER] [MESSAGE]");
static char *format_str = NULL;
......@@ -307,9 +307,6 @@ main (int argc, char **argv)
{
int rc;
/* Native Language Support */
MU_APP_INIT_NLS ();
draftfolder = mh_global_profile_get ("Draft-Folder", NULL);
whatnowproc = mh_global_profile_get ("whatnowproc", NULL);
......
......@@ -28,7 +28,7 @@
#include <dirent.h>
static char prog_doc[] = N_("GNU MH rmf");
static char prog_doc[] = N_("Remove a GNU MH folder");
static char args_doc[] = N_("[+FOLDER]");
int explicit_folder; /* Was the folder explicitly given */
......@@ -150,9 +150,6 @@ main (int argc, char **argv)
int status;
char *name;
/* Native Language Support */
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL);
cur_folder_path = current_folder_path ();
......
......@@ -19,7 +19,7 @@
#include <mh.h>
static char prog_doc[] = N_("GNU MH rmm");
static char prog_doc[] = N_("Remove messages");
static char args_doc[] = N_("[+FOLDER] [MSGLIST]");
static int
......@@ -56,9 +56,6 @@ main (int argc, char **argv)
int status;
struct seq_closure clos;
/* Native Language Support */
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, NULL, MH_GETOPT_DEFAULT_FOLDER,
args_doc, prog_doc, NULL);
......
......@@ -26,7 +26,7 @@
#include <time.h>
#include <mailutils/observer.h>
static char prog_doc[] = N_("GNU MH scan");
static char prog_doc[] = N_("Produce a one line per message scan listing");
static char args_doc[] = N_("[+FOLDER] [MSGLIST]");
static int clear;
......@@ -103,9 +103,6 @@ main (int argc, char **argv)
int status;
size_t total = 0;
/* Native Language Support */
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, MH_GETOPT_DEFAULT_FOLDER,
args_doc, prog_doc, NULL);
......
......@@ -23,7 +23,7 @@
#include <stdarg.h>
#include <pwd.h>
static char prog_doc[] = N_("GNU MH send");
static char prog_doc[] = N_("Send messages");
static char args_doc[] = N_("FILE [FILE...]");
static const char *draftfolder; /* Use this draft folder */
......@@ -752,8 +752,6 @@ main (int argc, char **argv)
char *p;
int rc;
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL);
mh_read_aliases ();
......
......@@ -19,7 +19,7 @@
#include <mh.h>
static char prog_doc[] = N_("GNU MH show");
static char prog_doc[] = N_("Display GNU MH messages");
static char args_doc[] = N_("[+FOLDER] [MSGLIST]");
int use_draft;
......@@ -184,9 +184,6 @@ main (int argc, char **argv)
mu_msgset_t msgset;
const char *p;
/* Native Language Support */
MU_APP_INIT_NLS ();
showargmax = 2;
showargc = 1;
showargv = mu_calloc (showargmax, sizeof showargv[0]);
......
......@@ -22,8 +22,7 @@
#include <unistd.h>
#include <signal.h>
static char prog_doc[] = N_("GNU MH sortm")"\v"
N_("Use -help to obtain the list of traditional MH options.");
static char prog_doc[] = N_("Sort GNU MH messages");
static char args_doc[] = N_("[MSGLIST]");
static int limit;
......@@ -603,8 +602,6 @@ main (int argc, char **argv)
mu_url_t url;
mu_msgset_t msgset;
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, MH_GETOPT_DEFAULT_FOLDER,
args_doc, prog_doc, NULL);
......
......@@ -19,7 +19,7 @@
#include <mh.h>
static char prog_doc[] = "GNU MH whatnow";
static char prog_doc[] = N_("Prompting front-end for sending messages");
static char args_doc[] = N_("[FILE]");
struct mh_whatnow_env wh_env = { 0 };
......@@ -52,8 +52,6 @@ static struct mu_option options[] = {
int
main (int argc, char **argv)
{
MU_APP_INIT_NLS ();
mh_whatnow_env_from_environ (&wh_env);
mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL);
......
......@@ -17,7 +17,7 @@
#include <mh.h>
static char prog_doc[] = N_("GNU MH whom");
static char prog_doc[] = N_("Report to whom a message would go");
static char args_doc[] = "[FILE]";
static int check_recipients;
......@@ -66,8 +66,6 @@ main (int argc, char **argv)
{
char *name = "draft";
MU_APP_INIT_NLS ();
mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL);
if (!use_draft && argc > 0)
......
......@@ -149,7 +149,7 @@ popauth_version (struct mu_parseopt *po, mu_stream_t stream)
mu_iterator_t itr;
int rc;
mu_version_func (po, stream);
mu_version_hook (po, stream);
mu_stream_printf (stream, _("Database formats: "));
rc = mu_dbm_impl_iterator (&itr);
......