summaryrefslogtreecommitdiffstats
path: root/tools/build/eolstrip.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1998-01-21 18:28:09 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1998-01-21 18:28:09 +0000
commit9ad1f135fafcca1d43766dc928e50e4de201614c (patch)
treed5f4890c13c84ed691264e62101e6eecc9e46831 /tools/build/eolstrip.c
parentd73ed76b03671198b0a73994beef019943746338 (diff)
downloadrtems-9ad1f135fafcca1d43766dc928e50e4de201614c.tar.bz2
Added autoconf support for strerror/sys_errlist per Ralf Corsepius'
direction. This fixes a problem reported by Steve Evans of Radstone since he is using glibc2.
Diffstat (limited to 'tools/build/eolstrip.c')
-rw-r--r--tools/build/eolstrip.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/tools/build/eolstrip.c b/tools/build/eolstrip.c
index b8854fabf1..d15151c8b0 100644
--- a/tools/build/eolstrip.c
+++ b/tools/build/eolstrip.c
@@ -30,6 +30,24 @@ Strip the white space from the end of every line on the list of files.\n\
#include <memory.h>
#include <stdarg.h>
+#include "config.h"
+
+#ifndef VMS
+#ifndef HAVE_STRERROR
+extern int sys_nerr;
+extern char *sys_errlist[];
+
+#define strerror( _err ) \
+ ((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
+
+#else /* HAVE_STRERROR */
+char *strerror ();
+#endif
+#else /* VMS */
+char *strerror (int,...);
+#endif
+
+
#define BUFFER_SIZE 2048
#define MAX_PATH 2048
@@ -218,8 +236,6 @@ error(int error_flag, ...)
{
va_list arglist;
register char *format;
- extern char *sys_errlist[];
- extern int sys_nerr;
int local_errno;
extern int errno;
@@ -237,12 +253,9 @@ error(int error_flag, ...)
va_end(arglist);
if (local_errno)
- if ((local_errno > 0) && (local_errno < sys_nerr))
- (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
- else
- (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ (void) fprintf(stderr, " (%s)\n", strerror(local_errno));
else
- (void) fprintf(stderr, "\n");
+ (void) fprintf(stderr, "\n");
(void) fflush(stderr);