25 lines
695 B
C++
25 lines
695 B
C++
#include <errno.h>
|
|
#include <luna.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <sys/syscall.h>
|
|
#include <unistd.h>
|
|
|
|
extern "C"
|
|
{
|
|
int puts(const char* s)
|
|
{
|
|
long nwritten = syscall(SYS_write, s, strlen(s));
|
|
if (nwritten < 0) return -1;
|
|
nwritten += syscall(SYS_write, "\n", 1);
|
|
return (int)nwritten;
|
|
}
|
|
void perror(const char* s) // FIXME: Print to stderr, whenever we have an stderr.
|
|
{
|
|
int savederr =
|
|
errno; // This was necessary before, but even more now since we clear errno on successful syscalls now.
|
|
if (s && *s) { printf("%s: ", s); }
|
|
printf("%s\n", strerror(savederr));
|
|
}
|
|
} |