diff options
| author | Dominik Kaiser | 2025-01-14 18:33:45 +0100 |
|---|---|---|
| committer | GitHub | 2025-01-14 18:33:45 +0100 |
| commit | 430521cc47e9f47fbd1005fade9251c31d9f3f18 (patch) | |
| tree | 14d1f541418576d565f42f0d70faf1369fc17d1b /src/format_string.c | |
| parent | da80405b345b58f9e1bd83039b1df3771b5ca193 (diff) | |
| parent | d4f3525a01f2566afed0da9209cb1c64bf188776 (diff) | |
| download | minishell-430521cc47e9f47fbd1005fade9251c31d9f3f18.tar.gz minishell-430521cc47e9f47fbd1005fade9251c31d9f3f18.zip | |
Merge pull request #28 from dpu-kaiser/uwu
Some changes
Diffstat (limited to 'src/format_string.c')
| -rw-r--r-- | src/format_string.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/format_string.c b/src/format_string.c index 7168ea0..5f31130 100644 --- a/src/format_string.c +++ b/src/format_string.c @@ -6,7 +6,7 @@ /* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/12/17 19:30:11 by chuhlig #+# #+# */ -/* Updated: 2025/01/14 14:21:36 by chuhlig ### ########.fr */ +/* Updated: 2025/01/14 18:06:17 by dkaiser ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,11 +22,11 @@ char *format_string(char *str, t_env *env) char *result; int pos; int start; - int mode; + int is_literal; pos = 0; start = 0; - mode = 0; + is_literal = 0; result = NULL; if (str == NULL) return (NULL); @@ -36,14 +36,14 @@ char *format_string(char *str, t_env *env) { append_slice(&result, str, start, pos); start = pos + 1; - mode ^= 1; + is_literal = !is_literal; } - if (str[pos] == '"' && !(mode & 1)) + if (str[pos] == '"' && !is_literal) { append_slice(&result, str, start, pos); start = pos + 1; } - if (str[pos] == '$' && !(mode & 1)) + if (str[pos] == '$' && !is_literal) { append_slice(&result, str, start, pos); append_var(&result, str, &pos, env); |
