diff options
author | nthnluu <nate1299@me.com> | 2024-01-28 21:20:27 -0500 |
---|---|---|
committer | nthnluu <nate1299@me.com> | 2024-01-28 21:20:27 -0500 |
commit | c63f340d90800895f007de64b7d2d14624263331 (patch) | |
tree | 2c0849fa597dd6da831c8707b6f2603403778d7b /user/include/stdio.h |
Created student weenix repository
Diffstat (limited to 'user/include/stdio.h')
-rw-r--r-- | user/include/stdio.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/user/include/stdio.h b/user/include/stdio.h new file mode 100644 index 0000000..d138990 --- /dev/null +++ b/user/include/stdio.h @@ -0,0 +1,63 @@ +#pragma once + +#include "lseek.h" +#include "stdarg.h" +#include "stddef.h" +#include "sys/types.h" + +/* Output not buffered */ +#define __IONBF 1 + +#ifndef EOF +#define EOF (-1) +#endif + +#ifndef NULL +#define NULL 0 +#endif + +/* For now, just store a file descriptor */ +typedef struct +{ + int fd; + int offset; + char buffer[8192]; +} FILE; +typedef off_t fpos_t; +extern FILE *stdin; +extern FILE *stdout; +extern FILE *stderr; + +/* ANSI C89 */ +int printf(const char *fmt, ...) __attribute__((__format__(printf, 1, 2))) +__attribute__((__nonnull__(1))); + +int fprintf(FILE *stream, const char *fmt, ...) + __attribute__((__format__(printf, 2, 3))) __attribute__((__nonnull__(2))); + +int sprintf(char *buf, const char *fmt, ...) + __attribute__((__format__(printf, 2, 3))) __attribute__((__nonnull__(2))); + +int fflush(FILE *stream); + +int vprintf(const char *fmt, va_list args) + __attribute__((__format__(printf, 1, 0))) __attribute__((__nonnull__(1))); + +int vfprintf(FILE *stream, const char *fmt, va_list args) + __attribute__((__format__(printf, 2, 0))) __attribute__((__nonnull__(2))); + +int vsprintf(char *buf, const char *fmt, va_list args) + __attribute__((__format__(printf, 2, 0))) __attribute__((__nonnull__(2))); + +/* Other */ +int snprintf(char *buf, size_t size, const char *fmt, ...) + __attribute__((__format__(printf, 3, 4))) __attribute__((__nonnull__(3))); + +int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) + __attribute__((__format__(printf, 3, 0))) __attribute__((__nonnull__(3))); + +int sscanf(const char *buf, const char *fmt, ...) + __attribute__((__format__(scanf, 2, 3))) __attribute__((__nonnull__(2))); + +int vsscanf(const char *buf, const char *fmt, va_list args) + __attribute__((__nonnull__(2))); |