Subversion Repositories HelenOS

Rev

Rev 4514 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4514 Rev 4541
Line 39... Line 39...
39
#include <stdarg.h>
39
#include <stdarg.h>
40
#include <adt/list.h>
40
#include <adt/list.h>
41
 
41
 
42
#define EOF  (-1)
42
#define EOF  (-1)
43
 
43
 
-
 
44
/** Default size for stream I/O buffers */
-
 
45
#define BUFSIZ 4096
-
 
46
 
44
#define DEBUG(fmt, ...) \
47
#define DEBUG(fmt, ...) \
45
{ \
48
{ \
46
    char buf[256]; \
49
    char buf[256]; \
47
    int n = snprintf(buf, sizeof(buf), fmt, ##__VA_ARGS__); \
50
    int n = snprintf(buf, sizeof(buf), fmt, ##__VA_ARGS__); \
48
    if (n > 0) \
51
    if (n > 0) \
Line 53... Line 56...
53
    #define SEEK_SET  0
56
    #define SEEK_SET  0
54
    #define SEEK_CUR  1
57
    #define SEEK_CUR  1
55
    #define SEEK_END  2
58
    #define SEEK_END  2
56
#endif
59
#endif
57
 
60
 
-
 
61
enum _buffer_type {
-
 
62
    /** No buffering */
-
 
63
    _IONBF,
-
 
64
    /** Line buffering */
-
 
65
    _IOLBF,
-
 
66
    /** Full buffering */
-
 
67
    _IOFBF
-
 
68
};
-
 
69
 
58
typedef struct {
70
typedef struct {
59
    /** Linked list pointer. */
71
    /** Linked list pointer. */
60
    link_t link;
72
    link_t link;
61
   
73
   
62
    /** Underlying file descriptor. */
74
    /** Underlying file descriptor. */
Line 71... Line 83...
71
    /** Klog indicator */
83
    /** Klog indicator */
72
    int klog;
84
    int klog;
73
   
85
   
74
    /** Phone to the file provider */
86
    /** Phone to the file provider */
75
    int phone;
87
    int phone;
-
 
88
 
-
 
89
    /** Buffering type */
-
 
90
    enum _buffer_type btype;
-
 
91
    /** Buffer */
-
 
92
    uint8_t *buf;
-
 
93
    /** Buffer size */
-
 
94
    size_t buf_size;
-
 
95
    /** Buffer I/O pointer */
-
 
96
    uint8_t *buf_head;
76
} FILE;
97
} FILE;
77
 
98
 
78
extern FILE *stdin;
99
extern FILE *stdin;
79
extern FILE *stdout;
100
extern FILE *stdout;
80
extern FILE *stderr;
101
extern FILE *stderr;
Line 119... Line 140...
119
 
140
 
120
extern int fflush(FILE *);
141
extern int fflush(FILE *);
121
extern int ferror(FILE *);
142
extern int ferror(FILE *);
122
extern void clearerr(FILE *);
143
extern void clearerr(FILE *);
123
 
144
 
-
 
145
extern void setvbuf(FILE *, void *, int, size_t);
-
 
146
 
124
/* Misc file functions */
147
/* Misc file functions */
125
extern int rename(const char *, const char *);
148
extern int rename(const char *, const char *);
126
 
149
 
127
#endif
150
#endif
128
 
151