/contrib/sdk/sources/newlib/libc/sys/_rename.c |
---|
14,9 → 14,10 |
*/ |
#include <fcntl.h> |
#include <errno.h> |
#include <stdio.h> |
#include <unistd.h> |
#include <alloca.h> |
#include <errno.h> |
int _rename (char *from, char *to) |
{ |
/contrib/sdk/sources/newlib/libc/sys/conio.c |
---|
9,9 → 9,37 |
unsigned __stdcall con_set_flags(unsigned new_flags); |
void __stdcall con_cls(void); |
void __stdcall con_write_string(const char* string, unsigned length); |
short __stdcall con_getch2(void); |
int __gui_mode; |
static int console_read(const char *path, void *buff, |
size_t offset, size_t count, size_t *done) |
{ |
char *p = buff; |
int cnt = 0; |
short c; |
char ch; |
// __asm__ volatile("int3"); |
do |
{ |
c = con_getch2(); |
ch = (char)c; |
if(ch != 0) |
{ |
p[cnt] = ch != 0x0D ? ch : 0x0A; |
con_write_string(p+cnt, 1); |
cnt++; |
} |
}while(ch != 0x0D); |
*done = cnt; |
return 0; |
} |
static int console_write(const char *path, const void *buff, |
size_t offset, size_t count, size_t *writes) |
{ |
18,7 → 46,7 |
con_write_string(buff, count); |
*writes = count; |
return count; |
return 0; |
}; |
void __init_conio() |
28,6 → 56,10 |
load_libconsole(); |
con_init(80, 25, 80, 500, "Console application"); |
ioh = &__io_tab[STDIN_FILENO]; |
ioh->mode = _READ|_ISTTY; |
ioh->read = &console_read; |
ioh = &__io_tab[STDOUT_FILENO]; |
ioh->mode = _WRITE|_ISTTY; |
ioh->write = &console_write; |
/contrib/sdk/sources/newlib/libc/sys/io.c |
---|
1,5 → 1,6 |
#include <stddef.h> |
#include <stdio.h> |
#include "io.h" |
extern __io_handle __io_tab[64]; |
11,9 → 12,17 |
return 10; |
}; |
//static int fake_io_read(const char *path, void *buff, |
// size_t offset, size_t count, size_t *done) __attribute__ ((alias("fake_io"))); |
static int fake_io_read(const char *path, void *buff, |
size_t offset, size_t count, size_t *done) __attribute__ ((alias("fake_io"))); |
size_t offset, size_t count, size_t *done) |
{ |
printf("%s path:%s buf:%p offset:%d count:%d\n", |
__FUNCTION__, path, buff, offset, count); |
} |
static int fake_io_write(const char *path, const void *buff, |
size_t offset, size_t count, size_t *done) __attribute__ ((alias("fake_io"))); |
/contrib/sdk/sources/newlib/libc/sys/read.c |
---|
12,13 → 12,8 |
* the new terms are clearly indicated on the first page of each file where |
* they apply. |
*/ |
#include <fcntl.h> |
#include <errno.h> |
#include <string.h> |
#include <stdio.h> |
#include <alloca.h> |
#include <sys/kos_io.h> |
#include "glue.h" |
#include <unistd.h> |
#include "io.h" |
#undef erro |
63,7 → 58,7 |
if( iomode_flags & _BINARY ) /* if binary mode */ |
{ |
err = read_file(ioh->name, buffer, ioh->offset, cnt, &amount_read); |
err = ioh->read(ioh->name, buffer, ioh->offset, cnt, &amount_read); |
ioh->offset+= amount_read; |
total_len = amount_read; |
77,7 → 72,7 |
read_len = cnt; |
do |
{ |
err=read_file(ioh->name,buffer, ioh->offset, cnt, &amount_read); |
err=ioh->read(ioh->name,buffer, ioh->offset, cnt, &amount_read); |
ioh->offset+=amount_read; |
if( amount_read == 0 ) |
/contrib/sdk/sources/newlib/libc/sys/write.c |
---|
12,13 → 12,10 |
* the new terms are clearly indicated on the first page of each file where |
* they apply. |
*/ |
#include <fcntl.h> |
#include <errno.h> |
#include <string.h> |
#include <stdio.h> |
#include <unistd.h> |
#include <alloca.h> |
#include <sys/kos_io.h> |
#include "glue.h" |
#include "io.h" |
#undef erro |