aboutsummaryrefslogtreecommitdiff
path: root/user/include/stdio.h
blob: d138990e0ba085f3fc8c5fb74fe1fd972e740c3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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)));