Ignore:
File:
1 edited

Legend:

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

    r690ad20 r694ca3d6  
    3434 */
    3535
    36 #include <abi/syscall.h>
    3736#include <stddef.h>
    3837#include <libc.h>
     
    113112}
    114113
    115 size_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 
    120114/** Print formatted text to kio.
    121115 *
     
    137131}
    138132
    139 static errno_t kio_vprintf_str_write(const char *str, size_t size, void *data)
     133static int kio_vprintf_str_write(const char *str, size_t size, void *data)
    140134{
    141         size_t wr = 0;
    142         return kio_write(str, size, &wr);
     135        size_t wr;
     136
     137        wr = 0;
     138        (void) kio_write(str, size, &wr);
     139        return str_nlength(str, wr);
     140}
     141
     142static 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;
    143160}
    144161
     
    155172        printf_spec_t ps = {
    156173                kio_vprintf_str_write,
     174                kio_vprintf_wstr_write,
    157175                NULL
    158176        };
Note: See TracChangeset for help on using the changeset viewer.