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 libc_hidden_proto(fprintf)
11 libc_hidden_proto(__glibc_strerror_r)
13 #ifdef __UCLIBC_MJN3_ONLY__
14 #warning CONSIDER: Increase buffer size for error message (non-%m case)?
17 void perror(register const char *s)
19 /* If the program is calling perror, it's a safe bet that printf and
20 * friends are used as well. It is also possible that the calling
21 * program could buffer stderr, or reassign it. */
23 register const char *sep;
26 if (!(s && *s)) { /* Caller did not supply a prefix message */
27 s = (sep += 2); /* or passed an empty string. */
30 #ifdef __UCLIBC_HAS_PRINTF_M_SPEC__
31 fprintf(stderr, "%s%s%m\n", s, sep); /* Use the gnu %m feature. */
35 fprintf(stderr, "%s%s%s\n", s, sep,
36 __glibc_strerror_r(errno, buf, sizeof(buf)));
40 libc_hidden_proto(perror)
41 libc_hidden_def(perror)