Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/kio.c

    r28a5ebd r690ad20  
    3434 */
    3535
     36#include <abi/syscall.h>
    3637#include <stddef.h>
    3738#include <libc.h>
     
    4243#include <abi/kio.h>
    4344#include <io/kio.h>
    44 #include <io/printf_core.h>
     45#include <printf_core.h>
    4546#include <macros.h>
    4647#include <libarch/config.h>
     
    112113}
    113114
     115size_t kio_read(char *buf, size_t n, size_t at)
     116{
     117        return __SYSCALL3(SYS_KIO_READ, (sysarg_t) buf, n, at);
     118}
     119
    114120/** Print formatted text to kio.
    115121 *
     
    131137}
    132138
    133 static int kio_vprintf_str_write(const char *str, size_t size, void *data)
     139static errno_t kio_vprintf_str_write(const char *str, size_t size, void *data)
    134140{
    135         size_t wr;
    136 
    137         wr = 0;
    138         (void) kio_write(str, size, &wr);
    139         return str_nlength(str, wr);
    140 }
    141 
    142 static int kio_vprintf_wstr_write(const char32_t *str, size_t size, void *data)
    143 {
    144         size_t offset = 0;
    145         size_t chars = 0;
    146         size_t wr;
    147 
    148         while (offset < size) {
    149                 char buf[STR_BOUNDS(1)];
    150                 size_t sz = 0;
    151 
    152                 if (chr_encode(str[chars], buf, &sz, STR_BOUNDS(1)) == EOK)
    153                         kio_write(buf, sz, &wr);
    154 
    155                 chars++;
    156                 offset += sizeof(char32_t);
    157         }
    158 
    159         return chars;
     141        size_t wr = 0;
     142        return kio_write(str, size, &wr);
    160143}
    161144
     
    172155        printf_spec_t ps = {
    173156                kio_vprintf_str_write,
    174                 kio_vprintf_wstr_write,
    175157                NULL
    176158        };
Note: See TracChangeset for help on using the changeset viewer.