]> mj.ucw.cz Git - moe.git/commitdiff
The judge reports errors in a more useful way
authorMartin Mares <mj@ucw.cz>
Sat, 14 Mar 2009 22:58:00 +0000 (23:58 +0100)
committerMartin Mares <mj@ucw.cz>
Sat, 14 Mar 2009 22:58:00 +0000 (23:58 +0100)
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.

judge/token.c

index 4606395483935493c2d8715099174c389254b820..85f5069420e96755f2f98e7299f3fa4469055f12 100644 (file)
@@ -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);
 }