This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU Mailutils".
http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=e3840467baf287cc14177d224dddc282674f1609 The branch, master has been updated via e3840467baf287cc14177d224dddc282674f1609 (commit) via a76bffd55d3657bfb369656e7225eca21323c454 (commit) from a29af229e7675aaabe28bdabf6cc2bd4b549e2cb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e3840467baf287cc14177d224dddc282674f1609 Author: Sergey Poznyakoff <g...@gnu.org> Date: Sun Oct 16 01:26:03 2016 +0300 Convert examples to mu_cli commit a76bffd55d3657bfb369656e7225eca21323c454 Author: Sergey Poznyakoff <g...@gnu.org> Date: Sun Oct 16 01:10:01 2016 +0300 Minor fix in help output. Print "[OPTION...]", instead of "[OPTION]..." ----------------------------------------------------------------------- Summary of changes: examples/Makefile.am | 4 +- examples/muauth.c | 87 ++++++++++++++------------------- examples/muemail.c | 20 ++++---- libmailutils/opt/help.c | 2 +- libmailutils/tests/parseopt_help00.at | 2 +- libmailutils/tests/parseopt_help02.at | 2 +- libmailutils/tests/parseopt_help03.at | 2 +- libmailutils/tests/parseopt_help04.at | 2 +- libmailutils/tests/parseopt_help05.at | 2 +- libmailutils/tests/parseopt_help06.at | 2 +- libmailutils/tests/parseopt_help07.at | 2 +- libmailutils/tests/parseopt_help08.at | 2 +- libmailutils/tests/parseopt_help11.at | 2 +- libmailutils/tests/parseopt_help12.at | 6 +-- 14 files changed, 61 insertions(+), 76 deletions(-) diff --git a/examples/Makefile.am b/examples/Makefile.am index 55b53df..5ffabeb 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -113,14 +113,14 @@ lsf_LDADD = \ muauth_CPPFLAGS = @MU_APP_COMMON_INCLUDES@ muauth_LDADD = \ - ${MU_APP_LIBRARIES}\ + ${MU_APP_NEW_LIBRARIES}\ ${MU_LIB_AUTH}\ @MU_AUTHLIBS@ \ ${MU_LIB_MAILUTILS} muemail_CPPFLAGS = @MU_APP_COMMON_INCLUDES@ muemail_LDADD = \ - ${MU_APP_LIBRARIES} \ + ${MU_APP_NEW_LIBRARIES} \ ${MU_LIB_MAILUTILS} mboxidx_CPPFLAGS = @MU_APP_COMMON_INCLUDES@ diff --git a/examples/muauth.c b/examples/muauth.c index 24b4143..5c32157 100644 --- a/examples/muauth.c +++ b/examples/muauth.c @@ -24,89 +24,74 @@ #include <ctype.h> #include <string.h> #include <mailutils/mailutils.h> -#include "mailutils/libargp.h" - -static char doc[] = -"muauth -- test mailutils authentication and authorization schemes"; -static char args_doc[] = "key"; - -static const char *capa[] = { - "mailutils", - "auth", - "common", - "debug", - NULL -}; - -static struct argp_option options[] = { - { "password", 'p', "STRING", 0, "user password", 0 }, - { "uid", 'u', NULL, 0, "test getpwuid functions", 0 }, - { "name", 'n', NULL, 0, "test getpwnam functions", 0 }, - { NULL }, -}; enum mu_auth_key_type key_type = mu_auth_key_name; char *password; -static error_t -parse_opt (int key, char *arg, struct argp_state *state) +static void +use_uid (struct mu_parseopt *po, struct mu_option *opt, char const *arg) { - switch (key) - { - case 'p': - password = arg; - break; + key_type = mu_auth_key_uid; +} - case 'u': - key_type = mu_auth_key_uid; - break; +static void +use_name (struct mu_parseopt *po, struct mu_option *opt, char const *arg) +{ + key_type = mu_auth_key_name; +} - case 'n': - key_type = mu_auth_key_name; - break; +static struct mu_option muauth_options[] = { + { "password", 'p', "STRING", MU_OPTION_DEFAULT, + "user password", + mu_c_string, &password }, + { "uid", 'u', NULL, MU_OPTION_DEFAULT, + "test getpwuid functions", + mu_c_string, NULL, use_uid }, + { "name", 'n', NULL, MU_OPTION_DEFAULT, + "test getpwnam functions", + mu_c_string, NULL, use_name }, + MU_OPTION_END +}, *options[] = { muauth_options, NULL }; - default: - return ARGP_ERR_UNKNOWN; - } - return 0; -} +static char *capa[] = { + "auth", + "debug", + NULL +}; -static struct argp argp = { +static struct mu_cli_setup cli = { options, - parse_opt, - args_doc, - doc, NULL, - NULL, NULL + "muauth -- test mailutils authentication and authorization schemes", + "key" }; int main (int argc, char * argv []) { - int rc, index; + int rc; struct mu_auth_data *auth; void *key; uid_t uid; MU_AUTH_REGISTER_ALL_MODULES (); - mu_argp_init (NULL, NULL); - if (mu_app_init (&argp, capa, NULL, argc, argv, 0, &index, NULL)) - exit (1); - if (index == argc) + mu_cli (argc, argv, &cli, capa, NULL, &argc, &argv); + + if (argc == 0) { mu_error ("not enough arguments, try `%s --help' for more info", - argv[0]); + mu_program_name); return 1; } if (key_type == mu_auth_key_uid) { - uid = strtoul (argv[index], NULL, 0); + uid = strtoul (argv[0], NULL, 0); key = &uid; } else - key = argv[index]; + key = argv[0]; rc = mu_get_auth (&auth, key_type, key); printf ("mu_get_auth => %d, %s\n", rc, mu_strerror (rc)); diff --git a/examples/muemail.c b/examples/muemail.c index 23350cd..e30a8b4 100644 --- a/examples/muemail.c +++ b/examples/muemail.c @@ -21,28 +21,28 @@ #include <stdlib.h> #include <stdio.h> #include <mailutils/util.h> -#include "mailutils/libargp.h" +#include <mailutils/cli.h> -const char *capa[] = { - "mailutils", +char *capa[] = { "address", NULL }; +static struct mu_cli_setup cli = { NULL }; + + int main (int argc, char *argv[]) { - int arg = 1; - - if (mu_app_init (NULL, capa, NULL, argc, argv, 0, &arg, NULL)) - exit (1); + mu_cli (argc, argv, &cli, capa, NULL, &argc, &argv); - if (!argv[arg]) + if (argc == 0) printf ("current user -> %s\n", mu_get_user_email (0)); else { - for (; argv[arg]; arg++) - printf ("%s -> %s\n", argv[arg], mu_get_user_email (argv[arg])); + int i; + for (i = 0; i < argc; i++) + printf ("%s -> %s\n", argv[i], mu_get_user_email (argv[i])); } return 0; diff --git a/libmailutils/opt/help.c b/libmailutils/opt/help.c index 07420dc..b1a81ea 100644 --- a/libmailutils/opt/help.c +++ b/libmailutils/opt/help.c @@ -521,7 +521,7 @@ print_program_usage (struct mu_parseopt *po, int optsum, mu_stream_t str) optsum = 0; } else - mu_stream_printf (str, "[%s]...", _("OPTION")); + mu_stream_printf (str, "[%s...]", _("OPTION")); if (arg_text) { diff --git a/libmailutils/tests/parseopt_help00.at b/libmailutils/tests/parseopt_help00.at index 894d524..df43dc3 100644 --- a/libmailutils/tests/parseopt_help00.at +++ b/libmailutils/tests/parseopt_help00.at @@ -21,7 +21,7 @@ PARSEOPT_DEFAULT parseopt --help ], [0], -[[Usage: parseopt [OPTION]... +[[Usage: parseopt [OPTION...] Group A -a, --all no arguments to this one diff --git a/libmailutils/tests/parseopt_help02.at b/libmailutils/tests/parseopt_help02.at index 61dbac3..b88cdf0 100644 --- a/libmailutils/tests/parseopt_help02.at +++ b/libmailutils/tests/parseopt_help02.at @@ -21,7 +21,7 @@ PARSEOPT_DEFAULT MU_PARSEOPT_PROG_NAME=newname parseopt --help ], [0], -[[Usage: newname [OPTION]... +[[Usage: newname [OPTION...] Group A -a, --all no arguments to this one diff --git a/libmailutils/tests/parseopt_help03.at b/libmailutils/tests/parseopt_help03.at index 8435a9c..cc89a1e 100644 --- a/libmailutils/tests/parseopt_help03.at +++ b/libmailutils/tests/parseopt_help03.at @@ -21,7 +21,7 @@ unset ARGP_HELP_FMT MU_PARSEOPT_PROG_DOC="Tests option parsing" parseopt --help ], [0], -[[Usage: parseopt [OPTION]... +[[Usage: parseopt [OPTION...] Tests option parsing Group A diff --git a/libmailutils/tests/parseopt_help04.at b/libmailutils/tests/parseopt_help04.at index 473c0fb..f859d72 100644 --- a/libmailutils/tests/parseopt_help04.at +++ b/libmailutils/tests/parseopt_help04.at @@ -21,7 +21,7 @@ PARSEOPT_DEFAULT MU_PARSEOPT_PROG_ARGS="SOME MORE ARGS" parseopt --help ], [0], -[Usage: parseopt [[OPTION]]... SOME MORE ARGS +[Usage: parseopt [[OPTION...]] SOME MORE ARGS Group A -a, --all no arguments to this one diff --git a/libmailutils/tests/parseopt_help05.at b/libmailutils/tests/parseopt_help05.at index 2856e61..69058a7 100644 --- a/libmailutils/tests/parseopt_help05.at +++ b/libmailutils/tests/parseopt_help05.at @@ -21,7 +21,7 @@ PARSEOPT_DEFAULT MU_PARSEOPT_BUG_ADDRESS='g...@gnu.org' parseopt --help ], [0], -[Usage: parseopt [[OPTION]]... +[Usage: parseopt [[OPTION...]] Group A -a, --all no arguments to this one diff --git a/libmailutils/tests/parseopt_help06.at b/libmailutils/tests/parseopt_help06.at index 4562a21..2a2067a 100644 --- a/libmailutils/tests/parseopt_help06.at +++ b/libmailutils/tests/parseopt_help06.at @@ -21,7 +21,7 @@ PARSEOPT_DEFAULT MU_PARSEOPT_PACKAGE_NAME='GNU Mailutils' MU_PARSEOPT_PACKAGE_URL='http://mailutils.org' parseopt --help ], [0], -[[Usage: parseopt [OPTION]... +[[Usage: parseopt [OPTION...] Group A -a, --all no arguments to this one diff --git a/libmailutils/tests/parseopt_help07.at b/libmailutils/tests/parseopt_help07.at index 1b2e388..0a824c2 100644 --- a/libmailutils/tests/parseopt_help07.at +++ b/libmailutils/tests/parseopt_help07.at @@ -27,7 +27,7 @@ MU_PARSEOPT_PROG_DOC="Tests option parsing"\ parseopt --help ], [0], -[[Usage: parseopt [OPTION]... SOME MORE ARGS +[[Usage: parseopt [OPTION...] SOME MORE ARGS Tests option parsing Group A diff --git a/libmailutils/tests/parseopt_help08.at b/libmailutils/tests/parseopt_help08.at index becc899..6d8e193 100644 --- a/libmailutils/tests/parseopt_help08.at +++ b/libmailutils/tests/parseopt_help08.at @@ -22,7 +22,7 @@ ARGP_HELP_FMT=dup-args,no-dup-args-note,short-opt-col=1,opt-doc-col=32,header-co parseopt --help ], [0], -[[Usage: parseopt [OPTION]... +[[Usage: parseopt [OPTION...] Group A -a, --all no arguments to this one diff --git a/libmailutils/tests/parseopt_help11.at b/libmailutils/tests/parseopt_help11.at index 9b7dc2b..93d4d25 100644 --- a/libmailutils/tests/parseopt_help11.at +++ b/libmailutils/tests/parseopt_help11.at @@ -21,7 +21,7 @@ PARSEOPT_DEFAULT MU_PARSEOPT_VERSION_HOOK=1 parseopt --help ], [0], -[[Usage: parseopt [OPTION]... +[[Usage: parseopt [OPTION...] Group A -a, --all no arguments to this one diff --git a/libmailutils/tests/parseopt_help12.at b/libmailutils/tests/parseopt_help12.at index 674bdf4..86737d0 100644 --- a/libmailutils/tests/parseopt_help12.at +++ b/libmailutils/tests/parseopt_help12.at @@ -21,9 +21,9 @@ PARSEOPT_DEFAULT MU_PARSEOPT_PROG_ARGS="SOME MORE ARGS|ALTERNATIVE ARGS|ANOTHER ARGS" parseopt --help ], [0], -[Usage: parseopt [[OPTION]]... SOME MORE ARGS - or: parseopt [[OPTION]]... ALTERNATIVE ARGS - or: parseopt [[OPTION]]... ANOTHER ARGS +[Usage: parseopt [[OPTION...]] SOME MORE ARGS + or: parseopt [[OPTION...]] ALTERNATIVE ARGS + or: parseopt [[OPTION...]] ANOTHER ARGS Group A -a, --all no arguments to this one hooks/post-receive -- GNU Mailutils _______________________________________________ Commit-mailutils mailing list Commit-mailutils@gnu.org https://lists.gnu.org/mailman/listinfo/commit-mailutils