It will now load all settings in the kernel driver settings directory and pass them over to the kernel (unparsed). Additionally, it allows other parts of the boot loader to access driver_settings just like in the kernel. Moved the switch to the logo in the boot loader much further to the end of the boot loader's life cycle. This is done so that the boot loader can directly use the video mode as configured in Haiku, without a jumping logo. Since the delay will be noticeable on a real system, we might want to introduce a second different boot logo, though. We'll see. stdio.cpp now also exports errno (and _errnop). Might be changed to a different approach later as well (it's now done this way so that strtol.o can be taken over unchanged from libroot.so). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10634 a95241bf-73f2-0310-859d-f6bbb57e9c96
122 lines
1.7 KiB
C++
122 lines
1.7 KiB
C++
/*
|
|
* Copyright 2003-2005, Axel Dörfler, [email protected]. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
|
|
|
|
#include <boot/vfs.h>
|
|
#include <boot/stdio.h>
|
|
#include <util/kernel_cpp.h>
|
|
|
|
#include <stdarg.h>
|
|
#include <string.h>
|
|
|
|
//#undef stdout
|
|
//#undef stdin
|
|
//extern FILE *stdout;
|
|
//extern FILE *stdin;
|
|
|
|
int errno;
|
|
int *_errnop = &errno;
|
|
|
|
|
|
int
|
|
vfprintf(FILE *file, const char *format, va_list list)
|
|
{
|
|
ConsoleNode *node = (ConsoleNode *)file;
|
|
char buffer[512];
|
|
// the buffer handling could (or should) be done better...
|
|
|
|
int length = vsnprintf(buffer, sizeof(buffer), format, list);
|
|
if (length > 0)
|
|
node->Write(buffer, length);
|
|
|
|
return length;
|
|
}
|
|
|
|
|
|
int
|
|
vprintf(const char *format, va_list args)
|
|
{
|
|
return vfprintf(stdout, format, args);
|
|
}
|
|
|
|
|
|
int
|
|
printf(const char *format, ...)
|
|
{
|
|
va_list args;
|
|
|
|
va_start(args, format);
|
|
int status = vfprintf(stdout, format, args);
|
|
va_end(args);
|
|
|
|
return status;
|
|
}
|
|
|
|
|
|
int
|
|
fprintf(FILE *file, const char *format, ...)
|
|
{
|
|
va_list args;
|
|
|
|
va_start(args, format);
|
|
int status = vfprintf(file, format, args);
|
|
va_end(args);
|
|
|
|
return status;
|
|
}
|
|
|
|
|
|
int
|
|
fputc(int character, FILE *file)
|
|
{
|
|
if (file == NULL)
|
|
return B_FILE_ERROR;
|
|
|
|
status_t status;
|
|
|
|
// we only support direct console output right now...
|
|
status = ((ConsoleNode *)file)->Write(&character, 1);
|
|
|
|
if (status > 0)
|
|
return character;
|
|
|
|
return status;
|
|
}
|
|
|
|
|
|
int
|
|
fputs(const char *string, FILE *file)
|
|
{
|
|
if (file == NULL)
|
|
return B_FILE_ERROR;
|
|
|
|
status_t status = ((ConsoleNode *)file)->Write(string, strlen(string));
|
|
fputc('\n', file);
|
|
|
|
return status;
|
|
}
|
|
|
|
|
|
int
|
|
putc(int character)
|
|
{
|
|
return fputc(character, stdout);
|
|
}
|
|
|
|
|
|
int
|
|
putchar(int character)
|
|
{
|
|
return fputc(character, stdout);
|
|
}
|
|
|
|
|
|
int
|
|
puts(const char *string)
|
|
{
|
|
return fputs(string, stdout);
|
|
}
|
|
|