64 |
{ NULL, 0, NULL, 0, NULL, 0 } |
{ NULL, 0, NULL, 0, NULL, 0 } |
65 |
}; |
}; |
66 |
|
|
67 |
/* Option to print the licence. */ |
/* Option to print the license. */ |
68 |
static struct argp_option mu_licence_argp_option[] = { |
static struct argp_option mu_license_argp_option[] = { |
69 |
{ "license", 'L', NULL, 0, "Print license and exit", -2 }, |
{ "license", 'L', NULL, 0, "Print license and exit", -2 }, |
70 |
{ NULL, 0, NULL, 0, NULL, 0 } |
{ NULL, 0, NULL, 0, NULL, 0 } |
71 |
}; |
}; |
139 |
struct argp_child mu_common_argp_child = { |
struct argp_child mu_common_argp_child = { |
140 |
&mu_common_argp, |
&mu_common_argp, |
141 |
0, |
0, |
142 |
"", |
NULL, |
143 |
-10, |
0, |
144 |
}; |
}; |
145 |
|
|
146 |
struct argp mu_licence_argp = { |
struct argp mu_license_argp = { |
147 |
mu_licence_argp_option, |
mu_license_argp_option, |
148 |
mu_common_argp_parser, |
mu_common_argp_parser, |
149 |
}; |
}; |
150 |
|
|
151 |
struct argp_child mu_licence_argp_child = { |
struct argp_child mu_license_argp_child = { |
152 |
&mu_licence_argp, |
&mu_license_argp, |
153 |
0, |
0, |
154 |
"", |
NULL, |
155 |
-2 |
0 |
156 |
}; |
}; |
157 |
|
|
158 |
struct argp mu_mailbox_argp = { |
struct argp mu_mailbox_argp = { |
163 |
struct argp_child mu_mailbox_argp_child = { |
struct argp_child mu_mailbox_argp_child = { |
164 |
&mu_mailbox_argp, |
&mu_mailbox_argp, |
165 |
0, |
0, |
166 |
"", |
NULL, |
167 |
-3 |
0 |
168 |
}; |
}; |
169 |
|
|
170 |
struct argp mu_logging_argp = { |
struct argp mu_logging_argp = { |
175 |
struct argp_child mu_logging_argp_child = { |
struct argp_child mu_logging_argp_child = { |
176 |
&mu_logging_argp, |
&mu_logging_argp, |
177 |
0, |
0, |
178 |
"", |
NULL, |
179 |
-3 |
0 |
180 |
}; |
}; |
181 |
|
|
182 |
struct argp mu_auth_argp = { |
struct argp mu_auth_argp = { |
188 |
&mu_auth_argp, |
&mu_auth_argp, |
189 |
0, |
0, |
190 |
"Authentication options", |
"Authentication options", |
191 |
|
0 |
192 |
}; |
}; |
193 |
|
|
194 |
struct argp mu_daemon_argp = { |
struct argp mu_daemon_argp = { |
277 |
{ |
{ |
278 |
/* common */ |
/* common */ |
279 |
case 'L': |
case 'L': |
280 |
printf ("Licence for %s:\n\n", argp_program_version); |
printf ("License for %s:\n\n", argp_program_version); |
281 |
printf ("%s", license_text); |
printf ("%s", license_text); |
282 |
exit (0); |
exit (0); |
283 |
|
|
665 |
struct argp_child *child; |
struct argp_child *child; |
666 |
} mu_argp_capa[] = { |
} mu_argp_capa[] = { |
667 |
{"common", &mu_common_argp_child}, |
{"common", &mu_common_argp_child}, |
668 |
{"licence", &mu_licence_argp_child}, |
{"license", &mu_license_argp_child}, |
669 |
{"mailbox", &mu_mailbox_argp_child}, |
{"mailbox", &mu_mailbox_argp_child}, |
670 |
{"logging", &mu_logging_argp_child}, |
{"logging", &mu_logging_argp_child}, |
671 |
{"auth", &mu_auth_argp_child}, |
{"auth", &mu_auth_argp_child}, |
689 |
int n; |
int n; |
690 |
int nchild; |
int nchild; |
691 |
struct argp_child *ap; |
struct argp_child *ap; |
692 |
|
struct argp_option *opt; |
693 |
struct argp *argp; |
struct argp *argp; |
694 |
int group = -100; |
int group = 0; |
695 |
|
|
696 |
/* Count the capabilities. */ |
/* Count the capabilities. */ |
697 |
for (n = 0; capa && capa[n]; n++) |
for (n = 0; capa && capa[n]; n++) |
713 |
for (n = 0; template->children[n].argp; n++, nchild++) |
for (n = 0; template->children[n].argp; n++, nchild++) |
714 |
ap[nchild] = template->children[n]; |
ap[nchild] = template->children[n]; |
715 |
|
|
716 |
group = -nchild - 1; |
/* Find next group number */ |
717 |
|
for (opt = template->options; |
718 |
|
opt && ((opt->name && opt->key) || opt->doc); opt++) |
719 |
|
if (opt->group > group) |
720 |
|
group = opt->group; |
721 |
|
|
722 |
|
group++; |
723 |
|
|
724 |
/* Append any capabilities to the children or options, as appropriate. */ |
/* Append any capabilities to the children or options, as appropriate. */ |
725 |
for (n = 0; capa && capa[n]; n++) |
for (n = 0; capa && capa[n]; n++) |
726 |
{ |
{ |
732 |
abort (); |
abort (); |
733 |
} |
} |
734 |
ap[nchild] = *child; |
ap[nchild] = *child; |
735 |
// ap[nchild].group = group++; |
ap[nchild].group = group++; |
736 |
nchild++; |
nchild++; |
737 |
} |
} |
738 |
ap[nchild].argp = NULL; |
ap[nchild].argp = NULL; |