mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
refactor(redirect): ambiguous redirect message to own file
This commit is contained in:
parent
2dd20b21bc
commit
920ad586e1
4 changed files with 41 additions and 3 deletions
19
src/postprocess/ambiguous_redirect.c
Normal file
19
src/postprocess/ambiguous_redirect.c
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ambiguous_redirect.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/21 14:24:00 by khais #+# #+# */
|
||||
/* Updated: 2025/04/21 14:25:27 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ambiguous_redirect.h"
|
||||
#include "libft.h"
|
||||
|
||||
void ambiguous_redirect(char *original)
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "minishell: %s: ambiguous redirect\n", original);
|
||||
}
|
||||
18
src/postprocess/ambiguous_redirect.h
Normal file
18
src/postprocess/ambiguous_redirect.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ambiguous_redirect.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/21 14:23:49 by khais #+# #+# */
|
||||
/* Updated: 2025/04/21 14:25:25 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef AMBIGUOUS_REDIRECT_H
|
||||
# define AMBIGUOUS_REDIRECT_H
|
||||
|
||||
void ambiguous_redirect(char *original);
|
||||
|
||||
#endif // AMBIGUOUS_REDIRECT_H
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/21 11:54:16 by khais #+# #+# */
|
||||
/* Updated: 2025/04/23 11:17:03 by khais ### ########.fr */
|
||||
/* Updated: 2025/04/23 11:19:26 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
#include "fieldsplit.h"
|
||||
#include "../../parser/redirect/redirect.h"
|
||||
#include "../../parser/cmd/cmd_destroy.h"
|
||||
#include "../ambiguous_redirect.h"
|
||||
#include <unistd.h>
|
||||
|
||||
static void redirect_fieldsplit_cleanup(t_redirect *in_list,
|
||||
|
|
@ -40,8 +41,7 @@ static t_simple_cmd *redirect_fieldsplit_single(t_redirect *in_list,
|
|||
current->redirectee.filename = wordlist_pop(&out);
|
||||
if (out != NULL)
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "minishell: %s: ambiguous redirect\n",
|
||||
current->unexpanded_filename);
|
||||
ambiguous_redirect(current->unexpanded_filename);
|
||||
redirect_fieldsplit_cleanup(in_list, out_list, current, cmd);
|
||||
return (wordlist_destroy(out), NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue