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, ...@@ -375,6 +375,8 @@ mu_cli_ext (int argc, char **argv,
375 setup->ex_config = EX_CONFIG; 375 setup->ex_config = EX_CONFIG;
376 376
377 hints = *cfhint; 377 hints = *cfhint;
378 hints.data = setup;
379
378 /* Set program name */ 380 /* Set program name */
379 if (hints.flags & MU_CFG_PARSE_PROGRAM) 381 if (hints.flags & MU_CFG_PARSE_PROGRAM)
380 { 382 {
......
...@@ -334,7 +334,7 @@ mu_option_describe_options (mu_stream_t str, struct mu_parseopt *po) ...@@ -334,7 +334,7 @@ mu_option_describe_options (mu_stream_t str, struct mu_parseopt *po)
334 i = print_option (str, po, i, &argsused); 334 i = print_option (str, po, i, &argsused);
335 mu_stream_printf (str, "\n"); 335 mu_stream_printf (str, "\n");
336 336
337 if (argsused && dup_args_note) 337 if (argsused && !(po->po_flags & MU_PARSEOPT_SINGLE_DASH) && dup_args_note)
338 { 338 {
339 set_margin (str, 0); 339 set_margin (str, 0);
340 mu_stream_printf (str, "%s\n\n", 340 mu_stream_printf (str, "%s\n\n",
......
...@@ -30,10 +30,11 @@ mu_set_program_name (const char *arg) ...@@ -30,10 +30,11 @@ mu_set_program_name (const char *arg)
30 { 30 {
31 char *p; 31 char *p;
32 32
33 p = mu_strdup (arg);
33 free (mu_full_program_name); 34 free (mu_full_program_name);
34 mu_full_program_name = mu_strdup (arg); 35 mu_full_program_name = p;
35 36
36 p = strrchr (arg, '/'); 37 p = strrchr (mu_full_program_name, '/');
37 if (p) 38 if (p)
38 ++p; 39 ++p;
39 else 40 else
......
...@@ -164,20 +164,6 @@ There is NO WARRANTY, to the extent permitted by law.\n\ ...@@ -164,20 +164,6 @@ There is NO WARRANTY, to the extent permitted by law.\n\
164 ")); 164 "));
165 } 165 }
166 166
167 static void
168 fn_version (struct mu_parseopt *po, struct mu_option *opt, char const *unused)
169 {
170 mu_program_version (po, mu_strout);
171 exit (0);
172 }
173
174 static struct mu_option version_option[] = {
175 { "version", 0, NULL, MU_OPTION_DEFAULT,
176 N_("print program version"),
177 mu_c_string, NULL, fn_version },
178 MU_OPTION_END
179 };
180
181 void 167 void
182 mh_getopt (int *pargc, char ***pargv, struct mu_option *options, 168 mh_getopt (int *pargc, char ***pargv, struct mu_option *options,
183 int mhflags, 169 int mhflags,
...@@ -248,7 +234,6 @@ mh_getopt (int *pargc, char ***pargv, struct mu_option *options, ...@@ -248,7 +234,6 @@ mh_getopt (int *pargc, char ***pargv, struct mu_option *options,
248 optv[i++] = folder_option; 234 optv[i++] = folder_option;
249 if (options) 235 if (options)
250 optv[i++] = options; 236 optv[i++] = options;
251 optv[i++] = version_option;
252 optv[i] = NULL; 237 optv[i] = NULL;
253 238
254 if (mu_parseopt (&po, argc, argv, optv, flags)) 239 if (mu_parseopt (&po, argc, argv, optv, flags))
......
...@@ -54,7 +54,7 @@ subcommand_help (mu_stream_t str) ...@@ -54,7 +54,7 @@ subcommand_help (mu_stream_t str)
54 { 54 {
55 struct mutool_action_tab *p; 55 struct mutool_action_tab *p;
56 unsigned margin; 56 unsigned margin;
57 57
58 mu_stream_printf (str, "%s\n\n", _("Commands are:")); 58 mu_stream_printf (str, "%s\n\n", _("Commands are:"));
59 for (p = mutool_action_tab; p->name; p++) 59 for (p = mutool_action_tab; p->name; p++)
60 { 60 {
......
...@@ -104,6 +104,11 @@ libmailutils/diag/errors ...@@ -104,6 +104,11 @@ libmailutils/diag/errors
104 libmailutils/opt/opt.c 104 libmailutils/opt/opt.c
105 libmailutils/opt/help.c 105 libmailutils/opt/help.c
106 106
107 libmailutils/cli/acl.c
108 libmailutils/cli/capa.c
109 libmailutils/cli/cli.c
110 libmailutils/cli/stdcapa.c
111
107 libmailutils/server/acl.c 112 libmailutils/server/acl.c
108 113
109 libmailutils/stream/file_stream.c 114 libmailutils/stream/file_stream.c
......