aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/rc/exec.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-04-22 08:55:35 -0700
committerNicholas Noll <nbnoll@eml.cc>2021-04-22 08:55:35 -0700
commit5d3642b8ef920316693031d2ea34b9def0b1abc5 (patch)
tree8100890ed5b2e4ecdbde09615e0820346ccc3f41 /sys/cmd/rc/exec.c
parente30f8b22069bec1a3fb68f089a9a7198671eb09a (diff)
chore: rm unfinished projects
Diffstat (limited to 'sys/cmd/rc/exec.c')
-rw-r--r--sys/cmd/rc/exec.c139
1 files changed, 0 insertions, 139 deletions
diff --git a/sys/cmd/rc/exec.c b/sys/cmd/rc/exec.c
deleted file mode 100644
index d4822a7..0000000
--- a/sys/cmd/rc/exec.c
+++ /dev/null
@@ -1,139 +0,0 @@
-#include "rc.h"
-
-#define W0 shell->stack->words
-// -----------------------------------------------------------------------
-// helper functions
-
-static
-void
-setstatus(char *s)
-{
- setvar("status", newword(s, nil));
-}
-
-static
-void
-pushredir(int type, int from, int to)
-{
- Redir *r;
-
- alloc(r);
- r->type = type;
- r->from = from;
- r->to = to;
- r->link = shell->redir, shell->redir = r;
-}
-
-// -----------------------------------------------------------------------
-// interpreter functions
-
-void
-Xerror(char *s)
-{
- if(!strcmp(argv0, "rc")||!strcmp(argv0, "/bin/rc"))
- pfmt(errio, "rc: %s: %r\n", s);
- else
- pfmt(errio, "rc (%s): %s: %r\n", argv0, s);
- flush(&errio);
-
- setstatus("error");
- while(!shell->interactive)
- Xkill();
-}
-
-void
-Xappend(void)
-{
- int fd;
- char *path;
-
- switch(count(W0)) {
- default:
- Xerror(">> requires a singleton list");
- return;
- case 0:
- Xerror(">> requires one file");
- return;
- case 1:
- ;
- }
-
- path = shell->stack->words->word;
- if ((fd=open(path, 1))< 0 && (fd=creat(path, 0666L))<0) {
- pfmt(errio, "%s: ", path);
- Xerror("can't open");
- return;
- }
- lseek(fd, 0L, 2);
- pushredir(Fopen, fd, shell->ip++->i);
- poplist();
-}
-
-void
-Xassign(void)
-{
- Var *v;
- if(count(W0)!=1) {
- Xerror("variable name not singleton");
- return;
- }
- unglob(W0->word);
- v = vlookup(W0->word);
- poplist();
- globlist();
- freelist(v->val);
-
- v->val = W0;
- if(v->update)
- v->update(v);
- W0 = nil;
- poplist();
-}
-
-void
-Xmark(void)
-{
- pushlist();
-}
-
-void
-Xword(void)
-{
- pushword(shell->ip++->s);
-}
-
-void Xasync(void);
-void Xcat(void);
-void Xclose(void);
-void Xcmdsub(void);
-void Xcount(void);
-void Xdol(void);
-void Xdup(void);
-void Xexit(void);
-void Xfalse(void);
-void Xflatten(void);
-void Xfor(void);
-void Xfunc(void);
-void Xglob(void);
-void Xif(void);
-void Xjump(void);
-void Xkill(void);
-void Xlocal(void);
-void Xmark(void);
-void Xmatch(void);
-void Xnegate(void);
-void Xpipe(void);
-void Xpipefd(void);
-void Xpipewait(void);
-void Xpop(void);
-void Xpopredir(void);
-void Xrdwr(void);
-void Xread(void);
-void Xsub(void);
-void Xsimple(void);
-void Xsubshell(void);
-void Xtrue(void);
-void Xunfunc(void);
-void Xunlocal(void);
-void Xword(void);
-void Xwrite(void);