/* Copyright (C) 1996 Robert de Bath * This file is part of the Linux-8086 C library and is distributed * under the GNU Library General Public License. */ #include char **__sys_errlist =0; int __sys_nerr = 0; char * strerror(err) int err; { int fd; static char retbuf[80]; char inbuf[256]; int cc; int bufoff = 0; if( __sys_nerr ) { if( err < 0 || err >= __sys_nerr ) goto unknown; return __sys_errlist[err]; } if( err <= 0 ) goto unknown; /* NB the <= allows comments in the file */ fd = open("/lib/liberror.txt", 0); if( fd < 0 ) goto unknown; while( (cc=read(fd, inbuf, sizeof(inbuf))) > 0 ) { int i; for(i=0; i= 0 ) close(fd); strcpy(retbuf, "Unknown error "); strcpy(retbuf+14, itoa(err)); return retbuf; }