1 #include "stdio_impl.h"
6 void psignal(int sig
, const char *msg
)
9 char *s
= strsignal(sig
);
13 /* Save stderr's orientation and encoding rule, since psignal is not
14 * permitted to change them. Save errno and restore it if there is no
15 * error since fprintf might change it even on success but psignal is
16 * not permitted to do so. */
17 void *old_locale
= f
->locale
;
18 int old_mode
= f
->mode
;
19 int old_errno
= errno
;
21 if (fprintf(f
, "%s%s%s\n", msg
?msg
:"", msg
?": ":"", s
)>=0)
24 f
->locale
= old_locale
;