aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/rc/main.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-10-15 16:18:02 -0700
committerNicholas Noll <nbnoll@eml.cc>2021-10-15 16:18:02 -0700
commitbf03074e346b004659196b6c17eee04dbffd3ac2 (patch)
tree7200db30f1ef7e3661091552932eb304bd4ce9c6 /sys/cmd/rc/main.c
parent566d54fe549286895fdef8aa9f385686405dd290 (diff)
feat(rc): working prototype of input->compile->print loop
Diffstat (limited to 'sys/cmd/rc/main.c')
-rw-r--r--sys/cmd/rc/main.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/sys/cmd/rc/main.c b/sys/cmd/rc/main.c
new file mode 100644
index 0000000..46a4e0f
--- /dev/null
+++ b/sys/cmd/rc/main.c
@@ -0,0 +1,47 @@
+#include "rc.h"
+#include "parse.h"
+#include "exec.h"
+
+int rcpid;
+Io *errio = nil;
+Thread *shell = nil;
+
+int
+main(int argc, char *argv[])
+{
+ int i;
+ Code bootstrap[32];
+ char num[12];
+
+ errio = openfd(2);
+
+ initenv();
+ initpath();
+
+ itoa(num, rcpid = getpid());
+ setvar("pid", makeword(num, nil));
+
+ xboot(argc, argv);
+#if 0
+ Thread root = {
+ .cmd = {
+ .path = "<nil>",
+ .io = openfd(0),
+ },
+ .line = 0,
+ .flag = {
+ .i = 1,
+ .eof = 0,
+ },
+ };
+
+ shell = &root;
+ errio = openfd(2);
+#if 1
+ while(!yyparse())
+ ;
+#else
+ printkeycode()
+#endif
+#endif
+}