source: trunk/sys/dietlibc/perror.c @ 127

Last change on this file since 127 was 1, checked in by alain, 8 years ago

First import

File size: 574 bytes
Line 
1#include "dietfeatures.h"
2#include <unistd.h>
3#include <string.h>
4#include <stdio.h>
5
6#define _BSD_SOURCE
7#undef __attribute_dontuse__
8#define __attribute_dontuse__
9#include <errno.h>
10
11extern const char  __sys_err_unknown [];
12
13void  perror ( const char* prepend )
14{
15  register const char* message = sys_errlist[EUNKNOWN];
16
17  if ( (unsigned int) errno < (unsigned int) __SYS_NERR )
18    message = sys_errlist [errno];
19
20  if (prepend) {
21    write ( 2, prepend, strlen(prepend) );
22    write ( 2, ": ", 2 );
23  }
24  write ( 2, message, strlen(message) );
25  write ( 2, "\n", 1 );
26}
Note: See TracBrowser for help on using the repository browser.