57 lines
1.5 KiB
C
57 lines
1.5 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_door.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2016/11/04 05:24:25 by gtertysh #+# #+# */
|
||
|
/* Updated: 2016/11/04 06:11:40 by gtertysh ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include <unistd.h>
|
||
|
#include "ft_door.h"
|
||
|
|
||
|
void ft_putstr(char *str)
|
||
|
{
|
||
|
while (*str)
|
||
|
{
|
||
|
write(1, str, 1);
|
||
|
str++;
|
||
|
}
|
||
|
write(1, "\n", 1);
|
||
|
}
|
||
|
|
||
|
t_bool close_door(t_door *door)
|
||
|
{
|
||
|
ft_putstr("Door closing...");
|
||
|
door->state = CLOSE;
|
||
|
return (TRUE);
|
||
|
}
|
||
|
|
||
|
t_bool is_door_open(t_door *door)
|
||
|
{
|
||
|
ft_putstr("Door is open ?");
|
||
|
if (door->state == OPEN)
|
||
|
return (TRUE);
|
||
|
else
|
||
|
return (FALSE);
|
||
|
}
|
||
|
|
||
|
t_bool is_door_close(t_door *door)
|
||
|
{
|
||
|
ft_putstr("Door is close ?");
|
||
|
if (door->state == CLOSE)
|
||
|
return (TRUE);
|
||
|
else
|
||
|
return (FALSE);
|
||
|
}
|
||
|
|
||
|
t_bool open_door(t_door *door)
|
||
|
{
|
||
|
ft_putstr("Door opening...");
|
||
|
door->state = OPEN;
|
||
|
return (TRUE);
|
||
|
}
|