piscine-rush00-ultra/main.c

41 lines
1.5 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jtorrez- <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/18 20:15:26 by jtorrez- #+# #+# */
/* Updated: 2023/03/19 03:46:33 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
#include "include/ft_lib.h"
#include "include/arghandle.h"
#include "include/rush0X.h"
int main(int argc, char *argv[])
{
int width;
int max_width;
int height;
int max_height;
if (argc != 3)
{
wrong_argc(2, argc - 1);
usage(argv[0]);
return (1);
}
max_width = get_dim("cols", g_default_max_width);
max_height = get_dim("lines", g_default_max_height);
width = ft_atoi(argv[1]);
height = ft_atoi(argv[2]);
if (width > max_width)
return (wrong_dimension("width", max_width, width));
else if (height > max_height - 2)
return (wrong_dimension("height", max_height - 2, height));
rush(width, height);
return (0);
}