Browse files

verifying source code

  • Loading branch information...
1 parent a14cb81 commit 4a74fb5e221f28dfd23bfbbc0f27491498d27bad @pewniak747 committed Mar 21, 2012
Showing with 27 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +8 −1 bin/compile
  3. +15 −0 bin/verify
  4. +3 −0 conf/blacklist.conf.sample
View
1 .gitignore
@@ -1,3 +1,4 @@
+conf/blacklist.conf
problems/**/*
solutions/**/*
tmp
View
9 bin/compile
@@ -4,6 +4,7 @@ SRC_FILE=$1
PROGRAM_NAME=$2
TMP_DIR=tmp
CLEANUP=bin/cleanup
+VERIFY=bin/verify
outfile=$TMP_DIR/$PROGRAM_NAME
@@ -16,4 +17,10 @@ if [ ! -e $SRC_FILE ]; then
exit 3
fi
-g++ -o $outfile $SRC_FILE
+$VERIFY $SRC_FILE
+
+if [[ $? == 0 ]]; then
+ g++ -o $outfile $SRC_FILE
+else
+ exit 1
+fi
View
15 bin/verify
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+SRC_FILE=$1
+PROGRAM_NAME=`basename $SRC_FILE .cpp`
+BLACKLIST_FILE=conf/blacklist.conf
+
+BLACKLIST=`cat $BLACKLIST_FILE`
+
+cat $BLACKLIST_FILE | while read taboo; do
+ result=`grep -c "$taboo" $SRC_FILE`
+ if [[ $result != "0" ]]; then
+ printf "\033[31m[unacceptable expression: $taboo]\033[0m\t$PROGRAM_NAME\n"
+ exit 1
+ fi
+done
View
3 conf/blacklist.conf.sample
@@ -0,0 +1,3 @@
+# rename this file to blacklist.conf
+# and list all not allowed source expressions
+# eachi in new line

0 comments on commit 4a74fb5

Please sign in to comment.