xref: /haiku/headers/private/kernel/boot/stdio.h (revision 97dfeb96704e5dbc5bec32ad7b21379d0125e031)
1 /*
2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the OpenBeOS 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 #define EOF -1
36 
37 #define __PRINTFLIKE(a, b)
38 
39 extern int printf(char const *format, ...) __PRINTFLIKE(1,2);
40 extern int fprintf(FILE *stream, char const *format, ...) __PRINTFLIKE(2,3);
41 extern int sprintf(char *str, char const *format, ...) __PRINTFLIKE(2,3);
42 extern int snprintf(char *str, size_t size, char const *format, ...) __PRINTFLIKE(3,4);
43 extern int asprintf(char **ret, char const *format, ...) __PRINTFLIKE(2,3);
44 extern int vprintf(char const *format, va_list ap);
45 extern int vfprintf(FILE *stream, char const *format, va_list ap);
46 extern int vsprintf(char *str, char const *format, va_list ap);
47 extern int vsnprintf(char *str, size_t size, char const *format, va_list ap);
48 extern int vasprintf(char **ret, char const *format, va_list ap);
49 
50 // ToDo: not everything is or should be implemented here
51 extern void		clearerr(FILE *stream);
52 extern int		fclose(FILE *stream);
53 extern int		feof(FILE *stream);
54 extern int		ferror(FILE *stream);
55 extern int		fflush(FILE *stream);
56 extern int		fgetpos(FILE *stream, fpos_t *position);
57 extern FILE		*fopen(const char *name, const char *mode);
58 extern size_t	fread(void *buffer, size_t size, size_t numItems, FILE *stream);
59 extern FILE		*freopen(const char *name, const char *mode, FILE *stream);
60 extern int		fscanf(FILE *stream, char const *format, ...);
61 extern int		fseek(FILE *stream, long offset, int seekType);
62 extern int		fsetpos(FILE *stream, const fpos_t *position);
63 extern long		ftell(FILE *stream);
64 extern size_t	fwrite(const void *buffer, size_t size, size_t numItems, FILE *stream);
65 extern void		perror(const char *errorPrefix);
66 extern int		rename(const char *from, const char *to);
67 extern void		rewind(FILE *stream);
68 extern int		scanf(char const *format, ...);
69 extern void		setbuf (FILE *file, char *buff);
70 extern int		setvbuf(FILE *file, char *buff, int mode, size_t size);
71 extern int		sscanf(char const *str, char const *format, ...);
72 extern FILE		*tmpfile(void);
73 extern char 	*tmpnam(char *nameBuffer);
74 extern int		ungetc(int c, FILE *stream);
75 extern int		vscanf(char const *format, va_list ap);
76 extern int		vsscanf(char const *str, char const *format, va_list ap);
77 extern int		vfscanf(FILE *stream, char const *format, va_list ap);
78 
79 extern int    fgetc(FILE *);
80 extern char  *fgets(char *, int, FILE *);
81 extern int    fputc(int, FILE *);
82 extern int    fputs(const char *, FILE*);
83 extern int    getc(FILE *);
84 extern char  *gets(char *);
85 extern int    getw(FILE *);
86 extern int    getchar(void);
87 extern int    putc(int, FILE *);
88 extern int    putchar(int);
89 extern int    puts(const char *);
90 extern int    putw(int, FILE *);
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif /* _STDIO_H_ */
97