4 #include "stdio_impl.h"
6 void perror(const char *msg)
9 char *errstr = strerror(errno);
13 /* Save stderr's orientation and encoding rule, since perror is not
14 * permitted to change them. */
15 void *old_locale = f->locale;
16 int old_mode = f->mode;
19 fwrite(msg, strlen(msg), 1, f);
23 fwrite(errstr, strlen(errstr), 1, f);
27 f->locale = old_locale;