aboutsummaryrefslogtreecommitdiff
path: root/src/format_string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format_string.c')
-rw-r--r--src/format_string.c12
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);