summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2012-08-19 12:35:21 -0400
committerOri Bernstein <ori@eigenstate.org>2012-08-19 12:35:21 -0400
commitfa9b8ec335f027943f5757503b2c2ebb283cc502 (patch)
tree95a7203f8b8bd568e5ed194fa3297c3c99e8a752 /util
parent8fc0919576234ccc15a9f66e43a326fd15f9ca79 (diff)
downloadmc-fa9b8ec335f027943f5757503b2c2ebb283cc502.tar.gz
Add to the manpages.
Diffstat (limited to 'util')
-rw-r--r--util/muse.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/util/muse.c b/util/muse.c
index 336f794..42ae747 100644
--- a/util/muse.c
+++ b/util/muse.c
@@ -47,7 +47,9 @@ static void dumpuse(char *path)
static void genuse(char *path)
{
Stab *globls;
+ char *p;
FILE *f;
+ char buf[1024];
globls = file->file.globls;
tyinit(globls);
@@ -55,9 +57,13 @@ static void genuse(char *path)
yyparse();
infer(file);
- if (!outfile)
- die("need output file name right now. FIX THIS.");
- f = fopen(outfile, "w");
+ if (outfile) {
+ p = outfile;
+ } else {
+ swapsuffix(buf, sizeof buf, path, ".myr", ".use");
+ p = buf;
+ }
+ f = fopen(p, "w");
writeuse(f, file);
fclose(f);
}
@@ -109,6 +115,11 @@ int main(int argc, char **argv)
}
if (merge) {
+ if (!outfile) {
+ fprintf(stderr, "Output file needed when merging usefiles.");
+ exit(1);
+ }
+
file = mkfile("internal");
file->file.exports = mkstab();
file->file.globls = mkstab();