aboutsummaryrefslogtreecommitdiff
path: root/philo_one/src/args.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-30 07:59:27 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-30 07:59:27 +0200
commitd7aea773431926cefb6430b948329da1662d1dee (patch)
tree984fd10acf619ee8da84e7111742399a55a02770 /philo_one/src/args.c
parentb6f4db572d7d40c178ec286373422faa2172f135 (diff)
downloadphilosophers-d7aea773431926cefb6430b948329da1662d1dee.tar.gz
philosophers-d7aea773431926cefb6430b948329da1662d1dee.tar.bz2
philosophers-d7aea773431926cefb6430b948329da1662d1dee.zip
Refactoring common lib
Diffstat (limited to 'philo_one/src/args.c')
-rw-r--r--philo_one/src/args.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/philo_one/src/args.c b/philo_one/src/args.c
deleted file mode 100644
index b7277dd..0000000
--- a/philo_one/src/args.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* ************************************************************************** */
-/* */
-/* ::: :::::::: */
-/* args.c :+: :+: :+: */
-/* +:+ +:+ +:+ */
-/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
-/* +#+#+#+#+#+ +#+ */
-/* Created: 2020/02/08 23:12:55 by cacharle #+# #+# */
-/* Updated: 2020/09/29 11:08:06 by cacharle ### ########.fr */
-/* */
-/* ************************************************************************** */
-
-#include "philo_one.h"
-
-bool parse_args(t_philo_conf *philo_args, int argc, char **argv)
-{
- if (argc != 5 && argc != 6)
- return h_err(false, "Usage: %s philosophers_num death_timeout eat_timeout sleep_timeout [meal_num]", argv[0]);
- if ((philo_args->philo_num = h_atou_strict(argv[1])) == -1
- || (philo_args->timeout_death = h_atou_strict(argv[2])) == -1
- || (philo_args->timeout_eat = h_atou_strict(argv[3])) == -1
- || (philo_args->timeout_sleep = h_atou_strict(argv[4])) == -1)
- return (false);
- if (argc == 6)
- {
- if ((philo_args->meal_num = h_atou_strict(argv[5])) == -1)
- return (false);
- }
- else
- philo_args->meal_num = 1;
- return (true);
-}