add =cut
[openssl.git] / doc / crypto / ERR_error_string.pod
1 =pod
2
3 =head1 NAME
4
5 ERR_error_string - obtain human-readable error message
6
7 =head1 SYNOPSIS
8
9  #include <openssl/err.h>
10
11  char *ERR_error_string(unsigned long e, char *buf);
12
13  const char *ERR_lib_error_string(unsigned long e);
14  const char *ERR_func_error_string(unsigned long e);
15  const char *ERR_reason_error_string(unsigned long e);
16
17 =head1 DESCRIPTION
18
19 ERR_error_string() generates a human-readable string representing the
20 error code B<e>, and places it at B<buf>. B<buf> must be at least 120
21 bytes long. If B<buf> is B<NULL>, the error string is placed in a
22 static buffer.
23
24 The string will have the following format:
25
26  error:[error code]:[library name]:[function name]:[reason string]
27
28 I<error code> is an 8 digit hexadecimal number, I<library name>,
29 I<function name> and I<reason string> are ASCII text.
30
31 ERR_lib_error_string(), ERR_func_error_string() and
32 ERR_reason_error_string() return the library name, function
33 name and reason string respectively.
34
35 The OpenSSL error strings should be loaded by calling
36 L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)> or, for SSL
37 applications, L<SSL_load_error_strings(3)|SSL_load_error_strings(3)>
38 first.
39 If there is no text string registered for the given error code,
40 the error string will contain the numeric code.
41
42 L<ERR_print_errors(3)|ERR_print_errors(3)> can be used to print
43 all error codes currently in the queue.
44
45 =head1 RETURN VALUES
46
47 ERR_error_string() returns a pointer to a static buffer containing the
48 string if B<buf == NULL>, B<buf> otherwise.
49
50 ERR_lib_error_string(), ERR_func_error_string() and
51 ERR_reason_error_string() return the strings, and B<NULL> if
52 none is registered for the error code.
53
54 =head1 SEE ALSO
55
56 L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)>,
57 L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>,
58 L<SSL_load_error_strings(3)|SSL_load_error_strings(3)>
59 L<ERR_print_errors(3)|ERR_print_errors(3)>
60
61 =head1 HISTORY
62
63 ERR_error_string() is available in all versions of SSLeay and OpenSSL.
64
65 =cut