Compare commits

...

2 Commits

Author SHA1 Message Date
r4 6993bf5d27 make c programs accept user input 2022-09-10 19:21:13 +02:00
r4 b4ca4e302f move default opts to setup 2022-09-10 19:19:48 +02:00
1 changed files with 4 additions and 3 deletions

View File

@ -16,7 +16,8 @@ fi
# Get file names, options and passed-through args
basedir="."
files=""
opts=""
opts="-Wall
-pedantic"
shebang_mode=""
at_args=""
args=""
@ -83,14 +84,14 @@ cleanup() {
tmpfile="$(mktemp -t "cscript.XXXXXXXXXX")"
printf "%s" "$files" | xargs -d'\n' sed "s@^#!@//#!@g" -i
trap 'cleanup; exit 130' INT
if ! printf "%s\n%s" "$files" "$opts" | xargs -d'\n' cc -Wall -pedantic -o "$tmpfile"; then
if ! printf "%s\n%s" "$files" "$opts" | xargs -d'\n' cc -o "$tmpfile"; then
cleanup
exit 1
fi
if [ -n "$CSCRIPT_GDB" ]; then
printf "%s" "$args" | xargs -o -d'\n' gdb --args "$tmpfile"
else
printf "%s" "$args" | xargs -d'\n' "$tmpfile"
printf "%s" "$args" | xargs -o -d'\n' "$tmpfile"
fi
trap - INT
cleanup