File:  [gforth] / gforth / Attic / strerror.c
Revision 1.1: download - view: text, annotated - select for diffs
Sat Apr 29 16:51:50 1995 UTC (26 years, 3 months ago) by anton
Branches: MAIN
CVS tags: HEAD
added strerror replacement (for SunOS)

    1: #include <errno.h>
    2: #include <stdio.h>
    3: 
    4: extern char *sys_errlist[];
    5: extern int sys_nerr;
    6: 
    7: char *strerror(int err)
    8: {
    9:   if (err<sys_nerr) /* !! or check with <= ? */
   10:     return sys_errlist[err];
   11:   else {
   12:     static char errbuf[50];
   13:     sprintf(errbuf,"Unknown system error %d",err);
   14:     return errbuf;
   15:   }
   16: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>