print errors to stderr

This commit is contained in:
Sami Samhuri 2011-04-24 12:02:26 -07:00
parent 23c8c5cecd
commit 4bfb171676
3 changed files with 7 additions and 7 deletions

View file

@ -68,7 +68,7 @@ char *lake_repr(LakeVal *expr)
break;
default:
printf("error: unrecognized value, type %d, size %zu bytes", expr->type, expr->size);
fprintf(stderr, "error: unrecognized value, type %d, size %zu bytes", expr->type, expr->size);
s = g_strdup("");
}

View file

@ -43,7 +43,7 @@ static void warn_trailing(Ctx *ctx)
/* don't warn about trailing comments */
if (ctx->i < ctx->n && peek(ctx) != ';') {
char *trailing = ctx->s + ctx->i;
printf("warning: ignoring %d trailing chars: %s\n", (int)(ctx->n - ctx->i), trailing);
fprintf(stderr, "warning: ignoring %d trailing chars: %s\n", (int)(ctx->n - ctx->i), trailing);
}
}

View file

@ -41,7 +41,7 @@ static LakeVal *prompt_read(LakeCtx *ctx, Env *env, char *prompt)
char buf[n];
if (!fgets(buf, n, stdin)) {
if (ferror(stdin)) {
printf("error: cannot read from stdin");
fprintf(stderr, "error: cannot read from stdin");
}
if (feof(stdin)) {
return VAL(EOF);