diff --git a/std-script/box-win/.gitignore b/std-script/box-win/.gitignore new file mode 100644 --- /dev/null +++ b/std-script/box-win/.gitignore @@ -0,0 +1,3 @@ +temp +box.exe +*.o diff --git a/std-script/box-win/Makefile b/std-script/box-win/Makefile new file mode 100644 --- /dev/null +++ b/std-script/box-win/Makefile @@ -0,0 +1,7 @@ +box: box.cpp execute.o + g++ box.cpp execute.o -o box -lpsapi + +execute.o: execute.cpp execute.h + g++ -c execute.cpp + +all: box \ No newline at end of file diff --git a/std-script/box-win/box.cpp b/std-script/box-win/box.cpp new file mode 100644 --- /dev/null +++ b/std-script/box-win/box.cpp @@ -0,0 +1,67 @@ +/* + +This is originally taken from Fossil Grader. It is modified so that +it has the same interface as the sandbox module for Cafe Grader. By +the way, the Cafe-Grader's sandbox module is from Moe grader, +distributed under GPL. + +*/ + +#include +#include +#include +#include "execute.h" + +char* input_filename = 0; +char* output_filename = 0; +double time_limit = 1; +int memory_limit = 16*1024*1024; // in bytes +char* exe_filename = 0; + +// process_argument takes an array of arguments starting from argv[0]. +void process_argument(int argc, char* argv[]) +{ + for(int i=0; i executable + exe_filename = strdup(argv[i]); + } + } +} + +void display_help() +{ + printf("Using: trun \n"); + printf("Options:\n"); + printf(" -i \n"); + printf(" -o \n"); + printf(" -t