ref: 98d48074b07237716a405ce4748814e7eb939228
parent: 384f8efd91ca6d18314a71166099c34c5633f764
author: Quentin Rameau <quinq@fifth.space>
date: Fri Jun 3 12:54:10 EDT 2016
[driver] write files to PWD instead of source directory
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -113,12 +113,19 @@
}
static char *
-newfileext(char *name, char *ext)
+outfilename(char *path, char *ext)
{
- char *new, *dot;
- size_t newsz, nameln = strlen(name);
+ char *new, *name, *dot;
+ size_t newsz, nameln;
int n;
+ if (!(name = strrchr(path, '/')))
+ name = path;
+ else
+ ++name;
+
+ nameln = strlen(name);
+
if (!(dot = strrchr(name, '.')))
dot = &name[nameln];
@@ -144,7 +151,7 @@
switch (tool) {
case AS:
- outfiles[output] = newfileext(input, "o");
+ outfiles[output] = outfilename(input, "o");
t->args[t->nargs] = outfiles[output];
t->args[3] = NULL;
break;
@@ -160,7 +167,7 @@
case AS:
ext = "as"; break;
}
- outfiles[output] = newfileext(input, ext);
+ outfiles[output] = outfilename(input, ext);
t->args[1] = outfiles[output];
break;
default: