49 |
|
|
50 |
__extern FILE *fopen(const char *, const char *); |
__extern FILE *fopen(const char *, const char *); |
51 |
|
|
52 |
static __inline__ FILE *fdopen(int __fd, const char *__m) |
__static_inline FILE *fdopen(int __fd, const char *__m) |
53 |
{ |
{ |
54 |
(void)__m; |
(void)__m; |
55 |
return __create_file(__fd); |
return __create_file(__fd); |
56 |
} |
} |
57 |
static __inline__ int fclose(FILE * __f) |
__static_inline int fclose(FILE * __f) |
58 |
{ |
{ |
59 |
extern int close(int); |
extern int close(int); |
60 |
return close(fileno(__f)); |
return close(fileno(__f)); |
61 |
} |
} |
62 |
static __inline__ int fseek(FILE * __f, off_t __o, int __w) |
__static_inline int fseek(FILE * __f, off_t __o, int __w) |
63 |
{ |
{ |
64 |
extern off_t lseek(int, off_t, int); |
extern off_t lseek(int, off_t, int); |
65 |
return (lseek(fileno(__f), __o, __w) == (off_t) - 1) ? -1 : 0; |
return (lseek(fileno(__f), __o, __w) == (off_t) - 1) ? -1 : 0; |
66 |
} |
} |
67 |
static __inline__ off_t ftell(FILE * __f) |
__static_inline off_t ftell(FILE * __f) |
68 |
{ |
{ |
69 |
extern off_t lseek(int, off_t, int); |
extern off_t lseek(int, off_t, int); |
70 |
return lseek(fileno(__f), 0, SEEK_CUR); |
return lseek(fileno(__f), 0, SEEK_CUR); |
85 |
__extern size_t _fwrite(const void *, size_t, FILE *); |
__extern size_t _fwrite(const void *, size_t, FILE *); |
86 |
|
|
87 |
#ifndef __NO_FREAD_FWRITE_INLINES |
#ifndef __NO_FREAD_FWRITE_INLINES |
88 |
extern __inline__ size_t fread(void *__p, size_t __s, size_t __n, FILE * __f) |
__extern_inline size_t |
89 |
|
fread(void *__p, size_t __s, size_t __n, FILE * __f) |
90 |
{ |
{ |
91 |
return _fread(__p, __s * __n, __f) / __s; |
return _fread(__p, __s * __n, __f) / __s; |
92 |
} |
} |
93 |
|
|
94 |
extern __inline__ size_t |
__extern_inline size_t |
95 |
fwrite(const void *__p, size_t __s, size_t __n, FILE * __f) |
fwrite(const void *__p, size_t __s, size_t __n, FILE * __f) |
96 |
{ |
{ |
97 |
return _fwrite(__p, __s * __n, __f) / __s; |
return _fwrite(__p, __s * __n, __f) / __s; |
110 |
__extern int vasprintf(char **, const char *, va_list); |
__extern int vasprintf(char **, const char *, va_list); |
111 |
|
|
112 |
/* No buffering, so no flushing needed */ |
/* No buffering, so no flushing needed */ |
113 |
extern __inline__ int fflush(FILE * __f) |
__static_inline int fflush(FILE * __f) |
114 |
|
{ |
115 |
|
(void)__f; |
116 |
|
return 0; |
117 |
|
} |
118 |
|
|
119 |
|
/* stream errors are not kept track of by klibc implementation */ |
120 |
|
__static_inline int ferror(FILE * __f) |
121 |
{ |
{ |
122 |
(void)__f; |
(void)__f; |
123 |
return 0; |
return 0; |