summaryrefslogtreecommitdiff
path: root/6/main.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-05-24 13:23:12 -0400
committerOri Bernstein <ori@eigenstate.org>2014-05-24 13:23:12 -0400
commit1813b4c97ae6b43914fc39b804abf40309071acd (patch)
tree2e5df4d0b4b4924164ed69cbfb317a912b49236f /6/main.c
parentda52a8bf41174d1483c6094a339be759741df877 (diff)
downloadmc-1813b4c97ae6b43914fc39b804abf40309071acd.tar.gz
6m now generates usefiles.
This should simplify and speed things up.
Diffstat (limited to '6/main.c')
-rw-r--r--6/main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/6/main.c b/6/main.c
index 3addf57..408507a 100644
--- a/6/main.c
+++ b/6/main.c
@@ -8,6 +8,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
+#include <err.h>
#include "parse.h"
#include "opt.h"
@@ -68,6 +69,19 @@ static char *gentemp(char *buf, size_t bufsz, char *path, char *suffix)
return buf;
}
+static void genuse(char *path)
+{
+ FILE *f;
+ char buf[1024];
+
+ swapsuffix(buf, sizeof buf, path, ".myr", ".use");
+ f = fopen(buf, "w");
+ if (!f)
+ err(1, "Could not open path %s\n", buf);
+ writeuse(f, file);
+ fclose(f);
+}
+
int main(int argc, char **argv)
{
int opt;
@@ -129,6 +143,7 @@ int main(int argc, char **argv)
}
gen(file, buf);
assem(buf, argv[i]);
+ genuse(argv[i]);
}
return 0;