ack/lang/cem/libcc.ansi/stdio/perror.c

20 lines
317 B
C
Raw Normal View History

1989-05-30 13:34:25 +00:00
/*
* perror.c - print an error message on the standard error output
*/
1994-06-24 14:02:31 +00:00
/* $Id$ */
1989-05-30 13:34:25 +00:00
2018-06-21 20:33:47 +00:00
#include <errno.h>
#include <stdio.h>
#include <string.h>
1989-05-30 13:34:25 +00:00
2018-06-21 20:33:47 +00:00
void perror(const char* s)
1989-05-30 13:34:25 +00:00
{
2018-06-21 20:33:47 +00:00
if (s && *s)
{
(void)fputs(s, stderr);
(void)fputs(": ", stderr);
}
2018-06-21 20:33:47 +00:00
(void)fputs(strerror(errno), stderr);
(void)fputs("\n", stderr);
1989-05-30 13:34:25 +00:00
}