2000-05-28 13:40:48 +00:00
|
|
|
/*
|
|
|
|
* perror.c
|
|
|
|
*
|
|
|
|
* Ullrich von Bassewitz, 01.10.1998
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void perror (const char* msg)
|
2002-10-18 13:38:23 +00:00
|
|
|
{
|
|
|
|
/* Fetch the message that corresponds to errno */
|
|
|
|
const char* errormsg = strerror (errno);
|
|
|
|
|
|
|
|
/* Different output depending on msg */
|
|
|
|
if (msg) {
|
|
|
|
fprintf (stderr, "%s: %s\n", msg, errormsg);
|
|
|
|
} else {
|
|
|
|
fprintf (stderr, "%s\n", errormsg);
|
2000-05-28 13:40:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|