Changeset f2b8cdc in mainline for uspace/lib/libc/generic/io/vprintf.c
- Timestamp:
- 2009-04-04T22:04:28Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b27eb71
- Parents:
- 4527fb5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/io/vprintf.c
r4527fb5 rf2b8cdc 42 42 static atomic_t printf_futex = FUTEX_INITIALIZER; 43 43 44 static int vprintf_ write(const char *str, size_t count, void *unused)44 static int vprintf_str_write(const char *str, size_t size, void *data) 45 45 { 46 return write_stdout(str, count); 46 size_t offset = 0; 47 size_t prev; 48 count_t chars = 0; 49 50 while (offset < size) { 51 prev = offset; 52 str_decode(str, &offset, size); 53 write_stdout(str + prev, offset - prev); 54 chars++; 55 } 56 57 return chars; 47 58 } 59 60 static int vprintf_wstr_write(const wchar_t *str, size_t size, void *data) 61 { 62 size_t offset = 0; 63 size_t boff; 64 count_t chars = 0; 65 char buf[4]; 66 67 while (offset < size) { 68 boff = 0; 69 chr_encode(str[chars], buf, &boff, 4); 70 write_stdout(buf, boff); 71 chars++; 72 offset += sizeof(wchar_t); 73 } 74 75 return chars; 76 } 77 48 78 49 79 /** Print formatted text. … … 55 85 { 56 86 struct printf_spec ps = { 57 (int (*)(void *, size_t, void *)) vprintf_write, 87 vprintf_str_write, 88 vprintf_wstr_write, 58 89 NULL 59 90 };
Note:
See TracChangeset
for help on using the changeset viewer.