re_types.h: move errno values to above 200
print.c: add support for %m to describe error values (similar to syslog)
This commit is contained in:
parent
15399ea23e
commit
1b4b901609
2 changed files with 28 additions and 19 deletions
|
@ -145,90 +145,90 @@ typedef bool _Bool;
|
|||
|
||||
/** No data available */
|
||||
#ifndef ENODATA
|
||||
#define ENODATA 61
|
||||
#define ENODATA 200
|
||||
#endif
|
||||
|
||||
/** Protocol error */
|
||||
#ifndef EPROTO
|
||||
#define EPROTO 71
|
||||
#define EPROTO 201
|
||||
#endif
|
||||
|
||||
/** Not a data message */
|
||||
#ifndef EBADMSG
|
||||
#define EBADMSG 74
|
||||
#define EBADMSG 202
|
||||
#endif
|
||||
|
||||
/** Value too large for defined data type */
|
||||
#ifndef EOVERFLOW
|
||||
#define EOVERFLOW 75
|
||||
#define EOVERFLOW 203
|
||||
#endif
|
||||
|
||||
/** Accessing a corrupted shared library */
|
||||
#ifndef ELIBBAD
|
||||
#define ELIBBAD 80
|
||||
#define ELIBBAD 204
|
||||
#endif
|
||||
|
||||
/** Destination address required */
|
||||
#ifndef EDESTADDRREQ
|
||||
#define EDESTADDRREQ 89
|
||||
#define EDESTADDRREQ 205
|
||||
#endif
|
||||
|
||||
/** Protocol not supported */
|
||||
#ifndef EPROTONOSUPPORT
|
||||
#define EPROTONOSUPPORT 93
|
||||
#define EPROTONOSUPPORT 206
|
||||
#endif
|
||||
|
||||
/** Operation not supported on transport endpoint */
|
||||
/** Operation not supported */
|
||||
#ifndef ENOTSUP
|
||||
#define ENOTSUP 95
|
||||
#define ENOTSUP 207
|
||||
#endif
|
||||
|
||||
/** Address family not supported by protocol */
|
||||
#ifndef EAFNOSUPPORT
|
||||
#define EAFNOSUPPORT 97
|
||||
#define EAFNOSUPPORT 208
|
||||
#endif
|
||||
|
||||
/** Cannot assign requested address */
|
||||
#ifndef EADDRNOTAVAIL
|
||||
#define EADDRNOTAVAIL 99
|
||||
#define EADDRNOTAVAIL 209
|
||||
#endif
|
||||
|
||||
/** Software caused connection abort */
|
||||
#ifndef ECONNABORTED
|
||||
#define ECONNABORTED 103
|
||||
#define ECONNABORTED 210
|
||||
#endif
|
||||
|
||||
/** Connection reset by peer */
|
||||
#ifndef ECONNRESET
|
||||
#define ECONNRESET 104
|
||||
#define ECONNRESET 211
|
||||
#endif
|
||||
|
||||
/** Transport endpoint is not connected */
|
||||
#ifndef ENOTCONN
|
||||
#define ENOTCONN 107
|
||||
#define ENOTCONN 212
|
||||
#endif
|
||||
|
||||
/** Connection timed out */
|
||||
#ifndef ETIMEDOUT
|
||||
#define ETIMEDOUT 110
|
||||
#define ETIMEDOUT 213
|
||||
#endif
|
||||
|
||||
/** Connection refused */
|
||||
#ifndef ECONNREFUSED
|
||||
#define ECONNREFUSED 111
|
||||
#define ECONNREFUSED 214
|
||||
#endif
|
||||
|
||||
/** Operation already in progress */
|
||||
#ifndef EALREADY
|
||||
#define EALREADY 114
|
||||
#define EALREADY 215
|
||||
#endif
|
||||
|
||||
/** Operation now in progress */
|
||||
#ifndef EINPROGRESS
|
||||
#define EINPROGRESS 115
|
||||
#define EINPROGRESS 216
|
||||
#endif
|
||||
|
||||
/** Authentication error */
|
||||
#ifndef EAUTH
|
||||
#define EAUTH 116
|
||||
#define EAUTH 217
|
||||
#endif
|
||||
|
|
|
@ -147,6 +147,7 @@ static size_t local_ftoa(char *buf, double n, size_t dp)
|
|||
* %J (struct sa *) Socket address and port - like 1.2.3.4:1234
|
||||
* %H (re_printf_h *, void *) Print handler with argument
|
||||
* %v (char *fmt, va_list *) Variable argument list
|
||||
* %m (int) Describe an error code
|
||||
* </pre>
|
||||
*
|
||||
* Reserved for the future:
|
||||
|
@ -311,6 +312,14 @@ int re_vhprintf(const char *fmt, va_list ap, re_vprintf_h *vph, void *arg)
|
|||
fm = true;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
(void)strerror_r(va_arg(ap, int), addr, sizeof(addr));
|
||||
addr[sizeof(addr)-1] = '\0';
|
||||
|
||||
err |= write_padded(addr, strlen(addr), pad, ' ',
|
||||
plr, NULL, vph, arg);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
ptr = va_arg(ap, void *);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue