diff options
| author | Lucas Faria Mendes <lucas.oliveira1676@etec.sp.gov.br> | 2025-12-05 06:16:30 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.oliveira1676@etec.sp.gov.br> | 2025-12-05 06:16:30 +0000 |
| commit | b7b730364ca00b95b3c4c46422dbc0a16317df27 (patch) | |
| tree | aa42d7c4ac5b424ae9266254cb5cd61a4b5da9e8 /src/builtins.zig | |
| parent | 8f90c47b28b235cc4292342900765987af5bf768 (diff) | |
| download | shell-zig-b7b730364ca00b95b3c4c46422dbc0a16317df27.tar.gz shell-zig-b7b730364ca00b95b3c4c46422dbc0a16317df27.zip | |
codecrafters submit [skip ci]
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index 1326b98..409b57d 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -29,7 +29,11 @@ pub fn executeEcho(stdout: anytype, args: ?[]const u8) !void { var last_was_space = false; while (i < a.len) : (i += 1) { - if (!in_quote and (a[i] == '\'' or a[i] == '"')) { + if (!in_quote and a[i] == '\\' and i + 1 < a.len) { + i += 1; + _ = unquoted.append(std.heap.page_allocator, a[i]) catch {}; + last_was_space = false; + } else if (!in_quote and (a[i] == '\'' or a[i] == '"')) { in_quote = true; quote_char = a[i]; last_was_space = false; |