Mercurial > repo
view share/candide @ 9954:fb3529990ed4
<oerjan> ` echo \'121:122 194:196 770:771 1000:1001 1493 1497 2113:2114 3341:3343 4530:4531 5136:5137 5642:5643 5895 5897 8669:8678 9070:9071 9074:9075\' | xargs -n 1 >share/scowrevs
author | HackBot |
---|---|
date | Mon, 12 Dec 2016 03:24:20 +0000 |
parents | c989a1669243 |
children |
line wrap: on
line source
#!/bin/bash # compile c from stdin # candide, kinda readinput () { while read -r -e || { printf %s "$REPLY"; false; } ; do printf '%s\n' "$REPLY" done } 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 fi # if you don't write 'main' it assumes that you're writing a full program (with free includes) # this allows you to use other functions and stuff # it will get false positives, but who cares? if [[ $c != *main* ]]; then c=$(cat <<SOURCE int main(int argc, char *argv[]) { $c return 0; } SOURCE ); fi # 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