/[mailutils]/mailutils/lib/mu_argp.c
ViewVC logotype

Diff of /mailutils/lib/mu_argp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by sroberts, Thu Apr 11 03:08:25 2002 UTC revision 1.13 by gray, Thu Apr 11 10:12:24 2002 UTC
# Line 64  static struct argp_option mu_common_argp Line 64  static struct argp_option mu_common_argp
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  };  };
# Line 139  struct argp mu_common_argp = { Line 139  struct argp mu_common_argp = {
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 = {
# Line 163  struct argp mu_mailbox_argp = { Line 163  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 = {
# Line 175  struct argp mu_logging_argp = { Line 175  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 = {
# Line 188  struct argp_child mu_auth_argp_child = { Line 188  struct argp_child mu_auth_argp_child = {
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 = {
# Line 276  mu_common_argp_parser (int key, char *ar Line 277  mu_common_argp_parser (int key, char *ar
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    
# Line 664  struct argp_capa { Line 665  struct argp_capa {
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},
# Line 688  mu_build_argp (const struct argp *templa Line 689  mu_build_argp (const struct argp *templa
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++)
# Line 711  mu_build_argp (const struct argp *templa Line 713  mu_build_argp (const struct argp *templa
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      {      {
# Line 724  mu_build_argp (const struct argp *templa Line 732  mu_build_argp (const struct argp *templa
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;

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26