ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/applications/randomBuilder/randomBuilderCmd.c
(Generate patch)

Comparing trunk/OOPSE-4/src/applications/randomBuilder/randomBuilderCmd.c (file contents):
Revision 2738 by chuckv, Tue Apr 25 22:59:27 2006 UTC vs.
Revision 3041 by gezelter, Tue Oct 10 18:34:12 2006 UTC

# Line 1 | Line 1
1   /*
2 <  File autogenerated by gengetopt version 2.15
2 >  File autogenerated by gengetopt version 2.16
3    generated with the following command:
4 <  gengetopt --file-name=randomBuilderCmd --unamed-opts
4 >  gengetopt -F randomBuilderCmd --unamed-opts
5  
6    The developers of gengetopt consider the fixed text that goes in all
7    gengetopt output files to be in the public domain:
# Line 48 | Line 48 | void clear_given (struct gengetopt_args_info *args_inf
48    args_info->help_given = 0 ;
49    args_info->version_given = 0 ;
50    args_info->output_given = 0 ;
51  args_info->latticetype_given = 0 ;
51    args_info->density_given = 0 ;
52    args_info->nx_given = 0 ;
53    args_info->ny_given = 0 ;
# Line 61 | Line 60 | void clear_args (struct gengetopt_args_info *args_info
60   {
61    args_info->output_arg = NULL;
62    args_info->output_orig = NULL;
64  args_info->latticetype_arg = gengetopt_strdup ("fcc");
65  args_info->latticetype_orig = NULL;
63    args_info->density_orig = NULL;
64    args_info->nx_orig = NULL;
65    args_info->ny_orig = NULL;
# Line 82 | Line 79 | cmdline_parser_print_help (void)
79   cmdline_parser_print_help (void)
80   {
81    cmdline_parser_print_version ();
82 <  printf("\nUsage: simpleBuilder [OPTIONS]... [FILES]...\n\n");
82 >  printf("\nUsage: randomBuilder [OPTIONS]... [FILES]...\n\n");
83    printf("%s\n","  -h, --help                Print help and exit");
84    printf("%s\n","  -V, --version             Print version and exit");
85    printf("%s\n","  -o, --output=STRING       Output file name");
89  printf("%s\n","      --latticetype=STRING  Lattice type string. Valid types are fcc,hcp,bcc \n                              and hcp-water.  (default=`fcc')");
86    printf("%s\n","      --density=DOUBLE      density (g/cm^3)");
87    printf("%s\n","      --nx=INT              number of unit cells in x");
88    printf("%s\n","      --ny=INT              number of unit cells in y");
# Line 120 | Line 116 | cmdline_parser_release (struct gengetopt_args_info *ar
116        free (args_info->output_orig); /* free previous argument */
117        args_info->output_orig = 0;
118      }
123  if (args_info->latticetype_arg)
124    {
125      free (args_info->latticetype_arg); /* free previous argument */
126      args_info->latticetype_arg = 0;
127    }
128  if (args_info->latticetype_orig)
129    {
130      free (args_info->latticetype_orig); /* free previous argument */
131      args_info->latticetype_orig = 0;
132    }
119    if (args_info->density_orig)
120      {
121        free (args_info->density_orig); /* free previous argument */
# Line 202 | Line 188 | cmdline_parser_file_save(const char *filename, struct
188        fprintf(outfile, "%s\n", "output");
189      }
190    }
205  if (args_info->latticetype_given) {
206    if (args_info->latticetype_orig) {
207      fprintf(outfile, "%s=\"%s\"\n", "latticetype", args_info->latticetype_orig);
208    } else {
209      fprintf(outfile, "%s\n", "latticetype");
210    }
211  }
191    if (args_info->density_given) {
192      if (args_info->density_orig) {
193        fprintf(outfile, "%s=\"%s\"\n", "density", args_info->density_orig);
# Line 360 | Line 339 | cmdline_parser_required2 (struct gengetopt_args_info *
339   {
340    int error = 0;
341  
342 +  if (! args_info->output_given)
343 +    {
344 +      fprintf (stderr, "%s: '--output' ('-o') option required%s\n", prog_name, (additional_error ? additional_error : ""));
345 +      error = 1;
346 +    }
347    if (! args_info->density_given)
348      {
349        fprintf (stderr, "%s: '--density' option required%s\n", prog_name, (additional_error ? additional_error : ""));
# Line 402 | Line 386 | cmdline_parser_internal (int argc, char * const *argv,
386    cmdline_parser_init (&local_args_info);
387  
388    optarg = 0;
389 <  optind = 1;
389 >  optind = 0;
390    opterr = 1;
391    optopt = '?';
392  
# Line 415 | Line 399 | cmdline_parser_internal (int argc, char * const *argv,
399          { "help",       0, NULL, 'h' },
400          { "version",    0, NULL, 'V' },
401          { "output",     1, NULL, 'o' },
418        { "latticetype",        1, NULL, 0 },
402          { "density",    1, NULL, 0 },
403          { "nx", 1, NULL, 0 },
404          { "ny", 1, NULL, 0 },
# Line 461 | Line 444 | cmdline_parser_internal (int argc, char * const *argv,
444  
445  
446          case 0: /* Long option with no short option */
447 <          /* Lattice type string. Valid types are fcc,hcp,bcc and hcp-water..  */
448 <          if (strcmp (long_options[option_index].name, "latticetype") == 0)
466 <          {
467 <            if (local_args_info.latticetype_given)
468 <              {
469 <                fprintf (stderr, "%s: `--latticetype' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
470 <                goto failure;
471 <              }
472 <            if (args_info->latticetype_given && ! override)
473 <              continue;
474 <            local_args_info.latticetype_given = 1;
475 <            args_info->latticetype_given = 1;
476 <            if (args_info->latticetype_arg)
477 <              free (args_info->latticetype_arg); /* free previous string */
478 <            args_info->latticetype_arg = gengetopt_strdup (optarg);
479 <            if (args_info->latticetype_orig)
480 <              free (args_info->latticetype_orig); /* free previous string */
481 <            args_info->latticetype_orig = gengetopt_strdup (optarg);
482 <          }
483 <          /* density (g/cm^3).  */
484 <          else if (strcmp (long_options[option_index].name, "density") == 0)
447 >          /* density (g/cm^3).  */
448 >          if (strcmp (long_options[option_index].name, "density") == 0)
449            {
450              if (local_args_info.density_given)
451                {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines