ref: b5e9ed296e0086e96fe3caab00e1c9db345febc3
parent: adc4463f0ca6590f216aadb1e75390977fe1ec49
author: kvik <[email protected]>
date: Sat Feb 15 15:36:28 EST 2020
cc(1): deobfuscate and enable passing flags to compiler
--- a/bin/cc
+++ b/bin/cc
@@ -1,8 +1,13 @@
-#!/bin/rc
-
+#!/bin/rc -e
rfork e
-O=`{sed 's/^O=//; t end; D; :end; q' /$objtype/mkfile}
-CFLAGS=`{sed 's/^CFLAGS=//; t end; D; :end; q' /sys/src/mkfile.proto}
+. /$objtype/mkfile
-$O^c $CFLAGS $1.c && $O^l -o $1 $1.$O
+while(~ $1 -* && ! ~ $1 --){
+ CFLAGS=($CFLAGS $1)
+ shift
+}
+if(~ $1 --) shift
+
+$CC $CFLAGS $1.c
+$LD -o $1 $1.$O