got a working sort

This commit is contained in:
vagrant
2019-03-06 16:20:33 +00:00
parent 428525b561
commit 2d351417dc
3 changed files with 36 additions and 31 deletions

View File

@@ -6,7 +6,7 @@
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/23 13:35:15 by tmaze #+# #+# */
/* Updated: 2019/03/02 18:28:08 by tmaze ### ########.fr */
/* Updated: 2019/03/06 16:08:02 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
@@ -48,12 +48,14 @@ int read_ops(t_psdata *data)
int ret;
ft_memset(buff, '\0', 5);
while ((ret = read(1, buff, 4)) > 0)
while ((ret = read(0, buff, 4)) > 0)
{
printf("buff '%s'\n", buff);
buff[ft_strlen(buff) - 1] = '\0';
printf("buff '%s'\n", buff);
if (ret > 4 || !is_op(buff) || (nop = ft_lstnew(buff, 4)) == NULL)
{
ft_putendl_fd("Error", 2);
dprintf(2, "Error op %d %d '%s'", ret > 4, !is_op(buff), buff);
return (1);
}
ft_lstaddend(&(data->op), nop);