mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 17:52:47 +01:00
sys: fmt: add workaround for AVR libc's missing write()
This commit is contained in:
parent
28d9eab420
commit
157f8c93ad
@ -137,6 +137,10 @@ uint32_t scn_u32_dec(const char *str, size_t n)
|
|||||||
|
|
||||||
void print(const char *s, size_t n)
|
void print(const char *s, size_t n)
|
||||||
{
|
{
|
||||||
|
#ifdef __WITH_AVRLIBC__
|
||||||
|
/* AVR's libc doesn't offer write(), so use fwrite() instead */
|
||||||
|
fwrite(s, n, 1, stdout);
|
||||||
|
#else
|
||||||
while (n > 0) {
|
while (n > 0) {
|
||||||
ssize_t written = write(STDOUT_FILENO, s, n);
|
ssize_t written = write(STDOUT_FILENO, s, n);
|
||||||
if (written < 0) {
|
if (written < 0) {
|
||||||
@ -145,6 +149,7 @@ void print(const char *s, size_t n)
|
|||||||
n -= written;
|
n -= written;
|
||||||
s += written;
|
s += written;
|
||||||
}
|
}
|
||||||
|
#endif /* __WITH_AVRLIBC__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_u32_dec(uint32_t val)
|
void print_u32_dec(uint32_t val)
|
||||||
|
Loading…
Reference in New Issue
Block a user