diff options
author | dzwdz | 2022-07-28 18:06:23 +0200 |
---|---|---|
committer | dzwdz | 2022-07-28 18:06:23 +0200 |
commit | a0b16620e1699504e8d21a481e019dec40d7ee1b (patch) | |
tree | 657835c863dc5cf88d003af29fa9b7836f728cd6 /src/user/app/shell/parser.c | |
parent | 473cc957826064840bce7a5c5ff97614e0c6cb9e (diff) |
user/shell: redirections
Diffstat (limited to 'src/user/app/shell/parser.c')
-rw-r--r-- | src/user/app/shell/parser.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/user/app/shell/parser.c b/src/user/app/shell/parser.c index 878202d..31c45d1 100644 --- a/src/user/app/shell/parser.c +++ b/src/user/app/shell/parser.c @@ -48,19 +48,24 @@ static char *parg(char **sp) { return res; } -int parse(char *s, char **argv, size_t argvlen, char **redir) { +int parse(char *s, char **argv, size_t argvlen, struct redir *redir) { if (argvlen == 0) return -1; size_t argc = 0; char *arg; *argv = NULL; - *redir = NULL; + redir->stdout = NULL; + redir->append = false; while (skipspace(&s)) { switch (*s) { case '>': s++; - *redir = parg(&s); + if (*s == '>') { + s++; + redir->append = true; + } + redir->stdout = parg(&s); break; default: arg = parg(&s); |