mirror of
https://github.com/Savapitech/42sh.git
synced 2026-03-18 21:50:35 +01:00
[FIX] inhibitors
This commit is contained in:
@@ -101,7 +101,7 @@ bool compare_to_close(ast_ctx_t *ctx, token_t acutal_tok)
|
||||
if (!*ctx->str && !(*ctx->str + 1))
|
||||
return false;
|
||||
for (size_t i = 0; i < TOKENS_LIST_SZ; i++) {
|
||||
if (u_strncmp(ctx->str, TOKENS_LIST[i].str,
|
||||
if (u_strncmp((ctx->str + 1), TOKENS_LIST[i].str,
|
||||
TOKENS_LIST[i].sz) == 0) {
|
||||
token = TOKENS_LIST[i].type;
|
||||
break;
|
||||
|
||||
@@ -96,13 +96,12 @@ bool format_quotes(ast_t *node, char be_matched, size_t *i)
|
||||
if (isblank(last_quote[1]) || be_matched == '`'){
|
||||
last_quote[0] = '\0';
|
||||
return true;
|
||||
} else
|
||||
node->vector.tokens[*i].str[node->vector.tokens[*i].sz - 1] = '\0';
|
||||
}
|
||||
memmove(&last_quote[0], &last_quote[1], strlen(last_quote));
|
||||
last_quote = strchr(node->vector.tokens[*i].str, be_matched);
|
||||
if (strchr(node->vector.tokens[*i].str, be_matched))
|
||||
return (fprintf(stderr, "Unmatched \'%c\'.\n", be_matched), false);
|
||||
node->vector.tokens[*i].str[node->vector.tokens[*i].sz - 2] = '\0';
|
||||
node->vector.tokens[*i].str[node->vector.tokens[*i].sz] = '\0';
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -115,8 +114,7 @@ bool check_quotes(ast_t *node, size_t *i, exec_ctx_t *ctx, args_t *args)
|
||||
return true;
|
||||
if (node->vector.tokens[*i].sz == 1)
|
||||
return (fprintf(stderr, "Unmatched \'%c\'.\n", be_matched), true);
|
||||
memmove(&node->vector.tokens[*i].str[0],
|
||||
&node->vector.tokens[*i].str[1], node->vector.tokens[*i].sz);
|
||||
node->vector.tokens[*i].str++;
|
||||
if (!format_quotes(node, be_matched, i))
|
||||
return true;
|
||||
if (be_matched == '`')
|
||||
|
||||
Reference in New Issue
Block a user