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
ce8e06f665
commit
8ba13c02d5
4 changed files with 41 additions and 3 deletions
1
Makefile
1
Makefile
|
|
@ -93,6 +93,7 @@ srcs = \
|
||||||
src/parser/wordsplit/tokenizing_6_10.c \
|
src/parser/wordsplit/tokenizing_6_10.c \
|
||||||
src/parser/wordsplit/wordsplit.c \
|
src/parser/wordsplit/wordsplit.c \
|
||||||
src/parser/wordsplit/wordsplit_utils.c \
|
src/parser/wordsplit/wordsplit_utils.c \
|
||||||
|
src/postprocess/ambiguous_redirect.c \
|
||||||
src/postprocess/expansion/expand_vars.c \
|
src/postprocess/expansion/expand_vars.c \
|
||||||
src/postprocess/expansion/expand_wildcard.c \
|
src/postprocess/expansion/expand_wildcard.c \
|
||||||
src/postprocess/fieldsplit/fieldsplit.c \
|
src/postprocess/fieldsplit/fieldsplit.c \
|
||||||
|
|
|
||||||
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> +#+ +:+ +#+ */
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/21 11:54:16 by khais #+# #+# */
|
/* Created: 2025/04/21 11:54:16 by khais #+# #+# */
|
||||||
/* Updated: 2025/04/21 11:57:50 by khais ### ########.fr */
|
/* Updated: 2025/04/21 14:25:13 by khais ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
#include "fieldsplit.h"
|
#include "fieldsplit.h"
|
||||||
#include "../../parser/redirect/redirect.h"
|
#include "../../parser/redirect/redirect.h"
|
||||||
#include "../../parser/cmd/cmd_destroy.h"
|
#include "../../parser/cmd/cmd_destroy.h"
|
||||||
|
#include "../ambiguous_redirect.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
static void redirect_fieldsplit_cleanup(t_redirect *in_list,
|
static void redirect_fieldsplit_cleanup(t_redirect *in_list,
|
||||||
|
|
@ -39,8 +40,7 @@ static t_simple_cmd *redirect_fieldsplit_single(t_redirect *in_list,
|
||||||
current->redirectee.filename = wordlist_pop(&out);
|
current->redirectee.filename = wordlist_pop(&out);
|
||||||
if (out != NULL)
|
if (out != NULL)
|
||||||
{
|
{
|
||||||
ft_dprintf(STDERR_FILENO, "minishell: %s: ambiguous redirect\n",
|
ambiguous_redirect(current->unexpanded_filename);
|
||||||
current->unexpanded_filename);
|
|
||||||
redirect_fieldsplit_cleanup(in_list, out_list, current, cmd);
|
redirect_fieldsplit_cleanup(in_list, out_list, current, cmd);
|
||||||
return (wordlist_destroy(out), NULL);
|
return (wordlist_destroy(out), NULL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue