summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortslil clingman <>2021-07-14 18:26:32 -0400
committertslil clingman <>2021-07-14 18:26:32 -0400
commit5b4fb66bebc154a8fd121edae6b2e44ee71566bd (patch)
treee077633812762661fb29e84b6c84773a52c39c62
parent9569368eb6cf50eba21341766487f865723ee669 (diff)
parent3c79bbc4529f62d462f6807f354b6b4c5e3477e6 (diff)
Merge branch 'master' of git.sr.ht:~tslil/scripts
-rwxr-xr-xci26
1 files changed, 13 insertions, 13 deletions
diff --git a/ci b/ci
index 3870b3c..e1e1709 100755
--- a/ci
+++ b/ci
@@ -1,32 +1,32 @@
#!/usr/bin/env sh
# Convenient frontend for quickly evaluating C code
-LIBR="stdlib stdio math ieee754 limits stdint"
+LIBR="stdlib stdio math ieee754 limits stdint stdstring"
FLAG="-Wall -lm"
-NAME=/tmp/$RANDOM-$RANDOM
+gen_rand() {
+ od -A n -t d -N 1 /dev/urandom | tr -d ' '
+}
+
+NAME=/tmp/$(gen_rand)-$(gen_rand)
SRC=$NAME.c
BIN=$NAME-B
-for k in $LIBR; do
- echo "#include<$k.h>" >> $SRC
+for k in $LIBR; do
+ echo "#include<$k.h>" >> $SRC
done
-#echo -e "int main(int argc, char ** argv) {\n\n return 0;\n}" >> $SRC
-#zile +8 $SRC
-
echo "int main(int argc, char ** argv) {" >> $SRC
rlwrap -o cat >> $SRC
echo "return 0;}" >> $SRC
-
-echo -e "\n\n\t!!! Compiling ..."
-gcc $FLAG $SRC -o $BIN
+printf "\n\n\t!!! Compiling ..."
+cc $FLAG $SRC -o $BIN
if [ "$?" = "0" ]; then
- echo -e "\t!!! Executing ...\n\n"
- exec $BIN
- rm $BIN
+ printf "\n\n\t!!! Executing ...\n\n"
+ exec $BIN
+ rm $BIN
fi;
rm $SRC