Luna/libs/libc/src/stdio.cpp

58 lines
1.2 KiB
C++
Raw Normal View History

#include <luna.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/syscall.h>
#include <unistd.h>
extern "C"
{
int fclose(FILE*)
{
NOT_IMPLEMENTED("fclose");
}
int fflush(FILE*)
{
NOT_IMPLEMENTED("fflush");
}
FILE* fopen(const char*, const char*)
{
NOT_IMPLEMENTED("fopen");
}
int fprintf(FILE*, const char*, ...)
{
NOT_IMPLEMENTED("fprintf");
}
size_t fread(void*, size_t, size_t, FILE*)
{
NOT_IMPLEMENTED("fread");
}
int fseek(FILE*, long, int)
{
NOT_IMPLEMENTED("fseek");
}
long ftell(FILE*)
{
NOT_IMPLEMENTED("ftell");
}
size_t fwrite(const void*, size_t, size_t, FILE*)
{
NOT_IMPLEMENTED("fwrite");
}
void setbuf(FILE*, char*)
{
NOT_IMPLEMENTED("setbuf");
}
int vfprintf(FILE*, const char*, va_list)
{
NOT_IMPLEMENTED("vfprintf");
}
int puts(const char* s)
{
size_t len = strlen(s);
char* output = (char*)__builtin_alloca(len + 1);
memcpy(output, s, len);
output[len] = '\n';
return syscall(SYS_write, output, len + 1);
}
}