summaryrefslogtreecommitdiff
path: root/src/stdio/perror.c
blob: 788bb4fcd7faa61131501ba07733027fcafbb923 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <errno.h>
#include <stdio.h>
#include <string.h>

/** print an error message **/

void perror(const char *s)
{
	if (s != NULL && *s != '\0') {
		fprintf(stderr, "%s: ", s);
	}
	fprintf(stderr, "%s\n", strerror(errno));
}

/***
writes an error message to IDENTIFIER(stderr).

If ARGUMENT(s) is CONSTANT(NULL), the error message is a string representation of the
current value of IDENTIFIER(errno).

If ARGUMENT(s) is not CONSTANT(NULL), the error message will be preceded by the string
pointed to by ARGUMENT(s), a colon (CHAR(:)), and a space.
***/

/*
POSIX_(L_C_MESSAGES)
STDC(1)
*/