From ac4278405b7a258010219499cccc0dd978201caf Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Mon, 28 Sep 2020 15:02:51 +0200 Subject: Added argument error reporting --- philo_one/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'philo_one/main.c') diff --git a/philo_one/main.c b/philo_one/main.c index b43c0fe..83b5564 100644 --- a/philo_one/main.c +++ b/philo_one/main.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/24 05:53:02 by cacharle #+# #+# */ -/* Updated: 2020/09/27 10:36:40 by charles ### ########.fr */ +/* Updated: 2020/09/28 14:59:59 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,6 +21,8 @@ int main(int argc, char **argv) if (!parse_args(&philo_args, argc, argv)) return (1); + if (philo_args.philo_num < 2) + return (h_err(1, "Error: there should be at least 2 philosophers")); if ((forks = forks_new(philo_args.philo_num)) == NULL) return (1); if ((philos = philos_new(philo_args.philo_num)) == NULL) -- cgit