aboutsummaryrefslogtreecommitdiff
path: root/philo_one/main.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-28 15:02:51 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-28 15:02:51 +0200
commitac4278405b7a258010219499cccc0dd978201caf (patch)
tree501b23b1874b6fa264c9b612d0fe5b5ebc9cd26a /philo_one/main.c
parentf0a36076950bf0c3356ad73382ce3d341cdb0463 (diff)
downloadphilosophers-ac4278405b7a258010219499cccc0dd978201caf.tar.gz
philosophers-ac4278405b7a258010219499cccc0dd978201caf.tar.bz2
philosophers-ac4278405b7a258010219499cccc0dd978201caf.zip
Added argument error reporting
Diffstat (limited to 'philo_one/main.c')
-rw-r--r--philo_one/main.c4
1 files changed, 3 insertions, 1 deletions
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 <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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)