fix: merging all the code

This commit is contained in:
Matteo Flebus 2026-01-15 18:49:42 +01:00
parent 2e9e98d343
commit 1eecb1bd42
12 changed files with 86 additions and 61 deletions

View file

@ -14,15 +14,15 @@
// return iter - start;
// }
struct ast_cmd *expand(struct ast_cmd *cmd)
struct ast_command *expand(struct ast_command *command)
{
if (cmd == NULL)
if (command == NULL)
return NULL;
bool in_quotes = false;
char *str;
size_t len;
struct list *l = cmd->cmd;
struct list *l = command->command;
while (l != NULL)
{
@ -69,19 +69,19 @@ struct ast_cmd *expand(struct ast_cmd *cmd)
l = l->next;
}
return cmd;
return command;
}
// int main()
// {
// printf("Expansion module test\n");
// struct ast_cmd ast_cmd;
// struct ast_command ast_command;
// // char str[] = "echo Hello $?";
// char str[] = "echo Hello $AE86";
// ast_cmd.cmd = list_append(NULL, str);
// ast_command.command = list_append(NULL, str);
// struct ast_cmd *cmd2 = expand(&ast_cmd);
// printf("cmd2: %s\n", (char *)cmd2->cmd->data);
// struct ast_command *command2 = expand(&ast_command);
// printf("command2: %s\n", (char *)command2->command->data);
// return 0;
// }