/programs/develop/libraries/kolibri-libc/include/sys/ksys.h |
---|
349,7 → 349,7 |
} |
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 |
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; |
/programs/develop/libraries/kolibri-libc/lib/crt0.o |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/x-object |
Property changes: |
Added: svn:mime-type |
+application/x-object |
\ No newline at end of property |
/programs/develop/libraries/kolibri-libc/lib/libc.obj.a |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/x-archive |
Property changes: |
Added: svn:mime-type |
+application/x-archive |
\ No newline at end of property |
/programs/develop/libraries/kolibri-libc/samples/Makefile |
---|
11,7 → 11,8 |
string_test.kex \ |
whois.kex \ |
file_io.kex \ |
tmpdisk_work.kex |
tmpdisk_work.kex \ |
exp_drv_work.kex |
all: $(BIN) |
/programs/develop/libraries/kolibri-libc/source/stdio/fgetc.c |
---|
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; |
} |
/programs/develop/libraries/kolibri-libc/source/stdio/fread.c |
---|
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; |
if(!stream){ |
errno = EINVAL; |
return 0; |
} |
*(char*)(ptr+i) = c; |
bytes_read++; |
if(stream==stdin){ |
__con_init(); |
__con_gets((char*)ptr, bytes_count); |
return nmemb; |
} |
return bytes_read / size; |
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; |
} |
/programs/develop/libraries/kolibri-libc/source/symbols.txt |
---|
69,6 → 69,7 |
memset |
strncat |
strchr |
strcat |
strcmp |
strcoll |
strcpy |