From 55beb3f2985c9fda15f015320d1b9c723c97fbe0 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Mon, 28 Apr 2025 11:07:15 -0400 Subject: add stderr --- user/apple.c | 2 +- user/include/stdio.h | 2 ++ user/lib/fwrite.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/user/apple.c b/user/apple.c index 000718c..5adafe8 100644 --- a/user/apple.c +++ b/user/apple.c @@ -44,7 +44,7 @@ int main(void) printf("all your apple belong to bad\n"); if (drm((void **)&fb, &width, &height, &bpp)) { - printf("failure!\n"); + fprintf(stderr, "failure!\n"); return 1; } diff --git a/user/include/stdio.h b/user/include/stdio.h index 2e2abf4..fe29c9d 100644 --- a/user/include/stdio.h +++ b/user/include/stdio.h @@ -23,8 +23,10 @@ typedef void FILE; extern FILE *stdin; extern FILE *stdout; +extern FILE *stderr; #define stdin stdin #define stdout stdout +#define stderr stderr /** * Get a char from stdin diff --git a/user/lib/fwrite.c b/user/lib/fwrite.c index aa828e0..515d4ff 100644 --- a/user/lib/fwrite.c +++ b/user/lib/fwrite.c @@ -2,6 +2,7 @@ #include FILE *stdout = (void *)1; +FILE *stderr = (void *)2; int putchar(int c) { -- cgit v1.2.3-freya