Commits

Aaron Conole  committed 38c85b0

remove the remove call

  • Participants
  • Parent commits 48475bf

Comments (0)

Files changed (2)

File bash/handler_callbacks

 
   HASMAIN=$(/bin/echo "$*" | $GREP_BIN -w -E "main")
 
-  BADWORDS=( "socket" "setuid" "setgid" "seteuid" "setegid" "fopen" "open" "creat" "system" "exec" "execl" "execvp" "execp" "execle" "ioctl" "asm" "fork" "vfork" "clone" "execve" "signal" "kill" "popen" "sigaction" "signal" "#include" "ifstream" "ofstream" )
+  BADWORDS=( "socket" "setuid" "setgid" "seteuid" "setegid" "fopen" "open" "creat" "system" "exec" "execl" "execvp" "execp" "execle" "ioctl" "asm" "fork" "vfork" "clone" "execve" "signal" "kill" "popen" "sigaction" "signal" "#include" "ifstream" "ofstream" "syscall" "remove" )
 
   for badword in "${BADWORDS[@]}"; do
     HASWORD=$(/bin/echo "$*" | $GREP_BIN -w -o "$badword")
     fi
   done
 
-
-  COUTFILE=$($MKTEMP_BIN --suffix=.cc)
-  OOUTFILE=$($MKTEMP_BIN --suffix=.o)
+  MKTEMP_BIN=/bin/mktemp
+  COUTFILE=$($MKTEMP_BIN )
+  OOUTFILE=$($MKTEMP_BIN )
   AOUTFILE=$($MKTEMP_BIN)
   WARNFIL=$($MKTEMP_BIN)
 
-  $CAT_BIN > $COUTFILE <<EOF
+  debug "compile to $COUTFILE.cc"
+
+  $CAT_BIN > ${COUTFILE}.cc <<EOF
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
   NEEDSTERM="false"
 
   if [ ! "$HASMAIN" ]; then
-      $CAT_BIN >> $COUTFILE <<EOF
+      $CAT_BIN >> ${COUTFILE}.cc <<EOF
 
 int main()
 EOF
 
-      [ "${1:0:1}" != "{" ] && $(echo "{" >> $COUTFILE) && NEEDSTERM="true"
+      [ "${1:0:1}" != "{" ] && $(echo "{" >> ${COUTFILE}.cc) && NEEDSTERM="true"
   fi
   
 
-  $(set -f && echo "$*" >> $COUTFILE)
+  $(set -f && echo "$*" >> ${COUTFILE}.cc)
 
-  [ "$NEEDSTERM" == "true" ] && $(echo "}" >> $COUTFILE)
+  [ "$NEEDSTERM" == "true" ] && $(echo "}" >> ${COUTFILE}.cc)
 
-  ERRORS=$($CXX ${GCC_FLAGS} -Dmain="APP_TMP_MAIN_main" -c -o $OOUTFILE $COUTFILE 2>&1)
+  ERRORS=$($CXX ${GCC_FLAGS} -Dmain="APP_TMP_MAIN_main" -c -o ${OOUTFILE}.o ${COUTFILE}.cc 2>&1)
 
   if [ "$ERRORS" ]; then
     BADSTUFF=$(echo "$ERRORS" | $GREP_BIN -o -E -m 1 "(warning\:|error\:).*" )
 
     message_post $RESPONSE "submitted: ${BADSTUFF}"
-    $RM_BIN -f $COUTFILE $AOUTFILE $WARNFIL $OOUTFILE
+    $RM_BIN -f $AOUTFILE $WARNFIL $OOUTFILE $COUTFILE ${COUTFILE}.cc ${OOUTFILE}.o
 
     return
   fi
 
-  $CAT_BIN >$COUTFILE <<EOF
+  $CAT_BIN >${COUTFILE}.cc <<EOF
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 
 EOF
 
-  ERRORS=$($CXX -fpermissive -o $AOUTFILE $COUTFILE $OOUTFILE 2>&1 )
+  ERRORS=$($CXX -fpermissive -o $AOUTFILE ${COUTFILE}.cc ${OOUTFILE}.o 2>&1 )
   if [ "$ERRORS" -a $? -eq 1 ]; then
     BADSTUFF=$(echo "$ERRORS" | $GREP_BIN -o -E -m 1 "(warning\:|error\:|undefined).*" )
 
     message_post $RESPONSE "precomp: ${BADSTUFF}"
-    $RM_BIN -f $AOUTFILE $WARNFIL $OOUTFILE
+    $RM_BIN -f $AOUTFILE $WARNFIL $OOUTFILE $COUTFILE ${COUTFILE}.cc ${OOUTFILE}.o
 
     return
   fi
 #!/bin/bash
 ulimit -t 2
 #ulimit -u 5
-$AOUTFILE
+$AOUTFILE 2>&1 | $TR_BIN '\n\r\0' '|||'
+
 EOF
 
   $CHMOD_BIN +x $WARNFIL
  
   $RM_BIN -f $COUTFILE $AOUTFILE $WARNFIL $OOUTFILE
 
-  message_post $RESPONSE "$RESULT"
+  [ "$RESULT" ] && message_post $RESPONSE "$RESULT" && return
+  message_post $RESPONSE "$SENDER, No output."
 }
 
 run_rot13(){
 CXX=$(/usr/bin/which g++)
 
 # These are for your protection
-GCC_FLAGS="-finput-charset=UTF-8 -O2 -std=c++0x -pedantic-errors -Wfatal-errors -Wall -Wextra -Wno-empty-body -Wno-missing-field-initializers -Wwrite-strings -Wno-deprecated -Wno-unused -Wno-non-virtual-dtor -Wno-variadic-macros -fno-use-linker-plugin -fmessage-length=0 -ftemplate-depth-128 -fno-merge-constants -fno-nonansi-builtins -fno-gnu-keywords -fno-elide-constructors -fstrict-aliasing -fstack-protector-all -Winvalid-pch -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_GLIBCXX_CONCEPT_CHECKS"
+GCC_FLAGS="-finput-charset=UTF-8 -O2 -std=c++0x -pedantic-errors -Wfatal-errors -Wall -Wextra -Wno-empty-body -Wno-missing-field-initializers -Wwrite-strings -Wno-deprecated -Wno-unused -Wno-non-virtual-dtor -Wno-variadic-macros -fmessage-length=0 -ftemplate-depth-128 -fno-merge-constants -fno-nonansi-builtins -fno-gnu-keywords -fno-elide-constructors -fstrict-aliasing -fstack-protector-all -Winvalid-pch -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_GLIBCXX_CONCEPT_CHECKS"
+#GCC_FLAGS="-finput-charset=UTF-8 -O2 -std=c++0x -pedantic-errors -Wfatal-errors -Wall -Wextra -Wno-empty-body -Wno-missing-field-initializers -Wwrite-strings -Wno-deprecated -Wno-unused -Wno-non-virtual-dtor -Wno-variadic-macros -fmessage-length=0 -ftemplate-depth-128 -fno-merge-constants -fno-linker-plugin -fno-nonansi-builtins -fno-gnu-keywords -fno-elide-constructors -fstrict-aliasing -fstack-protector-all -Winvalid-pch -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_GLIBCXX_CONCEPT_CHECKS"
 
 #
 # configuration