1 /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
3 * GNU Library General Public License (LGPL) version 2 or later.
5 * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
10 void perror(register const char *s
)
12 /* If the program is calling perror, it's a safe bet that printf and
13 * friends are used as well. It is also possible that the calling
14 * program could buffer stderr, or reassign it. */
16 register const char *sep
;
19 if (!(s
&& *s
)) { /* Caller did not supply a prefix message */
20 s
= (sep
+= 2); /* or passed an empty string. */
23 #ifdef __UCLIBC_HAS_PRINTF_M_SPEC__
24 fprintf(stderr
, "%s%s%m\n", s
, sep
); /* Use the gnu %m feature. */
28 fprintf(stderr
, "%s%s%s\n", s
, sep
,
29 __glibc_strerror_r(errno
, buf
, sizeof(buf
)));
33 libc_hidden_def(perror
)