diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-11-29 12:55:31 +0100 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-11-29 12:55:31 +0100 |
| commit | c157ae7c78965f390d380a068fe08db0843bb813 (patch) | |
| tree | 4adfa852336c5c6c9ac17c18dca7b2cfd8a1524f | |
| parent | 2ffa7e5c7b6b75df9eb7e54f8c4f73af7dd28563 (diff) | |
libpsx: Add rewind(3)
| -rw-r--r-- | libpsx/include/stdio.h | 1 | ||||
| -rw-r--r-- | libpsx/src/libc.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/libpsx/include/stdio.h b/libpsx/include/stdio.h index 89d8817..34d2d57 100644 --- a/libpsx/include/stdio.h +++ b/libpsx/include/stdio.h @@ -123,6 +123,7 @@ size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream); int fgetc(FILE *f); int ftell(FILE *f); int fseek(FILE *f, int offset, int whence); +void rewind(FILE *f); int fputs(const char *str, FILE *stream); void clearerr(FILE *stream); diff --git a/libpsx/src/libc.c b/libpsx/src/libc.c index 3baccf4..58884b0 100644 --- a/libpsx/src/libc.c +++ b/libpsx/src/libc.c @@ -420,6 +420,12 @@ int fseek(FILE *f, int offset, int whence) return 0; } +void rewind(FILE *f) +{ + fseek(f, 0, SEEK_SET); + clearerr(f); +} + int toupper(int c) { if(c >= 'a' && c <= 'z') |
