scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit a891448dfebfde12ae05c961bb2337d76e72a643
parent 26d544e443cbc7965ae5450a84d3125e56d354c4
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon,  4 Dec 2017 13:35:03 +0000

[lib/c] Add fgetc(), fputc(), getchar() and putchar()

Diffstat:
Mlib/c/src/Makefile | 2+-
Alib/c/src/fgetc.c | 9+++++++++
Alib/c/src/fputc.c | 9+++++++++
Alib/c/src/getchar.c | 9+++++++++
Alib/c/src/putchar.c | 9+++++++++
5 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/lib/c/src/Makefile b/lib/c/src/Makefile @@ -11,7 +11,7 @@ OBJ = assert.o strcpy.o strcmp.o strlen.o strchr.o \ isxdigit.o toupper.o tolower.o ctype.o setlocale.o \ localeconv.o atoi.o atol.o atoll.o atexit.o exit.o \ printf.o fprintf.o vfprintf.o \ - fgets.o gets.o \ + fgets.o gets.of fgetc.o fputc.o getchar.o putchar.o \ realloc.o calloc.o malloc.o all: $(ARCH)-libc.a diff --git a/lib/c/src/fgetc.c b/lib/c/src/fgetc.c @@ -0,0 +1,9 @@ + +#include <stdio.h> +#undef fgetc + +int +fgetc(FILE *fp) +{ + return getc(fp); +} diff --git a/lib/c/src/fputc.c b/lib/c/src/fputc.c @@ -0,0 +1,9 @@ + +#include <stdio.h> +#undef fputc + +int +fputc(int c, FILE *fp) +{ + return putc(c, fp); +} diff --git a/lib/c/src/getchar.c b/lib/c/src/getchar.c @@ -0,0 +1,9 @@ + +#include <stdio.h> +#undef getchar + +int +getchar(void) +{ + return getc(stdin); +} diff --git a/lib/c/src/putchar.c b/lib/c/src/putchar.c @@ -0,0 +1,9 @@ + +#include <stdio.h> +#undef putchar + +int +putchar(int ch) +{ + return putc(ch, stdin); +}