2012-04-22 04:21:26 +02:00
|
|
|
--- percent_m.c.orig
|
2008-10-13 18:39:38 +02:00
|
|
|
+++ percent_m.c
|
2012-04-22 04:21:26 +02:00
|
|
|
@@ -13,7 +13,7 @@ static char sccsid[] = "@(#) percent_m.c
|
2008-10-13 18:39:38 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
extern int errno;
|
|
|
|
-#ifndef SYS_ERRLIST_DEFINED
|
|
|
|
+#if !defined(SYS_ERRLIST_DEFINED) && !defined(HAVE_STRERROR)
|
|
|
|
extern char *sys_errlist[];
|
|
|
|
extern int sys_nerr;
|
|
|
|
#endif
|
2012-04-22 04:21:26 +02:00
|
|
|
@@ -29,11 +29,15 @@ char *ibuf;
|
2008-10-13 18:39:38 +02:00
|
|
|
|
|
|
|
while (*bp = *cp)
|
|
|
|
if (*cp == '%' && cp[1] == 'm') {
|
|
|
|
+#ifdef HAVE_STRERROR
|
|
|
|
+ strcpy(bp, strerror(errno));
|
|
|
|
+#else
|
|
|
|
if (errno < sys_nerr && errno > 0) {
|
|
|
|
strcpy(bp, sys_errlist[errno]);
|
|
|
|
} else {
|
|
|
|
sprintf(bp, "Unknown error %d", errno);
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
bp += strlen(bp);
|
|
|
|
cp += 2;
|
|
|
|
} else {
|