aboutsummaryrefslogtreecommitdiff
path: root/src/mazerator.c
diff options
context:
space:
mode:
authorHampus <hampus@hampusmat.com>2022-01-05 21:45:49 +0100
committerHampus <hampus@hampusmat.com>2022-01-05 21:45:49 +0100
commitdc78467ebc7df9bfad81ed6e30f74139440ab159 (patch)
treeccabc47e358bfe09fb71aca6352f499713e24479 /src/mazerator.c
parent6b1f6cf3b7685eed5fb9e24b18c479d842c4043c (diff)
fix: add better number handling
Diffstat (limited to 'src/mazerator.c')
-rw-r--r--src/mazerator.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mazerator.c b/src/mazerator.c
index 8224fb9..593d518 100644
--- a/src/mazerator.c
+++ b/src/mazerator.c
@@ -72,6 +72,9 @@ int main(int argc, char *argv[])
if (err != NULL)
optarg_error(arg, err);
+ if (maze_width == 0)
+ optarg_error(arg, "It should not be 0");
+
break;
case 'h':
maze_height = str_to_uint(optarg, &err);
@@ -79,6 +82,9 @@ int main(int argc, char *argv[])
if (err != NULL)
optarg_error(arg, err);
+ if (maze_height == 0)
+ optarg_error(arg, "It should not be 0");
+
break;
case 'x':
start_x = malloc_s(sizeof(unsigned int *));
@@ -106,6 +112,9 @@ int main(int argc, char *argv[])
if (err != NULL)
optarg_error(arg, err);
+ if (*seed == 0)
+ optarg_error(arg, "It should not be 0");
+
break;
case 0:
printf("Usage: %s [OPTION]...\n\n"
@@ -119,7 +128,7 @@ int main(int argc, char *argv[])
" -W, --wall WALL Single character used as maze walls "
"(Default: '█')\n"
" -s, --seed SEED The randomization seed used for maze "
- "generation (Any number)\n"
+ "generation\n"
" --help Displays usage information\n",
argv[0]);
exit(0);