From 5ecb8aafa496e9dfff51378be50eb29858b5465a Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Wed, 15 Feb 2023 16:35:40 +0100 Subject: add quote parsing to smash --- smash/parser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'smash/parser.c') 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; -- cgit v1.2.3-70-g09d2