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.
This commit is contained in:
Joel Sherrill
1998-01-21 18:28:09 +00:00
parent d73ed76b03
commit 9ad1f135fa
20 changed files with 418 additions and 143 deletions

View File

@@ -35,6 +35,24 @@ maximum line length. The default maximum line length is 80.\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 512
#define SUCCESS 0
@@ -231,8 +249,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;
@@ -250,12 +266,7 @@ 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);
else
(void) fprintf(stderr, "\n");
(void) fprintf(stderr, " (%s)\n", strerror(local_errno));
(void) fflush(stderr);

View File

@@ -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);

View File

@@ -37,6 +37,23 @@
#include <stdlib.h>
#include <string.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
#if defined(__unix__) && !defined(EXIT_FAILURE)
#define EXIT_FAILURE -1
#define EXIT_SUCCESS 0

View File

@@ -40,7 +40,7 @@ include $(RTEMS_ROOT)/make/leaf.cfg
#
DEFINES +=
CPPFLAGS +=
CPPFLAGS += -I.
CFLAGS +=
LD_PATHS +=

View File

@@ -35,6 +35,24 @@ maximum line length. The default maximum line length is 80.\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 512
#define SUCCESS 0
@@ -231,8 +249,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;
@@ -250,12 +266,7 @@ 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);
else
(void) fprintf(stderr, "\n");
(void) fprintf(stderr, " (%s)\n", strerror(local_errno));
(void) fflush(stderr);

View File

@@ -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);

View File

@@ -37,6 +37,23 @@
#include <stdlib.h>
#include <string.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
#if defined(__unix__) && !defined(EXIT_FAILURE)
#define EXIT_FAILURE -1
#define EXIT_SUCCESS 0

View File

@@ -38,6 +38,24 @@ usage: unhex [-va] [ -o file ] [ file [file ... ] ]\n\
#include <stdlib.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 OK 0
#define FAILURE (-1)
#define Failed(x) ((x) == FAILURE)
@@ -119,10 +137,10 @@ char *MISCSUM = "Checksum mismatch";
char *BADTYPE = "Unrecognized record type";
char *MISTYPE = "Incompatible record types";
int
main(argc, argv)
int argc;
char **argv;
int main(
int argc,
char **argv
)
{
register int c;
bool showusage = FALSE; /* usage error? */
@@ -680,8 +698,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;
@@ -699,12 +715,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);

View File

@@ -38,6 +38,24 @@ usage: unhex [-va] [ -o file ] [ file [file ... ] ]\n\
#include <stdlib.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 OK 0
#define FAILURE (-1)
#define Failed(x) ((x) == FAILURE)
@@ -119,10 +137,10 @@ char *MISCSUM = "Checksum mismatch";
char *BADTYPE = "Unrecognized record type";
char *MISTYPE = "Incompatible record types";
int
main(argc, argv)
int argc;
char **argv;
int main(
int argc,
char **argv
)
{
register int c;
bool showusage = FALSE; /* usage error? */
@@ -680,8 +698,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;
@@ -699,12 +715,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);