This commit is contained in:
Timo Schmidt 2023-03-19 18:11:19 +01:00
parent 826f885936
commit 6b9b87010d
2 changed files with 4 additions and 6 deletions

View File

@ -6,7 +6,7 @@
/* By: jtorrez- <marvin@42.fr> +#+ +:+ +#+ */ /* By: jtorrez- <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/18 20:15:26 by jtorrez- #+# #+# */ /* Created: 2023/03/18 20:15:26 by jtorrez- #+# #+# */
/* Updated: 2023/03/19 17:20:41 by tischmid ### ########.fr */ /* Updated: 2023/03/19 18:07:42 by tischmid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -21,26 +21,24 @@ void ft_putstr(char *str);
// Also fails if the passed arguments are out of // Also fails if the passed arguments are out of
// bounds (200 for width, 100 for height). // bounds (200 for width, 100 for height).
// argv[0] contains the path of the executable, eg ./rush00 // argv[0] contains the path of the executable, eg ./rush00
#include <stdio.h>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int width; int width;
int height; int height;
width = 5;
height = 3;
if (argc != 1 && argc != 3) if (argc != 1 && argc != 3)
{ {
ft_putstr("Usage: "); ft_putstr("Usage: ");
ft_putstr(argv[0]); ft_putstr(argv[0]);
ft_putstr(" [WIDTH HEIGHT]\n"); ft_putstr(" [WIDTH HEIGHT]\n");
} }
if (argc == 1) if (argc == 3)
{ {
width = ft_atoi(argv[1]); width = ft_atoi(argv[1]);
height = ft_atoi(argv[2]); height = ft_atoi(argv[2]);
} }
else
width = 5;
height = 3;
if (width >= 200) if (width >= 200)
ft_putstr("Width must be less than 200\n"); ft_putstr("Width must be less than 200\n");
else if (height >= 100) else if (height >= 100)

Binary file not shown.