commit 42b1dad5561fc2cc87954113f25a3699efe4ab09
parent 139f83d5c296b191100cd199b553f03636273539
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Sun, 20 Mar 2016 16:45:06 +0100
Check that the -d and -g option is not 0
The number of directions per geometry and the number of sampled
geometries cannot be null. The schiff program previously notified a not
very explicit "integration error". Now, an error message is reported on
the parsing of the invalid option.
Diffstat:
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/schiff_args.c b/src/schiff_args.c
@@ -1078,8 +1078,22 @@ schiff_args_init
res = RES_BAD_ARG;
}
break;
- case 'd': res = cstr_to_uint(optarg, &args->ndirs); break;
- case 'g': res = cstr_to_uint(optarg, &args->nrealisations); break;
+ case 'd':
+ res = cstr_to_uint(optarg, &args->ndirs);
+ if(res == RES_OK && !args->ndirs) {
+ fprintf(stderr, "%s: the number of directions cannot be null.\n",
+ argv[0]);
+ res = RES_BAD_ARG;
+ }
+ break;
+ case 'g':
+ res = cstr_to_uint(optarg, &args->nrealisations);
+ if(res == RES_OK && !args->nrealisations) {
+ fprintf(stderr, "%s: the number of realisations cannot be null.\n",
+ argv[0]);
+ res = RES_BAD_ARG;
+ }
+ break;
case 'G': res = cstr_to_uint(optarg, &args->ngeoms_dump); break;
case 'h':
print_help(argv[0]);