xref: /haiku/headers/private/kernel/boot/stdio.h (revision 899e0ef82b5624ace2ccfa5f5a58c8ebee54aaef)
1 /*
2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
4 */
5 #ifndef _STDIO_H_
6 #define _STDIO_H_
7 	// must match the one of the real stdio.h
8 
9 #include <stdarg.h>
10 
11 typedef off_t fpos_t;
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 typedef struct FILE FILE;
18 	// dummy definition of FILE
19 	// In the boot loader, it really is a ConsoleNode
20 
21 extern FILE *stdin;
22 extern FILE *stdout;
23 extern FILE *stderr;
24 
25 #ifndef SEEK_SET
26 #	define SEEK_SET 0
27 #endif
28 #ifndef SEEK_CUR
29 #	define SEEK_CUR 1
30 #endif
31 #ifndef SEEK_END
32 #	define SEEK_END 2
33 #endif
34 
35 #ifndef EOF
36 #	define EOF (-1)
37 #endif
38 
39 #define __PRINTFLIKE(a, b)
40 
41 extern int printf(char const *format, ...) __PRINTFLIKE(1,2);
42 extern int fprintf(FILE *stream, char const *format, ...) __PRINTFLIKE(2,3);
43 extern int sprintf(char *str, char const *format, ...) __PRINTFLIKE(2,3);
44 extern int snprintf(char *str, size_t size, char const *format, ...) __PRINTFLIKE(3,4);
45 extern int asprintf(char **ret, char const *format, ...) __PRINTFLIKE(2,3);
46 extern int vprintf(char const *format, va_list ap);
47 extern int vfprintf(FILE *stream, char const *format, va_list ap);
48 extern int vsprintf(char *str, char const *format, va_list ap);
49 extern int vsnprintf(char *str, size_t size, char const *format, va_list ap);
50 extern int vasprintf(char **ret, char const *format, va_list ap);
51 
52 // ToDo: not everything is or should be implemented here
53 extern void		clearerr(FILE *stream);
54 extern int		fclose(FILE *stream);
55 extern int		feof(FILE *stream);
56 extern int		ferror(FILE *stream);
57 extern int		fflush(FILE *stream);
58 extern int		fgetpos(FILE *stream, fpos_t *position);
59 extern FILE		*fopen(const char *name, const char *mode);
60 extern size_t	fread(void *buffer, size_t size, size_t numItems, FILE *stream);
61 extern FILE		*freopen(const char *name, const char *mode, FILE *stream);
62 extern int		fscanf(FILE *stream, char const *format, ...);
63 extern int		fseek(FILE *stream, long offset, int seekType);
64 extern int		fsetpos(FILE *stream, const fpos_t *position);
65 extern long		ftell(FILE *stream);
66 extern size_t	fwrite(const void *buffer, size_t size, size_t numItems, FILE *stream);
67 extern void		perror(const char *errorPrefix);
68 extern int		rename(const char *from, const char *to);
69 extern void		rewind(FILE *stream);
70 extern int		scanf(char const *format, ...);
71 extern void		setbuf (FILE *file, char *buff);
72 extern int		setvbuf(FILE *file, char *buff, int mode, size_t size);
73 extern int		sscanf(char const *str, char const *format, ...);
74 extern FILE		*tmpfile(void);
75 extern char 	*tmpnam(char *nameBuffer);
76 extern int		ungetc(int c, FILE *stream);
77 extern int		vscanf(char const *format, va_list ap);
78 extern int		vsscanf(char const *str, char const *format, va_list ap);
79 extern int		vfscanf(FILE *stream, char const *format, va_list ap);
80 
81 extern int    fgetc(FILE *);
82 extern char  *fgets(char *, int, FILE *);
83 extern int    fputc(int, FILE *);
84 extern int    fputs(const char *, FILE*);
85 extern int    getc(FILE *);
86 extern char  *gets(char *);
87 extern int    getw(FILE *);
88 extern int    getchar(void);
89 extern int    putc(int, FILE *);
90 extern int    putchar(int);
91 extern int    puts(const char *);
92 extern int    putw(int, FILE *);
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif /* _STDIO_H_ */
99