aboutsummaryrefslogtreecommitdiff
path: root/smash/main.c
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-02-14 09:33:29 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2023-02-14 09:33:29 +0100
commitdffe48ee9dec21e3dbcb374f938d747da8d66f12 (patch)
treef4a71f3ade01e2ece4dae580081a9834672911d5 /smash/main.c
parentcf625ea48ac09b8b484f90e5971e2d8001aa76de (diff)
add set env variables
Diffstat (limited to 'smash/main.c')
-rw-r--r--smash/main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/smash/main.c b/smash/main.c
index e36744d..cf5f47f 100644
--- a/smash/main.c
+++ b/smash/main.c
@@ -1,6 +1,7 @@
#include "exec.h"
#include "comment.h"
#include "env.h"
+#include "variable.h"
#include "../lib/sys/io.h"
#include "../lib/cstr/cstr.h"
@@ -19,6 +20,7 @@ int main(int argc, char *argv[])
int fd = STDIN_FD;
char linebuf[BUFSIZ];
char *line;
+ char *line_exec;
init_arg_env(argc, (const char**)argv);
@@ -43,12 +45,15 @@ int main(int argc, char *argv[])
remove_comment(linebuf);
line = new_line_and_replace_vars(linebuf, BUFSIZ);
- line_length = cstr_length(line);
+ line_exec = setup_variable_line_context(line);
+ line_length = cstr_length(line_exec);
if (line_length > 0) {
- exec(line);
+ exec(line_exec);
}
+ cleanup_variable_line_context();
+
free(line);
}