diff options
author | Freya Murphy <freya@freyacat.org> | 2025-04-21 16:45:28 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-04-21 16:45:33 -0400 |
commit | ceb9471fed96f907e37a6ba031825c31167a8ff4 (patch) | |
tree | d98392e420b4541a6ba926ff4d8b3ebe85734580 /user/include/stdio.h | |
parent | update linker scripts (diff) | |
download | comus-ceb9471fed96f907e37a6ba031825c31167a8ff4.tar.gz comus-ceb9471fed96f907e37a6ba031825c31167a8ff4.tar.bz2 comus-ceb9471fed96f907e37a6ba031825c31167a8ff4.zip |
update userland to compile
Diffstat (limited to 'user/include/stdio.h')
-rw-r--r-- | user/include/stdio.h | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/user/include/stdio.h b/user/include/stdio.h index 8a938ab..2e2abf4 100644 --- a/user/include/stdio.h +++ b/user/include/stdio.h @@ -27,6 +27,47 @@ extern FILE *stdout; #define stdout stdout /** + * Get a char from stdin + * + * @returns the character or EOF on failure + */ +extern int getchar(void); + +/** + * Get a chracter from a stream + * + * @param stream - the stream to read from + * @returns the character or EOF on failure + */ +extern int getc(FILE *stream); + +/** + * Get a chracter from a stream + * + * @param stream - the stream to read from + * @returns the character or EOF on failure + */ +extern int fgetc(FILE *stream); + +/** + * Reads a string from stdin + * + * @param s - the buffer to read into + * @returns s on success, NULL on error or EOF + */ +extern char *gets(char *s); + +/** + * Reads a string from stdin + * + * @param s - the buffer to read into + * @param size - reads at most 1 less then size + * @param stream - stream to read from from + * @returns s on success, NULL on error or EOF + */ +extern char *fgets(char *restrict str, int size, FILE *stream); + +/** * Prints out a char * * @param c - the char @@ -140,7 +181,7 @@ extern int vsnprintf(char *restrict s, size_t maxlen, const char *format, * @param format - the format string * @param ... - variable args for the format */ -__attribute__((format(printf, 2, 3))) extern void +__attribute__((format(printf, 2, 3))) extern int fprintf(FILE *stream, const char *format, ...); /** @@ -150,7 +191,7 @@ fprintf(FILE *stream, const char *format, ...); * @param format - the format string * @param args - variable arg list for the format */ -extern void vfprintf(FILE *stream, const char *format, va_list args); +extern int vfprintf(FILE *stream, const char *format, va_list args); /** * opens a file with a given file name |