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

Comparing trunk/OOPSE-3.0/src/applications/staticProps/StaticPropsCmd.c (file contents):
Revision 2053 by tim, Fri Feb 18 23:07:32 2005 UTC vs.
Revision 2204 by gezelter, Fri Apr 15 22:04:00 2005 UTC

# Line 33 | Line 33 | cmdline_parser_print_help (void)
33   {
34    cmdline_parser_print_version ();
35    printf("\n"
36 <  "Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE);
36 >         "Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE);
37    printf("\n");
38    printf("  -h, --help                      Print help and exit\n");
39    printf("  -V, --version                   Print version and exit\n");
# Line 94 | Line 94 | cmdline_parser (int argc, char * const *argv, struct g
94    args_info->r_omega_given = 0 ;
95    args_info->theta_omega_given = 0 ;
96    args_info->gxyz_given = 0 ;
97 < #define clear_args() { \
98 <  args_info->input_arg = NULL; \
99 <  args_info->output_arg = NULL; \
100 <  args_info->step_arg = 1 ;\
101 <  args_info->nrbins_arg = 100 ;\
102 <  args_info->nanglebins_arg = 50 ;\
103 <  args_info->sele1_arg = NULL; \
104 <  args_info->sele2_arg = NULL; \
105 <  args_info->refsele_arg = NULL; \
106 < }
97 > #define clear_args() {                          \
98 >    args_info->input_arg = NULL;                \
99 >    args_info->output_arg = NULL;               \
100 >    args_info->step_arg = 1 ;                   \
101 >    args_info->nrbins_arg = 100 ;               \
102 >    args_info->nanglebins_arg = 50 ;            \
103 >    args_info->sele1_arg = NULL;                \
104 >    args_info->sele2_arg = NULL;                \
105 >    args_info->refsele_arg = NULL;              \
106 >  }
107  
108    clear_args();
109  
# Line 224 | Line 224 | cmdline_parser (int argc, char * const *argv, struct g
224          case 0: /* Long option with no short option */
225            /* select first stuntdouble set.  */
226            if (strcmp (long_options[option_index].name, "sele1") == 0)
227 <          {
228 <            if (args_info->sele1_given)
229 <              {
230 <                fprintf (stderr, "%s: `--sele1' option given more than once\n", CMDLINE_PARSER_PACKAGE);
231 <                clear_args ();
232 <                exit (EXIT_FAILURE);
233 <              }
234 <            args_info->sele1_given = 1;
235 <            args_info->sele1_arg = gengetopt_strdup (optarg);
236 <            break;
237 <          }
227 >            {
228 >              if (args_info->sele1_given)
229 >                {
230 >                  fprintf (stderr, "%s: `--sele1' option given more than once\n", CMDLINE_PARSER_PACKAGE);
231 >                  clear_args ();
232 >                  exit (EXIT_FAILURE);
233 >                }
234 >              args_info->sele1_given = 1;
235 >              args_info->sele1_arg = gengetopt_strdup (optarg);
236 >              break;
237 >            }
238            
239            /* select second stuntdouble set.  */
240            else if (strcmp (long_options[option_index].name, "sele2") == 0)
241 <          {
242 <            if (args_info->sele2_given)
243 <              {
244 <                fprintf (stderr, "%s: `--sele2' option given more than once\n", CMDLINE_PARSER_PACKAGE);
245 <                clear_args ();
246 <                exit (EXIT_FAILURE);
247 <              }
248 <            args_info->sele2_given = 1;
249 <            args_info->sele2_arg = gengetopt_strdup (optarg);
250 <            break;
251 <          }
241 >            {
242 >              if (args_info->sele2_given)
243 >                {
244 >                  fprintf (stderr, "%s: `--sele2' option given more than once\n", CMDLINE_PARSER_PACKAGE);
245 >                  clear_args ();
246 >                  exit (EXIT_FAILURE);
247 >                }
248 >              args_info->sele2_given = 1;
249 >              args_info->sele2_arg = gengetopt_strdup (optarg);
250 >              break;
251 >            }
252            
253            /* select reference (use and only use with --gxyz).  */
254            else if (strcmp (long_options[option_index].name, "refsele") == 0)
255 <          {
256 <            if (args_info->refsele_given)
257 <              {
258 <                fprintf (stderr, "%s: `--refsele' option given more than once\n", CMDLINE_PARSER_PACKAGE);
259 <                clear_args ();
260 <                exit (EXIT_FAILURE);
261 <              }
262 <            args_info->refsele_given = 1;
263 <            args_info->refsele_arg = gengetopt_strdup (optarg);
264 <            break;
265 <          }
255 >            {
256 >              if (args_info->refsele_given)
257 >                {
258 >                  fprintf (stderr, "%s: `--refsele' option given more than once\n", CMDLINE_PARSER_PACKAGE);
259 >                  clear_args ();
260 >                  exit (EXIT_FAILURE);
261 >                }
262 >              args_info->refsele_given = 1;
263 >              args_info->refsele_arg = gengetopt_strdup (optarg);
264 >              break;
265 >            }
266            
267            /* g(r).  */
268            else if (strcmp (long_options[option_index].name, "gofr") == 0)
269 <          {
270 <            if (args_info->gofr_given)
271 <              {
272 <                fprintf (stderr, "%s: `--gofr' option given more than once\n", CMDLINE_PARSER_PACKAGE);
273 <                clear_args ();
274 <                exit (EXIT_FAILURE);
275 <              }
276 <            args_info->gofr_given = 1; staticProps_group_counter += 1;
269 >            {
270 >              if (args_info->gofr_given)
271 >                {
272 >                  fprintf (stderr, "%s: `--gofr' option given more than once\n", CMDLINE_PARSER_PACKAGE);
273 >                  clear_args ();
274 >                  exit (EXIT_FAILURE);
275 >                }
276 >              args_info->gofr_given = 1; staticProps_group_counter += 1;
277            
278 <            break;
279 <          }
278 >              break;
279 >            }
280            
281            /* g(r, cos(theta)).  */
282            else if (strcmp (long_options[option_index].name, "r_theta") == 0)
283 <          {
284 <            if (args_info->r_theta_given)
285 <              {
286 <                fprintf (stderr, "%s: `--r_theta' option given more than once\n", CMDLINE_PARSER_PACKAGE);
287 <                clear_args ();
288 <                exit (EXIT_FAILURE);
289 <              }
290 <            args_info->r_theta_given = 1; staticProps_group_counter += 1;
283 >            {
284 >              if (args_info->r_theta_given)
285 >                {
286 >                  fprintf (stderr, "%s: `--r_theta' option given more than once\n", CMDLINE_PARSER_PACKAGE);
287 >                  clear_args ();
288 >                  exit (EXIT_FAILURE);
289 >                }
290 >              args_info->r_theta_given = 1; staticProps_group_counter += 1;
291            
292 <            break;
293 <          }
292 >              break;
293 >            }
294            
295            /* g(r, cos(omega)).  */
296            else if (strcmp (long_options[option_index].name, "r_omega") == 0)
297 <          {
298 <            if (args_info->r_omega_given)
299 <              {
300 <                fprintf (stderr, "%s: `--r_omega' option given more than once\n", CMDLINE_PARSER_PACKAGE);
301 <                clear_args ();
302 <                exit (EXIT_FAILURE);
303 <              }
304 <            args_info->r_omega_given = 1; staticProps_group_counter += 1;
297 >            {
298 >              if (args_info->r_omega_given)
299 >                {
300 >                  fprintf (stderr, "%s: `--r_omega' option given more than once\n", CMDLINE_PARSER_PACKAGE);
301 >                  clear_args ();
302 >                  exit (EXIT_FAILURE);
303 >                }
304 >              args_info->r_omega_given = 1; staticProps_group_counter += 1;
305            
306 <            break;
307 <          }
306 >              break;
307 >            }
308            
309            /* g(cos(theta), cos(omega)).  */
310            else if (strcmp (long_options[option_index].name, "theta_omega") == 0)
311 <          {
312 <            if (args_info->theta_omega_given)
313 <              {
314 <                fprintf (stderr, "%s: `--theta_omega' option given more than once\n", CMDLINE_PARSER_PACKAGE);
315 <                clear_args ();
316 <                exit (EXIT_FAILURE);
317 <              }
318 <            args_info->theta_omega_given = 1; staticProps_group_counter += 1;
311 >            {
312 >              if (args_info->theta_omega_given)
313 >                {
314 >                  fprintf (stderr, "%s: `--theta_omega' option given more than once\n", CMDLINE_PARSER_PACKAGE);
315 >                  clear_args ();
316 >                  exit (EXIT_FAILURE);
317 >                }
318 >              args_info->theta_omega_given = 1; staticProps_group_counter += 1;
319            
320 <            break;
321 <          }
320 >              break;
321 >            }
322            
323            /* g(x, y, z).  */
324            else if (strcmp (long_options[option_index].name, "gxyz") == 0)
325 <          {
326 <            if (args_info->gxyz_given)
327 <              {
328 <                fprintf (stderr, "%s: `--gxyz' option given more than once\n", CMDLINE_PARSER_PACKAGE);
329 <                clear_args ();
330 <                exit (EXIT_FAILURE);
331 <              }
332 <            args_info->gxyz_given = 1; staticProps_group_counter += 1;
325 >            {
326 >              if (args_info->gxyz_given)
327 >                {
328 >                  fprintf (stderr, "%s: `--gxyz' option given more than once\n", CMDLINE_PARSER_PACKAGE);
329 >                  clear_args ();
330 >                  exit (EXIT_FAILURE);
331 >                }
332 >              args_info->gxyz_given = 1; staticProps_group_counter += 1;
333            
334 <            break;
335 <          }
334 >              break;
335 >            }
336            
337  
338          case '?':       /* Invalid option.  */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines