summaryrefslogtreecommitdiff
path: root/6/main.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-10-03 17:28:59 -0400
committerOri Bernstein <ori@eigenstate.org>2014-10-03 17:29:03 -0400
commit96c8b599027a762ccaf6bd5c7633e3ede3850153 (patch)
treeeb393a3fb41dfe0a525433e8b1272fdf0497135f /6/main.c
parente898ab8413e852b6f097e047157093014246c9a2 (diff)
downloadmc-96c8b599027a762ccaf6bd5c7633e3ede3850153.tar.gz
Strip out platform suffixes from compiler output.
foo+platformstrig.myr will compile to foo.o for now.
Diffstat (limited to '6/main.c')
-rw-r--r--6/main.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/6/main.c b/6/main.c
index b0ba3b2..9aafd25 100644
--- a/6/main.c
+++ b/6/main.c
@@ -44,15 +44,20 @@ static void usage(char *prog)
printf("\t-S\tGenerate assembly instead of object code\n");
}
-static void assem(char *asmsrc, char *input)
+static void assem(char *asmsrc, char *path)
{
char *asmcmd[] = Asmcmd;
char objfile[1024];
+ char *psuffix;
char **p, **cmd;
size_t ncmd;
int pid, status;
- swapsuffix(objfile, 1024, input, ".myr", ".o");
+ psuffix = strrchr(path, '+');
+ if (psuffix != NULL)
+ swapsuffix(objfile, 1024, path, psuffix, ".o");
+ else
+ swapsuffix(objfile, 1024, path, ".myr", ".o");
cmd = NULL;
ncmd = 0;
for (p = asmcmd; *p != NULL; p++)
@@ -97,8 +102,13 @@ static void genuse(char *path)
{
FILE *f;
char buf[1024];
+ char *psuffix;
- swapsuffix(buf, sizeof buf, path, ".myr", ".use");
+ psuffix = strrchr(path, '+');
+ if (psuffix != NULL)
+ swapsuffix(buf, 1024, path, psuffix, ".use");
+ else
+ swapsuffix(buf, 1024, path, ".myr", ".use");
f = fopen(buf, "w");
if (!f)
err(1, "Could not open path %s\n", buf);