aboutsummaryrefslogtreecommitdiff
path: root/mazerator.c
diff options
context:
space:
mode:
Diffstat (limited to 'mazerator.c')
-rw-r--r--mazerator.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/mazerator.c b/mazerator.c
index 6c24ec0..9b2e434 100644
--- a/mazerator.c
+++ b/mazerator.c
@@ -123,20 +123,15 @@ int main(int argc, char *argv[])
while((c = getopt_long(argc, argv, "w:h:W:s:", options, NULL)) != -1) {
switch(c){
case 'w':
- // Set Width
- if(is_number(optarg) && atoi(optarg) >= 1 && atoi(optarg) <= 255)
- maze_width = atoi(optarg);
- else{
- printf("Invalid option argument for -w/--width!\n");
- exit(1);
- }
- break;
case 'h':
- // Set heigth
+ // Set heigth or width
if(is_number(optarg) && atoi(optarg) >= 1 && atoi(optarg) <= 255)
- maze_heigth = atoi(optarg);
+ switch(c){
+ case 'h': maze_heigth = atoi(optarg);
+ case 'w': maze_width = atoi(optarg);
+ }
else{
- printf("Invalid option argument for -h/--heigth!\n");
+ printf("Invalid option argument for -%c!\n", c);
exit(1);
}
break;