Description:
[grader] fix cmdline error git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@184 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r48:9aeaed99df74 - - 1 file changed: 7 inserted, 7 deleted

@@ -11,27 +11,27
11
11
12 talk ()
12 talk ()
13 {
13 {
14 if [ "$TALKATIVE" != "" ]; then
14 if [ "$TALKATIVE" != "" ]; then
15 echo "$1"
15 echo "$1"
16 fi
16 fi
17 }
17 }
18
18
19 export C_COMPILER=/usr/bin/gcc
19 export C_COMPILER=/usr/bin/gcc
20 export CPLUSPLUS_COMPILER=/usr/bin/g++
20 export CPLUSPLUS_COMPILER=/usr/bin/g++
21 export PASCAL_COMPILER=/usr/bin/gpc
21 export PASCAL_COMPILER=/usr/bin/gpc
22
22
23 - export C_OPTIONS="-O2 -Wall"
23 + export C_OPTIONS="-O2 -s -static -lm -Wall"
24 - export CPLUSPLUS_OPTIONS="-O2 -Wall"
24 + export CPLUSPLUS_OPTIONS="-O2 -s -static -lm -Wall"
25 - export PASCAL_OPTIONS="-O2 -Wall"
25 + export PASCAL_OPTIONS="-O2 -XS -lm -Wall"
26
26
27 # Check for the correct number of arguments. Otherwise, print usage.
27 # Check for the correct number of arguments. Otherwise, print usage.
28 if [ $# -eq 0 -o $# -gt 4 ]
28 if [ $# -eq 0 -o $# -gt 4 ]
29 then
29 then
30 echo "Usage: $0 <language> [<source-file>] [<output-file>] [<message-file>]"
30 echo "Usage: $0 <language> [<source-file>] [<output-file>] [<message-file>]"
31 echo
31 echo
32 echo "<source-file> is defaulted to \"source\"."
32 echo "<source-file> is defaulted to \"source\"."
33 echo "<output-file> is defaulted to \"a.out\"."
33 echo "<output-file> is defaulted to \"a.out\"."
34 echo "<message-file> is defaulted to \"compiler_message\"."
34 echo "<message-file> is defaulted to \"compiler_message\"."
35 echo
35 echo
36 exit 127
36 exit 127
37 fi
37 fi
@@ -73,34 +73,34
73
73
74 # Check if the source file exists before attempt compiling.
74 # Check if the source file exists before attempt compiling.
75 if [ ! -f $SOURCE_FILE ]
75 if [ ! -f $SOURCE_FILE ]
76 then
76 then
77 talk "ERROR: The source file does not exist!"
77 talk "ERROR: The source file does not exist!"
78 echo "ERROR: The source file did not exist." > $MESSAGE_FILE
78 echo "ERROR: The source file did not exist." > $MESSAGE_FILE
79 exit 127
79 exit 127
80 fi
80 fi
81
81
82 # Compile.
82 # Compile.
83 if [ $PROG_LANG = "c" ]
83 if [ $PROG_LANG = "c" ]
84 then
84 then
85 - $C_COMPILER $C_OPTIONS -o $OUTPUT_FILE $SOURCE_FILE 2>$MESSAGE_FILE
85 + $C_COMPILER $SOURCE_FILE -o $OUTPUT_FILE $C_OPTIONS 2>$MESSAGE_FILE
86 elif [ $PROG_LANG = "c++" ]
86 elif [ $PROG_LANG = "c++" ]
87 then
87 then
88 - $CPLUSPLUS_COMPILER $CPLUSPLUS_OPTIONS -o $OUTPUT_FILE $SOURCE_FILE 2>$MESSAGE_FILE
88 + $CPLUSPLUS_COMPILER $SOURCE_FILE -o $OUTPUT_FILE $CPLUSPLUS_OPTIONS 2>$MESSAGE_FILE
89 elif [ $PROG_LANG = "pascal" ]
89 elif [ $PROG_LANG = "pascal" ]
90 then
90 then
91 - $PASCAL_COMPILER $PASCAL_OPTIONS -o $OUTPUT_FILE $SOURCE_FILE 2>$MESSAGE_FILE
91 + $PASCAL_COMPILER $SOURCE_FILE -o $OUTPUT_FILE $PASCAL_OPTIONS 2>$MESSAGE_FILE
92 else
92 else
93 talk "ERROR: Invalid language specified!"
93 talk "ERROR: Invalid language specified!"
94 echo "ERROR: Invalid language specified!" > $MESSAGE_FILE
94 echo "ERROR: Invalid language specified!" > $MESSAGE_FILE
95 exit 127
95 exit 127
96 fi
96 fi
97
97
98 # Report success or failure.
98 # Report success or failure.
99 if [ -f $OUTPUT_FILE ]
99 if [ -f $OUTPUT_FILE ]
100 then
100 then
101 talk "Compilation was successful!"
101 talk "Compilation was successful!"
102 else
102 else
103 talk "ERROR: Something was wrong during the compilation!"
103 talk "ERROR: Something was wrong during the compilation!"
104 talk "Dumping compiler message:"
104 talk "Dumping compiler message:"
105 #cat $MESSAGE_FILE
105 #cat $MESSAGE_FILE
106 - fi No newline at end of file
106 + fi
You need to be logged in to leave comments. Login now