1 /* Copyright (C) 1996 Robert de Bath <robert@debath.thenet.co.uk>
2 * This file is part of the Linux-8086 C library and is distributed
3 * under the GNU Library General Public License.
7 char **__sys_errlist
=0;
15 static char retbuf
[80];
22 if( err
< 0 || err
>= __sys_nerr
) goto unknown
;
23 return __sys_errlist
[err
];
26 if( err
<= 0 ) goto unknown
; /* NB the <= allows comments in the file */
27 fd
= open("/usr/lib/bcc/liberror.txt", 0);
28 if (fd
< 0) fd
= open("/lib/liberror.txt", 0);
29 if( fd
< 0 ) goto unknown
;
31 while( (cc
=read(fd
, inbuf
, sizeof(inbuf
))) > 0 )
36 if( inbuf
[i
] == '\n' )
38 retbuf
[bufoff
] = '\0';
39 if( err
== atoi(retbuf
) )
41 char * p
= strchr(retbuf
, ' ');
42 if( p
== 0 ) goto unknown
;
49 else if( bufoff
< sizeof(retbuf
)-1 )
50 retbuf
[bufoff
++] = inbuf
[i
];
54 if( fd
>= 0 ) close(fd
);
55 strcpy(retbuf
, "Unknown error ");
56 strcpy(retbuf
+14, itoa(err
));