File:  [DVB] / dietlibc / lib / perror.c
Revision 1.15: download - view: text, annotated - select for diffs
Tue Mar 15 08:51:22 2005 UTC (19 years, 2 months ago) by leitner
Branches: MAIN
CVS tags: HEAD
  Lots of fixes and patches from Markus Oberhumer.
    libstdc++ compatibility
    ilp64 compatibility
    make diet libc compile with -Werror on 13 platforms
  ppc64 now compiles again

#include "dietfeatures.h"
#include <unistd.h>
#include <string.h>
#include <stdio.h>

#define _BSD_SOURCE
#undef __attribute_dontuse__
#define __attribute_dontuse__
#include <errno.h>

extern const char  __sys_err_unknown [];

void  perror ( const char* prepend )
{
    register const char* message = __sys_err_unknown;

    if ( (unsigned int) errno < (unsigned int) __SYS_NERR )
        message = sys_errlist [errno];

    if (prepend) {
      write ( 2, prepend, strlen(prepend) );
      write ( 2, ": ", 2 );
    }
    write ( 2, message, strlen(message) );
    write ( 2, "\n", 1 );
}

LinuxTV legacy CVS <linuxtv.org/cvs>