aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/rc/sys.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-11-16 12:08:59 -0800
committerNicholas Noll <nbnoll@eml.cc>2021-11-16 12:08:59 -0800
commit29138fff8643194ec49cb79304d2a878d46c378b (patch)
tree04f46762380d84994ec821cec13f1ff8288d46fc /src/cmd/rc/sys.c
parente4f9b993e97b6e6e790810b6d261dc5bf61b0513 (diff)
Feat: added heredocs
Heredocs are simply strings written to tmp files. There was minimal bug testing here. Also, various bug fixes are included
Diffstat (limited to 'src/cmd/rc/sys.c')
-rw-r--r--src/cmd/rc/sys.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/cmd/rc/sys.c b/src/cmd/rc/sys.c
index 807359d..a845122 100644
--- a/src/cmd/rc/sys.c
+++ b/src/cmd/rc/sys.c
@@ -94,24 +94,24 @@ execute(Word *cmd, Word *path)
void
redirect(Redir *r)
{
- if(r){
- redirect(r->link);
- switch(r->type){
- case Ropen:
- if(r->from != r->to){
- dup2(r->from, r->to);
- close(r->from);
- }
- break;
- case Rdupfd:
- dup2(r->from, r->to); // TODO: error checking
- break;
- case Rclose:
+ if(!r) return;
+ redirect(r->link);
+
+ switch(r->type){
+ case Ropen:
+ if(r->from != r->to){
+ dup2(r->from, r->to);
close(r->from);
- break;
- default:
- fatal("unrecognized redirection type %d\n", r->type);
}
+ break;
+ case Rdup:
+ dup2(r->from, r->to); // TODO: error checking
+ break;
+ case Rclose:
+ close(r->from);
+ break;
+ default:
+ fatal("unrecognized redirection type %d\n", r->type);
}
}