Commit d8194bb3 d8194bb31044d2140a7b3c0e877ae59c20152a35 by Sergey Poznyakoff

Bugfixes

* libmailutils/cli/cli.c (mu_cli_ext): Initialize hints.data
(accidentally deleted).
* libmailutils/opt/help.c (mu_option_describe_options): Don't
display dup_args_note in single-dash mode.
* libmailutils/opt/progname.c (mu_set_program_name): Free the
old value after allocating new copy.  This allows to pass
mu_full_program_name as argument.  Set mu_program_name to point
to a segment of mu_full_program_name, not the original arg.
* mh/mh_getopt.c: Remove duplicate version option.
* po/POTFILES.in: Add missing files.
1 parent 97fb4785
......@@ -375,6 +375,8 @@ mu_cli_ext (int argc, char **argv,
setup->ex_config = EX_CONFIG;
hints = *cfhint;
hints.data = setup;
/* Set program name */
if (hints.flags & MU_CFG_PARSE_PROGRAM)
{
......
......@@ -334,7 +334,7 @@ mu_option_describe_options (mu_stream_t str, struct mu_parseopt *po)
i = print_option (str, po, i, &argsused);
mu_stream_printf (str, "\n");
if (argsused && dup_args_note)
if (argsused && !(po->po_flags & MU_PARSEOPT_SINGLE_DASH) && dup_args_note)
{
set_margin (str, 0);
mu_stream_printf (str, "%s\n\n",
......
......@@ -30,10 +30,11 @@ mu_set_program_name (const char *arg)
{
char *p;
p = mu_strdup (arg);
free (mu_full_program_name);
mu_full_program_name = mu_strdup (arg);
mu_full_program_name = p;
p = strrchr (arg, '/');
p = strrchr (mu_full_program_name, '/');
if (p)
++p;
else
......
......@@ -164,20 +164,6 @@ There is NO WARRANTY, to the extent permitted by law.\n\
"));
}
static void
fn_version (struct mu_parseopt *po, struct mu_option *opt, char const *unused)
{
mu_program_version (po, mu_strout);
exit (0);
}
static struct mu_option version_option[] = {
{ "version", 0, NULL, MU_OPTION_DEFAULT,
N_("print program version"),
mu_c_string, NULL, fn_version },
MU_OPTION_END
};
void
mh_getopt (int *pargc, char ***pargv, struct mu_option *options,
int mhflags,
......@@ -248,7 +234,6 @@ mh_getopt (int *pargc, char ***pargv, struct mu_option *options,
optv[i++] = folder_option;
if (options)
optv[i++] = options;
optv[i++] = version_option;
optv[i] = NULL;
if (mu_parseopt (&po, argc, argv, optv, flags))
......
......@@ -54,7 +54,7 @@ subcommand_help (mu_stream_t str)
{
struct mutool_action_tab *p;
unsigned margin;
mu_stream_printf (str, "%s\n\n", _("Commands are:"));
for (p = mutool_action_tab; p->name; p++)
{
......
......@@ -104,6 +104,11 @@ libmailutils/diag/errors
libmailutils/opt/opt.c
libmailutils/opt/help.c
libmailutils/cli/acl.c
libmailutils/cli/capa.c
libmailutils/cli/cli.c
libmailutils/cli/stdcapa.c
libmailutils/server/acl.c
libmailutils/stream/file_stream.c
......