Changeset 9ad1f13 in rtems for c/build-tools/src


Ignore:
Timestamp:
Jan 21, 1998, 6:28:09 PM (23 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
ba024755
Parents:
d73ed76b
Message:

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.

Location:
c/build-tools/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • c/build-tools/src/Makefile.in

    rd73ed76b r9ad1f13  
    4141
    4242DEFINES  +=
    43 CPPFLAGS +=
     43CPPFLAGS += -I.
    4444CFLAGS   +=
    4545
  • c/build-tools/src/cklength.c

    rd73ed76b r9ad1f13  
    3636#include <stdarg.h>
    3737
     38#include "config.h"
     39
     40#ifndef VMS
     41#ifndef HAVE_STRERROR
     42extern int sys_nerr;
     43extern char *sys_errlist[];
     44
     45#define strerror( _err ) \
     46  ((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
     47
     48#else   /* HAVE_STRERROR */
     49char *strerror ();
     50#endif
     51#else   /* VMS */
     52char *strerror (int,...);
     53#endif
     54
     55
    3856#define BUFFER_SIZE     512
    3957
     
    232250    va_list arglist;
    233251    register char *format;
    234     extern char *sys_errlist[];
    235     extern int sys_nerr;
    236252    int local_errno;
    237253
     
    251267
    252268    if (local_errno)
    253         if ((local_errno > 0) && (local_errno < sys_nerr))
    254             (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
    255         else
    256             (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
    257     else
    258         (void) fprintf(stderr, "\n");
     269      (void) fprintf(stderr, " (%s)\n", strerror(local_errno));
    259270
    260271    (void) fflush(stderr);
  • c/build-tools/src/eolstrip.c

    rd73ed76b r9ad1f13  
    3131#include <stdarg.h>
    3232
     33#include "config.h"
     34
     35#ifndef VMS
     36#ifndef HAVE_STRERROR
     37extern int sys_nerr;
     38extern char *sys_errlist[];
     39
     40#define strerror( _err ) \
     41  ((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
     42
     43#else   /* HAVE_STRERROR */
     44char *strerror ();
     45#endif
     46#else   /* VMS */
     47char *strerror (int,...);
     48#endif
     49
     50
    3351#define BUFFER_SIZE     2048
    3452#define MAX_PATH        2048
     
    219237    va_list arglist;
    220238    register char *format;
    221     extern char *sys_errlist[];
    222     extern int sys_nerr;
    223239    int local_errno;
    224240
     
    238254
    239255    if (local_errno)
    240         if ((local_errno > 0) && (local_errno < sys_nerr))
    241             (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
    242         else
    243             (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
     256      (void) fprintf(stderr, " (%s)\n", strerror(local_errno));
    244257    else
    245         (void) fprintf(stderr, "\n");
     258      (void) fprintf(stderr, "\n");
    246259
    247260    (void) fflush(stderr);
  • c/build-tools/src/packhex.c

    rd73ed76b r9ad1f13  
    3737#include <stdlib.h>
    3838#include <string.h>
     39
     40#include "config.h"
     41
     42#ifndef VMS
     43#ifndef HAVE_STRERROR
     44extern int sys_nerr;
     45extern char *sys_errlist[];
     46
     47#define strerror( _err ) \
     48  ((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
     49
     50#else   /* HAVE_STRERROR */
     51char *strerror ();
     52#endif
     53#else   /* VMS */
     54char *strerror (int,...);
     55#endif
    3956
    4057#if defined(__unix__) && !defined(EXIT_FAILURE)
  • c/build-tools/src/unhex.c

    rd73ed76b r9ad1f13  
    3939#include <stdarg.h>
    4040
     41#include "config.h"
     42
     43#ifndef VMS
     44#ifndef HAVE_STRERROR
     45extern int sys_nerr;
     46extern char *sys_errlist[];
     47
     48#define strerror( _err ) \
     49  ((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
     50
     51#else   /* HAVE_STRERROR */
     52char *strerror ();
     53#endif
     54#else   /* VMS */
     55char *strerror (int,...);
     56#endif
     57
     58
    4159#define OK      0
    4260#define FAILURE (-1)
     
    120138char *MISTYPE = "Incompatible record types";
    121139
    122 int
    123 main(argc, argv)
    124 int argc;
    125 char **argv;
     140int main(
     141  int argc,
     142  char **argv
     143)
    126144{
    127145    register int c;
     
    681699    va_list arglist;
    682700    register char *format;
    683     extern char *sys_errlist[];
    684     extern int sys_nerr;
    685701    int local_errno;
    686702
     
    700716
    701717    if (local_errno)
    702         if ((local_errno > 0) && (local_errno < sys_nerr))
    703             (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
    704         else
    705             (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
     718      (void) fprintf(stderr, " (%s)\n", strerror(local_errno));
    706719    else
    707         (void) fprintf(stderr, "\n");
     720      (void) fprintf(stderr, "\n");
    708721
    709722    (void) fflush(stderr);
Note: See TracChangeset for help on using the changeset viewer.