diff --git a/sys/fmt/fmt.c b/sys/fmt/fmt.c index 4ddc63f4b9940738926b391e61fa0c0da9f54f3d..803b1e0d639ead5f6fee50e45813486d6dfda013 100644 --- a/sys/fmt/fmt.c +++ b/sys/fmt/fmt.c @@ -137,6 +137,10 @@ uint32_t scn_u32_dec(const char *str, 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) { ssize_t written = write(STDOUT_FILENO, s, n); if (written < 0) { @@ -145,6 +149,7 @@ void print(const char *s, size_t n) n -= written; s += written; } +#endif /* __WITH_AVRLIBC__ */ } void print_u32_dec(uint32_t val)