Correctly append \n in puts

This commit is contained in:
johannes committed 2026-11-11 16:02:12 +01:00
1 parent 75505f214e
commit de1699b025
1 file changed
+3 -2
+3 -2
View File
@@ -9,7 +9,8 @@ int __wrap_puts(const char* s) {
const char* str = s; const char* str = s;
while(*str) while(*str)
++str; ++str;
*(char*)str='\n'; if (_bsp_write(STDOUT_FILENO, s, str - s) != str - s)
return _bsp_write(STDOUT_FILENO, s, (str - s)+1); return -1;
return _bsp_write(STDOUT_FILENO, "\n", 1) == 1 ? 0 : -1;
} }
weak_under_alias(puts); weak_under_alias(puts);