Last change
on this file since 39916d6 was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago |
Replace some license headers with SPDX identifier
Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.
|
-
Property mode
set to
100644
|
File size:
804 bytes
|
Line | |
---|
1 | /*
|
---|
2 | * SPDX-FileCopyrightText: 2006 Josef Cejka
|
---|
3 | *
|
---|
4 | * SPDX-License-Identifier: BSD-3-Clause
|
---|
5 | */
|
---|
6 |
|
---|
7 | /** @file
|
---|
8 | */
|
---|
9 |
|
---|
10 | #include <stddef.h>
|
---|
11 | #include <printf.h>
|
---|
12 | #include <printf_core.h>
|
---|
13 | #include <putchar.h>
|
---|
14 | #include <str.h>
|
---|
15 |
|
---|
16 | static int vprintf_str_write(const char *str, size_t size, void *data)
|
---|
17 | {
|
---|
18 | size_t offset = 0;
|
---|
19 | size_t chars = 0;
|
---|
20 |
|
---|
21 | while (offset < size) {
|
---|
22 | putuchar(str_decode(str, &offset, size));
|
---|
23 | chars++;
|
---|
24 | }
|
---|
25 |
|
---|
26 | return chars;
|
---|
27 | }
|
---|
28 |
|
---|
29 | int puts(const char *str)
|
---|
30 | {
|
---|
31 | size_t offset = 0;
|
---|
32 | size_t chars = 0;
|
---|
33 | char32_t uc;
|
---|
34 |
|
---|
35 | while ((uc = str_decode(str, &offset, STR_NO_LIMIT)) != 0) {
|
---|
36 | putuchar(uc);
|
---|
37 | chars++;
|
---|
38 | }
|
---|
39 |
|
---|
40 | putuchar('\n');
|
---|
41 | return chars;
|
---|
42 | }
|
---|
43 |
|
---|
44 | int vprintf(const char *fmt, va_list ap)
|
---|
45 | {
|
---|
46 | printf_spec_t ps = {
|
---|
47 | vprintf_str_write,
|
---|
48 | NULL
|
---|
49 | };
|
---|
50 |
|
---|
51 | int ret = printf_core(fmt, &ps, ap);
|
---|
52 |
|
---|
53 | return ret;
|
---|
54 | }
|
---|
55 |
|
---|
56 | /** @}
|
---|
57 | */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.