--- trunk/src/applications/staticProps/StaticPropsCmd.c 2009/11/25 20:02:06 1390 +++ trunk/src/applications/staticProps/StaticPropsCmd.c 2010/03/22 19:21:22 1413 @@ -1,7 +1,7 @@ /* File autogenerated by gengetopt version 2.22 generated with the following command: - gengetopt -F StaticPropsCmd + gengetopt -F StaticPropsCmd -u The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: @@ -23,7 +23,7 @@ const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_purpose = ""; -const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]..."; +const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_description = ""; @@ -64,6 +64,7 @@ const char *gengetopt_args_info_help[] = { " -s, --scd scd order parameter (either --sele1, --sele2, \n --sele3 are specified or --molname, --begin, \n --end are specified)", " -d, --density density plot", " --slab_density slab density", + " --p_angle p(cos(theta))", " --hxy hxy", " --rho_r rho of R", " --hullvol hull volume of nanoparticle", @@ -129,6 +130,7 @@ void clear_given (struct gengetopt_args_info *args_inf args_info->scd_given = 0 ; args_info->density_given = 0 ; args_info->slab_density_given = 0 ; + args_info->p_angle_given = 0 ; args_info->hxy_given = 0 ; args_info->rho_r_given = 0 ; args_info->hullvol_given = 0 ; @@ -214,9 +216,10 @@ void init_args_info(struct gengetopt_args_info *args_i args_info->scd_help = gengetopt_args_info_help[33] ; args_info->density_help = gengetopt_args_info_help[34] ; args_info->slab_density_help = gengetopt_args_info_help[35] ; - args_info->hxy_help = gengetopt_args_info_help[36] ; - args_info->rho_r_help = gengetopt_args_info_help[37] ; - args_info->hullvol_help = gengetopt_args_info_help[38] ; + args_info->p_angle_help = gengetopt_args_info_help[36] ; + args_info->hxy_help = gengetopt_args_info_help[37] ; + args_info->rho_r_help = gengetopt_args_info_help[38] ; + args_info->hullvol_help = gengetopt_args_info_help[39] ; } @@ -256,6 +259,9 @@ cmdline_parser_init (struct gengetopt_args_info *args_ clear_given (args_info); clear_args (args_info); init_args_info (args_info); + + args_info->inputs = NULL; + args_info->inputs_num = 0; } void @@ -294,7 +300,7 @@ cmdline_parser_release (struct gengetopt_args_info *ar static void cmdline_parser_release (struct gengetopt_args_info *args_info) { - + unsigned int i; free_string_field (&(args_info->input_arg)); free_string_field (&(args_info->input_orig)); free_string_field (&(args_info->output_arg)); @@ -324,7 +330,12 @@ cmdline_parser_release (struct gengetopt_args_info *ar free_string_field (&(args_info->radius_orig)); + for (i = 0; i < args_info->inputs_num; ++i) + free (args_info->inputs [i]); + if (args_info->inputs_num) + free (args_info->inputs); + clear_given (args_info); } @@ -421,6 +432,8 @@ cmdline_parser_dump(FILE *outfile, struct gengetopt_ar write_into_file(outfile, "density", 0, 0 ); if (args_info->slab_density_given) write_into_file(outfile, "slab_density", 0, 0 ); + if (args_info->p_angle_given) + write_into_file(outfile, "p_angle", 0, 0 ); if (args_info->hxy_given) write_into_file(outfile, "hxy", 0, 0 ); if (args_info->rho_r_given) @@ -494,6 +507,7 @@ reset_group_staticProps(struct gengetopt_args_info *ar args_info->scd_given = 0 ; args_info->density_given = 0 ; args_info->slab_density_given = 0 ; + args_info->p_angle_given = 0 ; args_info->hxy_given = 0 ; args_info->rho_r_given = 0 ; args_info->hullvol_given = 0 ; @@ -772,6 +786,7 @@ cmdline_parser_internal (int argc, char * const *argv, { "scd", 0, NULL, 's' }, { "density", 0, NULL, 'd' }, { "slab_density", 0, NULL, 0 }, + { "p_angle", 0, NULL, 0 }, { "hxy", 0, NULL, 0 }, { "rho_r", 0, NULL, 0 }, { "hullvol", 0, NULL, 0 }, @@ -1270,6 +1285,23 @@ cmdline_parser_internal (int argc, char * const *argv, &(local_args_info.slab_density_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "slab_density", '-', + additional_error)) + goto failure; + + } + /* p(cos(theta)). */ + else if (strcmp (long_options[option_index].name, "p_angle") == 0) + { + + if (args_info->staticProps_group_counter && override) + reset_group_staticProps (args_info); + args_info->staticProps_group_counter += 1; + + if (update_arg( 0 , + 0 , &(args_info->p_angle_given), + &(local_args_info.p_angle_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "p_angle", '-', additional_error)) goto failure; @@ -1355,6 +1387,30 @@ cmdline_parser_internal (int argc, char * const *argv, if ( error ) return (EXIT_FAILURE); + if (optind < argc) + { + int i = 0 ; + int found_prog_name = 0; + /* whether program name, i.e., argv[0], is in the remaining args + (this may happen with some implementations of getopt, + but surely not with the one included by gengetopt) */ + + i = optind; + while (i < argc) + if (argv[i++] == argv[0]) { + found_prog_name = 1; + break; + } + i = 0; + + args_info->inputs_num = argc - optind - found_prog_name; + args_info->inputs = + (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; + while (optind < argc) + if (argv[optind++] != argv[0]) + args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; + } + return 0; failure: