mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
here_doc: null marker returns error
This commit is contained in:
parent
99babbf6d2
commit
442aa85e84
3 changed files with 28 additions and 3 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/07 11:42:29 by khais #+# #+# */
|
/* Created: 2025/03/07 11:42:29 by khais #+# #+# */
|
||||||
/* Updated: 2025/03/11 11:22:54 by khais ### ########.fr */
|
/* Updated: 2025/03/11 11:24:30 by khais ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -55,3 +55,17 @@ char *here_doc_random_filename(void)
|
||||||
close(randomfd);
|
close(randomfd);
|
||||||
return (ft_buffer_to_charptr(filename));
|
return (ft_buffer_to_charptr(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Read from STDIN into some file until a line that is exactly equal to the
|
||||||
|
** marker is read.
|
||||||
|
**
|
||||||
|
** Then unlink the file, and return a filedescriptor to it, seeked to the start.
|
||||||
|
**
|
||||||
|
** If NULL is given as argument, or any other error occurs, return -1.
|
||||||
|
*/
|
||||||
|
int here_doc(t_worddesc *marker)
|
||||||
|
{
|
||||||
|
(void)marker;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,16 @@
|
||||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/07 11:41:27 by khais #+# #+# */
|
/* Created: 2025/03/07 11:41:27 by khais #+# #+# */
|
||||||
/* Updated: 2025/03/11 10:58:19 by khais ### ########.fr */
|
/* Updated: 2025/03/11 11:18:47 by khais ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef HERE_DOC_H
|
#ifndef HERE_DOC_H
|
||||||
# define HERE_DOC_H
|
# define HERE_DOC_H
|
||||||
|
|
||||||
|
# include "../../parser/worddesc/worddesc.h"
|
||||||
|
|
||||||
|
int here_doc(t_worddesc *marker);
|
||||||
char *here_doc_random_filename(void);
|
char *here_doc_random_filename(void);
|
||||||
|
|
||||||
#endif // HERE_DOC_H
|
#endif // HERE_DOC_H
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/07 11:43:32 by khais #+# #+# */
|
/* Created: 2025/03/07 11:43:32 by khais #+# #+# */
|
||||||
/* Updated: 2025/03/10 18:23:36 by khais ### ########.fr */
|
/* Updated: 2025/03/11 11:19:16 by khais ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -34,7 +34,15 @@ static void test_here_doc_filename_generation(void)
|
||||||
do_leak_check();
|
do_leak_check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_here_doc_null_args(void)
|
||||||
|
{
|
||||||
|
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
|
||||||
|
assert(-1 == here_doc(NULL));
|
||||||
|
do_leak_check();
|
||||||
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
test_here_doc_filename_generation();
|
test_here_doc_filename_generation();
|
||||||
|
test_here_doc_null_args();
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue