Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/builtins/alias.c b/src/builtins/alias.c
- index f648006..d880592 100644
- --- a/src/builtins/alias.c
- +++ b/src/builtins/alias.c
- @@ -89,4 +89,27 @@ int alias_builtin(int argc, char **args)
- return 0;
- }
- +void find_alias(expr *e)
- +{
- + if (aliases == NULL)
- + aliases = new_hash_table();
- +
- + expr *ex;
- + char **new_args;
- + int i = 0;
- +
- + ex = find_hash_key(aliases, e->args[0]);
- +
- + if (ex) {
- + new_args = new_args_list();
- +
- + while (ex->args[i]) {
- + add_arg(new_args, strdup(ex->args[i]));
- + i++;
- + }
- +
- + e->args = new_args;
- + }
- +}
- +
- #endif /* __alias_c */
- \ No newline at end of file
- diff --git a/src/eval.c b/src/eval.c
- index ada05d4..8e8c4b0 100644
- --- a/src/eval.c
- +++ b/src/eval.c
- @@ -102,6 +102,8 @@ int eval_expr(expr *e)
- pid_t pid;
- if (e->type == SIMPLE) {
- + find_alias(e);
- +
- /* That's a dirty hack !! */
- builtin = find_builtin(e->args[0]);
- if (builtin) {
Add Comment
Please, Sign In to add comment