#include #include #include #include #include #include #include extern "C" { int puts(const char* s) { long nwritten = fwrite(s, strlen(s), 1, stdout); if (nwritten < 0) return -1; nwritten += fwrite("\n", 1, 1, stdout); return (int)nwritten; } void perror(const char* s) { int savederr = errno; // This was necessary before, but even more now since we clear errno on successful syscalls now. if (s && *s) { fprintf(stderr, "%s: ", s); } fprintf(stderr, "%s\n", strerror(savederr)); } }