From: Martin Mares Date: Sat, 14 Mar 2009 22:58:00 +0000 (+0100) Subject: The judge reports errors in a more useful way X-Git-Tag: python-dummy-working~127 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=1461a0b5f3efa09795fc3b12918b12ca25621972;p=moe.git The judge reports errors in a more useful way They are reported to stderr as two lines: one is the location of the error, another contains the error message. This is parsed by the evaluator and the second line is displayed on the screen, while both are logged. --- diff --git a/judge/token.c b/judge/token.c index 4606395..85f5069 100644 --- a/judge/token.c +++ b/judge/token.c @@ -34,9 +34,9 @@ void tok_err(struct tokenizer *t, char *msg, ...) { va_list args; va_start(args, msg); - printf("%s:%d: ", t->stream->name, t->line); - vprintf(msg, args); - putchar('\n'); + fprintf(stderr, "Error at %s line %d:\n", t->stream->name, t->line); + vfprintf(stderr, msg, args); + fputc('\n', stderr); va_end(args); exit(1); }