aboutsummaryrefslogtreecommitdiff
path: root/smash/parser.c
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-02-15 16:35:40 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2023-02-15 16:35:40 +0100
commit5ecb8aafa496e9dfff51378be50eb29858b5465a (patch)
tree312a64f45148d03464c08f309af4a9a46a3f4ec8 /smash/parser.c
parent0d9c643920a9431870983c896fb0b45d87d88afe (diff)
add quote parsing to smash
Diffstat (limited to 'smash/parser.c')
-rw-r--r--smash/parser.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/smash/parser.c b/smash/parser.c
index 55a6fd2..a0ea9d8 100644
--- a/smash/parser.c
+++ b/smash/parser.c
@@ -11,7 +11,7 @@ void __free_argv(char **argv);
expression_list_t *new_expression_from_line(char *line)
{
- u64 n = cstr_split(line, '|');
+ u64 n = cstr_split_with_cancel(line, '|', '"');
char *current = line;
char *next = 0;
expression_list_t *head = 0;
@@ -54,7 +54,7 @@ void free_expression(expression_list_t *expression)
char **new_argv(char *exp)
{
- u64 n = cstr_split(exp, ' ');
+ u64 n = cstr_split_with_cancel(exp, ' ', '"');
char **argv = malloc(sizeof(char*) * (n + 1));
u64 i = 0;
char *current = exp;
@@ -65,6 +65,7 @@ char **new_argv(char *exp)
for (; n > 0; --n) {
next = (char*)next_split(current);
strip_cstr(current, ' ');
+ strip_cstr(current, '"');
if (cstr_length(current))
argv[i++] = current;