This commit is contained in:
Timo Schmidt 2023-03-19 17:42:11 +01:00
parent 948354d97a
commit 826f885936
2 changed files with 14 additions and 13 deletions

View File

@ -6,7 +6,7 @@
/* By: jtorrez- <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/18 20:15:26 by jtorrez- #+# #+# */
/* Updated: 2023/03/19 17:13:50 by tischmid ### ########.fr */
/* Updated: 2023/03/19 17:20:41 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,10 +17,11 @@ void ft_putstr(char *str);
// Entry point of the program
// Parses the program arguments and fails if the number of passed
// arguments is not 2.
// arguments is not 2 or 0.
// Also fails if the passed arguments are out of
// bounds (200 for width, 100 for height).
// argv[0] contains the path of the executable, eg ./rush00
#include <stdio.h>
int main(int argc, char *argv[])
{
int width;
@ -31,20 +32,20 @@ int main(int argc, char *argv[])
ft_putstr("Usage: ");
ft_putstr(argv[0]);
ft_putstr(" [WIDTH HEIGHT]\n");
return (1);
}
if (argc == 1)
{
width = ft_atoi(argv[1]);
height = ft_atoi(argv[2]);
}
else
width = 5;
height = 3;
if (width >= 200)
{
ft_putstr("Width must be less than 200\n");
return (2);
}
if (height >= 100)
{
else if (height >= 100)
ft_putstr("Height must be less than 100\n");
return (3);
}
else
rush(width, height);
return (0);
}

BIN
ex00/rush00 Executable file

Binary file not shown.