shithub: scc

Download patch

ref: cdbf973318575a464365117703dae97b95000a89
parent: 5ec5de955e3b14f6a0f8f5663a5379778ba10682
author: Quentin Rameau <[email protected]>
date: Mon Jan 23 09:58:26 EST 2017

[driver] move env parameters settings to main

--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -103,14 +103,10 @@
 	switch (tool) {
 	case CC1: /* FALLTHROUGH */
 	case CC2:
-		if (!arch)
-			arch = ARCH;
 		n = snprintf(t->bin, sizeof(t->bin), "%s-%s", t->cmd, arch);
 		if (n < 0 || n >= sizeof(t->bin))
 			die("scc: target tool name too long");
 
-		if (!execpath)
-			execpath = PREFIX "/libexec/scc";
 		n = snprintf(t->cmd, sizeof(t->cmd), "%s/%s", execpath, t->bin);
 		if (n < 0 || n >= sizeof(t->cmd))
 			die("scc: target tool path too long");
@@ -421,8 +417,10 @@
 
 	atexit(terminate);
 
-	arch = getenv("ARCH");
-	execpath = getenv("SCCEXECPATH");
+	if (!(arch = getenv("ARCH")))
+		arch = ARCH;
+	if (!(execpath = getenv("SCCEXECPATH")))
+		execpath = PREFIX "/libexec/scc";
 
 	ARGBEGIN {
 	case 'D':