2 * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
8 #include <boot/stdio.h>
19 //extern FILE *stdout;
35 vfprintf(FILE *file
, const char *format
, va_list list
)
37 ConsoleNode
*node
= (ConsoleNode
*)file
;
39 // the buffer handling could (or should) be done better...
41 int length
= vsnprintf(buffer
, sizeof(buffer
), format
, list
);
42 length
= std::min(length
, (int)sizeof(buffer
) - 1);
44 node
->Write(buffer
, length
);
51 vprintf(const char *format
, va_list args
)
53 return vfprintf(stdout
, format
, args
);
58 printf(const char *format
, ...)
62 va_start(args
, format
);
63 int status
= vfprintf(stdout
, format
, args
);
71 fprintf(FILE *file
, const char *format
, ...)
75 va_start(args
, format
);
76 int status
= vfprintf(file
, format
, args
);
84 fputc(int c
, FILE *file
)
90 char character
= (char)c
;
92 // we only support direct console output right now...
93 status
= ((ConsoleNode
*)file
)->Write(&character
, 1);
103 fputs(const char *string
, FILE *file
)
108 status_t status
= ((ConsoleNode
*)file
)->Write(string
, strlen(string
));
118 return fputc(character
, stdout
);
123 putchar(int character
)
125 return fputc(character
, stdout
);
130 puts(const char *string
)
132 return fputs(string
, stdout
);