aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <dbphillipsnz@gmail.com>2016-04-08 12:56:14 +1200
committerDavid Phillips <dbphillipsnz@gmail.com>2016-04-08 12:56:14 +1200
commit800eab3e52e427f40c069aea5e52a8d59bca513f (patch)
treed3249c358f0e9a564c9412c7f7133e660097eb1b
parente98797d189a0c21c88557eb58a4363cdc353f847 (diff)
downloadfractal-gen-800eab3e52e427f40c069aea5e52a8d59bca513f.tar.xz
Improve error messages for command line arguments
-rw-r--r--fractal-gen.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/fractal-gen.c b/fractal-gen.c
index cc4d6d2..7f651b6 100644
--- a/fractal-gen.c
+++ b/fractal-gen.c
@@ -194,34 +194,34 @@ bool args_parse_okay(int argc, char **argv)
/* Extend number of threads to multiplier value */
cores *= thread_mult;
- /* Interlacing is column-based, can't have more workers than columns */
- if (cores > size)
+ if (size <= 0)
{
- cores = size;
- fprintf(stderr, "WARN: Capping number of threads to image size (%d)\n", cores);
+ fprintf(stderr, "ERROR: size must be positive\n");
+ return false;
}
- if (size % clust_total != 0)
+ if (iterat <= 0)
{
- fprintf(stderr, "ERROR: image size must be an exact multiple of clust_total\n");
+ fprintf(stderr, "ERROR: max iteration count must be positive\n");
return false;
}
- if (size <= 0)
+ /* Interlacing is column-based, can't have more workers than columns */
+ if (cores > size)
{
- fprintf(stderr, "size should be positive\n");
- return false;
+ cores = size;
+ fprintf(stderr, "WARN: Capping number of threads to image size (%d)\n", cores);
}
- if (iterat <= 0)
+ if (size % clust_total != 0)
{
- fprintf(stderr, "iteration count should be positive\n");
+ fprintf(stderr, "ERROR: image size must be an exact multiple of clust_total\n");
return false;
}
if (cores <= 0)
{
- fprintf(stderr, "core counts should be positive\n");
+ fprintf(stderr, "ERROR: core counts should be positive\n");
return false;
}
return true;