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 3036 by gezelter, Tue Oct 10 02:44:13 2006 UTC vs.
Revision 3041 by gezelter, Tue Oct 10 18:34:12 2006 UTC

# 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 86 | Line 83 | cmdline_parser_print_help (void)
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 119 | Line 115 | cmdline_parser_release (struct gengetopt_args_info *ar
115      {
116        free (args_info->output_orig); /* free previous argument */
117        args_info->output_orig = 0;
122    }
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;
118      }
119    if (args_info->density_orig)
120      {
# Line 200 | Line 186 | cmdline_parser_file_save(const char *filename, struct
186        fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig);
187      } else {
188        fprintf(outfile, "%s\n", "output");
203    }
204  }
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");
189      }
190    }
191    if (args_info->density_given) {
# Line 420 | 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' },
423        { "latticetype",        1, NULL, 0 },
402          { "density",    1, NULL, 0 },
403          { "nx", 1, NULL, 0 },
404          { "ny", 1, NULL, 0 },
# Line 466 | Line 444 | cmdline_parser_internal (int argc, char * const *argv,
444  
445  
446          case 0: /* Long option with no short option */
469          /* Lattice type string. Valid types are fcc,hcp,bcc and hcp-water..  */
470          if (strcmp (long_options[option_index].name, "latticetype") == 0)
471          {
472            if (local_args_info.latticetype_given)
473              {
474                fprintf (stderr, "%s: `--latticetype' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
475                goto failure;
476              }
477            if (args_info->latticetype_given && ! override)
478              continue;
479            local_args_info.latticetype_given = 1;
480            args_info->latticetype_given = 1;
481            if (args_info->latticetype_arg)
482              free (args_info->latticetype_arg); /* free previous string */
483            args_info->latticetype_arg = gengetopt_strdup (optarg);
484            if (args_info->latticetype_orig)
485              free (args_info->latticetype_orig); /* free previous string */
486            args_info->latticetype_orig = gengetopt_strdup (optarg);
487          }
447            /* density (g/cm^3).  */
448 <          else if (strcmp (long_options[option_index].name, "density") == 0)
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