ref: 5ec5de955e3b14f6a0f8f5663a5379778ba10682
parent: c435ace1e7d11f4db85989b764021b5e701ddf53
author: Quentin Rameau <quinq@fifth.space>
date: Mon Jan 23 09:39:27 EST 2017
[driver] fix and simplify target tool name setting
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -38,9 +38,9 @@
int in, out, init;
pid_t pid;
} tools[] = {
- [CC1] = { .bin = "cc1" },
+ [CC1] = { .cmd = "cc1" },
[TEEIR] = { .bin = "tee", .cmd = "tee", },
- [CC2] = { .bin = "cc2" },
+ [CC2] = { .cmd = "cc2" },
[TEEQBE] = { .bin = "tee", .cmd = "tee", },
[QBE] = { .bin = "qbe", .cmd = "qbe", },
[TEEAS] = { .bin = "tee", .cmd = "tee", },
@@ -95,7 +95,6 @@
inittool(int tool)
{
struct tool *t = &tools[tool];
- size_t binln;
int n;
if (t->init)
@@ -104,15 +103,11 @@
switch (tool) {
case CC1: /* FALLTHROUGH */
case CC2:
- binln = strlen(t->bin);
if (!arch)
arch = ARCH;
- n = snprintf(t->bin + binln,
- sizeof(t->bin) - binln,
- "-%s", arch);
+ n = snprintf(t->bin, sizeof(t->bin), "%s-%s", t->cmd, arch);
if (n < 0 || n >= sizeof(t->bin))
- die("scc: target tool bin too long");
- binln = strlen(t->bin);
+ die("scc: target tool name too long");
if (!execpath)
execpath = PREFIX "/libexec/scc";