changeset 8784:d1d589eea623

<fizzie> ` sed -i -e \'12s/^/args=""; while [[ "$c" =~ ^(-[^ ]*)\\\\ (.*) ]]; do args="$args ${BASH_REMATCH[1]}"; c="${BASH_REMATCH[2]}"; done\\n/\' -e \'s/-O0/${args--O0}/\' share/candide # bleh
author HackBot
date Sun, 10 Jul 2016 09:22:15 +0000
parents ecf07adbdcfe
children d32a7c62d774
files share/candide
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/share/candide	Sun Jul 10 09:06:06 2016 +0000
+++ b/share/candide	Sun Jul 10 09:22:15 2016 +0000
@@ -9,6 +9,7 @@
 }
 
 c="$*"
+args=""; while [[ "$c" =~ ^(-[^ ]*)\ (.*) ]]; do args="$args ${BASH_REMATCH[1]}"; c="${BASH_REMATCH[2]}"; done
 if ! [[ $c ]] || ! out=$(mktemp); then
   echo Error >&2
   exit 1
@@ -25,8 +26,8 @@
 SOURCE
 ); fi
 
-# will replace -O0 with the parameters
-gcc -o "$out" -x c -I /hackenv/share -O0 /dev/fd/0 <<SOURCE && { "$out" && { rm -f "$out"; true; }; }
+# will replace ${args--O0} with the parameters
+gcc -o "$out" -x c -I /hackenv/share ${args--O0} /dev/fd/0 <<SOURCE && { "$out" && { rm -f "$out"; true; }; }
 #include "headers"    /* precompiled headers */
 $c
 SOURCE