diff --git a/ex00/main.c b/ex00/main.c index f3a3bc4..c65d115 100644 --- a/ex00/main.c +++ b/ex00/main.c @@ -6,7 +6,7 @@ /* By: jtorrez- +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 int main(int argc, char *argv[]) { int width; @@ -31,21 +32,21 @@ int main(int argc, char *argv[]) ft_putstr("Usage: "); ft_putstr(argv[0]); ft_putstr(" [WIDTH HEIGHT]\n"); - return (1); } - width = ft_atoi(argv[1]); - height = ft_atoi(argv[2]); + 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); - } - rush(width, height); + else + rush(width, height); return (0); } diff --git a/ex00/rush00 b/ex00/rush00 new file mode 100755 index 0000000..72d3d3b Binary files /dev/null and b/ex00/rush00 differ