summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2002-04-11 10:12:24 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2002-04-11 10:12:24 +0000
commit8be58f39a54921e61a9665d3f5ff82ebc09b8b13 (patch)
tree4be8f88dc5d049626995027aa1061d5c28b28a79 /lib
parent1c6da6b557a24698a7faacbe01d4f178f9d453bc (diff)
downloadmailutils-8be58f39a54921e61a9665d3f5ff82ebc09b8b13.tar.gz
mailutils-8be58f39a54921e61a9665d3f5ff82ebc09b8b13.tar.bz2
Fixed auto-arranging of options groups. Fixed spelling of license option.
Diffstat (limited to 'lib')
-rw-r--r--lib/mu_argp.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/lib/mu_argp.c b/lib/mu_argp.c
index 62a088f1e..b3641c351 100644
--- a/lib/mu_argp.c
+++ b/lib/mu_argp.c
@@ -64,8 +64,8 @@ static struct argp_option mu_common_argp_options[] =
{ NULL, 0, NULL, 0, NULL, 0 }
};
-/* Option to print the licence. */
-static struct argp_option mu_licence_argp_option[] = {
+/* Option to print the license. */
+static struct argp_option mu_license_argp_option[] = {
{ "license", 'L', NULL, 0, "Print license and exit", -2 },
{ NULL, 0, NULL, 0, NULL, 0 }
};
@@ -139,20 +139,20 @@ struct argp mu_common_argp = {
struct argp_child mu_common_argp_child = {
&mu_common_argp,
0,
- "",
- -10,
+ NULL,
+ 0,
};
-struct argp mu_licence_argp = {
- mu_licence_argp_option,
+struct argp mu_license_argp = {
+ mu_license_argp_option,
mu_common_argp_parser,
};
-struct argp_child mu_licence_argp_child = {
- &mu_licence_argp,
+struct argp_child mu_license_argp_child = {
+ &mu_license_argp,
0,
- "",
- -2
+ NULL,
+ 0
};
struct argp mu_mailbox_argp = {
@@ -163,8 +163,8 @@ struct argp mu_mailbox_argp = {
struct argp_child mu_mailbox_argp_child = {
&mu_mailbox_argp,
0,
- "",
- -3
+ NULL,
+ 0
};
struct argp mu_logging_argp = {
@@ -175,8 +175,8 @@ struct argp mu_logging_argp = {
struct argp_child mu_logging_argp_child = {
&mu_logging_argp,
0,
- "",
- -3
+ NULL,
+ 0
};
struct argp mu_auth_argp = {
@@ -188,6 +188,7 @@ struct argp_child mu_auth_argp_child = {
&mu_auth_argp,
0,
"Authentication options",
+ 0
};
struct argp mu_daemon_argp = {
@@ -276,7 +277,7 @@ mu_common_argp_parser (int key, char *arg, struct argp_state *state)
{
/* common */
case 'L':
- printf ("Licence for %s:\n\n", argp_program_version);
+ printf ("License for %s:\n\n", argp_program_version);
printf ("%s", license_text);
exit (0);
@@ -664,7 +665,7 @@ struct argp_capa {
struct argp_child *child;
} mu_argp_capa[] = {
{"common", &mu_common_argp_child},
- {"licence", &mu_licence_argp_child},
+ {"license", &mu_license_argp_child},
{"mailbox", &mu_mailbox_argp_child},
{"logging", &mu_logging_argp_child},
{"auth", &mu_auth_argp_child},
@@ -688,8 +689,9 @@ mu_build_argp (const struct argp *template, const char *capa[])
int n;
int nchild;
struct argp_child *ap;
+ struct argp_option *opt;
struct argp *argp;
- int group = -100;
+ int group = 0;
/* Count the capabilities. */
for (n = 0; capa && capa[n]; n++)
@@ -711,8 +713,14 @@ mu_build_argp (const struct argp *template, const char *capa[])
for (n = 0; template->children[n].argp; n++, nchild++)
ap[nchild] = template->children[n];
- group = -nchild - 1;
+ /* Find next group number */
+ for (opt = template->options;
+ opt && ((opt->name && opt->key) || opt->doc); opt++)
+ if (opt->group > group)
+ group = opt->group;
+ group++;
+
/* Append any capabilities to the children or options, as appropriate. */
for (n = 0; capa && capa[n]; n++)
{
@@ -724,7 +732,7 @@ mu_build_argp (const struct argp *template, const char *capa[])
abort ();
}
ap[nchild] = *child;
-// ap[nchild].group = group++;
+ ap[nchild].group = group++;
nchild++;
}
ap[nchild].argp = NULL;

Return to:

Send suggestions and report system problems to the System administrator.