80 lines
1.2 KiB
C
80 lines
1.2 KiB
C
#include <stdio.h>
|
|
#include "sys/types.h"
|
|
#include "__fio.h"
|
|
|
|
static struct __io_file __stdin = {};
|
|
static struct __io_file __stdout = {};
|
|
static struct __io_file __stderr = {};
|
|
|
|
static int flags_from_mode(const char *r)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
FILE *__get_stdio_file(int i)
|
|
{
|
|
switch (i) {
|
|
case 0:
|
|
return &__stdin;
|
|
case 1:
|
|
return &__stdout;
|
|
case 2:
|
|
return &__stderr;
|
|
default:
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void __fio_init(int in, int out, int err)
|
|
{
|
|
__stdin.fd = in;
|
|
__stdout.fd = out;
|
|
__stderr.fd = err;
|
|
}
|
|
|
|
int __fio_fopen(const char *path, const char *mode, struct __io_file *fp)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
int __fio_fclose(struct __io_file *fp)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
int __fio_fdopen(int fd, const char *mode, struct __io_file *fp)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
int __fileno(struct __io_file *f)
|
|
{
|
|
return (int)f->fd;
|
|
}
|
|
|
|
unsigned int __fio_read(struct __io_file *f, char *buf, unsigned int sz)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
unsigned int __fio_write(struct __io_file *f, const char *buf, unsigned int sz)
|
|
{
|
|
//mx_console_write(buf, sz);
|
|
return sz;
|
|
}
|
|
|
|
int __fio_ungetc(struct __io_file *f, char c)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
unsigned int __fio_flush(struct __io_file *f)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
int __fio_error(struct __io_file *f)
|
|
{
|
|
return f->err != 0;
|
|
}
|