kolibri-libc:

- Fixed fwrite.
- Added strcat to the export table. 
- Fixed two functions in ksys.h.
- Added binaries for autobuild

git-svn-id: svn://kolibrios.org@8705 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2021-04-30 22:00:07 +00:00
parent 3b21d367d3
commit da310946f0
7 changed files with 35 additions and 45 deletions

View File

@ -349,7 +349,7 @@ unsigned _ksys_get_skin_height()
}
static inline
void _ksys_get_colors(ksys_colors_table_t *color_table)
void _ksys_get_system_colors(ksys_colors_table_t *color_table)
{
asm_inline(
"int $0x40"
@ -1015,6 +1015,7 @@ ksys_drv_hand_t _ksys_load_driver(char *driver_name)
return driver_h;
}
static inline
ksys_drv_hand_t _ksys_load_pe_driver(char *driver_path, char *cmd_line)
{
ksys_drv_hand_t driver_h;

Binary file not shown.

Binary file not shown.

View File

@ -11,7 +11,8 @@ math_test.kex \
string_test.kex \
whois.kex \
file_io.kex \
tmpdisk_work.kex
tmpdisk_work.kex \
exp_drv_work.kex
all: $(BIN)

View File

@ -1,38 +1,11 @@
#include <stdio.h>
#include <errno.h>
#include <sys/ksys.h>
int fgetc(FILE* stream)
{
unsigned bytes_read;
char c;
unsigned status = _ksys_file_read_file(stream->name, stream->position, 1, &c, &bytes_read);
if (status != KSYS_FS_ERR_SUCCESS) {
switch (status) {
case KSYS_FS_ERR_EOF:
stream->eof = 1;
break;
case KSYS_FS_ERR_1:
case KSYS_FS_ERR_2:
case KSYS_FS_ERR_3:
case KSYS_FS_ERR_4:
case KSYS_FS_ERR_5:
case KSYS_FS_ERR_7:
case KSYS_FS_ERR_8:
case KSYS_FS_ERR_9:
case KSYS_FS_ERR_10:
case KSYS_FS_ERR_11:
default:
// Just some IO error, who knows what exactly happened
errno = EIO;
stream->error = errno;
break;
}
int c=EOF;
if(fwrite(&c, sizeof(int), 1, stream)==1){
return c;
}else{
return EOF;
}
stream->position++;
return c;
}

View File

@ -1,20 +1,34 @@
#include <stdio.h>
#include <errno.h>
#include "conio.h"
#include "sys/ksys.h"
size_t fread(void *restrict ptr, size_t size, size_t nmemb, FILE *restrict stream) {
unsigned bytes_read = 0;
unsigned bytes_count = size * nmemb;
for (size_t i = 0; i < bytes_count; i++) {
char c = fgetc(stream);
if (c == EOF) {
break;
}
*(char*)(ptr+i) = c;
bytes_read++;
if(!stream){
errno = EINVAL;
return 0;
}
return bytes_read / size;
if(stream==stdin){
__con_init();
__con_gets((char*)ptr, bytes_count);
return nmemb;
}
else{
if(stream->mode != _STDIO_F_W){
unsigned status = _ksys_file_read_file(stream->name, stream->position, bytes_count, ptr , &bytes_read);
if (status != KSYS_FS_ERR_SUCCESS) {
errno = EIO;
stream->error = errno;
return 0;
}else {
stream->position+=bytes_read;
}
}
}
return bytes_read;
}

View File

@ -69,6 +69,7 @@ memmove
memset
strncat
strchr
strcat
strcmp
strcoll
strcpy