recherche du pbm dans heredoc

This commit is contained in:
hugogogo
2021-12-05 14:16:11 +01:00
parent 0171de26e9
commit 10a8ecaae8
6 changed files with 20 additions and 54 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */
/* Updated: 2021/12/05 09:28:00 by hulamy ### ########.fr */
/* Updated: 2021/12/05 14:09:43 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -19,7 +19,6 @@ int exec_cmd_line(t_all *c)
free_pipeline(&c->pipeline);
return (0);
}
//write(1, "here\n", 5);
return (1);
}

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/24 10:52:40 by lperrey #+# #+# */
/* Updated: 2021/12/04 16:06:48 by hulamy ### ########.fr */
/* Updated: 2021/12/05 14:02:10 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/11 18:46:43 by lperrey #+# #+# */
/* Updated: 2021/12/05 10:58:56 by hulamy ### ########.fr */
/* Updated: 2021/12/05 14:15:09 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -117,31 +117,3 @@ static int here_doc_write(char *delimiter, int doc_fd)
sigaction(SIGINT, &signal_action, NULL);
return (0);
}
/*
static int here_doc_write(char *delimiter, int doc_fd)
{
char *line;
int ret;
line = NULL;
ret = 1;
while (ret)
{
ret = gnl(STDIN_FILENO, &line, 0);
if (ret == -1)
return (ft_reti_perror_free(0, line, free, "gnl() STDIN"));
if (ft_strncmp(line, delimiter, ft_strlen(line) + 1) == 0) // Ou ft_strlen(delimiter) + 1 ? Ça devrais être identique et ça peux se calculer une seul fois.
break ;
if (write(doc_fd, line, ft_strlen(line)) == -1)
return (ft_reti_perror_free(0, line, free, "write() "TMP_HERE_DOC));
if (write(doc_fd, "\n", 1) == -1)
return (ft_reti_perror_free(0, line, free, "write() "TMP_HERE_DOC));
free(line);
line = NULL;
}
free(line);
gnl(STDIN_FILENO, NULL, 1);
return (1);
}
*/

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/11 18:46:43 by lperrey #+# #+# */
/* Updated: 2021/12/04 16:05:46 by hulamy ### ########.fr */
/* Updated: 2021/12/05 14:00:22 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/04 05:59:26 by lperrey #+# #+# */
/* Updated: 2021/12/04 16:08:48 by hulamy ### ########.fr */
/* Updated: 2021/12/05 14:15:18 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -23,9 +23,6 @@ void shell_loop(t_all *c)
{
if (line_input)
free(line_input);
write(2, c->prompt, ft_strlen(c->prompt));
rl_already_prompted = 1;
// line_input = read_input(NULL, c);
line_input = read_input(c->prompt, c);
if (line_input && *line_input)
{