-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess_w.c
More file actions
36 lines (33 loc) · 1.26 KB
/
process_w.c
File metadata and controls
36 lines (33 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* process_w.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: elavrich <elavrich@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/06/17 18:23:43 by elavrich #+# #+# */
/* Updated: 2025/07/27 22:28:20 by elavrich ### ########.fr */
/* */
/* ************************************************************************** */
#include "Minishell.h"
char *process_word(char *word, t_shell *shell, int flag)
{
char *exp;
int len;
len = 0;
if (flag != EXPAND || !word)
return (word);
if (ft_strchr(word, '$') != NULL)
{
len = ft_strlen(word);
if (word[len - 1] == '$')
return (word);
exp = handle_dollar(word, shell);
if (!exp)
return (word);
}
else
return (word);
free(word);
return (exp);
}