Commit 587fbc3a 587fbc3aa0015132504f5604fdbe798895d2afcf by Sergey Poznyakoff

(main): Use mu_argp_init.

1 parent b49ffcc4
......@@ -50,7 +50,7 @@ typedef struct utmp UTMP;
#define MAX_TTY_SIZE (sizeof (PATH_TTY_PFX) + sizeof (((UTMP*)0)->ut_line))
const char *argp_program_version = "comsatd (" PACKAGE_STRING ")";
const char *program_version = "comsatd (" PACKAGE_STRING ")";
static char doc[] = "GNU comsatd";
static struct argp_option options[] =
......@@ -139,6 +139,7 @@ main(int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mu_argp_parse (&argp, &argc, &argv, 0, comsat_argp_capa,
NULL, &daemon_param);
......
......@@ -30,7 +30,7 @@
#include <mailutils/locker.h>
#include <mailutils/nls.h>
const char *argp_program_version = "GNU dotlock (" PACKAGE_STRING ")";
const char *program_version = "GNU dotlock (" PACKAGE_STRING ")";
static char doc[] =
N_("GNU dotlock -- lock mail spool files"
"\v"
......@@ -38,7 +38,6 @@ N_("GNU dotlock -- lock mail spool files"
" it's already locked, and 1 if some other kind of error occurred.");
static char args_doc[] = N_("FILE");
error_t argp_err_exit_status = MU_DL_EX_ERROR;
static struct argp_option options[] = {
{"unlock", 'u', NULL, 0,
......@@ -148,6 +147,8 @@ main (int argc, char *argv[])
if(setegid(usergid) < 0)
return MU_DL_EX_ERROR;
mu_argp_init (program_version, NULL);
argp_err_exit_status = MU_DL_EX_ERROR;
argp_parse (&argp, argc, argv, 0, NULL, NULL);
if ((err = locker_create (&locker, file, flags)))
......
......@@ -60,7 +60,7 @@ static int selected;
static int action (observer_t, size_t);
const char *argp_program_version = "frm (" PACKAGE_STRING ")";
const char *program_version = "frm (" PACKAGE_STRING ")";
static char doc[] = N_("GNU frm -- display From: lines");
static struct argp_option options[] = {
......@@ -306,6 +306,7 @@ main(int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mu_argp_parse (&argp, &argc, &argv, 0, frm_argp_capa, &c, NULL);
/* have an argument */
......
......@@ -46,7 +46,7 @@
#include <mailutils/stream.h>
#include <mailutils/nls.h>
const char *argp_program_version = "from (" PACKAGE_STRING ")";
const char *program_version = "from (" PACKAGE_STRING ")";
static char doc[] = N_("GNU from -- display from and subject");
static struct argp_option options[] = {
......@@ -103,6 +103,7 @@ main(int argc, char **argv)
{
int opt;
mu_argp_init (program_version, NULL);
mu_argp_parse (&argp, &argc, &argv, 0, capa, &opt, NULL);
mailbox_name = argv[opt];
}
......
......@@ -116,7 +116,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
return 0;
}
const char *argp_program_version = "guimb (" PACKAGE_STRING ")";
const char *program_version = "guimb (" PACKAGE_STRING ")";
static char doc[] =
N_("GNU guimb -- Process the contents of the specified mailboxes "
"using a Scheme program or expression.");
......@@ -149,6 +149,7 @@ main (int argc, char *argv[])
mu_init_nls ();
append_arg ("");
mu_argp_init (program_version, NULL);
mu_argp_parse (&argp, &argc, &argv, 0, guimb_argp_capa, NULL, &c);
for (; c < argc; c++)
......
......@@ -36,7 +36,7 @@ int login_disabled;
/* Number of child processes. */
volatile size_t children;
const char *argp_program_version = "imap4d (" PACKAGE_STRING ")";
const char *program_version = "imap4d (" PACKAGE_STRING ")";
static char doc[] = N_("GNU imap4d -- the IMAP4D daemon");
#define ARG_LOGIN_DISABLED 1
......@@ -124,6 +124,7 @@ main (int argc, char **argv)
MU_AUTH_REGISTER_ALL_MODULES ();
imap4d_capability_init ();
mu_argp_init (program_version, NULL);
#ifdef WITH_TLS
mu_tls_init_argp ();
#endif /* WITH_TLS */
......
......@@ -41,7 +41,7 @@ void guess_retval __P((int ec));
void mailer_err __P((char *fmt, ...));
void notify_biff __P((mailbox_t mbox, char *name, size_t size));
const char *argp_program_version = "mail.local (" PACKAGE_STRING ")";
const char *program_version = "mail.local (" PACKAGE_STRING ")";
static char doc[] =
N_("GNU mail.local -- the local MDA"
"\v"
......@@ -278,6 +278,7 @@ main (int argc, char *argv[])
mu_argp_error_code = EX_CONFIG;
MU_AUTH_REGISTER_ALL_MODULES();
mu_argp_init (program_version, NULL);
sieve_argp_init ();
mu_argp_parse (&argp, &argc, &argv, 0, argp_capa, &arg_index, NULL);
......
......@@ -41,7 +41,7 @@
#include <mailutils/error.h>
#include <mailutils/nls.h>
const char *argp_program_version = "mail.remote (" PACKAGE_STRING ")";
const char *program_version = "mail.remote (" PACKAGE_STRING ")";
static char doc[] =
N_("GNU mail.remote -- pseudo-sendmail interface for mail delivery\n"
"\v"
......@@ -143,6 +143,7 @@ main (int argc, char **argv)
list_append (bookie, smtp_record);
}
mu_argp_init (program_version, NULL);
mu_argp_parse (&argp, &argc, &argv, 0, capa, &optind, NULL);
if (optfrom)
......
......@@ -24,7 +24,7 @@ size_t total;
FILE *ofile;
int interactive;
const char *argp_program_version = "mail (" PACKAGE_STRING ")";
const char *program_version = "mail (" PACKAGE_STRING ")";
static char doc[] = N_("GNU mail -- the standard /bin/mail interface");
static char args_doc[] = N_("[address...]");
......@@ -324,6 +324,7 @@ main (int argc, char **argv)
/* argument parsing */
mu_argp_init (program_version, NULL);
mu_argp_parse (&argp, &argc, &argv, 0, mail_capa, NULL, &args);
/* read system-wide mail.rc and user's .mailrc */
......
......@@ -22,7 +22,7 @@
#include <mailutils/argp.h>
#include <mu_asprintf.h>
const char *argp_program_version = "mailutils-config (" PACKAGE_STRING ")";
const char *program_version = "mailutils-config (" PACKAGE_STRING ")";
static char doc[] = N_("GNU mailutils-config -- Display compiler and loader options needed for building a program with mailutils");
static char args_doc[] = N_("[arg...]");
......@@ -94,6 +94,7 @@ main (int argc, char **argv)
{
int index;
mu_argp_init (program_version, NULL);
if (mu_argp_parse (&argp, &argc, &argv, 0, argp_capa, &index, NULL))
{
argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
......
......@@ -30,7 +30,7 @@
static int messages_count (const char *);
const char *argp_program_version = "messages (" PACKAGE_STRING ")";
const char *program_version = "messages (" PACKAGE_STRING ")";
static char doc[] = N_("GNU messages -- count the number of messages in a mailbox");
static char args_doc[] = N_("[mailbox...]");
......@@ -100,6 +100,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mu_argp_parse (&argp, &argc, &argv, 0, argp_capa, NULL, &args);
registrar_get_list (&bookie);
......
......@@ -19,7 +19,7 @@
#include <mh.h>
const char *argp_program_version = "anno (" PACKAGE_STRING ")";
const char *program_version = "anno (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH anno\v"
"Options marked with `*' are not yet implemented.\n"
"Use -help to obtain the list of traditional MH options.");
......@@ -116,6 +116,7 @@ main (int argc, char **argv)
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -21,7 +21,7 @@
#include <sys/types.h>
#include <sys/stat.h>
const char *argp_program_version = "comp (" PACKAGE_STRING ")";
const char *program_version = "comp (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH comp\v"
"Options marked with `*' are not yet implemented.\n"
"Use -help to obtain the list of traditional MH options.");
......@@ -205,6 +205,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -19,7 +19,7 @@
#include <mh.h>
const char *argp_program_version = "fmtcheck (" PACKAGE_STRING ")";
const char *program_version = "fmtcheck (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH fmtcheck\v"
"Use -help to obtain the list of traditional MH options.");
static char args_doc[] = "";
......@@ -103,6 +103,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, NULL);
......
......@@ -32,7 +32,7 @@
#define obstack_chunk_free free
#include <obstack.h>
const char *argp_program_version = "folder (" PACKAGE_STRING ")";
const char *program_version = "folder (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH folder\v"
"Use -help to obtain the list of traditional MH options.");
static char args_doc[] = N_("[action] [msg]");
......@@ -527,6 +527,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -19,7 +19,7 @@
#include <mh.h>
const char *argp_program_version = "forw (" PACKAGE_STRING ")";
const char *program_version = "forw (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH forw\v"
"Options marked with `*' are not yet implemented.\n"
"Use -help to obtain the list of traditional MH options.");
......@@ -357,6 +357,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -19,7 +19,7 @@
#include <mh.h>
const char *argp_program_version = "inc (" PACKAGE_STRING ")";
const char *program_version = "inc (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH inc\v"
"Use -help to obtain the list of traditional MH options.");
static char args_doc[] = N_("[+folder]");
......@@ -175,6 +175,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, NULL);
......
......@@ -17,7 +17,7 @@
#include <mh.h>
const char *argp_program_version = "install-mh (" PACKAGE_STRING ")";
const char *program_version = "install-mh (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH install-mh\v"
"Use -help to obtain the list of traditional MH options.");
static char args_doc[] = "";
......@@ -66,9 +66,11 @@ main (int argc, char **argv)
{
char *home, *name;
extern int mh_auto_install;
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_auto_install = 0;
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, NULL);
......
......@@ -17,7 +17,7 @@
#include <mh.h>
const char *argp_program_version = "mark (" PACKAGE_STRING ")";
const char *program_version = "mark (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH mark\v"
"Use -help to obtain the list of traditional MH options.");
static char args_doc[] = "[msgs...]";
......@@ -193,6 +193,7 @@ main (int argc, char **argv)
url_t url;
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -21,7 +21,7 @@
#include <sys/stat.h>
#include <unistd.h>
const char *argp_program_version = "mhl (" PACKAGE_STRING ")";
const char *program_version = "mhl (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH mhl\v"
"Use -help to obtain the list of traditional MH options.");
static char args_doc[] = N_("[files]");
......@@ -219,6 +219,7 @@ main (int argc, char **argv)
interactive = isatty (1) && isatty (0);
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -24,7 +24,7 @@
#define obstack_chunk_free free
#include <obstack.h>
const char *argp_program_version = "mhn (" PACKAGE_STRING ")";
const char *program_version = "mhn (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH mhn\v"
"Options marked with `*' are not yet implemented.\n"
"Use -help to obtain the list of traditional MH options.");
......@@ -2507,6 +2507,7 @@ main (int argc, char **argv)
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -19,7 +19,7 @@
#include <mh.h>
const char *argp_program_version = "mhpath (" PACKAGE_STRING ")";
const char *program_version = "mhpath (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH mhpath\v"
"Use -help to obtain the list of traditional MH options.");
static char args_doc[] = N_("[+folder] [msgs]");
......@@ -80,6 +80,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -25,7 +25,7 @@
#define obstack_chunk_free free
#include <obstack.h>
const char *argp_program_version = "pick (" PACKAGE_STRING ")";
const char *program_version = "pick (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH pick\v"
"Options marked with `*' are not yet implemented.\n"
"Use -help to obtain the list of traditional MH options.");
......@@ -347,6 +347,7 @@ main (int argc, char **argv)
flags = isatty (0) ? 0 : ARGP_NO_ERRS;
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, flags, options, mh_option,
args_doc, doc, opt_handler, NULL, &index);
if (pick_parse (lexlist))
......
......@@ -24,7 +24,7 @@
#include <errno.h>
#include <fcntl.h>
const char *argp_program_version = "refile (" PACKAGE_STRING ")";
const char *program_version = "refile (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH refile\v"
"Options marked with `*' are not yet implemented.\n"
"Use -help to obtain the list of traditional MH options.");
......@@ -229,6 +229,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -21,7 +21,7 @@
#include <sys/stat.h>
#include <unistd.h>
const char *argp_program_version = "reply (" PACKAGE_STRING ")";
const char *program_version = "reply (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH repl\v"
"Options marked with `*' are not yet implemented.\n"
"Use -help to obtain the list of traditional MH options.");
......@@ -323,6 +323,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
if (mh_format_parse (format_str, &format))
......
......@@ -28,7 +28,7 @@
#include <dirent.h>
const char *argp_program_version = "rmf (" PACKAGE_STRING ")";
const char *program_version = "rmf (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH rmf\v"
"Use -help to obtain the list of traditional MH options.");
static char args_doc[] = N_("[+folder]");
......@@ -149,6 +149,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, NULL);
if (!explicit_folder)
......
......@@ -19,7 +19,7 @@
#include <mh.h>
const char *argp_program_version = "rmm (" PACKAGE_STRING ")";
const char *program_version = "rmm (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH rmm\v"
"Use -help to obtain the list of traditional MH options.");
static char args_doc[] = N_("[+folder] [msgs]");
......@@ -76,6 +76,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -26,7 +26,7 @@
#include <time.h>
#include <mailutils/observer.h>
const char *argp_program_version = "scan (" PACKAGE_STRING ")";
const char *program_version = "scan (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH scan\v"
"Use -help to obtain the list of traditional MH options.");
static char args_doc[] = N_("[+folder] [msgs]");
......@@ -175,6 +175,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -23,7 +23,7 @@
#include <stdarg.h>
#include <pwd.h>
const char *argp_program_version = "send (" PACKAGE_STRING ")";
const char *program_version = "send (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH send\v"
"Options marked with `*' are not yet implemented.\n"
"Use -help to obtain the list of traditional MH options.");
......@@ -443,6 +443,7 @@ main (int argc, char **argv)
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -22,7 +22,7 @@
#include <unistd.h>
#include <signal.h>
const char *argp_program_version = "sortm (" PACKAGE_STRING ")";
const char *program_version = "sortm (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH sortm\v"
"Use -help to obtain the list of traditional MH options.");
static char args_doc[] = N_("[msgs]");
......@@ -545,6 +545,7 @@ main (int argc, char **argv)
url_t url;
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option,
args_doc, doc, opt_handler, NULL, &index);
if (!oplist)
......
......@@ -19,7 +19,7 @@
#include <mh.h>
const char *argp_program_version = "whatnow (" PACKAGE_STRING ")";
const char *program_version = "whatnow (" PACKAGE_STRING ")";
static char doc[] = "GNU MH whatnow";
static char args_doc[] = N_("[FILE]");
......@@ -101,6 +101,7 @@ main (int argc, char **argv)
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
argc -= index;
......
......@@ -17,7 +17,7 @@
#include <mh.h>
const char *argp_program_version = "whom (" PACKAGE_STRING ")";
const char *program_version = "whom (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH whom\v"
"Use -help to obtain the list of traditional MH options.");
static char args_doc[] = "[file]";
......@@ -111,6 +111,7 @@ main (int argc, char **argv)
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_parse (argc, argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -47,7 +47,7 @@ static error_t pop3d_parse_opt __P((int key, char *arg,
struct argp_state *astate));
static void pop3d_log_connection __P((int fd));
const char *argp_program_version = "pop3d (" PACKAGE_STRING ")";
const char *program_version = "pop3d (" PACKAGE_STRING ")";
static char doc[] = N_("GNU pop3d -- the POP3 daemon");
static struct argp argp = {
......@@ -97,6 +97,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
MU_AUTH_REGISTER_ALL_MODULES();
#ifdef WITH_TLS
mu_tls_init_argp ();
......
......@@ -51,7 +51,7 @@ int (*ftab[]) __P((struct action_data *)) = {
action_chpass
};
const char *argp_program_version = "popauth (" PACKAGE_STRING ")";
const char *program_version = "popauth (" PACKAGE_STRING ")";
static char doc[] = N_("GNU popauth -- manage pop3 authentication database");
static error_t popauth_parse_opt __P((int key, char *arg,
struct argp_state *astate));
......@@ -168,6 +168,7 @@ main(int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mu_argp_parse (&argp, &argc, &argv, 0,
popauth_argp_capa, NULL, &adata);
......
......@@ -28,7 +28,7 @@ static void print_header __P ((message_t, int no_header, int all_header, const c
static void print_body __P ((message_t));
static int string_starts_with __P ((const char * s1, const char *s2));
const char *argp_program_version = "readmsg (" PACKAGE_STRING ")";
const char *program_version = "readmsg (" PACKAGE_STRING ")";
static char doc[] = N_("GNU readmsg -- print messages");
static error_t readmsg_parse_opt __P((int key, char *arg,
struct argp_state *astate));
......@@ -228,6 +228,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mu_argp_parse (&argp, &argc, &argv, 0, readmsg_argp_capa, &index, NULL);
/* Registration. */
......
......@@ -45,7 +45,7 @@
void mutil_register_all_mbox_formats (void);
const char *argp_program_version = "sieve (" PACKAGE_STRING ")";
const char *program_version = "sieve (" PACKAGE_STRING ")";
static char doc[] =
N_("GNU sieve -- a mail filtering tool\n"
......@@ -310,6 +310,7 @@ main (int argc, char *argv[])
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
sieve_argp_init ();
rc = mu_argp_parse (&argp, &argc, &argv, ARGP_IN_ORDER, sieve_argp_capa,
0, &opts);
......